freetds-1.3.6/000755 025423 025423 00000000000 14162303422 014600 5ustar00fredianofrediano000000 000000 freetds-1.3.6/m4/000755 025423 025423 00000000000 14162303400 015114 5ustar00fredianofrediano000000 000000 freetds-1.3.6/Makefile.am000644 025423 025423 00000004016 14056414221 016637 0ustar00fredianofrediano000000 000000 ## SUBDIRS determines in which directories automake will generate a Makefile ## See also AC_OUTPUT in configure.ac SUBDIRS = include src doc samples win32 vms misc ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = interfaces PWD.in BUGS.md \ freetds.conf locales.conf \ autogen.sh freetds.spec.in freetds.spec tds.dox \ config.rpath CMakeLists.txt Thanks-1.0 \ AUTHORS.md INSTALL.md NEWS.md README.md TODO.md \ COPYING_LIB.txt COPYING.txt ETC = $(DESTDIR)$(sysconfdir) DOCDIR = doc install-data-local: $(mkinstalldirs) $(ETC) if test ! -f $(ETC)/freetds.conf; then \ $(INSTALL) -m 644 $(srcdir)/freetds.conf $(ETC)/freetds.conf; \ fi if test ! -f $(ETC)/locales.conf; then \ $(INSTALL) -m 644 $(srcdir)/locales.conf $(ETC)/locales.conf; \ fi clean-local: find . \( -name \*.test_output -o -name \*.bb -o -name \*.bbg -o -name \*.da -o -name \*.gc\* \) -exec rm -f {} \; # enable some cheat so make distcheck work (see below) DISTCHECK_CONFIGURE_FLAGS = \ --enable-distcheck-build --enable-extra-checks # do not uninstall configuration files (they may have been changed) if DISTCHECK_BUILD uninstall-local: rm -f $(ETC)/freetds.conf $(ETC)/locales.conf $(ETC)/pool.conf PWD endif test: @echo "The 'make test' option has been replaced with 'make check'"; all: if DISTCHECK_BUILD # if we are inside a make distcheck copy our real password file if test ! -f PWD -a -f $(srcdir)/../PWD; then cp $(srcdir)/../PWD PWD; fi endif # this prevent the store of passwords in the source repository if test ! -f PWD; then cp $(srcdir)/PWD.in PWD; fi snapshot: $(MAKE) dist distdir=$(PACKAGE)-`date +"%Y%m%d"` ## The doxygen configuration file understands environment variables. doxy: $(SUBDIRS) if HAVE_DOXYGEN $(MKDIR_P) $(DOCDIR)/reference rm -rf $(DOCDIR)/reference/* SRCDIR=$(top_srcdir) VERSION=$(VERSION) $(DOXYGEN) $(top_srcdir)/tds.dox if test -d $(DOCDIR)/reference/html ; then mv $(DOCDIR)/reference/html/* $(DOCDIR)/reference; rmdir $(DOCDIR)/reference/html; fi else echo 'Doxygen not installed; reference manual not built.' endif freetds-1.3.6/configure000755 025423 025423 00002547163 14162303355 016536 0ustar00fredianofrediano000000 000000 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for FreeTDS 1.3.6. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='FreeTDS' PACKAGE_TARNAME='freetds' PACKAGE_VERSION='1.3.6' PACKAGE_STRING='FreeTDS 1.3.6' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="src/dblib/dblib.c" ac_default_prefix=/usr/local # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS DISTCHECK_BUILD_FALSE DISTCHECK_BUILD_TRUE ODBC_WIDE_TESTS_FALSE ODBC_WIDE_TESTS_TRUE ENABLE_DEVELOPING_FALSE ENABLE_DEVELOPING_TRUE GCRYPT_LIBS GCRYPT_CFLAGS INCPOOL_FALSE INCPOOL_TRUE ENABLE_THREADSAFE_FALSE ENABLE_THREADSAFE_TRUE SYBASE_COMPAT_FALSE SYBASE_COMPAT_TRUE dblib_define INCSERVER_FALSE INCSERVER_TRUE INCAPPS_FALSE INCAPPS_TRUE HAVE_OPENSSL OPENSSL_LIBS OPENSSL_CFLAGS NETTLE_LIBS NETTLE_CFLAGS GNUTLS_LIBS GNUTLS_CFLAGS ODBCINST_LDFLAGS ODBC_LDFLAGS ODBC_INC ODBC UNIXODBC_FALSE UNIXODBC_TRUE ODBC_FALSE ODBC_TRUE FREETDS_ODBC_MODULE INCODBC_FALSE INCODBC_TRUE IODBC_LIBS IODBC_CFLAGS ALLOCA LIBOBJS FREETDS_LIBGCC FREETDS_SYMBOLIC tds_sysdep_intptr_type tds_sysdep_int64_type tds_sysdep_real64_type tds_sysdep_real32_type tds_sysdep_int32_type tds_sysdep_int16_type HAVE_SSPI_FALSE HAVE_SSPI_TRUE AM_CFLAGS PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC acx_pthread_config READLINE_LIBS NETWORK_LIBS MINGW32_FALSE MINGW32_TRUE HAVE_PERL_SOURCES GPERF HAVE_PERL_SOURCES_FALSE HAVE_PERL_SOURCES_TRUE ODBC_CONFIG HAVE_DOXYGEN_FALSE HAVE_DOXYGEN_TRUE DOXYGEN LTLIBICONV LIBICONV RC LIBADD_DL LT_DLPREOPEN LIBADD_DLD_LINK LIBADD_SHL_LOAD LIBADD_DLOPEN LT_DLLOADERS LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR NM ac_ct_DUMPBIN DUMPBIN LD FGREP LIBTOOL OBJDUMP DLLTOOL AS EGREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MACOSX_FALSE MACOSX_TRUE host_os host_vendor host_cpu host build_os build_vendor build_cpu build PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG SED LN_S GREP BUILD_NUMBER SUBVERSION MINOR MAJOR AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_largefile enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_libiconv enable_rpath with_libiconv_prefix enable_krb5 enable_sspi with_tdsver with_iodbc with_unixodbc with_odbc_nodm enable_odbc with_gnutls with_openssl enable_apps enable_server enable_pool enable_msdblib enable_sybase_compat enable_threadsafe enable_debug enable_extra_checks enable_developing enable_mars enable_odbc_wide enable_odbc_wide_tests enable_distcheck_build ' ac_precious_vars='build_alias host_alias target_alias PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP LT_SYS_LIBRARY_PATH IODBC_CFLAGS IODBC_LIBS GNUTLS_CFLAGS GNUTLS_LIBS NETTLE_CFLAGS NETTLE_LIBS OPENSSL_CFLAGS OPENSSL_LIBS GCRYPT_CFLAGS GCRYPT_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures FreeTDS 1.3.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/freetds] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of FreeTDS 1.3.6:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-largefile omit support for large files --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-libiconv do not attempt to include libiconv --disable-rpath do not hardcode runtime library paths --enable-krb5[=LIB] enable Kerberos support, optionally with library --disable-sspi disable SSPI support --disable-odbc do not attempt to build odbc the driver --disable-apps skip build of src/apps (including tsql) --disable-server skip build of src/server directory --disable-pool skip build of src/pool directory --enable-msdblib for MS style dblib --enable-sybase-compat enable increased Open Client binary compatibility --disable-threadsafe disable calls to threadsafe fuctions e.g.,gethostbyname_r --disable-debug disable assert and other things --enable-extra-checks enable extra checks on code --enable-developing enable code still in develop --disable-mars enable MARS code --disable-odbc-wide disable wide string support in odbc --enable-odbc-wide-tests enable compiling ODBC tests to use wide functions --enable-distcheck-build used internally for testing Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-tdsver=VERSION TDS protocol version (5.0/7.1/7.2/7.3/7.4/auto) [auto] --with-iodbc=DIR build odbc driver against iODBC in DIR --with-unixodbc=DIR build odbc driver against unixODBC in DIR --with-odbc-nodm=DIR build odbc using headers in DIR/include --with-gnutls build with GnuTLS support --with-openssl --with-openssl=DIR build with OpenSSL (license NOT compatible cf. User Guide) Some influential environment variables: PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor LT_SYS_LIBRARY_PATH User-defined run-time library search path. IODBC_CFLAGS C compiler flags for IODBC, overriding pkg-config IODBC_LIBS linker flags for IODBC, overriding pkg-config GNUTLS_CFLAGS C compiler flags for GNUTLS, overriding pkg-config GNUTLS_LIBS linker flags for GNUTLS, overriding pkg-config NETTLE_CFLAGS C compiler flags for NETTLE, overriding pkg-config NETTLE_LIBS linker flags for NETTLE, overriding pkg-config OPENSSL_CFLAGS C compiler flags for OPENSSL, overriding pkg-config OPENSSL_LIBS linker flags for OPENSSL, overriding pkg-config GCRYPT_CFLAGS C compiler flags for GCRYPT, overriding pkg-config GCRYPT_LIBS linker flags for GCRYPT, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF FreeTDS configure 1.3.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* 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_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by FreeTDS $as_me 1.3.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='freetds' VERSION='1.3.6' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' ac_config_headers="$ac_config_headers include/config.h" ASAN_OPTIONS='detect_leaks=0' export ASAN_OPTIONS ver=`echo $VERSION.0 | sed 's,^dev\.,,; s,^\([0-9][0-9]*\.[0-9][0-9]*\)rc,\1.dev.,g; s/\.dev\./.9999./'` match='^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*' if test "`echo $ver | sed \"s,$match,,\"`" != ""; then as_fn_error $? "Invalid version $VERSION specified" "$LINENO" 5 fi MAJOR=`echo $ver | sed "s,$match,\1,"` MINOR=`echo $ver | sed "s,$match,\2,"` SUBVERSION=`echo $ver | sed "s,$match,\3,"` BUILD_NUMBER="`date +1%j` - 1000 + ( `date +%Y` - 2021 )" BUILD_NUMBER="`expr $BUILD_NUMBER \* 366`" if test "$SUBVERSION" = "9999"; then MINOR=`expr $MINOR - 1` fi # ------------------------------------------------------------ # Commands and Utilities # ------------------------------------------------------------ for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # ------------------------------------------------------------ # Host-specific configuration # ------------------------------------------------------------ # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac netdb_reentrant=no case $host in *-*-osf*) CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_POSIX_C_SOURCE=199506L" netdb_reentrant=yes ;; *-*-hpux11*) netdb_reentrant=yes ;; *-*-cygwin*) netdb_reentrant=yes ;; esac case $host_os in darwin* | rhapsody*) if true; then MACOSX_TRUE= MACOSX_FALSE='#' else MACOSX_TRUE='#' MACOSX_FALSE= fi ;; *) if false; then MACOSX_TRUE= MACOSX_FALSE='#' else MACOSX_TRUE='#' MACOSX_FALSE= fi ;; esac if test $netdb_reentrant = yes; then $as_echo "#define NETDB_REENTRANT 1" >>confdefs.h fi DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi # ------------------------------------------------------------ # Checks for programs. # ------------------------------------------------------------ ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump enable_dlopen=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: LT_DLLOADERS= ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu lt_dlload_save_LIBS=$LIBS LIBADD_DLOPEN= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 $as_echo_n "checking for library containing dlopen... " >&6; } if ${ac_cv_search_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF for ac_lib in '' dl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_dlopen=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_dlopen+:} false; then : break fi done if ${ac_cv_search_dlopen+:} false; then : else ac_cv_search_dlopen=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 $as_echo "$ac_cv_search_dlopen" >&6; } ac_res=$ac_cv_search_dlopen if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_LIBDL 1" >>confdefs.h if test "$ac_cv_search_dlopen" != "none required"; then LIBADD_DLOPEN=-ldl fi libltdl_cv_lib_dl_dlopen=yes LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_DLFCN_H # include #endif int main () { dlopen(0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_LIBDL 1" >>confdefs.h libltdl_cv_func_dlopen=yes LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : $as_echo "#define HAVE_LIBDL 1" >>confdefs.h LIBADD_DLOPEN=-lsvld libltdl_cv_func_dlopen=yes LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la" fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen" then lt_save_LIBS=$LIBS LIBS="$LIBS $LIBADD_DLOPEN" for ac_func in dlerror do : ac_fn_c_check_func "$LINENO" "dlerror" "ac_cv_func_dlerror" if test "x$ac_cv_func_dlerror" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLERROR 1 _ACEOF fi done LIBS=$lt_save_LIBS fi LIBADD_SHL_LOAD= ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : $as_echo "#define HAVE_SHL_LOAD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : $as_echo "#define HAVE_SHL_LOAD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" LIBADD_SHL_LOAD=-ldld fi fi case $host_os in darwin[1567].*) # We only want this for pre-Mac OS X 10.4. ac_fn_c_check_func "$LINENO" "_dyld_func_lookup" "ac_cv_func__dyld_func_lookup" if test "x$ac_cv_func__dyld_func_lookup" = xyes; then : $as_echo "#define HAVE_DYLD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la" fi ;; beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | pw32*) ac_fn_c_check_decl "$LINENO" "cygwin_conv_path" "ac_cv_have_decl_cygwin_conv_path" "#include " if test "x$ac_cv_have_decl_cygwin_conv_path" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_CYGWIN_CONV_PATH $ac_have_decl _ACEOF LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : $as_echo "#define HAVE_DLD 1" >>confdefs.h LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la" fi LT_DLPREOPEN= if test -n "$LT_DLLOADERS" then for lt_loader in $LT_DLLOADERS; do LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " done $as_echo "#define HAVE_LIBDLLOADER 1" >>confdefs.h fi LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" LIBS=$lt_dlload_save_LIBS ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RC"; then ac_cv_prog_RC="$RC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RC="${ac_tool_prefix}windres" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RC=$ac_cv_prog_RC if test -n "$RC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 $as_echo "$RC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RC"; then ac_ct_RC=$RC # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RC"; then ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RC="windres" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RC=$ac_cv_prog_ac_ct_RC if test -n "$ac_ct_RC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 $as_echo "$ac_ct_RC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RC" = x; then RC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RC=$ac_ct_RC fi else RC="$ac_cv_prog_RC" fi # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o objext_RC=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC compiler_RC=$CC func_cc_basename $compiler cc_basename=$func_cc_basename_result lt_cv_prog_compiler_c_o_RC=yes if test -n "$compiler"; then : fi GCC=$lt_save_GCC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS # Check whether --enable-libiconv was given. if test "${enable_libiconv+set}" = set; then : enableval=$enable_libiconv; use_libiconv=$enableval else use_libiconv=yes fi if test "$use_libiconv" = "yes" ; then if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 $as_echo_n "checking for ld... " >&6; } elif test "$GCC" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if test -n "$LD"; then # Let the user override the test with a path. : else if ${acl_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else acl_cv_path_LD= # Final result of this test ac_prog=ld # Program to search in $PATH if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) acl_output=`($CC -print-prog-name=ld) 2>&5` ;; esac case $acl_output in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` done # Got the pathname. No search in PATH is needed. acl_cv_path_LD="$acl_output" ac_prog= ;; "") # If it fails, then pretend we aren't using GCC. ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac fi if test -n "$ac_prog"; then # Search for $ac_prog in $PATH. acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext /* end confdefs.h. */ #if defined __powerpc64__ || defined _ARCH_PPC64 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # The compiler produces 64-bit code. Add option '-b64' so that the # linker groks 64-bit object files. case "$acl_cv_path_LD " in *" -b64 "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; sparc64-*-netbsd*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else # The compiler produces 32-bit code. Add option '-m elf32_sparc' # so that the linker groks 32-bit object files. case "$acl_cv_path_LD " in *" -m elf32_sparc "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; esac fi LD="$acl_cv_path_LD" fi if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${acl_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 $as_echo_n "checking for shared library run path origin... " >&6; } if ${acl_cv_rpath+:} false; then : $as_echo_n "(cached) " >&6 else CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 $as_echo "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; : else enable_rpath=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 $as_echo_n "checking 32-bit host C ABI... " >&6; } if ${gl_cv_host_cpu_c_abi_32bit+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$gl_cv_host_cpu_c_abi"; then case "$gl_cv_host_cpu_c_abi" in i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) gl_cv_host_cpu_c_abi_32bit=yes ;; *) gl_cv_host_cpu_c_abi_32bit=no ;; esac else case "$host_cpu" in i[4567]86 ) gl_cv_host_cpu_c_abi_32bit=yes ;; x86_64 ) # On x86_64 systems, the C compiler may be generating code in one of # these ABIs: # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 # with native Windows (mingw, MSVC). # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if (defined __x86_64__ || defined __amd64__ \ || defined _M_X64 || defined _M_AMD64) \ && !(defined __ILP32__ || defined _ILP32) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; arm* | aarch64 ) # Assume arm with EABI. # On arm64 systems, the C compiler may be generating code in one of # these ABIs: # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) # On hppa, the C compiler may be generating 32-bit code or 64-bit # code. In the latter case, it defines _LP64 and __LP64__. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; ia64* ) # On ia64 on HP-UX, the C compiler may be generating 64-bit code or # 32-bit code. In the latter case, it defines _ILP32. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _ILP32 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=yes else gl_cv_host_cpu_c_abi_32bit=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; mips* ) # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this # at 32. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; powerpc* ) # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. # No need to distinguish them here; the caller may distinguish # them based on the OS. # On powerpc64 systems, the C compiler may still be generating # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may # be generating 64-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __powerpc64__ || defined _ARCH_PPC64 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; rs6000 ) gl_cv_host_cpu_c_abi_32bit=yes ;; riscv32 | riscv64 ) # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. # Size of 'long' and 'void *': cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; s390* ) # On s390x, the C compiler may be generating 64-bit (= s390x) code # or 31-bit (= s390) code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __LP64__ || defined __s390x__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; sparc | sparc64 ) # UltraSPARCs running Linux have `uname -m` = "sparc64", but the # C compiler still generates 32-bit code. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_host_cpu_c_abi_32bit=no else gl_cv_host_cpu_c_abi_32bit=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; *) gl_cv_host_cpu_c_abi_32bit=no ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 $as_echo "$gl_cv_host_cpu_c_abi_32bit" >&6; } HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" case "$host_os" in solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 $as_echo_n "checking for 64-bit host... " >&6; } if ${gl_cv_solaris_64bit+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _LP64 int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : gl_cv_solaris_64bit=yes else gl_cv_solaris_64bit=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 $as_echo "$gl_cv_solaris_64bit" >&6; };; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 $as_echo_n "checking for the common suffixes of directories in the library search path... " >&6; } if ${acl_cv_libdirstems+:} false; then : $as_echo_n "(cached) " >&6 else acl_libdirstem=lib acl_libdirstem2= case "$host_os" in solaris*) if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi ;; *) if test "$HOST_CPU_C_ABI_32BIT" != yes; then searchpath=`(if test -f /usr/bin/gcc \ && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ LC_ALL=C /usr/bin/gcc -print-search-dirs; \ else \ LC_ALL=C $CC -print-search-dirs; \ fi) 2>/dev/null \ | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 $as_echo "$acl_cv_libdirstems" >&6; } # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && test ! -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi fi LIBICONV= LTLIBICONV= INCICONV= LIBICONV_PREFIX= HAVE_LIBICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if ${am_cv_func_iconv+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 $as_echo "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 $as_echo_n "checking for working iconv... " >&6; } if ${am_cv_func_iconv_works+:} false; then : $as_echo_n "(cached) " >&6 else am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do if test "$cross_compiling" = yes; then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif int main () { int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ { /* Try standardized names. */ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); /* Try IRIX, OSF/1 names. */ iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); /* Try AIX names. */ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); /* Try HP-UX names. */ iconv_t cd4 = iconv_open ("utf8", "eucJP"); if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) result |= 16; if (cd1 != (iconv_t)(-1)) iconv_close (cd1); if (cd2 != (iconv_t)(-1)) iconv_close (cd2); if (cd3 != (iconv_t)(-1)) iconv_close (cd3); if (cd4 != (iconv_t)(-1)) iconv_close (cd4); } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : am_cv_func_iconv_works=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi test "$am_cv_func_iconv_works" = no || break done LIBS="$am_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 $as_echo "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then $as_echo "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 $as_echo_n "checking how to link with libiconv... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 $as_echo "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi if test "$am_cv_func_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv declaration" >&5 $as_echo_n "checking for iconv declaration... " >&6; } if ${am_cv_proto_iconv+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : am_cv_proto_iconv_arg1="" else am_cv_proto_iconv_arg1="const" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_proto_iconv" >&5 $as_echo " $am_cv_proto_iconv" >&6; } else am_cv_proto_iconv_arg1="" fi cat >>confdefs.h <<_ACEOF #define ICONV_CONST $am_cv_proto_iconv_arg1 _ACEOF else { $as_echo "$as_me:${as_lineno-$LINENO}: libiconv disabled" >&5 $as_echo "$as_me: libiconv disabled" >&6;} cat >>confdefs.h <<_ACEOF #define ICONV_CONST const _ACEOF fi # See if we have doxygen installed # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DOXYGEN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DOXYGEN"; then ac_cv_prog_DOXYGEN="$DOXYGEN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DOXYGEN="doxygen" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DOXYGEN=$ac_cv_prog_DOXYGEN if test -n "$DOXYGEN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 $as_echo "$DOXYGEN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -n "$DOXYGEN"; then HAVE_DOXYGEN_TRUE= HAVE_DOXYGEN_FALSE='#' else HAVE_DOXYGEN_TRUE='#' HAVE_DOXYGEN_FALSE= fi # Extract the first word of "odbc_config", so it can be a program name with args. set dummy odbc_config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ODBC_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ODBC_CONFIG"; then ac_cv_prog_ODBC_CONFIG="$ODBC_CONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ODBC_CONFIG="odbc_config" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ODBC_CONFIG=$ac_cv_prog_ODBC_CONFIG if test -n "$ODBC_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ODBC_CONFIG" >&5 $as_echo "$ODBC_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # ------------------------------------------------------------ # Check for git-only sources. # ------------------------------------------------------------ # # Distribution tarballs include some generated files. These # files are not maintained in git, but their bases are, and # the bases are not in the tarball. For example, num_limits.h # is distributed, but it is generated from numeric.pl, which # is kept in git. # If the base is found, we use it as a source in the Makefile, # otherwise the Makefile will (correctly) assume that the # generated file is already present. # if test -f "${srcdir}/src/tds/num_limits.pl"; then if true; then HAVE_PERL_SOURCES_TRUE= HAVE_PERL_SOURCES_FALSE='#' else HAVE_PERL_SOURCES_TRUE='#' HAVE_PERL_SOURCES_FALSE= fi # Extract the first word of "gperf", so it can be a program name with args. set dummy gperf; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GPERF+:} false; then : $as_echo_n "(cached) " >&6 else case $GPERF in [\\/]* | ?:[\\/]*) ac_cv_path_GPERF="$GPERF" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GPERF="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GPERF=$ac_cv_path_GPERF if test -n "$GPERF"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPERF" >&5 $as_echo "$GPERF" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$GPERF" = x; then : as_fn_error $? "required program 'gperf' not found." "$LINENO" 5 fi else if false; then HAVE_PERL_SOURCES_TRUE= HAVE_PERL_SOURCES_FALSE='#' else HAVE_PERL_SOURCES_TRUE='#' HAVE_PERL_SOURCES_FALSE= fi fi # ------------------------------------------------------------ # Checks for libraries. # ------------------------------------------------------------ # Check whether --enable-krb5 was given. if test "${enable_krb5+set}" = set; then : enableval=$enable_krb5; fi krb5_libs=auto case $enable_krb5 in yes) ;; "" | no) krb5_libs= ;; -* | */* | *.a | *.so | *.so.* | *.o) krb5_libs="$enable_krb5" ;; *) krb5_libs="-l$enable_krb5" ;; esac LIBS_172="$LIBS" LIBS="" tds_mingw=no case $host in *-*-mingw*) tds_mingw=yes if test "$host_cpu" = "x86_64"; then LIBS="-lws2_32" elif test -r /usr/lib/w32api/libws2_32.a; then LIBS="-L/usr/lib/w32api -lws2_32" else LIBS="-lws2_32" fi LIBS="$LIBS -lcrypt32" krb5_libs= if true; then MINGW32_TRUE= MINGW32_FALSE='#' else MINGW32_TRUE='#' MINGW32_FALSE= fi ;; *-*-hpux*) # these lines are needed to fix a problem for HP-UX # HP-UX define two versions of sockets, one BSD and one X/Open # these versions are not binary compatible (BSD use int where X/Open # use socklen_t == size_t) and different libraries (BSD in libc and # X/Open in libxnet). X/Open is used if _XOPEN_SOURCE and # _XOPEN_SOURCE_EXTENDED are defined. To complicate the things gcc # by default define _XOPEN_SOURCE_EXTENDED so define always both # constants and link always libxnet! CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED" LIBS="$LIBS -lxnet" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if ${ac_cv_search_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostbyname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostbyname+:} false; then : break fi done if ${ac_cv_search_gethostbyname+:} false; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # check for _xpg_ functions for ac_func in _xpg_accept _xpg_getpeername _xpg_getsockname _xpg_getsockopt _xpg_recvfrom \ __accept __getpeername __getsockname __getsockopt __recvfrom do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if false; then MINGW32_TRUE= MINGW32_FALSE='#' else MINGW32_TRUE='#' MINGW32_FALSE= fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if ${ac_cv_search_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostbyname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostbyname+:} false; then : break fi done if ${ac_cv_search_gethostbyname+:} false; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi if false; then MINGW32_TRUE= MINGW32_FALSE='#' else MINGW32_TRUE='#' MINGW32_FALSE= fi ;; esac case "$krb5_libs" in "" ) ;; "auto") { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gss_init_sec_context" >&5 $as_echo_n "checking for library containing gss_init_sec_context... " >&6; } if ${ac_cv_search_gss_init_sec_context+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gss_init_sec_context (); int main () { return gss_init_sec_context (); ; return 0; } _ACEOF for ac_lib in '' gssapi_krb5 gssapi; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gss_init_sec_context=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gss_init_sec_context+:} false; then : break fi done if ${ac_cv_search_gss_init_sec_context+:} false; then : else ac_cv_search_gss_init_sec_context=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gss_init_sec_context" >&5 $as_echo "$ac_cv_search_gss_init_sec_context" >&6; } ac_res=$ac_cv_search_gss_init_sec_context if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi if test "$ac_cv_search_gss_init_sec_context" != no; then $as_echo "#define ENABLE_KRB5 1" >>confdefs.h fi ;; *) $as_echo "#define ENABLE_KRB5 1" >>confdefs.h LIBS="$LIBS $krb5_libs" ;; esac if test -n "$krb5_libs"; then for d in /usr/include/heimdal /usr/include/krb5 /usr/include/et; do if test -d "$d"; then CPPFLAGS="$CPPFLAGS -I$d" fi done for ac_func in error_message do : ac_fn_c_check_func "$LINENO" "error_message" "ac_cv_func_error_message" if test "x$ac_cv_func_error_message" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ERROR_MESSAGE 1 _ACEOF fi done fi NETWORK_LIBS="$LIBS" LIBS="$LIBS_172" unset LIBS_172 if test $tds_mingw = no; then # readline test # Readline is needed by the tty session. Set up a special READLINE_LIBS # substitution for it. # Readline is linked with curses, and on some systems termcap must be # linked in. Others (inc debian) have termcap built into ncurses. LIBS_247="$LIBS" LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 $as_echo_n "checking for library containing tgetent... " >&6; } if ${ac_cv_search_tgetent+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char tgetent (); int main () { return tgetent (); ; return 0; } _ACEOF for ac_lib in '' readline ncurses curses termcap; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_tgetent=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_tgetent+:} false; then : break fi done if ${ac_cv_search_tgetent+:} false; then : else ac_cv_search_tgetent=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tgetent" >&5 $as_echo "$ac_cv_search_tgetent" >&6; } ac_res=$ac_cv_search_tgetent if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5 $as_echo_n "checking for readline in -lreadline... " >&6; } if ${ac_cv_lib_readline_readline+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char readline (); int main () { return readline (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_readline_readline=yes else ac_cv_lib_readline_readline=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5 $as_echo "$ac_cv_lib_readline_readline" >&6; } if test "x$ac_cv_lib_readline_readline" = xyes; then : LIBS="$LIBS -lreadline" $as_echo "#define HAVE_READLINE 1" >>confdefs.h else LIBS="" fi for ac_func in rl_on_new_line rl_reset_line_state do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_READLINE #include #include #endif /* HAVE_READLINE */ int main() { rl_inhibit_completion = 1; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_RL_INHIBIT_COMPLETION 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext READLINE_LIBS="$LIBS" LIBS="$LIBS_247" unset LIBS_247 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; # The HP-UX compiler just warns about options it does not understand # but it needs -mt. *-hpux*) acx_pthread_flags="-mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; -*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_acx_pthread_config+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$acx_pthread_config"; then ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_acx_pthread_config="yes" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" fi fi acx_pthread_config=$ac_cv_prog_acx_pthread_config if test -n "$acx_pthread_config"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5 $as_echo "$acx_pthread_config" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 $as_echo_n "checking for the pthreads library -l$flag... " >&6; } PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : acx_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int attr=$attr; return attr; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : attr_name=$attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 $as_echo "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then cat >>confdefs.h <<_ACEOF #define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 $as_echo_n "checking if more special flags are required for pthreads... " >&6; } flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5 $as_echo "${flag}" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then for ac_prog in xlc_r cc_r do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_PTHREAD_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 $as_echo "$PTHREAD_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h : else acx_pthread_ok=no fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_condattr_setclock" >&5 $as_echo_n "checking for library containing pthread_condattr_setclock... " >&6; } if ${ac_cv_search_pthread_condattr_setclock+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_condattr_setclock (); int main () { return pthread_condattr_setclock (); ; return 0; } _ACEOF for ac_lib in '' rt posix4 pthread; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_pthread_condattr_setclock=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_pthread_condattr_setclock+:} false; then : break fi done if ${ac_cv_search_pthread_condattr_setclock+:} false; then : else ac_cv_search_pthread_condattr_setclock=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_condattr_setclock" >&5 $as_echo "$ac_cv_search_pthread_condattr_setclock" >&6; } ac_res=$ac_cv_search_pthread_condattr_setclock if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi for ac_func in pthread_condattr_setclock pthread_cond_timedwait_relative_np do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi # check for SSPI # Check whether --enable-sspi was given. if test "${enable_sspi+set}" = set; then : enableval=$enable_sspi; fi # disable by default enable_sspi=${enable_sspi-yes} # only if MingW (TODO other compilers) test $tds_mingw != yes && enable_sspi=no if test "$enable_sspi" = "yes"; then HAVE_SSPI_TRUE= HAVE_SSPI_FALSE='#' else HAVE_SSPI_TRUE='#' HAVE_SSPI_FALSE= fi if test "$enable_sspi" = "yes"; then $as_echo "#define HAVE_SSPI 1" >>confdefs.h fi # ------------------------------------------------------------ # Checks for header files. # ------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include #include <$ac_cv_struct_tm> " if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 _ACEOF fi if test "$ac_cv_member_struct_tm_tm_zone" = yes; then $as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " if test "x$ac_cv_have_decl_tzname" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_TZNAME $ac_have_decl _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } if ${ac_cv_var_tzname+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #if !HAVE_DECL_TZNAME extern char *tzname[]; #endif int main () { return tzname[0][0]; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_var_tzname=yes else ac_cv_var_tzname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5 $as_echo "$ac_cv_var_tzname" >&6; } if test $ac_cv_var_tzname = yes; then $as_echo "#define HAVE_TZNAME 1" >>confdefs.h fi fi ac_fn_c_check_member "$LINENO" "struct tm" "__tm_zone" "ac_cv_member_struct_tm___tm_zone" "#include #include <$ac_cv_struct_tm> " if test "x$ac_cv_member_struct_tm___tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM___TM_ZONE 1 _ACEOF fi for ac_header in errno.h libgen.h \ limits.h locale.h poll.h \ signal.h stddef.h \ sys/param.h sys/select.h sys/stat.h \ sys/time.h sys/types.h sys/resource.h \ sys/eventfd.h \ sys/wait.h unistd.h netdb.h \ wchar.h inttypes.h winsock2.h \ localcharset.h valgrind/memcheck.h malloc.h dirent.h \ stdbool.h gnutls/abstract.h getopt.h fcntl.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in windows.h sql.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#ifdef HAVE_WINDOWS_H # include #endif #ifdef HAVE_SQL_H # include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test $tds_mingw = no; then for ac_header in arpa/inet.h \ langinfo.h \ netdb.h \ netinet/in.h \ netinet/tcp.h \ roken.h \ com_err.h \ paths.h \ sys/ioctl.h \ sys/socket.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether INADDR_NONE is defined" >&5 $as_echo_n "checking whether INADDR_NONE is defined... " >&6; } if ${ac_cv_have_inaddr_none+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* our includes */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif /* end includes */ int main () { unsigned long foo = INADDR_NONE; /* our test code */ ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_have_inaddr_none=yes else ac_cv_have_inaddr_none=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_inaddr_none" >&5 $as_echo "$ac_cv_have_inaddr_none" >&6; } if test $ac_cv_have_inaddr_none != yes; then $as_echo "#define INADDR_NONE 0xffffffff" >>confdefs.h fi # ------------------------------------------------------------ # Checks for integers/floats of different sizes # ------------------------------------------------------------ # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5 $as_echo_n "checking size of char... " >&6; } if ${ac_cv_sizeof_char+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then : else if test "$ac_cv_type_char" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (char) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_char=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5 $as_echo "$ac_cv_sizeof_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_CHAR $ac_cv_sizeof_char _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } if ${ac_cv_sizeof_float+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : else if test "$ac_cv_type_float" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_float=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_float" >&5 $as_echo "$ac_cv_sizeof_float" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_FLOAT $ac_cv_sizeof_float _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : else if test "$ac_cv_type_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5 $as_echo "$ac_cv_sizeof_double" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_DOUBLE $ac_cv_sizeof_double _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } if ${ac_cv_sizeof_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : else if test "$ac_cv_type_long_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long double) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_double=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_double" >&5 $as_echo "$ac_cv_sizeof_long_double" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __int64" >&5 $as_echo_n "checking size of __int64... " >&6; } if ${ac_cv_sizeof___int64+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int64))" "ac_cv_sizeof___int64" "$ac_includes_default"; then : else if test "$ac_cv_type___int64" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (__int64) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof___int64=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int64" >&5 $as_echo "$ac_cv_sizeof___int64" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF___INT64 $ac_cv_sizeof___int64 _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } if ${ac_cv_sizeof_void_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : else if test "$ac_cv_type_void_p" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_void_p=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 $as_echo "$ac_cv_sizeof_void_p" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 $as_echo_n "checking size of wchar_t... " >&6; } if ${ac_cv_sizeof_wchar_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default #ifdef HAVE_WCHAR_H #include #endif "; then : else if test "$ac_cv_type_wchar_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_wchar_t=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5 $as_echo "$ac_cv_sizeof_wchar_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t _ACEOF case 2 in $ac_cv_sizeof_short) tds_sysdep_int16_type=short;; $ac_cv_sizeof_int) tds_sysdep_int16_type=int;; *) as_fn_error $? "No 16-bit int found." "$LINENO" 5 esac case 4 in $ac_cv_sizeof_short) tds_sysdep_int32_type=short;; $ac_cv_sizeof_int) tds_sysdep_int32_type=int;; $ac_cv_sizeof_long) tds_sysdep_int32_type=long;; *) as_fn_error $? "No 32-bit int found." "$LINENO" 5 esac case 4 in $ac_cv_sizeof_float) tds_sysdep_real32_type=float;; $ac_cv_sizeof_double) tds_sysdep_real32_type=double;; $ac_cv_sizeof_long_double) tds_sysdep_real32_type="long double";; *) as_fn_error $? "No 32-bit real found." "$LINENO" 5 esac case 8 in $ac_cv_sizeof_float) tds_sysdep_real64_type=float;; $ac_cv_sizeof_double) tds_sysdep_real64_type=double;; $ac_cv_sizeof_long_double) tds_sysdep_real64_type="long double";; *) as_fn_error $? "No 64-bit real found." "$LINENO" 5 esac case 8 in $ac_cv_sizeof_long) tds_sysdep_int64_type=long;; $ac_cv_sizeof_long_long) tds_sysdep_int64_type="long long";; $ac_cv_sizeof___int64) tds_sysdep_int64_type=__int64;; *) as_fn_error $? "No 64-bit integer found." "$LINENO" 5 esac tds_i64_format= # Win32 case cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if !defined(__MINGW32__) || !defined(__MSVCRT__) this should produce an error! #endif int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tds_i64_format="I64" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # long is 64 bit if test "x$ac_cv_sizeof_long" = "x8"; then tds_i64_format=l fi # long long support if test "x$tds_i64_format" = "x"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #if !defined(__GLIBC__) || __GLIBC__ < 2 || !defined(__GLIBC_MINOR__) || __GLIBC_MINOR__ < 2 # if !defined(__APPLE__) # error no proper glibc or darwin system # endif #endif int main() { char buf[64]; long long ll = atoll(buf); return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tds_i64_format="ll" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # extract from inttypes.h if test "x$tds_i64_format" = "x"; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include char test_fmt[] = "Start PRId64:" PRId64 ":End PRId64"; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : for arg in l ll I64 L; do if grep "Start PRId64:${arg}d:End PRId64" conftest.$ac_objext >/dev/null ; then tds_i64_format=$arg fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x$tds_i64_format" = "x"; then for arg in l ll I64 L; do if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main() { char buf[20]; $tds_sysdep_int64_type ll = ((($tds_sysdep_int64_type) 0x12345) << 32) + 0x6789abcd; sprintf(buf, "%${arg}d", ll); return strcmp(buf, "320255973501901") != 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : tds_i64_format="$arg"; break fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi done fi if test "x$tds_i64_format" != "x"; then cat >>confdefs.h <<_ACEOF #define TDS_I64_PREFIX "$tds_i64_format" _ACEOF fi case $ac_cv_sizeof_void_p in $ac_cv_sizeof_short) tds_sysdep_intptr_type=short;; $ac_cv_sizeof_int) tds_sysdep_intptr_type=int;; $ac_cv_sizeof_long) tds_sysdep_intptr_type=long;; $ac_cv_sizeof_long_long) tds_sysdep_intptr_type="long long";; $ac_cv_sizeof___int64) tds_sysdep_intptr_type=__int64;; *) as_fn_error $? "No intptr type found." "$LINENO" 5 esac # ------------------------------------------------------------ # Checks for typedefs and structures # ------------------------------------------------------------ # ---- Solaris needs -DBSD_COMP to get FIONBIO defined ---- { $as_echo "$as_me:${as_lineno-$LINENO}: checking is FIONBIO defined" >&5 $as_echo_n "checking is FIONBIO defined... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef FIONBIO yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define BSD_COMP #include #ifdef FIONBIO yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : $as_echo "#define BSD_COMP 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: need -DBSD_COMP" >&5 $as_echo "need -DBSD_COMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f conftest* fi rm -f conftest* ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_WINSOCK2_H # include # include #endif " if test "x$ac_cv_type_socklen_t" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5 $as_echo_n "checking for socklen_t equivalent... " >&6; } if ${xml_cv_socklen_t_equiv+:} false; then : $as_echo_n "(cached) " >&6 else # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername xml_cv_socklen_t_equiv= for arg2 in "struct sockaddr" void; do for t in int size_t unsigned long "unsigned long"; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_WINSOCK2_H # include # include int PASCAL getpeername (SOCKET, $arg2 *, $t *); #elif defined(HAVE_SYS_SOCKET_H) # include int getpeername (int, $arg2 *, $t *); #endif int main () { $t len; getpeername(0,0,&len); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : xml_cv_socklen_t_equiv="$t" break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done if test "x$xml_cv_socklen_t_equiv" = x; then as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xml_cv_socklen_t_equiv" >&5 $as_echo "$xml_cv_socklen_t_equiv" >&6; } cat >>confdefs.h <<_ACEOF #define socklen_t $xml_cv_socklen_t_equiv _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt has optreset support" >&5 $as_echo_n "checking whether getopt has optreset support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_GETOPT_H #include #endif int main () { optreset = 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_GETOPT_OPTRESET 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # ------------------------------------------------------------ # Checks for compiler characteristics. # ------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi case $host_os in mingw*) FREETDS_SYMBOLIC="-no-undefined" ;; hpux* | linux* | solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use -Wl,-Bsymbolic" >&5 $as_echo_n "checking whether we can use -Wl,-Bsymbolic... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 1 ; return 0; } _ACEOF rm -f conftest.$ac_objext CMD="$SHELL $(test -n "$ac_top_builddir" && echo $ac_top_builddir || echo .)/libtool --mode=link $CC -o libtest.la conftest.$ac_ext >/dev/null 2>&1" if eval $CMD && test -s libtest.la; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } FREETDS_SYMBOLIC="-Wl,-Bsymbolic" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f conftest.$ac_objext conftest.$ac_ext libtest.la rm -rf .libs ;; esac # if GNU compiler but no GNU linker add explicitly libgcc # this is required for Solaris for example if test "$GCC" = yes; then for freetds_ldflag in "-static-libgcc" "-Wl,-static-libgcc"; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use $freetds_ldflag" >&5 $as_echo_n "checking whether we can use $freetds_ldflag... " >&6; } saved_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $freetds_ldflag" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_use_freetds_flag="yes" else ac_cv_use_freetds_flag="no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$saved_LDFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_use_freetds_flag" >&5 $as_echo "$ac_cv_use_freetds_flag" >&6; } if test "$ac_cv_use_freetds_flag" = "yes"; then FREETDS_LIBGCC="$freetds_ldflag" break; fi done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ static void __attribute__((destructor)) my_uninit(void) {} _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define TDS_ATTRIBUTE_DESTRUCTOR 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether memset(0) sets pointers to NULL" >&5 $as_echo_n "checking whether memset(0) sets pointers to NULL... " >&6; } if ${tds_cv_null_is_zero+:} false; then : $as_echo_n "(cached) " >&6 else tds_cv_null_is_zero=no # compile a test program. if test "$cross_compiling" = yes; then : # try to guess the endianness by grepping values into an object file cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include struct test { char begin[16]; void *ptrs[4]; char end[16]; } xxx[] = { { "abcdefghijklmnop", { NULL, NULL, NULL, NULL }, "qrstuvwxyzabcdef" }, { "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x91\x92\x93\x94\x95\x96\x97", { NULL, NULL, NULL, NULL }, "\x98\x99\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\x81\x82\x83\x84\x85\x86" } }; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if cat -v conftest.$ac_objext|grep 'abcdefghijklmnop\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\(\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\)*qrstuvwxyzabcdef'>/dev/null ; then tds_cv_null_is_zero=yes fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #ifdef HAVE_STDDEF_H #include #endif int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2)); return memcmp(&p1,&p2,sizeof(char*))?1:0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : tds_cv_null_is_zero=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tds_cv_null_is_zero" >&5 $as_echo "$tds_cv_null_is_zero" >&6; } case $tds_cv_null_is_zero in yes) $as_echo "#define NULL_REP_IS_ZERO_BYTES 1" >>confdefs.h ;; no) ;; esac # ------------------------------------------------------------ # Checks for library functions. # ------------------------------------------------------------ for ac_func in vsnprintf _vsnprintf _vscprintf gettimeofday \ nl_langinfo locale_charset setenv putenv \ getuid getpwuid getpwuid_r fstat alarm fork \ gethrtime localtime_r setitimer eventfd \ _fseeki64 _ftelli64 setrlimit pthread_cond_timedwait \ _lock_file _unlock_file usleep nanosleep readdir_r do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return system("ls") != 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_SYSTEM 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS_506="$LIBS" LIBS="$LIBS $NETWORK_LIBS" for ac_func in inet_ntoa_r getipnodebyaddr getipnodebyname \ getaddrinfo inet_ntop gethostname poll socketpair strtok_s do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_WINSOCK2_H #include #include #endif int main () { return getaddrinfo(NULL, NULL, NULL, NULL); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$LIBS_506" unset LIBS_506 ac_fn_c_check_func "$LINENO" "asprintf" "ac_cv_func_asprintf" if test "x$ac_cv_func_asprintf" = xyes; then : $as_echo "#define HAVE_ASPRINTF 1" >>confdefs.h else case " $LIBOBJS " in *" asprintf.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS asprintf.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" if test "x$ac_cv_func_vasprintf" = xyes; then : $as_echo "#define HAVE_VASPRINTF 1" >>confdefs.h else case " $LIBOBJS " in *" vasprintf.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS vasprintf.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strtok_r" "ac_cv_func_strtok_r" if test "x$ac_cv_func_strtok_r" = xyes; then : $as_echo "#define HAVE_STRTOK_R 1" >>confdefs.h else case " $LIBOBJS " in *" strtok_r.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strtok_r.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "readpassphrase" "ac_cv_func_readpassphrase" if test "x$ac_cv_func_readpassphrase" = xyes; then : $as_echo "#define HAVE_READPASSPHRASE 1" >>confdefs.h else case " $LIBOBJS " in *" readpassphrase.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS readpassphrase.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" if test "x$ac_cv_func_strlcpy" = xyes; then : $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h else case " $LIBOBJS " in *" strlcpy.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strlcpy.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" if test "x$ac_cv_func_strlcat" = xyes; then : $as_echo "#define HAVE_STRLCAT 1" >>confdefs.h else case " $LIBOBJS " in *" strlcat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strlcat.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "basename" "ac_cv_func_basename" if test "x$ac_cv_func_basename" = xyes; then : $as_echo "#define HAVE_BASENAME 1" >>confdefs.h else case " $LIBOBJS " in *" basename.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS basename.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "getopt" "ac_cv_func_getopt" if test "x$ac_cv_func_getopt" = xyes; then : $as_echo "#define HAVE_GETOPT 1" >>confdefs.h else case " $LIBOBJS " in *" getopt.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "strsep" "ac_cv_func_strsep" if test "x$ac_cv_func_strsep" = xyes; then : $as_echo "#define HAVE_STRSEP 1" >>confdefs.h else case " $LIBOBJS " in *" strsep.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strsep.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "daemon" "ac_cv_func_daemon" if test "x$ac_cv_func_daemon" = xyes; then : $as_echo "#define HAVE_DAEMON 1" >>confdefs.h else case " $LIBOBJS " in *" daemon.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS daemon.$ac_objext" ;; esac fi ac_fn_c_check_func "$LINENO" "setenv" "ac_cv_func_setenv" if test "x$ac_cv_func_setenv" = xyes; then : $as_echo "#define HAVE_SETENV 1" >>confdefs.h else case " $LIBOBJS " in *" setenv.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS setenv.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5 $as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; } if ${ac_cv_sys_largefile_source+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=no; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 #include /* for off_t */ #include int main () { int (*fp) (FILE *, off_t, int) = fseeko; return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sys_largefile_source=1; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5 $as_echo "$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source _ACEOF ;; esac rm -rf conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h fi if test x$ac_cv_func_gethrtime = xno; then tds_save_LIBS="$LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 $as_echo_n "checking for library containing clock_gettime... " >&6; } if ${ac_cv_search_clock_gettime+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char clock_gettime (); int main () { return clock_gettime (); ; return 0; } _ACEOF for ac_lib in '' rt posix4; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_clock_gettime=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_clock_gettime+:} false; then : break fi done if ${ac_cv_search_clock_gettime+:} false; then : else ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 $as_echo "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi if test "$ac_cv_search_clock_gettime" != no; then $as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h fi if test "$ac_cv_search_clock_gettime" != no; then for tds_const in CLOCK_MONOTONIC CLOCK_SGI_CYCLE CLOCK_REALTIME; do { $as_echo "$as_me:${as_lineno-$LINENO}: checking if clock_gettime support $tds_const" >&5 $as_echo_n "checking if clock_gettime support $tds_const... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifdef HAVE_SYS_TIME_H #include #endif int main () { struct timespec ts; clock_gettime($tds_const, &ts); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tds_clock_gettime_const=yes else tds_clock_gettime_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tds_clock_gettime_const" >&5 $as_echo "$tds_clock_gettime_const" >&6; } if test $tds_clock_gettime_const = yes; then cat >>confdefs.h <<_ACEOF #define TDS_GETTIMEMILLI_CONST $tds_const _ACEOF break fi done if test $tds_clock_gettime_const != yes; then LIBS="$tds_save_LIBS" fi fi fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) # include # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF fi # ------------------------------------------------------------ # Checks for library variables. # ------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc_options variable is present" >&5 $as_echo_n "checking whether malloc_options variable is present... " >&6; } if ${ac_cv_have_malloc_options+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { extern char *malloc_options; malloc_options = "AJR"; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_have_malloc_options=yes else ac_cv_have_malloc_options=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_malloc_options" >&5 $as_echo "$ac_cv_have_malloc_options" >&6; } if test $ac_cv_have_malloc_options = yes; then $as_echo "#define HAVE_MALLOC_OPTIONS 1" >>confdefs.h fi # ------------------------------------------------------------ # Compile time options # ------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking compile-time options" >&5 $as_echo "checking compile-time options" >&6; } # Check whether --with-tdsver was given. if test "${with_tdsver+set}" = set; then : withval=$with_tdsver; fi case "$with_tdsver" in 4.2) as_fn_error $? "Protocol 4.2 cannot be specified as obsolete" "$LINENO" 5 ;; 4.6) as_fn_error $? "Protocol 4.6 cannot be specified as obsolete and never correctly supported" "$LINENO" 5 ;; 5.0) $as_echo "#define TDS50 1" >>confdefs.h ;; 7.0) as_fn_error $? "Protocol 7.0 cannot be specified during configure as too insecure" "$LINENO" 5 ;; 7.1) $as_echo "#define TDS71 1" >>confdefs.h ;; 7.2) $as_echo "#define TDS72 1" >>confdefs.h ;; 7.3) $as_echo "#define TDS73 1" >>confdefs.h ;; 7.4) $as_echo "#define TDS74 1" >>confdefs.h ;; ""|auto) ;; *) as_fn_error $? "Invalid value specified for --with-tdsver: $with_tdsver" "$LINENO" 5 ;; esac # Check whether --with-iodbc was given. if test "${with_iodbc+set}" = set; then : withval=$with_iodbc; fi if test "x$with_iodbc" = "xyes"; then # The user asked for iodbc support, but didn't tell us # where to look. So, we'll try to get the info from # pkg-config. If we can't, we'll display an error. pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IODBC" >&5 $as_echo_n "checking for IODBC... " >&6; } if test -n "$IODBC_CFLAGS"; then pkg_cv_IODBC_CFLAGS="$IODBC_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libiodbc\""; } >&5 ($PKG_CONFIG --exists --print-errors "libiodbc") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_IODBC_CFLAGS=`$PKG_CONFIG --cflags "libiodbc" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$IODBC_LIBS"; then pkg_cv_IODBC_LIBS="$IODBC_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libiodbc\""; } >&5 ($PKG_CONFIG --exists --print-errors "libiodbc") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_IODBC_LIBS=`$PKG_CONFIG --libs "libiodbc" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then IODBC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libiodbc" 2>&1` else IODBC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libiodbc" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$IODBC_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libiodbc) were not met: $IODBC_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables IODBC_CFLAGS and IODBC_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables IODBC_CFLAGS and IODBC_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else IODBC_CFLAGS=$pkg_cv_IODBC_CFLAGS IODBC_LIBS=$pkg_cv_IODBC_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi CPPFLAGS="$CPPFLAGS -DIODBC" ODBC_LDFLAGS="$IODBC_LIBS" # The ODBC_INC variable is only substituted into *_CPPFLAGS, # which is there $IODBC_CFLAGS is supposed to go anyway. ODBC_INC="$IODBC_CFLAGS" odbc=true iodbc=true elif test "x$with_iodbc" != "x" -a "x$with_iodbc" != "xno"; then if echo "$with_iodbc" | grep -v '^/'; then with_iodbc="$PWD/$with_iodbc" fi CPPFLAGS="$CPPFLAGS -DIODBC" ODBC_INC="$with_iodbc/include" test -r "$ODBC_INC/isql.h" || as_fn_error $? "isql.h not found" "$LINENO" 5 test -r "$ODBC_INC/isqlext.h" || as_fn_error $? "isqlext.h not found" "$LINENO" 5 ODBC_INC="-I$ODBC_INC" ODBC_LDFLAGS="-L$with_iodbc/lib -liodbc" odbc=true iodbc=true fi # Check whether --with-unixodbc was given. if test "${with_unixodbc+set}" = set; then : withval=$with_unixodbc; fi if test "x$with_unixodbc" = "xyes"; then # The user asked for unixodbc support, but didn't tell us # where to look. We'll try to get the installation prefix from # the odbc_config executable, and if we can't, we'll display # an error. if test -z "$ODBC_CONFIG"; then as_fn_error $? "odbc_config not found" "$LINENO" 5 fi with_unixodbc=`$ODBC_CONFIG --prefix` if ! test -x "${with_unixodbc}/bin/odbc_config"; then as_fn_error $? "could not find your unixODBC installation" "$LINENO" 5 fi fi # Note: the --with-unixodbc=yes case will make use of this one, # after populating $with_unixodbc with the correct prefix. if test "x$with_unixodbc" != "x" -a "x$with_unixodbc" != "xno"; then if test "x$with_iodbc" != "x" -a "x$with_iodbc" != "xno"; then as_fn_error $? "choose at most one of --with-iodbc or --with-unixodbc" "$LINENO" 5 fi if echo "$with_unixodbc" | grep -v '^/'; then with_unixodbc="$PWD/$with_unixodbc" fi CPPFLAGS="$CPPFLAGS -DUNIXODBC" if test -f "$with_unixodbc/bin/odbc_config"; then ODBC_CONFIG="$with_unixodbc/bin/odbc_config" ODBC_INC=`$ODBC_CONFIG --include-prefix` ODBC_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`" else # if not available do not use system default ODBC_CONFIG="" ODBC_INC="$with_unixodbc/include" ODBC_LDFLAGS="-L$with_unixodbc/lib" fi test -r "$ODBC_INC/sql.h" || as_fn_error $? "sql.h not found" "$LINENO" 5 test -r "$ODBC_INC/sqlext.h" || as_fn_error $? "sqlext.h not found" "$LINENO" 5 ODBC_INC="-I$ODBC_INC" ODBC_LDFLAGS="$ODBC_LDFLAGS -lodbc" odbc=true unixodbc=true fi # Check whether --with-odbc_nodm was given. if test "${with_odbc_nodm+set}" = set; then : withval=$with_odbc_nodm; fi if test "x$with_odbc_nodm" != "x" -a "x$with_odbc_nodm" != "xno"; then if echo "$with_odbc_nodm" | grep -v '^/'; then with_odbc_nodm="$PWD/$with_odbc_nodm" fi CPPFLAGS="$CPPFLAGS -DTDS_NO_DM" ODBC_INC="$with_odbc_nodm/include" test -r "$ODBC_INC/sql.h" || as_fn_error $? "sql.h not found" "$LINENO" 5 test -r "$ODBC_INC/sqlext.h" || as_fn_error $? "sqlext.h not found" "$LINENO" 5 ODBC_INC="-I$ODBC_INC" # The next line is for linking the unittests. Here the ODBC driver # itself is treated as the driver manager to be linked. # Can't use ODBC_LDFLAGS/LDFLAGS variables since they are used in building # other directories. ODBC_LDFLAGS="-L\$(top_builddir)/src/odbc -ltdsodbc" odbc=true fi build_odbc=yes if test "$odbc" != "true"; then # Check whether --enable-odbc was given. if test "${enable_odbc+set}" = set; then : enableval=$enable_odbc; build_odbc=$enableval else build_odbc=yes fi fi if test "$build_odbc" = "yes"; then INCODBC_TRUE= INCODBC_FALSE='#' else INCODBC_TRUE='#' INCODBC_FALSE= fi if test "$build_odbc" = "yes" then case $host_os in darwin* | rhapsody*) if test "$with_odbc_nodm" = ""; then FREETDS_ODBC_MODULE="-module" fi ;; esac # odbc not specified, try to detect it echo looking for installed odbc driver manager if test "$odbc" != "true" -a $tds_mingw = yes; then odbc=true unixodbc=true CPPFLAGS="$CPPFLAGS -DUNIXODBC" ODBC_LDFLAGS="-lodbc32" fi # try to detect searching for iODBC if test "$odbc" != "true" -a "x$with_iodbc" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLConnect in -liodbc" >&5 $as_echo_n "checking for SQLConnect in -liodbc... " >&6; } if ${ac_cv_lib_iodbc_SQLConnect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liodbc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SQLConnect (); int main () { return SQLConnect (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iodbc_SQLConnect=yes else ac_cv_lib_iodbc_SQLConnect=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iodbc_SQLConnect" >&5 $as_echo "$ac_cv_lib_iodbc_SQLConnect" >&6; } if test "x$ac_cv_lib_iodbc_SQLConnect" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "isql.h" "ac_cv_header_isql_h" "$ac_includes_default" if test "x$ac_cv_header_isql_h" = xyes; then : odbc=true iodbc=true CPPFLAGS="$CPPFLAGS -DIODBC" ODBC_LDFLAGS="-liodbc" fi fi fi # try to detect searching for unixODBC if test "$odbc" != "true" -a "x$with_unixodbc" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLConnect in -lodbc" >&5 $as_echo_n "checking for SQLConnect in -lodbc... " >&6; } if ${ac_cv_lib_odbc_SQLConnect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lodbc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SQLConnect (); int main () { return SQLConnect (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_odbc_SQLConnect=yes else ac_cv_lib_odbc_SQLConnect=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_odbc_SQLConnect" >&5 $as_echo "$ac_cv_lib_odbc_SQLConnect" >&6; } if test "x$ac_cv_lib_odbc_SQLConnect" = xyes; then : ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default" if test "x$ac_cv_header_sql_h" = xyes; then : odbc=true unixodbc=true CPPFLAGS="$CPPFLAGS -DUNIXODBC" ODBC_LDFLAGS="-lodbc" fi fi fi if test "$odbc" = "true"; then saved_LDFLAGS="$LDFLAGS" ODBCINST_LDFLAGS= LDFLAGS="$LDFLAGS $ODBC_LDFLAGS" if test $tds_mingw = yes; then ODBCINST_LDFLAGS="-lodbccp32" elif test "$unixodbc" = "true"; then if test -n "$ODBC_CONFIG"; then CPPFLAGS="$CPPFLAGS `$ODBC_CONFIG --cflags`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLGetPrivateProfileString in -lodbcinst" >&5 $as_echo_n "checking for SQLGetPrivateProfileString in -lodbcinst... " >&6; } if ${ac_cv_lib_odbcinst_SQLGetPrivateProfileString+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lodbcinst $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SQLGetPrivateProfileString (); int main () { return SQLGetPrivateProfileString (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_odbcinst_SQLGetPrivateProfileString=yes else ac_cv_lib_odbcinst_SQLGetPrivateProfileString=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_odbcinst_SQLGetPrivateProfileString" >&5 $as_echo "$ac_cv_lib_odbcinst_SQLGetPrivateProfileString" >&6; } if test "x$ac_cv_lib_odbcinst_SQLGetPrivateProfileString" = xyes; then : ODBCINST_LDFLAGS="$ODBC_LDFLAGS -lodbcinst" fi elif test "$iodbc" = "true"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLGetPrivateProfileString in -liodbcinst" >&5 $as_echo_n "checking for SQLGetPrivateProfileString in -liodbcinst... " >&6; } if ${ac_cv_lib_iodbcinst_SQLGetPrivateProfileString+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liodbcinst $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SQLGetPrivateProfileString (); int main () { return SQLGetPrivateProfileString (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iodbcinst_SQLGetPrivateProfileString=yes else ac_cv_lib_iodbcinst_SQLGetPrivateProfileString=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iodbcinst_SQLGetPrivateProfileString" >&5 $as_echo "$ac_cv_lib_iodbcinst_SQLGetPrivateProfileString" >&6; } if test "x$ac_cv_lib_iodbcinst_SQLGetPrivateProfileString" = xyes; then : ODBCINST_LDFLAGS="$ODBC_LDFLAGS -liodbcinst" fi fi if test "$ODBCINST_LDFLAGS" != ""; then cat >>confdefs.h <<_ACEOF #define HAVE_SQLGETPRIVATEPROFILESTRING 1 _ACEOF fi LDFLAGS="$saved_LDFLAGS" fi if test "$iodbc" = "true"; then save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ODBC_INC" for ac_header in iodbcinst.h do : ac_fn_c_check_header_mongrel "$LINENO" "iodbcinst.h" "ac_cv_header_iodbcinst_h" "$ac_includes_default" if test "x$ac_cv_header_iodbcinst_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_IODBCINST_H 1 _ACEOF fi done CPPFLAGS="$save_cppflags" fi # test for SQLLEN (iODBC do not define but typedef it) save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ODBC_INC" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include int main () { SQLLEN len = 123; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_SQLLEN 1" >>confdefs.h # check SQLColAttribute definition cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include SQLRETURN SQL_API SQLColAttribute (SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLLEN * NumericAttribute) { } int main () { return 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define TDS_SQLCOLATTRIBUTE_SQLLEN 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # check is SQLParamOptions accept SQLULEN cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include SQLRETURN SQL_API SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow) { return SQL_SUCCESS; } int main () { return 0 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define TDS_SQLPARAMOPTIONS_SQLLEN 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_fn_c_check_type "$LINENO" "SQLSETPOSIROW" "ac_cv_type_SQLSETPOSIROW" "#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include " if test "x$ac_cv_type_SQLSETPOSIROW" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SQLSETPOSIROW 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "SQLROWSETSIZE" "ac_cv_type_SQLROWSETSIZE" "#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include " if test "x$ac_cv_type_SQLROWSETSIZE" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SQLROWSETSIZE 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "SQLROWOFFSET" "ac_cv_type_SQLROWOFFSET" "#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include " if test "x$ac_cv_type_SQLROWOFFSET" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SQLROWOFFSET 1 _ACEOF fi # test for sizeof(SQLWCHAR) # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of SQLWCHAR" >&5 $as_echo_n "checking size of SQLWCHAR... " >&6; } if ${ac_cv_sizeof_SQLWCHAR+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (SQLWCHAR))" "ac_cv_sizeof_SQLWCHAR" "#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include "; then : else if test "$ac_cv_type_SQLWCHAR" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (SQLWCHAR) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_SQLWCHAR=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_SQLWCHAR" >&5 $as_echo "$ac_cv_sizeof_SQLWCHAR" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SQLWCHAR $ac_cv_sizeof_SQLWCHAR _ACEOF CPPFLAGS="$save_cppflags" else { $as_echo "$as_me:${as_lineno-$LINENO}: odbc disabled" >&5 $as_echo "$as_me: odbc disabled" >&6;} fi if test "$odbc" = "true"; then ODBC_TRUE= ODBC_FALSE='#' else ODBC_TRUE='#' ODBC_FALSE= fi if test "$unixodbc" = "true"; then UNIXODBC_TRUE= UNIXODBC_FALSE='#' else UNIXODBC_TRUE='#' UNIXODBC_FALSE= fi # Check whether --with-gnutls was given. if test "${with_gnutls+set}" = set; then : withval=$with_gnutls; fi if test "$with_gnutls" = "yes"; then $as_echo "#define HAVE_GNUTLS 1" >>confdefs.h gnutls_backend=unknown pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNUTLS" >&5 $as_echo_n "checking for GNUTLS... " >&6; } if test -n "$GNUTLS_CFLAGS"; then pkg_cv_GNUTLS_CFLAGS="$GNUTLS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls\""; } >&5 ($PKG_CONFIG --exists --print-errors "gnutls") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GNUTLS_LIBS"; then pkg_cv_GNUTLS_LIBS="$GNUTLS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls\""; } >&5 ($PKG_CONFIG --exists --print-errors "gnutls") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GNUTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gnutls" 2>&1` else GNUTLS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gnutls" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GNUTLS_PKG_ERRORS" >&5 CPPFLAGS="$CPPFLAGS `libgnutls-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgnutls-config --libs`" elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CPPFLAGS="$CPPFLAGS `libgnutls-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgnutls-config --libs`" else GNUTLS_CFLAGS=$pkg_cv_GNUTLS_CFLAGS GNUTLS_LIBS=$pkg_cv_GNUTLS_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS" NETWORK_LIBS="$NETWORK_LIBS $GNUTLS_LIBS" if "$PKG_CONFIG" --libs --static gnutls | grep nettle > /dev/null 2>&1 ; then gnutls_backend=nettle $as_echo "#define GNUTLS_USE_NETTLE 1" >>confdefs.h pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NETTLE" >&5 $as_echo_n "checking for NETTLE... " >&6; } if test -n "$NETTLE_CFLAGS"; then pkg_cv_NETTLE_CFLAGS="$NETTLE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nettle\""; } >&5 ($PKG_CONFIG --exists --print-errors "nettle") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_NETTLE_CFLAGS=`$PKG_CONFIG --cflags "nettle" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$NETTLE_LIBS"; then pkg_cv_NETTLE_LIBS="$NETTLE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nettle\""; } >&5 ($PKG_CONFIG --exists --print-errors "nettle") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_NETTLE_LIBS=`$PKG_CONFIG --libs "nettle" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then NETTLE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "nettle" 2>&1` else NETTLE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "nettle" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$NETTLE_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (nettle) were not met: $NETTLE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables NETTLE_CFLAGS and NETTLE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables NETTLE_CFLAGS and NETTLE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else NETTLE_CFLAGS=$pkg_cv_NETTLE_CFLAGS NETTLE_LIBS=$pkg_cv_NETTLE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_NETTLE 1" >>confdefs.h NETWORK_LIBS="$NETWORK_LIBS $NETTLE_LIBS" fi LIBS_795="$LIBS" LIBS="$NETWORK_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { mpz_t x; mpz_init(x); mpz_powm(x,x,x,x); mpz_clear(x); return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_GMP 1" >>confdefs.h else gmp_save_LIBS="$LIBS" LIBS="$LIBS -lgmp" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { mpz_t x; mpz_init(x); mpz_powm(x,x,x,x); mpz_clear(x); return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_GMP 1" >>confdefs.h else LIBS="$gmp_save_LIBS" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nettle_rsa_public_key_init" >&5 $as_echo_n "checking for library containing nettle_rsa_public_key_init... " >&6; } if ${ac_cv_search_nettle_rsa_public_key_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char nettle_rsa_public_key_init (); int main () { return nettle_rsa_public_key_init (); ; return 0; } _ACEOF for ac_lib in '' nettle hogweed; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_nettle_rsa_public_key_init=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_nettle_rsa_public_key_init+:} false; then : break fi done if ${ac_cv_search_nettle_rsa_public_key_init+:} false; then : else ac_cv_search_nettle_rsa_public_key_init=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nettle_rsa_public_key_init" >&5 $as_echo "$ac_cv_search_nettle_rsa_public_key_init" >&6; } ac_res=$ac_cv_search_nettle_rsa_public_key_init if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi NETWORK_LIBS="$LIBS" LIBS="$LIBS_795" unset LIBS_795 fi fi LIBS_813="$LIBS" LIBS="$NETWORK_LIBS" for ac_func in gnutls_certificate_set_verify_function gnutls_record_disable_padding gnutls_rnd do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS="$LIBS_813" unset LIBS_813 if test "$gnutls_backend" = "unknown"; then gnutls_backend=gcrypt NETWORK_LIBS="$NETWORK_LIBS -ltasn1" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking if openssl is wanted" >&5 $as_echo_n "checking if openssl is wanted... " >&6; } # Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then : withval=$with_openssl; fi if test "$with_openssl" != "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } old_NETWORK_LIBS="$NETWORK_LIBS" pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL" >&5 $as_echo_n "checking for OPENSSL... " >&6; } if test -n "$OPENSSL_CFLAGS"; then pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$OPENSSL_LIBS"; then pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1` else OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$OPENSSL_PKG_ERRORS" >&5 found_ssl=no if test "$cross_compiling" != "yes"; then for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do ssldir="$dir" if test -f "$dir/include/openssl/ssl.h"; then echo "OpenSSL found in $ssldir" found_ssl="yes" CFLAGS="$CFLAGS -I$ssldir/include" NETWORK_LIBS="$NETWORK_LIBS -lssl -lcrypto" LDFLAGS="$LDFLAGS -L$ssldir/lib" break fi done fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } found_ssl=no if test "$cross_compiling" != "yes"; then for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do ssldir="$dir" if test -f "$dir/include/openssl/ssl.h"; then echo "OpenSSL found in $ssldir" found_ssl="yes" CFLAGS="$CFLAGS -I$ssldir/include" NETWORK_LIBS="$NETWORK_LIBS -lssl -lcrypto" LDFLAGS="$LDFLAGS -L$ssldir/lib" break fi done fi else OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } found_ssl=yes CFLAGS="$CFLAGS $OPENSSL_CFLAGS" NETWORK_LIBS="$NETWORK_LIBS $OPENSSL_LIBS" fi if test x$found_ssl = xyes; then LIBS_821="$LIBS" LIBS="$NETWORK_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { SSL_read(NULL, NULL, 100); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else found_ssl=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$LIBS_821" unset LIBS_821 fi if test x$found_ssl != xyes -a "$with_openssl" != ""; then as_fn_error $? "Cannot find OpenSSL libraries" "$LINENO" 5 NETWORK_LIBS="$old_NETWORK_LIBS" elif test x$found_ssl = xyes; then HAVE_OPENSSL=yes LIBS_821="$LIBS" LIBS="$NETWORK_LIBS" for ac_func in BIO_get_data RSA_get0_key ASN1_STRING_get0_data do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done LIBS="$LIBS_821" unset LIBS_821 $as_echo "#define HAVE_OPENSSL 1" >>confdefs.h else NETWORK_LIBS="$old_NETWORK_LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi # Check whether --enable-apps was given. if test "${enable_apps+set}" = set; then : enableval=$enable_apps; fi if test "$enable_apps" != "no"; then INCAPPS_TRUE= INCAPPS_FALSE='#' else INCAPPS_TRUE='#' INCAPPS_FALSE= fi # Check whether --enable-server was given. if test "${enable_server+set}" = set; then : enableval=$enable_server; fi if test "$enable_server" != "no"; then INCSERVER_TRUE= INCSERVER_FALSE='#' else INCSERVER_TRUE='#' INCSERVER_FALSE= fi # Check whether --enable-pool was given. if test "${enable_pool+set}" = set; then : enableval=$enable_pool; fi # Check whether --enable-msdblib was given. if test "${enable_msdblib+set}" = set; then : enableval=$enable_msdblib; fi if test "$enable_msdblib" = "yes" ; then dblib_define="#define MSDBLIB 1" else dblib_define="#define SYBDBLIB 1" fi # Check whether --enable-sybase-compat was given. if test "${enable_sybase_compat+set}" = set; then : enableval=$enable_sybase_compat; fi if test x$enable_sybase_compat = xyes; then SYBASE_COMPAT_TRUE= SYBASE_COMPAT_FALSE='#' else SYBASE_COMPAT_TRUE='#' SYBASE_COMPAT_FALSE= fi if test x$enable_sybase_compat = xyes; then $as_echo "#define TDS_SYBASE_COMPAT 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking threadsafety" >&5 $as_echo_n "checking threadsafety... " >&6; } # Enable or disable thread safetiness # This option is enabled by default because most OS's support it. # A more sophisticated approach would be to set the default per-OS. # Check whether --enable-threadsafe was given. if test "${enable_threadsafe+set}" = set; then : enableval=$enable_threadsafe; use_threadsafe=$enableval else use_threadsafe=yes fi if test "$enable_threadsafe" != "no" ; then CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE" { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } else $as_echo "#define TDS_NO_THREADSAFE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } enable_pool=no fi if test "$enable_threadsafe" != "no"; then ENABLE_THREADSAFE_TRUE= ENABLE_THREADSAFE_FALSE='#' else ENABLE_THREADSAFE_TRUE='#' ENABLE_THREADSAFE_FALSE= fi if test "$enable_pool" != "no"; then INCPOOL_TRUE= INCPOOL_FALSE='#' else INCPOOL_TRUE='#' INCPOOL_FALSE= fi # newer gcc are configured to fail to resolve references to libraries not # explicitly listed on the linker commandline. # So to make build add explicitly gcrypt library. if test "$enable_threadsafe" != "no" -a "$with_gnutls" = "yes" -a "$gnutls_backend" = "gcrypt"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCRYPT" >&5 $as_echo_n "checking for GCRYPT... " >&6; } if test -n "$GCRYPT_CFLAGS"; then pkg_cv_GCRYPT_CFLAGS="$GCRYPT_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gcrypt\""; } >&5 ($PKG_CONFIG --exists --print-errors "gcrypt") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GCRYPT_CFLAGS=`$PKG_CONFIG --cflags "gcrypt" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GCRYPT_LIBS"; then pkg_cv_GCRYPT_LIBS="$GCRYPT_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gcrypt\""; } >&5 ($PKG_CONFIG --exists --print-errors "gcrypt") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GCRYPT_LIBS=`$PKG_CONFIG --libs "gcrypt" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GCRYPT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gcrypt" 2>&1` else GCRYPT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gcrypt" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GCRYPT_PKG_ERRORS" >&5 CPPFLAGS="$CPPFLAGS `libgcrypt-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgcrypt-config --libs`" elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } CPPFLAGS="$CPPFLAGS `libgcrypt-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgcrypt-config --libs`" else GCRYPT_CFLAGS=$pkg_cv_GCRYPT_CFLAGS GCRYPT_LIBS=$pkg_cv_GCRYPT_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CPPFLAGS="$CPPFLAGS $GCRYPT_CFLAGS" NETWORK_LIBS="$NETWORK_LIBS $GCRYPT_LIBS" fi fi # we don't need to check netdb functions if they are already threadsafe if test $netdb_reentrant != yes; then ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NETWORK_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which type of gethostbyname_r" >&5 $as_echo_n "checking for which type of gethostbyname_r... " >&6; } if ${ac_cv_func_which_gethostname_r+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # include int main () { char *name; struct hostent *he; struct hostent_data data; (void) gethostbyname_r(name, he, &data); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_gethostname_r=three else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # include int main () { char *name; struct hostent *he, *res; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_gethostname_r=six else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # include int main () { char *name; struct hostent *he; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_gethostname_r=five else ac_cv_func_which_gethostname_r=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_which_gethostname_r" >&5 $as_echo "$ac_cv_func_which_gethostname_r" >&6; } if test $ac_cv_func_which_gethostname_r = six; then $as_echo "#define HAVE_FUNC_GETHOSTBYNAME_R_6 1" >>confdefs.h elif test $ac_cv_func_which_gethostname_r = five; then $as_echo "#define HAVE_FUNC_GETHOSTBYNAME_R_5 1" >>confdefs.h elif test $ac_cv_func_which_gethostname_r = three; then $as_echo "#define HAVE_FUNC_GETHOSTBYNAME_R_3 1" >>confdefs.h fi CFLAGS=$ac_save_CFLAGS ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NETWORK_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which type of getservbyname_r" >&5 $as_echo_n "checking for which type of getservbyname_r... " >&6; } if ${ac_cv_func_which_getservbyname_r+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # include int main () { char *name; char *proto; struct servent *se; struct servent_data data; (void) getservbyname_r(name, proto, se, &data); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_getservbyname_r=four else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # include int main () { char *name; char *proto; struct servent *se, *res; char buffer[2048]; int buflen = 2048; (void) getservbyname_r(name, proto, se, buffer, buflen, &res) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_getservbyname_r=six else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # include int main () { char *name; char *proto; struct servent *se; char buffer[2048]; int buflen = 2048; (void) getservbyname_r(name, proto, se, buffer, buflen) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_getservbyname_r=five else ac_cv_func_which_getservbyname_r=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_which_getservbyname_r" >&5 $as_echo "$ac_cv_func_which_getservbyname_r" >&6; } if test $ac_cv_func_which_getservbyname_r = six; then $as_echo "#define HAVE_FUNC_GETSERVBYNAME_R_6 1" >>confdefs.h elif test $ac_cv_func_which_getservbyname_r = five; then $as_echo "#define HAVE_FUNC_GETSERVBYNAME_R_5 1" >>confdefs.h elif test $ac_cv_func_which_getservbyname_r = four; then $as_echo "#define HAVE_FUNC_GETSERVBYNAME_R_4 1" >>confdefs.h fi CFLAGS=$ac_save_CFLAGS ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NETWORK_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which type of gethostbyaddr_r" >&5 $as_echo_n "checking for which type of gethostbyaddr_r... " >&6; } if ${ac_cv_func_which_gethostbyaddr_r+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { char * address; int length; int type; struct hostent h; struct hostent_data hdata; int rc; rc = gethostbyaddr_r(address, length, type, &h, &hdata); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_gethostbyaddr_r=five else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { char * address; int length; int type; struct hostent h; char buffer[8192]; int h_errnop; struct hostent * hp; hp = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &h_errnop); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_gethostbyaddr_r=seven else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { char * address; int length; int type; struct hostent h; char buffer[8192]; int h_errnop; struct hostent * hp; int rc; rc = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &hp, &h_errnop); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_which_gethostbyaddr_r=eight else ac_cv_func_which_gethostbyaddr_r=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_which_gethostbyaddr_r" >&5 $as_echo "$ac_cv_func_which_gethostbyaddr_r" >&6; } if test $ac_cv_func_which_gethostbyaddr_r = eight; then $as_echo "#define HAVE_FUNC_GETHOSTBYADDR_R_8 1" >>confdefs.h elif test $ac_cv_func_which_gethostbyaddr_r = seven; then $as_echo "#define HAVE_FUNC_GETHOSTBYADDR_R_7 1" >>confdefs.h elif test $ac_cv_func_which_gethostbyaddr_r = five; then $as_echo "#define HAVE_FUNC_GETHOSTBYADDR_R_5 1" >>confdefs.h fi CFLAGS=$ac_save_CFLAGS fi if test x$ac_cv_func_getpwuid = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which type of getpwuid_r" >&5 $as_echo_n "checking for which type of getpwuid_r... " >&6; } if ${ac_cv_func_which_getpwuid_r+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct passwd bpw; char buf[1024]; char *dir = getpwuid_r(getuid(), &bpw, buf, sizeof(buf))->pw_dir; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_which_getpwuid_r=four_pw else if test "$cross_compiling" = yes; then : # cross compile case ac_cv_func_which_getpwuid_r=no num_params=four for params in "int" "size_t, struct passwd **"; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include extern int getpwuid_r(uid_t, struct passwd *, char *, $params); int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if test $ac_cv_func_which_getpwuid_r != no; then as_fn_error $? "Two types of getpwuid_r detected" "$LINENO" 5 fi ac_cv_func_which_getpwuid_r=$num_params fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext num_params=five done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main() { struct passwd bpw; char buf[1024]; getpwuid_r(getuid(), &bpw, buf, sizeof(buf)); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_which_getpwuid_r=four else if test "$cross_compiling" = yes; then : { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main() { struct passwd *pw, bpw; char buf[1024]; getpwuid_r(getuid(), &bpw, buf, sizeof(buf), &pw); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_which_getpwuid_r=five else ac_cv_func_which_getpwuid_r=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_which_getpwuid_r" >&5 $as_echo "$ac_cv_func_which_getpwuid_r" >&6; } if test $ac_cv_func_which_getpwuid_r = four_pw; then $as_echo "#define HAVE_FUNC_GETPWUID_R_4 1" >>confdefs.h $as_echo "#define HAVE_FUNC_GETPWUID_R_4_PW 1" >>confdefs.h elif test $ac_cv_func_which_getpwuid_r = four; then $as_echo "#define HAVE_FUNC_GETPWUID_R_4 1" >>confdefs.h elif test $ac_cv_func_which_getpwuid_r = five; then $as_echo "#define HAVE_FUNC_GETPWUID_R_5 1" >>confdefs.h fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which type of localtime_r" >&5 $as_echo_n "checking for which type of localtime_r... " >&6; } if ${ac_cv_func_which_localtime_r+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm mytm; time_t t; int y = localtime_r(&t, &mytm)->tm_year; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_which_localtime_r=struct else ac_cv_func_which_localtime_r=int fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_which_localtime_r" >&5 $as_echo "$ac_cv_func_which_localtime_r" >&6; } if test $ac_cv_func_which_localtime_r = struct; then $as_echo "#define HAVE_FUNC_LOCALTIME_R_TM 1" >>confdefs.h else $as_echo "#define HAVE_FUNC_LOCALTIME_R_INT 1" >>confdefs.h fi # easy test for pthread (no library, only mutex support) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #if !defined(_WIN32) pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; #endif int main () { pthread_mutex_lock(&mutex); pthread_mutex_unlock(&mutex) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define TDS_HAVE_PTHREAD_MUTEX 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # easy test for locking stdio cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { int c; flockfile(stdin); c = getc_unlocked(stdin); funlockfile(stdin); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define TDS_HAVE_STDIO_LOCKED 1" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; use_debug=$enableval else use_debug=yes fi if test "$use_debug" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: debug enabled" >&5 $as_echo "$as_me: debug enabled" >&6;} CPPFLAGS="$CPPFLAGS -DDEBUG=1" # Check whether --enable-extra-checks was given. if test "${enable_extra_checks+set}" = set; then : enableval=$enable_extra_checks; fi if test "$enable_extra_checks" = "yes" ; then cat >>confdefs.h <<_ACEOF #define ENABLE_EXTRA_CHECKS 1 _ACEOF fi else { $as_echo "$as_me:${as_lineno-$LINENO}: debug disabled" >&5 $as_echo "$as_me: debug disabled" >&6;} CPPFLAGS="$CPPFLAGS -DNDEBUG=1" fi # Check whether --enable-developing was given. if test "${enable_developing+set}" = set; then : enableval=$enable_developing; fi if test "$enable_developing" = "yes" ; then cat >>confdefs.h <<_ACEOF #define ENABLE_DEVELOPING 1 _ACEOF fi if test "$enable_developing" = "yes"; then ENABLE_DEVELOPING_TRUE= ENABLE_DEVELOPING_FALSE='#' else ENABLE_DEVELOPING_TRUE='#' ENABLE_DEVELOPING_FALSE= fi # Check whether --enable-mars was given. if test "${enable_mars+set}" = set; then : enableval=$enable_mars; fi if test "$enable_mars" != "no" ; then cat >>confdefs.h <<_ACEOF #define ENABLE_ODBC_MARS 1 _ACEOF fi # Check whether --enable-odbc-wide was given. if test "${enable_odbc_wide+set}" = set; then : enableval=$enable_odbc_wide; fi if test "$enable_odbc_wide" != "no" ; then cat >>confdefs.h <<_ACEOF #define ENABLE_ODBC_WIDE 1 _ACEOF # Check whether --enable-odbc-wide-tests was given. if test "${enable_odbc_wide_tests+set}" = set; then : enableval=$enable_odbc_wide_tests; fi if test "$enable_odbc_wide_tests" = "yes"; then ODBC_WIDE_TESTS_TRUE= ODBC_WIDE_TESTS_FALSE='#' else ODBC_WIDE_TESTS_TRUE='#' ODBC_WIDE_TESTS_FALSE= fi else if false; then ODBC_WIDE_TESTS_TRUE= ODBC_WIDE_TESTS_FALSE='#' else ODBC_WIDE_TESTS_TRUE='#' ODBC_WIDE_TESTS_FALSE= fi fi # Check whether --enable-distcheck_build was given. if test "${enable_distcheck_build+set}" = set; then : enableval=$enable_distcheck_build; fi if test "$enable_distcheck_build" = "yes" ; then if true; then DISTCHECK_BUILD_TRUE= DISTCHECK_BUILD_FALSE='#' else DISTCHECK_BUILD_TRUE='#' DISTCHECK_BUILD_FALSE= fi else if false; then DISTCHECK_BUILD_TRUE= DISTCHECK_BUILD_FALSE='#' else DISTCHECK_BUILD_TRUE='#' DISTCHECK_BUILD_FALSE= fi fi # ------------------------------------------------------------ # LTLIBOBJS hack (for autoconf-2.53) # ------------------------------------------------------------ # This is necessary so that .o files in LIBOBJS are also built via # the ANSI2KNR-filtering rules. LIBOBJS=`echo "$LIBOBJS" | sed 's,\.[^.]* ,$U&,g;s,\.[^.]*$,$U&,'` LTLIBOBJS=`echo "$LIBOBJS" | sed 's,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,'` # enable some warning for gcc if test "$ac_compiler_gnu" = "yes" ; then CPPFLAGS="$CPPFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wpointer-arith" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for gcc -Wdeclaration-after-statement" >&5 $as_echo_n "checking CFLAGS for gcc -Wdeclaration-after-statement... " >&6; } if ${ac_cv_cflags_gcc_option__Wdeclaration_after_statement+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_cflags_gcc_option__Wdeclaration_after_statement="no, unknown" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_save_CFLAGS="$CFLAGS" for ac_arg in "-pedantic % -Wdeclaration-after-statement" # do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_cflags_gcc_option__Wdeclaration_after_statement=`echo $ac_arg | sed -e 's,.*% *,,'` ; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done CFLAGS="$ac_save_CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&5 $as_echo "$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" >&6; } case ".$ac_cv_cflags_gcc_option__Wdeclaration_after_statement" in .ok|.ok,*) ;; .|.no|.no,*) ;; *) if echo " $CFLAGS " | grep " $ac_cv_cflags_gcc_option__Wdeclaration_after_statement " 2>&1 >/dev/null then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement"; } >&5 (: CFLAGS does contain $ac_cv_cflags_gcc_option__Wdeclaration_after_statement) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_gcc_option__Wdeclaration_after_statement\""; } >&5 (: CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } CFLAGS="$CFLAGS $ac_cv_cflags_gcc_option__Wdeclaration_after_statement" fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } # ------------------------------------------------------------ # Final output # ------------------------------------------------------------ ac_config_files="$ac_config_files include/freetds/version.h include/tds_sysdep_public.h Makefile include/Makefile include/freetds/Makefile doc/Makefile samples/Makefile src/Makefile src/tds/Makefile src/tds/unittests/Makefile src/dblib/Makefile src/dblib/unittests/Makefile src/ctlib/Makefile src/ctlib/unittests/Makefile src/replacements/Makefile src/replacements/unittests/Makefile src/utils/Makefile src/utils/unittests/Makefile src/server/Makefile src/pool/Makefile src/odbc/Makefile src/odbc/unittests/Makefile src/apps/Makefile src/apps/fisql/Makefile freetds.spec win32/Makefile win32/freetds.nsh src/odbc/version.rc vms/Makefile misc/Makefile doc/freebcp.1 doc/tsql.1 doc/osql.1 doc/bsqldb.1 doc/bsqlodbc.1 doc/defncopy.1 doc/datacopy.1 doc/fisql.1 doc/freetds.conf.5" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MACOSX_TRUE}" && test -z "${MACOSX_FALSE}"; then as_fn_error $? "conditional \"MACOSX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MACOSX_TRUE}" && test -z "${MACOSX_FALSE}"; then as_fn_error $? "conditional \"MACOSX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_DOXYGEN_TRUE}" && test -z "${HAVE_DOXYGEN_FALSE}"; then as_fn_error $? "conditional \"HAVE_DOXYGEN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_PERL_SOURCES_TRUE}" && test -z "${HAVE_PERL_SOURCES_FALSE}"; then as_fn_error $? "conditional \"HAVE_PERL_SOURCES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_PERL_SOURCES_TRUE}" && test -z "${HAVE_PERL_SOURCES_FALSE}"; then as_fn_error $? "conditional \"HAVE_PERL_SOURCES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MINGW32_TRUE}" && test -z "${MINGW32_FALSE}"; then as_fn_error $? "conditional \"MINGW32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MINGW32_TRUE}" && test -z "${MINGW32_FALSE}"; then as_fn_error $? "conditional \"MINGW32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${MINGW32_TRUE}" && test -z "${MINGW32_FALSE}"; then as_fn_error $? "conditional \"MINGW32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${HAVE_SSPI_TRUE}" && test -z "${HAVE_SSPI_FALSE}"; then as_fn_error $? "conditional \"HAVE_SSPI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INCODBC_TRUE}" && test -z "${INCODBC_FALSE}"; then as_fn_error $? "conditional \"INCODBC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ODBC_TRUE}" && test -z "${ODBC_FALSE}"; then as_fn_error $? "conditional \"ODBC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${UNIXODBC_TRUE}" && test -z "${UNIXODBC_FALSE}"; then as_fn_error $? "conditional \"UNIXODBC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INCAPPS_TRUE}" && test -z "${INCAPPS_FALSE}"; then as_fn_error $? "conditional \"INCAPPS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INCSERVER_TRUE}" && test -z "${INCSERVER_FALSE}"; then as_fn_error $? "conditional \"INCSERVER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SYBASE_COMPAT_TRUE}" && test -z "${SYBASE_COMPAT_FALSE}"; then as_fn_error $? "conditional \"SYBASE_COMPAT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_THREADSAFE_TRUE}" && test -z "${ENABLE_THREADSAFE_FALSE}"; then as_fn_error $? "conditional \"ENABLE_THREADSAFE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INCPOOL_TRUE}" && test -z "${INCPOOL_FALSE}"; then as_fn_error $? "conditional \"INCPOOL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DEVELOPING_TRUE}" && test -z "${ENABLE_DEVELOPING_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DEVELOPING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ODBC_WIDE_TESTS_TRUE}" && test -z "${ODBC_WIDE_TESTS_FALSE}"; then as_fn_error $? "conditional \"ODBC_WIDE_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ODBC_WIDE_TESTS_TRUE}" && test -z "${ODBC_WIDE_TESTS_FALSE}"; then as_fn_error $? "conditional \"ODBC_WIDE_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DISTCHECK_BUILD_TRUE}" && test -z "${DISTCHECK_BUILD_FALSE}"; then as_fn_error $? "conditional \"DISTCHECK_BUILD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DISTCHECK_BUILD_TRUE}" && test -z "${DISTCHECK_BUILD_FALSE}"; then as_fn_error $? "conditional \"DISTCHECK_BUILD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by FreeTDS $as_me 1.3.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ FreeTDS config.status 1.3.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LD_RC='`$ECHO "$LD_RC" | $SED "$delay_single_quote_subst"`' reload_flag_RC='`$ECHO "$reload_flag_RC" | $SED "$delay_single_quote_subst"`' reload_cmds_RC='`$ECHO "$reload_cmds_RC" | $SED "$delay_single_quote_subst"`' old_archive_cmds_RC='`$ECHO "$old_archive_cmds_RC" | $SED "$delay_single_quote_subst"`' compiler_RC='`$ECHO "$compiler_RC" | $SED "$delay_single_quote_subst"`' GCC_RC='`$ECHO "$GCC_RC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_RC='`$ECHO "$lt_prog_compiler_no_builtin_flag_RC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_RC='`$ECHO "$lt_prog_compiler_pic_RC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_RC='`$ECHO "$lt_prog_compiler_wl_RC" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_RC='`$ECHO "$lt_prog_compiler_static_RC" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_RC='`$ECHO "$lt_cv_prog_compiler_c_o_RC" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_RC='`$ECHO "$archive_cmds_need_lc_RC" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_RC='`$ECHO "$enable_shared_with_static_runtimes_RC" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_RC='`$ECHO "$export_dynamic_flag_spec_RC" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_RC='`$ECHO "$whole_archive_flag_spec_RC" | $SED "$delay_single_quote_subst"`' compiler_needs_object_RC='`$ECHO "$compiler_needs_object_RC" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_RC='`$ECHO "$old_archive_from_new_cmds_RC" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_RC='`$ECHO "$old_archive_from_expsyms_cmds_RC" | $SED "$delay_single_quote_subst"`' archive_cmds_RC='`$ECHO "$archive_cmds_RC" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_RC='`$ECHO "$archive_expsym_cmds_RC" | $SED "$delay_single_quote_subst"`' module_cmds_RC='`$ECHO "$module_cmds_RC" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_RC='`$ECHO "$module_expsym_cmds_RC" | $SED "$delay_single_quote_subst"`' with_gnu_ld_RC='`$ECHO "$with_gnu_ld_RC" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_RC='`$ECHO "$allow_undefined_flag_RC" | $SED "$delay_single_quote_subst"`' no_undefined_flag_RC='`$ECHO "$no_undefined_flag_RC" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_RC='`$ECHO "$hardcode_libdir_flag_spec_RC" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_RC='`$ECHO "$hardcode_libdir_separator_RC" | $SED "$delay_single_quote_subst"`' hardcode_direct_RC='`$ECHO "$hardcode_direct_RC" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_RC='`$ECHO "$hardcode_direct_absolute_RC" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_RC='`$ECHO "$hardcode_minus_L_RC" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_RC='`$ECHO "$hardcode_shlibpath_var_RC" | $SED "$delay_single_quote_subst"`' hardcode_automatic_RC='`$ECHO "$hardcode_automatic_RC" | $SED "$delay_single_quote_subst"`' inherit_rpath_RC='`$ECHO "$inherit_rpath_RC" | $SED "$delay_single_quote_subst"`' link_all_deplibs_RC='`$ECHO "$link_all_deplibs_RC" | $SED "$delay_single_quote_subst"`' always_export_symbols_RC='`$ECHO "$always_export_symbols_RC" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_RC='`$ECHO "$export_symbols_cmds_RC" | $SED "$delay_single_quote_subst"`' exclude_expsyms_RC='`$ECHO "$exclude_expsyms_RC" | $SED "$delay_single_quote_subst"`' include_expsyms_RC='`$ECHO "$include_expsyms_RC" | $SED "$delay_single_quote_subst"`' prelink_cmds_RC='`$ECHO "$prelink_cmds_RC" | $SED "$delay_single_quote_subst"`' postlink_cmds_RC='`$ECHO "$postlink_cmds_RC" | $SED "$delay_single_quote_subst"`' file_list_spec_RC='`$ECHO "$file_list_spec_RC" | $SED "$delay_single_quote_subst"`' hardcode_action_RC='`$ECHO "$hardcode_action_RC" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ LD_RC \ reload_flag_RC \ compiler_RC \ lt_prog_compiler_no_builtin_flag_RC \ lt_prog_compiler_pic_RC \ lt_prog_compiler_wl_RC \ lt_prog_compiler_static_RC \ lt_cv_prog_compiler_c_o_RC \ export_dynamic_flag_spec_RC \ whole_archive_flag_spec_RC \ compiler_needs_object_RC \ with_gnu_ld_RC \ allow_undefined_flag_RC \ no_undefined_flag_RC \ hardcode_libdir_flag_spec_RC \ hardcode_libdir_separator_RC \ exclude_expsyms_RC \ include_expsyms_RC \ file_list_spec_RC; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path \ reload_cmds_RC \ old_archive_cmds_RC \ old_archive_from_new_cmds_RC \ old_archive_from_expsyms_cmds_RC \ archive_cmds_RC \ archive_expsym_cmds_RC \ module_cmds_RC \ module_expsym_cmds_RC \ export_symbols_cmds_RC \ prelink_cmds_RC \ postlink_cmds_RC; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "include/freetds/version.h") CONFIG_FILES="$CONFIG_FILES include/freetds/version.h" ;; "include/tds_sysdep_public.h") CONFIG_FILES="$CONFIG_FILES include/tds_sysdep_public.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "include/freetds/Makefile") CONFIG_FILES="$CONFIG_FILES include/freetds/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/tds/Makefile") CONFIG_FILES="$CONFIG_FILES src/tds/Makefile" ;; "src/tds/unittests/Makefile") CONFIG_FILES="$CONFIG_FILES src/tds/unittests/Makefile" ;; "src/dblib/Makefile") CONFIG_FILES="$CONFIG_FILES src/dblib/Makefile" ;; "src/dblib/unittests/Makefile") CONFIG_FILES="$CONFIG_FILES src/dblib/unittests/Makefile" ;; "src/ctlib/Makefile") CONFIG_FILES="$CONFIG_FILES src/ctlib/Makefile" ;; "src/ctlib/unittests/Makefile") CONFIG_FILES="$CONFIG_FILES src/ctlib/unittests/Makefile" ;; "src/replacements/Makefile") CONFIG_FILES="$CONFIG_FILES src/replacements/Makefile" ;; "src/replacements/unittests/Makefile") CONFIG_FILES="$CONFIG_FILES src/replacements/unittests/Makefile" ;; "src/utils/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/Makefile" ;; "src/utils/unittests/Makefile") CONFIG_FILES="$CONFIG_FILES src/utils/unittests/Makefile" ;; "src/server/Makefile") CONFIG_FILES="$CONFIG_FILES src/server/Makefile" ;; "src/pool/Makefile") CONFIG_FILES="$CONFIG_FILES src/pool/Makefile" ;; "src/odbc/Makefile") CONFIG_FILES="$CONFIG_FILES src/odbc/Makefile" ;; "src/odbc/unittests/Makefile") CONFIG_FILES="$CONFIG_FILES src/odbc/unittests/Makefile" ;; "src/apps/Makefile") CONFIG_FILES="$CONFIG_FILES src/apps/Makefile" ;; "src/apps/fisql/Makefile") CONFIG_FILES="$CONFIG_FILES src/apps/fisql/Makefile" ;; "freetds.spec") CONFIG_FILES="$CONFIG_FILES freetds.spec" ;; "win32/Makefile") CONFIG_FILES="$CONFIG_FILES win32/Makefile" ;; "win32/freetds.nsh") CONFIG_FILES="$CONFIG_FILES win32/freetds.nsh" ;; "src/odbc/version.rc") CONFIG_FILES="$CONFIG_FILES src/odbc/version.rc" ;; "vms/Makefile") CONFIG_FILES="$CONFIG_FILES vms/Makefile" ;; "misc/Makefile") CONFIG_FILES="$CONFIG_FILES misc/Makefile" ;; "doc/freebcp.1") CONFIG_FILES="$CONFIG_FILES doc/freebcp.1" ;; "doc/tsql.1") CONFIG_FILES="$CONFIG_FILES doc/tsql.1" ;; "doc/osql.1") CONFIG_FILES="$CONFIG_FILES doc/osql.1" ;; "doc/bsqldb.1") CONFIG_FILES="$CONFIG_FILES doc/bsqldb.1" ;; "doc/bsqlodbc.1") CONFIG_FILES="$CONFIG_FILES doc/bsqlodbc.1" ;; "doc/defncopy.1") CONFIG_FILES="$CONFIG_FILES doc/defncopy.1" ;; "doc/datacopy.1") CONFIG_FILES="$CONFIG_FILES doc/datacopy.1" ;; "doc/fisql.1") CONFIG_FILES="$CONFIG_FILES doc/fisql.1" ;; "doc/freetds.conf.5") CONFIG_FILES="$CONFIG_FILES doc/freetds.conf.5" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. Try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool 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. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='RC ' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: RC # The linker used to build libraries. LD=$lt_LD_RC # How to create reloadable object files. reload_flag=$lt_reload_flag_RC reload_cmds=$lt_reload_cmds_RC # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_RC # A language specific compiler. CC=$lt_compiler_RC # Is the compiler the GNU compiler? with_gcc=$GCC_RC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_RC # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_RC # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_RC # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_RC # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_RC # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_RC archive_expsym_cmds=$lt_archive_expsym_cmds_RC # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_RC module_expsym_cmds=$lt_module_expsym_cmds_RC # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_RC # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_RC # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_RC # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_RC # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_RC # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_RC # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_RC # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_RC # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_RC # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_RC # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_RC # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_RC # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_RC # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_RC # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_RC # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_RC # Specify filename containing input files. file_list_spec=$lt_file_list_spec_RC # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_RC # ### END LIBTOOL TAG CONFIG: RC _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi freetds-1.3.6/configure.ac000644 025423 025423 00000077375 14162303347 017117 0ustar00fredianofrediano000000 000000 dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html dnl http://autoconf-archive.cryp.to/ dnl dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ AC_INIT(FreeTDS, 1.3.6) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) AM_INIT_AUTOMAKE([dist-bzip2 parallel-tests subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)]) AC_CONFIG_HEADERS(include/config.h) AC_CONFIG_MACRO_DIR([m4]) dnl configuration directory will be /usr/local/etc AC_PREFIX_DEFAULT(/usr/local) dnl This disable address sanitizer leak detector as dnl some checks cause leaks which are detected as errors ASAN_OPTIONS='detect_leaks=0' export ASAN_OPTIONS dnl 0.X.Y -> 0.X.Y dnl 0.X.dev.date -> 0.(X-1).9999 dnl 0.XrcY -> 0.(X-1).9999 dnl dev.0.X.Y -> 0.X.Y ver=[`echo $VERSION.0 | sed 's,^dev\.,,; s,^\([0-9][0-9]*\.[0-9][0-9]*\)rc,\1.dev.,g; s/\.dev\./.9999./'`] match=['^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*'] if test "`echo $ver | sed \"s,$match,,\"`" != ""; then AC_MSG_ERROR([Invalid version $VERSION specified]) fi MAJOR=[`echo $ver | sed "s,$match,\1,"`] MINOR=[`echo $ver | sed "s,$match,\2,"`] SUBVERSION=[`echo $ver | sed "s,$match,\3,"`] BUILD_NUMBER="`date +1%j` - 1000 + ( `date +%Y` - 2021 )" BUILD_NUMBER="`expr $BUILD_NUMBER \* 366`" if test "$SUBVERSION" = "9999"; then MINOR=`expr $MINOR - 1` fi AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(SUBVERSION) AC_SUBST(BUILD_NUMBER) AH_TOP([#define _freetds_config_h_]) # ------------------------------------------------------------ # Commands and Utilities # ------------------------------------------------------------ AC_PROG_AWK AC_PROG_GREP AC_PROG_INSTALL AC_PROG_MKDIR_P AC_PROG_LN_S AC_PROG_SED PKG_PROG_PKG_CONFIG # ------------------------------------------------------------ # Host-specific configuration # ------------------------------------------------------------ AC_CANONICAL_HOST netdb_reentrant=no case $host in *-*-osf*) CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_POSIX_C_SOURCE=199506L" netdb_reentrant=yes ;; *-*-hpux11*) netdb_reentrant=yes ;; *-*-cygwin*) netdb_reentrant=yes ;; esac case $host_os in darwin* | rhapsody*) AM_CONDITIONAL(MACOSX, true) ;; *) AM_CONDITIONAL(MACOSX, false) ;; esac if test $netdb_reentrant = yes; then AC_DEFINE(NETDB_REENTRANT, 1, [Define to 1 if the BSD-style netdb interface is reentrant.]) fi AC_GNU_SOURCE AC_SYS_LARGEFILE # ------------------------------------------------------------ # Checks for programs. # ------------------------------------------------------------ AC_PROG_CC AC_PROG_CPP AM_PROG_CC_C_O AC_C_INLINE dnl Disable libtool 1.5 support for languages we don't use dnl (cfr http://lists.gnu.org/archive/html/libtool/2005-08/msg00137.html) define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl define([AC_LIBTOOL_LANG_GCJ_CONFIG], [:])dnl LT_INIT([win32-dll]) AC_LTDL_DLLIB LT_AC_PROG_RC AC_ARG_ENABLE(libiconv, AS_HELP_STRING([--disable-libiconv], [do not attempt to include libiconv]), [use_libiconv=$enableval], [use_libiconv=yes]) if test "$use_libiconv" = "yes" ; then AM_ICONV else AC_MSG_NOTICE(libiconv disabled) AC_DEFINE_UNQUOTED(ICONV_CONST, const, [Define as const if the declaration of iconv() needs const.]) fi # See if we have doxygen installed AC_CHECK_PROG(DOXYGEN,doxygen,doxygen) AM_CONDITIONAL(HAVE_DOXYGEN, [test -n "$DOXYGEN"]) AC_CHECK_PROG(ODBC_CONFIG,odbc_config,odbc_config) # ------------------------------------------------------------ # Check for git-only sources. # ------------------------------------------------------------ # # Distribution tarballs include some generated files. These # files are not maintained in git, but their bases are, and # the bases are not in the tarball. For example, num_limits.h # is distributed, but it is generated from numeric.pl, which # is kept in git. # If the base is found, we use it as a source in the Makefile, # otherwise the Makefile will (correctly) assume that the # generated file is already present. # if test -f "${srcdir}/src/tds/num_limits.pl"; then AM_CONDITIONAL(HAVE_PERL_SOURCES, true) AC_PATH_PROG(GPERF, gperf) AS_IF([test "x$GPERF" = x], [AC_MSG_ERROR([required program 'gperf' not found.])]) else AM_CONDITIONAL(HAVE_PERL_SOURCES, false) fi AC_SUBST(HAVE_PERL_SOURCES) # ------------------------------------------------------------ # Checks for libraries. # ------------------------------------------------------------ AC_ARG_ENABLE(krb5, AS_HELP_STRING([--enable-krb5@<:@=LIB@:>@], [enable Kerberos support, optionally with library])) krb5_libs=auto case $enable_krb5 in yes) ;; "" | no) krb5_libs= ;; -* | */* | *.a | *.so | *.so.* | *.o) krb5_libs="$enable_krb5" ;; *) krb5_libs="-l$enable_krb5" ;; esac ACX_PUSH_LIBS("") tds_mingw=no case $host in *-*-mingw*) tds_mingw=yes if test "$host_cpu" = "x86_64"; then LIBS="-lws2_32" elif test -r /usr/lib/w32api/libws2_32.a; then LIBS="-L/usr/lib/w32api -lws2_32" else LIBS="-lws2_32" fi LIBS="$LIBS -lcrypt32" krb5_libs= AM_CONDITIONAL(MINGW32, true) ;; *-*-hpux*) # these lines are needed to fix a problem for HP-UX # HP-UX define two versions of sockets, one BSD and one X/Open # these versions are not binary compatible (BSD use int where X/Open # use socklen_t == size_t) and different libraries (BSD in libc and # X/Open in libxnet). X/Open is used if _XOPEN_SOURCE and # _XOPEN_SOURCE_EXTENDED are defined. To complicate the things gcc # by default define _XOPEN_SOURCE_EXTENDED so define always both # constants and link always libxnet! CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED" LIBS="$LIBS -lxnet" AC_SEARCH_LIBS(gethostbyname, nsl) # check for _xpg_ functions AC_CHECK_FUNCS([_xpg_accept _xpg_getpeername _xpg_getsockname _xpg_getsockopt _xpg_recvfrom \ __accept __getpeername __getsockname __getsockopt __recvfrom]) AM_CONDITIONAL(MINGW32, false) ;; *) AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(gethostbyname, nsl) AM_CONDITIONAL(MINGW32, false) ;; esac case "$krb5_libs" in "" ) ;; "auto") AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gssapi]) if test "$ac_cv_search_gss_init_sec_context" != no; then AC_DEFINE(ENABLE_KRB5, 1, [Defined if --enable-krb5 used and library detected]) fi ;; *) AC_DEFINE(ENABLE_KRB5, 1, [Defined if --enable-krb5 used and library detected]) LIBS="$LIBS $krb5_libs" ;; esac if test -n "$krb5_libs"; then for d in /usr/include/heimdal /usr/include/krb5 /usr/include/et; do if test -d "$d"; then CPPFLAGS="$CPPFLAGS -I$d" fi done AC_CHECK_FUNCS([error_message]) fi NETWORK_LIBS="$LIBS" ACX_POP_LIBS AC_SUBST(NETWORK_LIBS) if test $tds_mingw = no; then # readline test # Readline is needed by the tty session. Set up a special READLINE_LIBS # substitution for it. # Readline is linked with curses, and on some systems termcap must be # linked in. Others (inc debian) have termcap built into ncurses. ACX_PUSH_LIBS("") AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap]) AC_CHECK_LIB([readline], [readline], [LIBS="$LIBS -lreadline" AC_DEFINE(HAVE_READLINE, 1, [Define to 1 if you have the GNU Readline library.])], [LIBS=""] ) AC_CHECK_FUNCS([rl_on_new_line rl_reset_line_state]) AC_LINK_IFELSE([AC_LANG_SOURCE([[ #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_READLINE #include #include #endif /* HAVE_READLINE */ int main() { rl_inhibit_completion = 1; return 0; } ]])],AC_DEFINE(HAVE_RL_INHIBIT_COMPLETION, 1, [Define to 1 if you have rl_inhibit_completion.])) READLINE_LIBS="$LIBS" ACX_POP_LIBS AC_SUBST(READLINE_LIBS) ACX_PTHREAD AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS) LIBS="$PTHREAD_LIBS $LIBS" AC_SEARCH_LIBS(pthread_condattr_setclock, [rt posix4 pthread]) AC_CHECK_FUNCS([pthread_condattr_setclock pthread_cond_timedwait_relative_np]) fi # check for SSPI AC_ARG_ENABLE(sspi, AS_HELP_STRING([--disable-sspi], [disable SSPI support])) # disable by default enable_sspi=${enable_sspi-yes} # only if MingW (TODO other compilers) test $tds_mingw != yes && enable_sspi=no AM_CONDITIONAL(HAVE_SSPI, test "$enable_sspi" = "yes") if test "$enable_sspi" = "yes"; then AC_DEFINE(HAVE_SSPI, 1, [Defined if not --disable-sspi and SSPI detected]) fi # ------------------------------------------------------------ # Checks for header files. # ------------------------------------------------------------ AC_HEADER_STDC AC_HEADER_TIME AC_STRUCT_TIMEZONE AC_CHECK_MEMBERS([struct tm.__tm_zone],,,[#include #include <$ac_cv_struct_tm> ]) AC_CHECK_HEADERS([errno.h libgen.h \ limits.h locale.h poll.h \ signal.h stddef.h \ sys/param.h sys/select.h sys/stat.h \ sys/time.h sys/types.h sys/resource.h \ sys/eventfd.h \ sys/wait.h unistd.h netdb.h \ wchar.h inttypes.h winsock2.h \ localcharset.h valgrind/memcheck.h malloc.h dirent.h \ stdbool.h gnutls/abstract.h getopt.h fcntl.h]) AC_CHECK_HEADERS([windows.h sql.h],[],[],[[#ifdef HAVE_WINDOWS_H # include #endif #ifdef HAVE_SQL_H # include #endif ]]) if test $tds_mingw = no; then AC_CHECK_HEADERS([ arpa/inet.h \ langinfo.h \ netdb.h \ netinet/in.h \ netinet/tcp.h \ roken.h \ com_err.h \ paths.h \ sys/ioctl.h \ sys/socket.h ]) fi AC_HAVE_INADDR_NONE # ------------------------------------------------------------ # Checks for integers/floats of different sizes # ------------------------------------------------------------ AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(float) AC_CHECK_SIZEOF(double) AC_CHECK_SIZEOF(long double) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(__int64) AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(wchar_t,,[$ac_includes_default #ifdef HAVE_WCHAR_H #include #endif]) case 2 in $ac_cv_sizeof_short) tds_sysdep_int16_type=short;; $ac_cv_sizeof_int) tds_sysdep_int16_type=int;; *) AC_MSG_ERROR(No 16-bit int found.) esac case 4 in $ac_cv_sizeof_short) tds_sysdep_int32_type=short;; $ac_cv_sizeof_int) tds_sysdep_int32_type=int;; $ac_cv_sizeof_long) tds_sysdep_int32_type=long;; *) AC_MSG_ERROR(No 32-bit int found.) esac case 4 in $ac_cv_sizeof_float) tds_sysdep_real32_type=float;; $ac_cv_sizeof_double) tds_sysdep_real32_type=double;; $ac_cv_sizeof_long_double) tds_sysdep_real32_type="long double";; *) AC_MSG_ERROR(No 32-bit real found.) esac case 8 in $ac_cv_sizeof_float) tds_sysdep_real64_type=float;; $ac_cv_sizeof_double) tds_sysdep_real64_type=double;; $ac_cv_sizeof_long_double) tds_sysdep_real64_type="long double";; *) AC_MSG_ERROR(No 64-bit real found.) esac case 8 in $ac_cv_sizeof_long) tds_sysdep_int64_type=long;; $ac_cv_sizeof_long_long) tds_sysdep_int64_type="long long";; $ac_cv_sizeof___int64) tds_sysdep_int64_type=__int64;; *) AC_MSG_ERROR([No 64-bit integer found.]) esac SPRINTF_I64_FORMAT case $ac_cv_sizeof_void_p in $ac_cv_sizeof_short) tds_sysdep_intptr_type=short;; $ac_cv_sizeof_int) tds_sysdep_intptr_type=int;; $ac_cv_sizeof_long) tds_sysdep_intptr_type=long;; $ac_cv_sizeof_long_long) tds_sysdep_intptr_type="long long";; $ac_cv_sizeof___int64) tds_sysdep_intptr_type=__int64;; *) AC_MSG_ERROR(No intptr type found.) esac AC_SUBST(tds_sysdep_int16_type) AC_SUBST(tds_sysdep_int32_type) AC_SUBST(tds_sysdep_real32_type) AC_SUBST(tds_sysdep_real64_type) AC_SUBST(tds_sysdep_int64_type) AC_SUBST(tds_sysdep_intptr_type) # ------------------------------------------------------------ # Checks for typedefs and structures # ------------------------------------------------------------ # ---- Solaris needs -DBSD_COMP to get FIONBIO defined ---- AC_MSG_CHECKING(is FIONBIO defined) AC_EGREP_CPP(yes, [#include #ifdef FIONBIO yes #endif ], AC_MSG_RESULT(yes), [ AC_EGREP_CPP(yes, [#define BSD_COMP #include #ifdef FIONBIO yes #endif ], AC_DEFINE(BSD_COMP, 1, [Define to 1 if you need BSD_COMP defined to get FIONBIO defined.]) AC_MSG_RESULT(need -DBSD_COMP), AC_MSG_RESULT(no)) ]) TYPE_SOCKLEN_T AC_MSG_CHECKING([whether getopt has optreset support]) AC_TRY_LINK([#ifdef HAVE_GETOPT_H #include #endif], [optreset = 0;], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETOPT_OPTRESET, 1, [Define if your getopt(3) defines and uses optreset])], [AC_MSG_RESULT(no)] ) # ------------------------------------------------------------ # Checks for compiler characteristics. # ------------------------------------------------------------ AC_C_BIGENDIAN AC_C_CONST case $host_os in mingw*) FREETDS_SYMBOLIC="-no-undefined" ;; hpux* | linux* | solaris*) AC_MSG_CHECKING([whether we can use -Wl,-Bsymbolic]) AC_LANG_CONFTEST([AC_LANG_PROGRAM([], [return 1])]) rm -f conftest.$ac_objext CMD="$SHELL $(test -n "$ac_top_builddir" && echo $ac_top_builddir || echo .)/libtool --mode=link $CC -o libtest.la conftest.$ac_ext >/dev/null 2>&1" if eval $CMD && test -s libtest.la; then AC_MSG_RESULT(yes) FREETDS_SYMBOLIC="-Wl,-Bsymbolic" else AC_MSG_RESULT(no) fi rm -f conftest.$ac_objext conftest.$ac_ext libtest.la rm -rf .libs ;; esac AC_SUBST(FREETDS_SYMBOLIC) # if GNU compiler but no GNU linker add explicitly libgcc # this is required for Solaris for example if test "$GCC" = yes; then for freetds_ldflag in "-static-libgcc" "-Wl,-static-libgcc"; do AC_MSG_CHECKING([whether we can use $freetds_ldflag]) saved_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $freetds_ldflag" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [ac_cv_use_freetds_flag="yes"], [ac_cv_use_freetds_flag="no"]) LDFLAGS=$saved_LDFLAGS AC_MSG_RESULT($ac_cv_use_freetds_flag) if test "$ac_cv_use_freetds_flag" = "yes"; then FREETDS_LIBGCC="$freetds_ldflag" break; fi done AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((destructor)) my_uninit(void) {}])], AC_DEFINE(TDS_ATTRIBUTE_DESTRUCTOR, 1, [Define to 1 if your compiler supports __attribute__((destructor)).])) fi AC_SUBST(FREETDS_LIBGCC) TDS_NULL_IS_ZERO # ------------------------------------------------------------ # Checks for library functions. # ------------------------------------------------------------ AC_CHECK_FUNCS([vsnprintf _vsnprintf _vscprintf gettimeofday \ nl_langinfo locale_charset setenv putenv \ getuid getpwuid getpwuid_r fstat alarm fork \ gethrtime localtime_r setitimer eventfd \ _fseeki64 _ftelli64 setrlimit pthread_cond_timedwait \ _lock_file _unlock_file usleep nanosleep readdir_r]) AC_TRY_LINK([#include #include ], [return system("ls") != 0;], AC_DEFINE(HAVE_SYSTEM, 1, [Define to 1 if you have the 'system' function])) ACX_PUSH_LIBS("$LIBS $NETWORK_LIBS") AC_CHECK_FUNCS([inet_ntoa_r getipnodebyaddr getipnodebyname \ getaddrinfo inet_ntop gethostname poll socketpair strtok_s]) AC_TRY_LINK([#ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETDB_H #include #endif #ifdef HAVE_WINSOCK2_H #include #include #endif], [return getaddrinfo(NULL, NULL, NULL, NULL);], AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have getaddrinfo function])) ACX_POP_LIBS AC_REPLACE_FUNCS([asprintf vasprintf strtok_r readpassphrase \ strlcpy strlcat basename getopt strsep daemon setenv]) AC_FUNC_FSEEKO TDS_GETTIMEMILLI AC_FUNC_ALLOCA # ------------------------------------------------------------ # Checks for library variables. # ------------------------------------------------------------ AC_HAVE_MALLOC_OPTIONS # ------------------------------------------------------------ # Compile time options # ------------------------------------------------------------ AC_MSG_RESULT(checking compile-time options) AC_ARG_WITH(tdsver, AS_HELP_STRING([--with-tdsver=VERSION], [TDS protocol version (5.0/7.1/7.2/7.3/7.4/auto) [auto]])) case "$with_tdsver" in 4.2) AC_MSG_ERROR([Protocol 4.2 cannot be specified as obsolete]) ;; 4.6) AC_MSG_ERROR([Protocol 4.6 cannot be specified as obsolete and never correctly supported]) ;; 5.0) AC_DEFINE(TDS50, 1, [Define to use TDS 5.0 by default]) ;; 7.0) AC_MSG_ERROR([Protocol 7.0 cannot be specified during configure as too insecure]) ;; 7.1) AC_DEFINE(TDS71, 1, [Define to use TDS 7.1 by default]) ;; 7.2) AC_DEFINE(TDS72, 1, [Define to use TDS 7.2 by default]) ;; 7.3) AC_DEFINE(TDS73, 1, [Define to use TDS 7.3 by default]) ;; 7.4) AC_DEFINE(TDS74, 1, [Define to use TDS 7.4 by default]) ;; ""|auto) ;; *) AC_MSG_ERROR([Invalid value specified for --with-tdsver: $with_tdsver]) ;; esac AC_ARG_WITH(iodbc, AS_HELP_STRING([--with-iodbc=DIR], [build odbc driver against iODBC in DIR])) if test "x$with_iodbc" = "xyes"; then # The user asked for iodbc support, but didn't tell us # where to look. So, we'll try to get the info from # pkg-config. If we can't, we'll display an error. PKG_CHECK_MODULES(IODBC, libiodbc) CPPFLAGS="$CPPFLAGS -DIODBC" ODBC_LDFLAGS="$IODBC_LIBS" # The ODBC_INC variable is only substituted into *_CPPFLAGS, # which is there $IODBC_CFLAGS is supposed to go anyway. ODBC_INC="$IODBC_CFLAGS" odbc=true iodbc=true elif test "x$with_iodbc" != "x" -a "x$with_iodbc" != "xno"; then if echo "$with_iodbc" | grep -v '^/'; then with_iodbc="$PWD/$with_iodbc" fi CPPFLAGS="$CPPFLAGS -DIODBC" ODBC_INC="$with_iodbc/include" test -r "$ODBC_INC/isql.h" || AC_MSG_ERROR([isql.h not found]) test -r "$ODBC_INC/isqlext.h" || AC_MSG_ERROR([isqlext.h not found]) ODBC_INC="-I$ODBC_INC" ODBC_LDFLAGS="-L$with_iodbc/lib -liodbc" odbc=true iodbc=true fi AC_ARG_WITH(unixodbc, AS_HELP_STRING([--with-unixodbc=DIR], [build odbc driver against unixODBC in DIR])) if test "x$with_unixodbc" = "xyes"; then # The user asked for unixodbc support, but didn't tell us # where to look. We'll try to get the installation prefix from # the odbc_config executable, and if we can't, we'll display # an error. if test -z "$ODBC_CONFIG"; then AC_MSG_ERROR([odbc_config not found]) fi with_unixodbc=`$ODBC_CONFIG --prefix` if ! test -x "${with_unixodbc}/bin/odbc_config"; then AC_MSG_ERROR([could not find your unixODBC installation]) fi fi # Note: the --with-unixodbc=yes case will make use of this one, # after populating $with_unixodbc with the correct prefix. if test "x$with_unixodbc" != "x" -a "x$with_unixodbc" != "xno"; then if test "x$with_iodbc" != "x" -a "x$with_iodbc" != "xno"; then AC_MSG_ERROR([choose at most one of --with-iodbc or --with-unixodbc]) fi if echo "$with_unixodbc" | grep -v '^/'; then with_unixodbc="$PWD/$with_unixodbc" fi CPPFLAGS="$CPPFLAGS -DUNIXODBC" if test -f "$with_unixodbc/bin/odbc_config"; then ODBC_CONFIG="$with_unixodbc/bin/odbc_config" ODBC_INC=`$ODBC_CONFIG --include-prefix` ODBC_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`" else # if not available do not use system default ODBC_CONFIG="" ODBC_INC="$with_unixodbc/include" ODBC_LDFLAGS="-L$with_unixodbc/lib" fi test -r "$ODBC_INC/sql.h" || AC_MSG_ERROR([sql.h not found]) test -r "$ODBC_INC/sqlext.h" || AC_MSG_ERROR([sqlext.h not found]) ODBC_INC="-I$ODBC_INC" ODBC_LDFLAGS="$ODBC_LDFLAGS -lodbc" odbc=true unixodbc=true fi AC_ARG_WITH(odbc_nodm, AS_HELP_STRING([--with-odbc-nodm=DIR], [build odbc using headers in DIR/include])) if test "x$with_odbc_nodm" != "x" -a "x$with_odbc_nodm" != "xno"; then if echo "$with_odbc_nodm" | grep -v '^/'; then with_odbc_nodm="$PWD/$with_odbc_nodm" fi CPPFLAGS="$CPPFLAGS -DTDS_NO_DM" ODBC_INC="$with_odbc_nodm/include" test -r "$ODBC_INC/sql.h" || AC_MSG_ERROR([sql.h not found]) test -r "$ODBC_INC/sqlext.h" || AC_MSG_ERROR([sqlext.h not found]) ODBC_INC="-I$ODBC_INC" # The next line is for linking the unittests. Here the ODBC driver # itself is treated as the driver manager to be linked. # Can't use ODBC_LDFLAGS/LDFLAGS variables since they are used in building # other directories. ODBC_LDFLAGS="-L\$(top_builddir)/src/odbc -ltdsodbc" odbc=true fi build_odbc=yes if test "$odbc" != "true"; then AC_ARG_ENABLE(odbc, AS_HELP_STRING([--disable-odbc], [do not attempt to build odbc the driver]), [build_odbc=$enableval], [build_odbc=yes]) fi AM_CONDITIONAL(INCODBC, test "$build_odbc" = "yes") if test "$build_odbc" = "yes" then case $host_os in darwin* | rhapsody*) if test "$with_odbc_nodm" = ""; then FREETDS_ODBC_MODULE="-module" fi ;; esac AC_SUBST(FREETDS_ODBC_MODULE) # odbc not specified, try to detect it echo looking for installed odbc driver manager if test "$odbc" != "true" -a $tds_mingw = yes; then odbc=true unixodbc=true CPPFLAGS="$CPPFLAGS -DUNIXODBC" ODBC_LDFLAGS="-lodbc32" fi # try to detect searching for iODBC if test "$odbc" != "true" -a "x$with_iodbc" != "xno"; then AC_CHECK_LIB(iodbc, SQLConnect, [AC_CHECK_HEADER([isql.h], [odbc=true iodbc=true CPPFLAGS="$CPPFLAGS -DIODBC" ODBC_LDFLAGS="-liodbc"])]) fi # try to detect searching for unixODBC if test "$odbc" != "true" -a "x$with_unixodbc" != "xno"; then AC_CHECK_LIB(odbc, SQLConnect, [AC_CHECK_HEADER([sql.h], [odbc=true unixodbc=true CPPFLAGS="$CPPFLAGS -DUNIXODBC" ODBC_LDFLAGS="-lodbc"])]) fi if test "$odbc" = "true"; then saved_LDFLAGS="$LDFLAGS" ODBCINST_LDFLAGS= LDFLAGS="$LDFLAGS $ODBC_LDFLAGS" if test $tds_mingw = yes; then ODBCINST_LDFLAGS="-lodbccp32" elif test "$unixodbc" = "true"; then if test -n "$ODBC_CONFIG"; then CPPFLAGS="$CPPFLAGS `$ODBC_CONFIG --cflags`" fi AC_CHECK_LIB(odbcinst, SQLGetPrivateProfileString, [ODBCINST_LDFLAGS="$ODBC_LDFLAGS -lodbcinst"]) elif test "$iodbc" = "true"; then AC_CHECK_LIB(iodbcinst, SQLGetPrivateProfileString, [ODBCINST_LDFLAGS="$ODBC_LDFLAGS -liodbcinst"]) fi if test "$ODBCINST_LDFLAGS" != ""; then AC_DEFINE_UNQUOTED(HAVE_SQLGETPRIVATEPROFILESTRING, 1, [Define to 1 if you have the SQLGetPrivateProfileString function.]) fi LDFLAGS="$saved_LDFLAGS" fi if test "$iodbc" = "true"; then save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ODBC_INC" AC_CHECK_HEADERS(iodbcinst.h) CPPFLAGS="$save_cppflags" fi # test for SQLLEN (iODBC do not define but typedef it) save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ODBC_INC" AC_TRY_COMPILE([#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include ], [SQLLEN len = 123;], AC_DEFINE(HAVE_SQLLEN, 1, [Define if sqltypes.h define SQLLEN]) # check SQLColAttribute definition AC_TRY_COMPILE([#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include SQLRETURN SQL_API SQLColAttribute (SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLLEN * NumericAttribute) { }], [return 0], AC_DEFINE(TDS_SQLCOLATTRIBUTE_SQLLEN, 1, [Define to 1 if last argument of SQLColAttribute it's SQLLEN *])) # check is SQLParamOptions accept SQLULEN AC_TRY_COMPILE([#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include SQLRETURN SQL_API SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow) { return SQL_SUCCESS; }], [return 0], AC_DEFINE(TDS_SQLPARAMOPTIONS_SQLLEN, 1, [Define to 1 if SQLParamOptions accept SQLULEN as arguments])) ) AC_CHECK_TYPES([SQLSETPOSIROW, SQLROWSETSIZE, SQLROWOFFSET],,, [#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include #include ]) # test for sizeof(SQLWCHAR) AC_CHECK_SIZEOF(SQLWCHAR,,[#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) #include #endif #include ]) CPPFLAGS="$save_cppflags" else AC_MSG_NOTICE(odbc disabled) fi AM_CONDITIONAL(ODBC, test "$odbc" = "true") AM_CONDITIONAL(UNIXODBC, test "$unixodbc" = "true") AC_SUBST(ODBC) AC_SUBST(ODBC_INC) AC_SUBST(ODBC_LDFLAGS) AC_SUBST(ODBCINST_LDFLAGS) AC_DEFUN([TDS_CHECK_GMP], [ AC_TRY_LINK([#include #include ], [mpz_t x; mpz_init(x); mpz_powm(x,x,x,x); mpz_clear(x); return 0;], AC_DEFINE(HAVE_GMP, 1, [Define if you have GMP library]), [$1])]) AC_DEFUN([TDS_HAVE_GMP], [TDS_CHECK_GMP([gmp_save_LIBS="$LIBS" LIBS="$LIBS -lgmp" TDS_CHECK_GMP([LIBS="$gmp_save_LIBS"])])]) AC_ARG_WITH(gnutls, AS_HELP_STRING([--with-gnutls], [build with GnuTLS support])) if test "$with_gnutls" = "yes"; then AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if you have GnuTLS.]) gnutls_backend=unknown PKG_CHECK_MODULES(GNUTLS, gnutls, [CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS" NETWORK_LIBS="$NETWORK_LIBS $GNUTLS_LIBS" if "$PKG_CONFIG" --libs --static gnutls | grep nettle > /dev/null 2>&1 ; then gnutls_backend=nettle AC_DEFINE(GNUTLS_USE_NETTLE, 1, [Define to 1 if GNU tls use nettle as backend.]) PKG_CHECK_MODULES(NETTLE, nettle, [AC_DEFINE(HAVE_NETTLE, 1, [Define to 1 if nettle is present.]) NETWORK_LIBS="$NETWORK_LIBS $NETTLE_LIBS"]) ACX_PUSH_LIBS("$NETWORK_LIBS") TDS_HAVE_GMP AC_SEARCH_LIBS(nettle_rsa_public_key_init, [nettle hogweed]) NETWORK_LIBS="$LIBS" ACX_POP_LIBS fi], [CPPFLAGS="$CPPFLAGS `libgnutls-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgnutls-config --libs`"] ) ACX_PUSH_LIBS("$NETWORK_LIBS") AC_CHECK_FUNCS([gnutls_certificate_set_verify_function gnutls_record_disable_padding gnutls_rnd]) ACX_POP_LIBS if test "$gnutls_backend" = "unknown"; then gnutls_backend=gcrypt NETWORK_LIBS="$NETWORK_LIBS -ltasn1" fi else CHECK_OPENSSL fi AC_ARG_ENABLE(apps, AS_HELP_STRING([--disable-apps], [skip build of src/apps (including tsql)])) AM_CONDITIONAL(INCAPPS, test "$enable_apps" != "no") AC_ARG_ENABLE(server, AS_HELP_STRING([--disable-server], [skip build of src/server directory])) AM_CONDITIONAL(INCSERVER, test "$enable_server" != "no") AC_ARG_ENABLE(pool, AS_HELP_STRING([--disable-pool], [skip build of src/pool directory])) AC_ARG_ENABLE(msdblib, AS_HELP_STRING([--enable-msdblib], [for MS style dblib])) if test "$enable_msdblib" = "yes" ; then dblib_define="#define MSDBLIB 1" else dblib_define="#define SYBDBLIB 1" fi AC_SUBST(dblib_define) AC_ARG_ENABLE(sybase-compat, AS_HELP_STRING([--enable-sybase-compat], [enable increased Open Client binary compatibility])) AM_CONDITIONAL(SYBASE_COMPAT, test x$enable_sybase_compat = xyes) if test x$enable_sybase_compat = xyes; then AC_DEFINE(TDS_SYBASE_COMPAT, 1, [Defined if --enable-sybase-compat used]) fi AC_MSG_CHECKING(threadsafety) # Enable or disable thread safetiness # This option is enabled by default because most OS's support it. # A more sophisticated approach would be to set the default per-OS. AC_ARG_ENABLE(threadsafe, AS_HELP_STRING([--disable-threadsafe], [disable calls to threadsafe fuctions e.g.,gethostbyname_r ]), [use_threadsafe=$enableval], [use_threadsafe=yes]) if test "$enable_threadsafe" != "no" ; then CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE" AC_MSG_RESULT(enabled) else AC_DEFINE(TDS_NO_THREADSAFE, 1, [Define if you don't care about thread safety]) AC_MSG_RESULT(disabled) enable_pool=no fi AM_CONDITIONAL(ENABLE_THREADSAFE, test "$enable_threadsafe" != "no") AM_CONDITIONAL(INCPOOL, test "$enable_pool" != "no") # newer gcc are configured to fail to resolve references to libraries not # explicitly listed on the linker commandline. # So to make build add explicitly gcrypt library. if test "$enable_threadsafe" != "no" -a "$with_gnutls" = "yes" -a "$gnutls_backend" = "gcrypt"; then PKG_CHECK_MODULES(GCRYPT, gcrypt, [CPPFLAGS="$CPPFLAGS $GCRYPT_CFLAGS" NETWORK_LIBS="$NETWORK_LIBS $GCRYPT_LIBS"], [CPPFLAGS="$CPPFLAGS `libgcrypt-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgcrypt-config --libs`"]) fi # we don't need to check netdb functions if they are already threadsafe if test $netdb_reentrant != yes; then AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R AC_raf_FUNC_WHICH_GETSERVBYNAME_R AC_tds_FUNC_WHICH_GETHOSTBYADDR_R fi AC_tds_FUNC_WHICH_GETPWUID_R AC_tds_FUNC_WHICH_LOCALTIME_R # easy test for pthread (no library, only mutex support) AC_TRY_LINK([#include #if !defined(_WIN32) pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; #endif], [pthread_mutex_lock(&mutex); pthread_mutex_unlock(&mutex)], AC_DEFINE(TDS_HAVE_PTHREAD_MUTEX, 1, [Define if you have pthread with mutex support])) # easy test for locking stdio AC_TRY_LINK([#include ], [int c; flockfile(stdin); c = getc_unlocked(stdin); funlockfile(stdin);], AC_DEFINE(TDS_HAVE_STDIO_LOCKED, 1, [Define if stdio support locking])) AC_ARG_ENABLE(debug, AS_HELP_STRING([--disable-debug], [disable assert and other things]), [use_debug=$enableval], [use_debug=yes]) if test "$use_debug" = "yes" ; then AC_MSG_NOTICE(debug enabled) CPPFLAGS="$CPPFLAGS -DDEBUG=1" AC_ARG_ENABLE(extra-checks, AS_HELP_STRING([--enable-extra-checks], [enable extra checks on code])) if test "$enable_extra_checks" = "yes" ; then AC_DEFINE_UNQUOTED(ENABLE_EXTRA_CHECKS, 1, [Define to enable extra checks on code]) fi else AC_MSG_NOTICE(debug disabled) CPPFLAGS="$CPPFLAGS -DNDEBUG=1" fi AC_ARG_ENABLE(developing, AS_HELP_STRING([--enable-developing], [enable code still in develop])) if test "$enable_developing" = "yes" ; then AC_DEFINE_UNQUOTED(ENABLE_DEVELOPING, 1, [Define to enable work in progress code]) fi AM_CONDITIONAL(ENABLE_DEVELOPING, test "$enable_developing" = "yes") AC_ARG_ENABLE(mars, AS_HELP_STRING([--disable-mars], [enable MARS code])) if test "$enable_mars" != "no" ; then AC_DEFINE_UNQUOTED(ENABLE_ODBC_MARS, 1, [Define to enable MARS support]) fi AC_ARG_ENABLE(odbc-wide, AS_HELP_STRING([--disable-odbc-wide], [disable wide string support in odbc])) if test "$enable_odbc_wide" != "no" ; then AC_DEFINE_UNQUOTED(ENABLE_ODBC_WIDE, 1, [Define to enable ODBC wide string support]) AC_ARG_ENABLE(odbc-wide-tests, AS_HELP_STRING([--enable-odbc-wide-tests], [enable compiling ODBC tests to use wide functions])) AM_CONDITIONAL(ODBC_WIDE_TESTS, test "$enable_odbc_wide_tests" = "yes") else AM_CONDITIONAL(ODBC_WIDE_TESTS, false) fi AC_ARG_ENABLE(distcheck_build, AS_HELP_STRING([--enable-distcheck-build], [used internally for testing])) if test "$enable_distcheck_build" = "yes" ; then AM_CONDITIONAL(DISTCHECK_BUILD, true) else AM_CONDITIONAL(DISTCHECK_BUILD, false) fi # ------------------------------------------------------------ # LTLIBOBJS hack (for autoconf-2.53) # ------------------------------------------------------------ # This is necessary so that .o files in LIBOBJS are also built via # the ANSI2KNR-filtering rules. LIB@&t@OBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'` LTLIBOBJS=`echo "$LIB@&t@OBJS" | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` AC_SUBST(LTLIBOBJS) # enable some warning for gcc if test "$ac_compiler_gnu" = "yes" ; then CPPFLAGS="$CPPFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -Wpointer-arith" fi AX_CFLAGS_GCC_OPTION([-Wdeclaration-after-statement]) AC_MSG_RESULT(done) # ------------------------------------------------------------ # Final output # ------------------------------------------------------------ AC_CONFIG_FILES(include/freetds/version.h \ include/tds_sysdep_public.h \ Makefile \ include/Makefile \ include/freetds/Makefile \ doc/Makefile \ samples/Makefile \ src/Makefile \ src/tds/Makefile src/tds/unittests/Makefile \ src/dblib/Makefile src/dblib/unittests/Makefile \ src/ctlib/Makefile src/ctlib/unittests/Makefile \ src/replacements/Makefile \ src/replacements/unittests/Makefile \ src/utils/Makefile \ src/utils/unittests/Makefile \ src/server/Makefile \ src/pool/Makefile \ src/odbc/Makefile \ src/odbc/unittests/Makefile \ src/apps/Makefile \ src/apps/fisql/Makefile \ freetds.spec \ win32/Makefile \ win32/freetds.nsh \ src/odbc/version.rc \ vms/Makefile misc/Makefile \ doc/freebcp.1 doc/tsql.1 doc/osql.1 \ doc/bsqldb.1 doc/bsqlodbc.1 doc/defncopy.1 \ doc/datacopy.1 doc/fisql.1 doc/freetds.conf.5 ) AC_OUTPUT freetds-1.3.6/aclocal.m4000644 025423 025423 00000501067 14162303353 016454 0ustar00fredianofrediano000000 000000 # generated automatically by aclocal 1.16.1 -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # host-cpu-c-abi.m4 serial 11 dnl Copyright (C) 2002-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible and Sam Steingold. dnl Sets the HOST_CPU variable to the canonical name of the CPU. dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its dnl C language ABI (application binary interface). dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in dnl config.h. dnl dnl This canonical name can be used to select a particular assembly language dnl source file that will interoperate with C code on the given host. dnl dnl For example: dnl * 'i386' and 'sparc' are different canonical names, because code for i386 dnl will not run on SPARC CPUs and vice versa. They have different dnl instruction sets. dnl * 'sparc' and 'sparc64' are different canonical names, because code for dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit dnl mode, but not both. dnl * 'mips' and 'mipsn32' are different canonical names, because they use dnl different argument passing and return conventions for C functions, and dnl although the instruction set of 'mips' is a large subset of the dnl instruction set of 'mipsn32'. dnl * 'mipsn32' and 'mips64' are different canonical names, because they use dnl different sizes for the C types like 'int' and 'void *', and although dnl the instruction sets of 'mipsn32' and 'mips64' are the same. dnl * The same canonical name is used for different endiannesses. You can dnl determine the endianness through preprocessor symbols: dnl - 'arm': test __ARMEL__. dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN. dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because dnl - Instructions that do not exist on all of these CPUs (cmpxchg, dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your dnl assembly language source files use such instructions, you will dnl need to make the distinction. dnl - Speed of execution of the common instruction set is reasonable across dnl the entire family of CPUs. If you have assembly language source files dnl that are optimized for particular CPU types (like GNU gmp has), you dnl will need to make the distinction. dnl See . AC_DEFUN([gl_HOST_CPU_C_ABI], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_C_ASM]) AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], [case "$host_cpu" in changequote(,)dnl i[4567]86 ) changequote([,])dnl gl_cv_host_cpu_c_abi=i386 ;; x86_64 ) # On x86_64 systems, the C compiler may be generating code in one of # these ABIs: # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 # with native Windows (mingw, MSVC). # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if (defined __x86_64__ || defined __amd64__ \ || defined _M_X64 || defined _M_AMD64) int ok; #else error fail #endif ]])], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=x86_64-x32], [gl_cv_host_cpu_c_abi=x86_64])], [gl_cv_host_cpu_c_abi=i386]) ;; changequote(,)dnl alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) changequote([,])dnl gl_cv_host_cpu_c_abi=alpha ;; arm* | aarch64 ) # Assume arm with EABI. # On arm64 systems, the C compiler may be generating code in one of # these ABIs: # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef __aarch64__ int ok; #else error fail #endif ]])], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=arm64-ilp32], [gl_cv_host_cpu_c_abi=arm64])], [# Don't distinguish little-endian and big-endian arm, since they # don't require different machine code for simple operations and # since the user can distinguish them through the preprocessor # defines __ARMEL__ vs. __ARMEB__. # But distinguish arm which passes floating-point arguments and # return values in integer registers (r0, r1, ...) - this is # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which # passes them in float registers (s0, s1, ...) and double registers # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer # sets the preprocessor defines __ARM_PCS (for the first case) and # __ARM_PCS_VFP (for the second case), but older GCC does not. echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c # Look for a reference to the register d0 in the .s file. AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then gl_cv_host_cpu_c_abi=armhf else gl_cv_host_cpu_c_abi=arm fi rm -f conftest* ]) ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) # On hppa, the C compiler may be generating 32-bit code or 64-bit # code. In the latter case, it defines _LP64 and __LP64__. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef __LP64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=hppa64], [gl_cv_host_cpu_c_abi=hppa]) ;; ia64* ) # On ia64 on HP-UX, the C compiler may be generating 64-bit code or # 32-bit code. In the latter case, it defines _ILP32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=ia64-ilp32], [gl_cv_host_cpu_c_abi=ia64]) ;; mips* ) # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this # at 32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=mips64], [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but # may later get defined by ), and _MIPS_SIM == _ABIN32. # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but # may later get defined by ), and _MIPS_SIM == _ABIO32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if (_MIPS_SIM == _ABIN32) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=mipsn32], [gl_cv_host_cpu_c_abi=mips])]) ;; powerpc* ) # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. # No need to distinguish them here; the caller may distinguish # them based on the OS. # On powerpc64 systems, the C compiler may still be generating # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __powerpc64__ || defined _ARCH_PPC64 int ok; #else error fail #endif ]])], [# On powerpc64, there are two ABIs on Linux: The AIX compatible # one and the ELFv2 one. The latter defines _CALL_ELF=2. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined _CALL_ELF && _CALL_ELF == 2 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=powerpc64-elfv2], [gl_cv_host_cpu_c_abi=powerpc64]) ], [gl_cv_host_cpu_c_abi=powerpc]) ;; rs6000 ) gl_cv_host_cpu_c_abi=powerpc ;; riscv32 | riscv64 ) # There are 2 architectures (with variants): rv32* and rv64*. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if __riscv_xlen == 64 int ok; #else error fail #endif ]])], [cpu=riscv64], [cpu=riscv32]) # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. # Size of 'long' and 'void *': AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ int ok; #else error fail #endif ]])], [main_abi=lp64], [main_abi=ilp32]) # Float ABIs: # __riscv_float_abi_double: # 'float' and 'double' are passed in floating-point registers. # __riscv_float_abi_single: # 'float' are passed in floating-point registers. # __riscv_float_abi_soft: # No values are passed in floating-point registers. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __riscv_float_abi_double int ok; #else error fail #endif ]])], [float_abi=d], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __riscv_float_abi_single int ok; #else error fail #endif ]])], [float_abi=f], [float_abi='']) ]) gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" ;; s390* ) # On s390x, the C compiler may be generating 64-bit (= s390x) code # or 31-bit (= s390) code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ || defined __s390x__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=s390x], [gl_cv_host_cpu_c_abi=s390]) ;; sparc | sparc64 ) # UltraSPARCs running Linux have `uname -m` = "sparc64", but the # C compiler still generates 32-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=sparc64], [gl_cv_host_cpu_c_abi=sparc]) ;; *) gl_cv_host_cpu_c_abi="$host_cpu" ;; esac ]) dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" AC_SUBST([HOST_CPU]) AC_SUBST([HOST_CPU_C_ABI]) # This was # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) # earlier, but KAI C++ 3.2d doesn't like this. sed -e 's/-/_/g' >> confdefs.h < #include ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_func_iconv=yes]) if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #include ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_lib_iconv=yes] [am_cv_func_iconv=yes]) LIBS="$am_save_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, dnl Solaris 10. am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include #include #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif ]], [[int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ { /* Try standardized names. */ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); /* Try IRIX, OSF/1 names. */ iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); /* Try AIX names. */ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); /* Try HP-UX names. */ iconv_t cd4 = iconv_open ("utf8", "eucJP"); if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) result |= 16; if (cd1 != (iconv_t)(-1)) iconv_close (cd1); if (cd2 != (iconv_t)(-1)) iconv_close (cd2); if (cd3 != (iconv_t)(-1)) iconv_close (cd3); if (cd4 != (iconv_t)(-1)) iconv_close (cd4); } return result; ]])], [am_cv_func_iconv_works=yes], , [case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac]) test "$am_cv_func_iconv_works" = no || break done LIBS="$am_save_LIBS" ]) case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then AC_DEFINE([HAVE_ICONV], [1], [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST([LIBICONV]) AC_SUBST([LTLIBICONV]) ]) dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to dnl avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". dnl This is tricky because of the way 'aclocal' is implemented: dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. dnl Otherwise aclocal's initial scan pass would miss the macro definition. dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. dnl Otherwise aclocal would emit many "Use of uninitialized value $1" dnl warnings. m4_define([gl_iconv_AC_DEFUN], m4_version_prereq([2.64], [[AC_DEFUN_ONCE( [$1], [$2])]], [m4_ifdef([gl_00GNULIB], [[AC_DEFUN_ONCE( [$1], [$2])]], [[AC_DEFUN( [$1], [$2])]])])) gl_iconv_AC_DEFUN([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_MSG_CHECKING([for iconv declaration]) AC_CACHE_VAL([am_cv_proto_iconv], [ AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #include #include extern #ifdef __cplusplus "C" #endif #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); #else size_t iconv(); #endif ]], [[]])], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` AC_MSG_RESULT([ $am_cv_proto_iconv]) else dnl When compiling GNU libiconv on a system that does not have iconv yet, dnl pick the POSIX compliant declaration without 'const'. am_cv_proto_iconv_arg1="" fi AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], [Define as const if the declaration of iconv() needs const.]) dnl Also substitute ICONV_CONST in the gnulib generated . m4_ifdef([gl_ICONV_H_DEFAULTS], [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) if test -n "$am_cv_proto_iconv_arg1"; then ICONV_CONST="const" fi ]) ]) # lib-ld.m4 serial 9 dnl Copyright (C) 1996-2003, 2009-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Subroutines of libtool.m4, dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid dnl collision with libtool.m4. dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], [# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 /dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi if test -n "$LD"; then AC_MSG_CHECKING([for ld]) elif test "$GCC" = yes; then AC_MSG_CHECKING([for ld used by $CC]) elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi if test -n "$LD"; then # Let the user override the test with a path. : else AC_CACHE_VAL([acl_cv_path_LD], [ acl_cv_path_LD= # Final result of this test ac_prog=ld # Program to search in $PATH if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) acl_output=`($CC -print-prog-name=ld) 2>&5` ;; esac case $acl_output in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` done # Got the pathname. No search in PATH is needed. acl_cv_path_LD="$acl_output" ac_prog= ;; "") # If it fails, then pretend we aren't using GCC. ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac fi if test -n "$ac_prog"; then # Search for $ac_prog in $PATH. acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE([rpath], [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_FROMPACKAGE(name, package) dnl declares that libname comes from the given package. The configure file dnl will then not have a --with-libname-prefix option but a dnl --with-package-prefix option. Several libraries can come from the same dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar dnl macro call that searches for libname. AC_DEFUN([AC_LIB_FROMPACKAGE], [ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_frompackage_]NAME, [$2]) popdef([NAME]) pushdef([PACK],[$2]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_libsinpackage_]PACKUP, m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) popdef([PACKUP]) popdef([PACK]) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_ARG_WITH(PACK[-prefix], [[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && test ! -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi ]) dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= LTLIB[]NAME= INC[]NAME= LIB[]NAME[]_PREFIX= dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been dnl computed. So it has to be reset here. HAVE_LIB[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" dnl The same code as in the loop below: dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$acl_hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi popdef([PACKLIBS]) popdef([PACKUP]) popdef([PACK]) popdef([NAME]) ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) dnl For those cases where a variable contains several -L and -l options dnl referring to unknown libraries and directories, this macro determines the dnl necessary additional linker options for the runtime path. dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) dnl sets LDADDVAR to linker options needed together with LIBSVALUE. dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, dnl otherwise linking without libtool is assumed. AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], [ AC_REQUIRE([AC_LIB_RPATH]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) $1= if test "$enable_rpath" != no; then if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode directories into the resulting dnl binary. rpathdirs= next= for opt in $2; do if test -n "$next"; then dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= else case $opt in -L) next=yes ;; -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2"; then rpathdirs="$rpathdirs $dir" fi next= ;; *) next= ;; esac fi done if test "X$rpathdirs" != "X"; then if test -n ""$3""; then dnl libtool is used for linking. Use -R options. for dir in $rpathdirs; do $1="${$1}${$1:+ }-R$dir" done else dnl The linker is used for linking directly. if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user dnl must pass all path elements in one option. alldirs= for dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="$flag" else dnl The -rpath options are cumulative. for dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" $1="${$1}${$1:+ }$flag" done fi fi fi fi fi AC_SUBST([$1]) ]) # lib-prefix.m4 serial 14 dnl Copyright (C) 2001-2005, 2008-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_ARG_WITH([lib-prefix], [[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" ]) dnl AC_LIB_PREPARE_MULTILIB creates dnl - a variable acl_libdirstem, containing the basename of the libdir, either dnl "lib" or "lib64" or "lib/64", dnl - a variable acl_libdirstem2, as a secondary possible value for dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or dnl "lib/amd64". AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ dnl There is no formal standard regarding lib and lib64. dnl On glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine dnl the compiler's default mode by looking at the compiler's library search dnl path. If at least one of its elements ends in /lib64 or points to a dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. dnl Otherwise we use the default, namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) case "$host_os" in solaris*) AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef _LP64 int ok; #else error fail #endif ]])], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) ]);; esac dnl Allow the user to override the result by setting acl_cv_libdirstems. AC_CACHE_CHECK([for the common suffixes of directories in the library search path], [acl_cv_libdirstems], [acl_libdirstem=lib acl_libdirstem2= case "$host_os" in solaris*) dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment dnl . dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the dnl symlink is missing, so we set acl_libdirstem2 too. if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi ;; *) dnl If $CC generates code for a 32-bit ABI, the libraries are dnl surely under $prefix/lib, not $prefix/lib64. if test "$HOST_CPU_C_ABI_32BIT" != yes; then dnl The result is a property of the system. However, non-system dnl compilers sometimes have odd library search paths. Therefore dnl prefer asking /usr/bin/gcc, if available, rather than $CC. searchpath=`(if test -f /usr/bin/gcc \ && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ LC_ALL=C /usr/bin/gcc -print-search-dirs; \ else \ LC_ALL=C $CC -print-search-dirs; \ fi) 2>/dev/null \ | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" ]) # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` ]) # ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- # # Copyright (C) 1999-2008, 2011-2015 Free Software Foundation, Inc. # Written by Thomas Tanner, 1999 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 20 LTDL_INIT # LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) # ------------------------------------------ # DIRECTORY contains the libltdl sources. It is okay to call this # function multiple times, as long as the same DIRECTORY is always given. AC_DEFUN([LT_CONFIG_LTDL_DIR], [AC_BEFORE([$0], [LTDL_INIT]) _$0($*) ])# LT_CONFIG_LTDL_DIR # We break this out into a separate macro, so that we can call it safely # internally without being caught accidentally by the sed scan in libtoolize. m4_defun([_LT_CONFIG_LTDL_DIR], [dnl remove trailing slashes m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) m4_case(_LTDL_DIR, [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply '.' m4_if(_ARG_DIR, [.], [], [m4_define([_LTDL_DIR], _ARG_DIR) _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], [m4_if(_ARG_DIR, _LTDL_DIR, [], [m4_fatal([multiple libltdl directories: ']_LTDL_DIR[', ']_ARG_DIR['])])]) m4_popdef([_ARG_DIR]) ])# _LT_CONFIG_LTDL_DIR # Initialise: m4_define([_LTDL_DIR], []) # _LT_BUILD_PREFIX # ---------------- # If Autoconf is new enough, expand to '$(top_build_prefix)', otherwise # to '$(top_builddir)/'. m4_define([_LT_BUILD_PREFIX], [m4_ifdef([AC_AUTOCONF_VERSION], [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], [$(top_build_prefix)], [$(top_builddir)/])], [$(top_build_prefix)])], [$(top_builddir)/])[]dnl ]) # LTDL_CONVENIENCE # ---------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-convenience to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with # '$(top_build_prefix)' if available, otherwise with '$(top_builddir)/', # and LTDLINCL will be prefixed with '$(top_srcdir)/' (note the single # quotes!). If your package is not flat and you're not using automake, # define top_build_prefix, top_builddir, and top_srcdir appropriately # in your Makefiles. AC_DEFUN([LTDL_CONVENIENCE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_CONVENIENCE # AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_CONVENIENCE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_CONVENIENCE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) # _LTDL_CONVENIENCE # ----------------- # Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). m4_defun([_LTDL_CONVENIENCE], [case $enable_ltdl_convenience in no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; "") enable_ltdl_convenience=yes ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}" AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL=$LTDLINCL AC_SUBST([INCLTDL]) ])# _LTDL_CONVENIENCE # LTDL_INSTALLABLE # ---------------- # sets LIBLTDL to the link flags for the libltdl installable library # and LTDLINCL to the include flags for the libltdl header and adds # --enable-ltdl-install to the configure arguments. Note that # AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl # is not found, LIBLTDL will be prefixed with '$(top_build_prefix)' if # available, otherwise with '$(top_builddir)/', and LTDLINCL will be # prefixed with '$(top_srcdir)/' (note the single quotes!). If your # package is not flat and you're not using automake, define top_build_prefix, # top_builddir, and top_srcdir appropriately in your Makefiles. # In the future, this macro may have to be called after LT_INIT. AC_DEFUN([LTDL_INSTALLABLE], [AC_BEFORE([$0], [LTDL_INIT])dnl dnl Although the argument is deprecated and no longer documented, dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one dnl here make sure it is the same as any other declaration of libltdl's dnl location! This also ensures lt_ltdl_dir is set when configure.ac is dnl not yet using an explicit LT_CONFIG_LTDL_DIR. m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl _$0() ])# LTDL_INSTALLABLE # AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, # now we have LT_CONFIG_LTDL_DIR: AU_DEFUN([AC_LIBLTDL_INSTALLABLE], [_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) _LTDL_INSTALLABLE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) # _LTDL_INSTALLABLE # ----------------- # Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). m4_defun([_LTDL_INSTALLABLE], [if test -f "$prefix/lib/libltdl.la"; then lt_save_LDFLAGS=$LDFLAGS LDFLAGS="-L$prefix/lib $LDFLAGS" AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) LDFLAGS=$lt_save_LDFLAGS if test yes = "${lt_lib_ltdl-no}"; then if test yes != "$enable_ltdl_install"; then # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install AC_MSG_WARN([not overwriting libltdl at $prefix, force with '--enable-ltdl-install']) enable_ltdl_install=no fi elif test no = "$enable_ltdl_install"; then AC_MSG_WARN([libltdl not installed, but installation disabled]) fi fi # If configure.ac declared an installable ltdl, and the user didn't override # with --disable-ltdl-install, we will install the shipped libltdl. case $enable_ltdl_install in no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL=-lltdl LTDLDEPS= LTDLINCL= ;; *) enable_ltdl_install=yes ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" LTDLDEPS=$LIBLTDL LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}" ;; esac AC_SUBST([LIBLTDL]) AC_SUBST([LTDLDEPS]) AC_SUBST([LTDLINCL]) # For backwards non-gettext consistent compatibility... INCLTDL=$LTDLINCL AC_SUBST([INCLTDL]) ])# LTDL_INSTALLABLE # _LTDL_MODE_DISPATCH # ------------------- m4_define([_LTDL_MODE_DISPATCH], [dnl If _LTDL_DIR is '.', then we are configuring libltdl itself: m4_if(_LTDL_DIR, [], [], dnl if _LTDL_MODE was not set already, the default value is 'subproject': [m4_case(m4_default(_LTDL_MODE, [subproject]), [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) _LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir])], [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir; lt_libobj_prefix=$lt_ltdl_dir/])], [recursive], [], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl dnl Be careful not to expand twice: m4_define([$0], []) ])# _LTDL_MODE_DISPATCH # _LT_LIBOBJ(MODULE_NAME) # ----------------------- # Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead # of into LIBOBJS. AC_DEFUN([_LT_LIBOBJ], [ m4_pattern_allow([^_LT_LIBOBJS$]) _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" ])# _LT_LIBOBJS # LTDL_INIT([OPTIONS]) # -------------------- # Clients of libltdl can use this macro to allow the installer to # choose between a shipped copy of the ltdl sources or a preinstalled # version of the library. If the shipped ltdl sources are not in a # subdirectory named libltdl, the directory name must be given by # LT_CONFIG_LTDL_DIR. AC_DEFUN([LTDL_INIT], [dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) dnl We need to keep our own list of libobjs separate from our parent project, dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while dnl we look for our own LIBOBJs. m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) m4_pushdef([AC_LIBSOURCES]) dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: m4_if(_LTDL_MODE, [], [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) AC_ARG_WITH([included_ltdl], [AS_HELP_STRING([--with-included-ltdl], [use the GNU ltdl sources included here])]) if test yes != "$with_included_ltdl"; then # We are not being forced to use the included libltdl sources, so # decide whether there is a useful installed version we can use. AC_CHECK_HEADER([ltdl.h], [AC_CHECK_DECL([lt_dlinterface_register], [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], [with_included_ltdl=no], [with_included_ltdl=yes])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT #include ])], [with_included_ltdl=yes], [AC_INCLUDES_DEFAULT] ) fi dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE dnl was called yet, then for old times' sake, we assume libltdl is in an dnl eponymous directory: AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) AC_ARG_WITH([ltdl_include], [AS_HELP_STRING([--with-ltdl-include=DIR], [use the ltdl headers installed in DIR])]) if test -n "$with_ltdl_include"; then if test -f "$with_ltdl_include/ltdl.h"; then : else AC_MSG_ERROR([invalid ltdl include directory: '$with_ltdl_include']) fi else with_ltdl_include=no fi AC_ARG_WITH([ltdl_lib], [AS_HELP_STRING([--with-ltdl-lib=DIR], [use the libltdl.la installed in DIR])]) if test -n "$with_ltdl_lib"; then if test -f "$with_ltdl_lib/libltdl.la"; then : else AC_MSG_ERROR([invalid ltdl library directory: '$with_ltdl_lib']) fi else with_ltdl_lib=no fi case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in ,yes,no,no,) m4_case(m4_default(_LTDL_TYPE, [convenience]), [convenience], [_LTDL_CONVENIENCE], [installable], [_LTDL_INSTALLABLE], [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) ;; ,no,no,no,) # If the included ltdl is not to be used, then use the # preinstalled libltdl we found. AC_DEFINE([HAVE_LTDL], [1], [Define this if a modern libltdl is already installed]) LIBLTDL=-lltdl LTDLDEPS= LTDLINCL= ;; ,no*,no,*) AC_MSG_ERROR(['--with-ltdl-include' and '--with-ltdl-lib' options must be used together]) ;; *) with_included_ltdl=no LIBLTDL="-L$with_ltdl_lib -lltdl" LTDLDEPS= LTDLINCL=-I$with_ltdl_include ;; esac INCLTDL=$LTDLINCL # Report our decision... AC_MSG_CHECKING([where to find libltdl headers]) AC_MSG_RESULT([$LTDLINCL]) AC_MSG_CHECKING([where to find libltdl library]) AC_MSG_RESULT([$LIBLTDL]) _LTDL_SETUP dnl restore autoconf definition. m4_popdef([AC_LIBOBJ]) m4_popdef([AC_LIBSOURCES]) AC_CONFIG_COMMANDS_PRE([ _ltdl_libobjs= _ltdl_ltlibobjs= if test -n "$_LT_LIBOBJS"; then # Remove the extension. _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" done fi AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) ]) # Only expand once: m4_define([LTDL_INIT]) ])# LTDL_INIT # Old names: AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIB_LTDL], []) dnl AC_DEFUN([AC_WITH_LTDL], []) dnl AC_DEFUN([LT_WITH_LTDL], []) # _LTDL_SETUP # ----------- # Perform all the checks necessary for compilation of the ltdl objects # -- including compiler checks and header checks. This is a public # interface mainly for the benefit of libltdl's own configure.ac, most # other users should call LTDL_INIT instead. AC_DEFUN([_LTDL_SETUP], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_SYS_MODULE_EXT])dnl AC_REQUIRE([LT_SYS_MODULE_PATH])dnl AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl AC_REQUIRE([LT_LIB_DLLOAD])dnl AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl AC_REQUIRE([LT_FUNC_ARGZ])dnl m4_require([_LT_CHECK_OBJDIR])dnl m4_require([_LT_HEADER_DLFCN])dnl m4_require([_LT_CHECK_DLPREOPEN])dnl m4_require([_LT_DECL_SED])dnl dnl Don't require this, or it will be expanded earlier than the code dnl that sets the variables it relies on: _LT_ENABLE_INSTALL dnl _LTDL_MODE specific code must be called at least once: _LTDL_MODE_DISPATCH # In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS # the user used. This is so that ltdl.h can pick up the parent projects # config.h file, The first file in AC_CONFIG_HEADERS must contain the # definitions required by ltdl.c. # FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). AC_CONFIG_COMMANDS_PRE([dnl m4_pattern_allow([^LT_CONFIG_H$])dnl m4_ifset([AH_HEADER], [LT_CONFIG_H=AH_HEADER], [m4_ifset([AC_LIST_HEADERS], [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's|^[[ ]]*||;s|[[ :]].*$||'`], [])])]) AC_SUBST([LT_CONFIG_H]) AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) m4_pattern_allow([LT_LIBEXT])dnl AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) name= eval "lt_libprefix=\"$libname_spec\"" m4_pattern_allow([LT_LIBPREFIX])dnl AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) name=ltdl eval "LTDLOPEN=\"$libname_spec\"" AC_SUBST([LTDLOPEN]) ])# _LTDL_SETUP # _LT_ENABLE_INSTALL # ------------------ m4_define([_LT_ENABLE_INSTALL], [AC_ARG_ENABLE([ltdl-install], [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) case ,$enable_ltdl_install,$enable_ltdl_convenience in *yes*) ;; *) enable_ltdl_convenience=yes ;; esac m4_ifdef([AM_CONDITIONAL], [AM_CONDITIONAL(INSTALL_LTDL, test no != "${enable_ltdl_install-no}") AM_CONDITIONAL(CONVENIENCE_LTDL, test no != "${enable_ltdl_convenience-no}")]) ])# _LT_ENABLE_INSTALL # LT_SYS_DLOPEN_DEPLIBS # --------------------- AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_CACHE_CHECK([whether deplibs are loaded by dlopen], [lt_cv_sys_dlopen_deplibs], [# PORTME does your system automatically load deplibs for dlopen? # or its logical equivalent (e.g. shl_load for HP-UX < 11) # For now, we just catch OSes we know something about -- in the # future, we'll try test this programmatically. lt_cv_sys_dlopen_deplibs=unknown case $host_os in aix3*|aix4.1.*|aix4.2.*) # Unknown whether this is true for these versions of AIX, but # we want this 'case' here to explicitly catch those versions. lt_cv_sys_dlopen_deplibs=unknown ;; aix[[4-9]]*) lt_cv_sys_dlopen_deplibs=yes ;; amigaos*) case $host_cpu in powerpc) lt_cv_sys_dlopen_deplibs=no ;; esac ;; bitrig*) lt_cv_sys_dlopen_deplibs=yes ;; darwin*) # Assuming the user has installed a libdl from somewhere, this is true # If you are looking for one http://www.opendarwin.org/projects/dlcompat lt_cv_sys_dlopen_deplibs=yes ;; freebsd* | dragonfly*) lt_cv_sys_dlopen_deplibs=yes ;; gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) # GNU and its variants, using gnu ld.so (Glibc) lt_cv_sys_dlopen_deplibs=yes ;; hpux10*|hpux11*) lt_cv_sys_dlopen_deplibs=yes ;; interix*) lt_cv_sys_dlopen_deplibs=yes ;; irix[[12345]]*|irix6.[[01]]*) # Catch all versions of IRIX before 6.2, and indicate that we don't # know how it worked for any of those versions. lt_cv_sys_dlopen_deplibs=unknown ;; irix*) # The case above catches anything before 6.2, and it's known that # at 6.2 and later dlopen does load deplibs. lt_cv_sys_dlopen_deplibs=yes ;; netbsd*) lt_cv_sys_dlopen_deplibs=yes ;; openbsd*) lt_cv_sys_dlopen_deplibs=yes ;; osf[[1234]]*) # dlopen did load deplibs (at least at 4.x), but until the 5.x series, # it did *not* use an RPATH in a shared library to find objects the # library depends on, so we explicitly say 'no'. lt_cv_sys_dlopen_deplibs=no ;; osf5.0|osf5.0a|osf5.1) # dlopen *does* load deplibs and with the right loader patch applied # it even uses RPATH in a shared library to search for shared objects # that the library depends on, but there's no easy way to know if that # patch is installed. Since this is the case, all we can really # say is unknown -- it depends on the patch being installed. If # it is, this changes to 'yes'. Without it, it would be 'no'. lt_cv_sys_dlopen_deplibs=unknown ;; osf*) # the two cases above should catch all versions of osf <= 5.1. Read # the comments above for what we know about them. # At > 5.1, deplibs are loaded *and* any RPATH in a shared library # is used to find them so we can finally say 'yes'. lt_cv_sys_dlopen_deplibs=yes ;; qnx*) lt_cv_sys_dlopen_deplibs=yes ;; solaris*) lt_cv_sys_dlopen_deplibs=yes ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) libltdl_cv_sys_dlopen_deplibs=yes ;; esac ]) if test yes != "$lt_cv_sys_dlopen_deplibs"; then AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], [Define if the OS needs help to load dependent libraries for dlopen().]) fi ])# LT_SYS_DLOPEN_DEPLIBS # Old name: AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) # LT_SYS_MODULE_EXT # ----------------- AC_DEFUN([LT_SYS_MODULE_EXT], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([what extension is used for runtime loadable modules], [libltdl_cv_shlibext], [ module=yes eval libltdl_cv_shlibext=$shrext_cmds module=no eval libltdl_cv_shrext=$shrext_cmds ]) if test -n "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_MODULE_EXT])dnl AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], [Define to the extension used for runtime loadable modules, say, ".so".]) fi if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then m4_pattern_allow([LT_SHARED_EXT])dnl AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], [Define to the shared library suffix, say, ".dylib".]) fi if test -n "$shared_archive_member_spec"; then m4_pattern_allow([LT_SHARED_LIB_MEMBER])dnl AC_DEFINE_UNQUOTED([LT_SHARED_LIB_MEMBER], ["($shared_archive_member_spec.o)"], [Define to the shared archive member specification, say "(shr.o)".]) fi ])# LT_SYS_MODULE_EXT # Old name: AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) # LT_SYS_MODULE_PATH # ------------------ AC_DEFUN([LT_SYS_MODULE_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([what variable specifies run-time module search path], [lt_cv_module_path_var], [lt_cv_module_path_var=$shlibpath_var]) if test -n "$lt_cv_module_path_var"; then m4_pattern_allow([LT_MODULE_PATH_VAR])dnl AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], [Define to the name of the environment variable that determines the run-time module search path.]) fi ])# LT_SYS_MODULE_PATH # Old name: AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) # LT_SYS_DLSEARCH_PATH # -------------------- AC_DEFUN([LT_SYS_DLSEARCH_PATH], [m4_require([_LT_SYS_DYNAMIC_LINKER])dnl AC_CACHE_CHECK([for the default library search path], [lt_cv_sys_dlsearch_path], [lt_cv_sys_dlsearch_path=$sys_lib_dlsearch_path_spec]) if test -n "$lt_cv_sys_dlsearch_path"; then sys_dlsearch_path= for dir in $lt_cv_sys_dlsearch_path; do if test -z "$sys_dlsearch_path"; then sys_dlsearch_path=$dir else sys_dlsearch_path=$sys_dlsearch_path$PATH_SEPARATOR$dir fi done m4_pattern_allow([LT_DLSEARCH_PATH])dnl AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], [Define to the system default library search path.]) fi ])# LT_SYS_DLSEARCH_PATH # Old name: AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) # _LT_CHECK_DLPREOPEN # ------------------- m4_defun([_LT_CHECK_DLPREOPEN], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], [libltdl_cv_preloaded_symbols], [if test -n "$lt_cv_sys_global_symbol_pipe"; then libltdl_cv_preloaded_symbols=yes else libltdl_cv_preloaded_symbols=no fi ]) if test yes = "$libltdl_cv_preloaded_symbols"; then AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], [Define if libtool can extract symbol lists from object files.]) fi ])# _LT_CHECK_DLPREOPEN # LT_LIB_DLLOAD # ------------- AC_DEFUN([LT_LIB_DLLOAD], [m4_pattern_allow([^LT_DLLOADERS$]) LT_DLLOADERS= AC_SUBST([LT_DLLOADERS]) AC_LANG_PUSH([C]) lt_dlload_save_LIBS=$LIBS LIBADD_DLOPEN= AC_SEARCH_LIBS([dlopen], [dl], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) if test "$ac_cv_search_dlopen" != "none required"; then LIBADD_DLOPEN=-ldl fi libltdl_cv_lib_dl_dlopen=yes LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H # include #endif ]], [[dlopen(0, 0);]])], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen=yes LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], [AC_CHECK_LIB([svld], [dlopen], [AC_DEFINE([HAVE_LIBDL], [1], [Define if you have the libdl library or equivalent.]) LIBADD_DLOPEN=-lsvld libltdl_cv_func_dlopen=yes LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen" then lt_save_LIBS=$LIBS LIBS="$LIBS $LIBADD_DLOPEN" AC_CHECK_FUNCS([dlerror]) LIBS=$lt_save_LIBS fi AC_SUBST([LIBADD_DLOPEN]) LIBADD_SHL_LOAD= AC_CHECK_FUNC([shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], [AC_CHECK_LIB([dld], [shl_load], [AC_DEFINE([HAVE_SHL_LOAD], [1], [Define if you have the shl_load function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" LIBADD_SHL_LOAD=-ldld])]) AC_SUBST([LIBADD_SHL_LOAD]) case $host_os in darwin[[1567]].*) # We only want this for pre-Mac OS X 10.4. AC_CHECK_FUNC([_dyld_func_lookup], [AC_DEFINE([HAVE_DYLD], [1], [Define if you have the _dyld_func_lookup function.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) ;; beos*) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" ;; cygwin* | mingw* | pw32*) AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" ;; esac AC_CHECK_LIB([dld], [dld_link], [AC_DEFINE([HAVE_DLD], [1], [Define if you have the GNU dld library.]) LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) AC_SUBST([LIBADD_DLD_LINK]) m4_pattern_allow([^LT_DLPREOPEN$]) LT_DLPREOPEN= if test -n "$LT_DLLOADERS" then for lt_loader in $LT_DLLOADERS; do LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " done AC_DEFINE([HAVE_LIBDLLOADER], [1], [Define if libdlloader will be built on this platform]) fi AC_SUBST([LT_DLPREOPEN]) dnl This isn't used anymore, but set it for backwards compatibility LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" AC_SUBST([LIBADD_DL]) LIBS=$lt_dlload_save_LIBS AC_LANG_POP ])# LT_LIB_DLLOAD # Old name: AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLLIB], []) # LT_SYS_SYMBOL_USCORE # -------------------- # does the compiler prefix global symbols with an underscore? AC_DEFUN([LT_SYS_SYMBOL_USCORE], [m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl AC_CACHE_CHECK([for _ prefix in compiled symbols], [lt_cv_sys_symbol_underscore], [lt_cv_sys_symbol_underscore=no cat > conftest.$ac_ext <<_LT_EOF void nm_test_func(){} int main(){nm_test_func;return 0;} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. ac_nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then lt_cv_sys_symbol_underscore=yes else if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD fi fi else echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.c >&AS_MESSAGE_LOG_FD fi rm -rf conftest* ]) sys_symbol_underscore=$lt_cv_sys_symbol_underscore AC_SUBST([sys_symbol_underscore]) ])# LT_SYS_SYMBOL_USCORE # Old name: AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) # LT_FUNC_DLSYM_USCORE # -------------------- AC_DEFUN([LT_FUNC_DLSYM_USCORE], [AC_REQUIRE([_LT_COMPILER_PIC])dnl for lt_prog_compiler_wl AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl for lt_cv_sys_symbol_underscore AC_REQUIRE([LT_SYS_MODULE_EXT])dnl for libltdl_cv_shlibext if test yes = "$lt_cv_sys_symbol_underscore"; then if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen"; then AC_CACHE_CHECK([whether we have to add an underscore for dlsym], [libltdl_cv_need_uscore], [libltdl_cv_need_uscore=unknown dlsym_uscore_save_LIBS=$LIBS LIBS="$LIBS $LIBADD_DLOPEN" libname=conftmod # stay within 8.3 filename limits! cat >$libname.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; }] _LT_EOF # ltfn_module_cmds module_cmds # Execute tilde-delimited MODULE_CMDS with environment primed for # $module_cmds or $archive_cmds type content. ltfn_module_cmds () {( # subshell avoids polluting parent global environment module_cmds_save_ifs=$IFS; IFS='~' for cmd in @S|@1; do IFS=$module_cmds_save_ifs libobjs=$libname.$ac_objext; lib=$libname$libltdl_cv_shlibext rpath=/not-exists; soname=$libname$libltdl_cv_shlibext; output_objdir=. major=; versuffix=; verstring=; deplibs= ECHO=echo; wl=$lt_prog_compiler_wl; allow_undefined_flag= eval $cmd done IFS=$module_cmds_save_ifs )} # Compile a loadable module using libtool macro expansion results. $CC $pic_flag -c $libname.$ac_ext ltfn_module_cmds "${module_cmds:-$archive_cmds}" # Try to fetch fnord with dlsym(). libltdl_dlunknown=0; libltdl_dlnouscore=1; libltdl_dluscore=2 cat >conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifndef RTLD_GLOBAL # ifdef DL_GLOBAL # define RTLD_GLOBAL DL_GLOBAL # else # define RTLD_GLOBAL 0 # endif #endif #ifndef RTLD_NOW # ifdef DL_NOW # define RTLD_NOW DL_NOW # else # define RTLD_NOW 0 # endif #endif int main () { void *handle = dlopen ("`pwd`/$libname$libltdl_cv_shlibext", RTLD_GLOBAL|RTLD_NOW); int status = $libltdl_dlunknown; if (handle) { if (dlsym (handle, "fnord")) status = $libltdl_dlnouscore; else { if (dlsym (handle, "_fnord")) status = $libltdl_dluscore; else puts (dlerror ()); } dlclose (handle); } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null libltdl_status=$? case x$libltdl_status in x$libltdl_dlnouscore) libltdl_cv_need_uscore=no ;; x$libltdl_dluscore) libltdl_cv_need_uscore=yes ;; x*) libltdl_cv_need_uscore=unknown ;; esac fi rm -rf conftest* $libname* LIBS=$dlsym_uscore_save_LIBS ]) fi fi if test yes = "$libltdl_cv_need_uscore"; then AC_DEFINE([NEED_USCORE], [1], [Define if dlsym() requires a leading underscore in symbol names.]) fi ])# LT_FUNC_DLSYM_USCORE # Old name: AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 11 (pkg-config-0.29.1) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------ dnl dnl Prepare a "--with-" configure option using the lowercase dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and dnl PKG_CHECK_MODULES in a single macro. AC_DEFUN([PKG_WITH_MODULES], [ m4_pushdef([with_arg], m4_tolower([$1])) m4_pushdef([description], [m4_default([$5], [build with ]with_arg[ support])]) m4_pushdef([def_arg], [m4_default([$6], [auto])]) m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) m4_case(def_arg, [yes],[m4_pushdef([with_without], [--without-]with_arg)], [m4_pushdef([with_without],[--with-]with_arg)]) AC_ARG_WITH(with_arg, AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, [AS_TR_SH([with_]with_arg)=def_arg]) AS_CASE([$AS_TR_SH([with_]with_arg)], [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], [auto],[PKG_CHECK_MODULES([$1],[$2], [m4_n([def_action_if_found]) $3], [m4_n([def_action_if_not_found]) $4])]) m4_popdef([with_arg]) m4_popdef([description]) m4_popdef([def_arg]) ])dnl PKG_WITH_MODULES dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ----------------------------------------------- dnl dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES dnl check._[VARIABLE-PREFIX] is exported as make variable. AC_DEFUN([PKG_HAVE_WITH_MODULES], [ PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) AM_CONDITIONAL([HAVE_][$1], [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) ])dnl PKG_HAVE_WITH_MODULES dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, dnl [DESCRIPTION], [DEFAULT]) dnl ------------------------------------------------------ dnl dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make dnl and preprocessor variable. AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], [ PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) ])dnl PKG_HAVE_DEFINE_WITH_MODULES # Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. Try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ac_caolan_func_which_gethostbyname_r.m4]) m4_include([m4/ac_have_inaddr_none.m4]) m4_include([m4/ac_have_malloc_options.m4]) m4_include([m4/ac_nullzero.m4]) m4_include([m4/ac_raf_func_which_getservbyname_r.m4]) m4_include([m4/ac_tds_func_which_gethostbyaddr_r.m4]) m4_include([m4/ac_tds_func_which_getpwuid_r.m4]) m4_include([m4/ac_tds_func_which_localtime_r.m4]) m4_include([m4/acx_pthread.m4]) m4_include([m4/ax_cflags_gcc_option.m4]) m4_include([m4/check_openssl.m4]) m4_include([m4/gettimemilli.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/pushlibs.m4]) m4_include([m4/sprintf_i64_format.m4]) m4_include([m4/type_socklen_t.m4]) freetds-1.3.6/Makefile.in000644 025423 025423 00000071476 14162303356 016672 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = freetds.spec CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/freetds.spec.in \ ChangeLog compile config.guess config.rpath config.sub depcomp \ install-sh ltmain.sh missing mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best DIST_TARGETS = dist-bzip2 dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = include src doc samples win32 vms misc ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = interfaces PWD.in BUGS.md \ freetds.conf locales.conf \ autogen.sh freetds.spec.in freetds.spec tds.dox \ config.rpath CMakeLists.txt Thanks-1.0 \ AUTHORS.md INSTALL.md NEWS.md README.md TODO.md \ COPYING_LIB.txt COPYING.txt ETC = $(DESTDIR)$(sysconfdir) DOCDIR = doc # enable some cheat so make distcheck work (see below) DISTCHECK_CONFIGURE_FLAGS = \ --enable-distcheck-build --enable-extra-checks all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): freetds.spec: $(top_builddir)/config.status $(srcdir)/freetds.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @DISTCHECK_BUILD_FALSE@uninstall-local: clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-local .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool clean-local cscope cscopelist-am ctags ctags-am \ dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \ dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-generic distclean-libtool distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-data-local install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-local .PRECIOUS: Makefile install-data-local: $(mkinstalldirs) $(ETC) if test ! -f $(ETC)/freetds.conf; then \ $(INSTALL) -m 644 $(srcdir)/freetds.conf $(ETC)/freetds.conf; \ fi if test ! -f $(ETC)/locales.conf; then \ $(INSTALL) -m 644 $(srcdir)/locales.conf $(ETC)/locales.conf; \ fi clean-local: find . \( -name \*.test_output -o -name \*.bb -o -name \*.bbg -o -name \*.da -o -name \*.gc\* \) -exec rm -f {} \; # do not uninstall configuration files (they may have been changed) @DISTCHECK_BUILD_TRUE@uninstall-local: @DISTCHECK_BUILD_TRUE@ rm -f $(ETC)/freetds.conf $(ETC)/locales.conf $(ETC)/pool.conf PWD test: @echo "The 'make test' option has been replaced with 'make check'"; all: # if we are inside a make distcheck copy our real password file @DISTCHECK_BUILD_TRUE@ if test ! -f PWD -a -f $(srcdir)/../PWD; then cp $(srcdir)/../PWD PWD; fi # this prevent the store of passwords in the source repository if test ! -f PWD; then cp $(srcdir)/PWD.in PWD; fi snapshot: $(MAKE) dist distdir=$(PACKAGE)-`date +"%Y%m%d"` doxy: $(SUBDIRS) @HAVE_DOXYGEN_TRUE@ $(MKDIR_P) $(DOCDIR)/reference @HAVE_DOXYGEN_TRUE@ rm -rf $(DOCDIR)/reference/* @HAVE_DOXYGEN_TRUE@ SRCDIR=$(top_srcdir) VERSION=$(VERSION) $(DOXYGEN) $(top_srcdir)/tds.dox @HAVE_DOXYGEN_TRUE@ if test -d $(DOCDIR)/reference/html ; then mv $(DOCDIR)/reference/html/* $(DOCDIR)/reference; rmdir $(DOCDIR)/reference/html; fi @HAVE_DOXYGEN_FALSE@ echo 'Doxygen not installed; reference manual not built.' # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/freetds.spec.in000644 025423 025423 00000010155 14056414221 017521 0ustar00fredianofrediano000000 000000 %define name @PACKAGE@ %define version @VERSION@ # compute some additional dependency from vendor name # # SUSE %define tds_dep_suse glibc-locale %undefine tds_builddep %{expand:%%{expand:%%{?tds_builddep_%{?_vendor}:%%%%define tds_builddep %%{?tds_builddep_%{?_vendor}}}}} %undefine tds_dep %{expand:%%{expand:%%{?tds_dep_%{?_vendor}:%%%%define tds_dep %%{?tds_dep_%{?_vendor}}}}} Name: %{name} Version: %{version} Release: 1 Vendor: www.freetds.org License: LGPL Group: System Environment/Libraries Source: http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-buildroot BuildRequires: unixODBC-devel >= 2.0.0 gnutls-devel %{?tds_builddep} Requires: gnutls %{?tds_dep} Summary: FreeTDS is a free re-implementation of the TDS (Tabular DataStream) protocol that is used by Sybase and Microsoft for their database products. %description FreeTDS is a project to document and implement the TDS (Tabular DataStream) protocol. TDS is used by Sybase and Microsoft for client to database server communications. FreeTDS includes call level interfaces for DB-Lib, CT-Lib, and ODBC. %package devel Group: Development/Libraries Summary: Include files needed for development with FreeTDS Requires: freetds = %{version} %package unixodbc Group: System Environment/Libraries Summary: FreeTDS ODBC Driver for unixODBC Requires: unixODBC >= 2.0.0 %{?tds_dep:Requires: %tds_dep} %package doc Group: Documentation Summary: User documentation for FreeTDS %description devel The freetds-devel package contains the files necessary for development with the FreeTDS libraries. %description unixodbc The freetds-unixodbc package contains ODBC driver build for unixODBC. %description doc The freetds-doc package contains the useguide and reference of FreeTDS and can be installed even if FreeTDS main package is not installed %prep %setup %build %configure --with-tdsver=auto --with-unixodbc --with-gnutls make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" %install rm -rf "$RPM_BUILD_ROOT" make DESTDIR="$RPM_BUILD_ROOT" install rm -rf "$RPM_BUILD_ROOT/%{_datadir}/doc/freetds" %post /sbin/ldconfig 2> /dev/null %postun /sbin/ldconfig 2> /dev/null %post unixodbc echo "[FreeTDS] Description = FreeTDS unixODBC Driver Driver = %{_libdir}/libtdsodbc.so.0 Setup = %{_libdir}/libtdsodbc.so.0" | odbcinst -i -d -r > /dev/null 2>&1 || true echo "[SQL Server] Description = FreeTDS unixODBC Driver Driver = %{_libdir}/libtdsodbc.so.0 Setup = %{_libdir}/libtdsodbc.so.0" | odbcinst -i -d -r > /dev/null 2>&1 || true %preun unixodbc odbcinst -u -d -n 'FreeTDS' > /dev/null 2>&1 || true odbcinst -u -d -n 'SQL Server' > /dev/null 2>&1 || true %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc AUTHORS.md BUGS.md COPYING*.txt INSTALL.md NEWS.md README.md TODO.md %{_bindir}/* %{_mandir}/man?/* %{_libdir}/libct.so.* %{_libdir}/libsybdb.so.* %config %{_sysconfdir}/* %files devel %defattr (-,root,root) %{_libdir}/*.a %{_libdir}/*.la %{_libdir}/*.so %{_includedir}/* %files unixodbc %defattr(-,root,root) %{_libdir}/libtdsodbc.so* %files doc %defattr (-,root,root) %doc doc/userguide doc/images doc/reference %changelog * Fri Nov 13 2015 Frediano Ziglio - set default protocol version to "auto" (automatic) - enable gnutls in RPM packages * Wed Mar 28 2007 Frediano Ziglio - removed libtdssrv * Thu Sep 09 2004 Frediano Ziglio - remove dependency from freetds-unixodbc - fix field name (Copyright instead of License) - updated URL * Sun Mar 30 2003 Frediano Ziglio - add reference to doc package * Wed Feb 5 2003 Ian Grant - 0.61 tweaked. Added libtdssrv libraries and tools in /usr/bin + man pages * Mon Dec 30 2002 David Hollis - 0.60 tweaked. Move .a & .la files to -devel package * Thu Dec 20 2001 Brian Bruns - Modifications for 0.53 ver and removing interfaces file * Fri Jun 28 2001 Brian Bruns - Modifications for 0.52 ver and ODBC drivers * Wed Feb 14 2001 David Hollis - First stab at RPM for 0.51 ver freetds-1.3.6/ChangeLog000644 025423 025423 00000003255 14162303347 016365 0ustar00fredianofrediano000000 000000 Author: Frediano Ziglio Date: Sun Dec 26 20:20:05 2021 +0000 Check for system function using header It seems that function is available to link but disable by iOS headers so check it using code instead of defining it and linking (as AC_CHECK_FUNCS does). Author: Frediano Ziglio Date: Fri Dec 24 10:32:50 2021 +0000 apps: Check for system function presence fisql execute system commands using system function which is not currently available on iOS. Avoid to use it and disable the specific fisql feature. Author: Frediano Ziglio Date: Sun Dec 12 19:46:14 2021 +0000 defncopy: Supports varchar(max)/varbinary(max) If length is -1 it means varchar(max) or varbinary(max) types. This fixes https://github.com/FreeTDS/freetds/issues/432. Author: Frediano Ziglio Date: Mon Aug 30 09:22:14 2021 +0100 Fix compatibility issue with some TLS implementations Not found using directly a SQL Server database but with some proxy program using different TLS settings. The TLS inside TDS packet was not ending with the handshake but had some additional bytes containing no data. Strip this tail. Author: Frediano Ziglio Date: Tue Aug 24 19:00:13 2021 +0100 tds: Avoid unaligned access using replacement iconv Test string for checking iconv should be memory aligned. Extra checks are used to check the alignment explicitly in system able to do unaligned access. Author: Jan umgarten Date: Mon Aug 16 15:07:58 2021 +0200 Keep make from failing if the source path contains spaces. freetds-1.3.6/compile000755 025423 025423 00000016327 14162303277 016177 0ustar00fredianofrediano000000 000000 #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, 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. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: freetds-1.3.6/config.guess000755 025423 025423 00000127661 14162303277 017145 0ustar00fredianofrediano000000 000000 #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2019 Free Software Foundation, Inc. timestamp='2019-01-03' # This file 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 3 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. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earm*) arch="${UNAME_MACHINE_ARCH#e}" arch="${arch%eb}" arch="${arch%hf}" endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/v[0-9]//;s/earm/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) set_cc_for_build SUN_ARCH=sparc # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __sparcv9'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=sparcv9 fi fi echo "$SUN_ARCH"-sun-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi else echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-pc-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; *:Unleashed:*:*) echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: freetds-1.3.6/config.rpath000755 025423 025423 00000043647 14056414221 017130 0ustar00fredianofrediano000000 000000 #! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # # Copyright 1996-2007 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # The first argument passed to this file is the canonical host specification, # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld # should be set by the caller. # # The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; darwin*) case $cc_basename in xlc*) wl='-Wl,' ;; esac ;; mingw* | cygwin* | pw32* | os2*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; newsos6) ;; linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) wl='-Wl,' ;; pgcc | pgf77 | pgf90) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) wl='-Wl,' ;; esac ;; esac ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; rdos*) ;; solaris*) wl='-Wl,' ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) wl='-Wl,' ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we cannot use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' else ld_shlibs=no fi ;; esac ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then hardcode_libdir_flag_spec= fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; bsdi[45]*) ;; cygwin* | mingw* | pw32*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if test "$GCC" = yes ; then : else case $cc_basename in xlc*) ;; *) ld_shlibs=no ;; esac fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd1*) ld_shlibs=no ;; freebsd2.2*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; freebsd2*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no ;; *) hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. # Unlike libtool.m4, here we don't care about _all_ names of the library, but # only about the one the linker finds when passed -lNAME. This is the last # element of library_names_spec in libtool.m4, or possibly two of them if the # linker has special search rules. library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) library_names_spec='$libname.a' ;; aix4* | aix5*) library_names_spec='$libname$shrext' ;; amigaos*) library_names_spec='$libname.a' ;; beos*) library_names_spec='$libname$shrext' ;; bsdi[45]*) library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib library_names_spec='$libname$shrext' ;; dgux*) library_names_spec='$libname$shrext' ;; freebsd1*) ;; freebsd* | dragonfly*) case "$host_os" in freebsd[123]*) library_names_spec='$libname$shrext$versuffix' ;; *) library_names_spec='$libname$shrext' ;; esac ;; gnu*) library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac library_names_spec='$libname$shrext' ;; interix[3-9]*) library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux* | k*bsd*-gnu) library_names_spec='$libname$shrext' ;; knetbsd*-gnu) library_names_spec='$libname$shrext' ;; netbsd*) library_names_spec='$libname$shrext' ;; newsos6) library_names_spec='$libname$shrext' ;; nto-qnx*) library_names_spec='$libname$shrext' ;; openbsd*) library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) library_names_spec='$libname$shrext' ;; rdos*) ;; solaris*) library_names_spec='$libname$shrext' ;; sunos4*) library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) library_names_spec='$libname$shrext' ;; sysv4*MP*) library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) library_names_spec='$libname$shrext' ;; uts4*) library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 os=$maybe_os ;; android-linux) basic_machine=$field1-unknown os=linux-android ;; *) basic_machine=$field1-$field2 os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 os= ;; *) basic_machine=$field1 os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc os=bsd ;; a29khif) basic_machine=a29k-amd os=udi ;; adobe68k) basic_machine=m68010-adobe os=scout ;; alliant) basic_machine=fx80-alliant os= ;; altos | altos3068) basic_machine=m68k-altos os= ;; am29k) basic_machine=a29k-none os=bsd ;; amdahl) basic_machine=580-amdahl os=sysv ;; amiga) basic_machine=m68k-unknown os= ;; amigaos | amigados) basic_machine=m68k-unknown os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=sysv4 ;; apollo68) basic_machine=m68k-apollo os=sysv ;; apollo68bsd) basic_machine=m68k-apollo os=bsd ;; aros) basic_machine=i386-pc os=aros ;; aux) basic_machine=m68k-apple os=aux ;; balance) basic_machine=ns32k-sequent os=dynix ;; blackfin) basic_machine=bfin-unknown os=linux ;; cegcc) basic_machine=arm-unknown os=cegcc ;; convex-c1) basic_machine=c1-convex os=bsd ;; convex-c2) basic_machine=c2-convex os=bsd ;; convex-c32) basic_machine=c32-convex os=bsd ;; convex-c34) basic_machine=c34-convex os=bsd ;; convex-c38) basic_machine=c38-convex os=bsd ;; cray) basic_machine=j90-cray os=unicos ;; crds | unos) basic_machine=m68k-crds os= ;; da30) basic_machine=m68k-da30 os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec os= ;; delta88) basic_machine=m88k-motorola os=sysv3 ;; dicos) basic_machine=i686-pc os=dicos ;; djgpp) basic_machine=i586-pc os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=ose ;; gmicro) basic_machine=tron-gmicro os=sysv ;; go32) basic_machine=i386-pc os=go32 ;; h8300hms) basic_machine=h8300-hitachi os=hms ;; h8300xray) basic_machine=h8300-hitachi os=xray ;; h8500hms) basic_machine=h8500-hitachi os=hms ;; harris) basic_machine=m88k-harris os=sysv3 ;; hp300) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=bsd ;; hp300hpux) basic_machine=m68k-hp os=hpux ;; hppaosf) basic_machine=hppa1.1-hp os=osf ;; hppro) basic_machine=hppa1.1-hp os=proelf ;; i386mach) basic_machine=i386-mach os=mach ;; vsta) basic_machine=i386-pc os=vsta ;; isi68 | isi) basic_machine=m68k-isi os=sysv ;; m68knommu) basic_machine=m68k-unknown os=linux ;; magnum | m3230) basic_machine=mips-mips os=sysv ;; merlin) basic_machine=ns32k-utek os=sysv ;; mingw64) basic_machine=x86_64-pc os=mingw64 ;; mingw32) basic_machine=i686-pc os=mingw32 ;; mingw32ce) basic_machine=arm-unknown os=mingw32ce ;; monitor) basic_machine=m68k-rom68k os=coff ;; morphos) basic_machine=powerpc-unknown os=morphos ;; moxiebox) basic_machine=moxie-unknown os=moxiebox ;; msdos) basic_machine=i386-pc os=msdos ;; msys) basic_machine=i686-pc os=msys ;; mvs) basic_machine=i370-ibm os=mvs ;; nacl) basic_machine=le32-unknown os=nacl ;; ncr3000) basic_machine=i486-ncr os=sysv4 ;; netbsd386) basic_machine=i386-pc os=netbsd ;; netwinder) basic_machine=armv4l-rebel os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=newsos ;; news1000) basic_machine=m68030-sony os=newsos ;; necv70) basic_machine=v70-nec os=sysv ;; nh3000) basic_machine=m68k-harris os=cxux ;; nh[45]000) basic_machine=m88k-harris os=cxux ;; nindy960) basic_machine=i960-intel os=nindy ;; mon960) basic_machine=i960-intel os=mon960 ;; nonstopux) basic_machine=mips-compaq os=nonstopux ;; os400) basic_machine=powerpc-ibm os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=ose ;; os68k) basic_machine=m68k-none os=os68k ;; paragon) basic_machine=i860-intel os=osf ;; parisc) basic_machine=hppa-unknown os=linux ;; pw32) basic_machine=i586-unknown os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=rdos ;; rdos32) basic_machine=i386-pc os=rdos ;; rom68k) basic_machine=m68k-rom68k os=coff ;; sa29200) basic_machine=a29k-amd os=udi ;; sei) basic_machine=mips-sei os=seiux ;; sequent) basic_machine=i386-sequent os= ;; sps7) basic_machine=m68k-bull os=sysv2 ;; st2000) basic_machine=m68k-tandem os= ;; stratus) basic_machine=i860-stratus os=sysv4 ;; sun2) basic_machine=m68000-sun os= ;; sun2os3) basic_machine=m68000-sun os=sunos3 ;; sun2os4) basic_machine=m68000-sun os=sunos4 ;; sun3) basic_machine=m68k-sun os= ;; sun3os3) basic_machine=m68k-sun os=sunos3 ;; sun3os4) basic_machine=m68k-sun os=sunos4 ;; sun4) basic_machine=sparc-sun os= ;; sun4os3) basic_machine=sparc-sun os=sunos3 ;; sun4os4) basic_machine=sparc-sun os=sunos4 ;; sun4sol2) basic_machine=sparc-sun os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun os= ;; sv1) basic_machine=sv1-cray os=unicos ;; symmetry) basic_machine=i386-sequent os=dynix ;; t3e) basic_machine=alphaev5-cray os=unicos ;; t90) basic_machine=t90-cray os=unicos ;; toad1) basic_machine=pdp10-xkl os=tops20 ;; tpf) basic_machine=s390x-ibm os=tpf ;; udi29k) basic_machine=a29k-amd os=udi ;; ultra3) basic_machine=a29k-nyu os=sym1 ;; v810 | necv810) basic_machine=v810-nec os=none ;; vaxv) basic_machine=vax-dec os=sysv ;; vms) basic_machine=vax-dec os=vms ;; vxworks960) basic_machine=i960-wrs os=vxworks ;; vxworks68) basic_machine=m68k-wrs os=vxworks ;; vxworks29k) basic_machine=a29k-wrs os=vxworks ;; xbox) basic_machine=i686-pc os=mingw32 ;; ymp) basic_machine=ymp-cray os=unicos ;; *) basic_machine=$1 os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi os=${os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray os=${os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $os in irix*) ;; *) os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony os=newsos ;; next | m*-next) cpu=m68k vendor=next case $os in nextstep* ) ;; ns2*) os=nextstep2 ;; *) os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde os=${os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x$os != x ] then case $os in # First match some system type aliases that might get confused # with valid system types. # solaris* is a basic system type, with this one exception. auroraux) os=auroraux ;; bluegene*) os=cnk ;; solaris1 | solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; solaris) os=solaris2 ;; unixware*) os=sysv4.2uw ;; gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) es1800*) os=ose ;; # Some version numbers need modification chorusos*) os=chorusos ;; isc) os=isc2.2 ;; sco6) os=sco5v6 ;; sco5) os=sco3.2v5 ;; sco4) os=sco3.2v4 ;; sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` ;; sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; scout) # Don't match below ;; sco*) os=sco3.2v2 ;; psos*) os=psos ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # sysv* is not here because it comes later, after sysvr4. gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | kopensolaris* | plan9* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* \ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ | knetbsd* | mirbsd* | netbsd* \ | bitrig* | openbsd* | solidbsd* | libertybsd* \ | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ | chorusrdb* | cegcc* | glidix* \ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ | linux-newlib* | linux-musl* | linux-uclibc* \ | uxpv* | beos* | mpeix* | udk* | moxiebox* \ | interix* | uwin* | mks* | rhapsody* | darwin* \ | openstep* | oskit* | conix* | pw32* | nonstopux* \ | storm-chaos* | tops10* | tenex* | tops20* | its* \ | os2* | vos* | palmos* | uclinux* | nucleus* \ | morphos* | superux* | rtmk* | windiss* \ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ | skyos* | haiku* | rdos* | toppers* | drops* | es* \ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten*) # Remember, each alternative MUST END IN *, to match a version number. ;; qnx*) case $cpu in x86 | i*86) ;; *) os=nto-$os ;; esac ;; hiux*) os=hiuxwe2 ;; nto-qnx*) ;; nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; sim | xray | os68k* | v88r* \ | windows* | osx | abug | netware* | os9* \ | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) ;; linux-dietlibc) os=linux-dietlibc ;; linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; lynx*178) os=lynxos178 ;; lynx*5) os=lynxos5 ;; lynx*) os=lynxos ;; mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; opened*) os=openedition ;; os400*) os=os400 ;; sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; wince*) os=wince ;; utek*) os=bsd ;; dynix*) os=bsd ;; acis*) os=aos ;; atheos*) os=atheos ;; syllable*) os=syllable ;; 386bsd) os=bsd ;; ctix* | uts*) os=sysv ;; nova*) os=rtmk-nova ;; ns2) os=nextstep2 ;; nsk*) os=nsk ;; # Preserve the version number of sinix5. sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; sinix*) os=sysv4 ;; tpf*) os=tpf ;; triton*) os=sysv3 ;; oss*) os=sysv3 ;; svr4*) os=sysv4 ;; svr3) os=sysv3 ;; sysvr4) os=sysv4 ;; # This must come after sysvr4. sysv*) ;; ose*) os=ose ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) os=mint ;; zvmoe) os=zvmoe ;; dicos*) os=dicos ;; pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $cpu in arm*) os=eabi ;; *) os=elf ;; esac ;; nacl*) ;; ios) ;; none) ;; *-eabi) ;; *) echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $cpu-$vendor in score-*) os=elf ;; spu-*) os=elf ;; *-acorn) os=riscix1.2 ;; arm*-rebel) os=linux ;; arm*-semi) os=aout ;; c4x-* | tic4x-*) os=coff ;; c8051-*) os=elf ;; clipper-intergraph) os=clix ;; hexagon-*) os=elf ;; tic54x-*) os=coff ;; tic55x-*) os=coff ;; tic6x-*) os=coff ;; # This must come before the *-dec entry. pdp10-*) os=tops20 ;; pdp11-*) os=none ;; *-dec | vax-*) os=ultrix4.2 ;; m68*-apollo) os=domain ;; i386-sun) os=sunos4.0.2 ;; m68000-sun) os=sunos3 ;; m68*-cisco) os=aout ;; mep-*) os=elf ;; mips*-cisco) os=elf ;; mips*-*) os=elf ;; or32-*) os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=sysv3 ;; sparc-* | *-sun) os=sunos4.1.1 ;; pru-*) os=elf ;; *-be) os=beos ;; *-ibm) os=aix ;; *-knuth) os=mmixware ;; *-wec) os=proelf ;; *-winbond) os=proelf ;; *-oki) os=proelf ;; *-hp) os=hpux ;; *-hitachi) os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=sysv ;; *-cbm) os=amigaos ;; *-dg) os=dgux ;; *-dolphin) os=sysv3 ;; m68k-ccur) os=rtu ;; m88k-omron*) os=luna ;; *-next) os=nextstep ;; *-sequent) os=ptx ;; *-crds) os=unos ;; *-ns) os=genix ;; i370-*) os=mvs ;; *-gould) os=sysv ;; *-highlevel) os=bsd ;; *-encore) os=bsd ;; *-sgi) os=irix ;; *-siemens) os=sysv4 ;; *-masscomp) os=rtu ;; f30[01]-fujitsu | f700-fujitsu) os=uxpv ;; *-rom68k) os=coff ;; *-*bug) os=coff ;; *-apple) os=macos ;; *-atari*) os=mint ;; *-wrs) os=vxworks ;; *) os=none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $os in riscix*) vendor=acorn ;; sunos*) vendor=sun ;; cnk*|-aix*) vendor=ibm ;; beos*) vendor=be ;; hpux*) vendor=hp ;; mpeix*) vendor=hp ;; hiux*) vendor=hitachi ;; unos*) vendor=crds ;; dgux*) vendor=dg ;; luna*) vendor=omron ;; genix*) vendor=ns ;; clix*) vendor=intergraph ;; mvs* | opened*) vendor=ibm ;; os400*) vendor=ibm ;; ptx*) vendor=sequent ;; tpf*) vendor=ibm ;; vxsim* | vxworks* | windiss*) vendor=wrs ;; aux*) vendor=apple ;; hms*) vendor=hitachi ;; mpw* | macos*) vendor=apple ;; *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) vendor=atari ;; vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: freetds-1.3.6/depcomp000755 025423 025423 00000056020 14162303277 016170 0ustar00fredianofrediano000000 000000 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2018 Free Software Foundation, Inc. # 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, 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. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: freetds-1.3.6/install-sh000755 025423 025423 00000015150 14162303277 016616 0ustar00fredianofrediano000000 000000 #!/bin/sh # # $NetBSD: install-sh.in,v 1.6 2012/01/11 13:07:31 hans Exp $ # This script now also installs multiple files, but might choke on installing # multiple files with spaces in the file names. # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. awkprog="${AWKPROG-awk}" mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" instcmd="$cpprog" instflags="" pathcompchmodcmd="$chmodprog 755" chmodcmd="$chmodprog 755" chowncmd="" chgrpcmd="" stripcmd="" stripflags="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" msrc="" dst="" dir_arg="" suffix="" suffixfmt="" while [ x"$1" != x ]; do case $1 in -b) suffix=".old" shift continue;; -B) suffixfmt="$2" shift shift continue;; -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -m*) chmodcmd="$chmodprog ${1#-m}" shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -S) stripcmd="$stripprog" stripflags="-S $2 $stripflags" shift shift continue;; -p) instflags="-p" shift continue;; *) if [ x"$msrc" = x ] then msrc="$dst" else msrc="$msrc $dst" fi src="$dst" dst="$1" shift continue;; esac done if [ x"$dir_arg" = x ] then dstisfile="" if [ ! -d "$dst" ] then if [ x"$msrc" = x"$src" ] then dstisfile=true else echo "install: destination is not a directory" exit 1 fi fi else msrc="$msrc $dst" fi if [ x"$msrc" = x ] then echo "install: no destination specified" exit 1 fi for srcarg in $msrc; do if [ x"$dir_arg" != x ]; then dstarg="$srcarg" else dstarg="$dst" # Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$srcarg" ] then doinst="$instcmd $instflags" elif [ -d "$srcarg" ] then echo "install: $srcarg: not a regular file" exit 1 elif [ "$srcarg" = "/dev/null" ] then doinst="$cpprog" else echo "install: $srcarg does not exist" exit 1 fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d "$dstarg" ] then dstarg="$dstarg"/`basename "$srcarg"` fi fi ## this sed command emulates the dirname command dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $doit $mkdirprog "${pathcomp}" if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi && if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then if [ -d "$dstarg" ]; then true else $doit $mkdirprog "$dstarg" && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi fi else if [ x"$dstisfile" = x ] then file=$srcarg else file=$dst fi dstfile=`basename "$file"` dstfinal="$dstdir/$dstfile" # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Make a backup file name in the proper directory. case x$suffixfmt in *%*) suffix=`echo x | $awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" ' { cnt = 0; do { sfx = sprintf(fmt, cnt++); name = bname sfx; } while (system("test -f " name) == 0); print sfx; }' -`;; x) ;; *) suffix="$suffixfmt";; esac dstbackup="$dstfinal$suffix" # Move or copy the file name to the temp name $doit $doinst $srcarg "$dsttmp" && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi && # Now rename the file to the real destination. if [ x"$suffix" != x ] && [ -f "$dstfinal" ] then $doit $mvcmd "$dstfinal" "$dstbackup" else $doit $rmcmd -f "$dstfinal" fi && $doit $mvcmd "$dsttmp" "$dstfinal" fi done && exit 0 freetds-1.3.6/ltmain.sh000644 025423 025423 00001171522 14162303271 016433 0ustar00fredianofrediano000000 000000 #! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. unset CP unset MV unset RM : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # 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 3 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. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then if test -f "$inst_prefix_dir$libdir/$linklib"; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= versuffix2= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision versuffix2=$major.$age ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= versuffix2= else versuffix=.0.0 versuffix2=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= versuffix2= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-mirbsd*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix versuffix2_save=$versuffix2 major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= versuffix2= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save versuffix2=$versuffix2_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink" && test -n "$relink_command"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: freetds-1.3.6/missing000755 025423 025423 00000015336 14162303277 016217 0ustar00fredianofrediano000000 000000 #! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # 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, 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. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: freetds-1.3.6/mkinstalldirs000755 025423 025423 00000001331 14056414221 017406 0ustar00fredianofrediano000000 000000 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.1 2001-10-12 23:28:53 brianb Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here freetds-1.3.6/interfaces000644 025423 025423 00000004467 14056414221 016663 0ustar00fredianofrediano000000 000000 # # Note: interfaces has been superceded by freetds.conf, however it can # continue to be used at sites that require compatibility with the # Sybase implementation. # # This format of the interfaces file is this: # # The entry starts with the server name beginning in the first column # (no whitespace preceding it). # # Next comes the services lines. They must be preceded by some # whitespace (preferably a tab). There are five fields in the services # line: # # 1) Service. Currently only "query" means anything "master" is # present for historical reasons only. # # 2) Transport. Currently ignored by FreeTDS, it should be "tcp". # When ipv6 support is added a second option of "tcp6" # will probably be available. # # 3) Physical layer. Sybase uses this field for a description of the # physical layer (usually "ether"), FreeTDS can also # use it to specify the version of the protocol to use # when connecting to the server. # # 4) Hostname. A hostname or IP address of the server machine. # # 5) Port. The TCP port on the server to connect to. # Microsft SQL Server defaults to 1433. # # So putting it all together, let's say you have an NT box running a # Microsoft SQL Server named "myserver" at ip address 10.0.2.1 and we # are connecting using version 4.2 of the protocol, your interfaces # entry would look like this: (without the comments) # #myserver # query tcp 4.2 10.0.2.1 1433 # # This is a Sybase hosted database server, if you are directly on the # net you can use it to test. JDBC query tcp 5.0 192.138.151.39 4444 master tcp 5.0 192.138.151.39 4444 # The same server, using TDS 4.2. Used in configuration examples for the # pool server, since the pool server supports only TDS 4.2. JDBC_42 query tcp 4.2 192.138.151.39 4444 master tcp 4.2 192.138.151.39 4444 # The client connecting to the pool server will use this to find its # listening socket. This entry assumes that the client is on the same # system as the pool server. mypool query tcp 4.2 127.0.0.1 5000 master tcp 4.2 127.0.0.1 5000 #myserver # query tcp ether 127.0.0.1 4000 # master tcp ether 127.0.0.1 4000 # #myserver2 # query tcp ether 127.0.0.1 4001 # master tcp ether 127.0.0.1 4001 freetds-1.3.6/PWD.in000644 025423 025423 00000001372 14056414221 015567 0ustar00fredianofrediano000000 000000 # $Id: PWD.in,v 1.1 2002-09-12 15:24:20 castellano Exp $ # # This file was taken from DBD::Sybase :-) It is used by 'make check' to test # the installation # # UID: the username of a user to connect with # PWD: the password for that user # SRV: the symbolic server name from the freetds.conf (or interfaces) file. # Note: if you use a hostname/IP here instead, freetds will attempt to # connect using the compiletime default port (4000 for TDS 5.0, 1433 for # 4.2 or 7.0) which is usually not right. # DB: Database in which to create tables used in the tests. For those new to # Sybase or MS SQL server, there may be many database per server. tempdb # is a good default choice if unsure. # UID=guest PWD=sybase SRV=JDBC DB=tempdb freetds-1.3.6/BUGS.md000644 025423 025423 00000000466 14056414221 015672 0ustar00fredianofrediano000000 000000 Needs Fixing ============ 1. Fix formatting of dbprhead/dbprrow...its a little off (Anybody care?) 2. ct-lib placeholders do not work with TDS 7.0+. To fix this requires either an SQL parser or API modification, because the library has to determine the SQL datatype of the placeholder variable. freetds-1.3.6/freetds.conf000644 025423 025423 00000002202 14056414221 017101 0ustar00fredianofrediano000000 000000 # # This file is installed by FreeTDS if no file by the same # name is found in the installation directory. # # For information about the layout of this file and its settings, # see the freetds.conf manpage "man freetds.conf". # Global settings are overridden by those in a database # server specific section [global] # TDS protocol version tds version = auto # Whether to write a TDSDUMP file for diagnostic purposes # (setting this to /tmp is insecure on a multi-user system) ; dump file = /tmp/freetds.log ; debug flags = 0xffff # Command and connection timeouts ; timeout = 10 ; connect timeout = 10 # To reduce data sent from server for BLOBs (like TEXT or # IMAGE) try setting 'text size' to a reasonable limit ; text size = 64512 # If you experience TLS handshake errors and are using openssl, # try adjusting the cipher list (don't surround in double or single quotes) # openssl ciphers = HIGH:!SSLv2:!aNULL:-DH # A typical Sybase server [egServer50] host = symachine.domain.com port = 5000 tds version = 5.0 # A typical Microsoft server [egServer73] host = ntmachine.domain.com port = 1433 tds version = 7.3 freetds-1.3.6/locales.conf000644 025423 025423 00000000562 14056414221 017076 0ustar00fredianofrediano000000 000000 [default] date format = %b %e %Y %I:%M:%S:%z%p [en_US] date format = %b %e %Y %I:%M:%S:%z%p language = us_english charset = iso_1 [es_ES] date format = %b %d %Y %I:%M%p language = spanish charset = iso_1 [pt_BR] date format = %d/%m/%Y %H:%M language = Portuguese charset = iso_1 [it_IT] date format = %d/%m/%Y %H:%M language = Italiano charset = iso_1 freetds-1.3.6/autogen.sh000755 025423 025423 00000003050 14056414221 016601 0ustar00fredianofrediano000000 000000 #!/bin/sh # Run this to generate all the initial makefiles, etc. # $Id: autogen.sh,v 1.10 2011-03-22 17:54:04 jklowden Exp $ # From automake.info: # # Many packages come with a script called `bootstrap.sh' or # `autogen.sh', that will just call `aclocal', `libtoolize', `gettextize' # or `autopoint', `autoconf', `autoheader', and `automake' in the right # order. Actually this is precisely what `autoreconf' can do for you. # If your package has such a `bootstrap.sh' or `autogen.sh' script, # consider using `autoreconf'. That should simplify its logic a lot # (less things to maintain, yum!), it's even likely you will not need the # script anymore, and more to the point you will not call `aclocal' # directly anymore. srcdir=`dirname $0` PKG_NAME="FreeTDS." # If autoreconf encounters an error, it might be because this is the # very first time it was run, meaning that some files e.g. config.sub # are missing. We retry with --install (and perhaps we should # try --force, too). # # Revision 1.6 was the last one not to use autoreconf. If you can't get # this (simpler) one to work, you might try that one. ( cd $srcdir echo running `which autoreconf` in `pwd`: autoreconf || autoreconf --install ) || exit #conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c if test x$NOCONFIGURE = x; then echo Running $srcdir/configure $conf_flags "$@" '...' \ | tr ' ' \\n \ | sed 's/^-/ &/' $srcdir/configure $conf_flags "$@" \ && echo Now type \`make\' to compile $PKG_NAME else echo Skipping configure process. fi freetds-1.3.6/freetds.spec000644 025423 025423 00000010147 14162303377 017124 0ustar00fredianofrediano000000 000000 %define name freetds %define version 1.3.6 # compute some additional dependency from vendor name # # SUSE %define tds_dep_suse glibc-locale %undefine tds_builddep %{expand:%%{expand:%%{?tds_builddep_%{?_vendor}:%%%%define tds_builddep %%{?tds_builddep_%{?_vendor}}}}} %undefine tds_dep %{expand:%%{expand:%%{?tds_dep_%{?_vendor}:%%%%define tds_dep %%{?tds_dep_%{?_vendor}}}}} Name: %{name} Version: %{version} Release: 1 Vendor: www.freetds.org License: LGPL Group: System Environment/Libraries Source: http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-buildroot BuildRequires: unixODBC-devel >= 2.0.0 gnutls-devel %{?tds_builddep} Requires: gnutls %{?tds_dep} Summary: FreeTDS is a free re-implementation of the TDS (Tabular DataStream) protocol that is used by Sybase and Microsoft for their database products. %description FreeTDS is a project to document and implement the TDS (Tabular DataStream) protocol. TDS is used by Sybase and Microsoft for client to database server communications. FreeTDS includes call level interfaces for DB-Lib, CT-Lib, and ODBC. %package devel Group: Development/Libraries Summary: Include files needed for development with FreeTDS Requires: freetds = %{version} %package unixodbc Group: System Environment/Libraries Summary: FreeTDS ODBC Driver for unixODBC Requires: unixODBC >= 2.0.0 %{?tds_dep:Requires: %tds_dep} %package doc Group: Documentation Summary: User documentation for FreeTDS %description devel The freetds-devel package contains the files necessary for development with the FreeTDS libraries. %description unixodbc The freetds-unixodbc package contains ODBC driver build for unixODBC. %description doc The freetds-doc package contains the useguide and reference of FreeTDS and can be installed even if FreeTDS main package is not installed %prep %setup %build %configure --with-tdsver=auto --with-unixodbc --with-gnutls make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" %install rm -rf "$RPM_BUILD_ROOT" make DESTDIR="$RPM_BUILD_ROOT" install rm -rf "$RPM_BUILD_ROOT/%{_datadir}/doc/freetds" %post /sbin/ldconfig 2> /dev/null %postun /sbin/ldconfig 2> /dev/null %post unixodbc echo "[FreeTDS] Description = FreeTDS unixODBC Driver Driver = %{_libdir}/libtdsodbc.so.0 Setup = %{_libdir}/libtdsodbc.so.0" | odbcinst -i -d -r > /dev/null 2>&1 || true echo "[SQL Server] Description = FreeTDS unixODBC Driver Driver = %{_libdir}/libtdsodbc.so.0 Setup = %{_libdir}/libtdsodbc.so.0" | odbcinst -i -d -r > /dev/null 2>&1 || true %preun unixodbc odbcinst -u -d -n 'FreeTDS' > /dev/null 2>&1 || true odbcinst -u -d -n 'SQL Server' > /dev/null 2>&1 || true %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc AUTHORS.md BUGS.md COPYING*.txt INSTALL.md NEWS.md README.md TODO.md %{_bindir}/* %{_mandir}/man?/* %{_libdir}/libct.so.* %{_libdir}/libsybdb.so.* %config %{_sysconfdir}/* %files devel %defattr (-,root,root) %{_libdir}/*.a %{_libdir}/*.la %{_libdir}/*.so %{_includedir}/* %files unixodbc %defattr(-,root,root) %{_libdir}/libtdsodbc.so* %files doc %defattr (-,root,root) %doc doc/userguide doc/images doc/reference %changelog * Fri Nov 13 2015 Frediano Ziglio - set default protocol version to "auto" (automatic) - enable gnutls in RPM packages * Wed Mar 28 2007 Frediano Ziglio - removed libtdssrv * Thu Sep 09 2004 Frediano Ziglio - remove dependency from freetds-unixodbc - fix field name (Copyright instead of License) - updated URL * Sun Mar 30 2003 Frediano Ziglio - add reference to doc package * Wed Feb 5 2003 Ian Grant - 0.61 tweaked. Added libtdssrv libraries and tools in /usr/bin + man pages * Mon Dec 30 2002 David Hollis - 0.60 tweaked. Move .a & .la files to -devel package * Thu Dec 20 2001 Brian Bruns - Modifications for 0.53 ver and removing interfaces file * Fri Jun 28 2001 Brian Bruns - Modifications for 0.52 ver and ODBC drivers * Wed Feb 14 2001 David Hollis - First stab at RPM for 0.51 ver freetds-1.3.6/tds.dox000644 025423 025423 00000001405 14056414221 016110 0ustar00fredianofrediano000000 000000 PROJECT_NAME = "FreeTDS API" OUTPUT_DIRECTORY = doc/reference GENERATE_LATEX = NO GENERATE_MAN = NO GENERATE_RTF = NO CASE_SENSE_NAMES = NO INPUT = $(SRCDIR)/src \ $(SRCDIR)/include \ $(SRCDIR)/win32 \ $(SRCDIR)/vms EXCLUDE_PATTERNS = */unittests/* RECURSIVE = YES QUIET = YES SHORT_NAMES = YES JAVADOC_AUTOBRIEF = YES PREDEFINED = HAVE_SSL INTERNAL_DOCS = YES EXAMPLE_PATH = $(SRCDIR)/src/tds/example SORT_BRIEF_DOCS = YES EXTRACT_STATIC = YES ALIASES += tds="@param tds A pointer to the TDSSOCKET structure managing a client/server operation." ALIASES += commit{1}="commit id \1" CALL_GRAPH = YES CALLER_GRAPH = YES HAVE_DOT = YES MAX_DOT_GRAPH_DEPTH = 3 DOT_IMAGE_FORMAT = svg freetds-1.3.6/CMakeLists.txt000644 025423 025423 00000037661 14161556621 017367 0ustar00fredianofrediano000000 000000 project(FreeTDS) cmake_minimum_required(VERSION 3.3) option(WITH_OPENSSL "Link in OpenSSL if found" ON) option(ENABLE_ODBC_WIDE "Enable ODBC wide character support" ON) option(ENABLE_KRB5 "Enable Kerberos support" OFF) option(ENABLE_ODBC_MARS "Enable MARS" ON) option(ENABLE_EXTRA_CHECKS "Enable internal extra checks, DO NOT USE in production" OFF) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) cmake_policy(SET CMP0005 NEW) endif(COMMAND cmake_policy) set(PACKAGE freetds) unset(VERSION) if(EXISTS "${CMAKE_SOURCE_DIR}/configure") file(STRINGS "${CMAKE_SOURCE_DIR}/configure" VER LIMIT_COUNT 1 REGEX "^[ ]*VERSION[ ]*=.*1[.]") if(VER MATCHES "VERSION[ ]*=[ ]*'?([^' ]+)") set(VERSION ${CMAKE_MATCH_1}) endif() else() file(STRINGS "${CMAKE_SOURCE_DIR}/configure.ac" VER LIMIT_COUNT 1 REGEX "^AC_INIT\\(FreeTDS,[ ]*1[.].*\\)$") if(VER MATCHES "AC_INIT\\(FreeTDS,[ ]*(.+)\\)$") set(VERSION ${CMAKE_MATCH_1}) endif() endif() if(DEFINED VERSION) # versions to test # set(VERSION "0.92.dev.esyscmd(printf $(date +\"%Y%m%d\"))") # set(VERSION "0.92.dev.esyscmd(printf $(date +\"%y%m%d\"))") # FAIL # set(VERSION "0.95rc1") # set(VERSION "0.95") # set(VERSION "0.95.1") string(TIMESTAMP DATE "%Y%m%d") string(REPLACE ".esyscmd(printf $(date +\"%Y%m%d\"))" ".${DATE}" VERSION ${VERSION}) string(REGEX REPLACE "^dev\\.([0-9]+\\.[0-9]+)\\." "\\1.dev." VERSION "${VERSION}") string(REGEX REPLACE "^([0-9]+\\.[0-9]+)(rc|RC)" "\\1.dev." VER "${VERSION}") string(REPLACE ".dev." ".9999." VER ${VER}) if(VER MATCHES "[^0-9.]" OR VER MATCHES "\\.\\.") message(FATAL_ERROR "wrong VERSION format (${VERSION}) --> (${VER})") endif() if("${VER}.0" MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") set(MAJOR ${CMAKE_MATCH_1}) set(MINOR ${CMAKE_MATCH_2}) set(SUBVERSION ${CMAKE_MATCH_3}) if(SUBVERSION STREQUAL "9999") math(EXPR MINOR "${MINOR} - 1") endif() else() message(FATAL_ERROR "wrong VERSION format (${VERSION}) --> (${VER})") endif() # message(FATAL_ERROR "DEBUG ${MAJOR} ${MINOR} ${SUBVERSION}") else() message(FATAL_ERROR "VERSION not found or wrong format") endif() # get build number from date # use same formula used in configure.ac unset(BUILD_NUMBER) string(TIMESTAMP BUILD_NUMBER "( %Y - 2021 ) * 366 + 1%j - 1000") math(EXPR BUILD_NUMBER "${BUILD_NUMBER}") set(FREETDS_TOPDIR ${CMAKE_CURRENT_LIST_DIR}) enable_testing() set(CMAKE_CTEST_COMMAND ctest) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) # TODO depends on configure add_definitions(-D_REENTRANT -D_THREAD_SAFE) include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckTypeSize) include(CheckFunctionExists) include(CheckLibraryExists) include(CheckStructHasMember) include(CheckPrototypeDefinition) find_package(Perl) find_program(GPERF NAMES gperf) macro(config_write str) file(APPEND "${CMAKE_BINARY_DIR}/include/config.h.in" "${str}") endmacro() file(WRITE "${CMAKE_BINARY_DIR}/include/config.h.in" "/* Automatic generated by cmake */\n\n#define _freetds_config_h_\n") foreach(fn arpa/inet.h com_err.h dirent.h errno.h getopt.h inttypes.h langinfo.h libgen.h limits.h locale.h malloc.h netdb.h netinet/in.h netinet/tcp.h paths.h poll.h roken.h signal.h sql.h sqlext.h stddef.h stdlib.h stdint.h string.h strings.h sys/eventfd.h sys/ioctl.h sys/param.h sys/resource.h sys/select.h sys/socket.h sys/stat.h sys/time.h sys/types.h sys/wait.h unistd.h fcntl.h wchar.h windows.h) string(REGEX REPLACE "[/.]" "_" var "${fn}") string(TOUPPER "HAVE_${var}" var) CHECK_INCLUDE_FILE(${fn} ${var}) config_write("/* Define to 1 if you have the <${fn}> header file. */\n") config_write("#cmakedefine ${var} 1\n\n") endforeach(fn) macro(CHECK_FUNCTION_EXISTS_DEFINE func) string(TOUPPER "HAVE_${func}" var) check_function_exists(${func} ${var}) config_write("/* Define to 1 if you have function <${func}>. */\n") config_write("#cmakedefine ${var} 1\n\n") endmacro() if(WITH_OPENSSL) find_package(OpenSSL) endif(WITH_OPENSSL) if(OPENSSL_FOUND) config_write("#define HAVE_OPENSSL 1\n\n") include_directories(${OPENSSL_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) # This fixes an issue with OpenSSL compiled as static library if(WIN32) list(APPEND CMAKE_REQUIRED_LIBRARIES crypt32 ws2_32) endif(WIN32) check_function_exists_define(BIO_get_data) check_function_exists_define(RSA_get0_key) check_function_exists_define(ASN1_STRING_get0_data) set(CMAKE_REQUIRED_LIBRARIES) endif(OPENSSL_FOUND) set(CMAKE_THREAD_PREFER_PTHREAD ON) find_package(Threads REQUIRED) if(HAVE_WINDOWS_H) if(NOT HAVE_SQL_H) unset(HAVE_SQL_H CACHE) CHECK_INCLUDE_FILES("windows.h;sql.h" HAVE_SQL_H) endif() if(HAVE_SQL_H AND NOT HAVE_SQLEXT_H) unset(HAVE_SQLEXT_H CACHE) CHECK_INCLUDE_FILES("windows.h;sql.h;sqlext.h" HAVE_SQLEXT_H) endif() if(NOT HAVE_ODBCSS_H) unset(HAVE_ODBCSS_H CACHE) CHECK_INCLUDE_FILES("windows.h;sqltypes.h;odbcss.h" HAVE_ODBCSS_H) endif() endif(HAVE_WINDOWS_H) # find types macro(ADD_HEADER VAR FN) if(${VAR}) set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} ${FN}) endif() endmacro(ADD_HEADER) add_header(HAVE_WCHAR_H wchar.h) add_header(HAVE_WINDOWS_H windows.h) add_header(HAVE_SQL_H sql.h) add_header(HAVE_SQLEXT_H sqlext.h) foreach(fn char double float int short long "long double" "long long" "SQLWCHAR" "void *" wchar_t __int64 SQLLEN SQLROWOFFSET SQLROWSETSIZE SQLSETPOSIROW) string(REGEX REPLACE "[/. ]" "_" var "${fn}") string(REPLACE "*" "P" var "${var}") string(TOUPPER "HAVE_${var}" have) string(TOUPPER "SIZEOF_${var}" var) CHECK_TYPE_SIZE(${fn} ${var}) if(HAVE_${var}) set(${have} 1 CACHE INTERNAL "Have type ${fn}") else() set(${var} 0) endif() config_write("#define ${var} \\@${var}\\@\n\n") endforeach(fn) foreach(fn SQLLEN SQLROWOFFSET SQLROWSETSIZE SQLSETPOSIROW) config_write("/* Define to 1 if you have type <${fn}>. */\n#cmakedefine HAVE_${fn} 1\n\n") endforeach(fn) check_prototype_definition(SQLColAttribute "SQLRETURN SQL_API SQLColAttribute (SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, SQLSMALLINT *StringLength, SQLLEN * NumericAttribute)" SQL_SUCCESS "${CMAKE_EXTRA_INCLUDE_FILES}" TDS_SQLCOLATTRIBUTE_SQLLEN) config_write("/* Define to 1 if last argument of SQLColAttribute it's SQLLEN * */\n#cmakedefine TDS_SQLCOLATTRIBUTE_SQLLEN 1\n\n") check_prototype_definition(SQLParamOptions "SQLRETURN SQL_API SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN *pirow)" SQL_SUCCESS "${CMAKE_EXTRA_INCLUDE_FILES}" TDS_SQLPARAMOPTIONS_SQLLEN) config_write("/* Define to 1 if SQLParamOptions accept SQLULEN as arguments */\n#cmakedefine TDS_SQLPARAMOPTIONS_SQLLEN 1\n\n") set(CMAKE_EXTRA_INCLUDE_FILES) macro(SELECT_TYPE VAR SIZE TYPES ERROR) set(${VAR} "") foreach(t ${TYPES}) string(REGEX REPLACE "[/. ]" "_" var "${t}") string(REPLACE "*" "P" var "${var}") string(TOUPPER "SIZEOF_${var}" var) if(${${var}} EQUAL ${SIZE}) set(${VAR} ${t}) break() endif() endforeach(t) if(${VAR} STREQUAL "") message(FATAL_ERROR ${ERROR}) endif() endmacro(SELECT_TYPE) SELECT_TYPE(tds_sysdep_int16_type 2 "short;int" "No 16-bit int found.") SELECT_TYPE(tds_sysdep_int32_type 4 "short;int;long" "No 32-bit int found.") SELECT_TYPE(tds_sysdep_int64_type 8 "long;long long;__int64" "No 64-bit int found.") SELECT_TYPE(tds_sysdep_real32_type 4 "float;double" "No 32-bit real found.") SELECT_TYPE(tds_sysdep_real64_type 8 "float;double;long double" "No 64-bit real found.") SELECT_TYPE(tds_sysdep_intptr_type ${SIZEOF_VOID_P} "short;int;long;__int64" "No intptr type found.") # find functions set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) set(FUNCS asprintf vasprintf strtok_r strtok_s readpassphrase strlcpy strlcat basename getopt strsep vsnprintf _vsnprintf snprintf _snprintf _vscprintf gettimeofday nl_langinfo locale_charset setenv putenv getuid getpwuid getpwuid_r fstat alarm fork gethrtime localtime_r setitimer _fseeki64 _ftelli64 setrlimit inet_ntoa_r getipnodebyaddr getipnodebyname getaddrinfo inet_ntop gethostname poll socketpair clock_gettime fseeko pthread_cond_timedwait pthread_cond_timedwait_relative_np pthread_condattr_setclock _lock_file _unlock_file usleep nanosleep readdir_r eventfd daemon system) # TODO set(HAVE_GETADDRINFO 1 CACHE INTERNAL "") foreach(func ${FUNCS}) check_function_exists_define(${func}) endforeach(func) macro(CHECK_STDIO_FUNCTION_EXISTS FUNCTION) string(TOUPPER "HAVE_${FUNCTION}" VARIABLE) string(TOUPPER "CHECK_${FUNCTION}" CHECK) if (NOT ${VARIABLE}) set(MACRO_CHECK_FUNCTION_DEFINITIONS "-D${CHECK}=1 ${CMAKE_REQUIRED_FLAGS}") message(STATUS "Looking for ${FUNCTION}") try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/misc/cmake_checks.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") message(STATUS "Looking for ${FUNCTION} - found") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") else() message(STATUS "Looking for ${FUNCTION} - not found") set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" "${OUTPUT}\n\n") endif() endif() endmacro() foreach(func asprintf vasprintf vsnprintf _vsnprintf snprintf _snprintf _vscprintf) check_stdio_function_exists(${func}) endforeach(func) set(CMAKE_REQUIRED_LIBRARIES) check_struct_has_member("struct tm" "tm_zone" "time.h" HAVE_STRUCT_TM_TM_ZONE) config_write("#cmakedefine HAVE_STRUCT_TM_TM_ZONE 1\n\n") macro(SEARCH_LIBRARY FUNC HAVE VAR LIBS) foreach(lib ${LIBS}) if(NOT ${HAVE}) unset(${HAVE} CACHE) check_library_exists(${lib} ${FUNC} "" ${HAVE}) if(${HAVE}) unset(${VAR} CACHE) set(${VAR} ${lib} CACHE INTERNAL "") endif() endif() endforeach(lib) endmacro(SEARCH_LIBRARY) check_library_exists(readline readline "" HAVE_READLINE) if(HAVE_READLINE) config_write("#cmakedefine HAVE_READLINE 1\n\n") search_library(tgetent HAVE_TGETENT lib_READLINE "readline;ncurses;curses;termcap") set(lib_READLINE readline ${lib_READLINE}) endif(HAVE_READLINE) config_write("#cmakedefine HAVE_SQLGETPRIVATEPROFILESTRING 1\n\n") if(WIN32) set(lib_ODBCINST odbccp32) check_library_exists(legacy_stdio_definitions _vsnwprintf_s "" LEGACY_STDIO) if(LEGACY_STDIO) set(lib_ODBCINST ${lib_ODBCINST} legacy_stdio_definitions) endif(LEGACY_STDIO) else() search_library(SQLGetPrivateProfileString HAVE_SQLGETPRIVATEPROFILESTRING lib_ODBCINST "odbcinst;iodbcinst") endif() # flags foreach(flag ODBC_WIDE EXTRA_CHECKS KRB5 ODBC_MARS) config_write("#cmakedefine ENABLE_${flag} 1\n\n") endforeach(flag) config_write("#define VERSION \"\\@VERSION\\@\"\n\n") config_write("#define FREETDS_TOPDIR \"${FREETDS_TOPDIR}\"\n\n") # TODO allow to configure default TDS protocol version config_write("#ifdef _MSC_VER # define inline __inline # define _CRT_SECURE_NO_WARNINGS 1 #endif\n\n") if(WIN32) config_write("/* Define to 1 if you want to use SSPI for Win32 */\n#define HAVE_SSPI 1\n\n") config_write("/* define to format string used for 64bit integers */\n#define TDS_I64_PREFIX \"I64\"\n\n") config_write("/* Define to 1 if you have the SQLGetPrivateProfileString function. */\n#define HAVE_SQLGETPRIVATEPROFILESTRING 1\n\n") if(MINGW) config_write("#define _GNU_SOURCE 1\n\n") endif(MINGW) else(WIN32) # this section make just work on Linux, many definition are not checked config_write("#define HAVE_FUNC_GETPWUID_R_5 1\n\n") config_write("#define HAVE_FUNC_LOCALTIME_R_TM 1\n\n") config_write("/* define to format string used for 64bit integers */\n#define TDS_I64_PREFIX \"ll\"\n\n") config_write("#define UNIXODBC 1\n\n#define _GNU_SOURCE 1\n\n") if(NOT OPENSSL_FOUND) include(FindGnuTLS) if(GNUTLS_FOUND) config_write("#define HAVE_GNUTLS 1\n") set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES}) check_function_exists_define(gnutls_certificate_set_verify_function) check_function_exists_define(gnutls_record_disable_padding) check_function_exists_define(gnutls_rnd) set(CMAKE_REQUIRED_LIBRARIES) pkg_check_modules(NETTLEDEP gnutls) if (";${NETTLEDEP_STATIC_LIBRARIES};" MATCHES ";nettle;") set(lib_GNUTLS ${GNUTLS_LIBRARIES}) config_write("#define GNUTLS_USE_NETTLE 1\n\n") pkg_check_modules(NETTLE nettle) if(NETTLE_FOUND) set(lib_GNUTLS ${GNUTLS_LIBRARIES} ${NETTLE_LIBRARIES}) config_write("#define HAVE_NETTLE 1\n\n") if (";${NETTLEDEP_STATIC_LIBRARIES};" MATCHES ";hogweed;") set(lib_GNUTLS ${lib_GNUTLS} hogweed) endif() if (";${NETTLEDEP_STATIC_LIBRARIES};" MATCHES ";gmp;") set(lib_GNUTLS ${lib_GNUTLS} gmp) config_write("#define HAVE_GMP 1\n\n") endif() endif(NETTLE_FOUND) else() set(lib_GNUTLS ${GNUTLS_LIBRARIES} gcrypt tasn1) endif() endif(GNUTLS_FOUND) endif(NOT OPENSSL_FOUND) if(NOT HAVE_CLOCK_GETTIME AND NOT HAVE_GETHRTIME) search_library(clock_gettime HAVE_CLOCK_GETTIME lib_RT "rt;posix4") config_write("#cmakedefine HAVE_CLOCK_GETTIME 1\n\n") endif(NOT HAVE_CLOCK_GETTIME AND NOT HAVE_GETHRTIME) if(CMAKE_USE_PTHREADS_INIT) config_write("#define HAVE_PTHREAD 1\n\n") config_write("#define TDS_HAVE_PTHREAD_MUTEX 1\n\n") endif(CMAKE_USE_PTHREADS_INIT) config_write(" #define TIME_WITH_SYS_TIME 1 //#define _ALL_SOURCE 1 #define __EXTENSIONS__ 1 // readline #define HAVE_RL_INHIBIT_COMPLETION 1 #define HAVE_RL_ON_NEW_LINE 1 #define HAVE_RL_RESET_LINE_STATE 1 // iconv #define HAVE_ICONV 1 #define ICONV_CONST ") endif(WIN32) set(lib_BASE ${lib_RT} ${CMAKE_THREAD_LIBS_INIT}) if(EXISTS "${CMAKE_SOURCE_DIR}/iconv/lib/iconv.lib") set(lib_BASE ${lib_BASE} ${CMAKE_THREAD_LIBS_INIT} "${CMAKE_SOURCE_DIR}/iconv/lib/iconv.lib") config_write("#define HAVE_ICONV 1\n\n") config_write("#define ICONV_CONST \n\n") endif() if(WIN32) set(lib_NETWORK ws2_32 crypt32) else(WIN32) # TODO check libraries set(lib_NETWORK gssapi_krb5) endif(WIN32) if(OPENSSL_FOUND) set(lib_NETWORK ${lib_NETWORK} ${OPENSSL_LIBRARIES}) elseif(GNUTLS_FOUND) set(lib_NETWORK ${lib_NETWORK} ${lib_GNUTLS}) endif(OPENSSL_FOUND) include_directories(${CMAKE_BINARY_DIR}/include include win32 iconv/include) add_subdirectory(src/utils) add_subdirectory(src/replacements) add_subdirectory(src/tds) add_subdirectory(src/ctlib) add_subdirectory(src/dblib) add_subdirectory(src/odbc) add_subdirectory(src/apps) add_subdirectory(src/server) add_subdirectory(src/pool) configure_file(${CMAKE_BINARY_DIR}/include/config.h.in ${CMAKE_BINARY_DIR}/include/config.h) configure_file(${CMAKE_SOURCE_DIR}/include/tds_sysdep_public.h.in ${CMAKE_BINARY_DIR}/include/tds_sysdep_public.h) configure_file(${CMAKE_SOURCE_DIR}/include/freetds/version.h.in ${CMAKE_BINARY_DIR}/include/freetds/version.h) if(NOT EXISTS "${CMAKE_SOURCE_DIR}/configure") configure_file(${CMAKE_SOURCE_DIR}/src/odbc/version.rc.in ${CMAKE_SOURCE_DIR}/src/odbc/version.rc) endif(NOT EXISTS "${CMAKE_SOURCE_DIR}/configure") set(FREETDS_PUBLIC_INCLUDE ${CMAKE_SOURCE_DIR}/include/bkpublic.h ${CMAKE_SOURCE_DIR}/include/cspublic.h ${CMAKE_SOURCE_DIR}/include/cstypes.h ${CMAKE_SOURCE_DIR}/include/ctpublic.h ${CMAKE_SOURCE_DIR}/include/sqldb.h ${CMAKE_SOURCE_DIR}/include/sqlfront.h ${CMAKE_SOURCE_DIR}/include/sybdb.h ${CMAKE_SOURCE_DIR}/include/sybfront.h ${CMAKE_SOURCE_DIR}/include/syberror.h ${CMAKE_SOURCE_DIR}/include/odbcss.h ${CMAKE_BINARY_DIR}/include/tds_sysdep_public.h) set(FREETDS_PUBLIC_INCLUDE_2 ${CMAKE_BINARY_DIR}/include/freetds/version.h) set(FREETDS_CONF_FILES ${CMAKE_SOURCE_DIR}/freetds.conf ${CMAKE_SOURCE_DIR}/locales.conf ${CMAKE_SOURCE_DIR}/src/pool/pool.conf) install(FILES ${FREETDS_PUBLIC_INCLUDE} DESTINATION include) install(FILES ${FREETDS_PUBLIC_INCLUDE_2} DESTINATION include/freetds) install(FILES ${FREETDS_CONF_FILES} DESTINATION etc) freetds-1.3.6/Thanks-1.0000644 025423 025423 00000002030 14056414222 016245 0ustar00fredianofrediano000000 000000 - Bill D Thompson - help fixing packet corruption - Christos Zoulas - server maintainer - Craig A. Berry - updated VMS support - Jan Baumgarten - reported a problem with CMake - John Kendall - fixed compatibility with old sql server - Johnny C. Lam - reported a problem in userguide - Joshua Lang - reported some issues - fixed reading server SPID - Ken Collins - reported different issues and helped fixing them - Lars Kanis - minor header cleanup - Mark Brand - fix a compile issue - Matthew Green - support for Sybase date/time - Mike Jetzer - reported some issue using HP-UX and tested the fix - Noel Diaz - reported bug causing a corrupted packet - Ondrej Holecek - fix a problem with affected row compatibility in CT-Library - Ramiro Morales - improved AppVeyor support - fixed some compiler issue - CMake improvements - Randy Syring - updated some userguid - Richard Hughes - added support for BCP in ODBC - Sergio NNX - fixed a problem with IPv6 - Zoltan Kozma - patch for protocol compatibility freetds-1.3.6/AUTHORS.md000644 025423 025423 00000005324 14056414221 016255 0ustar00fredianofrediano000000 000000 Brian Bruns Started this crazy thing James K. Lowden Documentation, maintainer from 2003 to early 2015. Marc Abramowitz Testing and patches, Travis CI tests. Koscheev Andrey Negative money patch. Craig A. Berry VMS support. James Cameron GNU standards compliance and minor fixes. Peter Deacon Lots of help, testing and patches. John F. Dumas Patch to fix memory leaks. David Fraser Testing and patches (NO-DM support). Scott Gray TDS 7.0 numeric support and bug fixes. Alex Hornby Testing and patches. Mihai Ibanescu GNUified the packet. Gregg Jensen Message handlers and extra datatype support and some sybperl stuff? Viktar Klimkovitch ODBC fixes to get libodbc++ working. Bob Kline NTEXT support. Lothar Krauss ODBC fixes. Steve Langasek Off by one fixes and autoconf byte size thing. Debian package maintainer. Mark J. Lilback Implementation of dbstrlen and dbstrcpy. Kevin Lyons Various TDS bug fixes. Steve Murphree Contributed a huge ODBC patch. Dennis Nicklaus vxWorks port and fixes for dbdata() and SYBVARBINARY. Arno Pedusaar Donated his TDS4.2 code to the cause. Brandon M. Reynolds Fix for arbitrarily large queries under dblib. Thomas Rogers Testing and patches. Mark Schaal Cleaned up message handling, bug fixes, ctlib unittests. Ken Seymour ODBC Driver Fixes. Craig Spannring JDBC driver and CVS repository. Martin Spott Testing and patches. Sam Tetherow Various TDS bug fixes. Bill Thompson BCP patches and datetime fixes. Patrick van Kleef Various bug fixes, dbcanquery() and odbc version checks. Geoff Winkless Lost connection stuff. Nicholas S. Castellano Many bug fixes and improvements, contributor of fisql application. Frediano Ziglio Lot of contributions, maintainer since 2015. Special thanks to Michael Peppler , author of the DBD::Sybase Perl module. Thanks go to the folks at A2i, Inc. (http://www.a2i.com) for funding the development of dblib host file bulk copy and writetext support, and to Dave Poyourow there for helping with the debugging. freetds-1.3.6/INSTALL.md000644 025423 025423 00000001416 14056414222 016235 0ustar00fredianofrediano000000 000000 FreeTDS Installation ==== If you are installing from git repository please read [INSTALL.GIT](./INSTALL.GIT.md) For complete instructions, see the [FreeTDS Users Guide](http://www.freetds.org/userguide/). It is included in the distribution inside "doc/userguide/index.html`. Brief Instructions ---- ``` $ ./configure --help $ ./configure $ make $ make install ``` Post Install ==== * Edit the `/usr/local/etc/freetds.conf` file to add servers. * Test the connection with `/usr/local/bin/tsql` * Build and test the package that requires FreeTDS. If you want to build the ODBC driver, you'll probably first want to install a Driver Manager (on Unix-like systems). This release of FreeTDS was tested with unixODBC 2.2.11. For any other information please see the Users Guide. freetds-1.3.6/NEWS.md000644 025423 025423 00000073436 14056414271 015722 0ustar00fredianofrediano000000 000000 $Id: b4e6442475cd841716ce9526482ecf7d0e30f471 $ Summary of Changes in release 1.3 -------------------------------------------- User visible (not in a particular order): - Generic: - Support UTF-8 columns using MSSQL 2019; - Do not accept TDS protocol versions "4.6" (never really supported) and "8.0"; - Minor portability issues; - Fix log elision for login; - Detect some possible minor memory failure in application; - Support long (more than 64k) SSPI packets (never encountered but you never know); - Fix unicode columns for ASA database; - Avoid using BCP with old protocols; - (\*) Fix bulk copy using big endian machines; - (\*) Fix Sybase uni(var)char and unsigned types for big endian machines; - (\*) Do not send nullable data during bulk copy if type is not nullable; - ODBC: - Added "Timeout" setting; - Applications: - Improve defncopy utility: - Fix some declaration; - Fix Sybase support; - (\*) Fix datacopy and freebcp logging ; - CT-Library: - Minor fix for variant type; - Better support for timeout setting; - (\*) Support some missing types (like nullable unsigned integers) for Sybase; - DB-library: - Unify date format (all systems can use the same syntax); - (\*) Allows to pass 0 as type for bcp_bind; - (\*) Fix DBSETLSERVERPRINCIPAL macro; - (\*) Do not limit queries length for bcp using Sybase; - (\*) Add KEEP_NULLS to BCP hints. (\*) Feature backported in stable 1.2 branch. Implementation: - Move replacement headers under freetds directory for coherence with other internal headers; - Lot of style updates; - Optimize UTF-8 encoding for ODBC, reuse common code. Summary of Changes in release 1.2 -------------------------------------------- User visible (not in a particular order): - Sybase server: - All strings are now converted as MSSQL; - Support kerberos login; - DB-Library: add DBSETNETWORKAUTH, DBSETMUTUALAUTH, DBSETDELEGATION and DBSETSERVERPRINCIPAL; - CT-Library: add CS_SEC_NETWORKAUTH, CS_SEC_NETWORKAUTH, CS_SEC_NETWORKAUTH and CS_SEC_NETWORKAUTH; - Bulk copies: - DB-Library: fix trim of unicode fields; - (\*) Apply character conversion for Sybase, like MSSQL; - (\*) Ignore computed columns; - (\*) Properly support multibyte strings in column names; - (\*) DB-Library: stop correctly on BCPMAXERRS setting; - (\*) DB-Library: do not try to convert skipped rows reading file allowing for instance to load CVS files; - (\*) CT-Library: added CS_DATABASE property to allows to connect correctly to Azure servers; - (\*) Improve support for MS XML columns for both DB-Library and CT-Library; - (\*) Fix some issues with MSSQL server redirection (used for instance in Azure); - (\*) Change SQL_DESC_OCTET_LENGTH value for wise character columns; - Better support for SQL_VARIANT: - Better column checks; - (\*) CT-Library: now supported, columns are returned as CS_CHAR_TYPE; - Some updates to server part: - Set correctly initial state; - IPv6 support; - Fix TDS 7.2 logins; - Support extended character using domain logins under Unix; - Improve MARS: - Less memory copies; - (\*) Remove possible deadlock; - Handle wrapping sequence/window numbers; - Make sure we sent the wanted packet; - (\*) Support UTF-16 surrogate pairs in odbc_wide2utf and odbc_set_string_flag fixing some character encoding support; - (\*) Fix multiple queries, used by ODBC to optimize data load; - (\*) Improve emulated parameter queries, fixing minor issues and reducing memory usage; - Support DBVERSION_UNKNOWN in dbsetlversion (will use automatic detection); - CT-Library: define CS_MIN_SYBTYPE and CS_MAX_SYBTYPE; - (\*) CT-Library: fix cs_will_convert accepting library constants, not libTDS. (\*) Feature backported in stable 1.1 branch. Implementation: - User guide converted to XML; - Always use little endian on network level, simpler and faster; - Converted some files to markdown; - Optimize bytes endianess conversion; - Made character lookup faster making character conversion quicker; - Optimize data padding in CT-Library; - Fix some build dependencies causing some files to not be properly recompiled during development; - Add "freeze" support allowing to pause sending in order to simplify lengths computations sending data. Summary of Changes in release 1.1 -------------------------------------------- User visible (not in a particular order): - Changed default TDS protocol version during configure to "auto". Versions 4.2 and 7.0 are no longer accepted for default, you may still specify an explicit version to connect to obsolete servers ("auto" won't attempt these versions); - allows to disable TLS 1.0 support; - pool server allows to specify different username/password for server and clients allowing to hide internal server logins; - tsql utility now send final partial query to server to avoid to have to specify a final "GO" line to terminate commands; - better support for Microsoft cluster, client will attempt multiple connection to server at the same time if DNS reply multiple IPs; - MONEY/SMALLMONEY types are now formated with 4 decimal digits to avoid truncation; - MARS support is now compiled by default; - pool server is now compiled by default; - Fixed SQL_ATTR_LOGIN_TIMEOUT for ODBC; - Fixed large integer numbers for ODBC RPC constants; - Fixed encrypted logins if "auto" protocol version is used; - Support CS_TIMEOUT, CS_LOGIN_TIMEOUT and CS_CLIENTCHARSET properties under CTLibrary; - Added a dbacolname function in DBLibrary, similar to dbcolname but for compute columns (mainly for Sybase now, Microsoft removed support for compute columns); - NTLMv2 is now on by default. Implementation: - Improved UTF-8 performances; - Use more stdint.h style definitions (like uint32_t); - Use bool type instead of int; - pool server compile under Windows too (not as capable as Unix version); - CMake build is now able to do an installation; - Added a src/utils directory to collect all common code not strictly related to replacements or TDS; - Simplified makefiles; - Support CP1252 encoding in internal trivial iconv; - Better ODBC detection. Allows to specify a directory with --with-iodbc to specify custom iOBDC. Summary of Changes in release 1.0 -------------------------------------------- User visible (not in a particular order): - Removed "8.0" from protocol version string accepted. Please update configuration files; - Default protocol version is now auto. This could slow down connection but make user experience less painful; - Sybase encrypted login. Set encryption to get it; - Support protocol version 7.4; - Add intent support to specify we don't want to change data; - Allow to attach database file during the login (MS SQL Server); - Support for Sybase time/date/bigdate/bigdatetime; - Pool is working again; - ODBC BCP (not complete); - Improved dbconvert and dbconvert_ps (more compatible); - Fixed dbspid; - Improved ODBC type information; - Better certificate verification; - AppVeyor is used for every build; - Try all IPs from DNS. This allows SQL Cluster connection to secondary servers. Implementation: - Removed Nmake support; - Type conversions simplified; - Better type handle code. Summary of Changes in release 0.95 -------------------------------------------- User visible (not in a particular order): - Support for build with CMake under Windows. - Support MSSQL 2008: - new date/time types; - NBCROWs; - able to retrieve CLR UDT types in binary format. - Moved from CVS to git. - Support MARS under ODBC. - IPv6 support. - Support unsigned Sybase types. - Sybase use some characters conversion like MSSQL. - Bulk-copy improvements: - more types; - support for empty fields; - no needs for seekable file; - avoid possible buffer overflows; - less memory consumption; - handle different BIT fields in Sybase; - -T option for datacopy. - datacopy: - prompting for password (use "-" password on command line); - empty user/password (to use Kerberos). - Support for query notifications in ODBC. - Support for protocols 7.2 and 7.3 under dblib and ctlib. - dblib: - dbpivot extension; - dbprcollen extension to get printable column size; - add DBCOL2 structure for dbtablecolinfo; - support DBTEXTSIZE option for dbsetopt; - support SRCNUMERICBIND and SRCDECIMALBIND binding; - DATETIME2BIND extension binding to support new mssql 2008 type; - ODBC: - add SQL_INFO_FREETDS_TDS_VERSION option to SQLGetInfo to retrieve FreeTDS version; - add --enable-odbc-wide-tests configure option to use wide functions in unit tests. - Better thread support. - Allow to specify server SPN for GSSAPI. - Sybase graceful disconnects. - Better support for VARCHAR(MAX)/VARBINARY(MAX). - Better error reporting from login failure. - More strict test for configuration errors, fails if configuration is wrong. - "use utf-16" option to enable use of UTF-16 for server encoding (MSSQL). - Remove support for Dev-C++. - Remove support for bad iconv, use libiconv instead (Tru64 and HP-UX should be affected), connect will fail. - New NTLM options: - "use lanman"; - "use ntlmv2". - New Kerberos options: - "realm" ("REALM" in ODBC); - "spn" ("ServerSPN" in ODBC). - New certificate options: - "ca file"; - "crl file"; - "check certificate hostname". - Many bug fixes, majors: - SSPI with Kerberos on some setup; - SQLCancel threading; - ctlib numeric; - ODBC statistic function quotings. Implementation: - Introdude streams support to make easier handling large data and making conversions faster. - Use array of flags to make faster to retrieve data type features. - Use callbacks for handling various type functions. - Optimize data conversions. - Store TDS packets in a new structure to handle multiple packets. - New DSTR implementation which use less memory. - Faster logging. - Put mostly data handling in src/tds/data.c. - Move mostly headers to include/freetds directory. - Add a include/freetds/proto.h header to separate protocol declarations. - Add src/tds/packet.c to separate code handling TDS packets. - Modify libTDS error codes, not only TDS_FAIL. - Use DSTR for names in TDSCOLUMN. - Generate graphs in Doxygen. Summary of Changes in release 0.91 -------------------------------------------- 1. Full Kerberos and SSPI support for passwordless login to Microsoft SQL Server from Unix and Windows clients. Includes Kerberos delegation option. 2. Full support for DB-Library under Win32/64 via NMAKE.EXE. 3. Built-in support for UTF-8. 4. Support for wide characters in ODBC. 5. Support for varchar(max) and varbinary(max). 6. Better thread-safety in ODBC. 7. Distinguish between connect and login errors. 8. Bulk-copy functions in CT-Library. TDS versions now reflect Microsoft's nomenclature. The previous version numbers (8.0 and 9.0) are now 7.1 and 7.2. See the UG for details. Executive Summary of Changes in release 0.82 -------------------------------------------- 1. timeout handling 2. encrypted connections 3. fisql (and odbc utilities) 4. autoconf improvements 5. 23,710 lines added or deleted (101,022 total). 6. 85 files added 7. 21 unit tests added Details ------- db-lib - timeouts work! - corrected dbnextrow - implemented dbsetnull and dbsetinterrupt - improved error reporting and checking - fixed rpc parameter processing, now php works correctly ct-lib - added cs_loc_alloc, cs_loc_drop, cs_locale implementations odbc - cursors (mssql) - fixed database setting - return error always if odbc returns SQL_ERROR - fixed SQLGetData result utilities - added support for NUL characters inside terminators in freebcp - added row termination and column termination option to tsql - new fisql application - new ODBC utilities documentation - significant updates to TDS protocol documentation - freetds.conf man page - added tenderfoot sample code general - fixed timeout handling - added freetds.conf option for encryption - added protocol version discovery - NTLM2 session response - read table and real column name from wire - experimental Kerberos support using gssapi - some optimizations for GCC4 - optimized conversions avoiding some memory copy - minor improves to server stuff - improved MingW compile (even cross one) - more verbose log for dblib and odbc - many test added 1 test for libTDS 1 test for ctlib 3 tests for dblib 13 tests for odbc libTDS API changes - tds_add_row_column_size removed - tds_alloc_row return now TDS_SUCCEED/TDS_FAIL - tds_alloc_compute_row return now TDS_SUCCEED/TDS_FAIL - removed TDSCOLUMN->column_offset - added TDSCOLUMN->column_data and TDSCOLUMN->column_data_free - added TDSCURSOR->type and TDSCURSOR->concurrency for mssql support - added fetch_type and i_row parameters to tds_cursor_fetch - added tds_cursor_update and tds_cursor_setname functions - made tds_alloc_get_string static - removed tds_free_cursor - added TDSCURSOR->ref_count - added tds_cursor_deallocated and tds_release_cursor to handle cursor release. tds_cursor_deallocated is called when cursor got deallocated from server while tds_release_cursor is called to decrement reference counter. Reference counter is used cause is difficult to trace pointer owner between libTDS and upper libraries - added TDS_COMPILETIME_SETTINGS->sysconfdir - changed DSTR_STRUCT structure to include dstr_size - changed DSTR type - error handler cannot return TDS_INT_EXIT - removed TDSSOCKET->query_timeout_func TDSSOCKET->query_timeout_param, TDSSOCKET->query_start_time - changed TDSLOGIN->host_name to client_host_name - changed TDSCONNECTION->host_name to client_host_name - changed TDSLOGIN->encrypted to encryption_level - changed TDSCONNECTION->encrypted to encryption_level - added TDSRESULTINFO->row_free handler to free row - added TDSCONTEXT->int_handler handler - removed tds_prtype - removed tds_alloc_param_row - added tds_alloc_param_data - added flags parameter to tds7_send_auth - removed tds_client_msg - added tdserror to report error - added flags parameter to tds_answer_challenge - added is_variable_type macro - added TDSCOLUMN->table_column_name - added tds parameter to tds_set_column_type - renamed BCPCOLDATA->null_column to is_null - added TDSMESSAGE->oserr - remove length, number_upd_cols and cur_col_list from TDSCURSOR (never used) - added new TDSAUTHENTICATION to handle authentication modules - added TDSSOCKET->authentication - added tds_ntlm_get_auth and tds_gss_get_auth - removed TDSANSWER - removed tds7_send_auth (use new tds_ntlm_get_auth) - added tds_get_int8 - add TDSPARAMINFO *params argument to tds_cursor_declare - add TDSPARAMINFO *params argument to tds_cursor_open - changed TDSSOCKET->rows_affected from int to TDS_INT8 - added TDSSOCKET->tds9_transaction (used internally for TDS9) - added TDSCONNECTION->server_host_name needed for Kerberos support * 0.64 - core library - reduced network bandwidth use on Linux and *BSD - do not free TDSSOCKET in tds_connect - moved network stuff into net.c - fixed conversion NUMERIC->NUMERIC changing precision/scale - added named instance support (mssql2k) - fixed cancel and timeout - added support for encrypted connection using mssql (using either GnuTLS or OpenSSL) - improved numeric conversions performance - improved debug logging (added "debug flags" option) - ctlib - ct_dynamic and friends (placeholder support) - dblib - more functions - made threadsafe - improved bcp - support for large files using BCP - fixed buffering - ODBC - fixed compute handling in ODBC - paramset support - constant parameters in rpc (ie {?=call func(10,?)} ) - configure use automatically odbc_config if available - compatibility - improve PHP support - improve DBD::ODBC support - partial dos32 support - improve JDBC support - added msvc6 project to build dblib library on windows - support long password on tsql for all platforms - improved pool server - RPMs - ODBC driver registration (in odbcinst.ini) - better dependency for RedHat and SUSE - a lot of fixes libTDS API changes - tds_connect does not free TDSSOCKET* on failure - TDSSOCKET->env is not a pointer anymore - tds_free_compute_result and tds_free_compute_results are now static - added TDSDYNAMIC->next for linked list - removed TDSCURSOR->client_cursor_id - use TDSCURSOR* cursor instead of TDS_INT client_cursor_it in tds_cursor_* functions - added const char* file param to tdsdump_dump_buf and tdsdump_log and added line information in level - changed tds_alloc_compute_results declaration, pass a TDSSOCKET* - removed tds_do_until_done (not used) - removed tds_set_longquery_handler function (not used) - changed some fields in TDSSOCKET - removed out_len (not used) - renamed cursor to cursors - removed client_cursor_id - added cur_cursor (instead of removed client_cursor_id) - dyns now a pointer to a pointer to first dynamic allocated - removed num_dyns (now useless with linked list) - removed chkintr and hndlintr (use longquery_*) - removed longquery_timeout (use query_timeout) - renamed longquery_func to query_timeout_func - renamed longquery_param to query_timeout_param - queryStarttime to query_start_time - add a DSTR instance_name to TDSCONNECTION - add tds7_get_instance_port - removed tds_free_all_dynamic - tdsdump_append now static - new tds_process_tokens to replace removed - tds_process_result_tokens - tds_process_row_tokens - tds_process_row_tokens_ct - tds_process_trailing_tokens - removed tds_ctx_set_parent/tds_ctx_get_parent, use parent member - added void * parent argument to tds_alloc_context - tds_process_tokens return a TDS_CANCELLED if handle cancellation - removed query_timeout_func and query_timeout_param from TDSCONNECTION and TDSLOGIN - add tds_free_row - renamed TDSLOCALE->char_set to server_charset * 0.63 - ODBC: use tds_dstr* functions to store descriptor information - header privatizations (removing tds.h dependency). This is quite important for future binary compatibility. - ODBC: SQLFetch returns error correctly - ODBC: fix problem rebinding parameters - ODBC: ability to fetch data types after prepare (needed for Oracle bindings and OTL library). - Builds cleanly under OS X. - Improved BCP support for NULL fields and native file format. - ct-lib: ct_blk support (bcp for ct-lib). - ct-lib: Cursors! - apps: added bsqldb and defncopy. - iconv: better collation support, e.g. SQL_Scandinavian_CP850_CI_AS * 0.62 - ct-lib: cursor support - fixed PHP problem handling empty recordsets. See messages on ML: Damian Kramer, September 23, "Possible bug in freeTDS" Steve Hanselman, September 16 "Issue with freetds 0.61.2 ..." - ODBC: improved, best error report - ct-lib: support ct_diag (for Python) - ODBC: fixed SQLMoreResults/SQLRowCount and batch behavior - ODBC: fixes call to {?=store(?)} - ODBC: multiple record with "select id,name from sysobjects where name = 'sysobjects'" - ODBC: fixed early binding - ODBC: autodetect iODBC or unixODBC during configure - ODBC: implemented option 109 in SQLGetConnectOption (for OpenOffice) - freebcp understand \n as newline. Also \r and \0 (null byte). - added --without-libiconv configure option to switch off iconv library - ODBC: test and fixes for NUMERIC parameter - ODBC: dynamic query - SQLPutData - Sybase and blobs ported code for string building from ODBC to libtds - extended TDSSOCKET::iconv_info as an array. Keep converters for non-UCS-2 server charsets. Every TDSCOLINFO holding character data should point to one of these elements. - dblib: src/dblib/unittests/t0017.c (bcp) fixed - changed tds_get_char_data(), ML 2 May 2003, "tds_get_char_data and iconv". - rewrote tds_iconv: - use iconv() signature. - rely on TDSCOLINFO::iconv_info for conversion descriptor, instead of inferring it from the column sizes. - on read error, emit Msg 2403, Severity 16 (EX_INFO): "WARNING! Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?')." - on write error emit Msg 2402, Severity 16 (EX_USER): "Error converting client characters into server's character set. Some character(s) could not be converted." and return an error code. Do not proceed. - Cf. ML 16 Apr 2003. "conversion error management". - added doxygen to the nightly build - "make install" put the UG in PREFIX/share/doc/freetds/userguide - "make install" put doxygen html in PREFIX/share/doc/freetds/reference - moved website docs (not UG) to doc/htdoc, put in CVS - added bcp support to tds/dblib/ctlib. (started in dblib) - RPC stuff - added support for TDS 8.0 - TDS 7 Unicode to native charset conversion using iconv - autoconf the connection pooling stuff - DBLIB: output params - set database during login process - libtds: dynamic query - ctlib: null returns zero-length string (see "SELECT '' and TDS 7.0" in message list on 26 Jan 2003) * Jan 2003 - Version 0.61 - Dynamic SQL - Output parameters - Compute rows - Varbinary support - dsn-less ODBC connections - RPC support (db-lib) - Compatibility with DBD::Sybase 0.95 - 68 new functions! (see doc/api_status.txt) - Error/message handling rewritten, uses real error numbers - new sample programs - much cleaner code, warning-free compiles - namespace cleanup - public domain versions of functions for OSs that lack them - autoconf portability improvements - builds in HP-UX, Win32, and cygwin - No dependency on OpenSSL * Sep 2002 - Version 0.60 - Support for SQL Server 2000 datatypes and domain logins. - Support and convertibility of all major datatypes. - Much expanded coverage of the ODBC API. - An all-new BCP implementation, including host variable support. - Character set conversions, via the iconv library. - Threadsafe operation. * [late 2001?] - tdspool now working for big endian systems - Fixed mem leak in ctlib - Added some descriptive text to the PWD file - EINTR handling during login (Kostya Ivanov) - Added support for TLI style interfaces files (thanks Michael for explaining) - Added 'text size' config option which changes textsize on connect - Added preliminary TDS 8.0 support (no new datatypes supported though) - Added 'emulate little endian' config flag - Some TDS5 placeholder stuff. Not ready for primetime yet. - Fixed interfaces handling seg fault * Jul 2001 Brian Bruns - Version 0.52 - Mem leak fixes in dbloginfree() and tds_free_env() (John Dumas) - Added support for new configuration format (freetds.conf) - unixODBC now working - Fixed error in two's complement function for money types - Added support for nullable bits (BITN) - checked in work on tds connection pooling server - added preliminary userguide (James Lowden and me) - a lot of work on ODBC driver, now works with PHP - added config options for iodbc/unixodbc (unixODBC doesn't actually work yet) - image -> char now works (verified with ctlib only) - varbinary -> char now works with destlen of -1 - New config routines - Free socket on login fail - 64bit patches - off by one error - numeric problem with 7.0 fixed - digit cutoff on numerics/floats fixed * Nov 2000 Brian Bruns - Version 0.51 - removed all the old unittests from the samples directory - endian detection fixed - 'make check' and ctlib unittests (Mark) - TDS 7.0 fixes, numerics et al. (Scott) - dead connection handling (Geoff) - query timeout stuff (Jeff) * Dec 1999 Brian Bruns - Version 0.50 - Added TDS 7.0 support for MS SQL 7 - Added hostfile bulk copy for dblib - Added writetext support for dblib - Added CS_CON_STATUS property to ctlib - Fixed bugs for ctlib version of PHP 3/4 - Many changes to text/image handling - New script for running the unittests - dbcancel/ct_cancel now working properly - inserts/updates now return proper rowcount - Numerous bug fixes * Sep 1999 Brian Bruns - Version 0.47 - Added workaround for SQL 7.0 bug handling datetime/money for big endian (testing/bug report - Paul Schaap) - Added TDS 7.0 login function (untested) - Fixed many big endian bugs - Fixed some bus errors on Sparc - Fixed big endian detection - DBD::Sybase 0.19 now passes all tests - Fixed date bug working with PHP 3.x - binary/varbinary support added - Fixed Text datatypes in tds layer - More conversions implemented (Mark Schaal) - Fix make install for not overwriting interfaces (Michael Peppler) - CS_USERDATA now works - Numerous bug fixes (many people) * Thu Aug xx 1999 Brian Bruns - Version 0.46 - Fixed floating type support - Fixed lots of little datatype conversion bugs - Fixed 5.0 login acknowledgement bug - Message processing was cleaned up (Mark Schaal) - Fixed login bug for SQL Server 7.0 - DBD::Sybase 0.19 now compiles and partially works (very partially) - Fixed Solaris #define clash - Numerous bug fixes * Thu Jun 03 1999 Brian Bruns - Version 0.45 - Capabilities added to ctlib code - Numeric support working - MONEY to string conversions now support > 32 bit values - Fixed underread in message handling - Fixed various buffer overflow problems - Fixed NULL handling - Added support for length binding (copied arguement to ct_bind) - Converted ODBC to use iODBC driver manager - SQSH 1.7 runs - PHP 3.0.x with ctlib now runs * Thu Jan 14 1999 Brian Bruns - Version 0.41 - Better row buffering (Craig Spannring) - CT-Lib code improved greatly - Closer behaviour to real dblib - Commonized datatype conversions - Server side code is running somewhat. - SQSH 1.6 running - More ODBC functionality - Many bug fixes - Lots of other stuff I've already forgotten * Sun Nov 22 1998 Brian Bruns - Version 0.40 - Row buffering is now supported for dblib. - Better row handling (side effect of above) - Improved conversion code - Preliminary ODBC layer - PHP now runs basic scripts, maybe more - Many many bug fixes - General cleanup (better error handling, C++ friendly headers, etc...) * Fri Sep 04 1998 Mihai Ibanescu - Version 0.31 - By default the install dir is /usr/local/freetds - The Makefile in the samples dir is automatically built from Makefile.am. The samples dir is not installed, only packaged in the distribution. * Wed Sep 02 1998 Brian Bruns - Version 0.3 - Updated the AUTHORS file - FIXME Brian (added by misa) * Mon Aug 31 1998 Mihai Ibanescu - Version 0.21 - GNUified - Fixed a couple of the TODO issues: byte order is automatically determined, and the TDS version is a configurable option - Modified the README file to reflect the new directory structure Pre-GNUification log by Brian : 2/8/98 Should be able to send the first packet to a server soon, my output is only slightly different than open clients. This codes pretty crappy right now. I need to clean up alot of stuff, remove hardcode values, etc...but I'm anxious to see something work! 2/7/98 Broke the code up a bit, tds.c now handles all wire level stuff, dblib.c handles dblib specific stuff. So, in the future there can be ctlib.c and obdc.c can also sit on top of tds.c to handle the other CLIs 3/16/98 Been working on the code here and there...We can now send a query to the server, dbnumcols() and dbcolname() both work. Almost ready to get some data back. I put in a dummy dbbind to just handle strings so, I could do some work on dbnextrow(). However, we will have revisit almost everything later. 3/23/98 Haven't been able to work on it lately. Still trying to decide on the best way to propagate the row data from tds.c to dblib.c to the calling func. Not that hard, but nothing strikes me as the "Right Way" (tm). 4/2/98 Ok we are ready to release 0.01 (marked by the fact that a simple dblib program actually works!) 5/1/98 Haven't updated in quite a while. A few more dblib commands are supported. dbconvert() support is preliminary. Fixed alot of bugs. A little bit of cleanup. dbbind() sorta works now, needs work still. At least one mem leak that I know of (haven't gotten around to fixing it. Wish I had more time to work on it... 5/2/98 Decided to release what I have. executing sp_who seems to mostly work.. a step in the right direction. Version 0.02. Seem to have generated a little interest after mentioning it in a usenet post. 5/6/98 Can compile against sqsh!!! Did a reorg on tds.c, all dblib func that read data now go through tds_process_messages() which read the marker and calls other routines as necessary. sqsh's output is a little screwy (well I don't have a real dbprrow() yet, but the number of result sets coming back is too many). So, anyway Version 0.04 5/9/98 Decided to upload some new code, mostly just stubs. Sybperl compiles I can't get my perl to work with it. (I need to download perl and link statically, the one that comes on the system won't do). Anyway, most of dblib is present in stub form. 5/17/98 Managed to scrape up some time and release new code. Duplicate result sets went away, and handling of more datatypes (money, bit, more int stuff). Also, improved dbprhead()/row() function. 5/26/98 Ok, I'm doing the long overdue cleaning up of the code. All the kludges should be gone. Thanks, to everyone who contributed code/idea/corrections. 6/3/98 The majority of the overhaul is done...still some work to do, but this is much better than before. I'm bumping the version to 0.1 signifying that I actually use sqsh compiled against it on a regular basis. 6/5/98 TDS 4.2 support seems to be working properly 6/26/98 Gregg Jenson has added support for err and msg handling among other things. I've added some prelimary ctlib support (nothing working yet) 7/3/98 I think we are about ready to release 0.2. Gregg sent some datetime code which appears to work great. I added TDS 4.6 support (small changes really) and tested all the byte order issues on an RS/6000. Also, ctlib code will run the unittest.c and will compile all modules in sqsh 1.6, however there are many missing functions before it will link! 7/10/98 Haven't been able to work on it lately (moved this week). Anyway, trying to add some functions to server. 7/13/98 Tom Poindexter made some changes to get sybtcl to work. 8/8/98 Haven't had much time lately (again), however some small stuff has been fixed and the protocol version stuff has (mostly) been moved to a runtime option. sybperl is supposedly running for simple stuff. freetds-1.3.6/README.md000644 025423 025423 00000006112 14073251137 016065 0ustar00fredianofrediano000000 000000 README for FreeTDS 1.3 ==== *Release date 13th July 2021* **To build FreeTDS read the file [INSTALL](./INSTALL.md) or the [FreeTDS Users Guide](http://www.freetds.org/userguide/)** FreeTDS is a free implementation of Sybase's DB-Library, CT-Library, and ODBC libraries. FreeTDS builds and runs on every flavor of unix-like systems we've heard of (and some we haven't) as well as Win32 (with or without Cygwin), VMS, and Mac OS X. Failure to build on your system is probably considered a bug. It has C language bindings, and works also with Perl and PHP, among others. FreeTDS is licensed under the GNU LGPL license. See [COPYING_LIB.txt](./COPYING_LIB.txt) for details. Other files you might want to peruse: * [AUTHORS](./AUTHORS.md) Who's involved * [BUGS](./BUGS.md) Some things we fixed, or think we did * [NEWS](./NEWS.md) Summary of feature changes and fixes * [TODO](./TODO.md) The roadmap, such as it is Also, [api_status](./doc/api_status.txt) shows which functions are implemented. For details on what's new in this version, see NEWS. For unbearable detail, see git log. Documentation ============= A User Guide, in XML and HTML form, is included in this distribution. Also included is a reference manual, generated in HTML with Doxygen. "make install" installs the HTML documentation, by default to /usr/local/share/doc/freetds-. Note to Users ============= Submissions of test programs (self-contained programs that demonstrate functionality or problems) are greatly appreciated. They should create any tables needed (since we obviously don't have access to your database) and populate them. Unit tests for any of the libraries is appreciated Notes to Developers =================== The code is split into several pieces. 1. `tds` directory is the wire level stuff, it should be independent of the library using it, this will allow db-lib, ct-lib, and ODBC to sit on top. 2. `db-lib` directory. This is the actual db-lib code which runs on top of tds. 3. `ct-lib` directory. This is the ct-lib code which runs on top of tds. 4. `server` directory. This will be a set of server routines basically to impersonate a dataserver, functions like send_login_ack() etc... 5. `odbc` directory. ODBC implementation over tds. Uses iODBC or unixODBC as a driver manager. You need to have one of those if you are using the ODBC CLI. 6. `unittests` directories. Test harness code for ct-lib, db-lib, ODBC and libtds. 7. `samples` directories. Sample code for getting started with Perl, PHP, etc... 8. `pool` directory. A connection pooling server for TDS. Useful if you have a connection limited license. Needs some hacking to get configured but is quite stable once configured correctly. Contact the list if interested in how to use it. Please look at doc/getting_started.txt for a description of what is going on in the code. Side note: Brian, as many free software authors, appreciates postcards from all over. So if you live someplace neat (read: not Michigan) and want to send one, email him (brian@bruns.org) for his current snail mail address. freetds-1.3.6/TODO.md000644 025423 025423 00000013327 14056414221 015677 0ustar00fredianofrediano000000 000000 To Do List ========== This list is ordered top-to-bottom by priority. Things that are broken and need mending are at the top, followed by things that should work before the next release, followed by features that should be added/fixed/reworked (grouped by library). Everyone is encouraged to add to the list. Developers can do it directly; anyone else can post a patch to SourceForge. In this way we can communicate with each other about the project's priorities and needs. Must be fixed: ==== * ctlib parameters, handle all case even in tds7 * handle and test prepared query (? and @ syntax should be supported) * cancellation * ctlib seems to hang reading row while in IDLE state (tds_peek if not in pending state hang... update) Applied but could not test fix from ML 21 May 2008: "Problem with FreeTDS validating SQL commands (actually a ct_cancel() error)" I don't know if this is still true. Upper libraries should not use tds_peek as it does handle cancellation. Work in progress: ==== * be able to disable iconv for BCP (see Sybase documentation) I have a patch to disable it, how to handle NVARCHAR? -- freddy77 * BCP under ODBC. There is an experimental patch trying to implement it. For future versions (in priority order within library): All ---- * Cache protocol discovery (TDSVER=0.0). Save port/instance into some permanent storage. tsql should report progress in verbose mode. * retain values used from freetds.conf, so we can report them. * add a way for tsql to report host, port, and TDS version for the connection it's attempting. Actually libTDS does the name resolution in tds_connect and then just connect so there is no way for tsql to report these information. * move error message macro/prototype to tds.h.in; use in dblib.c. * conversion from ucs2 to utf8, provide for 2+ bytes/character * change numeric format to improve performance ?? * little/big endian based on platform * already packet at word * correctly aligned to read directly packetized * limit copy of data (now wire -> tds -> temp -> client) use a method like zero-copy In token.c getting row should write data even to client (callback, new user types, see ctlib conversion functions) In query.c writing data do the same (use additional column fields?) Situation is much improved in 0.95 version. In ODBC is much better as wire -> tds are never performed and convert extension to give client buffer is used if possible so to avoid the temp step. * review the way parameters are packed (too complicate, see ctlib bulk, cf "bulk copy and row buffer") * improve cursor support on dblib and ctlib * read on partial packet, do not wait entire one * detect if realloc accepts NULL pointers (in configure.ac) * support for password longer than 30 characters under Sybase (anybody know how ??) * under Sybase using prepared statements and BLOBs we shouldn't try to prepare every time (cache failure preparing, see odbc unittests logs, binary_test) done in ODBC ?? * Native bcp has no iconv support; character bcp files are assumed be encoded with the client's charset. More flexibility one both sides would be good. * date/time on Sybase (from 12.5) * encrypted connection for Sybase db-lib ---- * add DBTEXTLIMIT (dbsetopt), PHP require it to support textlimit ini value ct-lib ---- * dynamic placeholders (DBD::Sybase) * ct_option() calls (CS_OPT_ROWCOUNT, CS_OPT_TEXTSIZE, among others) * async function, async calls (dbpoll() and friends) * support all type of bind in ct_bind (CS_VARBINARY_TYPE and other) search "site:.sybase.com CS_VARBINARY ct_bind" on google for more info * complete sqlstate and other field in message (for Python) odbc ---- * SQLDescribeParam (Sybase seems to require it) A 100% success for DBD::ODBC require this. Require parsing of the string to extract placeholders ("?") type, something like "INSERT INTO test_table(field_a) VALUES(?)" -> "SELECT field_a FROM test_table(NOLOCK) WHERE 0=1" * Star Office complains that these TypeInfo constants are not implemented in SQLGetInfo: 47 SQL_USER_NAME (handle environment callbacks) do a "SELECT USER_NAME()". If data pending MS do another connection with same login. * SQLNativeSql and fill SQLGetInfo according (mssql7+ handle odbc escapes directly) * it seems that if statement it's wrong and we issue SQLPrepare on SQLExecute it try to send unprepared dynamic... state on dynamic?? * odbc array binding test large field (like image) have language queries some limits? do we have to split large multiple queries? * report error just before returning SQL_ERROR from inner function? * handle async flags ?? * handle no termination on odbc_set_string* Test and fix ---- * hidden fields (FOR BROWSE select, see flag test on tds) * what happen if we bind to an hidden field?? * if we use SQLGetData?? * if we request informations with SQLDescribeCol/SQLColAttribute(s)/ SQLGetDescField?? * as you noted returning # columns hidden fields are not counted (there is however a setting which is a mssql extension which threat hidden columns as normal) (cfr "SQLNumResultCols() is wrong (+1)" Jan 8 2008) * test: descriptors work * what happen to SQL_DESC_DATETIME_INTERVAL_CODE and SQL_DESC_CONCISE_TYPE changing only SQL_DESC_TYPE (with SQLSetDescField) * test: set SQL_C_DEFAULT and call SQLFetch (numeric, others) * test: SQLGetStmtAttr(SQL_ATTR_ROW_NUMBER) * all binded parameters * no bind and sqlgetdata * before first fetch * after last fetch pool ---- * get connection pooling working with all protocol versions * Make pool configuration a non-recompile process server ---- * Server API needs more work. It's in a quite ugly state. It's more experimental. Should be disabled by default to state it. freetds-1.3.6/COPYING_LIB.txt000644 025423 025423 00000061447 14056414221 017155 0ustar00fredianofrediano000000 000000 GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 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. Copyright (C) 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! freetds-1.3.6/COPYING.txt000644 025423 025423 00000043254 14056414221 016463 0ustar00fredianofrediano000000 000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, 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 software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, 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 redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's 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 give any other recipients of the Program a copy of this License along with the Program. 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 Program or any portion of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, 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 Program, 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 Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) 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; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, 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 executable. 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. If distribution of executable or 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 counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program 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. 5. 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 Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program 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. 7. 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 Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program 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 Program. 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. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program 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. 9. The Free Software Foundation may publish revised and/or new versions of the 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 Program 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 Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, 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 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. 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. Copyright (C) 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. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. freetds-1.3.6/include/000755 025423 025423 00000000000 14162303401 016220 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/000755 025423 025423 00000000000 14162303406 015371 5ustar00fredianofrediano000000 000000 freetds-1.3.6/test-driver000755 025423 025423 00000011042 14162303277 017004 0ustar00fredianofrediano000000 000000 #! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2018 Free Software Foundation, Inc. # # 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, 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. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: freetds-1.3.6/doc/000755 025423 025423 00000000000 14162303421 015344 5ustar00fredianofrediano000000 000000 freetds-1.3.6/samples/000755 025423 025423 00000000000 14162303422 016244 5ustar00fredianofrediano000000 000000 freetds-1.3.6/win32/000755 025423 025423 00000000000 14162303422 015542 5ustar00fredianofrediano000000 000000 freetds-1.3.6/vms/000755 025423 025423 00000000000 14162303422 015405 5ustar00fredianofrediano000000 000000 freetds-1.3.6/misc/000755 025423 025423 00000000000 14162303422 015533 5ustar00fredianofrediano000000 000000 freetds-1.3.6/misc/Makefile.am000644 025423 025423 00000000034 14056414221 017566 0ustar00fredianofrediano000000 000000 EXTRA_DIST = cmake_checks.c freetds-1.3.6/misc/Makefile.in000644 025423 025423 00000034050 14162303356 017610 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = misc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = cmake_checks.c all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign misc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign misc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/misc/cmake_checks.c000644 025423 025423 00000001446 14056414221 020306 0ustar00fredianofrediano000000 000000 #define _GNU_SOURCE #include #include int main(int argc, char **argv) { #if defined(CHECK_ASPRINTF) char *p = NULL; int len = asprintf(&p, "%d", 123); #elif defined(CHECK_VASPRINTF) va_list va; char *p = NULL; int len = vasprintf(&p, "%d", va); #elif defined(CHECK_SNPRINTF) char buf[128]; int len = snprintf(buf, 128, "%d", 123); #elif defined(CHECK__SNPRINTF) char buf[128]; int len = _snprintf(buf, 128, "%d", 123); #elif defined(CHECK_VSNPRINTF) va_list va; char buf[128]; int len = vsnprintf(buf, 128, "%d", va); #elif defined(CHECK__VSNPRINTF) va_list va; char buf[128]; int len = _vsnprintf(buf, 128, "%d", va); #elif defined(CHECK__VSCPRINTF) va_list va; int len = _vscprintf("%d", va); #else #error "Check function not specified correctly" #endif return 0; } freetds-1.3.6/vms/Makefile.am000644 025423 025423 00000000511 14056414222 017441 0ustar00fredianofrediano000000 000000 EXTRA_DIST = config_h.vms configure.com edit.c descrip_mms.template \ getpass.c libodbc.opt odbc_driver_axp.opt README.vms \ vargdefs.h vmsarg_command_bcp.cld vmsarg_command_defncopy.cld \ vmsarg_command_isql.cld vmsarg_mapping_bcp.c \ vmsarg_mapping_defncopy.c vmsarg_mapping_isql.c \ vmsarg_parse.c stdint.h clean: freetds-1.3.6/vms/Makefile.in000644 025423 025423 00000034502 14162303357 017465 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = vms ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = config_h.vms configure.com edit.c descrip_mms.template \ getpass.c libodbc.opt odbc_driver_axp.opt README.vms \ vargdefs.h vmsarg_command_bcp.cld vmsarg_command_defncopy.cld \ vmsarg_command_isql.cld vmsarg_mapping_bcp.c \ vmsarg_mapping_defncopy.c vmsarg_mapping_isql.c \ vmsarg_parse.c stdint.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign vms/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign vms/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile clean: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/vms/config_h.vms000644 025423 025423 00000024740 14056414355 017731 0ustar00fredianofrediano000000 000000 /* include/config.h.in. Generated from configure.ac by autoheader. */ /* and edited by hand for VMS */ #ifndef CONFIG_H_LOADED #define CONFIG_H_LOADED 1 #define _freetds_config_h_ /* Define to 1 if you need BSD_COMP defined to get FIONBIO defined. */ #undef BSD_COMP /* Define to enable work in progress code */ #undef ENABLE_DEVELOPING /* Define to enable extra checks on code */ #undef ENABLE_EXTRA_CHECKS /* Define to 1 if you have the header file. */ #define HAVE_ARPA_INET_H 1 /* Define to 1 if you have the `alarm' function. */ #define HAVE_ALARM 1 /* Define to 1 if you have the `asprintf' function. */ #define HAVE_ASPRINTF @D_ASPRINTF@ /* Define to 1 if you have the `basename' function. */ #ifndef __CRTL_VER #define __CRTL_VER __VMS_VER #endif #if __CRTL_VER >= 70000000 #define HAVE_BASENAME 1 #else #define HAVE_BASENAME 0 #endif /* Define if you have the clock_gettime function. */ #if __CRTL_VER >= 70302000 #define HAVE_CLOCK_GETTIME 1 #endif /* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 /* Define to 1 if your system provides the 5-parameter version of gethostbyaddr_r(). */ #undef HAVE_FUNC_GETHOSTBYADDR_R_5 /* Define to 1 if your system provides the 6-parameter version of gethostbyaddr_r(). */ #undef HAVE_FUNC_GETHOSTBYADDR_R_7 /* Define to 1 if your system provides the 8-parameter version of gethostbyaddr_r(). */ #undef HAVE_FUNC_GETHOSTBYADDR_R_8 /* Define to 1 if your system provides the 3-parameter version of gethostbyname_r(). */ #undef HAVE_FUNC_GETHOSTBYNAME_R_3 /* Define to 1 if your system provides the 5-parameter version of gethostbyname_r(). */ #undef HAVE_FUNC_GETHOSTBYNAME_R_5 /* Define to 1 if your system provides the 6-parameter version of gethostbyname_r(). */ #undef HAVE_FUNC_GETHOSTBYNAME_R_6 /* Define to 1 if your system provides the 4-parameter version of getpwuid_r(). */ #undef HAVE_FUNC_GETPWUID_R_4 /* Define to 1 if your system getpwuid_r() have 4 parameters and return struct passwd*. */ #undef HAVE_FUNC_GETPWUID_R_4_PW /* Define to 1 if your system provides the 5-parameter version of getpwuid_r(). */ #undef HAVE_FUNC_GETPWUID_R_5 /* Define to 1 if your system provides the 4-parameter version of getservbyname_r(). */ #undef HAVE_FUNC_GETSERVBYNAME_R_4 /* Define to 1 if your system provides the 5-parameter version of getservbyname_r(). */ #undef HAVE_FUNC_GETSERVBYNAME_R_5 /* Define to 1 if your system provides the 6-parameter version of getservbyname_r(). */ #undef HAVE_FUNC_GETSERVBYNAME_R_6 /* Define to 1 if you have the `gethostent_r' function. */ #undef HAVE_GETHOSTENT_R /* Define if you have getaddrinfo function */ #define HAVE_GETADDRINFO 1 /* Define to 1 if you have the `gethostname' function. */ #define HAVE_GETHOSTNAME 1 /* Define to 1 if you have the `getpwuid' function. */ #define HAVE_GETPWUID 1 /* Define to 1 if you have the `getpwuid_r' function. */ #undef HAVE_GETPWUID_R /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 /* Define to 1 if you have the `getopt' function. */ #define HAVE_GETOPT 1 /* Define to 1 if you have the `getuid' function. */ #define HAVE_GETUID 1 /* Define if you have the iconv() function. */ #define HAVE_ICONV @D_HAVE_ICONV@ /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LANGINFO_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LIBGEN_H 1 /* Define to 1 if you have the header file. */ #define HAVE_LOCALE_H 1 /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if your system provides the malloc_options variable. */ #undef HAVE_MALLOC_OPTIONS /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETDB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_NETINET_IN_H 1 /* Define to 1 if you have the `nl_langinfo' function. */ #define HAVE_NL_LANGINFO 1 /* Define if you have the OpenSSL. */ #if @D_OPENSSL@ #define HAVE_OPENSSL #define HAVE_BIO_GET_DATA 1 #endif /* Define to 1 if you have the `RSA_get0_key' function. */ #if @D_RSA_GET0_KEY@ #define HAVE_RSA_GET0_KEY 1 #endif /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H #if __CRTL_VER >= 70302000 && !defined(__VAX) /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 /* Define to 1 if you have the header file. */ #define HAVE_POLL_H 1 #endif /* Define if you have POSIX threads libraries and header files. */ #define HAVE_PTHREAD 1 /* Define to 1 if you have the `pthread_cond_timedwait' function. */ #define HAVE_PTHREAD_COND_TIMEDWAIT 1 /* Define to 1 if you have the GNU Readline library. */ #define HAVE_READLINE 1 /* Define to 1 if you have the `setenv' function. */ #define HAVE_SETENV 1 /* Define to 1 if you have the `sethostent_r' function. */ #undef HAVE_SETHOSTENT_R /* Define to 1 if you have the `socketpair' function. */ /* Must be undefined, not defined to 0, when not present. */ #if @D_SOCKETPAIR@ #define HAVE_SOCKETPAIR 1 #endif /* Define to 1 if you have the header file. */ #if @D_STDINT@ #define HAVE_STDINT_H #endif /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRINGS_H 1 /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strtok_r' function. */ #define HAVE_STRTOK_R @D_STRTOK_R@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #define HAVE_SYS_SOCKET_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define to 1 if you have the `vasprintf' function. */ #define HAVE_VASPRINTF @D_VASPRINTF@ /* Define to 1 if you have the `snprintf' function. */ #define HAVE_SNPRINTF @D_SNPRINTF@ /* Define to 1 if you have the `vsnprintf' function. */ #define HAVE_VSNPRINTF 0 /* Define as const if the declaration of iconv() needs const. */ #if HAVE_ICONV # define ICONV_CONST #else # define ICONV_CONST const #endif /* Define to value of INADDR_NONE if not provided by your system header files. */ /*#undef INADDR_NONE*/ /* Define to 1 if the BSD-style netdb interface is reentrant. */ #undef NETDB_REENTRANT /* Name of package */ #define PACKAGE "freetds" /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of a `char', as computed by sizeof. */ #undef SIZEOF_CHAR /* The size of a `double', as computed by sizeof. */ #undef SIZEOF_DOUBLE /* The size of a `float', as computed by sizeof. */ #undef SIZEOF_FLOAT /* The size of a `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of a `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of a `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* The size of a `__int64', as computed by sizeof. */ #undef SIZEOF___INT64 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* define to constant to use for clock_gettime */ #if __CRTL_VER >= 70302000 #define TDS_GETTIMEMILLI_CONST CLOCK_REALTIME #endif /* Define if you have pthread with mutex support */ #define TDS_HAVE_PTHREAD_MUTEX 1 /* Define if stdio support locking */ #if __CRTL_VER >= 80200000 #define TDS_HAVE_STDIO_LOCKED 1 #endif /* define to prefix format string used for 64bit integers */ #define TDS_I64_PREFIX "ll" /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Version number of package */ #define VERSION @VERSION@ /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Additions below not originally from config.h.in */ /* This really just needs to be the current working directory for the tests */ #define FREETDS_SRCDIR "." /* But some tests insist on redefining that in terms of this */ #define FREETDS_TOPDIR "../../.." #include #define MAXPATHLEN PATH_MAX #define _PATH_DEVNULL "_NLA0:" /* FIXME: There are numerous signed/unsigned mismatches in the code * that should really be corrected, but this hushes the compiler for now. */ #pragma message disable PTRMISMATCH1 #include /* we need size_t for replacements */ #pragma extern_prefix save /* We cook up our own version of this, so prototype it here. */ #pragma extern_prefix "freetds_" (getpass) char *getpass( const char* prompt ); #pragma extern_prefix "freetds_" (readpassphrase) char * readpassphrase(const char *, char *, size_t, int); #ifdef HAVE_READPASSPHRASE /* has to be undefined to pick up constants in readpassphrase.h */ # undef HAVE_READPASSPHRASE #endif #pragma extern_prefix restore #define tds_sysdep_intptr_type int /* 32-bit int */ #include /* If the CRTL ever complies with UNIX98 and defines socklen_t in * sys/socket.h, this _may_ prevent a conflicting definition but * still get us what we need in the meantime. */ #if !defined __SOCKLEN_T # define __SOCKLEN_T 1 typedef __size_t socklen_t; #endif /* We only support unixODBC, so we do have these */ #define HAVE_SQLGETPRIVATEPROFILESTRING 1 #define HAVE_SQLLEN 1 #define HAVE_SQLSETPOSIROW 1 #define TDS_SQLCOLATTRIBUTE_SQLLEN 1 /* Prototype for routine to convert VMS-style arguments to Unix-style. */ int parse_vms_args(int *argc, char **argv[]); /* alloca is a built-in */ #include #define alloca(__x) __ALLOCA(__x) #endif /* CONFIG_H_LOADED */ freetds-1.3.6/vms/configure.com000644 025423 025423 00000030557 14056414222 020103 0ustar00fredianofrediano000000 000000 $! FreeTDS - Library of routines accessing Sybase and Microsoft databases $! Copyright (C) 2003 Craig A. Berry craigberry@mac.com 1-FEB-2003 $! $! 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., 59 Temple Place - Suite 330, $! Boston, MA 02111-1307, USA. $! $! CONFIGURE.COM -- run from top level source directory as @[.vms]configure $! $! Checks for C library functions and applies its findings to $! description file template and config.h. Much of this cribbed $! from Perl's configure.com, largely the work of Peter Prymmer. $! $ SAY := "write sys$output" $! $ SEARCH/KEY=(POS:2,SIZE:8) SYS$DISK:[]Configure. "VERSION="/EXACT/OUTPUT=version.tmp $ open/read version version.tmp $ read version versionline $ close version $ delete/noconfirm/nolog version.tmp;* $ versionstring = f$element(1, "=", f$edit(versionline, "COLLAPSE")) $ gosub check_crtl $! $! The system-supplied iconv() is fine, but unless the internationalization $! kit has been installed, we may not have the conversions we need. Check $! for their presence and use the homegrown iconv() if necessary. $! $ IF - "FALSE" - ! native iconv() buggy, don't use for now .AND. F$SEARCH("SYS$I18N_ICONV:UCS-2_ISO8859-1.ICONV") .NES. "" - .AND. F$SEARCH("SYS$I18N_ICONV:ISO8859-1_UCS-2.ICONV") .NES. "" - .AND. F$SEARCH("SYS$I18N_ICONV:UTF-8_ISO8859-1.ICONV") .NES. "" - .AND. F$SEARCH("SYS$I18N_ICONV:ISO8859-1_UTF-8.ICONV") .NES. "" $ THEN $ d_have_iconv = "1" $ SAY "Using system-supplied iconv()" $ ELSE $ d_have_iconv = "0" $ SAY "Using replacement iconv()" $ ENDIF $! $! Set socketpair (available with VMS 8.2 and later) $! $ IF F$EXTRACT(1,3,F$EDIT(F$GETSYI("VERSION"),"TRIM")) .GES. "8.2" $ THEN $ d_socketpair = "1" $ SAY "Using system-supplied socketpair()" $ ELSE $ d_socketpair = "0" $ SAY "Using replacement socketpair()" $ ENDIF $! $! $! Enable OpenSSL if we have it. Don't bother looking for 0.9.x versions $! $ d_rsa_get0_key = "0" $ IF F$SEARCH("SSL111$INCLUDE:SSL.H") .NES. "" $ THEN $ d_openssl = "1" $ d_rsa_get0_key = "1" $ SAY "Found OpenSSL 1.1.x and creating linker options file..." $ OPEN/WRITE sslopt openssl.opt $ WRITE sslopt "SYS$SHARE:SSL111$LIBSSL_SHR32.EXE/SHARE" $ WRITE sslopt "SYS$SHARE:SSL111$LIBCRYPTO_SHR32.EXE/SHARE" $ CLOSE sslopt $ ELSE $ IF F$SEARCH("SSL1$INCLUDE:SSL.H") .NES. "" $ THEN $ d_openssl = "1" $ SAY "Found OpenSSL 1.0.x and creating linker options file..." $ OPEN/WRITE sslopt openssl.opt $ WRITE sslopt "SYS$SHARE:SSL1$LIBSSL_SHR32.EXE/SHARE" $ WRITE sslopt "SYS$SHARE:SSL1$LIBCRYPTO_SHR32.EXE/SHARE" $ CLOSE sslopt $ ELSE $ d_openssl = "0" $ SAY "Did not find OpenSSL" $ ENDIF $ ENDIF $! $! Generate config.h $! $ open/write vmsconfigtmp vmsconfigtmp.com $ write vmsconfigtmp "$ define/user_mode/nolog SYS$OUTPUT _NLA0:" $ write vmsconfigtmp "$ edit/tpu/nodisplay/noinitialization -" $ write vmsconfigtmp "/section=sys$library:eve$section.tpu$section -" $ write vmsconfigtmp "/command=sys$input/output=[.include]config.h [.vms]config_h.vms" $ write vmsconfigtmp "input_file := GET_INFO (COMMAND_LINE, ""file_name"");" $ write vmsconfigtmp "main_buffer:= CREATE_BUFFER (""main"", input_file);" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_ASPRINTF@"",""''d_asprintf'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_VASPRINTF@"",""''d_vasprintf'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_STRTOK_R@"",""''d_strtok_r'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@VERSION@"",""""""''versionstring'"""""");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_HAVE_ICONV@"",""''d_have_iconv'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_SNPRINTF@"",""''d_snprintf'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_SOCKETPAIR@"",""''d_socketpair'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_OPENSSL@"",""''d_openssl'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_STDINT@"",""''d_stdint'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_RSA_GET0_KEY@"",""''d_rsa_get0_key'"");" $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");" $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);" $ write vmsconfigtmp "quit;" $ write vmsconfigtmp "$ exit" $ close vmsconfigtmp $ @vmsconfigtmp.com $ delete/noconfirm/nolog vmsconfigtmp.com; $! $! Generate descrip.mms from template $! $ if d_asprintf .eqs. "1" $ then $ asprintfobj = " " $ else $ asprintfobj = "[.src.replacements]asprintf$(OBJ)," $ endif $! $ if d_vasprintf .eqs. "1" $ then $ vasprintfobj = " " $ else $ vasprintfobj = "[.src.replacements]vasprintf$(OBJ)," $ endif $! $ if d_strtok_r .eqs. "1" $ then $ strtok_robj = " " $ else $ strtok_robj = "[.src.replacements]strtok_r$(OBJ)," $ endif $! $ if d_have_iconv .eqs. "1" $ then $ libiconvobj = " " $ else $ libiconvobj = "[.src.replacements]libiconv$(OBJ)," $ copy/noconfirm/nolog [.src.replacements]iconv.c [.src.replacements]libiconv.c $ endif $! $ if d_snprintf .eqs. "1" $ then $ snprintfobj = " " $ else $ snprintfobj = "[.src.replacements]snprintf$(OBJ)," $ endif $! $ if d_socketpair .eqs. "1" $ then $ socketpairobj = " " $ else $ socketpairobj = "[.src.replacements]socketpair$(OBJ)," $ endif $! $ if P1 .eqs. "--disable-thread-safe" $ then $ enable_thread_safe = " " $ else $ enable_thread_safe = "ENABLE_THREAD_SAFE = 1" $ endif $! $ open/write vmsconfigtmp vmsconfigtmp.com $ write vmsconfigtmp "$ define/user_mode/nolog SYS$OUTPUT _NLA0:" $ write vmsconfigtmp "$ edit/tpu/nodisplay/noinitialization -" $ write vmsconfigtmp "/section=sys$library:eve$section.tpu$section -" $ write vmsconfigtmp "/command=sys$input/output=[]descrip.mms [.vms]descrip_mms.template" $ write vmsconfigtmp "input_file := GET_INFO (COMMAND_LINE, ""file_name"");" $ write vmsconfigtmp "main_buffer:= CREATE_BUFFER (""main"", input_file);" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@ASPRINTFOBJ@"",""''asprintfobj'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@VASPRINTFOBJ@"",""''vasprintfobj'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@STRTOK_ROBJ@"",""''strtok_robj'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@LIBICONVOBJ@"",""''libiconvobj'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@SNPRINTFOBJ@"",""''snprintfobj'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@SOCKETPAIROBJ@"",""''socketpairobj'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@ENABLE_THREAD_SAFE@"",""''enable_thread_safe'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_OPENSSL@"",""''d_openssl'"");" $ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsconfigtmp "eve_global_replace(""@D_STDINT@"",""''d_stdint'"");" $ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");" $ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);" $ write vmsconfigtmp "quit;" $ write vmsconfigtmp "$ exit" $ close vmsconfigtmp $ @vmsconfigtmp.com $ delete/noconfirm/nolog vmsconfigtmp.com; $! $! C99 requires t, z, and j modifiers to decimal format specifiers $! but the HP compiler doesn't handle them, so replace the one $! use of %td with %ld. $! $ open/write vmsbsqldbtmp vmsbsqldbtmp.com $ write vmsbsqldbtmp "$ define/user_mode/nolog SYS$OUTPUT _NLA0:" $ write vmsbsqldbtmp "$ edit/tpu/nodisplay/noinitialization -" $ write vmsbsqldbtmp "/section=sys$library:eve$section.tpu$section -" $ write vmsbsqldbtmp "/command=sys$input/output=[.src.apps]bsqldb.c [.src.apps]bsqldb.c" $ write vmsbsqldbtmp "input_file := GET_INFO (COMMAND_LINE, ""file_name"");" $ write vmsbsqldbtmp "main_buffer:= CREATE_BUFFER (""main"", input_file);" $ write vmsbsqldbtmp "POSITION (BEGINNING_OF (main_buffer));" $ write vmsbsqldbtmp "eve_global_replace("" %td "","" %ld "");" $ write vmsbsqldbtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");" $ write vmsbsqldbtmp "WRITE_FILE (main_buffer, out_file);" $ write vmsbsqldbtmp "quit;" $ write vmsbsqldbtmp "$ exit" $ close vmsbsqldbtmp $ @vmsbsqldbtmp.com $ delete/noconfirm/nolog vmsbsqldbtmp.com; $! $ Say "" $ Say "Configuration complete; run MMK or MMS to build." $ EXIT $! $ CHECK_CRTL: $! $ OS := "open/write CONFIG []try.c" $ WS := "write CONFIG" $ CS := "close CONFIG" $ DS := "delete/nolog/noconfirm []try.*;*" $ good_compile = %X10B90001 $ good_link = %X10000001 $ tmp = "" ! null string default $! $! Check for asprintf $! $ OS $ WS "#include " $ WS "#include " $ WS "int main()" $ WS "{" $ WS "char *ptr; $ WS "asprintf(&ptr,""%d"",1);" $ WS "exit(0);" $ WS "}" $ CS $ tmp = "asprintf" $ GOSUB inlibc $ d_asprintf == tmp $! $! $! Check for vasprintf $! $ OS $ WS "#include " $ WS "#include " $ WS "#include " $ WS "int main()" $ WS "{" $ WS "char *ptr; $ WS "vasprintf(&ptr,""%d,%d"",1,2);" $ WS "exit(0);" $ WS "}" $ CS $ tmp = "vasprintf" $ GOSUB inlibc $ d_vasprintf == tmp $! $! $! $! Check for strtok_r $! $ OS $ WS "#include " $ WS "#include " $ WS "int main()" $ WS "{" $ WS "char *word, *brkt, mystr[4];" $ WS "strcpy(mystr,""1^2"");" $ WS "word = strtok_r(mystr, ""^"", &brkt);" $ WS "exit(0);" $ WS "}" $ CS $ tmp = "strtok_r" $ GOSUB inlibc $ d_strtok_r == tmp $! $! $! Check for snprintf $! $ OS $ WS "#include " $ WS "#include " $ WS "#include " $ WS "int main()" $ WS "{" $ WS "char ptr[15];" $ WS "snprintf((char*)&ptr,sizeof(ptr),""%d,%d"",1,2);" $ WS "exit(0);" $ WS "}" $ CS $ tmp = "snprintf" $ GOSUB inlibc $ d_snprintf == tmp $! $! $! Check for stdint.h $! $ OS $ WS "#include " $ WS "#include " $ WS "int main()" $ WS "{" $ WS "exit(0);" $ WS "}" $ CS $ tmp = "stdint" $ GOSUB inlibc $ d_stdint == tmp $! $ DS $ RETURN $!******************** $inlibc: $ GOSUB link_ok $ IF compile_status .EQ. good_compile .AND. link_status .EQ. good_link $ THEN $ say "''tmp'() found." $ tmp = "1" $ ELSE $ say "''tmp'() NOT found." $ tmp = "0" $ ENDIF $ RETURN $! $!: define a shorthand compile call $compile: $ GOSUB link_ok $just_mcr_it: $ IF compile_status .EQ. good_compile .AND. link_status .EQ. good_link $ THEN $ OPEN/WRITE CONFIG []try.out $ DEFINE/USER_MODE SYS$ERROR CONFIG $ DEFINE/USER_MODE SYS$OUTPUT CONFIG $ MCR []try.exe $ CLOSE CONFIG $ OPEN/READ CONFIG []try.out $ READ CONFIG tmp $ CLOSE CONFIG $ DELETE/NOLOG/NOCONFIRM []try.out; $ DELETE/NOLOG/NOCONFIRM []try.exe; $ ELSE $ tmp = "" ! null string default $ ENDIF $ RETURN $! $link_ok: $ GOSUB compile_ok $ DEFINE/USER_MODE SYS$ERROR _NLA0: $ DEFINE/USER_MODE SYS$OUTPUT _NLA0: $ SET NOON $ LINK try.obj $ link_status = $status $ SET ON $ IF F$SEARCH("try.obj") .NES. "" THEN DELETE/NOLOG/NOCONFIRM try.obj; $ RETURN $! $!: define a shorthand compile call for compilations that should be ok. $compile_ok: $ DEFINE/USER_MODE SYS$ERROR _NLA0: $ DEFINE/USER_MODE SYS$OUTPUT _NLA0: $ SET NOON $ CC try.c $ compile_status = $status $ SET ON $ DELETE/NOLOG/NOCONFIRM try.c; $ RETURN $! $beyond_compile_ok: $! freetds-1.3.6/vms/edit.c000644 025423 025423 00000003444 14056414222 016506 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* $Id: edit.c,v */ #include #include #include #include #include #include #if defined(NAML$C_MAXRSS) && !defined(__VAX) # define VMS_MAXRSS (NAML$C_MAXRSS+1) #else # define VMS_MAXRSS (NAM$C_MAXRSS+1) #endif char vms_fnm[VMS_MAXRSS]; static int get_vms_name(char *, int); int edit(const char *editor, const char *arg) { $DESCRIPTOR(fnm_dsc, ""); int status; decc$to_vms(arg, get_vms_name, 0, 0); fnm_dsc.dsc$a_pointer = vms_fnm; fnm_dsc.dsc$w_length = strlen(vms_fnm); if (fnm_dsc.dsc$a_pointer == NULL || fnm_dsc.dsc$w_length == 0) return -1; status = TPU$EDIT(&fnm_dsc, &fnm_dsc); if ($VMS_STATUS_SUCCESS(status)) return 0; else return -1; } static int get_vms_name(char *name, int type) { strncpy(vms_fnm, name, VMS_MAXRSS); return 1; } int reset_term() { return 0; } freetds-1.3.6/vms/descrip_mms.template000644 025423 025423 00000274371 14056414271 021474 0ustar00fredianofrediano000000 000000 # FreeTDS - Library of routines accessing Sybase and Microsoft databases # Copyright (C) 2003 Craig A. Berry craigberry@mac.com 23-JAN-2003 # # 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # OpenVMS description file for FreeTDS # To override default TDS version of "auto" specify /MACRO="TDSVER=TDSxx=1" # where xx is one of 50, 71, 72, 73, or 74. # To build with ODBC support do MM(K|S)/MACRO="ODBC"=1 # This presupposes the existence of an ODBC library in the location pointed to # by the logical name ODBC_LIBDIR and ODBC include files in the location pointed # to by ODBC_INCDIR # To build in debug, do MM(K|S)/MACRO="__DEBUG__"=1 # To build with MSDBLIB-compatbile dblib structures, do MM(K|S)/MACRO="MSDBLIB"=1 OBJ = .OBJ E = .EXE OLB = .OLB .IFDEF ODBC ODBC_INC=,[.src.odbc],ODBC_INCDIR TDSODBCSHR=[]libtdsodbc$(E) TDSODBCCHECK=TDSODBCCHECK ODBCTESTS=ODBCTESTS .ELSE ODBC_INC= TDSODBCSHR= TDSODBCCHECK= ODBCTESTS= .ENDIF .IFDEF SYBASE_COMPAT DBOPENOBJ = [.src.dblib]dbopen$(OBJ), .ELSE DBOPENOBJ = .ENDIF .IFDEF MSDBLIB DBLIB_DEFINE = define MSDBLIB 1 .ELSE DBLIB_DEFINE = define SYBDBLIB 1 .ENDIF CC = CC/DECC .SUFFIXES : .SUFFIXES : $(E) $(OLB) $(OBJ) .C .H @ENABLE_THREAD_SAFE@ .IFDEF ENABLE_THREAD_SAFE PTHREAD_CDEFINE = "_THREAD_SAFE"=1 PTHREAD_LINK_FLAGS = /THREADS=UPCALLS .ELSE PTHREAD_CDEFINE = PTHREAD_LINK_FLAGS = .ENDIF .IF @D_OPENSSL@ .EQ 1 OPENSSL_OPTIONS = ,openssl.opt/OPTIONS .ELSE OPENSSL_OPTIONS = .ENDIF .IF @D_STDINT@ .EQ 1 STDINT_H = [.vms]discard.tmp .ELSE STDINT_H = [.include]stdint.h .ENDIF CDEFINE = .IFDEF TDSVER CDEFINE = $(TDSVER) .ENDIF .IFDEF ODBC ODBC_CDEFINE = "UNIXODBC" CODBCFLAGS = /NAMES=(AS_IS,SHORTENED) .ELSE ODBC_CDEFINE = CODBCFLAGS = /NAMES=SHORTENED .ENDIF .IFDEF ODBC_CDEFINE .IFDEF CDEFINE CDEFINE = $(CDEFINE),$(ODBC_CDEFINE) .ELSE CDEFINE = $(ODBC_CDEFINE) .ENDIF .ENDIF .IFDEF PTHREAD_CDEFINE .IFDEF CDEFINE CDEFINE = $(CDEFINE),$(PTHREAD_CDEFINE) .ELSE CDEFINE = $(PTHREAD_CDEFINE) .ENDIF .ENDIF .IFDEF CDEFINE CDEFINE_QUAL = /DEFINE=($(CDEFINE)) .ELSE CDEFINE_QUAL = .ENDIF CPREFIX = ALL CINCLUDE = "./","./include"$(ODBC_INC) .IFDEF __DEBUG__ CDBGFLAGS = /DEBUG/NOOPTIMIZE/LIST=$(MMS$TARGET_NAME)/SHOW=(EXPANSION,INCLUDE) LDBGFLAGS = /DEBUG/MAP .ELSE CDBGFLAGS = LDBGFLAGS = /NOTRACE .ENDIF CFLAGS = $(CDEFINE_QUAL)/PREFIX=($(CPREFIX))/FLOAT=IEEE/IEEE=DENORM/OBJECT=$(MMS$TARGET_NAME)$(OBJ) $(CODBCFLAGS) $(CDBGFLAGS) LINKFLAGS = $(LDBGFLAGS)$(PTHREAD_LINK_FLAGS) .c$(OBJ) : $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE)) $(MMS$SOURCE) $(OBJ)$(OLB) : @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" - THEN LIBRARY/CREATE/LOG $(MMS$TARGET) @ LIBRARY /REPLACE /LOG $(MMS$TARGET) $(MMS$SOURCE) ASPRINTFOBJ = @ASPRINTFOBJ@ VASPRINTFOBJ = @VASPRINTFOBJ@ STRTOK_ROBJ = @STRTOK_ROBJ@ LIBICONVOBJ = @LIBICONVOBJ@ SNPRINTFOBJ = @SNPRINTFOBJ@ SOCKETPAIROBJ = @SOCKETPAIROBJ@ TDSOBJS = [.src.tds]bulk$(OBJ), [.src.tds]challenge$(OBJ), [.src.tds]config$(OBJ), \ [.src.tds]convert$(OBJ), [.src.tds]data$(OBJ), [.src.tds]getmac$(OBJ), \ [.src.tds]gssapi$(OBJ), [.src.tds]iconv$(OBJ), [.src.tds]locale$(OBJ), \ [.src.tds]login$(OBJ), [.src.tds]mem$(OBJ), [.src.tds]numeric$(OBJ), \ [.src.tds]query$(OBJ), [.src.tds]read$(OBJ), [.src.utils]tdsstring$(OBJ), \ [.src.tds]token$(OBJ), [.src.tds]util$(OBJ), \ [.src.tds]vstrbuild$(OBJ), [.src.tds]write$(OBJ), \ [.src.tds]net$(OBJ), [.src.tds]tls$(OBJ), [.src.tds]log$(OBJ), [.src.tds]packet$(OBJ), \ [.src.tds]stream$(OBJ), [.src.tds]random$(OBJ), [.src.tds]sec_negotiate$(OBJ), \ [.src.replacements]strlcpy$(OBJ), \ [.src.replacements]strlcat$(OBJ), \ [.src.utils]des$(OBJ), [.src.utils]md4$(OBJ), [.src.utils]md5$(OBJ), \ [.src.utils]sleep$(OBJ), \ [.src.utils]hmac_md5$(OBJ), \ [.src.utils]getpassarg$(OBJ), \ [.src.utils]threadsafe$(OBJ), \ [.src.utils]net$(OBJ), \ [.src.utils]bjoern-utf8$(OBJ), \ $(ASPRINTFOBJ) $(VASPRINTFOBJ) $(SNPRINTFOBJ) $(STRTOK_ROBJ) $(LIBICONVOBJ) $(SOCKETPAIROBJ) \ [.vms]getpass$(OBJ) CTLIBOBJS = [.src.ctlib]blk$(OBJ), [.src.ctlib]cs$(OBJ), [.src.ctlib]ct$(OBJ), \ [.src.ctlib]ctutil$(OBJ) DBLIBOBJS = [.src.dblib]bcp$(OBJ), [.src.dblib]dblib$(OBJ), [.src.dblib]dbpivot$(OBJ), $(DBOPENOBJ) \ [.src.dblib]dbutil$(OBJ), [.src.dblib]rpc$(OBJ), [.src.dblib]xact$(OBJ) TDSSRVOBJS = [.src.server]query$(OBJ), [.src.server]server$(OBJ), [.src.server]login$(OBJ) TDSPOOLOBJS = [.src.pool]config$(OBJ), [.src.pool]main$(OBJ), [.src.pool]member$(OBJ), \ [.src.pool]user$(OBJ), [.src.pool]util$(OBJ) TDSODBCOBJS = [.src.odbc]connectparams$(OBJ), \ [.src.odbc]convert_tds2sql$(OBJ), [.src.odbc]descriptor$(OBJ), [.src.odbc]error$(OBJ), \ [.src.odbc]native$(OBJ), [.src.odbc]odbc$(OBJ), [.src.odbc]odbc_checks$(OBJ), \ [.src.odbc]odbc_util$(OBJ) [.src.odbc]prepare_query$(OBJ), [.src.odbc]sql2tds$(OBJ) # This is the top-level target all : []libtds$(OLB) []libct$(OLB) []libsybdb$(OLB) []libtdssrv$(OLB) $(TDSODBCSHR) buildchecks apps @ write sys$output " " @ QUALIFIERS := $(MMSQUALIFIERS) @ QUALIFIERS = QUALIFIERS - """" - """" @ write sys$output " " @ write sys$output " Everything is up to date. '$(MMS)''QUALIFIERS' check' to run test suite." # Configuration dependencies CONFIGS = [.include]config.h [.include.freetds]sysconfdir.h [.include]tds_sysdep_public.h \ [.include]readline.h [.include]history.h $(TDSOBJS) : $(CONFIGS) $(CTLIBOBJS) : $(CONFIGS) $(DBLIBOBJS) : $(CONFIGS) $(TDSSRVOBJS) : $(CONFIGS) [.src.pool]config$(OBJ) : [.src.pool]config.c $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE) [.src.pool]main$(OBJ) : [.src.pool]main.c $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE) [.src.pool]member$(OBJ) : [.src.pool]member.c $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE) [.src.pool]stream$(OBJ) : [.src.pool]stream.c $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE) [.src.pool]user$(OBJ) : [.src.pool]user.c $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE) [.src.pool]util$(OBJ) : [.src.pool]util.c $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE),[.src.pool]) $(MMS$SOURCE) $(TDSPOOLOBJS) : $(CONFIGS) $(TDSODBCOBJS) : $(CONFIGS) [.include]config.h : [.vms]config_h.vms @ write sys$output "Run @[.vms]configure to generate config.h" @ exit [.include.freetds]sysconfdir.h : @ open/write sysconfh [.include.freetds]sysconfdir.h @ write sysconfh "#define FREETDS_SYSCONFDIR ""/FREETDS_ROOT""" @ close sysconfh $(STDINT_H) : @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" THEN COPY [.vms]stdint.h $(MMS$TARGET) [.include]tds_sysdep_public.h_in : @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" THEN COPY [.include]tds_sysdep_public^.h.in $(MMS$TARGET) [.include]tds_sysdep_public.h : [.include]tds_sysdep_public.h_in $(STDINT_H) @ open/write vmsconfigtmp vmsconfigtmp.com @ write vmsconfigtmp "$ define/user_mode/nolog SYS$OUTPUT _NLA0:" @ write vmsconfigtmp "$ edit/tpu/nodisplay/noinitialization -" @ write vmsconfigtmp "/section=sys$library:eve$section.tpu$section -" @ write vmsconfigtmp "/command=sys$input/output=$(MMS$TARGET) $(MMS$SOURCE)" @ write vmsconfigtmp "input_file := GET_INFO (COMMAND_LINE, ""file_name"");" @ write vmsconfigtmp "main_buffer:= CREATE_BUFFER (""main"", input_file);" @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" @ write vmsconfigtmp "eve_global_replace(""@tds_sysdep_int16_type@"",""short"");" @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" @ write vmsconfigtmp "eve_global_replace(""@tds_sysdep_int32_type@"",""int"");" @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" @ write vmsconfigtmp "eve_global_replace(""@tds_sysdep_int64_type@"",""__int64"");" @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" @ write vmsconfigtmp "eve_global_replace(""@tds_sysdep_real32_type@"",""float"");" @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" @ write vmsconfigtmp "eve_global_replace(""@tds_sysdep_real64_type@"",""double"");" @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" @ write vmsconfigtmp "eve_global_replace(""@tds_sysdep_intptr_type@"",""int"");" @ write vmsconfigtmp "POSITION (BEGINNING_OF (main_buffer));" @ write vmsconfigtmp "eve_global_replace(""@dblib_define@"",""#$(DBLIB_DEFINE)"");" @ write vmsconfigtmp "out_file := GET_INFO (COMMAND_LINE, ""output_file"");" @ write vmsconfigtmp "WRITE_FILE (main_buffer, out_file);" @ write vmsconfigtmp "quit;" @ write vmsconfigtmp "$ exit" @ close vmsconfigtmp @ @vmsconfigtmp.com @ delete/noconfirm/nolog vmsconfigtmp.com; [.include]readline.h : @ open/write readlineh $(MMS$TARGET) @ write readlineh "char *readline(char *prompt);" @ write readlineh "int rl_inhibit_completion;" @ write readlineh "/* The following are needed for fisql. */" @ write readlineh "FILE **rl_outstream_get_addr(void);" @ write readlineh "#define rl_outstream (*rl_outstream_get_addr())" @ write readlineh "FILE **rl_instream_get_addr(void);" @ write readlineh "#define rl_instream (*rl_instream_get_addr())" @ write readlineh "static const char *rl_readline_name = NULL;" @ write readlineh "#define rl_bind_key(c,f) do {} while(0)" @ write readlineh "#define rl_reset_line_state() do {} while(0)" @ write readlineh "#define rl_on_new_line() do {} while(0)" @ close readlineh [.include]history.h : @ open/write historyh $(MMS$TARGET) @ write historyh "void add_history(const char *s);" @ close historyh # Work around MMS bug that confuses these with files in different # directories having the same names. [.src.tds]util$(OBJ) : [.src.tds]util.c [.src.tds]log$(OBJ) : [.src.tds]log.c [.src.tds]config$(OBJ) : [.src.tds]config.c [.src.tds]convert$(OBJ) : [.src.tds]convert.c [.src.tds]data$(OBJ) : [.src.tds]data.c [.src.dblib]bcp$(OBJ) : [.src.dblib]bcp.c [.src.dblib]rpc$(OBJ) : [.src.dblib]rpc.c [.src.odbc]error$(OBJ) : [.src.odbc]error.c [.src.tds]login$(OBJ) : [.src.tds]login.c [.src.server]login$(OBJ) : [.src.server]login.c [.src.tds]query$(OBJ) : [.src.tds]query.c [.src.server]query$(OBJ) : [.src.server]query.c # Build the libraries []libtds$(OLB) : libtds$(OLB)( $(TDSOBJS) ) LIBRARY /COMPRESS $(MMS$TARGET) /OUTPUT=$(MMS$TARGET) []libct$(OLB) : libct$(OLB)( $(CTLIBOBJS) ) LIBRARY /COMPRESS $(MMS$TARGET) /OUTPUT=$(MMS$TARGET) []libsybdb$(OLB) : libsybdb$(OLB)( $(DBLIBOBJS) ) LIBRARY /COMPRESS $(MMS$TARGET) /OUTPUT=$(MMS$TARGET) []libtdssrv$(OLB) : libtdssrv$(OLB)( $(TDSSRVOBJS) ) LIBRARY /COMPRESS $(MMS$TARGET) /OUTPUT=$(MMS$TARGET) []libtdsodbc$(OLB) : libtdsodbc$(OLB)( $(TDSODBCOBJS), $(TDSOBJS) ) LIBRARY /COMPRESS $(MMS$TARGET) /OUTPUT=$(MMS$TARGET) $(TDSODBCSHR) : []libtdsodbc$(OLB) link$(LINKFLAGS) $(MMS$SOURCE)/include=odbc/library,[.vms]odbc_driver_axp.opt/options/share=$(MMS$TARGET) # Build the utility programs and the pool server apps : freebcp$(E) tsql$(E) bsqldb$(E) defncopy$(E) tdspool$(E) fisql$(E) @ continue []vmsarg_parse$(OBJ) : [.vms]vmsarg_parse.c $(CC) $(CFLAGS)/INCLUDE=([.vms],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) freebcp$(E) : [.src.apps]freebcp$(OBJ) []vmsarg_mapping_bcp$(OBJ) []vmsarg_command_bcp$(OBJ) []vmsarg_parse$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library, []libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.apps]freebcp$(OBJ) : [.src.apps]freebcp.c []libsybdb$(OLB) []libtds$(OLB) []vmsarg_mapping_bcp$(OBJ) : [.vms]vmsarg_mapping_bcp.c $(CC) $(CFLAGS)/INCLUDE=([.vms],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) []vmsarg_command_bcp$(OBJ) : [.vms]vmsarg_command_bcp.cld SET COMMAND/OBJECT=$(MMS$TARGET) $(MMS$SOURCE) tsql$(E) : [.src.apps]tsql$(OBJ) []libsybdb$(OLB) []libtds$(OLB) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE),[]libsybdb$(OLB)/library, []libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.apps]tsql$(OBJ) : [.src.apps]tsql.c @ define/nolog/user_mode readline [.include] $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE)) $(MMS$SOURCE) bsqldb$(E) : [.src.apps]bsqldb$(OBJ) []libsybdb$(OLB) []libtds$(OLB) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE),[]libsybdb$(OLB)/library, []libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.apps]bsqldb$(OBJ) : [.src.apps]bsqldb.c defncopy$(E) : [.src.apps]defncopy$(OBJ) []vmsarg_mapping_defncopy$(OBJ) []vmsarg_command_defncopy$(OBJ) []vmsarg_parse$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library, []libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.apps]defncopy$(OBJ) : [.src.apps]defncopy.c []libsybdb$(OLB) []libtds$(OLB) []vmsarg_mapping_defncopy$(OBJ) : [.vms]vmsarg_mapping_defncopy.c $(CC) $(CFLAGS)/INCLUDE=([.vms],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) []vmsarg_command_defncopy$(OBJ) : [.vms]vmsarg_command_defncopy.cld SET COMMAND/OBJECT=$(MMS$TARGET) $(MMS$SOURCE) tdspool$(E) : $(TDSPOOLOBJS) []libtdssrv$(OLB) []libtds$(OLB) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(TDSPOOLOBJS), []libtdssrv$(OLB)/library, []libtds$(OLB)/library $(OPENSSL_OPTIONS) fisql$(E) : [.src.apps.fisql]fisql$(OBJ) [.src.apps.fisql]interrupt$(OBJ) [.src.apps.fisql]handlers$(OBJ) [.vms]edit$(OBJ) \ []vmsarg_mapping_isql$(OBJ) []vmsarg_command_isql$(OBJ) []vmsarg_parse$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library, []libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.apps.fisql]fisql$(OBJ) : [.src.apps.fisql]fisql.c []libsybdb$(OLB) []libtds$(OLB) @ define/nolog/user_mode readline [.include] $(CC) $(CFLAGS)/INCLUDE=($(CINCLUDE)) $(MMS$SOURCE) [.src.apps.fisql]interrupt$(OBJ) : [.src.apps.fisql]interrupt.c [.src.apps.fisql]handlers$(OBJ) : [.src.apps.fisql]handlers.c []vmsarg_mapping_isql$(OBJ) : [.vms]vmsarg_mapping_isql.c $(CC) $(CFLAGS)/INCLUDE=([.vms],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) []vmsarg_command_isql$(OBJ) : [.vms]vmsarg_command_isql.cld SET COMMAND/OBJECT=$(MMS$TARGET) $(MMS$SOURCE) # Run the test suite check : buildchecks PWD libtdscheck ctlibcheck dblibcheck $(tdsodbccheck) @ write sys$output "" @ write sys$output "Test run complete. PWD : PWD.in copy $(MMS$SOURCE) $(MMS$TARGET). libtdscheck : @ set default [.src.tds.unittests] @ define/nolog FREETDSCONF [---]freetds.conf @ run/nodebug []t0001$(E) @ run/nodebug []t0002$(E) @ run/nodebug []t0003$(E) @ run/nodebug []t0004$(E) @ run/nodebug []t0005$(E) @ run/nodebug []t0006$(E) @ run/nodebug []t0007$(E) @ run/nodebug []t0008$(E) @ run/nodebug []dynamic1$(E) @ run/nodebug []convert$(E) @ run/nodebug []dataread$(E) @ run/nodebug []utf8_1$(E) @ run/nodebug []utf8_2$(E) @ run/nodebug []utf8_3$(E) @ run/nodebug []numeric$(E) @ run/nodebug []iconv_fread$(E) @ run/nodebug []toodynamic$(E) @ run/nodebug []readconf$(E) @ run/nodebug []charconv$(E) @ run/nodebug []nulls$(E) @ run/nodebug []corrupt$(E) @ run/nodebug []declarations$(E) @ run/nodebug []portconf$(E) @ run/nodebug []freeze$(E) @ run/nodebug []strftime$(E) @ run/nodebug []log_elision$(E) @ set default [---] ctlibcheck : @ set default [.src.ctlib.unittests] @ define/nolog FREETDSCONF [---]freetds.conf @ run/nodebug []t0001$(E) @ run/nodebug []t0002$(E) @ run/nodebug []t0003$(E) @ run/nodebug []t0004$(E) @ run/nodebug []t0005$(E) @ run/nodebug []cs_convert$(E) @ run/nodebug []t0007$(E) @ run/nodebug []t0008$(E) @ run/nodebug []t0009$(E) @ run/nodebug []connect_fail$(E) @ run/nodebug []ct_options$(E) @ run/nodebug []lang_ct_param$(E) @ run/nodebug []array_bind$(E) @ run/nodebug []cs_diag$(E) @ run/nodebug []get_send_data$(E) @ run/nodebug []rpc_ct_param$(E) @ run/nodebug []rpc_ct_setparam$(E) @ run/nodebug []ct_diagclient$(E) @ run/nodebug []ct_diagserver$(E) @ run/nodebug []ct_diagall$(E) @ run/nodebug []cs_config$(E) @ run/nodebug []cancel$(E) @ run/nodebug []blk_in$(E) @ run/nodebug []blk_out$(E) @ run/nodebug []ct_cursor$(E) @ run/nodebug []ct_cursors$(E) @ run/nodebug []ct_dynamic$(E) @ run/nodebug []blk_in2$(E) @ run/nodebug []datafmt$(E) @ run/nodebug []rpc_fail$(E) @ run/nodebug []row_count$(E) @ run/nodebug []all_types$(E) @ run/nodebug []long_binary$(E) @ run/nodebug []will_convert$(E) @ set default [---] dblibcheck : @ set default [.src.dblib.unittests] @ define/nolog FREETDSCONF [---]freetds.conf @ run/nodebug []t0001$(E) @ run/nodebug []t0002$(E) @ run/nodebug []t0003$(E) @ run/nodebug []t0004$(E) @ run/nodebug []t0005$(E) @ run/nodebug []t0006$(E) @ run/nodebug []t0007$(E) @ run/nodebug []t0008$(E) @ run/nodebug []t0009$(E) @ run/nodebug []t0011$(E) @ run/nodebug []t0012$(E) @ run/nodebug []t0013$(E) @ run/nodebug []t0014$(E) @ run/nodebug []t0015$(E) @ run/nodebug []t0016$(E) @ run/nodebug []t0017$(E) @ run/nodebug []t0018$(E) @ run/nodebug []t0019$(E) @ run/nodebug []t0020$(E) @ run/nodebug []dbsafestr$(E) @ run/nodebug []t0022$(E) @ run/nodebug []t0023$(E) @ run/nodebug []rpc$(E) @ run/nodebug []dbmorecmds$(E) @ run/nodebug []bcp$(E) @ run/nodebug []thread$(E) @ run/nodebug []text_buffer$(E) @ run/nodebug []done_handling$(E) @ run/nodebug []timeout$(E) @ run/nodebug []hang$(E) @ run/nodebug []null$(E) @ run/nodebug []null2$(E) @ run/nodebug []setnull$(E) @ run/nodebug []numeric$(E) @ run/nodebug []pending$(E) @ run/nodebug []cancel$(E) @ run/nodebug []spid$(E) @ run/nodebug []canquery$(E) @ run/nodebug []batch_stmt_ins_sel$(E) @ run/nodebug []batch_stmt_ins_upd$(E) @ run/nodebug []bcp_getl$(E) @ run/nodebug []empty_rowsets$(E) @ run/nodebug []string_bind$(E) @ run/nodebug []colinfo$(E) @ run/nodebug []bcp2$(E) @ set default [---] tdsodbccheck : @ set default [.src.odbc.unittests] @ define/nolog FREETDSCONF [---]freetds.conf @ define/nolog ODBCINI SYS$DISK:[]ODBC.INI @ define/nolog ODBCSYSINI SYS$DISK:[] @ create/directory [-._libs] @ copy [---]libtdsodbc$(E) [-._libs] @ run/nodebug []t0001$(E) @ run/nodebug []t0002$(E) @ run/nodebug []t0003$(E) @ run/nodebug []moreresults$(E) @ run/nodebug []connect$(E) @ run/nodebug []print$(E) @ run/nodebug []date$(E) @ run/nodebug []norowset$(E) @ run/nodebug []funccall$(E) @ run/nodebug []lang_error$(E) @ run/nodebug []tables$(E) @ run/nodebug []binary_test$(E) @ run/nodebug []moreandcount$(E) @ run/nodebug []earlybind$(E) @ run/nodebug []putdata$(E) @ run/nodebug []params$(E) @ run/nodebug []raiserror$(E) @ run/nodebug []getdata$(E) @ run/nodebug []transaction$(E) @ run/nodebug []type$(E) @ run/nodebug []genparams$(E) @ run/nodebug []preperror$(E) @ run/nodebug []prepare_results$(E) @ run/nodebug []testodbc$(E) @ run/nodebug []data$(E) @ run/nodebug []error$(E) @ run/nodebug []rebindpar$(E) @ run/nodebug []rpc$(E) @ run/nodebug []convert_error$(E) @ run/nodebug []typeinfo$(E) @ run/nodebug []const_params$(E) @ run/nodebug []insert_speed$(E) @ run/nodebug []compute$(E) @ run/nodebug []timeout$(E) @ run/nodebug []array$(E) @ run/nodebug []array_out$(E) @ run/nodebug []cursor1$(E) @ run/nodebug []scroll$(E) @ run/nodebug []cursor2$(E) @ run/nodebug []describecol$(E) @ run/nodebug []copydesc$(E) @ run/nodebug []prepclose$(E) @ run/nodebug []warning$(E) @ run/nodebug []paramcore$(E) @ run/nodebug []timeout2$(E) @ run/nodebug []timeout3$(E) @ run/nodebug []connect2$(E) @ run/nodebug []timeout4$(E) @ run/nodebug []freeclose$(E) @ run/nodebug []cursor3$(E) @ run/nodebug []cursor4$(E) @ run/nodebug []cursor5$(E) @ run/nodebug []attributes$(E) @ run/nodebug []hidden$(E) @ run/nodebug []blob1$(E) @ run/nodebug []cancel$(E) @ run/nodebug []wchar$(E) @ run/nodebug []rowset$(E) @ run/nodebug []transaction2$(E) @ set default [---] buildchecks : libtdstests ctlibtests dblibtests $(ODBCTESTS) @ continue libtdstests : [.src.tds.unittests]dynamic1$(E) [.src.tds.unittests]iconv_fread$(E) \ [.src.tds.unittests]numeric$(E) [.src.tds.unittests]t0001$(E) [.src.tds.unittests]t0002$(E) \ [.src.tds.unittests]t0003$(E) [.src.tds.unittests]t0004$(E) [.src.tds.unittests]t0005$(E) \ [.src.tds.unittests]t0006$(E) [.src.tds.unittests]t0007$(E) [.src.tds.unittests]t0008$(E) \ [.src.tds.unittests]convert$(E) [.src.tds.unittests]dataread$(E) \ [.src.tds.unittests]utf8_1$(E) [.src.tds.unittests]utf8_2$(E) [.src.tds.unittests]utf8_3$(E) \ [.src.tds.unittests]toodynamic$(E) [.src.tds.unittests]readconf$(E) \ [.src.tds.unittests]charconv$(E) [.src.tds.unittests]nulls$(E) [.src.tds.unittests]corrupt$(E) \ [.src.tds.unittests]declarations$(E) [.src.tds.unittests]portconf$(E) [.src.tds.unittests]freeze$(E) \ [.src.tds.unittests]strftime$(E) [.src.tds.unittests]log_elision$(E) @ continue ctlibtests : [.src.ctlib.unittests]t0001$(E) [.src.ctlib.unittests]t0002$(E) [.src.ctlib.unittests]t0003$(E) \ [.src.ctlib.unittests]t0004$(E) [.src.ctlib.unittests]t0005$(E) [.src.ctlib.unittests]cs_convert$(E) \ [.src.ctlib.unittests]t0007$(E) [.src.ctlib.unittests]t0008$(E) [.src.ctlib.unittests]t0009$(E) \ [.src.ctlib.unittests]connect_fail$(E) [.src.ctlib.unittests]ct_options$(E) \ [.src.ctlib.unittests]lang_ct_param$(E) [.src.ctlib.unittests]array_bind$(E) \ [.src.ctlib.unittests]cs_diag$(E) [.src.ctlib.unittests]get_send_data$(E) \ [.src.ctlib.unittests]rpc_ct_param$(E) [.src.ctlib.unittests]rpc_ct_setparam$(E) \ [.src.ctlib.unittests]ct_diagclient$(E) [.src.ctlib.unittests]ct_diagserver$(E) \ [.src.ctlib.unittests]ct_diagall$(E) [.src.ctlib.unittests]cs_config$(E) \ [.src.ctlib.unittests]cancel$(E) [.src.ctlib.unittests]blk_in$(E) \ [.src.ctlib.unittests]blk_out$(E) [.src.ctlib.unittests]ct_cursor$(E) \ [.src.ctlib.unittests]ct_cursors$(E) [.src.ctlib.unittests]ct_dynamic$(E) \ [.src.ctlib.unittests]blk_in2$(E) [.src.ctlib.unittests]datafmt$(E) \ [.src.ctlib.unittests]rpc_fail$(E) [.src.ctlib.unittests]row_count$(E) \ [.src.ctlib.unittests]all_types$(E) [.src.ctlib.unittests]long_binary$(E) \ [.src.ctlib.unittests]will_convert$(E) @ continue dblibtests : [.src.dblib.unittests]rpc$(E) [.src.dblib.unittests]t0001$(E) [.src.dblib.unittests]t0002$(E) \ [.src.dblib.unittests]t0003$(E) [.src.dblib.unittests]t0004$(E) [.src.dblib.unittests]t0005$(E) \ [.src.dblib.unittests]t0006$(E) [.src.dblib.unittests]t0007$(E) [.src.dblib.unittests]t0008$(E) \ [.src.dblib.unittests]t0009$(E) [.src.dblib.unittests]t0011$(E) \ [.src.dblib.unittests]t0012$(E) [.src.dblib.unittests]t0013$(E) [.src.dblib.unittests]t0014$(E) \ [.src.dblib.unittests]t0015$(E) [.src.dblib.unittests]t0016$(E) [.src.dblib.unittests]t0017$(E) \ [.src.dblib.unittests]t0018$(E) [.src.dblib.unittests]t0019$(E) [.src.dblib.unittests]t0020$(E) \ [.src.dblib.unittests]dbsafestr$(E) [.src.dblib.unittests]t0022$(E) [.src.dblib.unittests]t0023$(E) \ [.src.dblib.unittests]dbmorecmds$(E) [.src.dblib.unittests]bcp$(E) \ [.src.dblib.unittests]thread$(E) [.src.dblib.unittests]text_buffer$(E) \ [.src.dblib.unittests]done_handling$(E) [.src.dblib.unittests]timeout$(E) \ [.src.dblib.unittests]hang$(E) [.src.dblib.unittests]null$(E) \ [.src.dblib.unittests]null2$(E) [.src.dblib.unittests]setnull$(E) \ [.src.dblib.unittests]numeric$(E) [.src.dblib.unittests]pending$(E) \ [.src.dblib.unittests]cancel$(E) [.src.dblib.unittests]spid$(E) [.src.dblib.unittests]canquery$(E) \ [.src.dblib.unittests]batch_stmt_ins_sel$(E) [.src.dblib.unittests]batch_stmt_ins_upd$(E) \ [.src.dblib.unittests]bcp_getl$(E) [.src.dblib.unittests]empty_rowsets$(E) \ [.src.dblib.unittests]string_bind$(E) [.src.dblib.unittests]colinfo$(E) \ [.src.dblib.unittests]bcp2$(E) @ continue odbctests : [.src.odbc.unittests]t0001$(E) [.src.odbc.unittests]t0002$(E) [.src.odbc.unittests]t0003$(E) \ [.src.odbc.unittests]moreresults$(E) [.src.odbc.unittests]connect$(E) [.src.odbc.unittests]print$(E) \ [.src.odbc.unittests]date$(E) [.src.odbc.unittests]norowset$(E) [.src.odbc.unittests]funccall$(E) \ [.src.odbc.unittests]lang_error$(E) [.src.odbc.unittests]tables$(E) \ [.src.odbc.unittests]binary_test$(E) [.src.odbc.unittests]moreandcount$(E) \ [.src.odbc.unittests]earlybind$(E) [.src.odbc.unittests]putdata$(E) [.src.odbc.unittests]params$(E) \ [.src.odbc.unittests]raiserror$(E) [.src.odbc.unittests]getdata$(E) [.src.odbc.unittests]type$(E) \ [.src.odbc.unittests]transaction$(E) [.src.odbc.unittests]genparams$(E) [.src.odbc.unittests]preperror$(E) \ [.src.odbc.unittests]prepare_results$(E) [.src.odbc.unittests]testodbc$(E) \ [.src.odbc.unittests]data$(E) [.src.odbc.unittests]error$(E) [.src.odbc.unittests]rebindpar$(E) \ [.src.odbc.unittests]rpc$(E) [.src.odbc.unittests]convert_error$(E) [.src.odbc.unittests]typeinfo$(E) \ [.src.odbc.unittests]const_params$(E) [.src.odbc.unittests]insert_speed$(E) \ [.src.odbc.unittests]compute$(E) [.src.odbc.unittests]timeout$(E) \ [.src.odbc.unittests]array$(E) [.src.odbc.unittests]array_out$(E) \ [.src.odbc.unittests]cursor1$(E) [.src.odbc.unittests]scroll$(E) [.src.odbc.unittests]cursor2$(E) \ [.src.odbc.unittests]describecol$(E) [.src.odbc.unittests]copydesc$(E) \ [.src.odbc.unittests]prepclose$(E) [.src.odbc.unittests]warning$(E) \ [.src.odbc.unittests]paramcore$(E) [.src.odbc.unittests]timeout2$(E) [.src.odbc.unittests]timeout3$(E) \ [.src.odbc.unittests]connect2$(E) [.src.odbc.unittests]timeout4$(E) [.src.odbc.unittests]freeclose$(E) \ [.src.odbc.unittests]cursor3$(E) [.src.odbc.unittests]cursor4$(E) [.src.odbc.unittests]cursor5$(E) \ [.src.odbc.unittests]attributes$(E) [.src.odbc.unittests]hidden$(E) [.src.odbc.unittests]blob1$(E) \ [.src.odbc.unittests]cancel$(E) [.src.odbc.unittests]wchar$(E) [.src.odbc.unittests]rowset$(E) \ [.src.odbc.unittests]transaction2$(E) @ continue # libtds test detailed dependencies [.src.tds.unittests]dynamic1$(E) : [.src.tds.unittests]dynamic1$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]dynamic1$(OBJ) : [.src.tds.unittests]dynamic1.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]iconv_fread$(E) : [.src.tds.unittests]iconv_fread$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]iconv_fread$(OBJ) : [.src.tds.unittests]iconv_fread.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]numeric$(E) : [.src.tds.unittests]numeric$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]numeric$(OBJ) : [.src.tds.unittests]numeric.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0001$(E) : [.src.tds.unittests]t0001$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0001$(OBJ) : [.src.tds.unittests]t0001.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0002$(E) : [.src.tds.unittests]t0002$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0002$(OBJ) : [.src.tds.unittests]t0002.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0003$(E) : [.src.tds.unittests]t0003$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0003$(OBJ) : [.src.tds.unittests]t0003.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0004$(E) : [.src.tds.unittests]t0004$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0004$(OBJ) : [.src.tds.unittests]t0004.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0005$(E) : [.src.tds.unittests]t0005$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0005$(OBJ) : [.src.tds.unittests]t0005.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0006$(E) : [.src.tds.unittests]t0006$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0006$(OBJ) : [.src.tds.unittests]t0006.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0007$(E) : [.src.tds.unittests]t0007$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0007$(OBJ) : [.src.tds.unittests]t0007.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]t0008$(E) : [.src.tds.unittests]t0008$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]t0008$(OBJ) : [.src.tds.unittests]t0008.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]common$(OBJ) : [.src.tds.unittests]common.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]convert$(E) : [.src.tds.unittests]convert$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]convert$(OBJ) : [.src.tds.unittests]convert.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE),[.src.tds]) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]dataread$(E) : [.src.tds.unittests]dataread$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]dataread$(OBJ) : [.src.tds.unittests]dataread.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]utf8$(OBJ) : [.src.tds.unittests]utf8.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]utf8_1$(E) : [.src.tds.unittests]utf8_1$(OBJ) [.src.tds.unittests]common$(OBJ) [.src.tds.unittests]utf8$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]utf8_1$(OBJ) : [.src.tds.unittests]utf8_1.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]utf8_2$(E) : [.src.tds.unittests]utf8_2$(OBJ) [.src.tds.unittests]common$(OBJ) [.src.tds.unittests]utf8$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]utf8_2$(OBJ) : [.src.tds.unittests]utf8_2.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]utf8_3$(E) : [.src.tds.unittests]utf8_3$(OBJ) [.src.tds.unittests]common$(OBJ) [.src.tds.unittests]utf8$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]utf8_3$(OBJ) : [.src.tds.unittests]utf8_3.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]toodynamic$(E) : [.src.tds.unittests]toodynamic$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]toodynamic$(OBJ) : [.src.tds.unittests]toodynamic.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]readconf$(E) : [.src.tds.unittests]readconf$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]readconf$(OBJ) : [.src.tds.unittests]readconf.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]charconv$(E) : [.src.tds.unittests]charconv$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]charconv$(OBJ) : [.src.tds.unittests]charconv.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]nulls$(E) : [.src.tds.unittests]nulls$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]nulls$(OBJ) : [.src.tds.unittests]nulls.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]corrupt$(E) : [.src.tds.unittests]corrupt$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]corrupt$(OBJ) : [.src.tds.unittests]corrupt.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]allcolumns$(OBJ) : [.src.tds.unittests]allcolumns.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]declarations$(E) : [.src.tds.unittests]declarations$(OBJ) [.src.tds.unittests]common$(OBJ) [.src.tds.unittests]allcolumns$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]declarations$(OBJ) : [.src.tds.unittests]declarations.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]portconf$(E) : [.src.tds.unittests]portconf$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]portconf$(OBJ) : [.src.tds.unittests]portconf.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]freeze$(E) : [.src.tds.unittests]freeze$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]freeze$(OBJ) : [.src.tds.unittests]freeze.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]strftime$(E) : [.src.tds.unittests]strftime$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]strftime$(OBJ) : [.src.tds.unittests]strftime.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE),[.src.tds]) $(CDBGFLAGS) $(MMS$SOURCE) [.src.tds.unittests]log_elision$(E) : [.src.tds.unittests]log_elision$(OBJ) [.src.tds.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.tds.unittests]log_elision$(OBJ) : [.src.tds.unittests]log_elision.c [.src.tds.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.tds.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) # ctlib test detailed dependencies [.src.ctlib.unittests]t0001$(E) : [.src.ctlib.unittests]t0001$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0001$(OBJ) : [.src.ctlib.unittests]t0001.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]t0002$(E) : [.src.ctlib.unittests]t0002$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0002$(OBJ) : [.src.ctlib.unittests]t0002.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]t0003$(E) : [.src.ctlib.unittests]t0003$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0003$(OBJ) : [.src.ctlib.unittests]t0003.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]t0004$(E) : [.src.ctlib.unittests]t0004$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0004$(OBJ) : [.src.ctlib.unittests]t0004.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]t0005$(E) : [.src.ctlib.unittests]t0005$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0005$(OBJ) : [.src.ctlib.unittests]t0005.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]cs_convert$(E) : [.src.ctlib.unittests]cs_convert$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]cs_convert$(OBJ) : [.src.ctlib.unittests]cs_convert.c $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]t0007$(E) : [.src.ctlib.unittests]t0007$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0007$(OBJ) : [.src.ctlib.unittests]t0007.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]t0008$(E) : [.src.ctlib.unittests]t0008$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0008$(OBJ) : [.src.ctlib.unittests]t0008.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]t0009$(E) : [.src.ctlib.unittests]t0009$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]t0009$(OBJ) : [.src.ctlib.unittests]t0009.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]connect_fail$(E) : [.src.ctlib.unittests]connect_fail$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]connect_fail$(OBJ) : [.src.ctlib.unittests]connect_fail.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]ct_options$(E) : [.src.ctlib.unittests]ct_options$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]ct_options$(OBJ) : [.src.ctlib.unittests]ct_options.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]lang_ct_param$(E) : [.src.ctlib.unittests]lang_ct_param$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]lang_ct_param$(OBJ) : [.src.ctlib.unittests]lang_ct_param.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]array_bind$(E) : [.src.ctlib.unittests]array_bind$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]array_bind$(OBJ) : [.src.ctlib.unittests]array_bind.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]cs_diag$(E) : [.src.ctlib.unittests]cs_diag$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]cs_diag$(OBJ) : [.src.ctlib.unittests]cs_diag.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]get_send_data$(E) : [.src.ctlib.unittests]get_send_data$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]get_send_data$(OBJ) : [.src.ctlib.unittests]get_send_data.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]rpc_ct_param$(E) : [.src.ctlib.unittests]rpc_ct_param$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]rpc_ct_param$(OBJ) : [.src.ctlib.unittests]rpc_ct_param.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]rpc_ct_setparam$(E) : [.src.ctlib.unittests]rpc_ct_setparam$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]rpc_ct_setparam$(OBJ) : [.src.ctlib.unittests]rpc_ct_setparam.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]ct_diagclient$(E) : [.src.ctlib.unittests]ct_diagclient$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]ct_diagclient$(OBJ) : [.src.ctlib.unittests]ct_diagclient.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]ct_diagserver$(E) : [.src.ctlib.unittests]ct_diagserver$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]ct_diagserver$(OBJ) : [.src.ctlib.unittests]ct_diagserver.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]ct_diagall$(E) : [.src.ctlib.unittests]ct_diagall$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]ct_diagall$(OBJ) : [.src.ctlib.unittests]ct_diagall.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]cs_config$(E) : [.src.ctlib.unittests]cs_config$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]cs_config$(OBJ) : [.src.ctlib.unittests]cs_config.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]cancel$(E) : [.src.ctlib.unittests]cancel$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]cancel$(OBJ) : [.src.ctlib.unittests]cancel.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]blk_in$(E) : [.src.ctlib.unittests]blk_in$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]blk_in$(OBJ) : [.src.ctlib.unittests]blk_in.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]blk_out$(E) : [.src.ctlib.unittests]blk_out$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]blk_out$(OBJ) : [.src.ctlib.unittests]blk_out.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]ct_cursor$(E) : [.src.ctlib.unittests]ct_cursor$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]ct_cursor$(OBJ) : [.src.ctlib.unittests]ct_cursor.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]ct_cursors$(E) : [.src.ctlib.unittests]ct_cursors$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]ct_cursors$(OBJ) : [.src.ctlib.unittests]ct_cursors.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]ct_dynamic$(E) : [.src.ctlib.unittests]ct_dynamic$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]ct_dynamic$(OBJ) : [.src.ctlib.unittests]ct_dynamic.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]blk_in2$(E) : [.src.ctlib.unittests]blk_in2$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]blk_in2$(OBJ) : [.src.ctlib.unittests]blk_in2.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]datafmt$(E) : [.src.ctlib.unittests]datafmt$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]datafmt$(OBJ) : [.src.ctlib.unittests]datafmt.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]rpc_fail$(E) : [.src.ctlib.unittests]rpc_fail$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]rpc_fail$(OBJ) : [.src.ctlib.unittests]rpc_fail.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]row_count$(E) : [.src.ctlib.unittests]row_count$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]row_count$(OBJ) : [.src.ctlib.unittests]row_count.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]all_types$(E) : [.src.ctlib.unittests]all_types$(OBJ) [.src.ctlib.unittests]common$(OBJ) [.src.tds.unittests]allcolumns$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]all_types$(OBJ) : [.src.ctlib.unittests]all_types.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=("./src/ctlib/unittests/",$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]long_binary$(E) : [.src.ctlib.unittests]long_binary$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]long_binary$(OBJ) : [.src.ctlib.unittests]long_binary.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]will_convert$(E) : [.src.ctlib.unittests]will_convert$(OBJ) [.src.ctlib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libct$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.ctlib.unittests]will_convert$(OBJ) : [.src.ctlib.unittests]will_convert.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.ctlib.unittests]common$(OBJ) : [.src.ctlib.unittests]common.c [.src.ctlib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.ctlib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) # dblib test detailed dependencies [.src.dblib.unittests]t0001$(E) : [.src.dblib.unittests]t0001$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0001$(OBJ) : [.src.dblib.unittests]t0001.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0002$(E) : [.src.dblib.unittests]t0002$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0002$(OBJ) : [.src.dblib.unittests]t0002.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0003$(E) : [.src.dblib.unittests]t0003$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0003$(OBJ) : [.src.dblib.unittests]t0003.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0004$(E) : [.src.dblib.unittests]t0004$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0004$(OBJ) : [.src.dblib.unittests]t0004.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0005$(E) : [.src.dblib.unittests]t0005$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0005$(OBJ) : [.src.dblib.unittests]t0005.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0006$(E) : [.src.dblib.unittests]t0006$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0006$(OBJ) : [.src.dblib.unittests]t0006.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0007$(E) : [.src.dblib.unittests]t0007$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0007$(OBJ) : [.src.dblib.unittests]t0007.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0008$(E) : [.src.dblib.unittests]t0008$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0008$(OBJ) : [.src.dblib.unittests]t0008.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0009$(E) : [.src.dblib.unittests]t0009$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0009$(OBJ) : [.src.dblib.unittests]t0009.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0011$(E) : [.src.dblib.unittests]t0011$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0011$(OBJ) : [.src.dblib.unittests]t0011.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0012$(E) : [.src.dblib.unittests]t0012$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0012$(OBJ) : [.src.dblib.unittests]t0012.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0013$(E) : [.src.dblib.unittests]t0013$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0013$(OBJ) : [.src.dblib.unittests]t0013.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0014$(E) : [.src.dblib.unittests]t0014$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0014$(OBJ) : [.src.dblib.unittests]t0014.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0015$(E) : [.src.dblib.unittests]t0015$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0015$(OBJ) : [.src.dblib.unittests]t0015.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0016$(E) : [.src.dblib.unittests]t0016$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0016$(OBJ) : [.src.dblib.unittests]t0016.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0017$(E) : [.src.dblib.unittests]t0017$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0017$(OBJ) : [.src.dblib.unittests]t0017.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0018$(E) : [.src.dblib.unittests]t0018$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0018$(OBJ) : [.src.dblib.unittests]t0018.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0019$(E) : [.src.dblib.unittests]t0019$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0019$(OBJ) : [.src.dblib.unittests]t0019.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0020$(E) : [.src.dblib.unittests]t0020$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0020$(OBJ) : [.src.dblib.unittests]t0020.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]dbsafestr$(E) : [.src.dblib.unittests]dbsafestr$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]dbsafestr$(OBJ) : [.src.dblib.unittests]dbsafestr.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0022$(E) : [.src.dblib.unittests]t0022$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0022$(OBJ) : [.src.dblib.unittests]t0022.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]t0023$(E) : [.src.dblib.unittests]t0023$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]t0023$(OBJ) : [.src.dblib.unittests]t0023.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]rpc$(E) : [.src.dblib.unittests]rpc$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]rpc$(OBJ) : [.src.dblib.unittests]rpc.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]dbmorecmds$(E) : [.src.dblib.unittests]dbmorecmds$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]dbmorecmds$(OBJ) : [.src.dblib.unittests]dbmorecmds.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]bcp$(E) : [.src.dblib.unittests]bcp$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]bcp$(OBJ) : [.src.dblib.unittests]bcp.c [.src.dblib.unittests]bcp.h [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]thread$(E) : [.src.dblib.unittests]thread$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]thread$(OBJ) : [.src.dblib.unittests]thread.c [.src.dblib.unittests]bcp.h [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]text_buffer$(E) : [.src.dblib.unittests]text_buffer$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]text_buffer$(OBJ) : [.src.dblib.unittests]text_buffer.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]done_handling$(E) : [.src.dblib.unittests]done_handling$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]done_handling$(OBJ) : [.src.dblib.unittests]done_handling.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]timeout$(E) : [.src.dblib.unittests]timeout$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]timeout$(OBJ) : [.src.dblib.unittests]timeout.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]hang$(E) : [.src.dblib.unittests]hang$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]hang$(OBJ) : [.src.dblib.unittests]hang.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]null$(E) : [.src.dblib.unittests]null$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]null$(OBJ) : [.src.dblib.unittests]null.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]null2$(E) : [.src.dblib.unittests]null2$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]null2$(OBJ) : [.src.dblib.unittests]null2.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]setnull$(E) : [.src.dblib.unittests]setnull$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]setnull$(OBJ) : [.src.dblib.unittests]setnull.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]numeric$(E) : [.src.dblib.unittests]numeric$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]numeric$(OBJ) : [.src.dblib.unittests]numeric.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]common$(OBJ) : [.src.dblib.unittests]common.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]pending$(E) : [.src.dblib.unittests]pending$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]pending$(OBJ) : [.src.dblib.unittests]pending.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]cancel$(E) : [.src.dblib.unittests]cancel$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]cancel$(OBJ) : [.src.dblib.unittests]cancel.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]spid$(E) : [.src.dblib.unittests]spid$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]spid$(OBJ) : [.src.dblib.unittests]spid.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]canquery$(E) : [.src.dblib.unittests]canquery$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]canquery$(OBJ) : [.src.dblib.unittests]canquery.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]batch_stmt_ins_sel$(E) : [.src.dblib.unittests]batch_stmt_ins_sel$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]batch_stmt_ins_sel$(OBJ) : [.src.dblib.unittests]batch_stmt_ins_sel.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]batch_stmt_ins_upd$(E) : [.src.dblib.unittests]batch_stmt_ins_upd$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]batch_stmt_ins_upd$(OBJ) : [.src.dblib.unittests]batch_stmt_ins_upd.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]bcp_getl$(E) : [.src.dblib.unittests]bcp_getl$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]bcp_getl$(OBJ) : [.src.dblib.unittests]bcp_getl.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]empty_rowsets$(E) : [.src.dblib.unittests]empty_rowsets$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]empty_rowsets$(OBJ) : [.src.dblib.unittests]empty_rowsets.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]string_bind$(E) : [.src.dblib.unittests]string_bind$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]string_bind$(OBJ) : [.src.dblib.unittests]string_bind.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]colinfo$(E) : [.src.dblib.unittests]colinfo$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]colinfo$(OBJ) : [.src.dblib.unittests]colinfo.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.dblib.unittests]bcp2$(E) : [.src.dblib.unittests]bcp2$(OBJ) [.src.dblib.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[]libsybdb$(OLB)/library,[]libtds$(OLB)/library $(OPENSSL_OPTIONS) [.src.dblib.unittests]bcp2$(OBJ) : [.src.dblib.unittests]bcp2.c [.src.dblib.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.dblib.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) # tdsodbc test detailed dependencies [.src.odbc.unittests]t0001$(E) : [.src.odbc.unittests]t0001$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]t0001$(OBJ) : [.src.odbc.unittests]t0001.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]t0002$(E) : [.src.odbc.unittests]t0002$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]t0002$(OBJ) : [.src.odbc.unittests]t0002.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]t0003$(E) : [.src.odbc.unittests]t0003$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]t0003$(OBJ) : [.src.odbc.unittests]t0003.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]moreresults$(E) : [.src.odbc.unittests]moreresults$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]moreresults$(OBJ) : [.src.odbc.unittests]moreresults.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]connect$(E) : [.src.odbc.unittests]connect$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]connect$(OBJ) : [.src.odbc.unittests]connect.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]print$(E) : [.src.odbc.unittests]print$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]print$(OBJ) : [.src.odbc.unittests]print.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]date$(E) : [.src.odbc.unittests]date$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]date$(OBJ) : [.src.odbc.unittests]date.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]norowset$(E) : [.src.odbc.unittests]norowset$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]norowset$(OBJ) : [.src.odbc.unittests]norowset.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]funccall$(E) : [.src.odbc.unittests]funccall$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]funccall$(OBJ) : [.src.odbc.unittests]funccall.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]lang_error$(E) : [.src.odbc.unittests]lang_error$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]lang_error$(OBJ) : [.src.odbc.unittests]lang_error.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]tables$(E) : [.src.odbc.unittests]tables$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]tables$(OBJ) : [.src.odbc.unittests]tables.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]binary_test$(E) : [.src.odbc.unittests]binary_test$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]binary_test$(OBJ) : [.src.odbc.unittests]binary_test.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]moreandcount$(E) : [.src.odbc.unittests]moreandcount$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]moreandcount$(OBJ) : [.src.odbc.unittests]moreandcount.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]earlybind$(E) : [.src.odbc.unittests]earlybind$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]earlybind$(OBJ) : [.src.odbc.unittests]earlybind.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]putdata$(E) : [.src.odbc.unittests]putdata$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]putdata$(OBJ) : [.src.odbc.unittests]putdata.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]params$(E) : [.src.odbc.unittests]params$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]params$(OBJ) : [.src.odbc.unittests]params.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]raiserror$(E) : [.src.odbc.unittests]raiserror$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]raiserror$(OBJ) : [.src.odbc.unittests]raiserror.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]getdata$(E) : [.src.odbc.unittests]getdata$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]getdata$(OBJ) : [.src.odbc.unittests]getdata.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]type$(E) : [.src.odbc.unittests]type$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]type$(OBJ) : [.src.odbc.unittests]type.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]transaction$(E) : [.src.odbc.unittests]transaction$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]transaction$(OBJ) : [.src.odbc.unittests]transaction.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]common$(OBJ) : [.src.odbc.unittests]common.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]genparams$(E) : [.src.odbc.unittests]genparams$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]genparams$(OBJ) : [.src.odbc.unittests]genparams.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]preperror$(E) : [.src.odbc.unittests]preperror$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]preperror$(OBJ) : [.src.odbc.unittests]preperror.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]prepare_results$(E) : [.src.odbc.unittests]prepare_results$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]prepare_results$(OBJ) : [.src.odbc.unittests]prepare_results.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]testodbc$(E) : [.src.odbc.unittests]testodbc$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]testodbc$(OBJ) : [.src.odbc.unittests]testodbc.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]data$(E) : [.src.odbc.unittests]data$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]data$(OBJ) : [.src.odbc.unittests]data.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]error$(E) : [.src.odbc.unittests]error$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]error$(OBJ) : [.src.odbc.unittests]error.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]rebindpar$(E) : [.src.odbc.unittests]rebindpar$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]rebindpar$(OBJ) : [.src.odbc.unittests]rebindpar.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]rpc$(E) : [.src.odbc.unittests]rpc$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]rpc$(OBJ) : [.src.odbc.unittests]rpc.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]convert_error$(E) : [.src.odbc.unittests]convert_error$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]convert_error$(OBJ) : [.src.odbc.unittests]convert_error.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]typeinfo$(E) : [.src.odbc.unittests]typeinfo$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]typeinfo$(OBJ) : [.src.odbc.unittests]typeinfo.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]const_params$(E) : [.src.odbc.unittests]const_params$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]const_params$(OBJ) : [.src.odbc.unittests]const_params.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]insert_speed$(E) : [.src.odbc.unittests]insert_speed$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]insert_speed$(OBJ) : [.src.odbc.unittests]insert_speed.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]compute$(E) : [.src.odbc.unittests]compute$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]compute$(OBJ) : [.src.odbc.unittests]compute.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]timeout$(E) : [.src.odbc.unittests]timeout$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]timeout$(OBJ) : [.src.odbc.unittests]timeout.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]array$(E) : [.src.odbc.unittests]array$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]array$(OBJ) : [.src.odbc.unittests]array.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]array_out$(E) : [.src.odbc.unittests]array_out$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]array_out$(OBJ) : [.src.odbc.unittests]array_out.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]cursor1$(E) : [.src.odbc.unittests]cursor1$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]cursor1$(OBJ) : [.src.odbc.unittests]cursor1.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]scroll$(E) : [.src.odbc.unittests]scroll$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]scroll$(OBJ) : [.src.odbc.unittests]scroll.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]cursor2$(E) : [.src.odbc.unittests]cursor2$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]cursor2$(OBJ) : [.src.odbc.unittests]cursor2.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]describecol$(E) : [.src.odbc.unittests]describecol$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]describecol$(OBJ) : [.src.odbc.unittests]describecol.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]copydesc$(E) : [.src.odbc.unittests]copydesc$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]copydesc$(OBJ) : [.src.odbc.unittests]copydesc.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]prepclose$(E) : [.src.odbc.unittests]prepclose$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]prepclose$(OBJ) : [.src.odbc.unittests]prepclose.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]warning$(E) : [.src.odbc.unittests]warning$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]warning$(OBJ) : [.src.odbc.unittests]warning.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]paramcore$(E) : [.src.odbc.unittests]paramcore$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]paramcore$(OBJ) : [.src.odbc.unittests]paramcore.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]timeout2$(E) : [.src.odbc.unittests]timeout2$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]timeout2$(OBJ) : [.src.odbc.unittests]timeout2.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]timeout3$(E) : [.src.odbc.unittests]timeout3$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]timeout3$(OBJ) : [.src.odbc.unittests]timeout3.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]connect2$(E) : [.src.odbc.unittests]connect2$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]connect2$(OBJ) : [.src.odbc.unittests]connect2.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]timeout4$(E) : [.src.odbc.unittests]timeout4$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]timeout4$(OBJ) : [.src.odbc.unittests]timeout4.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]freeclose$(E) : [.src.odbc.unittests]freeclose$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]freeclose$(OBJ) : [.src.odbc.unittests]freeclose.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]cursor3$(E) : [.src.odbc.unittests]cursor3$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]cursor3$(OBJ) : [.src.odbc.unittests]cursor3.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]cursor4$(E) : [.src.odbc.unittests]cursor4$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]cursor4$(OBJ) : [.src.odbc.unittests]cursor4.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]cursor5$(E) : [.src.odbc.unittests]cursor5$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]cursor5$(OBJ) : [.src.odbc.unittests]cursor5.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]attributes$(E) : [.src.odbc.unittests]attributes$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]attributes$(OBJ) : [.src.odbc.unittests]attributes.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]hidden$(E) : [.src.odbc.unittests]hidden$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]hidden$(OBJ) : [.src.odbc.unittests]hidden.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]blob1$(E) : [.src.odbc.unittests]blob1$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]blob1$(OBJ) : [.src.odbc.unittests]blob1.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]rowset$(E) : [.src.odbc.unittests]rowset$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]rowset$(OBJ) : [.src.odbc.unittests]rowset.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]cancel$(E) : [.src.odbc.unittests]cancel$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]cancel$(OBJ) : [.src.odbc.unittests]cancel.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]wchar$(E) : [.src.odbc.unittests]wchar$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]wchar$(OBJ) : [.src.odbc.unittests]wchar.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) [.src.odbc.unittests]transaction2$(E) : [.src.odbc.unittests]transaction2$(OBJ) [.src.odbc.unittests]common$(OBJ) link$(LINKFLAGS)/exe=$(MMS$TARGET) $(MMS$SOURCE_LIST),[.vms]libodbc.opt/options $(OPENSSL_OPTIONS) [.src.odbc.unittests]transaction2$(OBJ) : [.src.odbc.unittests]transaction2.c [.src.odbc.unittests]common.h $(CC) $(CFLAGS)/NOWARN/INCLUDE=([.src.odbc.unittests],$(CINCLUDE)) $(CDBGFLAGS) $(MMS$SOURCE) # Clean up distclean : @ if f$search("[...]*$(OBJ)") .nes. "" then delete/noconfirm [...]*$(OBJ);* @ if f$search("[...]*.LIS") .nes. "" then delete/noconfirm [...]*.LIS;* @ if f$search("[...]*.MAP") .nes. "" then delete/noconfirm [...]*.MAP;*/exclude=[.doc...]*.MAP @ if f$search("[...unittests]*$(E)") .nes. "" then delete/noconfirm [...unittests]*$(E);* @ if f$search("[.src.odbc._libs]*$(E)") .nes. "" then delete/noconfirm [.src.odbc._libs]*$(E);* @ if f$search("[...unittests]*.ini") .nes. "" then delete/noconfirm [...unittests]*.ini;* @ if f$search("[...unittests]*.out") .nes. "" then delete/noconfirm [...unittests]*.out;* @ if f$search("*$(OLB)") .nes. "" then purge/noconfirm *$(OLB) @ if f$search("*$(E)") .nes. "" then purge/noconfirm *$(E) clean : distclean @ if f$search("*$(OLB)") .nes. "" then delete/noconfirm *$(OLB);* @ if f$search("*$(E)") .nes. "" then delete/noconfirm *$(E);* @ if f$search("[.include]config.h") .nes. "" then delete/noconfirm [.include]config.h;* @ if f$search("[.include]readline.h") .nes. "" then delete/noconfirm [.include]readline.h;* @ if f$search("[.include]history.h") .nes. "" then delete/noconfirm [.include]history.h;* @ if f$search("[.include]tds_sysdep_public.h_in") .nes. "" then delete/noconfirm [.include]tds_sysdep_public.h_in;* @ if f$search("[]openssl.opt") .nes. "" then delete/noconfirm []openssl.opt;* @ if f$search("[]descrip.mms") .nes. "" then delete/noconfirm []descrip.mms;* @ if f$search("[.include.freetds]sysconfdir.h") .nes. "" then delete/noconfirm [.include.freetds]sysconfdir.h;* @ if f$search("[.include]tds_sysdep_public.h") .nes. "" then delete/noconfirm [.include]tds_sysdep_public.h;* @ if f$search("[.src.replacements]libiconv.c") .nes. "" then delete/noconfirm [.src.replacements]libiconv.c;* freetds-1.3.6/vms/getpass.c000644 025423 025423 00000017756 14056414271 017246 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2003, 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "readline.h" static FILE *tds_rl_instream = NULL; static FILE *tds_rl_outstream = NULL; /* * A collection of assorted UNIXy input functions for VMS. The core * functionality is provided by readpassphrase(), and the general * requirements come mostly from Todd Miller's OpenBSD code but are * completely reimplemented using native services. * * There are simple getpass() and readline() implementations wrapped * around readpassphrase(), the main difference being that getpass() * suppresses echoing whereas readline() enables echoing and suppresses * timeouts. There is also an add_history() stub; echoed lines are * already stored in the command recall buffer by SMG$READ_COMPOSED_LINE. */ #define MY_PASSWORD_LEN 8192 #define RECALL_SIZE 50 /* Lines in recall buffer. */ #define DEFAULT_TIMEOUT 30 /* Seconds to wait for user input. */ /* Flags defined below are VMS-specific. Use the high byte to minimize * potential conflicts. */ #define RPP_TIMEOUT_OFF 0x01000000 /* Wait indefinitely for input. */ char * readpassphrase(const char *prompt, char *pbuf, size_t buflen, int flags) { static unsigned long keyboard_id, keytable_id = 0; unsigned long ctrl_mask, saved_ctrl_mask = 0; int timeout_secs = 0; int *timeout_ptr = NULL; unsigned long status = 0; unsigned short iosb[4]; unsigned short ttchan, result_len = 0, stdin_is_tty; $DESCRIPTOR(ttdsc, ""); $DESCRIPTOR(pbuf_dsc, ""); $DESCRIPTOR(prompt_dsc, ""); char *retval = NULL; char *myprompt = NULL; char input_fspec[MY_PASSWORD_LEN + 1]; if (pbuf == NULL || buflen == 0) { errno = EINVAL; return NULL; } bzero(pbuf, buflen); pbuf_dsc.dsc$a_pointer = pbuf; pbuf_dsc.dsc$w_length = buflen - 1; /* * If stdin is not a terminal and only reading from a terminal is allowed, we * stop here. */ stdin_is_tty = isatty(fileno(stdin)); if (stdin_is_tty != 1 && (flags & RPP_REQUIRE_TTY)) { errno = ENOTTY; return NULL; } /* * We need the file or device associated with stdin in VMS format. */ if (fgetname(stdin, input_fspec, 1)) { ttdsc.dsc$a_pointer = (char *)&input_fspec; ttdsc.dsc$w_length = strlen(input_fspec); } else { errno = EMFILE; return NULL; } /* * The prompt is expected to provide its own leading newline. */ myprompt = malloc(strlen(prompt) + 1); if (myprompt == NULL) { errno = ENOMEM; return NULL; } sprintf(myprompt, "\n%s", prompt); prompt_dsc.dsc$a_pointer = myprompt; prompt_dsc.dsc$w_length = strlen(myprompt); if (!(flags & RPP_ECHO_ON) && (stdin_is_tty)) { /* Disable Ctrl-T and Ctrl-Y */ ctrl_mask = LIB$M_CLI_CTRLT | LIB$M_CLI_CTRLY; status = LIB$DISABLE_CTRL(&ctrl_mask, &saved_ctrl_mask); if (!$VMS_STATUS_SUCCESS(status)) { errno = EVMSERR; vaxc$errno = status; free(myprompt); return NULL; } } /* * Unless timeouts are disabled, find out how long should we wait for input * before giving up. */ if (!(flags & RPP_TIMEOUT_OFF)) { unsigned long tmo_item = SYI$_LGI_PWD_TMO; status = LIB$GETSYI(&tmo_item, &timeout_secs); if (!$VMS_STATUS_SUCCESS(status)) timeout_secs = DEFAULT_TIMEOUT; timeout_ptr = &timeout_secs; } if (!(flags & RPP_ECHO_ON) && (stdin_is_tty)) { /* * If we are suppressing echoing, get a line of input with $QIOW. * Non-echoed lines are not stored for recall. (The same thing * could be done with SMG but would require maintenance of a virtual * display and pasteboard.) */ status = SYS$ASSIGN(&ttdsc, &ttchan, 0, 0, 0); if ($VMS_STATUS_SUCCESS(status)) { unsigned long qio_func = IO$_READPROMPT | IO$M_NOECHO | IO$M_PURGE; if (!(flags & RPP_TIMEOUT_OFF)) qio_func |= IO$M_TIMED; bzero(iosb, sizeof(iosb)); status = SYS$QIOW(0, (unsigned long) ttchan, qio_func, &iosb, 0, 0, pbuf, buflen - 1, timeout_secs, 0, myprompt, strlen(myprompt)); if ($VMS_STATUS_SUCCESS(status)) { status = iosb[0]; result_len = iosb[1]; /* bytes actually read */ } (void) SYS$DASSGN(ttchan); } } else { /* * We are not suppressing echoing because echoing has been explicitly * enabled and/or we are not reading from a terminal. In this case we * use SMG, which will store commands for recall. The virtual keyboard * and key table are static and will only be created if we haven't been * here before. */ status = SS$_NORMAL; if (keyboard_id == 0) { unsigned char recall_size = RECALL_SIZE; status = SMG$CREATE_VIRTUAL_KEYBOARD(&keyboard_id, &ttdsc, 0, 0, &recall_size); } if ($VMS_STATUS_SUCCESS(status) && keytable_id == 0) { status = SMG$CREATE_KEY_TABLE(&keytable_id); } if ($VMS_STATUS_SUCCESS(status)) { status = SMG$READ_COMPOSED_LINE(&keyboard_id, &keytable_id, &pbuf_dsc, &prompt_dsc, &result_len, 0, 0, 0, timeout_ptr); } } /* * Process return value from SYS$QIOW or SMG$READ_COMPOSED_LINE. */ switch (status) { case SS$_TIMEOUT: errno = ETIMEDOUT; break; case SMG$_EOF: if (result_len != 0) { status = SS$_NORMAL; } /* fall through */ default: if ($VMS_STATUS_SUCCESS(status)) { int i; if (flags & RPP_FORCELOWER) { for (i = 0; i < result_len; i++) pbuf[i] = tolower(pbuf[i]); } if (flags & RPP_FORCEUPPER) { for (i = 0; i < result_len; i++) pbuf[i] = toupper(pbuf[i]); } if (flags & RPP_SEVENBIT) { for (i = 0; i < result_len; i++) pbuf[i] &= 0x7f; } pbuf[result_len] = '\0'; retval = pbuf; } else { errno = EVMSERR; vaxc$errno = status; } } /* end switch */ free(myprompt); if (!(flags & RPP_ECHO_ON) && (stdin_is_tty)) { /* * Reenable previous control processing. */ status = LIB$ENABLE_CTRL(&saved_ctrl_mask); if (!$VMS_STATUS_SUCCESS(status)) { errno = EVMSERR; vaxc$errno = status; return NULL; } } return retval; } /* getpassphrase */ static char passbuf[MY_PASSWORD_LEN + 1]; char * getpass(const char *prompt) { bzero(passbuf, sizeof(passbuf)); /* caller should do this again */ return (readpassphrase(prompt, passbuf, sizeof(passbuf), RPP_ECHO_OFF) ); } /* getpass */ char * readline(char *prompt) { char *buf = NULL, *s = NULL, *p = NULL, *newline = NULL; if (tds_rl_instream == NULL) s = readpassphrase((const char *) prompt, passbuf, sizeof(passbuf), RPP_ECHO_ON | RPP_TIMEOUT_OFF); else s = fgets(passbuf, sizeof(passbuf), tds_rl_instream); if (s != NULL) { buf = (char *) malloc(strlen(s) + 1); strcpy(buf, s); } /* readline is documented to eat the newline. */ if (buf) { newline = strchr(buf, '\n'); if (newline) *newline = '\0'; } return buf; } /* readline */ void add_history(const char *s) { } FILE ** rl_instream_get_addr(void) { return &tds_rl_instream; } FILE ** rl_outstream_get_addr(void) { return &tds_rl_outstream; } freetds-1.3.6/vms/libodbc.opt000644 025423 025423 00000000022 14056414222 017524 0ustar00fredianofrediano000000 000000 LIBODBC/Shareable freetds-1.3.6/vms/odbc_driver_axp.opt000644 025423 025423 00000007714 14056414222 021277 0ustar00fredianofrediano000000 000000 ! FreeTDS - Library of routines accessing Sybase and Microsoft databases ! Copyright (C) 2003 Craig A. Berry craigberry@mac.com 05-MAY-2003 ! ! 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., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. ! LIBODBCINST/SHAREABLE CASE_SENSITIVE=YES SYMBOL_VECTOR = (SQLAllocConnect=PROCEDURE,- SQLAllocEnv=PROCEDURE,- SQLAllocHandle=PROCEDURE,- SQLAllocStmt=PROCEDURE,- SQLBindCol=PROCEDURE,- SQLBindParam=PROCEDURE,- SQLBindParameter=PROCEDURE,- SQLCancel=PROCEDURE,- SQLCloseCursor=PROCEDURE,- SQLColAttribute=PROCEDURE,- SQLColAttributes=PROCEDURE,- SQLColumnPrivileges=PROCEDURE,- SQLColumns=PROCEDURE,- SQLConnect=PROCEDURE,- SQLCopyDesc=PROCEDURE,- SQLDescribeCol=PROCEDURE,- SQLDisconnect=PROCEDURE,- SQLDriverConnect=PROCEDURE,- SQLEndTran=PROCEDURE,- SQLError=PROCEDURE,- SQLExecDirect=PROCEDURE,- SQLExecute=PROCEDURE,- SQLExtendedFetch=PROCEDURE,- SQLFetch=PROCEDURE,- SQLFetchScroll=PROCEDURE,- SQLForeignKeys=PROCEDURE,- SQLFreeConnect=PROCEDURE,- SQLFreeEnv=PROCEDURE,- SQLFreeHandle=PROCEDURE,- SQLFreeStmt=PROCEDURE,- SQLGetConnectAttr=PROCEDURE,- SQLGetConnectOption=PROCEDURE,- SQLGetConnectOptionW=PROCEDURE,- SQLGetCursorName=PROCEDURE,- SQLGetData=PROCEDURE,- SQLGetDescField=PROCEDURE,- SQLGetDescRec=PROCEDURE,- SQLGetDiagField=PROCEDURE,- SQLGetDiagRec=PROCEDURE,- SQLGetEnvAttr=PROCEDURE,- SQLGetFunctions=PROCEDURE,- SQLGetInfo=PROCEDURE,- SQLGetStmtAttr=PROCEDURE,- SQLGetStmtAttrW=PROCEDURE,- SQLGetStmtOption=PROCEDURE,- SQLGetTypeInfo=PROCEDURE,- SQLGetTypeInfoW=PROCEDURE,- SQLMoreResults=PROCEDURE,- SQLNativeSql=PROCEDURE,- SQLNumParams=PROCEDURE,- SQLNumResultCols=PROCEDURE,- SQLParamData=PROCEDURE,- SQLParamOptions=PROCEDURE,- SQLPrepare=PROCEDURE,- SQLPrimaryKeys=PROCEDURE,- SQLProcedureColumns=PROCEDURE,- SQLProcedures=PROCEDURE,- SQLPutData=PROCEDURE,- SQLRowCount=PROCEDURE,- SQLSetConnectAttr=PROCEDURE,- SQLSetConnectOption=PROCEDURE,- SQLSetConnectOptionW=PROCEDURE,- SQLSetCursorName=PROCEDURE,- SQLSetDescField=PROCEDURE,- SQLSetDescRec=PROCEDURE,- SQLSetEnvAttr=PROCEDURE,- SQLSetParam=PROCEDURE,- SQLSetPos=PROCEDURE,- SQLSetScrollOptions=PROCEDURE,- SQLSetStmtAttr=PROCEDURE,- SQLSetStmtAttrW=PROCEDURE,- SQLSetStmtOption=PROCEDURE,- SQLSpecialColumns=PROCEDURE,- SQLStatistics=PROCEDURE,- SQLTablePrivileges=PROCEDURE,- SQLTables=PROCEDURE,- SQLTransact=PROCEDURE,- SQLColAttributeW=PROCEDURE,- SQLColumnPrivilegesW=PROCEDURE,- SQLColumnsW=PROCEDURE,- SQLConnectW=PROCEDURE,- SQLDescribeColW=PROCEDURE,- SQLDriverConnectW=PROCEDURE,- SQLErrorW=PROCEDURE,- SQLExecDirectW=PROCEDURE,- SQLForeignKeysW=PROCEDURE,- SQLGetConnectAttrW=PROCEDURE,- SQLGetCursorNameW=PROCEDURE,- SQLGetDescFieldW=PROCEDURE,- SQLGetDescRecW=PROCEDURE,- SQLGetDiagFieldW=PROCEDURE,- SQLGetDiagRecW=PROCEDURE,- SQLGetInfoW=PROCEDURE,- SQLNativeSqlW=PROCEDURE,- SQLPrepareW=PROCEDURE,- SQLPrimaryKeysW=PROCEDURE,- SQLProcedureColumnsW=PROCEDURE,- SQLProceduresW=PROCEDURE,- SQLSetConnectAttrW=PROCEDURE,- SQLSetCursorNameW=PROCEDURE,- SQLSetDescFieldW=PROCEDURE,- SQLSpecialColumnsW=PROCEDURE,- SQLStatisticsW=PROCEDURE,- SQLTablePrivilegesW=PROCEDURE,- SQLTablesW=PROCEDURE) ) ! ! SQLBrowseConnect=PROCEDURE,- ! SQLDescribeParam=PROCEDURE,- freetds-1.3.6/vms/README.vms000644 025423 025423 00000007540 14056414222 017102 0ustar00fredianofrediano000000 000000 README.vms -- VMS-specific notes on building and running FreeTDS FreeTDS has successfully built and passed all expected tests in the following environments: OpenVMS Alpha 7.2-1, Compaq C 6.4, OpenVMS Sybase 11.0.2, TDS 5.0 OpenVMS Alpha 7.3-1, Compaq C 6.5, MS SQL Server 7.0, TDS 7.0 OpenVMS Alpha 7.1, Compaq C 6.5, MS SQL Server 2000, TDS 8.0 It will probably build and run on most versions of OpenVMS Alpha 7.0 and later with DEC/Compaq C 6.0 or later. Other prerequisites: gunzip vmstar MMS or MMK Build Instructions Decompress and unpack the source archive using gunzip and vmstar (You probably have already or you wouldn't be reading this). If you are untarring on an ODS-5 disk, you should use the /ODS2 or -o option to create universally VMS-friendly filenames; the build will fail to locate some files otherwise. Set default to the top-level source directory and run the configuration script like so: $ @[.vms]configure This creates a descrip.mms in the top-level source directory which you may execute by simply running MMS (if you have the Module Management System that is part of DECset) or MMK (a freeware MMS alternative available from http://www.madgoat.com). By default the build uses version 5.0 of the TDS protocol and does not include ODBC support. You may change these defaults by sypplying the following macros to the make utility: TDSVER This macro expects a value that will be passed directly to the C compiler. Valid values are TDS50, TDS71, TDS72, TDS73 and TDS74. Consult the [.doc] directory for more information about the TDS protocol, what servers use which versions, and the history of the versions. Example: $ MMK/MACRO="TDSVER"="TDS71" MSDBLIB Enables Microsoft behavior in the db-lib API where it diverges from Sybase's. See additional documentation in the [.doc] directory. Example: $ MMK/MACRO="MSDBLIB"=1 ODBC This macro instructs the build to include ODBC support. At the moment, the unixODBC driver manager is assumed (see http://www.unixodbc.org), but others may work as well. The following logical names must be defined in order to build with ODBC support: ODBC_LIBDIR directory containing driver manager's libraries ODBC_INCDIR directory containing driver manager's include files LIBODBC the shareable image comprising the driver manager Note: in unixODBC 2.2.4 and later, all of these logicals except ODBC_INCDIR will be set up by running ODBC_SETUP.COM in the library directory. Examples: $ MMS/MACRO="ODBC"=1 $ MMK/MACRO=("ODBC"=1,"TDSVER"="TDS71") Caveats and To-do: It's probably best to define the locations of your configuration files as logical names; otherwise FreeTDS may concoct an unparseable combination of UNIX and VMS filename syntax. For example: $ DEFINE FREETDSCONF DISK$USER:[TDSDIR]freetds.conf There is currently no install target; it's up to you to put the libraries, include files, etc. wherever you want them. A VAX port is within the realm of possibilities. It would need to convert between IEEE floating point data and native format and/or request native F_FLOAT and D_FLOAT from the server (which may only work on Sybase, not MS SQL Server, but that's TBD). As more ODBC functions are implemented, the file [.vms]odbc_driver_axp.opt needs to be updated to point to the real functions instead of the aliases to the stub for unimplemented functions. The build currently compiles with the /NAMES=AS_IS switch when the ODBC macro is enabled; this results in mixed-case symbol names. Mixed-case symbols were necessary to get the code working with unixODBC but may cause problems when calling the FreeTDS libraries from other languages. There are a variety of approaches that could be taken to work around this but for now you'll have to roll your own. Last updated: 6-NOV-2004 Craig A. Berry $Id: README.vms,v 1.4 2009-09-04 07:12:18 freddy77 Exp $ freetds-1.3.6/vms/vargdefs.h000644 025423 025423 00000004206 14056414222 017364 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. /* * Definitions used by the VMSARG parsing and mapping routines. * * Based on VMSARG Version 2.0 by Tom Wade * * Extensively revised for inclusion in FreeTDS by Craig A. Berry. * * From the VMSARG 2.0 documentation: * * The product is aimed at . . . people who are porting a package from * Unix to VMS. This software is made freely available for inclusion in * such products, whether they are freeware, public domain or commercial. * No licensing is required. */ #if __CRTL_VER >= 70302000 && !defined(__VAX) #define QUAL_LENGTH (4000+1) #define S_LENGTH (4096+1) #else #define QUAL_LENGTH (255+1) #define S_LENGTH (1024+1) #endif #define MAX_ARGS 255 /* bit fields for arg flags. */ #define VARG_M_AFFIRM 1 #define VARG_M_NEGATIVE 2 #define VARG_M_KEYWORDS 4 #define VARG_M_SEPARATOR 8 #define VARG_M_DATE 16 #define VARG_M_APPEND 32 #define VARG_M_HELP 64 /* bit fields for action flags. */ #define VARGACT_M_UPPER 1 #define VARGACT_M_LOWER 2 #define VARGACT_M_SPECIAL 4 #define VARGACT_M_ESCAPE 8 #define VARGACT_M_DOUBLE 16 #define VARGACT_M_IMAGE 32 #define VARGACT_M_SYMBOL 64 #define VARGACT_M_COMMAND 128 #define VARGACT_M_RETURN 256 #define VARGACT_M_PROTECT 512 #define VARGACT_M_UNIXARG 1024 #define VARGACT_M_PROTMASK 1+2+4+8+16 freetds-1.3.6/vms/vmsarg_command_bcp.cld000644 025423 025423 00000005051 14056414222 021716 0ustar00fredianofrediano000000 000000 ! FreeTDS - Library of routines accessing Sybase and Microsoft databases ! Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. ! Command definitions for the BCP command. Module VARG_CLD Define Verb VARG parameter P1, label=TABLE_NAME value (required) parameter P2, label=DIRECTION value (required,type=DIR_KEYS) parameter P3, label=DATA_FILE value (required,type=$file) qualifier MAX_ERRORS value (required,type=$number) qualifier FORMAT_FILE value (required,type=$file) qualifier ERRORFILE value (required,type=$file) qualifier FIRST_ROW value (required,type=$number) qualifier LAST_ROW value (required,type=$number) qualifier BATCH_SIZE value (required,type=$number) qualifier NATIVE_DEFAULT qualifier CHARACTER_DEFAULT qualifier COLUMN_TERMINATOR value (required) qualifier ROW_TERMINATOR value (required) qualifier USERNAME value qualifier PASSWORD value (default="") qualifier SERVER_NAME value (required) qualifier INPUT value (required,type=$file) qualifier OUTPUT value (required,type=$file) qualifier SERVCHARSET value qualifier CLIENTCHARSET value qualifier DISPCHARSET value qualifier FILECHARSET value qualifier LANGUAGE value qualifier FILECHARSET value qualifier TDSPACKETSIZE value (type=$number) qualifier TEXTSIZE value (type=$number) qualifier VERSION, syntax=NOPARAM qualifier HOMEDIR value qualifier ENCRYPT qualifier IDENTITY disallow (NATIVE_DEFAULT and CHARACTER_DEFAULT) define type DIR_KEYS keyword IN keyword OUT define syntax NOPARAM parameter P1, label=TABLE_NAME parameter P2, label=DIRECTION value (type=DIR_KEYS) parameter P3, label=DATA_FILE value (type=$file) freetds-1.3.6/vms/vmsarg_command_defncopy.cld000644 025423 025423 00000003603 14056414222 022762 0ustar00fredianofrediano000000 000000 ! FreeTDS - Library of routines accessing Sybase and Microsoft databases ! Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. ! Command definitions for the DEFNCOPY command. Module VARG_CLD define verb VARG parameter P1, label=DIRECTION value (required,type=DIR_KEYS) parameter P2, label=FILE_NAME value (required,type=$file) parameter P3, label=DATABASE_NAME value (required) parameter P4, label=OBJECT_NAME value (list) qualifier USERNAME value qualifier PASSWORD value (default="") qualifier SERVER_NAME, label=SERVERNAME value qualifier VERSION, syntax=NOPARAM qualifier INTERFACES, label=INTERFACE value (type=$file) qualifier DISPCHARSET value qualifier LANGUAGE value qualifier SERVCHARSET value qualifier CLIENTCHARSET value qualifier REAL_VERSION qualifier HOMEDIR value define type DIR_KEYS keyword IN keyword OUT define syntax NOPARAM parameter P1, label=DIRECTION value (type=DIR_KEYS) parameter P2, label=FILE_NAME value (type=$file) parameter P3, label=DATABASE_NAME parameter P4, label=OBJECT_NAME value (list) freetds-1.3.6/vms/vmsarg_command_isql.cld000644 025423 025423 00000004013 14056414222 022117 0ustar00fredianofrediano000000 000000 ! FreeTDS - Library of routines accessing Sybase and Microsoft databases ! Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. ! Command definitions for the ISQL command. Module VARG_CLD Define Verb VARG qualifier ECHO qualifier STATISTICS qualifier NOPROMPT qualifier TERMINATOR value qualifier WIDTH value (type=$number) qualifier COLSEPARATOR value qualifier ROWSINPAGE value (type=$number) qualifier TIMEOUT value qualifier ERRORLEVEL value (type=$number) qualifier USERNAME value qualifier PASSWORD value qualifier SERVER_NAME value qualifier INTERFACE value (type=$file) qualifier HOSTNAME value qualifier CLIENTCHARSET value qualifier DISPCHARSET value qualifier INPUT value (type=$file) qualifier OUTPUT value (type=$file) qualifier LANGUAGE value qualifier HOMEDIR value qualifier VERSION qualifier DEBUG qualifier BROWSE qualifier RECORD_FRONT_TO_SERVER value qualifier LOGINTIME value qualifier EDITOR value qualifier TDSPACKETSIZE value (type=$number) qualifier TRACE value qualifier ADDID qualifier LOOK3 qualifier ENCRYPT qualifier CHAIN_XACT qualifier FIPS define syntax NOPARAM freetds-1.3.6/vms/vmsarg_mapping_bcp.c000644 025423 025423 00000005621 14056414222 021416 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. /* * Mapping table for the BCP command. */ int vmsarg_mapping (int *nvargs, char *vms_arg[], char *unix_arg[], char *unix_narg[], char *vms_key[], char *unix_key[], char *separator[], int flags[], char *pattern[], char **outverb, int *action_flags, char **arg_symbol, char **image_name) { *nvargs = 26; *action_flags = 1301; vms_arg[1] = "TABLE_NAME"; flags[1] = 1; unix_arg[1] = "$"; vms_arg[2] = "DIRECTION"; flags[2] = 1; unix_arg[2] = "$"; vms_arg[3] = "DATA_FILE"; flags[3] = 1; unix_arg[3] = "$"; vms_arg[4] = "MAX_ERRORS"; flags[4] = 1; unix_arg[4] = "-m"; vms_arg[5] = "FORMAT_FILE"; flags[5] = 1; unix_arg[5] = "-f"; vms_arg[6] = "ERRORFILE"; flags[6] = 1; unix_arg[6] = "-e"; vms_arg[7] = "FIRST_ROW"; flags[7] = 1; unix_arg[7] = "-F"; vms_arg[8] = "LAST_ROW"; flags[8] = 1; unix_arg[8] = "-L"; vms_arg[9] = "BATCH_SIZE"; flags[9] = 1; unix_arg[9] = "-b"; vms_arg[10] = "NATIVE_DEFAULT"; flags[10] = 1; unix_arg[10] = "-n"; vms_arg[11] = "CHARACTER_DEFAULT"; flags[11] = 1; unix_arg[11] = "-c"; vms_arg[12] = "COLUMN_TERMINATOR"; flags[12] = 1; unix_arg[12] = "-t"; vms_arg[13] = "ROW_TERMINATOR"; flags[13] = 1; unix_arg[13] = "-r"; vms_arg[14] = "USERNAME"; flags[14] = 1; unix_arg[14] = "-U"; vms_arg[15] = "PASSWORD"; flags[15] = 1; unix_arg[15] = "-P"; vms_arg[16] = "SERVER_NAME"; flags[16] = 1; unix_arg[16] = "-S"; vms_arg[17] = "INPUT"; flags[17] = 1; unix_arg[17] = "-i"; vms_arg[18] = "OUTPUT"; flags[18] = 1; unix_arg[18] = "-o"; vms_arg[19] = "TDSPACKETSIZE"; flags[19] = 1; unix_arg[19] = "-A"; vms_arg[20] = "TEXTSIZE"; flags[20] = 1; unix_arg[20] = "-T"; vms_arg[21] = "VERSION"; flags[21] = 1; unix_arg[21] = "-v"; vms_arg[22] = "DISPCHARSET"; flags[22] = 1; unix_arg[22] = "-a"; vms_arg[23] = "LANGUAGE"; flags[23] = 1; unix_arg[23] = "-z"; vms_arg[24] = "CLIENTCHARSET"; flags[24] = 1; unix_arg[24] = "-J"; vms_arg[25] = "IDENTITY"; flags[25] = 1; unix_arg[25] = "-E"; vms_arg[26] = "ENCRYPT"; flags[26] = 1; unix_arg[26] = "-X"; return 1; } freetds-1.3.6/vms/vmsarg_mapping_defncopy.c000644 025423 025423 00000003733 14056414222 022463 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. /* * Mapping table for the DEFNCOPY command. */ int vmsarg_mapping (int *nvargs, char *vms_arg[], char *unix_arg[], char *unix_narg[], char *vms_key[], char *unix_key[], char *separator[], int flags[], char *pattern[], char **outverb, int *action_flags, char **arg_symbol, char **image_name) { *nvargs = 12; *action_flags = 1301; vms_arg[1] = "DIRECTION"; flags[1] = 1; unix_arg[1] = "$"; vms_arg[2] = "FILE_NAME"; flags[2] = 1; unix_arg[2] = "$"; vms_arg[3] = "DATABASE_NAME"; flags[3] = 1; unix_arg[3] = "$"; vms_arg[4] = "OBJECT_NAME"; flags[4] = 1; unix_arg[4] = "$"; vms_arg[5] = "USERNAME"; flags[5] = 1; unix_arg[5] = "-U"; vms_arg[6] = "PASSOWRD"; flags[6] = 1; unix_arg[6] = "-P"; vms_arg[7] = "SERVER_NAME"; flags[7] = 1; unix_arg[7] = "-S"; vms_arg[8] = "VERSION"; flags[8] = 1; unix_arg[8] = "-v"; vms_arg[9] = "INTERFACES"; flags[9] = 1; unix_arg[9] = "-I"; vms_arg[10] = "DISPCHARSET"; flags[10] = 1; unix_arg[10] = "-a"; vms_arg[11] = "LANGUAGE"; flags[11] = 1; unix_arg[11] = "-z"; vms_arg[12] = "CLIENTCHARSET"; flags[12] = 1; unix_arg[12] = "-J"; return 1; } freetds-1.3.6/vms/vmsarg_mapping_isql.c000644 025423 025423 00000005754 14056414222 021631 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. /* * Mapping table for the ISQL command. */ #include int vmsarg_mapping (int *nvargs, char *vms_arg[], char *unix_arg[], char *unix_narg[], char *vms_key[], char *unix_key[], char *separator[], int flags[], char *pattern[], char **outverb, int *action_flags, char **arg_symbol, char **image_name) { *nvargs = 26; *action_flags = 1301; vms_arg[1] = "USERNAME"; flags[1] = 1; unix_arg[1] = "-U"; vms_arg[2] = "PASSWORD"; flags[2] = 1; unix_arg[2] = "-P"; vms_arg[3] = "SERVER_NAME"; flags[3] = 1; unix_arg[3] = "-S"; vms_arg[4] = "TIMEOUT"; flags[4] = 1; unix_arg[4] = "-t"; vms_arg[5] = "INPUT"; flags[5] = 1; unix_arg[5] = "-i"; vms_arg[6] = "OUTPUT"; flags[6] = 1; unix_arg[6] = "-o"; vms_arg[7] = "VERSION"; flags[7] = 1; unix_arg[7] = "-v"; vms_arg[8] = "ECHO"; flags[8] = 1; unix_arg[8] = "-e"; vms_arg[9] = "FIPS"; flags[9] = 1; unix_arg[9] = "-F"; vms_arg[10] = "STATISTICS"; flags[10] = 1; unix_arg[10] = "-p"; vms_arg[11] = "NOPROMPT"; flags[11] = 1; unix_arg[11] = "-n"; vms_arg[12] = "ENCRYPT"; flags[12] = 1; unix_arg[12] = "-X"; vms_arg[13] = "CHAIN_XACT"; flags[13] = 1; unix_arg[13] = "-Y"; vms_arg[14] = "DISPCHARSET"; flags[14] = 1; unix_arg[14] = "-a"; vms_arg[15] = "TDSPACKETSIZE"; flags[15] = 1; unix_arg[15] = "-A"; vms_arg[16] = "TERMINATOR"; flags[16] = 1; unix_arg[16] = "-c"; vms_arg[17] = "EDITOR"; flags[17] = 1; unix_arg[17] = "-E"; vms_arg[18] = "ROWSINPAGE"; flags[18] = 1; unix_arg[18] = "-h"; vms_arg[19] = "HOSTNAME"; flags[19] = 1; unix_arg[19] = "-H"; vms_arg[20] = "INTERFACE"; flags[20] = 1; unix_arg[20] = "-I"; vms_arg[21] = "CLIENTCHARSET"; flags[21] = 1; unix_arg[21] = "-J"; vms_arg[22] = "ERRORLEVEL"; flags[22] = 1; unix_arg[22] = "-m"; vms_arg[23] = "LOGINTIME"; flags[23] = 1; unix_arg[23] = "-l"; vms_arg[24] = "COLSEPARATOR"; flags[24] = 1; unix_arg[24] = "-s"; vms_arg[25] = "WIDTH"; flags[25] = 1; unix_arg[25] = "-w"; vms_arg[26] = "LANGUAGE"; flags[26] = 1; unix_arg[26] = "-z"; /* Because vi is not a reasonable default on VMS. */ if (setenv("EDITOR", "edit", 0) != 0) return 0; return 1; } freetds-1.3.6/vms/vmsarg_parse.c000644 025423 025423 00000072436 14056414222 020261 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Craig A. Berry craigberry@mac.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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. /* * Program to Parse VMS style arguments. The calling program passes * argc, argv into this routine, and we translate the VMS qualifiers into * Unix style arguments according to a user specified translation table. * It then puts these into a new argv and returns that address to the * caller. The calling program then happily proceeds with the Unix style * qualifiers that it was written to deal with. * * Based on VMSARG Version 2.0 by Tom Wade * * Extensively revised for inclusion in FreeTDS by Craig A. Berry. * * From the VMSARG 2.0 documentation: * * The product is aimed at . . . people who are porting a package from * Unix to VMS. This software is made freely available for inclusion in * such products, whether they are freeware, public domain or commercial. * No licensing is required. */ #include "vargdefs.h" #include #include #include #include #include #include #include #include #include #include #include #include /* Increment arg counter and crash out if we have too many */ #define Increment(x) x = x + 1;\ if (x > MAX_ARGS) sys$exit(SS$_OVRMAXARG); /* Declare internal static routines */ static int varg_get_index(), varg_set_index(), varg_convert_date(), varg_do_help(); static int varg_protect_string(), varg_set_symbol(), varg_do_command(); static int varg_do_exit(); parse_vms_args(int *argc, char **argv[]) { static char command[S_LENGTH], value_template[S_LENGTH]; static char qual_template[S_LENGTH]; char verb[] = "VARG "; char *vms_arg[MAX_ARGS]; char *unix_arg[MAX_ARGS]; char *unix_narg[MAX_ARGS]; char *vms_key[MAX_ARGS]; char *unix_key[MAX_ARGS]; char *separator[MAX_ARGS]; char *pattern[MAX_ARGS]; char *outverb, *arg_symbol, *image_name; char foreign_image[S_LENGTH]; int flags[MAX_ARGS], action_flags; int nvargs, u_length, l_element, index; char arg_string[S_LENGTH], arg_element[S_LENGTH]; static char value[S_LENGTH]; char *special_chars; char default_special[] = "!@#^&()=+\'\"/?,"; $DESCRIPTOR(command_desc, command); $DESCRIPTOR(qual_desc, ""); $DESCRIPTOR(value_desc, value); int i, length, status, i_length, arg_count, q_length; static char command_args[S_LENGTH]; $DESCRIPTOR(command_arg_desc, command_args); extern VARG_CLD; static char *newargv[MAX_ARGS]; int affirm_flag, negative_flag, keywords_flag, separator_flag; int date_flag, append_flag, present, more_flag, multivalue, help_flag; int vmsarg_mapping(); /* Get the VMS -> Unix mapping definitions from the routine generated by the GEN_MAPPING utility. */ vmsarg_mapping(&nvargs, vms_arg, unix_arg, unix_narg, vms_key, unix_key, separator, flags, pattern, &outverb, &action_flags, &arg_symbol, &image_name ); /* Get the original command line from the foreign command utility. */ length = 0; /* RTL only writes word */ lib$get_foreign(&command_arg_desc, 0, &length); command_args[length] = 0; /* add NULL terminator */ /* Check to see if any of the exising arguments start with a "-" character. if so, assume he's already using Unix style arguments so we don't have to do anything. Only do this if the Unix_Arg bit is set in the action flags. */ if ((action_flags & VARGACT_M_UNIXARG)) { for (i = 1; i <= *argc - 1; i++) if ((*argv) [i][0] == '-') { /* He's using Unix style args. */ if ((action_flags & VARGACT_M_RETURN)) { return 1; /* back out quietly */ } else { status = varg_do_exit(action_flags, arg_symbol, command_args, image_name, outverb); sys$exit(status); /* exit with DCL stuff done */ } } } /* Catenate verb and arguments into the command string for DCL to parse. */ strcpy(command, verb); strcat(command, command_args); command_desc.dsc$w_length = strlen(verb) + strlen(command_args); /* Pass it to the DCL parser for its approval. */ status = cli$dcl_parse(&command_desc, &VARG_CLD); if ((status & 1) != 1) sys$exit (status); /* Now that DCL is happy, we go through all the defined VMS qualifiers and parameters to check if they are present or defaulted. */ arg_count = 0; /* so far so good */ for (i = 1; i <= nvargs; i++) { /* Set The various flags for this qualifier. */ affirm_flag = (VARG_M_AFFIRM & flags[i]) != 0; negative_flag = (VARG_M_NEGATIVE & flags[i]) != 0; keywords_flag = (VARG_M_KEYWORDS & flags[i]) != 0; separator_flag = (VARG_M_SEPARATOR & flags[i]) != 0; date_flag = (VARG_M_DATE & flags[i]) != 0; append_flag = (VARG_M_APPEND & flags[i]) != 0; help_flag = (VARG_M_HELP & flags[i]) != 0; /* Check if the qualifier or parameter is present */ qual_desc.dsc$w_length = strlen(vms_arg[i]); qual_desc.dsc$a_pointer = vms_arg[i]; present = cli$present(&qual_desc) & 1; /* if the qualifier is present, and there is a positive translation, then replace the VMS qualifier by its Unix equivalent. Note that if the Unix equivalent starts with a '$', then it is a parameter and we omit the qualifier name, only putting in the value. */ qual_template[0] = 0; /* zero string initially */ if (present && affirm_flag) { if (unix_arg[i][0] != '$') strcpy(qual_template, unix_arg[i]); } if (!(present & 1) && negative_flag) /* NOT present AND negative_flag */ { strcpy(qual_template, unix_narg[i]); } /* Get the first value (if any). We may have to catenate this with the qualifier keyword, or build up multiple values in a single argv element. */ if (present) { value_desc.dsc$w_length = QUAL_LENGTH; status = cli$get_value(&qual_desc, &value_desc, &length); if ((status & 1) != 1) length = 0; value[length] = 0; /* NULL terminator */ more_flag = status == CLI$_COMMA; } else { length = 0; } /* if the /APPEND qualifier was used, then the qualifier and its value are in the same argv element. */ if (append_flag) { strcpy(value_template, qual_template); } else { /* Allocate a fresh argv element and load the Unix keyword into it. */ q_length = strlen(qual_template); if (q_length != 0) { Increment(arg_count); newargv[arg_count] = malloc(q_length + 1); if (newargv[arg_count] == NULL) sys$exit(LIB$_INSVIRMEM); strcpy(newargv[arg_count], qual_template); } } multivalue = more_flag; /* Get all the various values and either append them with appropriate separators to the current template, or load them in successive argv elements. */ while (affirm_flag && (length != 0)) { /* if a keyword list is involved, get the corresponding field from the Unix equivalent. */ if (keywords_flag) { index = varg_get_index(value, vms_key[i]); varg_set_index(value, unix_key[i], index); } /* if the /DATE qualifier was present, we interpret the value as a VMS date/time specification, and convert it to the equivalent Unix type string. */ if (date_flag) varg_convert_date(value, pattern[i]); /* Add the current value to the template so far. Add a separator character if we need one. */ strcat(value_template, value); if (separator_flag) { if (more_flag) strcat(value_template, separator[i]); } else { /* Each value should have its own argv element. */ Increment(arg_count); newargv[arg_count] = malloc(strlen(value_template) + 1); if (newargv[arg_count] == NULL) sys$exit(LIB$_INSVIRMEM); strcpy(newargv[arg_count], value_template); value_template[0] = 0; } /* Get the next value from the DCL parser. */ value_desc.dsc$w_length = QUAL_LENGTH; /* reset string */ status = cli$get_value(&qual_desc, &value_desc, &length); if ((status & 1) != 1) length = 0; value[length] = 0; more_flag = status == CLI$_COMMA; } /* All the values are in for this qualifier - if there were being stacked up then load them all into an argv element. */ if (separator_flag & multivalue) { Increment(arg_count); newargv[arg_count] = malloc(strlen(value_template) + 1); if (newargv[arg_count] == NULL) sys$exit(LIB$_INSVIRMEM); strcpy(newargv[arg_count], value_template); value_template[0] = 0; } /* Check to see if this is a HELP directive. if so, then the help library name is stored in pattern[i] and the initial help string in unix_arg[i] */ if ((present &1) && help_flag) { varg_do_help(pattern[i], unix_arg[i]); } /* And around for the next qualifier. */ } /* We've built the argument vector. Now lets find out what we're supposed to do with it. */ if ((action_flags & VARGACT_M_RETURN)) { /* We should return the result to the caller. Set the corresponding argc & argv variables in the caller to point at these. Make sure the new argv contains the same [0] element as the old one (program name). */ *argc = arg_count + 1; newargv[0] = (*argv)[0]; *argv = newargv; return 1; } /* We must convert the argv elements into an arg string. */ arg_string[0] = 0; special_chars = default_special; for (i = 1; i <= arg_count; i++) { varg_protect_string(newargv[i], arg_element, action_flags, special_chars); strcat(arg_string, arg_element); if (i != arg_count) strcat(arg_string, " "); } status = varg_do_exit(action_flags, arg_symbol, arg_string, image_name, outverb); /* if we got this far then exit to DCL. */ sys$exit(status); } /*****************************************************************************| | Routine to scan the string 'string' to see if it matches any of | | the fields in 'keywords' (fields delimited by "|" characters). if | | so, return the field number (1=first). if it doesn't match, return | | 0. | \*****************************************************************************/ static int varg_get_index(char *string, char *keywords) { int i; char temp[S_LENGTH]; char *field; i = 0; strcpy(temp, keywords); /* don't muck up caller's string. */ /* Get successive fields using STRTOK function and compare. */ field = strtok(temp, "|"); while (field != NULL) { i = i + 1; if (strcmp(field, string) == 0) return i; field = strtok(NULL, "|"); } return 0; } /*****************************************************************************| | Routine to return the 'index' numbered field of 'keywords' in | | 'string'. Keywords are delimited by "|" characters. if 'index' | | is 0 do nothing. | \*****************************************************************************/ static int varg_set_index(char *string, char *keywords, int index) { int i; char temp[S_LENGTH]; char *field; if (index == 0) return 1; strcpy(temp, keywords); /* don't screw up caller's string. */ field = strtok(temp, "|"); for (i = 1; i <= index - 1; i++) { field = strtok(NULL, "|"); } strcpy(string, field); return 1; } /*****************************************************************************| | Invoke a help dialog with the user using the supplied help library | | and initial help command. | \*****************************************************************************/ static int varg_do_help(char *help_library, char *help_command) { $DESCRIPTOR(lib_desc, ""); $DESCRIPTOR(command_desc, ""); int status; lib_desc.dsc$w_length = strlen(help_library); lib_desc.dsc$a_pointer = help_library; command_desc.dsc$w_length = strlen(help_command); command_desc.dsc$a_pointer = help_command; status = lbr$output_help(&lib$put_output, 0, &command_desc, &lib_desc, 0, &lib$get_input); return status; } /*****************************************************************************| | Routine to create a DCL symbol called 'symbol' with value 'value'. | \*****************************************************************************/ static int varg_set_symbol(char *symbol, char *value) { $DESCRIPTOR(symbol_desc, ""); $DESCRIPTOR(value_desc, ""); int status; symbol_desc.dsc$w_length = strlen(symbol); symbol_desc.dsc$a_pointer = symbol; value_desc.dsc$w_length = strlen(value); value_desc.dsc$a_pointer = value; status = lib$set_symbol(&symbol_desc, &value_desc); return status; } /*****************************************************************************| | Routine to exit the program and pass 'command' to DCL for execution. | \*****************************************************************************/ static int varg_do_command(char *command) { $DESCRIPTOR(command_desc, ""); int status; command_desc.dsc$w_length = strlen(command); command_desc.dsc$a_pointer = command; status = lib$do_command(&command_desc); return status; } /*****************************************************************************| | Routine to rebuild 'date_string' converting from a VMS standard | | date/time specifier to the Unix format specified in 'pattern'. | | | \*****************************************************************************/ static int varg_convert_date(char *date_string, char *pattern) { char date_text[30]; int bin_time[2], flags, length, status, i, from, to; char year_4[5], year_2[4], month_name[4]; char month_2[3], month_1[3], date_2[3], date_1[3]; char hour_2[3], hour_1[3], minute[3], second[3]; char *months[] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; $DESCRIPTOR(date_desc, ""); static int context; /* First convert the date string into internal VMS format */ date_desc.dsc$w_length = strlen(date_string); date_desc.dsc$a_pointer = date_string; context = 0; flags = 0X7F; status = lib$convert_date_string(&date_desc, &bin_time, &context, &flags); if ((status & 1) != 1) return status; /* Now convert it back to string form. This ensures that delta times and keywords like TODAY get translated into a consistent format. */ date_desc.dsc$w_length = 30; /* date_desc.dsc$a_pointer = &date_text;*/ date_desc.dsc$a_pointer = date_text; length = 0; status = sys$asctim(&length, &date_desc, &bin_time, 0); if ((status & 1) != 1) return status; date_text[length] = 0; /* add NULL terminator */ date_string[0] = 0; /* start with empty string */ /* Break the date/time string up into the constituent fields. Fields such as date have two instances - one with leading zero and one without e.g. "05" and "5". */ if (date_text[0] == ' ') { date_2[0] = '0'; date_2[1] = date_text[1]; date_2[2] = 0; date_1[0] = date_text[1]; date_1[1] = 0; } else { date_2[0] = date_text[0]; date_2[1] = date_text[1]; date_2[2] = 0; strcpy(date_1, date_2); } /* Extract the month name and lowercase the 2nd and 3rd characters. */ month_name[0] = date_text [3]; month_name[1] = tolower(date_text [4]); month_name[2] = tolower(date_text [5]); month_name[3] = 0; /* Calculate the month number by looking up the month name in a character array. */ for (i = 1; i <= 12; i++) { if (strcmp(month_name, months[i]) == 0) { sprintf(month_2, "%02d", i); sprintf(month_1, "%d", i); break; } } /* Extract the year field (both 4 digit and 2 digit forms). */ year_2[0] = date_text[9]; year_2[1] = date_text[10]; year_2[3] = 0; for (i = 0; i <= 3; i++) { year_4[i] = date_text[i+7]; } year_4[4] = 0; /* Extract hour field. */ hour_2[0] = date_text[12]; hour_2[1] = date_text[13]; hour_2[2] = 0; if (date_text[12] == '0') { hour_1[0] = date_text[13]; hour_1[1] = 0; } else strcpy(hour_1, hour_2); /* Lastly copy the minutes and seconds. */ for (i = 0; i <= 1; i++) { minute[i] = date_text[i+15]; second[i] = date_text[i+18]; } minute[2] = 0; second[2] = 0; /* Now start building up the output string by copying characters from 'pattern' to 'date_string' substituting the various fields when we encounter an escape pair. */ from = 0; to = 0; while (pattern[from] != 0) { if (pattern[from] == '$') { switch (pattern[from+1]) { case 'Y': strcat(date_string, year_4); to = to + 4; break; case 'y': strcat(date_string, year_2); to = to + 2; break; case 'M': strcat(date_string, month_name); to = to + 3; break; case 'N': strcat(date_string, month_2); to = to + 2; break; case 'n': strcat(date_string, month_1); to = to + strlen(month_1); break; case 'D': strcat(date_string, date_2); to = to + 2; break; case 'd': strcat(date_string, date_1); to = to + strlen(date_1); break; case 'H': strcat(date_string, hour_2); to = to + 2; break; case 'h': strcat(date_string, hour_1); to = to + strlen(hour_1); break; case 'm': strcat(date_string, minute); to = to + 2; break; case 'S': case 's': strcat(date_string, second); to = to + 2; break; case '$': date_string[to] = '$'; date_string[to+1] = 0; to = to + 1; break; } from = from + 2; } else { date_string[to] = pattern[from]; date_string[to+1] = 0; from = from + 1; to = to + 1; } } } /*****************************************************************************| | Routine to decide if a string requires to be enclosed in quotation | | marks, and if so, put them in. The various bits in 'flags' tells | | us what characters require protecting. 'Quote' contains the actual | | quote character (which may require doubling or escaping with "\" | | if it occurs in the string). 'Special' contains a list of characters | | which require protecting. | \*****************************************************************************/ static int varg_protect_string(char *instring, char *outstring, int flags, char *special) { int protection_needed, quote_present; int length, i, j, special_length; char ch, quote = '\"'; char quote_string[2]; quote_string[0] = quote; quote_string[1] = 0; length = strlen(instring); special_length = strlen(special); protection_needed = 0; quote_present = 0; /* Check to see if we actually need the quotes. */ if ((flags & VARGACT_M_PROTMASK) != 0) { for (i = 0; i <= length-1; i++) { ch = instring[i]; if ((flags & VARGACT_M_UPPER) && isupper (ch)) { protection_needed = 1; continue; } if ((flags & VARGACT_M_LOWER) && islower (ch)) { protection_needed = 1; continue; } if ((flags & VARGACT_M_SPECIAL)) { for (j = 0; j <= special_length-1; j++) { if (ch == special[j]) { protection_needed = 1; continue; } } if (protection_needed) continue; } if (((flags & VARGACT_M_ESCAPE) || (flags & VARGACT_M_DOUBLE)) && ch == quote) { protection_needed = 1; quote_present = 1; continue; } } } /* if protection is not needed, just copy the input string to the output string. */ if (!protection_needed) { strcpy(outstring, instring); return 1; } /* Protection is needed. if no quotes are present, then we simply enclose the string in quote marks, otherwise we have to step through the string. */ if (quote_present) { outstring[0] = quote; j = 1; for (i = 0; i <= length-1; i++) { ch = instring[i]; if (ch == quote) { if ((flags & VARGACT_M_ESCAPE)) { outstring[j] = '\\'; j = j + 1; } if ((flags & VARGACT_M_DOUBLE)) { outstring[j] = quote; j = j + 1; } } outstring[j] = ch; j = j + 1; } outstring[j] = 0; } else { /* just append the output string + quote */ outstring[0] = 0; strcat(outstring, quote_string); strcat(outstring, instring); strcat(outstring, quote_string); } return 1; } /*****************************************************************************| | Routine to define any DCL symbols that are required, and if the | | appropriate flag bit is set, exit to DCL using a LIB$DO_COMMAND call | | which will activate the real application image. | \*****************************************************************************/ static int varg_do_exit(int flags, char *arg_symbol, char *arg_string, char *image_name, char *verb) { char *foreign_image; char *command; int status; /* Should we set up a symbol containing this arg string ? */ if ((flags & VARGACT_M_SYMBOL)) varg_set_symbol(arg_symbol, arg_string); /* Should we define an image name in the verb symbol ? */ if ((flags & VARGACT_M_IMAGE)) { foreign_image = malloc(strlen(image_name) + 2); if (foreign_image == NULL) return LIB$_INSVIRMEM; strcpy(foreign_image, "$"); strcat(foreign_image, image_name); varg_set_symbol(verb, foreign_image); } /* Should we exit the program and and activate another image or command procedure ? */ if ((flags & VARGACT_M_COMMAND)) { command = malloc(strlen(verb) + strlen(arg_string) + 2); if (command == NULL) return LIB$_INSVIRMEM; strcpy(command, verb); strcat(command, " "); strcat(command, arg_string); status = varg_do_command(command); return status; } return 1; } freetds-1.3.6/vms/stdint.h000644 025423 025423 00000000026 14056414222 017064 0ustar00fredianofrediano000000 000000 #include freetds-1.3.6/win32/freetds/000755 025423 025423 00000000000 14162303422 017176 5ustar00fredianofrediano000000 000000 freetds-1.3.6/win32/Makefile.am000644 025423 025423 00000000167 14056414222 017605 0ustar00fredianofrediano000000 000000 EXTRA_DIST = initnet.c \ freetds/sysconfdir.h \ freetds.nsh freetds.nsh.in \ installfreetds.bat freetds.nsi freetds-1.3.6/win32/Makefile.in000644 025423 025423 00000034453 14162303357 017627 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = win32 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = freetds.nsh CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/freetds.nsh.in \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = initnet.c \ freetds/sysconfdir.h \ freetds.nsh freetds.nsh.in \ installfreetds.bat freetds.nsi all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign win32/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign win32/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): freetds.nsh: $(top_builddir)/config.status $(srcdir)/freetds.nsh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/win32/freetds.nsh.in000644 025423 025423 00000000044 14056414222 020316 0ustar00fredianofrediano000000 000000 !define PRODUCT_VERSION "@VERSION@" freetds-1.3.6/win32/initnet.c000644 025423 025423 00000002214 14056414222 017362 0ustar00fredianofrediano000000 000000 #if defined(_MSC_VER) && defined(_DEBUG) #define _CRTDBG_MAP_ALLOC #include #include #endif #include #ifdef DLL_EXPORT HINSTANCE hinstFreeTDS; BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { WSADATA wsaData; hinstFreeTDS = hinstDLL; switch (fdwReason) { case DLL_PROCESS_ATTACH: #if defined(_MSC_VER) && defined(_DEBUG) _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); #endif if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) return FALSE; DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH: #if defined(_MSC_VER) && defined(_DEBUG) _CrtDumpMemoryLeaks(); #endif break; } return TRUE; } #endif freetds-1.3.6/win32/freetds.nsh000644 025423 025423 00000000040 14162303377 017713 0ustar00fredianofrediano000000 000000 !define PRODUCT_VERSION "1.3.6" freetds-1.3.6/win32/installfreetds.bat000644 025423 025423 00000000413 14056414222 021256 0ustar00fredianofrediano000000 000000 @echo off REM This shell script installs the FreeTDS ODBC driver set dest=%windir%\System IF EXIST %windir%\System32\ODBCCONF.exe SET dest=%windir%\System32 ECHO Installing to %dest% COPY /Y Debug\FreeTDS.dll %dest%\FreeTDS.dll CD %dest% regsvr32 FreeTDS.dll freetds-1.3.6/win32/freetds.nsi000644 025423 025423 00000005151 14056414222 017716 0ustar00fredianofrediano000000 000000 ; Script generated by the HM NIS Edit Script Wizard. !include "freetds.nsh" ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "FreeTDS ODBC driver" !define PRODUCT_PUBLISHER "FreeTDS group" !define PRODUCT_WEB_SITE "http://www.freetds.org" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\{fef6e1f0-ef60-43d2-80a4-bfb774df706c}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" SetCompressor lzma ; MUI 1.67 compatible ------ !include "MUI.nsh" ; MUI Settings !define MUI_ABORTWARNING !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" ; Welcome page !insertmacro MUI_PAGE_WELCOME ; License page !insertmacro MUI_PAGE_LICENSE "..\COPYING.txt" ; Directory page !insertmacro MUI_PAGE_DIRECTORY ; Instfiles page !insertmacro MUI_PAGE_INSTFILES ; Finish page !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_INSTFILES ; Language files !insertmacro MUI_LANGUAGE "English" ; Reserve files !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ; MUI end ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "FreeTDS Setup.exe" InstallDir "$PROGRAMFILES\${PRODUCT_NAME}" ShowInstDetails show ShowUnInstDetails show Section "MainSection" SEC01 SetOutPath "$SYSDIR" SetOverwrite ifnewer File ".\FreeTDS.dll" ; install driver ExecWait '"$SYSDIR\rundll32.exe" "$SYSDIR\FreeTDS.dll" DllRegisterServer' SectionEnd Section -Post SetOutPath "$INSTDIR" WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" SectionEnd Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." FunctionEnd Function un.onInit MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 Abort FunctionEnd Section Uninstall ExecWait '"$SYSDIR\rundll32.exe" "$SYSDIR\FreeTDS.dll" DllUnregisterServer' Delete "$INSTDIR\uninst.exe" Delete "$SYSDIR\FreeTDS.dll" RMDir "$INSTDIR" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" SetAutoClose true SectionEnd freetds-1.3.6/win32/freetds/sysconfdir.h000644 025423 025423 00000000040 14056414222 021527 0ustar00fredianofrediano000000 000000 #define FREETDS_SYSCONFDIR "c:" freetds-1.3.6/samples/Makefile.am000644 025423 025423 00000001157 14056414221 020306 0ustar00fredianofrediano000000 000000 # version $Id: Makefile.am,v 1.3 2006-09-13 11:56:37 freddy77 Exp $ noinst_SCRIPTS = unixodbc.freetds.driver.template EXTRA_DIST = README debug.c dyntest.c odbc.ini odbctest.php \ odbctest.pl test.php test.pl \ unixodbc.freetds.driver.template.in \ unixodbc.install.sh \ unixodbc.jdbc.datasource.template SUFFIXES = .in edit = sed \ -e 's,@datadir\@,$(pkgdatadir),g' \ -e 's,@libdir\@,$(libdir),g' \ -e 's,@prefix\@,$(prefix),g' unixodbc.freetds.driver.template: unixodbc.freetds.driver.template.in CLEANFILES = unixodbc.freetds.driver.template .in: rm -f $@ $@.tmp $(edit) $< >$@.tmp mv $@.tmp $@ freetds-1.3.6/samples/Makefile.in000644 025423 025423 00000035364 14162303356 020332 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # version $Id: Makefile.am,v 1.3 2006-09-13 11:56:37 freddy77 Exp $ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = samples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SCRIPTS = $(noinst_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/mkinstalldirs \ README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_SCRIPTS = unixodbc.freetds.driver.template EXTRA_DIST = README debug.c dyntest.c odbc.ini odbctest.php \ odbctest.pl test.php test.pl \ unixodbc.freetds.driver.template.in \ unixodbc.install.sh \ unixodbc.jdbc.datasource.template SUFFIXES = .in edit = sed \ -e 's,@datadir\@,$(pkgdatadir),g' \ -e 's,@libdir\@,$(libdir),g' \ -e 's,@prefix\@,$(prefix),g' CLEANFILES = unixodbc.freetds.driver.template all: all-am .SUFFIXES: .SUFFIXES: .in $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign samples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign samples/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile unixodbc.freetds.driver.template: unixodbc.freetds.driver.template.in .in: rm -f $@ $@.tmp $(edit) $< >$@.tmp mv $@.tmp $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/samples/README000644 025423 025423 00000000224 14056414221 017124 0ustar00fredianofrediano000000 000000 The dblib and ctlib test programs in this directory are old. Please refer to the src/dblib/unittests and src/ctlib/unittests for better examples. freetds-1.3.6/samples/debug.c000644 025423 025423 00000003314 14056414221 017501 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #include #include #include static char software_version[] = "$Id: debug.c,v 1.2 2001-10-13 00:02:54 brianb Exp $"; static void *no_unused_var_warn[] = {software_version, no_unused_var_warn}; extern errno; get_incoming (int fd) { FILE *out; int len, i, offs=0; unsigned char buf[BUFSIZ]; out = fopen("client.out","w"); while ((len = read(fd, buf, BUFSIZ)) > 0) { fprintf (out,"len is %d\n",len); for (i=0;i=' ' && buf[i]<'z') fprintf(out," %c",buf[i]); fprintf(out,"\n"); } fflush(out); } close(fd); fclose(out); } freetds-1.3.6/samples/dyntest.c000644 025423 025423 00000007516 14056414221 020115 0ustar00fredianofrediano000000 000000 #include #include void execute(CS_COMMAND *cmd, char *id, CS_DATAFMT *datafmt, char *p1, char *p2, double p3, double p4) ; int main() { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_RETCODE ret; CS_RETCODE restype; CS_DATAFMT datafmt[10]; ret = cs_ctx_alloc(CS_VERSION_100, &ctx); ret = ct_init(ctx, CS_VERSION_100); ret = ct_con_alloc(ctx, &conn); ret = ct_con_props(conn, CS_SET, CS_USERNAME, "guest", CS_NULLTERM, NULL); ret = ct_con_props(conn, CS_SET, CS_PASSWORD, "sybase", CS_NULLTERM, NULL); /* ret = ct_con_props(conn, CS_SET, CS_IFILE, "/devl/t3624bb/myinterf", CS_NULLTERM, NULL); */ ret = ct_connect(conn, "JDBC", CS_NULLTERM); ret = ct_cmd_alloc(conn, &cmd); ret = ct_command(cmd, CS_LANG_CMD, "drop table tempdb..prepare_bug ", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); exit(1); } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); exit(1); } while(ct_results(cmd, &restype) == CS_SUCCEED) ; ret = ct_command(cmd, CS_LANG_CMD, "create table tempdb..prepare_bug (c1 char(20), c2 varchar(255), p1 float, p2 real) ", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); exit(1); } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); exit(1); } while(ct_results(cmd, &restype) == CS_SUCCEED) ; ct_dynamic(cmd, CS_PREPARE, "BUG", CS_NULLTERM, "insert tempdb..prepare_bug values(?, ?, ?, ?)", CS_NULLTERM); if(ct_send(cmd) != CS_SUCCEED) { fprintf(stderr,"ct_send failed in prepare"); exit(1); } while(ct_results(cmd, &restype) == CS_SUCCEED) ; /* ---- Sybase has now created a temporary stored proc ---- now - describe the parameters */ ct_dynamic(cmd, CS_DESCRIBE_INPUT, "BUG", CS_NULLTERM, NULL, CS_UNUSED); ct_send(cmd); while(ct_results(cmd, &restype) == CS_SUCCEED) { if(restype == CS_DESCRIBE_RESULT) { CS_INT num_param, outlen; int i; ct_res_info(cmd, CS_NUMDATA, &num_param, CS_UNUSED, &outlen); for(i = 1; i <= num_param; ++i) { ct_describe(cmd, i, &datafmt[i-1]); printf("column type: %d size: %d\n", datafmt[i-1].datatype, datafmt[i-1].maxlength); } } } /* ---- Now we have CS_DATAFMT struct for each of the input params ---- to the request. ---- so we can execute it with some parameters */ execute(cmd, "BUG", &datafmt[0], "test", "Jan 1 1988", 123.4, 222.334); /* ---- from now on it's a standard fetch all results loop... */ while(ct_results(cmd, &restype) == CS_SUCCEED) { printf("got restype %d\n", restype); if(restype == CS_ROW_RESULT) { int numcols, rows; char string[20]; int i, len, ind, ival; CS_DATAFMT output[2]; ct_res_info(cmd, CS_NUMDATA, &numcols, CS_UNUSED, NULL); for(i = 0; i < numcols; ++i) { ct_describe(cmd, (i + 1), &output[i]); if(output[i].datatype == CS_CHAR_TYPE) { ct_bind(cmd, (i + 1), &output[i], &string, &len, &ind); } else { ct_bind(cmd, (i + 1), &output[i], &ival, &len, &ind); } } while(ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows) == CS_SUCCEED) { printf("data = %.3s - %d\n", string, ival); } } } } void execute(CS_COMMAND *cmd, char *id, CS_DATAFMT *datafmt, char *p1, char *p2, double p3, double p4) { CS_INT restype; printf("execute called with %s, %s, %f, %f\n", p1, p2, p3, p4); ct_dynamic(cmd, CS_EXECUTE, id, CS_NULLTERM, NULL, CS_UNUSED); datafmt[0].datatype = CS_CHAR_TYPE; ct_param(cmd, &datafmt[0], p1, CS_NULLTERM, 0); datafmt[1].datatype = CS_CHAR_TYPE; ct_param(cmd, &datafmt[1], p2, CS_NULLTERM, 0); datafmt[2].datatype = CS_FLOAT_TYPE; ct_param(cmd, &datafmt[2], &p3, sizeof(double), 0); datafmt[3].datatype = CS_FLOAT_TYPE; ct_param(cmd, &datafmt[3], &p4, sizeof(double), 0); ct_send(cmd); } freetds-1.3.6/samples/odbc.ini000644 025423 025423 00000000460 14056414221 017656 0ustar00fredianofrediano000000 000000 ; ; odbc.ini ; [ODBC Data Sources] JDBC = Sybase JDBC Server [JDBC] Driver = /usr/local/lib/libtdsodbc.so Description = Sybase JDBC Server Trace = No Servername = JDBC Database = pubs2 UID = guest [Default] Driver = /usr/local/lib/libtdsodbc.so freetds-1.3.6/samples/odbctest.php000644 025423 025423 00000001050 14056414221 020562 0ustar00fredianofrediano000000 000000 freetds-1.3.6/samples/odbctest.pl000644 025423 025423 00000001020 14056414221 020403 0ustar00fredianofrediano000000 000000 #!/usr/local/bin/perl # $Id: odbctest.pl,v 1.2 2005-04-04 22:05:33 jklowden Exp $ use DBI; my ($dsn, $user, $pass, $sql) = @ARGV; $dsn = "dbi:ODBC:JDBC" unless $dsn; $user = 'guest' unless $user; $pass = 'sybase' unless $pass; $sql ="select \@\@servername" unless $sql; my $dbh = DBI->connect($dsn, $user, $pass, {PrintError => 1}); die "Unable for connect to server $DBI::errstr" unless $dbh; my $rc; my $sth = $dbh->prepare($sql); if($sth->execute) { while(@dat = $sth->fetchrow) { print "@dat\n"; } } freetds-1.3.6/samples/test.php000644 025423 025423 00000000453 14056414221 017740 0ustar00fredianofrediano000000 000000 \n"; } ?> freetds-1.3.6/samples/test.pl000644 025423 025423 00000001134 14056414221 017561 0ustar00fredianofrediano000000 000000 #!/usr/bin/perl # use DBI; my ($servername, $username, $password) = @ARGV; $servername = 'JDBC' unless $servername; $username = 'guest' unless $username; $password = 'sybase' unless $password; my $dbh = DBI->connect("dbi:Sybase:server=$servername", $username, $password, {PrintError => 0}); die "Unable for connect to server $DBI::errstr" unless $dbh; my $rc; my $sth; if (@ARGV > 3) { $query = $ARGV[3]; } else { $query = "select \@\@version"; } $sth = $dbh->prepare($query); print $sth->{"ChopBlanks"} = 0; if($sth->execute) { while(@dat = $sth->fetchrow) { print "@dat\n"; } } freetds-1.3.6/samples/unixodbc.freetds.driver.template.in000644 025423 025423 00000002025 14056414221 025147 0ustar00fredianofrediano000000 000000 # # $Id: unixodbc.freetds.driver.template.in,v 1.2 2006-09-13 11:56:37 freddy77 Exp $ # # FreeTDS - Library of routines accessing Sybase and Microsoft databases # Copyright (C) 1998-1999 Brian Bruns # # 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # [FreeTDS] Description = FreeTDS unixODBC Driver Driver = @libdir@/libtdsodbc.so Setup = @libdir@/libtdsodbc.so freetds-1.3.6/samples/unixodbc.install.sh000755 025423 025423 00000002607 14056414221 022072 0ustar00fredianofrediano000000 000000 #! /bin/sh # # $Id: unixodbc.install.sh,v 1.1 2002-10-09 17:05:44 castellano Exp $ # # FreeTDS - Library of routines accessing Sybase and Microsoft databases # Copyright (C) 1998-1999 Brian Bruns # # 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Run this script as root to install FreeTDS unixODBC drivers and datasources. # # You will most likely want to edit unixodbc.jdbc.datasource.template # to add your own dataserver instead of the public Sybase dataserver. # # For more information about these template files, please see # http://www.unixodbc.org/doc/FreeTDS.html # # Install driver. odbcinst -i -d -f unixodbc.freetds.driver.template # Install system datasource. odbcinst -i -s -l -f unixodbc.jdbc.datasource.template freetds-1.3.6/samples/unixodbc.jdbc.datasource.template000644 025423 025423 00000002031 14056414221 024644 0ustar00fredianofrediano000000 000000 # # $Id: unixodbc.jdbc.datasource.template,v 1.1 2002-10-09 17:05:44 castellano Exp $ # # FreeTDS - Library of routines accessing Sybase and Microsoft databases # Copyright (C) 1998-1999 Brian Bruns # # 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # [JDBC] Driver = FreeTDS Description = Sybase JDBC Server Trace = No Servername = JDBC Database = pubs2 UID = guest freetds-1.3.6/doc/Makefile.am000644 025423 025423 00000015760 14107141721 017413 0ustar00fredianofrediano000000 000000 # Converting DocBook to HTML (several small files) # http://www.freebsd.org/tutorials/docproj-primer/x3132.html#AEN3140 SHELL = /bin/sh DOCDIR = . TARGET_DOCDIR = $(DESTDIR)$(docdir) EXTRA_DIST = api_status.txt bcp.txt cap.txt getting_started.txt \ policy.txt CodingStyle tds.html \ userguide.xsl userguide.xml userguide.css \ $(man_MANS) \ $(DOCDIR)/userguide $(DOCDIR)/reference \ images grep_sample_code tds_ssl.html \ freebcp.1.in tsql.1.in osql.1.in bsqldb.1.in bsqlodbc.1.in \ defncopy.1.in datacopy.1.in fisql.1.in freetds.conf.5.in \ userguide_desc.xml man_MANS = freebcp.1 \ tsql.1 \ osql.1 \ bsqldb.1 \ bsqlodbc.1 \ defncopy.1 \ datacopy.1 \ fisql.1 \ freetds.conf.5 noinst_DATA = $(DOCDIR)/reference/index.html $(DOCDIR)/userguide/index.html $(DOCDIR)/userguide: $(DOCDIR)/userguide/index.html $(DOCDIR)/reference: $(DOCDIR)/reference/index.html doc: $(DOCDIR)/userguide $(DOCDIR)/reference dist: man man: $(man_MANS) INSTALLDIRS = $(TARGET_DOCDIR)/userguide \ $(TARGET_DOCDIR)/reference \ $(TARGET_DOCDIR)/images \ $(TARGET_DOCDIR)/images/callouts $(INSTALLDIRS) $(DOCDIR): $(MKDIR_P) $@ 2>&1 # If we built the documentation ourselves, install that, # else if we have access to distributed documentation, install that. install-data-local: $(INSTALLDIRS) $(noinst_DATA) $(MKDIR_P) $(DOCDIR) 2>&1 if test -r $(DOCDIR)/userguide ; then d=.; else d="$(srcdir)"; fi; \ find $$d/$(DOCDIR)/userguide \( -type f -o -type l \) \ -exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/userguide ';' if test -r $(DOCDIR)/reference ; then d=.; else d="$(srcdir)"; fi; \ find $$d/$(DOCDIR)/reference \( -type f -o -type l \) \ -exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/reference ';' cd $(srcdir) && find images -name \*.gif \ -exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/{} ';' uninstall-local: rm -rf $(TARGET_DOCDIR) clean-local: rm -rf doxy.log \ dblib.api.xml \ ctlib.api.xml \ odbc.api.xml ## In building the UG and reference manual, we confront several ## possible situations: ## 1. GIT user (or developer) with or without xmlto/doxygen installed. ## 2. Distribution user. The distribution includes pre-built ## documentation, ready to install. ## Either of these users may choose to build out-of-tree (e.g., in a ## build/ directory). We want to build the docs if we can, link to ## distributed ones if they exist, else create stub files pointing to ## the website. ## ## We build the documentation only if we found xmlto. ## If the user builds FreeTDS out of tree, "make install" will put a symlink ## to the distributed UG HTML in the build directory, and install per usual. ## ## In the case of Doxygen, we detect its presence in the configure ## script, and invoke it if found. If it is not found, we try to link ## the build tree's reference manual HTML to the distribution. If ## that fails, we install a stub. DISTRIBUTED_UG_DIR = $(srcdir)/$(DOCDIR)/userguide UG_STUB = \

at www.freetds.org \ userguide_desc.xml: userguide.xml git log -1 '--pretty=format:%n%n' HEAD -- $< > $@~ mv -f $@~ $@ # To make the userguide, install xmlto $(DOCDIR)/userguide/index.html: $(DOCDIR) userguide.xml userguide_desc.xml \ dblib.api.xml ctlib.api.xml odbc.api.xml \ userguide.xsl api_status.txt if test -h userguide; then rm userguide; fi $(MKDIR_P) $(DOCDIR)/userguide 2>&1 touch $(DOCDIR)/userguide/t.htm rm -rf $(DOCDIR)/userguide/* # if we're not using xmlto, copy the distribution's userguide if ! xmlto --version > /dev/null 2> /dev/null ; then \ if test -r $(DISTRIBUTED_UG_DIR) \ -a ! -r $(DOCDIR)/userguide ; then \ cp -R $(DISTRIBUTED_UG_DIR) $(DOCDIR); \ fi; \ fi # try xmlto ... test -r "$(abs_srcdir)/userguide.xml" test -r userguide.xml || ln -s $(srcdir)/userguide.xml userguide.xml test -r userguide.xsl || ln -s $(srcdir)/userguide.xsl userguide.xsl test -r userguide_desc.xml || ln -s $(srcdir)/userguide_desc.xml userguide_desc.xml (cd $(DOCDIR)/userguide && \ if xmlto --version > /dev/null 2> /dev/null ; then \ xmlto -m ../userguide.xsl xhtml ../userguide.xml; \ ## and copy the stylesheet cp "$(abs_srcdir)/userguide.css" .; \ fi) # if still no joy, create a stub if test ! -r $@ ; then \ echo '$(UG_STUB)' > .index.html && mv .index.html $@; \ fi test -f $(DOCDIR)/userguide/index.html userguide: $(DOCDIR)/userguide/index.html reference: $(DOCDIR)/reference/index.html DISTRIBUTED_REF_DIR = $(srcdir)/$(DOCDIR)/reference REF_STUB = \

at www.freetds.org \ $(DOCDIR)/reference/index.html: $(top_srcdir)/configure.ac if test -h reference; then rm reference; fi $(MKDIR_P) $(DOCDIR)/reference 2>&1 cd .. && $(MAKE) doxy 2> doc/doxy.log # If "make doxy" doesn't create anything, # try to copy the distributed manual's HTML if test -r $(DISTRIBUTED_REF_DIR)/index.html -a ! $@ ; then \ cp -R $(DISTRIBUTED_REF_DIR) $(DOCDIR); \ fi # If we don't find the source, generate a stub. if test ! -r $@ ; then \ cd $(DOCDIR)/reference && \ echo '$(REF_STUB)' > .index.html && \ mv .index.html index.html; \ fi # # The following sections generate API implementation reference tables # as XML "entities". # The entities are used a little bit like include files in the UG, e.g.: # # # and "dblibapixml" is referred to later on: # # # db-lib API Implementation Summary # &dblibapixml; # # # This lets us use the api_status.txt document in our XML. # API_TABLE_HEADING = \ \ Category \ Function \ Status \ Comments \ API_FUNC_COL = Function API_DBLIB_FUNC_COLS = Microsoft nameSybase name API_PAGE_FMT = \ \ &%s; API Implementation Summary\n \ \n \ %s\n \ \n \ %s\n \
\n dblib.api.body ctlib.api.body odbc.api.body: $(srcdir)/api_status.txt NAME=`echo $@ | sed 's/\..*$$//'` && \ sed -ne "/^$${NAME}[ ]/ s!!!p" \ $(srcdir)/api_status.txt \ | sed -e's![ ][ ]*! !g' \ -e's!$$!!' > $@~ mv $@~ $@ dblib.api.xml: dblib.api.body ctlib.api.xml: ctlib.api.body odbc.api.xml: odbc.api.body dblib.api.xml ctlib.api.xml odbc.api.xml: NAME=`echo $@ | sed 's/\..*$$//'` && \ HEAD='$(API_TABLE_HEADING)' && \ if [ $${NAME} = dblib ]; then \ HEAD=`echo '$(API_TABLE_HEADING)' \ | sed 's!$(API_FUNC_COL)!$(API_DBLIB_FUNC_COLS)!'`; \ fi && \ BODY=`cat $(@:.xml=.body)` && \ printf '$(API_PAGE_FMT)' $${NAME} $${NAME} "$${HEAD}" "$${BODY}" > $@~ mv $@~ $@ CLEANFILES = dblib.api.body ctlib.api.body odbc.api.body dblib.api.xml ctlib.api.xml odbc.api.xml $(man_MANS) distclean-local: rm -rf $(DOCDIR)/userguide $(DOCDIR)/reference freetds-1.3.6/doc/Makefile.in000644 025423 025423 00000064560 14162303356 017433 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # Converting DocBook to HTML (several small files) # http://www.freebsd.org/tutorials/docproj-primer/x3132.html#AEN3140 VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = freebcp.1 tsql.1 osql.1 bsqldb.1 bsqlodbc.1 \ defncopy.1 datacopy.1 fisql.1 freetds.conf.5 CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" man5dir = $(mandir)/man5 NROFF = nroff MANS = $(man_MANS) DATA = $(noinst_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/bsqldb.1.in \ $(srcdir)/bsqlodbc.1.in $(srcdir)/datacopy.1.in \ $(srcdir)/defncopy.1.in $(srcdir)/fisql.1.in \ $(srcdir)/freebcp.1.in $(srcdir)/freetds.conf.5.in \ $(srcdir)/osql.1.in $(srcdir)/tsql.1.in \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = /bin/sh STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DOCDIR = . TARGET_DOCDIR = $(DESTDIR)$(docdir) EXTRA_DIST = api_status.txt bcp.txt cap.txt getting_started.txt \ policy.txt CodingStyle tds.html \ userguide.xsl userguide.xml userguide.css \ $(man_MANS) \ $(DOCDIR)/userguide $(DOCDIR)/reference \ images grep_sample_code tds_ssl.html \ freebcp.1.in tsql.1.in osql.1.in bsqldb.1.in bsqlodbc.1.in \ defncopy.1.in datacopy.1.in fisql.1.in freetds.conf.5.in \ userguide_desc.xml man_MANS = freebcp.1 \ tsql.1 \ osql.1 \ bsqldb.1 \ bsqlodbc.1 \ defncopy.1 \ datacopy.1 \ fisql.1 \ freetds.conf.5 noinst_DATA = $(DOCDIR)/reference/index.html $(DOCDIR)/userguide/index.html INSTALLDIRS = $(TARGET_DOCDIR)/userguide \ $(TARGET_DOCDIR)/reference \ $(TARGET_DOCDIR)/images \ $(TARGET_DOCDIR)/images/callouts DISTRIBUTED_UG_DIR = $(srcdir)/$(DOCDIR)/userguide UG_STUB = \

at www.freetds.org \ DISTRIBUTED_REF_DIR = $(srcdir)/$(DOCDIR)/reference REF_STUB = \

at www.freetds.org \ # # The following sections generate API implementation reference tables # as XML "entities". # The entities are used a little bit like include files in the UG, e.g.: # # # and "dblibapixml" is referred to later on: # # # db-lib API Implementation Summary # &dblibapixml; # # # This lets us use the api_status.txt document in our XML. # API_TABLE_HEADING = \ \ Category \ Function \ Status \ Comments \ API_FUNC_COL = Function API_DBLIB_FUNC_COLS = Microsoft nameSybase name API_PAGE_FMT = \ \ &%s; API Implementation Summary\n \ \n \ %s\n \ \n \ %s\n \
\n CLEANFILES = dblib.api.body ctlib.api.body odbc.api.body dblib.api.xml ctlib.api.xml odbc.api.xml $(man_MANS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): freebcp.1: $(top_builddir)/config.status $(srcdir)/freebcp.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ tsql.1: $(top_builddir)/config.status $(srcdir)/tsql.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ osql.1: $(top_builddir)/config.status $(srcdir)/osql.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ bsqldb.1: $(top_builddir)/config.status $(srcdir)/bsqldb.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ bsqlodbc.1: $(top_builddir)/config.status $(srcdir)/bsqlodbc.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ defncopy.1: $(top_builddir)/config.status $(srcdir)/defncopy.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ datacopy.1: $(top_builddir)/config.status $(srcdir)/datacopy.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ fisql.1: $(top_builddir)/config.status $(srcdir)/fisql.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ freetds.conf.5: $(top_builddir)/config.status $(srcdir)/freetds.conf.5.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man5: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.5[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-local dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-data-local install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-man5 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-local uninstall-man uninstall-man: uninstall-man1 uninstall-man5 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ clean-local cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distclean-local distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-data-local install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man1 \ install-man5 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags-am uninstall uninstall-am uninstall-local \ uninstall-man uninstall-man1 uninstall-man5 .PRECIOUS: Makefile $(DOCDIR)/userguide: $(DOCDIR)/userguide/index.html $(DOCDIR)/reference: $(DOCDIR)/reference/index.html doc: $(DOCDIR)/userguide $(DOCDIR)/reference dist: man man: $(man_MANS) $(INSTALLDIRS) $(DOCDIR): $(MKDIR_P) $@ 2>&1 # If we built the documentation ourselves, install that, # else if we have access to distributed documentation, install that. install-data-local: $(INSTALLDIRS) $(noinst_DATA) $(MKDIR_P) $(DOCDIR) 2>&1 if test -r $(DOCDIR)/userguide ; then d=.; else d="$(srcdir)"; fi; \ find $$d/$(DOCDIR)/userguide \( -type f -o -type l \) \ -exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/userguide ';' if test -r $(DOCDIR)/reference ; then d=.; else d="$(srcdir)"; fi; \ find $$d/$(DOCDIR)/reference \( -type f -o -type l \) \ -exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/reference ';' cd $(srcdir) && find images -name \*.gif \ -exec $(INSTALL) -m 644 {} $(TARGET_DOCDIR)/{} ';' uninstall-local: rm -rf $(TARGET_DOCDIR) clean-local: rm -rf doxy.log \ dblib.api.xml \ ctlib.api.xml \ odbc.api.xml userguide_desc.xml: userguide.xml git log -1 '--pretty=format:%n%n' HEAD -- $< > $@~ mv -f $@~ $@ # To make the userguide, install xmlto $(DOCDIR)/userguide/index.html: $(DOCDIR) userguide.xml userguide_desc.xml \ dblib.api.xml ctlib.api.xml odbc.api.xml \ userguide.xsl api_status.txt if test -h userguide; then rm userguide; fi $(MKDIR_P) $(DOCDIR)/userguide 2>&1 touch $(DOCDIR)/userguide/t.htm rm -rf $(DOCDIR)/userguide/* # if we're not using xmlto, copy the distribution's userguide if ! xmlto --version > /dev/null 2> /dev/null ; then \ if test -r $(DISTRIBUTED_UG_DIR) \ -a ! -r $(DOCDIR)/userguide ; then \ cp -R $(DISTRIBUTED_UG_DIR) $(DOCDIR); \ fi; \ fi # try xmlto ... test -r "$(abs_srcdir)/userguide.xml" test -r userguide.xml || ln -s $(srcdir)/userguide.xml userguide.xml test -r userguide.xsl || ln -s $(srcdir)/userguide.xsl userguide.xsl test -r userguide_desc.xml || ln -s $(srcdir)/userguide_desc.xml userguide_desc.xml (cd $(DOCDIR)/userguide && \ if xmlto --version > /dev/null 2> /dev/null ; then \ xmlto -m ../userguide.xsl xhtml ../userguide.xml; \ cp "$(abs_srcdir)/userguide.css" .; \ fi) # if still no joy, create a stub if test ! -r $@ ; then \ echo '$(UG_STUB)' > .index.html && mv .index.html $@; \ fi test -f $(DOCDIR)/userguide/index.html userguide: $(DOCDIR)/userguide/index.html reference: $(DOCDIR)/reference/index.html $(DOCDIR)/reference/index.html: $(top_srcdir)/configure.ac if test -h reference; then rm reference; fi $(MKDIR_P) $(DOCDIR)/reference 2>&1 cd .. && $(MAKE) doxy 2> doc/doxy.log # If "make doxy" doesn't create anything, # try to copy the distributed manual's HTML if test -r $(DISTRIBUTED_REF_DIR)/index.html -a ! $@ ; then \ cp -R $(DISTRIBUTED_REF_DIR) $(DOCDIR); \ fi # If we don't find the source, generate a stub. if test ! -r $@ ; then \ cd $(DOCDIR)/reference && \ echo '$(REF_STUB)' > .index.html && \ mv .index.html index.html; \ fi dblib.api.body ctlib.api.body odbc.api.body: $(srcdir)/api_status.txt NAME=`echo $@ | sed 's/\..*$$//'` && \ sed -ne "/^$${NAME}[ ]/ s!!!p" \ $(srcdir)/api_status.txt \ | sed -e's![ ][ ]*! !g' \ -e's!$$!!' > $@~ mv $@~ $@ dblib.api.xml: dblib.api.body ctlib.api.xml: ctlib.api.body odbc.api.xml: odbc.api.body dblib.api.xml ctlib.api.xml odbc.api.xml: NAME=`echo $@ | sed 's/\..*$$//'` && \ HEAD='$(API_TABLE_HEADING)' && \ if [ $${NAME} = dblib ]; then \ HEAD=`echo '$(API_TABLE_HEADING)' \ | sed 's!$(API_FUNC_COL)!$(API_DBLIB_FUNC_COLS)!'`; \ fi && \ BODY=`cat $(@:.xml=.body)` && \ printf '$(API_PAGE_FMT)' $${NAME} $${NAME} "$${HEAD}" "$${BODY}" > $@~ mv $@~ $@ distclean-local: rm -rf $(DOCDIR)/userguide $(DOCDIR)/reference # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/doc/bsqldb.1.in000644 025423 025423 00000006672 14056414221 017320 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 26, 2015 .Dt BSQLDB 1 .Os FreeTDS @VERSION@ .Sh NAME .Nm bsqldb .Nd batch SQL script processor using DB-Library .Sh SYNOPSIS .Nm .Op Fl hqv .Op Fl S Ar servername .Op Fl D Ar database .Op Fl U Ar username .Op Fl P Ar password .Op Fl i Ar input_file .Op Fl o Ar output_file .Op Fl e Ar error_file .Op Fl H Ar hostname .Op Fl t Ar field_term .Op Fl R Ar pivot_description .\" .Sh DESCRIPTION .Nm is a utility program distributed with FreeTDS. .Nm is a non-interactive equivalent of the "isql" utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command "go" on a line by itself as a separator between batches. The last batch need not be followed by "go". .Nm makes use of the DB-Library API provided by FreeTDS. This API is of course also available to application developers. .Sh OPTIONS .Bl -tag -width indent .It Fl D Ar database Database to use. .It Fl H Ar hostname hostname Override name of client sent to server. .It Fl P Ar password Database server password. .It Fl S Ar servername Database server to which to connect. .It Fl U Ar username Database server login name. If username is not provided, a domain login is attempted for TDS 7+ connections. .It Fl e Ar error_file Name of file for errors. .It Fl h Print column headers with the data to the same file. .It Fl i Ar input_file Name of script file, containing SQL. .It Fl o Ar output_file Name of output file, holding result data. .It Fl q Do not print column metadata, return status, or rowcount. Overrides .Fl h Ns . .It Fl t Ar field_term Specifies the field terminator. Default is two spaces (' '). Recognized escape sequences are tab ('\\t'), carriage return ('\\r'), newline ('\\n'), and backslash ('\\\\'). .It Fl v Verbose mode, for more information about the DB-Library interaction. This also reports the result set metadata, including and return code. All verbose data are written to standard error (or .Fl e Ns ), so as not to interfere with the data stream. .It Fl R Ar pivot_description Specify pivot trasformation. The format is .Ao Ar down\ columns Ac .Ao Ar across\ columns Ac .Ao Ar function Ac .Ao Ar value Ac . Columns are specified but numbers. The format of .Ar down columns and .Ar across columns is a comma separated list of columns. .Ar function is either count, sum, min or max. .El .\" .Sh ENVIRONMENT .Ev DSQUERY default .Ar servername .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i Ns , Fl o Ns , and Fl e options override these defaults. .Pp The source code for .Nm is intended as a model for DB-Library users. DB-Library has a rich set of functions, and it can be hard sometimes to understand how to use them, particularly the first time. If you find something about the source code unclear, you are encouraged to email the author your comments. .\" .Sh EXIT STATUS .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp For messages with severity > 10, .Nm calls exit(3) with the severity level. For example, if the severity level is 16, .Nm will return an exit status of 16 to the shell. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.63. .\" .Sh AUTHORS The .Nm utility was written by .An "James K. Lowden" Aq jklowden@freetds.org . .\" .Sh BUGS Microsoft servers as of SQL Server 7.0 SP 3 do not return output parameters unless the RPC functions are used. This means .Nm cannot return output parameters for stored procedures with these servers. freetds-1.3.6/doc/bsqlodbc.1.in000644 025423 025423 00000004523 14056414221 017633 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS @VERSION@ .Dt BSQLODBC FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm bsqlodbc .Nd batch SQL script processor using ODBC .\" .Sh SYNOPSIS .Pp .Nm .Op Fl hqv .Op Fl U Ar username .Op Fl P Ar password .Op Fl S Ar server .Op Fl D Ar database .Op Fl i Ar input_file .Op Fl o Ar output_file .Op Fl e Ar error_file .Op Fl t Ar field_term .Op Fl V Ar odbc_version .\" .Sh DESCRIPTION .Pp .Nm is a utility program distributed with FreeTDS. .Pp .Nm is a non-interactive equivalent of the .Ql isql utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command .Ql go on a line by itself as a separator between batches. The last batch need not be followed by .Ql go . .Pp .Nm makes use of the ODBC API provided by FreeTDS. This API is of course also available to application developers. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl U Ar username Database server login name. .It Fl P Ar password Database server password. .It Fl S Ar server Database server to which to connect. .It Fl D Ar database Database to use. .It Fl i Ar input_file Name of script file, containing SQL. .It Fl o Ar output_file Name of output file, holding result data. .It Fl e Ar error_file Name of file for errors. .It Fl t Ar field_term Specifies the field terminator. Default is two spaces ( .Ql \ \ .Ns ). Recognized escape sequences are tab ( .Ql \et .Ns ), carriage return ( .Ql \er .Ns ), newline ( .Ql \en .Ns ), and backslash ( .Ql \e\e .Ns ). .It Fl h Print column headers with the data to the same file. .It Fl q Do not print column metadata, return status, or rowcount. Overrides .Fl h . .It Fl v Verbose mode, for more information about the ODBC interaction. This also reports the result set metadata, including and return code. All verbose data are written to standard error (or .Fl e Ns ), so as not to interfere with the data stream. .It Fl V Ar odbc_version Specify ODBC version (2 or 3). .El .\" .Sh NOTES .Pp .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i , .Fl o , and .Fl e options override these defaults. .Sh EXIT STATUS .Nm exits 0 on success, and >0 if the server cannot process the query. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Aq jklowden@freetds.org . freetds-1.3.6/doc/datacopy.1.in000644 025423 025423 00000004563 14056414221 017652 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS @VERSION@ .Dt DATACOPY FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm datacopy .Nd move table data between two servers .\" .Sh SYNOPSIS .Nm .Op Fl vdE .Bro .Fl t | .Fl a | .Fl c .Ar owner .Brc .Op Fl b Ar batchsize .Op Fl p Ar packetsize .Op Fl S Ar server/username/password/database/table_or_view .Op Fl D Ar server/username/password/database/table .Op Fl T Ar textsize .\" .Sh DESCRIPTION .Nm is a utility distributed with FreeTDS. .Nm will move table data from one server to another without the need for intermediate files. .Nm is much faster and more efficient than is freebcp out/in. .Pp .Nm makes use of the db-lib bcp API built into FreeTDS. This API is also available to application developers. .Pp .Nm can be used to migrate data between Sybase ASE and SQL Server or vice versa. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl t Truncate target table before loading data. .It Fl a Append data to target table. .It Fl c Ar owner Create the target table with the same schema as the source table. .Nm will submit a .Ql CREATE TABLE command on the target server using the specified owner in the command, e.g. .Ql CREATE TABLE owner.table (.\|.\|.\&). .It Fl b Ar batchsize The number of rows per batch of data copied. Each batch of data is effectively 'committed' to the database. The default is 1000. .It Fl p Ar packetsize The number of bytes, per network packet, sent to and from the servers. Increased packet size can enhance performance. .It Fl T Ar textsize Specify size of TEXT/IMAGE column from network. .It Fl v Produce verbose output, including diagnostic timings. .It Fl d Produce freetds TDSDUMP output. (Serious debug only!) .It Fl S Ar server/username/password/database/table_or_view The connection information for the source server and the location/name of the table (or view) to be copied. If not specified, .Nm prompts the user for the information. .It Fl D Ar server/username/password/database/table The connection information for the destination server and the location/name of the target table. If not specified, .Nm prompts the user for the information. .It Fl E Keep identity values. .Sh SEE ALSO .Xr freebcp 1 , Xr defncopy 1 , Xr bsqldb 1 , Xr tsql 1 , .%B FreeTDS User Guide. .\" .Sh HISTORY .Pp .Nm first appeared in FreeTDS 0.64. .\" .Sh AUTHORS The .Nm utility was written by .An Bill Thompson Aq thompbil@exchange.uk.ml.com . freetds-1.3.6/doc/defncopy.1.in000644 025423 025423 00000005077 14056414221 017656 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd April 26, 2012 .Os FreeTDS @VERSION@ .Dt DEFNCOPY FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm defncopy .Nd extract procedures and views from a Microsoft server. .\" .Sh SYNOPSIS .Pp .Nm .Op Fl v .Op Fl U Ar username .Op Fl P Ar password .Op Fl S Ar server .Op Fl D Ar database .Op Fl i Ar input_file .Op Fl o Ar output_file .Bo .Ar owner.object_name .\" Elipsis according to Werner Lemberg: .\" http://www.mail-archive.com/groff@gnu.org/msg03122.html .Op Ar owner.object_name .\|.\|.\& .Bc .\" .Sh DESCRIPTION .Pp .Nm is a utility program distributed with FreeTDS. It replaces a similar program of the same name distributed by Sybase. .Pp .Nm reads the text of a stored procedure or view, and writes a script suitable for recreating the procedure or view. For tables, it reads the output of sp_help and constructs a .Ql CREATE TABLE statement, complete with .Ql CREATE INDEX Ns , too. .\" .Ar owner is optional if you or the database owner is the owner of the procedure/view being copied. .Ar object_name is the name of the system object you wish to extract. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl U Ar username database server login name. .It Fl P Ar password database server password. .It Fl S Ar server database server to which to connect. .It Fl D Ar database database to use. Optional if the procedure/view being extracted is in your default database. .It Fl i Ar input_file a script to apply to the database. Not currently implemented. .It Fl o Ar output_file a file to hold the script, defaults to standard output. .It Fl v Show version information and copyright notice. .El .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i , .Fl o , and .Fl e options override these defaults. .Pp .Nm makes use of the db-lib API provided by FreeTDS. This API is of course also available to application developers. .Sh EXIT STATUS .Pp .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp .Nm will report any errors returned by the server, but will continue processing. .\" .Sh HISTORY .Pp .Nm first appeared in FreeTDS 0.63. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Aq jklowden@schemamania.org. .\" .Sh BUGS Works only with Microsoft servers and ancient Sybase servers. Does not create primary keys. Many options are defined by Sybase that this version does not implement. Feel free to correct this situation. In theory, .Nm could apply/produce DDL for any system object, but at present only tables, procedures and views are supported, and only for extraction. freetds-1.3.6/doc/fisql.1.in000644 025423 025423 00000010074 14056414221 017156 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS @VERSION@ .Dt FISQL FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm fisql .Nd interactive SQL shell .\" .Sh SYNOPSIS .Pp .Nm .Op Fl eFgpnvXY .Op Fl a Ar display_charset .Op Fl A Ar packet_size .Op Fl c Ar cmdend .Op Fl D Ar database .Op Fl E Ar editor .Op Fl h Ar headers .Op Fl H Ar hostname .Op Fl i Ar inputfile .Op Fl I Ar interfaces_file .Op Fl J Ar client_charset .Op Fl l Ar login_timeout .Op Fl m Ar errorlevel .Op Fl o Ar outputfile .Op Fl P Ar password .Op Fl s Ar colseparator .Op Fl S Ar server .Op Fl t Ar timeout .Op Fl U Ar username .Op Fl w Ar width .Op Fl y Ar sybase_dir .Op Fl z Ar language .\" .Sh DESCRIPTION .Pp .Nm is very similar to the .Ql isql utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command .Ql go on a line by itself as a separator between batches. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl a Ar display_charset The client charset name. Not implemented. .It Fl A Ar packet_size Set protocol packet size. You should not need to set this parameter. .It Fl c Ar cmdend Command terminator, defaults to .Ql go Ns . .It Fl D Database name on the server to use. .It Fl e Echo SQL input (usually in outputfile) .It Fl E Ar editor Specify an editor to invoke. Defaults to vi. .It Fl F FIPS mode ON. Server returns a message (but processes the query anyway) when it encounters a non-standard SQL command. .It Fl g Display a brief help message .It Fl h Ar headers Number of rows after which to repeat the column headers. Default is once per resultset. .It Fl H Ar hostname Hostname of the client machine as it will be told to the server. .It Fl I Ar interfaces_file Name of the interfaces or freetds.conf file to use. .It Fl i Ar inputfile Name of script file, containing SQL. .It Fl J Ar client_charset Not implemented. .It Fl l Ar login_timeout How long to wait for the server to acknowledge a login attempt. .It Fl m Ar errorlevel For errors of the severity level specified or higher, print only the message number, state, and error level. Below that level, print nothing. .It Fl n Suppress line numbers in echoed output. .It Fl o Ar outputfile Name of output file, holding result data. .It Fl p Prints performance statistics. Not implemented. .It Fl P Ar password Database server password. .It Fl s Ar colseparator The column separator. Default is space. Shell metacharacters require quoting. .It Fl S Ar server Database server to which to connect. .It Fl t Ar timeout The query timeout, in seconds. How long to wait for a query to be processed. The default is indefinitely, or as determined by freetds.conf. .It Fl U Ar username Database server login name. .It Fl v Display version and copyright. .It Fl w Ar width How many characters wide to print the output. Defaults to 80. .It Fl X Use encrypted login. Not implemented in FreeTDS. .It Fl y Pa sybase_dir Sets the .Ev SYBASE environment variable. Not used by FreeTDS. .It Fl Y Use chained transactions. .It Fl z Ar language Name of a language for fisql's prompts and messages. Cf. DBSETLNATLANG. .El .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i Ns , .FL o Ns , and .Fl e options override these defaults. .Pp .Nm uses the DB-Library API provided by FreeTDS. It was first implemented using Sybase's own library and continues to work with it. Before (and after) modifying it, it would be well to test it with Sybase's library to assure compatibility between it and FreeTDS. EXIT STATUS .Pp .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp .Nm will report any errors returned by the server, but will continue processing. In a production environment, this behavior may be insufficiently stringent. To make it extremely intolerant of errors, change the message and error handlers to call exit(3). .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An Nicholas S. Castellano Aq entropy@freetds.org Ns , who contributed it to the FreeTDS project under the terms of the GPL. .\" .Sh BUGS Requires the GNU readline library. freetds-1.3.6/doc/freebcp.1.in000644 025423 025423 00000014323 14056414221 017447 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS @VERSION@ .Dt FREEBCP 1 .Sh NAME .Nm freebcp .Nd bulk loading utility for Sybase and Microsoft databases .Sh SYNOPSIS .Nm .Bo Bo Ao Ar database Ac Ns . Bc Ns Ao Ar owner Ac Ns . Bc Ns Aq Ar object_name .Bro .Ar in | .Ar [query] Ns Ar out .Brc .Ar datafile .Bro .Fl c | .Fl n | .Fl f Ar formatfile .Brc .Op Fl S Ar servername .Op Fl D Ar dbname .Op Fl U Ar username .Op Fl P Ar password .Op Fl b Ar batchsize .Op Fl F Ar firstrow .Op Fl L Ar lastrow .Op Fl e Ar errfile .Op Fl I Ar interfaces .Op Fl m Ar maxerror .Op Fl t Ar field_term .Op Fl r Ar row_term .Op Fl h Ar hints .Op Fl T Ar textsize .Op Fl A Ar packet_size .Op Fl O Ar options .Op Fl i Ar inputfile .Op Fl o Ar outputfile .Op Fl C Ar charset .Op Fl EdVv .\" .Sh DESCRIPTION .Nm is a utility program distributed with FreeTDS. .Nm replicates (in part at least) the functionality of the bcp utility programs distributed by Sybase and Microsoft. .Nm makes use of the DB-Library bcp API provided by FreeTDS. This API is also available to application developers. .Pp The manual pages or online help for Sybase or SQL Server can be referenced for more detailed information on bcp functionality. .\" .Sh TABLES\ AND\ FILES .Bl -tag -width indent .It Ar database The name of the database containing object to be copied. Optional if the table/view is in the default database for .Ar username . .It Ar schema The schema of the object being copied. If not provided, the default schema for .Ar username is used. .It Ar object The name of the database object you wish to access, typically a table. It can also be a view. All views can be read; some can be written, subject to constraints. With .Ar queryout Ns , Ar object can also be an SQL query. .It Ar in Copy data from a host file to a database table. .It Ar out Copy data from a database table to a host file. .It Ar queryout indicates that .Ar table_name is in fact SQL, rather than a database object. .Nm will execute the query and write the results to a file. (It is a good idea to have the query return one and only one result set.) .It Ar datafile The name of an operating system file. .El .\" .Sh OPTIONS .Bl -tag -width indent .It Fl A Ar packet_size Set the size of a TDS packet to packet_size. Not sure why you would want to do this, except as an experiment. .It Fl D Ar dbname The name of the default database to use. Overrides default database associated with the login account. Causes .Nm to issue a .Ic USE Ar dbname command immediately after logging in, before commencing BCP operations. .It Fl E Write the data in datafile to the table's IDENTITY column. Without this flag, the identity data present in the datafile will be ignored, and new IDENTITY values will be generated for the imported rows. .It Fl F Ar firstrow The first row to copy from the input file or database table. The default is the first row, row 1. .It Fl I Ar interfaces The name and location of the .Pa interfaces file to search when connecting to servername. Overrides .Pa freetds.conf. .It Fl L Ar lastrow The last row to copy from an input file or database table. The default is the last row. .It Fl O Ar options SQL text to set connection options prior to the bcp operation. If .Ar options is a valid filename, the SQL is read from the file instead. Sometimes needed for .Ar queryout . Example: .Li -O `SET QUOTED_IDENTIFIER ON' Ns . .It Fl P Ar password The password associated with .Ar username . .It Fl S Ar servername The name of the Database Server to which to connect. .It Fl T Ar textsize For text or image columns, set the maximum number of characters to request from the server. Defaults to the setting in .Pa freetds.conf . If not specified anywhere, defaults to the full size of the data. .It Fl U Ar username A database login name. For TDS\ 7+ connections, a domain login is attempted if .Ar username is not provided. .It Fl b Ar batchsize The number of rows per batch of data copied. Batching applies only when you are bulk copying into the database. Each batch of data is effectively .Dq committed into the database. The default value for .Ar batchsize is 1000. .It Fl c The host data file is (or will be) in "character" format, i.e., a text file. Encoding is determined by the client charset attribute in .Pa freetds.conf . .It Fl d Turn off any logging. (Unintuitive, perhaps.) .It Fl e Ar errfile Write errors to .Ar errfile . For uploads. Includes line and column information, and the row data. .It Fl f Ar formatfile The format of the host data file is described by .Ar formatfile . The layout of .Ar formatfile is identical to that understood by the Sybase and Microsoft bcp utilities, but is too complicated to describe here. .It Fl h Ar hints Set bcp hints. For valid values, cf. .Fn bcp_options in the FreeTDS Reference Manual. .It Fl m Ar maxerror Stop after encountering .Ar maxerror errors. Default 10. .It Fl n The host data file is in .Dq native format. This is a format that .Nm will be able to process, but is not portable or readable. .It Fl r Ar row_term The row terminator for a character file. May be more than one character. Default is newline ('\\n'). Cf\&. .Fl c Ns , above. .It Fl t Ar field_term The field terminator for character file. Also known as a column delimiter. May be more than one character. Default is tab ('\\t'). Cf\&. .Fl c Ns , above. .It Fl v .It Fl V Print the version information and exit. .It Fl i Ar inputfile Read input data from file specified. .It Fl o Ar outputfile Write output data to file specified. .It Fl C Ar charset Specify character set to use to talk to server. .El .Sh ENVIRONMENT .Ev DSQUERY default .Ar servername .\" .Sh NOTES When connecting to a Sybase database server, it is required that the TDS 5.0 protocol be used. When connecting to a Microsoft SQL Server 2000 database server, the TDS\ 7 (or later) protocol is required. .Pp Sybase and Microsoft define different versions of the bcp portion of TDS 4.2. Because FreeTDS has no way of knowing which type of server it's connected to, .Nm does not support version 4.2 of the TDS protocol. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.60 .Sh AUTHORS The .Nm utility was written by .An Bill Thompson Aq thompbil@exchange.uk.ml.com .Sh BUGS Currently, there is no support for text data types in .Nm Ns , when SQL Server 2000 is the target server. freetds-1.3.6/doc/freetds.conf.5.in000644 025423 025423 00000014456 14056414221 020434 0ustar00fredianofrediano000000 000000 .Dd May 2, 2017 .Os FreeTDS @VERSION@ .Dt FREETDS.CONF "FreeTDS 5" "FreeTDS Reference Manual" . .Sh NAME .Nm freetds.conf .Nd configuration file for FreeTDS . .Sh SYNOPSIS The .Pa freetds.conf file describes Sybase and Microsoft database servers to the FreeTDS library. It comprises sections headed by a servername, followed by a list of connection properties denoted as name-value pairs. Defaults are defined via a .Bq global section. This file supersedes the .Pa interfaces file that Sybase defines for the same purpose, although the latter is still supported. . .Sh DESCRIPTION A section begins with a servername \(em the name of the server \(em in square brackets. The servername is chosen at the client's descretion. (One exception: with Sybase ASA the servername must match the database name to be used.) .Pp Sections contain properties, one per line, in the form .Pp .Dl name = value .Pp where .Ar name is the connection property to be described. Servernames and properties are not case sensitive. Values are case-preserving i.e., copied literally. Comments begin with either a semicolon .Pq So ; Sc or pound sign .Pq So # Sc and continue to end of line. Blank lines are ignored. Whitespace surrounding the .So = Sc is ignored. . .Sh PROPERTIES .Bl -tag -width "emulate little endian" -compact . .It client charset encoding of client data; overrides locale(1) settings .Bl -tag -width "default:" -compact .It Domain: iconv character set names .It Default: ISO-8859-1 .El . .It connect timeout seconds to wait for response from connect request .Bl -tag -width "default:" -compact .It Domain: 0 to MAX_INT .It Default: none .El . .It debug flags logging granularity .Bl -tag -width "default:" -compact .It Domain: 32-bit integer .It Default: 0x4fff .El . .It dump file specifies location of a logfile and turns on logging .Bl -tag -width "default:" -compact .It Domain: valid file name .It Default: none .El . .It dump file append log data appended to file instead of re-writing for each connection .Bl -tag -width "default:" -compact .It Domain: yes/no .It Default: no .El . .It emulate little endian forces big endian machines to act as little endian to communicate with Microsoft Servers .Bl -tag -width "default:" -compact .It Domain: yes/no .It Default: no .El . .It encryption .Bl -tag -compact .It Em off disables encryption .It Em request use if available (default when tds version greater than 7.0) .It Em required allow encrypted connections only .El . .It host Name of the host the server is running on. .Bl -tag -width "default:" -compact .It Domain: host name or IP address .It Default: SYBASE .El . .It initial block size maximum size of a protocol block .Bl -tag -width "default:" -compact .It Domain: multiple of 512 .It Default: 512 .El . .It instance name of Microsoft SQL Server instance to connect to (supersedes .Em port ) .Bl -tag -width "default:" -compact .It Domain: instance name .It Default: none .El . .It port port number that the server is listening to .Bl -tag -width "default:" -compact .It Domain: any valid port .It Default: TDS 5.0, 5000; TDS 7.0 and up, 1433 .El . .It tds version TDS protocol version to use .Bl -tag -width "default:" -compact .It Domain: 4.2, 5.0, 7.0, 7.1, 7.2 .It Default: .Fl -with-tdsver value (5.0 if unspecified) .El . .It text size default value of TEXTSIZE, in bytes .Bl -tag -width "default:" -compact .It Domain: 0 to 4,294,967,295 .It Default: 4,294,967,295 .El . .It timeout seconds to wait for response to a query .Bl -tag -width "default:" -compact .It Domain: 0 to MAX_INT .It Default: none (wait forever) .El . .El .Pp Do not define both .Fa port and .Fa instance Ns \&. One implies the other. .Pp Boolean property values may be denoted as on/off, true/false, or 1/0. . .Ss DEBUG FLAGS The log's granularity can be controlled with the .Em debug flags property. .Bl -column -offset indent ".Sy 0x8000" ".Sy show source level info (source file and line)" .It Sy Value Ta Sy Meaning .It Li \ \ 0x02 severe error .It Li \ \ 0x04 error .It Li \ \ 0x08 warning .It Li \ \ 0x10 network .It Li \ \ 0x20 information level 1 .It Li \ \ 0x40 information level 2 .It Li \ \ 0x80 function trace and info .It Li 0x1000 show pid .It Li 0x2000 show time .It Li 0x4000 show source level info (source file and line) .It Li 0x8000 thread id (not implemented). .El . .Sh NAMES AND LOCATIONS The file is normally named .Pa /etc/freetds.conf or .Pa ${HOME}/.freetds.conf . That name can be overridden with the FREETDSCONF environment variable. .Pp FreeTDS will search conf files for a servername in the following order: .Bl -enum -offset indent -compact .It a filename set programatically via dbsetifile() that is in .conf format .It a filename in the environment variable FREETDSCONF that is in .conf format .It .Pa ${HOME}/.freetds.conf if extant .It .Pa @sysconfdir@/freetds.conf .El .Pp The search stops with the first file containing the servername. .Pp If no conf file is found, FreeTDS searches for an .Pa interfaces file in the following order: .Bl -enum -offset indent -compact .It a filename set programatically via dbsetifile() that is in .Pa interfaces format .It .Pa ${HOME}/.interfaces .It .Pa $SYBASE/interfaces (where .Ev $SYBASE is an environment variable) .El .Pp If the requested servername is not found in any configuration file, the fallback mechanism is: .Bl -enum -offset indent -compact .It attempt to convert the name to an IP address with inet_addr(3), else .It attempt to convert the name to an IP address with gethostbyname(3), else .It attempt to look up the literal name .Dq SYBASE .El . .Sh ENVIRONMENT .Bl -tag -width "TDSDUMPCONFIG" -compact .It Ev FREETDSCONF overrides name and location of the system-wide conf file .It Ev TDSDUMP overrides the name and location of the FreeTDS log file .It Ev TDSDUMPCONFIG specifies a name and location of a file that logs the search of configuration files .It Ev TDSHOST overrides the host property .It Ev TDSPORT overrides the port property .It Ev TDSQUERY synonym for DSQUERY, the default servername .It Ev TDSVER overrides the version specified in the freetds.conf .El .Pp The environment variables .Ev TDSVER, Ev TDSDUMP, Ev TDSPORT, Ev TDSQUERY, and Ev TDSHOST override values set by a .conf or .Pa interfaces file. . .Sh FILES .Pa @sysconfdir@/freetds.conf , ${HOME}/.freetds.conf . .Sh SEE ALSO .%B FreeTDS User Guide . .Sh HISTORY \.conf files first appeared with version 0.53 of FreeTDS. freetds-1.3.6/doc/osql.1.in000644 025423 025423 00000003743 14056414221 017023 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd April 26, 2012 .Os FreeTDS @VERSION@ .Dt OSQL FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm osql .Nd utility to test FreeTDS connections and queries .\" .Sh SYNOPSIS .Pp .Nm .Fl S Ar dsn .Fl U Ar username .Fl P Ar password .Op Fl I Pa ini_directory .\" .Sh DESCRIPTION .Pp .Nm is a diagnostic tool provided as part of FreeTDS. It is a Bourne shell script that checks and reports on your configuration files. If everything checks out OK, it invokes isql. .Pp .Nm works only with the isql that comes with unixODBC. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl S Ar dsn the Data Source Name to which to connect, as known to .Pa odbc.ini Ns . .It Fl U Ar username database login name. .It Fl P Ar password database password. .It Fl I Ar ini_dir override .Pa odbc.ini file location. .El .\" .Sh EXAMPLE If you have an .Pa odbc.ini with a section like this: .Bd -literal -offset indent .Bq myDSN servername = myserver TDS_Version = 5.0 .Ed .Pp You would invoke .Nm as: .Pp .Li osql -S myDSN .Op .\|.\|.\& .\" .Sh FILES .Pa odbc.ini .Pa freetds.conf .\" .Sh NOTES If you can connect with .Ql osql -S servername -U user -P passwd Ns , your FreeTDS ODBC installation is working. .Pp .Nm guesses where unixODBC might look for its .Pa odbc.ini by examining the binary. This is not always an effective approach. If it doesn't work, you'll receive a report of candidate strings. Kindly pass along the output to help improve the guessing. .Pp If .Nm cannot intuit your .Pa odbc.ini directory, you can force the issue with the .Fl I option. However, you're then instructing .Nm what to test, not where unixODBC will eventually look. Your override is therefore only as good as you are. Look carefully at the error output before overriding. .Pp If you have suggestions for ways to make .Nm more useful as a diagnostic tool, please post them to the FreeTDS mailing list. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Ns . freetds-1.3.6/doc/tsql.1.in000644 025423 025423 00000006637 14056414221 017035 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS @VERSION@ .Dt TSQL FreeTDS "FreeTDS Reference Manual" .Sh NAME .Nm tsql .Nd utility to test FreeTDS connections and queries .Sh SYNOPSIS .Nm .Bro .Fl S Ar servername .Op Fl I Ar interface | .Fl H Ar hostname .Op Fl L .Op Fl p Ar port .Brc .Op Fl D Ar dbname .Op Fl U Ar username .Op Fl P Ar password .Op Fl o Ar options .Nm .Fl C .Sh DESCRIPTION .Nm is a FreeTDS diagnostic tool. It uses the TDS protocol to connect to a Sybase or Microsoft SQL Server, and lets the user issue queries. .Nm does not use the FreeTDS client libraries. Instead, it uses only the lowest level library, libtds, to test the protocol implementation. .Pp .Nm can be run in two ways, one which uses the freetds.conf and one which connects directly using the server's hostname and port. The .Fl H and .Fl p parameters are provided to let the user verify a server is listening on the named host and port. These parameters override any configuration files and environment variables. .Pl The .Fl S parameter can be used to test the local configuration. FreeTDS will use freetds.conf (or equivalent) and environment variables in the normal way to determine the server's IP address and port. You can use .Fl I to specify a filename, overriding FreeTDS's configuration file search algorithm. .Sh OPTIONS .Bl -tag -width indent .It Fl S Ar servername database server to which to connect. .It Fl D Ar dbname database to use. .It Fl I Ar interface freetds.conf or interfaces file describing servername. .It Fl H Ar hostname DNS hostname of the server. .It Fl p Ar port port at which SQL Server is listening. .It Fl U Ar username database login name. If username is not provided, a domain login is attempted for TDS 7+ connections. .It Fl P Ar password database password. .It Fl L list Microsoft server instances (with .Fl H Ns ). .It Fl C print some of the compile-time configuration parameters. .It Fl o Ar options apply the options specified to every command. .Bl -tag -width indent .It Fl f No footer .Bq result count .It Fl h No header .Bq titles .It Fl t Print time .It Fl v Print version .It Fl q Quiet .El .It Fl a Ar appname application name. .It Fl t Ar colterm column terminator. .It Fl r Ar rowterm row terminator. .It Fl r Ar rowterm row terminator. .It Fl J Ar charset character set. .It Fl v verbose mode. .El .\" .Sh NOTES If you can connect with .Ql tsql -S servername Ns , your basic FreeTDS installation is working. .Pp Typing .Ql exit Ns , .Ql quit Ns , or .Ql bye (or .Li ^D Ns ) exits .Nm Ns . .Pp Typing .Ql version displays the TDS protocol version. .Pp Command batches may be separated with .Ql go or .Ql GO Ns . If .Ql GO the version string is reported before executing the batch. .Pp After prompting for the password (if not provided with .Fl P Ns ), .Nm will attempt to connect to the remote server. .Nm displays a counter indicating the number of seconds elapsed during the connection attempt. Typically, .Nm immediately responds with a .Ql 1> prompt. If you see the counter (1, 2, 3, ...), most likely .Nm is unable to connect to the indicated server. .Pp .Nm is not a replacement for a complete isql such as sqsh (www.sqsh.org). If you have suggestions for ways to make .Nm more useful as a diagnostic tool, please post them to the FreeTDS mailing list for consideration. .Sh HISTORY .Nm first appeared in FreeTDS 0.60. .Sh AUTHORS The .Nm utility was written by .An Brian Bruns Ns . .Sh BUGS Several, to be sure, now that it's documented. :) freetds-1.3.6/doc/api_status.txt000644 025423 025423 00000054772 14056414221 020303 0ustar00fredianofrediano000000 000000 #!/usr/pkg/bin/perl # API status document # # $Id: api_status.txt,v 1.65 2010-12-31 16:34:15 jklowden Exp $s # # This tab-delimited file is a database of the "readiness" of the various # APIs. Please feel free to modify it if you notice something is missing or # wrong or incomplete. # # Format rules # # 1. Fields are delimited with one or more tab characters. # Multiple consecutive tabs make hand editing easier; they # do not delimit null fields. # 2. The first column must be one of: 'odbc', 'dblib', 'ctlib'. # Lines starting with *anything* else are ignored. # 3. Field definitions are: # Library: odbc, dblib, or ctlib # Category: chunk of api functionality (bcp/cursors/etc.) # Name[1,2]: self-explanatory # For db-lib, there are two names: # Name 1: Microsoft's name # Name 2: Sybase's name # Status: *OK thought to be working # *stub present but non-functional # *partial parts thought to be working # *(blank) Mentioned in vendor documentation but # not in the FreeTDS C code. # Other statuses are acceptable if you see a need. # Comments: Whatever you'd like to say about the function. # # This little bit of perl will produce a data file suitable for uploading into a table thus: # create table api # ( vendor char(15) NOT NULL # , name char(15) NOT NULL # , section char(15) NULL # , function varchar(30) NOT NULL # , status char(20) NULL # , comment varchar(160) NULL # ) # create view vapi # as # # select *, Total - OK as ToDo, 100 * OK / Total as 'Done%' # from ( # select name # , count(*) as Total # , sum(case status when 'OK' # then 1 else 0 end) as OK # , sum(case status when 'partial' # then 1 else 0 end) as Partial # , sum(case status when 'stub' # then 1 else 0 end) as Stub # from api # group by name # ) as API # # go # create view vapisection # as # # select *, Total - OK as ToDo, 100 * OK / Total as 'Done%' # from ( # select name # , section # , count(*) as Total # , sum(case status when 'OK' # then 1 else 0 end) as OK # , sum(case status when 'partial' # then 1 else 0 end) as Partial # , sum(case status when 'stub' # then 1 else 0 end) as Stub # from api # group by name, section # ) as API # # go while( ) { chomp; next if /^\s*$/; #skip blank lines @row = split /\t/, $_; $row[1] =~ s/\(all\)//; #nullify "all" if( $row[0] eq 'dblib' ) { @row = split /\t+/, $_; my @ms = ('Microsoft', @row[0,1,2, 4,5]); my @sy = ('Sybase', @row[0,1, 3,4,5]); $sy[3] = $ms[3] if $sy[3] eq '(same)'; Print( @ms ) unless $ms[3] eq 'n/a'; Print( @sy ) unless $sy[3] eq 'n/a'; next; } if( $row[0] eq 'ctlib' && @row < 5 ) { if( length($row[-1]) > 10 ) { # missing status pop @row; push @row, ("", $_); } } unshift @row, 'Microsoft' if $row[0] eq 'odbc'; unshift @row, 'Sybase' if $row[0] eq 'ctlib'; Print( @row ); } sub Print() { my @row = @_; while( @row < 6 ) { push @row, ""; } print join ("\t", @row), $/; } # edit the data below the following line __DATA__ odbc (all) SQLAllocConnect OK odbc (all) SQLAllocEnv OK odbc (all) SQLAllocHandle OK odbc (all) SQLAllocStmt OK odbc (all) SQLBindCol OK odbc (all) SQLBindParam OK odbc (all) SQLBindParameter OK odbc (all) SQLBrowseConnect odbc (all) SQLCancel OK odbc (all) SQLCloseCursor OK odbc (all) SQLColAttribute OK odbc (all) SQLColAttributes OK odbc (all) SQLColumnPrivileges OK odbc (all) SQLColumns OK odbc (all) SQLConnect OK odbc (all) SQLCopyDesc OK odbc (all) SQLDescribeCol OK odbc (all) SQLDescribeParam unimplemented odbc (all) SQLDisconnect OK odbc (all) SQLDriverConnect OK odbc (all) SQLEndTran OK odbc (all) SQLError OK odbc (all) SQLExecDirect OK odbc (all) SQLExecute OK odbc (all) SQLExtendedFetch OK odbc (all) SQLFetch OK odbc (all) SQLFetchScroll OK odbc (all) SQLForeignKeys OK odbc (all) SQLFreeConnect OK odbc (all) SQLFreeEnv OK odbc (all) SQLFreeHandle OK odbc (all) SQLFreeStmt OK odbc (all) SQLGetConnectAttr OK odbc (all) SQLGetConnectOption OK odbc (all) SQLGetCursorName OK odbc (all) SQLGetData OK odbc (all) SQLGetDescField OK odbc (all) SQLGetDescRec OK odbc (all) SQLGetDiagField OK odbc (all) SQLGetDiagRec OK odbc (all) SQLGetEnvAttr OK odbc (all) SQLGetFunctions OK odbc (all) SQLGetInfo OK odbc (all) SQLGetStmtAttr OK odbc (all) SQLGetStmtOption OK odbc (all) SQLGetTypeInfo OK odbc (all) SQLMoreResults OK odbc (all) SQLNativeSql partial odbc (all) SQLNumParams OK odbc (all) SQLNumResultCols OK odbc (all) SQLParamData OK odbc (all) SQLParamOptions OK odbc (all) SQLPrepare OK odbc (all) SQLPrimaryKeys OK odbc (all) SQLProcedureColumns OK odbc (all) SQLProcedures OK odbc (all) SQLPutData OK odbc (all) SQLRowCount OK odbc (all) SQLSetConnectAttr OK odbc (all) SQLSetConnectOption OK odbc (all) SQLSetCursorName OK odbc (all) SQLSetDescField OK odbc (all) SQLSetDescRec OK odbc (all) SQLSetEnvAttr partial odbc (all) SQLSetPos OK odbc (all) SQLSetParam OK odbc (all) SQLSetScrollOption OK odbc (all) SQLSetStmtAttr OK odbc (all) SQLSetStmtOption OK odbc (all) SQLSpecialColumns OK odbc (all) SQLStatistics OK odbc (all) SQLTablePrivileges OK odbc (all) SQLTables OK odbc (all) SQLTransact OK dblib (none) n/a db12hour dblib (none) n/a dbaltbind_ps dblib (none) n/a dbbind_ps dblib (none) n/a dbbufsize dblib (none) n/a dbcharsetconv dblib (none) n/a dbcoltypeinfo OK dblib (none) n/a dbconvert_ps OK dblib (none) n/a dbfreesort never dblib (none) n/a dbfree_xlate never dblib (none) n/a dbgetcharset dblib (none) n/a dbgetloginfo never dblib (none) n/a dbgetlusername dblib (none) n/a dbgetnatlang dblib (none) n/a DBIORDESC OK dblib (none) n/a DBIOWDESC OK dblib (none) n/a dbloadsort never dblib (none) n/a dbload_xlate never dblib (none) n/a dbnpcreate never dblib (none) n/a dbnpdefine never dblib (none) n/a dbpoll dblib (none) n/a DBRBUF never dblib (none) n/a dbreadpage never dblib (none) n/a dbrecftos OK dblib (none) n/a dbrecvpassthru never dblib (none) n/a dbregdrop never dblib (none) n/a dbregexec never dblib (none) n/a dbreghandle never dblib (none) n/a dbreginit never dblib (none) n/a dbreglist never dblib (none) n/a dbregnowatch never dblib (none) n/a dbregparam never dblib (none) n/a dbregwatch never dblib (none) n/a dbregwatchlist never dblib (none) n/a dbrpwclr never dblib (none) n/a dbrpwset never dblib (none) n/a dbsafestr OK dblib (none) n/a dbsechandle dblib (none) n/a dbsendpassthru never dblib (none) n/a dbsetbusy dblib (none) n/a dbsetdefcharset dblib (none) n/a dbsetdeflang dblib (none) n/a dbsetidle dblib (none) n/a dbsetifile OK dblib (none) n/a dbsetinterrupt OK dblib (none) n/a DBSETLCHARSET dblib (none) n/a DBSETLENCRYPT dblib (none) n/a dbsetloginfo never dblib (none) n/a dbsetrow OK dblib (none) n/a dbsetversion OK dblib (none) n/a dbspr1row OK dblib (none) n/a dbspr1rowlen OK dblib (none) n/a dbsprhead OK dblib (none) n/a dbsprline OK dblib (none) n/a dbstrcmp never dblib (none) n/a dbstrsort never dblib (none) n/a dbtextsize dblib (none) n/a dbwritepage never dblib (none) n/a dbxlate never dblib bcp bcp_batch (same) OK dblib bcp bcp_bind (same) OK dblib bcp bcp_colfmt (same) OK dblib bcp n/a bcp_colfmt_ps dblib bcp bcp_collen (same) OK dblib bcp bcp_colptr (same) OK dblib bcp bcp_columns (same) OK dblib bcp bcp_control (same) OK dblib bcp bcp_done (same) OK dblib bcp bcp_exec (same) OK dblib bcp n/a bcp_getl OK dblib bcp bcp_init (same) OK dblib bcp bcp_moretext (same) stub dblib bcp n/a bcp_options partial dblib bcp bcp_readfmt (same) OK dblib bcp bcp_sendrow (same) OK dblib bcp BCP_SETL (same) OK dblib bcp bcp_writefmt (same) dblib browse dbcolbrowse n/a never dblib browse dbcolsource n/a never dblib browse dbfreequal n/a never dblib browse dbqual n/a never dblib browse dbtabbrowse n/a never dblib browse dbtabcount n/a never dblib browse dbtabname n/a never dblib browse dbtabsource n/a never dblib browse dbtsnewlen n/a never dblib browse dbtsnewval n/a never dblib browse dbtsput n/a never dblib core dbadata (same) OK dblib core dbadlen (same) OK dblib core dbaltbind (same) OK dblib core dbaltcolid (same) OK dblib core dbaltlen (same) OK dblib core dbaltop (same) OK dblib core dbalttype (same) OK dblib core dbaltutype (same) OK dblib core dbanullbind (same) OK dblib core dbbind (same) OK dblib core dbbylist (same) OK dblib core dbcancel (same) OK dblib core dbcanquery (same) OK dblib core dbchange (same) OK dblib core dbclose (same) OK dblib core dbclrbuf (same) OK dblib core dbclropt (same) partial dblib core dbcmd (same) OK dblib core dbcmdrow DBCMDROW OK dblib core dbcolinfo n/a OK dblib core dbcollen (same) OK dblib core dbcolname (same) OK dblib core dbcoltype (same) OK dblib core dbcolutype (same) OK dblib core dbconvert (same) OK dblib core dbcount DBCOUNT OK dblib core dbcurcmd DBCURCMD stub dblib core dbcurrow DBCURROW stub dblib core dbdata (same) OK dblib core dbdataready n/a dblib core dbdatecrack (same) OK dblib core dbdatlen (same) OK dblib core dbdead DBDEAD OK dblib core dbenlisttrans n/a never dblib core dbenlistxatrans n/a never dblib core dberrhandle (same) OK dblib core dbexit (same) OK dblib core dbfcmd (same) OK dblib core dbfirstrow DBFIRSTROW OK dblib core dbfreebuf (same) OK dblib core dbgetchar (same) OK dblib core dbgetmaxprocs (same) OK dblib core dbgetoff (same) never dblib core dbgetpacket (same) OK dblib core dbgetrow (same) OK dblib core dbgettime DBGETTIME OK dblib core dbgetuserdata (same) OK dblib core dbinit (same) OK dblib core dbisavail DBISAVAIL OK dblib core dbiscount n/a OK dblib core dbisopt (same) partial dblib core dblastrow DBLASTROW OK dblib core dblogin (same) OK dblib core dbfreelogin dbloginfree OK dblib money n/a dbmny4add OK dblib money n/a dbmny4cmp OK dblib money n/a dbmny4copy OK dblib money n/a dbmny4divide stub dblib money n/a dbmny4minus OK dblib money n/a dbmny4mul stub dblib money n/a dbmny4sub OK dblib money n/a dbmny4zero OK dblib money n/a dbmnyadd stub dblib money n/a dbmnycmp OK dblib money n/a dbmnycopy OK dblib money n/a dbmnydec OK dblib money n/a dbmnydivide stub dblib money n/a dbmnydown stub dblib money n/a dbmnyinc OK dblib money n/a dbmnyinit stub dblib money n/a dbmnymaxneg OK dblib money n/a dbmnymaxpos OK dblib money n/a dbmnyminus OK dblib money n/a dbmnymul stub dblib money n/a dbmnyndigit stub dblib money n/a dbmnyscale stub dblib money n/a dbmnysub stub dblib money n/a dbmnyzero OK dblib core dbmorecmds DBMORECMDS OK dblib core dbmsghandle (same) OK dblib core dbname (same) OK dblib core dbnextrow (same) OK dblib core dbnullbind (same) OK dblib core dbnumalts (same) OK dblib core dbnumcols (same) OK dblib core dbnumcompute (same) OK dblib core dbnumorders DBNUMORDERS never dblib core dbopen (same) OK dblib core dbordercol (same) never dblib core dbprhead (same) OK dblib core dbprocerrhandle n/a aliases dberrhandle dblib core dbprocinfo n/a never dblib core dbprocmsghandle n/a aliases dbmsghandle dblib core dbprrow (same) OK dblib core dbprtype (same) OK dblib core dbresults (same) OK dblib core dbrows DBROWS OK dblib core dbrowtype DBROWTYPE OK dblib core n/a dbservcharset OK dblib core dbserverenum n/a never dblib core dbsetavail (same) OK dblib core dbsetlapp DBSETLAPP OK dblib core dbsetlfallback n/a never dblib core dbsetlhost DBSETLHOST OK dblib core dbsetlnatlang DBSETLNATLANG OK dblib core dbsetlogintime (same) OK dblib core dbsetlpacket DBSETLPACKET OK dblib core dbsetlpwd DBSETLPWD OK dblib core dbsetlsecure n/a dblib core dbsetltime n/a dblib core dbsetluser DBSETLUSER OK dblib core dbsetlversion n/a OK dblib core dbsetmaxprocs (same) OK dblib core dbsetnull (same) OK dblib core dbsetopt (same) partial dblib core dbsettime (same) OK dblib core dbsetuserdata (same) OK dblib core n/a dbspid OK dblib core dbsqlexec (same) OK dblib core dbsqlok (same) OK dblib core dbsqlsend (same) OK dblib core n/a dbstrbuild OK dblib core dbstrcpy (same) OK dblib core dbstrlen (same) OK dblib core n/a DBTDS OK dblib core dbuse (same) OK dblib core dbvarylen (same) OK dblib core n/a dbversion OK dblib core dbwillconvert (same) OK dblib core dbwinexit (Windows only) n/a no-op macro dblib cursor dbcursor (same) never dblib cursor dbcursorbind (same) never dblib cursor dbcursorclose (same) never dblib cursor dbcursorcolinfo (same) never dblib cursor dbcursorfetch (same) never dblib cursor dbcursorfetchex n/a never dblib cursor dbcursorinfo (same) never dblib cursor dbcursorinfoex n/a never dblib cursor dbcursoropen (same) never dblib datetime n/a dbdate4cmp never dblib datetime n/a dbdate4zero never dblib datetime n/a dbdatechar never dblib datetime n/a dbdatecmp OK dblib datetime n/a dbdatename never dblib datetime n/a dbdateorder never dblib datetime n/a dbdatepart never dblib datetime n/a dbdatezero never dblib datetime n/a dbdayname never dblib datetime n/a dbmonthname OK dblib procedure dbhasretstat (same) OK dblib procedure dbnumrets (same) OK dblib procedure dbretdata (same) OK dblib procedure dbretlen (same) OK dblib procedure dbretname (same) OK dblib procedure dbretstatus (same) OK dblib procedure dbrettype (same) OK dblib procedure dbrpcexec n/a dblib procedure dbrpcinit (same) OK dblib procedure dbrpcparam (same) OK dblib procedure dbrpcsend (same) OK dblib text dbmoretext (same) OK dblib text dbreadtext (same) OK dblib text dbtxptr (same) OK dblib text dbtxtimestamp (same) OK dblib text dbtxtsnewval (same) dblib text dbtxtsput (same) dblib text dbupdatetext n/a dblib text dbwritetext (same) OK ctlib (all) ct_bind OK Bind server results to program variables. ctlib (all) ct_br_column Retrieve information about a column generated by a browse mode select. ctlib (all) ct_br_table Return information about browse mode tables. ctlib (all) ct_callback OK Install or retrieve a Client-Library callback routine. ctlib (all) ct_cancel OK Cancel a command or the results of a command. ctlib (all) ct_capability OK Set or retrieve a client/server capability. ctlib (all) ct_close OK Close a server connection. ctlib (all) ct_cmd_alloc OK Allocate a CS_COMMAND structure. ctlib (all) ct_cmd_drop OK Deallocate a CS_COMMAND structure. ctlib (all) ct_cmd_props OK Set or retrieve command structure properties. For use by applications that resend commands. ctlib (all) ct_command OK Initiate a language, package, RPC, message, or send-data command. ctlib (all) ct_compute_info OK Retrieve compute result information. ctlib (all) ct_con_alloc OK Allocate a CS_CONNECTION structure. ctlib (all) ct_con_drop OK Deallocate a CS_CONNECTION structure. ctlib (all) ct_con_props OK Set or retrieve connection structure properties. ctlib (all) ct_config OK Set or retrieve context properties. ctlib (all) ct_connect OK Connect to a server. ctlib (all) ct_cursor OK Initiate a Client-Library cursor command. ctlib (all) ct_data_info OK Define or retrieve a data I/O descriptor structure. ctlib (all) ct_debug Manage debug library operations. ctlib (all) ct_describe OK Return a description of result data. ctlib (all) ct_diag OK Manage inline error handling. ctlib (all) ct_ds_dropobj Release the memory associated with a directory object. ctlib (all) ct_ds_lookup Initiate or cancel a directory lookup operation. ctlib (all) ct_ds_objinfo Retrieve information associated with a directory object. ctlib (all) ct_dynamic OK Initiate a dynamic SQL command. ctlib (all) ct_dyndesc Perform operations on a dynamic SQL descriptor area. ctlib (all) ct_dynsqlda Operate on a SQLDA structure. ctlib (all) ct_exit OK Exit Client-Library. ctlib (all) ct_fetch OK Fetch result data. ctlib (all) ct_get_data OK Read a chunk of data from the server. ctlib (all) ct_getformat Return the server user-defined format string associated with a result column. ctlib (all) ct_getloginfo Transfer TDS login response information from a CS_CONNECTION structure to a newly allocated CS_LOGINFO structure. ctlib (all) ct_init OK Initialize Client-Library for an application context. ctlib (all) ct_keydata Specify or extract the contents of a key column. ctlib (all) ct_labels Define a security label or clear security labels for a connection. ctlib (all) ct_options OK Set, retrieve, or clear the values of server query-processing options. ctlib (all) ct_param OK Supply values for a server command's input parameters. ctlib (all) ct_poll stub Poll connections for asynchronous operation completions and registered procedure notifications. ctlib (all) ct_recvpassthru Receive a TDS (Tabular Data Stream) packet from a server. ctlib (all) ct_remote_pwd Define or clear passwords to be used for server-to-server connections. ctlib (all) ct_res_info OK Retrieve current result set or command information. ctlib (all) ct_results OK Set up result data to be processed. ctlib (all) ct_send OK Send a command to the server. ctlib (all) ct_send_data OK Send a chunk of text or image data to the server. ctlib (all) ct_sendpassthru Send a Tabular Data Stream (TDS) packet to a server. ctlib (all) ct_setloginfo Transfer TDS login response information from a CS_LOGINFO structure to a CS_CONNECTION structure. ctlib (all) ct_setparam OK Specify source variables from which ct_send reads input parameter values for a server command. ctlib (all) ct_wakeup Call a connection's completion callback. ctlib (all) cs_calc Perform an arithmetic operation on two operands. ctlib (all) cs_cmp Compare two data values. ctlib (all) cs_config partial Set or retrieve CS-Library properties. ctlib (all) cs_conv_mult stub Retrieve the conversion multiplier for converting character data from one character set to another. ctlib (all) cs_convert OK Convert a data value from one datatype, locale, or format to another datatype, locale, or format. ctlib (all) cs_ctx_alloc OK Allocate a CS_CONTEXT structure. ctlib (all) cs_ctx_drop OK Deallocate a CS_CONTEXT structure. ctlib (all) cs_ctx_global OK Allocate or return a CS_CONTEXT structure. ctlib (all) cs_diag OK Manage inline error handling. ctlib (all) cs_dt_crack OK Convert a machine-readable datetime value into a user-accessible format. ctlib (all) cs_dt_info stub Set or retrieve language-specific datetime information. ctlib (all) cs_loc_alloc OK Allocate a CS_LOCALE structure. ctlib (all) cs_loc_drop OK Deallocate a CS_LOCALE structure. ctlib (all) cs_locale partial Load a CS_LOCALE structure with localization values or retrieve the locale name previously used to load a CS_LOCALE structure. ctlib (all) cs_manage_convert stub Install or retrieve a user-defined character set conversion routine. ctlib (all) cs_objects stub Save, retrieve, or clear objects and data associated with them. ctlib (all) cs_set_convert stub Install or retrieve a user-defined conversion routine. ctlib (all) cs_setnull stub Define a null substitution value to be used when binding or converting NULL data. ctlib (all) cs_strbuild OK Construct native language message strings. ctlib (all) cs_strcmp stub Compare two strings using a specified sort order. ctlib (all) cs_time stub Retrieve the current date and time. ctlib (all) cs_will_convert OK Indicate whether a specific datatype conversion is available in the Client/Server libraries. ctlib (all) blk_alloc OK Allocate a CS_BLKDESC structure. ctlib (all) blk_bind OK Bind a program variable and a database column. ctlib (all) blk_colval stub Server-side routine to obtain the column value from a formatted bulk copy row. ctlib (all) blk_default stub Retrieve a column's default value. ctlib (all) blk_describe OK Retrieve a description of a database column. ctlib (all) blk_done OK Mark a complete bulk copy operation or a complete bulk copy batch. ctlib (all) blk_drop OK Deallocate a CS_BLKDESC structure. ctlib (all) blk_getrow stub Server-side routine to retrieve and store a formatted bulk copy row. ctlib (all) blk_gettext stub Server-side routine to retrieve the text, image, sensitivity, or boundary portion of an incoming bulk copy formatted row. ctlib (all) blk_init OK Initiate a bulk copy operation. ctlib (all) blk_props OK Set or retrieve bulk descriptor structure properties. ctlib (all) blk_rowalloc stub Server-side routine to allocate space for a formatted bulk copy row. ctlib (all) blk_rowdrop stub Server-side routine to free space previously allocated for a formatted bulk copy row. ctlib (all) blk_rowxfer OK Transfer one or more rows during a bulk copy operation without specifying or receiving a row count. ctlib (all) blk_rowxfer_mult OK Transfer one or more rows during a bulk copy operation. ctlib (all) blk_sendrow stub Server-side routine to send a formatted bulk copy row obtained from blk_getrow. ctlib (all) blk_sendtext stub Server-side routine to send text, image, sensitivity, or boundary data in a formatted bulk copy row obtained from blk_sendtext. ctlib (all) blk_srvinit stub Server-side routine to copy descriptions of server table columns to the client, if required. ctlib (all) blk_textxfer stub Transfer a column's data in chunks during a bulk copy operation. freetds-1.3.6/doc/bcp.txt000644 025423 025423 00000001053 14056414221 016653 0ustar00fredianofrediano000000 000000 Bulk Copy --------- BCP Data Format +---------+-----+-----+---------------+----------+-------------+------------+ | | non | row | | | | size of | | size | var | num | fixed columns | row size | var columns | adjustment | | | cols| | | | | table | +---------+-----+-----+---------------+----------+-------------+------------+ +---------+------------+ | end of | offsets | | data | to varlen | | pointer | data | +---------+------------+ freetds-1.3.6/doc/cap.txt000644 025423 025423 00000012326 14056414221 016657 0ustar00fredianofrediano000000 000000 Capabilities ------------ The TDS_CAP_TOKEN token (decimal 226) in TDS is sent to the server immediately after the login sequence in TDS 5.0. It is sent back as part of the login acknowledgement stream. The client requests which capabilities it wants and the server sends back which ones it supports. I'm not certain but I believe a full 5.0 login sequence could be sent to an MS-SQL or Sybase 4.x server and if the 226 token is absent from the return stream then the protocol could default back to 4.2. This would eliminate the need for compiling two versions of the library, of course setting the proto version manually would not send the capabilities. I need someone to try this as I only have access to Sybase 11.x servers. The layout of the capabilities packet is: 1 byte 2 bytes n bytes +---------+---------------+---------------------+ | 226 | size of mask | capabilities field | +---------+---------------+---------------------+ The capabilities field looks like: 1 byte 1 byte n bytes +--------+--------+---------------+ | id | size | bitmask | +--------+--------+---------------+ 1) For id 1 seems to signify request capabilities and 2 is response capabilities. 2) The size represents the size of the bitmask (7 for all I've seen). 3) The bitmask is is a bitset mask denoting values set by ct_capability() or similar call. It is packed from the low order bit to high order bit. The first bit (low order bit...bit 0 of byte 6) is not used for a capability. It seems to be used by the protocol but its function is presently unknown. A listing of all known values for the bitmasks follows with its ctlib constant. Refer to the ctlib documentation for descriptions of these. REQUEST CAPABILITIES -------------------- byte 0: default ctlib value: 3 bit 0 (0x01): CS_PROTO_DYNPROC bit 1 (0x02): CS_DATA_FLTN bit 2 (0x04): CS_DATA_BITN bit 3 (0x08): CS_DATA_INT8 bit 4 (0x10): CS_DATA_VOID bit 5 (0x20): unknown bit 6 (0x40): unknown bit 7 (0x80): unknown byte 1: default ctlib value: 109 bit 0 (0x01): CS_CON_INBAND bit 1 (0x02): CS_CON_LOGICAL bit 2 (0x04): CS_PROTO_TEXT bit 3 (0x08): CS_PROTO_BULK bit 4 (0x10): CS_REQ_URGNOTIF bit 5 (0x20): CS_DATA_SENSITIVITY bit 6 (0x40): CS_DATA_BOUNDARY bit 7 (0x80): CS_PROTO_DYNAMIC byte 2: default ctlib value: 127 bit 0 (0x01): CS_DATA_MONEYN bit 1 (0x02): CS_CSR_PREV bit 2 (0x04): CS_CSR_FIRST bit 3 (0x08): CS_CSR_LAST bit 4 (0x10): CS_CSR_ABS bit 5 (0x20): CS_CSR_REL bit 6 (0x40): CS_CSR_MULTI bit 7 (0x80): CS_CON_OOB byte 3: default ctlib value: 255 bit 0 (0x01): CS_DATA_NUM bit 1 (0x02): CS_DATA_TEXT bit 2 (0x04): CS_DATA_IMAGE bit 3 (0x08): CS_DATA_DEC bit 4 (0x10): CS_DATA_LCHAR bit 5 (0x20): CS_DATA_LBIN bit 6 (0x40): CS_DATA_INTN bit 7 (0x80): CS_DATA_DATETIMEN byte 4: default ctlib value: 255 bit 0 (0x01): CS_DATA_BIN bit 1 (0x02): CS_DATA_VBIN bit 2 (0x04): CS_DATA_MNY8 bit 3 (0x08): CS_DATA_MNY4 bit 4 (0x10): CS_DATA_DATE8 bit 5 (0x20): CS_DATA_DATE4 bit 6 (0x40): CS_DATA_FLT4 bit 7 (0x80): CS_DATA_FLT8 byte 5: default ctlib value: 255 bit 0 (0x01): CS_REQ_MSG bit 1 (0x02): CS_REQ_PARAM bit 2 (0x04): CS_DATA_INT1 bit 3 (0x08): CS_DATA_INT2 bit 4 (0x10): CS_DATA_INT4 bit 5 (0x20): CS_DATA_BIT bit 6 (0x40): CS_DATA_CHAR bit 7 (0x80): CS_DATA_VCHAR byte 6: default ctlib value: 254 bit 0 (0x01): unknown bit 1 (0x02): CS_REQ_LANG bit 2 (0x04): CS_REQ_RPC bit 3 (0x08): CS_REQ_NOTIF bit 4 (0x10): CS_REQ_MSTMT bit 5 (0x20): CS_REQ_BCP bit 6 (0x40): CS_REQ_CURSOR bit 7 (0x80): CS_REQ_DYN RESPONSE CAPABILITIES --------------------- byte 0: default ctlib value: 0 bit 0 (0x01): unknown bit 1 (0x02): unknown bit 2 (0x04): unknown bit 3 (0x08): unknown bit 4 (0x10): unknown bit 5 (0x20): unknown bit 6 (0x40): unknown bit 7 (0x80): unknown byte 1: default ctlib value: 0 bit 0 (0x01): unknown bit 1 (0x02): unknown bit 2 (0x04): unknown bit 3 (0x08): unknown bit 4 (0x10): unknown bit 5 (0x20): unknown bit 6 (0x40): unknown bit 7 (0x80): unknown byte 2: (88) default ctlib value: 10 bit 0 (0x01): CS_DATA_NOBOUNDARY bit 1 (0x02): CS_DATA_NOTDSDEBUG bit 2 (0x04): CS_RES_NOSTRIPBLANKS bit 3 (0x08): CS_DATA_NOINT8 bit 4 (0x10): unknown bit 5 (0x20): unknown bit 6 (0x40): unknown bit 7 (0x80): unknown byte 3: (89) default ctlib value: 120 bit 0 (0x01): CS_DATA_NOINTN bit 1 (0x02): CS_DATA_NODATETIMEN bit 2 (0x04): CS_DATA_MONEYN bit 3 (0x08): CS_CON_NOOOB bit 4 (0x10): CS_CON_NOINBAND bit 5 (0x20): CS_PROTO_NOTEXT bit 6 (0x40): CS_PROTO_NOBULK bit 7 (0x80): CS_DATA_NOSENSITIVITY byte 4: (90) default ctlib value: 0 bit 0 (0x01): CS_DATA_NOFLT4 bit 1 (0x02): CS_DATA_NOFLT8 bit 2 (0x04): CS_DATA_NONUM bit 3 (0x08): CS_DATA_NOTEXT bit 4 (0x10): CS_DATA_IMAGE bit 5 (0x20): CS_DATA_NODEC bit 6 (0x40): CS_DATA_NOLCHAR bit 7 (0x80): CS_DATA_NOLBIN byte 5: (91) default ctlib value: 0 bit 0 (0x01): CS_DATA_NOCHAR bit 1 (0x02): CS_DATA_NOVCHAR bit 2 (0x04): CS_DATA_NOBIN bit 3 (0x08): CS_DATA_NOVBIN bit 4 (0x10): CS_DATA_NOMNY8 bit 5 (0x20): CS_DATA_NOMNY4 bit 6 (0x40): CS_DATA_NODATE8 bit 7 (0x80): CS_DATA_NODATE4 byte 6: (92) default ctlib value: 0 bit 0 (0x01): unknown bit 1 (0x02): CS_RES_NOMSG bit 2 (0x04): CS_RES_NOEED bit 3 (0x08): CS_RES_NOPARAM bit 4 (0x10): CS_DATA_NOINT1 bit 5 (0x20): CS_DATA_NOINT2 bit 6 (0x40): CS_DATA_NOINT4 bit 7 (0x80): CS_DATA_NOBIT freetds-1.3.6/doc/getting_started.txt000644 025423 025423 00000013172 14056414221 021303 0ustar00fredianofrediano000000 000000 Introduction ------------ This document is intended for people who want to help on the FreeTDS project and/or are interested in how the code works. TDS is a fairly simple request/response protocol. It comes in three major flavors: 4.2, 5.0 and 7.0. Microsoft SQL-Server versions through 6.5 still use the 4.2 version as do Sybase servers before 10.0. MS SQL 7.0 introduced TDS 7.0. No version of MS SQL uses 5.0 and Sybase does not use 7.0, but both still support 4.2. TDS 5.0 allows for negotiation of quite a few parameters at connection time, many of these are documented in the cap.txt file in this directory. +--------------------------------------------------------------------------+ | | MS SQL | Sybase ASE | Sybase ASA | +--------------------------------------------------------------------------+ |ver |6.5 |7.0 |2000|2005|2008|2012| <10.x | >11.0 |<5.5.03|5.5*|>6.0| +-----+----+----+----+----+----+----+---------+----------+-------+----+----+ | 4.2 | X | X | X | X | X | X | X | X | | | | | 5.0 | | | | | | | | X | | X | X | | 7.0 | | X | X | X | X | X | | | | | | | 7.1 | | | X | X | X | X | | | | | | | 7.2 | | | | X | X | X | | | | | | | 7.3 | | | | | X | X | | | | | | | 7.4 | | | | | | X | | | | | | +-----+----+----+----+----+----+----+---------+----------+-------+----+----+ * Sybase ASA 5.5 requires 5.5.03 or better with the OpenServer Gateway (OSG). Layers ------ The FreeTDS code is broken down into two layers. The TDS layer handles the bulk of the processing of the protocol and dealing with the network, etc... Any code dealing with protocol issues should reside in this directory (src/tds). A related directory src/server has routines that are used only for server side processes. Actually server is not updated. On top of this layer is a thin layer specific to the 'Call Level Interface' (CLI). A CLI is an API intended to be used by client programs. The core FreeTDS has three CLIs: dblib, the original Sybase API; ctlib, the newer Sybase API; and ODBC, the non-database specific API. Currently dblib and ODBC are the most robust CLIs we have, followed by ctlib, which is quite usable none-the-less. The ODBC CLI is built using a driver manager (either iODBC or unixODBC), so you will need one of those to build it with. Outside of these there is also a JDBC driver for Java and a DBI driver for Perl which do not reside atop the TDS layer. (FreeTDS/JDBC is a pure Java driver). This document does not currently cover these libraries. Those wishing to use Perl are also encouraged to look at DBD::Sybase which uses ctlib and works well with the FreeTDS libraries. The Nitty Gritty ---------------- The first thing a CLI does is allocate a login structure for TDS. Such as: TDS_LOGIN *login = tds_alloc_login(); It can then call any of the tds_set_*() functions to initialize this TDS_LOGIN structure. Please refer to src/tds/login.c for a complete listing of options. Once username, password, server, and other options are set a call can be made to tds_connect(). This will allocate a TDS_SOCKET structure and open a socket connection to the specified server (or NULL on failure). The TDS_SOCKET is then passed as an argument to all future TDS functions. At this point the only really useful thing to do is to call tds_submit_query() and then process the returning rows using tds_process_results() and company. This should get us to the routines in src/tds/token.c which are responsible for reading the results back from the server and doing something with them. The logic in these routines should not be hard to follow. The return stream is broken up into a series of 'messages' (not to be confused with actual messages returned from the server). Each one starts with a marker (marker is my word for it, not Sybase's or anyone else's). include/tds.h defines all the markers and in general there will be one tds_process_*() function for each marker unless it is not worth looking at, in which case tds_process_default_tokens() will read past it. libTDS ------ libTDS (src/tds) is the core of this projects Files details (not exaustive): * convert.c Handles conversion between types; * bulk.c Handles bulk transfer; * config.c Handles configuration files; * data.c Handles handling different column types; * numeric.c Handles specific numeric stuff; * net.c Low level network stuff including socket and SSL; * packet.c Handles network stream at packet level, all TDS communication is encapsulated in packets (TDS packets, do not confuse with network ones); * locale.c Deals with locale information; * log.c Handles logging; * mem.c Handles allocation and freeing of structures; * login.c Handles login with server (contains tds_connect); * read.c, write.c Handle reading and writing to TDS packets; * query.c Contains all routines to send requests; * token.c Contains all routines to get reply from server; * tds_checks.c, tds_checks.h Internal checks; * iconv.c Handle character conversions; * tdsstring.c Dynamic string management; * challenge.c, des.c, gssapi.c, hmac_md5.c, md4.c, md5.c, sspi.c Deals with various authentications; * stream.c Deals with large stream of data; * threadsafe.c Utilities for thread safe. Misc ---- Please send fixes and updates to this document to the mailing list (you can find the link on www.freetds.org). I (Brian Bruns) realize it's a little rough right now but I wanted to at least put something out. freetds-1.3.6/doc/policy.txt000644 025423 025423 00000006345 14056414221 017417 0ustar00fredianofrediano000000 000000 Documentation Design Policy, User Guide versus FAQ. James Cameron, 9th November 2001. There are two primary documents in this project, the User Guide and the FAQ. They serve different purposes. The User Guide - is the FreeTDS 'product' documentation, - is specific to each release, - is included in the release, and on the FreeTDS web site, - is structured as a HOWTO, or a list of steps, to get the software working. The FAQ - is the FreeTDS Mailing List documentation, - is FreeTDS release independent, - is on the FreeTDS web site, - is structured as a list of questions. The risks we need to address are: - duplication of content, increasing cost of maintenance, - conflicts between the documents, causing mail traffic, - outdated content is left present, causing mail traffic, - insufficient content, causing mail traffic, - too much content and too little indexing, causing mail traffic. So some policy suggestions ... The FAQ should not duplicate content found in the User Guide, and vice versa. If they have access to the FAQ, they can read the User Guide. If they have access to the User Guide, they shouldn't need the FAQ, unless they hit a defect. To avoid duplication, the FAQ should point to the User Guide to address specific questions, unless the User Guide hasn't got the answer. The User Guide should only point to the FAQ base URL, and should never need to point to specific FAQ content. New content between releases should first go into the FAQ in CVS, with an effective date and FreeTDS version number. The FAQ maintainer will then transfer this to the FreeTDS web site. This new content for the FAQ may breed code changes, or new content for the User Guide. New content for the next release should be inserted into the User Guide in CVS. Once the User Guide is released (by nature of a FreeTDS release), old FAQ entries should be reviewed. -- Date: Fri, 9 Nov 2001 08:07:18 -0500 (EST) From: Brian Bruns To: Cc: Subject: Re: FreeTDS Documentation Design Policy, Draft In-Reply-To: <3BEB6E09.9BC32E58@stl.dec.com> Message-ID: My .02$ The FAQ is 1) A brief description of what freetds is/does (for completeness) as this is the first document many people see. 2) A pointer to other resources: mailing list, user guide, CVS, protocol docs 3) what is supported/not supported. ie Do you support feature X? Including 'are you planning...?' 4) Specific known bugs/build problems with work arounds or dates of fix I think what there is good, except we need to rip out the programming section in favor of the user guide, and section 5 (CVS) needs to go under a more general 'Other Resources' section. Problems Building/Problems Running (4 & 6) probably belong next to each other. I don't know quite where to put 'Which Perl library should I use' but it seems to me to be FAQ fodder, but it doesn't fit the criteria above. The user guide is more detailed. It should explain everything you ever wanted to know about TDS/FreeTDS, discuss its many options in detail, and detail steps for building each type of configuration. I'd personally like to add a section on porting MS dblib/ODBC programs to Unix/Linux. Brian freetds-1.3.6/doc/CodingStyle000644 025423 025423 00000017224 14056414221 017524 0ustar00fredianofrediano000000 000000 The FreeTDS coding style for C code is close to K&R/Linux kernel style. This document makes explicit the coding style found through most of the project. There are likely to be portions of code that do not follow this style, but ideally all would. We are of course not trying to dictate how you code, but patches or submissions to git should be converted to this style prior to committing. The indent program found on most Unix systems will do this nicely. Code Blocks ----------- Blocks of code should start with the { on the line with the control statement. For example, for (i=0;i TDS Protocol Documentation

TDS Protocol Documentation

This document attempts to cover the TDS protocol for:

TDS VersionSupported Products
4.2Sybase SQL Server < 10 and Microsoft SQL Server 6.5
5.0Sybase SQL Server >= 10
7.0Microsoft SQL Server 7.0
7.1Microsoft SQL Server 2000
7.2Microsoft SQL Server 2005

Contents

Common Terms

TDS protocol versions
  TDS 5.0    tds version 5.0
  TDS 7.0    tds version 7.0
  TDS 7.0+   tds version 7.0, 7.1 and 7.2
  TDS 5.0-   tds version 5.0 and previous

Variable types used in this document:
  CHAR      8-bit char
    CHAR[6]	string of 6 chars
    CHAR[n]     variable length string
  XCHAR    single byte (TDS 5.0-) or ucs2le (TDS 7.0+) characters
  INT8      8-bit int
  INT16    16-bit int
  INT32    32-bit int
  UCS2LE   Unicode in UCS2LE format

Note: FreeTDS uses TDS_TINYINT for INT8 and TDS_SMALLINT for INT16.

Typical Usage sequences

These are TDS 4.2 and not meant to be 100% correct, but I thought they might be helpful to get an overall view of what goes on.

--> Login
<-- Login acknowledgement

--> INSERT SQL statement
<-- Result Set Done

--> SELECT SQL statement
<-- Column Names
<-- Column Info
<-- Row Result
<-- Row Result
<-- Result Set Done

--> call stored procedure
<-- Column Names
<-- Column Info
<-- Row Result
<-- Row Result
<-- Done Inside Process
<-- Column Names
<-- Column Info
<-- Row Result
<-- Row Result
<-- Done Inside Process
<-- Return Status
<-- Process Done

The packet format

Every informations in TDS protocol (query, RPCs, responses and so on) is splitted in packets.

All packets start with the following 8 byte header.

 INT8       INT8          INT16      4 bytes
+----------+-------------+----------+--------------------+
|  packet  | last packet |  packet  |    unknown         |
|   type   |  indicator  |   size   |                    |
+----------+-------------+----------+--------------------+

Fields:
packet type 
     0x01 TDS 4.2 or 7.0 query
     0x02 TDS 4.2 or 5.0 login packet
     0x03 RPC
     0x04 responses from server
     0x06 cancels
     0x07 Used in Bulk Copy
     0x0F TDS 5.0 query
     0x10 TDS 7.0 login packet
     0x11 TDS 7.0 authentication packet
     0x12 TDS 8 prelogin packet
last packet indicator 
     0x00 if more packets
     0x01 if last packet
packet size
     (in network byte order)
unknown?
     always 0x00
     this has something to do with server to server communication/rpc stuff

The remainder of the packet depends on the type of information it is providing. As noted above, packets break down into the types query, login, response, and cancels. Response packets are further split into multiple sub-types denoted by the first byte (a.k.a. the token) following the above header.

Note: A TDS packet that is longer than 512 bytes is split on the 512 byte boundary and the "more packets" bit is set. The full TDS packet is reassembled from its component 512 byte packets with the 8-byte headers stripped out. 512 is the block_size in the login packet, so it could be set to a different values. In Sybase you can configure a range of valid block sizes. TDS 7.0+ use a default of 4096 as block size.


TDS 4.2 & 5.0 Login Packet

Packet type (first byte) is 2. The numbers on the left are decimal offsets including the 8 byte packet header.

byte   var type    description
------------------------------
   8   CHAR[30]    host_name
  38   INT8        host_name_length
  39   CHAR[30]    user_name
  69   INT8        user_name_length
  70   CHAR[30]    password
 100   INT8        password_length
 101   CHAR[30]    host_process
 131   INT8        host_process_length
 132   ?           magic1[6]          /* mystery stuff */
 138   INT8        bulk_copy 
 139   ?           magic2[9]          /* mystery stuff */
 148   CHAR[30]    app_name
 178   INT8        app_name_length
 179   CHAR[30]    server_name
 209   INT8        server_name_length
 210   ?           magic3[1]          /* 0, don't know this one either */
 211   INT8        password2_length
 212   CHAR[30]    password2
 242   CHAR[223]   magic4
 465   INT8        password2_length_plus2
 466   INT16       major_version      /* TDS version */
 468   INT16       minor_version      /* TDS version */
 470   CHAR        library_name[10]   /* "Ct-Library" or "DB-Library" */
 480   INT8        library_length
 481   INT16       major_version2     /* program version */
 483   INT16       minor_version2     /* program version */
 485   ?           magic6[3]          /* ? last two octets are 13 and 17 */
                                      /* bdw reports last two as 12 and 16 here  */
                                      /* possibly a bitset flag  */
 488   CHAR[30]    language           /* e.g. "us-english" */
 518   INT8        language_length
 519   ?           magic7[1]          /*  mystery stuff */
 520   INT16       old_secure         /* explanation? */
 522   INT8        encrypted          /*  1 means encrypted all password fields blank */
 523   ?           magic8[1]          /*  no clue... zeros */
 524   CHAR        sec_spare[9]       /* explanation? */
 533   CHAR[30]    char_set           /* e.g. "iso_1" */
 563   INT8        char_set_length
 564   INT8        magic9[1]          /* 1 */ 
 565   CHAR[6]     block_size         /*  in text */
 571   INT8        block_size_length 
 572   ?           magic10[25]        /* lots of stuff here...no clue */

Any help with the magic numbers would be most appreciated.


TDS 7.0+ Login Packet

byte  var type  description
---------------------------
  0   INT32	total packet size
  4   INT8[4]	TDS Version	
                	0x00000070 7.0
			0x01000071 7.1
                	0x02000972 7.2 (7.2.9?)
  8   INT32	packet size (default 4096)
 12   INT8[4]	client program version
 16   INT32	PID of client
 20   INT32	connection id (usually 0)
 24   INT8	option flags 1
                0x80 enable warning messages if SET LANGUAGE issued
                0x40 change to initial database must succeed
                0x20 enable warning messages if USE <database> issued
                0x10 enable BCP
		0x08 use ND5000 floating point format (untested)
		0x04 use VAX floating point format (untested)
		0x02 use EBCDIC encoding (untested)
		0x01 use big-endian byte order (untested)
 25   INT8	option flags 2
                0x80 enable domain login security
		0x40 "USER_SERVER - reserved" 
		0x20 user type is "DQ login"
		0x10 user type is "replication login"
		0x08 "fCacheConnect"
		0x04 "fTranBoundary"
                0x02 client is an ODBC driver
                0x01 change to initial language must succeed
 26   INT8	0x04 spawn user instance (TDS 7.2)
                0x02 XML data type instances are returned as binary XML (TDS 7.2)
                0x01 password change requested (TDS 7.2)
 27   INT8	0x01 SQL Type: 0 = use default, 1 = use T-SQL (TDS 7.2)
 28   INT8[4]	time zone (0x88ffffff ???)
 32   INT8[4]	collation information
 36   INT16	position of client hostname (86)
 38   INT16	hostname length
 40   INT16	position of username
 42   INT16	username length
 44   INT16	position of password
 46   INT16	password length
 48   INT16	position of app name
 50   INT16	app name length
 52   INT16	position of server name
 54   INT16	server name length
 56   INT16	position of remote server/password pairs
 58   INT16	remote server/password pairs length
 60   INT16	position of library name
 62   INT16	library name length
 64   INT16	position of language
 66   INT16	language name (for italian "Italiano", coded UCS2)
 68   INT16	position of database name
 70   INT16	database name length
 72   INT8[6]	MAC address of client
 78   INT16	position of auth portion
 80   INT16	NT authentication length
 82   INT16	next position (same as total packet size)
 84   INT16	0
 86   UCS2LE[n] hostname
      UCS2LE[n]	username
      UCS2LE[n]	encrypted password
      UCS2LE[n]	app name
      UCS2LE[n]	server name
      UCS2LE[n]	library name
      UCS2LE[n]	language name
      UCS2LE[n]	database name
      NT Authentication packet

NT Authentication packet
  0   CHAR[8]	authentication id "NTLMSSP\0"
  8   INT32     1  message type
 12   INT32	0xb201 flags
 16   INT16	domain length
 18   INT16     domain length
 20   INT32     domain offset
 24   INT16     hostname length
 26   INT16     hostname length
 28   INT32     hostname offset
 32   CHAR[n]   hostname
      CHAR[n]   domain
See documentation on Samba for detail (or search ntlm authentication for IIS)

For mssql 2005 before hostname (byte 86) you have
 86   INT16     next position,  or 
                position of file name for a database to be 
                attached during the connection process
 88   INT16     database filename length
 90   INT16     new password position
 92   INT16     new password length
 94   UCS2LE[n] hostname
      ... (as above)

"current pos" is the starting byte address for a Unicode string within the packet. The length of that Unicode string immediately follows. That implies there are at least 2 more strings that could be defined. (character set??)

Username and password are empty if domain authentication is used.

If the client uses an authentication packet, the server replies with an Authentication token followed by an Authentication packet.


TDS 7.0 Authentication Packet

 varies
+------+
| auth |
+------+

auth   authentication data
       for NTLM this message 3

This packet usually follows Authentication token.


Types

HEXDECtypeprotocolnullablesizecollate
0x1F31SYBVOID7+no0
0x2234SYBIMAGEyes4
0x2335SYBTEXTyes4yes
0x2436SYBUNIQUE7+yes1
0x2537SYBVARBINARYyes1
0x2638SYBINTNyes1
0x2739SYBVARCHARyes1
0x2D45SYBBINARYyes1
0x2F47SYBCHARyes1
0x3048SYBINT1no0
0x3250SYBBITno0
0x3452SYBINT2no0
0x3856SYBINT4no0
0x3A58SYBDATETIME4no0
0x3B59SYBREALno0
0x3C60SYBMONEYno0
0x3D61SYBDATETIMEno0
0x3E62SYBFLT8no0
0x4064SYBSINT15no0
0x4165SYBUINT25no0
0x4266SYBUINT45no0
0x4367SYBUINT85no0
0x6298SYBVARIANT7+yes4
0x6399SYBNTEXT7+yes4yes
0x67103SYBNVARCHAR7+yes1
0x68104SYBBITNyes1
0x6A106SYBDECIMALyes1
0x6C108SYBNUMERICyes1
0x6D109SYBFLTNyes1
0x6E110SYBMONEYNyes1
0x6F111SYBDATETIMNyes1
0x7A122SYBMONEY4no0
0x7F127SYBINT8no0
0xA5165XSYBVARBINARY7+yes2 *
0xA7167XSYBVARCHAR7+yes2 *yes
0xAD173XSYBBINARY7+yes2
0xAF175XSYBCHAR7+yes2yes
0xE1225SYBLONGBINARY5yes4
0xE7231XSYBNVARCHAR7+yes2 *yes
0xEF239XSYBNCHAR7+yes2yes

* Under TDS 7.2+ these types allow size to be -1, representing varchar(max), varbinary(max) and nvarchar(max). Data representation for them changes:

  • size is 64 (not 16) bits
  • size of -1 means NULL
  • size of -2 means the size is unknown
  • the data are split in chunks, where each chunk starts with a 32-bit size
  • a chunk with size <= 0 is the terminal chunk

Collation type - TDS 7.1

The collation structure contains information about the character set encoding and comparison method.

 INT16      INT16    INT8
+----------+--------+------------+
| codepage | flags  | charset_id |
+----------+--------+------------+

codepage    windows codepage (see http://www.microsoft.com/globaldev/nlsweb/)
            also specified in lcid column of master..syslanguages
flags       sort flags
            0x100 binary compare
            0x080 width insensitive
            0x040 Katatype insensitive
            0x020 accent insensitive
            0x010 case insensitive
            If binary flag is specified other flags are not present
            Low nibble of flags is a charset specifier (like chinese dialect)
charset_id  charset id in master..syscharsets table or zero for no SQL collations

Collations names can be obtained from select name from ::fn_helpcollations() query


Column Metadata

 INT8          XCHAR[n]       INT8    INT32   INT8
+-------------+--------------+-------+-------+---------+
| column name | column name  | flags |  user | column  |
|   length    |              |       |  type |  type   |
+-------------+--------------+-------+-------+---------+

 varies        INT8       INT8       INT16      XCHAR[n]     INT8     varies
+-------------+----------+----------+----------+------------+--------+--------+
| column size |precision |  scale   | t length | table name | locale | locale |
|             |          |          |          |            | length |  info  |
| (optional)  |(optional)|(optional)|(optional)| (optional) | (opt)  | (opt)  |
+-------------+----------+----------+----------+------------+--------+--------+

column name length 
column name        column name in result set, not necessarily db column name
flags              bit flags
                   0x1  hidden (TDS 5.0)
                   0x2  key
                   0x10 writable
                   0x20 can be NULL
                   0x40 identity
user type          usertype column from syscolumns
column type        column type
column size        not present for fixed size columns
precision          present only for SYBDECIMAL and SYBNUMERIC
scale              present only for SYBDECIMAL and SYBNUMERIC
t length           present only for SYBTEXT and SYBIMAGE, length of table name
table name         present only for SYBTEXT and SYBIMAGE
locale length      length of locale info (in bytes)
                   only for TDS 5.0 results (not for parameters)
locale info        unknown
                   only for TDS 5.0 results (not for parameters)

Client request

Normal tokens (contained in packets 0xF)

TODO

Special packets


Language packet (0x1 1)

This sample packet contain just SQL commands. It's supported by all TDS version (although TDS 5.0 have others token with similar use)

  XCHAR[n]
+---------+
| string  |
+---------+

string   SQL text

RPC packet (0x3 3)

Do not confuse an RPC packet with an RPC token. The RPC packet is supported by all version of TDS; the RPC token is supported only by TDS 5.0 (and has different format). This is the oldest (and the only one in mssql) way to call directly an RPC. Sybase also documents it, but as 0xE.

  INT16         XCHAR[n]   INT16  
+-------------+----------+-------+----------+
| name length | rpc name | flags | params   |
+-------------+----------+-------+----------+

name length   length of RPC name in characters. 
              mssql2k+ support some core RPC using numbers
              If a number is used instead of name name length is marked as -1
              (null) and a INT16 is used for the name.
                0x1  1  sp_cursor
                0x2  2  sp_cursoropen
                0x3  3  sp_cursorprepare
                0x4  4  sp_cursorexecute
                0x5  5  sp_cursorprepexec
                0x6  6  sp_cursorunprepare
                0x7  7  sp_cursorfetch
                0x8  8  sp_cursoroption
                0x9  9  sp_cursorclose
                0xA  10 sp_executesql
                0xB  11 sp_prepare
                0xC  12 sp_execute ???
                0xD  13 sp_prepexec
                0xE  14 sp_prepexecrpc
                0xF  15 sp_unprepare
              sp_execute seems to have some problems, even MS ODBC use name
              version instead of number.
rpc name      name of RPC.
flags         bit flags. 
               0x1 1 recompile procedure (TDS 7.0+/TDS 5.0)
               0x2 2 no metadata (TDS 7.0+)
                     (I don't know meaning of "no metadata" -- freddy77)
params        parameters. See below

Every parameter has the following structure

+-----------+------+
| data info | data |
+-----------+------+
data info    data information. See below
data         data. See results for detail

Data info structure

  INT8          XCHAR[n]     INT8    INT32
+-------------+------------+-------+--------------------+
| name length | param name | flags | usertype (TDS 5.0) |
+-------------+------------+-------+--------------------+
  INT8   varies  varies     INT8[5]         INT8
+------+-------+----------+---------------+------------------+
| type | size  | optional | collate       | locale           |
|      | (opt) | (opt)    | info(TDS 7.1) | length (TDS 5.0) |
+------+-------+----------+---------------+------------------+

name length   parameter name length (0 if unused)
param name    parameter name
flags         bit Name           Meaning
              0x1 TDS_RPC_OUTPUT output parameter
              0x2 TDS_RPC_NODEF  output parameter has no default value. 
                                 Valid only with TDS_RPC_OUTPUT.

usertype      usertype
type          param type
size          see Results
optional      see Results. Blobs DO NOT have 
              optional on input parameters (output blob parameters
              are not supported by any version of TDS).
collate info  only for type that want collate info and using TDS 7.1
locale length locale information length. Usually 0 (if not locale
              information follow, the structure is unknown)

Chained RPCs

Under TDS 7.0+ is possible to chain multiple RPCs together. This is useful to limit packets and round-trips with server. RPCs can be chained using byte 0x80 (TDS 7.0/TDS 7.1) or 0xFF (TDS 7.2).

       INT8                     INT8
+-----+------------------------+----------------+-----+
| RPC | 0x80 (TDS 7.0/TDS 7.1) | 0xFF (TDS 7.2) | RPC | ...
+-----+------------------------+----------------+-----+

Bulk Copy packet (0x7 7)

This documents a TDS 5.0 packet. It might be true for others....

BCP Packet Structure

 INT8       INT16          INT32                
+----------+-------------+--------------------+
|  packet  | last packet |  packet            |
| type = 7 |  indicator  |   size             |
+----------+-------------+--------------------+

		followed by N row buffers, 
		where N is computed by exhausting the packet size

BCP Packet Row Buffer

 INT16          INT8       INT8	      INT16	    
+--------------+----------+----------+--------------+
| size         |  ncols   |  zero    | size (again) |
+--------------+----------+----------+--------------+

	followed by column buffers (data), where 
		
		first, the fixed-size datatype columns

		 fixed size and count (determined by column definition)
		+--------------+
		|    data .... | [repeats once for each mandatory column]
		+--------------+

		then, the variable-size (including nullable) datatype columns

		 variable size and count
		+--------------+
		|    data .... | [repeats ncol times]
		+--------------+

		followed by two tables (!) to describe the column buffers

 Adjustment Table (optional)
 
 INT8       INT8        
+----------+----------+
| 1 + ncols| offset   | [repeats ncol + 1 times]
+----------+----------+

 Offset Table (mandatory)
 
 INT8       INT8        
+----------+----------+
| 1 + ncols| offset   | [repeats ncol + 1 times]
+----------+----------+

The BCP packet has a slightly different Packet header!?

Computation of Offset and Adjustment tables

The offset and adjustment tables describe the postion of the first byte of each variable-size column. The first element holds the count of elements in the offset/adjustment table. Thereafer, the offsets are arranged in reverse order: the last element — which is also the last byte of the row buffer — holds the offset from the start of the row of the first variable-size column. The next-to-last offset table element holds the starting position of the second variable-size column, and so on.

Offset Table Example

  1. 5
  2. 31
  3. 22
  4. 21
  5. 8
  6. 4

The first element is 5 because there are five elements in the list. There are 4 column data buffers with 5 endpoints. The first column's data begins at offset 4. Computations:

column 1
offset 4
length: 4 = 8 - 4
column 2
offset 8
length: 13 = 21 - 8
column 3
offset 21
length: 1 = 22 - 21
column 4
offset 22
length: 9 = 31 - 22

Any column not accounted for is implicitly NULL. To represent a NULL column between two dataful columns, the offset table will have adjacent entries of the same value.

Adjustment table

The so-called adjustment table provides for longer rows. The reader will note the Offset table has 8-bit elements, which would limit the width of the table: the last variable column would have to end less than 256 bytes from the start fo the row. Rather than changing the definition of the Offset table, a second table, the Adjustment table, was introduced. It holds high-order bytes for the column offsets.

In other words, to compute a variable column's offset from the start of the row buffer, the server looks up its offset table value, then consults the same position in the adjustment table, and splices them together.

Offset table commentary

The BCP packet is very dense. The data formats are governed by the table definition. Non-NULL columns of course must be present; there is no need to count them or compute their size. The NULL columns are undelimited; their boundaries are defined by the minimalist offset table.

The Adjustment table seems silly at first glance. Why not just make the offset table's elements 16 or or even 32 bits? The reason is overhead. Most rows will have less than 256 bytes of variable column data. By using the adjustment table, the BCP packet avoids adding one or even three empty bytes per column per row.

Why is the table in reverse order? Because that places the first offset at a known location: the end of each row gives the start of the first column. The server can work its way down the offset table and compute the column sizes. If they don't add up — if there are data between the (presumed) end of the last column and the start of the offset table — the server knows it should look for an adjustment table. Because the scheme is infinitely repeatable, rows could one day grow to terabyte widths without redefining the packet structure.


Server Responses

Responses from the server start with a single octet (token) identifying its type. If variable length, they generally have the length as the second and third bytes

Tokens encountered thus far:
HEXDECnamenote
0x2032Param Format 25.0 only
0x2133Language5.0 only, client-side
0x2234OrderBy 25.0 only??
0x6197Row Format 25.0 only
0x71113"Logout"5.0? ct_close(), client-side?
0x79121Return Status 
0x7C124Process ID4.2 only
0x80128Cursor Close5.0 only
0x81129Cursor Delete5.0 only
0x811297.0 Result7.0 only
0x82130Cursor Fetch5.0 only
0x83131Cursor Info5.0 only
0x84132Cursor Open5.0 only
0x86134Cursor Declare5.0 only
0x881367.0 Compute Result7.0 only
0xA0160Column Name4.2 only
0xA1161Column Format4.2 only
0xA3163Dynamic 25.0 only
0xA4164Table namesname of tables in a FOR BROWSE select
0xA5165Column Infocolumn information in a FOR BROWSE select
0xA6166Option Cmd5.0 only
0xA7167Compute Names 
0xA8168Compute Result 
0xA9169Order By 
0xAA170Error Message 
0xAB171Info Message 
0xAC172Output Parameters 
0xAD173Login Acknowledgement 
0xAE174Control 
0xD1209Data --- Row Result 
0xD3211Data --- Compute Result 
0xD7215Params5.0 only
0xE2226Capability5.0 only. Information on server
0xE3227Environment Change(database change, packet size, etc...)
0xE5229Extended Error Message 
0xE6230DBRPC5.0 only RPC calls
0xE7231Dynamic5.0 only
0xEC236Param Format5.0 only
0xED237Authentication7.0 only
0xEE238Result Set5.0 only
0xFD253Result Set Done 
0xFE254Process Done 
0xFF255Done inside Process 

Param Format 2 - TDS 5.0 (0x20 32)

TODO.  


Language - TDS 5.0 (0x21 33)

 INT32    INT8     CHAR[n]
+--------+--------+-------+
| length | status | query |
+--------+--------+-------+

length  total token length
status  0 no args
        1 has args (followed by PARAMFMT/PARAMS)
query   query (total length - 1)

Order By 2 (0x22 34)

TODO.  


Row Format 2 - TDS 5.0 (0x61 97)

TODO.  


"Logout" (0x71 113)

No information. (1 byte, value=0 ?)  


Return Status (0x79 121)

 INT32
+---------------+
| Return status |
+---------------+

The return value of a stored procedure.  

Process ID (0x7C 124)


 8 bytes
+----------------+
| process number |
+----------------+

Presumably the process ID number for an executing stored procedure. (I'm not sure how this would ever be used by a client. *mjs*)  


Cursor Close - TDS 5.0 (0x80 128)

TODO.  


Cursor Delete - TDS 5.0 (0x81 129)

TODO.  


Result - TDS 7.0+ (0x81 129)

 INT16  
+----------+-------------+
| #columns | column_info | 
+----------+-------------+

The TDS 7.0 column_info is formatted as follows for each column:

 INT16      INT16   INT8   varies  varies     INT8[5]         INT8          UCS2LE[n]
+----------+-------+------+-------+----------+---------------+-------------+---------+
| usertype | flags | type | size  | optional | collate       | name length | name    | 
|          |       |      | (opt) | (opt)    | info(TDS 7.1) |             |         |
+----------+-------+------+-------+----------+---------------+-------------+---------+

usertype	type modifier
flags		bit flags
		0x1  can be NULL
		0x8  can be written (it's not an expression)
		0x10 identity 
type		data type, values >128 indicate a large type
size		none for fixed size types
		4 bytes for blob and text
		2 bytes for large types
		1 byte for all others
optional
                               INT8        INT8
                              +-----------+-------+
  numeric/decimal types:      | precision | scale |
                              +-----------+-------+

                               INT16               UCS2LE[n]
                              +-------------------+------------+
  blob/text types:            | table name length | table name |
                              +-------------------+------------+

  collate info are available only using TDS 7.1 and for characters types (but not
  for old type like short VARCHAR, only 2byte length versions)

Cursor Fetch - TDS 5.0 (0x82 130)

TODO.

Cursor Info - TDS 5.0 (0x83 131)

TODO.

Cursor Open - TDS 5.0 (0x84 132)

TODO.

Cursor Declare - TDS 5.0 (0x86 134)

TODO.

Compute Result - TDS 7.0+ (0x88 136)

TODO.

Column Name (0xA0 160)

 INT16          INT8      CHAR[n]               INT8      CHAR[n] 
+--------------+---------+--------------+------+---------+--------------+
| total length | length1 | column1 name | .... | lengthN | columnN name |
+--------------+---------+--------------+------+---------+--------------+

This token is the first token that contain result informations. Is usually followed by Column Format token (0xA1 161)


Column Format (0xA1 161)

 INT16  
+--------------+-------------+
| total length | column_info | 
+--------------+-------------+

The number of columns is the same of previous Column Name token.

The TDS 4.2 column_info is formatted as follows for each column:

 INT8[4]     INT8   varies  varies
+-----------+------+-------+----------+
| usertype/ | type | size  | optional |
|   flags   |      | (opt) | (opt)    |
+-----------+------+-------+----------+

usertype/flags for Sybase

   INT32
  +----------+
  | usertype |
  +----------+

usertype/flags for MSSQL

   INT16
  +----------+-------+
  | usertype | flags |
  +----------+-------+

usertype	type modifier
flags		bit flags (only MSSQL)
		0x1  can be NULL
		0x8  can be written (it's not an expression)
		0x10 identity 
type		data type
size		none for fixed size types
		4 bytes for blob and text
		1 byte for all others
                (TDS 4.2 do not support large types)
optional
                               INT8        INT8
                              +-----------+-------+
  numeric/decimal types:      | precision | scale |
  (supported??)               +-----------+-------+

                               INT16               CHAR[n]
                              +-------------------+------------+
  blob/text types:            | table name length | table name |
                              +-------------------+------------+

Dynamic 2 - TDS 5.0 (0xA3 163)

TODO.

Option Cmd - TDS 5.0 (0xA6 166)

TODO.

Compute Result (0xA8 168)

 INT16          INT16        INT8       varies        INT8      INT8[n]
+--------------+------------+----------+-------------+---------+-------+
| total length | compute id | #columns | column info | #bycols | bycol |
+--------------+------------+----------+-------------+---------+-------+

column info:

 INT8       INT8      INT32      INT8     varies  INT8               varies
+----------+---------+----------+--------+-------+------------------+----------------+
| operator | operand | usertype | column | size  | locale length    | locale info    |
|          |         |          |  type  | (opt) |  info (TDS 5.0)  | (TDS 5.0)      |
+----------+---------+----------+--------+-------+------------------+----------------+

operator      operator
              0x4b COUNT
              0x4c UNSIGNED? COUNT
              0x4d SUM
              0x4e UNSIGNED? SUM
              0x4f AVG
              0x50 UNSIGNED? AVG
              0x51 MIN
              0x52 MAX
              0x09 COUNT_BIG (mssql2k)
              0x30 STDEV (mssql2k)
              0x31 STDEVP (mssql2k)
              0x32 VAR (mssql2k)
              0x33 VARP (mssql2k)
              0x72 CHECKSUM_AGG (mssql2k)
operand       ???
usertype      usertype
column type   data type
size          data size
locale length length of locale informations
locale info   locale informations (unknown)

Each bycol information contains column info for a specific column.

TODO: optional possible?? collate infos ??

TabName (0xA4 164)

TDS4/5/7:

 INT16          INT16         XCHAR[n]
+--------------+-------------+------------+
| total length | name length | table name | ...
+--------------+-------------+------------+

name length   table name length
table name    table name

TDS 7.1:

 INT16          varies
+--------------+-------------+
| total length | table names |
+--------------+-------------+

table name:
 INT8              INT16              XCHAR[n]
+-----------------+------------------+----------------+
| # of components | component length | component name |
+-----------------+------------------+----------------+

ie:
  name        -> 01  04 00  ucs2le "name"
  db..name    -> 03  02 00  ucs2le "db"  00 00  04 00  ucs2le "name"
  db.dbo.name -> 03  02 00  ucs2le "db"  03 00  ucs2le "dbo"  04 00  ucs2le "name"

Column Info (0xA5 165)

 INT16          varies
+--------------+--------------+
| total length | column infos |
+--------------+--------------+

column info:

 INT8    INT8          INT8    INT8          XCHAR[n]
+-------+-------------+-------+-------------+-------------+
| index | table index | flags | name length | column name |
|       |             |       |  (opt)      |  (opt)      |
+-------+-------------+-------+-------------+-------------+

index        index in result format (1-based)
table index  index in previous TabName (1-based)
             0 means no table (ie computed)
flags        set of flags
             0x04 expression
             0x08 key
             0x10 hidden
             0x20 column name present
name length  length of following column
column name  real column name (result contain the label)

This token follow TabName token    


compute "control" ? (0xA7 167)

"control" (0xAE 174)

Miscellaneous note (from *bdw* ?) found with 0xAE:

  has one byte for each column, 
  comes between result(238) and first row(209),
  I believe computed column info is stored here, need to investigate

Order By (0xA9 169)

 INT16    variable (1 byte per col)
+--------+---------+
| length | orders  |
+--------+---------+

length		Length of packet(and number of cols)
orders          one byte per order by indicating the
                column # in the output matching the
                order from Column Info and Column Names
                and data in following Row Data items.
                A 0 indicates the column is not in the
                resulting rows.

an example:
select first_name, last_name, number from employee
order by salary, number
assuming the columns are returned in the order
queried:
first_name then last_name, then number. we would have:
----------------
|  2   | 0 | 3 |
----------------
where length = 2 then the orders evaluate:
0 for salary, meaning there is no salary data returned
3 for number, meaning the 3rd data item corresponding
to a column is the number

 


Error Message (0xAA 170)

Non-error Message (0xAB 171)

Extended Error Message (0xE5 229)

 INT16    INT32        INT8    INT8    
+--------+------------+-------+-------+
| length | msg number | state | level |
+--------+------------+-------+-------+

 INT16      XCHAR[n]  INT8       XCHAR[n]  INT8       XCHAR[n]  INT16             INT32
+----------+---------+----------+---------+----------+---------+-----------------+-----------------+
| m length | message | s length | server  | p length | process | line#(TDS 7.1-) | line# (TDS 7.2) |
+----------+---------+----------+---------+----------+---------+-----------------+-----------------+

length		Length of packet
msg number	SQL message number
state		?
level		An error if level > 10, a message if level <= 10
m length	Length of message
message		Text of error/message
s length	Length of server name
server		Name of "server" ?
p length	Length of process name
process name	Stored procedure name, if any
line#		Line number of input which generated the message

Output Parameters (0xAC 172)

  Output parameters of a stored procedure.

 INT16    INT8       XCHAR[n]  INT8    INT32      INT8
+--------+----------+---------+-------+----------+----------+------+
| length | c length | colname | flags | usertype | datatype | .... | 
+--------+----------+---------+-------+----------+----------+------+

length		Length of packet
c length	Length of colname
colname		Name of column
flags		0x1 Nullable
usertype	cf. systypes table in database
datatype	Type of data returned

The trailing information depends on whether the datatype is
a fixed size datatype.
				 N bytes
				+---------+
  Datatype of fixed size N	| data    |
				+---------+

				 INT8          INT8            N bytes
				+-------------+---------------+--------+
  Otherwise			| column size | actual size N | data   |
				+-------------+---------------+--------+

Login Acknowledgement (0xAD 173)

 INT16    INT8    4 bytes   INT8       XCHAR[n] 4 bytes
+--------+-------+---------+----------+--------+----------+
| length |  ack  | version | t length |  text  | ser_ver  |
+--------+-------+---------+----------+--------+----------+

length		length of packet
ack		0x01 success	4.2
		0x05 success	5.0
		0x06 failure	5.0
version		TDS version 4 bytes:  major.minor.?.?
t length	length of text
text		server name (ie 'Microsoft SQL Server')
ser_ver		Server version
		(with strange encoding, differring from TDS version)

   


Data - Row Result (0xD1 209)

Data - Compute Result (0xD3 211)

 INT8       variable size
+----------+--------------------+
|  token   |   row data         |
+----------+--------------------+

Row data starts with one byte (decimal 209), for variable length types, a one byte length field precedes the data, for fixed length records just the data appears.
Note: nullable integers and floats are variable length.

For example: sp_who

The first field is spid, a smallint
The second field is status a char(12), in our example "recv sleep "

The row would look like this:

  byte  0 is the token
  bytes 1-2 are a smallint in low-endian
  byte  3 is the length of the char field
  bytes 4-15 is the char field

byte  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
hex  D1  01  00  0C  72  65  63  76  20  73  6C  65  65  70  20  20
    209   1   0  12   r   e   c   v ' '   s   l   e   e   p ' ' ' '

Params - TDS 5.0 (0xD7 215)

TODO.

Capability - TDS 5.0 (0xE2 226)

 INT16    variable
+--------+--------------+
| length | capabilities |
+--------+--------------+

length		Length of capability string
capabilities	Server capabilities?  Related to login magic?

Environment change (0xE3 227)

 INT16    INT8       INT8        CHAR[n]   INT8        CHAR[n] 
+--------+----------+-----------+---------+-----------+---------+
| length | env code | t1 length |  text1  | t2 length |  text2  |
+--------+----------+-----------+---------+-----------+---------+

env code	Code for what part of environment changed
	0x01  database context
	0x02  language
	0x03  character set
	0x04  packet size
	0x05  TDS 7.0+ LCID
	0x06  TDS 7.0+ ??? (sort method? sql server encoding?)
	0x07  Collation info
text1		Old value
text2		New value

text1 and text2 are text information (coded in ucs2 in TDS 7.0+) except 
collation info that's a structure (see collation structure)

DBRPC - TDS 5.0 (0xE6 230)

TODO.

Dynamic - TDS 5.0 (0xE7 231)

TODO.

Param Format - TDS 5.0 (0xEC 236)

 INT16     INT16        variable size
+---------+------------+-------------------+
| length  | number of  | parameter info    |
|         | parameters |                   |
+---------+------------+-------------------+

length            	length of message following this field
number of parameters	number of parameter formats following
list of formats		I (*bdw*) imagine it uses the column format structure.

Authentication - TDS 7.0 (0xED 237)

 INT16     varies
+---------+------+
| length  | auth |
+---------+------+

length   length of authentication data following this field
auth     authentication data
         for NTLM this is message 2

Client reply with Authentication packet.

Result Set - TDS 5.0 (0xEE 238)

 INT16     INT16        variable size
+---------+------------+-----------------+
| length  | number of  | column info     |
|         | columns    |                 |
+---------+------------+-----------------+


Fields:
length             length of message following this field
number of columns  number of columns in the result set, this many column
                   information fields will follow.
column info        column info

Done Packets

Result Set Done (0xFD 253)
Process Done (0xFE 254)
Done Inside Process (0xFF 255)

 INT16       INT16     INT32                  INT64
+-----------+---------+----------------------+---------------------+
| bit flags | unknown | row count (TDS 7.1-) | row count (TDS 7.2) |
+-----------+---------+----------------------+---------------------+

Fields:
bit flags          0x01 more results
		   0x02 error (like invalid sql syntax)
		   0x10 row count is valid
		   0x20 cancelled
unknown            2,0  /* something to do with block size perhaps */
row count          number of rows affected / returned in the result set. 
                   row count is 64-bit using TDS 7.2.
		(FIXME check if "affected / returned" is correct)

"Result Set Complete" is the end of a query that doesn't create a process on the server. I.e., it doesn't call a stored procedure.
"Process Done" is the end of a stored procedure
"Done In Process" means that a query internal to a stored procedure has finished, but the stored procedure isn't done overall.


Acknowledgements

The following people have contributed to this document:

  • Brian Bruns (first draft, protocol discovery)
  • Brian Wheeler (protocol discovery)
  • Mark Schaal (second draft)
  • Frediano Ziglio

(short list)

Document Status

$Id: tds.html,v 1.41 2008-11-25 23:38:33 jklowden Exp $

Valid HTML 4.01 Strict

freetds-1.3.6/doc/userguide.xsl000644 025423 025423 00000002431 14056414221 020073 0ustar00fredianofrediano000000 000000 .gif ../images/ gif index freetds-1.3.6/doc/userguide.xml000644 025423 025423 00001173723 14056414355 020113 0ustar00fredianofrediano000000 000000 %ug.desc; FreeTDS"> DB-Library'> CT-Library'> ODBC'> iODBC'> unixODBC'> freetds.conf"> ]> &ug.date; &freetds; User Guide A Guide to Installing, Configuring, and Running &freetds; Brian Bruns James K. Lowden Frediano Ziglio 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 Brian Bruns and James K. Lowden 2015 2016 2017 2018 2019 Frediano Ziglio Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License. About this User Guide This User Guide describes &freetds; &version;. It is the product of (lots of) happy collaborative effort. Although Brian's name and mine are at the top of it, behind it are many others, who contributed thoughtful suggestions, bamboozled questions, stellar prose, and terse instructions. I don't mention this for the usual reasons (the enumeration of which I leave to you) but rather to emphasize that the purpose of our effort is to help you and those who come after you to have the easiest and most enjoyable time with &freetds;. It is surprisingly hard, after a while, to remember how it can be for someone newly approaching a project to use it. What seems as obvious as a fog horn to an old hand may be much more like the fog itself to the newcomer. That can make installing and setting up new software a puzzling or frustrating experience. You may have heard, It's easy if you know how. Indeed it is, and that's our purpose here: to make it easy, by letting you know how. This guide is here for you, and we hope that you will be here for it, that others might benefit from your experience or inexperience. The most recent version The version you're reading is: &ug.date; &ug.id; can be found on the &freetds; web site, where you will also find the most up to date FAQ, as well as links to the anonymous and browseable git repository. If you find something wrong, unclear, badly put, misleading, or incorrigible, I hope you will let us know. Post your musings or rants to the mailing list (see Helping). Patches to doc/userguide.xml are especially welcome, of course. By taking the time let us know what you think, perhaps the path to enlightenment will be made a little smoother for the fellow behind you. A few technical notes. This guide is written in XML DocBook format, specifications for which are found in the DocBook book. It was converted to HTML with xmlto. The XML text is distributed with the rest of the source code, and may be edited with your favorite or least favorite text editor. Enough. Let's begin. --jkl What is &freetds;? &freetds; is re-implementation of C libraries originally marketed by Sybase and Microsoft SQL Server. It allows many open source applications such as Perl and PHP (or your own C or C++ program) to connect to Sybase or Microsoft SQL Server. &freetds; provides drop-in replacements for Sybase's &dblib; and &ctlib; Microsoft's &dblib; (which differs in small details from Sybase's) the &odbc; drivers from both vendors interactive SQL and BCP utilities The TDS part of the name comes from name of the protocol used to communicate with such servers: the Tabular Data Stream. &freetds; is distributed in source code form, and is expected to compile on just about any operating system. That means every form of Unix® and Unix-like™ system (including notable variants such as Interix® and QNX®), as well as Win32®, VMS®, and OS X®. If it doesn't compile on your system — and you're not using MS-DOS® — it's probably considered a bug. Background: The <acronym>TDS</acronym> Protocol and related <acronym>API</acronym>s TDS is a protocol, a set of rules describing how to transmit data between two computers. Like any protocol, it defines the types of messages that can be sent, and the order in which they may be sent. Protocols describe the bits on the wire, how data flow. In reading this manual, it may be helpful to keep in mind that a protocol is not an API, although the two are related. The server recognizes and speaks a protocol; anything that can send it the correct combination of bytes in the right order can communicate with it. But programmers aren't generally in the business of sending bytes; that's the job of a library. Over the years, there have been a few libraries — each with its own API — that do the work of moving SQL through a TDS pipe. &odbc;, &dblib;, and &ctlib; have very different APIs, but they're all one to the server, because on the wire they speak TDS. The TDS protocol was designed and developed by Sybase Inc. for their Sybase SQL Server relational database engine in 1984. The problem Sybase faced then still exists: There was no commonly accepted application-level protocol to transfer data between a database server and its client. To encourage the use of their product, Sybase came up with &dblib;. &dblib; provided an API to the client program, and communicated with the server. What it sent to the server took the form of a stream of bytes meant for tables of data, a Tabular Data Stream. In 1990 Sybase entered into a technology sharing agreement with Microsoft which resulted in Microsoft marketing its own SQL Server. Microsoft kept the &dblib; API and added &odbc;. (Microsoft has since added other APIs, too. It no longer supports its own &dblib; implementation.) At about the same time, Sybase introduced a more powerful successor to &dblib;, called &ctlib;, and called the pair OpenClient. &ctlib;, &dblib;, and &odbc; are APIs that — however different their programming style may be — all communicate with the server in the same way. The language they use is TDS. The TDS protocol comes in several flavors, most of which were not openly documented. If anything, it was considered to be something like a trade secret, or at least proprietary technology. The exception is TDS 5.0, used exclusively by Sybase, for which documentation is available from Sybase. History of <acronym>TDS</acronym> Versions At first, there was One Version of TDS common to both vendors but, in keeping with the broad history of private ventures, they soon diverged. Each vendor has subsequently brought out different versions, and neither supports the other's flavor. That is to say, each vendor's client libraries use the latest version of TDS offered by that vendor. You can't reliably use Microsoft's libraries to connect to Sybase, or Sybase's libraries to connect to Microsoft. In some cases you'll get a connection, but pretty soon you'll bump into some incompatibility. Versions of the <acronym>TDS</acronym> protocol TDS 4.2 Sybase and Microsoft The version in use at the time of the Sybase/Microsoft split. TDS 5.0 Sybase Introduced for Sybase. Because TDS 5.0 includes negotiated capabilities through which protocol features can be expanded, we are unlikely to see a new TDS version from Sybase. TDS 7.0 Microsoft Introduced for SQL Server 7.0. Includes support for the extended datatypes in SQL Server 7.0 (such as char/varchar fields of more than 255 characters). It also includes support for Unicode. TDS 7.1 Microsoft was 8.0 Earlier &freetds; documentation referred to versions 7, 8 and 9. Microsoft subsequently published a protocol specification document denoting 7.1 and 7.2, and one finds scattered references using that scheme elsewhere, too. For that reason, &freetds; switched to Microsoft's nomenclature. Introduced for SQL Server 2000. Includes support for big integer (64-bit int) and variant datatypes. TDS 7.2 Microsoft was 9.0 Introduced for SQL Server 2005. Includes support for varchar(max), varbinary(max), xml datatypes and MARS. TDS 7.3 Microsoft Introduced for SQL Server 2008. Includes support for extended date/time, table as parameters. TDS 7.4 Microsoft Introduced for SQL Server 2012. Includes support for session recovery. History of &freetds; &freetds; was and is developed by observation and experimentation, which is to say, by trial and error. In early 1997, the only option for connecting to a Sybase server from Linux or other free systems was an aging Sybase-released version of OpenClient. Unfortunately it had a few problems. The original release was a.out-based, although Greg Thain did a great service in converting the library to ELF. Secondly, it included only the newer &ctlib; API. The older &dblib; API was missing. Brian Bruns, a Sybase DBA and originator of the &freetds; project, had some &dblib; programs he wanted to run under Linux, and thus began the &freetds; project. The original work focused on &dblib; and version 5.0 of the protocol, but quickly expanded to include a &ctlib; compatible layer and TDS version 4.2. Later support for &odbc; and TDS 7.0 and 7.1 was added. Craig Spannring wrote a Java JDBC driver which became FreeTDS/JDBC. As the project matured, it gained new participants. Frediano Ziglio greatly expanded the &odbc; driver, and continues to improve both it and the underlying TDS library. Bill Thompson wrote most of the present BCP system and added cursors to our &ctlib;. James K. Lowden joined the project to add documentation, and in 2002 became its maintainer. Such are the rewards for doing a good deed. There have been many other contributions. Please see the AUTHORS.md in the distribution for a (we hope) complete list. Current Projects, Language Bindings, and Alternatives Current Projects &freetds; consists of some C libraries. The &freetds; libraries support three separate APIs: &dblib;, &ctlib;, and &odbc;. Underlying these three is libtds, which handles the low-level details of the TDS protocol, such as sending, receiving, and datatype conversion. This document and the FreeTDS website are dedicated to these libraries. Status The libraries are portable, mature, and stable. They're expected to compile readily and normally do not crash or corrupt data. Extensive logging aids in diagnosing problems. While they do not include every feature provided by the vendors' libraries, they do faithfully implement a useful — and widely used — subset of their APIs. The &dblib; and &ctlib; APIs have been usable for several years. They have been successfully substituted for Sybase's own libraries in a variety of venues, including Perl and PHP. The ODBC driver should be fully ODBC 3.5 compliant. Basic API coverage information for all libraries may be found in this manual. It is maintained in doc/api_status.txt, included in the source distribution. For Microsoft servers, &freetds; now offers the best &dblib; for any OS on the planet (including Windows!) thanks not only to the hard work of its contributors, but also to Microsoft'sMicrosoft ceased enhancing &dblib; in 2001, advising customers to avoid using &dblib;. For Microsoft's unmaintained product, that's good advice. But if the &dblib; specification meets your needs, &freetds; permits you to keep using it with little loss (and some gain) of functionality. strategy. It is the only Win64 implementation of &dblib;, and the only Win32 implementation to support modern versions of the protocol. (SQL Server 2008 still accepts the TDS 4.2 connections that Microsoft's old library uses, but rejects BCP uploads with a spurious permission-denied message.) In addition to the core &dblib; API, &freetds; includes a full implementation of &dblib;'s bcp functions, as well as freebcp, a replacement for Sybase's bcp utility. How big is it? &freetds; has over 100,000 lines of C code, maintained by a handful of developers. Patches arrive irregularly, varying in size from one-liners to thousand-line monsters. Almost all are applied or used in some way. The mailing list has some 700 or so subscribers at this writing. Safe to say, &freetds;'s success so far lies somewhere between the Beetle and the Edsel. Who uses it? Oh, pretty much everyone. &freetds; users number in the tens of thousands. It's used by large corporations, by the U.S. federal government (e.g. Database Access Library at the National Center for Biotechnology Information) and, judging by the mailing list, by many webservers running Apache and PHP. Sybase recommends &freetds; for their EAServer product. Microsoft recommends &freetds; to their customers who want access to Microsoft SQL Server from non-Win32 clients. So do we. Languages besides C You may be wondering how these libraries fit with Perl, PHP, TCL, Python, or other popular scripting languages. Most of these languages have bindings to Sybase that use either the &dblib; or &ctlib; API, for which &freetds; is intended as a drop-in replacement. For instance, Michael Peppler's DBD::Sybase works very well using &freetds; to access Sybase or Microsoft SQL Servers. PHP has options for sybase (&dblib;) and sybase-ct (&ctlib;) APIs. Alternatives Should &freetds; not suit your needs, some alternatives jTDS If Java is your game, we refer you to the jTDS project on SourceForge. It is a fork of the FreeTDS/JDBC project, by Craig Spannring, and is a free, native 100% Java implementation of a Type 4 JDBC driver. Sybase OpenClient In the time since &freetds; was started, Sybase (as well as most major DBMS vendors) has released its database for the Intel GNU/Linux platform. The good: it is a solid product and supports TDS 4.2 and TDS 5.0. The bad: it doesn't support TDS 7.0 or Linux/*BSD on non-Intel platforms. The ugly: Microsoft broke date handling for big endian Sybase clients. Depending on platform, it may cost something. &odbc; bridge products They use the &odbc; driver on the NT box where your SQL Server runs so you'll never have trouble with new protocols and the like. On the downside, they can be costly and may be inefficient. We know of EasySoft ODBC-ODBC Bridge from EasySoft, Universal Data Access Driver from OpenLink Software, SequeLink from Merant, and &odbc; Router from August Software Corporation. Inline &odbc; driver Based on libtds, this is a native &odbc; driver for i386 *nix. It is free in price, but comes only as a binary at the present time. DBD::Proxy We have no direct experience with this Perl-only option. It has the same caveats as an &odbc; bridge except it's free. Build &freetds; If you build it they will come. The <acronym>GNU</acronym> World &freetds; uses GNU Autoconf, Automake, and libtool Versions used for this release autoconf (GNU Autoconf) 2.69 automake (GNU automake) 1.15 ltmain.sh (GNU libtool) 2.4.6 to increase portability. For many people, the preceding sentence says it all (good or bad). If you're familiar with the GNU system, you can probably just download the tarball and get away with scanning the README.md impatiently and then following your instincts. Because everyone is a beginner once and no one is an expert at everything, we'll try to explain things in plain English where possible, and to define our terms as we go along. If the following nevertheless reads like gibberish, you might very well want to use something prepackaged (see Alternatives). If it reads like a vaguely intelligible alien script that might yield to intensive research, we've included links to some of the usual suspects at the end of this chapter. If it reads like a bad explanation of something you could explain better, please send us your version! What to build: Packages, Tarballs, and the <productname>git</productname> repository The latest &freetds; package is always available from ftp.freetds.org. Code changes by the developers are immediately available in the git repository. If you've run into a problem, you may want to check out from git to see if it's fixed there. No password is needed to obtain the current git copy of &freetds;; you need only have a git client installed on your machine. Then: $ git clone https://github.com/FreeTDS/freetds.git $ For those behind firewalls or otherwise unable to access git, nightly snapshots of git are rolled up into tarballs for your convenience. They can be downloaded from ftp.freetds.org. In general, the git master branch (the basis of the current nightly snapshot) works better and has more functionality than the release version. Bugs sometimes persist in the release version but are usually fixed in short order (once identified) in git master. As with any project of this sort, if you want to use the git master branch, it's a good idea to join the mailing list. How to build: Configure and make If you've built other GNU projects, building &freetds; is a fairly straightforward process. We have a terse and verbose description. &freetds; is known to build with GNU and BSD make. If you encounter a large number of build errors, and your operating system's make is not GNU make (as is the case on most non-GNU/Linux systems), you may wish to install GNU make from ftp.gnu.org. For Experts $ ./configure --prefix=/usr/local $ make $ su root Password: $ make install Building from git is described in the file INSTALL.GIT.md. For Everyone Else (&freetds; for Dummies?) The GNU development system can generate code for a wide variety of hardware architectures and operating systems, virtually all of which can run &freetds; in consequence. The work of building and installing the &freetds; libraries begins with the command configure, which generates the Makefile that governs how the code is compiled, linked, and installed. Once you've configured the project, make will manage the rest of the build. ODBC Preparation If you intend to build the &freetds; ODBC driver — and want to use a Driver Manager (DM), as most people do — install the Driver Manager before configuring &freetds;. configure will detect the the DM and use its header (.h) files for ODBC constants and such. If your DM is installed in an unusual directory, you may have to provide the directory name as a parameter to configure. &freetds; doesn't require a DM. You can build the ODBC driver without one, as long as you have the requisite header files: sql.h, sqlext.h and sqltypes.h. These can be taken from either the &iODBC; or &unixODBC; distributions. Put them wherever you like (e.g., /usr/local/include). Because &freetds; won't detect your (missing) DM, it won't automatically build the ODBC driver, so you'll have to tell configure what to do and where to look. Cf. . The simplest form of running configure is: $ ./configure and sometimes that's enough. configure accepts command-line arguments, too, and you may need to provide some, depending on your environment. There are a few optional arguments to configure that may be important to you. For a complete list, see configure --help. <command>configure</command> options Directories and TDS version install architecture-independent files in PREFIX. When you run make install, libraries will be placed in PREFIX/lib, executables in PREFIX/bin, and so on. The default is /usr/local if this argument is not passed to configure. read-only single-machine data in DIR The default is PREFIX/etc (PREFIX being the value of , above) if this argument is not passed to configure. Specifies the location of the iconv library to use. configure will search for libiconv in the usual places; use if it's unsuccessful (assuming you want to use iconv, of course). Overridden by , below. Version 0.95 removed support for iconv which cannot convert from any encoding to any encoding. This affect potentially systems like Tru64 and HP-UX were iconv mainly convert from/to ucs2. It's recommended to use GNU libiconv in this case. Specifies the default TDS version. (There are a couple of ways to set the TDS version at run-time. This parameter takes effect if no run-time settings are provided.) Acceptable values of VER are 5.0, 7.1, 7.2, 7.3 and 7.4. The default is auto if this argument is not passed to configure. ODBC Driver Managers Specify a particular ODBC driver manager and the directory in which it is installed. The form chooses &iODBC; as the driver manager, and specifies &unixODBC; as the driver manager. The directory argument is required for , but may be omitted for ; pkg-config will be used to find your &iODBC; installation if the directory is omitted. Typical directory arguments are /usr and /usr/local. So long as either &iODBC; or &unixODBC; are installed, the build system will detect your driver manager by default. As a result, these options are only needed if you wish to override the default behavior. It is an error to specify both and . If you're building the ODBC driver and not using a Driver Manager, use this option to indicate the location of the .h files. configure will not cause the ODBC driver to be built unless this option is used or a DM is detected/specified. Things you can turn off Do not attempt to detect ODBC, and do not build the ODBC driver. In case you don't care about ODBC. Do not attempt to build applications like tsql. Do not attempt to build server stuff. Do not attempt to build pool stuff. By default, configure will search your system for an iconv library for use with Microsoft servers (because TDS 7.0 employs Unicode). This switch prevents that search. If no iconv library is used, &freetds; relies on its built-in iconv emulation, which is capable of converting ISO-8859-1 to UCS-2, sufficient for many applications. Force &freetds; not to use threadsafe versions of functions such as gethostbyname_r() where available. Rely instead on the older and non-threadsafe ones such as gethostbyname(). configure tests some of these functions. If the tests are successful, &freetds; will use threadsafe functions throughout. Threadsafe operation has been tested on Linux, FreeBSD, HP-UX and Windows. It should work on Solaris, Tru64, and (reportedly) IRIX. Not expected to work on non-unixy systems. Should not be used if your system supports threads. Pool server and MARS won't work if disabled. Debug-mode compiles are enabled by default, and will remain so at least until version 1.0. You can speed things up ever so slightly by disabling it. Disable support for wide characaters in ODBC. Disable SSPI support. SSPI is a Micrsoft library that allows you to use your current logged-in account for authentication. With this option enabled (the default), &freetds; supports "trusted logins" for Win32/64, just as Microsoft's own implementations do. Things you can turn on Enable Microsoft behavior in the &dblib; API where it diverges from Sybase's. Use this option if you are replacing Microsoft's libraries with &freetds; This option specifies default behavior. Programs can change the default at compile time by defining MSDBLIB or SYBDBLIB (for Microsoft or Sybase behavior, respectively). Enable close compatibility with Sybase's ABI, at the expense of other features. Currently, this enables the generation of a dbopen() entry point in &dblib;, which may clash with the DBM function with the same name. Absolutely not required for use with other free software. Enable Kerberos support. With Kerberos you can connect to server using your stored Kerberos ticket. Obviously requires Kerberos be configured on the machine. Intended for debugging purposes, enables certain internal consistency checks against problems like memory corruption and buffer exhaustion. Enable some code still in development. Should be used only by a developer or a brave user :) Compile ODBC tests to use wide characters. Test will use wide versions. SSL support Enable SSL using GnuTLS. Enable SSL using OpenSSL. Unlike &freetds;, OpenSSL does not use the LGPL. Please read the OpenSSL license before distributing binaries compiled with this option. <command>Make</command> Now you're ready to build. Follow these easy steps. Download the tarball and unpack it. Alternatively, get the latest build from git git users will need the GNU autotools: Autoconf, Automake, and libtool. . Change to the freetds directory. run ./configure with any options you need. make; make install; make clean You normally need to be root to make install, unless you used the option during configuration to install into your own directory. With any luck, you've built and installed the &freetds; libraries. Two bits of advice, if you like to keep things tidy and keep track of what you did. Create a file to hold your configure options called, say, .build_options. Create a build directory for the binaries, and invoke ../configure $(cat ../.build_options). This approach lets you remove the binaries at any time and rebuild from scratch using the same options. OS-specific Issues If you've recently built and installed &freetds; and noticed steps peculiar to your OS, we'll happily include your comments here. One thing that can be said, if it's not too obvious: check with your vendor or favorite download site. &freetds; is routinely rolled up into OS install packages. We know of packages for Debian, Red Hat, FreeBSD, and NetBSD. The installation through the package management systems in these environments may well reduce your work to simply make install. Win32 and Win64 Officially &freetds; for Windows should be compiled using CMake. CMake is able to create project files for different development systems (like Visual C++). Install CMake on your box and point to the source directory to generate wanted files. Refer to CMake documentation on how to do it (I personally use CMake GUI passing source directory and a newly create build directory). Once project files are created you can open them with your environment. Other ways to build under Windows® MingW Download Windows® binaries You can download FreeTDS binaries for Windows from AppVeyor (the hosted CI platform used). There is a .zip file available as artifact of every sucessful build. The list of builds is at https://ci.appveyor.com/project/FreeTDS/freetds/history. You can find there builds of code in the master banch and (from time to time) builds from the post-1.0 release fixes-only Branch-1_00 branch. Every build matrix element generates its artifact. Ramiro Morales also maintains similar builds of the Branch-0_95 branch at https://github.com/ramiro/freetds/releases. ODBC driver registration If compiled correctly &freetds; ODBC driver supports component registration. Although an ODBC driver is not a Windows component you can register the driver with regsvr32 utility or you can use this feature with some installer and register the driver as a standard component. Once the ODBC driver is registered in the system you can configure it from Control Panel. VMS® &freetds; will probably build and run on most versions of OpenVMS Alpha 7.0 and later with DEC/Compaq C 6.0 or later. Other prerequisites: gunzip vmstar MMS or MMK Build Instructions Decompress and unpack the source archive using gunzip and vmstar. If you are untarring on an ODS-5 disk, you should use the /ODS2 or -o option to create universally VMS-friendly filenames; otherwise the build will fail to locate some files. Set default to the top-level source directory and run the configuration script: $ @[.vms]configure This creates a descrip.mms in the top-level source directory which you may execute by simply running MMS (if you have the Module Management System that is part of DECset) or MMK (a freeware MMS alternative available from www.madgoat.com). Further information can be found in the vms/README.vms in the source distribution. OS X® The regular distribution compiles on OS X. Possible linker problems On 18 April 2016, a problem was reported causing linker issues. Undefined symbols for architecture x86_64: "___strlcpy_chk", referenced from: _tdsdbopen in libsybdb_64.a(dblib.o) _db_env_chg in libsybdb_64.a(dblib.o) _dbcolinfo in libsybdb_64.a(dblib.o) _dbtablecolinfo in libsybdb_64.a(dblib.o) _tds_alloc_dynamic in libsybdb_64.a(mem.o) _tds7_get_instance_port in libsybdb_64.a(net.o) _tds_get_locale in libsybdb_64.a(locale.o) ... This is due to some mismatch on different project releases. To solve these issue set the target release like CFLAGS="-mmacosx-version-min=10.8" ./configure make or export MACOSX_DEPLOYMENT_TARGET=10.8 ./configure make AIX® AIX® can induce linker indigestion. libtool doesn't always understand that a .a file can be a shared library. One solution is to build only static libraries with the configure option. Another problem seems to be that the linker isn't asked to pull in all the requisite libraries. Cf. this helpful mailing list message. GNU/Linux distributions that use RPMs You may find it convenient to make an RPM from the source distribution, in which case you'll be glad to know it is easily done: $ rpmbuild -ta freetds-0.95.tar.bz2 Install &freetds; If you install it they will stay? Confusing terminology Configuring and installing don't have absolute, context-free definitions. In some circles, we install a product and then configure it. In the GNU world, we configure the package (generate the Makefiles), then we make install the package. In the case of a library package such as &freetds; To install the package is to copy the files the application developer will use to their canonical locations: header files to include, libraries to the lib, documentation and man pages share. Install targets were specified during the build process as arguments to configure, covered in the last chapter. For lack of a better term, this chapter describes installing the product. Put more specifically, once we're done with the package manager, we still have to tell &freetds; about your database servers, and we still have to tell your client programs about &freetds;. The local environment After &freetds; has been built and installed, it still doesn't know where your servers are or what particular version of Sybase or Microsoft software each one is using. The purpose of this section is to explain how to describe your servernames to &freetds;. &freetds; looks up your server's attributes in &freetdsconf;. Some of the attributes can be overridden by environment variables. One of the more important (and arcane) settings is the TDS protocol version, described next. Choosing a <acronym>TDS</acronym> protocol version The TDS protocol version is probably something you'd rather not know even existed, much less something you'd have to choose. But there's not that much to it, really. Unless you run into an incompatibility, you're best off running with the highest protocol version supported by your server. That's what the vendors' own products do, which is why when you read the Sybase or Microsoft documentation you find no mention of TDS versions. Versions of the <acronym>TDS</acronym> Protocol, by Product Product TDS Version Comment Sybase before System 10, Microsoft SQL Server 6.x 4.2 Still works with all products, subject to its limitations. Sybase System 10 and above 5.0 Still the most current protocol used by Sybase. Sybase System SQL Anywhere 5.0 only Originally Watcom SQL Server, a completely separate codebase. Our best information is that SQL Anywhere first supported TDS in version 5.5.03 using the OpenServer Gateway (OSG), and native TDS 5.0 support arrived with version 6.0. Microsoft SQL Server 7.0 7.0 Includes support for the extended datatypes in SQL Server 7.0 (such as char/varchar fields of more than 255 characters), and support for Unicode. Microsoft SQL Server 2000 7.1 Include support for bigint (64 bit integers), variant and collation on all fields. Collation is not widely used. Microsoft SQL Server 2005 7.2 Includes support for varchar(max), varbinary(max), xml datatypes and MARSMultiple Active Result Sets.. Microsoft SQL Server 2008 7.3 Includes support for time, date, datetime2, datetimeoffset. Microsoft SQL Server 2012 or 2014 7.4 Includes support for session recovery.
Choosing protocol version since &freetds; 1.1 Version 1.1 improved the discovery of the protocol version. If you are using Microsoft SQL Server is recommended to leave the version to auto (the default). If you are using any Sybase product you could set version to 5.0 to get faster connections (although auto will work too). Choosing protocol version before &freetds; 1.1 Choosing the correct TDS protocol version for use with SQL Server can be confusing. Hopefully, these steps will lead you to the correct version. If you have a Sybase server, you should be able to use version 5.0, otherwise, if you have Microsoft SQL Server refer to the following section. Step 1: Find out which FreeTDS version you are running. You can use the command: `tsql -C` Step 2: Find out what version of Microsoft SQL Server you are running. Step 3: Pick the lower TDS Version number out of what matches steps 1 and 2 from the table below. What Version of the <acronym>TDS</acronym> Protocol Should I use with Microsoft SQL Server? FreeTDS Version Microsoft SQL Server Version Supported Highest TDS Version Supported Microsoft Extended Support End Date 1.00 2016 7.4 July 9th, 2024 1.00 2014 7.4 July 9th, 2024 1.00 2012 7.4 July 12th, 2022 0.95 2008 7.3 July 9th, 2019 0.91 2005 7.2 April 12th, 2016 0.82 2000 7.1 April 9th, 2013 0.64 2000 7.1 April 9th, 2013
NOTE FOR USERS WHO NEED SQL SERVER 2000 SUPPORT (VERY RARE; SQL SERVER HAS BEEN OUT OF EXTENDED SUPPORT SINCE 2013 AND SHOULD *NEVER* BE USED IN PRODUCTION): Years ago, Microsoft didn't officially create a TDS version number until after FreeTDS was released, and it was assumed 8.0 would be the next version; it turned out to be 7.1. Because of this: If you are running FreeTDS Version 0.64 or 0.82 with Microsoft SQL Server 2000, use TDS Version 8.0 instead of 7.1. If you are running FreeTDS Version 0.91 or greater with Microsoft SQL Server 2000, use TDS Version 7.1. Please note, this is ONLY if you need Microsoft SQL Server 2000 support. For best results, use the highest version of the protocol supported by your server. If you encounter problems, try a lower version. If that works, though, please report it to the mailing list!
Regarding obsolete versions In the earlier days of &freetds;, Microsoft did not release official specs for the TDS protocol. When MSSQL 2000 (product 8.0) was released, there was semi-official indications from the Microsoft community that the TDS protocol would be version 8.0. So the &freetds; developers adopted that version for &freetds;. Years later, when Microsoft started releasing official specs of the protocol, it became obvious that the TDS versions that &freetds; had labeled 8.0 and 9.0 were actually versions 7.1 and 7.2 respectively. Version 8.0 cannot be used from &freetds; version 1.3. TDS 4.2 has limitations ASCII only, of course. RPC is not supported. BCP is not supported. varchar fields are limited to 255 characters. If your table defines longer fields, they'll be truncated. dynamic queries (also called prepared statements) are not supported. The protocol version may also affect how database servers interpret commands. For example, Microsoft SQL Server 2000 is known to behave differently with versions 4.2 and 7.0. Version 7.0 is recommended for compatibility with Microsoft SQL Server tools.
<replaceable>servername</replaceable> Lookup &freetds; converts the servername to an IP address by following the steps below, stopping when it succeeds. Name lookup sequence <footnote><para>This description applies to &dblib; and &ctlib;. ODBC lookup is different.</para></footnote> Find servername in &freetdsconf;. If a section with that name exists, use the hostname, port, and TDS version specified therein. Attempt to convert servername to an IP address with inet_addr(3). Request name-lookup from the operating system via gethostbyname(3) or similar. If the TDS version and port are not read from &freetdsconf;, they are derived from the compiled-in defaults and overridden by applicable environment variables. As you can see, if most of your servers use the same TDS version and answer to the default port, then you don't need to list them all in &freetdsconf;. You can simply compile in the right defaults — or set the TDSPORT and TDSVER environment variables — and rely on DNS for name resolution. The &freetdsconf; file What it does Just as DNS defines hostnames for network addresses, &freetdsconf; uses a servername to define the properties of your server. In general, the servername is arbitrary and local; it's used only by your client programs to tell &freetds; which server to connect to. You can choose any name you like. Sybase SQL Anywhere (a/k/a Sybase ASA), however, is fussy. Unless you use the ASA Database property, you must use the database's name as your servername. Otherwise, the server will refuse your connection. In particular, &freetds; needs to know: Primary Server Properties Hostname or IP address of the server Port number or Instance name (not both) TDS protocol version &freetds; also supports an older configuration file format, known as the interfaces file. Use &freetdsconf; unless interfaces is needed for your situation. It is easier to read, and it is where all the new options are being added. &freetds; looks for &freetdsconf; first, falling back on interfaces only if &freetdsconf; is not found. Should you need it, more information about interfaces can be found in the Appendix. Where it goes The default location of &freetdsconf; is determined by the --sysconfdir option of configure. If you don't specify anything, configure's default sysconfdir is /usr/local/etc. tsql -C reports the sysconfdir to let you confirm it. In addition, &freetds; will look for a file .freetds.conf in the user's home directory (${HOME}/.freetds.conf). The actual name and location of &freetdsconf; may be specified by the environment variable FREETDS (or FREETDSCONF, same effect). See Environment Variables, below. &freetds; reads the user's ${HOME}/.freetds.conf before resorting to the system-wide sysconfdir/&freetdsconf;. The file used is the first one that is readable and contains a section for the server. What it looks like The following information is also provided in the &freetdsconf; manual page, cf. man freetds.conf. The &freetdsconf; file format is similar to that of Samba's modified win.ini. It is composed of two types of sections: one [global] section, and a [servername] section for each servername. Settings in the [global] section affect all servernames, but can be overridden in a [servername] section. For example A &freetdsconf; file example [global] tds version = auto [myserver] host = ntbox.mydomain.com port = 1433 [myserver2] host = unixbox.mydomain.com port = 4000 tds version = 5.0 [myserver3] host = instancebox.mydomain.com instance = foo In this example, the default TDS version for all servernames is set to auto. It is then overridden for myserver2 (a Sybase server) which uses 5.0. Usually, it is sufficient to state just the server's hostname and TDS protocol version. Everything else can be inferred, unless your setup (or your server's) strays from the defaults. Some people seem to feel safer using the IP address for the server, rather than its name. We don't recommend you do that. Use the name, and benefit from the inherent advantages. That's why DNS was invented in the first place, you know. It bears mentioning here that prior versions of &freetds; were quite fussy about domain logins, forcing users to make explicit per-server entries in &freetdsconf;. That is no longer the case. If the username has the form DOMAIN\username, &freetds; will automatically use a domain login. &freetdsconf; settings Name Possible Values Default Meaning tds version 4.2, 5.0, 7.0, 7.1, 7.2, 7.3, 7.4, auto --with-tdsver value (auto if unspecified) Overridden by TDSVER. The TDS protocol version to use when connecting. auto tells &freetds; to use an autodetection (trial-and-error) algorithm to choose the protocol version. host host name or IP address none The host that the servername is running on. port any valid port Product Version Default Port Sybase SQL Server prior to System 10 1433 Sybase SQL Server 10 and up 5000 Sybase SQL Anywhere 7 2638 Microsoft SQL Server all 1433 The port number that the servername is listening to. Please note: The "defaults" to the left are the server's default settings. &freetds; chooses its default port based on the TDS protocol version: 5000 for TDS 5.0, and 1433 for everything else. Mutually exclusive with instance, below. Overridden by TDSPORT. instance instance name none Name of Microsoft SQL Server instance to connect to. The port will be detected automatically. Mutually exclusive with port, above. Requires UDP connection to port 1434 on the server. ASA database valid database name servername [section] name Specifies the name of the default database when connecting to an ASA server. A TDS 5.0 login packet has a field called lservname. For most TDS servers, lservname is a user-defined string with no inherent meaning. ASA servers, however, requires that lservname contain a valid database name, and sets that as the default database for the connection. &freetds; normally fills lservname with the [section] text.. This entry instead sets the database name independently of the [section] name. database valid database name none Specifies the name of the default database. This is the name of the database container in the server you are connecting to. initial block size multiple of 512 512 Specifies the maximum size of a protocol block. Don't mess with unless you know what you are doing. dump file any valid file name none Overridden by TDSDUMP. Specifies the location of a tds dump file and turns on logging dump file append yes/no no Appends dump file instead of overwriting it. Useful for debugging when many processes are active. timeout 0- none Sets period to wait for response of query before timing out. connect timeout 0- none Sets period to wait for response from connect before timing out. emulate little endian yes/no yes Forces big endian machines (Sparc, PPC, PARISC, MIPS) to act as little endian to communicate with server. Ignored, always use little endian at protocol level. client charset any valid iconv character set ISO-8859-1Valid for ISO 8859-1 character set. See Localization and TDS 7.0 for more information. Makes &freetds; use iconv to convert to and from the specified character set from UCS-2 in TDS 7.0 or above. &freetds; uses iconv to convert all character data, so there's no need to match the server's charset to insert any characters the server supports. text size 0 to 4,294,967,295 4,294,967,295 default value of TEXTSIZE, in bytes. For text and image datatypes, sets the maximum width of any returned column. Cf. set TEXTSIZE in the T-SQL documentation for your server. debug flags Any number even in hex or octal notation 0x4fff Sets granularity of logging. A bitmask. See table below for specification. encryption off/request/require request (if tds version > 7.1 otherwise off) Specify if encryption is desired. Supported for Microsoft servers. off disables encryption; request means use if available; require means create and allow encrypted connections only. enable gssapi delegation on/off off Enable delegation flag using Kerberos. realm any default Kerberos realm Specify Kerberos realm. SPN any MSSQLSvc/fqdn:port Specify Kerberos SPN. mutual authentication on/off off Enable mutual authentication flag using Kerberos. Always enabled for TDS 7.0 or above. use ntlmv2 yes/no yes Use NTLMv2. An alternative to the UseNTLMv2 option in odbc.ini. use lanman yes/no no Use LAN MANAGER for NTLM. This is a very old encryption. Should not be enabled unless you have a really old server. use utf-16 yes/no no Instead of using UCS-2 for database wide character encoding use UTF-16. Newer Windows versions use this encoding instead of UCS-2. This could result in some issues if clients assume that a character is always 2 bytes. ca file any filename or system none File that hold root certificates (in PEM format) to verify server certificate, used during an encrypted connection. If not specify or empty any certificate will be accepted from server. If you specify system &freetds; will use system wide certificate list. If a certiticate is not installed server can generate a self signed certificate, in this case is useful to disable certificate validation (which is the default). Note that is not possible to specify a directory as usually database servers does not use a certificate signed by a public global certification authority. crl file any filename none File that hold certificate revocation list. Only used if ca file is also specified. check certificate hostname yes/no yes Check is the hostname is valid in the certificate. Only used if ca file is also specified. read-only intent yes/no no Tell server we only intent to do read-only queries. This is supported from MSSQL 2012. enable tls v1 yes/no yes Enable or disable TLS version 1.0. Useful to increase security. Not too recent Windows version (like Windows 2008) does not enable higher versions by default so be aware.
Overrides Many settings in &freetdsconf; can be overridden by environment variables. The servername can also be decorated adding the port or instance name using port override syntax. Controlling log details The logging capability has helped solve innumerable cases, some trivial and some very low-level bugs. Sometimes a developer needs very detailed information about one function, whereas someone else may interested only in whether or not a particular function is called, or even want to see only the SQL that was transmitted to the server. The log's granularity can be controlled with the debug flags entry. The default value (4FFF hex) gives a level of detail that is useful for resolving problems via the mailing list. Valid bitmask values for <literal>debug flags</literal> entry in &freetdsconf; Value Meaning 0x80 function trace and info 0x40 information level 2 0x20 information level 1 0x10 network 0x08 warning 0x04 error 0x02 severe error 0x1000 show pid 0x2000 show time 0x4000 show source level info (source file and line) 0x8000 thread id (not implemented)
For more about the wonderful world of &freetds; logs, see Logging.
Deprecated options The following options have long been deprecated. Deprecated &freetdsconf; settings try server login try domain login nt domain cross domain login debug level
The <filename>locales.conf</filename> file What it does For an English-speaking American, not much. &freetds; originated in the United States, and uses U.S. conventions if no locales.conf is present. The locales.conf provided with the installation also reflects these conventions. locales.conf will probably be dropped from &freetds; one day. Its only real purpose now is to control the format of date strings. The Right Way™ to deduce the appropriate default date format is from the application's locale settings, while allowing an override in &freetdsconf;. That's the direction we're headed. If your purpose is to affect the client charset description, use &freetdsconf; instead. Information on locales and locale strings is easily (even too easily!) found on the Internet, or see man locale for your system. &freetds; will examine its environment for a LOCALE string. If it finds one, it will look it up in locales.conf to find your preferred settings. If it fails to find one, it will use its defaults. Where it goes Like &freetdsconf;, the location of locales.conf is determined by the value of to configure. The default is PREFIX/etc. What it looks like The format of locales.conf is similar to that of &freetdsconf;. There is a [default] section, and a section for each locale. locales.conf controls three settings date format This entry will be passed (almost) literally to strftime(3) to convert dates to strings. For the most part, see you system documentation for strftime(3) (man 3 strftime). You will see there though that strftime(3) has no provision for milliseconds. The locales.conf format string uses %z for milliseconds. If your system's strftime(3) does employ %z for its own use, it will not be given that chance by &freetds;. &freetds; will consume the %z for its milliseconds needs, and will not pass it on to strftime(3). language The language that will be used for error/status messages from the server. A SQL Server client can specify a language for such messages at login time. &freetds; issues a few messages of its own. Messages from the server are called messages; those from the client library (i.e., from &freetds;) are called error messages. &freetds;-issued messages are not affected by locales.conf. charset Indicates to the server what character set should be used for communicating with the client. Environment variables What they're for You can use environment variables to Override some of the settings in &freetds;'s configuration file. Advertise the location of the &freetds; libraries to programs that want them. Control how logging is done. This section covers the first two items. For information about environment variables that control logging, see Logging In a typical system, no environment variables need be used. They're sometimes handy for testing, for instance setting TDSVER to check if a connection problem is due to using the wrong protocol version. And they have other uses, described below. But they're just knobs, so don't feel you have to turn every one, unless you're the sort that likes turning knobs. Environment Variables FREETDS may be used to specify the name and location of the &freetdsconf; file. In prior versions of &freetds; this variable was known as FREETDSCONF. TDSVER governs the version of the TDS protocol used to connect to your server. For a given server, &freetds; inspects four sources in the following order to determine which TDS protocol version to use, using the first one it finds. The value specified in TDSVER A &freetdsconf; file entry (see below) The interfaces file entry (see below) The option passed to configure TDSPORT specifies a TCP port number at which the servername is listening. It overrides the default port (1433 for TDS 4.2/7.0/7.1/7.2/7.3/7.4, 4000 for TDS 5.0) as well as any port specified in the &freetdsconf; file. SYBASE points to the &freetds; run-time directory. Use of this variable originated with Sybase (the company), and many programs still rely on SYBASE to discover the location of the SYBASE libraries. The primary use of SYBASE is to advertise the location of the &freetds; libraries. A secondary use is to point to the location of the interfaces file (if used, see the Appendix), which some programs examine directly. TDSQUERY DSQUERY provides a server name to connect to if none is specified by the application. DSQUERY is the historical Sybase name for this variable. TDSHOST overrides the host specified in the &freetdsconf;. Setting environment variables Of course, each shell is a little different. In the Bourne shell and variants such as ksh and bash, to set SYBASE and TDSVER do: $ export SYBASE=/usr/local/freetds # (or your favorite directory) $ export TDSVER=7.4 In csh: $ setenv SYBASE /usr/local/freetds $ setenv TDSVER 7.4 Checking your work When you're done, you should see something very like this: $ ls $SYBASE etc include interfaces lib Port/instance override syntax The port to which to connect can be overridden using a &freetds; extended syntax. A port may be appended to the servername in the form servername:port. &freetds; will attempt to connect to specified port. Please note port must be a number; a service name is not supported. If you specify servername\instance as servername during login, &freetds; will attempt to connect to specified instance. Only Microsoft SQL Server instances are supported. (This server feature was introduced with Microsoft SQL Server 2000.) Note that other &freetdsconf; properties still apply. For the technically curious: each Microsoft SQL Server instance appears on the network as a server listening at a port. The old way — and it still works — is to designate each instance in &freetdsconf; as a separate server. The new named instance notation, if we can call it that, instead uses the server to discover the port. The library sends a UDP packet containing the instance name to the server at a well known port, port 1434. The server responds with a port number. &freetds; then uses that number to connect in the usual way. Confirm the installation We want to make sure that when your application requests a connection to your server, it actually works. In detail, we want to know: &freetds; can find and read &freetdsconf; servername exists in &freetdsconf; a host property exists for servername host can be resolved to a network address the server is listening to the port or named instance the user can log in to the server Each of the above can be confirmed independently with tsql. Once you're sure you can connect and log in, you can run the unit tests to see if the software works as promised. <application>tsql</application> The tsql utility is provided as part of &freetds; expressly for troubleshooting. tsql is superficially similar to an isql, but uses libtds directly, bypassing the client libraries (e.g., &dblib;). It can also report where it looks for &freetdsconf; and other compile-time settings (with tsql -C). Show compile-time settings with <command>tsql</command> $ tsql -C Password: Compile-time settings (established with the "configure" script) Version: freetds v&version; freetds.conf directory: /usr/local/etc MS db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: auto iODBC: no unixodbc: no SSPI "trusted" logins: no Keberos: no OpenSSL: yes GnuTLS: no MARS: yes For details on the use of tsql, consult its man page. <replaceable>servername</replaceable> Lookup If all goes well, the first time you fire up tsql it connects and you can issue your first query. More often, though, the result is less joyous. Listed below for your troubleshooting pleasure are a variety of servername lookup failures and their corresponding messages. When servername cannot be converted to an address, up to two messages may result. Successful conversion (by any means) never produces an error message. Failure to find <replaceable>servername</replaceable> in &freetdsconf; $ tsql -S nobox -U sa Password: locale is "C" locale charset is "646" Password: Error 20012 (severity 2): Server name not found in configuration files. Error 20013 (severity 2): Unknown host machine name. There was a problem connecting to the server $ host nobox Host not found. In the above case message 20012 indicates nobox was not found in &freetdsconf;. The library then treated nobox as a network hostname but found it also not to be valid per DNS, leading to message 20013. If servername is found in the configuration files, but refers to an invalid hostname, only message 20013 is returned. Failure to resolve hostname for <replaceable>servername</replaceable> $ tsql -S nonesuch -U sa Password: locale is "C" locale charset is "646" Error 20013 (severity 2): Unknown host machine name. There was a problem connecting to the server Unfortunately, the host machine name (the right side of the host line in &freetdsconf;) isn't mentioned in the error message. Fortunately, this kind of setup problem is rarely encountered by users. Connecting to the Server If name lookup succeeds, &freetds; next attempts to connect to the server. To connect means to form at TCP connection by calling connect(2). A valid connection must exist before any information can be exchanged with the server. Specifically, we need a connection before we can log in. A few things can go wrong at this point. The address returned by DNS may not be that of the machine hosting the server, or indeed of any machine! The machine may be down. The server may not be running. The server may be running but not listening to the port &freetds; is attempting to connect to. In rare cases, both ends are correctly configured, but a firewall stands in the way. If no server accepts the connection, no connection can be established. It's difficult to know why, and the message is consequently vague. Failing to connect with tsql $ tsql -S emforester -U sa #only connect? Password: Msg 20009, Level 9, State -1, Server OpenClient, Line -1 Unable to connect: Adaptive Server is unavailable or does not exist There was a problem connecting to the server If you get message 20009, remember you haven't connected to the machine. It's a configuration or network issue, not a protocol failure. Verify the server is up, has the name and IP address &freetds; is using, and is listening to the configured port. Named instances provide another way for connections to fail. You can verify the instance name and the port the server is using with tsql -L. Getting instance information with tsql $ tsql -LH servername locale is "C" locale charset is "646" ServerName TITAN InstanceName MSSQLSERVER IsClustered No Version 8.00.194 tcp 1433 np \\TITAN\pipe\sql\query servername could be configured to use instance MSSQLSERVER or port 1433. After a valid connection is formed, &freetds; sends a login packet. The TDS protocol provides no way to interrogate the server for its TDS version. If you specify the wrong one, you'll get an error. Using the wrong protocol for the server $ tsql -S servername Password: Msg 20017, Level 9, State -1, Server OpenClient, Line -1 Unexpected EOF from the server Msg 20002, Level 9, State -1, Server OpenClient, Line -1 Adaptive Server connection failed There was a problem connecting to the server Unexpected EOF from the server seems to be a fairly common message when the wrong TDS version is used. Note that there's no complaint about the login. If the right TDS version is used, the server will accept the login packet and examine its contents to authenticate the user. If there's a problem, the server will say so. This is the first time we're receiving a message from the server. If you'd like to help the project and want to so something fairly easy but still useful, modify tsql to distinguish clearly between errors returned by the library, and those returned by the server. Errors should be marked error and don't return state or a line number, but can contain an error code (and message) from the operating system. Login failure $ tsql -S servername -U notme Password: Msg 18456, Level 14, State 1, Server [servername], Line 0 Login failed for user 'notme'. Msg 20002, Level 9, State -1, Server OpenClient, Line -1 Adaptive Server connection failed There was a problem connecting to the server Bypassing &freetdsconf;: tsql -H hostname -p port -U username -Ppassword -C Keep in mind that the TDS protocol version normally comes from &freetdsconf;. When using tsql this way, the library uses the compiled-in default (set by the configure script). If that's not what you want, override it using the TDSVER environment variable. Connect with <command>tsql</command> using a hostname and port number $ TDSVER=auto tsql -H hillary -p 4100 -U sa Password: 1> For details on tsql, see the its man page. <application>Unit Tests</application> The source code directory of each &freetds; library includes a unittests directory. Although the directories are named unittests they are not unit tests, most of them require a configured database to work. $ ls -d -1 src/*/unittests src/ctlib/unittests src/dblib/unittests src/odbc/unittests src/replacements/unittests src/tds/unittests src/utils/unittests The tests rely on the PWD file in root of the &freetds; source tree. PWD holds a username, password, servername, and database to be used for the unit tests. We try to make sure to leave nothing behind: any data and objects created are either temporary or removed at the end of the test. The tests should all work, subject to disclaimers in the directory's README.md. To invoke the tests, edit the PWD file (you can copy from PWD.in which is a template) and issue the command make check. In order to execute all tests successfully, you must indicate a working, available servername in PWD. Some tests require permission to create stored procedures on server. In addition, some may require that a database named freetds_test exists on the server, and the user whose credentials are used during the testing process has sufficient permissions to create and manipulate tables in this database. To complete successfully, the ODBC tests require some additional setup. In your PWD file, add a SRV entry specifying the DSN entry for your odbc.ini. The ODBC tests all build their own odbc.ini and try to redirect the Driver Manager to it, however this functionality is very DM dependent and may well fail unless you have either &iODBC; or &unixODBC;. The PWD provided by &freetds; includes usernames and passwords that probably don't exist on your server.
Preparing ODBC Background and Terminology To connect to a database server, a library such as &freetds; needs some information about the connection. By server, which IP address and port is do you mean? Which user is requesting the connection, and what authentication does he offer? Every database library needs a way to capture and convey that information. ODBC was conceived as a general interface definition, not tied to any particular database or access library. For that reason, ODBC also needs to know which driver to use with a given server. The original ODBC solution to this conundrum employed the odbc.ini file. odbc.ini stored information about a server, known generically as a Data Source Name (DSN). ODBC applications connected to the server by calling the function SQLConnect(DSN, UID, PWD), where DSN is the Data Source Name entry in odbc.ini, UID is the username, and PWD the password. Any and all information about the DSN was kept in odbc.ini. And all was right with the world. The ODBC 3.0 specification introduced a new function: SQLDriverConnect. The connection attributes are provided as a single argument, a string of concatenated name-value pairs. SQLDriverConnect subsumed the functionality of SQLConnect, in that the name-value pair string allowed the caller to pass — in addition the the original DSN, UID, and PWD — any other parameters the driver could accept. Moreover, the application can specify which driver to use. In effect, it became possible to specify the entire set of DSN properties as parameters to SQLDriverConnect, obviating the need for odbc.ini. This led to the use of the so-called DSN-less configuration, a setup with no odbc.ini. But &freetds; did not start out as an ODBC driver (remember &dblib; and &ctlib;), and has always had its own way to store server properties: &freetdsconf;. When Brian added the &freetds; ODBC driver, he began by supporting the old SQLConnect, using odbc.ini to describe the DSN. That choice complied with the expectations of the Driver Managers, and minimized the amount of duplicated information in the configuration files. But it can be a little confusing, too, because odbc.ini in effect points to &freetdsconf;. We call this configuration ODBC-combined, because it supports all three &freetds; libraries. As progress on the the &freetds; ODBC library progressed, the driver was made able to read the connection attributes directly from odbc.ini, rather than leaning on &freetdsconf;. For installations that don't need &dblib; and &ctlib;, this ODBC-only setup is simpler. More recently, SQLDriverConnect was added to &freetds;. As described above, this function allows the application to specify connection attributes with reference to either, or neither, configuration file. It's your choice. In making that choice, keep the following terms clear in your mind: Important &freetds; ODBC terms SERVERNAME specifies the [servername] entry in &freetdsconf;. SERVER specifies the real server i.e., the TCP/IP name of the machine hosting the database server. DSN Driver In your connection string, you can decide to use a DSN entry in odbc.ini using the DSN attribute, or to specify the driver you want with the Driver attribute. In sum, &freetds; supports three ODBC choices: ODBC configuration choices DSN-less No connection information is specified in odbc.ini. Advantageous if you're using more of &freetds; than just the ODBC driver. ODBC-only All connection information is specified in odbc.ini, without the need for &freetdsconf;. This is the traditional ODBC setup. ODBC-combined Connection information maintained in &freetdsconf;. odbc.ini contains DSN entries that refer to servernames in &freetdsconf;. Library or Driver? What's a library and what's a driver? Technically, they're the same thing: bodies of subroutines whose names are exported to a linker (static or runtime). By convention, a library is used directly by an application, whose programmer will require documentation and header files. A driver, by contrast, is defined by a binary API and is used in some kind of framework, hence printer driver and video driver. An ODBC driver is a hybrid. For the most part, an application relies on a driver manager to define manifest constants, and links to the DM's library. But because the ODBC specification leaves behavior up to the driver, the application is forced to include the driver's header files, too, to exploit driver-specific functions. Connection attributes The following tables define all possible ODBC connection attributes for the &freetds; ODBC driver. Which ones you'll need depends on how you set yourself up. They may appear in your connection string, or in odbc.ini. Connection attributes used only in connection strings Name Possible Values Default Meaning DSN A valid DSN entry none The DSN to which &freetds; should connect. &freetds; will search odbc.ini for entry. It lets you specify a connection as for SQLConnect, but using SQLDriverConnect. Do not use Servername and DSN together. UID Any valid username none The username to be used when connecting. To use domain authentication, specify the domain using the format domain\username. PWD Any empty The password to be used when connecting. WSID Any Computer name The name of the local computer, sent to server. Can be specified only for a DSN-less connection.
Connection attributes that may appear in <filename>odbc.ini</filename> Name Possible Values Default Meaning Servername A valid &freetdsconf; server section none A &freetdsconf; servername, not a hostname as known to DNS. If you want to use ODBC-only configuration, use Server instead. Server A server name or (ip) address none Hostname of a server. Used in an ODBC-only configuration. To specify a Microsoft SQL Server instance, use the form server\instance. Port Any TCP port Depends on the TDS version specified with configure The TCP port where the servername is listening. TDS_Version Any valid protocol version Depends on the TDS version specified with configure TDS protocol version to use (e.g., 5.0, 7.0). ClientCharset or Client_Charset A name recognized by the iconv library linked to &freetds;. Corresponds to client charset in &freetdsconf;. Client_Charset is for compatibility with NCBI C++ ToolKit. ISO 8859-1 Character set (encoding) used by the client. APP Free form text, up to 30 characters. none Application name. Identifies the connecting application to the server. Language Any us_english (Human) language the server should use for error messages. Address Any none IP address of the servername. Useful if you want to specify a server by address, rather than by name. The format is ip,port or simply ip in standard dotted-decimal notation. Database Any none Specify which database you want to access. If the database does not exist or the user lacks permission to access it, the connection will fail. TextSize Any Server-dependent Maximum size returned from server for blobs. PacketSize Any Server-dependent Size of packets to server. Some users saw some performance gain by increasing this value. Normally you shouldn't set it. Trusted_Connection Yes/No No Use your current account instead of UID/PWD attributes. This option require SSPI or Kerberos and supersedes any UID/PWD attributes passed from the application. Encryption off/request/require off Specify encryption. See encryption on freetds.conf MARS_Connection Yes/No No Enable MARS for this connection. UseNTLMv2 Yes/No No Use NTLMv2 instead of normal NTLM. Use this option if your Windows domain have this setting. REALM Machine domain none Kerberos REALM. ServerSPN Any valid SPN MSSQLSvc/server FQDN:port Full server Kerberos SPN. AttachDbFilename server filename (mdf/sdf) none MSSQL allow to attach a database while connecting to a server. This setting allow to do it. You should specify Database attribute to set the name of the database that will be used. DumpFile Any File name where to dump logs. DumpFileAppend Yes/No No DumpFlags Any Debug flags. See freetds.conf entries. ApplicationIntent ReadWrite/ReadOnly ReadWrite Tell application intent. See read-only intent on freetds.conf. Timeout Integer number Query timeout in seconds.
DSN-less configuration In a DSN-less configuration, the odbc.ini file is not consulted for server connection properties. To connect to a servername, your application may refer to a servername entry in &freetdsconf;, or explicitly specify the servername's hostname (bypassing &freetdsconf;). Sample files for a DSN-less configuration The odbcinst.ini is quite brief: ; ; odbcinst.ini ; [FreeTDS] Driver = /usr/local/freetds/lib/libtdsodbc.so The &freetdsconf; might look something like: ; ; freetds.conf ; [JDBC] host = jdbc.sybase.com port = 4444 tds version = 5.0 Connecting with a DSN-less configuration /* * application call */ const char servername[] = "JDBC"; refers to the [JDBC] entry in &freetdsconf;. sprintf(tmp, "DRIVER=FreeTDSrefers to the [FreeTDS] entry in odbcinst.ini.;SERVERNAME=%s;UID=%s;PWD=%s;DATABASE=%s;", servername, username, password, dbname); res = SQLDriverConnect(Connection, NULL, (SQLCHAR *) tmp, SQL_NTS, (SQLCHAR *) tmp, sizeof(tmp), &len, SQL_DRIVER_NOPROMPT); if (!SQL_SUCCEEDED(res)) { printf("Unable to open data source (ret=%d)\n", res); exit(1); } You can even establish a connection without reference to either odbc.ini or freetd.conf. Connecting with a DSN-less configuration that does not use &freetdsconf; /* * application call */ const char servername[] = "jdbc.sybase.com"; refers to the real server name. sprintf(tmp, "DRIVER=FreeTDS;SERVER=%s;UID=%s;PWD=%s;DATABASE=%s;TDS_Version=5.0;Port=4444;", servername, username, password, dbname); res = SQLDriverConnect(Connection, NULL, (SQLCHAR *) tmp, SQL_NTS, (SQLCHAR *) tmp, sizeof(tmp), &len, SQL_DRIVER_NOPROMPT); if (!SQL_SUCCEEDED(res)) { printf("Unable to open data source (ret=%d)\n", res); exit(1); } ODBC-only configuration An ODBC-only configuration relies solely on odbc.ini for server properties. Other &freetds; libraries don't know about odbc.ini. Sample ODBC-only <filename>odbc.ini</filename> file [ODBC Data Sources]Several DSNs might be listed here. In this example, we have only one, JDBC. It matches the [JDBC] entry later in the file. JDBC = Sybase JDBC Server [JDBC] Driver = /usr/local/freetds/lib/libtdsodbc.so Description = Sybase JDBC Server Trace = No Server = jdbc.sybase.com Database = pubs2 Port = 4444 TDS_Version = 5.0 [Default] Driver = /usr/local/freetds/lib/libtdsodbc.so ODBC-combined configuration Like the DSN-less configuration, ODBC-combined keeps server properties in &freetdsconf;. The difference is that your applications can refer to the server by its DSN. To make that possible, the DSN entry in odbc.ini refers to the servername entry in &freetdsconf;. Sample ODBC-combined <filename>odbc.ini</filename> file [ODBC Data Sources]Several DSNs might be listed here. In this example, we have only one, JDBCdsn. It matches the [JDBCdsn] entry later in the file. JDBCdsn = Sybase JDBC Server [JDBCdsn] Driver = /usr/local/freetds/lib/libtdsodbc.so Description = Sybase JDBC Server Trace = No Servername = JDBCRefers to the [JDBC] entry in &freetdsconf;. Database = pubs2 [Default] Driver = /usr/local/freetds/lib/libtdsodbc.so Sample ODBC-combined &freetdsconf; file ; ; freetds.conf ; [JDBC] host = jdbc.sybase.com port = 4444 tds version = 5.0 With this arrangement, an application can connect to the server in two ways, via its DSN (JDBCdsn), or its servername (JDBC). Troubleshooting ODBC connections Supposing everything compiles and installs without trouble, how do you know if your ODBC setup works? Or, if you know it doesn't, what then? First, try to connect with tsql. If you're intending to use &freetdsconf;, exercise it with tsql -S servername. If not, use TDSVER=auto tsql -H hostname -p port If tsql works and isql doesn't, you've isolated the problem to the ODBC setup. &freetds; might have some interoperability problems, but mere connection to the database isn't one of them! If tsql doesn't work, turn on logging with TDSDUMP. The log will tell you what TCP/IP name (and address) &freetds; is attempting to connect to, and what version of the TDS protocol it's using. With iODBC &iODBC; comes with a sample command line query program called odbctest, located in the iodbc/samples directory. Using this program you can get a listing of DSNs, connect, and issue queries. For debugging purposes, you may wish to link a program such as odbctest directly to &freetds; instead of to the driver manager. Why? Once the program is started in the debugger, the driver entry points become viable breakpoints. Because the DM loads the driver dynamically with dlopen(3), no driver addresses even exist until the runtime linker loads it. To do so, compile and install the &odbc; driver with &iODBC; as normal When linking directly to &freetds; you still need the Driver Manager's header files., then compile and link the program: Compile <filename>odbctest</filename> without a driver manager. $ make odbctest.o $ gcc -g -o odbctest odbctest.o /usr/local/freetds/lib/libtdsodbc.a Now you can run gdb or another debugger and set breakpoints on functions in the library without the driver manager getting in the way. With unixODBC Try isql -v dsn username password, and have a look at the log. See if the right address and TDS version are being used. Adjust to taste. Use <command>osql</command> The osql utility is a Bourne shell script that checks your ODBC configuration. If it approves, it invokes the &unixODBC; isql utility. Cf. man osql for details on its use. Use <command>osql</command> to test the ODBC setup. $ osql -S machine -U mr_ed -P hayseed looking for odbc.ini and odbcinst.ini in /usr/local/etc reading "/usr/home/mr_ed/.odbc.ini" [machine] found in "/usr/home/mr_ed/.odbc.ini" found this section: [machine] Database = testdb Servername = machine Trace = Yes TraceFile = /tmp/unixodbc.trace looking for driver for DSN [machine] no driver mentioned for [machine] in .odbc.ini looking for driver for DSN [default] driver "FreeTDS" found for [default] in .odbc.ini found driver named "FreeTDS" FreeTDS is not a readable file looking for entry named [FreeTDS] in /usr/local/etc/odbcinst.ini driver "/usr/local/lib/libtdsodbc.so" found for [FreeTDS] in odbcinst.ini /usr/local/lib/libtdsodbc.so is a readable file Using ODBC-Combined strategy FreeTDS servername is "machine" (from /usr/home/mr_ed/.odbc.ini) looking for [machine] in /usr/home/mr_ed/.freetds.conf "/usr/home/mr_ed/.freetds.conf" is a readable file found this section: [machine] host = machine.example.com port = 2500 tds version = 7.1 machine.example.com has address 10.82.32.177 DSN: machine Driver: /usr/local/lib/libtdsodbc.so Server's hostname: machine.example.com Address: 10.82.32.177 Attempting connection as mr_ed ... + exec isql machine mr_ed hayseed -v +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> The reader is here advised that the isql that comes with many versions of &unixODBC; will truncate text and surprise in other ways without warning. If it behaves strangely, try &freetds;'s bsqlodbc before you decide you've found a &freetds; bug.
Advanced Configurations This chapter details some advanced configurations that need expanded explanation. Big Endian Clients with Buggy <productname>Microsoft SQL Server</productname>s Several version of Microsoft SQL server have a bug that affects big endian clients. This includes 7.0 GA and 7.0 SP1. Furthermore, TDS Protocol version 7.0 is natively little endian. Microsoft SQL Server 2000 is also reported not to work from big endian clients without little endian emulation turned on. The terms big endian and little endian come originally from Gulliver's Travels. In computer science they refer to the the integer byte-order for a processor. Big endian processors, such as Sparc and PowerPC store the most significant byte in the first memory location of a multi-byte integer. Little endian processors, such as Intel and Alpha do it the other way around. So the 16-bit number 258 would be 0x0102 on big endian and 0x0201 on little endian machines. In this example we want to force connections to a server named mssql to emulate a little endian client. We are using protocol version 4.2 here, version 7.0 or above will automatically emulate little endian mode regardless of the &freetdsconf; setting. You shouldn't use this option, set another protocol version instead (7.0, 7.1, 7.2, 7.3 or 7.4). Emulate Little Endian &freetdsconf; setting [mssql] host = ntbox.mydomain.com port = 1433 tds version = 4.2 emulate little endian = yes Localization and <acronym>TDS</acronym> 7.0 TDS 7.0 uses 2-byte Unicode (technically, UCS-2, recently UTF-16) to transfer character data between servers and clients. Included in character data are query text (i.e., SQL), metadata (table names and such), and bona fide data of datatypes nchar, nvarchar, and ntext. (Background information on Unicode and how it affects &freetds; can be found in the appendix.) Because most Unix tools and environments do not support UCS-2, &freetds; provides for conversion by the client to other character sets. The mechanism used is determined by the configure script, which looks for a iconv(3) function, an implementation of the iconv standard. If no iconv library is found, or if it is explicitly disabled, &freetds; will use its built-in iconv substitute, and will be capable of converting among only ISO 8859-1, UTF-8, UCS-2, UTF-16 and UTF-16. To learn what character set the client wants, &freetds; prefers the applicable &freetdsconf; client charset property. If that is not set, it parses the LANG environment variable. In either case, the found string is passed to iconv(3) (or its built-in replacement). The built-in replacement expects GNU iconv names: ISO-8859-1, US-ASCII, or UTF-8.. If neither is found, UCS-2 data are converted to ISO 8859-1. To list all supported iconv character sets try iconv(1). GNU's does: $ iconv --list For other systems, consult your documentation (most likely man iconv will give you some hints). In this example a server named mssql will return data encoded in the GREEK character set. Configuring for GREEK &freetdsconf; setting [mssql] host = ntbox.mydomain.com port = 1433 client charset = GREEK If &freetds; runs into a character it can not convert, its behavior varies according to the severity of the problem. On retrieving data from the server, &freetds; substitutes an ASCII '?' in the character's place, and emits a warning message stating that some characters could not be converted. On sending data to the server, &freetds; aborts the query and emits an error message. It is well to ensure that the data contained in the database is representable in the client's character set. If you have a mix of character data that can not be contained in a single-byte character set, you may wish to use UTF-8. UTF-8 is a variable length unicode encoding that is compatible with ASCII in the range 0 to 127. With UTF-8, you are guaranteed to never have an unconvertible character. &freetds; is not fully compatible with multi-byte character sets such as UCS-2. You must use an ASCII-extension charset (e.g., UTF-8, ISO-8859-*)not EBCDIC or other weird charsets. Great care should be taken testing applications using these encodings. Specifically, many applications do not expect the number of characters returned to exceed the column size (in bytes). In the following example, a server named mssql will return data encoded in the UTF-8 character set. Configuring for <acronym>UTF-8</acronym> &freetdsconf; setting [mssql] host = ntbox.mydomain.com port = 1433 client charset = UTF-8 It is also worth clarifying that TDS 7.0 and above do not accept any specified character set during login, as 4.2 does. A TDS 7.0 login packet uses UCS-2. Microsoft Server Note String literals in SQL must be prefixed with 'N' unless the enclosed string can be represented in the server's single-byte character set, irrespective of the column's datatype. For example, in the SQL statement INSERT INTO tablename (greeting) VALUES ('Hallå') the string is subject to somewhat surprising treatment by the server. When the server parses the SQL, it extracts the data values for insertion (or update, or comparison, etc.) Unprefixed strings are converted to the single-byte character set of the server/database.The precise rules are unknown to the author. Inserted data are then of course stored in the column. In the case of UCS-2 columns — nchar, nvarchar, and ntext — the value stored is that which results from a second conversion: from the single-byte form to the UCS-2 form. The only safe way to enclose strings in SQL text is with an 'N' prefix: INSERT INTO tablename (greeting) VALUES (N'Hallå') Commentary What's surprising about this? Versions 7.0 and later of the TDS protocol use UCS-2 to send SQL text. No matter how your local client is configured — with UCS-2 or ISO 8859-1 or anything else — it's converted to UCS-2 before it's sent to the server. And obviously arrives at the server as UCS-2. If the column into which it's being inserted is also UCS-2, there's no need of any conversion, much less two, and certainly no need to lose information. Why this happens is anyone's guess. Here's one: it makes the datatype of the column unimportant. Regardless of whether you use char/varchar/text or nchar/nvarchar/ntext or a mixture of the two, the arriving SQL (if naïvely written) will store exactly the same characters. Domain Logins Domain logins can be used only with TDS protocol versions 7.0 or above. As mentioned in the installation chapter, Microsoft SQL Server includes the ability to use domain The term domain in this context is a Microsoft term. It refers to what's sometimes called an NT domain. It's unrelated to the DNS domain. DNS domains are used for name resolution. NT domains are used for authentication. Authentication is done by the domain controller, often the Primary Domain Controller (PDC). The Microsoft SQL Server machine may belong to an NT domain. &freetds; provides an encrypted password — a domain password, known to the domain controller — that the server will ask the domain controller to verify. logins instead of standard server logins. Passwords are encrypted on the wire using a challenge-response protocol. &freetds; plays nice with such logins. &freetds; supports single sign-on (connecting without prompting for a username & password) or not, depending on how it was configured. For Windows hosts (both 32- and 64-bit), if SSPI is enabled, &freetds; will log in using so-called trusted authentication. For non-Windows hosts, enabling Kerberos provides similar functionality. When neither option is enabled, &freetds; can still log in using the domain account, but the user must supply the username & password. To use domain logins without SSPI or Kerberos, use the 'DOMAIN\username' syntax for the username and use the domain password. Logging in with a domain login $ tsql -S camelot -U 'NOTTINGHAM\lancelot' -P roundtable locale is "C" locale charset is "646" Msg 5703, Level 0, State 1, Server CPRO200, Line 0 Changed language setting to middle_english. 1> When &freetds; sees the \ character, it automatically chooses a domain login. Implementation details Support for domain logins in &freetds; is limited to the TCP/IP network protocol stack. &freetds; does not currently implement support for Named Pipe-based SQL connections — that is, connections transported over the DCE/RPC interface, which uses TCP port 139, 445, or 135 on Win32 machines depending on the type of encapsulation used for DCE/RPC itself. Supporting this would require a fairly extensive DCE/RPC library for Unix. Samba has one that is licensed under the GPL and therefore not usable by LGPL-licensed projects such as &freetds; . For a technical description of the protocol used for domain logins, see http://davenport.sourceforge.net/ntlm.html Kerberos Support Perhaps surprisingly, Kerberos can be used to authenticate to Microsoft SQL Servers. It works because much of Active Directory is based on Kerberos. From each according to his ability; to each according to his needs. This affords single-signon (or, at most, double-signon) capability in non-Windows environment. To take advantage of Kerberos you have to set up your machine with keytab No, the author does not really know what he's talking about. from your Active Directory. You could use Samba or configure Kerberos directly (/etc/krb5.conf). configure includes options to define the location of your Kerberos installation (cf. ). By default UNIX does not initialize a Kerberos ticket with your login account. You must use kinit to initialize a ticket. You could also configure Kerberos in PAM to initialize a Kerberos ticket at login time. Threading in unixODBC &unixODBC; uses a strong thread-locking policy that causes big locks with the default configuration for &freetds;. Performance of multi-threaded applications can be affected because every operation is serialized. To avoid this problem, choose a threading model in odbcinst.ini. Sample <filename>odbcinst.ini</filename> for threading model [FreeTDS] Driver = /usr/local/freetds/lib/libtdsodbc.so Threading = 1 Sample <filename>odbc.ini</filename> for threading model [Server1] Driver = FreeTDS Server = myServer1 Port = 1433 You can use also a connection string e.g. DRIVER=FreeTDS;SERVER=myServer1;PORT=1433;. Appending Dump Files When running &freetds; with applications such as Apache/PHP it is often difficult to get a usable log file. Since each of the many httpd children opens the file at the beginning of its connection and closes it on connection close, they tend to stomp all over each other. In append mode, the log file is opened for append each time it is written to and then immediately closed. If you are experiencing problems when running under Apache (or similar application) use append mode to generate useful logs. Turning on Dump File Append mode in &freetdsconf; [mssql] host = ntbox.mydomain.com port = 1433 dump file = /tmp/freetds.log dump file append = yes In this example, the /tmp/freetds.log file will contain log entries for all processes using the Microsoft SQL Server server, identified by pid. Because there will be one log file being opened and closed more or less continuously, there is going to be a negative impact on performance. Also, be advised that the log file will grow quite large. As an alternative to &freetds; logging, you might also consider using tcpdump or wireshark to log network packets. While not as useful as a TDS log, it can also help to identify problems. TDS Connection Pooling The Connection Pooling server swims in the src/pool directory. The &freetds; connection pool is a server process; it emulates a SQL Server. Any program that can attach to a real SQL Server may instead elect to attach to the pool server. The pool in turn connects to the SQL Server and database you specify, and attempts to share these connections. See the src/pool/README for a more detailed description of its inner workings. To configure the pool server, first make sure &freetds; has a working entry for the real SQL Server by connecting to it with SQSH or another program. The &freetds; connection pool currently does not supports TDS version 5.0 (Sybase) and encrypted connections. This restriction applies to both the client-to-pool and pool-to-server connections! After &freetds; has been installed, you will find an executable named tdspool in the /usr/local/bin directory (or whatever directory was specified with the configure option). Edit pool.conf in the &freetds;'s etc directory. The pool.conf file is formatted like &freetdsconf;, with a section name in brackets and options for each section in key/value pairs. Just as in &freetdsconf; there are two types of sections, a [global] section whose options affect all pools, and a section with the name of the pool for pool-specific options. The following options are supported and may appear in either section. pool.conf settings Name Possible Values Default Meaning user Any valid user none The username used to connect to the pool server. password Any none The password of the user at the pool server. server user Any valid user user field The username used to connect to the servername. server password Any password field The password of the user at the servername. server Any entry in the freetds.conf file none The alias from the freetds.conf file representing the servername that will be connected to. database Any valid database User's default database The database on the servername to use. port Any TCP port none Port on which tdspool will listen. min pool conn 0 or more none Minimum number of open connections to maintain to the servername. 0 will cause pool server to not open any initial connection. max pool conn 1 or more none Maximum number of open connections to open against the servername. max member age 0 (no limit) or a number of seconds 0 Maximum age of idle members before connection is closed.
Now, let's put this into practice. pool.conf [global] min pool conn = 5 max pool conn = 10 max member age = 120 [mypool] user = webuser password = secret database = ebiz server = fooserv max pool conn = 7 port = 5000 The [global] section defines that we will open 5 connections against the server initially, and will increase up to 10 as demand requires. These connections will be closed after being idle for 2 minutes (120 seconds), but only until there are 5 remaining open. The [mypool] section defines a pool named mypool that will listen on port 5000. It will login to a SQL Server named fooserv using the user webuser and the ever so clever password of secret. Once logged in, the connections will use the database ebiz instead of webuser's default database. Also, since this SQL Server has a limited number of CALs (Client Access Licenses), we are restricting the maximum number of connections to 7, which overrides the global setting of 10. Run tdspool with the name of the pool you are serving. $ tdspool mypool Before your clients connect to the pool, you must edit your &freetdsconf; to include the host and port of the pooling server, and point your clients at it.
stunnel HOWTO Contributed by Bradley Bell. To set up &freetds; over stunnel between a Linux webserver and a W2k SQL server: Get unencrypted &freetds; working Install openssl and stunnel on the Linux box: stunnel.org Download the stunnel binary and openssl dll's for Windows. Generate stunnel.pem (complete with Diffie-Hellman parameters) for placement on the W2k box. See instructions in the stunnel FAQ. Start stunnel on the W2k box: $ stunnel.exe -d 61666 -r localhost:1433 61666 is just an arbitrary port number. Start stunnel on the Linux box: $ stunnel -c -d 1433 -r win2kserver:61666 where win2kserver is the hostname or IP address of the W2k box. Set up &freetds; to use the tunnel. If this is your unencrypted entry in &freetdsconf;: Unencrypted entry in &freetdsconf; [win2kserver] host = win2kserver port = 1433 the encrypted equivalent uses: Encrypted entry in &freetdsconf; [win2kserver] host = localhost port = 1433
Use &freetds; &freetds; includes several utilities. Some are testing tools, some demonstration projects, some intended for day-to-day use. All have man pages. &freetds; Utilities (listed alphabetically) bsqldb A non-interactive equivalent of the isql utility programs distributed by Sybase and Microsoft. Like them, bsqldb uses the command go on a line by itself as a separator between batches. The last batch need not be followed by go. bsqldb makes use of the &dblib; API. Intended for production use. bsqlodbc A non-interactive equivalent of the isql utility programs distributed by Sybase and Microsoft. Like them, bsqlodbc uses the command go on a line by itself as a separator between batches. The last batch need not be followed by go. It uses the &odbc; API. bsqlodbc is a demonstration project, but can also aid in isolating problems. &odbc; applications typically have many layers, and it can be difficult to know if a problem arises in a layer, or in the interface between layers. By executing a query in bsqlodbc, you can see if the functionality of the &odbc; driver works when used as the folks who wrote the driver thought it would be used. datacopy A tool for migrating data between Sybase ASE and Microsoft SQL Server or vice versa. datacopy will move table data from one server to another without the need for intermediate files. datacopy is much faster and more efficient than is freebcp out/in. datacopy makes use of the &dblib; bcp API. defncopy Replaces a similar program of the same name distributed by Sybase. defncopy reads the text of a stored procedure or view, and writes a script suitable for recreating the procedure or view. For tables, it reads the output of sp_help and constructs a CREATE TABLE statement, complete with CREATE INDEX, too. fisql A complete replacement of the isql utility programs distributed by Sybase and Microsoft. Like them, fisql uses the command go on a line by itself as a separator between batches. freebcp Replicates the functionality of the bcp utility programs distributed by Sybase and Microsoft. freebcp makes use of the &dblib; bcp API. The manual pages or online help for Sybase or Microsoft SQL Server can be referenced for more detailed information on bcp functionality. osql A Bourne shell script that checks and reports on your configuration. tsql A diagnostic tool that uses uses the lowest level &freetds; library, libtds, as a way to isolate potential bugs in the protocol implementation. tsql is not a replacement for a complete isql. How to get what works with it working The following programs are known to work to some extent with &freetds;. Here you will find any special instructions for getting them compiled or running. <application>SQSH</application> SQSH is a command line based query tool written by Scott Gray to replace the isql utility that ships with Sybase ASE. It makes a great diagnostic tool for &freetds; as well. If you are having trouble, install SQSH (it's easy) and try getting that to work before more complicated arrangements. SQSH is an excellent tool. Because it uses &ctlib;, it works with &freetds;, but potentially — and with significant effort — it could be ported to ODBC and thus made useful for other server environments. Just a thought…. SQSH 2.1 includes direct support for &freetds;, so these instructions may not be necessary, but are still included just in case. After running configure in SQSH's directory (make sure you set the Sybase environment variable first), look for the Sybase_LIBS definition in the Makefile. Change the line to match this example. The <application>SQSH</application> Makefile # # The following set of CT-LIB libraries were determined automatically # by 'configure'. For most systems configure looks up the required # libraries by looking at the name of the OS (although this doesn't # mean it got them right), however if the line below ends with the # word "Guess", then 'configure' didn't have an entry for your operating # system and it took a best guess to figure out which libraries you # need. In either case, there may be problems, so look this line over # and if it doesn't work, compare it to the libraries located in # $SYBASE/samples/ct-library. # # The listings below show suggested libraries for Operating Systems # that frequently fail to be recognized by 'configure': # # SCO: -lblk -lct -lcs -lcomn -ltcl -ltli -lnsl_s -lintl -m -lsocket # Dynix: -lblk -lct -lcs -lcomn -ltcl -ltli -lnsl -lintl -lm -lseq # SYBASE_LIBS = -lct -ldl -lm At this point you can also enable readline support if you didn't specify it in the configure arguments. After that just type make and you are off and running. Perl There are a few ways to use Perl to connect to a SQL Server using &freetds;. DBD::ODBC The recommended choice is DBD::ODBC with the &freetds; &odbc; driver. DBD::Sybase You may also use DBD::Sybase from Michael Peppler. Despite the name it works for any Sybase or Microsoft SQL Server. DBD::Sybase uses the &ctlib; API and works well. However the project has not been updated for a while. Sybperl Finally, you can use Sybperl. Scripts written against Sybperl will not run against other databases the way DBI scripts will. However, it will be familiar ground for those who know &dblib;. Building and using the Perl modules Building <systemitem class="library">DBD::ODBC</systemitem> $ cd DBD-ODBC-0.28 $ export SYBASE=/usr/local/freetds $ export ODBCHOME=/usr/local $ export DBI_DSN=dbi:ODBC:JDBC $ export DBI_USER=guest $ export DBI_PASS=sybase $ perl Makefile.PL $ make $ su root Password: $ make install We used the public JDBC server logins for our configuration here. You'll want to replace these with ones suitable to your environment. Connect to a server with <systemitem class="library">DBD::ODBC</systemitem> #!/usr/local/bin/perl # use DBI; my $dbh = DBI->connect("dbi:ODBC:JDBC", 'guest', 'sybase', {PrintError => 0}); die "Unable for connect to server $DBI::errstr" unless $dbh; my $rc; my $sth; $sth = $dbh->prepare("select \@\@servername"); if($sth->execute) { while(@dat = $sth->fetchrow) { print "@dat\n"; } } Building <systemitem class="library">DBD::Sybase</systemitem> $ cd DBD-Sybase-0.91 $ export SYBASE=/usr/local/freetds $ perl Makefile.PL $ make $ su root Password: $ make install There will be some output about missing libraries after perl Makefile.PL. These are normal. The following example will attach to Sybase's public JDBC server and run a simple query (it can be found in samples/test.pl): Connect to a server with <systemitem class="library">DBD::Sybase</systemitem> #!/usr/local/bin/perl # use DBI; my $dbh = DBI->connect("dbi:Sybase:server=JDBC", 'guest', 'sybase', {PrintError => 0}); die "Unable for connect to server $DBI::errstr" unless $dbh; my $rc; my $sth; $sth = $dbh->prepare("select \@\@servername"); if($sth->execute) { while(@dat = $sth->fetchrow) { print "@dat\n"; } } You'll note this is the same program as for DBD::ODBC with the exception of the connect statement. Welcome to the magic of DBI! PHP There are three options for building PHP with support for &freetds; corresponding to the three APIs that &freetds; supports: &dblib;, &ctlib;, and &odbc;. All these examples build the CGI version. Consult PHP's documentation for building the Apache module and including other extensions. &dblib; PHP can be configured with &dblib; access for a "Sybase" server (which also works with Microsoft servers), or with the mssql extension, intended exclusively for Microsoft servers. PHP and &dblib; for <quote>Sybase</quote> First build &freetds; normally. $ ./configure --prefix=/usr/local/freetds $ make $ su root Password: $ make install Then build PHP with support for Sybase $ cd php $ ./configure --with-sybase=/usr/local/freetds $ make $ su root Password: $ make install And that's it! &ctlib; Option 2 is to use the &ctlib; API. Again here, we run into minor difficulties at build time. Applications linking with Sybase's OpenClient have to link in a handful of libraries and these libraries vary slightly from platform to platform. When creating &freetds; it was decided that there would be only one library: libct. This saves a great deal of library naming conflicts that Sybase ran into (e.g. libtcl is used both by Sybase and the language TCL), however some applications like PHP assume that all the Sybase libraries will be present. So, some hand editing of the Makefile is necessary to remove these extra libs. Build &freetds; just as you would for &dblib; in with &dblib;, above. Then configure PHP with &ctlib;. $ cd php $ ./configure --with-sybase-ct=/usr/local/freetds Now edit the Zend/Makefile looking for the libZend_la_LDFLAGS line and remove -lsybtcl -lintl -lcomn and -lcs, leaving the -lct. Then proceed to make and install PHP. $ make $ su root Password: $ make install We hope an upcoming version of PHP will automatically detect the presence of &freetds; and include only the -lct library. &odbc; The third and newest option is to use the &freetds; &odbc; driver with PHP. First build the &iODBC; or &unixODBC; driver manager and &freetds; as detailed in . Then build PHP with support for ODBC. $ cd php $ ./configure --with-iodbc=/usr/local $ make $ su root Password: $ make install Now everything should run. There is a sample PHP script in the &freetds; samples directory called odbctest.php. Python pymssql The pymssql module is a simple database interface to Microsoft SQL Server for Python that builds on top of &freetds; to provide a Python DB-API v2 (PEP-249) interface to Microsoft SQL Server. The 2.x branch of pymssql take advantage of recent releases (0.91 and newer) of &freetds; and by doing that removes many of the limitations previously found with older &freetds; versions and the 1.x branch. pymssql features include: Unicode friendly Python 3 friendly Works on most popular operating systems Written in Cython for performance Includes a supported and documented low-level module (_mssql) that you can use instead of the DB-API Supports stored procedures with both return values and output parameters A comprehensive test suite Please refer to the pymssql home page where you'll find complete documentation on how to obtain, install and use it. Sybase module You can obtain the Python Sybase module here. This example uses version 0.37, the most current at the time of this writing, please adjust accordingly if using a different version. $ tar xvfz sybase-0.37.tgz $ cd sybase-0.37 $ export SYBASE=/usr/local/freetds $ export CFLAGS="-DHAVE_FREETDS" $ export LD_LIBRARY_PATH=/usr/local/freetds/lib:${LD_LIBRARY_PATH} $ python setup.py install Edit the example.py and fix the bottom stuff, &freetds; lacks the 110 symbols for version use 100 $ python example.py Qt To access SQL Server databases using Qt use QODBC. There are some problems with wide character support on Qt because Qt assumes sizeof(SQLWCHAR) == 2. On some DMs, though — including &iODBC;, the default on Ubuntu — sizeof(SQLWCHAR) == 4, which could lead to invalid character conversion. ODBC on Unix &odbc; has some issues on Unix, mainly due to lack of clean specifications. ODBC and 64-bit ODBC was originally specified as 32-bitIn fact, the earliest versions were 16-bit.. Its evolution to 64-bit took place in the absence of a good specification which led to conflicting declarations and associated problems. For instance, some parameters are defined as SQLINTEGER but are used for pointer offsets. But SQLINTEGER was (and remains) 32-bit, while pointer offsets must be 64-bit. Also row numbers and some other formerly 32-bit quantities are now 64-bit. If you use &unixODBC; Frediano would recommend at least version 2.2.14. Earlier versions have issues if used on 64-bit environments. sizeof(SQLWCHAR) Under Windows sizeof(wchar_t) == sizeof(SQLWCHAR) == 2 but on many Unix systems you have sizeof(wchar_t) == 4. And some DMs decided to keep sizeof(SQLWCHAR) == 2 (including &unixODBC;) while in other DM sizeof(SQLWCHAR) == sizeof(wchar_t) == 4 (namely &iODBC;). This leads to incompatible ABIs between applications and drivers. If you compile the &freetds; ODBC driver using &iODBC; take care to ensure all drivers are compiled with the same header files. Alternatively, compile &freetds; with both includes and rename the library to use two ABIs (for instance having a libtdsiodbc.so and a libtdsuodbc.so). At the time of writing Ubuntu compiled Qt using &iODBC; but most packages use &unixODBC;. If you plan to use Qt with the &freetds; &odbc; driver, you should have an &iODBC;-compatible driver. Also be aware that the QODBC Qt driver has problems with &iODBC; and SQLWCHAR (see Qt). Due to these problems Frediano suggests not using this configuration (Qt database) on Ubuntu at this time. Default charset Character encoding is yet another trap. ODBC makes no provision for specifying client character encoding. By default many DM converting from multi-byte to wide characters assume the client uses ISO 8859-1. Even the &freetds; driver assumes ISO 8859-1 by default. Also some DM have problems converting multi-byte encodings (like UTF-8), by assuming a byte can be converted to a single wide character (and vice versa). That creates problems if you use multi-byte encoding for &freetds; driver. Troubleshooting Jason Mewes (Mall Rats) He's like motherf**king McGuiver, no he's better than McGuiver! Known Issues Porting Issues Date Structures and Offsets Microsoft and Sybase use different &dblib; date structures and conventions. Notably months can be in the range [0,11] or [1,12]. Pay careful attention to the results of dbdatecrack(). Floating Point Precision may surprise you if you pay attention. Microsoft's &dblib; promotes single-precision to double in dbbind() by appending zeros; C promotes it to the nearest double. &freetds; relies on the C compiler. Math libraries vary, too. If porting an application whose output uses functions such at log(3), expect differences in different implementations. Perfectly consistent results between OSes will require the use of a single math library. <type>Text</type> Fields Questions sometimes arise over large varchar types (anything larger than varchar(255)) that became available with Microsoft SQL Server 7.0. When accessing long varchars with TDS protocol version 4.2 or 5.0, these fields will be truncated to 255 characters, due to limitations inherent in the protocol definition. Your best bet in that case is to convert them to text types. In Microsoft SQL Server 7.0 and later, varchar types can hold up to 8000 bytes (8000 ASCII characters or 4000 Unicode characters). To move these large varchars through TDS 4.2, convert them with either a CONVERT as in, SELECT mycol = convert(mycol, text) FROM mytable or with the newer SQL92 CAST syntax e.g., SELECT CAST(mycol as TEXT) FROM mytable There is also a bug (Lions and tigers and bugs! Oh, my!) in Microsoft's implementation of text fields. Disregardless [sic] of their documentation, you must explicitly set the value of TEXTSIZE, else the text fields will be represented to have a maximum size of 4 gigabytes or so. If you encounter some spurious out of memory error try to set TEXTSIZE to some reasonable value before querying any TEXT fields. For example, in isql: 1> set TEXTSIZE 10000 2> go Another way to handle control the default TEXTSIZE is to use the setting in &freetdsconf;. As most of the time data contained in BLOBs fields are much smaller than larger supported fields, we try to avoid considering field sizes for BLOBs allocating memory as needed instead, so you should not have to reduce this value unless you really want the server to limit data returned by queries. Endianism If either your server or your client is a big endian system, pay careful attention to all references to endianism anywhere near &freetds;. See the section on Little Endian Emulation for details. <type>Datetime</type> and <type>Money</type> Big endian clients may experience difficulty with Microsoft servers. Some versions of Microsoft SQL Server 7 did not handle these types on these machines correctly, according to the protocol. According to http://support.microsoft.com/support/kb/articles/Q254/1/23.ASP on the Microsoft support site, it's fixed as of service pack 3. Unfortunately, there's no direct way for &freetds; to know whether or not a service pack has been installed, and how/whether to support the buggy version is an outstanding issue. Your best bet is to apply their patch. The Knowledge Base article states The Sybase CT-Lib client is the only known big-endian client that can connect to SQL Server. Depends on who's doing the knowing, of course. Microsoft's <quote>Integrated Security</quote> &freetds; may be unable to connect to the server. The error message will be "Login failed for user 'example'. Reason: Not associated with a trusted SQL Server connection". To solve this, turn on SQL Server authentication: Open the Microsoft SQL Server Enterprise Manager, Select the server, Right mouse click and choose Properties. A properties window will appear. Choose the Security tab. The security properties will be displayed. Change the Authentication field to SQL Server and Windows, Apply the changes and try again. These instructions apply to Microsoft SQL Server 7 and SQL Server 2000. &freetds; supports integrated security mode, too. If you have Microsoft SQL Server running in integrated (domain) mode along with a Windows PDC, and wish to try it, see Domain Logins in the Advanced Configurations chapter. If you have Active Directory you can also use Kerberos, see Kerberos support. Is the server there? Start with <command>ping</command> First ping the host to make sure you can talk to the machine the server resides on. Finding the server's host $ ping -c1 myhost PING myhost (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data. 64 bytes from myhost (127.0.0.1): icmp_seq=0 ttl=255 time=250 usec A successful ping shows that your network isn't preventing you from reaching the machine hosting the server. Test with <command>telnet</command> Attempt to telnet to the port, to verify that the servername is listening. Finding the server $ telnet myhost 1433 Trying 127.0.0.1... Connected to myhost. Escape character is '^]'. If you get output as above, the servername is listening. If you get a 'Connection Refused' message, you're talking to the wrong host, wrong port, or the servername is down. To exit telnet: When connected, telnet's command mode may be entered by typing the telnet escape character (initially Ctrl-], as above). Once in command mode, telnet may be exited with the command quit. Test with <command>tsql</command> tsql can be run in two ways, one which uses &freetdsconf; and one which connects directly using the host and port. First attempt a connection using host and port. Connecting to the server, bypassing &freetdsconf; $ cd src/apps $ TDSVER=auto ./tsql -H myhost -p 1433 -U user If you receive a message of 'Login Failed.' then your connectivity is OK, but you have a authentication issue. If you receive a message like Msg. No.: 18450 Severity: 14 State: 1 Login failed- User: loginid Reason: Not defined as a valid user of a trusted Microsoft SQL Server connection Microsoft SQL Server is accepting only domain logins. This applies only to Microsoft SQL Server and you'll need to have your DBA verify that server logins are allowed, or use a domain login. Finally, if you received a prompt, then try tsql using the servername. Connecting to the server using &freetdsconf; $ ./tsql -S myserver -U user If this fails, &freetds; is either not finding your &freetdsconf; file, finding the wrong one, or there is an error in the file. Logging &freetds; has quite extensive logging capabilities. These are often invaluable in setting up new configurations, when it's hard to be sure precisely what configuration information is being used, and what communication is (not) working. Often such questions can be quickly resolved by turning on logging and examining the logs. Environment Variables that Control Logging TDSDUMP Log files can be turned on using the TDSDUMP environment variable. For instance, setting the location of a dumpfile $ export TDSDUMP=/tmp/freetds.log Will generate a log file named freetds.log in the /tmp directory. The filenames stdout and stderr are also supported. They can be handy if you want to intersperse the log output with your application's output, or if your application opens more than one connection. (The logfile is otherwise normally truncated each time the library connects to the server.) TDSDUMPCONFIG Set TDSDUMPCONFIG to a file to write information to on how the configuration information is being obtained, e.g. from environment variables, a &freetdsconf; file, or interfaces file. Sometimes it's unclear what source of information &freetds; is using to connect to a given servername. This variable can make that bright and clear. What if you were running Apache/PHP? Apache has many children. Setting the TDSDUMP (and/or TDSDUMPCONFIG) variable to a null string will cause &freetds; to open a log under every PID. $ export TDSDUMP="" The log files will be named /tmp/freetds.log.9999, where 9999 is the pid number of the process generating the log. A couple of important notes about using the logs with &freetds;. First, the logs tend to grow large, so trim or archive them often. Secondly, &freetds; will record certain network packets to the log, this includes login packets which can contain clear text or clear text equivalent passwords. So, if this is a concern (most likely is) make sure that the files are not world readable, and avoid posting them to mailing lists. Once in a while, someone writes to the mailing list, asking why &freetds; is so slow. It sometimes turns out that logging was left turned on. Don't you be the next victim! &freetds; logs are meant for development and debugging, not as a system monitoring tool. &freetdsconf; variables that Control Logging See Valid bitmask values for debug flags entry in &freetdsconf; The logfile is normally truncated each time &freetds; connects to the server. Logging in ODBC land (Tree-huggers need not worry) Many ODBC Driver Managers have their own support for logging. How logging is controlled, however, varies widely by implementation. The ODBC log is often very helpful because it provides a log of all calls made directly by the application. unixODBC &unixODBC; supports logging via some entries in odbcinst.ini. For example: [ODBC] Trace = Yes TraceFile = /tmp/sql.log ForceTrace = Yes Will generate a log file named sql.log in the /tmp directory. "Page contains no data" Web browsers display this error when the underlying script didn't return any information. The error could be in any of several places, of which &freetds; is one. To isolate the cause, turn on enough logs to see the query, and execute the query through SQSH. If that works, the problem lies further up the chain. If it doesn't, take a look at the known issues section. &freetds; under PHP executing within an Apache process may abort with a segmentation fault. The evidence of this is the words "Segmentation Fault" or "Bus Error" in the Apache error log, and a "Page contains no data" warning displayed by the web browser. The unexpected termination of the process causes the connection to the client to be closed before any buffered data is sent. To diagnose this sort of problem, follow this procedure; Compile PHP as a CGI binary. This should have been a side-effect of your build of PHP, look for an executable called php in the PHP build tree. If you are using a packaged binary, look for a php-cgi package. Make a reproducer. Make a PHP script that reliably reproduces the segmentation fault via the web server, but with no arguments. This is so that you can execute it using the PHP binary, thus excluding the web server as the cause of the problem. Reproduce on command line. Reproduce the segmentation fault using PHP on the command line, by activating PHP with the script as first argument. For example; % php file.php Segmentation fault % If this doesn't reproduce the segmentation fault, then there is something about the environment that differs, so look for the differences and resolve them. Check environment variables, assumptions made by the script, the UID you are executing under, and the current working directory. Reproduce using GDB. Now reproduce the segmentation fault using the debugger, GDB. Instead of aborting to the command line, GDB will stop executing the PHP program at the point of failure. Use the bt command to determine the details and context. This is called a backtrace. % gdb php gdb> run file.php gdb> bt Analyze the backtrace. Read the backtrace to determine what the cause of the problem is. Examine each line, assigning responsibility by component; some code is PHP, some is &freetds;, and some may be glibc. You will need the source code for each component, and software engineering debugging skills. If you cannot determine the cause yourself, send the backtrace to the mailing list, along with the PHP script. It helps to make the script as small as possible, but still fail. It also helps to report the version numbers of PHP, and &freetds;. Slow connection or data retrieval &freetds; is not slow. We know this because we've tested it. It's measurably slower than the vendors' products for some operations, but it's not noticeably slower and it's certainly no laggard. If your experience is different, if you're waiting 30 seconds for simple operations or minutes instead of seconds for for query results, something is up with your setup. There are two likely culprits. Logging. If everything seems a bit sluggish, check to make sure logging is turned off. TDSDUMP should not be defined, and there should be no dump file mentioned in &freetdsconf;. You can double-check by setting TDSDUMPCONFIG temporarily, which will log only the startup process. DNS. If connecting to the server takes 30 seconds or 1 minute, you could do worse than to check your resolv.conf. Use host or nslookup to confirm that &freetds; can actually resolve the name/address you provided in &freetdsconf;. Packet size. The default packet size setting in &freetdsconf; (see initial block size) is usually fine. Slowness can potentially be due to multiple packet to use. Under GNU/Linux system we use an optimization to reduce network traffic; you shouldn't see much difference using this system. Getting Help Beatles Help me if you can, I'm feeling down And I do appreciate you being 'round. Help me get my feet back on the ground, Won't you please, please help me? In the battle against frustration and wasted motion, this manual is our first defense. Our documentation is intended to make it possible for a knowledgeable user to, well, use &freetds; without further assistance. We strive to include all known features and behaviors here, so you can work quickly and anonymously, and go home before 5:00. Would that it were always thus. Reconfirm the installation For initial setup and login problems, review . Distinguish between network and server issues, between finding the server and logging into it. The TDSDUMPCONFIG log will show how the servername is being looked up, what address & port is being used, what TDS version is being used. The TDSDUMP log will show quite clearly whether or not the server accepted the connection, and whether or not the login succeeded. Remember compiled-in defaults can be displayed with tsql: $ tsql -C Compile-time settings (established with the "configure" script) Version: freetds v&version; freetds.conf directory: /usr/local/etc MS db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: auto iODBC: no unixodbc: no SSPI "trusted" logins: no Keberos: no OpenSSL: yes GnuTLS: no MARS: yes For &odbc; setup issues, the osql script is intended to confirm the configuration files are all sane. If it fails to report a problem, please post a message describing the problem to the mailing list. Thanks. Isolate the cause Successful problem isolation will yield earliest resolution. You (believe it or not) have more information about your environment than anyone else does, and have the greatest motivation to solve your problem. The resources at your disposal will be much more useful if the problem is specific. (Sorry if this is obvious. If it is, you might be surprised how often it's not.) If you can demonstrate the problem with tsql or sqsh, you can expect a quick answer to your question, possibly even a fairly quick fix. (It has happened several times in the last few years that bug reports to small problems were fixed the same day. On a few occasions, new functions were added in a few days. Making &freetds; useful and bugless is the goal of the project, after all.) &freetds; being what it is, problems frequently arise amidst complex environments. It can be hard for both you and the list participants — who are your allies and best resource — to determine what's going wrong. If you can submit a script that they can use to try to reproduce your results, you have a much better chance of happy resolution. On the plus side, the list includes people with a variety of backgrounds, who frequently answer questions that aren't really about &freetds; per se. Clear questions have sometimes even led to submitting patches to other projects. Try a different client &freetds; comes with its own utilities that use the various libraries. It's a good idea to run your query through one of them — the one that uses the same API you're using — to see if it produces the same behavior you're seeing. That helps eliminate your application (and the rest of the calling hierarchy) as a source of the problem. Check permissions If your query works in tsql but not with Apache, make sure the account running Apache can find and read &freetdsconf;. Also consider security settings like firewalls, SELinux/AppArmor or similars. The Mailing List 3 Henry VI, I, ii, approximately In them I trust; for they are [hackers] Witty, courteous, liberal, full of spirit. The Archive The &freetds; mailing list archive is a good place to start. It is searchable. It should be considered the most up to date (and least edited) source of information. New developments between releases tend not to be announced on the website. The website is updated only intermittently, when we post a new release or &freetds; is somehow in the news, say. If you found a bug or need a feature, you may find it was announced/discussed/fixed by perusing the archive. Ask the list Many of the original authors and anyone maintaining or extending the code reads the list. The traffic tends to be bursty. It usually focuses on build problems and troubleshooting. Again, the more specific your question, the sooner you'll get a useful reply (if it comes). Please, do not email the authors directly. You may well be ignored because they're they type that gets a ton of mail. Anyone willing to address your question reads the list, and you don't want to offend anyone willing to help you by going about it the wrong way. What to include when asking for help Waddya got? It's important to convey your setup and configuration. SQL Server version &freetds; version (or snapshot date, if not a release) any options used with configure which client library you are using what language or Perl module, as appropriate, you're using your client OS and hardware architecture Attach a logfile If you're puzzled by some interaction with the server (often the case), it's a very good idea to set TDSDUMP and attach the log to your message. Messages are currently limited to 75 KB attachments, and the logs are quite detailed, so make your query as short as possible. If necessary, trim the log; gzip is also your friend here. It's always a good idea to post it on a website where people can fetch it if they're so inclined. Log files are especially important if you're not programming at the C level. Sometimes there are problems — an impedance mismatch, to coin a phrase — between &freetds; and the calling framework/language. But if you write to the list and say Why does my PHP foo() returns an empty string?, please keep in mind that your question might as well be in Urdu to someone familiar with the C library. Without knowing which C function was called, and with what data, it's impossible to even begin to try to answer the question. Think about it this way: If you attach a log no one reads, you wasted some bandwidth. If you don't attach one and someone asks you for it, you wasted a day. Like that. Show your work Great questions make the problem crystal clear to a tired developer after supper. Show what you did, and show what happened. Throughout this User Guide, you've seen examples of screenshots; in each case the first line was the command entered, followed by the machine's response. By showing verbatim what you did and saw, you give someone who knows what to do a chance to look over your shoulder. Across the Internet! How cool is that? Whether you're having a problem with your own application or with something at a higher level, you're well advised to try to reproduce it using one of the &freetds; utilities, preferably one that used the same client library you're using. If, say, bsqldb works and your program doesn't, that's a clue. By the same token, if bsqldb exhibits problems, too, chances are you found a bug. Or — how to say it? — a missing feature. It's always good to know about those. Helping Bertrand Russell The time you enjoy wasting is not wasted time. &freetds; is a cooperative, volunteer effort. Flame wars on the list are unknown and the signal to noise ratio is pretty high for its venue. Many people have contributed patches, and few have been turned away. Pick a weak spot and fix it. We don't have enough non-English speakers to test our character set conversion features. Anyone willing to participate in that way would be most welcome. Canonical examples of using the each library would be very helpful to newcomers. An isql Perl and PHP would all make debugging and testing easier for everyone. Send a patch Good patches are nearly always applied in short order. Patches uploaded to SourceForge trigger automatic notification to the &freetds; mailing list. Correct this User Guide Any corrections or suggestions, be they typographical, grammatical, structural, factual, or mineral are most welcome. Please send it to the &freetds; mailing list. The User Guide is maintained in XML DocBook format; the file in your distibution is doc/userguide.xml. It is a flat ASCII file that you can edit with any text editor. You don't have to know XML to correct or add to the User Guide, however. Just open it up, find the place you're interested in, and type away. Do a diff -u old_version your_version and post your patch to the SourceForge site. Any errors or lackings in your markup will be graciously emended by yours truly. Document an <acronym>API</acronym> We have just begun an independent reference manual to &freetds;; the main API documents are the work of the server vendors. We're using Doxygen, which extracts documentation directly from comments in the source code, and we're maybe 25% done. The TDS protocol is partly documented, as are the APIs to libtds and &dblib;, but much remains. Be the Webmaster The FAQ and in particular the news don't get updated often enough. If that's your thing, drop a line to the &freetds; mailing list. Light another's taper Every question you answer on the mailing list will save someone time and, if done well, will actually improve your own knowledge. The project's developers will often answer technical questions that require substantial understanding of the code or suggest a possible bug. Setup issues, though — connecting and logging in to the server, getting Apache going — are questions many experienced users can and do answer, thereby fostering the community on which the project depends. Your experience may well be more closely aligned with the question posed than that of anyone else reading the list that day. You may use that framework or language or OS, or have that particular server. No one, no matter how expert in the code, has used every configuration, version, OS, compiler, etc. Whether you simply confirm there's a problem in some particular arrangement, or say, dunno, works for me, you're adding information. Ambitious ideas If you want to get your hands really dirty, here are some big ideas to contemplate. <literal>libtds2</literal> After many years developing &freetds;, we've learned quite a bit about the protocol and how to write database libraries. Unfortunately, though, one of the things holding us back — and, obviously hampering the project — is the underlying utility library. This wouldn't be a from-scratch effort; most of the code is already written. What's needed is a more uniform API that better reflects the TDS protocol, and that does not attempt character set conversions immediately on receipt of the data. <literal>libstddb</literal> This would be a new client library modelled after stdio, a project to demonstrate what database programming should be like. Server code &freetds; includes a little stub of a server, but it could be much more useful. One idea would be to make it a front-end to SQLite, thereby creating for the first time a TDS client & server pair composed entirely of free software. Advocacy Out of ten people you know, it's a fair bet 10 never heard of &freetds; and nine don't understand the problem it solves. Lots of places have begun to use Microsoft SQL Servers in all sorts of ways, and if you adhere to the Microsoft line, there's only one way to connect to them: from a Microsoft OS. What can &freetds; do that can't be done any other way? Glad you asked. &freetds; can Connect to every version of either vendor's server, using the same binaries. Provide a &ctlib; for Microsoft SQL Server. This feature alone allows DBD::Sybase and sqsh, among others, to connect to Microsoft's product. Provide a modern &dblib; for Microsoft SQL Server: Win32/64, and TDS 7+. Provide a bcp-capable interface and command-line utility on unix-like operating systems for Microsoft SQL Server. Run on many more operating systems than either vendor's libraries do. Get fixed, instead of telling you to get stuffed. Amuse and inform. Also frustrate and infuriate, but we don't put that under Advocacy. If more people knew, fewer would be stuck. Programming TDS protocol reference Can be found on www.freetds.org API Reference Manual The reference manual is installed as part of &freetds;. It can be regenerated at any time using Doxygen with cd doc; make doc. The reference manual is a work in progress: only &dblib; is completely documented, and quite minimally at that. Should you find it inadequate, you may be interested to learn it's not hard to add to, technically. Doxygen generates a manual from encoded comments in the source code. Its markup syntax is not hard to learn. You can read more about it at the Doxygen website. Basic API coverage information for the db-lib, ct-lib, and ODBC client libraries is maintained in doc/api_status.txt, included in the source distribution. For your convenience and enjoyment, we include that file in the following sections. In each table, we note for the function Sybase and Microsoft sometimes use slightly different names for the same function. It is the intention of the option to align &freetds; with one or the other's convention. the extent to which it is implemented. The Status field may be: &dblib; API function status domain (blank) Function is not implemented. stub Function is implemented as a stub. Some such functions return SUCCEED even though they have no effect, to satisfy upper layers. Partial Function is partly implemented. We haven't dealt with every possible option, for instance. OK Function is implemented. Completely, we claim. &dblib; API Implementation Summary Microsoft's version of &dblib; is online. Sybase's is both online and can be downloaded as a PDF file. Links such as these are quite perishable. Should you find them broken, please check the &freetds; User Guide posted on our website. If it's out of date, please let us know, so we can correct it. Thanks. &dblibapixml; ct-lib API Implementation Summary Sybase ct-lib documentation can be found online and in PDF form. Links such as these are quite perishable. Should you find them broken, please check the &freetds; User Guide posted on our website. If it's out of date, please let us know, so we can correct it. Thanks. &ctlibapixml; ODBC API Implementation Summary Microsoft's ODBC documentation is online. The functions are linked to the reference page on Microsoft's website. Links such as these are quite perishable. Should you find them broken, please check the &freetds; User Guide posted on our website. If it's out of date, please let us know, so we can correct it. Thanks. &odbcapixml; DB-Library for the Tenderfoot Mark Twain Few things are harder to put up with than the annoyance of a good example. Below is a complete working &dblib; program, presented as a series of examples. Features of sample code Processes command-line options to select the server, database, username, and password Remaining arguments on the command line comprise the SQL query to execute Installs error and message handlers Illustrates correct row-processing Illustrates correct error detection and handling Other sample code may be found in the distribution, in the cleverly named samples directory. A complete program, heavily commented for your perusal, is apps/bsqldb.c. What's the big deal with errors? Correct handling of errors is extremely important in database applications because they involve two systems most others don't: the network and the database server. Both can give rise to errors that, if not detected and reported when they occur, let the application proceed blithely on until something truly mysterious happens. In the worst case, in the absence of a properly reported error, the application may seem to have updated the data, when in fact it did not. Every &dblib; application uses the network, making it subject to network failures. Database programs also almost always have very high data integrity requirements. It is necessary to know the row was absolutely, positively committed, once and only once, without error or exception. Without taking great care to trap and handle all error conditions, no statement about the program's reliability can be made with confidence. How to Get and Build the sample code Run doc/grep_sample_code to extract the C code from the User Guide XML source. Compile Link Files Required to Build the Sample Code sybfront.h sybdb.h libsybdb.a or libsybdb.so Your library's extension may vary according to your operating system. The source code may be built with commands similar to these. The precise options and paths depend on your particular system. The commands below work with the GNU compiler and linker on an ELF system with dynamic linking, common on Linux and BSD systems. Building the Sample Code $ ../doc/grep_sample_code ../doc/userguide.xml > sample.c $ cc -I /usr/local/include -Wl,-L/usr/local/lib -Wl,-R/usr/local/lib sample.c -lsybdb -o sample where /usr/local/include and /usr/local/lib are respectively the locations of your header files and libraries. We now proceed to the code proper. Header files We need two header files to use &dblib;. We need a few others to deal with I/O in C, as you know. Also declare the error and message handler functions, more about which later. Sample Code: &dblib; header files #include #include #include #include #include #include ]]> #include <sybfront.h> /* sybfront.h always comes first */ #include <sybdb.h> /* sybdb.h is the only other file you need */ int err_handler(DBPROCESS*, int, int, int, char*, char*); int msg_handler(DBPROCESS*, DBINT, int, int, char*, char*, char*, int); Prolog Nothing special here. Collect the command line parameters. We do this with the standard getopts(3) function. Cf. man 3 getopts for details. Sample Code: &dblib; prolog extern char *optarg; extern int optind; const static char syntax[] = "syntax: example -S server -D db -U user -P passwd\n"; struct { char *appname, *servername, *dbname, *username, *password; } options = {0,0,0,0,0}; int main(int argc, char *argv[]) { int i, ch; LOGINREC *login; DBPROCESS *dbproc; RETCODE erc; options.appname = basename(argv[0]); while ((ch = getopt(argc, argv, "U:P:S:D:")) != -1) { switch (ch) { case 'S': options.servername = strdup(optarg); break; case 'D': options.dbname = strdup(optarg); break; case 'U': options.username = strdup(optarg); break; case 'P': options.password = strdup(optarg); break; case '?': default: fprintf(stderr, syntax); exit(1); } } argc -= optind; argv += optind; if (! (options.servername && options.username && options.password)) { fprintf(stderr, syntax); exit(1); } Prolog Notes LOGINREC is a structure that describes the client. It's passed to the server at connect time. DBPROCESS is a structure that describes the connection. It is returned by dbopen(). RETCODE is the most common return code type for &dblib; functions. Initialize Initialize the library. Create and populate a LOGINREC record. Sample Code: &dblib; Initialize if (dbinit() == FAIL) { fprintf(stderr, "%s:%d: dbinit() failed\n", options.appname, __LINE__); exit(1); } dberrhandle(err_handler); dbmsghandle(msg_handler); if ((login = dblogin()) == NULL) { fprintf(stderr, "%s:%d: unable to allocate login structure\n", options.appname, __LINE__); exit(1); } DBSETLUSER(login, options.username); DBSETLPWD(login, options.password); Initialization Notes Always make dbinit() the first &dblib; call. Install the error- and mesage-handlers right away. They're explained in more detail later. dblogin() almost never fails. But check! No point in trying to use a null pointer. The LOGIN record isn't directly accessible. It's populated via macros like these. There are other fields, but these two are essential. Look for SETLsomething in the documentation. Connect to the server dbopen() forms a connection with the server. We pass our LOGINREC pointer (which describes the client end), and the name of the server. Then, optionally, we change to our favored database. If that step is skipped, the user lands in his default database. Sample Code: &dblib; Connect to the server if ((dbproc = dbopen(login, options.servername)) == NULL) { fprintf(stderr, "%s:%d: unable to connect to %s as %s\n", options.appname, __LINE__, options.servername, options.username); exit(1); } if (options.dbname && (erc = dbuse(dbproc, options.dbname)) == FAIL) { fprintf(stderr, "%s:%d: unable to use to database %s\n", options.appname, __LINE__, options.dbname); exit(1); } Send a query &dblib; maintains a command buffer to hold the SQL to be sent to the server. Two functions — dbcmd() and dbfcmd() — build up the query from strings of text. The command buffer is reset after the query is sent to the server. We left the SQL on the command line. We fetch it now and send it to the server. Sample Code: &dblib; Send a query for (i=0; i < argc; i++) { assert(argv[i]); printf("%s ", argv[i]); if ((erc = dbfcmd(dbproc, "%s ", argv[i])) == FAIL) { fprintf(stderr, "%s:%d: dbcmd() failed\n", options.appname, __LINE__); exit(1); } } printf("\n"); if ((erc = dbsqlexec(dbproc)) == FAIL) { fprintf(stderr, "%s:%d: dbsqlexec() failed\n", options.appname, __LINE__); exit(1); } Initialization Notes Failure at this juncture is rare. The library is merely allocating memory to hold the SQL. dbsqlexec() waits for the server to execute the query. Depending on the complexity of the query, that may take a while. dbsqlexec() will fail if something is grossly wrong with the query, e.g. incorrect syntax or a reference to nonexistent table. It's only the first of a few places where an error can crop up in processing the query, though. Just because dbsqlexec() succeeded doesn't mean you're in the clear. Fetch Results A query may produce zero, one, or more results. The application normally provides buffers to &dblib; to fill, and iterates over the results a row (and column) at a time. Kinds of Results Results is a special term: it means more than rows or no rows. To process the results means to gather the data returned by the server into the application's variables. Kinds of Results Type Metadata Regular Rows Compute Rows Return Status Example SQL None None None None None Any INSERT, UPDATE, or DELETE statement Empty 1 set None 0 or more None SELECT name FROM systypes WHERE 0 = 1 Simple 1 set 0 or more None None SELECT name FROM sysobjects Complex 2 or more 0 or more 1 or more None SELECT name FROM sysobjects COMPUTE COUNT(name) Stored Procedure 0 or more 0 or more 0 or more 1 or more EXEC sp_help sysobjects
As the above table shows, results can comprise ordinary rows and compute rows (resulting from a COMPUTE clause). Stored procedures may of course contain multiple SQL statements, some of which may be SELECT statements and might include COMPUTE clauses. In addition, they generate a return status (with a RETURN statement or else automatically) and perhaps OUTPUT parameters. Data and Metadata Observe that a row is set of columns, and each column has attributes such as type and size. The column attributes of a row are collectively known as metadata. The server always returns metadata before any data (even for a SELECT statement that produced no rows). Result-fetching functions Function Fetches Returns Comment dbresults() metadata SUCCEED, FAIL or, NO_MORE_RESULTS. SUCCEED indicates just that: the query executed successfully (whew!). There may be metadata (and perhaps data) and/or stored procedure outputs available. dbnextrow() data REG_ROW, compute_id, NO_MORE_ROWS, BUF_FULL, or FAIL. Places fetched data into bound columns, if any.
Binding Each time dbresults() returns SUCCEED, there is something to retrieve. &dblib; has different functions to deal with the different kinds of results. The functions are of two kinds: those that convert the data into a form desired by the application, known as binding, and those that return the data in native form. To understand binding, it may be easiest to examine two primitive functions, dbdata() and dbconvert(). dbdata() returns a pointer to the column's data. The data to which it points are in native form, 4 bytes for an INT, 8 bytes for a DATETIME and so on. dbconvert() converts between datatypes; you can hand it an integer and get back a character array (or a C double. You might think of dbconvert() as atoi(3) on steroids). dbbind() combines these two functions. The application indicates in what form it would like to use each column, and the library converts them on the fly as each row is read. To bind a column is to provide a buffer to &dblib; for it to fill, and indicate which datatype the buffer is meant to hold. This is the sort of thing C++'s type system does so much better It may be well to pause here to observe the three ways a datatype is described in a &dblib; program. &dblib; Datatype Descriptors Sever Datatype Describes the data as an abstract type, not representing any particular kind of storage. SYBREAL, for example, doesn't imply any particular arrangement of bits; it just means a floating-point datatype corresponding to the T-SQL REAL type on the server. These all begin with SYB, e.g. SYBINT4. Program Variable Datatype Defines a C variable in a machine-independent way. Because a C defines its int type according the CPU architecture, it may have 2, 4, 8, or some other number of bytes. A DBINT on the other hand, is guaranteed to be 4 bytes and, as such, assuredly will hold any value returned by the server from a T-SQL INT column. These all begin with DB, e.g. DBREAL. Bind Type Prescribes a conversion operation. Indicates to dbbind() the Program Variable Datatype defined by the target buffer. Sybase and Microsoft call this the vartype. These all end with BIND, e.g. STRINGBIND. Typically it's convenient to have &dblib; convert the data into the desired form. The function that does that is dbind(). So: after fetching the metadata, and before fetching the data, we usually prepare the bound columns. Fetching Data Data-fetching functions Type Regular rows Compute rows Return status OUTPUT parameters Meta dbnumcols() dbnumcompute(), dbnumalts(), dbaltop(), dbbylist() dbhasretstatus() dbnumrets() Binding dbbind(), dbnullbind() dbaltbind(), dbanullbind() dbretstatus() none Native dbdatlen(), dbdata() dbadlen(), dbalttype(), dbaltutype(), dbaltlen(), dbadata() none dbretdata(), dbretlen(), dbretname(), dbrettype()
The paradigm may now perhaps be clear: Query, fetch results, bind columns, fetch regular rows, fetch compute rows, fetch stored procedure outputs. Repeat as necessary. Putting it all together Step Function Once Per Many Times Per Query dbsqlexec() Query Program Fetch metadata dbresults() SQL statement Query Prepare variables dbbind() Column Statement Fetch regular data dbnextrow() Row Statement Fetch compute data dbnextrow() Compute column Statement Fetch output parameters dbretdata() output parameter Stored procedure Fetch return status dbretstatus() Stored procedure Program
Fetch All Rows! &dblib; doesn't insist every column — or even any column — be bound or otherwise retrieved into the application's variables. There is, however, one absolutely crucial, inflexible, unalterable requirement: the application must process all rows produced by the query. Before the DBPROCESS can be used for another query, the application must either fetch all rows, or cancel the results and receive an acknowledgement from the server. Cancelling is beyond the scope of this document, so for now fetch all rows. Now, at last, some sample code that fetches data. In the interest of simplicity, we don't bind anything except regular rows. Sample Code: &dblib; Fetch Results while ((erc = dbresults(dbproc)) != NO_MORE_RESULTS) { struct COL { char *name; char *buffer; int type, size, status; } *columns, *pcol; int ncols; int row_code; if (erc == FAIL) { fprintf(stderr, "%s:%d: dbresults failed\n", options.appname, __LINE__); exit(1); } ncols = dbnumcols(dbproc); if ((columns = calloc(ncols, sizeof(struct COL))) == NULL) { perror(NULL); exit(1); } /* * Read metadata and bind. */ for (pcol = columns; pcol - columns < ncols; pcol++) { int c = pcol - columns + 1; pcol->name = dbcolname(dbproc, c); pcol->type = dbcoltype(dbproc, c); pcol->size = dbcollen(dbproc, c); if (SYBCHAR != pcol->type) { pcol->size = dbprcollen(dbproc, c); if (pcol->size > 255) pcol->size = 255; } printf("%*s ", pcol->size, pcol->name); if ((pcol->buffer = calloc(1, pcol->size + 1)) == NULL){ perror(NULL); exit(1); } erc = dbbind(dbproc, c, NTBSTRINGBIND, pcol->size+1, (BYTE*)pcol->buffer); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbbind(%d) failed\n", options.appname, __LINE__, c); exit(1); } status);]]> if (erc == FAIL) { fprintf(stderr, "%s:%d: dbnullbind(%d) failed\n", options.appname, __LINE__, c); exit(1); } } printf("\n"); /* * Print the data to stdout. */ while ((row_code = dbnextrow(dbproc)) != NO_MORE_ROWS){ switch (row_code) { case REG_ROW: for (pcol=columns; pcol - columns < ncols; pcol++) { char *buffer = pcol->status == -1? "NULL" : pcol->buffer; printf("%*s ", pcol->size, buffer); } printf("\n"); break; case BUF_FULL: assert(row_code != BUF_FULL); break; case FAIL: fprintf(stderr, "%s:%d: dbresults failed\n", options.appname, __LINE__); exit(1); break; default: printf("Data for computeid %d ignored\n", row_code); } } /* free metadata and data buffers */ for (pcol=columns; pcol - columns < ncols; pcol++) { free(pcol->buffer); } free(columns); /* * Get row count, if available. */ if (DBCOUNT(dbproc) > -1) fprintf(stderr, "%d rows affected\n", DBCOUNT(dbproc)); /* * Check return status */ if (dbhasretstat(dbproc) == TRUE) { printf("Procedure returned %d\n", dbretstatus(dbproc)); } } dbclose(dbproc); dbexit(); exit(0); } Data-fetching Notes As soon as dbresults() reports SUCCESS, the row's metadata are available. &dblib; columns start with 1. dbcollen() returns the sizeof the native data (e.g. 4 bytes for a T-SQL INT). We'll use dbbind() to convert everything to strings. If the column is [VAR]CHAR, we want the column's defined size, otherwise we want its maximum size when represented as a string. NTBSTRINGBIND null-terminates the character array for us. NTB might perhaps stand for null terminating byte. A zero-length string is not a NULL! dbnullbind() arranges for the passed buffer to be set to -1 whenever that column is NULL for a particular row. Each time dbnextrow() returns REG_ROW, it has filled the bound buffers with the converted values for the row. Computed rows are left as an exercise to the reader.
Messages and Errors Errors may originate on the server or in the library itself. The former are known as messages (because they are: they arrive as messages from the server); the latter are termed errors. Their handling is a little intimidating. It requires writing and installing a callback function (whose parameters are predefined by &dblib;), and thinking about how to handle different types of errors. Kinds of Errors Messages Messages arise because the server has something to say. Just one more way in which databases differ from files.. They usually describe some problem encountered executing the SQL. Perhaps the SQL refers to a nonexistent object or attempted to violate a constraint. But they can also be benign, indicating for instance merely that the default database has changed. Errors Errors arise either because the application has misused &dblib; in some way — say, passed a NULL DBPROCESS pointer or tried to issue a query while results were pending — or because some trouble cropped up in communicating with the server (couldn't find it, say, or didn't hear back from it). Why these two require distinct handling is lost in the mists of time. But it does help to keep them distinct in your mind, especially while reading the documentation. To have &dblib; use your handler, pass its name to the appropriate dberrhandle() or dbmsghandle() function immediately after calling dbinit(). Sample Code: &dblib; Error and Message handlers int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { enum {changed_database = 5701, changed_language = 5703 }; if (msgno == changed_database || msgno == changed_language) return 0; if (msgno > 0) { fprintf(stderr, "Msg %ld, Level %d, State %d\n", (long) msgno, severity, msgstate); if (strlen(srvname) > 0) fprintf(stderr, "Server '%s', ", srvname); if (strlen(procname) > 0) fprintf(stderr, "Procedure '%s', ", procname); if (line > 0) fprintf(stderr, "Line %d", line); fprintf(stderr, "\n\t"); } fprintf(stderr, "%s\n", msgtext); if (severity > 10) { fprintf(stderr, "%s: error: severity %d > 10, exiting\n", options.appname, severity); exit(severity); } return 0; } int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { if (dberr) { fprintf(stderr, "%s: Msg %d, Level %d\n", options.appname, dberr, severity); fprintf(stderr, "%s\n\n", dberrstr); } else { fprintf(stderr, "%s: DB-LIBRARY error:\n\t", options.appname); fprintf(stderr, "%s\n", dberrstr); } return INT_CANCEL; } Handlers are always called before the function that engendered them returns control to the application. Error Handling Notes When first writing a handler, pay careful attention to the precise type of each parameter. Only by carefully matching them will you convince a modern C compiler that the address of your function is of the type accepted by dbmsghandle(). Back in K&R days, that wasn't such a problem. But there were other problems, some much worse. Some messages don't convey much, as though the server gets lonely sometimes. You're not obliged to print every one. Severities are defined in the server documentation, and can be set by the T-SQL RAISERROR statement. Message handlers always and only ever return zero. When first writing the handler, pay careful attention to the precise type of each parameter. Only by carefully matching them will you convince a modern C compiler that the address of your function is of the type accepted by dberrhandle(). If that advice sounds familiar, it's because it bears repeating. Some messages are so severe they provoke &dblib; into calling the error handler, too! If you have both installed — and of course you do, right? — then you can skip those lacking an error number. While INT_CANCEL is the most common return code, it's not the only one. For one thing, the error handler's return code can control how long &dblib; keeps retrying timeout errors. See the documentation for details. No matter what the error handler says or does, it can't remedy the error. It's still an error and usually the best that can happen is that the function will return FAIL. The exception is timeout conditions, when the handler can stave off failure by requesting retries. You may be asking yourself, OK, fine, I can print the error message. But what if I want to communicate something back to the line in my program where the error occurred? How to do that? First of all, remember the calling function — that's your application — will learn of an error from the return code. If it needs more detail, though, there are two ways to pass it. Set a global variable. Use setuserdata() and getuserdata(). If your application is written in C++, you may be tempted to use throw(). Don't! Your handler is a C function and, more important, it's an extension of &dblib;. You can put a throw() in your handler and it will compile. But when it executes, it's going to rip through &dblib;'s stack. Your application will be unuseable at that point, if it doesn't cause a segment fault. Last Remarks We've reached the end of our &dblib; tour. The almost 300 lines of C above constitute program with these features: Sample Code features Accepts command-line parameters and SQL. Checks for errors and server messages. Processes any number of results.. Prints results in columns of suitable widths. There are things it doesn't do, in the name of simplicity. Sample Code nonfeatures No BCP (bulk copy) mode No RPC (remote procedure call) mode, preventing it from retrieving output parameters. Your humble author hopes you found it worthwhile. Happy Hacking.
Acknowledgments Codesmyths Many people, too many to mention, have contributed patches and located bugs. The primary names are: Brian Bruns (brian@bruns.org) Started this crazy thing Mihai Ibanescu (misa@dntis.ro) GNUified the packet Gregg Jensen (greggj@savvis.com) Message handlers and extra datatype support and some sybperl stuff James K. Lowden (jklowden@schemamania.org) Wrote most of the documentation. Helped out here and there. Steve Murphree (smurph@smcomp.com) Added more ODBC functionality. Arno Pedusaar (psaar@fenar.ee) Donated his TDS4.2 code to the cause Mark Schaal (mark@champ.tstonramp.com) Cleaned up message handling, more datatype support, bug fixes Craig Spannring (cts@internetcds.com) Wrote the JDBC and DBI drivers Bill Thompson (thompbil@exchange.uk.ml.com) Completer of the &dblib; bcp API and author of freebcp. Frediano Ziglio (freddy77@gmail.com) Extended the ODBC library, and added many, many fixes and enhancements to libtds. Contributors This user guide owes at least 100 words each to the following people. Brian Bruns James Cameron Allen Grace James K. Lowden Bill Thompson Frediano Ziglio On Linkers &freetds; is a library, obviously, its functions invoked by an application. How the application finds the library can be mysterious. In the interest of making &freetds; easier to use, this appendix discusses how it all works. This appendix focusses on using &freetds; in your application. It isn't intended to help in building &freetds;, although the background information it provides might be useful.
What is a C function? A C function is a named bit of code. A C compiler recognizes function names in source code by parsing the C language. When it encounters a function name, it looks for a definition for the function — i.e. actual code implementing it — in the current file. If it finds one, it creates machine instructions to push any parameters on the stack, jump to the named address, and clear the stack after the functions returns. If it doesn't find one, it shrugsYou have to watch carefully. Modern compilers shrug quickly. and adds that name to the list of names to be resolved later. We'll get to what that means in a minute. The compiler's job ends where the linker's begins. Compiler's job Convert source code into object code Put in jumps to defined functions Create a list of defined functions, and their addresses Create a list of undefined functions The nm utility displays function names. Here are the ones defined by bsqldb.c (in bsqsldb.o): $ nm bsqldb.o | grep -wi t 0000000000000000 T err_handler 0000000000000270 T get_login 00000000000001d0 t get_printable_size 0000000000000940 T main 00000000000000a0 T msg_handler 00000000000007d0 t next_query 00000000000006c0 t set_format_string 0000000000000080 t usage GNU nm marks with a lower-case letter functions that are locally defined, not intended to be used outside the file. The C programmer marked those functions static. Note how closely the source code corresponds to the object code: $ grep ^static src/bsqldb.c static int next_query(DBPROCESS *dbproc); static void print_results(DBPROCESS *dbproc); static int get_printable_size(int type, int size); static void usage(const char invoked_as[]); static int set_format_string(struct METADATA * meta, const char separator[]); (Order doesn't matter. It's a set, not a list.) Here are some functions used, but not defined, by bsqldb.o: $ nm bsqldb.o | grep -w U | head U __assert_fail U __ctype_b_loc U __errno_location U __strdup U __xpg_basename U asprintf U calloc U dbaltbind U dbaltcolid U dbaltlen Two things to note. First, the functions defined by bsqldb.o have addresses, and undefined functions don't. Second, only the name identifies the function. It's been that way since about 1978, and it's one reason C libraries are so useful: to find a function, the tool need only resolve the name, i.e. convert the name into an address. The caller (the programmer, really) has to know the function's inputs and semantics (how it behaves), but the tool's job is bone simple. Which turns out to be quite handy.
What is a C library? A C library is a set of named functions, for example dbinit() or SQLConnect(). Or, for that matter, fopen(3)The Unix convention is to put in parentheses behind the name the section of the manual in which the function is documented. &freetds; functions don't get numbers because they're not in the manual. Yet. . Libraries come in two flavors: static and dynamic.
Static libraries Static libraries (also known as archives) have been around as long as C itself. Like a .zip file, they're just a bag of object files — containing functions, of course — with a table of contents in front giving the address of each nameOr, depending on how you look at it, the name of each address.. Static libraries are created from object files using a librarian utility of some kind. One such programs is ar, for archive. Static libraries are part of the build environment. Functions in static libraries are joined to a program's main module by a static linker at build time to produce an executable program. The executable incorporates the libraries' object code into its own body, making it completely self-sufficient.
Dynamic libraries Dynamic libraries are the new kid on the block, as these things go, arriving on the Unix scene circa 1985. Like a static library, a dynamic library is a collection of functions with a table of contents. They are referenced at build time to give the executatble information about how they will eventually be used, but they aren't used until run time. Dynamic libraries are part of the run-time environment. When a program is run, the run-time linker finds the dynamic libraries needed by the program, finds the addresses of the required functions, and assembles a runable image in memory. Missing libraries and/or missing functions — or the wrong versions of them — can lead to head-scratching and other amusing behavior. In Windows® dynamic libraries are called dynamic link libraries (DLLs). In Unix they're normally called shared objects. But they're roughly the same thing. What about <literal>.h</literal> files? C header files include functional prototypes, declarations (not definitions) of functions. Functional prototypes describe to the compiler each function's parameters, allowing the compiler to confirm that the function is being called correctly. Most of the functions declared in header files are implemented in libraries. However, there's no mechanical or automatic relationship between the functional prototypes in the header files and their implementation in a library. The .h file is maintained by hand, by the programmer, and is used to generate a library. The header file and associated library are distributed and installed together (one hopes), but correct installation and subsequent use by the compiler & linker require human beings to keep track of the pair. Failure to do so leads to interesting development and even run-time problems, especially with libraries whose functions' parameters change from version to version. For example, imagine a function f(int g) defined in library libf.so and declared in f.h. In a later version of libf.so, the function's parameter is changed to use a pointer, f(int *p), and f.h is likewise updated. Possible errors that cannot be prevented by the linker include: An old program could use the new library. Probably the integer it passes will be interpreted as an out-of-bounds address, resulting in a segmentation violation. A new program could use the old library, passing an address that the library interprets as an integer. Hillarity ensues. Existing source code could be compiled using the old header file but linked to the new library. If you've never done that, give it time. These errors are possible because C functions are identified to the linker by name only. On the upside, that makes the tools simple and easy to implement and, by the same token, simplifies the use of C libraries by other languages. The downside is that the work of ensuring that the right libraries are used becomes an administrative task instead of a technical one.
Checking if a Library Provides a Function A linker, any linker, knits together object files (some of which may be in libraries) such that every function needed by the program has a definition. If the linker fails to locate a definition for even one function, it will fail and the program will not run. Returning to bsqldb.o, we can use nm to see which functions are unresolved, and determine whether or not a particular library contains them. We'll ignore the symbols that start with an underscore, marking them per the C standard as being provided by the implementationWhy and how leading underscores enter into this discussion is just one more example of arcane historical practices one needs to know to master the subject. For our purposes, though, it's enough to know that implementation-provided functions like these — functions provided by the C standard library — often have an underscored prepended. , and focus on the last five in this abbreviated list. Some unresolved functions in <filename>bsqldb.o</filename> asprintf basename Normally provided by the standard C library, but if not by &freetds;'s replacements library: $ nm /usr/lib/libc.a | grep -w T | grep -E 'asprintf|basename' 0000000000000000 T _basename 0000000000000000 T _asprintf calloc Provided by the standard C library: $ nm /usr/lib/libc.a | grep -w T | grep calloc 0000000000004240 T calloc dbaltbind dbaltcolid Provided by &dblib;: $ nm libsybdb.a | grep -Ew 'dbaltbind|dbaltcolid' 0000000000007140 T dbaltbind 0000000000003590 T dbaltcolid Although these examples refer to static libraries, nm works just as well with dynamic libraries, too. There are other tools besides nm. Windows®, for instance, has dumpbin, and the GNU bintools include objdump.
How Dost Thy Linker Link? Now at last we come to how the linker performs its magic. Once again the discussion divides between static and dynamic linking.
Static Linker Static linking happens at build time. Object files are collected together; a distinct list of all function names is created, and the linker is tasked with finding a definition for each one. Different linkers have different command-line options to support OS-specific features. This document isn't intended to teach how to use any particular linker. Our task here is to understand the principles involved, so that you can apply them to your particular situation. The static linker needs three kinds of information: Static linker inputs Object modules to be linked, including libraries Locations of libraries Search order
Knitting together the object modules The static linker merges your object files into one executable. Your project's object files may refer freely (usually) to each other's functions, and the linker will match them up. It will catenate them together, compute every function's offset from the start of the executable, and replace every function reference with the actual address needed for the executable it's constructing. For library functions, definitions are copied from the library and appended to the output file (executable). The placeholder addresses left by the compiler are similarly replaced by offsets.
Specifying libraries An application programmer using &freetds; will need to mention the name fo the &freetds; library being used. Failure to do so will provoke the dread undefined reference linker error: Missing library name $ gcc -o bsqldb bsqldb.o bsqldb.o: In function `get_login': ../../../src/apps/bsqldb.c:816: undefined reference to `dblogin' ../../../src/apps/bsqldb.c:823: undefined reference to `dbsetlname' ../../../src/apps/bsqldb.c:874: undefined reference to `dbsetlname' ../../../src/apps/bsqldb.c:884: undefined reference to `dbsetlname' ../../../src/apps/bsqldb.c:889: undefined reference to `dbsetlname' …
Finding libraries Specifying the library is necessary but may be insufficient. The linker may need to be told where to look for the library. This is often the case for the application programmer using &freetds; because the &freetds; libraries may be installed in a location not on the linker's default search path. Linkers are usually pretty blunt about missing libraries: Library not found $ gcc -o bsqldb bsqldb.o -l sybdb ld: cannot find -lsybdb Order matters. Linkers tend to be fussy about library search order, some more than others. It's good practice to tell the linker to search project libraries first, third-party libraries (e.g. iconv or kerberos) next, and finally system libraries.
Dynamic Linker The dynamic linker — also known as the runtime linker — is, like the rest of dynamic linking, more complicated than its static counterpart. Whereas it's impossible even to generate an executable with missing static function references, an executable that uses dynamic libraries depends on the runtime environment to have its references satisfied. When a dynamically linked application is launched, the OS invokes the runtime linker to resolve any undefined references. Much as the static linker does, the runtime linker consults a list of dynamic libraries along its configured search path. The names of the libraries to search for are embedded in the executable. Sometimes, not always, the search path is found in the executable too. Usually any embedded path can be overridden.
Information in the executable Exactly what information is in the executable and how to display it depends on the format of the executable. Different OSes use different formats and most Unix derivatives actually support at least two. The most commonly encountered format for the &freetds; programmer is the ELF format. In the interest of your time and mine, that's the one we'll examine here. The GNU bintool utility readelf displays the information in the executable that is input to the runtime linker: $ readelf -d src/apps/.libs/bsqldb Dynamic section at offset 0x6028 contains 20 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libsybdb.so.5] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.12] 0x000000000000000f (RPATH) Library rpath: [/usr/pkg/lib:/usr/local/lib] … What is this telling us? First, the bsqldb executable uses three shared libraries, namely sybdb for &dblib;, pthread for POSIX threads, and c, the C standard library. The runtime linker is going to have to find those somewhere, and it's going to use only those libraries to resolve unresolved references in the executable. Second, readelf displays the RPATH. The runtime linker searches for the required dynamic libraries in the directories listed in the RPATH, if extant. The RPATH is placed in the executable by the static linker. It can be thought of as a hint from the application builder to the system administrator. If an executable is built with an appropriate RPATH, the runtine linker will have all the information it needs to find the required libraries.
Information outside the executable Runtime linkers differ. The advice and observations that follow apply in many situations, but not all. The best way to know how yours works is to consult your system's documentation. RTFM! The NetBSD and GNU linkers both (as of this writing on machines used by the author) honor a configuration file and environment variables. They also have compiled-in default search locations. At a minimum, the default is /usr/lib. Sometimes a configuration file extends this to /usr/local/lib. The primary environment variable is LD_LIBRARY_PATH. On some systems this overrides the RPATH in the executable. In others it doesn't. Where ineffective, specific libraries (not their paths) can be forceably used with LD_PRELOAD.
Displaying what the Runtime linker will do The ldd(1) shows which dynamic libraries an executable requires and where, if at all, they'll be found: $ ldd $(command -v bsqldb) /usr/local/bin/bsqldb: -lc.12 => /usr/lib/libc.so.12 -lpthread.0 => /usr/lib/libpthread.so.0 -lsybdb.5 => /usr/local/lib/libsybdb.so.5 Important to understand: ldd is not figuring out this information by itself. It just reports the results of its interrogation of the runtime linker. As the configuration of the runtime linker is changed, so changes the output of ldd.
A Word about Windows® Windows executables use PE format (derived from the older COFF format), which has no provision for an RPATH. The runtime linker searches the PATH instead, after some built-in locations that usually include the current working directory. Neither ldd nor any similar utility is included in the basic product. It has been said that Unix is for programmers and Windows is for users, and perhaps that roughly describes the intention. But the Unix features listed above — RPATH and ldd — as well as a canonical filesystem hierarchy and dynamic library versioning, all promote a better user experience. Because of them, the problem of DLL conflicts in Windows hardly exists in Unix. Yet they are neither new nor secrect nor patented nor complicated; Microsoft could have adopted them years ago (as Apple finally did). We therefore know that the 20-year old phenomemon known as “DLL hell” is not inevitable, but a choice signifying nothing so much as Microsoft's indifference to its customers. Recently Microsoft added support to configure different search paths and other attributes based on Application Manifests and Application Configuration Files.
Advice for the lazy To avoid tinkering with your runtime linker, embed an RPATH in your executable commensurate with its intended runtime environment. If ldd doesn't show the libraries you want, or some are not found, use readelf to see which libraries are used and the RPATH. Relink with a better RPATH if needed. When testing with new libraries, use LD_PRELOAD to override the default, taking care that the semantics haven't changed.
Keep in Mind The compiler's job ends on the last line of each source code file. A header file describes a function for the compiler, not the linker. The linker, static or runtime, uses only the function's name to resolve references. Function parameters and semantics are invisible to it. The programmer and, to a lesser degree, the sysadmin direct the choice of which library to link to an executable. A missing function will prevent execution. A wrong function will promote wrong execution. Don't do that.
The <filename>interfaces</filename> File The interfaces file is retained for compatibility with Sybase environments. It is recommended that new users use the freetds.conf format instead. Where it came from Under Sybase OpenClient there is a file called interfaces that defines servers available to the software. &freetds; inherited this file structure with minor alterations. The interfaces remains supported for backward compatibility, and for those running in a mixed &freetds;/Sybase environment. The interfaces is not read by &freetds; unless it does not find &freetdsconf;. Note also that make install will install a skeleton &freetdsconf;, which you'll have to remove if you want to use interfaces instead. Where it goes Anywhere. The SYBASE environment variable must contain the location of interfaces; that is how &freetds; will find it. By the way before looking for $SYBASE/interfaces file FreeTDS try to open file specified programmatically (for instance by dbsetifile() using &dblib;) and .interfaces in your home directory. What it does The interfaces file aliases a servername to the hostname and port number of the servername's machine. When &freetds; receives a request to connect to a database server, it looks up the servername in interfaces. There, it finds the machine name (or address) and port number to connect to, that is, the port where the database server is listening. How's that again? The interfaces file sometimes trips people up. It seems innocuous enough, but it's also a pretty good example of it's easy if you know how. Keep in mind: The servername is the name of the database server. When a database client specifies the name of the server to connect to, it's the servername that is used. The host name is the name of the host (machine) where the database server is running. It has an IP address, and in almost any environment, you can ping the machine name to see if you've got it right. After it uses the servername to look up the host name, &freetds; will do the same thing ping does to get the IP address of the machine to connect to. Finally, the port number is frequently overlooked. From the network's point of view, knowing the IP address without the port number is a little like knowing the address of an apartment building without knowing the apartment number. In both cases, it will be hard to find what you came for. Make sure you know the port number, and that it's correctly entered in the interfaces file. What it looks like The format of the interfaces file is borrowed directly from that used by Sybase on Unix platforms (Windows has a different format). Additionally, we have overloaded one of the fields to add the ability to set the protocol version. An example interfaces file looks like this. An <filename>interfaces</filename> file example myserver query tcp 4.2 127.0.0.1 4000 master tcp ether 127.0.0.1 4000 The entry starts with the servername beginning in the first column (no whitespace preceding it). Following the servername are one or more services lines which must be indented with whitespace. &freetds; uses only the query line, although others may be present to retain compatibility with Sybase. The fields in the services lines are as follows. Services Line Name Example Meaning service query The only supported service transport tcp The transport protocol to use. Only tcp is supported by &freetds;. physical 4.2 Historically this field referred the physical/datalink layer, however it appears to simply a comment field. Therefore, &freetds; optionally uses it to specify the protocol version to connect with. hostname/IP 127.0.0.1 The hostname or IP address where the SQL Server resides. port 4000 The TCP port where the SQL Server is listening.
In the example above, the hostname was entered as an IP address. It needn't be; it could just as well be a name. &freetds; can use a name rather than an address; it will just let the network (specifically, the resolver get the address.
About Unicode, UCS-2, and UTF-8 For better or worse, &freetds; brings the otherwise innocent programmer into contact with the arcane business of how data are stored and transported. &freetds; is a data communications library that of course connects to databases, which are charged with storing information in a way that is neutral to all architectures and languages. On the surface, that might not seem very complex, even worth discussing. Under the surface, things are not so simple.
<acronym>ASCII</acronym>: What everyone knows The world we are all familiar with, programmingwise, is ASCII. Our email (mostly), our text files, our web pages (mostly), all use ASCII to represent English (or English-like) text. Perhaps because ASCII was standardized back in 1972 by the ISO, it seems like the natural way to store information. But let's look under the hood a little bit, and examine our assumptions. Our so-called text files are nothing special, nothing but a little agreement we enter into with our operating system. The only reason we can read them with cat or vi is that the operating system and its tools are in on the agreement. A file is only a stream of bytes, after all, no more text than an executable. The only thing distinguishing a text file from any other, is our understanding to treat it like one. We agree that the number 65 will represent the letter A, 66, B, and so on, 127 values in all. See man ascii for further details. The important thing to understand is that the designation of 65 for A and so on is a choice. It's an encoding standard, made necessary by the old simple fact that computers store numbers, not letters. ASCII is so ubiquitous these days that it's hard sometimes to remember there was a time when it was but one of a set of competing encoding standards. Others you probably have heard of include EBCDIC and the Baudot systems, but they are by no means the only historical alternatives, nor the only modern ones.
The <acronym>ASCII</acronym> Compact UNIX® and unix-like systems bought into ASCII big time. Program code, filenames, string constants (and variables), configuration files, everything but everything is encoded in ASCII. Practically every utility, command, and library assumes the text data will be ASCII. At the dawn of the 21st century, there is widespread recognition that ASCII will no longer suffice, but the art of upgrading all the computers and computer programmers is, well, an unfinished work.
ISO 8859: What everyone would like to forget ASCII won, it would seem, but the race goes not to the swift. ASCII has many limitations, the most egregious of which is, it's not much good for anything besides English. It encodes all the letters and punctuation (almost) of the English alphabet, but is useless for German, Russian, and Greek, to say nothing of Chinese. ASCII assigns one byte to every character, but deals with only 7 of the 8 available bits, the range 0-127 (with the high bit always zero). Demand for computers that could display and print languages besides English — even English with em dashes and cent (¢) signs — arrived soon enough, with the Marketing Department way out in front of the propeller heads. The predictable result was an array of 8-bit ASCII encoding standards for a wide variety of alphabets. Eventually, they were standardized (or at least enumerated and documented) by the ISO. These are what our friendly database vendors are referring to when they talk about character sets. More information on this subject can be found at webreference.com. The upshot is, there is no uniform standard, no agreement on the meaning of a byte, particularly if that byte's value is greater than 127. Let's say your client machine sends HELLO and your database stores it as 72 69 76 76 79. When another client retrieves that value, it will convert it into human-readable form by applying an encoding standard. If everything's tightly wrapped, it will use the very same encoding that your database used (and the same one you had in mind when you sent it), and that client will also see HELLO. If things are not so tightly wrapped but that client is fortunate enough to be using a similar standard to what you were using, say, ISO 8859-1, he'll still see HELLO. Most languages based on the Roman alphabet can be represented by ISO 8859-1, and are thus interchangeable. Beyond that, things get quickly messy. Greek clients, for one, are not so lucky: there are three ISO 8859 standards for Greek, all mutually incompatible. For more information, see ISO 8859 Alphabet Soup. Roman Czyborra's site is very informative; take your time there if you don't want your head to spin. Database servers need to know what encoding standard to employ, too. It's not obvious at first, but notions like uppercase and lowercase, trailing blanks, and collation rules all depend on what letter is meant by what number. (Collation even depends on what culture is interpreting the letters.)
Unicode: East meets West ASCII and its 8-bit cousins are on the way out, and with them the assumption that a character can be represented by a single byte. The new kid on the block is Unicode, similar to but not precisely the same as ISO 10646. Unicode (despite its name) is a set of standards. The most widely implemented is the 16-bit form, called UCS-2. As you might guess, UCS-2 uses two bytes per character, allowing it to encode most characters of most languages. Because most is far from all, there are nascent 32-bit forms, too, but they are neither complete nor in common use. In the same sense that 7-bit ASCII was extended to 8 bits, Unicode extends the most prevalent 8-bit ASCII, ISO 8859-1, to 16 and 32 bits. The first 256 values remain in Unicode as in ISO 8859-1: 65 is still A, except instead of being 8 bits (0x40), it's 16 bits (0x0040). Unlike the 8-bit extensions, Unicode has a unique 1:1 map of numbers to characters, so no language context or character set name is needed to decode a Unicode string. UCS-2 was the initial system employed by Microsoft NT-based systems while recent versions moved to UTF-16. Microsoft database servers store UCS-2/UTF-16 strings in nchar and nvarchar datatypes. Microsoft also designed version 7.0 (and up) of the TDS protocol around UCS-2/UTF-16: all metadata (table names and such) are encoded according to these encoding on the wire.
Unicode's Pluses and Minuses You will read from time to time that Unicode is not perfect. Surprise, surprise: it's true. From a linguistic point of view, Unicode is incomplete; in particular, UCS-2 is demonstrably too small (!) to hold all the forms of Chinese ideographs used over the centuries. (It is, however, quite useful and widely employed in representing modern Chinese.) Of more common concern to programmers are Unicode's technical problems, or rather, Unix's technical shortcomings vis-a-vis any encoding more complex than ISO 8859-x. The basic problem, from a programmer's perspective, is the ancient agreement Unix entered into 30 years ago, the ASCII Compact, alluded to earlier. Assumptions about ASCII are littered throughout Unix-like systems, beginning with C's convention of representing strings as arrays of characters ending in a zero. Returning to our HELLO example earlier, C will store HELLO as 72 69 76 76 79 0, in very nice ASCII. Many many parts of the operating system and its associated tools and applications will recognize that as a 5-letter word because it's terminated by a null (zero). In UCS-2 Unicode, though, that same HELLO uses 2 bytes for every character and becomes 72 0 69 0 76 0 76 0 79 0 0 0. Practically the whole OS will think that's a 1-letter word, H. Not a good thing. Even if every OS were magically rid of all ASCII assumptions and C strings, there would still be the problem of Endianism. Technical explanations on the subject are not hard to find. The long and short of it is, given a 16-bit integer (2 bytes), different hardware architectures will store the value differently. Asked to store our friend A, (0x41), for instance, a Sparc processor will put the least significant byte at the higher address (00 41) whereas an Intel processor will put it in the lower address (41 00). Put aside the questions of left, right, and wrong; architectures are a fact of life. Endianism shows up wherever integers are stored and retrieved in heterogeneous environments. The Unicode folks knew about Endianism, of course, and had to address it. A Unicode bytestream is supposed to begin with a byte-order mark. Needless to say, perhaps, many don't.
Unicode Transformation Format: UTF-8 The presence of nulls embedded in character data and of byte order issues make straight Unicode i.e., UCS-2 or UCS-4 hard to work with in a heterogeneous environment. Too many opportunities arise for the data to be truncated or misinterpreted, and too many systems would fail even to transmit such data. In short, when 16-bit data are thrust into a multi-architecture 8-bit world, it frequently bodes ill for the data. To answer that problem, to make Unicode transmissible and unambiguous to most machines, several transformation formats were adopted. Their goals were generally similar: to create a generally recognized format that would unambiguously and safely convey Unicode information between machines and across the Internet. To do that, they sought to remove nulls and endianism from the data stream. The most popular one — practically the only one used — is known as UTF-8. UTF-8 found wide acceptance for many reasons. UTF-8 represents any Unicode character as a combination of 1-4 bytes. The number of bytes required depends on the integer value of the Unicode character, and only one byte is used to represent the old ASCII range (0-127). UTF-8 does not use zero to represent any part of any character (except for the ASCII NUL). In consequence, UTF-8 is efficient with respect to space, has no endianism issues, and embeds no nulls. UTF-8 strings can be treated as plain old ASCII strings. These properties make UTF-8 data relatively easy for systems accustomed to processing ASCII data. Here's a small example showing the difference between UCS-2 and UTF-8. <quote>HELLO</quote> in UCS-2 and UTF-8 $ echo HELLO | iconv -f ascii -t UCS-2 | hexdump -C 00000000 00 48 00 45 00 4c 00 4c 00 4f 00 0a |.H.E.L.L.O..| 0000000c $ echo HELLO | iconv -f ascii -t utf-8 | hexdump -C 00000000 48 45 4c 4c 4f 0a |HELLO.| 00000006 $ echo HELLO | hexdump -C 00000000 48 45 4c 4c 4f 0a |HELLO.| 00000006 It is the similarity of the last two outputs that makes UTF-8 so attractive. It behaves like ASCII when ASCII's all that's needed. But it lacks ASCII's limitations. While UTF-8 solves many technical problems, it doesn't magically transform every ASCII-assuming system into a Unicode system. For example, to display Unicode data correctly — even Unicode data in UTF-8 format — the system still needs a suitable font. And it must distinguish the buffer size (and byte count) from the character count.
Unicode and &freetds; Microsoft servers using TDS 7.0 and above (anything since Microsoft SQL Server 6.5) transmit their data in UCS-2 format (16-bit integers). Because most applications linked to &freetds; are not prepared to deal with UCS-2 data, &freetds; can convert the data to something more acceptable, including ASCII. To do so, it employs an iconv library. &freetds; determines the server's encoding from the TDS protocol and information reported by the server (generally per connection, but in the case of TDS 7.1, per result set column). It discovers the client's encoding in &freetdsconf;. &freetds; will happily convert and convey your data in any single-byte format that iconv can provide. In practice, this normally means some form of ISO 8859-x or UTF-8. At some future time, &freetds; aims to support Unicode and other multi-byte character sets. It does not do so at the current time, beside using wide functions in ODBC. Sybase servers, by the way, adhere to a server makes right policy: they transmit their data in whatever character set the client requested at login time. The list of available character sets is fairly short, but includes UTF-8. While &freetds; could convert Sybase data streams as easily as it does Microsoft data streams, to our knowledge no one is doing so. The Sybase server can perform the conversion itself, making &freetds;'s capability in this regard largely redundant and irrelevant.
For further information UTF-8 and Unicode FAQ for Unix/Linux, by Markus Kuhn. As the man says, very comprehensive. ASCII: American Standard Code for Information Infiltration, by Tom Jennings. Everything you ever wanted know about ASCII, but didn't know whom to ask. A Brief History of Character Codes, by Steven J. Searle. Includes useful references. Unicode Home Page.
GNU Free Documentation License Version 1.1, March 2000 PREAMBLE The purpose of this License is to make a manual, textbook, or other written document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. COPYING IN QUANTITY If you publish printed copies of the Document numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has less than five). State on the Title page the name of the publisher of the Modified Version, as the publisher. Preserve all the copyright notices of the Document. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. Include an unaltered copy of this License. Preserve the section entitled "History", and its title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. In any section entitled "Acknowledgements" or "Dedications", preserve the section's title, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. Delete any section entitled "Endorsements". Such a section may not be included in the Modified Version. Do not retitle any existing section as "Endorsements" or to conflict in title with any Invariant Section. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections entitled "History" in the various original documents, forming one section entitled "History"; likewise combine any sections entitled "Acknowledgements", and any sections entitled "Dedications". You must delete all sections entitled "Endorsements." COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an "aggregate", and this License does not apply to the other self-contained works thus compiled with the Document, on account of their being thus compiled, if they are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document's Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document 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. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation 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. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: If you have no Invariant Sections, write "with no Invariant Sections" instead of saying which ones are invariant. If you have no Front-Cover Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being LIST"; likewise for Back-Cover Texts. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
freetds-1.3.6/doc/userguide.css000644 025423 025423 00000000537 14056414221 020062 0ustar00fredianofrediano000000 000000 /* * $Id: userguide.css,v 1.1 2005-10-03 02:52:29 jklowden Exp $ */ /* Set the screen background to gray */ .screen { background-color: #F0F0F0; } /* Render user input as boldface */ .userinput { font-weight: bold; } /* Make filenames green (why not?) */ .filename { color: #007a00; } .epigraph { text-align: center; font-style: italic; } freetds-1.3.6/doc/freebcp.1000644 025423 025423 00000014317 14162303377 017054 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.3.6 .Dt FREEBCP 1 .Sh NAME .Nm freebcp .Nd bulk loading utility for Sybase and Microsoft databases .Sh SYNOPSIS .Nm .Bo Bo Ao Ar database Ac Ns . Bc Ns Ao Ar owner Ac Ns . Bc Ns Aq Ar object_name .Bro .Ar in | .Ar [query] Ns Ar out .Brc .Ar datafile .Bro .Fl c | .Fl n | .Fl f Ar formatfile .Brc .Op Fl S Ar servername .Op Fl D Ar dbname .Op Fl U Ar username .Op Fl P Ar password .Op Fl b Ar batchsize .Op Fl F Ar firstrow .Op Fl L Ar lastrow .Op Fl e Ar errfile .Op Fl I Ar interfaces .Op Fl m Ar maxerror .Op Fl t Ar field_term .Op Fl r Ar row_term .Op Fl h Ar hints .Op Fl T Ar textsize .Op Fl A Ar packet_size .Op Fl O Ar options .Op Fl i Ar inputfile .Op Fl o Ar outputfile .Op Fl C Ar charset .Op Fl EdVv .\" .Sh DESCRIPTION .Nm is a utility program distributed with FreeTDS. .Nm replicates (in part at least) the functionality of the bcp utility programs distributed by Sybase and Microsoft. .Nm makes use of the DB-Library bcp API provided by FreeTDS. This API is also available to application developers. .Pp The manual pages or online help for Sybase or SQL Server can be referenced for more detailed information on bcp functionality. .\" .Sh TABLES\ AND\ FILES .Bl -tag -width indent .It Ar database The name of the database containing object to be copied. Optional if the table/view is in the default database for .Ar username . .It Ar schema The schema of the object being copied. If not provided, the default schema for .Ar username is used. .It Ar object The name of the database object you wish to access, typically a table. It can also be a view. All views can be read; some can be written, subject to constraints. With .Ar queryout Ns , Ar object can also be an SQL query. .It Ar in Copy data from a host file to a database table. .It Ar out Copy data from a database table to a host file. .It Ar queryout indicates that .Ar table_name is in fact SQL, rather than a database object. .Nm will execute the query and write the results to a file. (It is a good idea to have the query return one and only one result set.) .It Ar datafile The name of an operating system file. .El .\" .Sh OPTIONS .Bl -tag -width indent .It Fl A Ar packet_size Set the size of a TDS packet to packet_size. Not sure why you would want to do this, except as an experiment. .It Fl D Ar dbname The name of the default database to use. Overrides default database associated with the login account. Causes .Nm to issue a .Ic USE Ar dbname command immediately after logging in, before commencing BCP operations. .It Fl E Write the data in datafile to the table's IDENTITY column. Without this flag, the identity data present in the datafile will be ignored, and new IDENTITY values will be generated for the imported rows. .It Fl F Ar firstrow The first row to copy from the input file or database table. The default is the first row, row 1. .It Fl I Ar interfaces The name and location of the .Pa interfaces file to search when connecting to servername. Overrides .Pa freetds.conf. .It Fl L Ar lastrow The last row to copy from an input file or database table. The default is the last row. .It Fl O Ar options SQL text to set connection options prior to the bcp operation. If .Ar options is a valid filename, the SQL is read from the file instead. Sometimes needed for .Ar queryout . Example: .Li -O `SET QUOTED_IDENTIFIER ON' Ns . .It Fl P Ar password The password associated with .Ar username . .It Fl S Ar servername The name of the Database Server to which to connect. .It Fl T Ar textsize For text or image columns, set the maximum number of characters to request from the server. Defaults to the setting in .Pa freetds.conf . If not specified anywhere, defaults to the full size of the data. .It Fl U Ar username A database login name. For TDS\ 7+ connections, a domain login is attempted if .Ar username is not provided. .It Fl b Ar batchsize The number of rows per batch of data copied. Batching applies only when you are bulk copying into the database. Each batch of data is effectively .Dq committed into the database. The default value for .Ar batchsize is 1000. .It Fl c The host data file is (or will be) in "character" format, i.e., a text file. Encoding is determined by the client charset attribute in .Pa freetds.conf . .It Fl d Turn off any logging. (Unintuitive, perhaps.) .It Fl e Ar errfile Write errors to .Ar errfile . For uploads. Includes line and column information, and the row data. .It Fl f Ar formatfile The format of the host data file is described by .Ar formatfile . The layout of .Ar formatfile is identical to that understood by the Sybase and Microsoft bcp utilities, but is too complicated to describe here. .It Fl h Ar hints Set bcp hints. For valid values, cf. .Fn bcp_options in the FreeTDS Reference Manual. .It Fl m Ar maxerror Stop after encountering .Ar maxerror errors. Default 10. .It Fl n The host data file is in .Dq native format. This is a format that .Nm will be able to process, but is not portable or readable. .It Fl r Ar row_term The row terminator for a character file. May be more than one character. Default is newline ('\\n'). Cf\&. .Fl c Ns , above. .It Fl t Ar field_term The field terminator for character file. Also known as a column delimiter. May be more than one character. Default is tab ('\\t'). Cf\&. .Fl c Ns , above. .It Fl v .It Fl V Print the version information and exit. .It Fl i Ar inputfile Read input data from file specified. .It Fl o Ar outputfile Write output data to file specified. .It Fl C Ar charset Specify character set to use to talk to server. .El .Sh ENVIRONMENT .Ev DSQUERY default .Ar servername .\" .Sh NOTES When connecting to a Sybase database server, it is required that the TDS 5.0 protocol be used. When connecting to a Microsoft SQL Server 2000 database server, the TDS\ 7 (or later) protocol is required. .Pp Sybase and Microsoft define different versions of the bcp portion of TDS 4.2. Because FreeTDS has no way of knowing which type of server it's connected to, .Nm does not support version 4.2 of the TDS protocol. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.60 .Sh AUTHORS The .Nm utility was written by .An Bill Thompson Aq thompbil@exchange.uk.ml.com .Sh BUGS Currently, there is no support for text data types in .Nm Ns , when SQL Server 2000 is the target server. freetds-1.3.6/doc/tsql.1000644 025423 025423 00000006633 14162303377 016433 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.3.6 .Dt TSQL FreeTDS "FreeTDS Reference Manual" .Sh NAME .Nm tsql .Nd utility to test FreeTDS connections and queries .Sh SYNOPSIS .Nm .Bro .Fl S Ar servername .Op Fl I Ar interface | .Fl H Ar hostname .Op Fl L .Op Fl p Ar port .Brc .Op Fl D Ar dbname .Op Fl U Ar username .Op Fl P Ar password .Op Fl o Ar options .Nm .Fl C .Sh DESCRIPTION .Nm is a FreeTDS diagnostic tool. It uses the TDS protocol to connect to a Sybase or Microsoft SQL Server, and lets the user issue queries. .Nm does not use the FreeTDS client libraries. Instead, it uses only the lowest level library, libtds, to test the protocol implementation. .Pp .Nm can be run in two ways, one which uses the freetds.conf and one which connects directly using the server's hostname and port. The .Fl H and .Fl p parameters are provided to let the user verify a server is listening on the named host and port. These parameters override any configuration files and environment variables. .Pl The .Fl S parameter can be used to test the local configuration. FreeTDS will use freetds.conf (or equivalent) and environment variables in the normal way to determine the server's IP address and port. You can use .Fl I to specify a filename, overriding FreeTDS's configuration file search algorithm. .Sh OPTIONS .Bl -tag -width indent .It Fl S Ar servername database server to which to connect. .It Fl D Ar dbname database to use. .It Fl I Ar interface freetds.conf or interfaces file describing servername. .It Fl H Ar hostname DNS hostname of the server. .It Fl p Ar port port at which SQL Server is listening. .It Fl U Ar username database login name. If username is not provided, a domain login is attempted for TDS 7+ connections. .It Fl P Ar password database password. .It Fl L list Microsoft server instances (with .Fl H Ns ). .It Fl C print some of the compile-time configuration parameters. .It Fl o Ar options apply the options specified to every command. .Bl -tag -width indent .It Fl f No footer .Bq result count .It Fl h No header .Bq titles .It Fl t Print time .It Fl v Print version .It Fl q Quiet .El .It Fl a Ar appname application name. .It Fl t Ar colterm column terminator. .It Fl r Ar rowterm row terminator. .It Fl r Ar rowterm row terminator. .It Fl J Ar charset character set. .It Fl v verbose mode. .El .\" .Sh NOTES If you can connect with .Ql tsql -S servername Ns , your basic FreeTDS installation is working. .Pp Typing .Ql exit Ns , .Ql quit Ns , or .Ql bye (or .Li ^D Ns ) exits .Nm Ns . .Pp Typing .Ql version displays the TDS protocol version. .Pp Command batches may be separated with .Ql go or .Ql GO Ns . If .Ql GO the version string is reported before executing the batch. .Pp After prompting for the password (if not provided with .Fl P Ns ), .Nm will attempt to connect to the remote server. .Nm displays a counter indicating the number of seconds elapsed during the connection attempt. Typically, .Nm immediately responds with a .Ql 1> prompt. If you see the counter (1, 2, 3, ...), most likely .Nm is unable to connect to the indicated server. .Pp .Nm is not a replacement for a complete isql such as sqsh (www.sqsh.org). If you have suggestions for ways to make .Nm more useful as a diagnostic tool, please post them to the FreeTDS mailing list for consideration. .Sh HISTORY .Nm first appeared in FreeTDS 0.60. .Sh AUTHORS The .Nm utility was written by .An Brian Bruns Ns . .Sh BUGS Several, to be sure, now that it's documented. :) freetds-1.3.6/doc/osql.1000644 025423 025423 00000003737 14162303377 016430 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd April 26, 2012 .Os FreeTDS 1.3.6 .Dt OSQL FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm osql .Nd utility to test FreeTDS connections and queries .\" .Sh SYNOPSIS .Pp .Nm .Fl S Ar dsn .Fl U Ar username .Fl P Ar password .Op Fl I Pa ini_directory .\" .Sh DESCRIPTION .Pp .Nm is a diagnostic tool provided as part of FreeTDS. It is a Bourne shell script that checks and reports on your configuration files. If everything checks out OK, it invokes isql. .Pp .Nm works only with the isql that comes with unixODBC. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl S Ar dsn the Data Source Name to which to connect, as known to .Pa odbc.ini Ns . .It Fl U Ar username database login name. .It Fl P Ar password database password. .It Fl I Ar ini_dir override .Pa odbc.ini file location. .El .\" .Sh EXAMPLE If you have an .Pa odbc.ini with a section like this: .Bd -literal -offset indent .Bq myDSN servername = myserver TDS_Version = 5.0 .Ed .Pp You would invoke .Nm as: .Pp .Li osql -S myDSN .Op .\|.\|.\& .\" .Sh FILES .Pa odbc.ini .Pa freetds.conf .\" .Sh NOTES If you can connect with .Ql osql -S servername -U user -P passwd Ns , your FreeTDS ODBC installation is working. .Pp .Nm guesses where unixODBC might look for its .Pa odbc.ini by examining the binary. This is not always an effective approach. If it doesn't work, you'll receive a report of candidate strings. Kindly pass along the output to help improve the guessing. .Pp If .Nm cannot intuit your .Pa odbc.ini directory, you can force the issue with the .Fl I option. However, you're then instructing .Nm what to test, not where unixODBC will eventually look. Your override is therefore only as good as you are. Look carefully at the error output before overriding. .Pp If you have suggestions for ways to make .Nm more useful as a diagnostic tool, please post them to the FreeTDS mailing list. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Ns . freetds-1.3.6/doc/bsqldb.1000644 025423 025423 00000006666 14162303377 016725 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 26, 2015 .Dt BSQLDB 1 .Os FreeTDS 1.3.6 .Sh NAME .Nm bsqldb .Nd batch SQL script processor using DB-Library .Sh SYNOPSIS .Nm .Op Fl hqv .Op Fl S Ar servername .Op Fl D Ar database .Op Fl U Ar username .Op Fl P Ar password .Op Fl i Ar input_file .Op Fl o Ar output_file .Op Fl e Ar error_file .Op Fl H Ar hostname .Op Fl t Ar field_term .Op Fl R Ar pivot_description .\" .Sh DESCRIPTION .Nm is a utility program distributed with FreeTDS. .Nm is a non-interactive equivalent of the "isql" utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command "go" on a line by itself as a separator between batches. The last batch need not be followed by "go". .Nm makes use of the DB-Library API provided by FreeTDS. This API is of course also available to application developers. .Sh OPTIONS .Bl -tag -width indent .It Fl D Ar database Database to use. .It Fl H Ar hostname hostname Override name of client sent to server. .It Fl P Ar password Database server password. .It Fl S Ar servername Database server to which to connect. .It Fl U Ar username Database server login name. If username is not provided, a domain login is attempted for TDS 7+ connections. .It Fl e Ar error_file Name of file for errors. .It Fl h Print column headers with the data to the same file. .It Fl i Ar input_file Name of script file, containing SQL. .It Fl o Ar output_file Name of output file, holding result data. .It Fl q Do not print column metadata, return status, or rowcount. Overrides .Fl h Ns . .It Fl t Ar field_term Specifies the field terminator. Default is two spaces (' '). Recognized escape sequences are tab ('\\t'), carriage return ('\\r'), newline ('\\n'), and backslash ('\\\\'). .It Fl v Verbose mode, for more information about the DB-Library interaction. This also reports the result set metadata, including and return code. All verbose data are written to standard error (or .Fl e Ns ), so as not to interfere with the data stream. .It Fl R Ar pivot_description Specify pivot trasformation. The format is .Ao Ar down\ columns Ac .Ao Ar across\ columns Ac .Ao Ar function Ac .Ao Ar value Ac . Columns are specified but numbers. The format of .Ar down columns and .Ar across columns is a comma separated list of columns. .Ar function is either count, sum, min or max. .El .\" .Sh ENVIRONMENT .Ev DSQUERY default .Ar servername .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i Ns , Fl o Ns , and Fl e options override these defaults. .Pp The source code for .Nm is intended as a model for DB-Library users. DB-Library has a rich set of functions, and it can be hard sometimes to understand how to use them, particularly the first time. If you find something about the source code unclear, you are encouraged to email the author your comments. .\" .Sh EXIT STATUS .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp For messages with severity > 10, .Nm calls exit(3) with the severity level. For example, if the severity level is 16, .Nm will return an exit status of 16 to the shell. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.63. .\" .Sh AUTHORS The .Nm utility was written by .An "James K. Lowden" Aq jklowden@freetds.org . .\" .Sh BUGS Microsoft servers as of SQL Server 7.0 SP 3 do not return output parameters unless the RPC functions are used. This means .Nm cannot return output parameters for stored procedures with these servers. freetds-1.3.6/doc/bsqlodbc.1000644 025423 025423 00000004517 14162303377 017240 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.3.6 .Dt BSQLODBC FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm bsqlodbc .Nd batch SQL script processor using ODBC .\" .Sh SYNOPSIS .Pp .Nm .Op Fl hqv .Op Fl U Ar username .Op Fl P Ar password .Op Fl S Ar server .Op Fl D Ar database .Op Fl i Ar input_file .Op Fl o Ar output_file .Op Fl e Ar error_file .Op Fl t Ar field_term .Op Fl V Ar odbc_version .\" .Sh DESCRIPTION .Pp .Nm is a utility program distributed with FreeTDS. .Pp .Nm is a non-interactive equivalent of the .Ql isql utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command .Ql go on a line by itself as a separator between batches. The last batch need not be followed by .Ql go . .Pp .Nm makes use of the ODBC API provided by FreeTDS. This API is of course also available to application developers. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl U Ar username Database server login name. .It Fl P Ar password Database server password. .It Fl S Ar server Database server to which to connect. .It Fl D Ar database Database to use. .It Fl i Ar input_file Name of script file, containing SQL. .It Fl o Ar output_file Name of output file, holding result data. .It Fl e Ar error_file Name of file for errors. .It Fl t Ar field_term Specifies the field terminator. Default is two spaces ( .Ql \ \ .Ns ). Recognized escape sequences are tab ( .Ql \et .Ns ), carriage return ( .Ql \er .Ns ), newline ( .Ql \en .Ns ), and backslash ( .Ql \e\e .Ns ). .It Fl h Print column headers with the data to the same file. .It Fl q Do not print column metadata, return status, or rowcount. Overrides .Fl h . .It Fl v Verbose mode, for more information about the ODBC interaction. This also reports the result set metadata, including and return code. All verbose data are written to standard error (or .Fl e Ns ), so as not to interfere with the data stream. .It Fl V Ar odbc_version Specify ODBC version (2 or 3). .El .\" .Sh NOTES .Pp .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i , .Fl o , and .Fl e options override these defaults. .Sh EXIT STATUS .Nm exits 0 on success, and >0 if the server cannot process the query. .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Aq jklowden@freetds.org . freetds-1.3.6/doc/defncopy.1000644 025423 025423 00000005073 14162303377 017254 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd April 26, 2012 .Os FreeTDS 1.3.6 .Dt DEFNCOPY FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm defncopy .Nd extract procedures and views from a Microsoft server. .\" .Sh SYNOPSIS .Pp .Nm .Op Fl v .Op Fl U Ar username .Op Fl P Ar password .Op Fl S Ar server .Op Fl D Ar database .Op Fl i Ar input_file .Op Fl o Ar output_file .Bo .Ar owner.object_name .\" Elipsis according to Werner Lemberg: .\" http://www.mail-archive.com/groff@gnu.org/msg03122.html .Op Ar owner.object_name .\|.\|.\& .Bc .\" .Sh DESCRIPTION .Pp .Nm is a utility program distributed with FreeTDS. It replaces a similar program of the same name distributed by Sybase. .Pp .Nm reads the text of a stored procedure or view, and writes a script suitable for recreating the procedure or view. For tables, it reads the output of sp_help and constructs a .Ql CREATE TABLE statement, complete with .Ql CREATE INDEX Ns , too. .\" .Ar owner is optional if you or the database owner is the owner of the procedure/view being copied. .Ar object_name is the name of the system object you wish to extract. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl U Ar username database server login name. .It Fl P Ar password database server password. .It Fl S Ar server database server to which to connect. .It Fl D Ar database database to use. Optional if the procedure/view being extracted is in your default database. .It Fl i Ar input_file a script to apply to the database. Not currently implemented. .It Fl o Ar output_file a file to hold the script, defaults to standard output. .It Fl v Show version information and copyright notice. .El .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i , .Fl o , and .Fl e options override these defaults. .Pp .Nm makes use of the db-lib API provided by FreeTDS. This API is of course also available to application developers. .Sh EXIT STATUS .Pp .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp .Nm will report any errors returned by the server, but will continue processing. .\" .Sh HISTORY .Pp .Nm first appeared in FreeTDS 0.63. .\" .Sh AUTHORS The .Nm utility was written by .An James K. Lowden Aq jklowden@schemamania.org. .\" .Sh BUGS Works only with Microsoft servers and ancient Sybase servers. Does not create primary keys. Many options are defined by Sybase that this version does not implement. Feel free to correct this situation. In theory, .Nm could apply/produce DDL for any system object, but at present only tables, procedures and views are supported, and only for extraction. freetds-1.3.6/doc/datacopy.1000644 025423 025423 00000004557 14162303377 017257 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.3.6 .Dt DATACOPY FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm datacopy .Nd move table data between two servers .\" .Sh SYNOPSIS .Nm .Op Fl vdE .Bro .Fl t | .Fl a | .Fl c .Ar owner .Brc .Op Fl b Ar batchsize .Op Fl p Ar packetsize .Op Fl S Ar server/username/password/database/table_or_view .Op Fl D Ar server/username/password/database/table .Op Fl T Ar textsize .\" .Sh DESCRIPTION .Nm is a utility distributed with FreeTDS. .Nm will move table data from one server to another without the need for intermediate files. .Nm is much faster and more efficient than is freebcp out/in. .Pp .Nm makes use of the db-lib bcp API built into FreeTDS. This API is also available to application developers. .Pp .Nm can be used to migrate data between Sybase ASE and SQL Server or vice versa. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl t Truncate target table before loading data. .It Fl a Append data to target table. .It Fl c Ar owner Create the target table with the same schema as the source table. .Nm will submit a .Ql CREATE TABLE command on the target server using the specified owner in the command, e.g. .Ql CREATE TABLE owner.table (.\|.\|.\&). .It Fl b Ar batchsize The number of rows per batch of data copied. Each batch of data is effectively 'committed' to the database. The default is 1000. .It Fl p Ar packetsize The number of bytes, per network packet, sent to and from the servers. Increased packet size can enhance performance. .It Fl T Ar textsize Specify size of TEXT/IMAGE column from network. .It Fl v Produce verbose output, including diagnostic timings. .It Fl d Produce freetds TDSDUMP output. (Serious debug only!) .It Fl S Ar server/username/password/database/table_or_view The connection information for the source server and the location/name of the table (or view) to be copied. If not specified, .Nm prompts the user for the information. .It Fl D Ar server/username/password/database/table The connection information for the destination server and the location/name of the target table. If not specified, .Nm prompts the user for the information. .It Fl E Keep identity values. .Sh SEE ALSO .Xr freebcp 1 , Xr defncopy 1 , Xr bsqldb 1 , Xr tsql 1 , .%B FreeTDS User Guide. .\" .Sh HISTORY .Pp .Nm first appeared in FreeTDS 0.64. .\" .Sh AUTHORS The .Nm utility was written by .An Bill Thompson Aq thompbil@exchange.uk.ml.com . freetds-1.3.6/doc/fisql.1000644 025423 025423 00000010070 14162303377 016554 0ustar00fredianofrediano000000 000000 .\" cf. groff_mdoc .Dd March 25, 2015 .Os FreeTDS 1.3.6 .Dt FISQL FreeTDS "FreeTDS Reference Manual" .\" .Sh NAME .Nm fisql .Nd interactive SQL shell .\" .Sh SYNOPSIS .Pp .Nm .Op Fl eFgpnvXY .Op Fl a Ar display_charset .Op Fl A Ar packet_size .Op Fl c Ar cmdend .Op Fl D Ar database .Op Fl E Ar editor .Op Fl h Ar headers .Op Fl H Ar hostname .Op Fl i Ar inputfile .Op Fl I Ar interfaces_file .Op Fl J Ar client_charset .Op Fl l Ar login_timeout .Op Fl m Ar errorlevel .Op Fl o Ar outputfile .Op Fl P Ar password .Op Fl s Ar colseparator .Op Fl S Ar server .Op Fl t Ar timeout .Op Fl U Ar username .Op Fl w Ar width .Op Fl y Ar sybase_dir .Op Fl z Ar language .\" .Sh DESCRIPTION .Pp .Nm is very similar to the .Ql isql utility programs distributed by Sybase and Microsoft. Like them, .Nm uses the command .Ql go on a line by itself as a separator between batches. .\" .Sh OPTIONS .Bl -tag -width indent .It Fl a Ar display_charset The client charset name. Not implemented. .It Fl A Ar packet_size Set protocol packet size. You should not need to set this parameter. .It Fl c Ar cmdend Command terminator, defaults to .Ql go Ns . .It Fl D Database name on the server to use. .It Fl e Echo SQL input (usually in outputfile) .It Fl E Ar editor Specify an editor to invoke. Defaults to vi. .It Fl F FIPS mode ON. Server returns a message (but processes the query anyway) when it encounters a non-standard SQL command. .It Fl g Display a brief help message .It Fl h Ar headers Number of rows after which to repeat the column headers. Default is once per resultset. .It Fl H Ar hostname Hostname of the client machine as it will be told to the server. .It Fl I Ar interfaces_file Name of the interfaces or freetds.conf file to use. .It Fl i Ar inputfile Name of script file, containing SQL. .It Fl J Ar client_charset Not implemented. .It Fl l Ar login_timeout How long to wait for the server to acknowledge a login attempt. .It Fl m Ar errorlevel For errors of the severity level specified or higher, print only the message number, state, and error level. Below that level, print nothing. .It Fl n Suppress line numbers in echoed output. .It Fl o Ar outputfile Name of output file, holding result data. .It Fl p Prints performance statistics. Not implemented. .It Fl P Ar password Database server password. .It Fl s Ar colseparator The column separator. Default is space. Shell metacharacters require quoting. .It Fl S Ar server Database server to which to connect. .It Fl t Ar timeout The query timeout, in seconds. How long to wait for a query to be processed. The default is indefinitely, or as determined by freetds.conf. .It Fl U Ar username Database server login name. .It Fl v Display version and copyright. .It Fl w Ar width How many characters wide to print the output. Defaults to 80. .It Fl X Use encrypted login. Not implemented in FreeTDS. .It Fl y Pa sybase_dir Sets the .Ev SYBASE environment variable. Not used by FreeTDS. .It Fl Y Use chained transactions. .It Fl z Ar language Name of a language for fisql's prompts and messages. Cf. DBSETLNATLANG. .El .\" .Sh NOTES .Nm is a filter; it reads from standard input, writes to standard output, and writes errors to standard error. The .Fl i Ns , .FL o Ns , and .Fl e options override these defaults. .Pp .Nm uses the DB-Library API provided by FreeTDS. It was first implemented using Sybase's own library and continues to work with it. Before (and after) modifying it, it would be well to test it with Sybase's library to assure compatibility between it and FreeTDS. EXIT STATUS .Pp .Nm exits 0 on success, and >0 if the server cannot process the query. .Pp .Nm will report any errors returned by the server, but will continue processing. In a production environment, this behavior may be insufficiently stringent. To make it extremely intolerant of errors, change the message and error handlers to call exit(3). .\" .Sh HISTORY .Nm first appeared in FreeTDS 0.65. .\" .Sh AUTHORS The .Nm utility was written by .An Nicholas S. Castellano Aq entropy@freetds.org Ns , who contributed it to the FreeTDS project under the terms of the GPL. .\" .Sh BUGS Requires the GNU readline library. freetds-1.3.6/doc/freetds.conf.5000644 025423 025423 00000014454 14162303377 020034 0ustar00fredianofrediano000000 000000 .Dd May 2, 2017 .Os FreeTDS 1.3.6 .Dt FREETDS.CONF "FreeTDS 5" "FreeTDS Reference Manual" . .Sh NAME .Nm freetds.conf .Nd configuration file for FreeTDS . .Sh SYNOPSIS The .Pa freetds.conf file describes Sybase and Microsoft database servers to the FreeTDS library. It comprises sections headed by a servername, followed by a list of connection properties denoted as name-value pairs. Defaults are defined via a .Bq global section. This file supersedes the .Pa interfaces file that Sybase defines for the same purpose, although the latter is still supported. . .Sh DESCRIPTION A section begins with a servername \(em the name of the server \(em in square brackets. The servername is chosen at the client's descretion. (One exception: with Sybase ASA the servername must match the database name to be used.) .Pp Sections contain properties, one per line, in the form .Pp .Dl name = value .Pp where .Ar name is the connection property to be described. Servernames and properties are not case sensitive. Values are case-preserving i.e., copied literally. Comments begin with either a semicolon .Pq So ; Sc or pound sign .Pq So # Sc and continue to end of line. Blank lines are ignored. Whitespace surrounding the .So = Sc is ignored. . .Sh PROPERTIES .Bl -tag -width "emulate little endian" -compact . .It client charset encoding of client data; overrides locale(1) settings .Bl -tag -width "default:" -compact .It Domain: iconv character set names .It Default: ISO-8859-1 .El . .It connect timeout seconds to wait for response from connect request .Bl -tag -width "default:" -compact .It Domain: 0 to MAX_INT .It Default: none .El . .It debug flags logging granularity .Bl -tag -width "default:" -compact .It Domain: 32-bit integer .It Default: 0x4fff .El . .It dump file specifies location of a logfile and turns on logging .Bl -tag -width "default:" -compact .It Domain: valid file name .It Default: none .El . .It dump file append log data appended to file instead of re-writing for each connection .Bl -tag -width "default:" -compact .It Domain: yes/no .It Default: no .El . .It emulate little endian forces big endian machines to act as little endian to communicate with Microsoft Servers .Bl -tag -width "default:" -compact .It Domain: yes/no .It Default: no .El . .It encryption .Bl -tag -compact .It Em off disables encryption .It Em request use if available (default when tds version greater than 7.0) .It Em required allow encrypted connections only .El . .It host Name of the host the server is running on. .Bl -tag -width "default:" -compact .It Domain: host name or IP address .It Default: SYBASE .El . .It initial block size maximum size of a protocol block .Bl -tag -width "default:" -compact .It Domain: multiple of 512 .It Default: 512 .El . .It instance name of Microsoft SQL Server instance to connect to (supersedes .Em port ) .Bl -tag -width "default:" -compact .It Domain: instance name .It Default: none .El . .It port port number that the server is listening to .Bl -tag -width "default:" -compact .It Domain: any valid port .It Default: TDS 5.0, 5000; TDS 7.0 and up, 1433 .El . .It tds version TDS protocol version to use .Bl -tag -width "default:" -compact .It Domain: 4.2, 5.0, 7.0, 7.1, 7.2 .It Default: .Fl -with-tdsver value (5.0 if unspecified) .El . .It text size default value of TEXTSIZE, in bytes .Bl -tag -width "default:" -compact .It Domain: 0 to 4,294,967,295 .It Default: 4,294,967,295 .El . .It timeout seconds to wait for response to a query .Bl -tag -width "default:" -compact .It Domain: 0 to MAX_INT .It Default: none (wait forever) .El . .El .Pp Do not define both .Fa port and .Fa instance Ns \&. One implies the other. .Pp Boolean property values may be denoted as on/off, true/false, or 1/0. . .Ss DEBUG FLAGS The log's granularity can be controlled with the .Em debug flags property. .Bl -column -offset indent ".Sy 0x8000" ".Sy show source level info (source file and line)" .It Sy Value Ta Sy Meaning .It Li \ \ 0x02 severe error .It Li \ \ 0x04 error .It Li \ \ 0x08 warning .It Li \ \ 0x10 network .It Li \ \ 0x20 information level 1 .It Li \ \ 0x40 information level 2 .It Li \ \ 0x80 function trace and info .It Li 0x1000 show pid .It Li 0x2000 show time .It Li 0x4000 show source level info (source file and line) .It Li 0x8000 thread id (not implemented). .El . .Sh NAMES AND LOCATIONS The file is normally named .Pa /etc/freetds.conf or .Pa ${HOME}/.freetds.conf . That name can be overridden with the FREETDSCONF environment variable. .Pp FreeTDS will search conf files for a servername in the following order: .Bl -enum -offset indent -compact .It a filename set programatically via dbsetifile() that is in .conf format .It a filename in the environment variable FREETDSCONF that is in .conf format .It .Pa ${HOME}/.freetds.conf if extant .It .Pa ${prefix}/etc/freetds.conf .El .Pp The search stops with the first file containing the servername. .Pp If no conf file is found, FreeTDS searches for an .Pa interfaces file in the following order: .Bl -enum -offset indent -compact .It a filename set programatically via dbsetifile() that is in .Pa interfaces format .It .Pa ${HOME}/.interfaces .It .Pa $SYBASE/interfaces (where .Ev $SYBASE is an environment variable) .El .Pp If the requested servername is not found in any configuration file, the fallback mechanism is: .Bl -enum -offset indent -compact .It attempt to convert the name to an IP address with inet_addr(3), else .It attempt to convert the name to an IP address with gethostbyname(3), else .It attempt to look up the literal name .Dq SYBASE .El . .Sh ENVIRONMENT .Bl -tag -width "TDSDUMPCONFIG" -compact .It Ev FREETDSCONF overrides name and location of the system-wide conf file .It Ev TDSDUMP overrides the name and location of the FreeTDS log file .It Ev TDSDUMPCONFIG specifies a name and location of a file that logs the search of configuration files .It Ev TDSHOST overrides the host property .It Ev TDSPORT overrides the port property .It Ev TDSQUERY synonym for DSQUERY, the default servername .It Ev TDSVER overrides the version specified in the freetds.conf .El .Pp The environment variables .Ev TDSVER, Ev TDSDUMP, Ev TDSPORT, Ev TDSQUERY, and Ev TDSHOST override values set by a .conf or .Pa interfaces file. . .Sh FILES .Pa ${prefix}/etc/freetds.conf , ${HOME}/.freetds.conf . .Sh SEE ALSO .%B FreeTDS User Guide . .Sh HISTORY \.conf files first appeared with version 0.53 of FreeTDS. freetds-1.3.6/doc/userguide/000755 025423 025423 00000000000 14162303411 017337 5ustar00fredianofrediano000000 000000 freetds-1.3.6/doc/reference/000755 025423 025423 00000000000 14162303421 017302 5ustar00fredianofrediano000000 000000 freetds-1.3.6/doc/images/000755 025423 025423 00000000000 14056414221 016614 5ustar00fredianofrediano000000 000000 freetds-1.3.6/doc/grep_sample_code000755 025423 025423 00000000767 14056414221 020577 0ustar00fredianofrediano000000 000000 #! /usr/bin/perl -w # A simple, not very flexible bit of Perl to extract the sample code # from the User Guide. while(<>) { last if /chapter id="programming"/; } while(<>) { if (///; s/.+$//; s//g; print; } __DATA__ $Id: grep_sample_code,v 1.1 2007-12-10 05:13:11 jklowden Exp $ freetds-1.3.6/doc/tds_ssl.html000644 025423 025423 00000023002 14056414221 017705 0ustar00fredianofrediano000000 000000 SSL and TDS

How to enable encryption on MSSQL

Under Linux (or any system that have openssl)

# create a file containing key and self-signed certificate
openssl req \
  -x509 -nodes -days 365 \
  -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

# export mycert.pem as PKCS#12 file, mycert.pfx
openssl pkcs12 -export \
  -out mycert.pfx -in mycert.pem \
  -name "My Certificate"

So we created a mycert.pfx certificate ready to be imported

Under Windows

Open MMC and add certificates snap-in, add our certificate under personal and under ca root (to validate it)

Add to the registry the thumbprint of our certificato so to be used by mssql. For examples

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib]
"Certificate"=hex:DD,5F,6C,EE,47,8E,0C,C0,74,8B,C4,71,8D,87,1C,E6,07,20,F2,28

Restart MSSQL

Check event viewer for results

Encryption protocol

Prelogin packet (tds 7.1 only)

>From client to server

00000000  12 01 00 34 00 00 00 00  00 00 15 00 06 01 00 1b ...4.... ........
00000010  00 01 02 00 1c 00 0c 03  00 28 00 04 ff 08 00 01 ........ .(......
00000020  55 00 00 01 4d 53 53 51  4c 53 65 72 76 65 72 00 U...MSSQ LServer.
00000030  38 09 00 00                                      8...
HeaderDescriptionValue
00 00 15 00 06 netlib version (0) start from 0x15 length 0x06 8.341.0
01 00 1b 00 01 encrypt flag (1) start from 0x1b length 0x01 1, see below
02 00 1c 00 0c instance name (2) start from 0x1c length 0x0c "MSSQLServer\0" (as you note string is null terminated)
03 00 28 00 04 process id (3) start from 0x28 length 0x04 0x938 (why in little endian ??)
ff end  

Meaning of encryption flag (client):

  • 0x00 normal
  • 0x01 high encryption (128 bit ??)

MSSQL 2005 have 9.0.0 as a version and have a single byte option 4 (always seen as zero, I don't know the meaning).

>From server to client

00000000  04 01 00 25 00 00 01 00  00 00 15 00 06 01 00 1b ...%.... ........
00000010  00 01 02 00 1c 00 01 03  00 1d 00 00 ff 08 00 02 ........ ........
00000020  f8 00 00 01 00     

Similar
HeaderDescriptionValue
00 00 15 00 06 version (0) start from 0x15 length 0x06 8.0.760.0
01 00 1b 00 01 encrypt flag (1) start from 0x1b length 0x01 1, see below
02 00 1c 00 01 instance name (2) start from 0x1c length 0x01 "\0" (still null terminatted)
03 00 1d 00 00 process id (3) start from 0x1d length 0x0 no info
ff end  

Meaning of encryption flag (server):

  • 0x02, no certificate, no encryption required just do normal jobs (like FreeTDS)
  • 0x00, certificate, no force flag on server, prelogin to see certificate (TLS 1.0, not SSL 2 or 3 !!) login encrypted, after login do normal TDS (not encrypted)
  • 0x01, certificate, high encryption required by client prelogin to see certificate login encrypted, after login changed crypt (my client close connection perhaps a configuration problem...)
  • 0x03, certificate enabled, force encryption configured on server prelogin like 0x00, remains in SSL after login

Note that mssql2k unpatched do not set last packet flag (byte 2) for this packet.

Following a valid encrypted connection (0x00 from server, no force)

>From client to server

00000034  12 01 00 46 00 00 00 00  16 03 01 00 39 01 00 00 ...F.... ....9...
00000044  35 03 01 41 b9 5e 02 f8  7d 45 81 31 d9 73 9e 93 5..A.^.. }E.1.s..
00000054  91 b2 dd f4 4a 80 a3 92  a8 0f aa 67 32 8a 72 6d ....J... ...g2.rm
00000064  4b 22 07 00 00 0e 00 09  00 64 00 62 00 03 00 06 K"...... .d.b....
00000074  00 12 00 63 01 00                                ...c..

prelogin packet (0x12), content TLS 1.0 (you can see a ClientHell0, see RFC 2246)

>From server to client

00000025  04 01 03 da 00 00 01 00  16 03 01 03 cd 02 00 00 ........ ........
00000035  46 03 01 41 b9 5e 03 4b  c1 bf 9b a5 7d 83 74 57 F..A.^.K ....}.tW
00000045  00 03 de b5 fb fc 4d f8  84 15 ce 07 d9 ab fe 2b ......M. .......+
00000055  57 3c ad 20 96 10 00 00  6f 31 af e4 17 ae 2a 2b W<. .... o1....*+
00000065  37 29 0e 57 8a 4d 1d 32  aa d9 ed 62 6b 3d 3c d1 7).W.M.2 ...bk=<.
00000075  d1 c6 a9 cb 00 09 00 0b  00 03 7b 00 03 78 00 03 ........ ..{..x..
00000085  75 30 82 03 71 30 82 02  da a0 03 02 01 02 02 01 u0..q0.. ........
00000095  00 30 0d 06 09 2a 86 48  86 f7 0d 01 01 04 05 00 .0...*.H ........
000000A5  30 81 88 31 0b 30 09 06  03 55 04 06 13 02 49 54 0..1.0.. .U....IT
000000B5  31 10 30 0e 06 03 55 04  08 13 07 42 6f 6c 6f 67 1.0...U. ...Bolog
000000C5  6e 61 31 10 30 0e 06 03  55 04 07 13 07 42 6f 6c na1.0... U....Bol
... omissis...

normal reply packet (0x4), ServerHello(2), content TLS (certificate).

NOTE: if server send certificate request client (MS ODBC) crash so I think this is not supported.

>From client to server

0000007A  12 01 00 c6 00 00 00 00  16 03 01 00 86 10 00 00 ........ ........
0000008A  82 00 80 3a c6 96 ba 55  ce 8e 4b a4 e2 d7 b7 bd ...:...U ..K.....
0000009A  5d 5e f4 28 30 c6 c7 b9  4e 66 60 80 45 ce cb 4e ]^.(0... Nf`.E..N
000000AA  f6 f7 91 d7 9b 05 79 f8  ad f7 c7 13 77 36 cb 8c ......y. ....w6..
000000BA  04 58 33 3f 51 c8 0a bb  6a 95 8f 65 a1 e9 74 c5 .X3?Q... j..e..t.
000000CA  c9 c6 4a 11 b1 36 87 84  f2 96 82 d0 19 8a dd dc ..J..6.. ........
000000DA  d1 32 6a 32 ab 73 47 76  58 69 16 fd 9f 0b bd d7 .2j2.sGv Xi......
000000EA  72 79 a7 86 9a 71 2b 70  9a d1 8f e2 54 63 46 81 ry...q+p ....TcF.
000000FA  3e 6d 8a f7 8d 2e 26 02  3f 2d 0c a1 bc 63 ac 0a >m....&. ?-...c..
0000010A  8a 38 0e 14 03 01 00 01  01 16 03 01 00 28 12 09 .8...... .....(..
0000011A  d5 2d 93 8c 60 aa ae ec  e3 9b 2b 3c 27 63 46 ad .-..`... ..+<'cF.
0000012A  b1 b9 3d 1e 06 60 18 49  6d bb 76 80 8b 7b 51 70 ..=..`.I m.v..{Qp
0000013A  b7 79 14 b8 ba 62                                .y...b

prelogin (0x12), still TLS handshake, client_key_exchange (??) (0x16, 0x10), change crypt (0x14), handshake (crypted)

>From server to client

000003FF  04 01 00 3b 00 00 01 00  14 03 01 00 01 01 16 03 ...;.... ........
0000040F  01 00 28 96 3c 2e 41 42  09 d3 a8 77 82 19 7f 4b ..(.<.AB ...w...K
0000041F  ac 04 b8 96 4b f1 65 c2  35 9e ef 6a 1d c2 41 2d ....K.e. 5..j..A-
0000042F  a3 98 b8 2b 5c 0f 40 d1  98 b0 1e                ...+\.@. ...

normal reply (0x4), still TLS

0x14 means change crypt, followed by 0x16 (handshake crypted).

>From client to server

00000140  17 03 01 01 08 d7 3a b5  c3 fd a7 4d 14 b7 ce c7 ......:. ...M....
00000150  c6 6f f3 c5 03 1c 5c 86  7b 15 98 45 2a 93 73 c7 .o....\. {..E*.s.
00000160  72 75 72 23 c2 11 20 7d  5c b1 be e7 ac 72 ac b3 rur#.. } \....r..
00000170  47 41 4f 45 d8 fa 22 2b  94 b1 67 a5 7f de af 96 GAOE.."+ ..g.....
00000180  05 ad bb fc e4 33 66 3a  a2 f1 8d c5 5f 84 8b 38 .....3f: ...._..8
00000190  86 b0 df e8 87 e7 2c 26  e6 c0 66 2e b1 53 86 40 ......,& ..f..S.@
000001A0  98 0d 9e 2f 49 0b 17 b2  9d 55 d3 e3 7e 08 ca b9 .../I... .U..~...
000001B0  de 62 87 23 14 98 6e 10  d0 dd c2 94 70 4c 33 4b .b.#..n. ....pL3K
000001C0  09 8d b8 46 e5 a2 31 52  4d 89 06 b2 10 a8 ed b0 ...F..1R M.......
000001D0  a8 21 02 79 ab 99 de 67  28 a3 6c ea 18 88 b5 63 .!.y...g (.l....c
000001E0  02 ab f4 a1 78 0d 83 ec  b6 7b 61 7d 42 d2 38 bb ....x... .{a}B.8.
000001F0  50 fc e1 9e 1e e0 51 69  93 ea 05 9f d5 a4 a8 2b P.....Qi .......+
00000200  18 7f 79 4f 29 1a c0 35  3c 55 83 b0 9f af b7 de ..yO)..5 <U......
00000210  6d 2d 12 fa 27 ef 28 6b  a9 83 12 e6 a1 09 58 00 m-..'.(k ......X.
00000220  30 b3 3d f0 60 00 97 84  ee 28 b0 ae 31 78 50 d7 0.=.`... .(..1xP.
00000230  85 82 19 9f 57 ca a6 1c  d2 81 0f 6b 2d fb 47 41 ....W... ...k-.GA
00000240  37 58 8a ba 4f 38 f6 00  23 24 56 c2 35          7X..O8.. #$V.5

Well... you can note that this it's not a TDS packet !!! This is a fully crypted packet (login packet).

>From server to client

0000043A  04 01 01 79 00 33 01 00  e3 1b 00 01 06 6d 00 61 ...y.3.. .....m.a
0000044A  00 73 00 74 00 65 00 72  00 06 6d 00 61 00 73 00 .s.t.e.r ..m.a.s.
0000045A  74 00 65 00 72 00 ab 66  00 45 16 00 00 02 00 25 t.e.r..f .E.....%
0000046A  00 43 00 68 00 61 00 6e  00 67 00 65 00 64 00 20 .C.h.a.n .g.e.d. 
0000047A  00 64 00 61 00 74 00 61  00 62 00 61 00 73 00 65 .d.a.t.a .b.a.s.e
0000048A  00 20 00 63 00 6f 00 6e  00 74 00 65 00 78 00 74 . .c.o.n .t.e.x.t
0000049A  00 20 00 74 00 6f 00 20  00 27 00 6d 00 61 00 73 . .t.o.  .'.m.a.s
... omissis ...

Now normal data follow. In this case server used flag 0 (see above).

With force login (0x03 from server) after crypted login packet server and client continue to keep encrypting full packets

Note that uncrypted packets are still splitted using packet size selected during login (that is usually 4096 bytes). freetds-1.3.6/doc/userguide_desc.xml000644 025423 025423 00000000215 14162303331 021056 0ustar00fredianofrediano000000 000000 freetds-1.3.6/doc/images/callouts/000755 025423 025423 00000000000 14056414221 020442 5ustar00fredianofrediano000000 000000 freetds-1.3.6/doc/images/caution.gif000644 025423 025423 00000002017 14056414221 020745 0ustar00fredianofrediano000000 000000 GIF87a÷!!11BBZZcckkss{{„„„„sŒŒŒŒsŒŒŒ””””s””{œœœœsœœ{œœ”œœœ¥¥¥¥c¥¥œ¥¥¥µµµµZµµcµµµ½½½½cÎÎÎÎÎÖÖÖÖÎÖÖÖÞÞÞÞ1ÞÞ9ÞÞBçççç1çç9çççïïïïï÷÷÷÷÷÷÷÷1÷÷÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ,ôuH° Áƒ_Ä@È ‰6DHB $N$ø¢Á 4>pиña (e|ˆ¸QGE(YÀéaäD`ÊèP 8j’,XÑEJt@ÃP?MºeH›œL)ƒ‚€%¸ªd)ð¥Ø üäJC¨Ž¨geŒp`-[ tÄààÆYÌ«b 16|ø‹ÀÁÙÜûÁoÊ "ؕтd‚‰=àHÉ)UDF¸W4Ê  „•áÂÂ热-—X«ÂöÆÄ‹¹B¾Ý²åÎÄ'†Æ¡:ùo ·Ä ÂùÀ€;freetds-1.3.6/doc/images/important.gif000644 025423 025423 00000002071 14056414221 021320 0ustar00fredianofrediano000000 000000 GIF87a÷)))999BB1BBBJJJRRRZZ)ccccRccckkBkkkssR{{{„„„ŒŒŒŒ9ŒŒ{ŒŒŒ””Z””Œ”””œœZœœcœœ{œœœ¥¥c¥¥„¥¥”¥¥œ¥¥¥­­!­­9­­k­­{­­„­­Œ­­¥­­­µµJµµRµµŒµµµ½½½½Z½½„½½œ½½½ÆÆÆÆZÆÆÆÎÎsÎÎÎÖÖÖÖRÖÖcÖÖkÖÖÖÞÞÞÞ!ÞÞ1ÞÞ9ÞÞRÞÞÞçççç!çç)çç1ççZççcçç{çççïïïïïï1ïïBïïï÷÷÷÷÷÷1÷÷9÷÷J÷÷÷ÿÿÿÿÿÿÿÿ!ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ,þ·Hp‰Aƒ*ܲĆˆ ""BÄae!A+3,|Ò¤cG,à°È0ƒ‡$WRªT©CƒˆŠ ­dˆÑd¥Í”ML¸ˆ9Ó& |Üܰs Ž5WR@AR•M< ¸$J› ˜rSG 8Pܼ"i'c9,Ù""ÈØLd‹ÇOW¾`ÂØ+D2ÜÍ«2$þ<öG+ Æ;ÖÈ;$3¾ùÄÂ%ŠElqÁõæ 9æÞ¬»¥Ç‡±Ìá b­•:nB`jà‡M,0жö@؇/nò… 7µ ½)R¡ˆ „ó0r¡ 5žŒ}Â"ƒ ’­ET@A¤=‘*¨X‹žª ø'ÒO;freetds-1.3.6/doc/images/note.gif000644 025423 025423 00000002056 14056414221 020253 0ustar00fredianofrediano000000 000000 GIF87a÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,þÿ HðœAƒ*Ø«¥R:[˜ð1F¥¬{Çñœ1J”&R<÷ÐÅÎ(ÕZø®ÔÊ“[öªHi&L‚5 :+u³b)“öL¸S`Q‚ÆzÕRÚËÛA„ÿJ‹êí5k¥ÕræÍš3F„ F¤tnë9© · <—Ò˜³9M½u élF²ßQ£E‰”=5k-5öޤ·»Sîáz˜Ò¿wÖ=ëQb½sTö¸$eJ{Jq\³Ç«±=@žýWËšÀZ!×lž3ƦÂR±Æ<-%3!c[BŽ*òŸÓã'{ÙÆšxèÎá¯yýǨøÀ^” Süj l¿ÃÄŠQî9o;µ6‡‰$HÜÚ;freetds-1.3.6/doc/images/tip.gif000644 025423 025423 00000002005 14056414221 020074 0ustar00fredianofrediano000000 000000 GIF87a÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ,êÿ HðœAƒ*xÎX)J¥"BtvoaÂ{½&ž»·±!%JÎ,2„èM¤3ˆïQêUQä¿s¥j)TÙK!Ìs W&tVªåÀ{{B¬ÁY°TI†¥ˆ¼7‚¥yF•¹Ð›Ñ…*‰^UÈhϪ k…„é“`Ö”xŽÒËž )åH»vä[¨?ÇÐ]ØömÝ÷ôªåëö&VÁ½¹ý'öð^…¥Bþ³êxpBÀ#ÏD¬°WÍVñ2 ±g-O¼z3&™ £ÖkQ«ÐÙk‘ý='Û˜ËÉ”=x"m‹çŠŒ|ü_@;freetds-1.3.6/doc/images/warning.gif000644 025423 025423 00000002034 14056414221 020747 0ustar00fredianofrediano000000 000000 GIF87a÷!)1BJRZks{„Œ””{{œRRœZZœ{{¥¥99¥JJ¥„„¥””¥¥¥­­11­””µµ))µŒŒµœœµ¥¥µµµ½½­­½µµÆÆÆÆÆÆÎÎÎÎ))ÖÖ))ÖÖÖÞÞÞÞçç!!çççïïïïï÷÷÷÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ,þyÈCŒƒâ Èp`Š6Dœ¸a‡… аp#‡ÇQ\̈#E…Ž Sæ@q#ÁPªL‰"ƒK"NªìðÀ…J–SpT9‚@€2C^”!éÇðù3Œ 3shÀ@Œ™7 ÀðÕÄœz {5kŒdeKvæŒÌ‹5+‚öŽÍšC ‚ûÎÑ€ªJºYg0@€,ŠSjˆêuf 8@ ˜Ùa@€3T¾˜ ƒGèÑ;¨P}¡µ@NNIã2C"tïÎñÂ͸ag}Q;ãmÑ7fDŸ>£…oçu˜À½;w ¶ ;freetds-1.3.6/doc/images/callouts/1.gif000644 025423 025423 00000001602 14056414221 021270 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, _ÿý»G)98Ýøï\ ¤€ãÜÀ‡9ƒ Æ=F•œ»·‘##ŒK•¤ˆ€#N+#¶äÓ%”/cÆI3&£{(Õâè±áD—- ü‚”þ ;freetds-1.3.6/doc/images/callouts/10.gif000644 025423 025423 00000001646 14056414221 021360 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, ƒÿ 䔄Œî ü÷. ¤€ÛÀjÕJá­×9))î• ñîŸÆZæxÀHIDgµ¬Íã_ˆÀ¼7†sÂ|×3P.uÖrF@Žb” ”‘5”œ±<Ú‹„^÷¬ÅÉ0Uªp\øF‰”þ ;freetds-1.3.6/doc/images/callouts/2.gif000644 025423 025423 00000001623 14056414221 021274 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, pÿý»G)98Ýøï\ R„€ãÜÀ‡!¬{g €÷A,e @ˆ=ÀhDoµ("€HäˆfÒTr®–N+YÞsYS$€5÷ÆÄˆ!彇œÎI=çdà5- #gJ ÿ;freetds-1.3.6/doc/images/callouts/3.gif000644 025423 025423 00000001632 14056414221 021275 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, wÿý»G)98Ýøï\ rä@ ƹ!x³æÍ„Š÷0çÿÖŒdô„.SŽŒAq$€Vç¬ÕDPsdŽ1÷TBl©E$gµfeô.FŽw„VÞËØêÞ½Vc,<¢M‹ CÒ„ƒÒÂ;freetds-1.3.6/doc/images/callouts/4.gif000644 025423 025423 00000001623 14056414221 021276 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, pÿ l%%E %¥ ¼§€Ãä8'°¡C%ÿæ8Ìq¯•C(jtHÉ"€V¥ÞƒC-ç Ü[‰Àe•)î1r AÃ1 –rcèG3?2º—㨷5ïý{×ô(€ÞÞã‚K;freetds-1.3.6/doc/images/callouts/5.gif000644 025423 025423 00000001627 14056414221 021303 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, tÿ 䔄Œî ü÷.‚)B¤@ÛÀr0|÷N €÷JÈøÁÈ“Œ<’låŒI10ŒÔHHÉ9N#È‚ÐHFïrª„ e$¥s#cˆ„ùOIo”~þÀл>*l˜óe ‹ )9¤˜P`@;freetds-1.3.6/doc/images/callouts/6.gif000644 025423 025423 00000001635 14056414221 021303 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, zÿ l%%E %¥ ¼§ )æ8'°!€RïÎC ǽVç¼Ã€á]‡”,+•"G‡108<÷ΙMÈàÍïæä´Ø«”Cg„`°æ]ˆ 2ºw¥{÷’HqïŸÉœ/SxSx“K1¦ ;freetds-1.3.6/doc/images/callouts/7.gif000644 025423 025423 00000001616 14056414221 021303 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, kÿ ¬%%E %­î üwO  !@ÈqN ­þ³ ƽ^B†Äpî"J&EÖ2G ‘¤Ü{ÍÖjÁD2Ç?)0cè É蘌þ) YkhÈ ß ù´âBN9 HQT`@;freetds-1.3.6/doc/images/callouts/8.gif000644 025423 025423 00000001633 14056414221 021303 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, xÿ l%%E)¥ |§!æ8'PˆÃRÞ¬õ‚ ƽR•ÜãxnŽCJ ‰à݇108Pë\FÈ åž%.s¦,ÕËa«¢A˜óÎà9B'ÿYD@éÜ;J8=þc8sfŽw ÿ•R"„„;freetds-1.3.6/doc/images/callouts/9.gif000644 025423 025423 00000001637 14056414221 021310 0ustar00fredianofrediano000000 000000 GIF89a ÷  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~€€€‚‚‚ƒƒƒ„„„………†††‡‡‡ˆˆˆ‰‰‰ŠŠŠ‹‹‹ŒŒŒŽŽŽ‘‘‘’’’“““”””•••–––———˜˜˜™™™ššš›››œœœžžžŸŸŸ   ¡¡¡¢¢¢£££¤¤¤¥¥¥¦¦¦§§§¨¨¨©©©ªªª«««¬¬¬­­­®®®¯¯¯°°°±±±²²²³³³´´´µµµ¶¶¶···¸¸¸¹¹¹ººº»»»¼¼¼½½½¾¾¾¿¿¿ÀÀÀÁÁÁÂÂÂÃÃÃÄÄÄÅÅÅÆÆÆÇÇÇÈÈÈÉÉÉÊÊÊËËËÌÌÌÍÍÍÎÎÎÏÏÏÐÐÐÑÑÑÒÒÒÓÓÓÔÔÔÕÕÕÖÖÖ×××ØØØÙÙÙÚÚÚÛÛÛÜÜÜÝÝÝÞÞÞßßßàààáááâââãããäääåååæææçççèèèéééêêêëëëìììíííîîîïïïðððñññòòòóóóôôôõõõööö÷÷÷øøøùùùúúúûûûüüüýýýþþþÿÿÿ!ù, |ÿ l%%E)­î üwO <ÌñN ZY;Wjâ½VçxC€áž–‡”.(€µŽr`x¸gdÉ^I>„Ðëݹsµr:̉5JcÀr/„’92º@«ïÖ FreeTDS API: src/apps/fisql/edit.h Source File

FreeTDS API
edit.h
1 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 02111-1307, USA.
17  */
18 
19 /* $Id: edit.h,v 1.3 2007-01-20 06:32:27 castellano Exp $ */
20 int edit(const char *editor, const char *arg);
static int rtrim(char *, int)
trim a string of trailing blanks
Definition: bcp.c:2323
Definition: datacopy.c:62
int dbretlen(DBPROCESS *dbproc, int retnum)
Get size of an output parameter filled by a stored procedure.
Definition: dblib.c:4779
Definition: datacopy.c:53
void dbclose(DBPROCESS *dbproc)
Close a connection to the server and free associated resources.
Definition: dblib.c:1485
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
Definition: dblib.c:4471
int dbnumrets(DBPROCESS *dbproc)
Get count of output parameters filled by a stored procedure.
Definition: dblib.c:4692
int dbnumcompute(DBPROCESS *dbproc)
Get count of COMPUTE clauses for a result set.
Definition: dblib.c:4973
BYTE * dbbylist(DBPROCESS *dbproc, int computeid, int *size)
Get bylist for a compute row.
Definition: dblib.c:4999
RETCODE dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator)
Tie a null-indicator to a regular result column.
Definition: dblib.c:2740
char * dbcolsource(DBPROCESS *dbproc, int column)
Get base database column name for a result set column.
Definition: dblib.c:3144
void dbexit()
Close server connections and free all related structures.
Definition: dblib.c:1552
RETCODE bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
Prepare for bulk copy operation on a table.
Definition: bcp.c:167
Definition: bsqldb.c:75
RETCODE dbaltbind(DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
Bind a compute column to a program variable.
Definition: dblib.c:4369
#define DBSETLPACKET(x, y)
Set the packet size in the login packet for new connections.
Definition: sybdb.h:1278
int dbaltcolid(DBPROCESS *dbproc, int computeid, int column)
Get column ID of a compute column.
Definition: dblib.c:4284
Definition: bsqlodbc.c:100
#define DBSETLUSER(x, y)
Set the username in the login packet.
Definition: sybdb.h:1251
RETCODE dbsqlsend(DBPROCESS *dbproc)
Transmit the command buffer to the server.
Definition: dblib.c:7043
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition: dblib.c:5121
Definition: bsqldb.c:86
RETCODE bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column)
Set the length of a host variable to be written to a table.
Definition: bcp.c:267
Definition: bsqldb.c:74
int dbrettype(DBPROCESS *dbproc, int retnum)
Get datatype of a stored procedure's return parameter.
Definition: dblib.c:6266
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition: dblib.c:1694
int dbalttype(DBPROCESS *dbproc, int computeid, int column)
Get datatype for a compute column.
Definition: dblib.c:4340
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition: bcp.c:544
char * dbretname(DBPROCESS *dbproc, int retnum)
Get name of an output parameter filled by a stored procedure.
Definition: dblib.c:4724
DBINT dbvarylen(DBPROCESS *dbproc, int column)
Determine whether a column can vary in size.
Definition: dblib.c:3218
Definition: bsqldb.c:80
DBINT dbretstatus(DBPROCESS *dbproc)
Fetch status value returned by query or remote procedure call.
Definition: dblib.c:4674
#define BCP_SETL(x, y)
Enable (or prevent) bcp operations for connections made with a login.
Definition: sybdb.h:1264
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition: dblib.c:1373
RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val)
Pivot the rows, creating a new resultset.
Definition: dbpivot.c:914
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition: dblib.c:6447
RETCODE dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
Tie a host variable to a resultset column.
Definition: dblib.c:2634
#define DBTDS(a)
Sybase macro, maps to the internal (lower-case) function.
Definition: sybdb.h:1228
RETCODE dbsqlok(DBPROCESS *dbproc)
Wait for results of a query from the server.
Definition: dblib.c:4814
DBPROCESS * dbopen(LOGINREC *login, const char *server)
Normally not used.
Definition: dbopen.c:36
DBINT bcp_done(DBPROCESS *dbproc)
Conclude the transfer of data from program variables.
Definition: bcp.c:2037
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition: dblib.c:2970
DBINT dbdatlen(DBPROCESS *dbproc, int column)
Get size of current row's data in a regular result column.
Definition: dblib.c:3324
DBBOOL dbhasretstat(DBPROCESS *dbproc)
Determine if query generated a return status number.
Definition: dblib.c:4650
RETCODE dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)
Definition: dblib.c:6464
DBINT dbcollen(DBPROCESS *dbproc, int column)
Get size of a regular result column.
Definition: dblib.c:3169
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition: dblib.c:5140
RETCODE dbinit(void)
Initialize db-lib.
Definition: dblib.c:660
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition: dblib.c:1419
RETCODE bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column)
Override bcp_bind() by pointing to a different host variable.
Definition: bcp.c:671
Primary include file for db-lib applications.
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:7007
RETCODE dbfcmd(DBPROCESS *dbproc, const char *fmt,...)
printf-like way to form SQL to send to the server.
Definition: dblib.c:1334
Definition: sybdb.h:374
int dbnumalts(DBPROCESS *dbproc, int computeid)
Get count of columns in a compute row.
Definition: dblib.c:4940
RETCODE dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
Definition: dblib.c:1445
#define DBCOUNT(x)
Sybase macro mapping to the Microsoft (lower-case) function.
Definition: sybdb.h:748
#define DBROWS(x)
Sybase macro mapping to the Microsoft (lower-case) function.
Definition: sybdb.h:876
#define DBSETLPWD(x, y)
Set the password in the login packet.
Definition: sybdb.h:1254
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
Definition: dblib.c:1872
DBINT dbaltlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in compute column.
Definition: dblib.c:7137
#define DBSETLHOST(x, y)
Set the (client) host name in the login packet.
Definition: sybdb.h:1248
Definition: bsqldb.c:99
BYTE * dbretdata(DBPROCESS *dbproc, int retnum)
Get value of an output parameter filled by a stored procedure.
Definition: dblib.c:4753
RETCODE bcp_sendrow(DBPROCESS *dbproc)
Write data in host variables to the table.
Definition: bcp.c:1381
void dbloginfree(LOGINREC *login)
free the LOGINREC
Definition: dblib.c:737
Definition: sybdb.h:355
Definition: dblib.h:123
DBINT dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
cf.
Definition: dblib.c:2593
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
Definition: dblib.c:1848
#define DBSETLAPP(x, y)
Set the (client) application name in the login packet.
Definition: sybdb.h:1261
Definition: bsqldb.c:73
BYTE * dbdata(DBPROCESS *dbproc, int column)
Get address of data in a regular result column.
Definition: dblib.c:3352
Definition: defncopy.c:120
int dbstrlen(DBPROCESS *dbproc)
Get size of the command buffer, in bytes.
Definition: dblib.c:6291
DBINT bcp_batch(DBPROCESS *dbproc)
Commit a set of rows to the table.
Definition: bcp.c:2010
void dbfreebuf(DBPROCESS *dbproc)
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
Definition: dblib.c:6060
int dbaltop(DBPROCESS *dbproc, int computeid, int column)
Get aggregation operator for a compute column.
Definition: dblib.c:4444
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition: dblib.c:705
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3093
freetds-1.3.6/doc/reference/a00035_source.html000644 025423 025423 00000062337 14162303413 022374 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps/fisql/handlers.h Source File
FreeTDS API
handlers.h
1 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 02111-1307, USA.
17  */
18 
19 /* $Id: handlers.h,v 1.4 2007-01-20 06:32:27 castellano Exp $ */
20 extern int global_errorlevel;
21 
22 int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr);
23 
24 int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate,
25  int severity, char *msgtext, char *srvname, char *procname, int line);
RETCODE dbsettime(int seconds)
Set maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4192
void dbsetifile(char *filename)
set name and location of the interfaces file FreeTDS should use to look up a servername.
Definition: dblib.c:2711
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
Definition: dblib.c:4471
RETCODE dbsetversion(DBINT version)
Specify a db-lib version level.
Definition: dblib.c:5976
char * dbgetchar(DBPROCESS *dbproc, int pos)
Get address of a position in the command buffer.
Definition: dblib.c:6310
void dbexit()
Close server connections and free all related structures.
Definition: dblib.c:1552
#define DBSETLCHARSET(x, y)
Set the client character set in the login packet.
Definition: sybdb.h:1276
#define DBSETLPACKET(x, y)
Set the packet size in the login packet for new connections.
Definition: sybdb.h:1278
int dbaltcolid(DBPROCESS *dbproc, int computeid, int column)
Get column ID of a compute column.
Definition: dblib.c:4284
Definition: bsqlodbc.c:100
RETCODE dbprrow(DBPROCESS *dbproc)
Print a result set to stdout.
Definition: dblib.c:3540
#define DBSETLUSER(x, y)
Set the username in the login packet.
Definition: sybdb.h:1251
#define DBDEAD(x)
Sybase macro mapping to the Microsoft (lower-case) function.
Definition: sybdb.h:762
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition: dblib.c:5121
RETCODE dbsetlogintime(int seconds)
Set maximum seconds db-lib waits for a server response to a login attempt.
Definition: dblib.c:4239
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition: dblib.c:1694
int dbalttype(DBPROCESS *dbproc, int computeid, int column)
Get datatype for a compute column.
Definition: dblib.c:4340
void dbprhead(DBPROCESS *dbproc)
Print result set headings to stdout.
Definition: dblib.c:3959
RETCODE dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print a regular result row to a buffer.
Definition: dblib.c:3457
DBINT dbretstatus(DBPROCESS *dbproc)
Fetch status value returned by query or remote procedure call.
Definition: dblib.c:4674
RETCODE dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
Get formatted string for underlining dbsprhead() column names.
Definition: dblib.c:3837
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition: dblib.c:1373
RETCODE dbcancel(DBPROCESS *dbproc)
Cancel the current command batch.
Definition: dblib.c:3394
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition: dblib.c:6447
DBPROCESS * dbopen(LOGINREC *login, const char *server)
Normally not used.
Definition: dbopen.c:36
#define DBSETLENCRYPT(x, y)
Enable (or not) network password encryption for Sybase servers version 10.0 or above.
Definition: sybdb.h:1281
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition: dblib.c:2970
DBBOOL dbhasretstat(DBPROCESS *dbproc)
Determine if query generated a return status number.
Definition: dblib.c:4650
DBINT dbcollen(DBPROCESS *dbproc, int column)
Get size of a regular result column.
Definition: dblib.c:3169
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition: dblib.c:5140
RETCODE dbinit(void)
Initialize db-lib.
Definition: dblib.c:660
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition: dblib.c:1419
Primary include file for db-lib applications.
BYTE * dbadata(DBPROCESS *dbproc, int computeid, int column)
Get address of compute column data.
Definition: dblib.c:4415
int dbnumalts(DBPROCESS *dbproc, int computeid)
Get count of columns in a compute row.
Definition: dblib.c:4940
#define DBCOUNT(x)
Sybase macro mapping to the Microsoft (lower-case) function.
Definition: sybdb.h:748
#define DBROWS(x)
Sybase macro mapping to the Microsoft (lower-case) function.
Definition: sybdb.h:876
#define DBSETLPWD(x, y)
Set the password in the login packet.
Definition: sybdb.h:1254
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
Definition: dblib.c:1872
#define DBSETLHOST(x, y)
Set the (client) host name in the login packet.
Definition: sybdb.h:1248
#define DBSETLNATLANG(x, y)
Set the language the server should use for messages.
Definition: sybdb.h:1267
Definition: dblib.h:123
DBINT dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
cf.
Definition: dblib.c:2593
#define DBSETLAPP(x, y)
Set the (client) application name in the login packet.
Definition: sybdb.h:1261
RETCODE dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print result set headings to a buffer.
Definition: dblib.c:3895
void dbfreebuf(DBPROCESS *dbproc)
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
Definition: dblib.c:6060
DBINT dbspr1rowlen(DBPROCESS *dbproc)
Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(),...
Definition: dblib.c:3419
DBINT dbadlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in a compute column.
Definition: dblib.c:4310
void dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
Set interrupt handler for db-lib to use while blocked against a read from the server.
Definition: dblib.c:4631
int dbaltop(DBPROCESS *dbproc, int computeid, int column)
Get aggregation operator for a compute column.
Definition: dblib.c:4444
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition: dblib.c:705
freetds-1.3.6/doc/reference/a00041_source.html000644 025423 025423 00000017201 14162303413 022357 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps/fisql/interrupt.h Source File
FreeTDS API
interrupt.h
1 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 02111-1307, USA.
17  */
18 
19 /* $Id: interrupt.h,v 1.4 2007-01-20 06:32:27 castellano Exp $ */
20 extern sigjmp_buf restart;
21 
22 void inactive_interrupt_handler(int sig);
23 void active_interrupt_handler(int sig);
24 void maybe_handle_active_interrupt(void);
25 int active_interrupt_pending(DBPROCESS * dbproc);
26 int active_interrupt_servhandler(DBPROCESS * dbproc);
Primary include file for db-lib applications.
Definition: dblib.h:123
freetds-1.3.6/doc/reference/a00047_source.html000644 025423 025423 00000015164 14162303413 022373 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps/fisql/terminal.h Source File
FreeTDS API
terminal.h
1 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16  * Boston, MA 02111-1307, USA.
17  */
18 
19 /* $Id: terminal.h,v 1.4 2007-01-20 06:32:27 castellano Exp $ */
20 int save_term(void);
21 int set_term_noecho(void);
22 int reset_term(void);
freetds-1.3.6/doc/reference/a00053_source.html000644 025423 025423 00000054745 14162303413 022400 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps/freebcp.h Source File
FreeTDS API
freebcp.h
1 enum states
2 {
3  GET_NEXTARG,
4  GET_MAXERRORS,
5  GET_FORMATFILE,
6  GET_ERRORFILE,
7  GET_FIRSTROW,
8  GET_LASTROW,
9  GET_BATCHSIZE,
10  GET_FIELDTERM,
11  GET_ROWTERM,
12  GET_USER,
13  GET_PASS,
14  GET_INTERFACESFILE,
15  GET_SERVER,
16  GET_DISPLAYCHARSET,
17  GET_DATAFILECHARSET,
18  GET_LANGUAGE,
19  GET_PACKETSIZE,
20  GET_CLIENTCHARSET,
21  GET_TEXTSIZE,
22  GET_SYBASEDIR,
23  GET_FROMLABEL,
24  GET_TOLABEL,
25  GET_HINT
26 };
27 
28 typedef struct pd
29 {
30  char *dbobject;
31  char dbdirection[10];
32  DBINT direction;
33  char *hostfilename;
34  char *formatfile;
35  char *errorfile;
36  char *interfacesfile;
37  int firstrow;
38  int lastrow;
39  int batchsize;
40  int maxerrors;
41  int textsize;
42  char *fieldterm;
43  int fieldtermlen;
44  char *rowterm;
45  int rowtermlen;
46  char *user;
47  char *pass;
48  char *server;
49  char *dbname;
50  char *hint;
51  char *options;
52  char *charset;
53  int packetsize;
54  int mflag;
55  int fflag;
56  int eflag;
57  int Fflag;
58  int Lflag;
59  int bflag;
60  int nflag;
61  int cflag;
62  int tflag;
63  int rflag;
64  int Uflag;
65  int Iflag;
66  int Sflag;
67  int Pflag;
68  int Tflag;
69  int Aflag;
70  int Eflag;
71  char *inputfile;
72  char *outputfile;
73 }
Definition: datacopy.c:62
RETCODE bcp_readfmt(DBPROCESS *dbproc, const char filename[])
Read a format definition file.
Definition: bcp.c:1678
void dbsetifile(char *filename)
set name and location of the interfaces file FreeTDS should use to look up a servername.
Definition: dblib.c:2711
Main include file for libtds.
RETCODE bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
Prepare for bulk copy operation on a table.
Definition: bcp.c:167
#define DBSETLCHARSET(x, y)
Set the client character set in the login packet.
Definition: sybdb.h:1276
#define DBSETLPACKET(x, y)
Set the packet size in the login packet for new connections.
Definition: sybdb.h:1278
Definition: bsqlodbc.c:100
#define DBSETLUSER(x, y)
Set the username in the login packet.
Definition: sybdb.h:1251
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition: dblib.c:5121
RETCODE bcp_columns(DBPROCESS *dbproc, int host_colcount)
Indicate how many columns are to be found in the datafile.
Definition: bcp.c:301
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition: dblib.c:1694
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition: bcp.c:544
RETCODE bcp_colfmt(DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int table_colnum)
Specify the format of a datafile prior to writing to a table.
Definition: bcp.c:377
#define BCP_SETL(x, y)
Enable (or prevent) bcp operations for connections made with a login.
Definition: sybdb.h:1264
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition: dblib.c:1373
DBPROCESS * dbopen(LOGINREC *login, const char *server)
Normally not used.
Definition: dbopen.c:36
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition: dblib.c:2970
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition: dblib.c:5140
RETCODE dbinit(void)
Initialize db-lib.
Definition: dblib.c:660
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition: dblib.c:1419
Primary include file for db-lib applications.
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
RETCODE dbfcmd(DBPROCESS *dbproc, const char *fmt,...)
printf-like way to form SQL to send to the server.
Definition: dblib.c:1334
RETCODE bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
Set "hints" for uploading a file.
Definition: bcp.c:622
#define DBSETLPWD(x, y)
Set the password in the login packet.
Definition: sybdb.h:1254
void dbloginfree(LOGINREC *login)
free the LOGINREC
Definition: dblib.c:737
RETCODE bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied)
Write a datafile to a table.
Definition: bcp.c:1617
Definition: dblib.h:123
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
Definition: dblib.c:1848
#define DBSETLAPP(x, y)
Set the (client) application name in the login packet.
Definition: sybdb.h:1261
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition: dblib.c:705
freetds-1.3.6/doc/reference/a00077_source.html000644 025423 025423 00000405412 14162303413 022375 0ustar00fredianofrediano000000 000000 FreeTDS API: src/dblib/buffering.h Source File
FreeTDS API
buffering.h
1 typedef struct dblib_buffer_row {
5  unsigned char *row_data;
7  DBINT row;
9  TDS_INT *sizes;
11 
12 static void buffer_struct_print(const DBPROC_ROWBUF *buf);
13 static RETCODE buffer_save_row(DBPROCESS *dbproc);
14 static DBLIB_BUFFER_ROW* buffer_row_address(const DBPROC_ROWBUF * buf, int idx);
15 
16 #if ENABLE_EXTRA_CHECKS
17 static void buffer_check_row_empty(DBLIB_BUFFER_ROW *row)
18 {
19  assert(row->resinfo == NULL);
20  assert(row->row_data == NULL);
21  assert(row->sizes == NULL);
22  assert(row->row == 0);
23 }
24 
25 static void buffer_check(const DBPROC_ROWBUF *buf)
26 {
27  int i;
28 
29  /* no buffering */
30  if (buf->capacity == 0 || buf->capacity == 1) {
31  assert(buf->head == 0);
32  assert(buf->tail == 0 || buf->tail == 1);
33  assert(buf->capacity == 1 || buf->rows == NULL);
34  return;
35  }
36 
37  assert(buf->capacity > 0);
38  assert(buf->head >= 0);
39  assert(buf->tail >= 0);
40  assert(buf->head < buf->capacity);
41  assert(buf->tail <= buf->capacity);
42 
43  /* check empty */
44  if (buf->tail == buf->capacity) {
45  assert(buf->head == 0);
46  for (i = 0; buf->rows && i < buf->capacity; ++i)
47  buffer_check_row_empty(&buf->rows[i]);
48  return;
49  }
50 
51  if (buf->rows == NULL)
52  return;
53 
54  /* check filled part */
55  i = buf->tail;
56  do {
57  assert(i >= 0 && i < buf->capacity);
58  assert(buf->rows[i].resinfo != NULL);
59  assert(buf->rows[i].row > 0);
60  assert(buf->rows[i].row <= buf->received);
61  ++i;
62  if (i == buf->capacity)
63  i = 0;
64  } while (i != buf->head);
65 
66  /* check empty part */
67  if (buf->head != buf->tail) {
68  i = buf->head;
69  do {
70  assert(i >= 0 && i < buf->capacity);
71  buffer_check_row_empty(&buf->rows[i]);
72  ++i;
73  if (i == buf->capacity)
74  i = 0;
75  } while (i != buf->tail);
76  }
77 }
78 #define BUFFER_CHECK(buf) buffer_check(buf)
79 #else
80 #define BUFFER_CHECK(buf) do {} while(0)
81 #endif
82 
111 static int
112 buffer_count(const DBPROC_ROWBUF *buf)
113 {
114  BUFFER_CHECK(buf);
115  return (buf->head > buf->tail) ?
116  buf->head - buf->tail : /* |...TddddH....| */
117  buf->capacity - (buf->tail - buf->head); /* |ddddH....Tddd| */
118 }
119 
123 static int
124 buffer_is_full(const DBPROC_ROWBUF *buf)
125 {
126  BUFFER_CHECK(buf);
127  return buf->capacity == buffer_count(buf) && buf->capacity > 1;
128 }
129 
130 #ifndef NDEBUG
131 static int
132 buffer_index_valid(const DBPROC_ROWBUF *buf, int idx)
133 {
134  BUFFER_CHECK(buf);
135  if (buf->tail <= buf->head)
136  if (buf->head <= idx && idx <= buf->tail)
137  return 1;
138 
139  if (0 <= idx && idx <= buf->head)
140  return 1;
141 
142  if (buf->tail <= idx && idx < buf->capacity)
143  return 1;
144 #if 0
145  printf("buffer_index_valid: idx = %d\n", idx);
146  buffer_struct_print(buf);
147 #endif
148  return 0;
149 }
150 #endif
151 
152 static void
153 buffer_free_row(DBLIB_BUFFER_ROW *row)
154 {
155  if (row->sizes)
156  TDS_ZERO_FREE(row->sizes);
157  if (row->row_data) {
158  tds_free_row(row->resinfo, row->row_data);
159  row->row_data = NULL;
160  }
161  tds_free_results(row->resinfo);
162  row->resinfo = NULL;
163  row->row = 0;
164 }
165 
166 /*
167  * Buffer is freed at slightly odd points, whenever
168  * capacity changes:
169  *
170  * 1. When setting capacity, to release prior buffer.
171  * 2. By dbresults. When called the second time, it has to
172  * release prior storage because the new resultset will have
173  * a different width.
174  * 3. By dbclose(), else open/close/open would leak.
175  */
176 static void
177 buffer_free(DBPROC_ROWBUF *buf)
178 {
179  BUFFER_CHECK(buf);
180  if (buf->rows != NULL) {
181  int i;
182  for (i = 0; i < buf->capacity; ++i)
183  buffer_free_row(&buf->rows[i]);
184  TDS_ZERO_FREE(buf->rows);
185  }
186  BUFFER_CHECK(buf);
187 }
188 
189 /*
190  * When no rows are currently buffered (and the buffer is allocated)
191  * set the indices to their initial positions.
192  */
193 static void
194 buffer_reset(DBPROC_ROWBUF *buf)
195 {
196  buf->head = 0;
197  buf->current = buf->tail = buf->capacity;
198  BUFFER_CHECK(buf);
199 }
200 
201 static int
202 buffer_idx_increment(const DBPROC_ROWBUF *buf, int idx)
203 {
204  if (++idx >= buf->capacity) {
205  idx = 0;
206  }
207  return idx;
208 }
209 
214 static DBLIB_BUFFER_ROW*
215 buffer_row_address(const DBPROC_ROWBUF * buf, int idx)
216 {
217  BUFFER_CHECK(buf);
218  if (idx < 0 || idx >= buf->capacity) {
219  printf("idx is %d:\n", idx);
220  buffer_struct_print(buf);
221  return NULL;
222  }
223 
224  return &(buf->rows[idx]);
225 }
226 
230 static DBINT
231 buffer_idx2row(const DBPROC_ROWBUF *buf, int idx)
232 {
233  BUFFER_CHECK(buf);
234  return buffer_row_address(buf, idx)->row;
235 }
236 
240 static int
241 buffer_row2idx(const DBPROC_ROWBUF *buf, int row_number)
242 {
243  int i = buf->tail;
244 #ifndef NDEBUG
245  int ii = 0;
246 #endif
247 
248  BUFFER_CHECK(buf);
249  if (i == buf->capacity) {
250  assert (buf->head == 0);
251  return -1; /* no rows buffered */
252  }
253 
254  /*
255  * March through the buffers from tail to head, stop if we find our row.
256  * A full queue is indicated by tail == head (which means we can't write).
257  */
258  do {
259  if (buffer_idx2row(buf, i) == row_number)
260  return i;
261 
262  assert(ii++ < buf->capacity); /* prevent infinite loop */
263 
264  i = buffer_idx_increment(buf, i);
265  } while (i != buf->head);
266 
267  return -1;
268 }
269 
274 static void
275 buffer_delete_rows(DBPROC_ROWBUF * buf, int count)
276 {
277  int i;
278 
279  BUFFER_CHECK(buf);
280  if (count < 0 || count > buffer_count(buf)) {
281  count = buffer_count(buf);
282  }
283 
284  for (i=0; i < count; i++) {
285  if (buf->tail < buf->capacity)
286  buffer_free_row(&buf->rows[buf->tail]);
287  buf->tail = buffer_idx_increment(buf, buf->tail);
288  /*
289  * If deleting rows from the buffer catches the tail to the head,
290  * return to the initial position. Otherwise, it will look full.
291  */
292  if (buf->tail == buf->head) {
293  buffer_reset(buf);
294  break;
295  }
296  }
297 #if 0
298  buffer_struct_print(buf);
299 #endif
300  BUFFER_CHECK(buf);
301 }
302 
306 static void
307 buffer_transfer_bound_data(DBPROC_ROWBUF *buf, TDS_INT res_type, TDS_INT compute_id, DBPROCESS * dbproc, int idx)
308 {
309  int i;
310  BYTE *src;
311  const DBLIB_BUFFER_ROW *row;
312 
313  tdsdump_log(TDS_DBG_FUNC, "buffer_transfer_bound_data(%p %d %d %p %d)\n", buf, res_type, compute_id, dbproc, idx);
314  BUFFER_CHECK(buf);
315  assert(buffer_index_valid(buf, idx));
316 
317  row = buffer_row_address(buf, idx);
318  assert(row->resinfo);
319 
320  for (i = 0; i < row->resinfo->num_cols; i++) {
321  TDS_SERVER_TYPE srctype;
322  DBINT srclen;
323  TDSCOLUMN *curcol = row->resinfo->columns[i];
324 
325  if (row->sizes)
326  curcol->column_cur_size = row->sizes[i];
327 
328  srclen = curcol->column_cur_size;
329 
330  if (curcol->column_nullbind) {
331  if (srclen < 0) {
332  *(DBINT *)(curcol->column_nullbind) = -1;
333  } else {
334  *(DBINT *)(curcol->column_nullbind) = 0;
335  }
336  }
337  if (!curcol->column_varaddr)
338  continue;
339 
340  if (srclen <= 0) {
341  if (srclen == 0 || !curcol->column_nullbind)
342  dbgetnull(dbproc, curcol->column_bindtype, curcol->column_bindlen,
343  (BYTE *) curcol->column_varaddr);
344  continue;
345  }
346 
347  srctype = tds_get_conversion_type(curcol->column_type, curcol->column_size);
348 
349  if (row->row_data)
350  src = &row->row_data[curcol->column_data - row->resinfo->current_row];
351  else
352  src = curcol->column_data;
353  if (is_blob_col(curcol))
354  src = (BYTE *) ((TDSBLOB *) src)->textvalue;
355 
356  copy_data_to_host_var(dbproc, srctype, src, srclen,
357  (BYTE *) curcol->column_varaddr, curcol->column_bindlen,
358  curcol->column_bindtype, (DBINT*) curcol->column_nullbind);
359  }
360 
361  /*
362  * This function always bumps current. Usually, it's called
363  * by dbnextrow(), so bumping current is a pretty obvious choice.
364  * It can also be called by dbgetrow(), but that function also
365  * causes the bump. If you call dbgetrow() for row N, a subsequent
366  * call to dbnextrow() yields N+1.
367  */
368  buf->current = buffer_idx_increment(buf, buf->current);
369 
370 } /* end buffer_transfer_bound_data() */
371 
372 static void
373 buffer_struct_print(const DBPROC_ROWBUF *buf)
374 {
375  assert(buf);
376 
377  printf("\t%d rows in buffer\n", buffer_count(buf));
378 
379  printf("\thead = %d\t", buf->head);
380  printf("\ttail = %d\t", buf->tail);
381  printf("\tcurrent = %d\n", buf->current);
382  printf("\tcapacity = %d\t", buf->capacity);
383  printf("\thead row number = %d\n", buf->received);
384 }
385 
386 /* * * Functions called only by public db-lib API take DBPROCESS* * */
387 
404 static int
405 buffer_current_index(const DBPROCESS *dbproc)
406 {
407  const DBPROC_ROWBUF *buf = &dbproc->row_buf;
408 #if 0
409  buffer_struct_print(buf);
410 #endif
411  if (buf->capacity <= 1) /* no buffering */
412  return -1;
413  if (buf->current == buf->head || buf->current == buf->capacity)
414  return -1;
415 
416  assert(buf->current >= 0);
417  assert(buf->current < buf->capacity);
418 
419  if( buf->tail < buf->head) {
420  assert(buf->tail < buf->current);
421  assert(buf->current < buf->head);
422  } else {
423  if (buf->current > buf->head)
424  assert(buf->current > buf->tail);
425  }
426  return buf->current;
427 }
428 
429 /*
430  * Normally called by dbsetopt() to prepare for buffering
431  * Called with nrows == 0 by dbopen to safely set buf->rows to NULL.
432  */
433 static void
434 buffer_set_capacity(DBPROCESS *dbproc, int nrows)
435 {
436  DBPROC_ROWBUF *buf = &dbproc->row_buf;
437 
438  buffer_free(buf);
439 
440  memset(buf, 0, sizeof(DBPROC_ROWBUF));
441 
442  if (0 == nrows) {
443  buf->capacity = 1;
444  BUFFER_CHECK(buf);
445  return;
446  }
447 
448  assert(0 < nrows);
449 
450  buf->capacity = nrows;
451  BUFFER_CHECK(buf);
452 }
453 
454 /*
455  * Called only by dbresults(); capacity must be >= 1.
456  * Sybase's documents say dbresults() cannot return FAIL if the prior calls worked,
457  * which is a little strange, because (for FreeTDS, at least), dbresults
458  * is when we learn about the result set's width. Without that information, we
459  * can't allocate memory for the buffer. But if we *fail* to allocate memory,
460  * we're not to communicate it back to the caller?
461  */
462 static void
463 buffer_alloc(DBPROCESS *dbproc)
464 {
465  DBPROC_ROWBUF *buf = &dbproc->row_buf;
466 
467  /* Call this function only after setting capacity. */
468 
469  assert(buf);
470  assert(buf->capacity > 0);
471  assert(buf->rows == NULL);
472 
473  buf->rows = tds_new0(DBLIB_BUFFER_ROW, buf->capacity);
474 
475  assert(buf->rows);
476 
477  buffer_reset(buf);
478 
479  buf->received = 0;
480 }
481 
486 static int
487 buffer_add_row(DBPROCESS *dbproc, TDSRESULTINFO *resinfo)
488 {
489  DBPROC_ROWBUF *buf = &dbproc->row_buf;
490  DBLIB_BUFFER_ROW *row;
491  int i;
492 
493  assert(buf->capacity >= 0);
494 
495  if (buffer_is_full(buf))
496  return -1;
497 
498  row = buffer_row_address(buf, buf->head);
499 
500  /* bump the row number, write it, and move the data to head */
501  if (row->resinfo) {
502  tds_free_row(row->resinfo, row->row_data);
503  tds_free_results(row->resinfo);
504  }
505  row->row = ++buf->received;
506  ++resinfo->ref_count;
507  row->resinfo = resinfo;
508  row->row_data = NULL;
509  if (row->sizes)
510  free(row->sizes);
511  row->sizes = tds_new0(TDS_INT, resinfo->num_cols);
512  for (i = 0; i < resinfo->num_cols; ++i)
513  row->sizes[i] = resinfo->columns[i]->column_cur_size;
514 
515  /* initial condition is head == 0 and tail == capacity */
516  if (buf->tail == buf->capacity) {
517  /* bumping this tail will set it to zero */
518  assert(buf->head == 0);
519  buf->tail = 0;
520  }
521 
522  /* update current, bump the head */
523  buf->current = buf->head;
524  buf->head = buffer_idx_increment(buf, buf->head);
525 
526  return buf->current;
527 }
528 
532 static RETCODE
533 buffer_save_row(DBPROCESS *dbproc)
534 {
535  DBPROC_ROWBUF *buf = &dbproc->row_buf;
536  DBLIB_BUFFER_ROW *row;
537  int idx = buf->head - 1;
538 
539  if (buf->capacity <= 1)
540  return SUCCEED;
541 
542  if (idx < 0)
543  idx = buf->capacity - 1;
544  if (idx >= 0 && idx < buf->capacity) {
545  row = &buf->rows[idx];
546 
547  if (row->resinfo && !row->row_data) {
548  row->row_data = row->resinfo->current_row;
549  tds_alloc_row(row->resinfo);
550  }
551  }
552 
553  return SUCCEED;
554 }
555 
static int rtrim(char *, int)
trim a string of trailing blanks
Definition: bcp.c:2323
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
Definition: cspublic.h:685
Definition: ctlib.h:239
RETCODE bcp_readfmt(DBPROCESS *dbproc, const char filename[])
Read a format definition file.
Definition: bcp.c:1678
static RETCODE _bcp_exec_in(DBPROCESS *dbproc, DBINT *rows_copied)
Definition: bcp.c:1434
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
Definition: odbc.h:275
Used by tds_datecrack.
Definition: tds.h:159
Definition: ctlib.h:212
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:951
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:953
TDSRET tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Sends a language string to the database server for processing.
Definition: query.c:350
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
DSTR password
password of account login
Definition: tds.h:535
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
Definition: tds.h:582
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3056
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:2979
Main include file for libtds.
static void _bcp_free_storage(DBPROCESS *dbproc)
Definition: bcp.c:2377
static TDSRET _bcp_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset)
For a bcp in from program variables, get the data from the host variable.
Definition: bcp.c:2185
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
TDS_INT day
day of month (1-31)
Definition: tds.h:163
#define is_datetime_type(x)
return true if type is a datetime (but not date or time)
Definition: tds.h:393
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:836
RETCODE bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
Prepare for bulk copy operation on a table.
Definition: bcp.c:167
int tds7_get_instance_ports(FILE *output, struct addrinfo *addr)
Get port of all instances.
Definition: net.c:1093
struct addrinfo * tds_lookup_host(const char *servername)
Get the IP address for a hostname.
Definition: config.c:987
static int _bcp_convert_out(DBPROCESS *dbproc, TDSCOLUMN *curcol, BCP_HOSTCOLINFO *hostcol, TDS_UCHAR **p_data, const char *bcpdatefmt)
Convert column for output (usually to a file) Conversion is slightly different from input as:
Definition: bcp.c:725
unsigned char * row_data
row data, NULL for resinfo->current_row
Definition: buffering.h:5
Holds informations about a cursor.
Definition: tds.h:937
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
Definition: ctlib.h:176
Definition: bsqlodbc.c:100
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:941
int login_timeout
not used unless positive
Definition: ctlib.h:101
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:224
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:165
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
static STATUS _bcp_read_hostfile(DBPROCESS *dbproc, FILE *hostfile, int *row_error, bool skip)
Definition: bcp.c:1141
Definition: convert.h:34
DBBOOL bcp_getl(LOGINREC *login)
See if BCP_SETL() was used to set the LOGINREC for BCP work.
Definition: bcp.c:707
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
Definition: ctlib.h:138
TDSLOGIN * tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
tds_read_config_info() will fill the tds connection structure based on configuration information gath...
Definition: config.c:138
TDSRET tds_set_interfaces_file_loc(const char *interf)
Set the full name of interface file.
Definition: config.c:961
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
RETCODE bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column)
Set the length of a host variable to be written to a table.
Definition: bcp.c:267
Definition: ctlib.h:75
Definition: cstypes.h:129
TDSRET tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2554
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:129
int query_timeout
not used unless positive
Definition: ctlib.h:102
RETCODE bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int db_vartype, int table_column)
Bind a program host variable to a database column.
Definition: bcp.c:2079
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
RETCODE bcp_columns(DBPROCESS *dbproc, int host_colcount)
Indicate how many columns are to be found in the datafile.
Definition: bcp.c:301
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1007
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
Definition: proto.h:50
Definition: ctlib.h:61
unsigned char tds_peek(TDSSOCKET *tds)
Reads a byte from the TDS stream without removing it.
Definition: read.c:100
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition: bcp.c:544
RETCODE bcp_colfmt(DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int table_colnum)
Specify the format of a datafile prior to writing to a table.
Definition: bcp.c:377
Store variant informations.
Definition: tds.h:604
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:164
Definition: cstypes.h:191
DBINT dbvarylen(DBPROCESS *dbproc, int column)
Determine whether a column can vary in size.
Definition: dblib.c:3218
Definition: tds.h:876
Definition: cstypes.h:69
Definition: buffering.h:1
Definition: ctlib.h:117
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
char * query
SQL query.
Definition: tds.h:947
Metadata about columns in regular and compute rows.
Definition: tds.h:689
static int _bcp_readfmt_colinfo(DBPROCESS *dbproc, char *buf, BCP_HOSTCOLINFO *ci)
Definition: bcp.c:1775
TDS_TINYINT options
read only|updatable TODO use it
Definition: tds.h:942
Definition: tds.h:1091
TDSRET tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
Send option commands to server.
Definition: query.c:3389
TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
Send some data in the writetext request started by tds_writetext_start.
Definition: bulk.c:1185
Definition: tds.h:628
Definition: proto.h:45
static RETCODE _bcp_exec_out(DBPROCESS *dbproc, DBINT *rows_copied)
Definition: bcp.c:872
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3159
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
Information about blobs (e.g.
Definition: tds.h:593
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:556
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition: dblib.c:6447
TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
Start writing writetext request.
Definition: bulk.c:1147
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
TDS_INT hour
0-23
Definition: tds.h:166
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1256
static void _bcp_free_columns(DBPROCESS *dbproc)
Definition: bcp.c:2351
RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE *varaddr)
Definition: dblib.c:529
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:546
char * cursor_name
name of the cursor
Definition: tds.h:940
TDS_INT month
month number (0-11)
Definition: tds.h:162
TDS_INT second
0-59
Definition: tds.h:168
static TDSRET _bcp_convert_in(DBPROCESS *dbproc, TDS_SERVER_TYPE srctype, const TDS_CHAR *src, TDS_UINT srclen, TDS_SERVER_TYPE desttype, BCPCOLDATA *coldata)
Convert column for input to a table.
Definition: bcp.c:1054
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
Definition: cstypes.h:147
DBINT bcp_done(DBPROCESS *dbproc)
Conclude the transfer of data from program variables.
Definition: bcp.c:2037
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
TDSRET tds_bcp_fread(TDSSOCKET *tds, TDSICONV *char_conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
Read a data file, passing the data through iconv().
Definition: bulk.c:1077
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1630
static int _bcp_get_term_var(const BYTE *pdata, const BYTE *term, int term_len)
Get the data for bcp-in from program variables, where the program data have been identified as charac...
Definition: bcp.c:2297
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:206
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
TDS_INT * sizes
save old sizes
Definition: buffering.h:9
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1250
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
RETCODE bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column)
Override bcp_bind() by pointing to a different host variable.
Definition: bcp.c:671
Definition: cstypes.h:84
Primary include file for db-lib applications.
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
Definition: dblib.h:62
static TDSRET _bcp_no_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset)
Function to read data from file.
Definition: bcp.c:2276
Definition: cstypes.h:159
RETCODE bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
Set "hints" for uploading a file.
Definition: bcp.c:622
TDSRESULTINFO * resinfo
pointer to result informations
Definition: buffering.h:3
TDS_INT year
year
Definition: tds.h:160
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:84
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
RETCODE bcp_colfmt_ps(DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int table_colnum, DBTYPEINFO *typeinfo)
Specify the format of a host file for bulk copy purposes, with precision and scale support for numeri...
Definition: bcp.c:509
int port
port of database service
Definition: tds.h:519
Definition: cstypes.h:135
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
static char * _bcp_fgets(char *buffer, int size, FILE *f)
Definition: bcp.c:1652
TDSPARAMINFO * res_info
query results
Definition: tds.h:999
Definition: ctlib.h:55
DSTR user_name
account for login
Definition: tds.h:534
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:592
@ TDS_DEAD
no connection
Definition: tds.h:795
char * tds_strndup(const void *s, TDS_INTPTR len)
Copy a string of length len to a new allocated buffer This function does not read more than len bytes...
Definition: util.c:406
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
Definition: ctlib.h:162
Definition: cstypes.h:114
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1202
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:866
Definition: proto.h:33
Definition: tds.h:1661
RETCODE bcp_sendrow(DBPROCESS *dbproc)
Write data in host variables to the table.
Definition: bcp.c:1381
Definition: dblib.h:52
RETCODE bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied)
Write a datafile to a table.
Definition: bcp.c:1617
Definition: cstypes.h:153
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset)
Send one row of data to server.
Definition: bulk.c:468
DBINT row
row number
Definition: buffering.h:7
Information for a server connection.
Definition: tds.h:1163
Definition: tds.h:504
Definition: dblib.h:123
TDS_INT bcp_prefix_len
The length, in bytes, of any length prefix this column may have.
Definition: tds.h:761
DSTR server_spn
server SPN (in freetds.conf)
Definition: tds.h:528
Definition: proto.h:56
TDS_INT minute
0-59
Definition: tds.h:167
int tds7_get_instance_port(struct addrinfo *addr, const char *instance)
Get port of given instance.
Definition: net.c:1229
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
Definition: ctlib.h:69
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
Definition: cspublic.h:699
int msdblib
boolean use ms behaviour
Definition: dblib.h:154
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
Definition: ctlib.h:248
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
Definition: sybdb.h:336
DSTR server_charset
charset of server e.g.
Definition: tds.h:523
Definition: tds.h:330
DBINT bcp_batch(DBPROCESS *dbproc)
Commit a set of rows to the table.
Definition: bcp.c:2010
Definition: cstypes.h:97
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
int block_size
packet size (512-65535)
Definition: tds.h:965
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
Definition: tds.h:1029
A structure to hold all the compile-time settings.
Definition: tds.h:82
Definition: dblib.h:74
Definition: proto.h:26
Definition: tds.h:517
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:916
const TDS_COMPILETIME_SETTINGS * tds_get_compiletime_settings(void)
Return a structure capturing the compile-time settings provided to the configure script.
Definition: config.c:1337
Definition: cstypes.h:177
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:212
TDSRET tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server.
Definition: query.c:1124
int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...)
Call client-installed error handler.
Definition: dblib.c:8127
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3093
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
freetds-1.3.6/doc/reference/a00080.html000644 025423 025423 00000405126 14162303416 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: src/dblib/dblib.c File Reference
FreeTDS API
dblib.c File Reference

Main implementation file for db-lib. More...

#include <config.h>
#include <stdarg.h>
#include <freetds/time.h>
#include <assert.h>
#include <stdio.h>
#include <freetds/tds.h>
#include <freetds/thread.h>
#include <freetds/convert.h>
#include <freetds/utils/string.h>
#include <freetds/data.h>
#include <freetds/replacements.h>
#include <sybfront.h>
#include <sybdb.h>
#include <syberror.h>
#include <dblib.h>
#include "buffering.h"
Include dependency graph for dblib.c:

Classes

struct  _dblib_error_message
 
struct  dblib_context
 

Typedefs

typedef struct _dblib_error_message DBLIB_ERROR_MESSAGE
 
typedef struct dblib_context DBLIBCONTEXT
 

Functions

static BYTE * _dbcoldata (TDSCOLUMN *colinfo)
 Return data from a column. More...
 
static int _dbnullable (DBPROCESS *dbproc, int column)
 
static char * _dbprdate (char *timestr)
 
static RETCODE _dbresults (DBPROCESS *dbproc)
 
static int _get_printable_size (TDSCOLUMN *colinfo)
 
void copy_data_to_host_var (DBPROCESS *, TDS_SERVER_TYPE, const BYTE *, int, BYTE *, DBINT, int, DBINT *)
 
void copy_data_to_host_var (DBPROCESS *dbproc, TDS_SERVER_TYPE srctype, const BYTE *src, DBINT srclen, BYTE *dest, DBINT destlen, int bindtype, DBINT *indicator)
 
static void db_env_chg (TDSSOCKET *tds, int type, char *oldval, char *newval)
 
const char * dbacolname (DBPROCESS *dbproc, int computeid, int column)
 Return name of a computed result column. More...
 
static TDSCOLUMNdbacolptr (DBPROCESS *dbproc, int computeid, int column, int is_bind)
 
BYTE * dbadata (DBPROCESS *dbproc, int computeid, int column)
 Get address of compute column data. More...
 
DBINT dbadlen (DBPROCESS *dbproc, int computeid, int column)
 Get size of data in a compute column. More...
 
RETCODE dbaltbind (DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
 Bind a compute column to a program variable. More...
 
int dbaltcolid (DBPROCESS *dbproc, int computeid, int column)
 Get column ID of a compute column. More...
 
DBINT dbaltlen (DBPROCESS *dbproc, int computeid, int column)
 Get size of data in compute column. More...
 
int dbaltop (DBPROCESS *dbproc, int computeid, int column)
 Get aggregation operator for a compute column. More...
 
int dbalttype (DBPROCESS *dbproc, int computeid, int column)
 Get datatype for a compute column. More...
 
DBINT dbaltutype (DBPROCESS *dbproc, int computeid, int column)
 Get user-defined datatype of a compute column. More...
 
RETCODE dbanullbind (DBPROCESS *dbproc, int computeid, int column, DBINT *indicator)
 Tie a null-indicator to a compute result column. More...
 
RETCODE dbanydatecrack (DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
 Break any kind of date or time value into useful pieces. More...
 
RETCODE dbbind (DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
 Tie a host variable to a resultset column. More...
 
static int dbbindtype (int datatype)
 
BYTE * dbbylist (DBPROCESS *dbproc, int computeid, int *size)
 Get bylist for a compute row. More...
 
RETCODE dbcancel (DBPROCESS *dbproc)
 Cancel the current command batch. More...
 
RETCODE dbcanquery (DBPROCESS *dbproc)
 Cancel the query currently being retrieved, discarding all pending rows. More...
 
char * dbchange (DBPROCESS *dbproc)
 See if a command caused the current database to change. More...
 
void dbclose (DBPROCESS *dbproc)
 Close a connection to the server and free associated resources. More...
 
void dbclrbuf (DBPROCESS *dbproc, DBINT n)
 Clear n rows from the row buffer. More...
 
RETCODE dbclropt (DBPROCESS *dbproc, int option, const char param[])
 Reset an option. More...
 
RETCODE dbcmd (DBPROCESS *dbproc, const char cmdstring[])
 Append SQL to the command buffer. More...
 
RETCODE dbcmdrow (DBPROCESS *dbproc)
 See if the current command can return rows. More...
 
RETCODE dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol)
 Get a bunch of column attributes with a single call (Microsoft-compatibility feature). More...
 
DBINT dbcollen (DBPROCESS *dbproc, int column)
 Get size of a regular result column. More...
 
char * dbcolname (DBPROCESS *dbproc, int column)
 Return name of a regular result column. More...
 
static TDSCOLUMNdbcolptr (DBPROCESS *dbproc, int column)
 Sanity checks for column-oriented functions.
More...
 
char * dbcolsource (DBPROCESS *dbproc, int column)
 Get base database column name for a result set column. More...
 
int dbcoltype (DBPROCESS *dbproc, int column)
 Get the datatype of a regular result set column. More...
 
DBTYPEINFOdbcoltypeinfo (DBPROCESS *dbproc, int column)
 Get precision and scale information for a regular result column. More...
 
int dbcolutype (DBPROCESS *dbproc, int column)
 Get user-defined datatype of a regular result column. More...
 
DBINT dbconvert (DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
 cf. More...
 
DBINT dbconvert_ps (DBPROCESS *dbproc, int db_srctype, const BYTE *src, DBINT srclen, int db_desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
 Convert one datatype to another. More...
 
DBINT dbcount (DBPROCESS *dbproc)
 Get count of rows processed. More...
 
int dbcurcmd (DBPROCESS *dbproc)
 Get number of the row just returned. More...
 
DBINT dbcurrow (DBPROCESS *dbproc)
 Get number of the row currently being read. More...
 
BYTE * dbdata (DBPROCESS *dbproc, int column)
 Get address of data in a regular result column. More...
 
int dbdatecmp (DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
 Compare DBDATETIME values, similar to strcmp(3). More...
 
RETCODE dbdatecrack (DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime)
 Break a DBDATETIME value into useful pieces. More...
 
DBINT dbdatlen (DBPROCESS *dbproc, int column)
 Get size of current row's data in a regular result column. More...
 
DBBOOL dbdead (DBPROCESS *dbproc)
 Check if dbproc is an ex-parrot.
More...
 
EHANDLEFUNC dberrhandle (EHANDLEFUNC handler)
 Set an error handler, for messages from db-lib. More...
 
void dbexit ()
 Close server connections and free all related structures. More...
 
RETCODE dbfcmd (DBPROCESS *dbproc, const char *fmt,...)
 printf-like way to form SQL to send to the server. More...
 
DBINT dbfirstrow (DBPROCESS *dbproc)
 See if a server response has arrived. More...
 
void dbfreebuf (DBPROCESS *dbproc)
 Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt(). More...
 
char * dbgetchar (DBPROCESS *dbproc, int pos)
 Get address of a position in the command buffer. More...
 
int dbgetmaxprocs (void)
 get maximum simultaneous connections db-lib will open to the server. More...
 
RETCODE dbgetnull (DBPROCESS *dbproc, int bindtype, int varlen, BYTE *varaddr)
 
int dbgetpacket (DBPROCESS *dbproc)
 Get TDS packet size for the connection. More...
 
RETCODE dbgetrow (DBPROCESS *dbproc, DBINT row)
 Read a row from the row buffer. More...
 
int dbgettime (void)
 Get maximum seconds db-lib waits for a server response to query. More...
 
BYTE * dbgetuserdata (DBPROCESS *dbproc)
 Get address of user-allocated data from a DBPROCESS. More...
 
DBBOOL dbhasretstat (DBPROCESS *dbproc)
 Determine if query generated a return status number. More...
 
RETCODE dbinit (void)
 Initialize db-lib. More...
 
int dbiordesc (DBPROCESS *dbproc)
 Get file descriptor of the socket used by a DBPROCESS to read data coming from the server. (!) More...
 
int dbiowdesc (DBPROCESS *dbproc)
 Get file descriptor of the socket used by a DBPROCESS to write data coming to the server. (!) More...
 
DBBOOL dbisavail (DBPROCESS *dbproc)
 
BOOL dbiscount (DBPROCESS *dbproc)
 Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature). More...
 
DBBOOL dbisopt (DBPROCESS *dbproc, int option, const char param[])
 Get value of an option. More...
 
DBINT dblastrow (DBPROCESS *dbproc)
 Get number of the last row in the row buffer. More...
 
static int dblib_add_connection (DBLIBCONTEXT *ctx, TDSSOCKET *tds)
 
static TDS_SERVER_TYPE dblib_bound_type (int bindtype)
 
static int dblib_coltype (TDSCOLUMN *colinfo)
 
static RETCODE dblib_datecrack (DBPROCESS *dbproc, BOOL nano_precision, DBDATEREC *output, int type, const void *data)
 
static void dblib_del_connection (DBLIBCONTEXT *ctx, TDSSOCKET *tds)
 
static TDSCONTEXTdblib_get_tds_ctx (void)
 
static void dblib_release_tds_ctx (int count)
 
LOGINRECdblogin (void)
 Allocate a LOGINREC structure. More...
 
void dbloginfree (LOGINREC *login)
 free the LOGINREC
 
RETCODE dbmny4add (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
 Add two DBMONEY4 values. More...
 
int dbmny4cmp (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
 Compare two DBMONEY4 values. More...
 
RETCODE dbmny4copy (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
 Copy a DBMONEY4 value. More...
 
RETCODE dbmny4minus (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
 Negate a DBMONEY4 value. More...
 
RETCODE dbmny4sub (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
 Subtract two DBMONEY4 values. More...
 
RETCODE dbmny4zero (DBPROCESS *dbproc, DBMONEY4 *dest)
 Zero a DBMONEY4 value. More...
 
int dbmnycmp (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
 Compare two DBMONEY values. More...
 
RETCODE dbmnycopy (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
 Copy a DBMONEY value. More...
 
RETCODE dbmnydec (DBPROCESS *dbproc, DBMONEY *amount)
 Subtract $0.0001 from a DBMONEY value. More...
 
RETCODE dbmnyinc (DBPROCESS *dbproc, DBMONEY *amount)
 Add $0.0001 to a DBMONEY value. More...
 
RETCODE dbmnymaxneg (DBPROCESS *dbproc, DBMONEY *amount)
 Get maximum negative DBMONEY value supported. More...
 
RETCODE dbmnymaxpos (DBPROCESS *dbproc, DBMONEY *amount)
 Get maximum positive DBMONEY value supported. More...
 
RETCODE dbmnyminus (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
 Negate a DBMONEY value. More...
 
RETCODE dbmnyzero (DBPROCESS *dbproc, DBMONEY *dest)
 Set a DBMONEY value to zero. More...
 
const char * dbmonthname (DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
 Get name of a month, in some human language. More...
 
RETCODE dbmorecmds (DBPROCESS *dbproc)
 See if more commands are to be processed. More...
 
RETCODE dbmoretext (DBPROCESS *dbproc, DBINT size, const BYTE text[])
 Send chunk of a text/image value to the server. More...
 
MHANDLEFUNC dbmsghandle (MHANDLEFUNC handler)
 Set a message handler, for messages from the server. More...
 
char * dbname (DBPROCESS *dbproc)
 Get name of current database. More...
 
STATUS dbnextrow (DBPROCESS *dbproc)
 
RETCODE dbnullbind (DBPROCESS *dbproc, int column, DBINT *indicator)
 Tie a null-indicator to a regular result column. More...
 
int dbnumalts (DBPROCESS *dbproc, int computeid)
 Get count of columns in a compute row. More...
 
int dbnumcols (DBPROCESS *dbproc)
 Return number of regular columns in a result set. More...
 
int dbnumcompute (DBPROCESS *dbproc)
 Get count of COMPUTE clauses for a result set. More...
 
int dbnumrets (DBPROCESS *dbproc)
 Get count of output parameters filled by a stored procedure. More...
 
int dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum,...)
 Call client-installed error handler. More...
 
DBINT dbprcollen (DBPROCESS *dbproc, int column)
 Get size of a result column needed to print column. More...
 
void dbprhead (DBPROCESS *dbproc)
 Print result set headings to stdout. More...
 
RETCODE dbprrow (DBPROCESS *dbproc)
 Print a result set to stdout. More...
 
const char * dbprtype (int token)
 Print a token value's name to a buffer. More...
 
STATUS dbreadtext (DBPROCESS *dbproc, void *buf, DBINT bufsize)
 Fetch part of a text or image value from the server. More...
 
void dbrecftos (const char filename[])
 Record to a file all SQL commands sent to the server. More...
 
RETCODE dbresults (DBPROCESS *dbproc)
 Set up query results. More...
 
BYTE * dbretdata (DBPROCESS *dbproc, int retnum)
 Get value of an output parameter filled by a stored procedure. More...
 
int dbretlen (DBPROCESS *dbproc, int retnum)
 Get size of an output parameter filled by a stored procedure. More...
 
char * dbretname (DBPROCESS *dbproc, int retnum)
 Get name of an output parameter filled by a stored procedure. More...
 
DBINT dbretstatus (DBPROCESS *dbproc)
 Fetch status value returned by query or remote procedure call. More...
 
int dbrettype (DBPROCESS *dbproc, int retnum)
 Get datatype of a stored procedure's return parameter. More...
 
RETCODE dbrows (DBPROCESS *dbproc)
 Indicate whether a query returned rows. More...
 
STATUS dbrowtype (DBPROCESS *dbproc)
 Get returned row's type. More...
 
RETCODE dbsafestr (DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
 safely quotes character values in SQL text. More...
 
char * dbservcharset (DBPROCESS *dbproc)
 Get syscharset name of the server character set. More...
 
void dbsetavail (DBPROCESS *dbproc)
 Mark a DBPROCESS as "available". More...
 
void dbsetifile (char *filename)
 set name and location of the interfaces file FreeTDS should use to look up a servername. More...
 
void dbsetinterrupt (DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
 Set interrupt handler for db-lib to use while blocked against a read from the server. More...
 
RETCODE dbsetlbool (LOGINREC *login, int value, int which)
 Set a boolean value in a LOGINREC structure.
More...
 
RETCODE dbsetllong (LOGINREC *login, long value, int which)
 Set an integer value in a LOGINREC structure.
More...
 
RETCODE dbsetlname (LOGINREC *login, const char *value, int which)
 Set the value of a string in a LOGINREC structure.
More...
 
RETCODE dbsetlogintime (int seconds)
 Set maximum seconds db-lib waits for a server response to a login attempt. More...
 
RETCODE dbsetlversion (LOGINREC *login, BYTE version)
 Set TDS version for future connections.
 
RETCODE dbsetmaxprocs (int maxprocs)
 Set maximum simultaneous connections db-lib will open to the server. More...
 
RETCODE dbsetnull (DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval)
 Define substitution values to be used when binding null values. More...
 
RETCODE dbsetopt (DBPROCESS *dbproc, int option, const char *char_param, int int_param)
 Set db-lib or server option. More...
 
STATUS dbsetrow (DBPROCESS *dbproc, DBINT row)
 Make a buffered row "current" without fetching it into bound variables. More...
 
RETCODE dbsettime (int seconds)
 Set maximum seconds db-lib waits for a server response to query. More...
 
void dbsetuserdata (DBPROCESS *dbproc, BYTE *ptr)
 Associate client-allocated (and defined) data with a DBPROCESS. More...
 
RETCODE dbsetversion (DBINT version)
 Specify a db-lib version level. More...
 
int dbspid (DBPROCESS *dbproc)
 Get server process ID for a DBPROCESS. More...
 
RETCODE dbspr1row (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
 Print a regular result row to a buffer. More...
 
DBINT dbspr1rowlen (DBPROCESS *dbproc)
 Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row(). More...
 
RETCODE dbsprhead (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
 Print result set headings to a buffer. More...
 
RETCODE dbsprline (DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
 Get formatted string for underlining dbsprhead() column names. More...
 
RETCODE dbsqlexec (DBPROCESS *dbproc)
 send the SQL command to the server and wait for an answer. More...
 
RETCODE dbsqlok (DBPROCESS *dbproc)
 Wait for results of a query from the server. More...
 
RETCODE dbsqlsend (DBPROCESS *dbproc)
 Transmit the command buffer to the server. More...
 
RETCODE dbstrbuild (DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
 Build a printable string from text containing placeholders for variables. More...
 
RETCODE dbstrcpy (DBPROCESS *dbproc, int start, int numbytes, char *dest)
 Get a copy of a chunk of the command buffer. More...
 
static RETCODE dbstring_assign (DBSTRING **dbstrp, const char *p)
 
static RETCODE dbstring_concat (DBSTRING **dbstrp, const char *p)
 
static void dbstring_free (DBSTRING **dbstrp)
 
static char * dbstring_get (DBSTRING *dbstr)
 
static int dbstring_getchar (DBSTRING *dbstr, int i)
 
static DBINT dbstring_length (DBSTRING *dbstr)
 
int dbstrlen (DBPROCESS *dbproc)
 Get size of the command buffer, in bytes. More...
 
RETCODE dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
 describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo) More...
 
int dbtds (DBPROCESS *dbproc)
 Get the TDS version in use for dbproc.
More...
 
DBBINARY * dbtxptr (DBPROCESS *dbproc, int column)
 Get text pointer for a column in the current row. More...
 
DBBINARY * dbtxtimestamp (DBPROCESS *dbproc, int column)
 Get text timestamp for a column in the current row. More...
 
RETCODE dbuse (DBPROCESS *dbproc, const char *name)
 Change current database. More...
 
DBINT dbvarylen (DBPROCESS *dbproc, int column)
 Determine whether a column can vary in size. More...
 
const char * dbversion ()
 See which version of db-lib is in use. More...
 
DBBOOL dbwillconvert (int srctype, int desttype)
 Test whether or not a datatype can be converted to another datatype. More...
 
RETCODE dbwritetext (DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text)
 Send text or image data to the server. More...
 
static int default_err_handler (DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
 default error handler for db-lib (handles library-generated errors) More...
 
static DBOPTIONinit_dboptions (void)
 
static const char * prdbresults_state (int retcode)
 
static const char * prdbretcode (RETCODE retcode)
 
static const char * prresult_type (int result_type)
 
static const char * prretcode (int retcode)
 
static const char * tds_prdatatype (int datatype_token)
 Returns type in string. More...
 
DBPROCESStdsdbopen (LOGINREC *login, const char *server, int msdblib)
 Form a connection with the server. More...
 

Variables

EHANDLEFUNC _dblib_err_handler = default_err_handler
 
MHANDLEFUNC _dblib_msg_handler = NULL
 
static const DBLIB_ERROR_MESSAGE dblib_error_messages []
 
static tds_mutex dblib_mutex = TDS_MUTEX_INITIALIZER
 
static NULLREP default_null_representations [MAXBINDTYPES]
 
static DBLIBCONTEXT g_dblib_ctx
 
static int g_dblib_version
 
static const DBBIGINT null_BIGINT = 0
 
static const DBBIT null_BIT = 0
 
static const DBCHAR null_CHAR = '\0'
 
static const DBDATETIME null_DATETIME = { 0, 0 }
 
static const TDS_DATETIMEALL null_DATETIMEALL = { 0, 0, 0, 0 }
 
static const DBFLT8 null_FLT8 = 0
 
static const DBINT null_INT = 0
 
static const DBMONEY null_MONEY = { 0, 0 }
 
static const DBNUMERIC null_NUMERIC = { 0, 0, {0} }
 
static const DBREAL null_REAL = 0
 
static const DBDATETIME4 null_SMALLDATETIME = { 0, 0 }
 
static const DBSMALLINT null_SMALLINT = 0
 
static const DBMONEY4 null_SMALLMONEY = {0}
 
static const DBTINYINT null_TINYINT = 0
 
static const DBVARYCHAR null_VARYCHAR = { 0, {0} }
 
static const char *const opttext [DBNUMOPTIONS]
 

Detailed Description

Main implementation file for db-lib.

Typedef Documentation

◆ DBLIBCONTEXT

typedef struct dblib_context DBLIBCONTEXT

\dblib_internal

Remarks
A db-lib connection has an implicit TDS context.

Function Documentation

◆ dbcolinfo()

RETCODE dbcolinfo ( DBPROCESS dbproc,
CI_TYPE  type,
DBINT  column,
DBINT  computeid,
DBCOL pdbcol 
)

Get a bunch of column attributes with a single call (Microsoft-compatibility feature).


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
typemust be CI_REGULAR or CI_ALTERNATE (CI_CURSOR is defined by the vendor, but is not yet implemented).
columnNth in the result set, starting from 1.
computeid(ignored)
pdbcoladdress of structure to be populated by this function.
Returns
SUCCEED or FAIL.
See also
dbcolbrowse(), dbqual(), dbtabbrowse(), dbtabcount(), dbtabname(), dbtabsource(), dbtsnewlen(), dbtsnewval(), dbtsput().
Todo:
Support cursor rows.
Here is the call graph for this function:

◆ dbgetnull()

RETCODE dbgetnull ( DBPROCESS dbproc,
int  bindtype,
int  varlen,
BYTE *  varaddr 
)

dbbind() says: "Note that if varlen is 0, no padding takes place" dbgetnull() will not pad varaddr unless varlen is positive.
Vartype Program Type Padding Terminator


CHARBIND DBCHAR blanks none STRINGBIND DBCHAR blanks \0 NTBSTRINGBIND DBCHAR none \0 VARYCHARBIND DBVARYCHAR none none BOUNDARYBIND DBCHAR none \0 SENSITIVITYBIND DBCHAR none \0

◆ tds_prdatatype()

static const char * tds_prdatatype ( int  datatype_token)
static

Returns type in string.

Used for debugging purpose

Variable Documentation

◆ g_dblib_version

int g_dblib_version
static
Initial value:
#define DBVERSION_UNKNOWN
DBVERSION_xxx are used with dbsetversion()
Definition: sybdb.h:70
freetds-1.3.6/doc/reference/a00080_a9b73fd1afa2c3ccfca481635212d2e43_cgraph.dot000644 025423 025423 00000001307 14162303416 027075 0ustar00fredianofrediano000000 000000 digraph "dbcolinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcolinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get a bunch of column attributes with a single call (Microsoft-compatibility feature)."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00081.dot000644 025423 025423 00000021663 14162303416 020637 0ustar00fredianofrediano000000 000000 digraph "src/dblib/dblib.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/dblib/dblib.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Main implementation file for db-lib."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="freetds/time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node4 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node7 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node7 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node7 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node7 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node7 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node14 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node7 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node18 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node19 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node20 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node7 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/convert.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00401_source.html",tooltip=" "]; Node22 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/data.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00404_source.html",tooltip=" "]; Node23 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="sybfront.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00512_source.html",tooltip=" "]; Node24 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="sybdb.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00506.html",tooltip="Primary include file for db-lib applications."]; Node25 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node26 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node26 [label="syberror.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00509_source.html",tooltip=" "]; Node1 -> Node27 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node27 [label="dblib.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00374_source.html",tooltip=" "]; Node27 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node27 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node28 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node28 [label="buffering.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00077_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00092_source.html000644 025423 025423 00000474011 14162303414 022374 0ustar00fredianofrediano000000 000000 FreeTDS API: src/dblib/error_table.h Source File
FreeTDS API
error_table.h
1 { SYBEICONVI, EXINFO, "WARNING! Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?')."},
2 { SYBEICONVO, EXUSER, "Error converting client characters into server's character set. Some character(s) could not be converted."},
3 { SYBEAAMT, EXPROGRAM, "User attempted a dbaltbind() with mismatched column and variable types."},
4 { SYBEABMT, EXPROGRAM, "User attempted a dbbind() with mismatched column and variable types."},
5 { SYBEABNC, EXPROGRAM, "Attempt to bind to a non-existent column."},
6 { SYBEABNP, EXPROGRAM, "Attempt to bind using NULL pointers."},
7 { SYBEABNV, EXPROGRAM, "Attempt to bind to a NULL program variable."},
8 { SYBEACNV, EXCONVERSION, "Attemp to do conversion with NULL destination variable."},
9 { SYBEADST, EXCONSISTENCY, "Error in attempting to determine the size of a pair of translation tables."},
10 { SYBEAICF, EXCONSISTENCY, "Error in attempting to install custom format."},
11 { SYBEALTT, EXCONSISTENCY, "Error in attempting to load a pair of translation tables."},
12 { SYBEAOLF, EXRESOURCE, "Error in attempting to open a localization file."},
13 { SYBEAPCT, EXCONSISTENCY, "Error in attempting to perform a character-set translation."},
14 { SYBEAPUT, EXPROGRAM, "Attempt to print unknown token."},
15 { SYBEARDI, EXRESOURCE, "Error in attempting to read datetime information from a localization file."},
16 { SYBEARDL, EXRESOURCE, "Error in attempting to read the dblib.loc localization file."},
17 { SYBEASEC, EXPROGRAM, "Attempt to send an empty command buffer to the SQL Server."},
18 { SYBEASNL, EXPROGRAM, "Attempt to set fields in a null loginrec."},
19 { SYBEASTF, 1, "VMS: Unable to setmode for control_c ast."},
20 { SYBEASTL, EXPROGRAM, "Synchronous IO attempted at AST level."},
21 { SYBEASUL, EXPROGRAM, "Attempt to set unknown loginrec field."},
22 { SYBEATTNACK, 1, "Timed out waiting for server to acknowledge attention."},
23 { SYBEAUTN, EXPROGRAM, "Attempt to update the timestamp of a table which has no timestamp column."},
24 { SYBEBADPK, EXINFO, "Packet size of %1! not supported. -- size of %2! used instead."},
25 { SYBEBADTYPE, 1, "Illegal value for type parameter given to %1!."},
26 { SYBEBBCI, EXINFO, "Batch successfully bulk-copied to SQL Server."},
27 { SYBEBBFL, 1, "-001- Batch failed in bulk-copy to SQL Server."},
28 { SYBEBBL, EXPROGRAM, "Bad bindlen parameter passed to dbsetnull()."},
29 { SYBEBCBC, EXPROGRAM, "bcp_columns() must be called before bcp_colfmt() and bcp_colfmt_ps()."},
30 { SYBEBCBNPR, EXPROGRAM, "bcp_bind(): if varaddr is NULL, prefixlen must be 0 and no terminator should be specified."},
31 { SYBEBCBNTYP, EXPROGRAM, "bcp_bind(): if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY."},
32 { SYBEBCBPREF, EXPROGRAM, "Illegal prefix length. Legal values are 0, 1, 2 or 4."},
33 { SYBEBCFO, EXUSER, "Bcp host-files must contain at least one column."},
34 { SYBEBCHLEN, EXPROGRAM, "host_collen should be greater than or equal to -1."},
35 { SYBEBCIS, EXCONSISTENCY, "Attempt to bulk-copy an illegally-sized column value to the SQL Server."},
36 { SYBEBCIT, EXPROGRAM, "It's illegal to use BCP terminators with program variables other than SYBCHAR, SYBBINARY, SYBTEXT, or SYBIMAGE."},
37 { SYBEBCITBLEN, EXPROGRAM, "bcp_init(): tblname parameter is too long."},
38 { SYBEBCITBNM, EXPROGRAM, "bcp_init(): tblname parameter cannot be NULL."},
39 { SYBEBCMTXT, EXPROGRAM, "bcp_moretext() may be used only when there is at least one text or image column in the server table."},
40 { SYBEBCNL, EXNONFATAL, "Negative length-prefix found in BCP data-file."},
41 { SYBEBCNN, EXUSER, "Attempt to bulk-copy a NULL value into Server column 0, which does not accept NULL values."},
42 { SYBEBCNT, EXUSER, "Attempt to use Bulk Copy with a non-existent Server table."},
43 { SYBEBCOR, EXCONSISTENCY, "Attempt to bulk-copy an oversized row to the SQL Server."},
44 { SYBEBCPB, EXPROGRAM, "bcp_bind(), bcp_moretext() and bcp_sendrow() may NOT be used after bcp_init() has been passed a non-NULL input file name."},
45 { SYBEBCPCTYP, EXPROGRAM, "bcp_colfmt(): If table_colnum is 0, host_type cannot be 0."},
46 { SYBEBCPI, EXPROGRAM, "bcp_init() must be called before any other bcp routines."},
47 { SYBEBCPN, EXPROGRAM, "bcp_bind(), bcp_collen(), bcp_colptr(), bcp_moretext() and bcp_sendrow() may be used only after bcp_init() has been called with the copy direction set to DB_IN."},
48 { SYBEBCPOPT, 1, "The option cannot be called while a bulk copy operation is progress."},
49 { SYBEBCPREC, EXNONFATAL, "Column %1!: Illegal precision value encountered."},
50 { SYBEBCPREF, EXPROGRAM, "Illegal prefix length. Legal values are -1, 0, 1, 2 or 4."},
51 { SYBEBCRE, EXNONFATAL, "IO error while reading bcp data-file."},
52 { SYBEBCRO, EXINFO, "The BCP hostfile '' contains only 0 rows. It was impossible to read the requested 0 rows."},
53 { SYBEBCSA, EXUSER, "The BCP hostfile '' contains only 0 rows. Skipping all of these rows is not allowed."},
54 { SYBEBCSET, EXCONSISTENCY, "Unknown character-set encountered."},
55 { SYBEBCSI, EXPROGRAM, "Host-file columns may be skipped only when copying INto the Server."},
56 { SYBEBCSNDROW, EXPROGRAM, "bcp_sendrow() may NOT be called unless all text data for the previous row has been sent using bcp_moretext()."},
57 { SYBEBCSNTYP, EXPROGRAM, "column number %1!: if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY."},
58 { SYBEBCUC, EXRESOURCE, "Bcp: Unable to close host data-file."},
59 { SYBEBCUO, EXRESOURCE, "Bcp: Unable to open host data-file."},
60 { SYBEBCVH, EXPROGRAM, "bcp_exec() may be called only after bcp_init() has been passed a valid host file."},
61 { SYBEBCVLEN, EXPROGRAM, "varlen should be greater than or equal to -1."},
62 { SYBEBCWE, EXNONFATAL, "IO error while writing bcp data-file."},
63 { SYBEBDIO, EXPROGRAM, "Bad bulk-copy direction. Must be either IN or OUT."},
64 { SYBEBEOF, EXNONFATAL, "Unexpected EOF encountered in BCP data-file."},
65 { SYBEBIHC, EXPROGRAM, "Incorrect host-column number found in bcp format-file."},
66 { SYBEBIVI, EXPROGRAM, "bcp_columns(), bcp_colfmt() and bcp_colfmt_ps() may be used only after bcp_init() has been passed a valid input file."},
67 { SYBEBNCR, EXPROGRAM, "Attempt to bind user variable to a non-existent compute row."},
68 { SYBEBNUM, EXPROGRAM, "Bad numbytes parameter passed to dbstrcpy()."},
69 { SYBEBOOL, 1, "Boolean parameters must be TRUE or FALSE."},
70 { SYBEBPKS, EXPROGRAM, "In DBSETLPACKET(), the packet size parameter must be between 0 and 999999."},
71 { SYBEBPREC, EXPROGRAM, "Illegal precision specified."},
72 { SYBEBPROBADDEF, EXCONSISTENCY, "bcp protocol error: illegal default column id received."},
73 { SYBEBPROBADLEN, 1, "bcp protocol error: illegal datatype length received."},
74 { SYBEBPROBADPREC, 1, "bcp protocol error: illegal precision value received."},
75 { SYBEBPROBADSCL, 1, "bcp protocol error: illegal scale value received."},
76 { SYBEBPROBADTYP, 1, "bcp protocol error: unknown column datatype."},
77 { SYBEBPROCOL, EXCONSISTENCY, "bcp protocol error: returned column count differs from the actual number of columns received."},
78 { SYBEBPRODEF, EXCONSISTENCY, "bcp protocol error: expected default information and got none."},
79 { SYBEBPRODEFID, EXCONSISTENCY, "bcp protocol error: default column id and actual column id are not same."},
80 { SYBEBPRODEFTYP, EXCONSISTENCY, "bcp protocol error: default value datatype differs from column datatype."},
81 { SYBEBPROEXTDEF, EXCONSISTENCY, "bcp protocol error: more than one row of default information received."},
82 { SYBEBPROEXTRES, EXCONSISTENCY, "bcp protocol error: unexpected set of results received."},
83 { SYBEBPRONODEF, EXCONSISTENCY, "bcp protocol error: default value received for column that does not have default."},
84 { SYBEBPRONUMDEF, EXCONSISTENCY, "bcp protocol error: expected number of defaults differs from the actual number of defaults received."},
85 { SYBEBRFF, EXRESOURCE, "IO error while reading bcp format-file."},
86 { SYBEBSCALE, EXPROGRAM, "Illegal scale specified."},
87 { SYBEBTMT, EXPROGRAM, "Attempt to send too much TEXT data via the bcp_moretext() call."},
88 { SYBEBTOK, EXCOMM, "Bad token from SQL Server: Data-stream processing out of sync."},
89 { SYBEBTYP, EXPROGRAM, "Unknown bind type passed to DB-LIBRARY function."},
90 { SYBEBTYPSRV, EXPROGRAM, "Datatype is not supported by the server."},
91 { SYBEBUCE, EXRESOURCE, "Bcp: Unable to close error-file."},
92 { SYBEBUCF, EXPROGRAM, "Bcp: Unable to close format-file."},
93 { SYBEBUDF, EXPROGRAM, "Bcp: Unrecognized datatype found in format-file."},
94 { SYBEBUFF, EXPROGRAM, "Bcp: Unable to create format-file."},
95 { SYBEBUFL, EXCONSISTENCY, "DB-LIBRARY internal error - send buffer length corrupted."},
96 { SYBEBUOE, EXRESOURCE, "Bcp: Unable to open error-file."},
97 { SYBEBUOF, EXPROGRAM, "Bcp: Unable to open format-file."},
98 { SYBEBWEF, EXNONFATAL, "IO error while writing bcp error-file."},
99 { SYBEBWFF, EXRESOURCE, "IO error while writing bcp format-file."},
100 { SYBECAP, EXCOMM, "DB-Library capabilities not accepted by the Server."},
101 { SYBECAPTYP, EXCOMM, "Unexpected capability type in CAPABILITY datastream."},
102 { SYBECDNS, EXCONSISTENCY, "Datastream indicates that a compute column is derived from a non-existent select-list member."},
103 { SYBECDOMAIN, EXCONVERSION, "Source field value is not within the domain of legal values."},
104 { SYBECINTERNAL, EXCONVERSION, "Internal Conversion error."},
105 { SYBECLOS, EXCOMM, "Error in closing network connection."},
106 { SYBECLOSEIN, 1, "Unable to close interface file."},
107 { SYBECLPR, EXCONVERSION, "Data-conversion resulted in loss of precision."},
108 { SYBECNOR, EXPROGRAM, "Column number out of range."},
109 { SYBECNOV, EXCONVERSION, "Attempt to set variable to NULL resulted in overflow."},
110 { SYBECOFL, EXCONVERSION, "Data-conversion resulted in overflow."},
111 { SYBECONN, EXCOMM, "Unable to connect socket -- SQL Server is unavailable or does not exist."},
112 { SYBECRNC, EXPROGRAM, "The current row is not a result of compute clause 0, so it is illegal to attempt to extract that data from this row."},
113 { SYBECRSAGR, EXPROGRAM, "Aggregate functions are not allowed in a cursor statement."},
114 { SYBECRSBROL, EXPROGRAM, "Backward scrolling cannot be used in a forward scrolling cursor."},
115 { SYBECRSBSKEY, EXPROGRAM, "Keyset cannot be scrolled backward in mixed cursors with a previous fetch type."},
116 { SYBECRSBUFR, EXPROGRAM, "Row buffering should not be turned on when using cursor APIs."},
117 { SYBECRSDIS, EXPROGRAM, "Cursor statement contains one of the disallowed phrases 'compute', 'union', 'for browse', or 'select into'."},
118 { SYBECRSFLAST, EXPROGRAM, "Fetch type LAST requires fully keyset driven cursors."},
119 { SYBECRSFRAND, EXPROGRAM, "Fetch types RANDOM and RELATIVE can only be used within the keyset of keyset driven cursors."},
120 { SYBECRSFROWN, EXPROGRAM, "Row number to be fetched is outside valid range."},
121 { SYBECRSFTYPE, EXRESOURCE, "Unknown fetch type."},
122 { SYBECRSINV, EXPROGRAM, "Invalid cursor statement."},
123 { SYBECRSINVALID, EXRESOURCE, "The cursor handle is invalid."},
124 { SYBECRSMROWS, EXRESOURCE, "Multiple rows are returned, only one is expected."},
125 { SYBECRSNOBIND, EXPROGRAM, "Cursor bind must be called prior to updating cursor."},
126 { SYBECRSNOCOUNT, EXPROGRAM, "The DBNOCOUNT option should not be turned on when doing updates or deletes with dbcursor()."},
127 { SYBECRSNOFREE, EXPROGRAM, "The DBNOAUTOFREE option should not be turned on when using cursor APIs."},
128 { SYBECRSNOIND, EXPROGRAM, "One of the tables involved in the cursor statement does not have a unique index."},
129 { SYBECRSNOKEYS, EXRESOURCE, "The entire keyset must be defined for KEYSET cursors."},
130 { SYBECRSNOLEN, EXRESOURCE, "No unique index found."},
131 { SYBECRSNOPTCC, EXRESOURCE, "No OPTCC was found."},
132 { SYBECRSNORDER, EXRESOURCE, "The order of clauses must be from, where, and order by."},
133 { SYBECRSNORES, EXPROGRAM, "Cursor statement generated no results."},
134 { SYBECRSNOTABLE, EXRESOURCE, "Table name is NULL."},
135 { SYBECRSNOUPD, EXPROGRAM, "Update or delete operation did not affect any rows."},
136 { SYBECRSNOWHERE, EXPROGRAM, "A WHERE clause is not allowed in a cursor update or insert."},
137 { SYBECRSNROWS, EXRESOURCE, "No rows returned, at least one is expected."},
138 { SYBECRSNUNIQUE, EXRESOURCE, "No unique keys associated with this view."},
139 { SYBECRSORD, EXPROGRAM, "Only fully keyset driven cursors can have 'order by', ' group by', or 'having' phrases."},
140 { SYBECRSRO, EXPROGRAM, "Data locking or modifications cannot be made in a READONLY cursor."},
141 { SYBECRSSET, EXPROGRAM, "A SET clause is required for a cursor update or insert."},
142 { SYBECRSTAB, EXPROGRAM, "Table name must be determined in operations involving data locking or modifications."},
143 { SYBECRSUPDNB, EXPROGRAM, "Update or insert operations cannot use bind variables when binding type is NOBIND."},
144 { SYBECRSUPDTAB, EXPROGRAM, "Update or insert operations using bind variables require single table cursors."},
145 { SYBECRSVAR, EXRESOURCE, "There is no valid address associated with this bind."},
146 { SYBECRSVIEW, EXPROGRAM, "A view cannot be joined with another table or a view in a cursor statement."},
147 { SYBECRSVIIND, EXPROGRAM, "The view used in the cursor statement does not include all the unique index columns of the underlying tables."},
148 { SYBECS, 1, "-004- cs context Error."},
149 { SYBECSYN, EXCONVERSION, "Attempt to convert data stopped by syntax error in source field."},
150 { SYBECUFL, EXCONVERSION, "Data-conversion resulted in underflow."},
151 { SYBECWLL, 1, "Attempt to set column width less than 1."},
152 { SYBEDBPS, EXRESOURCE, "Maximum number of DBPROCESSes already allocated."},
153 { SYBEDCL, 1, "-004- DCL Error."},
154 { SYBEDDNE, EXCOMM, "DBPROCESS is dead or not enabled."},
155 { SYBEDIVZ, EXUSER, "Attempt to divide by $0.00 in function %1!."},
156 { SYBEDNTI, EXPROGRAM, "Attempt to use dbtxtsput() to put a new text-timestamp into a column whose datatype is neither SYBTEXT nor SYBIMAGE."},
157 { SYBEDPOR, EXPROGRAM, "Out-of-range datepart constant."},
158 { SYBEDVOR, EXPROGRAM, "Day values must be between 1 and 7."},
159 { SYBEECAN, EXINFO, "Attempted to cancel unrequested event notification."},
160 { SYBEECRT, 1, "Must call dbregdefine() before dbregcreate()."},
161 { SYBEEINI, EXINFO, "Must call dbreginit() before dbregraise()."},
162 { SYBEEQVA, 1, "Error in queueing VMS AST routine."},
163 { SYBEERRLABEL, 1, "An illegal value was returned from the security label handler."},
164 { SYBEESSL, 1, "Login security level entered does not agree with operating system level."},
165 { SYBEETD, EXPROGRAM, "Failure to send the expected amount of TEXT or IMAGE data via dbmoretext()."},
166 { SYBEEUNR, EXCOMM, "Unsolicited event notification received."},
167 { SYBEEVOP, EXINFO, "Called dbregwatch() with a bad options parameter."},
168 { SYBEEVST, EXINFO, "Must initiate a transaction before calling dbregparam()."},
169 { SYBEFCON, EXCOMM, "SQL Server connection failed."},
170 { SYBEFENC, 1, "Password Encryption failed."},
171 { SYBEFGTL, 1, "Bcp: Row number of the first row to be copied cannot be greater than the row number for the last row to be copied."},
172 { SYBEFMODE, 1, "ReadWriteAppend mode denied on file."},
173 { SYBEFRES, EXFATAL, "Challenge-Response function failed."},
174 { SYBEFSHD, EXRESOURCE, "Error in attempting to find the Sybase home directory."},
175 { SYBEFUNC, EXPROGRAM, "Functionality not supported at the specified version level."},
176 { SYBEGENOS, 1, "General Operating System Error."},
177 { SYBEICN, EXPROGRAM, "Invalid computeid or compute column number."},
178 { SYBEIDCL, EXCONSISTENCY, "Illegal datetime column length returned by DataServer. Legal datetime lengths are 4 and 8 bytes."},
179 { SYBEIDECCL, EXCONSISTENCY, "Invalid decimal column length returned by the server."},
180 { SYBEIFCL, EXCONSISTENCY, "Illegal floating-point column length returned by DataServer. Legal floating-point lengths are 4 and 8 bytes."},
181 { SYBEIFNB, EXPROGRAM, "Illegal field number passed to bcp_control()."},
182 { SYBEIICL, EXCONSISTENCY, "Illegal integer column length returned by SQL Server. Legal integer lengths are 1, 2, and 4 bytes."},
183 { SYBEIMCL, EXCONSISTENCY, "Illegal money column length returned by DataServer. Legal money lengths are 4 and 8 bytes."},
184 { SYBEINLN, EXUSER, "Interface file: unexpected end-of-line."},
185 { SYBEINTF, EXUSER, "Server name not found in interface file."},
186 { SYBEINUMCL, EXCONSISTENCY, "Invalid numeric column length returned by the server."},
187 { SYBEIPV, EXINFO, "%1! is an illegal value for the %2! parameter of %3!."},
188 { SYBEISOI, EXCONSISTENCY, "Invalid sort-order information found."},
189 { SYBEISRVPREC, EXCONSISTENCY, "Illegal precision value returned by the server."},
190 { SYBEISRVSCL, EXCONSISTENCY, "Illegal scale value returned by the server."},
191 { SYBEITIM, EXPROGRAM, "Illegal timeout value specified."},
192 { SYBEIVERS, EXPROGRAM, "Illegal version level specified."},
193 { SYBEKBCI, EXINFO, "Bcp: 1000 rows sent to SQL Server."},
194 { SYBEKBCO, EXINFO, "1000 rows successfully bulk-copied to host-file."},
195 { SYBELBLEN, 1, "Security labels should be less than 256 characters long."},
196 { SYBEMEM, EXRESOURCE, "Unable to allocate sufficient memory."},
197 { SYBEMOV, EXUSER, "Money arithmetic resulted in overflow in function %1!."},
198 { SYBEMPLL, EXUSER, "Attempt to set maximum number of DBPROCESSes lower than 1."},
199 { SYBEMVOR, EXPROGRAM, "Month values must be between 1 and 12."},
200 { SYBENBUF, EXINFO, "called dbsendpassthru() with a NULL buf pointer."},
201 { SYBENBVP, EXPROGRAM, "Cannot pass dbsetnull() a NULL bindval pointer."},
202 { SYBENDC, EXPROGRAM, "Cannot have negative component in date in numeric form."},
203 { SYBENDTP, EXPROGRAM, "Called dbdatecrack() with a NULL datetime parameter."},
204 { SYBENEG, EXCOMM, "Negotiated login attempt failed."},
205 { SYBENEHA, 1, "Called dbreghandle() with a NULL handler parameter."},
206 { SYBENHAN, EXINFO, "called dbrecvpassthru() with a NULL handler parameter."},
207 { SYBENLNL, 1, "Program not linked with specified network library."},
208 { SYBENMOB, EXPROGRAM, "No such member of 'order by' clause."},
209 { SYBENOEV, EXINFO, "dbpoll() cannot be called if registered procedure notifications have been disabled."},
210 { SYBENOTI, 1, "No event handler installed."},
211 { SYBENOVALUE, 1, "Security labels require both a name and a value."},
212 { SYBENPRM, EXPROGRAM, "NULL parameter not allowed for this dboption."},
213 { SYBENSIP, EXPROGRAM, "Negative starting index passed to dbstrcpy()."},
214 { SYBENTLL, EXUSER, "Name too long for loginrec field."},
215 { SYBENTST, 1, "The file being opened must be a stream_lf."},
216 { SYBENTTN, EXPROGRAM, "Attempt to use dbtxtsput() to put a new text-timestamp into a non-existent data row."},
217 { SYBENULL, EXINFO, "NULL DBPROCESS pointer passed to DB-Library."},
218 { SYBENULP, EXPROGRAM, "Called with a NULL parameter."},
219 { SYBENUM, 1, "Incorrect number of arguments given to DB-Library."},
220 { SYBENXID, EXNONFATAL, "The Server did not grant us a distributed-transaction ID."},
221 { SYBEONCE, EXPROGRAM, "Function can be called only once."},
222 { SYBEOOB, EXCOMM, "Error in sending out-of-band data to SQL Server."},
223 { SYBEOPIN, EXNONFATAL, "Could not open interface file."},
224 { SYBEOPNA, EXNONFATAL, "The textimage facility is available only when using a SQL Server whose version number is 4.0 or greater."},
225 { SYBEOPTNO, 1, "Option is not allowed or is unreconized."},
226 { SYBEOREN, EXINFO, "Warning: an out-of-range error-number was encountered in dblib.loc. The maximum permissible error-number is defined as DBERRCOUNT in sybdb.h."},
227 { SYBEORPF, EXUSER, "Attempt to set remote password would overflow the login-record's remote-password field."},
228 { SYBEOSSL, 1, "Operating system login level not in range of Secure SQL Server."},
229 { SYBEPAGE, 1, "wrong resource type or length given for dbpage() operation."},
230 { SYBEPOLL, EXINFO, "Only one dbpoll() can be active at a time."},
231 { SYBEPRTF, EXINFO, "dbtracestring() may only be called from a printfunc()."},
232 { SYBEPWD, EXUSER, "Incorrect password."},
233 { SYBERDCN, EXCONVERSION, "Requested data-conversion does not exist."},
234 { SYBERDNR, EXPROGRAM, "Attempt to retrieve data from a non-existent row."},
235 { SYBEREAD, EXCOMM, "Read from SQL Server failed."},
236 { SYBERESP, EXPROGRAM, "Response function address passed to dbresponse() must be non-NULL."},
237 { SYBERFILE, 1, "Can not open resource file."},
238 { SYBERPCS, EXINFO, "Must call dbrpcinit() before dbrpcparam()."},
239 { SYBERPIL, EXPROGRAM, "It is illegal to pass -1 to dbrpcparam() for the datalen of parameters which are of type SYBCHAR, SYBVARCHAR, SYBBINARY, or SYBVARBINARY."},
240 { SYBERPNA, EXNONFATAL, "The RPC facility is available only when using a SQL Server whose version number is 4.0 or greater."},
241 { SYBERPND, EXPROGRAM, "Attempt to initiate a new SQL Server operation with results pending."},
242 { SYBERPNULL, EXPROGRAM, "value parameter for dbprcparam() can be NULL, only if the datalen parameter is 0."},
243 { SYBERPTXTIM, EXPROGRAM, "RPC parameters cannot be of type TextImage."},
244 { SYBERPUL, EXPROGRAM, "When passing a SYBINTN, SYBDATETIMN, SYBMONEYN, or SYBFLTN parameter via dbrpcparam(), it's necessary to specify the parameter's maximum or actual length, so that DB-Library can recognize it as a SYBINT1, SYBINT2, SYBINT4, SYBMONEY, or SYBMONEY4, etc."},
245 { SYBERTCC, EXPROGRAM, "dbreadtext() may not be used to receive the results of a query which contains a COMPUTE clause."},
246 { SYBERTSC, EXPROGRAM, "dbreadtext() may only be used to receive the results of a query which contains a single result column."},
247 { SYBERTYPE, 1, "Invalid resource type given to DB-Library."},
248 { SYBERXID, EXNONFATAL, "The Server did not recognize our distributed-transaction ID."},
249 { SYBESECURE, EXPROGRAM, "Secure Server function not supported in this version."},
250 { SYBESEFA, EXPROGRAM, "DBSETNOTIFS cannot be called if connections are present."},
251 { SYBESEOF, EXCOMM, "Unexpected EOF from SQL Server."},
252 { SYBESFOV, EXPROGRAM, "dbsafestr() overflowed its destination buffer."},
253 { SYBESLCT, 1, "Could not select or copy field specified."},
254 { SYBESMSG, EXSERVER, "General SQL Server error: Check messages from the SQL Server."},
255 { SYBESOCK, EXCOMM, "Unable to open socket."},
256 { SYBESPID, EXPROGRAM, "Called dbspid() with a NULL dbproc."},
257 { SYBESYNC, EXCOMM, "Read attempted while out of synchronization with SQL Server."},
258 { SYBETEXS, EXINFO, "Called dbmoretext() with a bad size parameter."},
259 { SYBETIME, EXTIME, "SQL Server connection timed out."},
260 { SYBETMCF, EXPROGRAM, "Attempt to install too many custom formats via dbfmtinstall()."},
261 { SYBETMTD, EXPROGRAM, "Attempt to send too much TEXT data via the dbmoretext() call."},
262 { SYBETPAR, EXPROGRAM, "No SYBTEXT or SYBIMAGE parameters were defined."},
263 { SYBETPTN, EXUSER, "Syntax error: only two periods are permitted in table names."},
264 { SYBETRAC, EXINFO, "Attempted to turn off a trace flag that was not on."},
265 { SYBETRAN, EXINFO, "DBPROCESS is being used for another transaction."},
266 { SYBETRAS, EXINFO, "DB-Library internal error - trace structure not found."},
267 { SYBETRSN, EXINFO, "Bad numbytes parameter passed to dbtracestring()."},
268 { SYBETSIT, EXINFO, "Attempt to call dbtsput() with an invalid timestamp."},
269 { SYBETTS, EXUSER, "The table which bulk-copy is attempting to copy to a host-file is shorter than the number of rows which bulk-copy was instructed to skip."},
270 { SYBETYPE, EXINFO, "Invalid argument type given to DB-Library."},
271 { SYBEUACS, 1, "VMS: Unable to assign channel to sys$command."},
272 { SYBEUAVE, 1, "Unable to allocate VMS event flag."},
273 { SYBEUCPT, EXUSER, "Unrecognized custom-format parameter-type encountered in dbstrbuild()."},
274 { SYBEUCRR, EXCONSISTENCY, "Internal software error: Unknown connection result reported by dbpasswd()."},
275 { SYBEUDTY, EXCONSISTENCY, "Unknown datatype encountered."},
276 { SYBEUFDS, EXUSER, "Unrecognized format encountered in dbstrbuild()."},
277 { SYBEUFDT, EXCONSISTENCY, "Unknown fixed-length datatype encountered."},
278 { SYBEUHST, EXUSER, "Unknown host machine name."},
279 { SYBEUMSG, EXCOMM, "Unknown message-id in MSG datastream."},
280 { SYBEUNAM, EXFATAL, "Unable to get current username from operating system."},
281 { SYBEUNOP, EXNONFATAL, "Unknown option passed to dbsetopt()."},
282 { SYBEUNT, EXUSER, "Unknown network type found in interface file."},
283 { SYBEURCI, EXRESOURCE, "Unable to read copyright information from the dblib localization file."},
284 { SYBEUREI, EXRESOURCE, "Unable to read error information from the dblib localization file."},
285 { SYBEUREM, EXRESOURCE, "Unable to read error mnemonic from the dblib localization file."},
286 { SYBEURES, EXRESOURCE, "Unable to read error string from the dblib localization file."},
287 { SYBEURMI, EXRESOURCE, "Unable to read money-format information from the dblib localization file."},
288 { SYBEUSCT, EXCOMM, "Unable to set communications timer."},
289 { SYBEUTDS, EXCOMM, "Unrecognized TDS version received from SQL Server."},
290 { SYBEUVBF, EXPROGRAM, "Attempt to read an unknown version of BCP format-file."},
291 { SYBEUVDT, EXCONSISTENCY, "Unknown variable-length datatype encountered."},
292 { SYBEVDPT, EXUSER, "For bulk copy, all variable-length data must have either a length-prefix or a terminator specified."},
293 { SYBEVMS, 1, "Sendflush: VMS IO error."},
294 { SYBEVOIDRET, 1, "Parameter of type SYBVOID cannot be a return parameter."},
295 { SYBEWAID, EXCONSISTENCY, "DB-LIBRARY internal error: ALTFMT following ALTNAME has wrong id."},
296 { SYBEWRIT, EXCOMM, "Write to SQL Server failed."},
297 { SYBEXOCI, EXNONFATAL, "A character-set translation overflowed its destination buffer while using bcp to copy data from a host-file to the SQL Server."},
298 { SYBEXTDN, EXPROGRAM, "Warning: the xlt_todisp parameter to dbfree_xlate() was NULL. The space associated with the xlt_tosrv parameter has been freed."},
299 { SYBEXTN, EXPROGRAM, "The xlt_todisp and xlt_tosrv parameters to dbfree_xlate() were NULL."},
300 { SYBEXTSN, EXPROGRAM, "Warning: the xlt_tosrv parameter to dbfree_xlate() was NULL. The space associated with the xlt_todisp parameter has been freed."},
301 { SYBEZTXT, EXINFO, "Attempt to send zero length TEXT or IMAGE to dataserver via dbwritetext()."},
302 { 0, 0, "Please add a description for this error to src/tds/error_table.h"}
int _dblib_check_and_handle_interrupt(void *vdbproc)
check interrupts for libtds.
Definition: dbutil.c:192
Definition: sybdb.h:284
RETCODE dbsettime(int seconds)
Set maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4192
RETCODE dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[])
Send chunk of a text/image value to the server.
Definition: dblib.c:6732
DBTYPEINFO * dbcoltypeinfo(DBPROCESS *dbproc, int column)
Get precision and scale information for a regular result column.
Definition: dblib.c:3016
void dbsetifile(char *filename)
set name and location of the interfaces file FreeTDS should use to look up a servername.
Definition: dblib.c:2711
const char * dbversion()
See which version of db-lib is in use.
Definition: dblib.c:6840
TDS_INT quarter
quarter (0-3)
Definition: tds.h:161
Used by tds_datecrack.
Definition: tds.h:159
int dbretlen(DBPROCESS *dbproc, int retnum)
Get size of an output parameter filled by a stored procedure.
Definition: dblib.c:4779
RETCODE dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime)
Break a DBDATETIME value into useful pieces.
Definition: dblib.c:5847
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
void dbclose(DBPROCESS *dbproc)
Close a connection to the server and free associated resources.
Definition: dblib.c:1485
int tds_ctx_ref_count
libTDS context reference counter
Definition: dblib.c:179
RETCODE dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
Subtract two DBMONEY4 values.
Definition: dblib.c:5624
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
Definition: dblib.c:4471
const char * dbacolname(DBPROCESS *dbproc, int computeid, int column)
Return name of a computed result column.
Definition: dblib.c:1898
RETCODE dbmnydec(DBPROCESS *dbproc, DBMONEY *amount)
Subtract $0.0001 from a DBMONEY value.
Definition: dblib.c:5491
int dbnumrets(DBPROCESS *dbproc)
Get count of output parameters filled by a stored procedure.
Definition: dblib.c:4692
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
bool has_status
true is ret_status is valid
Definition: tds.h:1245
RETCODE dbsetversion(DBINT version)
Specify a db-lib version level.
Definition: dblib.c:5976
TDSCONTEXT * tds_ctx
libTDS context
Definition: dblib.c:177
DSTR password
password of account login
Definition: tds.h:535
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3056
int dbnumcompute(DBPROCESS *dbproc)
Get count of COMPUTE clauses for a result set.
Definition: dblib.c:4973
char * dbgetchar(DBPROCESS *dbproc, int pos)
Get address of a position in the command buffer.
Definition: dblib.c:6310
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:2979
DBBOOL dbdead(DBPROCESS *dbproc)
Check if dbproc is an ex-parrot.
Definition: dblib.c:5058
int login_timeout
not used unless positive
Definition: dblib.c:187
Main include file for libtds.
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
BYTE * dbbylist(DBPROCESS *dbproc, int computeid, int *size)
Get bylist for a compute row.
Definition: dblib.c:4999
RETCODE dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator)
Tie a null-indicator to a regular result column.
Definition: dblib.c:2740
TDS_INT day
day of month (1-31)
Definition: tds.h:163
#define is_datetime_type(x)
return true if type is a datetime (but not date or time)
Definition: tds.h:393
char * dbcolsource(DBPROCESS *dbproc, int column)
Get base database column name for a result set column.
Definition: dblib.c:3144
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
RETCODE dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
safely quotes character values in SQL text.
Definition: dblib.c:6386
struct dblib_context DBLIBCONTEXT
Definition: sybdb.h:275
void dbexit()
Close server connections and free all related structures.
Definition: dblib.c:1552
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1258
RETCODE dbaltbind(DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
Bind a compute column to a program variable.
Definition: dblib.c:4369
int dbaltcolid(DBPROCESS *dbproc, int computeid, int column)
Get column ID of a compute column.
Definition: dblib.c:4284
Definition: sybdb.h:269
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
Definition: bsqlodbc.c:100
RETCODE dbprrow(DBPROCESS *dbproc)
Print a result set to stdout.
Definition: dblib.c:3540
static TDSCOLUMN * dbcolptr(DBPROCESS *dbproc, int column)
Sanity checks for column-oriented functions.
Definition: dblib.c:331
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
void tds_fix_login(TDSLOGIN *login)
Fix configuration after reading it.
Definition: config.c:285
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:224
STATUS dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize)
Fetch part of a text or image value from the server.
Definition: dblib.c:6663
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:165
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
#define DBDEAD(x)
Sybase macro mapping to the Microsoft (lower-case) function.
Definition: sybdb.h:762
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1243
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
RETCODE dbsqlsend(DBPROCESS *dbproc)
Transmit the command buffer to the server.
Definition: dblib.c:7043
Definition: convert.h:34
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition: dblib.c:5121
BYTE * dbgetuserdata(DBPROCESS *dbproc)
Get address of user-allocated data from a DBPROCESS.
Definition: dblib.c:5958
DBINT dbaltutype(DBPROCESS *dbproc, int computeid, int column)
Get user-defined datatype of a compute column.
Definition: dblib.c:7114
RETCODE dbclropt(DBPROCESS *dbproc, int option, const char param[])
Reset an option.
Definition: dblib.c:6095
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
TDSLOGIN * tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
tds_read_config_info() will fill the tds connection structure based on configuration information gath...
Definition: config.c:138
TDSRET tds_set_interfaces_file_loc(const char *interf)
Set the full name of interface file.
Definition: config.c:961
int dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
Compare two DBMONEY values.
Definition: dblib.c:5266
RETCODE dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
Add two DBMONEY4 values.
Definition: dblib.c:5593
RETCODE dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest)
Zero a DBMONEY4 value.
Definition: dblib.c:5570
DBPROCESS * tdsdbopen(LOGINREC *login, const char *server, int msdblib)
Form a connection with the server.
Definition: dblib.c:1179
RETCODE dbmorecmds(DBPROCESS *dbproc)
See if more commands are to be processed.
Definition: dblib.c:6237
Definition: dbpivot.c:545
RETCODE dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Copy a DBMONEY value.
Definition: dblib.c:6010
RETCODE dbsetlogintime(int seconds)
Set maximum seconds db-lib waits for a server response to a login attempt.
Definition: dblib.c:4239
TDSRET tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2554
Definition: sybdb.h:263
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:129
int dbiowdesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to write data coming to the server....
Definition: dblib.c:7247
RETCODE dbsetlversion(LOGINREC *login, BYTE version)
Set TDS version for future connections.
Definition: dblib.c:947
int dbrettype(DBPROCESS *dbproc, int retnum)
Get datatype of a stored procedure's return parameter.
Definition: dblib.c:6266
static int default_err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
default error handler for db-lib (handles library-generated errors)
Definition: dblib.c:5092
DBINT dbprcollen(DBPROCESS *dbproc, int column)
Get size of a result column needed to print column.
Definition: dblib.c:3192
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition: dblib.c:1694
int dbalttype(DBPROCESS *dbproc, int computeid, int column)
Get datatype for a compute column.
Definition: dblib.c:4340
RETCODE dbsetlbool(LOGINREC *login, int value, int which)
Set a boolean value in a LOGINREC structure.
Definition: dblib.c:896
Definition: proto.h:50
RETCODE dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Negate a DBMONEY value.
Definition: dblib.c:5519
char * dbchange(DBPROCESS *dbproc)
See if a command caused the current database to change.
Definition: dblib.c:6987
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:164
RETCODE dbmnyinc(DBPROCESS *dbproc, DBMONEY *amount)
Add $0.0001 to a DBMONEY value.
Definition: dblib.c:5463
char * dbretname(DBPROCESS *dbproc, int retnum)
Get name of an output parameter filled by a stored procedure.
Definition: dblib.c:4724
void dbsetavail(DBPROCESS *dbproc)
Mark a DBPROCESS as "available".
Definition: dblib.c:7275
DBINT dbvarylen(DBPROCESS *dbproc, int column)
Determine whether a column can vary in size.
Definition: dblib.c:3218
void dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr)
Associate client-allocated (and defined) data with a DBPROCESS.
Definition: dblib.c:5940
RETCODE dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
Break any kind of date or time value into useful pieces.
Definition: dblib.c:5868
void dbprhead(DBPROCESS *dbproc)
Print result set headings to stdout.
Definition: dblib.c:3959
Definition: tds.h:876
static const char * tds_prdatatype(int datatype_token)
Returns type in string.
Definition: dblib.c:7350
RETCODE dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol)
Get a bunch of column attributes with a single call (Microsoft-compatibility feature).
Definition: dblib.c:3045
Definition: bsqldb.c:80
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
Metadata about columns in regular and compute rows.
Definition: tds.h:689
RETCODE dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print a regular result row to a buffer.
Definition: dblib.c:3457
Definition: sybdb.h:342
DBINT dbretstatus(DBPROCESS *dbproc)
Fetch status value returned by query or remote procedure call.
Definition: dblib.c:4674
#define DBVERSION_UNKNOWN
DBVERSION_xxx are used with dbsetversion()
Definition: sybdb.h:70
static BYTE * _dbcoldata(TDSCOLUMN *colinfo)
Return data from a column.
Definition: dblib.c:3368
int dbiordesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to read data coming from the server....
Definition: dblib.c:7231
void dbclrbuf(DBPROCESS *dbproc, DBINT n)
Clear n rows from the row buffer.
Definition: dblib.c:2844
RETCODE dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
Negate a DBMONEY4 value.
Definition: dblib.c:5546
int dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
Compare DBDATETIME values, similar to strcmp(3).
Definition: dblib.c:5765
RETCODE dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *amount)
Get maximum negative DBMONEY value supported.
Definition: dblib.c:5366
const char * dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
Get name of a month, in some human language.
Definition: dblib.c:6958
RETCODE dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
Get formatted string for underlining dbsprhead() column names.
Definition: dblib.c:3837
TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
Send some data in the writetext request started by tds_writetext_start.
Definition: bulk.c:1185
DBINT dblastrow(DBPROCESS *dbproc)
Get number of the last row in the row buffer.
Definition: dblib.c:7207
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition: dblib.c:1373
RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val)
Pivot the rows, creating a new resultset.
Definition: dbpivot.c:914
int query_timeout
not used unless positive
Definition: dblib.c:188
RETCODE dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *amount)
Get maximum positive DBMONEY value supported.
Definition: dblib.c:5345
int dbcolutype(DBPROCESS *dbproc, int column)
Get user-defined datatype of a regular result column.
Definition: dblib.c:2993
STATUS dbsetrow(DBPROCESS *dbproc, DBINT row)
Make a buffered row "current" without fetching it into bound variables.
Definition: dblib.c:2045
int ref_count
reference count, time dbinit called
Definition: dblib.c:174
Definition: proto.h:45
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3159
RETCODE dbcancel(DBPROCESS *dbproc)
Cancel the current command batch.
Definition: dblib.c:3394
Definition: sybdb.h:506
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
Information about blobs (e.g.
Definition: tds.h:593
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition: dblib.c:6447
STATUS dbrowtype(DBPROCESS *dbproc)
Get returned row's type.
Definition: dblib.c:6203
RETCODE dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
Tie a host variable to a resultset column.
Definition: dblib.c:2634
int dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
Compare two DBMONEY4 values.
Definition: dblib.c:5712
Definition: sybdb.h:290
TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
Start writing writetext request.
Definition: bulk.c:1147
int dbspid(DBPROCESS *dbproc)
Get server process ID for a DBPROCESS.
Definition: dblib.c:5920
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
TDS_INT hour
0-23
Definition: tds.h:166
NULLREP nullreps[MAXBINDTYPES]
default null values
Definition: dblib.h:159
RETCODE dbsqlok(DBPROCESS *dbproc)
Wait for results of a query from the server.
Definition: dblib.c:4814
int dbgettime(void)
Get maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4223
RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE *varaddr)
Definition: dblib.c:529
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
DBPROCESS * dbopen(LOGINREC *login, const char *server)
Normally not used.
Definition: dbopen.c:36
int dbgetpacket(DBPROCESS *dbproc)
Get TDS packet size for the connection.
Definition: dblib.c:4075
TDS_INT month
month number (0-11)
Definition: tds.h:162
DBBINARY * dbtxptr(DBPROCESS *dbproc, int column)
Get text pointer for a column in the current row.
Definition: dblib.c:6557
RETCODE dbsetmaxprocs(int maxprocs)
Set maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:4099
TDS_INT second
0-59
Definition: tds.h:168
Definition: dbpivot.c:772
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
Definition: dblib.h:117
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition: dblib.c:2970
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
DBINT dbdatlen(DBPROCESS *dbproc, int column)
Get size of current row's data in a regular result column.
Definition: dblib.c:3324
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
DBBOOL dbhasretstat(DBPROCESS *dbproc)
Determine if query generated a return status number.
Definition: dblib.c:4650
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1250
RETCODE dbanullbind(DBPROCESS *dbproc, int computeid, int column, DBINT *indicator)
Tie a null-indicator to a compute result column.
Definition: dblib.c:2776
RETCODE dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)
Definition: dblib.c:6464
RETCODE dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest)
Set a DBMONEY value to zero.
Definition: dblib.c:5324
TDS_INT timezone
-840 - 840 minutes from UTC
Definition: tds.h:170
DBINT dbcollen(DBPROCESS *dbproc, int column)
Get size of a regular result column.
Definition: dblib.c:3169
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition: dblib.c:5140
RETCODE dbinit(void)
Initialize db-lib.
Definition: dblib.c:660
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition: dblib.c:1419
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
DBINT dbconvert_ps(DBPROCESS *dbproc, int db_srctype, const BYTE *src, DBINT srclen, int db_desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
Convert one datatype to another.
Definition: dblib.c:2300
Primary include file for db-lib applications.
DBINT dbcurrow(DBPROCESS *dbproc)
Get number of the row currently being read.
Definition: dblib.c:6186
Definition: dblib.c:7738
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
BYTE * dbadata(DBPROCESS *dbproc, int computeid, int column)
Get address of compute column data.
Definition: dblib.c:4415
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:7007
RETCODE dbfcmd(DBPROCESS *dbproc, const char *fmt,...)
printf-like way to form SQL to send to the server.
Definition: dblib.c:1334
char * dbservcharset(DBPROCESS *dbproc)
Get syscharset name of the server character set.
Definition: dblib.c:7023
TDS_INT year
year
Definition: tds.h:160
RETCODE dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
Build a printable string from text containing placeholders for variables.
Definition: dblib.c:7300
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
Definition: sybdb.h:374
BOOL dbiscount(DBPROCESS *dbproc)
Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature).
Definition: dblib.c:2804
int dbnumalts(DBPROCESS *dbproc, int computeid)
Get count of columns in a compute row.
Definition: dblib.c:4940
#define DBTDS_UNKNOWN
DBTDS_xxx are returned by DBTDS() The integer values of the constants are poorly chosen.
Definition: sybdb.h:88
DBINT dbfirstrow(DBPROCESS *dbproc)
See if a server response has arrived.
Definition: dblib.c:7192
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
Definition: dbpivot.c:713
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
Definition: dblib.h:110
RETCODE dbrows(DBPROCESS *dbproc)
Indicate whether a query returned rows.
Definition: dblib.c:4034
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
RETCODE dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
Definition: dblib.c:1445
DSTR user_name
account for login
Definition: tds.h:534
int dbtds(DBPROCESS *dbproc)
Get the TDS version in use for dbproc.
Definition: dblib.c:6801
static RETCODE _dbresults(DBPROCESS *dbproc)
Definition: dblib.c:1703
void dbrecftos(const char filename[])
Record to a file all SQL commands sent to the server.
Definition: dblib.c:6767
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
Definition: dblib.c:1872
DBINT dbaltlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in compute column.
Definition: dblib.c:7137
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1202
Definition: sybdb.h:301
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
BYTE * dbretdata(DBPROCESS *dbproc, int retnum)
Get value of an output parameter filled by a stored procedure.
Definition: dblib.c:4753
Definition: proto.h:33
Definition: dblib.c:172
DBBINARY * dbtxtimestamp(DBPROCESS *dbproc, int column)
Get text timestamp for a column in the current row.
Definition: dblib.c:6527
Definition: sybdb.h:474
void dbloginfree(LOGINREC *login)
free the LOGINREC
Definition: dblib.c:737
Definition: dblib.h:52
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
RETCODE dbsetlname(LOGINREC *login, const char *value, int which)
Set the value of a string in a LOGINREC structure.
Definition: dblib.c:759
Definition: dbpivot.c:1275
Definition: sybdb.h:355
int dbcurcmd(DBPROCESS *dbproc)
Get number of the row just returned.
Definition: dblib.c:6220
Information for a server connection.
Definition: tds.h:1163
Definition: dblib.h:123
RETCODE dbcmdrow(DBPROCESS *dbproc)
See if the current command can return rows.
Definition: dblib.c:4260
DBINT dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
cf.
Definition: dblib.c:2593
DBINT dbcount(DBPROCESS *dbproc)
Get count of rows processed.
Definition: dblib.c:2824
struct _dblib_error_message DBLIB_ERROR_MESSAGE
Definition: proto.h:56
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
Definition: dblib.c:1848
TDS_INT minute
0-59
Definition: tds.h:167
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
BYTE * dbdata(DBPROCESS *dbproc, int column)
Get address of data in a regular result column.
Definition: dblib.c:3352
RETCODE dbsetnull(DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval)
Define substitution values to be used when binding null values.
Definition: dblib.c:1962
int msdblib
boolean use ms behaviour
Definition: dblib.h:154
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
TDSRET tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
Return declaration for column (like "varchar(20)").
Definition: query.c:718
RETCODE dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print result set headings to a buffer.
Definition: dblib.c:3895
RETCODE dbmny4copy(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
Copy a DBMONEY4 value.
Definition: dblib.c:5740
int dbstrlen(DBPROCESS *dbproc)
Get size of the command buffer, in bytes.
Definition: dblib.c:6291
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
Definition: sybdb.h:336
DBBOOL dbwillconvert(int srctype, int desttype)
Test whether or not a datatype can be converted to another datatype.
Definition: dblib.c:2874
RETCODE dbgetrow(DBPROCESS *dbproc, DBINT row)
Read a row from the row buffer.
Definition: dblib.c:1930
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
int block_size
packet size (512-65535)
Definition: tds.h:965
Definition: dbpivot.c:77
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
Definition: sybdb.h:295
Definition: tds.h:1029
void dbfreebuf(DBPROCESS *dbproc)
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
Definition: dblib.c:6060
DBINT dbspr1rowlen(DBPROCESS *dbproc)
Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(),...
Definition: dblib.c:3419
DBINT dbadlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in a compute column.
Definition: dblib.c:4310
Definition: proto.h:26
DBBOOL dbisopt(DBPROCESS *dbproc, int option, const char param[])
Get value of an option.
Definition: dblib.c:6163
RETCODE dbsetllong(LOGINREC *login, long value, int which)
Set an integer value in a LOGINREC structure.
Definition: dblib.c:825
RETCODE dbcanquery(DBPROCESS *dbproc)
Cancel the query currently being retrieved, discarding all pending rows.
Definition: dblib.c:6031
void dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
Set interrupt handler for db-lib to use while blocked against a read from the server.
Definition: dblib.c:4631
Definition: tds.h:517
RETCODE dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest)
Get a copy of a chunk of the command buffer.
Definition: dblib.c:6342
@ TDS_DONE_MORE_RESULTS
more results follow
Definition: tds.h:252
int dbaltop(DBPROCESS *dbproc, int computeid, int column)
Get aggregation operator for a compute column.
Definition: dblib.c:4444
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition: dblib.c:705
RETCODE dbwritetext(DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text)
Send text or image data to the server.
Definition: dblib.c:6594
int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...)
Call client-installed error handler.
Definition: dblib.c:8127
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3093
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
int dbgetmaxprocs(void)
get maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:4171
freetds-1.3.6/doc/reference/a00113_source.html000644 025423 025423 00000144552 14162303414 022372 0ustar00fredianofrediano000000 000000 FreeTDS API: src/odbc/error_export.h Source File
FreeTDS API
error_export.h
1 #undef tdsdump_log
2 
3 #ifdef ENABLE_ODBC_WIDE
4 static SQLRETURN _SQLGetDiagRec(SQLSMALLINT handleType,
5  SQLHANDLE handle,
6  SQLSMALLINT numRecord,
7  ODBC_CHAR * szSqlStat,
8  SQLINTEGER * pfNativeError,
9  ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
10 
11 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRecW(
12  SQLSMALLINT handleType,
13  SQLHANDLE handle,
14  SQLSMALLINT numRecord,
15  SQLWCHAR * szSqlStat,
16  SQLINTEGER * pfNativeError,
17  SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
18 {
19  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRecW(%d, %p, %d, %p, %p, %p, %d, %p)\n",
20  (int) handleType,
21  handle,
22  (int) numRecord,
23  szSqlStat,
24  pfNativeError,
25  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
26  return _SQLGetDiagRec(handleType,
27  handle,
28  numRecord,
29  (ODBC_CHAR*) szSqlStat,
30  pfNativeError,
31  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
32 }
33 #endif
34 
35 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRec(
36  SQLSMALLINT handleType,
37  SQLHANDLE handle,
38  SQLSMALLINT numRecord,
39  SQLCHAR * szSqlStat,
40  SQLINTEGER * pfNativeError,
41  SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
42 {
43  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n",
44  (int) handleType,
45  handle,
46  (int) numRecord,
47  szSqlStat,
48  pfNativeError,
49  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
50 #ifdef ENABLE_ODBC_WIDE
51  return _SQLGetDiagRec(handleType,
52  handle,
53  numRecord,
54  (ODBC_CHAR*) szSqlStat,
55  pfNativeError,
56  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
57 #else
58  return _SQLGetDiagRec(handleType,
59  handle,
60  numRecord,
61  szSqlStat,
62  pfNativeError,
63  szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
64 #endif
65 }
66 
67 #ifdef ENABLE_ODBC_WIDE
68 static SQLRETURN _SQLError(SQLHENV henv,
69  SQLHDBC hdbc,
70  SQLHSTMT hstmt,
71  ODBC_CHAR * szSqlStat,
72  SQLINTEGER * pfNativeError,
73  ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide);
74 
75 SQLRETURN ODBC_PUBLIC ODBC_API SQLErrorW(
76  SQLHENV henv,
77  SQLHDBC hdbc,
78  SQLHSTMT hstmt,
79  SQLWCHAR * szSqlStat,
80  SQLINTEGER * pfNativeError,
81  SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
82 {
83  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLErrorW(%p, %p, %p, %p, %p, %p, %d, %p)\n",
84  henv,
85  hdbc,
86  hstmt,
87  szSqlStat,
88  pfNativeError,
89  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
90  return _SQLError(henv,
91  hdbc,
92  hstmt,
93  (ODBC_CHAR*) szSqlStat,
94  pfNativeError,
95  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1);
96 }
97 #endif
98 
99 SQLRETURN ODBC_PUBLIC ODBC_API SQLError(
100  SQLHENV henv,
101  SQLHDBC hdbc,
102  SQLHSTMT hstmt,
103  SQLCHAR * szSqlStat,
104  SQLINTEGER * pfNativeError,
105  SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg)
106 {
107  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLError(%p, %p, %p, %p, %p, %p, %d, %p)\n",
108  henv,
109  hdbc,
110  hstmt,
111  szSqlStat,
112  pfNativeError,
113  szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg);
114 #ifdef ENABLE_ODBC_WIDE
115  return _SQLError(henv,
116  hdbc,
117  hstmt,
118  (ODBC_CHAR*) szSqlStat,
119  pfNativeError,
120  (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0);
121 #else
122  return _SQLError(henv,
123  hdbc,
124  hstmt,
125  szSqlStat,
126  pfNativeError,
127  szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
128 #endif
129 }
130 
131 #ifdef ENABLE_ODBC_WIDE
132 static SQLRETURN _SQLGetDiagField(SQLSMALLINT handleType,
133  SQLHANDLE handle,
134  SQLSMALLINT numRecord,
135  SQLSMALLINT diagIdentifier,
136  SQLPOINTER buffer,
137  SQLSMALLINT cbBuffer,
138  SQLSMALLINT * pcbBuffer, int wide);
139 
140 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagFieldW(
141  SQLSMALLINT handleType,
142  SQLHANDLE handle,
143  SQLSMALLINT numRecord,
144  SQLSMALLINT diagIdentifier,
145  SQLPOINTER buffer,
146  SQLSMALLINT cbBuffer,
147  SQLSMALLINT * pcbBuffer)
148 {
149  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagFieldW(%d, %p, %d, %d, %p, %d, %p)\n",
150  (int) handleType,
151  handle,
152  (int) numRecord,
153  (int) diagIdentifier,
154  buffer,
155  (int) cbBuffer,
156  pcbBuffer);
157  return _SQLGetDiagField(handleType,
158  handle,
159  numRecord,
160  diagIdentifier,
161  buffer,
162  cbBuffer,
163  pcbBuffer, 1);
164 }
165 #endif
166 
167 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagField(
168  SQLSMALLINT handleType,
169  SQLHANDLE handle,
170  SQLSMALLINT numRecord,
171  SQLSMALLINT diagIdentifier,
172  SQLPOINTER buffer,
173  SQLSMALLINT cbBuffer,
174  SQLSMALLINT * pcbBuffer)
175 {
176  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagField(%d, %p, %d, %d, %p, %d, %p)\n",
177  (int) handleType,
178  handle,
179  (int) numRecord,
180  (int) diagIdentifier,
181  buffer,
182  (int) cbBuffer,
183  pcbBuffer);
184 #ifdef ENABLE_ODBC_WIDE
185  return _SQLGetDiagField(handleType,
186  handle,
187  numRecord,
188  diagIdentifier,
189  buffer,
190  cbBuffer,
191  pcbBuffer, 0);
192 #else
193  return _SQLGetDiagField(handleType,
194  handle,
195  numRecord,
196  diagIdentifier,
197  buffer,
198  cbBuffer,
199  pcbBuffer);
200 #endif
201 }
202 
203 #define tdsdump_log TDSDUMP_LOG_FAST
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
RETCODE dbrpcsend(DBPROCESS *dbproc)
Execute the procedure and free associated memory.
Definition: rpc.c:281
Definition: odbc.h:275
Used by tds_datecrack.
Definition: tds.h:159
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
Definition: odbc.h:163
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
DSTR password
password of account login
Definition: tds.h:535
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:2979
TDS_SERVER_TYPE odbc_c_to_server_type(int c_type)
Pass this an SQL_C_* type and get a SYB* type which most closely corresponds to the SQL_C_* type.
Definition: odbc_util.c:601
Main include file for libtds.
TDS_INT day
day of month (1-31)
Definition: tds.h:163
bool tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
Read a section of configuration file (INI style file)
Definition: config.c:503
Definition: odbc.h:204
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
Definition: sybdb.h:275
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
Definition: bsqlodbc.c:100
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
Definition: convert.h:34
Definition: odbc.h:94
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
RETCODE dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
Initialize a remote procedure call.
Definition: rpc.c:72
Definition: dblib.h:101
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
Store variant informations.
Definition: tds.h:604
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2913
Definition: error.c:168
Definition: odbcss.h:132
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:529
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
Definition: odbc.h:381
Definition: proto.h:62
bool tds_read_conf_file(TDSLOGIN *login, const char *server)
Read configuration info for given server return 0 on error.
Definition: config.c:346
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3159
Information about blobs (e.g.
Definition: tds.h:593
Definition: odbc.h:230
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
TDS_INT hour
0-23
Definition: tds.h:166
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:546
TDS_INT month
month number (0-11)
Definition: tds.h:162
TDS_INT second
0-59
Definition: tds.h:168
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
Primary include file for db-lib applications.
Definition: odbc.h:532
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
TDS_INT year
year
Definition: tds.h:160
Definition: connectparams.c:523
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
int port
port of database service
Definition: tds.h:519
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
DSTR user_name
account for login
Definition: tds.h:534
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:592
TDS_SMALLINT offset
time offset
Definition: tds.h:149
Definition: odbc.h:106
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
Definition: dblib.h:89
RETCODE dbrpcparam(DBPROCESS *dbproc, const char paramname[], BYTE status, int db_type, DBINT maxlen, DBINT datalen, BYTE *value)
Add a parameter to a remote procedure call.
Definition: rpc.c:155
Information for a server connection.
Definition: tds.h:1163
Definition: dblib.h:123
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
TDS_INT minute
0-59
Definition: tds.h:167
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
Definition: odbcss.h:139
Definition: odbc.h:237
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
Definition: tds.h:1029
Definition: proto.h:26
Definition: tds.h:517
Definition: error.c:48
int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...)
Call client-installed error handler.
Definition: dblib.c:8127
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
freetds-1.3.6/doc/reference/a00128_source.html000644 025423 025423 00000654716 14162303415 022411 0ustar00fredianofrediano000000 000000 FreeTDS API: src/odbc/odbc_export.h Source File
FreeTDS API
odbc_export.h
1 #undef tdsdump_log
2 
3 #ifdef ENABLE_ODBC_WIDE
4 static SQLRETURN _SQLDriverConnect(SQLHDBC hdbc,
5  SQLHWND hwnd,
6  ODBC_CHAR * szConnStrIn, SQLSMALLINT cbConnStrIn,
7  ODBC_CHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut,
8  SQLUSMALLINT fDriverCompletion, int wide);
9 
10 SQLRETURN ODBC_PUBLIC ODBC_API SQLDriverConnectW(
11  SQLHDBC hdbc,
12  SQLHWND hwnd,
13  SQLWCHAR * szConnStrIn, SQLSMALLINT cbConnStrIn,
14  SQLWCHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut,
15  SQLUSMALLINT fDriverCompletion)
16 {
17  if (TDS_UNLIKELY(tds_write_dump)) {
18  SQLWSTR_BUFS(1);
19  tdsdump_log(TDS_DBG_FUNC, "SQLDriverConnectW(%p, %p, %ls, %d, %p, %d, %p, %u)\n",
20  hdbc,
21  hwnd,
22  SQLWSTR(szConnStrIn), (int) cbConnStrIn,
23  szConnStrOut, (int) cbConnStrOutMax, pcbConnStrOut,
24  (unsigned int) fDriverCompletion);
25  SQLWSTR_FREE();
26  }
27  return _SQLDriverConnect(hdbc,
28  hwnd,
29  (ODBC_CHAR*) szConnStrIn, cbConnStrIn,
30  (ODBC_CHAR*) szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
31  fDriverCompletion, 1);
32 }
33 #endif
34 
35 SQLRETURN ODBC_PUBLIC ODBC_API SQLDriverConnect(
36  SQLHDBC hdbc,
37  SQLHWND hwnd,
38  SQLCHAR * szConnStrIn, SQLSMALLINT cbConnStrIn,
39  SQLCHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut,
40  SQLUSMALLINT fDriverCompletion)
41 {
42  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDriverConnect(%p, %p, %s, %d, %p, %d, %p, %u)\n",
43  hdbc,
44  hwnd,
45  (const char*) szConnStrIn, (int) cbConnStrIn,
46  szConnStrOut, (int) cbConnStrOutMax, pcbConnStrOut,
47  (unsigned int) fDriverCompletion);
48 #ifdef ENABLE_ODBC_WIDE
49  return _SQLDriverConnect(hdbc,
50  hwnd,
51  (ODBC_CHAR*) szConnStrIn, cbConnStrIn,
52  (ODBC_CHAR*) szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
53  fDriverCompletion, 0);
54 #else
55  return _SQLDriverConnect(hdbc,
56  hwnd,
57  szConnStrIn, cbConnStrIn,
58  szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
59  fDriverCompletion);
60 #endif
61 }
62 
63 #ifdef ENABLE_ODBC_WIDE
64 static SQLRETURN _SQLColumnPrivileges(SQLHSTMT hstmt,
65  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
66  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
67  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
68  ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide);
69 
70 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnPrivilegesW(
71  SQLHSTMT hstmt,
72  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
73  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
74  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
75  SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName)
76 {
77  if (TDS_UNLIKELY(tds_write_dump)) {
78  SQLWSTR_BUFS(4);
79  tdsdump_log(TDS_DBG_FUNC, "SQLColumnPrivilegesW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
80  hstmt,
81  SQLWSTR(szCatalogName), (int) cbCatalogName,
82  SQLWSTR(szSchemaName), (int) cbSchemaName,
83  SQLWSTR(szTableName), (int) cbTableName,
84  SQLWSTR(szColumnName), (int) cbColumnName);
85  SQLWSTR_FREE();
86  }
87  return _SQLColumnPrivileges(hstmt,
88  (ODBC_CHAR*) szCatalogName, cbCatalogName,
89  (ODBC_CHAR*) szSchemaName, cbSchemaName,
90  (ODBC_CHAR*) szTableName, cbTableName,
91  (ODBC_CHAR*) szColumnName, cbColumnName, 1);
92 }
93 #endif
94 
95 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnPrivileges(
96  SQLHSTMT hstmt,
97  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
98  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
99  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
100  SQLCHAR * szColumnName, SQLSMALLINT cbColumnName)
101 {
102  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLColumnPrivileges(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
103  hstmt,
104  (const char*) szCatalogName, (int) cbCatalogName,
105  (const char*) szSchemaName, (int) cbSchemaName,
106  (const char*) szTableName, (int) cbTableName,
107  (const char*) szColumnName, (int) cbColumnName);
108 #ifdef ENABLE_ODBC_WIDE
109  return _SQLColumnPrivileges(hstmt,
110  (ODBC_CHAR*) szCatalogName, cbCatalogName,
111  (ODBC_CHAR*) szSchemaName, cbSchemaName,
112  (ODBC_CHAR*) szTableName, cbTableName,
113  (ODBC_CHAR*) szColumnName, cbColumnName, 0);
114 #else
115  return _SQLColumnPrivileges(hstmt,
116  szCatalogName, cbCatalogName,
117  szSchemaName, cbSchemaName,
118  szTableName, cbTableName,
119  szColumnName, cbColumnName);
120 #endif
121 }
122 
123 #ifdef ENABLE_ODBC_WIDE
124 static SQLRETURN _SQLForeignKeys(SQLHSTMT hstmt,
125  ODBC_CHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName,
126  ODBC_CHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName,
127  ODBC_CHAR * szPkTableName, SQLSMALLINT cbPkTableName,
128  ODBC_CHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName,
129  ODBC_CHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName,
130  ODBC_CHAR * szFkTableName, SQLSMALLINT cbFkTableName, int wide);
131 
132 SQLRETURN ODBC_PUBLIC ODBC_API SQLForeignKeysW(
133  SQLHSTMT hstmt,
134  SQLWCHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName,
135  SQLWCHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName,
136  SQLWCHAR * szPkTableName, SQLSMALLINT cbPkTableName,
137  SQLWCHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName,
138  SQLWCHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName,
139  SQLWCHAR * szFkTableName, SQLSMALLINT cbFkTableName)
140 {
141  if (TDS_UNLIKELY(tds_write_dump)) {
142  SQLWSTR_BUFS(6);
143  tdsdump_log(TDS_DBG_FUNC, "SQLForeignKeysW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
144  hstmt,
145  SQLWSTR(szPkCatalogName), (int) cbPkCatalogName,
146  SQLWSTR(szPkSchemaName), (int) cbPkSchemaName,
147  SQLWSTR(szPkTableName), (int) cbPkTableName,
148  SQLWSTR(szFkCatalogName), (int) cbFkCatalogName,
149  SQLWSTR(szFkSchemaName), (int) cbFkSchemaName,
150  SQLWSTR(szFkTableName), (int) cbFkTableName);
151  SQLWSTR_FREE();
152  }
153  return _SQLForeignKeys(hstmt,
154  (ODBC_CHAR*) szPkCatalogName, cbPkCatalogName,
155  (ODBC_CHAR*) szPkSchemaName, cbPkSchemaName,
156  (ODBC_CHAR*) szPkTableName, cbPkTableName,
157  (ODBC_CHAR*) szFkCatalogName, cbFkCatalogName,
158  (ODBC_CHAR*) szFkSchemaName, cbFkSchemaName,
159  (ODBC_CHAR*) szFkTableName, cbFkTableName, 1);
160 }
161 #endif
162 
163 SQLRETURN ODBC_PUBLIC ODBC_API SQLForeignKeys(
164  SQLHSTMT hstmt,
165  SQLCHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName,
166  SQLCHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName,
167  SQLCHAR * szPkTableName, SQLSMALLINT cbPkTableName,
168  SQLCHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName,
169  SQLCHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName,
170  SQLCHAR * szFkTableName, SQLSMALLINT cbFkTableName)
171 {
172  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLForeignKeys(%p, %s, %d, %s, %d, %s, %d, %s, %d, %s, %d, %s, %d)\n",
173  hstmt,
174  (const char*) szPkCatalogName, (int) cbPkCatalogName,
175  (const char*) szPkSchemaName, (int) cbPkSchemaName,
176  (const char*) szPkTableName, (int) cbPkTableName,
177  (const char*) szFkCatalogName, (int) cbFkCatalogName,
178  (const char*) szFkSchemaName, (int) cbFkSchemaName,
179  (const char*) szFkTableName, (int) cbFkTableName);
180 #ifdef ENABLE_ODBC_WIDE
181  return _SQLForeignKeys(hstmt,
182  (ODBC_CHAR*) szPkCatalogName, cbPkCatalogName,
183  (ODBC_CHAR*) szPkSchemaName, cbPkSchemaName,
184  (ODBC_CHAR*) szPkTableName, cbPkTableName,
185  (ODBC_CHAR*) szFkCatalogName, cbFkCatalogName,
186  (ODBC_CHAR*) szFkSchemaName, cbFkSchemaName,
187  (ODBC_CHAR*) szFkTableName, cbFkTableName, 0);
188 #else
189  return _SQLForeignKeys(hstmt,
190  szPkCatalogName, cbPkCatalogName,
191  szPkSchemaName, cbPkSchemaName,
192  szPkTableName, cbPkTableName,
193  szFkCatalogName, cbFkCatalogName,
194  szFkSchemaName, cbFkSchemaName,
195  szFkTableName, cbFkTableName);
196 #endif
197 }
198 
199 #ifdef ENABLE_ODBC_WIDE
200 static SQLRETURN _SQLNativeSql(SQLHDBC hdbc,
201  ODBC_CHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn,
202  ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr, int wide);
203 
204 SQLRETURN ODBC_PUBLIC ODBC_API SQLNativeSqlW(
205  SQLHDBC hdbc,
206  SQLWCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn,
207  SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr)
208 {
209  if (TDS_UNLIKELY(tds_write_dump)) {
210  SQLWSTR_BUFS(1);
211  tdsdump_log(TDS_DBG_FUNC, "SQLNativeSqlW(%p, %ls, %d, %p, %d, %p)\n",
212  hdbc,
213  SQLWSTR(szSqlStrIn), (int) cbSqlStrIn,
214  szSqlStr, (int) cbSqlStrMax, pcbSqlStr);
215  SQLWSTR_FREE();
216  }
217  return _SQLNativeSql(hdbc,
218  (ODBC_CHAR*) szSqlStrIn, cbSqlStrIn,
219  (ODBC_CHAR*) szSqlStr, cbSqlStrMax, pcbSqlStr, 1);
220 }
221 #endif
222 
223 SQLRETURN ODBC_PUBLIC ODBC_API SQLNativeSql(
224  SQLHDBC hdbc,
225  SQLCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn,
226  SQLCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr)
227 {
228  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLNativeSql(%p, %s, %d, %p, %d, %p)\n",
229  hdbc,
230  (const char*) szSqlStrIn, (int) cbSqlStrIn,
231  szSqlStr, (int) cbSqlStrMax, pcbSqlStr);
232 #ifdef ENABLE_ODBC_WIDE
233  return _SQLNativeSql(hdbc,
234  (ODBC_CHAR*) szSqlStrIn, cbSqlStrIn,
235  (ODBC_CHAR*) szSqlStr, cbSqlStrMax, pcbSqlStr, 0);
236 #else
237  return _SQLNativeSql(hdbc,
238  szSqlStrIn, cbSqlStrIn,
239  szSqlStr, cbSqlStrMax, pcbSqlStr);
240 #endif
241 }
242 
243 #ifdef ENABLE_ODBC_WIDE
244 static SQLRETURN _SQLPrimaryKeys(SQLHSTMT hstmt,
245  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
246  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
247  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, int wide);
248 
249 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrimaryKeysW(
250  SQLHSTMT hstmt,
251  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
252  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
253  SQLWCHAR * szTableName, SQLSMALLINT cbTableName)
254 {
255  if (TDS_UNLIKELY(tds_write_dump)) {
256  SQLWSTR_BUFS(3);
257  tdsdump_log(TDS_DBG_FUNC, "SQLPrimaryKeysW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
258  hstmt,
259  SQLWSTR(szCatalogName), (int) cbCatalogName,
260  SQLWSTR(szSchemaName), (int) cbSchemaName,
261  SQLWSTR(szTableName), (int) cbTableName);
262  SQLWSTR_FREE();
263  }
264  return _SQLPrimaryKeys(hstmt,
265  (ODBC_CHAR*) szCatalogName, cbCatalogName,
266  (ODBC_CHAR*) szSchemaName, cbSchemaName,
267  (ODBC_CHAR*) szTableName, cbTableName, 1);
268 }
269 #endif
270 
271 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrimaryKeys(
272  SQLHSTMT hstmt,
273  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
274  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
275  SQLCHAR * szTableName, SQLSMALLINT cbTableName)
276 {
277  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLPrimaryKeys(%p, %s, %d, %s, %d, %s, %d)\n",
278  hstmt,
279  (const char*) szCatalogName, (int) cbCatalogName,
280  (const char*) szSchemaName, (int) cbSchemaName,
281  (const char*) szTableName, (int) cbTableName);
282 #ifdef ENABLE_ODBC_WIDE
283  return _SQLPrimaryKeys(hstmt,
284  (ODBC_CHAR*) szCatalogName, cbCatalogName,
285  (ODBC_CHAR*) szSchemaName, cbSchemaName,
286  (ODBC_CHAR*) szTableName, cbTableName, 0);
287 #else
288  return _SQLPrimaryKeys(hstmt,
289  szCatalogName, cbCatalogName,
290  szSchemaName, cbSchemaName,
291  szTableName, cbTableName);
292 #endif
293 }
294 
295 #ifdef ENABLE_ODBC_WIDE
296 static SQLRETURN _SQLProcedureColumns(SQLHSTMT hstmt,
297  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
298  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
299  ODBC_CHAR * szProcName, SQLSMALLINT cbProcName,
300  ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide);
301 
302 SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedureColumnsW(
303  SQLHSTMT hstmt,
304  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
305  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
306  SQLWCHAR * szProcName, SQLSMALLINT cbProcName,
307  SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName)
308 {
309  if (TDS_UNLIKELY(tds_write_dump)) {
310  SQLWSTR_BUFS(4);
311  tdsdump_log(TDS_DBG_FUNC, "SQLProcedureColumnsW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
312  hstmt,
313  SQLWSTR(szCatalogName), (int) cbCatalogName,
314  SQLWSTR(szSchemaName), (int) cbSchemaName,
315  SQLWSTR(szProcName), (int) cbProcName,
316  SQLWSTR(szColumnName), (int) cbColumnName);
317  SQLWSTR_FREE();
318  }
319  return _SQLProcedureColumns(hstmt,
320  (ODBC_CHAR*) szCatalogName, cbCatalogName,
321  (ODBC_CHAR*) szSchemaName, cbSchemaName,
322  (ODBC_CHAR*) szProcName, cbProcName,
323  (ODBC_CHAR*) szColumnName, cbColumnName, 1);
324 }
325 #endif
326 
327 SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedureColumns(
328  SQLHSTMT hstmt,
329  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
330  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
331  SQLCHAR * szProcName, SQLSMALLINT cbProcName,
332  SQLCHAR * szColumnName, SQLSMALLINT cbColumnName)
333 {
334  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLProcedureColumns(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
335  hstmt,
336  (const char*) szCatalogName, (int) cbCatalogName,
337  (const char*) szSchemaName, (int) cbSchemaName,
338  (const char*) szProcName, (int) cbProcName,
339  (const char*) szColumnName, (int) cbColumnName);
340 #ifdef ENABLE_ODBC_WIDE
341  return _SQLProcedureColumns(hstmt,
342  (ODBC_CHAR*) szCatalogName, cbCatalogName,
343  (ODBC_CHAR*) szSchemaName, cbSchemaName,
344  (ODBC_CHAR*) szProcName, cbProcName,
345  (ODBC_CHAR*) szColumnName, cbColumnName, 0);
346 #else
347  return _SQLProcedureColumns(hstmt,
348  szCatalogName, cbCatalogName,
349  szSchemaName, cbSchemaName,
350  szProcName, cbProcName,
351  szColumnName, cbColumnName);
352 #endif
353 }
354 
355 #ifdef ENABLE_ODBC_WIDE
356 static SQLRETURN _SQLProcedures(SQLHSTMT hstmt,
357  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
358  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
359  ODBC_CHAR * szProcName, SQLSMALLINT cbProcName, int wide);
360 
361 SQLRETURN ODBC_PUBLIC ODBC_API SQLProceduresW(
362  SQLHSTMT hstmt,
363  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
364  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
365  SQLWCHAR * szProcName, SQLSMALLINT cbProcName)
366 {
367  if (TDS_UNLIKELY(tds_write_dump)) {
368  SQLWSTR_BUFS(3);
369  tdsdump_log(TDS_DBG_FUNC, "SQLProceduresW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
370  hstmt,
371  SQLWSTR(szCatalogName), (int) cbCatalogName,
372  SQLWSTR(szSchemaName), (int) cbSchemaName,
373  SQLWSTR(szProcName), (int) cbProcName);
374  SQLWSTR_FREE();
375  }
376  return _SQLProcedures(hstmt,
377  (ODBC_CHAR*) szCatalogName, cbCatalogName,
378  (ODBC_CHAR*) szSchemaName, cbSchemaName,
379  (ODBC_CHAR*) szProcName, cbProcName, 1);
380 }
381 #endif
382 
383 SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedures(
384  SQLHSTMT hstmt,
385  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
386  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
387  SQLCHAR * szProcName, SQLSMALLINT cbProcName)
388 {
389  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLProcedures(%p, %s, %d, %s, %d, %s, %d)\n",
390  hstmt,
391  (const char*) szCatalogName, (int) cbCatalogName,
392  (const char*) szSchemaName, (int) cbSchemaName,
393  (const char*) szProcName, (int) cbProcName);
394 #ifdef ENABLE_ODBC_WIDE
395  return _SQLProcedures(hstmt,
396  (ODBC_CHAR*) szCatalogName, cbCatalogName,
397  (ODBC_CHAR*) szSchemaName, cbSchemaName,
398  (ODBC_CHAR*) szProcName, cbProcName, 0);
399 #else
400  return _SQLProcedures(hstmt,
401  szCatalogName, cbCatalogName,
402  szSchemaName, cbSchemaName,
403  szProcName, cbProcName);
404 #endif
405 }
406 
407 #ifdef ENABLE_ODBC_WIDE
408 static SQLRETURN _SQLTablePrivileges(SQLHSTMT hstmt,
409  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
410  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
411  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, int wide);
412 
413 SQLRETURN ODBC_PUBLIC ODBC_API SQLTablePrivilegesW(
414  SQLHSTMT hstmt,
415  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
416  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
417  SQLWCHAR * szTableName, SQLSMALLINT cbTableName)
418 {
419  if (TDS_UNLIKELY(tds_write_dump)) {
420  SQLWSTR_BUFS(3);
421  tdsdump_log(TDS_DBG_FUNC, "SQLTablePrivilegesW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
422  hstmt,
423  SQLWSTR(szCatalogName), (int) cbCatalogName,
424  SQLWSTR(szSchemaName), (int) cbSchemaName,
425  SQLWSTR(szTableName), (int) cbTableName);
426  SQLWSTR_FREE();
427  }
428  return _SQLTablePrivileges(hstmt,
429  (ODBC_CHAR*) szCatalogName, cbCatalogName,
430  (ODBC_CHAR*) szSchemaName, cbSchemaName,
431  (ODBC_CHAR*) szTableName, cbTableName, 1);
432 }
433 #endif
434 
435 SQLRETURN ODBC_PUBLIC ODBC_API SQLTablePrivileges(
436  SQLHSTMT hstmt,
437  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
438  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
439  SQLCHAR * szTableName, SQLSMALLINT cbTableName)
440 {
441  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLTablePrivileges(%p, %s, %d, %s, %d, %s, %d)\n",
442  hstmt,
443  (const char*) szCatalogName, (int) cbCatalogName,
444  (const char*) szSchemaName, (int) cbSchemaName,
445  (const char*) szTableName, (int) cbTableName);
446 #ifdef ENABLE_ODBC_WIDE
447  return _SQLTablePrivileges(hstmt,
448  (ODBC_CHAR*) szCatalogName, cbCatalogName,
449  (ODBC_CHAR*) szSchemaName, cbSchemaName,
450  (ODBC_CHAR*) szTableName, cbTableName, 0);
451 #else
452  return _SQLTablePrivileges(hstmt,
453  szCatalogName, cbCatalogName,
454  szSchemaName, cbSchemaName,
455  szTableName, cbTableName);
456 #endif
457 }
458 
459 #ifdef ENABLE_ODBC_WIDE
460 static SQLRETURN _SQLConnect(SQLHDBC hdbc,
461  ODBC_CHAR * szDSN, SQLSMALLINT cbDSN,
462  ODBC_CHAR * szUID, SQLSMALLINT cbUID,
463  ODBC_CHAR * szAuthStr, SQLSMALLINT cbAuthStr, int wide);
464 
465 SQLRETURN ODBC_PUBLIC ODBC_API SQLConnectW(
466  SQLHDBC hdbc,
467  SQLWCHAR * szDSN, SQLSMALLINT cbDSN,
468  SQLWCHAR * szUID, SQLSMALLINT cbUID,
469  SQLWCHAR * szAuthStr, SQLSMALLINT cbAuthStr)
470 {
471  if (TDS_UNLIKELY(tds_write_dump)) {
472  SQLWSTR_BUFS(3);
473  tdsdump_log(TDS_DBG_FUNC, "SQLConnectW(%p, %ls, %d, %ls, %d, %ls, %d)\n",
474  hdbc,
475  SQLWSTR(szDSN), (int) cbDSN,
476  SQLWSTR(szUID), (int) cbUID,
477  SQLWSTR(szAuthStr), (int) cbAuthStr);
478  SQLWSTR_FREE();
479  }
480  return _SQLConnect(hdbc,
481  (ODBC_CHAR*) szDSN, cbDSN,
482  (ODBC_CHAR*) szUID, cbUID,
483  (ODBC_CHAR*) szAuthStr, cbAuthStr, 1);
484 }
485 #endif
486 
487 SQLRETURN ODBC_PUBLIC ODBC_API SQLConnect(
488  SQLHDBC hdbc,
489  SQLCHAR * szDSN, SQLSMALLINT cbDSN,
490  SQLCHAR * szUID, SQLSMALLINT cbUID,
491  SQLCHAR * szAuthStr, SQLSMALLINT cbAuthStr)
492 {
493  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLConnect(%p, %s, %d, %s, %d, %s, %d)\n",
494  hdbc,
495  (const char*) szDSN, (int) cbDSN,
496  (const char*) szUID, (int) cbUID,
497  (const char*) szAuthStr, (int) cbAuthStr);
498 #ifdef ENABLE_ODBC_WIDE
499  return _SQLConnect(hdbc,
500  (ODBC_CHAR*) szDSN, cbDSN,
501  (ODBC_CHAR*) szUID, cbUID,
502  (ODBC_CHAR*) szAuthStr, cbAuthStr, 0);
503 #else
504  return _SQLConnect(hdbc,
505  szDSN, cbDSN,
506  szUID, cbUID,
507  szAuthStr, cbAuthStr);
508 #endif
509 }
510 
511 #ifdef ENABLE_ODBC_WIDE
512 static SQLRETURN _SQLDescribeCol(SQLHSTMT hstmt,
513  SQLUSMALLINT icol,
514  ODBC_CHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName,
515  SQLSMALLINT * pfSqlType,
516  SQLULEN * pcbColDef,
517  SQLSMALLINT * pibScale,
518  SQLSMALLINT * pfNullable, int wide);
519 
520 SQLRETURN ODBC_PUBLIC ODBC_API SQLDescribeColW(
521  SQLHSTMT hstmt,
522  SQLUSMALLINT icol,
523  SQLWCHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName,
524  SQLSMALLINT * pfSqlType,
525  SQLULEN * pcbColDef,
526  SQLSMALLINT * pibScale,
527  SQLSMALLINT * pfNullable)
528 {
529  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDescribeColW(%p, %u, %p, %d, %p, %p, %p, %p, %p)\n",
530  hstmt,
531  (unsigned int) icol,
532  szColName, (int) cbColNameMax, pcbColName,
533  pfSqlType,
534  pcbColDef,
535  pibScale,
536  pfNullable);
537  return _SQLDescribeCol(hstmt,
538  icol,
539  (ODBC_CHAR*) szColName, cbColNameMax, pcbColName,
540  pfSqlType,
541  pcbColDef,
542  pibScale,
543  pfNullable, 1);
544 }
545 #endif
546 
547 SQLRETURN ODBC_PUBLIC ODBC_API SQLDescribeCol(
548  SQLHSTMT hstmt,
549  SQLUSMALLINT icol,
550  SQLCHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName,
551  SQLSMALLINT * pfSqlType,
552  SQLULEN * pcbColDef,
553  SQLSMALLINT * pibScale,
554  SQLSMALLINT * pfNullable)
555 {
556  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDescribeCol(%p, %u, %p, %d, %p, %p, %p, %p, %p)\n",
557  hstmt,
558  (unsigned int) icol,
559  szColName, (int) cbColNameMax, pcbColName,
560  pfSqlType,
561  pcbColDef,
562  pibScale,
563  pfNullable);
564 #ifdef ENABLE_ODBC_WIDE
565  return _SQLDescribeCol(hstmt,
566  icol,
567  (ODBC_CHAR*) szColName, cbColNameMax, pcbColName,
568  pfSqlType,
569  pcbColDef,
570  pibScale,
571  pfNullable, 0);
572 #else
573  return _SQLDescribeCol(hstmt,
574  icol,
575  szColName, cbColNameMax, pcbColName,
576  pfSqlType,
577  pcbColDef,
578  pibScale,
579  pfNullable);
580 #endif
581 }
582 
583 #ifdef ENABLE_ODBC_WIDE
584 static SQLRETURN _SQLGetDescRec(SQLHDESC hdesc,
585  SQLSMALLINT RecordNumber,
586  ODBC_CHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName,
587  SQLSMALLINT * Type,
588  SQLSMALLINT * SubType,
589  SQLLEN * Length,
590  SQLSMALLINT * Precision,
591  SQLSMALLINT * Scale,
592  SQLSMALLINT * Nullable, int wide);
593 
594 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescRecW(
595  SQLHDESC hdesc,
596  SQLSMALLINT RecordNumber,
597  SQLWCHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName,
598  SQLSMALLINT * Type,
599  SQLSMALLINT * SubType,
600  SQLLEN * Length,
601  SQLSMALLINT * Precision,
602  SQLSMALLINT * Scale,
603  SQLSMALLINT * Nullable)
604 {
605  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescRecW(%p, %d, %p, %d, %p, %p, %p, %p, %p, %p, %p)\n",
606  hdesc,
607  (int) RecordNumber,
608  szName, (int) cbNameMax, pcbName,
609  Type,
610  SubType,
611  Length,
612  Precision,
613  Scale,
614  Nullable);
615  return _SQLGetDescRec(hdesc,
616  RecordNumber,
617  (ODBC_CHAR*) szName, cbNameMax, pcbName,
618  Type,
619  SubType,
620  Length,
621  Precision,
622  Scale,
623  Nullable, 1);
624 }
625 #endif
626 
627 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescRec(
628  SQLHDESC hdesc,
629  SQLSMALLINT RecordNumber,
630  SQLCHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName,
631  SQLSMALLINT * Type,
632  SQLSMALLINT * SubType,
633  SQLLEN * Length,
634  SQLSMALLINT * Precision,
635  SQLSMALLINT * Scale,
636  SQLSMALLINT * Nullable)
637 {
638  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescRec(%p, %d, %p, %d, %p, %p, %p, %p, %p, %p, %p)\n",
639  hdesc,
640  (int) RecordNumber,
641  szName, (int) cbNameMax, pcbName,
642  Type,
643  SubType,
644  Length,
645  Precision,
646  Scale,
647  Nullable);
648 #ifdef ENABLE_ODBC_WIDE
649  return _SQLGetDescRec(hdesc,
650  RecordNumber,
651  (ODBC_CHAR*) szName, cbNameMax, pcbName,
652  Type,
653  SubType,
654  Length,
655  Precision,
656  Scale,
657  Nullable, 0);
658 #else
659  return _SQLGetDescRec(hdesc,
660  RecordNumber,
661  szName, cbNameMax, pcbName,
662  Type,
663  SubType,
664  Length,
665  Precision,
666  Scale,
667  Nullable);
668 #endif
669 }
670 
671 #ifdef ENABLE_ODBC_WIDE
672 static SQLRETURN _SQLGetDescField(SQLHDESC hdesc,
673  SQLSMALLINT icol,
674  SQLSMALLINT fDescType,
675  SQLPOINTER Value,
676  SQLINTEGER BufferLength,
677  SQLINTEGER * StringLength, int wide);
678 
679 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescFieldW(
680  SQLHDESC hdesc,
681  SQLSMALLINT icol,
682  SQLSMALLINT fDescType,
683  SQLPOINTER Value,
684  SQLINTEGER BufferLength,
685  SQLINTEGER * StringLength)
686 {
687  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescFieldW(%p, %d, %d, %p, %d, %p)\n",
688  hdesc,
689  (int) icol,
690  (int) fDescType,
691  Value,
692  (int) BufferLength,
693  StringLength);
694  return _SQLGetDescField(hdesc,
695  icol,
696  fDescType,
697  Value,
698  BufferLength,
699  StringLength, 1);
700 }
701 #endif
702 
703 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescField(
704  SQLHDESC hdesc,
705  SQLSMALLINT icol,
706  SQLSMALLINT fDescType,
707  SQLPOINTER Value,
708  SQLINTEGER BufferLength,
709  SQLINTEGER * StringLength)
710 {
711  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescField(%p, %d, %d, %p, %d, %p)\n",
712  hdesc,
713  (int) icol,
714  (int) fDescType,
715  Value,
716  (int) BufferLength,
717  StringLength);
718 #ifdef ENABLE_ODBC_WIDE
719  return _SQLGetDescField(hdesc,
720  icol,
721  fDescType,
722  Value,
723  BufferLength,
724  StringLength, 0);
725 #else
726  return _SQLGetDescField(hdesc,
727  icol,
728  fDescType,
729  Value,
730  BufferLength,
731  StringLength);
732 #endif
733 }
734 
735 #ifdef ENABLE_ODBC_WIDE
736 static SQLRETURN _SQLSetDescField(SQLHDESC hdesc,
737  SQLSMALLINT icol,
738  SQLSMALLINT fDescType,
739  SQLPOINTER Value,
740  SQLINTEGER BufferLength, int wide);
741 
742 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetDescFieldW(
743  SQLHDESC hdesc,
744  SQLSMALLINT icol,
745  SQLSMALLINT fDescType,
746  SQLPOINTER Value,
747  SQLINTEGER BufferLength)
748 {
749  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetDescFieldW(%p, %d, %d, %p, %d)\n",
750  hdesc,
751  (int) icol,
752  (int) fDescType,
753  Value,
754  (int) BufferLength);
755  return _SQLSetDescField(hdesc,
756  icol,
757  fDescType,
758  Value,
759  BufferLength, 1);
760 }
761 #endif
762 
763 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetDescField(
764  SQLHDESC hdesc,
765  SQLSMALLINT icol,
766  SQLSMALLINT fDescType,
767  SQLPOINTER Value,
768  SQLINTEGER BufferLength)
769 {
770  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetDescField(%p, %d, %d, %p, %d)\n",
771  hdesc,
772  (int) icol,
773  (int) fDescType,
774  Value,
775  (int) BufferLength);
776 #ifdef ENABLE_ODBC_WIDE
777  return _SQLSetDescField(hdesc,
778  icol,
779  fDescType,
780  Value,
781  BufferLength, 0);
782 #else
783  return _SQLSetDescField(hdesc,
784  icol,
785  fDescType,
786  Value,
787  BufferLength);
788 #endif
789 }
790 
791 #ifdef ENABLE_ODBC_WIDE
792 static SQLRETURN _SQLExecDirect(SQLHSTMT hstmt,
793  ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStr, int wide);
794 
795 SQLRETURN ODBC_PUBLIC ODBC_API SQLExecDirectW(
796  SQLHSTMT hstmt,
797  SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStr)
798 {
799  if (TDS_UNLIKELY(tds_write_dump)) {
800  SQLWSTR_BUFS(1);
801  tdsdump_log(TDS_DBG_FUNC, "SQLExecDirectW(%p, %ls, %d)\n",
802  hstmt,
803  SQLWSTR(szSqlStr), (int) cbSqlStr);
804  SQLWSTR_FREE();
805  }
806  return _SQLExecDirect(hstmt,
807  (ODBC_CHAR*) szSqlStr, cbSqlStr, 1);
808 }
809 #endif
810 
811 SQLRETURN ODBC_PUBLIC ODBC_API SQLExecDirect(
812  SQLHSTMT hstmt,
813  SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
814 {
815  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLExecDirect(%p, %s, %d)\n",
816  hstmt,
817  (const char*) szSqlStr, (int) cbSqlStr);
818 #ifdef ENABLE_ODBC_WIDE
819  return _SQLExecDirect(hstmt,
820  (ODBC_CHAR*) szSqlStr, cbSqlStr, 0);
821 #else
822  return _SQLExecDirect(hstmt,
823  szSqlStr, cbSqlStr);
824 #endif
825 }
826 
827 #ifdef ENABLE_ODBC_WIDE
828 static SQLRETURN _SQLPrepare(SQLHSTMT hstmt,
829  ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStr, int wide);
830 
831 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrepareW(
832  SQLHSTMT hstmt,
833  SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStr)
834 {
835  if (TDS_UNLIKELY(tds_write_dump)) {
836  SQLWSTR_BUFS(1);
837  tdsdump_log(TDS_DBG_FUNC, "SQLPrepareW(%p, %ls, %d)\n",
838  hstmt,
839  SQLWSTR(szSqlStr), (int) cbSqlStr);
840  SQLWSTR_FREE();
841  }
842  return _SQLPrepare(hstmt,
843  (ODBC_CHAR*) szSqlStr, cbSqlStr, 1);
844 }
845 #endif
846 
847 SQLRETURN ODBC_PUBLIC ODBC_API SQLPrepare(
848  SQLHSTMT hstmt,
849  SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
850 {
851  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLPrepare(%p, %s, %d)\n",
852  hstmt,
853  (const char*) szSqlStr, (int) cbSqlStr);
854 #ifdef ENABLE_ODBC_WIDE
855  return _SQLPrepare(hstmt,
856  (ODBC_CHAR*) szSqlStr, cbSqlStr, 0);
857 #else
858  return _SQLPrepare(hstmt,
859  szSqlStr, cbSqlStr);
860 #endif
861 }
862 
863 #ifdef ENABLE_ODBC_WIDE
864 static SQLRETURN _SQLSetCursorName(SQLHSTMT hstmt,
865  ODBC_CHAR * szCursor, SQLSMALLINT cbCursor, int wide);
866 
867 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetCursorNameW(
868  SQLHSTMT hstmt,
869  SQLWCHAR * szCursor, SQLSMALLINT cbCursor)
870 {
871  if (TDS_UNLIKELY(tds_write_dump)) {
872  SQLWSTR_BUFS(1);
873  tdsdump_log(TDS_DBG_FUNC, "SQLSetCursorNameW(%p, %ls, %d)\n",
874  hstmt,
875  SQLWSTR(szCursor), (int) cbCursor);
876  SQLWSTR_FREE();
877  }
878  return _SQLSetCursorName(hstmt,
879  (ODBC_CHAR*) szCursor, cbCursor, 1);
880 }
881 #endif
882 
883 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetCursorName(
884  SQLHSTMT hstmt,
885  SQLCHAR * szCursor, SQLSMALLINT cbCursor)
886 {
887  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetCursorName(%p, %s, %d)\n",
888  hstmt,
889  (const char*) szCursor, (int) cbCursor);
890 #ifdef ENABLE_ODBC_WIDE
891  return _SQLSetCursorName(hstmt,
892  (ODBC_CHAR*) szCursor, cbCursor, 0);
893 #else
894  return _SQLSetCursorName(hstmt,
895  szCursor, cbCursor);
896 #endif
897 }
898 
899 #ifdef ENABLE_ODBC_WIDE
900 static SQLRETURN _SQLGetCursorName(SQLHSTMT hstmt,
901  ODBC_CHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor, int wide);
902 
903 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetCursorNameW(
904  SQLHSTMT hstmt,
905  SQLWCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor)
906 {
907  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetCursorNameW(%p, %p, %d, %p)\n",
908  hstmt,
909  szCursor, (int) cbCursorMax, pcbCursor);
910  return _SQLGetCursorName(hstmt,
911  (ODBC_CHAR*) szCursor, cbCursorMax, pcbCursor, 1);
912 }
913 #endif
914 
915 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetCursorName(
916  SQLHSTMT hstmt,
917  SQLCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor)
918 {
919  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetCursorName(%p, %p, %d, %p)\n",
920  hstmt,
921  szCursor, (int) cbCursorMax, pcbCursor);
922 #ifdef ENABLE_ODBC_WIDE
923  return _SQLGetCursorName(hstmt,
924  (ODBC_CHAR*) szCursor, cbCursorMax, pcbCursor, 0);
925 #else
926  return _SQLGetCursorName(hstmt,
927  szCursor, cbCursorMax, pcbCursor);
928 #endif
929 }
930 
931 #ifdef ENABLE_ODBC_WIDE
932 static SQLRETURN _SQLColumns(SQLHSTMT hstmt,
933  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
934  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
935  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
936  ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide);
937 
938 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnsW(
939  SQLHSTMT hstmt,
940  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
941  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
942  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
943  SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName)
944 {
945  if (TDS_UNLIKELY(tds_write_dump)) {
946  SQLWSTR_BUFS(4);
947  tdsdump_log(TDS_DBG_FUNC, "SQLColumnsW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
948  hstmt,
949  SQLWSTR(szCatalogName), (int) cbCatalogName,
950  SQLWSTR(szSchemaName), (int) cbSchemaName,
951  SQLWSTR(szTableName), (int) cbTableName,
952  SQLWSTR(szColumnName), (int) cbColumnName);
953  SQLWSTR_FREE();
954  }
955  return _SQLColumns(hstmt,
956  (ODBC_CHAR*) szCatalogName, cbCatalogName,
957  (ODBC_CHAR*) szSchemaName, cbSchemaName,
958  (ODBC_CHAR*) szTableName, cbTableName,
959  (ODBC_CHAR*) szColumnName, cbColumnName, 1);
960 }
961 #endif
962 
963 SQLRETURN ODBC_PUBLIC ODBC_API SQLColumns(
964  SQLHSTMT hstmt,
965  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
966  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
967  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
968  SQLCHAR * szColumnName, SQLSMALLINT cbColumnName)
969 {
970  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLColumns(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
971  hstmt,
972  (const char*) szCatalogName, (int) cbCatalogName,
973  (const char*) szSchemaName, (int) cbSchemaName,
974  (const char*) szTableName, (int) cbTableName,
975  (const char*) szColumnName, (int) cbColumnName);
976 #ifdef ENABLE_ODBC_WIDE
977  return _SQLColumns(hstmt,
978  (ODBC_CHAR*) szCatalogName, cbCatalogName,
979  (ODBC_CHAR*) szSchemaName, cbSchemaName,
980  (ODBC_CHAR*) szTableName, cbTableName,
981  (ODBC_CHAR*) szColumnName, cbColumnName, 0);
982 #else
983  return _SQLColumns(hstmt,
984  szCatalogName, cbCatalogName,
985  szSchemaName, cbSchemaName,
986  szTableName, cbTableName,
987  szColumnName, cbColumnName);
988 #endif
989 }
990 
991 #ifdef ENABLE_ODBC_WIDE
992 static SQLRETURN _SQLGetConnectAttr(SQLHDBC hdbc,
993  SQLINTEGER Attribute,
994  SQLPOINTER Value,
995  SQLINTEGER BufferLength,
996  SQLINTEGER * StringLength, int wide);
997 
998 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectAttrW(
999  SQLHDBC hdbc,
1000  SQLINTEGER Attribute,
1001  SQLPOINTER Value,
1002  SQLINTEGER BufferLength,
1003  SQLINTEGER * StringLength)
1004 {
1005  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetConnectAttrW(%p, %d, %p, %d, %p)\n",
1006  hdbc,
1007  (int) Attribute,
1008  Value,
1009  (int) BufferLength,
1010  StringLength);
1011  return _SQLGetConnectAttr(hdbc,
1012  Attribute,
1013  Value,
1014  BufferLength,
1015  StringLength, 1);
1016 }
1017 #endif
1018 
1019 SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectAttr(
1020  SQLHDBC hdbc,
1021  SQLINTEGER Attribute,
1022  SQLPOINTER Value,
1023  SQLINTEGER BufferLength,
1024  SQLINTEGER * StringLength)
1025 {
1026  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetConnectAttr(%p, %d, %p, %d, %p)\n",
1027  hdbc,
1028  (int) Attribute,
1029  Value,
1030  (int) BufferLength,
1031  StringLength);
1032 #ifdef ENABLE_ODBC_WIDE
1033  return _SQLGetConnectAttr(hdbc,
1034  Attribute,
1035  Value,
1036  BufferLength,
1037  StringLength, 0);
1038 #else
1039  return _SQLGetConnectAttr(hdbc,
1040  Attribute,
1041  Value,
1042  BufferLength,
1043  StringLength);
1044 #endif
1045 }
1046 
1047 #ifdef ENABLE_ODBC_WIDE
1048 static SQLRETURN _SQLSetConnectAttr(SQLHDBC hdbc,
1049  SQLINTEGER Attribute,
1050  SQLPOINTER ValuePtr,
1051  SQLINTEGER StringLength, int wide);
1052 
1053 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectAttrW(
1054  SQLHDBC hdbc,
1055  SQLINTEGER Attribute,
1056  SQLPOINTER ValuePtr,
1057  SQLINTEGER StringLength)
1058 {
1059  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetConnectAttrW(%p, %d, %p, %d)\n",
1060  hdbc,
1061  (int) Attribute,
1062  ValuePtr,
1063  (int) StringLength);
1064  return _SQLSetConnectAttr(hdbc,
1065  Attribute,
1066  ValuePtr,
1067  StringLength, 1);
1068 }
1069 #endif
1070 
1071 SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectAttr(
1072  SQLHDBC hdbc,
1073  SQLINTEGER Attribute,
1074  SQLPOINTER ValuePtr,
1075  SQLINTEGER StringLength)
1076 {
1077  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetConnectAttr(%p, %d, %p, %d)\n",
1078  hdbc,
1079  (int) Attribute,
1080  ValuePtr,
1081  (int) StringLength);
1082 #ifdef ENABLE_ODBC_WIDE
1083  return _SQLSetConnectAttr(hdbc,
1084  Attribute,
1085  ValuePtr,
1086  StringLength, 0);
1087 #else
1088  return _SQLSetConnectAttr(hdbc,
1089  Attribute,
1090  ValuePtr,
1091  StringLength);
1092 #endif
1093 }
1094 
1095 #ifdef ENABLE_ODBC_WIDE
1096 static SQLRETURN _SQLSpecialColumns(SQLHSTMT hstmt,
1097  SQLUSMALLINT fColType,
1098  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1099  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1100  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
1101  SQLUSMALLINT fScope,
1102  SQLUSMALLINT fNullable, int wide);
1103 
1104 SQLRETURN ODBC_PUBLIC ODBC_API SQLSpecialColumnsW(
1105  SQLHSTMT hstmt,
1106  SQLUSMALLINT fColType,
1107  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1108  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1109  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
1110  SQLUSMALLINT fScope,
1111  SQLUSMALLINT fNullable)
1112 {
1113  if (TDS_UNLIKELY(tds_write_dump)) {
1114  SQLWSTR_BUFS(3);
1115  tdsdump_log(TDS_DBG_FUNC, "SQLSpecialColumnsW(%p, %u, %ls, %d, %ls, %d, %ls, %d, %u, %u)\n",
1116  hstmt,
1117  (unsigned int) fColType,
1118  SQLWSTR(szCatalogName), (int) cbCatalogName,
1119  SQLWSTR(szSchemaName), (int) cbSchemaName,
1120  SQLWSTR(szTableName), (int) cbTableName,
1121  (unsigned int) fScope,
1122  (unsigned int) fNullable);
1123  SQLWSTR_FREE();
1124  }
1125  return _SQLSpecialColumns(hstmt,
1126  fColType,
1127  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1128  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1129  (ODBC_CHAR*) szTableName, cbTableName,
1130  fScope,
1131  fNullable, 1);
1132 }
1133 #endif
1134 
1135 SQLRETURN ODBC_PUBLIC ODBC_API SQLSpecialColumns(
1136  SQLHSTMT hstmt,
1137  SQLUSMALLINT fColType,
1138  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1139  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1140  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
1141  SQLUSMALLINT fScope,
1142  SQLUSMALLINT fNullable)
1143 {
1144  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSpecialColumns(%p, %u, %s, %d, %s, %d, %s, %d, %u, %u)\n",
1145  hstmt,
1146  (unsigned int) fColType,
1147  (const char*) szCatalogName, (int) cbCatalogName,
1148  (const char*) szSchemaName, (int) cbSchemaName,
1149  (const char*) szTableName, (int) cbTableName,
1150  (unsigned int) fScope,
1151  (unsigned int) fNullable);
1152 #ifdef ENABLE_ODBC_WIDE
1153  return _SQLSpecialColumns(hstmt,
1154  fColType,
1155  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1156  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1157  (ODBC_CHAR*) szTableName, cbTableName,
1158  fScope,
1159  fNullable, 0);
1160 #else
1161  return _SQLSpecialColumns(hstmt,
1162  fColType,
1163  szCatalogName, cbCatalogName,
1164  szSchemaName, cbSchemaName,
1165  szTableName, cbTableName,
1166  fScope,
1167  fNullable);
1168 #endif
1169 }
1170 
1171 #ifdef ENABLE_ODBC_WIDE
1172 static SQLRETURN _SQLStatistics(SQLHSTMT hstmt,
1173  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1174  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1175  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
1176  SQLUSMALLINT fUnique,
1177  SQLUSMALLINT fAccuracy, int wide);
1178 
1179 SQLRETURN ODBC_PUBLIC ODBC_API SQLStatisticsW(
1180  SQLHSTMT hstmt,
1181  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1182  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1183  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
1184  SQLUSMALLINT fUnique,
1185  SQLUSMALLINT fAccuracy)
1186 {
1187  if (TDS_UNLIKELY(tds_write_dump)) {
1188  SQLWSTR_BUFS(3);
1189  tdsdump_log(TDS_DBG_FUNC, "SQLStatisticsW(%p, %ls, %d, %ls, %d, %ls, %d, %u, %u)\n",
1190  hstmt,
1191  SQLWSTR(szCatalogName), (int) cbCatalogName,
1192  SQLWSTR(szSchemaName), (int) cbSchemaName,
1193  SQLWSTR(szTableName), (int) cbTableName,
1194  (unsigned int) fUnique,
1195  (unsigned int) fAccuracy);
1196  SQLWSTR_FREE();
1197  }
1198  return _SQLStatistics(hstmt,
1199  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1200  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1201  (ODBC_CHAR*) szTableName, cbTableName,
1202  fUnique,
1203  fAccuracy, 1);
1204 }
1205 #endif
1206 
1207 SQLRETURN ODBC_PUBLIC ODBC_API SQLStatistics(
1208  SQLHSTMT hstmt,
1209  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1210  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1211  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
1212  SQLUSMALLINT fUnique,
1213  SQLUSMALLINT fAccuracy)
1214 {
1215  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLStatistics(%p, %s, %d, %s, %d, %s, %d, %u, %u)\n",
1216  hstmt,
1217  (const char*) szCatalogName, (int) cbCatalogName,
1218  (const char*) szSchemaName, (int) cbSchemaName,
1219  (const char*) szTableName, (int) cbTableName,
1220  (unsigned int) fUnique,
1221  (unsigned int) fAccuracy);
1222 #ifdef ENABLE_ODBC_WIDE
1223  return _SQLStatistics(hstmt,
1224  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1225  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1226  (ODBC_CHAR*) szTableName, cbTableName,
1227  fUnique,
1228  fAccuracy, 0);
1229 #else
1230  return _SQLStatistics(hstmt,
1231  szCatalogName, cbCatalogName,
1232  szSchemaName, cbSchemaName,
1233  szTableName, cbTableName,
1234  fUnique,
1235  fAccuracy);
1236 #endif
1237 }
1238 
1239 #ifdef ENABLE_ODBC_WIDE
1240 static SQLRETURN _SQLTables(SQLHSTMT hstmt,
1241  ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1242  ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1243  ODBC_CHAR * szTableName, SQLSMALLINT cbTableName,
1244  ODBC_CHAR * szTableType, SQLSMALLINT cbTableType, int wide);
1245 
1246 SQLRETURN ODBC_PUBLIC ODBC_API SQLTablesW(
1247  SQLHSTMT hstmt,
1248  SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1249  SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1250  SQLWCHAR * szTableName, SQLSMALLINT cbTableName,
1251  SQLWCHAR * szTableType, SQLSMALLINT cbTableType)
1252 {
1253  if (TDS_UNLIKELY(tds_write_dump)) {
1254  SQLWSTR_BUFS(4);
1255  tdsdump_log(TDS_DBG_FUNC, "SQLTablesW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n",
1256  hstmt,
1257  SQLWSTR(szCatalogName), (int) cbCatalogName,
1258  SQLWSTR(szSchemaName), (int) cbSchemaName,
1259  SQLWSTR(szTableName), (int) cbTableName,
1260  SQLWSTR(szTableType), (int) cbTableType);
1261  SQLWSTR_FREE();
1262  }
1263  return _SQLTables(hstmt,
1264  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1265  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1266  (ODBC_CHAR*) szTableName, cbTableName,
1267  (ODBC_CHAR*) szTableType, cbTableType, 1);
1268 }
1269 #endif
1270 
1271 SQLRETURN ODBC_PUBLIC ODBC_API SQLTables(
1272  SQLHSTMT hstmt,
1273  SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName,
1274  SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName,
1275  SQLCHAR * szTableName, SQLSMALLINT cbTableName,
1276  SQLCHAR * szTableType, SQLSMALLINT cbTableType)
1277 {
1278  TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLTables(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n",
1279  hstmt,
1280  (const char*) szCatalogName, (int) cbCatalogName,
1281  (const char*) szSchemaName, (int) cbSchemaName,
1282  (const char*) szTableName, (int) cbTableName,
1283  (const char*) szTableType, (int) cbTableType);
1284 #ifdef ENABLE_ODBC_WIDE
1285  return _SQLTables(hstmt,
1286  (ODBC_CHAR*) szCatalogName, cbCatalogName,
1287  (ODBC_CHAR*) szSchemaName, cbSchemaName,
1288  (ODBC_CHAR*) szTableName, cbTableName,
1289  (ODBC_CHAR*) szTableType, cbTableType, 0);
1290 #else
1291  return _SQLTables(hstmt,
1292  szCatalogName, cbCatalogName,
1293  szSchemaName, cbSchemaName,
1294  szTableName, cbTableName,
1295  szTableType, cbTableType);
1296 #endif
1297 }
1298 
1299 #define tdsdump_log TDSDUMP_LOG_FAST
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
static void tds_dstr_init(DSTR *s)
init a string with empty
Definition: string.h:53
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
Definition: odbc.h:275
struct _hstmt * stmt_list
list of all statements allocated from this connection
Definition: odbc.h:295
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:951
TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor)
Deallocate cursor on idle.
Definition: query.c:3057
Definition: odbc.h:163
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:953
TDSRET tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Sends a language string to the database server for processing.
Definition: query.c:350
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
void odbc_rdbms_version(TDSSOCKET *tds, char *pversion_string)
Returns the version of the RDBMS in the ODBC format.
Definition: odbc_util.c:852
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:256
DSTR password
password of account login
Definition: tds.h:535
struct _hstmt * next
next in list
Definition: odbc.h:392
#define TDS_IS_SYBASE(x)
Check if product is Sybase (such as Adaptive Server Enterrprice).
Definition: tds.h:1720
SQLRETURN odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
Set concise type and all cascading field.
Definition: odbc_util.c:976
Definition: odbc.h:204
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
unsigned int param_count
number of parameter in current query
Definition: odbc.h:418
Holds informations about a cursor.
Definition: tds.h:937
TDSLOGIN * tds_init_login(TDSLOGIN *login, TDSLOCALE *locale)
Initialize login structure with locale information and other stuff for connection.
Definition: mem.c:800
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
struct _hstmt * current_statement
Statement executing.
Definition: odbc.h:293
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1093
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:941
void tds_fix_login(TDSLOGIN *login)
Fix configuration after reading it.
Definition: config.c:285
unsigned int cursor_support
<>0 if server handle cursors
Definition: odbc.h:300
int tds_canonical_charset(const char *charset_name)
Determine canonical iconv character set.
Definition: iconv.c:970
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
Definition: native.c:348
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:515
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:993
TDSRET tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2554
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:881
RETCODE bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int db_vartype, int table_column)
Bind a program host variable to a database column.
Definition: bcp.c:2079
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
TDS_ODBC_ROW_STATUS row_status
status of row, it can happen that this flag mark that we are still parsing row, this it's normal
Definition: odbc.h:423
size_t prepared_pos
position in prepared query to check parameters, used only in RPC
Definition: odbc.h:413
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1007
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
TDSRET tds_submit_begin_tran(TDSSOCKET *tds)
Send a rollback request.
Definition: query.c:3665
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition: bcp.c:544
TDS_INT type
row fetched from this cursor
Definition: tds.h:956
size_t tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id for a RPC call.
Definition: query.c:2216
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
Definition: odbcss.h:132
Definition: tds.h:876
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
int param_num
last valid parameter in params, it's a ODBC index (from 1 relative to descriptor)
Definition: odbc.h:411
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
TDS_DESC * uad[TDS_MAX_APP_DESC]
descriptors associated to connection
Definition: odbc.h:298
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: odbc.h:381
TDSRET tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server and execute it.
Definition: query.c:1401
TDS_INT8 row_count
row count to return
Definition: odbc.h:421
#define TDS_MS_VER(maj, min, x)
Calc a version number for mssql.
Definition: tds.h:1727
const char * tds_skip_comment(const char *s)
Skip a comment in a query.
Definition: query.c:490
TDS_SYS_SOCKET s
tcp socket, INVALID_SOCKET if not connected
Definition: tds.h:1096
DSTR query
query to execute
Definition: odbc.h:387
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1248
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
Information about blobs (e.g.
Definition: tds.h:593
Definition: odbc.h:230
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:536
Definition: tds.h:1019
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
DBINT bcp_done(DBPROCESS *dbproc)
Conclude the transfer of data from program variables.
Definition: bcp.c:2037
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1630
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:206
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
TDSRET tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Submit a prepared query with parameters.
Definition: query.c:1256
unsigned need_reprepare
Prepared statement needs to be prepared again.
Definition: odbc.h:404
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
int tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Check if dynamic request must be unprepared.
Definition: query.c:1752
RETCODE bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column)
Override bcp_bind() by pointing to a different host variable.
Definition: bcp.c:671
TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont)
Send a rollback request.
Definition: query.c:3693
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1722
Definition: odbc.h:532
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
Definition: native.c:356
DSTR user_name
account for login
Definition: tds.h:534
@ TDS_DEAD
no connection
Definition: tds.h:795
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
Definition: odbc.h:106
@ TDS_IDLE
no data expected
Definition: tds.h:790
Definition: tds.h:574
RETCODE bcp_sendrow(DBPROCESS *dbproc)
Write data in host variables to the table.
Definition: bcp.c:1381
Definition: odbc.h:441
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
Information for a server connection.
Definition: tds.h:1163
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
int tds_count_placeholders(const char *query)
Count the number of placeholders ('?') in a query.
Definition: query.c:571
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
struct _hstmt * prev
previous in list
Definition: odbc.h:394
Definition: odbcss.h:139
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
TDSRET tds_submit_commit(TDSSOCKET *tds, int cont)
Send a commit request.
Definition: query.c:3724
DBINT bcp_batch(DBPROCESS *dbproc)
Commit a set of rows to the table.
Definition: bcp.c:2010
Definition: odbc.h:237
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
Definition: tds.h:1029
TDSSOCKET * tds
socket (only if active)
Definition: odbc.h:389
TDSRET tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Unprepare dynamic on idle.
Definition: query.c:1774
Definition: tds.h:517
TDSRET tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server.
Definition: query.c:1124
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
TDSPARAMINFO * params
parameters saved
Definition: odbc.h:409
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
SQLRETURN odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
Set concise type and all cascading field.
Definition: odbc_util.c:1098
freetds-1.3.6/doc/reference/a00137_source.html000644 025423 025423 00000055262 14162303415 022400 0ustar00fredianofrediano000000 000000 FreeTDS API: src/odbc/resource.h Source File
FreeTDS API
resource.h
1 //{{NO_DEPENDENCIES}}
2 // Microsoft Developer Studio generated include file.
3 // Used by setup.rc
4 //
5 #define IDD_LOGIN 102
6 #define IDD_DSN 106
7 #define IDC_PROTOCOL 1003
8 #define IDC_ADDRESS 1004
9 #define IDC_PORT 1005
10 #define IDC_DATABASE 1011
11 #define IDC_DSNNAME 1015
12 #define IDC_HINT 1017
13 #define IDC_LOGINSERVER 1020
14 #define IDC_LOGINUID 1021
15 #define IDC_LOGINPWD 1022
16 #define IDC_LOGINDUMP 1023
17 
18 // Next default values for new objects
19 //
20 #ifdef APSTUDIO_INVOKED
21 #ifndef APSTUDIO_READONLY_SYMBOLS
22 #define _APS_NEXT_RESOURCE_VALUE 103
23 #define _APS_NEXT_COMMAND_VALUE 40001
24 #define _APS_NEXT_CONTROL_VALUE 1024
25 #define _APS_NEXT_SYMED_VALUE 101
26 #endif
27 #endif
Definition: odbc.h:275
Definition: odbc.h:163
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
void odbc_rdbms_version(TDSSOCKET *tds, char *pversion_string)
Returns the version of the RDBMS in the ODBC format.
Definition: odbc_util.c:852
bool has_status
true is ret_status is valid
Definition: tds.h:1245
TDS_SERVER_TYPE odbc_c_to_server_type(int c_type)
Pass this an SQL_C_* type and get a SYB* type which most closely corresponds to the SQL_C_* type.
Definition: odbc_util.c:601
SQLRETURN odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
Set concise type and all cascading field.
Definition: odbc_util.c:976
Definition: odbc.h:204
unsigned int param_count
number of parameter in current query
Definition: odbc.h:418
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1093
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
Definition: convert.h:34
Definition: iconv.h:78
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
size_t prepared_pos
position in prepared query to check parameters, used only in RPC
Definition: odbc.h:413
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
int param_num
last valid parameter in params, it's a ODBC index (from 1 relative to descriptor)
Definition: odbc.h:411
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
Definition: odbc.h:381
Definition: tds.h:1091
DSTR query
query to execute
Definition: odbc.h:387
Information about blobs (e.g.
Definition: tds.h:593
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1250
SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row)
Return length of parameter from parameter information.
Definition: odbc_util.c:861
unsigned need_reprepare
Prepared statement needs to be prepared again.
Definition: odbc.h:404
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR *pcbBuffer, const char *s, int len, int flag)
Copy a string to client setting size according to ODBC convenction.
Definition: odbc_util.c:301
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:592
Definition: odbc.h:106
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
Information for a server connection.
Definition: tds.h:1163
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
TDSSOCKET * tds
socket (only if active)
Definition: odbc.h:389
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:320
TDSPARAMINFO * params
parameters saved
Definition: odbc.h:409
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
SQLRETURN odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
Set concise type and all cascading field.
Definition: odbc_util.c:1098
freetds-1.3.6/doc/reference/a00146_source.html000644 025423 025423 00000035777 14162303415 022411 0ustar00fredianofrediano000000 000000 FreeTDS API: src/odbc/sqlwparams.h Source File
FreeTDS API
sqlwparams.h
1 #if 0
2 # ODBC_FUNC(SQLTest, (P(SQLSMALLINT, x), PCHAR(y) WIDE))
3 #endif
4 
5 #undef WIDE
6 #undef P
7 #undef PCHAR
8 #undef PCHARIN
9 #undef PCHAROUT
10 
11 #ifdef ENABLE_ODBC_WIDE
12 # define WIDE , int wide
13 # define PCHAR(a) ODBC_CHAR* a
14 #else
15 # define WIDE
16 # define PCHAR(a) SQLCHAR* a
17 #endif
18 
19 #define P(a,b) a b
20 #define PCHARIN(n,t) PCHAR(sz ## n), P(t, cb ## n)
21 #define PCHAROUT(n,t) PCHAR(sz ## n), P(t, cb ## n ## Max), P(t FAR*, pcb ## n)
22 
23 #define ODBC_FUNC(name, params) \
24  static SQLRETURN _ ## name params
25 
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
Definition: odbc.h:275
Definition: odbc.h:163
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
TDS_INT date
date, 0 = 1900-01-01
Definition: tds.h:148
TDS_SERVER_TYPE odbc_c_to_server_type(int c_type)
Pass this an SQL_C_* type and get a SYB* type which most closely corresponds to the SQL_C_* type.
Definition: odbc_util.c:601
Definition: odbc.h:204
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
Definition: convert.h:34
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2913
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
Definition: odbc.h:381
Definition: tds.h:1091
Information about blobs (e.g.
Definition: tds.h:593
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row)
Return length of parameter from parameter information.
Definition: odbc_util.c:861
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
TDS_UINT8 time
time, 7 digit precision
Definition: tds.h:147
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
Definition: proto.h:26
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
freetds-1.3.6/doc/reference/a00164_source.html000644 025423 025423 00000155256 14162303415 022404 0ustar00fredianofrediano000000 000000 FreeTDS API: src/pool/pool.h Source File
FreeTDS API
pool.h
1 /* TDSPool - Connection pooling for TDS based databases
2  * Copyright (C) 2001 Brian Bruns
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
20 #ifndef _pool_h_
21 #define _pool_h_
22 
23 #include <assert.h>
24 
25 #if HAVE_SYS_TYPES_H
26 #include <sys/types.h>
27 #endif
28 
29 #if HAVE_NETINET_IN_H
30 #include <netinet/in.h>
31 #endif
32 
33 /*
34  * POSIX says fd_set type may be defined in either sys/select.h or sys/time.h.
35  */
36 #if HAVE_SYS_TIME_H
37 #include <sys/time.h>
38 #endif
39 
40 #include <freetds/tds.h>
41 #include <freetds/utils/dlist.h>
42 
43 /* defines */
44 #define PGSIZ 2048
45 #define BLOCKSIZ 512
46 #define MAX_POOL_USERS 1024
47 
48 /* enums and typedefs */
49 typedef enum
50 {
51  TDS_SRV_WAIT, /* if no members are free wait */
52  TDS_SRV_QUERY,
53 } TDS_USER_STATE;
54 
55 /* forward declaration */
56 typedef struct tds_pool_event TDS_POOL_EVENT;
57 typedef struct tds_pool_socket TDS_POOL_SOCKET;
58 typedef struct tds_pool_member TDS_POOL_MEMBER;
59 typedef struct tds_pool_user TDS_POOL_USER;
60 typedef struct tds_pool TDS_POOL;
61 typedef void (*TDS_POOL_EXECUTE)(TDS_POOL_EVENT *event);
62 
64 {
65  TDS_POOL_EVENT *next;
66  TDS_POOL_EXECUTE execute;
67 };
68 
70 {
71  TDSSOCKET *tds;
72  bool poll_recv;
73  bool poll_send;
74 };
75 
77 {
78  TDS_POOL_SOCKET sock;
79  DLIST_FIELDS(dlist_user_item);
80  TDSLOGIN *login;
81  TDS_USER_STATE user_state;
82  TDS_POOL_MEMBER *assigned_member;
83 };
84 
86 {
87  TDS_POOL_SOCKET sock;
88  DLIST_FIELDS(dlist_member_item);
89  bool doing_async;
90  time_t last_used_tm;
91  TDS_POOL_USER *current_user;
92 };
93 
94 #define DLIST_PREFIX dlist_member
95 #define DLIST_LIST_TYPE dlist_members
96 #define DLIST_ITEM_TYPE TDS_POOL_MEMBER
97 #include <freetds/utils/dlist.tmpl.h>
98 
99 #define DLIST_PREFIX dlist_user
100 #define DLIST_LIST_TYPE dlist_users
101 #define DLIST_ITEM_TYPE TDS_POOL_USER
102 #include <freetds/utils/dlist.tmpl.h>
103 
104 struct tds_pool
105 {
106  char *name;
107  char *user;
108  char *password;
109  char *server;
110  char *database;
111  char *server_user;
112  char *server_password;
113  int port;
114  int max_member_age; /* in seconds */
115  int min_open_conn;
116  int max_open_conn;
117  tds_mutex events_mtx;
118  TDS_SYS_SOCKET listen_fd;
119  TDS_SYS_SOCKET wakeup_fd;
120  TDS_SYS_SOCKET event_fd;
121  TDS_POOL_EVENT *events;
122 
123  int num_active_members;
124  dlist_members active_members;
125  dlist_members idle_members;
126 
128  dlist_users waiters;
129  int num_users;
130  dlist_users users;
131  TDSCONTEXT *ctx;
132 
133  unsigned long user_logins;
134  unsigned long member_logins;
135 };
136 
137 /* prototypes */
138 
139 /* member.c */
140 int pool_process_members(TDS_POOL * pool, fd_set * rfds, fd_set * wfds);
141 TDS_POOL_MEMBER *pool_assign_idle_member(TDS_POOL * pool, TDS_POOL_USER *user);
142 void pool_mbr_init(TDS_POOL * pool);
143 void pool_mbr_destroy(TDS_POOL * pool);
144 void pool_free_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr);
145 void pool_assign_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr, TDS_POOL_USER *puser);
146 void pool_deassign_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr);
147 void pool_reset_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr);
148 bool pool_packet_read(TDSSOCKET * tds);
149 
150 /* user.c */
151 void pool_process_users(TDS_POOL * pool, fd_set * rfds, fd_set * wfds);
152 void pool_user_init(TDS_POOL * pool);
153 void pool_user_destroy(TDS_POOL * pool);
154 TDS_POOL_USER *pool_user_create(TDS_POOL * pool, TDS_SYS_SOCKET s);
155 void pool_free_user(TDS_POOL * pool, TDS_POOL_USER * puser);
156 void pool_user_query(TDS_POOL * pool, TDS_POOL_USER * puser);
157 bool pool_user_send_login_ack(TDS_POOL * pool, TDS_POOL_USER * puser);
158 void pool_user_finish_login(TDS_POOL * pool, TDS_POOL_USER * puser);
159 
160 /* util.c */
161 void dump_login(TDSLOGIN * login);
162 void pool_event_add(TDS_POOL *pool, TDS_POOL_EVENT *ev, TDS_POOL_EXECUTE execute);
163 int pool_write(TDS_SYS_SOCKET sock, const void *buf, size_t len);
164 bool pool_write_data(TDS_POOL_SOCKET *from, TDS_POOL_SOCKET *to);
165 
166 /* config.c */
167 bool pool_read_conf_files(const char *path, const char *poolname, TDS_POOL * pool, char **err);
168 
169 
170 #endif
void tds_start_query(TDSSOCKET *tds, unsigned char packet_type)
Start query packet of a given type.
Definition: query.c:332
static void tds_dstr_init(DSTR *s)
init a string with empty
Definition: string.h:53
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
Definition: pool.h:105
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
DSTR password
password of account login
Definition: tds.h:535
Definition: tds.h:582
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
Main include file for libtds.
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
bool tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
Read a section of configuration file (INI style file)
Definition: config.c:503
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
Definition: member.c:413
struct addrinfo * tds_lookup_host(const char *servername)
Get the IP address for a hostname.
Definition: config.c:987
static int tds_lookup_port(const char *portname)
Given a portname lookup the port.
Definition: config.c:1026
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock)
Set socket to non-blocking.
Definition: net.c:168
TDSLOGIN * tds_init_login(TDSLOGIN *login, TDSLOCALE *locale)
Initialize login structure with locale information and other stuff for connection.
Definition: mem.c:800
Definition: pool.h:86
void tds_fix_login(TDSLOGIN *login)
Fix configuration after reading it.
Definition: config.c:285
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
TDSLOGIN * login
everything else
Definition: winsetup.c:66
TDS_USMALLINT * tds_config_verstr(const char *tdsver, TDSLOGIN *login)
Set TDS version from given string.
Definition: config.c:923
TDSLOGIN * tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
tds_read_config_info() will fill the tds connection structure based on configuration information gath...
Definition: config.c:138
Definition: pool.h:70
TDSRET tds_set_interfaces_file_loc(const char *interf)
Set the full name of interface file.
Definition: config.c:961
DSTR server_realm_name
server realm name (in freetds.conf)
Definition: tds.h:527
Definition: main.c:209
Provide poll call where missing.
static int search_interface_file(TDSLOGIN *login, const char *dir, const char *file, const char *host)
Open and read the file 'file' searching for a logical server by the name of 'host'.
Definition: config.c:1064
dlist_users waiters
users in wait state
Definition: pool.h:128
DSTR dsn
edited name of the data source
Definition: winsetup.c:65
TDSRET tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2554
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:129
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:881
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
Definition: winsetup.c:63
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:529
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
Definition: pool.h:64
unsigned char out_flag
output buffer type
Definition: tds.h:1196
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1248
bool tds_read_conf_file(TDSLOGIN *login, const char *server)
Read configuration info for given server return 0 on error.
Definition: config.c:346
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:556
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:536
DSTR origdsn
original name of the data source
Definition: winsetup.c:64
Structure to hold a string.
Definition: string.h:36
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:520
static int parse_server_name_for_port(TDSLOGIN *connection, TDSLOGIN *login, bool update_server)
Check the server name to find port info first Warning: connection-> & login-> are all modified when n...
Definition: config.c:1293
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:546
@ TDS_WRITING
client is writing data
Definition: tds.h:791
Definition: config.c:905
static int tds_read_interfaces(const char *server, TDSLOGIN *login)
Try to find the IP number and port for a (possibly) logical server name.
Definition: config.c:1187
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
unsigned in_len
input buffer length
Definition: tds.h:1194
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
int tds_put_string(TDSSOCKET *tds, const char *s, int len)
Output a string to wire automatic translate string to unicode if needed.
Definition: write.c:97
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
int port
port of database service
Definition: tds.h:519
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
DSTR user_name
account for login
Definition: tds.h:534
char * database
database name
Definition: tds.h:970
DSTR crlfile
certificate revocation file
Definition: tds.h:531
Definition: pool.h:77
Information for a server connection.
Definition: tds.h:1163
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
DSTR server_spn
server SPN (in freetds.conf)
Definition: tds.h:528
Definition: config.c:55
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
DSTR server_charset
charset of server e.g.
Definition: tds.h:523
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
Definition: tds.h:1029
A structure to hold all the compile-time settings.
Definition: tds.h:82
Definition: tds.h:517
const TDS_COMPILETIME_SETTINGS * tds_get_compiletime_settings(void)
Return a structure capturing the compile-time settings provided to the configure script.
Definition: config.c:1337
DSTR cafile
certificate authorities file
Definition: tds.h:530
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:212
char * tds_get_home_file(const char *file)
Return filename from HOME directory.
Definition: config.c:325
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
freetds-1.3.6/doc/reference/a00197_source.html000644 025423 025423 00000141650 14162303415 022403 0ustar00fredianofrediano000000 000000 FreeTDS API: src/replacements/iconv_charsets.h Source File
FreeTDS API
iconv_charsets.h
1 /*
2  * Autogenerated file.
3  * Generated by iconv_charsets.pl
4  */
5 
6 #define CP1252_ALL \
7  CP1252(0x80, 8364) \
8  CP1252(0x82, 8218) \
9  CP1252(0x83, 402) \
10  CP1252(0x84, 8222) \
11  CP1252(0x85, 8230) \
12  CP1252(0x86, 8224) \
13  CP1252(0x87, 8225) \
14  CP1252(0x88, 710) \
15  CP1252(0x89, 8240) \
16  CP1252(0x8a, 352) \
17  CP1252(0x8b, 8249) \
18  CP1252(0x8c, 338) \
19  CP1252(0x8e, 381) \
20  CP1252(0x91, 8216) \
21  CP1252(0x92, 8217) \
22  CP1252(0x93, 8220) \
23  CP1252(0x94, 8221) \
24  CP1252(0x95, 8226) \
25  CP1252(0x96, 8211) \
26  CP1252(0x97, 8212) \
27  CP1252(0x98, 732) \
28  CP1252(0x99, 8482) \
29  CP1252(0x9a, 353) \
30  CP1252(0x9b, 8250) \
31  CP1252(0x9c, 339) \
32  CP1252(0x9e, 382) \
33  CP1252(0x9f, 376)
34 
35 static const uint16_t cp1252_0080_00a0[] = {
36  0x20ac,
37  0x81,
38  0x201a,
39  0x192,
40  0x201e,
41  0x2026,
42  0x2020,
43  0x2021,
44  0x2c6,
45  0x2030,
46  0x160,
47  0x2039,
48  0x152,
49  0x8d,
50  0x17d,
51  0x8f,
52  0x90,
53  0x2018,
54  0x2019,
55  0x201c,
56  0x201d,
57  0x2022,
58  0x2013,
59  0x2014,
60  0x2dc,
61  0x2122,
62  0x161,
63  0x203a,
64  0x153,
65  0x9d,
66  0x17e,
67  0x178,
68 };
69 
70 TDS_COMPILE_CHECK(cp1252size, sizeof(cp1252_0080_00a0) == 0x20*sizeof(uint16_t));
output stream to write data to a static buffer.
Definition: stream.h:92
Definition: stream.c:44
TDSPACKET * pkt
first packet frozen
Definition: tds.h:1575
static int tds_datain_stream_read(TDSINSTREAM *stream, void *ptr, size_t len)
Reads data from network for input stream.
Definition: stream.c:185
TDSPACKET * frozen_packets
list of packets frozen, points to first one.
Definition: tds.h:1203
char * charset
character set encoding
Definition: tds.h:968
Definition: tds.h:1057
static int tds_dynamic_stream_write(TDSOUTSTREAM *stream, size_t len)
Writes data to a dynamic allocated buffer.
Definition: stream.c:324
Definition: pool.h:105
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
@ TDS_READING
client is reading data
Definition: tds.h:794
int tds_iconv_alloc(TDSCONNECTION *conn)
Allocate iconv stuff.
Definition: iconv.c:307
char * buffer
write buffer.
Definition: stream.h:50
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
DSTR password
password of account login
Definition: tds.h:535
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
TDSICONV * tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5])
Get iconv information from a LCID (to support different column encoding under MSSQL2K)
Definition: iconv.c:1245
Main include file for libtds.
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
int(* read)(struct tds_input_stream *stream, void *ptr, size_t len)
read some data Return 0 if end of stream Return <0 if error (actually not defined)
Definition: stream.h:35
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
static int tds_staticout_stream_write(TDSOUTSTREAM *stream, size_t len)
Writes data to a static allocated buffer.
Definition: stream.c:298
input stream to read data from a static buffer
Definition: stream.h:81
Definition: iconv.h:85
output stream to write data to tds protocol
Definition: stream.h:72
unsigned char canonic
internal numeric index into array of all encodings
Definition: tds.h:624
unsigned char * out_buf
Output buffer.
Definition: tds.h:1185
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock)
Set socket to non-blocking.
Definition: net.c:168
TDSRET tds_freeze_abort(TDSFREEZE *freeze)
Discard all data written after the freeze.
Definition: packet.c:961
enum tds_states TDS_STATE
values for tds->state
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1093
Definition: pool.h:86
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:224
int tds_canonical_charset(const char *charset_name)
Determine canonical iconv character set.
Definition: iconv.c:970
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1243
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
Definition: pool.h:70
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
unsigned size_len
length size (0, 1, 2 or 4)
Definition: tds.h:1579
static int tds_iconv_init(void)
Initialize charset searching for UTF-8, UCS-2 and ISO8859-1.
Definition: iconv.c:92
void tds_datain_stream_init(TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
Initialize a data input stream.
Definition: stream.c:204
dlist_users waiters
users in wait state
Definition: pool.h:128
Definition: iconv.h:78
input stream to read data from tds protocol
Definition: stream.h:63
const char * tds_canonical_charset_name(const char *charset_name)
Determine canonical iconv character set name.
Definition: iconv.c:982
void ** buf
where is stored the pointer
Definition: stream.h:102
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:881
int tds_get_token_size(int marker)
tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determi...
Definition: token.c:2754
static int tds_iconv_info_init(TDSICONV *char_conv, int client_canonic, int server_canonic)
Open iconv descriptors to convert between character sets (both directions).
Definition: iconv.c:444
int(* write)(struct tds_output_stream *stream, size_t len)
write len bytes from buffer, return <0 if error or len
Definition: stream.h:41
define a stream of data used for input
Definition: stream.h:30
Definition: tds.h:876
Definition: user.c:521
Definition: pool.h:64
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
const char * name
name of the encoding (ie UTF-8)
Definition: tds.h:620
Definition: tds.h:1091
size_t wire_size
bytes still to read
Definition: stream.h:65
unsigned char out_flag
output buffer type
Definition: tds.h:1196
static size_t skip_one_input_sequence(iconv_t cd, const TDS_ENCODING *charset, const char **input, size_t *input_size)
Move the input sequence pointer to the next valid position.
Definition: iconv.c:866
static const char * tds_set_iconv_name(int charset)
Get iconv name given canonic.
Definition: iconv.c:238
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
@ TDS_SENDING
client would send data
Definition: tds.h:792
TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated)
Initialize a dynamic output stream.
Definition: stream.c:354
Definition: replacements.h:88
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
output stream to write data to a dynamic buffer
Definition: stream.h:99
Hold information for any results.
Definition: tds.h:769
@ TDS_WRITING
client is writing data
Definition: tds.h:791
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
unsigned in_len
input buffer length
Definition: tds.h:1194
unsigned out_pos
current position in out_buf
Definition: tds.h:1193
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163
size_t allocated
currently allocated buffer
Definition: stream.h:104
TDSRET tds_convert_stream(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream converting characters.
Definition: stream.c:71
iconv_t tds_sys_iconv_open(const char *tocode, const char *fromcode)
Inputs are FreeTDS canonical names, no other.
Definition: iconv.c:360
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
void tds_staticin_stream_init(TDSSTATICINSTREAM *stream, const void *ptr, size_t len)
Initialize an input stream for read from a static allocated buffer.
Definition: stream.c:286
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
void * tds_realloc(void **pp, size_t new_size)
Reallocate a pointer and update it if success.
Definition: mem.c:1876
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
DSTR user_name
account for login
Definition: tds.h:534
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:592
@ TDS_DEAD
no connection
Definition: tds.h:795
char * tds_strndup(const void *s, TDS_INTPTR len)
Copy a string of length len to a new allocated buffer This function does not read more than len bytes...
Definition: util.c:406
Definition: util.c:237
Definition: pool.h:77
TDSSOCKET * tds
which socket we refer to
Definition: tds.h:1573
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t need)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
@ TDS_IDLE
no data expected
Definition: tds.h:790
Information for a server connection.
Definition: tds.h:1163
unsigned char in_flag
input buffer type
Definition: tds.h:1195
Information relevant to libiconv.
Definition: tds.h:618
void tds_dataout_stream_init(TDSDATAOUTSTREAM *stream, TDSSOCKET *tds)
Initialize a data output stream.
Definition: stream.c:244
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1191
Definition: user.c:100
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
define a stream of data used for output
Definition: stream.h:39
unsigned pkt_pos
position in pkt
Definition: tds.h:1577
DSTR server_charset
charset of server e.g.
Definition: tds.h:523
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
int block_size
packet size (512-65535)
Definition: tds.h:965
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
void tds_staticout_stream_init(TDSSTATICOUTSTREAM *stream, void *ptr, size_t len)
Initialize an output stream for write into a static allocated buffer.
Definition: stream.c:313
Definition: tds.h:1029
size_t size
size of data inside buffer
Definition: stream.h:106
Definition: tds.h:1571
Definition: tds.h:517
static int tds_staticin_stream_read(TDSINSTREAM *stream, void *ptr, size_t len)
Reads data from a static allocated buffer.
Definition: stream.c:268
Definition: charset_lookup.h:36
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
static int tds_dataout_stream_write(TDSOUTSTREAM *stream, size_t len)
Writes data to network for output stream.
Definition: stream.c:215
freetds-1.3.6/doc/reference/a00239.html000644 025423 025423 00000137477 14162303416 021035 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/bulk.c File Reference
FreeTDS API
bulk.c File Reference

Handle bulk copy. More...

#include <config.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/checks.h>
#include <freetds/bytes.h>
#include <freetds/iconv.h>
#include <freetds/stream.h>
#include <freetds/utils/string.h>
#include <freetds/replacements.h>
Include dependency graph for bulk.c:

Classes

struct  tds_file_stream
 input stream to read a file More...
 
struct  tds_pbcb
 Holds clause buffer. More...
 

Typedefs

typedef struct tds_file_stream TDSFILESTREAM
 input stream to read a file
 
typedef struct tds_pbcb TDSPBCB
 Holds clause buffer.
 

Functions

static int tds5_bcp_add_fixed_columns (TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, unsigned char *rowbuffer, int start)
 Add fixed size columns to the row. More...
 
static int tds5_bcp_add_variable_columns (TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, TDS_UCHAR *rowbuffer, int start, int *pncols)
 Add variable size columns to the row. More...
 
static TDSRET tds5_send_record (TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset)
 
static void tds5_swap_data (const TDSCOLUMN *col, void *p)
 
static TDSRET tds7_bcp_send_colmetadata (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Send BCP metadata to server. More...
 
static TDSRET tds7_build_bulk_insert_stmt (TDSSOCKET *tds, TDSPBCB *clause, TDSCOLUMN *bcpcol, int first)
 Help to build query to be sent to server. More...
 
static TDSRET tds7_send_record (TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, int offset)
 
TDSRET tds_bcp_done (TDSSOCKET *tds, int *rows_copied)
 Tell we finished sending BCP data to server. More...
 
TDSRET tds_bcp_fread (TDSSOCKET *tds, TDSICONV *char_conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
 Read a data file, passing the data through iconv(). More...
 
TDSRET tds_bcp_init (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Initialize BCP information. More...
 
static void tds_bcp_row_free (TDSRESULTINFO *result, unsigned char *row)
 Free row data allocated in the result set.
 
TDSRET tds_bcp_send_record (TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset)
 Send one row of data to server. More...
 
TDSRET tds_bcp_start (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Start sending BCP data to server. More...
 
TDSRET tds_bcp_start_copy_in (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Start bulk copy to server. More...
 
static TDSRET tds_bcp_start_insert_stmt (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Prepare the query to be sent to server to request BCP information. More...
 
static int tds_file_stream_read (TDSINSTREAM *stream, void *ptr, size_t len)
 Reads a chunk of data from file stream checking for terminator. More...
 
TDSRET tds_writetext_continue (TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
 Send some data in the writetext request started by tds_writetext_start. More...
 
TDSRET tds_writetext_end (TDSSOCKET *tds)
 Finish sending writetext data. More...
 
TDSRET tds_writetext_start (TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
 Start writing writetext request. More...
 

Detailed Description

Handle bulk copy.

Function Documentation

◆ tds5_bcp_add_fixed_columns()

static int tds5_bcp_add_fixed_columns ( TDSBCPINFO bcpinfo,
tds_bcp_get_col_data  get_col_data,
tds_bcp_null_error  null_error,
int  offset,
unsigned char *  rowbuffer,
int  start 
)
static

Add fixed size columns to the row.

Parameters
bcpinfoBCP information
get_col_datafunction to call to retrieve data to be sent
ignoredfunction to call if we try to send NULL if not allowed (not used)
offsetpassed to get_col_data and null_error to specify the row to get
rowbufferrow buffer to write to
startrow buffer last end position
Returns
new row length or -1 on error.

◆ tds5_bcp_add_variable_columns()

static int tds5_bcp_add_variable_columns ( TDSBCPINFO bcpinfo,
tds_bcp_get_col_data  get_col_data,
tds_bcp_null_error  null_error,
int  offset,
TDS_UCHAR *  rowbuffer,
int  start,
int *  pncols 
)
static

Add variable size columns to the row.

Parameters
bcpinfoBCP information already prepared
get_col_datafunction to call to retrieve data to be sent
null_errorfunction to call if we try to send NULL if not allowed
offsetpassed to get_col_data and null_error to specify the row to get
rowbufferThe row image that will be sent to the server.
startWhere to begin copying data into the rowbuffer.
pncolsAddress of output variable holding the count of columns added to the rowbuffer.
Returns
length of (potentially modified) rowbuffer, or -1.

◆ tds7_bcp_send_colmetadata()

static TDSRET tds7_bcp_send_colmetadata ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)
static

Send BCP metadata to server.

Only for TDS 7.0+.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information
Returns
TDS_SUCCESS or TDS_FAIL.
Here is the call graph for this function:

◆ tds7_build_bulk_insert_stmt()

static TDSRET tds7_build_bulk_insert_stmt ( TDSSOCKET tds,
TDSPBCB clause,
TDSCOLUMN bcpcol,
int  first 
)
static

Help to build query to be sent to server.

Append column declaration to the query. Only for TDS 7.0+.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
[out]clauseoutput string
bcpcolcolumn to append
firsttrue if column is the first
Returns
TDS_SUCCESS or TDS_FAIL.
Here is the call graph for this function:

◆ tds_bcp_done()

TDSRET tds_bcp_done ( TDSSOCKET tds,
int *  rows_copied 
)

Tell we finished sending BCP data to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
[out]rows_copiednumber of rows copied to server
Here is the call graph for this function:

◆ tds_bcp_fread()

TDSRET tds_bcp_fread ( TDSSOCKET tds,
TDSICONV char_conv,
FILE *  stream,
const char *  terminator,
size_t  term_len,
char **  outbuf,
size_t *  outbytes 
)

Read a data file, passing the data through iconv().

Return values
TDS_SUCCESSsuccess
TDS_FAILerror reading the column
TDS_NO_MORE_RESULTSend of file detected
Here is the call graph for this function:

◆ tds_bcp_init()

TDSRET tds_bcp_init ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

Initialize BCP information.

Query structure of the table to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information to initialize. Structure should be allocate and table name and direction should be already set.

◆ tds_bcp_send_record()

TDSRET tds_bcp_send_record ( TDSSOCKET tds,
TDSBCPINFO bcpinfo,
tds_bcp_get_col_data  get_col_data,
tds_bcp_null_error  null_error,
int  offset 
)

Send one row of data to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information
get_col_datafunction to call to retrieve data to be sent
ignoredfunction to call if we try to send NULL if not allowed (not used)
offsetpassed to get_col_data and null_error to specify the row to get
Returns
TDS_SUCCESS or TDS_FAIL.

◆ tds_bcp_start()

TDSRET tds_bcp_start ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

Start sending BCP data to server.

Initialize stream to accept data.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information already prepared
Here is the call graph for this function:

◆ tds_bcp_start_copy_in()

TDSRET tds_bcp_start_copy_in ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

Start bulk copy to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information already prepared
Here is the call graph for this function:

◆ tds_bcp_start_insert_stmt()

static TDSRET tds_bcp_start_insert_stmt ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)
static

Prepare the query to be sent to server to request BCP information.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information

◆ tds_file_stream_read()

static int tds_file_stream_read ( TDSINSTREAM stream,
void *  ptr,
size_t  len 
)
static

Reads a chunk of data from file stream checking for terminator.

Parameters
streamfile stream
ptrbuffer where to read data
lenlength of buffer
Here is the caller graph for this function:

◆ tds_writetext_continue()

TDSRET tds_writetext_continue ( TDSSOCKET tds,
const TDS_UCHAR *  text,
TDS_UINT  size 
)

Send some data in the writetext request started by tds_writetext_start.

You should write in total (with multiple calls to this function) all bytes declared calling tds_writetext_start.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
textdata to write
sizedata size in bytes
Here is the call graph for this function:

◆ tds_writetext_end()

TDSRET tds_writetext_end ( TDSSOCKET tds)

Finish sending writetext data.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
Here is the call graph for this function:

◆ tds_writetext_start()

TDSRET tds_writetext_start ( TDSSOCKET tds,
const char *  objname,
const char *  textptr,
const char *  timestamp,
int  with_log,
TDS_UINT  size 
)

Start writing writetext request.

This request start a bulk session.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
objnametable name
textptrTEXTPTR (see sql documentation)
timestampdata timestamp
with_logis log is enabled during insert
sizebytes to be inserted
Here is the call graph for this function:
freetds-1.3.6/doc/reference/a00239_a1b83c9db016b481aa1fa0352f976d50d_icgraph.dot000644 025423 025423 00000001345 14162303416 027117 0ustar00fredianofrediano000000 000000 digraph "tds_file_stream_read" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_file_stream_read",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reads a chunk of data from file stream checking for terminator."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_bcp_fread",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a8184311543c685f2ee0bcccfb725ca02",tooltip="Read a data file, passing the data through iconv()."]; } freetds-1.3.6/doc/reference/a00239_a3118c7232bc9c3e47f8ba872bb39e967_cgraph.dot000644 025423 025423 00000001276 14162303416 026725 0ustar00fredianofrediano000000 000000 digraph "tds7_build_bulk_insert_stmt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds7_build_bulk_insert_stmt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Help to build query to be sent to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00239_a4daaa551e54dbd978650e2eef89e09ff_cgraph.dot000644 025423 025423 00000001255 14162303416 027226 0ustar00fredianofrediano000000 000000 digraph "tds7_bcp_send_colmetadata" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds7_bcp_send_colmetadata",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send BCP metadata to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00239_a5eec23828b0610c58de248c4edb53879_cgraph.dot000644 025423 025423 00000001243 14162303416 026713 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_start_copy_in" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_start_copy_in",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start bulk copy to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00239_a7711612cc544a7da2c7aa212b870acb2_cgraph.dot000644 025423 025423 00000001245 14162303416 026727 0ustar00fredianofrediano000000 000000 digraph "tds_writetext_start" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_writetext_start",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start writing writetext request."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_submit_queryf",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gad695defcbf663b0023851a198206a772",tooltip="Format and submit a query."]; } freetds-1.3.6/doc/reference/a00239_a8208eef2a3974ae1f0cf3c8c8ab011ce_cgraph.dot000644 025423 025423 00000001232 14162303416 027166 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_start" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_start",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start sending BCP data to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00239_a86ac92bd8a3c61a413d27150ec9bc202_cgraph.dot000644 025423 025423 00000001323 14162303416 026736 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_fread" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_fread",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Read a data file, passing the data through iconv()."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_file_stream_read",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00239.html#a1b83c9db016b481aa1fa0352f976d50d",tooltip="Reads a chunk of data from file stream checking for terminator."]; } freetds-1.3.6/doc/reference/a00239_ab68dead99a2ebec55895a10cd3db5202_cgraph.dot000644 025423 025423 00000002012 14162303416 027170 0ustar00fredianofrediano000000 000000 digraph "tds_writetext_continue" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_writetext_continue",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send some data in the writetext request started by tds_writetext_start."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a16db200d2281f76fe46fc1cbe37ca9df",tooltip="Set state of TDS connection, with logging and checking."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00240.dot000644 025423 025423 00000017252 14162303416 020633 0ustar00fredianofrediano000000 000000 digraph "src/tds/bulk.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/tds/bulk.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Handle bulk copy."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node7 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node4 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node4 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node4 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node4 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node14 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node4 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node18 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node19 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node20 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node4 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/checks.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00395_source.html",tooltip=" "]; Node22 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/bytes.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00386_source.html",tooltip=" "]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node24 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="freetds/stream.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00443_source.html",tooltip=" "]; Node25 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00239_ac1e460551f1188620ea478238864ac4b_cgraph.dot000644 025423 025423 00000001727 14162303416 026467 0ustar00fredianofrediano000000 000000 digraph "tds_writetext_end" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_writetext_end",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Finish sending writetext data."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a16db200d2281f76fe46fc1cbe37ca9df",tooltip="Set state of TDS connection, with logging and checking."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00239_ade7df2db455b61edc83819ad60edb339_cgraph.dot000644 025423 025423 00000001243 14162303416 027207 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_done" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_done",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Tell we finished sending BCP data to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00248.html000644 025423 025423 00000116010 14162303416 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/data.c File Reference
FreeTDS API
data.c File Reference

Handle different data handling from network. More...

#include <config.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <freetds/utils.h>
#include <freetds/tds.h>
#include <freetds/bytes.h>
#include <freetds/iconv.h>
#include <freetds/checks.h>
#include <freetds/stream.h>
#include <freetds/data.h>
#include <freetds/pushvis.h>
#include <freetds/popvis.h>
#include "tds_types.h"
Include dependency graph for data.c:

Classes

struct  tds_varmax_stream
 

Macros

#define MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define TDS_DECLARE_FUNCS(name)    extern const TDSCOLUMNFUNCS tds_ ## name ## _funcs
 
#define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS
 
#define USE_ICONV   (tds->conn->use_iconv)
 

Typedefs

typedef struct tds_varmax_stream TDSVARMAXSTREAM
 

Functions

static TDSRET tds72_get_varmax (TDSSOCKET *tds, TDSCOLUMN *curcol)
 
TDSRET tds_clrudt_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_clrudt_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_clrudt_row_len (TDSCOLUMN *col)
 
 TDS_COMPILE_CHECK (tds_variant_offset, TDS_OFFSET(TDSVARIANT, data)==TDS_OFFSET(TDSBLOB, textvalue))
 
 TDS_COMPILE_CHECK (tds_variant_size, sizeof(((TDSVARIANT *) 0) ->data)==sizeof(((TDSBLOB *) 0) ->textvalue))
 
 TDS_COMPILE_CHECK (variant_size, sizeof(TDSBLOB) >=sizeof(TDSVARIANT))
 
 TDS_DECLARE_FUNCS (clrudt)
 
 TDS_DECLARE_FUNCS (generic)
 
 TDS_DECLARE_FUNCS (invalid)
 
 TDS_DECLARE_FUNCS (msdatetime)
 
 TDS_DECLARE_FUNCS (numeric)
 
 TDS_DECLARE_FUNCS (sybbigtime)
 
 TDS_DECLARE_FUNCS (variant)
 
TDSRET tds_generic_get (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Read a data from wire. More...
 
TDSRET tds_generic_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_generic_put (TDSSOCKET *tds, TDSCOLUMN *curcol, int bcp7)
 Write data to wire. More...
 
TDSRET tds_generic_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 Put data information to wire. More...
 
TDS_INT tds_generic_row_len (TDSCOLUMN *col)
 
TDS_SERVER_TYPE tds_get_cardinal_type (TDS_SERVER_TYPE datatype, int usertype)
 
static TDSRET tds_get_char_dynamic (TDSSOCKET *tds, TDSCOLUMN *curcol, void **pp, size_t allocated, TDSINSTREAM *r_stream)
 
static const TDSCOLUMNFUNCStds_get_column_funcs (TDSCONNECTION *conn, int type)
 
TDSRET tds_invalid_get (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_invalid_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_invalid_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_invalid_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_invalid_row_len (TDSCOLUMN *col)
 
TDSRET tds_msdatetime_get (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_msdatetime_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_msdatetime_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_msdatetime_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_msdatetime_row_len (TDSCOLUMN *col)
 
TDSRET tds_numeric_get (TDSSOCKET *tds, TDSCOLUMN *curcol)
 
TDSRET tds_numeric_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_numeric_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_numeric_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_numeric_row_len (TDSCOLUMN *col)
 
void tds_set_column_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency. More...
 
void tds_set_param_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency. More...
 
static void tds_swap_numeric (TDS_NUMERIC *num)
 Converts numeric from Microsoft representation to internal one (Sybase). More...
 
TDSRET tds_sybbigtime_get (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_sybbigtime_get_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDSRET tds_sybbigtime_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_sybbigtime_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
TDS_INT tds_sybbigtime_row_len (TDSCOLUMN *col)
 
TDSRET tds_variant_get (TDSSOCKET *tds, TDSCOLUMN *curcol)
 
TDSRET tds_variant_put (TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
TDSRET tds_variant_put_info (TDSSOCKET *tds, TDSCOLUMN *col)
 
static int tds_varmax_stream_read (TDSINSTREAM *stream, void *ptr, size_t len)
 

Detailed Description

Handle different data handling from network.

Function Documentation

◆ tds_generic_get()

TDSRET tds_generic_get ( TDSSOCKET tds,
TDSCOLUMN curcol 
)

Read a data from wire.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn where store column information
Returns
TDS_FAIL on error or TDS_SUCCESS

◆ tds_generic_put()

TDSRET tds_generic_put ( TDSSOCKET tds,
TDSCOLUMN curcol,
int  bcp7 
)

Write data to wire.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn where store column information
Returns
TDS_FAIL on error or TDS_SUCCESS
Here is the call graph for this function:

◆ tds_generic_put_info()

TDSRET tds_generic_put_info ( TDSSOCKET tds,
TDSCOLUMN col 
)

Put data information to wire.

Parameters
tdsstate information for the socket and the TDS protocol
colcolumn where to store information
Returns
TDS_SUCCESS or TDS_FAIL
Here is the call graph for this function:

◆ tds_set_column_type()

void tds_set_column_type ( TDSCONNECTION conn,
TDSCOLUMN curcol,
TDS_SERVER_TYPE  type 
)

Set type of column initializing all dependency.

column_usertype should already be set.

Parameters
curcolcolumn to set
typetype to set

◆ tds_set_param_type()

void tds_set_param_type ( TDSCONNECTION conn,
TDSCOLUMN curcol,
TDS_SERVER_TYPE  type 
)

Set type of column initializing all dependency.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn to set
typetype to set

◆ tds_swap_numeric()

static void tds_swap_numeric ( TDS_NUMERIC num)
static

Converts numeric from Microsoft representation to internal one (Sybase).

Parameters
numnumeric data to convert
freetds-1.3.6/doc/reference/a00248_a84e17808683ba2dd956e811a42e23176_cgraph.dot000644 025423 025423 00000001220 14162303416 026464 0ustar00fredianofrediano000000 000000 digraph "tds_generic_put" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_generic_put",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Write data to wire."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00248_aabd0e5f15615b5c141c525b76e746520_cgraph.dot000644 025423 025423 00000001245 14162303416 026606 0ustar00fredianofrediano000000 000000 digraph "tds_generic_put_info" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_generic_put_info",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Put data information to wire."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_fix_column_size",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga440f0f469afad1eac4c008979873ccdd",tooltip="Get column size for wire."]; } freetds-1.3.6/doc/reference/a00249.dot000644 025423 025423 00000022142 14162303416 020636 0ustar00fredianofrediano000000 000000 digraph "src/tds/data.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/tds/data.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Handle different data handling from network."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="freetds/utils.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00485_source.html",tooltip=" "]; Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="freetds/time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node7 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node6 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node6 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node11 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node11 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node13 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node11 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node11 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node17 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node19 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node20 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node21 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node11 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/bytes.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00386_source.html",tooltip=" "]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node24 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="freetds/checks.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00395_source.html",tooltip=" "]; Node25 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node26 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node26 [label="freetds/stream.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00443_source.html",tooltip=" "]; Node26 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node26 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node27 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node27 [label="freetds/data.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00404_source.html",tooltip=" "]; Node27 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node27 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node28 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node28 [label="tds_types.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00299_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00269_source.html000644 025423 025423 00000536752 14162303415 022416 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/num_limits.h Source File
FreeTDS API
num_limits.h
1 #define LIMIT_INDEXES_ADJUST 4
2 
3 static const signed char limit_indexes[79]= {
4  0, /* 0 */
5  -3, /* 1 */
6  -6, /* 2 */
7  -9, /* 3 */
8  -12, /* 4 */
9  -15, /* 5 */
10  -18, /* 6 */
11  -21, /* 7 */
12  -24, /* 8 */
13  -27, /* 9 */
14  -30, /* 10 */
15  -32, /* 11 */
16  -34, /* 12 */
17  -36, /* 13 */
18  -38, /* 14 */
19  -40, /* 15 */
20  -42, /* 16 */
21  -44, /* 17 */
22  -46, /* 18 */
23  -48, /* 19 */
24  -50, /* 20 */
25  -51, /* 21 */
26  -52, /* 22 */
27  -53, /* 23 */
28  -54, /* 24 */
29  -55, /* 25 */
30  -56, /* 26 */
31  -57, /* 27 */
32  -58, /* 28 */
33  -59, /* 29 */
34  -59, /* 30 */
35  -59, /* 31 */
36  -59, /* 32 */
37  -60, /* 33 */
38  -61, /* 34 */
39  -62, /* 35 */
40  -63, /* 36 */
41  -64, /* 37 */
42  -65, /* 38 */
43  -66, /* 39 */
44  -66, /* 40 */
45  -66, /* 41 */
46  -66, /* 42 */
47  -66, /* 43 */
48  -66, /* 44 */
49  -66, /* 45 */
50  -66, /* 46 */
51  -66, /* 47 */
52  -66, /* 48 */
53  -66, /* 49 */
54  -65, /* 50 */
55  -64, /* 51 */
56  -63, /* 52 */
57  -62, /* 53 */
58  -61, /* 54 */
59  -60, /* 55 */
60  -59, /* 56 */
61  -58, /* 57 */
62  -57, /* 58 */
63  -55, /* 59 */
64  -53, /* 60 */
65  -51, /* 61 */
66  -49, /* 62 */
67  -47, /* 63 */
68  -45, /* 64 */
69  -44, /* 65 */
70  -43, /* 66 */
71  -42, /* 67 */
72  -41, /* 68 */
73  -39, /* 69 */
74  -37, /* 70 */
75  -35, /* 71 */
76  -33, /* 72 */
77  -31, /* 73 */
78  -29, /* 74 */
79  -27, /* 75 */
80  -25, /* 76 */
81  -23, /* 77 */
82  -21, /* 78 */
83 };
84 
85 static const TDS_WORD limits[]= {
86  0x00000001u, /* 0 */
87  0x0000000au, /* 1 */
88  0x00000064u, /* 2 */
89  0x000003e8u, /* 3 */
90  0x00002710u, /* 4 */
91  0x000186a0u, /* 5 */
92  0x000f4240u, /* 6 */
93  0x00989680u, /* 7 */
94  0x05f5e100u, /* 8 */
95  0x3b9aca00u, /* 9 */
96  0x00000002u, /* 10 */
97  0x540be400u, /* 11 */
98  0x00000017u, /* 12 */
99  0x4876e800u, /* 13 */
100  0x000000e8u, /* 14 */
101  0xd4a51000u, /* 15 */
102  0x00000918u, /* 16 */
103  0x4e72a000u, /* 17 */
104  0x00005af3u, /* 18 */
105  0x107a4000u, /* 19 */
106  0x00038d7eu, /* 20 */
107  0xa4c68000u, /* 21 */
108  0x002386f2u, /* 22 */
109  0x6fc10000u, /* 23 */
110  0x01634578u, /* 24 */
111  0x5d8a0000u, /* 25 */
112  0x0de0b6b3u, /* 26 */
113  0xa7640000u, /* 27 */
114  0x8ac72304u, /* 28 */
115  0x89e80000u, /* 29 */
116  0x00000005u, /* 30 */
117  0x6bc75e2du, /* 31 */
118  0x63100000u, /* 32 */
119  0x00000036u, /* 33 */
120  0x35c9adc5u, /* 34 */
121  0xdea00000u, /* 35 */
122  0x0000021eu, /* 36 */
123  0x19e0c9bau, /* 37 */
124  0xb2400000u, /* 38 */
125  0x0000152du, /* 39 */
126  0x02c7e14au, /* 40 */
127  0xf6800000u, /* 41 */
128  0x0000d3c2u, /* 42 */
129  0x1bceccedu, /* 43 */
130  0xa1000000u, /* 44 */
131  0x00084595u, /* 45 */
132  0x16140148u, /* 46 */
133  0x4a000000u, /* 47 */
134  0x0052b7d2u, /* 48 */
135  0xdcc80cd2u, /* 49 */
136  0xe4000000u, /* 50 */
137  0x033b2e3cu, /* 51 */
138  0x9fd0803cu, /* 52 */
139  0xe8000000u, /* 53 */
140  0x204fce5eu, /* 54 */
141  0x3e250261u, /* 55 */
142  0x10000000u, /* 56 */
143  0x00000001u, /* 57 */
144  0x431e0faeu, /* 58 */
145  0x6d7217cau, /* 59 */
146  0xa0000000u, /* 60 */
147  0x0000000cu, /* 61 */
148  0x9f2c9cd0u, /* 62 */
149  0x4674edeau, /* 63 */
150  0x40000000u, /* 64 */
151  0x0000007eu, /* 65 */
152  0x37be2022u, /* 66 */
153  0xc0914b26u, /* 67 */
154  0x80000000u, /* 68 */
155  0x000004eeu, /* 69 */
156  0x2d6d415bu, /* 70 */
157  0x85acef81u, /* 71 */
158  0x0000314du, /* 72 */
159  0xc6448d93u, /* 73 */
160  0x38c15b0au, /* 74 */
161  0x0001ed09u, /* 75 */
162  0xbead87c0u, /* 76 */
163  0x378d8e64u, /* 77 */
164  0x00134261u, /* 78 */
165  0x72c74d82u, /* 79 */
166  0x2b878fe8u, /* 80 */
167  0x00c097ceu, /* 81 */
168  0x7bc90715u, /* 82 */
169  0xb34b9f10u, /* 83 */
170  0x0785ee10u, /* 84 */
171  0xd5da46d9u, /* 85 */
172  0x00f436a0u, /* 86 */
173  0x4b3b4ca8u, /* 87 */
174  0x5a86c47au, /* 88 */
175  0x098a2240u, /* 89 */
176  0x00000002u, /* 90 */
177  0xf050fe93u, /* 91 */
178  0x8943acc4u, /* 92 */
179  0x5f655680u, /* 93 */
180  0x0000001du, /* 94 */
181  0x6329f1c3u, /* 95 */
182  0x5ca4bfabu, /* 96 */
183  0xb9f56100u, /* 97 */
184  0x00000125u, /* 98 */
185  0xdfa371a1u, /* 99 */
186  0x9e6f7cb5u, /* 100 */
187  0x4395ca00u, /* 101 */
188  0x00000b7au, /* 102 */
189  0xbc627050u, /* 103 */
190  0x305adf14u, /* 104 */
191  0xa3d9e400u, /* 105 */
192  0x000072cbu, /* 106 */
193  0x5bd86321u, /* 107 */
194  0xe38cb6ceu, /* 108 */
195  0x6682e800u, /* 109 */
196  0x00047bf1u, /* 110 */
197  0x9673df52u, /* 111 */
198  0xe37f2410u, /* 112 */
199  0x011d1000u, /* 113 */
200  0x002cd76fu, /* 114 */
201  0xe086b93cu, /* 115 */
202  0xe2f768a0u, /* 116 */
203  0x0b22a000u, /* 117 */
204  0x01c06a5eu, /* 118 */
205  0xc5433c60u, /* 119 */
206  0xddaa1640u, /* 120 */
207  0x6f5a4000u, /* 121 */
208  0x118427b3u, /* 122 */
209  0xb4a05bc8u, /* 123 */
210  0xa8a4de84u, /* 124 */
211  0x59868000u, /* 125 */
212  0xaf298d05u, /* 126 */
213  0x0e4395d6u, /* 127 */
214  0x9670b12bu, /* 128 */
215  0x7f410000u, /* 129 */
216  0x00000006u, /* 130 */
217  0xd79f8232u, /* 131 */
218  0x8ea3da61u, /* 132 */
219  0xe066ebb2u, /* 133 */
220  0xf88a0000u, /* 134 */
221  0x00000044u, /* 135 */
222  0x6c3b15f9u, /* 136 */
223  0x926687d2u, /* 137 */
224  0xc40534fdu, /* 138 */
225  0xb5640000u, /* 139 */
226  0x000002acu, /* 140 */
227  0x3a4edbbfu, /* 141 */
228  0xb8014e3bu, /* 142 */
229  0xa83411e9u, /* 143 */
230  0x15e80000u, /* 144 */
231  0x00001abau, /* 145 */
232  0x4714957du, /* 146 */
233  0x300d0e54u, /* 147 */
234  0x9208b31au, /* 148 */
235  0xdb100000u, /* 149 */
236  0x00010b46u, /* 150 */
237  0xc6cdd6e3u, /* 151 */
238  0xe0828f4du, /* 152 */
239  0xb456ff0cu, /* 153 */
240  0x8ea00000u, /* 154 */
241  0x000a70c3u, /* 155 */
242  0xc40a64e6u, /* 156 */
243  0xc5199909u, /* 157 */
244  0x0b65f67du, /* 158 */
245  0x92400000u, /* 159 */
246  0x006867a5u, /* 160 */
247  0xa867f103u, /* 161 */
248  0xb2fffa5au, /* 162 */
249  0x71fba0e7u, /* 163 */
250  0xb6800000u, /* 164 */
251  0x04140c78u, /* 165 */
252  0x940f6a24u, /* 166 */
253  0xfdffc788u, /* 167 */
254  0x73d4490du, /* 168 */
255  0x21000000u, /* 169 */
256  0x28c87cb5u, /* 170 */
257  0xc89a2571u, /* 171 */
258  0xebfdcb54u, /* 172 */
259  0x864ada83u, /* 173 */
260  0x4a000000u, /* 174 */
261  0x00000001u, /* 175 */
262  0x97d4df19u, /* 176 */
263  0xd6057673u, /* 177 */
264  0x37e9f14du, /* 178 */
265  0x3eec8920u, /* 179 */
266  0xe4000000u, /* 180 */
267  0x0000000fu, /* 181 */
268  0xee50b702u, /* 182 */
269  0x5c36a080u, /* 183 */
270  0x2f236d04u, /* 184 */
271  0x753d5b48u, /* 185 */
272  0xe8000000u, /* 186 */
273  0x0000009fu, /* 187 */
274  0x4f272617u, /* 188 */
275  0x9a224501u, /* 189 */
276  0xd762422cu, /* 190 */
277  0x946590d9u, /* 191 */
278  0x10000000u, /* 192 */
279  0x00000639u, /* 193 */
280  0x17877cecu, /* 194 */
281  0x0556b212u, /* 195 */
282  0x69d695bdu, /* 196 */
283  0xcbf7a87au, /* 197 */
284  0xa0000000u, /* 198 */
285  0x00003e3au, /* 199 */
286  0xeb4ae138u, /* 200 */
287  0x3562f4b8u, /* 201 */
288  0x2261d969u, /* 202 */
289  0xf7ac94cau, /* 203 */
290  0x40000000u, /* 204 */
291  0x00026e4du, /* 205 */
292  0x30eccc32u, /* 206 */
293  0x15dd8f31u, /* 207 */
294  0x57d27e23u, /* 208 */
295  0xacbdcfe6u, /* 209 */
296  0x80000000u, /* 210 */
297  0x00184f03u, /* 211 */
298  0xe93ff9f4u, /* 212 */
299  0xdaa797edu, /* 213 */
300  0x6e38ed64u, /* 214 */
301  0xbf6a1f01u, /* 215 */
302  0x00f31627u, /* 216 */
303  0x1c7fc390u, /* 217 */
304  0x8a8bef46u, /* 218 */
305  0x4e3945efu, /* 219 */
306  0x7a25360au, /* 220 */
307  0x097edd87u, /* 221 */
308  0x1cfda3a5u, /* 222 */
309  0x697758bfu, /* 223 */
310  0x0e3cbb5au, /* 224 */
311  0xc5741c64u, /* 225 */
312  0x5ef4a747u, /* 226 */
313  0x21e86476u, /* 227 */
314  0x1ea97776u, /* 228 */
315  0x8e5f518bu, /* 229 */
316  0xb6891be8u, /* 230 */
317  0x00000003u, /* 231 */
318  0xb58e88c7u, /* 232 */
319  0x5313ec9du, /* 233 */
320  0x329eaaa1u, /* 234 */
321  0x8fb92f75u, /* 235 */
322  0x215b1710u, /* 236 */
323  0x00000025u, /* 237 */
324  0x179157c9u, /* 238 */
325  0x3ec73e23u, /* 239 */
326  0xfa32aa4fu, /* 240 */
327  0x9d3bda93u, /* 241 */
328  0x4d8ee6a0u, /* 242 */
329  0x00000172u, /* 243 */
330  0xebad6ddcu, /* 244 */
331  0x73c86d67u, /* 245 */
332  0xc5faa71cu, /* 246 */
333  0x245689c1u, /* 247 */
334  0x07950240u, /* 248 */
335  0x00000e7du, /* 249 */
336  0x34c64a9cu, /* 250 */
337  0x85d4460du, /* 251 */
338  0xbbca8719u, /* 252 */
339  0x6b61618au, /* 253 */
340  0x4bd21680u, /* 254 */
341  0x000090e4u, /* 255 */
342  0x0fbeea1du, /* 256 */
343  0x3a4abc89u, /* 257 */
344  0x55e946feu, /* 258 */
345  0x31cdcf66u, /* 259 */
346  0xf634e100u, /* 260 */
347  0x0005a8e8u, /* 261 */
348  0x9d752524u, /* 262 */
349  0x46eb5d5du, /* 263 */
350  0x5b1cc5edu, /* 264 */
351  0xf20a1a05u, /* 265 */
352  0x9e10ca00u, /* 266 */
353  0x00389916u, /* 267 */
354  0x2693736au, /* 268 */
355  0xc531a5a5u, /* 269 */
356  0x8f1fbb4bu, /* 270 */
357  0x74650438u, /* 271 */
358  0x2ca7e400u, /* 272 */
359  0x0235faddu, /* 273 */
360  0x81c2822bu, /* 274 */
361  0xb3f07877u, /* 275 */
362  0x973d50f2u, /* 276 */
363  0x8bf22a31u, /* 277 */
364  0xbe8ee800u, /* 278 */
365  0x161bcca7u, /* 279 */
366  0x119915b5u, /* 280 */
367  0x0764b4abu, /* 281 */
368  0xe8652979u, /* 282 */
369  0x7775a5f1u, /* 283 */
370  0x71951000u, /* 284 */
371  0xdd15fe86u, /* 285 */
372  0xaffad912u, /* 286 */
373  0x49ef0eb7u, /* 287 */
374  0x13f39ebeu, /* 288 */
375  0xaa987b6eu, /* 289 */
376  0x6fd2a000u, /* 290 */
377 };
size_t tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len)
Quote a string.
Definition: query.c:2241
Definition: tds.h:643
TDSLOCALE * tds_get_locale(void)
Get locale information.
Definition: locale.c:50
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
void tdsdump_off(TDSDUMP_OFF_ITEM *off_item)
Temporarily turn off logging for current thread.
Definition: log.c:81
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
bool bulk_query
true is query sent was a bulk query so we need to switch state to QUERYING
Definition: tds.h:1244
void tds_start_query(TDSSOCKET *tds, unsigned char packet_type)
Start query packet of a given type.
Definition: query.c:332
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:662
static void tds_dstr_init(DSTR *s)
init a string with empty
Definition: string.h:53
static void tds7_put_query_params(TDSSOCKET *tds, const char *query, size_t query_len)
Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec)
Definition: query.c:1064
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
static const char * tds_next_placeholder_ucs2le(const char *start, const char *end, int named)
Found the next placeholder (? or @param) in a string.
Definition: query.c:644
TDS_INT quarter
quarter (0-3)
Definition: tds.h:161
TDSPACKET * frozen_packets
list of packets frozen, points to first one.
Definition: tds.h:1203
char * charset
character set encoding
Definition: tds.h:968
Definition: tds.h:1057
Used by tds_datecrack.
Definition: tds.h:159
bool defer_close
true if dynamic was marker to be closed when connection is idle
Definition: tds.h:997
#define tds_dstr_empty(s)
Make a string empty.
Definition: string.h:91
char * left
buffer for store bytes readed that could be the terminator
Definition: bulk.c:1015
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:951
TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor)
Deallocate cursor on idle.
Definition: query.c:3057
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
int tm_min
minutes (0-59)
Definition: convert.c:60
static TDSRET tds_put_data_info(TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
Put data information to wire.
Definition: query.c:1533
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:953
TDSRET tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Sends a language string to the database server for processing.
Definition: query.c:350
int tds_iconv_alloc(TDSCONNECTION *conn)
Allocate iconv stuff.
Definition: iconv.c:307
char * buffer
write buffer.
Definition: stream.h:50
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
FILE * f
file to read from
Definition: bulk.c:1007
int tm_ns
nanoseconds (0-999999999)
Definition: convert.c:62
TDSCURSOR * cursors
linked list of cursors allocated for this connection contains only cursors allocated on the server
Definition: tds.h:1107
bool has_status
true is ret_status is valid
Definition: tds.h:1245
Definition: proto.h:39
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:256
DSTR password
password of account login
Definition: tds.h:535
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
Definition: tds.h:582
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3056
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
TDS_INT date
date, 0 = 1900-01-01
Definition: tds.h:148
size_t tds_freeze_written(TDSFREEZE *freeze)
Compute how many bytes has been written from freeze.
Definition: packet.c:935
TDSICONV * tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5])
Get iconv information from a LCID (to support different column encoding under MSSQL2K)
Definition: iconv.c:1245
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:2979
static void tds_swap_numeric(TDS_NUMERIC *num)
Converts numeric from Microsoft representation to internal one (Sybase).
Definition: data.c:1674
Main include file for libtds.
char * pb
buffer
Definition: bulk.c:61
static int tds_socket_read(TDSCONNECTION *conn, TDSSOCKET *tds, unsigned char *buf, int buflen)
Read from an OS socket @TODO remove tds, save error somewhere, report error in another way.
Definition: net.c:727
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
int(* read)(struct tds_input_stream *stream, void *ptr, size_t len)
read some data Return 0 if end of stream Return <0 if error (actually not defined)
Definition: stream.h:35
TDS_INT day
day of month (1-31)
Definition: tds.h:163
bool tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
Read a section of configuration file (INI style file)
Definition: config.c:503
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
static TDSRET tds7_write_param_def_from_query(TDSSOCKET *tds, const char *converted_query, size_t converted_query_len, TDSPARAMINFO *params) TDS_WUR
Write string with parameters definition, useful for TDS7+.
Definition: query.c:903
static int tds_get_socket_error(TDS_SYS_SOCKET sock)
Returns error stored in the socket.
Definition: net.c:217
input stream to read data from a static buffer
Definition: stream.h:81
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:836
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1258
int tds7_get_instance_ports(FILE *output, struct addrinfo *addr)
Get port of all instances.
Definition: net.c:1093
TDSRET tds_generic_put(TDSSOCKET *tds, TDSCOLUMN *curcol, int bcp7)
Write data to wire.
Definition: data.c:919
unsigned char canonic
internal numeric index into array of all encodings
Definition: tds.h:624
Holds informations about a cursor.
Definition: tds.h:937
unsigned char * out_buf
Output buffer.
Definition: tds.h:1185
TDSINSTREAM stream
common fields, must be the first field
Definition: bulk.c:1005
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock)
Set socket to non-blocking.
Definition: net.c:168
TDSLOGIN * tds_init_login(TDSLOGIN *login, TDSLOCALE *locale)
Initialize login structure with locale information and other stuff for connection.
Definition: mem.c:800
TDSRET tds_freeze_abort(TDSFREEZE *freeze)
Discard all data written after the freeze.
Definition: packet.c:961
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Set current dynamic.
Definition: query.c:192
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1093
int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on)
Set socket to not throw SIGPIPE.
Definition: net.c:72
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:941
TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION *conn, const char *id)
Allocate a dynamic statement.
Definition: mem.c:160
TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size)
Stop keeping data for this specific freeze.
Definition: packet.c:1031
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:224
static TDSRET tds7_send_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send dynamic request on TDS 7+ to be executed.
Definition: query.c:1593
struct tds_blob TDSBLOB
Information about blobs (e.g.
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:165
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
TDSPACKET * send_packet
packet we are preparing to send
Definition: tds.h:1231
static TDSRET tds_start_query_head(TDSSOCKET *tds, unsigned char packet_type, TDSHEADERS *head)
Start query packet of a given type.
Definition: query.c:291
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
Definition: login.c:180
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1243
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
static const char * parse_numeric(const char *buf, const char *pend, bool *p_negative, size_t *p_digits, size_t *p_decimals)
Parse a string for numbers.
Definition: convert.c:3422
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:515
Definition: convert.h:34
Definition: poll.h:52
TDSDYNAMIC * dyns
list of dynamic allocated for this connection contains only dynamic allocated on the server
Definition: tds.h:1112
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
int tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen)
Loops until we have received some characters return -1 on failure.
Definition: net.c:916
int tm_mon
month (0-11)
Definition: convert.c:57
unsigned data_len
data length, this does not account SMP header, only TDS part
Definition: tds.h:1071
Definition: md5.h:8
static TDS_INT binary_to_result(int desttype, const void *data, size_t len, CONV_RESULT *cr)
Copy binary data to to result and return len or TDS_CONVERT_NOMEM.
Definition: convert.c:179
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
bool in_row
true if we are getting rows
Definition: tds.h:1246
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
DSTR server_realm_name
server realm name (in freetds.conf)
Definition: tds.h:527
Provide poll call where missing.
void tds_datain_stream_init(TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
Initialize a data input stream.
Definition: stream.c:204
static int tds_count_placeholders_ucs2le(const char *query, const char *query_end)
Count the number of placeholders ('?') in a query.
Definition: query.c:692
Definition: iconv.h:78
static char * tds_get_dynid(TDSCONNECTION *conn, char *id)
Get an id for dynamic query based on TDS information.
Definition: mem.c:94
Definition: challenge.c:564
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:993
input stream to read data from tds protocol
Definition: stream.h:63
TDSRET tds_generic_get(TDSSOCKET *tds, TDSCOLUMN *curcol)
Read a data from wire.
Definition: data.c:713
const char * tds_canonical_charset_name(const char *charset_name)
Determine canonical iconv character set name.
Definition: iconv.c:982
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:129
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:881
static TDSRET tds_answer_challenge(TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
Crypt a given password using schema required for NTLMv1 or NTLM2 authentication.
Definition: challenge.c:291
static TDSRET tds_send_emulated_execute(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
Emulate prepared execute traslating to a normal language.
Definition: query.c:3269
tds_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:652
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
int tds_get_varint_size(TDSCONNECTION *conn, int datatype)
tds_get_varint_size() returns the size of a variable length integer returned in a result string
Definition: tds_types.h:57
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1007
static TDSRET tds_bcp_start_insert_stmt(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Prepare the query to be sent to server to request BCP information.
Definition: bulk.c:266
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
TDSRET tds_submit_begin_tran(TDSSOCKET *tds)
Send a rollback request.
Definition: query.c:3665
Definition: proto.h:50
Definition: net.c:364
int(* write)(struct tds_output_stream *stream, size_t len)
write len bytes from buffer, return <0 if error or len
Definition: stream.h:41
Store variant informations.
Definition: tds.h:604
TDS_INT type
row fetched from this cursor
Definition: tds.h:956
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:164
TDSDYNAMIC * tds_lookup_dynamic(TDSCONNECTION *conn, const char *id)
Finds a dynamic given string id.
Definition: token.c:2587
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2913
size_t tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id for a RPC call.
Definition: query.c:2216
static TDSRET tds4_send_emulated_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
Send RPC as string query.
Definition: query.c:1873
define a stream of data used for input
Definition: stream.h:30
Definition: login.c:174
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
Definition: tds.h:876
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:529
TDS 7.2 SMP packet header.
Definition: proto.h:361
static TDS_INT string_to_int8(const char *buf, const char *pend, TDS_INT8 *res)
convert a number in string to TDS_INT8
Definition: convert.c:3355
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
struct tds_pbcb TDSPBCB
Holds clause buffer.
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
Definition: md4.h:9
char * query
SQL query.
Definition: tds.h:947
static void unix_to_nt_time(uint64_t *nt, struct timeval *tv)
put a 8 byte filetime from a time_t This takes GMT as input
Definition: challenge.c:586
Metadata about columns in regular and compute rows.
Definition: tds.h:689
static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Send BCP metadata to server.
Definition: bulk.c:736
Definition: iconv.h:92
struct tds_cursor * next
next in linked list, keep first
Definition: tds.h:938
TDSRET tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server and execute it.
Definition: query.c:1401
Definition: tds.h:1091
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:939
size_t wire_size
bytes still to read
Definition: stream.h:65
static TDSRET tds5_put_params(TDSSOCKET *tds, TDSPARAMINFO *info, int flags) TDS_WUR
Send parameters to server.
Definition: query.c:1693
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
static int tds_socket_write(TDSCONNECTION *conn, TDSSOCKET *tds, const unsigned char *buf, int buflen)
Write to an OS socket.
Definition: net.c:762
static int tds5_bcp_add_fixed_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, unsigned char *rowbuffer, int start)
Add fixed size columns to the row.
Definition: bulk.c:507
TDSRET tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
Send option commands to server.
Definition: query.c:3389
DSTR * tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len)
Reads a string from wire and put in a DSTR.
Definition: read.c:293
const char * tds_skip_comment(const char *s)
Skip a comment in a query.
Definition: query.c:490
TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
Send some data in the writetext request started by tds_writetext_start.
Definition: bulk.c:1185
TDS_SYS_SOCKET s
tcp socket, INVALID_SOCKET if not connected
Definition: tds.h:1096
int tm_sec
seconds (0-59)
Definition: convert.c:61
static TDSRET tds_put_param_as_string(TDSSOCKET *tds, TDSPARAMINFO *params, int n)
Send a parameter to server.
Definition: query.c:3189
const char * tds_next_placeholder(const char *start)
Get position of next placeholder.
Definition: query.c:535
unsigned char out_flag
output buffer type
Definition: tds.h:1196
Definition: proto.h:62
int tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
Definition: net.c:987
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:978
Definition: tds.h:628
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1248
Definition: proto.h:45
static int string_to_numeric(const char *instr, const char *pend, CONV_RESULT *cr)
convert a number in string to a TDSNUMERIC
Definition: convert.c:2266
size_t tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
Fetch a string from the wire.
Definition: read.c:166
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3159
bool defer_close
true if cursor was marker to be closed when connection is idle
Definition: tds.h:946
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:979
const char * terminator
terminator
Definition: bulk.c:1010
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
@ TDS_SENDING
client would send data
Definition: tds.h:792
Information about blobs (e.g.
Definition: tds.h:593
TDSRET tds_process_login_tokens(TDSSOCKET *tds)
tds_process_login_tokens() is called after sending the login packet to the server.
Definition: token.c:411
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:556
static TDSRET tds_put_data(TDSSOCKET *tds, TDSCOLUMN *curcol)
Write data to wire.
Definition: query.c:279
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:536
TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated)
Initialize a dynamic output stream.
Definition: stream.c:354
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
Definition: tds.h:1019
TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
Start writing writetext request.
Definition: bulk.c:1147
output stream to write data to a dynamic buffer
Definition: stream.h:99
Structure to hold a string.
Definition: string.h:36
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:520
static char * tds5_fix_dot_query(const char *query, size_t *query_len, TDSPARAMINFO *params)
Substitute ?-style placeholders with named (@param) ones.
Definition: query.c:227
Hold information for any results.
Definition: tds.h:769
TDS_INT hour
0-23
Definition: tds.h:166
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1256
static int stringz_to_numeric(const char *instr, CONV_RESULT *cr)
convert a zero terminated string to NUMERIC
Definition: convert.c:2260
static TDSRET tds7_build_bulk_insert_stmt(TDSSOCKET *tds, TDSPBCB *clause, TDSCOLUMN *bcpcol, int first)
Help to build query to be sent to server.
Definition: bulk.c:219
static void tds_bcp_row_free(TDSRESULTINFO *result, unsigned char *row)
Free row data allocated in the result set.
Definition: bulk.c:904
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:546
char * cursor_name
name of the cursor
Definition: tds.h:940
const char * tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len)
Convert a string in an allocated buffer.
Definition: query.c:126
TDS_INT month
month number (0-11)
Definition: tds.h:162
@ TDS_WRITING
client is writing data
Definition: tds.h:791
TDS_INT second
0-59
Definition: tds.h:168
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
static bool tds_cursor_check_allocated(TDSCONNECTION *conn, TDSCURSOR *cursor)
Check if a cursor is allocated into the server.
Definition: query.c:2991
int tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
Select on a socket until it's available or the timeout expires.
Definition: net.c:612
#define TDS_PUT_N_AS_UCS2(tds, s)
Utility to convert a constant ascii string to ucs2 and send to server.
Definition: query.c:110
unsigned int from_malloc
true is buffer came from malloc
Definition: bulk.c:65
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
TDSRET tds_bcp_fread(TDSSOCKET *tds, TDSICONV *char_conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
Read a data file, passing the data through iconv().
Definition: bulk.c:1077
static TDS_INT string_to_uint8(const char *buf, const char *pend, TDS_UINT8 *res)
convert a number in string to TDS_UINT8
Definition: convert.c:3384
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1630
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:206
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
unsigned in_len
input buffer length
Definition: tds.h:1194
unsigned out_pos
current position in out_buf
Definition: tds.h:1193
static TDSRET tds7_write_param_def_from_params(TDSSOCKET *tds, const char *query, size_t query_len, TDSPARAMINFO *params) TDS_WUR
Write string with parameters definition, useful for TDS7+.
Definition: query.c:964
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:721
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
TDSRET tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Submit a prepared query with parameters.
Definition: query.c:1256
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1250
static TDS_INT parse_int8(const char *buf, const char *pend, TDS_UINT8 *res, bool *p_negative)
convert a number in string to TDS_INT8
Definition: convert.c:3325
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163
#define tds_put_tinyint(tds, ti)
Output a tinyint value.
Definition: tds.h:1469
TDS_INT timezone
-840 - 840 minutes from UTC
Definition: tds.h:170
TDSRET tds_convert_stream(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream converting characters.
Definition: stream.c:71
static int tds5_bcp_add_variable_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, TDS_UCHAR *rowbuffer, int start, int *pncols)
Add variable size columns to the row.
Definition: bulk.c:594
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1009
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
unsigned int cb
buffer length
Definition: bulk.c:63
int tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Check if dynamic request must be unprepared.
Definition: query.c:1752
TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont)
Send a rollback request.
Definition: query.c:3693
input stream to read a file
Definition: bulk.c:1003
void tds_staticin_stream_init(TDSSTATICINSTREAM *stream, const void *ptr, size_t len)
Initialize an input stream for read from a static allocated buffer.
Definition: stream.c:286
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
size_t tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol)
Get column size for wire.
Definition: query.c:1491
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1722
static TDS_INT string_to_result(int desttype, const char *s, CONV_RESULT *cr)
Copy a terminated string to result and return len or TDS_CONVERT_NOMEM.
Definition: convert.c:161
TDSRET tds_get_char_data(TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol)
Fetch character data the wire.
Definition: read.c:195
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
Definition: data.c:490
TDS_INT year
year
Definition: tds.h:160
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:84
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
Definition: tds.h:1501
Definition: tds.h:511
int tds_put_string(TDSSOCKET *tds, const char *s, int len)
Output a string to wire automatic translate string to unicode if needed.
Definition: write.c:97
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
int tm_year
year (0=1900)
Definition: convert.c:56
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
int port
port of database service
Definition: tds.h:519
void * tds_realloc(void **pp, size_t new_size)
Reallocate a pointer and update it if success.
Definition: mem.c:1876
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
Definition: login.c:187
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
TDSPARAMINFO * res_info
query results
Definition: tds.h:999
DSTR user_name
account for login
Definition: tds.h:534
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:592
@ TDS_DEAD
no connection
Definition: tds.h:795
static int tds_file_stream_read(TDSINSTREAM *stream, void *ptr, size_t len)
Reads a chunk of data from file stream checking for terminator.
Definition: bulk.c:1047
char * tds_strndup(const void *s, TDS_INTPTR len)
Copy a string of length len to a new allocated buffer This function does not read more than len bytes...
Definition: util.c:406
TDS_SMALLINT offset
time offset
Definition: tds.h:149
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
char * database
database name
Definition: tds.h:970
DSTR crlfile
certificate revocation file
Definition: tds.h:531
TDS_UINT8 time
time, 7 digit precision
Definition: tds.h:147
Definition: util.c:237
static size_t tds_quote(TDSSOCKET *tds, char *buffer, char quoting, const char *id, size_t len)
Quote a string properly.
Definition: query.c:2128
Definition: challenge.c:72
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1202
char id[30]
id of dynamic.
Definition: tds.h:987
static void tds_set_cur_cursor(TDSSOCKET *tds, TDSCURSOR *cursor)
Set current cursor.
Definition: query.c:2253
Definition: tds.h:1047
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:866
unsigned int pending_close
true is connection has pending closing (cursors or dynamic)
Definition: tds.h:1123
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t need)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
int tm_mday
month day (1-31)
Definition: convert.c:58
static const char * tds_skip_quoted_ucs2le(const char *s, const char *end)
Return pointer to end of a quoted string.
Definition: query.c:618
Holds clause buffer.
Definition: bulk.c:59
struct tds_file_stream TDSFILESTREAM
input stream to read a file
@ TDS_IDLE
no data expected
Definition: tds.h:790
Definition: tds.h:1661
Definition: tds.h:574
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
Definition: convert.c:55
TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset)
Send one row of data to server.
Definition: bulk.c:468
Information for a server connection.
Definition: tds.h:1163
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
int tds_count_placeholders(const char *query)
Count the number of placeholders ('?') in a query.
Definition: query.c:571
unsigned char in_flag
input buffer type
Definition: tds.h:1195
DSTR server_spn
server SPN (in freetds.conf)
Definition: tds.h:528
Definition: des.h:16
void tdsdump_on(TDSDUMP_OFF_ITEM *off_item)
Turn logging back on for current thread.
Definition: log.c:101
Definition: proto.h:56
static TDSERRNO tds_setup_socket(TDS_SYS_SOCKET *p_sock, struct addrinfo *addr, unsigned int port, int *p_oserr)
Setup the socket and attempt a connection.
Definition: net.c:249
TDS_INT minute
0-59
Definition: tds.h:167
int tds7_get_instance_port(struct addrinfo *addr, const char *instance)
Get port of given instance.
Definition: net.c:1229
static TDSRET tds_query_flush_packet(TDSSOCKET *tds)
Flush query packet.
Definition: query.c:178
#define TDS_SYB_VER(maj, min, x)
Calc a version number for Sybase.
Definition: tds.h:1731
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1191
Definition: query.c:3098
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
TDSRET tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
Return declaration for column (like "varchar(20)").
Definition: query.c:718
define a stream of data used for output
Definition: stream.h:39
TDSRET tds_freeze_close(TDSFREEZE *freeze)
Stop keeping data for this specific freeze.
Definition: packet.c:996
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:981
DSTR server_charset
charset of server e.g.
Definition: tds.h:523
Definition: tds.h:1085
Definition: tds.h:330
TDSRET tds_submit_commit(TDSSOCKET *tds, int cont)
Send a commit request.
Definition: query.c:3724
void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
Stop writing to server and cache every packet not sending them to server.
Definition: packet.c:907
Definition: challenge.c:65
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
int block_size
packet size (512-65535)
Definition: tds.h:965
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
static int store_monthname(const char *, struct tds_time *)
Test if a string is a month name and store correct month number.
Definition: convert.c:2706
Definition: tds.h:1029
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
TDS_USMALLINT tds_get_usmallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:113
TDSRET tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Unprepare dynamic on idle.
Definition: query.c:1774
static TDSCOMPUTEINFO * tds_alloc_compute_result(TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
Allocate memory for storing compute info return NULL on out of memory.
Definition: mem.c:395
size_t size
size of data inside buffer
Definition: stream.h:106
Definition: proto.h:26
Definition: tds.h:1571
size_t term_len
terminator length in bytes
Definition: bulk.c:1012
Definition: tds.h:517
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:916
static const char * tds_skip_comment_ucs2le(const char *s, const char *end)
Skip a comment in a query.
Definition: query.c:589
DSTR cafile
certificate authorities file
Definition: tds.h:530
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:212
static TDS_INT string_to_int(const char *buf, const char *pend, TDS_INT *res)
convert a number in string to TDS_INT
Definition: convert.c:3286
TDSRET tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server.
Definition: query.c:1124
TDSRET tds_generic_put_info(TDSSOCKET *tds, TDSCOLUMN *col)
Put data information to wire.
Definition: data.c:875
void tds_detach_results(TDSRESULTINFO *info)
Detach result info from it current socket.
Definition: mem.c:488
TDS_INT tds_numeric_to_string(const TDS_NUMERIC *numeric, char *s)
Definition: numeric.c:95
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3093
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:320
static void tds_quote_and_put(TDSSOCKET *tds, const char *s, const char *end)
Send a string to server while quoting it.
Definition: query.c:3079
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
void tdsdump_col(const TDSCOLUMN *col)
Write a column value to the debug log.
Definition: log.c:455
static size_t tds_ascii_to_ucs2(char *buffer, const char *buf)
Accept an ASCII string, convert it to UCS2-LE The input is NUL-terminated, but the output does not co...
Definition: query.c:91
int tm_hour
hours (0-23)
Definition: convert.c:59
freetds-1.3.6/doc/reference/a00281.html000644 025423 025423 00000027600 14162303416 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/read.c File Reference
FreeTDS API
read.c File Reference

Grab data from TDS packets. More...

#include <config.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/iconv.h>
#include <freetds/bytes.h>
#include <freetds/stream.h>
#include <freetds/utils/string.h>
#include <freetds/checks.h>
Include dependency graph for read.c:

Functions

static size_t read_and_convert (TDSSOCKET *tds, TDSICONV *char_conv, size_t *wire_size, char *outbuf, size_t outbytesleft)
 For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not aligned with the character boundary. More...
 
DSTRtds_dstr_get (TDSSOCKET *tds, DSTR *s, size_t len)
 Reads a string from wire and put in a DSTR. More...
 
unsigned char tds_get_byte (TDSSOCKET *tds)
 Return a single byte from the input buffer. More...
 
TDSRET tds_get_char_data (TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol)
 Fetch character data the wire. More...
 
bool tds_get_n (TDSSOCKET *tds, void *dest, size_t need)
 Get N bytes from the buffer and return them in the already allocated space
given to us. More...
 
size_t tds_get_string (TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
 Fetch a string from the wire. More...
 
TDS_UINT tds_get_uint (TDSSOCKET *tds)
 Get an int32 from the server. More...
 
TDS_UINT8 tds_get_uint8 (TDSSOCKET *tds)
 Get an uint64 from the server. More...
 
TDS_USMALLINT tds_get_usmallint (TDSSOCKET *tds)
 Get an int16 from the server.
 
unsigned char tds_peek (TDSSOCKET *tds)
 Reads a byte from the TDS stream without removing it. More...
 
void tds_unget_byte (TDSSOCKET *tds)
 Unget will always work as long as you don't call it twice in a row. More...
 

Detailed Description

Grab data from TDS packets.

freetds-1.3.6/doc/reference/a00282.dot000644 025423 025423 00000017131 14162303416 020635 0ustar00fredianofrediano000000 000000 digraph "src/tds/read.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/tds/read.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Grab data from TDS packets."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node7 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node4 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node4 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node4 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node4 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node14 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node4 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node18 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node19 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node20 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node4 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node22 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/bytes.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00386_source.html",tooltip=" "]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="freetds/stream.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00443_source.html",tooltip=" "]; Node24 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="freetds/checks.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00395_source.html",tooltip=" "]; Node25 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00287_source.html000644 025423 025423 00000227315 14162303416 022407 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/sec_negotiate_gnutls.h Source File
FreeTDS API
sec_negotiate_gnutls.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2015 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #include <gnutls/gnutls.h>
21 #include <gnutls/crypto.h>
22 #ifdef HAVE_GNUTLS_ABSTRACT_H
23 # include <gnutls/abstract.h>
24 #endif
25 
26 #if !defined(HAVE_NETTLE) || !defined(HAVE_GMP) || !defined(HAVE_GNUTLS_RND)
27 # include <gcrypt.h>
28 #endif
29 
30 #ifndef HAVE_NETTLE
31 # include <libtasn1.h>
32 #endif
33 
34 #ifdef HAVE_NETTLE
35 # include <nettle/asn1.h>
36 # include <nettle/rsa.h>
37 # include <nettle/bignum.h>
38 #endif
39 
51 #ifndef HAVE_GNUTLS
52 #error HAVE_GNUTLS not defines, this file should not be included
53 #endif
54 
55 /* emulate GMP if not present */
56 #ifndef HAVE_GMP
57 #define HAVE_GMP 1
58 
59 typedef struct {
60  gcry_mpi_t num;
61 } mpz_t[1];
62 
63 #define mpz_powm(w,n,e,m) \
64  gcry_mpi_powm((w)->num, (n)->num, (e)->num, (m)->num);
65 #define mpz_init(n) do { (n)->num = NULL; } while(0)
66 #define mpz_clear(n) gcry_mpi_release((n)->num)
67 
68 #endif
69 
70 
71 /* emulate Nettle is not present */
72 #ifndef HAVE_NETTLE
73 #define HAVE_NETTLE 1
74 
75 typedef void nettle_random_func(void *ctx, size_t len, uint8_t *out);
76 
77 static inline void
78 nettle_mpz_set_str_256_u(mpz_t x, unsigned length, const uint8_t *s)
79 {
80  gcry_mpi_scan(&x->num, GCRYMPI_FMT_USG, s, length, NULL);
81 }
82 
83 static inline void
84 nettle_mpz_get_str_256(unsigned length, uint8_t *s, const mpz_t x)
85 {
86  gcry_mpi_print(GCRYMPI_FMT_USG, s, length, NULL, x->num);
87 }
88 
90  const unsigned char *data, *data_end;
91  unsigned long length;
92  unsigned long type;
93 };
94 
95 enum asn1_iterator_result {
96  ASN1_ITERATOR_ERROR,
97  ASN1_ITERATOR_PRIMITIVE,
98  ASN1_ITERATOR_CONSTRUCTED,
99  ASN1_ITERATOR_END,
100 };
101 
102 enum {
103  ASN1_SEQUENCE = ASN1_TAG_SEQUENCE,
104 };
105 
106 static enum asn1_iterator_result
107 asn1_der_iterator_next(struct asn1_der_iterator *der)
108 {
109  unsigned char cls;
110  unsigned long tag;
111  int len;
112  long l;
113 
114  if (asn1_get_tag_der(der->data, der->data_end - der->data, &cls, &len, &tag) != ASN1_SUCCESS)
115  return ASN1_ITERATOR_ERROR;
116  der->type = tag;
117  der->data += len;
118  l = asn1_get_length_der(der->data, der->data_end - der->data, &len);
119  if (l < 0)
120  return ASN1_ITERATOR_ERROR;
121  der->data += len;
122  der->length = l;
123  if (cls == ASN1_CLASS_STRUCTURED)
124  return ASN1_ITERATOR_CONSTRUCTED;
125  return ASN1_ITERATOR_PRIMITIVE;
126 }
127 
128 static enum asn1_iterator_result
129 asn1_der_iterator_first(struct asn1_der_iterator *der, int size, const void *der_buf)
130 {
131  der->data = (const unsigned char *) der_buf;
132  der->data_end = der->data + size;
133 
134  return asn1_der_iterator_next(der);
135 }
136 
138  unsigned size;
139  mpz_t n, e;
140 };
141 
142 static void
143 rsa_public_key_init(struct rsa_public_key *key)
144 {
145  key->size = 0;
146  mpz_init(key->n);
147  mpz_init(key->e);
148 }
149 
150 static void
151 rsa_public_key_clear(struct rsa_public_key *key)
152 {
153  mpz_clear(key->n);
154  mpz_clear(key->e);
155 }
156 
157 static int
158 rsa_public_key_from_der_iterator(struct rsa_public_key *key, unsigned key_bits, struct asn1_der_iterator *der)
159 {
160  enum asn1_iterator_result ret;
161 
162  ret = asn1_der_iterator_next(der);
163  if (ret != ASN1_ITERATOR_PRIMITIVE || der->type != ASN1_TAG_INTEGER)
164  return 0;
165  gcry_mpi_scan(&key->n->num, GCRYMPI_FMT_USG, der->data, der->length, NULL);
166  key->size = (gcry_mpi_get_nbits(key->n->num)+7)/8;
167  der->data += der->length;
168 
169  ret = asn1_der_iterator_next(der);
170  if (ret != ASN1_ITERATOR_PRIMITIVE || der->type != ASN1_TAG_INTEGER)
171  return 0;
172  gcry_mpi_scan(&key->e->num, GCRYMPI_FMT_USG, der->data, der->length, NULL);
173 
174  return 1;
175 }
176 
177 static void
178 sha1(uint8_t *hash, const void *data, size_t len)
179 {
180  gcry_md_hash_buffer(GCRY_MD_SHA1, hash, data, len);
181 }
182 #else
183 static void
184 sha1(uint8_t *hash, const void *data, size_t len)
185 {
186  struct sha1_ctx ctx;
187  sha1_init(&ctx);
188  sha1_update(&ctx, len, (const uint8_t *) data);
189  sha1_digest(&ctx, 20, hash);
190 }
191 #endif
192 
193 
194 static void
195 rnd_func(void *ctx, size_t len, uint8_t * out)
196 {
197  tds_random_buffer(out, len);
198 }
199 
200 #define dumpl(b,l) tdsdump_dump_buf(TDS_DBG_INFO1, #b, b, l)
201 #ifndef dumpl
202 #define dumpl(b,l) do {} while(0)
203 #endif
204 #define dump(b) dumpl(b, sizeof(b))
205 
206 /* OAEP configuration parameters */
207 #define hash_func sha1
208 enum { hash_len = 20 }; /* sha1 length */
209 enum { key_size_max = 1024 }; /* max key in bytes */
210 static const char label[] = "";
211 
212 static void
213 memxor(uint8_t *dest, const uint8_t *src, size_t len)
214 {
215  size_t n;
216  for (n = 0; n < len; ++n)
217  dest[n] = dest[n] ^ src[n];
218 }
219 
220 static void
221 mgf_mask(uint8_t *dest, size_t dest_len, const uint8_t *mask, size_t mask_len)
222 {
223  unsigned n = 0;
224  uint8_t hash[hash_len];
225  uint8_t seed[mask_len + 4];
226 
227  memcpy(seed, mask, mask_len);
228  /* we always have some data and check is done internally */
229  for (;;) {
230  TDS_PUT_UA4BE(seed+mask_len, n);
231 
232  hash_func(hash, seed, sizeof(seed));
233  if (dest_len <= hash_len) {
234  memxor(dest, hash, dest_len);
235  break;
236  }
237 
238  memxor(dest, hash, hash_len);
239  dest += hash_len;
240  dest_len -= hash_len;
241  ++n;
242  }
243 }
244 
245 static int
246 oaep_encrypt(size_t key_size, void *random_ctx, nettle_random_func *random,
247  size_t length, const uint8_t *message, mpz_t m)
248 {
249  /* EM: 0x00 ROS (HASH 0x00.. 0x01 message) */
250  struct {
251  uint8_t all[1]; /* zero but used to access all data */
252  uint8_t ros[hash_len];
253  uint8_t db[key_size_max - hash_len - 1];
254  } em;
255  const unsigned db_len = key_size - hash_len - 1;
256 
257  if (length + hash_len * 2 + 2 > key_size)
258  /* Message too long for this key. */
259  return 0;
260 
261  /* create db */
262  memset(&em, 0, sizeof(em));
263  hash_func(em.db, label, strlen(label));
264  em.all[key_size - length - 1] = 0x1;
265  memcpy(em.all+(key_size - length), message, length);
266  dumpl(em.db, db_len);
267 
268  /* create ros */
269  random(random_ctx, hash_len, em.ros);
270  dump(em.ros);
271 
272  /* mask db */
273  mgf_mask(em.db, db_len, em.ros, hash_len);
274  dumpl(em.db, db_len);
275 
276  /* mask ros */
277  mgf_mask(em.ros, hash_len, em.db, db_len);
278  dump(em.ros);
279 
280  nettle_mpz_set_str_256_u(m, key_size, em.all);
281 
282  return 1;
283 }
284 
285 static int
286 rsa_encrypt_oaep(const struct rsa_public_key *key, void *random_ctx, nettle_random_func *random,
287  size_t length, const uint8_t *message, mpz_t gibberish)
288 {
289  if (!oaep_encrypt(key->size, random_ctx, random, length, message, gibberish))
290  return 0;
291 
292  mpz_powm(gibberish, gibberish, key->e, key->n);
293  return 1;
294 }
295 
296 static void*
297 tds5_rsa_encrypt(const void *key, size_t key_len, const void *nonce, size_t nonce_len, const char *pwd, size_t *em_size)
298 {
299  int ret;
300  mpz_t p;
301  gnutls_datum_t pubkey_datum = { (unsigned char *) key, key_len };
302  struct asn1_der_iterator der;
303  struct rsa_public_key pubkey;
304  uint8_t *message;
305  size_t message_len, pwd_len;
306  uint8_t *em = NULL;
307  unsigned char der_buf[2048];
308  size_t size = sizeof(der_buf);
309 
310  mpz_init(p);
311  rsa_public_key_init(&pubkey);
312 
313  pwd_len = strlen(pwd);
314  message_len = nonce_len + pwd_len;
315  message = tds_new(uint8_t, message_len);
316  if (!message)
317  return NULL;
318  memcpy(message, nonce, nonce_len);
319  memcpy(message + nonce_len, pwd, pwd_len);
320 
321  /* use nettle directly */
322  /* parse PEM, get DER */
323  ret = gnutls_pem_base64_decode("RSA PUBLIC KEY", &pubkey_datum, der_buf, &size);
324  if (ret) {
325  tdsdump_log(TDS_DBG_ERROR, "Error %d decoding public key: %s\n", ret, gnutls_strerror(ret));
326  goto error;
327  }
328 
329  /* get key with nettle using DER */
330  ret = asn1_der_iterator_first(&der, size, der_buf);
331  if (ret != ASN1_ITERATOR_CONSTRUCTED || der.type != ASN1_SEQUENCE) {
332  tdsdump_log(TDS_DBG_ERROR, "Invalid DER content\n");
333  goto error;
334  }
335 
336  ret = rsa_public_key_from_der_iterator(&pubkey, key_size_max * 8, &der);
337  if (!ret) {
338  tdsdump_log(TDS_DBG_ERROR, "Invalid DER content\n");
339  goto error;
340  }
341 
342  /* get password encrypted */
343  ret = rsa_encrypt_oaep(&pubkey, NULL, rnd_func, message_len, message, p);
344  if (!ret) {
345  tdsdump_log(TDS_DBG_ERROR, "Error encrypting message\n");
346  goto error;
347  }
348 
349  em = tds_new(uint8_t, pubkey.size);
350  *em_size = pubkey.size;
351  if (!em)
352  goto error;
353 
354  nettle_mpz_get_str_256(pubkey.size, em, p);
355 
356  tdsdump_dump_buf(TDS_DBG_INFO1, "em", em, pubkey.size);
357 
358 error:
359  free(message);
360  rsa_public_key_clear(&pubkey);
361  mpz_clear(p);
362  return em;
363 }
364 
output stream to write data to a static buffer.
Definition: stream.h:92
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
TDSPACKET * pkt
first packet frozen
Definition: tds.h:1575
TDSPACKET * frozen_packets
list of packets frozen, points to first one.
Definition: tds.h:1203
Definition: tds.h:1057
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
char * buffer
write buffer.
Definition: stream.h:50
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
Definition: proto.h:39
DSTR password
password of account login
Definition: tds.h:535
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
size_t tds_freeze_written(TDSFREEZE *freeze)
Compute how many bytes has been written from freeze.
Definition: packet.c:935
Main include file for libtds.
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
Definition: sec_negotiate_gnutls.h:89
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1258
void tds_unget_byte(TDSSOCKET *tds)
Unget will always work as long as you don't call it twice in a row.
Definition: read.c:89
unsigned char * out_buf
Output buffer.
Definition: tds.h:1185
TDSRET tds_freeze_abort(TDSFREEZE *freeze)
Discard all data written after the freeze.
Definition: packet.c:961
TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size)
Stop keeping data for this specific freeze.
Definition: packet.c:1031
TDSPACKET * send_packet
packet we are preparing to send
Definition: tds.h:1231
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
unsigned data_len
data length, this does not account SMP header, only TDS part
Definition: tds.h:1071
unsigned size_len
length size (0, 1, 2 or 4)
Definition: tds.h:1579
Definition: sec_negotiate_gnutls.h:59
Provide poll call where missing.
void tds_datain_stream_init(TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
Initialize a data input stream.
Definition: stream.c:204
input stream to read data from tds protocol
Definition: stream.h:63
unsigned char tds_peek(TDSSOCKET *tds)
Reads a byte from the TDS stream without removing it.
Definition: read.c:100
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
TDS 7.2 SMP packet header.
Definition: proto.h:361
Definition: sec_negotiate_gnutls.h:137
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
TDS_UINT8 tds_get_uint8(TDSSOCKET *tds)
Get an uint64 from the server.
Definition: read.c:140
Definition: tds.h:1091
size_t wire_size
bytes still to read
Definition: stream.h:65
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
DSTR * tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len)
Reads a string from wire and put in a DSTR.
Definition: read.c:293
unsigned char out_flag
output buffer type
Definition: tds.h:1196
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1248
size_t tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
Fetch a string from the wire.
Definition: read.c:166
Information about blobs (e.g.
Definition: tds.h:593
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
int tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
Select on a socket until it's available or the timeout expires.
Definition: net.c:612
unsigned in_len
input buffer length
Definition: tds.h:1194
unsigned out_pos
current position in out_buf
Definition: tds.h:1193
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
static size_t read_and_convert(TDSSOCKET *tds, TDSICONV *char_conv, size_t *wire_size, char *outbuf, size_t outbytesleft)
For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not al...
Definition: read.c:269
#define tds_put_tinyint(tds, ti)
Output a tinyint value.
Definition: tds.h:1469
TDSRET tds_convert_stream(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream converting characters.
Definition: stream.c:71
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
TDSRET tds_get_char_data(TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol)
Fetch character data the wire.
Definition: read.c:195
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
@ TDS_DEAD
no connection
Definition: tds.h:795
TDSSOCKET * tds
which socket we refer to
Definition: tds.h:1573
Definition: tds.h:1047
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t need)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
Information for a server connection.
Definition: tds.h:1163
unsigned char in_flag
input buffer type
Definition: tds.h:1195
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1191
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
unsigned pkt_pos
position in pkt
Definition: tds.h:1577
TDSRET tds_freeze_close(TDSFREEZE *freeze)
Stop keeping data for this specific freeze.
Definition: packet.c:996
void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
Stop writing to server and cache every packet not sending them to server.
Definition: packet.c:907
int block_size
packet size (512-65535)
Definition: tds.h:965
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
void tds_staticout_stream_init(TDSSTATICOUTSTREAM *stream, void *ptr, size_t len)
Initialize an output stream for write into a static allocated buffer.
Definition: stream.c:313
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
TDS_USMALLINT tds_get_usmallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:113
Definition: proto.h:26
Definition: tds.h:1571
TDS_INT tds_numeric_to_string(const TDS_NUMERIC *numeric, char *s)
Definition: numeric.c:95
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
freetds-1.3.6/doc/reference/a00290_source.html000644 025423 025423 00000035520 14162303416 022374 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/sec_negotiate_openssl.h Source File
FreeTDS API
sec_negotiate_openssl.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2015 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #include <openssl/rand.h>
21 #include <openssl/bio.h>
22 #include <openssl/pem.h>
23 #include <openssl/err.h>
24 
36 #ifndef HAVE_OPENSSL
37 #error HAVE_OPENSSL not defines, this file should not be included
38 #endif
39 
40 static inline const BIGNUM*
41 rsa_get_n(const RSA *rsa)
42 {
43 #if HAVE_RSA_GET0_KEY
44  const BIGNUM *n, *e, *d;
45  RSA_get0_key(rsa, &n, &e, &d);
46  return n;
47 #else
48  return rsa->n;
49 #endif
50 }
51 
52 static void*
53 tds5_rsa_encrypt(const void *key, size_t key_len, const void *nonce, size_t nonce_len, const char *pwd, size_t *em_size)
54 {
55  RSA *rsa = NULL;
56  BIO *keybio;
57 
58  uint8_t *message = NULL;
59  size_t message_len, pwd_len;
60  uint8_t *em = NULL;
61 
62  int result;
63 
64  keybio = BIO_new_mem_buf((void*) key, key_len);
65  if (keybio == NULL)
66  goto error;
67 
68  rsa = PEM_read_bio_RSAPublicKey(keybio, &rsa, NULL, NULL);
69  if (!rsa)
70  goto error;
71 
72  pwd_len = strlen(pwd);
73  message_len = nonce_len + pwd_len;
74  message = tds_new(uint8_t, message_len);
75  if (!message)
76  goto error;
77  memcpy(message, nonce, nonce_len);
78  memcpy(message + nonce_len, pwd, pwd_len);
79 
80  em = tds_new(uint8_t, BN_num_bytes(rsa_get_n(rsa)));
81  if (!em)
82  goto error;
83 
84  result = RSA_public_encrypt(message_len, message, em, rsa, RSA_PKCS1_OAEP_PADDING);
85  if (result < 0)
86  goto error;
87 
88  free(message);
89  RSA_free(rsa);
90  BIO_free(keybio);
91 
92  *em_size = result;
93  return em;
94 
95 error:
96  free(message);
97  free(em);
98  RSA_free(rsa);
99  BIO_free(keybio);
100  return NULL;
101 }
102 
freetds-1.3.6/doc/reference/a00299_source.html000644 025423 025423 00000553214 14162303416 022412 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/tds_types.h Source File
FreeTDS API
tds_types.h
1 /*
2  * This file produced from ./types.pl
3  */
4 
8 int
9 tds_get_size_by_type(TDS_SERVER_TYPE servertype)
10 {
11  switch (servertype) {
12  case SYBVOID:
13  return 0;
14  case SYBBIT:
15  case SYBBITN:
16  case SYBINT1:
17  case SYBSINT1:
18  case SYBUINT1:
19  return 1;
20  case SYBINT2:
21  case SYBUINT2:
22  return 2;
23  case SYBMSDATE:
24  return 3;
25  case SYBDATE:
26  case SYBDATEN:
27  case SYBDATETIME4:
28  case SYBINT4:
29  case SYBMONEY4:
30  case SYBREAL:
31  case SYBTIME:
32  case SYBTIMEN:
33  case SYBUINT4:
34  return 4;
35  case SYB5BIGDATETIME:
36  case SYB5BIGTIME:
37  case SYB5INT8:
38  case SYBDATETIME:
39  case SYBFLT8:
40  case SYBINT8:
41  case SYBINTERVAL:
42  case SYBMONEY:
43  case SYBUINT8:
44  return 8;
45  case SYBUNIQUE:
46  return 16;
47  default:
48  return 0;
49  }
50 }
51 
56 int
57 tds_get_varint_size(TDSCONNECTION * conn, int datatype)
58 {
59  switch (datatype) {
60  case SYBBIT:
61  case SYBDATETIME:
62  case SYBDATETIME4:
63  case SYBFLT8:
64  case SYBINT1:
65  case SYBINT2:
66  case SYBINT4:
67  case SYBMONEY:
68  case SYBMONEY4:
69  case SYBREAL:
70  case SYBVOID:
71  return 0;
72  case SYBIMAGE:
73  case SYBTEXT:
74  return 4;
75  }
76 
77  if (IS_TDS7_PLUS(conn)) {
78  switch (datatype) {
79  case SYBINT8:
80  return 0;
81  case XSYBBINARY:
82  case XSYBCHAR:
83  case XSYBNCHAR:
84  case XSYBNVARCHAR:
85  case XSYBVARBINARY:
86  case XSYBVARCHAR:
87  return 2;
88  case SYBNTEXT:
89  case SYBVARIANT:
90  return 4;
91  case SYBMSUDT:
92  case SYBMSXML:
93  return 8;
94  }
95  } else if (IS_TDS50(conn)) {
96  switch (datatype) {
97  case SYB5INT8:
98  case SYBDATE:
99  case SYBINTERVAL:
100  case SYBSINT1:
101  case SYBTIME:
102  case SYBUINT1:
103  case SYBUINT2:
104  case SYBUINT4:
105  case SYBUINT8:
106  return 0;
107  case SYBUNITEXT:
108  case SYBXML:
109  return 4;
110  case SYBLONGBINARY:
111  case SYBLONGCHAR:
112  return 5;
113  }
114  }
115  return 1;
116 }
117 
124 TDS_SERVER_TYPE
125 tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
126 {
127  switch (srctype) {
128  case SYBBITN:
129  return SYBBIT;
130  case SYBDATEN:
131  return SYBDATE;
132  case SYBDATETIMN:
133  switch (colsize) {
134  case 8:
135  return SYBDATETIME;
136  case 4:
137  return SYBDATETIME4;
138  }
139  break;
140  case SYBFLTN:
141  switch (colsize) {
142  case 8:
143  return SYBFLT8;
144  case 4:
145  return SYBREAL;
146  }
147  break;
148  case SYBINTN:
149  switch (colsize) {
150  case 8:
151  return SYBINT8;
152  case 4:
153  return SYBINT4;
154  case 2:
155  return SYBINT2;
156  case 1:
157  return SYBINT1;
158  }
159  break;
160  case SYBMONEYN:
161  switch (colsize) {
162  case 8:
163  return SYBMONEY;
164  case 4:
165  return SYBMONEY4;
166  }
167  break;
168  case SYBTIMEN:
169  return SYBTIME;
170  case SYBUINTN:
171  switch (colsize) {
172  case 8:
173  return SYBUINT8;
174  case 4:
175  return SYBUINT4;
176  case 2:
177  return SYBUINT2;
178  case 1:
179  return SYBUINT1;
180  }
181  break;
182  case SYB5INT8:
183  return SYBINT8;
184  default:
185  break;
186  }
187  return srctype;
188 }
189 
190 const uint16_t tds_type_flags_ms[256] = {
191  /* 0 empty */ TDS_TYPEFLAG_INVALID,
192  /* 1 empty */ TDS_TYPEFLAG_INVALID,
193  /* 2 empty */ TDS_TYPEFLAG_INVALID,
194  /* 3 empty */ TDS_TYPEFLAG_INVALID,
195  /* 4 empty */ TDS_TYPEFLAG_INVALID,
196  /* 5 empty */ TDS_TYPEFLAG_INVALID,
197  /* 6 empty */ TDS_TYPEFLAG_INVALID,
198  /* 7 empty */ TDS_TYPEFLAG_INVALID,
199  /* 8 empty */ TDS_TYPEFLAG_INVALID,
200  /* 9 empty */ TDS_TYPEFLAG_INVALID,
201  /* 10 empty */ TDS_TYPEFLAG_INVALID,
202  /* 11 empty */ TDS_TYPEFLAG_INVALID,
203  /* 12 empty */ TDS_TYPEFLAG_INVALID,
204  /* 13 empty */ TDS_TYPEFLAG_INVALID,
205  /* 14 empty */ TDS_TYPEFLAG_INVALID,
206  /* 15 empty */ TDS_TYPEFLAG_INVALID,
207  /* 16 empty */ TDS_TYPEFLAG_INVALID,
208  /* 17 empty */ TDS_TYPEFLAG_INVALID,
209  /* 18 empty */ TDS_TYPEFLAG_INVALID,
210  /* 19 empty */ TDS_TYPEFLAG_INVALID,
211  /* 20 empty */ TDS_TYPEFLAG_INVALID,
212  /* 21 empty */ TDS_TYPEFLAG_INVALID,
213  /* 22 empty */ TDS_TYPEFLAG_INVALID,
214  /* 23 empty */ TDS_TYPEFLAG_INVALID,
215  /* 24 empty */ TDS_TYPEFLAG_INVALID,
216  /* 25 empty */ TDS_TYPEFLAG_INVALID,
217  /* 26 empty */ TDS_TYPEFLAG_INVALID,
218  /* 27 empty */ TDS_TYPEFLAG_INVALID,
219  /* 28 empty */ TDS_TYPEFLAG_INVALID,
220  /* 29 empty */ TDS_TYPEFLAG_INVALID,
221  /* 30 empty */ TDS_TYPEFLAG_INVALID,
222  /* 31 SYBVOID */ TDS_TYPEFLAG_FIXED,
223  /* 32 empty */ TDS_TYPEFLAG_INVALID,
224  /* 33 empty */ TDS_TYPEFLAG_INVALID,
225  /* 34 SYBIMAGE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY,
226  /* 35 SYBTEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII,
227  /* 36 SYBUNIQUE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
228  /* 37 SYBVARBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT,
229  /* 38 SYBINTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT,
230  /* 39 SYBVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT,
231  /* 40 SYBMSDATE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
232  /* 41 SYBMSTIME */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
233  /* 42 SYBMSDATETIME2 */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
234  /* 43 SYBMSDATETIMEOFFSET */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
235  /* 44 empty */ TDS_TYPEFLAG_INVALID,
236  /* 45 SYBBINARY */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT,
237  /* 46 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
238  /* 47 SYBCHAR */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT,
239  /* 48 SYBINT1 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
240  /* 49 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME,
241  /* 50 SYBBIT */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
242  /* 51 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME,
243  /* 52 SYBINT2 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
244  /* 53 empty */ TDS_TYPEFLAG_INVALID,
245  /* 54 empty */ TDS_TYPEFLAG_INVALID,
246  /* 55 empty */ TDS_TYPEFLAG_INVALID,
247  /* 56 SYBINT4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
248  /* 57 empty */ TDS_TYPEFLAG_INVALID,
249  /* 58 SYBDATETIME4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
250  /* 59 SYBREAL */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
251  /* 60 SYBMONEY */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
252  /* 61 SYBDATETIME */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
253  /* 62 SYBFLT8 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
254  /* 63 empty */ TDS_TYPEFLAG_INVALID,
255  /* 64 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
256  /* 65 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
257  /* 66 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
258  /* 67 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
259  /* 68 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE,
260  /* 69 empty */ TDS_TYPEFLAG_INVALID,
261  /* 70 empty */ TDS_TYPEFLAG_INVALID,
262  /* 71 empty */ TDS_TYPEFLAG_INVALID,
263  /* 72 empty */ TDS_TYPEFLAG_INVALID,
264  /* 73 empty */ TDS_TYPEFLAG_INVALID,
265  /* 74 empty */ TDS_TYPEFLAG_INVALID,
266  /* 75 empty */ TDS_TYPEFLAG_INVALID,
267  /* 76 empty */ TDS_TYPEFLAG_INVALID,
268  /* 77 empty */ TDS_TYPEFLAG_INVALID,
269  /* 78 empty */ TDS_TYPEFLAG_INVALID,
270  /* 79 empty */ TDS_TYPEFLAG_INVALID,
271  /* 80 empty */ TDS_TYPEFLAG_INVALID,
272  /* 81 empty */ TDS_TYPEFLAG_INVALID,
273  /* 82 empty */ TDS_TYPEFLAG_INVALID,
274  /* 83 empty */ TDS_TYPEFLAG_INVALID,
275  /* 84 empty */ TDS_TYPEFLAG_INVALID,
276  /* 85 empty */ TDS_TYPEFLAG_INVALID,
277  /* 86 empty */ TDS_TYPEFLAG_INVALID,
278  /* 87 empty */ TDS_TYPEFLAG_INVALID,
279  /* 88 empty */ TDS_TYPEFLAG_INVALID,
280  /* 89 empty */ TDS_TYPEFLAG_INVALID,
281  /* 90 empty */ TDS_TYPEFLAG_INVALID,
282  /* 91 empty */ TDS_TYPEFLAG_INVALID,
283  /* 92 empty */ TDS_TYPEFLAG_INVALID,
284  /* 93 empty */ TDS_TYPEFLAG_INVALID,
285  /* 94 empty */ TDS_TYPEFLAG_INVALID,
286  /* 95 empty */ TDS_TYPEFLAG_INVALID,
287  /* 96 empty */ TDS_TYPEFLAG_INVALID,
288  /* 97 empty */ TDS_TYPEFLAG_INVALID,
289  /* 98 SYBVARIANT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE,
290  /* 99 SYBNTEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_UNICODE,
291  /* 100 empty */ TDS_TYPEFLAG_INVALID,
292  /* 101 empty */ TDS_TYPEFLAG_INVALID,
293  /* 102 empty */ TDS_TYPEFLAG_INVALID,
294  /* 103 SYBNVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE|TDS_TYPEFLAG_VARIANT,
295  /* 104 SYBBITN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT,
296  /* 105 empty */ TDS_TYPEFLAG_INVALID,
297  /* 106 SYBDECIMAL */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT,
298  /* 107 empty */ TDS_TYPEFLAG_INVALID,
299  /* 108 SYBNUMERIC */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT,
300  /* 109 SYBFLTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT,
301  /* 110 SYBMONEYN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT,
302  /* 111 SYBDATETIMN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
303  /* 112 empty */ TDS_TYPEFLAG_INVALID,
304  /* 113 empty */ TDS_TYPEFLAG_INVALID,
305  /* 114 empty */ TDS_TYPEFLAG_INVALID,
306  /* 115 empty */ TDS_TYPEFLAG_INVALID,
307  /* 116 empty */ TDS_TYPEFLAG_INVALID,
308  /* 117 empty */ TDS_TYPEFLAG_INVALID,
309  /* 118 empty */ TDS_TYPEFLAG_INVALID,
310  /* 119 empty */ TDS_TYPEFLAG_INVALID,
311  /* 120 empty */ TDS_TYPEFLAG_INVALID,
312  /* 121 empty */ TDS_TYPEFLAG_INVALID,
313  /* 122 SYBMONEY4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
314  /* 123 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
315  /* 124 empty */ TDS_TYPEFLAG_INVALID,
316  /* 125 empty */ TDS_TYPEFLAG_INVALID,
317  /* 126 empty */ TDS_TYPEFLAG_INVALID,
318  /* 127 SYBINT8 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
319  /* 128 empty */ TDS_TYPEFLAG_INVALID,
320  /* 129 empty */ TDS_TYPEFLAG_INVALID,
321  /* 130 empty */ TDS_TYPEFLAG_INVALID,
322  /* 131 empty */ TDS_TYPEFLAG_INVALID,
323  /* 132 empty */ TDS_TYPEFLAG_INVALID,
324  /* 133 empty */ TDS_TYPEFLAG_INVALID,
325  /* 134 empty */ TDS_TYPEFLAG_INVALID,
326  /* 135 empty */ TDS_TYPEFLAG_INVALID,
327  /* 136 empty */ TDS_TYPEFLAG_INVALID,
328  /* 137 empty */ TDS_TYPEFLAG_INVALID,
329  /* 138 empty */ TDS_TYPEFLAG_INVALID,
330  /* 139 empty */ TDS_TYPEFLAG_INVALID,
331  /* 140 empty */ TDS_TYPEFLAG_INVALID,
332  /* 141 empty */ TDS_TYPEFLAG_INVALID,
333  /* 142 empty */ TDS_TYPEFLAG_INVALID,
334  /* 143 empty */ TDS_TYPEFLAG_INVALID,
335  /* 144 empty */ TDS_TYPEFLAG_INVALID,
336  /* 145 empty */ TDS_TYPEFLAG_INVALID,
337  /* 146 empty */ TDS_TYPEFLAG_INVALID,
338  /* 147 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
339  /* 148 empty */ TDS_TYPEFLAG_INVALID,
340  /* 149 empty */ TDS_TYPEFLAG_INVALID,
341  /* 150 empty */ TDS_TYPEFLAG_INVALID,
342  /* 151 empty */ TDS_TYPEFLAG_INVALID,
343  /* 152 empty */ TDS_TYPEFLAG_INVALID,
344  /* 153 empty */ TDS_TYPEFLAG_INVALID,
345  /* 154 empty */ TDS_TYPEFLAG_INVALID,
346  /* 155 empty */ TDS_TYPEFLAG_INVALID,
347  /* 156 empty */ TDS_TYPEFLAG_INVALID,
348  /* 157 empty */ TDS_TYPEFLAG_INVALID,
349  /* 158 empty */ TDS_TYPEFLAG_INVALID,
350  /* 159 empty */ TDS_TYPEFLAG_INVALID,
351  /* 160 empty */ TDS_TYPEFLAG_INVALID,
352  /* 161 empty */ TDS_TYPEFLAG_INVALID,
353  /* 162 empty */ TDS_TYPEFLAG_INVALID,
354  /* 163 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE,
355  /* 164 empty */ TDS_TYPEFLAG_INVALID,
356  /* 165 XSYBVARBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT,
357  /* 166 empty */ TDS_TYPEFLAG_INVALID,
358  /* 167 XSYBVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT,
359  /* 168 empty */ TDS_TYPEFLAG_INVALID,
360  /* 169 empty */ TDS_TYPEFLAG_INVALID,
361  /* 170 empty */ TDS_TYPEFLAG_INVALID,
362  /* 171 empty */ TDS_TYPEFLAG_INVALID,
363  /* 172 empty */ TDS_TYPEFLAG_INVALID,
364  /* 173 XSYBBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT,
365  /* 174 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE,
366  /* 175 XSYBCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT,
367  /* 176 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
368  /* 177 empty */ TDS_TYPEFLAG_INVALID,
369  /* 178 empty */ TDS_TYPEFLAG_INVALID,
370  /* 179 empty */ TDS_TYPEFLAG_INVALID,
371  /* 180 empty */ TDS_TYPEFLAG_INVALID,
372  /* 181 empty */ TDS_TYPEFLAG_INVALID,
373  /* 182 empty */ TDS_TYPEFLAG_INVALID,
374  /* 183 empty */ TDS_TYPEFLAG_INVALID,
375  /* 184 empty */ TDS_TYPEFLAG_INVALID,
376  /* 185 empty */ TDS_TYPEFLAG_INVALID,
377  /* 186 empty */ TDS_TYPEFLAG_INVALID,
378  /* 187 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
379  /* 188 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
380  /* 189 empty */ TDS_TYPEFLAG_INVALID,
381  /* 190 empty */ TDS_TYPEFLAG_INVALID,
382  /* 191 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
383  /* 192 empty */ TDS_TYPEFLAG_INVALID,
384  /* 193 empty */ TDS_TYPEFLAG_INVALID,
385  /* 194 empty */ TDS_TYPEFLAG_INVALID,
386  /* 195 empty */ TDS_TYPEFLAG_INVALID,
387  /* 196 empty */ TDS_TYPEFLAG_INVALID,
388  /* 197 empty */ TDS_TYPEFLAG_INVALID,
389  /* 198 empty */ TDS_TYPEFLAG_INVALID,
390  /* 199 empty */ TDS_TYPEFLAG_INVALID,
391  /* 200 empty */ TDS_TYPEFLAG_INVALID,
392  /* 201 empty */ TDS_TYPEFLAG_INVALID,
393  /* 202 empty */ TDS_TYPEFLAG_INVALID,
394  /* 203 empty */ TDS_TYPEFLAG_INVALID,
395  /* 204 empty */ TDS_TYPEFLAG_INVALID,
396  /* 205 empty */ TDS_TYPEFLAG_INVALID,
397  /* 206 empty */ TDS_TYPEFLAG_INVALID,
398  /* 207 empty */ TDS_TYPEFLAG_INVALID,
399  /* 208 empty */ TDS_TYPEFLAG_INVALID,
400  /* 209 empty */ TDS_TYPEFLAG_INVALID,
401  /* 210 empty */ TDS_TYPEFLAG_INVALID,
402  /* 211 empty */ TDS_TYPEFLAG_INVALID,
403  /* 212 empty */ TDS_TYPEFLAG_INVALID,
404  /* 213 empty */ TDS_TYPEFLAG_INVALID,
405  /* 214 empty */ TDS_TYPEFLAG_INVALID,
406  /* 215 empty */ TDS_TYPEFLAG_INVALID,
407  /* 216 empty */ TDS_TYPEFLAG_INVALID,
408  /* 217 empty */ TDS_TYPEFLAG_INVALID,
409  /* 218 empty */ TDS_TYPEFLAG_INVALID,
410  /* 219 empty */ TDS_TYPEFLAG_INVALID,
411  /* 220 empty */ TDS_TYPEFLAG_INVALID,
412  /* 221 empty */ TDS_TYPEFLAG_INVALID,
413  /* 222 empty */ TDS_TYPEFLAG_INVALID,
414  /* 223 empty */ TDS_TYPEFLAG_INVALID,
415  /* 224 empty */ TDS_TYPEFLAG_INVALID,
416  /* 225 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY,
417  /* 226 empty */ TDS_TYPEFLAG_INVALID,
418  /* 227 empty */ TDS_TYPEFLAG_INVALID,
419  /* 228 empty */ TDS_TYPEFLAG_INVALID,
420  /* 229 empty */ TDS_TYPEFLAG_INVALID,
421  /* 230 empty */ TDS_TYPEFLAG_INVALID,
422  /* 231 XSYBNVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_UNICODE|TDS_TYPEFLAG_VARIANT,
423  /* 232 empty */ TDS_TYPEFLAG_INVALID,
424  /* 233 empty */ TDS_TYPEFLAG_INVALID,
425  /* 234 empty */ TDS_TYPEFLAG_INVALID,
426  /* 235 empty */ TDS_TYPEFLAG_INVALID,
427  /* 236 empty */ TDS_TYPEFLAG_INVALID,
428  /* 237 empty */ TDS_TYPEFLAG_INVALID,
429  /* 238 empty */ TDS_TYPEFLAG_INVALID,
430  /* 239 XSYBNCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_UNICODE|TDS_TYPEFLAG_VARIANT,
431  /* 240 SYBMSUDT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE,
432  /* 241 SYBMSXML */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE,
433  /* 242 empty */ TDS_TYPEFLAG_INVALID,
434  /* 243 empty */ TDS_TYPEFLAG_INVALID,
435  /* 244 empty */ TDS_TYPEFLAG_INVALID,
436  /* 245 empty */ TDS_TYPEFLAG_INVALID,
437  /* 246 empty */ TDS_TYPEFLAG_INVALID,
438  /* 247 empty */ TDS_TYPEFLAG_INVALID,
439  /* 248 empty */ TDS_TYPEFLAG_INVALID,
440  /* 249 empty */ TDS_TYPEFLAG_INVALID,
441  /* 250 empty */ TDS_TYPEFLAG_INVALID,
442  /* 251 empty */ TDS_TYPEFLAG_INVALID,
443  /* 252 empty */ TDS_TYPEFLAG_INVALID,
444  /* 253 empty */ TDS_TYPEFLAG_INVALID,
445  /* 254 empty */ TDS_TYPEFLAG_INVALID,
446  /* 255 empty */ TDS_TYPEFLAG_INVALID,
447 };
448 
449 #if 0
450 const uint16_t tds_type_flags_syb[256] = {
451  /* 0 empty */ TDS_TYPEFLAG_INVALID,
452  /* 1 empty */ TDS_TYPEFLAG_INVALID,
453  /* 2 empty */ TDS_TYPEFLAG_INVALID,
454  /* 3 empty */ TDS_TYPEFLAG_INVALID,
455  /* 4 empty */ TDS_TYPEFLAG_INVALID,
456  /* 5 empty */ TDS_TYPEFLAG_INVALID,
457  /* 6 empty */ TDS_TYPEFLAG_INVALID,
458  /* 7 empty */ TDS_TYPEFLAG_INVALID,
459  /* 8 empty */ TDS_TYPEFLAG_INVALID,
460  /* 9 empty */ TDS_TYPEFLAG_INVALID,
461  /* 10 empty */ TDS_TYPEFLAG_INVALID,
462  /* 11 empty */ TDS_TYPEFLAG_INVALID,
463  /* 12 empty */ TDS_TYPEFLAG_INVALID,
464  /* 13 empty */ TDS_TYPEFLAG_INVALID,
465  /* 14 empty */ TDS_TYPEFLAG_INVALID,
466  /* 15 empty */ TDS_TYPEFLAG_INVALID,
467  /* 16 empty */ TDS_TYPEFLAG_INVALID,
468  /* 17 empty */ TDS_TYPEFLAG_INVALID,
469  /* 18 empty */ TDS_TYPEFLAG_INVALID,
470  /* 19 empty */ TDS_TYPEFLAG_INVALID,
471  /* 20 empty */ TDS_TYPEFLAG_INVALID,
472  /* 21 empty */ TDS_TYPEFLAG_INVALID,
473  /* 22 empty */ TDS_TYPEFLAG_INVALID,
474  /* 23 empty */ TDS_TYPEFLAG_INVALID,
475  /* 24 empty */ TDS_TYPEFLAG_INVALID,
476  /* 25 empty */ TDS_TYPEFLAG_INVALID,
477  /* 26 empty */ TDS_TYPEFLAG_INVALID,
478  /* 27 empty */ TDS_TYPEFLAG_INVALID,
479  /* 28 empty */ TDS_TYPEFLAG_INVALID,
480  /* 29 empty */ TDS_TYPEFLAG_INVALID,
481  /* 30 empty */ TDS_TYPEFLAG_INVALID,
482  /* 31 SYBVOID */ TDS_TYPEFLAG_FIXED,
483  /* 32 empty */ TDS_TYPEFLAG_INVALID,
484  /* 33 empty */ TDS_TYPEFLAG_INVALID,
485  /* 34 SYBIMAGE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY,
486  /* 35 SYBTEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII,
487  /* 36 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_NULLABLE,
488  /* 37 SYBVARBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT,
489  /* 38 SYBINTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT,
490  /* 39 SYBVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT,
491  /* 40 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
492  /* 41 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
493  /* 42 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
494  /* 43 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
495  /* 44 empty */ TDS_TYPEFLAG_INVALID,
496  /* 45 SYBBINARY */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT,
497  /* 46 SYBINTERVAL */ TDS_TYPEFLAG_FIXED,
498  /* 47 SYBCHAR */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT,
499  /* 48 SYBINT1 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
500  /* 49 SYBDATE */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME,
501  /* 50 SYBBIT */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
502  /* 51 SYBTIME */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME,
503  /* 52 SYBINT2 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
504  /* 53 empty */ TDS_TYPEFLAG_INVALID,
505  /* 54 empty */ TDS_TYPEFLAG_INVALID,
506  /* 55 empty */ TDS_TYPEFLAG_INVALID,
507  /* 56 SYBINT4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
508  /* 57 empty */ TDS_TYPEFLAG_INVALID,
509  /* 58 SYBDATETIME4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
510  /* 59 SYBREAL */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
511  /* 60 SYBMONEY */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
512  /* 61 SYBDATETIME */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
513  /* 62 SYBFLT8 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
514  /* 63 empty */ TDS_TYPEFLAG_INVALID,
515  /* 64 SYBUINT1 */ TDS_TYPEFLAG_FIXED,
516  /* 65 SYBUINT2 */ TDS_TYPEFLAG_FIXED,
517  /* 66 SYBUINT4 */ TDS_TYPEFLAG_FIXED,
518  /* 67 SYBUINT8 */ TDS_TYPEFLAG_FIXED,
519  /* 68 SYBUINTN */ TDS_TYPEFLAG_NULLABLE,
520  /* 69 empty */ TDS_TYPEFLAG_INVALID,
521  /* 70 empty */ TDS_TYPEFLAG_INVALID,
522  /* 71 empty */ TDS_TYPEFLAG_INVALID,
523  /* 72 empty */ TDS_TYPEFLAG_INVALID,
524  /* 73 empty */ TDS_TYPEFLAG_INVALID,
525  /* 74 empty */ TDS_TYPEFLAG_INVALID,
526  /* 75 empty */ TDS_TYPEFLAG_INVALID,
527  /* 76 empty */ TDS_TYPEFLAG_INVALID,
528  /* 77 empty */ TDS_TYPEFLAG_INVALID,
529  /* 78 empty */ TDS_TYPEFLAG_INVALID,
530  /* 79 empty */ TDS_TYPEFLAG_INVALID,
531  /* 80 empty */ TDS_TYPEFLAG_INVALID,
532  /* 81 empty */ TDS_TYPEFLAG_INVALID,
533  /* 82 empty */ TDS_TYPEFLAG_INVALID,
534  /* 83 empty */ TDS_TYPEFLAG_INVALID,
535  /* 84 empty */ TDS_TYPEFLAG_INVALID,
536  /* 85 empty */ TDS_TYPEFLAG_INVALID,
537  /* 86 empty */ TDS_TYPEFLAG_INVALID,
538  /* 87 empty */ TDS_TYPEFLAG_INVALID,
539  /* 88 empty */ TDS_TYPEFLAG_INVALID,
540  /* 89 empty */ TDS_TYPEFLAG_INVALID,
541  /* 90 empty */ TDS_TYPEFLAG_INVALID,
542  /* 91 empty */ TDS_TYPEFLAG_INVALID,
543  /* 92 empty */ TDS_TYPEFLAG_INVALID,
544  /* 93 empty */ TDS_TYPEFLAG_INVALID,
545  /* 94 empty */ TDS_TYPEFLAG_INVALID,
546  /* 95 empty */ TDS_TYPEFLAG_INVALID,
547  /* 96 empty */ TDS_TYPEFLAG_INVALID,
548  /* 97 empty */ TDS_TYPEFLAG_INVALID,
549  /* 98 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE,
550  /* 99 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE,
551  /* 100 empty */ TDS_TYPEFLAG_INVALID,
552  /* 101 empty */ TDS_TYPEFLAG_INVALID,
553  /* 102 empty */ TDS_TYPEFLAG_INVALID,
554  /* 103 SYBSENSITIVITY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII,
555  /* 104 SYBBOUNDARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII,
556  /* 105 empty */ TDS_TYPEFLAG_INVALID,
557  /* 106 SYBDECIMAL */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT,
558  /* 107 empty */ TDS_TYPEFLAG_INVALID,
559  /* 108 SYBNUMERIC */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT,
560  /* 109 SYBFLTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT,
561  /* 110 SYBMONEYN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT,
562  /* 111 SYBDATETIMN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT,
563  /* 112 empty */ TDS_TYPEFLAG_INVALID,
564  /* 113 empty */ TDS_TYPEFLAG_INVALID,
565  /* 114 empty */ TDS_TYPEFLAG_INVALID,
566  /* 115 empty */ TDS_TYPEFLAG_INVALID,
567  /* 116 empty */ TDS_TYPEFLAG_INVALID,
568  /* 117 empty */ TDS_TYPEFLAG_INVALID,
569  /* 118 empty */ TDS_TYPEFLAG_INVALID,
570  /* 119 empty */ TDS_TYPEFLAG_INVALID,
571  /* 120 empty */ TDS_TYPEFLAG_INVALID,
572  /* 121 empty */ TDS_TYPEFLAG_INVALID,
573  /* 122 SYBMONEY4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT,
574  /* 123 SYBDATEN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
575  /* 124 empty */ TDS_TYPEFLAG_INVALID,
576  /* 125 empty */ TDS_TYPEFLAG_INVALID,
577  /* 126 empty */ TDS_TYPEFLAG_INVALID,
578  /* 127 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED,
579  /* 128 empty */ TDS_TYPEFLAG_INVALID,
580  /* 129 empty */ TDS_TYPEFLAG_INVALID,
581  /* 130 empty */ TDS_TYPEFLAG_INVALID,
582  /* 131 empty */ TDS_TYPEFLAG_INVALID,
583  /* 132 empty */ TDS_TYPEFLAG_INVALID,
584  /* 133 empty */ TDS_TYPEFLAG_INVALID,
585  /* 134 empty */ TDS_TYPEFLAG_INVALID,
586  /* 135 empty */ TDS_TYPEFLAG_INVALID,
587  /* 136 empty */ TDS_TYPEFLAG_INVALID,
588  /* 137 empty */ TDS_TYPEFLAG_INVALID,
589  /* 138 empty */ TDS_TYPEFLAG_INVALID,
590  /* 139 empty */ TDS_TYPEFLAG_INVALID,
591  /* 140 empty */ TDS_TYPEFLAG_INVALID,
592  /* 141 empty */ TDS_TYPEFLAG_INVALID,
593  /* 142 empty */ TDS_TYPEFLAG_INVALID,
594  /* 143 empty */ TDS_TYPEFLAG_INVALID,
595  /* 144 empty */ TDS_TYPEFLAG_INVALID,
596  /* 145 empty */ TDS_TYPEFLAG_INVALID,
597  /* 146 empty */ TDS_TYPEFLAG_INVALID,
598  /* 147 SYBTIMEN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
599  /* 148 empty */ TDS_TYPEFLAG_INVALID,
600  /* 149 empty */ TDS_TYPEFLAG_INVALID,
601  /* 150 empty */ TDS_TYPEFLAG_INVALID,
602  /* 151 empty */ TDS_TYPEFLAG_INVALID,
603  /* 152 empty */ TDS_TYPEFLAG_INVALID,
604  /* 153 empty */ TDS_TYPEFLAG_INVALID,
605  /* 154 empty */ TDS_TYPEFLAG_INVALID,
606  /* 155 empty */ TDS_TYPEFLAG_INVALID,
607  /* 156 empty */ TDS_TYPEFLAG_INVALID,
608  /* 157 empty */ TDS_TYPEFLAG_INVALID,
609  /* 158 empty */ TDS_TYPEFLAG_INVALID,
610  /* 159 empty */ TDS_TYPEFLAG_INVALID,
611  /* 160 empty */ TDS_TYPEFLAG_INVALID,
612  /* 161 empty */ TDS_TYPEFLAG_INVALID,
613  /* 162 empty */ TDS_TYPEFLAG_INVALID,
614  /* 163 SYBXML */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE,
615  /* 164 empty */ TDS_TYPEFLAG_INVALID,
616  /* 165 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY,
617  /* 166 empty */ TDS_TYPEFLAG_INVALID,
618  /* 167 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE,
619  /* 168 empty */ TDS_TYPEFLAG_INVALID,
620  /* 169 empty */ TDS_TYPEFLAG_INVALID,
621  /* 170 empty */ TDS_TYPEFLAG_INVALID,
622  /* 171 empty */ TDS_TYPEFLAG_INVALID,
623  /* 172 empty */ TDS_TYPEFLAG_INVALID,
624  /* 173 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY,
625  /* 174 SYBUNITEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE,
626  /* 175 SYBLONGCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII,
627  /* 176 SYBSINT1 */ TDS_TYPEFLAG_FIXED,
628  /* 177 empty */ TDS_TYPEFLAG_INVALID,
629  /* 178 empty */ TDS_TYPEFLAG_INVALID,
630  /* 179 empty */ TDS_TYPEFLAG_INVALID,
631  /* 180 empty */ TDS_TYPEFLAG_INVALID,
632  /* 181 empty */ TDS_TYPEFLAG_INVALID,
633  /* 182 empty */ TDS_TYPEFLAG_INVALID,
634  /* 183 empty */ TDS_TYPEFLAG_INVALID,
635  /* 184 empty */ TDS_TYPEFLAG_INVALID,
636  /* 185 empty */ TDS_TYPEFLAG_INVALID,
637  /* 186 empty */ TDS_TYPEFLAG_INVALID,
638  /* 187 SYB5BIGDATETIME */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
639  /* 188 SYB5BIGTIME */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME,
640  /* 189 empty */ TDS_TYPEFLAG_INVALID,
641  /* 190 empty */ TDS_TYPEFLAG_INVALID,
642  /* 191 SYB5INT8 */ TDS_TYPEFLAG_FIXED,
643  /* 192 empty */ TDS_TYPEFLAG_INVALID,
644  /* 193 empty */ TDS_TYPEFLAG_INVALID,
645  /* 194 empty */ TDS_TYPEFLAG_INVALID,
646  /* 195 empty */ TDS_TYPEFLAG_INVALID,
647  /* 196 empty */ TDS_TYPEFLAG_INVALID,
648  /* 197 empty */ TDS_TYPEFLAG_INVALID,
649  /* 198 empty */ TDS_TYPEFLAG_INVALID,
650  /* 199 empty */ TDS_TYPEFLAG_INVALID,
651  /* 200 empty */ TDS_TYPEFLAG_INVALID,
652  /* 201 empty */ TDS_TYPEFLAG_INVALID,
653  /* 202 empty */ TDS_TYPEFLAG_INVALID,
654  /* 203 empty */ TDS_TYPEFLAG_INVALID,
655  /* 204 empty */ TDS_TYPEFLAG_INVALID,
656  /* 205 empty */ TDS_TYPEFLAG_INVALID,
657  /* 206 empty */ TDS_TYPEFLAG_INVALID,
658  /* 207 empty */ TDS_TYPEFLAG_INVALID,
659  /* 208 empty */ TDS_TYPEFLAG_INVALID,
660  /* 209 empty */ TDS_TYPEFLAG_INVALID,
661  /* 210 empty */ TDS_TYPEFLAG_INVALID,
662  /* 211 empty */ TDS_TYPEFLAG_INVALID,
663  /* 212 empty */ TDS_TYPEFLAG_INVALID,
664  /* 213 empty */ TDS_TYPEFLAG_INVALID,
665  /* 214 empty */ TDS_TYPEFLAG_INVALID,
666  /* 215 empty */ TDS_TYPEFLAG_INVALID,
667  /* 216 empty */ TDS_TYPEFLAG_INVALID,
668  /* 217 empty */ TDS_TYPEFLAG_INVALID,
669  /* 218 empty */ TDS_TYPEFLAG_INVALID,
670  /* 219 empty */ TDS_TYPEFLAG_INVALID,
671  /* 220 empty */ TDS_TYPEFLAG_INVALID,
672  /* 221 empty */ TDS_TYPEFLAG_INVALID,
673  /* 222 empty */ TDS_TYPEFLAG_INVALID,
674  /* 223 empty */ TDS_TYPEFLAG_INVALID,
675  /* 224 empty */ TDS_TYPEFLAG_INVALID,
676  /* 225 SYBLONGBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY,
677  /* 226 empty */ TDS_TYPEFLAG_INVALID,
678  /* 227 empty */ TDS_TYPEFLAG_INVALID,
679  /* 228 empty */ TDS_TYPEFLAG_INVALID,
680  /* 229 empty */ TDS_TYPEFLAG_INVALID,
681  /* 230 empty */ TDS_TYPEFLAG_INVALID,
682  /* 231 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE,
683  /* 232 empty */ TDS_TYPEFLAG_INVALID,
684  /* 233 empty */ TDS_TYPEFLAG_INVALID,
685  /* 234 empty */ TDS_TYPEFLAG_INVALID,
686  /* 235 empty */ TDS_TYPEFLAG_INVALID,
687  /* 236 empty */ TDS_TYPEFLAG_INVALID,
688  /* 237 empty */ TDS_TYPEFLAG_INVALID,
689  /* 238 empty */ TDS_TYPEFLAG_INVALID,
690  /* 239 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE,
691  /* 240 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE,
692  /* 241 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE,
693  /* 242 empty */ TDS_TYPEFLAG_INVALID,
694  /* 243 empty */ TDS_TYPEFLAG_INVALID,
695  /* 244 empty */ TDS_TYPEFLAG_INVALID,
696  /* 245 empty */ TDS_TYPEFLAG_INVALID,
697  /* 246 empty */ TDS_TYPEFLAG_INVALID,
698  /* 247 empty */ TDS_TYPEFLAG_INVALID,
699  /* 248 empty */ TDS_TYPEFLAG_INVALID,
700  /* 249 empty */ TDS_TYPEFLAG_INVALID,
701  /* 250 empty */ TDS_TYPEFLAG_INVALID,
702  /* 251 empty */ TDS_TYPEFLAG_INVALID,
703  /* 252 empty */ TDS_TYPEFLAG_INVALID,
704  /* 253 empty */ TDS_TYPEFLAG_INVALID,
705  /* 254 empty */ TDS_TYPEFLAG_INVALID,
706  /* 255 empty */ TDS_TYPEFLAG_INVALID,
707 };
708 
709 const char *const tds_type_names[256] = {
710  /* 0 */ "",
711  /* 1 */ "",
712  /* 2 */ "",
713  /* 3 */ "",
714  /* 4 */ "",
715  /* 5 */ "",
716  /* 6 */ "",
717  /* 7 */ "",
718  /* 8 */ "",
719  /* 9 */ "",
720  /* 10 */ "",
721  /* 11 */ "",
722  /* 12 */ "",
723  /* 13 */ "",
724  /* 14 */ "",
725  /* 15 */ "",
726  /* 16 */ "",
727  /* 17 */ "",
728  /* 18 */ "",
729  /* 19 */ "",
730  /* 20 */ "",
731  /* 21 */ "",
732  /* 22 */ "",
733  /* 23 */ "",
734  /* 24 */ "",
735  /* 25 */ "",
736  /* 26 */ "",
737  /* 27 */ "",
738  /* 28 */ "",
739  /* 29 */ "",
740  /* 30 */ "",
741  /* 31 */ "SYBVOID",
742  /* 32 */ "",
743  /* 33 */ "",
744  /* 34 */ "SYBIMAGE",
745  /* 35 */ "SYBTEXT",
746  /* 36 */ "SYBUNIQUE",
747  /* 37 */ "SYBVARBINARY",
748  /* 38 */ "SYBINTN",
749  /* 39 */ "SYBVARCHAR",
750  /* 40 */ "SYBMSDATE",
751  /* 41 */ "SYBMSTIME",
752  /* 42 */ "SYBMSDATETIME2",
753  /* 43 */ "SYBMSDATETIMEOFFSET",
754  /* 44 */ "",
755  /* 45 */ "SYBBINARY",
756  /* 46 */ "SYBINTERVAL",
757  /* 47 */ "SYBCHAR",
758  /* 48 */ "SYBINT1",
759  /* 49 */ "SYBDATE",
760  /* 50 */ "SYBBIT",
761  /* 51 */ "SYBTIME",
762  /* 52 */ "SYBINT2",
763  /* 53 */ "",
764  /* 54 */ "",
765  /* 55 */ "",
766  /* 56 */ "SYBINT4",
767  /* 57 */ "",
768  /* 58 */ "SYBDATETIME4",
769  /* 59 */ "SYBREAL",
770  /* 60 */ "SYBMONEY",
771  /* 61 */ "SYBDATETIME",
772  /* 62 */ "SYBFLT8",
773  /* 63 */ "",
774  /* 64 */ "SYBUINT1",
775  /* 65 */ "SYBUINT2",
776  /* 66 */ "SYBUINT4",
777  /* 67 */ "SYBUINT8",
778  /* 68 */ "SYBUINTN",
779  /* 69 */ "",
780  /* 70 */ "",
781  /* 71 */ "",
782  /* 72 */ "",
783  /* 73 */ "",
784  /* 74 */ "",
785  /* 75 */ "",
786  /* 76 */ "",
787  /* 77 */ "",
788  /* 78 */ "",
789  /* 79 */ "",
790  /* 80 */ "",
791  /* 81 */ "",
792  /* 82 */ "",
793  /* 83 */ "",
794  /* 84 */ "",
795  /* 85 */ "",
796  /* 86 */ "",
797  /* 87 */ "",
798  /* 88 */ "",
799  /* 89 */ "",
800  /* 90 */ "",
801  /* 91 */ "",
802  /* 92 */ "",
803  /* 93 */ "",
804  /* 94 */ "",
805  /* 95 */ "",
806  /* 96 */ "",
807  /* 97 */ "",
808  /* 98 */ "SYBVARIANT",
809  /* 99 */ "SYBNTEXT",
810  /* 100 */ "",
811  /* 101 */ "",
812  /* 102 */ "",
813  /* 103 */ "SYBNVARCHAR or SYBSENSITIVITY",
814  /* 104 */ "SYBBITN or SYBBOUNDARY",
815  /* 105 */ "",
816  /* 106 */ "SYBDECIMAL",
817  /* 107 */ "",
818  /* 108 */ "SYBNUMERIC",
819  /* 109 */ "SYBFLTN",
820  /* 110 */ "SYBMONEYN",
821  /* 111 */ "SYBDATETIMN",
822  /* 112 */ "",
823  /* 113 */ "",
824  /* 114 */ "",
825  /* 115 */ "",
826  /* 116 */ "",
827  /* 117 */ "",
828  /* 118 */ "",
829  /* 119 */ "",
830  /* 120 */ "",
831  /* 121 */ "",
832  /* 122 */ "SYBMONEY4",
833  /* 123 */ "SYBDATEN",
834  /* 124 */ "",
835  /* 125 */ "",
836  /* 126 */ "",
837  /* 127 */ "SYBINT8",
838  /* 128 */ "",
839  /* 129 */ "",
840  /* 130 */ "",
841  /* 131 */ "",
842  /* 132 */ "",
843  /* 133 */ "",
844  /* 134 */ "",
845  /* 135 */ "",
846  /* 136 */ "",
847  /* 137 */ "",
848  /* 138 */ "",
849  /* 139 */ "",
850  /* 140 */ "",
851  /* 141 */ "",
852  /* 142 */ "",
853  /* 143 */ "",
854  /* 144 */ "",
855  /* 145 */ "",
856  /* 146 */ "",
857  /* 147 */ "SYBTIMEN",
858  /* 148 */ "",
859  /* 149 */ "",
860  /* 150 */ "",
861  /* 151 */ "",
862  /* 152 */ "",
863  /* 153 */ "",
864  /* 154 */ "",
865  /* 155 */ "",
866  /* 156 */ "",
867  /* 157 */ "",
868  /* 158 */ "",
869  /* 159 */ "",
870  /* 160 */ "",
871  /* 161 */ "",
872  /* 162 */ "",
873  /* 163 */ "SYBXML",
874  /* 164 */ "",
875  /* 165 */ "XSYBVARBINARY",
876  /* 166 */ "",
877  /* 167 */ "XSYBVARCHAR",
878  /* 168 */ "",
879  /* 169 */ "",
880  /* 170 */ "",
881  /* 171 */ "",
882  /* 172 */ "",
883  /* 173 */ "XSYBBINARY",
884  /* 174 */ "SYBUNITEXT",
885  /* 175 */ "XSYBCHAR or SYBLONGCHAR",
886  /* 176 */ "SYBSINT1",
887  /* 177 */ "",
888  /* 178 */ "",
889  /* 179 */ "",
890  /* 180 */ "",
891  /* 181 */ "",
892  /* 182 */ "",
893  /* 183 */ "",
894  /* 184 */ "",
895  /* 185 */ "",
896  /* 186 */ "",
897  /* 187 */ "SYB5BIGDATETIME",
898  /* 188 */ "SYB5BIGTIME",
899  /* 189 */ "",
900  /* 190 */ "",
901  /* 191 */ "SYB5INT8",
902  /* 192 */ "",
903  /* 193 */ "",
904  /* 194 */ "",
905  /* 195 */ "",
906  /* 196 */ "",
907  /* 197 */ "",
908  /* 198 */ "",
909  /* 199 */ "",
910  /* 200 */ "",
911  /* 201 */ "",
912  /* 202 */ "",
913  /* 203 */ "",
914  /* 204 */ "",
915  /* 205 */ "",
916  /* 206 */ "",
917  /* 207 */ "",
918  /* 208 */ "",
919  /* 209 */ "",
920  /* 210 */ "",
921  /* 211 */ "",
922  /* 212 */ "",
923  /* 213 */ "",
924  /* 214 */ "",
925  /* 215 */ "",
926  /* 216 */ "",
927  /* 217 */ "",
928  /* 218 */ "",
929  /* 219 */ "",
930  /* 220 */ "",
931  /* 221 */ "",
932  /* 222 */ "",
933  /* 223 */ "",
934  /* 224 */ "",
935  /* 225 */ "SYBLONGBINARY",
936  /* 226 */ "",
937  /* 227 */ "",
938  /* 228 */ "",
939  /* 229 */ "",
940  /* 230 */ "",
941  /* 231 */ "XSYBNVARCHAR",
942  /* 232 */ "",
943  /* 233 */ "",
944  /* 234 */ "",
945  /* 235 */ "",
946  /* 236 */ "",
947  /* 237 */ "",
948  /* 238 */ "",
949  /* 239 */ "XSYBNCHAR",
950  /* 240 */ "SYBMSUDT",
951  /* 241 */ "SYBMSXML",
952  /* 242 */ "",
953  /* 243 */ "",
954  /* 244 */ "",
955  /* 245 */ "",
956  /* 246 */ "",
957  /* 247 */ "",
958  /* 248 */ "",
959  /* 249 */ "",
960  /* 250 */ "",
961  /* 251 */ "",
962  /* 252 */ "",
963  /* 253 */ "",
964  /* 254 */ "",
965  /* 255 */ "",
966 };
967 #endif
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
TDSPACKET * pkt
first packet frozen
Definition: tds.h:1575
TDSPACKET * frozen_packets
list of packets frozen, points to first one.
Definition: tds.h:1203
Definition: tds.h:1057
@ TDS_READING
client is reading data
Definition: tds.h:794
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
TDSCURSOR * cursors
linked list of cursors allocated for this connection contains only cursors allocated on the server
Definition: tds.h:1107
DSTR password
password of account login
Definition: tds.h:535
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
Main include file for libtds.
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
Current environment as reported by the server.
Definition: tds.h:963
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1258
Holds informations about a cursor.
Definition: tds.h:937
unsigned char * out_buf
Output buffer.
Definition: tds.h:1185
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
TDSPACKET * send_packet
packet we are preparing to send
Definition: tds.h:1231
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
TDSDYNAMIC * dyns
list of dynamic allocated for this connection contains only dynamic allocated on the server
Definition: tds.h:1112
unsigned data_len
data length, this does not account SMP header, only TDS part
Definition: tds.h:1071
unsigned size_len
length size (0, 1, 2 or 4)
Definition: tds.h:1579
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:993
int tds_get_varint_size(TDSCONNECTION *conn, int datatype)
tds_get_varint_size() returns the size of a variable length integer returned in a result string
Definition: tds_types.h:57
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1007
TDS 7.2 SMP packet header.
Definition: proto.h:361
Metadata about columns in regular and compute rows.
Definition: tds.h:689
struct tds_cursor * next
next in linked list, keep first
Definition: tds.h:938
Definition: tds.h:1091
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:939
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:978
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:979
@ TDS_SENDING
client would send data
Definition: tds.h:792
Hold information for any results.
Definition: tds.h:769
@ TDS_WRITING
client is writing data
Definition: tds.h:791
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
unsigned in_len
input buffer length
Definition: tds.h:1194
unsigned out_pos
current position in out_buf
Definition: tds.h:1193
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1009
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
int port
port of database service
Definition: tds.h:519
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
TDSPARAMINFO * res_info
query results
Definition: tds.h:999
DSTR user_name
account for login
Definition: tds.h:534
@ TDS_DEAD
no connection
Definition: tds.h:795
TDSSOCKET * tds
which socket we refer to
Definition: tds.h:1573
Definition: tds.h:1047
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t need)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
@ TDS_IDLE
no data expected
Definition: tds.h:790
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
Information for a server connection.
Definition: tds.h:1163
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1191
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
unsigned pkt_pos
position in pkt
Definition: tds.h:1577
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
int block_size
packet size (512-65535)
Definition: tds.h:965
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
Definition: tds.h:1029
Definition: tds.h:1571
Definition: tds.h:517
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
freetds-1.3.6/doc/reference/a00302_source.html000644 025423 025423 00000115067 14162303416 022373 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/tds_willconvert.h Source File
FreeTDS API
tds_willconvert.h
1 /*** Please do not edit this file! ***/
2 /*** It was generated with 'perl tds_willconvert.pl > tds_willconvert.h' ***/
3 /*** It is much easier to edit the __DATA__ table than this file. ***/
4 /*** ***/
5 /*** Thank you. ***/
6 
7 static const uint8_t type2category[256] = {
8  0, /* 0 */
9  0, /* 1 */
10  0, /* 2 */
11  0, /* 3 */
12  0, /* 4 */
13  0, /* 5 */
14  0, /* 6 */
15  0, /* 7 */
16  0, /* 8 */
17  0, /* 9 */
18  0, /* 10 */
19  0, /* 11 */
20  0, /* 12 */
21  0, /* 13 */
22  0, /* 14 */
23  0, /* 15 */
24  0, /* 16 */
25  0, /* 17 */
26  0, /* 18 */
27  0, /* 19 */
28  0, /* 20 */
29  0, /* 21 */
30  0, /* 22 */
31  0, /* 23 */
32  0, /* 24 */
33  0, /* 25 */
34  0, /* 26 */
35  0, /* 27 */
36  0, /* 28 */
37  0, /* 29 */
38  0, /* 30 */
39  0, /* SYBVOID */
40  0, /* 32 */
41  0, /* 33 */
42  2, /* SYBIMAGE */
43  6, /* SYBTEXT */
44  7, /* SYBBLOB */
45  2, /* SYBVARBINARY */
46  0, /* SYBINTN */
47  6, /* SYBVARCHAR */
48  4, /* SYBMSDATE */
49  4, /* SYBMSTIME */
50  4, /* SYBMSDATETIME2 */
51  4, /* SYBMSDATETIMEOFFSET */
52  0, /* 44 */
53  2, /* SYBBINARY */
54  0, /* SYBINTERVAL */
55  6, /* SYBCHAR */
56  3, /* SYBINT1 */
57  4, /* SYBDATE */
58  1, /* SYBBIT */
59  4, /* SYBTIME */
60  3, /* SYBINT2 */
61  0, /* 53 */
62  0, /* 54 */
63  0, /* 55 */
64  3, /* SYBINT4 */
65  0, /* 57 */
66  4, /* SYBDATETIME4 */
67  3, /* SYBREAL */
68  3, /* SYBMONEY */
69  4, /* SYBDATETIME */
70  3, /* SYBFLT8 */
71  0, /* 63 */
72  3, /* SYBUINT1 */
73  3, /* SYBUINT2 */
74  3, /* SYBUINT4 */
75  3, /* SYBUINT8 */
76  0, /* SYBUINTN */
77  0, /* 69 */
78  0, /* 70 */
79  0, /* 71 */
80  0, /* 72 */
81  0, /* 73 */
82  0, /* 74 */
83  0, /* 75 */
84  0, /* 76 */
85  0, /* 77 */
86  0, /* 78 */
87  0, /* 79 */
88  0, /* 80 */
89  0, /* 81 */
90  0, /* 82 */
91  0, /* 83 */
92  0, /* 84 */
93  0, /* 85 */
94  0, /* 86 */
95  0, /* 87 */
96  0, /* 88 */
97  0, /* 89 */
98  0, /* 90 */
99  0, /* 91 */
100  0, /* 92 */
101  0, /* 93 */
102  0, /* 94 */
103  0, /* 95 */
104  0, /* 96 */
105  0, /* 97 */
106  0, /* SYBVARIANT */
107  0, /* SYBNTEXT */
108  0, /* 100 */
109  0, /* 101 */
110  0, /* 102 */
111  5, /* SYBSENSITIVITY */
112  1, /* SYBBOUNDARY */
113  0, /* 105 */
114  1, /* SYBDECIMAL */
115  0, /* 107 */
116  1, /* SYBNUMERIC */
117  0, /* SYBFLTN */
118  0, /* SYBMONEYN */
119  0, /* SYBDATETIMN */
120  0, /* 112 */
121  0, /* 113 */
122  0, /* 114 */
123  0, /* 115 */
124  0, /* 116 */
125  0, /* 117 */
126  0, /* 118 */
127  0, /* 119 */
128  0, /* 120 */
129  0, /* 121 */
130  3, /* SYBMONEY4 */
131  0, /* SYBDATEN */
132  0, /* 124 */
133  0, /* 125 */
134  0, /* 126 */
135  3, /* SYBINT8 */
136  0, /* 128 */
137  0, /* 129 */
138  0, /* 130 */
139  0, /* 131 */
140  0, /* 132 */
141  0, /* 133 */
142  0, /* 134 */
143  0, /* 135 */
144  0, /* 136 */
145  0, /* 137 */
146  0, /* 138 */
147  0, /* 139 */
148  0, /* 140 */
149  0, /* 141 */
150  0, /* 142 */
151  0, /* 143 */
152  0, /* 144 */
153  0, /* 145 */
154  0, /* 146 */
155  0, /* SYBTIMEN */
156  0, /* 148 */
157  0, /* 149 */
158  0, /* 150 */
159  0, /* 151 */
160  0, /* 152 */
161  0, /* 153 */
162  0, /* 154 */
163  0, /* 155 */
164  0, /* 156 */
165  0, /* 157 */
166  0, /* 158 */
167  0, /* 159 */
168  0, /* 160 */
169  0, /* 161 */
170  0, /* 162 */
171  0, /* SYBXML */
172  0, /* 164 */
173  2, /* XSYBVARBINARY */
174  0, /* 166 */
175  6, /* XSYBVARCHAR */
176  0, /* 168 */
177  0, /* 169 */
178  0, /* 170 */
179  0, /* 171 */
180  0, /* 172 */
181  2, /* XSYBBINARY */
182  0, /* SYBUNITEXT */
183  6, /* SYBLONGCHAR */
184  0, /* SYBSINT1 */
185  0, /* 177 */
186  0, /* 178 */
187  0, /* 179 */
188  0, /* 180 */
189  0, /* 181 */
190  0, /* 182 */
191  0, /* 183 */
192  0, /* 184 */
193  0, /* 185 */
194  0, /* 186 */
195  4, /* SYB5BIGDATETIME */
196  4, /* SYB5BIGTIME */
197  0, /* 189 */
198  0, /* 190 */
199  0, /* SYB5INT8 */
200  0, /* 192 */
201  0, /* 193 */
202  0, /* 194 */
203  0, /* 195 */
204  0, /* 196 */
205  0, /* 197 */
206  0, /* 198 */
207  0, /* 199 */
208  0, /* 200 */
209  0, /* 201 */
210  0, /* 202 */
211  0, /* 203 */
212  0, /* 204 */
213  0, /* 205 */
214  0, /* 206 */
215  0, /* 207 */
216  0, /* 208 */
217  0, /* 209 */
218  0, /* 210 */
219  0, /* 211 */
220  0, /* 212 */
221  0, /* 213 */
222  0, /* 214 */
223  0, /* 215 */
224  0, /* 216 */
225  0, /* 217 */
226  0, /* 218 */
227  0, /* 219 */
228  0, /* 220 */
229  0, /* 221 */
230  0, /* 222 */
231  0, /* 223 */
232  0, /* 224 */
233  2, /* SYBLONGBINARY */
234  0, /* 226 */
235  0, /* 227 */
236  0, /* 228 */
237  0, /* 229 */
238  0, /* 230 */
239  0, /* XSYBNVARCHAR */
240  0, /* 232 */
241  0, /* 233 */
242  0, /* 234 */
243  0, /* 235 */
244  0, /* 236 */
245  0, /* 237 */
246  0, /* 238 */
247  0, /* XSYBNCHAR */
248  0, /* SYBMSUDT */
249  0, /* SYBMSXML */
250  0, /* 242 */
251  0, /* 243 */
252  0, /* 244 */
253  0, /* 245 */
254  0, /* 246 */
255  0, /* 247 */
256  0, /* 248 */
257  0, /* 249 */
258  0, /* 250 */
259  0, /* 251 */
260  0, /* 252 */
261  0, /* 253 */
262  0, /* 254 */
263  0, /* 255 */
264 };
265 
266 static const uint32_t category_conversion[] = {
267  0,
268  78, /* SYBBIT */
269  76, /* SYBIMAGE */
270  78, /* SYBINT1 */
271  84, /* SYBMSDATE */
272  0, /* SYBSENSITIVITY */
273  222, /* SYBTEXT */
274  196, /* SYBUNIQUE */
275 };
freetds-1.3.6/doc/reference/a00308.html000644 025423 025423 00000123371 14162303416 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/token.c File Reference
FreeTDS API
token.c File Reference

Contains all routines to get replies from server. More...

#include <config.h>
#include <assert.h>
#include <freetds/tds.h>
#include <freetds/utils/string.h>
#include <freetds/convert.h>
#include <freetds/iconv.h>
#include <freetds/checks.h>
#include <freetds/bytes.h>
#include <freetds/alloca.h>
#include <freetds/encodings.h>
#include <freetds/enum_cap.h>
#include <freetds/replacements.h>
Include dependency graph for token.c:

Classes

struct  namelist
 Holds list of names. More...
 

Macros

#define GET_STRING(dest, len_type)
 

Functions

static void adjust_character_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Adjust column size according to client's encoding. More...
 
static int determine_adjusted_size (const TDSICONV *char_conv, int size)
 Allow for maximum possible size of converted data, while being careful about integer division truncation. More...
 
static TDSRET tds5_process_dyn_result2 (TDSSOCKET *tds)
 Process new TDS 5.0 token for describing output parameters. More...
 
static TDSRET tds5_process_optioncmd (TDSSOCKET *tds)
 Process option cmd results. More...
 
static TDSRET tds5_process_result (TDSSOCKET *tds)
 tds5_process_result() is the TDS 5.0 result set processing routine. More...
 
static TDSRET tds5_process_result2 (TDSSOCKET *tds)
 tds5_process_result2() is the new TDS 5.0 result set processing routine. More...
 
static int tds71_read_table_names (TDSSOCKET *tds, int remainder, struct namelist **p_head)
 Reads table names for TDS 7.1+. More...
 
static TDSRET tds7_get_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Reads data information from wire. More...
 
static TDSRET tds7_process_compute_result (TDSSOCKET *tds)
 tds7_process_compute_result() processes compute result sets for TDS 7/8. More...
 
static TDSRET tds7_process_result (TDSSOCKET *tds)
 tds7_process_result() is the TDS 7.0 result set processing routine. More...
 
static int tds_alloc_get_string (TDSSOCKET *tds, char **string, size_t len)
 Reads a string from wire in a new allocated buffer. More...
 
static void tds_free_namelist (struct namelist *head)
 Frees list of names. More...
 
static TDSRET tds_get_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol, int is_param)
 Reads data metadata from wire. More...
 
int tds_get_token_size (int marker)
 tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determine how to read past a token More...
 
TDSDYNAMICtds_lookup_dynamic (TDSCONNECTION *conn, const char *id)
 Finds a dynamic given string id. More...
 
static const char * tds_pr_op (int op)
 Returns string representation for a given operation. More...
 
static TDSRET tds_process_auth (TDSSOCKET *tds)
 Process authentication token. More...
 
TDSRET tds_process_cancel (TDSSOCKET *tds)
 
static TDSRET tds_process_col_fmt (TDSSOCKET *tds)
 tds_process_col_fmt() is the other half of result set processing under TDS 4.2. More...
 
static TDSRET tds_process_col_name (TDSSOCKET *tds)
 tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names, a TDS_COLFMT_TOKEN should immediately follow this token with the datatype/size information This is a 4.2 only function More...
 
static TDSRET tds_process_colinfo (TDSSOCKET *tds, char **names, int num_names)
 Reads column information. More...
 
static TDSRET tds_process_compute (TDSSOCKET *tds)
 tds_process_compute() processes compute rows and places them in the row buffer. More...
 
static TDSRET tds_process_compute_names (TDSSOCKET *tds)
 tds_process_compute_names() processes compute result sets. More...
 
static TDSRET tds_process_compute_result (TDSSOCKET *tds)
 tds_process_compute_result() processes compute result sets. More...
 
static TDSRET tds_process_cursor_tokens (TDSSOCKET *tds)
 Reads cursor command results. More...
 
static TDSRET tds_process_default_tokens (TDSSOCKET *tds, int marker)
 tds_process_default_tokens() is a catch all function that is called to process tokens not known to other tds_process_* routines More...
 
static TDSRET tds_process_dyn_result (TDSSOCKET *tds)
 Process results from dynamic. More...
 
static TDSDYNAMICtds_process_dynamic (TDSSOCKET *tds)
 tds_process_dynamic() finds the element of the dyns array for the id More...
 
static TDSRET tds_process_end (TDSSOCKET *tds, int marker, int *flags_parm)
 tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens. More...
 
static TDSRET tds_process_env_chg (TDSSOCKET *tds)
 tds_process_env_chg() when ever certain things change on the server, such as database, character set, language, or block size. More...
 
static TDSRET tds_process_env_routing (TDSSOCKET *tds)
 
static TDSRET tds_process_featureextack (TDSSOCKET *tds)
 
static TDSRET tds_process_info (TDSSOCKET *tds, int marker)
 tds_process_info() is called for INFO, ERR, or EED tokens and is responsible for calling the CLI's message handling routine More...
 
TDSRET tds_process_login_tokens (TDSSOCKET *tds)
 tds_process_login_tokens() is called after sending the login packet to the server. More...
 
static TDSRET tds_process_loginack (TDSSOCKET *tds, TDSRET *login_succeeded)
 
static TDSRET tds_process_nbcrow (TDSSOCKET *tds)
 tds_process_nbcrow() processes rows and places them in the row buffer.
 
static TDSRET tds_process_param_result (TDSSOCKET *tds, TDSPARAMINFO **pinfo)
 process output parameters of a stored procedure. More...
 
static TDSRET tds_process_param_result_tokens (TDSSOCKET *tds)
 Process parameters from networks. More...
 
static TDSRET tds_process_params_result_token (TDSSOCKET *tds)
 tds_process_params_result_token() processes params on TDS5. More...
 
static void tds_process_pending_closes (TDSSOCKET *tds)
 Attempt to close all deferred closes (dynamics and cursors). More...
 
static TDSRET tds_process_row (TDSSOCKET *tds)
 tds_process_row() processes rows and places them in the row buffer. More...
 
TDSRET tds_process_simple_query (TDSSOCKET *tds)
 Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results, beware they are discarded. More...
 
static TDSRET tds_process_tabname (TDSSOCKET *tds)
 Process list of table from network. More...
 
TDSRET tds_process_tokens (TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
 process all streams. More...
 
const char * tds_prtype (int type)
 Returns string representation of the given type. More...
 
static int tds_read_namelist (TDSSOCKET *tds, int remainder, struct namelist **p_head, int large)
 Reads list of names (usually table names) More...
 
static const char * tds_token_name (unsigned char marker)
 Returns string representation for a given token type. More...
 

Detailed Description

Contains all routines to get replies from server.

Macro Definition Documentation

◆ GET_STRING

#define GET_STRING (   dest,
  len_type 
)
Value:
do { \
unsigned int to_read_size = tds_get_ ## len_type(tds); \
char_len += to_read_size; \
rc += tds_alloc_get_string(tds, dest, to_read_size); \
} while(0)
static int tds_alloc_get_string(TDSSOCKET *tds, char **string, size_t len)
Reads a string from wire in a new allocated buffer.
Definition: token.c:2527
freetds-1.3.6/doc/reference/a00309.dot000644 025423 025423 00000020626 14162303416 020640 0ustar00fredianofrediano000000 000000 digraph "src/tds/token.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/tds/token.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Contains all routines to get replies from server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node7 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node4 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node4 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node4 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node4 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node14 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node4 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node18 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node19 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node20 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node4 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/convert.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00401_source.html",tooltip=" "]; Node22 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node23 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="freetds/checks.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00395_source.html",tooltip=" "]; Node24 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="freetds/bytes.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00386_source.html",tooltip=" "]; Node1 -> Node26 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node26 [label="freetds/alloca.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00377_source.html",tooltip=" "]; Node1 -> Node27 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node27 [label="freetds/encodings.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00407_source.html",tooltip=" "]; Node1 -> Node28 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node28 [label="freetds/enum_cap.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00410_source.html",tooltip=" "]; Node1 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00356_source.html000644 025423 025423 00000034337 14162303412 022400 0ustar00fredianofrediano000000 000000 FreeTDS API: include/bkpublic.h Source File
FreeTDS API
bkpublic.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _bkpublic_h_
21 #define _bkpublic_h_
22 
23 static const char rcsid_bkpublic_h[] = "$Id: bkpublic.h,v 1.5 2004-10-28 12:42:11 freddy77 Exp $";
24 static const void *const no_unused_bkpublic_h_warn[] = { rcsid_bkpublic_h, no_unused_bkpublic_h_warn };
25 
26 /* seperate this stuff out later */
27 #include <cspublic.h>
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #if 0
33 }
34 #endif
35 #endif
36 
37 /* buld properties start with 1 i guess */
38 #define BLK_IDENTITY 1
39 
40 CS_RETCODE blk_alloc(CS_CONNECTION * connection, CS_INT version, CS_BLKDESC ** blk_pointer);
41 CS_RETCODE blk_bind(CS_BLKDESC * blkdesc, CS_INT colnum, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT * datalen,
42  CS_SMALLINT * indicator);
43 CS_RETCODE blk_colval(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp, CS_INT colnum, CS_VOID * valuep,
44  CS_INT valuelen, CS_INT * outlenp);
45 CS_RETCODE blk_default(CS_BLKDESC * blkdesc, CS_INT colnum, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
46 CS_RETCODE blk_describe(CS_BLKDESC * blkdesc, CS_INT colnum, CS_DATAFMT * datafmt);
47 CS_RETCODE blk_done(CS_BLKDESC * blkdesc, CS_INT type, CS_INT * outrow);
48 CS_RETCODE blk_drop(CS_BLKDESC * blkdesc);
49 CS_RETCODE blk_getrow(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp);
50 CS_RETCODE blk_gettext(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp, CS_INT bufsize, CS_INT * outlenp);
51 CS_RETCODE blk_init(CS_BLKDESC * blkdesc, CS_INT direction, CS_CHAR * tablename, CS_INT tnamelen);
52 CS_RETCODE blk_props(CS_BLKDESC * blkdesc, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
53 CS_RETCODE blk_rowalloc(SRV_PROC * srvproc, CS_BLK_ROW ** row);
54 CS_RETCODE blk_rowdrop(SRV_PROC * srvproc, CS_BLK_ROW * row);
55 CS_RETCODE blk_rowxfer(CS_BLKDESC * blkdesc);
56 CS_RETCODE blk_rowxfer_mult(CS_BLKDESC * blkdesc, CS_INT * row_count);
57 CS_RETCODE blk_sendrow(CS_BLKDESC * blkdesc, CS_BLK_ROW * row);
58 CS_RETCODE blk_sendtext(CS_BLKDESC * blkdesc, CS_BLK_ROW * row, CS_BYTE * buffer, CS_INT buflen);
59 CS_RETCODE blk_srvinit(SRV_PROC * srvproc, CS_BLKDESC * blkdescp);
60 CS_RETCODE blk_textxfer(CS_BLKDESC * blkdesc, CS_BYTE * buffer, CS_INT buflen, CS_INT * outlen);
61 
62 #ifdef __cplusplus
63 #if 0
64 {
65 #endif
66 }
67 #endif
68 
69 #endif
Definition: ctlib.h:239
Definition: ctlib.h:117
Definition: cstypes.h:114
freetds-1.3.6/doc/reference/a00359_source.html000644 025423 025423 00000313614 14162303412 022401 0ustar00fredianofrediano000000 000000 FreeTDS API: include/config.h Source File
FreeTDS API
config.h
1 /* include/config.h. Generated from config.h.in by configure. */
2 /* include/config.h.in. Generated from configure.ac by autoheader. */
3 
4 #define _freetds_config_h_
5 
6 /* Define if building universal (internal helper macro) */
7 /* #undef AC_APPLE_UNIVERSAL_BUILD */
8 
9 /* Define to 1 if you need BSD_COMP defined to get FIONBIO defined. */
10 /* #undef BSD_COMP */
11 
12 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
13  systems. This function is required for `alloca.c' support on those systems.
14  */
15 /* #undef CRAY_STACKSEG_END */
16 
17 /* Define to 1 if using `alloca.c'. */
18 /* #undef C_ALLOCA */
19 
20 /* Define to enable work in progress code */
21 /* #undef ENABLE_DEVELOPING */
22 
23 /* Define to enable extra checks on code */
24 /* #undef ENABLE_EXTRA_CHECKS */
25 
26 /* Defined if --enable-krb5 used and library detected */
27 /* #undef ENABLE_KRB5 */
28 
29 /* Define to enable MARS support */
30 #define ENABLE_ODBC_MARS 1
31 
32 /* Define to enable ODBC wide string support */
33 #define ENABLE_ODBC_WIDE 1
34 
35 /* Define to 1 if GNU tls use nettle as backend. */
36 /* #undef GNUTLS_USE_NETTLE */
37 
38 /* Define to 1 if you have the `alarm' function. */
39 #define HAVE_ALARM 1
40 
41 /* Define to 1 if you have `alloca', as a function or macro. */
42 #define HAVE_ALLOCA 1
43 
44 /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
45  */
46 /* #undef HAVE_ALLOCA_H */
47 
48 /* Define to 1 if you have the <arpa/inet.h> header file. */
49 #define HAVE_ARPA_INET_H 1
50 
51 /* Define to 1 if you have the `ASN1_STRING_get0_data' function. */
52 #define HAVE_ASN1_STRING_GET0_DATA 1
53 
54 /* Define to 1 if you have the `asprintf' function. */
55 #define HAVE_ASPRINTF 1
56 
57 /* Define to 1 if you have the `basename' function. */
58 #define HAVE_BASENAME 1
59 
60 /* Define to 1 if you have the `BIO_get_data' function. */
61 #define HAVE_BIO_GET_DATA 1
62 
63 /* Define if you have the clock_gettime function. */
64 #define HAVE_CLOCK_GETTIME 1
65 
66 /* Define to 1 if you have the <com_err.h> header file. */
67 /* #undef HAVE_COM_ERR_H */
68 
69 /* Define to 1 if you have the `daemon' function. */
70 #define HAVE_DAEMON 1
71 
72 /* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
73  you don't. */
74 /* #undef HAVE_DECL_CYGWIN_CONV_PATH */
75 
76 /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
77  */
78 /* #undef HAVE_DECL_TZNAME */
79 
80 /* Define to 1 if you have the <dirent.h> header file. */
81 #define HAVE_DIRENT_H 1
82 
83 /* Define if you have the GNU dld library. */
84 /* #undef HAVE_DLD */
85 
86 /* Define to 1 if you have the `dlerror' function. */
87 #define HAVE_DLERROR 1
88 
89 /* Define to 1 if you have the <dlfcn.h> header file. */
90 #define HAVE_DLFCN_H 1
91 
92 /* Define if you have the _dyld_func_lookup function. */
93 /* #undef HAVE_DYLD */
94 
95 /* Define to 1 if you have the <errno.h> header file. */
96 #define HAVE_ERRNO_H 1
97 
98 /* Define to 1 if you have the `error_message' function. */
99 /* #undef HAVE_ERROR_MESSAGE */
100 
101 /* Define to 1 if you have the `eventfd' function. */
102 /* #undef HAVE_EVENTFD */
103 
104 /* Define to 1 if you have the <fcntl.h> header file. */
105 #define HAVE_FCNTL_H 1
106 
107 /* Define to 1 if you have the `fork' function. */
108 #define HAVE_FORK 1
109 
110 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
111 #define HAVE_FSEEKO 1
112 
113 /* Define to 1 if you have the `fstat' function. */
114 #define HAVE_FSTAT 1
115 
116 /* Define to 1 if your system provides the 5-parameter version of
117  gethostbyaddr_r(). */
118 /* #undef HAVE_FUNC_GETHOSTBYADDR_R_5 */
119 
120 /* Define to 1 if your system provides the 7-parameter version of
121  gethostbyaddr_r(). */
122 #define HAVE_FUNC_GETHOSTBYADDR_R_7 1
123 
124 /* Define to 1 if your system provides the 8-parameter version of
125  gethostbyaddr_r(). */
126 /* #undef HAVE_FUNC_GETHOSTBYADDR_R_8 */
127 
128 /* Define to 1 if your system provides the 3-parameter version of
129  gethostbyname_r(). */
130 /* #undef HAVE_FUNC_GETHOSTBYNAME_R_3 */
131 
132 /* Define to 1 if your system provides the 5-parameter version of
133  gethostbyname_r(). */
134 /* #undef HAVE_FUNC_GETHOSTBYNAME_R_5 */
135 
136 /* Define to 1 if your system provides the 6-parameter version of
137  gethostbyname_r(). */
138 #define HAVE_FUNC_GETHOSTBYNAME_R_6 1
139 
140 /* Define to 1 if your system provides the 4-parameter version of
141  getpwuid_r(). */
142 /* #undef HAVE_FUNC_GETPWUID_R_4 */
143 
144 /* Define to 1 if your system getpwuid_r() have 4 parameters and return struct
145  passwd*. */
146 /* #undef HAVE_FUNC_GETPWUID_R_4_PW */
147 
148 /* Define to 1 if your system provides the 5-parameter version of
149  getpwuid_r(). */
150 #define HAVE_FUNC_GETPWUID_R_5 1
151 
152 /* Define to 1 if your system provides the 4-parameter version of
153  getservbyname_r(). */
154 /* #undef HAVE_FUNC_GETSERVBYNAME_R_4 */
155 
156 /* Define to 1 if your system provides the 5-parameter version of
157  getservbyname_r(). */
158 /* #undef HAVE_FUNC_GETSERVBYNAME_R_5 */
159 
160 /* Define to 1 if your system provides the 6-parameter version of
161  getservbyname_r(). */
162 #define HAVE_FUNC_GETSERVBYNAME_R_6 1
163 
164 /* Define to 1 if your localtime_r return a int. */
165 /* #undef HAVE_FUNC_LOCALTIME_R_INT */
166 
167 /* Define to 1 if your localtime_r return a struct tm*. */
168 #define HAVE_FUNC_LOCALTIME_R_TM 1
169 
170 /* Define if you have getaddrinfo function */
171 #define HAVE_GETADDRINFO 1
172 
173 /* Define to 1 if you have the `gethostname' function. */
174 #define HAVE_GETHOSTNAME 1
175 
176 /* Define to 1 if you have the `gethrtime' function. */
177 /* #undef HAVE_GETHRTIME */
178 
179 /* Define to 1 if you have the `getipnodebyaddr' function. */
180 /* #undef HAVE_GETIPNODEBYADDR */
181 
182 /* Define to 1 if you have the `getipnodebyname' function. */
183 /* #undef HAVE_GETIPNODEBYNAME */
184 
185 /* Define to 1 if you have the `getopt' function. */
186 #define HAVE_GETOPT 1
187 
188 /* Define to 1 if you have the <getopt.h> header file. */
189 #define HAVE_GETOPT_H 1
190 
191 /* Define if your getopt(3) defines and uses optreset */
192 #define HAVE_GETOPT_OPTRESET 1
193 
194 /* Define to 1 if you have the `getpwuid' function. */
195 #define HAVE_GETPWUID 1
196 
197 /* Define to 1 if you have the `getpwuid_r' function. */
198 #define HAVE_GETPWUID_R 1
199 
200 /* Define to 1 if you have the `gettimeofday' function. */
201 #define HAVE_GETTIMEOFDAY 1
202 
203 /* Define to 1 if you have the `getuid' function. */
204 #define HAVE_GETUID 1
205 
206 /* Define if you have GMP library */
207 /* #undef HAVE_GMP */
208 
209 /* Define to 1 if you have GnuTLS. */
210 /* #undef HAVE_GNUTLS */
211 
212 /* Define to 1 if you have the <gnutls/abstract.h> header file. */
213 /* #undef HAVE_GNUTLS_ABSTRACT_H */
214 
215 /* Define to 1 if you have the `gnutls_certificate_set_verify_function'
216  function. */
217 /* #undef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION */
218 
219 /* Define to 1 if you have the `gnutls_record_disable_padding' function. */
220 /* #undef HAVE_GNUTLS_RECORD_DISABLE_PADDING */
221 
222 /* Define to 1 if you have the `gnutls_rnd' function. */
223 /* #undef HAVE_GNUTLS_RND */
224 
225 /* Define if you have the iconv() function and it works. */
226 #define HAVE_ICONV 1
227 
228 /* Define to 1 if you have the `inet_ntoa_r' function. */
229 /* #undef HAVE_INET_NTOA_R */
230 
231 /* Define to 1 if you have the `inet_ntop' function. */
232 #define HAVE_INET_NTOP 1
233 
234 /* Define to 1 if you have the <inttypes.h> header file. */
235 #define HAVE_INTTYPES_H 1
236 
237 /* Define to 1 if you have the <iodbcinst.h> header file. */
238 /* #undef HAVE_IODBCINST_H */
239 
240 /* Define to 1 if you have the <langinfo.h> header file. */
241 #define HAVE_LANGINFO_H 1
242 
243 /* Define if you have the libdl library or equivalent. */
244 #define HAVE_LIBDL 1
245 
246 /* Define if libdlloader will be built on this platform */
247 #define HAVE_LIBDLLOADER 1
248 
249 /* Define to 1 if you have the <libgen.h> header file. */
250 #define HAVE_LIBGEN_H 1
251 
252 /* Define to 1 if you have the <limits.h> header file. */
253 #define HAVE_LIMITS_H 1
254 
255 /* Define to 1 if you have the <localcharset.h> header file. */
256 /* #undef HAVE_LOCALCHARSET_H */
257 
258 /* Define to 1 if you have the `locale_charset' function. */
259 /* #undef HAVE_LOCALE_CHARSET */
260 
261 /* Define to 1 if you have the <locale.h> header file. */
262 #define HAVE_LOCALE_H 1
263 
264 /* Define to 1 if you have the `localtime_r' function. */
265 #define HAVE_LOCALTIME_R 1
266 
267 /* Define to 1 if you have the <malloc.h> header file. */
268 #define HAVE_MALLOC_H 1
269 
270 /* Define to 1 if your system provides the malloc_options variable. */
271 /* #undef HAVE_MALLOC_OPTIONS */
272 
273 /* Define to 1 if you have the <memory.h> header file. */
274 #define HAVE_MEMORY_H 1
275 
276 /* Define to 1 if you have the `nanosleep' function. */
277 #define HAVE_NANOSLEEP 1
278 
279 /* Define to 1 if you have the <netdb.h> header file. */
280 #define HAVE_NETDB_H 1
281 
282 /* Define to 1 if you have the <netinet/in.h> header file. */
283 #define HAVE_NETINET_IN_H 1
284 
285 /* Define to 1 if you have the <netinet/tcp.h> header file. */
286 #define HAVE_NETINET_TCP_H 1
287 
288 /* Define to 1 if nettle is present. */
289 /* #undef HAVE_NETTLE */
290 
291 /* Define to 1 if you have the `nl_langinfo' function. */
292 #define HAVE_NL_LANGINFO 1
293 
294 /* Define if you have the OpenSSL. */
295 #define HAVE_OPENSSL 1
296 
297 /* Define to 1 if you have the <paths.h> header file. */
298 #define HAVE_PATHS_H 1
299 
300 /* Define to 1 if you have the `poll' function. */
301 #define HAVE_POLL 1
302 
303 /* Define to 1 if you have the <poll.h> header file. */
304 #define HAVE_POLL_H 1
305 
306 /* Define if you have POSIX threads libraries and header files. */
307 #define HAVE_PTHREAD 1
308 
309 /* Define to 1 if you have the `pthread_condattr_setclock' function. */
310 #define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
311 
312 /* Define to 1 if you have the `pthread_cond_timedwait' function. */
313 #define HAVE_PTHREAD_COND_TIMEDWAIT 1
314 
315 /* Define to 1 if you have the `pthread_cond_timedwait_relative_np' function.
316  */
317 /* #undef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP */
318 
319 /* Define to 1 if you have the `putenv' function. */
320 #define HAVE_PUTENV 1
321 
322 /* Define to 1 if you have the `readdir_r' function. */
323 #define HAVE_READDIR_R 1
324 
325 /* Define to 1 if you have the GNU Readline library. */
326 /* #undef HAVE_READLINE */
327 
328 /* Define to 1 if you have the `readpassphrase' function. */
329 /* #undef HAVE_READPASSPHRASE */
330 
331 /* Define to 1 if you have rl_inhibit_completion. */
332 /* #undef HAVE_RL_INHIBIT_COMPLETION */
333 
334 /* Define to 1 if you have the `rl_on_new_line' function. */
335 /* #undef HAVE_RL_ON_NEW_LINE */
336 
337 /* Define to 1 if you have the `rl_reset_line_state' function. */
338 /* #undef HAVE_RL_RESET_LINE_STATE */
339 
340 /* Define to 1 if you have the <roken.h> header file. */
341 /* #undef HAVE_ROKEN_H */
342 
343 /* Define to 1 if you have the `RSA_get0_key' function. */
344 #define HAVE_RSA_GET0_KEY 1
345 
346 /* Define to 1 if you have the `setenv' function. */
347 #define HAVE_SETENV 1
348 
349 /* Define to 1 if you have the `setitimer' function. */
350 #define HAVE_SETITIMER 1
351 
352 /* Define to 1 if you have the `setrlimit' function. */
353 #define HAVE_SETRLIMIT 1
354 
355 /* Define if you have the shl_load function. */
356 /* #undef HAVE_SHL_LOAD */
357 
358 /* Define to 1 if you have the <signal.h> header file. */
359 #define HAVE_SIGNAL_H 1
360 
361 /* Define to 1 if you have the `socketpair' function. */
362 #define HAVE_SOCKETPAIR 1
363 
364 /* Define to 1 if you have the SQLGetPrivateProfileString function. */
365 /* #undef HAVE_SQLGETPRIVATEPROFILESTRING */
366 
367 /* Define if sqltypes.h define SQLLEN */
368 /* #undef HAVE_SQLLEN */
369 
370 /* Define to 1 if the system has the type `SQLROWOFFSET'. */
371 /* #undef HAVE_SQLROWOFFSET */
372 
373 /* Define to 1 if the system has the type `SQLROWSETSIZE'. */
374 /* #undef HAVE_SQLROWSETSIZE */
375 
376 /* Define to 1 if the system has the type `SQLSETPOSIROW'. */
377 /* #undef HAVE_SQLSETPOSIROW */
378 
379 /* Define to 1 if you have the <sql.h> header file. */
380 /* #undef HAVE_SQL_H */
381 
382 /* Defined if not --disable-sspi and SSPI detected */
383 /* #undef HAVE_SSPI */
384 
385 /* Define to 1 if you have the <stdbool.h> header file. */
386 #define HAVE_STDBOOL_H 1
387 
388 /* Define to 1 if you have the <stddef.h> header file. */
389 #define HAVE_STDDEF_H 1
390 
391 /* Define to 1 if you have the <stdint.h> header file. */
392 #define HAVE_STDINT_H 1
393 
394 /* Define to 1 if you have the <stdlib.h> header file. */
395 #define HAVE_STDLIB_H 1
396 
397 /* Define to 1 if you have the <strings.h> header file. */
398 #define HAVE_STRINGS_H 1
399 
400 /* Define to 1 if you have the <string.h> header file. */
401 #define HAVE_STRING_H 1
402 
403 /* Define to 1 if you have the `strlcat' function. */
404 #define HAVE_STRLCAT 1
405 
406 /* Define to 1 if you have the `strlcpy' function. */
407 #define HAVE_STRLCPY 1
408 
409 /* Define to 1 if you have the `strsep' function. */
410 #define HAVE_STRSEP 1
411 
412 /* Define to 1 if you have the `strtok_r' function. */
413 #define HAVE_STRTOK_R 1
414 
415 /* Define to 1 if you have the `strtok_s' function. */
416 /* #undef HAVE_STRTOK_S */
417 
418 /* Define to 1 if `tm_zone' is a member of `struct tm'. */
419 #define HAVE_STRUCT_TM_TM_ZONE 1
420 
421 /* Define to 1 if `__tm_zone' is a member of `struct tm'. */
422 /* #undef HAVE_STRUCT_TM___TM_ZONE */
423 
424 /* Define to 1 if you have the 'system' function */
425 #define HAVE_SYSTEM 1
426 
427 /* Define to 1 if you have the <sys/eventfd.h> header file. */
428 /* #undef HAVE_SYS_EVENTFD_H */
429 
430 /* Define to 1 if you have the <sys/ioctl.h> header file. */
431 #define HAVE_SYS_IOCTL_H 1
432 
433 /* Define to 1 if you have the <sys/param.h> header file. */
434 #define HAVE_SYS_PARAM_H 1
435 
436 /* Define to 1 if you have the <sys/resource.h> header file. */
437 #define HAVE_SYS_RESOURCE_H 1
438 
439 /* Define to 1 if you have the <sys/select.h> header file. */
440 #define HAVE_SYS_SELECT_H 1
441 
442 /* Define to 1 if you have the <sys/socket.h> header file. */
443 #define HAVE_SYS_SOCKET_H 1
444 
445 /* Define to 1 if you have the <sys/stat.h> header file. */
446 #define HAVE_SYS_STAT_H 1
447 
448 /* Define to 1 if you have the <sys/time.h> header file. */
449 #define HAVE_SYS_TIME_H 1
450 
451 /* Define to 1 if you have the <sys/types.h> header file. */
452 #define HAVE_SYS_TYPES_H 1
453 
454 /* Define to 1 if you have the <sys/wait.h> header file. */
455 #define HAVE_SYS_WAIT_H 1
456 
457 /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
458  `HAVE_STRUCT_TM_TM_ZONE' instead. */
459 #define HAVE_TM_ZONE 1
460 
461 /* Define to 1 if you don't have `tm_zone' but do have the external array
462  `tzname'. */
463 /* #undef HAVE_TZNAME */
464 
465 /* Define to 1 if you have the <unistd.h> header file. */
466 #define HAVE_UNISTD_H 1
467 
468 /* Define to 1 if you have the `usleep' function. */
469 #define HAVE_USLEEP 1
470 
471 /* Define to 1 if you have the <valgrind/memcheck.h> header file. */
472 /* #undef HAVE_VALGRIND_MEMCHECK_H */
473 
474 /* Define to 1 if you have the `vasprintf' function. */
475 #define HAVE_VASPRINTF 1
476 
477 /* Define to 1 if you have the `vsnprintf' function. */
478 #define HAVE_VSNPRINTF 1
479 
480 /* Define to 1 if you have the <wchar.h> header file. */
481 #define HAVE_WCHAR_H 1
482 
483 /* Define to 1 if you have the <windows.h> header file. */
484 /* #undef HAVE_WINDOWS_H */
485 
486 /* Define to 1 if you have the <winsock2.h> header file. */
487 /* #undef HAVE_WINSOCK2_H */
488 
489 /* Define to 1 if you have the `_fseeki64' function. */
490 /* #undef HAVE__FSEEKI64 */
491 
492 /* Define to 1 if you have the `_ftelli64' function. */
493 /* #undef HAVE__FTELLI64 */
494 
495 /* Define to 1 if you have the `_lock_file' function. */
496 /* #undef HAVE__LOCK_FILE */
497 
498 /* Define to 1 if you have the `_unlock_file' function. */
499 /* #undef HAVE__UNLOCK_FILE */
500 
501 /* Define to 1 if you have the `_vscprintf' function. */
502 /* #undef HAVE__VSCPRINTF */
503 
504 /* Define to 1 if you have the `_vsnprintf' function. */
505 #define HAVE__VSNPRINTF 1
506 
507 /* Define to 1 if you have the `_xpg_accept' function. */
508 /* #undef HAVE__XPG_ACCEPT */
509 
510 /* Define to 1 if you have the `_xpg_getpeername' function. */
511 /* #undef HAVE__XPG_GETPEERNAME */
512 
513 /* Define to 1 if you have the `_xpg_getsockname' function. */
514 /* #undef HAVE__XPG_GETSOCKNAME */
515 
516 /* Define to 1 if you have the `_xpg_getsockopt' function. */
517 /* #undef HAVE__XPG_GETSOCKOPT */
518 
519 /* Define to 1 if you have the `_xpg_recvfrom' function. */
520 /* #undef HAVE__XPG_RECVFROM */
521 
522 /* Define to 1 if you have the `__accept' function. */
523 /* #undef HAVE___ACCEPT */
524 
525 /* Define to 1 if you have the `__getpeername' function. */
526 /* #undef HAVE___GETPEERNAME */
527 
528 /* Define to 1 if you have the `__getsockname' function. */
529 /* #undef HAVE___GETSOCKNAME */
530 
531 /* Define to 1 if you have the `__getsockopt' function. */
532 /* #undef HAVE___GETSOCKOPT */
533 
534 /* Define to 1 if you have the `__recvfrom' function. */
535 /* #undef HAVE___RECVFROM */
536 
537 /* Define as const if the declaration of iconv() needs const. */
538 #define ICONV_CONST
539 
540 /* Define to value of INADDR_NONE if not provided by your system header files.
541  */
542 /* #undef INADDR_NONE */
543 
544 /* Define to the sub-directory where libtool stores uninstalled libraries. */
545 #define LT_OBJDIR ".libs/"
546 
547 /* Define to 1 if the BSD-style netdb interface is reentrant. */
548 /* #undef NETDB_REENTRANT */
549 
550 /* Define to 1 if memset(0) sets pointers to NULL. */
551 #define NULL_REP_IS_ZERO_BYTES 1
552 
553 /* Name of package */
554 #define PACKAGE "freetds"
555 
556 /* Define to the address where bug reports for this package should be sent. */
557 #define PACKAGE_BUGREPORT ""
558 
559 /* Define to the full name of this package. */
560 #define PACKAGE_NAME "FreeTDS"
561 
562 /* Define to the full name and version of this package. */
563 #define PACKAGE_STRING "FreeTDS 1.3.6"
564 
565 /* Define to the one symbol short name of this package. */
566 #define PACKAGE_TARNAME "freetds"
567 
568 /* Define to the home page for this package. */
569 #define PACKAGE_URL ""
570 
571 /* Define to the version of this package. */
572 #define PACKAGE_VERSION "1.3.6"
573 
574 /* Define to necessary symbol if this constant uses a non-standard name on
575  your system. */
576 /* #undef PTHREAD_CREATE_JOINABLE */
577 
578 /* The size of `char', as computed by sizeof. */
579 #define SIZEOF_CHAR 1
580 
581 /* The size of `double', as computed by sizeof. */
582 #define SIZEOF_DOUBLE 8
583 
584 /* The size of `float', as computed by sizeof. */
585 #define SIZEOF_FLOAT 4
586 
587 /* The size of `int', as computed by sizeof. */
588 #define SIZEOF_INT 4
589 
590 /* The size of `long', as computed by sizeof. */
591 #define SIZEOF_LONG 8
592 
593 /* The size of `long double', as computed by sizeof. */
594 #define SIZEOF_LONG_DOUBLE 16
595 
596 /* The size of `long long', as computed by sizeof. */
597 #define SIZEOF_LONG_LONG 8
598 
599 /* The size of `short', as computed by sizeof. */
600 #define SIZEOF_SHORT 2
601 
602 /* The size of `SQLWCHAR', as computed by sizeof. */
603 #define SIZEOF_SQLWCHAR 0
604 
605 /* The size of `void *', as computed by sizeof. */
606 #define SIZEOF_VOID_P 8
607 
608 /* The size of `wchar_t', as computed by sizeof. */
609 #define SIZEOF_WCHAR_T 4
610 
611 /* The size of `__int64', as computed by sizeof. */
612 #define SIZEOF___INT64 0
613 
614 /* If using the C implementation of alloca, define if you know the
615  direction of stack growth for your system; otherwise it will be
616  automatically deduced at runtime.
617  STACK_DIRECTION > 0 => grows toward higher addresses
618  STACK_DIRECTION < 0 => grows toward lower addresses
619  STACK_DIRECTION = 0 => direction of growth unknown */
620 /* #undef STACK_DIRECTION */
621 
622 /* Define to 1 if you have the ANSI C header files. */
623 #define STDC_HEADERS 1
624 
625 /* Define to use TDS 5.0 by default */
626 /* #undef TDS50 */
627 
628 /* Define to use TDS 7.1 by default */
629 /* #undef TDS71 */
630 
631 /* Define to use TDS 7.2 by default */
632 /* #undef TDS72 */
633 
634 /* Define to use TDS 7.3 by default */
635 /* #undef TDS73 */
636 
637 /* Define to use TDS 7.4 by default */
638 /* #undef TDS74 */
639 
640 /* Define to 1 if your compiler supports __attribute__((destructor)). */
641 #define TDS_ATTRIBUTE_DESTRUCTOR 1
642 
643 /* define to constant to use for clock_gettime */
644 #define TDS_GETTIMEMILLI_CONST CLOCK_MONOTONIC
645 
646 /* Define if you have pthread with mutex support */
647 #define TDS_HAVE_PTHREAD_MUTEX 1
648 
649 /* Define if stdio support locking */
650 #define TDS_HAVE_STDIO_LOCKED 1
651 
652 /* define to prefix format string used for 64bit integers */
653 #define TDS_I64_PREFIX "l"
654 
655 /* Define if you don't care about thread safety */
656 /* #undef TDS_NO_THREADSAFE */
657 
658 /* Define to 1 if last argument of SQLColAttribute it's SQLLEN * */
659 /* #undef TDS_SQLCOLATTRIBUTE_SQLLEN */
660 
661 /* Define to 1 if SQLParamOptions accept SQLULEN as arguments */
662 /* #undef TDS_SQLPARAMOPTIONS_SQLLEN */
663 
664 /* Defined if --enable-sybase-compat used */
665 /* #undef TDS_SYBASE_COMPAT */
666 
667 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
668 #define TIME_WITH_SYS_TIME 1
669 
670 /* Define to 1 if your <sys/time.h> declares `struct tm'. */
671 /* #undef TM_IN_SYS_TIME */
672 
673 /* Enable extensions on AIX 3, Interix. */
674 #ifndef _ALL_SOURCE
675 # define _ALL_SOURCE 1
676 #endif
677 /* Enable GNU extensions on systems that have them. */
678 #ifndef _GNU_SOURCE
679 # define _GNU_SOURCE 1
680 #endif
681 /* Enable threading extensions on Solaris. */
682 #ifndef _POSIX_PTHREAD_SEMANTICS
683 # define _POSIX_PTHREAD_SEMANTICS 1
684 #endif
685 /* Enable extensions on HP NonStop. */
686 #ifndef _TANDEM_SOURCE
687 # define _TANDEM_SOURCE 1
688 #endif
689 /* Enable general extensions on Solaris. */
690 #ifndef __EXTENSIONS__
691 # define __EXTENSIONS__ 1
692 #endif
693 
694 
695 /* Version number of package */
696 #define VERSION "1.3.6"
697 
698 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
699  significant byte first (like Motorola and SPARC, unlike Intel). */
700 #if defined AC_APPLE_UNIVERSAL_BUILD
701 # if defined __BIG_ENDIAN__
702 # define WORDS_BIGENDIAN 1
703 # endif
704 #else
705 # ifndef WORDS_BIGENDIAN
706 /* # undef WORDS_BIGENDIAN */
707 # endif
708 #endif
709 
710 /* Enable large inode numbers on Mac OS X 10.5. */
711 #ifndef _DARWIN_USE_64_BIT_INODE
712 # define _DARWIN_USE_64_BIT_INODE 1
713 #endif
714 
715 /* Number of bits in a file offset, on hosts where this is settable. */
716 /* #undef _FILE_OFFSET_BITS */
717 
718 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
719 /* #undef _LARGEFILE_SOURCE */
720 
721 /* Define for large files, on AIX-style hosts. */
722 /* #undef _LARGE_FILES */
723 
724 /* Define to 1 if on MINIX. */
725 /* #undef _MINIX */
726 
727 /* Define to 2 if the system does not provide POSIX.1 features except with
728  this defined. */
729 /* #undef _POSIX_1_SOURCE */
730 
731 /* Define to 1 if you need to in order for `stat' and other things to work. */
732 /* #undef _POSIX_SOURCE */
733 
734 /* Define to empty if `const' does not conform to ANSI C. */
735 /* #undef const */
736 
737 /* Define to `__inline__' or `__inline' if that's what the C compiler
738  calls it, or to nothing if 'inline' is not supported under any name. */
739 #ifndef __cplusplus
740 /* #undef inline */
741 #endif
742 
743 /* Define to `unsigned int' if <sys/types.h> does not define. */
744 /* #undef size_t */
745 
746 /* type to use in place of socklen_t if not defined */
747 /* #undef socklen_t */
freetds-1.3.6/doc/reference/a00362_source.html000644 025423 025423 00000337724 14162303412 022403 0ustar00fredianofrediano000000 000000 FreeTDS API: include/cspublic.h Source File
FreeTDS API
cspublic.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _cspublic_h_
21 #define _cspublic_h_
22 
23 #include <cstypes.h>
24 
25 #undef TDS_STATIC_CAST
26 #ifdef __cplusplus
27 #define TDS_STATIC_CAST(type, a) static_cast<type>(a)
28 extern "C"
29 {
30 #if 0
31 }
32 #endif
33 #else
34 #define TDS_STATIC_CAST(type, a) ((type)(a))
35 #endif
36 
37 #define CS_PUBLIC
38 #define CS_STATIC static
39 
40 #define CS_SUCCEED 1
41 #define CS_FAIL 0
42 #define CS_MEM_ERROR -1
43 #define CS_PENDING -2
44 #define CS_QUIET -3
45 #define CS_BUSY -4
46 #define CS_INTERRUPT -5
47 #define CS_BLK_HAS_TEXT -6
48 #define CS_CONTINUE -7
49 #define CS_FATAL -8
50 #define CS_RET_HAFAILOVER -9
51 #define CS_UNSUPPORTED -10
52 
53 #define CS_CANCELED -202
54 #define CS_ROW_FAIL -203
55 #define CS_END_DATA -204
56 #define CS_END_RESULTS -205
57 #define CS_END_ITEM -206
58 #define CS_NOMSG -207
59 #define CS_TIMED_OUT -208
60 
61 #define CS_SIZEOF(x) sizeof(x)
62 
63 #define CS_LAYER(x) (((x) >> 24) & 0xFF)
64 #define CS_ORIGIN(x) (((x) >> 16) & 0xFF)
65 #define CS_SEVERITY(x) (((x) >> 8) & 0xFF)
66 #define CS_NUMBER(x) ((x) & 0xFF)
67 
68 /* forward declarations */
69 typedef CS_RETCODE(*CS_CSLIBMSG_FUNC) (CS_CONTEXT *, CS_CLIENTMSG *);
70 typedef CS_RETCODE(*CS_CLIENTMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_CLIENTMSG *);
71 typedef CS_RETCODE(*CS_SERVERMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_SERVERMSG *);
72 
73 
74 #define CS_IODATA TDS_STATIC_CAST(CS_INT, 1600)
75 #define CS_SRC_VALUE -2562
76 
77 
78 
79 /* status bits for CS_SERVERMSG */
80 #define CS_HASEED 0x01
81 
82 typedef struct _cs_blkdesc CS_BLKDESC;
83 
84 /* CS_CAP_REQUEST values */
85 #define CS_REQ_LANG 1
86 #define CS_REQ_RPC 2
87 #define CS_REQ_NOTIF 3
88 #define CS_REQ_MSTMT 4
89 #define CS_REQ_BCP 5
90 #define CS_REQ_CURSOR 6
91 #define CS_REQ_DYN 7
92 #define CS_REQ_MSG 8
93 #define CS_REQ_PARAM 9
94 #define CS_DATA_INT1 10
95 #define CS_DATA_INT2 11
96 #define CS_DATA_INT4 12
97 #define CS_DATA_BIT 13
98 #define CS_DATA_CHAR 14
99 #define CS_DATA_VCHAR 15
100 #define CS_DATA_BIN 16
101 #define CS_DATA_VBIN 17
102 #define CS_DATA_MNY8 18
103 #define CS_DATA_MNY4 19
104 #define CS_DATA_DATE8 20
105 #define CS_DATA_DATE4 21
106 #define CS_DATA_FLT4 22
107 #define CS_DATA_FLT8 23
108 #define CS_DATA_NUM 24
109 #define CS_DATA_TEXT 25
110 #define CS_DATA_IMAGE 26
111 #define CS_DATA_DEC 27
112 #define CS_DATA_LCHAR 28
113 #define CS_DATA_LBIN 29
114 #define CS_DATA_INTN 30
115 #define CS_DATA_DATETIMEN 31
116 #define CS_DATA_MONEYN 32
117 #define CS_CSR_PREV 33
118 #define CS_CSR_FIRST 34
119 #define CS_CSR_LAST 35
120 #define CS_CSR_ABS 36
121 #define CS_CSR_REL 37
122 #define CS_CSR_MULTI 38
123 #define CS_CON_OOB 39
124 #define CS_CON_INBAND 40
125 #define CS_CON_LOGICAL 41
126 #define CS_PROTO_TEXT 42
127 #define CS_PROTO_BULK 43
128 #define CS_REQ_URGNOTIF 44
129 #define CS_DATA_SENSITIVITY 45
130 #define CS_DATA_BOUNDARY 46
131 #define CS_PROTO_DYNAMIC 47
132 #define CS_PROTO_DYNPROC 48
133 #define CS_DATA_FLTN 49
134 #define CS_DATA_BITN 50
135 #define CS_OPTION_GET 51
136 #define CS_DATA_INT8 52
137 #define CS_DATA_VOID 53
138 
139 /* CS_CAP_RESPONSE values */
140 #define CS_RES_NOMSG 1
141 #define CS_RES_NOEED 2
142 #define CS_RES_NOPARAM 3
143 #define CS_DATA_NOINT1 4
144 #define CS_DATA_NOINT2 5
145 #define CS_DATA_NOINT4 6
146 #define CS_DATA_NOBIT 7
147 #define CS_DATA_NOCHAR 8
148 #define CS_DATA_NOVCHAR 9
149 #define CS_DATA_NOBIN 10
150 #define CS_DATA_NOVBIN 11
151 #define CS_DATA_NOMNY8 12
152 #define CS_DATA_NOMNY4 13
153 #define CS_DATA_NODATE8 14
154 #define CS_DATA_NODATE4 15
155 #define CS_DATA_NOFLT4 16
156 #define CS_DATA_NOFLT8 17
157 #define CS_DATA_NONUM 18
158 #define CS_DATA_NOTEXT 19
159 #define CS_DATA_NOIMAGE 20
160 #define CS_DATA_NODEC 21
161 #define CS_DATA_NOLCHAR 22
162 #define CS_DATA_NOLBIN 23
163 #define CS_DATA_NOINTN 24
164 #define CS_DATA_NODATETIMEN 25
165 #define CS_DATA_NOMONEYN 26
166 #define CS_CON_NOOOB 27
167 #define CS_CON_NOINBAND 28
168 #define CS_PROTO_NOTEXT 29
169 #define CS_PROTO_NOBULK 30
170 #define CS_DATA_NOSENSITIVITY 31
171 #define CS_DATA_NOBOUNDARY 32
172 #define CS_RES_NOTDSDEBUG 33
173 #define CS_RES_NOSTRIPBLANKS 34
174 #define CS_DATA_NOINT8 35
175 
176 /* Properties */
177 enum
178 {
179 /*
180  * These defines looks weird but programs can test support for defines,
181  * compiler can check enum and there are no define side effecs
182  */
183  CS_USERNAME = 9100,
184 #define CS_USERNAME CS_USERNAME
185  CS_PASSWORD = 9101,
186 #define CS_PASSWORD CS_PASSWORD
187  CS_APPNAME = 9102,
188 #define CS_APPNAME CS_APPNAME
189  CS_HOSTNAME = 9103,
190 #define CS_HOSTNAME CS_HOSTNAME
191  CS_LOGIN_STATUS = 9104,
192 #define CS_LOGIN_STATUS CS_LOGIN_STATUS
193  CS_TDS_VERSION = 9105,
194 #define CS_TDS_VERSION CS_TDS_VERSION
195  CS_CHARSETCNV = 9106,
196 #define CS_CHARSETCNV CS_CHARSETCNV
197  CS_PACKETSIZE = 9107,
198 #define CS_PACKETSIZE CS_PACKETSIZE
199  CS_USERDATA = 9108,
200 #define CS_USERDATA CS_USERDATA
201  CS_NETIO = 9110,
202 #define CS_NETIO CS_NETIO
203  CS_TEXTLIMIT = 9112,
204 #define CS_TEXTLIMIT CS_TEXTLIMIT
205  CS_HIDDEN_KEYS = 9113,
206 #define CS_HIDDEN_KEYS CS_HIDDEN_KEYS
207  CS_VERSION = 9114,
208 #define CS_VERSION CS_VERSION
209  CS_IFILE = 9115,
210 #define CS_IFILE CS_IFILE
211  CS_LOGIN_TIMEOUT = 9116,
212 #define CS_LOGIN_TIMEOUT CS_LOGIN_TIMEOUT
213  CS_TIMEOUT = 9117,
214 #define CS_TIMEOUT CS_TIMEOUT
215  CS_MAX_CONNECT = 9118,
216 #define CS_MAX_CONNECT CS_MAX_CONNECT
217  CS_EXPOSE_FMTS = 9120,
218 #define CS_EXPOSE_FMTS CS_EXPOSE_FMTS
219  CS_EXTRA_INF = 9121,
220 #define CS_EXTRA_INF CS_EXTRA_INF
221  CS_ANSI_BINDS = 9123,
222 #define CS_ANSI_BINDS CS_ANSI_BINDS
223  CS_BULK_LOGIN = 9124,
224 #define CS_BULK_LOGIN CS_BULK_LOGIN
225  CS_LOC_PROP = 9125,
226 #define CS_LOC_PROP CS_LOC_PROP
227  CS_PARENT_HANDLE = 9130,
228 #define CS_PARENT_HANDLE CS_PARENT_HANDLE
229  CS_EED_CMD = 9131,
230 #define CS_EED_CMD CS_EED_CMD
231  CS_DIAG_TIMEOUT = 9132,
232 #define CS_DIAG_TIMEOUT CS_DIAG_TIMEOUT
233  CS_DISABLE_POLL = 9133,
234 #define CS_DISABLE_POLL CS_DISABLE_POLL
235  CS_SEC_ENCRYPTION = 9135,
236 #define CS_SEC_ENCRYPTION CS_SEC_ENCRYPTION
237  CS_SEC_CHALLENGE = 9136,
238 #define CS_SEC_CHALLENGE CS_SEC_CHALLENGE
239  CS_SEC_NEGOTIATE = 9137,
240 #define CS_SEC_NEGOTIATE CS_SEC_NEGOTIATE
241  CS_CON_STATUS = 9143,
242 #define CS_CON_STATUS CS_CON_STATUS
243  CS_VER_STRING = 9144,
244 #define CS_VER_STRING CS_VER_STRING
245  CS_SERVERNAME = 9146,
246 #define CS_SERVERNAME CS_SERVERNAME
247  CS_SEC_APPDEFINED = 9149,
248 #define CS_SEC_APPDEFINED CS_SEC_APPDEFINED
249  CS_STICKY_BINDS = 9151,
250 #define CS_STICKY_BINDS CS_STICKY_BINDS
251  CS_SEC_NETWORKAUTH = 9175,
252 #define CS_SEC_NETWORKAUTH CS_SEC_NETWORKAUTH
253  CS_SEC_DELEGATION = 9176,
254 #define CS_SEC_DELEGATION CS_SEC_DELEGATION
255  CS_SEC_MUTUALAUTH = 9177,
256 #define CS_SEC_MUTUALAUTH CS_SEC_MUTUALAUTH
257  CS_SEC_SERVERPRINCIPAL = 9188,
258 #define CS_SEC_SERVERPRINCIPAL CS_SEC_SERVERPRINCIPAL
259  CS_SERVERADDR = 9206,
260 #define CS_SERVERADDR CS_SERVERADDR
261  CS_PORT = 9300,
262 #define CS_PORT CS_PORT
263  CS_CLIENTCHARSET = 9301,
264 #define CS_CLIENTCHARSET CS_CLIENTCHARSET
265  CS_DATABASE = 9302
266 #define CS_DATABASE CS_DATABASE
267 };
268 
269 /* Arbitrary precision math operators */
270 enum
271 {
272  CS_ADD = 1,
273  CS_SUB,
274  CS_MULT,
275  CS_DIV
276 };
277 
278 enum
279 {
280 #define CS_TDS_AUTO CS_TDS_AUTO
281  CS_TDS_AUTO = 0,
282  CS_TDS_40 = 7360,
283  CS_TDS_42,
284  CS_TDS_46,
285  CS_TDS_495,
286  CS_TDS_50,
287  CS_TDS_70,
288  CS_TDS_71,
289 #define CS_TDS_71 CS_TDS_71
290  CS_TDS_72,
291 #define CS_TDS_72 CS_TDS_72
292  CS_TDS_73,
293 #define CS_TDS_73 CS_TDS_73
294  CS_TDS_74,
295 #define CS_TDS_74 CS_TDS_74
296 };
297 
298 /* bit mask values used by CS_DATAFMT.status */
299 #define CS_HIDDEN (1 << 0)
300 #define CS_KEY (1 << 1)
301 #define CS_VERSION_KEY (1 << 2)
302 #define CS_NODATA (1 << 3)
303 #define CS_UPDATABLE (1 << 4)
304 #define CS_CANBENULL (1 << 5)
305 #define CS_DESCIN (1 << 6)
306 #define CS_DESCOUT (1 << 7)
307 #define CS_INPUTVALUE (1 << 8)
308 #define CS_UPDATECOL (1 << 9)
309 #define CS_RETURN (1 << 10)
310 #define CS_TIMESTAMP (1 << 13)
311 #define CS_NODEFAULT (1 << 14)
312 #define CS_IDENTITY (1 << 15)
313 
314 /*
315  * DBD::Sybase compares indicator to CS_NULLDATA so this is -1
316  * (the documentation states -1)
317  */
318 #define CS_GOODDATA 0
319 #define CS_NULLDATA (-1)
320 
321 /* CS_CON_STATUS read-only property bit mask values */
322 #define CS_CONSTAT_CONNECTED 0x01
323 #define CS_CONSTAT_DEAD 0x02
324 
325 /*
326  * Code added for CURSOR support
327  * types accepted by ct_cursor
328  */
329 #define CS_CURSOR_DECLARE 700
330 #define CS_CURSOR_OPEN 701
331 #define CS_CURSOR_ROWS 703
332 #define CS_CURSOR_UPDATE 704
333 #define CS_CURSOR_DELETE 705
334 #define CS_CURSOR_CLOSE 706
335 #define CS_CURSOR_DEALLOC 707
336 #define CS_CURSOR_OPTION 725
337 
338 #define CS_FOR_UPDATE TDS_STATIC_CAST(CS_INT, 0x1)
339 #define CS_READ_ONLY TDS_STATIC_CAST(CS_INT, 0x2)
340 #define CS_RESTORE_OPEN TDS_STATIC_CAST(CS_INT, 0x8)
341 #define CS_IMPLICIT_CURSOR TDS_STATIC_CAST(CS_INT, 0x40)
342 
343 
344 #define CS_CURSTAT_NONE TDS_STATIC_CAST(CS_INT, 0x0)
345 #define CS_CURSTAT_DECLARED TDS_STATIC_CAST(CS_INT, 0x1)
346 #define CS_CURSTAT_OPEN TDS_STATIC_CAST(CS_INT, 0x2)
347 #define CS_CURSTAT_CLOSED TDS_STATIC_CAST(CS_INT, 0x4)
348 #define CS_CURSTAT_RDONLY TDS_STATIC_CAST(CS_INT, 0x8)
349 #define CS_CURSTAT_UPDATABLE TDS_STATIC_CAST(CS_INT, 0x10)
350 #define CS_CURSTAT_ROWCOUNT TDS_STATIC_CAST(CS_INT, 0x20)
351 #define CS_CURSTAT_DEALLOC TDS_STATIC_CAST(CS_INT, 0x40)
352 
353 #define CS_CUR_STATUS TDS_STATIC_CAST(CS_INT, 9126)
354 #define CS_CUR_ID TDS_STATIC_CAST(CS_INT, 9127)
355 #define CS_CUR_NAME TDS_STATIC_CAST(CS_INT, 9128)
356 #define CS_CUR_ROWCOUNT TDS_STATIC_CAST(CS_INT, 9129)
357 
358 /* options accepted by ct_options() */
359 #define CS_OPT_DATEFIRST 5001
360 #define CS_OPT_TEXTSIZE 5002
361 #define CS_OPT_STATS_TIME 5003
362 #define CS_OPT_STATS_IO 5004
363 #define CS_OPT_ROWCOUNT 5005
364 #define CS_OPT_DATEFORMAT 5007
365 #define CS_OPT_ISOLATION 5008
366 #define CS_OPT_AUTHON 5009
367 #define CS_OPT_SHOWPLAN 5013
368 #define CS_OPT_NOEXEC 5014
369 #define CS_OPT_ARITHIGNORE 5015
370 #define CS_OPT_TRUNCIGNORE 5016
371 #define CS_OPT_ARITHABORT 5017
372 #define CS_OPT_PARSEONLY 5018
373 #define CS_OPT_GETDATA 5020
374 #define CS_OPT_NOCOUNT 5021
375 #define CS_OPT_FORCEPLAN 5023
376 #define CS_OPT_FORMATONLY 5024
377 #define CS_OPT_CHAINXACTS 5025
378 #define CS_OPT_CURCLOSEONXACT 5026
379 #define CS_OPT_FIPSFLAG 5027
380 #define CS_OPT_RESTREES 5028
381 #define CS_OPT_IDENTITYON 5029
382 #define CS_OPT_CURREAD 5030
383 #define CS_OPT_CURWRITE 5031
384 #define CS_OPT_IDENTITYOFF 5032
385 #define CS_OPT_AUTHOFF 5033
386 #define CS_OPT_ANSINULL 5034
387 #define CS_OPT_QUOTED_IDENT 5035
388 #define CS_OPT_ANSIPERM 5036
389 #define CS_OPT_STR_RTRUNC 5037
390 
391 /* options accepted by ct_command() */
392 enum ct_command_options
393 {
394  CS_MORE = 16,
395  CS_END = 32,
396  CS_RECOMPILE = 188,
397  CS_NO_RECOMPILE,
398  CS_BULK_INIT,
399  CS_BULK_CONT,
400  CS_BULK_DATA,
401  CS_COLUMN_DATA
402 };
403 
404 
405 /*
406  * bind formats, should be mapped to TDS types
407  * can be a combination of bit
408  */
409 enum
410 {
411  CS_FMT_UNUSED = 0,
412 #define CS_FMT_UNUSED CS_FMT_UNUSED
413  CS_FMT_NULLTERM = 1,
414 #define CS_FMT_NULLTERM CS_FMT_NULLTERM
415  CS_FMT_PADNULL = 2,
416 #define CS_FMT_PADBLANK CS_FMT_PADBLANK
417  CS_FMT_PADBLANK = 4,
418 #define CS_FMT_PADNULL CS_FMT_PADNULL
419  CS_FMT_JUSTIFY_RT = 8
420 #define CS_FMT_JUSTIFY_RT CS_FMT_JUSTIFY_RT
421 };
422 
423 /* callbacks */
424 #define CS_COMPLETION_CB 1
425 #define CS_SERVERMSG_CB 2
426 #define CS_CLIENTMSG_CB 3
427 #define CS_NOTIF_CB 4
428 #define CS_ENCRYPT_CB 5
429 #define CS_CHALLENGE_CB 6
430 #define CS_DS_LOOKUP_CB 7
431 #define CS_SECSESSION_CB 8
432 #define CS_SIGNAL_CB 100
433 #define CS_MESSAGE_CB 9119
434 
435 /* string types */
436 #define CS_NULLTERM -9
437 #define CS_WILDCARD -99
438 #define CS_NO_LIMIT -9999
439 #define CS_UNUSED -99999
440 
441 /* other */
442 #define CS_GET 33
443 #define CS_SET 34
444 #define CS_CLEAR 35
445 #define CS_INIT 36
446 #define CS_STATUS 37
447 #define CS_MSGLIMIT 38
448 #define CS_SUPPORTED 40
449 
450 #define CS_CMD_DONE 4046
451 #define CS_CMD_SUCCEED 4047
452 #define CS_CMD_FAIL 4048
453 
454 /* commands */
455 #define CS_LANG_CMD 148
456 #define CS_RPC_CMD 149
457 #define CS_SEND_DATA_CMD 151
458 #define CS_SEND_BULK_CMD 153
459 
460 #define CS_VERSION_100 112
461 #define CS_VERSION_110 1100
462 #define CS_VERSION_120 1100
463 #define CS_VERSION_125 12500
464 #define CS_VERSION_150 15000
465 
466 #define BLK_VERSION_100 CS_VERSION_100
467 #define BLK_VERSION_110 CS_VERSION_110
468 #define BLK_VERSION_120 CS_VERSION_120
469 #define BLK_VERSION_125 CS_VERSION_125
470 #define BLK_VERSION_150 CS_VERSION_150
471 
472 #define CS_FORCE_EXIT 300
473 #define CS_FORCE_CLOSE 301
474 
475 #define CS_SYNC_IO 8111
476 #define CS_ASYNC_IO 8112
477 #define CS_DEFER_IO 8113
478 
479 #define CS_CANCEL_CURRENT 6000
480 #define CS_CANCEL_ALL 6001
481 #define CS_CANCEL_ATTN 6002
482 
483 #define CS_ROW_COUNT 800
484 #define CS_CMD_NUMBER 801
485 #define CS_NUM_COMPUTES 802
486 #define CS_NUMDATA 803
487 #define CS_NUMORDERCOLS 805
488 #define CS_MSGTYPE 806
489 #define CS_BROWSE_INFO 807
490 #define CS_TRANS_STATE 808
491 
492 #define CS_TRAN_UNDEFINED 0
493 #define CS_TRAN_IN_PROGRESS 1
494 #define CS_TRAN_COMPLETED 2
495 #define CS_TRAN_FAIL 3
496 #define CS_TRAN_STMT_FAIL 4
497 
498 #define CS_COMP_OP 5350
499 #define CS_COMP_ID 5351
500 #define CS_COMP_COLID 5352
501 #define CS_COMP_BYLIST 5353
502 #define CS_BYLIST_LEN 5354
503 
504 #define CS_NO_COUNT -1
505 
506 #define CS_OP_SUM 5370
507 #define CS_OP_AVG 5371
508 #define CS_OP_COUNT 5372
509 #define CS_OP_MIN 5373
510 #define CS_OP_MAX 5374
511 
512 #define CS_CAP_REQUEST 1
513 #define CS_CAP_RESPONSE 2
514 
515 #define CS_PREPARE 717
516 #define CS_EXECUTE 718
517 #define CS_DESCRIBE_INPUT 720
518 #define CS_DESCRIBE_OUTPUT 721
519 
520 #define CS_DEALLOC 711
521 
522 #define CS_LC_ALL 7
523 #define CS_SYB_LANG 8
524 #define CS_SYB_CHARSET 9
525 #define CS_SYB_SORTORDER 10
526 #define CS_SYB_COLLATE CS_SYB_SORTORDER
527 #define CS_SYB_LANG_CHARSET 11
528 
529 #define CS_BLK_IN 1
530 #define CS_BLK_OUT 2
531 
532 #define CS_BLK_BATCH 1
533 #define CS_BLK_ALL 2
534 #define CS_BLK_CANCEL 3
535 
536 /* to do support these */
537 
538 #define CS_BLK_ARRAY_MAXLEN 0x1000
539 #define CS_DEF_PREC 18
540 
541 /* Error Severities */
542 #define CS_SV_INFORM TDS_STATIC_CAST(CS_INT, 0)
543 #define CS_SV_API_FAIL TDS_STATIC_CAST(CS_INT, 1)
544 #define CS_SV_RETRY_FAIL TDS_STATIC_CAST(CS_INT, 2)
545 #define CS_SV_RESOURCE_FAIL TDS_STATIC_CAST(CS_INT, 3)
546 #define CS_SV_CONFIG_FAIL TDS_STATIC_CAST(CS_INT, 4)
547 #define CS_SV_COMM_FAIL TDS_STATIC_CAST(CS_INT, 5)
548 #define CS_SV_INTERNAL_FAIL TDS_STATIC_CAST(CS_INT, 6)
549 #define CS_SV_FATAL TDS_STATIC_CAST(CS_INT, 7)
550 
551 /* result_types */
552 #define CS_COMPUTE_RESULT 4045
553 #define CS_CURSOR_RESULT 4041
554 #define CS_PARAM_RESULT 4042
555 #define CS_ROW_RESULT 4040
556 #define CS_STATUS_RESULT 4043
557 #define CS_COMPUTEFMT_RESULT 4050
558 #define CS_ROWFMT_RESULT 4049
559 #define CS_MSG_RESULT 4044
560 #define CS_DESCRIBE_RESULT 4051
561 
562 /* bind types */
563 #define CS_ILLEGAL_TYPE TDS_STATIC_CAST(CS_INT, -1)
564 #define CS_CHAR_TYPE TDS_STATIC_CAST(CS_INT, 0)
565 #define CS_BINARY_TYPE TDS_STATIC_CAST(CS_INT, 1)
566 #define CS_LONGCHAR_TYPE TDS_STATIC_CAST(CS_INT, 2)
567 #define CS_LONGBINARY_TYPE TDS_STATIC_CAST(CS_INT, 3)
568 #define CS_TEXT_TYPE TDS_STATIC_CAST(CS_INT, 4)
569 #define CS_IMAGE_TYPE TDS_STATIC_CAST(CS_INT, 5)
570 #define CS_TINYINT_TYPE TDS_STATIC_CAST(CS_INT, 6)
571 #define CS_SMALLINT_TYPE TDS_STATIC_CAST(CS_INT, 7)
572 #define CS_INT_TYPE TDS_STATIC_CAST(CS_INT, 8)
573 #define CS_REAL_TYPE TDS_STATIC_CAST(CS_INT, 9)
574 #define CS_FLOAT_TYPE TDS_STATIC_CAST(CS_INT, 10)
575 #define CS_BIT_TYPE TDS_STATIC_CAST(CS_INT, 11)
576 #define CS_DATETIME_TYPE TDS_STATIC_CAST(CS_INT, 12)
577 #define CS_DATETIME4_TYPE TDS_STATIC_CAST(CS_INT, 13)
578 #define CS_MONEY_TYPE TDS_STATIC_CAST(CS_INT, 14)
579 #define CS_MONEY4_TYPE TDS_STATIC_CAST(CS_INT, 15)
580 #define CS_NUMERIC_TYPE TDS_STATIC_CAST(CS_INT, 16)
581 #define CS_DECIMAL_TYPE TDS_STATIC_CAST(CS_INT, 17)
582 #define CS_VARCHAR_TYPE TDS_STATIC_CAST(CS_INT, 18)
583 #define CS_VARBINARY_TYPE TDS_STATIC_CAST(CS_INT, 19)
584 #define CS_LONG_TYPE TDS_STATIC_CAST(CS_INT, 20)
585 #define CS_SENSITIVITY_TYPE TDS_STATIC_CAST(CS_INT, 21)
586 #define CS_BOUNDARY_TYPE TDS_STATIC_CAST(CS_INT, 22)
587 #define CS_VOID_TYPE TDS_STATIC_CAST(CS_INT, 23)
588 #define CS_USHORT_TYPE TDS_STATIC_CAST(CS_INT, 24)
589 #define CS_UNICHAR_TYPE TDS_STATIC_CAST(CS_INT, 25)
590 #define CS_BLOB_TYPE TDS_STATIC_CAST(CS_INT, 26)
591 #define CS_DATE_TYPE TDS_STATIC_CAST(CS_INT, 27)
592 #define CS_TIME_TYPE TDS_STATIC_CAST(CS_INT, 28)
593 #define CS_UNITEXT_TYPE TDS_STATIC_CAST(CS_INT, 29)
594 #define CS_BIGINT_TYPE TDS_STATIC_CAST(CS_INT, 30)
595 #define CS_USMALLINT_TYPE TDS_STATIC_CAST(CS_INT, 31)
596 #define CS_UINT_TYPE TDS_STATIC_CAST(CS_INT, 32)
597 #define CS_UBIGINT_TYPE TDS_STATIC_CAST(CS_INT, 33)
598 #define CS_XML_TYPE TDS_STATIC_CAST(CS_INT, 34)
599 #define CS_BIGDATETIME_TYPE TDS_STATIC_CAST(CS_INT, 35)
600 #define CS_BIGTIME_TYPE TDS_STATIC_CAST(CS_INT, 36)
601 #define CS_UNIQUE_TYPE TDS_STATIC_CAST(CS_INT, 40)
602 
603 #define CS_MIN_SYBTYPE CS_CHAR_TYPE
604 #define CS_MAX_SYBTYPE CS_UNIQUE_TYPE
605 
606 #define CS_USER_TYPE TDS_STATIC_CAST(CS_INT, 100)
607 /* cs_dt_info type values */
608 enum
609 {
610  CS_MONTH = 7340,
611 #define CS_MONTH CS_MONTH
612  CS_SHORTMONTH,
613 #define CS_SHORTMONTH CS_SHORTMONTH
614  CS_DAYNAME,
615 #define CS_DAYNAME CS_DAYNAME
616  CS_DATEORDER,
617 #define CS_DATEORDER CS_DATEORDER
618  CS_12HOUR,
619 #define CS_12HOUR CS_12HOUR
620  CS_DT_CONVFMT
621 #define CS_DT_CONVFMT CS_DT_CONVFMT
622 };
623 
624 /* DT_CONVFMT types */
625 enum
626 {
627  CS_DATES_SHORT = 0,
628 #define CS_DATES_SHORT CS_DATES_SHORT
629  CS_DATES_MDY1,
630 #define CS_DATES_MDY1 CS_DATES_MDY1
631  CS_DATES_YMD1,
632 #define CS_DATES_YMD1 CS_DATES_YMD1
633  CS_DATES_DMY1,
634 #define CS_DATES_DMY1 CS_DATES_DMY1
635  CS_DATES_DMY2,
636 #define CS_DATES_DMY2 CS_DATES_DMY2
637  CS_DATES_DMY3,
638 #define CS_DATES_DMY3 CS_DATES_DMY3
639  CS_DATES_DMY4,
640 #define CS_DATES_DMY4 CS_DATES_DMY4
641  CS_DATES_MDY2,
642 #define CS_DATES_MDY2 CS_DATES_MDY2
643  CS_DATES_HMS,
644 #define CS_DATES_HMS CS_DATES_HMS
645  CS_DATES_LONG,
646 #define CS_DATES_LONG CS_DATES_LONG
647  CS_DATES_MDY3,
648 #define CS_DATES_MDY3 CS_DATES_MDY3
649  CS_DATES_YMD2,
650 #define CS_DATES_YMD2 CS_DATES_YMD2
651  CS_DATES_YMD3,
652 #define CS_DATES_YMD3 CS_DATES_YMD3
653  CS_DATES_YDM1,
654 #define CS_DATES_YDM1 CS_DATES_YDM1
655  CS_DATES_MYD1,
656 #define CS_DATES_MYD1 CS_DATES_MYD1
657  CS_DATES_DYM1,
658 #define CS_DATES_DYM1 CS_DATES_DYM1
659  CS_DATES_MDY1_YYYY = 101,
660 #define CS_DATES_MDY1_YYYY CS_DATES_MDY1_YYYY
661  CS_DATES_YMD1_YYYY,
662 #define CS_DATES_YMD1_YYYY CS_DATES_YMD1_YYYY
663  CS_DATES_DMY1_YYYY,
664 #define CS_DATES_DMY1_YYYY CS_DATES_DMY1_YYYY
665  CS_DATES_DMY2_YYYY,
666 #define CS_DATES_DMY2_YYYY CS_DATES_DMY2_YYYY
667  CS_DATES_DMY3_YYYY,
668 #define CS_DATES_DMY3_YYYY CS_DATES_DMY3_YYYY
669  CS_DATES_DMY4_YYYY,
670 #define CS_DATES_DMY4_YYYY CS_DATES_DMY4_YYYY
671  CS_DATES_MDY2_YYYY,
672 #define CS_DATES_MDY2_YYYY CS_DATES_MDY2_YYYY
673  CS_DATES_MDY3_YYYY = 110,
674 #define CS_DATES_MDY3_YYYY CS_DATES_MDY3_YYYY
675  CS_DATES_YMD2_YYYY,
676 #define CS_DATES_YMD2_YYYY CS_DATES_YMD2_YYYY
677  CS_DATES_YMD3_YYYY
678 #define CS_DATES_YMD3_YYYY CS_DATES_YMD3_YYYY
679 };
680 
681 typedef CS_RETCODE(*CS_CONV_FUNC) (CS_CONTEXT * context, CS_DATAFMT * srcfmt, CS_VOID * src, CS_DATAFMT * detsfmt, CS_VOID * dest,
682  CS_INT * destlen);
683 
684 typedef struct _cs_objname
685 {
686  CS_BOOL thinkexists;
687  CS_INT object_type;
688  CS_CHAR last_name[CS_MAX_NAME];
689  CS_INT lnlen;
690  CS_CHAR first_name[CS_MAX_NAME];
691  CS_INT fnlen;
692  CS_VOID *scope;
693  CS_INT scopelen;
694  CS_VOID *thread;
695  CS_INT threadlen;
696 } CS_OBJNAME;
697 
698 typedef struct _cs_objdata
699 {
700  CS_BOOL actuallyexists;
701  CS_CONNECTION *connection;
702  CS_COMMAND *command;
703  CS_VOID *buffer;
704  CS_INT buflen;
705 } CS_OBJDATA;
706 
707 /* Eventually, these should be in terms of TDS values */
708 enum
709 {
710  CS_OPT_MONDAY = 1,
711  CS_OPT_TUESDAY,
712  CS_OPT_WEDNESDAY,
713  CS_OPT_THURSDAY,
714  CS_OPT_FRIDAY,
715  CS_OPT_SATURDAY,
716  CS_OPT_SUNDAY
717 };
718 enum
719 {
720  CS_OPT_FMTMDY = 1,
721  CS_OPT_FMTDMY,
722  CS_OPT_FMTYMD,
723  CS_OPT_FMTYDM,
724  CS_OPT_FMTMYD,
725  CS_OPT_FMTDYM
726 };
727 enum
728 {
729  CS_OPT_LEVEL0 = 0,
730  CS_OPT_LEVEL1,
731  CS_OPT_LEVEL2,
732  CS_OPT_LEVEL3
733 };
734 
735 #define CS_FALSE 0
736 #define CS_TRUE 1
737 
738 #define SRV_PROC CS_VOID
739 
740 /* constants required for ct_diag (not jet implemented) */
741 #define CS_CLIENTMSG_TYPE 4700
742 #define CS_SERVERMSG_TYPE 4701
743 #define CS_ALLMSG_TYPE 4702
744 
745 CS_RETCODE cs_convert(CS_CONTEXT * ctx, CS_DATAFMT * srcfmt, CS_VOID * srcdata, CS_DATAFMT * destfmt, CS_VOID * destdata,
746  CS_INT * resultlen);
747 CS_RETCODE cs_ctx_alloc(CS_INT version, CS_CONTEXT ** ctx);
748 CS_RETCODE cs_ctx_global(CS_INT version, CS_CONTEXT ** ctx);
749 CS_RETCODE cs_ctx_drop(CS_CONTEXT * ctx);
750 CS_RETCODE cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
751 CS_RETCODE cs_strbuild(CS_CONTEXT * ctx, CS_CHAR * buffer, CS_INT buflen, CS_INT * resultlen, CS_CHAR * text, CS_INT textlen,
752  CS_CHAR * formats, CS_INT formatlen, ...);
753 #undef cs_dt_crack
754 CS_RETCODE cs_dt_crack(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec);
755 CS_RETCODE cs_dt_crack_v2(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec);
756 #define cs_dt_crack cs_dt_crack_v2
757 CS_RETCODE cs_loc_alloc(CS_CONTEXT * ctx, CS_LOCALE ** locptr);
758 CS_RETCODE cs_loc_drop(CS_CONTEXT * ctx, CS_LOCALE * locale);
759 CS_RETCODE cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_VOID * buffer, CS_INT buflen,
760  CS_INT * outlen);
761 CS_RETCODE cs_dt_info(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_INT item, CS_VOID * buffer,
762  CS_INT buflen, CS_INT * outlen);
763 
764 CS_RETCODE cs_calc(CS_CONTEXT * ctx, CS_INT op, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_VOID * dest);
765 CS_RETCODE cs_cmp(CS_CONTEXT * ctx, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_INT * result);
766 CS_RETCODE cs_conv_mult(CS_CONTEXT * ctx, CS_LOCALE * srcloc, CS_LOCALE * destloc, CS_INT * conv_multiplier);
767 CS_RETCODE cs_diag(CS_CONTEXT * ctx, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer);
768 CS_RETCODE cs_manage_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_CHAR * srcname, CS_INT srcnamelen, CS_INT desttype,
769  CS_CHAR * destname, CS_INT destnamelen, CS_INT * conv_multiplier, CS_CONV_FUNC * func);
770 CS_RETCODE cs_objects(CS_CONTEXT * ctx, CS_INT action, CS_OBJNAME * objname, CS_OBJDATA * objdata);
771 CS_RETCODE cs_set_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_INT desttype, CS_CONV_FUNC * func);
772 CS_RETCODE cs_setnull(CS_CONTEXT * ctx, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT buflen);
773 CS_RETCODE cs_strcmp(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_INT type, CS_CHAR * str1, CS_INT len1, CS_CHAR * str2, CS_INT len2,
774  CS_INT * result);
775 CS_RETCODE cs_time(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen, CS_DATEREC * daterec);
776 CS_RETCODE cs_will_convert(CS_CONTEXT * ctx, CS_INT srctype, CS_INT desttype, CS_BOOL * result);
777 
778 const char * cs_prretcode(int retcode);
779 
780 #ifdef __cplusplus
781 #if 0
782 {
783 #endif
784 }
785 #endif
786 
787 #endif
Definition: cspublic.h:685
Definition: ctlib.h:239
Definition: ctlib.h:212
Definition: ctlib.h:75
Definition: cstypes.h:191
Definition: ctlib.h:117
Definition: cstypes.h:159
Definition: cstypes.h:114
Definition: cspublic.h:699
Definition: ctlib.h:248
Definition: cstypes.h:177
freetds-1.3.6/doc/reference/a00365_source.html000644 025423 025423 00000104275 14162303412 022377 0ustar00fredianofrediano000000 000000 FreeTDS API: include/cstypes.h Source File
FreeTDS API
cstypes.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _cstypes_h_
21 #define _cstypes_h_
22 
23 #include "tds_sysdep_public.h"
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #if 0
29 }
30 #endif
31 #endif
32 
33 typedef int32_t CS_INT;
34 typedef uint32_t CS_UINT;
35 typedef int64_t CS_BIGINT;
36 typedef uint64_t CS_UBIGINT;
37 typedef int16_t CS_SMALLINT;
38 typedef uint16_t CS_USMALLINT;
39 typedef unsigned char CS_TINYINT;
40 typedef char CS_CHAR;
41 typedef unsigned char CS_BYTE;
42 typedef tds_sysdep_real32_type CS_REAL;
43 typedef tds_sysdep_real64_type CS_FLOAT;
44 typedef int32_t CS_BOOL;
45 typedef void CS_VOID;
46 typedef unsigned char CS_IMAGE;
47 typedef unsigned char CS_TEXT;
48 typedef unsigned char CS_LONGBINARY;
49 typedef unsigned char CS_LONGCHAR;
50 typedef long CS_LONG;
51 typedef unsigned char CS_BINARY;
52 typedef uint16_t CS_USHORT;
53 typedef unsigned char CS_BIT;
54 
55 typedef CS_INT CS_RETCODE;
56 
57 #define CS_MAX_NAME 132
58 #define CS_MAX_SCALE 77
59 #define CS_MAX_PREC 77 /* used by php */
60 #define CS_MAX_NUMLEN 33 /* used by roguewave */
61 #define CS_MAX_MSG 1024
62 #define CS_SQLSTATE_SIZE 8
63 #define CS_OBJ_NAME 400
64 #define CS_TP_SIZE 16 /* text pointer */
65 #define CS_TS_SIZE 8 /* length of timestamp */
66 
67 
68 typedef struct _cs_numeric
69 {
70  unsigned char precision;
71  unsigned char scale;
72  unsigned char array[CS_MAX_NUMLEN];
73 } CS_NUMERIC;
74 
75 typedef CS_NUMERIC CS_DECIMAL;
76 
77 typedef struct _cs_varbinary
78 {
79  CS_SMALLINT len;
80  CS_CHAR array[256];
81 } CS_VARBINARY;
82 
83 typedef struct _cs_varchar
84 {
85  CS_SMALLINT len; /* length of the string */
86  CS_CHAR str[256]; /* string, no NULL terminator */
87 } CS_VARCHAR;
88 
89 typedef struct _cs_config CS_CONFIG;
90 typedef struct _cs_context CS_CONTEXT;
91 typedef struct _cs_connection CS_CONNECTION;
92 typedef struct _cs_locale CS_LOCALE;
93 typedef struct _cs_command CS_COMMAND;
94 typedef struct _cs_blk_row CS_BLK_ROW;
95 
96 typedef struct _cs_iodesc
97 {
98  CS_INT iotype;
99  CS_INT datatype;
100  CS_LOCALE *locale;
101  CS_INT usertype;
102  CS_INT total_txtlen;
103  CS_INT offset;
104  CS_BOOL log_on_update;
105  CS_CHAR name[CS_OBJ_NAME];
106  CS_INT namelen;
107  CS_BYTE timestamp[CS_TS_SIZE];
108  CS_INT timestamplen;
109  CS_BYTE textptr[CS_TP_SIZE];
110  CS_INT textptrlen;
111 } CS_IODESC;
112 
113 typedef struct _cs_datafmt
114 {
115  CS_CHAR name[CS_MAX_NAME];
116  CS_INT namelen;
117  CS_INT datatype;
118  CS_INT format;
119  CS_INT maxlength;
120  CS_INT scale;
121  CS_INT precision;
122  CS_INT status;
123  CS_INT count;
124  CS_INT usertype;
125  CS_LOCALE *locale;
126 } CS_DATAFMT;
127 
128 typedef struct _cs_money
129 {
130  CS_INT mnyhigh;
131  CS_UINT mnylow;
132 } CS_MONEY;
133 
134 typedef struct _cs_money4
135 {
136  CS_INT mny4;
137 } CS_MONEY4;
138 
139 typedef CS_INT CS_DATE;
140 
141 typedef CS_INT CS_TIME;
142 
143 typedef CS_UBIGINT CS_BIGDATETIME;
144 typedef CS_UBIGINT CS_BIGTIME;
145 
146 typedef struct _cs_datetime
147 {
148  CS_INT dtdays;
149  CS_INT dttime;
150 } CS_DATETIME;
151 
152 typedef struct _cs_datetime4
153 {
154  CS_USHORT days;
155  CS_USHORT minutes;
156 } CS_DATETIME4;
157 
158 typedef struct _cs_daterec
159 {
160  CS_INT dateyear;
161  CS_INT datemonth;
162  CS_INT datedmonth;
163  CS_INT datedyear;
164  CS_INT datedweek;
165  CS_INT datehour;
166  CS_INT dateminute;
167  CS_INT datesecond;
168  CS_INT datemsecond;
169  CS_INT datetzone;
170  CS_INT datesecfrac;
171  CS_INT datesecprec;
172 } CS_DATEREC;
173 
174 typedef CS_INT CS_MSGNUM;
175 
176 typedef struct _cs_clientmsg
177 {
178  CS_INT severity;
179  CS_MSGNUM msgnumber;
180  CS_CHAR msgstring[CS_MAX_MSG];
181  CS_INT msgstringlen;
182  CS_INT osnumber;
183  CS_CHAR osstring[CS_MAX_MSG];
184  CS_INT osstringlen;
185  CS_INT status;
186  CS_BYTE sqlstate[CS_SQLSTATE_SIZE];
187  CS_INT sqlstatelen;
188 } CS_CLIENTMSG;
189 
190 typedef struct _cs_servermsg
191 {
192  CS_MSGNUM msgnumber;
193  CS_INT state;
194  CS_INT severity;
195  CS_CHAR text[CS_MAX_MSG];
196  CS_INT textlen;
197  CS_CHAR svrname[CS_MAX_NAME];
198  CS_INT svrnlen;
199  CS_CHAR proc[CS_MAX_NAME];
200  CS_INT proclen;
201  CS_INT line;
202  CS_INT status;
203  CS_BYTE sqlstate[CS_SQLSTATE_SIZE];
204  CS_INT sqlstatelen;
205 } CS_SERVERMSG;
206 
207 #ifdef __cplusplus
208 #if 0
209 {
210 #endif
211 }
212 #endif
213 
214 #endif
Definition: ctlib.h:212
Definition: ctlib.h:45
Definition: ctlib.h:75
Definition: cstypes.h:129
Definition: cstypes.h:191
Definition: cstypes.h:69
Definition: ctlib.h:117
Definition: cstypes.h:147
Definition: cstypes.h:84
Definition: cstypes.h:159
Definition: cstypes.h:135
Definition: cstypes.h:114
Definition: cstypes.h:78
Definition: cstypes.h:153
Definition: ctlib.h:248
Definition: cstypes.h:97
Definition: cstypes.h:177
freetds-1.3.6/doc/reference/a00368_source.html000644 025423 025423 00000136600 14162303412 022377 0ustar00fredianofrediano000000 000000 FreeTDS API: include/ctlib.h Source File
FreeTDS API
ctlib.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _ctlib_h_
21 #define _ctlib_h_
22 
23 #include <freetds/tds.h>
24 #include <freetds/convert.h>
25 #include <freetds/utils/string.h>
26 
27 /*
28  * Internal (not part of the exposed API) prototypes and such.
29  */
30 
31 #include <freetds/pushvis.h>
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #if 0
37 }
38 #endif
39 #endif
40 
41 /*
42  * internal types
43  */
44 struct _cs_config
45 {
46  short cs_expose_formats;
47 };
48 
49 /* Code changed for error handling */
50 /* Code changes starts here - CT_DIAG - 01 */
51 
52 /* This structure is used in CT_DIAG */
53 
55 {
56  CS_CLIENTMSG *clientmsg;
57  struct cs_diag_msg_client *next;
58 };
59 
61 {
62  CS_SERVERMSG *servermsg;
63  struct cs_diag_msg_svr *next;
64 };
65 
66 /* Code changes ends here - CT_DIAG - 01 */
67 
69 {
70  CS_CLIENTMSG *msg;
71  struct cs_diag_msg *next;
72 };
73 
75 {
76  CS_INT date_convert_fmt;
77  CS_INT cs_errhandletype;
78  CS_INT cs_diag_msglimit;
79 
80  /* added for storing the maximum messages limit CT_DIAG */
81  /* code changes starts here - CT_DIAG - 02 */
82 
83  CS_INT cs_diag_msglimit_client;
84  CS_INT cs_diag_msglimit_server;
85  CS_INT cs_diag_msglimit_total;
86  struct cs_diag_msg_client *clientstore;
87  struct cs_diag_msg_svr *svrstore;
88 
89  /* code changes ends here - CT_DIAG - 02 */
90 
91  struct cs_diag_msg *msgstore;
92  CS_CSLIBMSG_FUNC _cslibmsg_cb;
93  CS_CLIENTMSG_FUNC _clientmsg_cb;
94  CS_SERVERMSG_FUNC _servermsg_cb;
95  /* code changes start here - CS_CONFIG - 01*/
96  void *userdata;
97  int userdata_len;
98  /* code changes end here - CS_CONFIG - 01*/
99  TDSCONTEXT *tds_ctx;
100  CS_CONFIG config;
103 };
104 
105 /*
106  * internal typedefs
107  */
108 typedef struct _ct_colinfo
109 {
110  TDS_SMALLINT *indicator;
111 }
112 CT_COLINFO;
113 
114 typedef struct _cs_dynamic CS_DYNAMIC;
115 
117 {
118  CS_CONTEXT *ctx;
121  CS_CLIENTMSG_FUNC _clientmsg_cb;
122  CS_SERVERMSG_FUNC _servermsg_cb;
123  void *userdata;
124  int userdata_len;
125  CS_LOCALE *locale;
126  CS_COMMAND *cmds;
127  CS_DYNAMIC *dynlist;
128  char *server_addr;
129  bool network_auth;
130 };
131 
132 /*
133  * Formerly CSREMOTE_PROC_PARAM, this structure can be used in other
134  * places, too.
135  */
136 
137 typedef struct _cs_param
138 {
139  struct _cs_param *next;
140  char *name;
141  int status;
142  int datatype;
143  CS_INT maxlen;
144  CS_INT scale;
145  CS_INT precision;
146  CS_INT *datalen;
147  CS_SMALLINT *ind;
148  CS_BYTE *value;
149  int param_by_value;
150  CS_INT datalen_value;
151  CS_SMALLINT indicator_value;
152 } CS_PARAM;
153 
154 /*
155  * Code added for RPC functionality - SUHA
156  * RPC Code changes starts here
157  */
158 
160 
161 typedef struct _csremote_proc
162 {
163  char *name;
164  CS_SMALLINT options;
165  CSREMOTE_PROC_PARAM *param_list;
166 } CSREMOTE_PROC;
167 
168 /*
169  * Structure CS_COMMAND changed for RPC functionality -SUHA
170  * Added CSREMOTE_PROC *rpc to CS_COMMAND structure
171  */
172 
173 typedef CS_PARAM CS_DYNAMIC_PARAM;
174 
176 {
177  struct _cs_dynamic *next;
178  char *id;
179  char *stmt;
180  CS_DYNAMIC_PARAM *param_list;
181  TDSDYNAMIC *tdsdyn;
182 };
183 
184 /* specific FreeTDS commands */
185 #define CS_DYNAMIC_CMD 160
186 #define CS_CUR_CMD 161
187 
188 /* values for cs_command.results_state */
189 
190 #define _CS_RES_NONE -1
191 #define _CS_RES_INIT 0
192 #define _CS_RES_RESULTSET_EMPTY 1
193 #define _CS_RES_RESULTSET_ROWS 2
194 #define _CS_RES_STATUS 3
195 #define _CS_RES_CMD_DONE 4
196 #define _CS_RES_CMD_SUCCEED 5
197 #define _CS_RES_END_RESULTS 6
198 #define _CS_RES_DESCRIBE_RESULT 7
199 
200 /* values for cs_command.command_state */
201 
202 #define _CS_COMMAND_IDLE 0
203 #define _CS_COMMAND_BUILDING 1
204 #define _CS_COMMAND_READY 2
205 #define _CS_COMMAND_SENT 3
206 
207 /* values for cs_command.cancel_state */
208 #define _CS_CANCEL_NOCANCEL 0
209 #define _CS_CANCEL_PENDING 1
210 
212 {
213  struct _cs_command *next;
214  CS_INT command_state;
215  CS_INT results_state;
216  CS_INT cancel_state;
217  CS_INT cursor_state;
218  CS_CONNECTION *con;
219  CS_INT command_type;
220  CS_CHAR *query;
221  short dynamic_cmd;
222  CS_DYNAMIC *dyn;
223  int row_prefetched;
224  int curr_result_type;
225  int bind_count;
226  int get_data_item;
227  int get_data_bytes_returned;
228  CS_IODESC *iodesc;
229  CS_INT send_data_started;
230  CSREMOTE_PROC *rpc;
231  CS_PARAM *input_params;
232  CS_INT client_cursor_id;
233  TDSCURSOR *cursor;
234  void *userdata;
235  int userdata_len;
236 };
237 
239 {
240  TDSBCPINFO bcpinfo;
241 };
242 
243 
244 #define _CS_ERRHAND_INLINE 1
245 #define _CS_ERRHAND_CB 2
246 
248 {
249  char *language;
250  char *charset;
251  char *time;
252  char *collate;
253 };
254 
255 /* internal defines for cursor processing */
256 
257 #define _CS_CURS_TYPE_UNACTIONED 0
258 #define _CS_CURS_TYPE_REQUESTED 1
259 #define _CS_CURS_TYPE_SENT 2
260 
261 /*
262  * internal prototypes
263  */
264 TDSRET _ct_handle_server_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
265 int _ct_handle_client_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr);
266 TDS_SERVER_TYPE _ct_get_server_type(TDSSOCKET *tds, int datatype);
267 int _ct_bind_data(CS_CONTEXT *ctx, TDSRESULTINFO * resinfo, TDSRESULTINFO *bindinfo, CS_INT offset);
268 int _ct_get_client_type(const TDSCOLUMN *col, bool describe);
269 void _ctclient_msg(CS_CONNECTION * con, const char *funcname, int layer, int origin, int severity, int number,
270  const char *fmt, ...);
271 CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type);
272 void _cs_locale_free(CS_LOCALE *locale);
273 CS_LOCALE *_cs_locale_copy(CS_LOCALE *orig);
274 int _cs_locale_copy_inplace(CS_LOCALE *new_locale, CS_LOCALE *orig);
275 
276 int _cs_convert_not_client(CS_CONTEXT *ctx, const TDSCOLUMN *curcol, CONV_RESULT *convert_buffer, unsigned char **p_src);
277 
278 #ifdef __cplusplus
279 #if 0
280 {
281 #endif
282 }
283 #endif
284 
285 #include <freetds/popvis.h>
286 
287 #endif
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
Definition: ctlib.h:239
Definition: ctlib.h:212
Main include file for libtds.
Definition: ctlib.h:109
Holds informations about a cursor.
Definition: tds.h:937
Definition: ctlib.h:176
int login_timeout
not used unless positive
Definition: ctlib.h:101
Definition: ctlib.h:45
Definition: convert.h:34
Definition: ctlib.h:138
Definition: ctlib.h:75
int query_timeout
not used unless positive
Definition: ctlib.h:102
Definition: ctlib.h:61
Definition: cstypes.h:191
Definition: tds.h:876
Definition: ctlib.h:117
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Hold information for any results.
Definition: tds.h:769
Definition: ctlib.h:55
Definition: ctlib.h:162
Definition: tds.h:1661
Information for a server connection.
Definition: tds.h:1163
Definition: ctlib.h:69
Definition: ctlib.h:248
Definition: cstypes.h:97
Definition: tds.h:1029
Definition: tds.h:517
Definition: cstypes.h:177
freetds-1.3.6/doc/reference/a00371_source.html000644 025423 025423 00000066670 14162303412 022402 0ustar00fredianofrediano000000 000000 FreeTDS API: include/ctpublic.h Source File
FreeTDS API
ctpublic.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _ctpublic_h_
21 #define _ctpublic_h_
22 
23 #include <cspublic.h>
24 
25 #undef TDS_STATIC_CAST
26 #ifdef __cplusplus
27 #define TDS_STATIC_CAST(type, a) static_cast<type>(a)
28 extern "C"
29 {
30 #if 0
31 }
32 #endif
33 #else
34 #define TDS_STATIC_CAST(type, a) ((type)(a))
35 #endif
36 
37 /*
38 ** define for each CT-Lib API
39 */
40 #define CT_BIND TDS_STATIC_CAST(CS_INT, 0)
41 #define CT_BR_COLUMN TDS_STATIC_CAST(CS_INT, 1)
42 #define CT_BR_TABLE TDS_STATIC_CAST(CS_INT, 2)
43 #define CT_CALLBACK TDS_STATIC_CAST(CS_INT, 3)
44 #define CT_CANCEL TDS_STATIC_CAST(CS_INT, 4)
45 #define CT_CAPABILITY TDS_STATIC_CAST(CS_INT, 5)
46 #define CT_CLOSE TDS_STATIC_CAST(CS_INT, 6)
47 #define CT_CMD_ALLOC TDS_STATIC_CAST(CS_INT, 7)
48 #define CT_CMD_DROP TDS_STATIC_CAST(CS_INT, 8)
49 #define CT_CMD_PROPS TDS_STATIC_CAST(CS_INT, 9)
50 #define CT_COMMAND TDS_STATIC_CAST(CS_INT, 10)
51 #define CT_COMPUTE_INFO TDS_STATIC_CAST(CS_INT, 11)
52 #define CT_CON_ALLOC TDS_STATIC_CAST(CS_INT, 12)
53 #define CT_CON_DROP TDS_STATIC_CAST(CS_INT, 13)
54 #define CT_CON_PROPS TDS_STATIC_CAST(CS_INT, 14)
55 #define CT_CON_XFER TDS_STATIC_CAST(CS_INT, 15)
56 #define CT_CONFIG TDS_STATIC_CAST(CS_INT, 16)
57 #define CT_CONNECT TDS_STATIC_CAST(CS_INT, 17)
58 #define CT_CURSOR TDS_STATIC_CAST(CS_INT, 18)
59 #define CT_DATA_INFO TDS_STATIC_CAST(CS_INT, 19)
60 #define CT_DEBUG TDS_STATIC_CAST(CS_INT, 20)
61 #define CT_DESCRIBE TDS_STATIC_CAST(CS_INT, 21)
62 #define CT_DIAG TDS_STATIC_CAST(CS_INT, 22)
63 #define CT_DYNAMIC TDS_STATIC_CAST(CS_INT, 23)
64 #define CT_DYNDESC TDS_STATIC_CAST(CS_INT, 24)
65 #define CT_EXIT TDS_STATIC_CAST(CS_INT, 25)
66 #define CT_FETCH TDS_STATIC_CAST(CS_INT, 26)
67 #define CT_GET_DATA TDS_STATIC_CAST(CS_INT, 27)
68 #define CT_GETFORMAT TDS_STATIC_CAST(CS_INT, 28)
69 #define CT_GETLOGINFO TDS_STATIC_CAST(CS_INT, 29)
70 #define CT_INIT TDS_STATIC_CAST(CS_INT, 30)
71 #define CT_KEYDATA TDS_STATIC_CAST(CS_INT, 31)
72 #define CT_OPTIONS TDS_STATIC_CAST(CS_INT, 32)
73 #define CT_PARAM TDS_STATIC_CAST(CS_INT, 33)
74 #define CT_POLL TDS_STATIC_CAST(CS_INT, 34)
75 #define CT_RECVPASSTHRU TDS_STATIC_CAST(CS_INT, 35)
76 #define CT_REMOTE_PWD TDS_STATIC_CAST(CS_INT, 36)
77 #define CT_RES_INFO TDS_STATIC_CAST(CS_INT, 37)
78 #define CT_RESULTS TDS_STATIC_CAST(CS_INT, 38)
79 #define CT_SEND TDS_STATIC_CAST(CS_INT, 39)
80 #define CT_SEND_DATA TDS_STATIC_CAST(CS_INT, 40)
81 #define CT_SENDPASSTHRU TDS_STATIC_CAST(CS_INT, 41)
82 #define CT_SETLOGINFO TDS_STATIC_CAST(CS_INT, 42)
83 #define CT_WAKEUP TDS_STATIC_CAST(CS_INT, 43)
84 #define CT_LABELS TDS_STATIC_CAST(CS_INT, 44)
85 #define CT_DS_LOOKUP TDS_STATIC_CAST(CS_INT, 45)
86 #define CT_DS_DROP TDS_STATIC_CAST(CS_INT, 46)
87 #define CT_DS_OBJINFO TDS_STATIC_CAST(CS_INT, 47)
88 #define CT_SETPARAM TDS_STATIC_CAST(CS_INT, 48)
89 #define CT_DYNSQLDA TDS_STATIC_CAST(CS_INT, 49)
90 #define CT_NOTIFICATION TDS_STATIC_CAST(CS_INT, 1000)
91 
92 static const char rcsid_ctpublic_h[] = "$Id: ctpublic.h,v 1.14 2005-05-28 10:48:26 freddy77 Exp $";
93 static const void *const no_unused_ctpublic_h_warn[] = { rcsid_ctpublic_h, no_unused_ctpublic_h_warn };
94 
95 
96 CS_RETCODE ct_init(CS_CONTEXT * ctx, CS_INT version);
97 CS_RETCODE ct_con_alloc(CS_CONTEXT * ctx, CS_CONNECTION ** con);
98 CS_RETCODE ct_con_props(CS_CONNECTION * con, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len);
99 CS_RETCODE ct_connect(CS_CONNECTION * con, CS_CHAR * servername, CS_INT snamelen);
100 CS_RETCODE ct_cmd_alloc(CS_CONNECTION * con, CS_COMMAND ** cmd);
101 CS_RETCODE ct_cancel(CS_CONNECTION * conn, CS_COMMAND * cmd, CS_INT type);
102 CS_RETCODE ct_cmd_drop(CS_COMMAND * cmd);
103 CS_RETCODE ct_close(CS_CONNECTION * con, CS_INT option);
104 CS_RETCODE ct_con_drop(CS_CONNECTION * con);
105 CS_RETCODE ct_exit(CS_CONTEXT * ctx, CS_INT unused);
106 CS_RETCODE ct_command(CS_COMMAND * cmd, CS_INT type, const CS_VOID * buffer, CS_INT buflen, CS_INT option);
107 CS_RETCODE ct_send(CS_COMMAND * cmd);
108 CS_RETCODE ct_results(CS_COMMAND * cmd, CS_INT * result_type);
109 CS_RETCODE ct_bind(CS_COMMAND * cmd, CS_INT item, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT * copied, CS_SMALLINT * indicator);
110 CS_RETCODE ct_fetch(CS_COMMAND * cmd, CS_INT type, CS_INT offset, CS_INT option, CS_INT * rows_read);
111 CS_RETCODE ct_res_info_dyn(CS_COMMAND * cmd, CS_INT type, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len);
112 CS_RETCODE ct_res_info(CS_COMMAND * cmd, CS_INT type, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len);
113 CS_RETCODE ct_describe(CS_COMMAND * cmd, CS_INT item, CS_DATAFMT * datafmt);
114 CS_RETCODE ct_callback(CS_CONTEXT * ctx, CS_CONNECTION * con, CS_INT action, CS_INT type, CS_VOID * func);
115 CS_RETCODE ct_send_dyn(CS_COMMAND * cmd);
116 CS_RETCODE ct_results_dyn(CS_COMMAND * cmd, CS_INT * result_type);
117 CS_RETCODE ct_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
118 CS_RETCODE ct_cmd_props(CS_COMMAND * cmd, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
119 CS_RETCODE ct_compute_info(CS_COMMAND * cmd, CS_INT type, CS_INT colnum, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
120 CS_RETCODE ct_get_data(CS_COMMAND * cmd, CS_INT item, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen);
121 CS_RETCODE ct_send_data(CS_COMMAND * cmd, CS_VOID * buffer, CS_INT buflen);
122 CS_RETCODE ct_data_info(CS_COMMAND * cmd, CS_INT action, CS_INT colnum, CS_IODESC * iodesc);
123 CS_RETCODE ct_capability(CS_CONNECTION * con, CS_INT action, CS_INT type, CS_INT capability, CS_VOID * value);
124 CS_RETCODE ct_dynamic(CS_COMMAND * cmd, CS_INT type, CS_CHAR * id, CS_INT idlen, CS_CHAR * buffer, CS_INT buflen);
125 CS_RETCODE ct_param(CS_COMMAND * cmd, CS_DATAFMT * datafmt, CS_VOID * data, CS_INT datalen, CS_SMALLINT indicator);
126 CS_RETCODE ct_setparam(CS_COMMAND * cmd, CS_DATAFMT * datafmt, CS_VOID * data, CS_INT * datalen, CS_SMALLINT * indicator);
127 CS_RETCODE ct_options(CS_CONNECTION * con, CS_INT action, CS_INT option, CS_VOID * param, CS_INT paramlen, CS_INT * outlen);
128 CS_RETCODE ct_poll(CS_CONTEXT * ctx, CS_CONNECTION * connection, CS_INT milliseconds, CS_CONNECTION ** compconn,
129  CS_COMMAND ** compcmd, CS_INT * compid, CS_INT * compstatus);
130 CS_RETCODE ct_cursor(CS_COMMAND * cmd, CS_INT type, CS_CHAR * name, CS_INT namelen, CS_CHAR * text, CS_INT tlen, CS_INT option);
131 CS_RETCODE ct_diag(CS_CONNECTION * conn, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer);
132 
133 #ifdef __cplusplus
134 #if 0
135 {
136 #endif
137 }
138 #endif
139 
140 #endif
Definition: ctlib.h:212
Definition: ctlib.h:75
Definition: ctlib.h:117
Definition: cstypes.h:114
Definition: cstypes.h:97
freetds-1.3.6/doc/reference/a00374_source.html000644 025423 025423 00000111546 14162303412 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/dblib.h Source File
FreeTDS API
dblib.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _dblib_h_
21 #define _dblib_h_
22 
23 #include <freetds/pushvis.h>
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #if 0
29 }
30 #endif
31 #endif
32 
33 typedef enum
34 {
35  _DB_RES_INIT
36  , _DB_RES_RESULTSET_EMPTY
37  , _DB_RES_RESULTSET_ROWS
38  , _DB_RES_NEXT_RESULT
39  , _DB_RES_NO_MORE_RESULTS
40  , _DB_RES_SUCCEED
41 } DB_RESULT_STATE;
42 
44 {
46  bool network_auth;
47 };
48 
49 struct dblib_buffer_row;
50 
51 typedef struct
52 {
53  int received; /* how many rows have been received for this result set */
54  int head; /* queue insertion point */
55  int tail; /* oldest item in queue */
56  int current; /* dbnextrow() reads this row */
57  int capacity; /* how many elements the queue can hold */
58  struct dblib_buffer_row *rows; /* pointer to the row storage */
60 
61 typedef struct
62 {
63  int host_column;
64  TDS_SERVER_TYPE datatype;
65  int prefix_len;
66  DBINT column_len;
67  BYTE *terminator;
68  int term_len;
69  int tab_colnum;
70  int column_error;
72 
73 typedef struct
74 {
75  TDS_CHAR *hostfile;
76  TDS_CHAR *errorfile;
77  FILE *bcp_errfileptr;
78  TDS_INT host_colcount;
79  BCP_HOSTCOLINFO **host_columns;
80  TDS_INT firstrow;
81  TDS_INT lastrow;
82  TDS_INT maxerrs;
83  TDS_INT batch;
85 
86 /* linked list of rpc parameters */
87 
88 typedef struct DBREMOTE_PROC_PARAM
89 {
90  struct DBREMOTE_PROC_PARAM *next;
91 
92  char *name;
93  BYTE status;
94  TDS_SERVER_TYPE type;
95  DBINT maxlen;
96  DBINT datalen;
97  BYTE *value;
99 
100 typedef struct DBREMOTE_PROC
101 {
102  struct DBREMOTE_PROC *next;
103 
104  char *name;
105  DBSMALLINT options;
106  DBREMOTE_PROC_PARAM *param_list;
107 } DBREMOTE_PROC;
108 
109 typedef struct dboption
110 {
111  const char *text;
112  DBSTRING *param;
113  DBBOOL factive;
114 } DBOPTION;
115 
116 typedef struct
117 {
118  const BYTE *bindval;
119  size_t len;
120 } NULLREP;
121 
123 {
125 
126  STATUS row_type;
127  DBPROC_ROWBUF row_buf;
128 
129  int noautofree;
130  int more_results; /* boolean. Are we expecting results? */
131  DB_RESULT_STATE dbresults_state;
132  int dbresults_retcode;
133  BYTE *user_data; /* see dbsetuserdata() and dbgetuserdata() */
134  unsigned char *dbbuf; /* is dynamic! */
135  int dbbufsz;
136  int command_state;
137  TDS_INT text_size;
138  TDS_INT text_sent;
139  DBTYPEINFO typeinfo;
140  unsigned char avail_flag;
141  DBOPTION *dbopts;
142  DBSTRING *dboptcmd;
143  BCP_HOSTFILEINFO *hostfileinfo;
144  TDSBCPINFO *bcpinfo;
145  DBREMOTE_PROC *rpc;
146  DBUSMALLINT envchange_rcv;
147  char dbcurdb[DBMAXNAME + 1];
148  char servcharset[DBMAXNAME + 1];
149  FILE *ftos;
150  DB_DBCHKINTR_FUNC chkintr;
151  DB_DBHNDLINTR_FUNC hndlintr;
152 
154  int msdblib;
155 
156  int ntimeouts;
157 
159  NULLREP nullreps[MAXBINDTYPES];
160 };
161 
162 enum {
163 #if MSDBLIB
164  dblib_msdblib = 1
165 #else
166  dblib_msdblib = 0
167 #endif
168 };
169 
170 /*
171  * internal prototypes
172  */
173 RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE* varaddr);
174 void copy_data_to_host_var(DBPROCESS * dbproc, TDS_SERVER_TYPE srctype, const BYTE * src, DBINT srclen,
175  BYTE * dest, DBINT destlen,
176  int bindtype, DBINT *indicator);
177 
178 int dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum, ...);
179 int _dblib_handle_info_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr);
180 int _dblib_handle_err_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr);
181 int _dblib_check_and_handle_interrupt(void * vdbproc);
182 
183 void _dblib_setTDS_version(TDSLOGIN * tds_login, DBINT version);
184 void _dblib_convert_err(DBPROCESS * dbproc, TDS_INT len);
185 
186 DBINT _convert_char(int srctype, BYTE * src, int destype, BYTE * dest, DBINT destlen);
187 DBINT _convert_intn(int srctype, BYTE * src, int destype, BYTE * dest, DBINT destlen);
188 
189 RETCODE _bcp_clear_storage(DBPROCESS * dbproc);
190 RETCODE _bcp_get_prog_data(DBPROCESS * dbproc);
191 
192 extern MHANDLEFUNC _dblib_msg_handler;
193 extern EHANDLEFUNC _dblib_err_handler;
194 
195 #define CHECK_PARAMETER(x, msg, ret) if (!(x)) { dbperror(dbproc, (msg), 0); return ret; }
196 #define CHECK_NULP(x, func, param_num, ret) if (!(x)) { dbperror(dbproc, SYBENULP, 0, func, (int) param_num); return ret; }
197 #define CHECK_PARAMETER_NOPROC(x, msg) if (!(x)) { dbperror(NULL, (msg), 0); return FAIL; }
198 #define DBPERROR_RETURN(x, msg) if (x) { dbperror(dbproc, (msg), 0); return FAIL; }
199 #define DBPERROR_RETURN3(x, msg, a, b, c) if (x) { dbperror(dbproc, (msg), 0, a, b, c); return FAIL; }
200 #define CHECK_CONN(ret) do { CHECK_PARAMETER(dbproc, SYBENULL, (ret)); \
201  if (IS_TDSDEAD(dbproc->tds_socket)) { dbperror(dbproc, SYBEDDNE, 0); return (ret); } } while(0)
202 
203 
204 #ifdef __cplusplus
205 #if 0
206 {
207 #endif
208 }
209 #endif
210 
211 #include <freetds/popvis.h>
212 
213 #endif
int _dblib_check_and_handle_interrupt(void *vdbproc)
check interrupts for libtds.
Definition: dbutil.c:192
Definition: dblib.h:101
Definition: tds.h:876
Definition: buffering.h:1
Definition: dblib.h:44
Definition: sybdb.h:342
NULLREP nullreps[MAXBINDTYPES]
default null values
Definition: dblib.h:159
RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE *varaddr)
Definition: dblib.c:529
Definition: dblib.h:117
Definition: dblib.h:62
Definition: dblib.h:110
Definition: dblib.h:89
Definition: tds.h:1661
Definition: dblib.h:52
Information for a server connection.
Definition: tds.h:1163
Definition: dblib.h:123
int msdblib
boolean use ms behaviour
Definition: dblib.h:154
Definition: sybdb.h:336
Definition: tds.h:1029
Definition: dblib.h:74
Definition: tds.h:517
int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...)
Call client-installed error handler.
Definition: dblib.c:8127
freetds-1.3.6/doc/reference/a00377_source.html000644 025423 025423 00000015410 14162303412 022372 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/alloca.h Source File
FreeTDS API
alloca.h
1 /* Cfr https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html */
2 #ifdef STDC_HEADERS
3 # include <stdlib.h>
4 # include <stddef.h>
5 #else
6 # ifdef HAVE_STDLIB_H
7 # include <stdlib.h>
8 # endif
9 #endif
10 #ifdef HAVE_ALLOCA_H
11 # include <alloca.h>
12 #elif !defined alloca
13 # ifdef __GNUC__
14 # define alloca __builtin_alloca
15 # elif defined _AIX
16 # define alloca __alloca
17 # elif defined _MSC_VER
18 # include <malloc.h>
19 # define alloca _alloca
20 # elif !defined HAVE_ALLOCA
21 # ifdef __cplusplus
22 extern "C"
23 # endif
24 void *alloca (size_t);
25 # endif
26 #endif
freetds-1.3.6/doc/reference/a00380_source.html000644 025423 025423 00000275102 14162303413 022373 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/alternative_character_sets.h Source File
FreeTDS API
alternative_character_sets.h
1 /*
2  * Copyright 2003 James K. Lowden <jklowden@schemamania.org>
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted, provided that redistributions of source
5  * code retain the above copyright notice.
6  */
7 
8  /*
9  * The purpose of this file is to help look up character set names.
10  *
11  * Any given encoding may be known by several (usually similar) aliases.
12  * For example, a system using ASCII encoding may report the character set as
13  * "ASCII", "US-ASCII", or "ISO646-US", among others. For details on what your system
14  * uses, you may wish to consult the nl_langinfo(3) manual page.
15  *
16  * GNU iconv converts a byte sequence from one encoding to another, but before it can do
17  * so, it must be told which is which. In the list below, the preferred GNU iconv(3) name
18  * is on the left and an alias is on the right. It is a simple exercise, left to the reader,
19  * to write a function that uses these data to look up the canonical name when provided
20  * an alias.
21  */
22 
23 #ifndef _ALTERNATIVE_CHARACTER_SETS_H_
24 #define _ALTERNATIVE_CHARACTER_SETS_H_
25 
26 /*
27  * $Id: alternative_character_sets.h,v 1.10 2005-02-26 13:08:32 freddy77 Exp $
28  */
29 
30 /*
31  * This list is sorted alphabetically, except that the most
32  * commonly used character sets are first.
33  */
34  /* ASCII */
35  { "US-ASCII", "US-ASCII" }
36  , { "US-ASCII", "ANSI_X3.4-1968" }
37  , { "US-ASCII", "ANSI_X3.4-1986" }
38  , { "US-ASCII", "ASCII" }
39  , { "US-ASCII", "CP367" }
40  , { "US-ASCII", "CSASCII" }
41  , { "US-ASCII", "IBM367" }
42  , { "US-ASCII", "ISO-IR-6" }
43  , { "US-ASCII", "ISO646-US" }
44  , { "US-ASCII", "ISO_646.IRV:1991" }
45  , { "US-ASCII", "US" }
46  , { "US-ASCII", "646" } /* NetBSD default */
47  /* ISO_8859-1 */
48  , { "ISO-8859-1", "ISO-8859-1" }
49  , { "ISO-8859-1", "CP819" }
50  , { "ISO-8859-1", "CSISOLATIN1" }
51  , { "ISO-8859-1", "IBM819" }
52  , { "ISO-8859-1", "ISO-IR-100" }
53  , { "ISO-8859-1", "ISO8859-1" }
54  , { "ISO-8859-1", "ISO_8859-1" }
55  , { "ISO-8859-1", "ISO_8859-1:1987" }
56  , { "ISO-8859-1", "L1" }
57  , { "ISO-8859-1", "LATIN1" }
58  , { "ISO-8859-1", "iso81" }
59  , { "ISO-8859-1", "iso88591" }
60  /* UCS-2 */
61  , { "UCS-2", "UCS-2" }
62  , { "UCS-2", "CSUNICODE" }
63  , { "UCS-2", "ISO-10646-UCS-2" }
64  , { "UCS-2", "UCS2" }
65  , { "UCS-2", "ucs2" }
66  , { "UCS-2-INTERNAL", "UCS-2-INTERNAL" }
67  , { "UCS-2-SWAPPED", "UCS-2-SWAPPED" }
68  , { "UCS-2BE", "UCS-2BE" }
69  , { "UCS-2BE", "CSUNICODE11" }
70  , { "UCS-2BE", "UNICODE-1-1" }
71  , { "UCS-2BE", "UNICODEBIG" }
72  , { "UCS-2LE", "UCS-2LE" }
73  , { "UCS-2LE", "UNICODELITTLE" }
74  /* UTF-8 */
75  , { "UTF-8", "UTF-8" }
76  , { "UTF-8", "UTF8" }
77  , { "UTF-8", "utf8" }
78 
79  /* Basically alphabetical from here */
80  , { "ARMSCII-8", "ARMSCII-8" }
81  , { "BIG-5", "BIG-5" }
82  , { "BIG-5", "BIG-FIVE" }
83  , { "BIG-5", "BIG5" }
84  , { "BIG-5", "BIGFIVE" }
85  , { "BIG-5", "CN-BIG5" }
86  , { "BIG-5", "CSBIG5" }
87  , { "BIG-5", "big5" }
88  , { "BIG5-HKSCS", "BIG5-HKSCS" }
89  , { "BIG5-HKSCS", "BIG5HKSCS" }
90  , { "C99", "C99" }
91  , { "CHINESE", "CHINESE" }
92  , { "CHINESE", "CSISO58GB231280" }
93  , { "CHINESE", "GB_2312-80" }
94  , { "CHINESE", "ISO-IR-58" }
95  , { "CHINESE", "hp15CN" }
96  , { "CN", "CN" }
97  , { "CN", "CSISO57GB1988" }
98  , { "CN", "GB_1988-80" }
99  , { "CN", "ISO-IR-57" }
100  , { "CN", "ISO646-CN" }
101  , { "CN-GB", "CN-GB" }
102  , { "CN-GB", "CSGB2312" }
103  , { "CN-GB", "EUC-CN" }
104  , { "CN-GB", "EUCCN" }
105  , { "CN-GB", "GB2312" }
106  , { "CN-GB-ISOIR165", "CN-GB-ISOIR165" }
107  , { "CN-GB-ISOIR165", "ISO-IR-165" }
108  , { "CP1133", "CP1133" }
109  , { "CP1133", "IBM-CP1133" }
110  , { "CP1250", "CP1250" }
111  , { "CP1250", "MS-EE" }
112  , { "CP1250", "WINDOWS-1250" }
113  , { "CP1250", "cp1250" }
114  , { "CP1251", "CP1251" }
115  , { "CP1251", "MS-CYRL" }
116  , { "CP1251", "WINDOWS-1251" }
117  , { "CP1251", "cp1251" }
118  , { "CP1252", "CP1252" }
119  , { "CP1252", "MS-ANSI" }
120  , { "CP1252", "WINDOWS-1252" }
121  , { "CP1252", "cp1252" }
122  , { "CP1253", "CP1253" }
123  , { "CP1253", "MS-GREEK" }
124  , { "CP1253", "WINDOWS-1253" }
125  , { "CP1253", "cp1253" }
126  , { "CP1254", "CP1254" }
127  , { "CP1254", "MS-TURK" }
128  , { "CP1254", "WINDOWS-1254" }
129  , { "CP1254", "cp1254" }
130  , { "CP1255", "CP1255" }
131  , { "CP1255", "MS-HEBR" }
132  , { "CP1255", "WINDOWS-1255" }
133  , { "CP1255", "cp1255" }
134  , { "CP1256", "CP1256" }
135  , { "CP1256", "MS-ARAB" }
136  , { "CP1256", "WINDOWS-1256" }
137  , { "CP1256", "cp1256" }
138  , { "CP1257", "CP1257" }
139  , { "CP1257", "WINBALTRIM" }
140  , { "CP1257", "WINDOWS-1257" }
141  , { "CP1257", "cp1257" }
142  , { "CP1258", "CP1258" }
143  , { "CP1258", "WINDOWS-1258" }
144  , { "CP1258", "cp1258" }
145  , { "CP1361", "CP1361" }
146  , { "CP1361", "JOHAB" }
147  , { "CP850", "CP850" }
148  , { "CP850", "850" }
149  , { "CP850", "CSPC850MULTILINGUAL" }
150  , { "CP850", "IBM850" }
151  , { "CP850", "cp850" }
152  , { "CP862", "CP862" }
153  , { "CP862", "862" }
154  , { "CP862", "CSPC862LATINHEBREW" }
155  , { "CP862", "IBM862" }
156  , { "CP862", "cp862" }
157  , { "CP866", "CP866" }
158  , { "CP866", "866" }
159  , { "CP866", "CSIBM866" }
160  , { "CP866", "IBM866" }
161  , { "CP866", "cp866" }
162  , { "CP874", "CP874" }
163  , { "CP874", "WINDOWS-874" }
164  , { "CP874", "cp874" }
165  , { "CP932", "CP932" }
166  , { "CP936", "CP936" }
167  , { "CP936", "GBK" }
168  , { "CP949", "CP949" }
169  , { "CP949", "UHC" }
170  , { "CP950", "CP950" }
171  , { "CP437", "CP437" }
172  , { "CP437", "cp437" }
173  , { "CP437", "IBM437" }
174  , { "EUC-JP", "EUC-JP" }
175  , { "EUC-JP", "CSEUCPKDFMTJAPANESE" }
176  , { "EUC-JP", "EUCJP" }
177  , { "EUC-JP", "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE"}
178  , { "EUC-JP", "eucJP" }
179  , { "EUC-KR", "EUC-KR" }
180  , { "EUC-KR", "CSEUCKR" }
181  , { "EUC-KR", "EUCKR" }
182  , { "EUC-KR", "eucKR" }
183  , { "EUC-TW", "CSEUCTW" }
184  , { "EUC-TW", "EUC-TW" }
185  , { "EUC-TW", "EUCTW" }
186  , { "EUC-TW", "eucTW" }
187  , { "GB18030", "GB18030" }
188  , { "GEORGIAN-ACADEMY", "GEORGIAN-ACADEMY" }
189  , { "GEORGIAN-PS", "GEORGIAN-PS" }
190  , { "HZ", "HZ" }
191  , { "HZ", "HZ-GB-2312" }
192  , { "ISO-2022-CN", "ISO-2022-CN" }
193  , { "ISO-2022-CN", "CSISO2022CN" }
194  , { "ISO-2022-CN-EXT", "ISO-2022-CN-EXT" }
195  , { "ISO-2022-JP", "ISO-2022-JP" }
196  , { "ISO-2022-JP", "CSISO2022JP" }
197  , { "ISO-2022-JP-1", "ISO-2022-JP-1" }
198  , { "ISO-2022-JP-2", "ISO-2022-JP-2" }
199  , { "ISO-2022-JP-2", "CSISO2022JP2" }
200  , { "ISO-2022-KR", "ISO-2022-KR" }
201  , { "ISO-2022-KR", "CSISO2022KR" }
202  , { "ISO-8859-10", "ISO-8859-10" }
203  , { "ISO-8859-10", "CSISOLATIN6" }
204  , { "ISO-8859-10", "ISO-IR-157" }
205  , { "ISO-8859-10", "ISO8859-10" }
206  , { "ISO-8859-10", "ISO_8859-10" }
207  , { "ISO-8859-10", "ISO_8859-10:1992" }
208  , { "ISO-8859-10", "L6" }
209  , { "ISO-8859-10", "LATIN6" }
210  , { "ISO-8859-13", "ISO-8859-13" }
211  , { "ISO-8859-13", "ISO-IR-179" }
212  , { "ISO-8859-13", "ISO_8859-13" }
213  , { "ISO-8859-13", "L7" }
214  , { "ISO-8859-13", "LATIN7" }
215  , { "ISO-8859-14", "ISO-8859-14" }
216  , { "ISO-8859-14", "ISO-CELTIC" }
217  , { "ISO-8859-14", "ISO-IR-199" }
218  , { "ISO-8859-14", "ISO_8859-14" }
219  , { "ISO-8859-14", "ISO_8859-14:1998" }
220  , { "ISO-8859-14", "L8" }
221  , { "ISO-8859-14", "LATIN8" }
222  , { "ISO-8859-15", "ISO8859-15" }
223  , { "ISO-8859-15", "ISO-8859-15" }
224  , { "ISO-8859-15", "ISO-IR-203" }
225  , { "ISO-8859-15", "ISO_8859-15" }
226  , { "ISO-8859-15", "ISO_8859-15:1998" }
227  , { "ISO-8859-15", "iso815" }
228  , { "ISO-8859-15", "iso885915" }
229  , { "ISO-8859-16", "ISO-8859-16" }
230  , { "ISO-8859-16", "ISO-IR-226" }
231  , { "ISO-8859-16", "ISO_8859-16" }
232  , { "ISO-8859-16", "ISO_8859-16:2000" }
233  , { "ISO-8859-2", "ISO-8859-2" }
234  , { "ISO-8859-2", "CSISOLATIN2" }
235  , { "ISO-8859-2", "ISO8859-2" }
236  , { "ISO-8859-2", "ISO-IR-101" }
237  , { "ISO-8859-2", "ISO_8859-2" }
238  , { "ISO-8859-2", "ISO_8859-2:1987" }
239  , { "ISO-8859-2", "L2" }
240  , { "ISO-8859-2", "LATIN2" }
241  , { "ISO-8859-2", "iso82" }
242  , { "ISO-8859-2", "iso88592" }
243  , { "ISO-8859-3", "ISO-8859-3" }
244  , { "ISO-8859-3", "CSISOLATIN3" }
245  , { "ISO-8859-3", "ISO-IR-109" }
246  , { "ISO-8859-3", "ISO_8859-3" }
247  , { "ISO-8859-3", "ISO_8859-3:1988" }
248  , { "ISO-8859-3", "L3" }
249  , { "ISO-8859-3", "LATIN3" }
250  , { "ISO-8859-3", "iso83" }
251  , { "ISO-8859-3", "iso88593" }
252  , { "ISO-8859-4", "ISO8859-4" }
253  , { "ISO-8859-4", "CSISOLATIN4" }
254  , { "ISO-8859-4", "ISO-8859-4" }
255  , { "ISO-8859-4", "ISO-IR-110" }
256  , { "ISO-8859-4", "ISO_8859-4" }
257  , { "ISO-8859-4", "ISO_8859-4:1988" }
258  , { "ISO-8859-4", "L4" }
259  , { "ISO-8859-4", "LATIN4" }
260  , { "ISO-8859-4", "iso84" }
261  , { "ISO-8859-4", "iso88594" }
262  , { "ISO-8859-5", "ISO-8859-5" }
263  , { "ISO-8859-5", "CSISOLATINCYRILLIC" }
264  , { "ISO-8859-5", "CYRILLIC" }
265  , { "ISO-8859-5", "ISO8859-5" }
266  , { "ISO-8859-5", "ISO-IR-144" }
267  , { "ISO-8859-5", "ISO8859-5" }
268  , { "ISO-8859-5", "ISO_8859-5" }
269  , { "ISO-8859-5", "ISO_8859-5:1988" }
270  , { "ISO-8859-5", "iso85" }
271  , { "ISO-8859-5", "iso88595" }
272  , { "ISO-8859-6", "ISO-8859-6" }
273  , { "ISO-8859-6", "ARABIC" }
274  , { "ISO-8859-6", "ASMO-708" }
275  , { "ISO-8859-6", "CSISOLATINARABIC" }
276  , { "ISO-8859-6", "ECMA-114" }
277  , { "ISO-8859-6", "ISO-IR-127" }
278  , { "ISO-8859-6", "ISO8859-6" }
279  , { "ISO-8859-6", "ISO_8859-6" }
280  , { "ISO-8859-6", "ISO_8859-6:1987" }
281  , { "ISO-8859-6", "iso86" }
282  , { "ISO-8859-6", "iso88596" }
283  , { "ISO-8859-7", "ISO-8859-7" }
284  , { "ISO-8859-7", "CSISOLATINGREEK" }
285  , { "ISO-8859-7", "ECMA-118" }
286  , { "ISO-8859-7", "ELOT_928" }
287  , { "ISO-8859-7", "GREEK" }
288  , { "ISO-8859-7", "GREEK8" }
289  , { "ISO-8859-7", "ISO-IR-126" }
290  , { "ISO-8859-7", "ISO8859-7" }
291  , { "ISO-8859-7", "ISO_8859-7" }
292  , { "ISO-8859-7", "ISO_8859-7:1987" }
293  , { "ISO-8859-7", "iso87" }
294  , { "ISO-8859-7", "iso88597" }
295  , { "ISO-8859-8", "ISO-8859-8" }
296  , { "ISO-8859-8", "CSISOLATINHEBREW" }
297  , { "ISO-8859-8", "HEBREW" }
298  , { "ISO-8859-8", "ISO8859-8" }
299  , { "ISO-8859-8", "ISO-IR-138" }
300  , { "ISO-8859-8", "ISO_8859-8" }
301  , { "ISO-8859-8", "ISO_8859-8:1988" }
302  , { "ISO-8859-8", "iso88" }
303  , { "ISO-8859-8", "iso88598" }
304  , { "ISO-8859-9", "ISO-8859-9" }
305  , { "ISO-8859-9", "CSISOLATIN5" }
306  , { "ISO-8859-9", "ISO-IR-148" }
307  , { "ISO-8859-9", "ISO8859-9" }
308  , { "ISO-8859-9", "ISO_8859-9" }
309  , { "ISO-8859-9", "ISO_8859-9:1989" }
310  , { "ISO-8859-9", "L5" }
311  , { "ISO-8859-9", "LATIN5" }
312  , { "ISO-8859-9", "iso88599" }
313  , { "ISO-8859-9", "iso89" }
314  , { "ISO-IR-14", "ISO-IR-14" }
315  , { "ISO-IR-14", "CSISO14JISC6220RO" }
316  , { "ISO-IR-14", "ISO646-JP" }
317  , { "ISO-IR-14", "JIS_C6220-1969-RO" }
318  , { "ISO-IR-14", "JP" }
319  , { "ISO-IR-149", "ISO-IR-149" }
320  , { "ISO-IR-149", "CSKSC56011987" }
321  , { "ISO-IR-149", "KOREAN" }
322  , { "ISO-IR-149", "KSC_5601" }
323  , { "ISO-IR-149", "KS_C_5601-1987" }
324  , { "ISO-IR-149", "KS_C_5601-1989" }
325  , { "ISO-IR-159", "ISO-IR-159" }
326  , { "ISO-IR-159", "CSISO159JISX02121990" }
327  , { "ISO-IR-159", "JIS_X0212" }
328  , { "ISO-IR-159", "JIS_X0212-1990" }
329  , { "ISO-IR-159", "JIS_X0212.1990-0" }
330  , { "ISO-IR-159", "X0212" }
331  , { "ISO-IR-166", "ISO-IR-166" }
332  , { "ISO-IR-166", "TIS-620" }
333  , { "ISO-IR-166", "TIS620" }
334  , { "ISO-IR-166", "TIS620-0" }
335  , { "ISO-IR-166", "TIS620.2529-1" }
336  , { "ISO-IR-166", "TIS620.2533-0" }
337  , { "ISO-IR-166", "TIS620.2533-1" }
338  , { "ISO-IR-166", "thai8" }
339  , { "ISO-IR-166", "tis620" }
340  , { "ISO-IR-87", "ISO-IR-87" }
341  , { "ISO-IR-87", "CSISO87JISX0208" }
342  , { "ISO-IR-87", "JIS0208" }
343  , { "ISO-IR-87", "JIS_C6226-1983" }
344  , { "ISO-IR-87", "JIS_X0208" }
345  , { "ISO-IR-87", "JIS_X0208-1983" }
346  , { "ISO-IR-87", "JIS_X0208-1990" }
347  , { "ISO-IR-87", "X0208" }
348  , { "JAVA", "JAVA" }
349  , { "JISX0201-1976", "JISX0201-1976" }
350  , { "JISX0201-1976", "CSHALFWIDTHKATAKANA" }
351  , { "JISX0201-1976", "JIS_X0201" }
352  , { "JISX0201-1976", "X0201" }
353  , { "KOI8-R", "KOI8-R" }
354  , { "KOI8-R", "CSKOI8R" }
355  , { "KOI8-RU", "KOI8-RU" }
356  , { "KOI8-T", "KOI8-T" }
357  , { "KOI8-U", "KOI8-U" }
358  , { "MAC", "MAC" }
359  , { "MAC", "CSMACINTOSH" }
360  , { "MAC", "MACINTOSH" }
361  , { "MAC", "MACROMAN" }
362  , { "MACARABIC", "MACARABIC" }
363  , { "MACCENTRALEUROPE", "MACCENTRALEUROPE" }
364  , { "MACCROATIAN", "MACCROATIAN" }
365  , { "MACCYRILLIC", "MACCYRILLIC" }
366  , { "MACGREEK", "MACGREEK" }
367  , { "MACHEBREW", "MACHEBREW" }
368  , { "MACICELAND", "MACICELAND" }
369  , { "MACROMANIA", "MACROMANIA" }
370  , { "MACTHAI", "MACTHAI" }
371  , { "MACTURKISH", "MACTURKISH" }
372  , { "MACUKRAINE", "MACUKRAINE" }
373  , { "MULELAO-1", "MULELAO-1" }
374  , { "NEXTSTEP", "NEXTSTEP" }
375  , { "ROMAN8", "ROMAN8" }
376  , { "ROMAN8", "CSHPROMAN8" }
377  , { "ROMAN8", "HP-ROMAN8" }
378  , { "ROMAN8", "R8" }
379  , { "ROMAN8", "roma8" }
380  , { "ROMAN8", "roman8" }
381  , { "SJIS", "SJIS" }
382  , { "SJIS", "CSSHIFTJIS" }
383  , { "SJIS", "MS_KANJI" }
384  , { "SJIS", "SHIFT-JIS" }
385  , { "SJIS", "SHIFT_JIS" }
386  , { "SJIS", "sjis" }
387  , { "TCVN", "TCVN" }
388  , { "TCVN", "TCVN-5712" }
389  , { "TCVN", "TCVN5712-1" }
390  , { "TCVN", "TCVN5712-1:1993" }
391  , { "UCS-4", "UCS-4" }
392  , { "UCS-4", "CSUCS4" }
393  , { "UCS-4", "ISO-10646-UCS-4" }
394  , { "UCS-4", "UCS4" }
395  , { "UCS-4", "ucs4" }
396  , { "UCS-4-INTERNAL", "UCS-4-INTERNAL" }
397  , { "UCS-4-SWAPPED", "UCS-4-SWAPPED" }
398  , { "UCS-4BE", "UCS-4BE" }
399  , { "UCS-4LE", "UCS-4LE" }
400  , { "UTF-16", "UTF-16" }
401  , { "UTF-16", "UTF16" }
402  , { "UTF-16BE", "UTF-16BE" }
403  , { "UTF-16LE", "UTF-16LE" }
404  , { "UTF-32", "UTF-32" }
405  , { "UTF-32BE", "UTF-32BE" }
406  , { "UTF-32LE", "UTF-32LE" }
407  , { "UTF-7", "UTF-7" }
408  , { "UTF-7", "CSUNICODE11UTF7" }
409  , { "UTF-7", "UNICODE-1-1-UTF-7" }
410  , { "UTF-7", "UTF7" }
411  , { "VISCII", "VISCII" }
412  , { "VISCII", "CSVISCII" }
413  , { "VISCII", "VISCII1.1-1" }
414 
415  /*
416  * The following are noted in Tru64 manuals, but
417  * have no canonical names in FreeTDS
418  *
419  * TACTIS TACTIS codeset
420  * dechanyu DEC Hanyu codeset
421  * dechanzi DEC Hanzi codeset
422  * deckanji DEC Kanji codeset
423  * deckorean DEC Korean codeset
424  * sdeckanji Super DEC Kanji codeset
425  */
426 
427  /* no stopper row; add your own */
428 #endif
freetds-1.3.6/doc/reference/a00383_source.html000644 025423 025423 00000021700 14162303413 022367 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/bool.h Source File
FreeTDS API
bool.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2015 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef freetds_bool_h_
21 #define freetds_bool_h_
22 
23 #ifndef __cplusplus
24 
25 #ifdef HAVE_STDBOOL_H
26 
27 #include <stdbool.h>
28 
29 #else
30 
31 #undef true
32 #undef false
33 #undef bool
34 typedef unsigned char freetds_boolean_t;
35 #define bool freetds_boolean_t
36 #define true 1
37 #define false 0
38 
39 #endif
40 
41 #endif
42 
43 #endif /* freetds_bool_h_ */
freetds-1.3.6/doc/reference/a00386_source.html000644 025423 025423 00000125527 14162303413 022406 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/bytes.h Source File
FreeTDS API
bytes.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2005-2008 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tdsbytes_h_
21 #define _tdsbytes_h_
22 
23 /*
24  * read a word of n bytes aligned, architecture dependent endian
25  * TDS_GET_An
26  * read a word of n bytes aligned, little endian
27  * TDS_GET_AnLE
28  * read a word of n bytes aligned, big endian
29  * TDS_GET_AnBE
30  * read a word of n bytes unaligned, architecture dependent endian
31  * TDS_GET_UAn
32  * read a word of n bytes unaligned, little endian
33  * TDS_GET_UAnLE
34  * read a word of n bytes unaligned, big endian
35  * TDS_GET_UAnBE
36  */
37 
38 /* one byte, easy... */
39 #define TDS_GET_A1LE(ptr) (((uint8_t *)(ptr))[0])
40 #define TDS_GET_A1BE(ptr) TDS_GET_A1LE(ptr)
41 #define TDS_GET_UA1LE(ptr) TDS_GET_A1LE(ptr)
42 #define TDS_GET_UA1BE(ptr) TDS_GET_A1LE(ptr)
43 
44 #define TDS_PUT_A1LE(ptr,val) do { ((uint8_t *)(ptr))[0] = (val); } while(0)
45 #define TDS_PUT_A1BE(ptr,val) TDS_PUT_A1LE(ptr,val)
46 #define TDS_PUT_UA1LE(ptr,val) TDS_PUT_A1LE(ptr,val)
47 #define TDS_PUT_UA1BE(ptr,val) TDS_PUT_A1LE(ptr,val)
48 
49 /* two bytes */
50 #define TDS_GET_UA2LE(ptr) (((uint8_t *)(ptr))[1] * 0x100u + ((uint8_t *)(ptr))[0])
51 #define TDS_GET_UA2BE(ptr) (((uint8_t *)(ptr))[0] * 0x100u + ((uint8_t *)(ptr))[1])
52 #define TDS_GET_A2LE(ptr) TDS_GET_UA2LE(ptr)
53 #define TDS_GET_A2BE(ptr) TDS_GET_UA2BE(ptr)
54 
55 #define TDS_PUT_UA2LE(ptr,val) do {\
56  ((uint8_t *)(ptr))[1] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[0] = (uint8_t)(val); } while(0)
57 #define TDS_PUT_UA2BE(ptr,val) do {\
58  ((uint8_t *)(ptr))[0] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[1] = (uint8_t)(val); } while(0)
59 #define TDS_PUT_A2LE(ptr,val) TDS_PUT_UA2LE(ptr,val)
60 #define TDS_PUT_A2BE(ptr,val) TDS_PUT_UA2BE(ptr,val)
61 
62 /* four bytes */
63 #define TDS_GET_UA4LE(ptr) \
64  (((uint8_t *)(ptr))[3] * 0x1000000u + ((uint8_t *)(ptr))[2] * 0x10000u +\
65  ((uint8_t *)(ptr))[1] * 0x100u + ((uint8_t *)(ptr))[0])
66 #define TDS_GET_UA4BE(ptr) \
67  (((uint8_t *)(ptr))[0] * 0x1000000u + ((uint8_t *)(ptr))[1] * 0x10000u +\
68  ((uint8_t *)(ptr))[2] * 0x100u + ((uint8_t *)(ptr))[3])
69 #define TDS_GET_A4LE(ptr) TDS_GET_UA4LE(ptr)
70 #define TDS_GET_A4BE(ptr) TDS_GET_UA4BE(ptr)
71 
72 #define TDS_PUT_UA4LE(ptr,val) do {\
73  ((uint8_t *)(ptr))[3] = (uint8_t)((val)>>24); ((uint8_t *)(ptr))[2] = (uint8_t)((val)>>16);\
74  ((uint8_t *)(ptr))[1] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[0] = (uint8_t)(val); } while(0)
75 #define TDS_PUT_UA4BE(ptr,val) do {\
76  ((uint8_t *)(ptr))[0] = (uint8_t)((val)>>24); ((uint8_t *)(ptr))[1] = (uint8_t)((val)>>16);\
77  ((uint8_t *)(ptr))[2] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[3] = (uint8_t)(val); } while(0)
78 #define TDS_PUT_A4LE(ptr,val) TDS_PUT_UA4LE(ptr,val)
79 #define TDS_PUT_A4BE(ptr,val) TDS_PUT_UA4BE(ptr,val)
80 
81 #if defined(__GNUC__)
82 # define TDS_MAY_ALIAS __attribute__((__may_alias__))
83 #else
84 # define TDS_MAY_ALIAS
85 #endif
86 
87 typedef union {
88  uint16_t usi;
89  uint8_t uc[2];
90 } TDS_MAY_ALIAS TDS_BYTE_CONVERT2;
91 
92 typedef union {
93  uint32_t ui;
94  uint8_t uc[4];
95 } TDS_MAY_ALIAS TDS_BYTE_CONVERT4;
96 
97 /* architecture dependent */
98 /* map to generic macros or redefine for aligned and same endianess */
99 #ifdef WORDS_BIGENDIAN
100 # define TDS_GET_A1(ptr) TDS_GET_A1BE(ptr)
101 # define TDS_GET_UA1(ptr) TDS_GET_UA1BE(ptr)
102 # define TDS_GET_A2(ptr) TDS_GET_A2BE(ptr)
103 # define TDS_GET_UA2(ptr) TDS_GET_UA2BE(ptr)
104 # define TDS_GET_A4(ptr) TDS_GET_A4BE(ptr)
105 # define TDS_GET_UA4(ptr) TDS_GET_UA4BE(ptr)
106 # undef TDS_GET_A2BE
107 # undef TDS_GET_A4BE
108 # define TDS_GET_A2BE(ptr) (((TDS_BYTE_CONVERT2*)(ptr))->usi)
109 # define TDS_GET_A4BE(ptr) (((TDS_BYTE_CONVERT4*)(ptr))->ui)
110 
111 # define TDS_PUT_A1(ptr,val) TDS_PUT_A1BE(ptr,val)
112 # define TDS_PUT_UA1(ptr,val) TDS_PUT_UA1BE(ptr,val)
113 # define TDS_PUT_A2(ptr,val) TDS_PUT_A2BE(ptr,val)
114 # define TDS_PUT_UA2(ptr,val) TDS_PUT_UA2BE(ptr,val)
115 # define TDS_PUT_A4(ptr,val) TDS_PUT_A4BE(ptr,val)
116 # define TDS_PUT_UA4(ptr,val) TDS_PUT_UA4BE(ptr,val)
117 # undef TDS_PUT_A2BE
118 # undef TDS_PUT_A4BE
119 # define TDS_PUT_A2BE(ptr,val) (((TDS_BYTE_CONVERT2*)(ptr))->usi = (val))
120 # define TDS_PUT_A4BE(ptr,val) (((TDS_BYTE_CONVERT4*)(ptr))->ui = (val))
121 # define TDS_HOST2LE(val) TDS_BYTE_SWAP16(val)
122 # define TDS_HOST4LE(val) TDS_BYTE_SWAP32(val)
123 # define TDS_HOST2BE(val) (val)
124 # define TDS_HOST4BE(val) (val)
125 #else
126 # define TDS_GET_A1(ptr) TDS_GET_A1LE(ptr)
127 # define TDS_GET_UA1(ptr) TDS_GET_UA1LE(ptr)
128 # define TDS_GET_A2(ptr) TDS_GET_A2LE(ptr)
129 # define TDS_GET_UA2(ptr) TDS_GET_UA2LE(ptr)
130 # define TDS_GET_A4(ptr) TDS_GET_A4LE(ptr)
131 # define TDS_GET_UA4(ptr) TDS_GET_UA4LE(ptr)
132 # undef TDS_GET_A2LE
133 # undef TDS_GET_A4LE
134 # define TDS_GET_A2LE(ptr) (((TDS_BYTE_CONVERT2*)(ptr))->usi)
135 # define TDS_GET_A4LE(ptr) (((TDS_BYTE_CONVERT4*)(ptr))->ui)
136 
137 # define TDS_PUT_A1(ptr,val) TDS_PUT_A1LE(ptr,val)
138 # define TDS_PUT_UA1(ptr,val) TDS_PUT_UA1LE(ptr,val)
139 # define TDS_PUT_A2(ptr,val) TDS_PUT_A2LE(ptr,val)
140 # define TDS_PUT_UA2(ptr,val) TDS_PUT_UA2LE(ptr,val)
141 # define TDS_PUT_A4(ptr,val) TDS_PUT_A4LE(ptr,val)
142 # define TDS_PUT_UA4(ptr,val) TDS_PUT_UA4LE(ptr,val)
143 # undef TDS_PUT_A2LE
144 # undef TDS_PUT_A4LE
145 # define TDS_PUT_A2LE(ptr,val) (((TDS_BYTE_CONVERT2*)(ptr))->usi = (val))
146 # define TDS_PUT_A4LE(ptr,val) (((TDS_BYTE_CONVERT4*)(ptr))->ui = (val))
147 # define TDS_HOST2LE(val) (val)
148 # define TDS_HOST4LE(val) (val)
149 # define TDS_HOST2BE(val) TDS_BYTE_SWAP16(val)
150 # define TDS_HOST4BE(val) TDS_BYTE_SWAP32(val)
151 #endif
152 
153 /* these platform support unaligned fetch/store */
154 /* map unaligned macro to aligned ones */
155 #if defined(__i386__) || defined(__amd64__) || defined(__CRIS__) ||\
156  defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__) ||\
157  defined(__s390__) || defined(__s390x__) || defined(__m68k__) ||\
158  (defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86) || defined(_M_X64))) ||\
159  defined(__ARM_FEATURE_UNALIGNED) ||\
160  defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_8__) ||\
161  (defined(_M_ARM) && (_M_ARM >= 7))
162 # ifdef WORDS_BIGENDIAN
163 # undef TDS_GET_UA2BE
164 # undef TDS_GET_UA4BE
165 # define TDS_GET_UA2BE(ptr) TDS_GET_A2BE(ptr)
166 # define TDS_GET_UA4BE(ptr) TDS_GET_A4BE(ptr)
167 
168 # undef TDS_PUT_UA2BE
169 # undef TDS_PUT_UA4BE
170 # define TDS_PUT_UA2BE(ptr,val) TDS_PUT_A2BE(ptr,val)
171 # define TDS_PUT_UA4BE(ptr,val) TDS_PUT_A4BE(ptr,val)
172 # else
173 # undef TDS_GET_UA2LE
174 # undef TDS_GET_UA4LE
175 # define TDS_GET_UA2LE(ptr) TDS_GET_A2LE(ptr)
176 # define TDS_GET_UA4LE(ptr) TDS_GET_A4LE(ptr)
177 
178 # undef TDS_PUT_UA2LE
179 # undef TDS_PUT_UA4LE
180 # define TDS_PUT_UA2LE(ptr,val) TDS_PUT_A2LE(ptr,val)
181 # define TDS_PUT_UA4LE(ptr,val) TDS_PUT_A4LE(ptr,val)
182 # endif
183 #endif
184 
185 #undef TDS_BSWAP16
186 #undef TDS_BSWAP32
187 /* __builtin_bswap16 was introduced in GCC 4.8 */
188 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && defined(__OPTIMIZE__)
189 # define TDS_BSWAP16(val) __builtin_bswap16(val)
190 # define TDS_BSWAP32(val) __builtin_bswap32(val)
191 /* __builtin_bswap32 was introduced in GCC 4.3 */
192 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && defined(__OPTIMIZE__)
193 # define TDS_BSWAP32(val) __builtin_bswap32(val)
194 #elif defined(_MSC_VER)
195 # define TDS_BSWAP16(val) _byteswap_ushort(val)
196 # define TDS_BSWAP32(val) _byteswap_ulong(val)
197 #endif
198 
199 #if defined(TDS_BSWAP16) && !defined(WORDS_BIGENDIAN)
200 # undef TDS_GET_UA2BE
201 # define TDS_GET_UA2BE(ptr) TDS_BSWAP16(TDS_GET_UA2LE(ptr))
202 
203 # undef TDS_PUT_UA2BE
204 # define TDS_PUT_UA2BE(ptr,val) do {\
205  uint16_t _tds_si = TDS_BSWAP16(val); TDS_PUT_UA2LE(ptr,_tds_si); } while(0)
206 #elif defined(TDS_BSWAP16) && defined(WORDS_BIGENDIAN)
207 # undef TDS_GET_UA2LE
208 # define TDS_GET_UA2LE(ptr) TDS_BSWAP16(TDS_GET_UA2BE(ptr))
209 
210 # undef TDS_PUT_UA2LE
211 # define TDS_PUT_UA2LE(ptr,val) do {\
212  uint16_t _tds_si = TDS_BSWAP16(val); TDS_PUT_UA2BE(ptr,_tds_si); } while(0)
213 #endif
214 
215 #if defined(TDS_BSWAP32) && !defined(WORDS_BIGENDIAN)
216 # undef TDS_GET_UA4BE
217 # define TDS_GET_UA4BE(ptr) TDS_BSWAP32(TDS_GET_UA4LE(ptr))
218 
219 # undef TDS_PUT_UA4BE
220 # define TDS_PUT_UA4BE(ptr,val) do {\
221  uint32_t _tds_i = TDS_BSWAP32(val); TDS_PUT_UA4LE(ptr,_tds_i); } while(0)
222 #elif defined(TDS_BSWAP32) && defined(WORDS_BIGENDIAN)
223 # undef TDS_GET_UA4LE
224 # define TDS_GET_UA4LE(ptr) TDS_BSWAP32(TDS_GET_UA4BE(ptr))
225 
226 # undef TDS_PUT_UA4LE
227 # define TDS_PUT_UA4LE(ptr,val) do {\
228  uint32_t _tds_i = TDS_BSWAP32(val); TDS_PUT_UA4BE(ptr,_tds_i); } while(0)
229 #endif
230 
231 #if defined(__GNUC__) && defined(__powerpc__) && defined(WORDS_BIGENDIAN)
232 # undef TDS_GET_UA2LE
233 # undef TDS_GET_UA4LE
234 static inline uint16_t
235 TDS_GET_UA2LE(void *ptr)
236 {
237  unsigned long res;
238  __asm__ ("lhbrx %0,0,%1\n" : "=r" (res) : "r" (ptr), "m"(*(uint16_t *)ptr));
239  return (uint16_t) res;
240 }
241 static inline uint32_t
242 TDS_GET_UA4LE(void *ptr)
243 {
244  unsigned long res;
245  __asm__ ("lwbrx %0,0,%1\n" : "=r" (res) : "r" (ptr), "m"(*(uint32_t *)ptr));
246  return (uint32_t) res;
247 }
248 
249 # undef TDS_PUT_UA2LE
250 # undef TDS_PUT_UA4LE
251 static inline void
252 TDS_PUT_UA2LE(void *ptr, unsigned data)
253 {
254  __asm__ ("sthbrx %1,0,%2\n" : "=m" (*(uint16_t *)ptr) : "r" (data), "r" (ptr));
255 }
256 static inline void
257 TDS_PUT_UA4LE(void *ptr, unsigned data)
258 {
259  __asm__ ("stwbrx %1,0,%2\n" : "=m" (*(uint32_t *)ptr) : "r" (data), "r" (ptr));
260 }
261 #endif
262 
263 #endif
Definition: bytes.h:87
freetds-1.3.6/doc/reference/a00389_source.html000644 025423 025423 00000055564 14162303413 022414 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/character_sets.h Source File
FreeTDS API
character_sets.h
1 /*
2  * These are the canonical names for character sets accepted by GNU iconv.
3  * See its documentation for the standard it follows.
4  *
5  * GNU iconv accepts other character set names, too, and your favorite operating system
6  * very likely uses still other names to represent the _same_ character set.
7  *
8  * Alternative character set names are mapped to these canonical ones in
9  * alternative_character_sets.h and are accessed with canonical_charset();
10  */
11  {"ISO-8859-1", 1, 1}
12  , {"UTF-8", 1, 4}
13  , {"UCS-2LE", 2, 2}
14  , {"UCS-2BE", 2, 2}
15  , {"UCS-2", 2, 2}
16  , {"US-ASCII", 1, 1}
17  , {"UCS-4", 4, 4}
18  , {"UCS-4BE", 4, 4}
19  , {"UCS-4LE", 4, 4}
20  , {"UTF-16", 2, 4}
21  , {"UTF-16BE", 2, 4}
22  , {"UTF-16LE", 2, 4}
23  , {"UTF-32", 4, 4}
24  , {"UTF-32BE", 4, 4}
25  , {"UTF-32LE", 4, 4}
26  , {"UTF-7", 1, 4}
27  , {"UCS-2-INTERNAL", 2, 2}
28  , {"UCS-2-SWAPPED", 2, 2}
29  , {"UCS-4-INTERNAL", 4, 4}
30  , {"UCS-4-SWAPPED", 4, 4}
31  , {"C99", 1, 1}
32  , {"JAVA", 1, 1}
33  , {"ISO-8859-2", 1, 1}
34  , {"ISO-8859-3", 1, 1}
35  , {"ISO-8859-4", 1, 1}
36  , {"ISO-8859-5", 1, 1}
37  , {"ISO-8859-6", 1, 1}
38  , {"ISO-8859-7", 1, 1}
39  , {"ISO-8859-8", 1, 1}
40  , {"ISO-8859-9", 1, 1}
41  , {"ISO-8859-10", 1, 1}
42  , {"ISO-8859-13", 1, 1}
43  , {"ISO-8859-14", 1, 1}
44  , {"ISO-8859-15", 1, 1}
45  , {"ISO-8859-16", 1, 1}
46  , {"KOI8-R", 1, 1}
47  , {"KOI8-U", 1, 1}
48  , {"KOI8-RU", 1, 1}
49  , {"CP1250", 1, 1}
50  , {"CP1251", 1, 1}
51  , {"CP1252", 1, 1}
52  , {"CP1253", 1, 1}
53  , {"CP1254", 1, 1}
54  , {"CP1255", 1, 1}
55  , {"CP1256", 1, 1}
56  , {"CP1257", 1, 1}
57  , {"CP1258", 1, 1}
58  , {"CP850", 1, 1}
59  , {"CP862", 1, 1}
60  , {"CP866", 1, 1}
61  , {"CP437", 1, 1}
62  , {"MAC", 1, 1}
63  , {"MACCENTRALEUROPE", 1, 1}
64  , {"MACICELAND", 1, 1}
65  , {"MACCROATIAN", 1, 1}
66  , {"MACROMANIA", 1, 1}
67  , {"MACCYRILLIC", 1, 1}
68  , {"MACUKRAINE", 1, 1}
69  , {"MACGREEK", 1, 1}
70  , {"MACTURKISH", 1, 1}
71  , {"MACHEBREW", 1, 1}
72  , {"MACARABIC", 1, 1}
73  , {"MACTHAI", 1, 1}
74  , {"ROMAN8", 1, 1}
75  , {"NEXTSTEP", 1, 1}
76  , {"ARMSCII-8", 1, 1}
77  , {"GEORGIAN-ACADEMY", 1, 1}
78  , {"GEORGIAN-PS", 1, 1}
79  , {"KOI8-T", 1, 1}
80  , {"MULELAO-1", 1, 1}
81  , {"CP1133", 1, 1}
82  , {"ISO-IR-166", 1, 1}
83  , {"CP874", 1, 1}
84  , {"CP936", 1, 2}
85  , {"CN", 1, 1}
86  , {"CP932", 1, 2}
87  , {"CN-GB", 1, 2}
88  , {"CP950", 1, 2}
89  , {"CP949", 1, 2}
90  , {"CP1361", 1, 2}
91  , {"BIG-5", 1, 2}
92  , {"BIG5-HKSCS", 1, 2}
93  , {"SJIS", 1, 2}
94  , {"EUC-KR", 1, 2}
95  , {"VISCII", 1, 1}
96  , {"ISO-IR-14", 1, 1}
97  , {"EUC-JP", 1, 3}
98  , {"EUC-TW", 1, 4}
99  , {"ISO-2022-JP", 1, 1}
100  , {"ISO-2022-KR", 1, 2}
101  , {"ISO-2022-CN", 1, 4}
102  , {"ISO-2022-CN-EXT", 1, 4}
103  , {"ISO-2022-JP-2", 1, 1}
104  , {"GB18030", 1, 4}
105  /*
106  * Beyond this point, I don't know the right answers.
107  * If you can provide the correct min/max (byte/char) values, please
108  * correct them if necessary and move them above the stopper row.
109  * Will the person vetting the last unknown row please turn off the lights?
110  * --jkl April 2003
111  */
112  , {"", 0, 0} /* stopper row */
113 
114  , {"TCVN", 1, 1}
115  , {"JISX0201-1976", 1, 1}
116  , {"ISO-IR-87", 1, 1}
117  , {"ISO-IR-159", 1, 1}
118  , {"CHINESE", 1, 1}
119  , {"CN-GB-ISOIR165", 1, 1}
120  , {"ISO-IR-149", 1, 1}
121  , {"ISO-2022-JP-1", 1, 1}
122  , {"HZ", 1, 1}
123  /* stopper row */
124  , {"", 0, 0}
125 
freetds-1.3.6/doc/reference/a00392_source.html000644 025423 025423 00001231316 14162303413 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/charset_lookup.h Source File
FreeTDS API
charset_lookup.h
1 /* ANSI-C code produced by gperf version 3.1 */
2 /* Command-line: /usr/pkg/bin/gperf -m 100 -C -K alias_pos -t -F ,-1 -P -H hash_charset -N charset_lookup -L ANSI-C charset_lookup.gperf */
3 /* Computed positions: -k'1,3-11,$' */
4 
5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6  && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7  && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8  && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9  && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10  && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11  && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12  && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13  && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14  && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15  && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16  && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17  && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18  && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19  && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20  && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21  && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22  && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23  && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24  && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25  && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26  && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27  && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646. */
29 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
30 #endif
31 
32 #line 3 "charset_lookup.gperf"
33 
34 static const struct charset_alias *charset_lookup(register const char *str, register size_t len);
35 #line 2 "charset_lookup.gperf"
36 struct charset_alias { short int alias_pos; short int canonic; };
37 
38 #define TOTAL_KEYWORDS 374
39 #define MIN_WORD_LENGTH 2
40 #define MAX_WORD_LENGTH 45
41 #define MIN_HASH_VALUE 15
42 #define MAX_HASH_VALUE 1079
43 /* maximum key range = 1065, duplicates = 0 */
44 
45 #ifdef __GNUC__
46 __inline
47 #else
48 #ifdef __cplusplus
49 inline
50 #endif
51 #endif
52 static unsigned int
53 hash_charset (register const char *str, register size_t len)
54 {
55  static const unsigned short asso_values[] =
56  {
57  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
58  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
59  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
60  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
61  1080, 1080, 1080, 1080, 1080, 7, 132, 1080, 56, 6,
62  47, 83, 35, 8, 18, 63, 7, 9, 363, 1080,
63  1080, 1080, 1080, 1080, 1080, 7, 99, 128, 6, 22,
64  141, 116, 95, 6, 34, 68, 7, 159, 6, 6,
65  80, 1080, 26, 6, 115, 191, 39, 162, 231, 14,
66  8, 1080, 1080, 1080, 1080, 37, 1080, 10, 16, 147,
67  1080, 16, 8, 12, 13, 6, 1080, 6, 1080, 8,
68  6, 6, 1080, 1080, 6, 7, 6, 19, 1080, 1080,
69  1080, 6, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
70  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
71  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
72  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
73  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
74  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
75  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
76  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
77  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
78  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
79  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
80  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
81  1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080,
82  1080, 1080, 1080, 1080, 1080, 1080
83  };
84  register unsigned int hval = len;
85 
86  switch (hval)
87  {
88  default:
89  hval += asso_values[(unsigned char)str[10]];
90  /*FALLTHROUGH*/
91  case 10:
92  hval += asso_values[(unsigned char)str[9]];
93  /*FALLTHROUGH*/
94  case 9:
95  hval += asso_values[(unsigned char)str[8]];
96  /*FALLTHROUGH*/
97  case 8:
98  hval += asso_values[(unsigned char)str[7]];
99  /*FALLTHROUGH*/
100  case 7:
101  hval += asso_values[(unsigned char)str[6]];
102  /*FALLTHROUGH*/
103  case 6:
104  hval += asso_values[(unsigned char)str[5]];
105  /*FALLTHROUGH*/
106  case 5:
107  hval += asso_values[(unsigned char)str[4]];
108  /*FALLTHROUGH*/
109  case 4:
110  hval += asso_values[(unsigned char)str[3]];
111  /*FALLTHROUGH*/
112  case 3:
113  hval += asso_values[(unsigned char)str[2]];
114  /*FALLTHROUGH*/
115  case 2:
116  case 1:
117  hval += asso_values[(unsigned char)str[0]];
118  break;
119  }
120  return hval + asso_values[(unsigned char)str[len - 1]];
121 }
122 
124  {
125  char stringpool_str15[sizeof("L1")];
126  char stringpool_str16[sizeof("L8")];
127  char stringpool_str17[sizeof("L5")];
128  char stringpool_str27[sizeof("L6")];
129  char stringpool_str28[sizeof("SJIS")];
130  char stringpool_str30[sizeof("koi8")];
131  char stringpool_str31[sizeof("sjis")];
132  char stringpool_str35[sizeof("R8")];
133  char stringpool_str36[sizeof("iso81")];
134  char stringpool_str38[sizeof("iso88")];
135  char stringpool_str39[sizeof("iso15")];
136  char stringpool_str40[sizeof("iso85")];
137  char stringpool_str41[sizeof("thai8")];
138  char stringpool_str42[sizeof("iso89")];
139  char stringpool_str43[sizeof("roma8")];
140  char stringpool_str44[sizeof("L4")];
141  char stringpool_str45[sizeof("utf8")];
142  char stringpool_str46[sizeof("866")];
143  char stringpool_str47[sizeof("iso815")];
144  char stringpool_str48[sizeof("big5")];
145  char stringpool_str50[sizeof("roman8")];
146  char stringpool_str56[sizeof("L2")];
147  char stringpool_str57[sizeof("646")];
148  char stringpool_str60[sizeof("iso86")];
149  char stringpool_str63[sizeof("iso88591")];
150  char stringpool_str65[sizeof("iso88598")];
151  char stringpool_str66[sizeof("iso_1")];
152  char stringpool_str67[sizeof("iso88595")];
153  char stringpool_str69[sizeof("iso88599")];
154  char stringpool_str70[sizeof("greek8")];
155  char stringpool_str71[sizeof("ISO8859-1")];
156  char stringpool_str72[sizeof("L7")];
157  char stringpool_str73[sizeof("ISO8859-8")];
158  char stringpool_str74[sizeof("iso885915")];
159  char stringpool_str75[sizeof("ISO8859-5")];
160  char stringpool_str77[sizeof("ISO8859-9")];
161  char stringpool_str79[sizeof("ISO-8859-1")];
162  char stringpool_str81[sizeof("ISO-8859-8")];
163  char stringpool_str82[sizeof("ISO8859-15")];
164  char stringpool_str83[sizeof("ISO-8859-5")];
165  char stringpool_str85[sizeof("ISO-8859-9")];
166  char stringpool_str87[sizeof("iso88596")];
167  char stringpool_str89[sizeof("ISO-IR-58")];
168  char stringpool_str90[sizeof("ISO-8859-15")];
169  char stringpool_str91[sizeof("JAVA")];
170  char stringpool_str92[sizeof("L3")];
171  char stringpool_str93[sizeof("iso14")];
172  char stringpool_str94[sizeof("iso84")];
173  char stringpool_str95[sizeof("ISO8859-6")];
174  char stringpool_str100[sizeof("ISO-IR-159")];
175  char stringpool_str101[sizeof("ISO-IR-199")];
176  char stringpool_str102[sizeof("ISO-IR-6")];
177  char stringpool_str103[sizeof("ISO-8859-6")];
178  char stringpool_str104[sizeof("862")];
179  char stringpool_str105[sizeof("HZ")];
180  char stringpool_str107[sizeof("iso646")];
181  char stringpool_str108[sizeof("ISO-IR-165")];
182  char stringpool_str109[sizeof("ISO_8859-1")];
183  char stringpool_str110[sizeof("ISO-8859-16")];
184  char stringpool_str111[sizeof("ISO_8859-8")];
185  char stringpool_str113[sizeof("ISO_8859-5")];
186  char stringpool_str115[sizeof("ISO_8859-9")];
187  char stringpool_str116[sizeof("JP")];
188  char stringpool_str118[sizeof("iso82")];
189  char stringpool_str120[sizeof("ISO_8859-15")];
190  char stringpool_str121[sizeof("iso88594")];
191  char stringpool_str122[sizeof("850")];
192  char stringpool_str123[sizeof("ISO-IR-148")];
193  char stringpool_str124[sizeof("ISO_8859-15:1998")];
194  char stringpool_str127[sizeof("ISO-IR-149")];
195  char stringpool_str128[sizeof("ISO-IR-166")];
196  char stringpool_str129[sizeof("ISO8859-4")];
197  char stringpool_str133[sizeof("ISO_8859-6")];
198  char stringpool_str135[sizeof("iso10")];
199  char stringpool_str136[sizeof("CN")];
200  char stringpool_str137[sizeof("ISO-8859-4")];
201  char stringpool_str140[sizeof("ISO_8859-16")];
202  char stringpool_str141[sizeof("KOREAN")];
203  char stringpool_str142[sizeof("ISO-IR-101")];
204  char stringpool_str143[sizeof("ISO-IR-14")];
205  char stringpool_str144[sizeof("ISO-8859-14")];
206  char stringpool_str145[sizeof("iso88592")];
207  char stringpool_str146[sizeof("KOI8-R")];
208  char stringpool_str148[sizeof("ISO-IR-109")];
209  char stringpool_str149[sizeof("C99")];
210  char stringpool_str150[sizeof("iso87")];
211  char stringpool_str151[sizeof("ISO_8859-14:1998")];
212  char stringpool_str152[sizeof("LATIN1")];
213  char stringpool_str153[sizeof("ISO8859-2")];
214  char stringpool_str154[sizeof("LATIN8")];
215  char stringpool_str155[sizeof("ISO-IR-179")];
216  char stringpool_str156[sizeof("LATIN5")];
217  char stringpool_str157[sizeof("ISO-IR-126")];
218  char stringpool_str158[sizeof("ASCII")];
219  char stringpool_str161[sizeof("ISO-8859-2")];
220  char stringpool_str164[sizeof("CP819")];
221  char stringpool_str167[sizeof("ISO_8859-4")];
222  char stringpool_str170[sizeof("TCVN")];
223  char stringpool_str171[sizeof("ISO-IR-138")];
224  char stringpool_str173[sizeof("hp15CN")];
225  char stringpool_str174[sizeof("ISO_8859-14")];
226  char stringpool_str176[sizeof("LATIN6")];
227  char stringpool_str177[sizeof("iso88597")];
228  char stringpool_str178[sizeof("ISO8859-10")];
229  char stringpool_str179[sizeof("ISO-IR-144")];
230  char stringpool_str183[sizeof("ISO_8859-16:2000")];
231  char stringpool_str185[sizeof("ISO8859-7")];
232  char stringpool_str186[sizeof("ISO-8859-10")];
233  char stringpool_str189[sizeof("iso13")];
234  char stringpool_str190[sizeof("iso83")];
235  char stringpool_str191[sizeof("ISO_8859-2")];
236  char stringpool_str192[sizeof("ISO-IR-110")];
237  char stringpool_str193[sizeof("ISO-8859-7")];
238  char stringpool_str194[sizeof("CP866")];
239  char stringpool_str195[sizeof("CP949")];
240  char stringpool_str196[sizeof("tis620")];
241  char stringpool_str197[sizeof("VISCII")];
242  char stringpool_str198[sizeof("ISO-IR-226")];
243  char stringpool_str199[sizeof("US")];
244  char stringpool_str200[sizeof("ISO-IR-87")];
245  char stringpool_str201[sizeof("ISO-IR-57")];
246  char stringpool_str202[sizeof("IBM819")];
247  char stringpool_str203[sizeof("macthai")];
248  char stringpool_str204[sizeof("MS-ANSI")];
249  char stringpool_str205[sizeof("macturk")];
250  char stringpool_str207[sizeof("CP1251")];
251  char stringpool_str208[sizeof("ISO-IR-157")];
252  char stringpool_str209[sizeof("CP1258")];
253  char stringpool_str210[sizeof("LATIN4")];
254  char stringpool_str211[sizeof("CP1255")];
255  char stringpool_str212[sizeof("ISO_8859-10:1992")];
256  char stringpool_str213[sizeof("cp866")];
257  char stringpool_str214[sizeof("cp949")];
258  char stringpool_str216[sizeof("ISO_8859-10")];
259  char stringpool_str217[sizeof("iso88593")];
260  char stringpool_str218[sizeof("ROMAN8")];
261  char stringpool_str219[sizeof("CHINESE")];
262  char stringpool_str220[sizeof("JIS0208")];
263  char stringpool_str223[sizeof("ISO_8859-7")];
264  char stringpool_str225[sizeof("macgreek")];
265  char stringpool_str226[sizeof("cp1251")];
266  char stringpool_str227[sizeof("ascii_8")];
267  char stringpool_str228[sizeof("cp1258")];
268  char stringpool_str229[sizeof("ECMA-118")];
269  char stringpool_str230[sizeof("cp1255")];
270  char stringpool_str231[sizeof("CP1256")];
271  char stringpool_str232[sizeof("IBM866")];
272  char stringpool_str233[sizeof("ISO-8859-3")];
273  char stringpool_str234[sizeof("LATIN2")];
274  char stringpool_str235[sizeof("BIG5")];
275  char stringpool_str236[sizeof("MULELAO-1")];
276  char stringpool_str237[sizeof("MS-EE")];
277  char stringpool_str239[sizeof("ISO646-CN")];
278  char stringpool_str240[sizeof("ISO-8859-13")];
279  char stringpool_str242[sizeof("ISO-IR-100")];
280  char stringpool_str243[sizeof("BIG-5")];
281  char stringpool_str247[sizeof("ISO-IR-127")];
282  char stringpool_str248[sizeof("GREEK8")];
283  char stringpool_str250[sizeof("cp1256")];
284  char stringpool_str252[sizeof("CP862")];
285  char stringpool_str253[sizeof("CP1361")];
286  char stringpool_str255[sizeof("GBK")];
287  char stringpool_str258[sizeof("ELOT_928")];
288  char stringpool_str260[sizeof("CP850")];
289  char stringpool_str261[sizeof("CP936")];
290  char stringpool_str262[sizeof("CP950")];
291  char stringpool_str263[sizeof("ISO_8859-3")];
292  char stringpool_str265[sizeof("CP1254")];
293  char stringpool_str266[sizeof("LATIN7")];
294  char stringpool_str270[sizeof("ISO_8859-13")];
295  char stringpool_str271[sizeof("cp862")];
296  char stringpool_str273[sizeof("CP874")];
297  char stringpool_str274[sizeof("CSKOI8R")];
298  char stringpool_str275[sizeof("EUCKR")];
299  char stringpool_str279[sizeof("cp850")];
300  char stringpool_str280[sizeof("cp936")];
301  char stringpool_str281[sizeof("cp950")];
302  char stringpool_str283[sizeof("EUC-KR")];
303  char stringpool_str284[sizeof("cp1254")];
304  char stringpool_str285[sizeof("ECMA-114")];
305  char stringpool_str288[sizeof("eucKR")];
306  char stringpool_str289[sizeof("CP1252")];
307  char stringpool_str290[sizeof("IBM862")];
308  char stringpool_str291[sizeof("CSISO159JISX02121990")];
309  char stringpool_str292[sizeof("cp874")];
310  char stringpool_str293[sizeof("ISO646-JP")];
311  char stringpool_str294[sizeof("CSASCII")];
312  char stringpool_str295[sizeof("EUCCN")];
313  char stringpool_str297[sizeof("UCS-4LE")];
314  char stringpool_str298[sizeof("IBM850")];
315  char stringpool_str301[sizeof("GREEK")];
316  char stringpool_str302[sizeof("ISO646-US")];
317  char stringpool_str303[sizeof("EUC-CN")];
318  char stringpool_str304[sizeof("TIS620")];
319  char stringpool_str305[sizeof("mac")];
320  char stringpool_str306[sizeof("LATIN3")];
321  char stringpool_str307[sizeof("CP1250")];
322  char stringpool_str308[sizeof("cp1252")];
323  char stringpool_str309[sizeof("UCS-2LE")];
324  char stringpool_str310[sizeof("CSISOLATIN1")];
325  char stringpool_str312[sizeof("TIS-620")];
326  char stringpool_str313[sizeof("TCVN5712-1")];
327  char stringpool_str314[sizeof("CSISOLATIN5")];
328  char stringpool_str318[sizeof("GB_1988-80")];
329  char stringpool_str319[sizeof("CP932")];
330  char stringpool_str320[sizeof("ASMO-708")];
331  char stringpool_str321[sizeof("CP1257")];
332  char stringpool_str324[sizeof("KOI8-T")];
333  char stringpool_str326[sizeof("cp1250")];
334  char stringpool_str329[sizeof("HP-ROMAN8")];
335  char stringpool_str331[sizeof("MS_KANJI")];
336  char stringpool_str333[sizeof("CSVISCII")];
337  char stringpool_str334[sizeof("CSISOLATIN6")];
338  char stringpool_str335[sizeof("KSC_5601")];
339  char stringpool_str336[sizeof("SHIFT-JIS")];
340  char stringpool_str337[sizeof("ISO-IR-203")];
341  char stringpool_str338[sizeof("cp932")];
342  char stringpool_str339[sizeof("JOHAB")];
343  char stringpool_str340[sizeof("cp1257")];
344  char stringpool_str342[sizeof("ARMSCII-8")];
345  char stringpool_str345[sizeof("ISO_646.IRV:1991")];
346  char stringpool_str347[sizeof("TCVN-5712")];
347  char stringpool_str349[sizeof("EUCJP")];
348  char stringpool_str350[sizeof("UTF8")];
349  char stringpool_str351[sizeof("X0201")];
350  char stringpool_str352[sizeof("GB2312")];
351  char stringpool_str353[sizeof("X0208")];
352  char stringpool_str354[sizeof("ISO-2022-KR")];
353  char stringpool_str355[sizeof("MS-CYRL")];
354  char stringpool_str356[sizeof("ISO-2022-JP-1")];
355  char stringpool_str357[sizeof("EUC-JP")];
356  char stringpool_str358[sizeof("UTF-8")];
357  char stringpool_str359[sizeof("VISCII1.1-1")];
358  char stringpool_str360[sizeof("CP367")];
359  char stringpool_str361[sizeof("CP1253")];
360  char stringpool_str362[sizeof("eucJP")];
361  char stringpool_str364[sizeof("mac_cyr")];
362  char stringpool_str365[sizeof("US-ASCII")];
363  char stringpool_str366[sizeof("SHIFT_JIS")];
364  char stringpool_str368[sizeof("CSISOLATIN4")];
365  char stringpool_str369[sizeof("TIS620-0")];
366  char stringpool_str371[sizeof("CSBIG5")];
367  char stringpool_str374[sizeof("ISO-2022-CN")];
368  char stringpool_str377[sizeof("CP437")];
369  char stringpool_str379[sizeof("CN-BIG5")];
370  char stringpool_str380[sizeof("cp1253")];
371  char stringpool_str381[sizeof("ARABIC")];
372  char stringpool_str383[sizeof("X0212")];
373  char stringpool_str384[sizeof("CSISO14JISC6220RO")];
374  char stringpool_str387[sizeof("GB18030")];
375  char stringpool_str389[sizeof("UCS-4BE")];
376  char stringpool_str392[sizeof("CSISOLATIN2")];
377  char stringpool_str393[sizeof("GEORGIAN-PS")];
378  char stringpool_str394[sizeof("KS_C_5601-1989")];
379  char stringpool_str395[sizeof("CP1133")];
380  char stringpool_str396[sizeof("cp437")];
381  char stringpool_str397[sizeof("ISO-2022-JP-2")];
382  char stringpool_str398[sizeof("IBM367")];
383  char stringpool_str401[sizeof("UCS-2BE")];
384  char stringpool_str402[sizeof("UNICODE-1-1")];
385  char stringpool_str409[sizeof("JIS_C6220-1969-RO")];
386  char stringpool_str411[sizeof("MS-ARAB")];
387  char stringpool_str415[sizeof("IBM437")];
388  char stringpool_str418[sizeof("MAC")];
389  char stringpool_str422[sizeof("UTF-16LE")];
390  char stringpool_str428[sizeof("ISO-2022-JP")];
391  char stringpool_str429[sizeof("CN-GB-ISOIR165")];
392  char stringpool_str434[sizeof("WINDOWS-1251")];
393  char stringpool_str435[sizeof("WINDOWS-1258")];
394  char stringpool_str436[sizeof("WINDOWS-1255")];
395  char stringpool_str438[sizeof("CSISOLATINARABIC")];
396  char stringpool_str441[sizeof("MS-HEBR")];
397  char stringpool_str444[sizeof("CYRILLIC")];
398  char stringpool_str445[sizeof("JIS_C6226-1983")];
399  char stringpool_str446[sizeof("WINDOWS-1256")];
400  char stringpool_str448[sizeof("KS_C_5601-1987")];
401  char stringpool_str450[sizeof("UHC")];
402  char stringpool_str452[sizeof("BIGFIVE")];
403  char stringpool_str454[sizeof("CN-GB")];
404  char stringpool_str455[sizeof("GEORGIAN-ACADEMY")];
405  char stringpool_str460[sizeof("BIG-FIVE")];
406  char stringpool_str461[sizeof("CSIBM866")];
407  char stringpool_str462[sizeof("UTF7")];
408  char stringpool_str463[sizeof("WINDOWS-1254")];
409  char stringpool_str464[sizeof("CSISOLATIN3")];
410  char stringpool_str465[sizeof("UNICODE-1-1-UTF-7")];
411  char stringpool_str467[sizeof("CSISO57GB1988")];
412  char stringpool_str470[sizeof("UTF-7")];
413  char stringpool_str472[sizeof("GB_2312-80")];
414  char stringpool_str474[sizeof("CSISO2022KR")];
415  char stringpool_str475[sizeof("WINDOWS-1252")];
416  char stringpool_str476[sizeof("KOI8-U")];
417  char stringpool_str479[sizeof("ISO_8859-8:1988")];
418  char stringpool_str480[sizeof("ISO_8859-5:1988")];
419  char stringpool_str483[sizeof("ISO_8859-9:1989")];
420  char stringpool_str484[sizeof("WINDOWS-1250")];
421  char stringpool_str485[sizeof("MACICELAND")];
422  char stringpool_str486[sizeof("CSISOLATINGREEK")];
423  char stringpool_str487[sizeof("ISO-2022-CN-EXT")];
424  char stringpool_str488[sizeof("JIS_X0201")];
425  char stringpool_str489[sizeof("JISX0201-1976")];
426  char stringpool_str490[sizeof("JIS_X0208")];
427  char stringpool_str491[sizeof("WINDOWS-1257")];
428  char stringpool_str494[sizeof("CSISO2022CN")];
429  char stringpool_str496[sizeof("MS-GREEK")];
430  char stringpool_str500[sizeof("EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE")];
431  char stringpool_str503[sizeof("KOI8-RU")];
432  char stringpool_str504[sizeof("TIS620.2529-1")];
433  char stringpool_str505[sizeof("MACROMAN")];
434  char stringpool_str506[sizeof("WINDOWS-874")];
435  char stringpool_str507[sizeof("ISO_8859-4:1988")];
436  char stringpool_str509[sizeof("CSKSC56011987")];
437  char stringpool_str511[sizeof("WINDOWS-1253")];
438  char stringpool_str514[sizeof("UTF-16BE")];
439  char stringpool_str515[sizeof("CSISO87JISX0208")];
440  char stringpool_str516[sizeof("CSISO2022JP2")];
441  char stringpool_str520[sizeof("JIS_X0212")];
442  char stringpool_str521[sizeof("MACROMANIA")];
443  char stringpool_str522[sizeof("CSUNICODE11")];
444  char stringpool_str523[sizeof("MACTHAI")];
445  char stringpool_str528[sizeof("UTF-32LE")];
446  char stringpool_str531[sizeof("CSHPROMAN8")];
447  char stringpool_str534[sizeof("ISO_8859-1:1987")];
448  char stringpool_str541[sizeof("BIG5HKSCS")];
449  char stringpool_str546[sizeof("ISO_8859-6:1987")];
450  char stringpool_str547[sizeof("JIS_X0212-1990")];
451  char stringpool_str548[sizeof("CSISO2022JP")];
452  char stringpool_str549[sizeof("BIG5-HKSCS")];
453  char stringpool_str553[sizeof("CSSHIFTJIS")];
454  char stringpool_str555[sizeof("ISO_8859-3:1988")];
455  char stringpool_str557[sizeof("JIS_X0208-1990")];
456  char stringpool_str560[sizeof("CSISOLATINHEBREW")];
457  char stringpool_str561[sizeof("CSISOLATINCYRILLIC")];
458  char stringpool_str563[sizeof("ISO-CELTIC")];
459  char stringpool_str564[sizeof("HZ-GB-2312")];
460  char stringpool_str571[sizeof("ANSI_X3.4-1968")];
461  char stringpool_str572[sizeof("HEBREW")];
462  char stringpool_str575[sizeof("ISO_8859-2:1987")];
463  char stringpool_str577[sizeof("CSISO58GB231280")];
464  char stringpool_str581[sizeof("CSGB2312")];
465  char stringpool_str582[sizeof("ANSI_X3.4-1986")];
466  char stringpool_str583[sizeof("CSUNICODE11UTF7")];
467  char stringpool_str584[sizeof("JIS_X0208-1983")];
468  char stringpool_str591[sizeof("ISO_8859-7:1987")];
469  char stringpool_str594[sizeof("EUCTW")];
470  char stringpool_str596[sizeof("CSEUCKR")];
471  char stringpool_str602[sizeof("EUC-TW")];
472  char stringpool_str605[sizeof("MACCROATIAN")];
473  char stringpool_str607[sizeof("eucTW")];
474  char stringpool_str614[sizeof("TIS620.2533-1")];
475  char stringpool_str617[sizeof("MACGREEK")];
476  char stringpool_str620[sizeof("UTF-32BE")];
477  char stringpool_str625[sizeof("MACINTOSH")];
478  char stringpool_str637[sizeof("UNICODELITTLE")];
479  char stringpool_str641[sizeof("MS-TURK")];
480  char stringpool_str645[sizeof("MACUKRAINE")];
481  char stringpool_str651[sizeof("IBM-CP1133")];
482  char stringpool_str658[sizeof("MACCENTRALEUROPE")];
483  char stringpool_str663[sizeof("NEXTSTEP")];
484  char stringpool_str664[sizeof("TIS620.2533-0")];
485  char stringpool_str674[sizeof("JIS_X0212.1990-0")];
486  char stringpool_str697[sizeof("MACARABIC")];
487  char stringpool_str706[sizeof("UNICODEBIG")];
488  char stringpool_str723[sizeof("CSPC862LATINHEBREW")];
489  char stringpool_str748[sizeof("MACCYRILLIC")];
490  char stringpool_str756[sizeof("WINBALTRIM")];
491  char stringpool_str758[sizeof("TCVN5712-1:1993")];
492  char stringpool_str762[sizeof("CSMACINTOSH")];
493  char stringpool_str788[sizeof("CSHALFWIDTHKATAKANA")];
494  char stringpool_str884[sizeof("MACHEBREW")];
495  char stringpool_str899[sizeof("MACTURKISH")];
496  char stringpool_str905[sizeof("CSPC850MULTILINGUAL")];
497  char stringpool_str915[sizeof("CSEUCTW")];
498  char stringpool_str1079[sizeof("CSEUCPKDFMTJAPANESE")];
499  };
500 static const struct stringpool_t stringpool_contents =
501  {
502  "L1",
503  "L8",
504  "L5",
505  "L6",
506  "SJIS",
507  "koi8",
508  "sjis",
509  "R8",
510  "iso81",
511  "iso88",
512  "iso15",
513  "iso85",
514  "thai8",
515  "iso89",
516  "roma8",
517  "L4",
518  "utf8",
519  "866",
520  "iso815",
521  "big5",
522  "roman8",
523  "L2",
524  "646",
525  "iso86",
526  "iso88591",
527  "iso88598",
528  "iso_1",
529  "iso88595",
530  "iso88599",
531  "greek8",
532  "ISO8859-1",
533  "L7",
534  "ISO8859-8",
535  "iso885915",
536  "ISO8859-5",
537  "ISO8859-9",
538  "ISO-8859-1",
539  "ISO-8859-8",
540  "ISO8859-15",
541  "ISO-8859-5",
542  "ISO-8859-9",
543  "iso88596",
544  "ISO-IR-58",
545  "ISO-8859-15",
546  "JAVA",
547  "L3",
548  "iso14",
549  "iso84",
550  "ISO8859-6",
551  "ISO-IR-159",
552  "ISO-IR-199",
553  "ISO-IR-6",
554  "ISO-8859-6",
555  "862",
556  "HZ",
557  "iso646",
558  "ISO-IR-165",
559  "ISO_8859-1",
560  "ISO-8859-16",
561  "ISO_8859-8",
562  "ISO_8859-5",
563  "ISO_8859-9",
564  "JP",
565  "iso82",
566  "ISO_8859-15",
567  "iso88594",
568  "850",
569  "ISO-IR-148",
570  "ISO_8859-15:1998",
571  "ISO-IR-149",
572  "ISO-IR-166",
573  "ISO8859-4",
574  "ISO_8859-6",
575  "iso10",
576  "CN",
577  "ISO-8859-4",
578  "ISO_8859-16",
579  "KOREAN",
580  "ISO-IR-101",
581  "ISO-IR-14",
582  "ISO-8859-14",
583  "iso88592",
584  "KOI8-R",
585  "ISO-IR-109",
586  "C99",
587  "iso87",
588  "ISO_8859-14:1998",
589  "LATIN1",
590  "ISO8859-2",
591  "LATIN8",
592  "ISO-IR-179",
593  "LATIN5",
594  "ISO-IR-126",
595  "ASCII",
596  "ISO-8859-2",
597  "CP819",
598  "ISO_8859-4",
599  "TCVN",
600  "ISO-IR-138",
601  "hp15CN",
602  "ISO_8859-14",
603  "LATIN6",
604  "iso88597",
605  "ISO8859-10",
606  "ISO-IR-144",
607  "ISO_8859-16:2000",
608  "ISO8859-7",
609  "ISO-8859-10",
610  "iso13",
611  "iso83",
612  "ISO_8859-2",
613  "ISO-IR-110",
614  "ISO-8859-7",
615  "CP866",
616  "CP949",
617  "tis620",
618  "VISCII",
619  "ISO-IR-226",
620  "US",
621  "ISO-IR-87",
622  "ISO-IR-57",
623  "IBM819",
624  "macthai",
625  "MS-ANSI",
626  "macturk",
627  "CP1251",
628  "ISO-IR-157",
629  "CP1258",
630  "LATIN4",
631  "CP1255",
632  "ISO_8859-10:1992",
633  "cp866",
634  "cp949",
635  "ISO_8859-10",
636  "iso88593",
637  "ROMAN8",
638  "CHINESE",
639  "JIS0208",
640  "ISO_8859-7",
641  "macgreek",
642  "cp1251",
643  "ascii_8",
644  "cp1258",
645  "ECMA-118",
646  "cp1255",
647  "CP1256",
648  "IBM866",
649  "ISO-8859-3",
650  "LATIN2",
651  "BIG5",
652  "MULELAO-1",
653  "MS-EE",
654  "ISO646-CN",
655  "ISO-8859-13",
656  "ISO-IR-100",
657  "BIG-5",
658  "ISO-IR-127",
659  "GREEK8",
660  "cp1256",
661  "CP862",
662  "CP1361",
663  "GBK",
664  "ELOT_928",
665  "CP850",
666  "CP936",
667  "CP950",
668  "ISO_8859-3",
669  "CP1254",
670  "LATIN7",
671  "ISO_8859-13",
672  "cp862",
673  "CP874",
674  "CSKOI8R",
675  "EUCKR",
676  "cp850",
677  "cp936",
678  "cp950",
679  "EUC-KR",
680  "cp1254",
681  "ECMA-114",
682  "eucKR",
683  "CP1252",
684  "IBM862",
685  "CSISO159JISX02121990",
686  "cp874",
687  "ISO646-JP",
688  "CSASCII",
689  "EUCCN",
690  "UCS-4LE",
691  "IBM850",
692  "GREEK",
693  "ISO646-US",
694  "EUC-CN",
695  "TIS620",
696  "mac",
697  "LATIN3",
698  "CP1250",
699  "cp1252",
700  "UCS-2LE",
701  "CSISOLATIN1",
702  "TIS-620",
703  "TCVN5712-1",
704  "CSISOLATIN5",
705  "GB_1988-80",
706  "CP932",
707  "ASMO-708",
708  "CP1257",
709  "KOI8-T",
710  "cp1250",
711  "HP-ROMAN8",
712  "MS_KANJI",
713  "CSVISCII",
714  "CSISOLATIN6",
715  "KSC_5601",
716  "SHIFT-JIS",
717  "ISO-IR-203",
718  "cp932",
719  "JOHAB",
720  "cp1257",
721  "ARMSCII-8",
722  "ISO_646.IRV:1991",
723  "TCVN-5712",
724  "EUCJP",
725  "UTF8",
726  "X0201",
727  "GB2312",
728  "X0208",
729  "ISO-2022-KR",
730  "MS-CYRL",
731  "ISO-2022-JP-1",
732  "EUC-JP",
733  "UTF-8",
734  "VISCII1.1-1",
735  "CP367",
736  "CP1253",
737  "eucJP",
738  "mac_cyr",
739  "US-ASCII",
740  "SHIFT_JIS",
741  "CSISOLATIN4",
742  "TIS620-0",
743  "CSBIG5",
744  "ISO-2022-CN",
745  "CP437",
746  "CN-BIG5",
747  "cp1253",
748  "ARABIC",
749  "X0212",
750  "CSISO14JISC6220RO",
751  "GB18030",
752  "UCS-4BE",
753  "CSISOLATIN2",
754  "GEORGIAN-PS",
755  "KS_C_5601-1989",
756  "CP1133",
757  "cp437",
758  "ISO-2022-JP-2",
759  "IBM367",
760  "UCS-2BE",
761  "UNICODE-1-1",
762  "JIS_C6220-1969-RO",
763  "MS-ARAB",
764  "IBM437",
765  "MAC",
766  "UTF-16LE",
767  "ISO-2022-JP",
768  "CN-GB-ISOIR165",
769  "WINDOWS-1251",
770  "WINDOWS-1258",
771  "WINDOWS-1255",
772  "CSISOLATINARABIC",
773  "MS-HEBR",
774  "CYRILLIC",
775  "JIS_C6226-1983",
776  "WINDOWS-1256",
777  "KS_C_5601-1987",
778  "UHC",
779  "BIGFIVE",
780  "CN-GB",
781  "GEORGIAN-ACADEMY",
782  "BIG-FIVE",
783  "CSIBM866",
784  "UTF7",
785  "WINDOWS-1254",
786  "CSISOLATIN3",
787  "UNICODE-1-1-UTF-7",
788  "CSISO57GB1988",
789  "UTF-7",
790  "GB_2312-80",
791  "CSISO2022KR",
792  "WINDOWS-1252",
793  "KOI8-U",
794  "ISO_8859-8:1988",
795  "ISO_8859-5:1988",
796  "ISO_8859-9:1989",
797  "WINDOWS-1250",
798  "MACICELAND",
799  "CSISOLATINGREEK",
800  "ISO-2022-CN-EXT",
801  "JIS_X0201",
802  "JISX0201-1976",
803  "JIS_X0208",
804  "WINDOWS-1257",
805  "CSISO2022CN",
806  "MS-GREEK",
807  "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE",
808  "KOI8-RU",
809  "TIS620.2529-1",
810  "MACROMAN",
811  "WINDOWS-874",
812  "ISO_8859-4:1988",
813  "CSKSC56011987",
814  "WINDOWS-1253",
815  "UTF-16BE",
816  "CSISO87JISX0208",
817  "CSISO2022JP2",
818  "JIS_X0212",
819  "MACROMANIA",
820  "CSUNICODE11",
821  "MACTHAI",
822  "UTF-32LE",
823  "CSHPROMAN8",
824  "ISO_8859-1:1987",
825  "BIG5HKSCS",
826  "ISO_8859-6:1987",
827  "JIS_X0212-1990",
828  "CSISO2022JP",
829  "BIG5-HKSCS",
830  "CSSHIFTJIS",
831  "ISO_8859-3:1988",
832  "JIS_X0208-1990",
833  "CSISOLATINHEBREW",
834  "CSISOLATINCYRILLIC",
835  "ISO-CELTIC",
836  "HZ-GB-2312",
837  "ANSI_X3.4-1968",
838  "HEBREW",
839  "ISO_8859-2:1987",
840  "CSISO58GB231280",
841  "CSGB2312",
842  "ANSI_X3.4-1986",
843  "CSUNICODE11UTF7",
844  "JIS_X0208-1983",
845  "ISO_8859-7:1987",
846  "EUCTW",
847  "CSEUCKR",
848  "EUC-TW",
849  "MACCROATIAN",
850  "eucTW",
851  "TIS620.2533-1",
852  "MACGREEK",
853  "UTF-32BE",
854  "MACINTOSH",
855  "UNICODELITTLE",
856  "MS-TURK",
857  "MACUKRAINE",
858  "IBM-CP1133",
859  "MACCENTRALEUROPE",
860  "NEXTSTEP",
861  "TIS620.2533-0",
862  "JIS_X0212.1990-0",
863  "MACARABIC",
864  "UNICODEBIG",
865  "CSPC862LATINHEBREW",
866  "MACCYRILLIC",
867  "WINBALTRIM",
868  "TCVN5712-1:1993",
869  "CSMACINTOSH",
870  "CSHALFWIDTHKATAKANA",
871  "MACHEBREW",
872  "MACTURKISH",
873  "CSPC850MULTILINGUAL",
874  "CSEUCTW",
875  "CSEUCPKDFMTJAPANESE"
876  };
877 #define stringpool ((const char *) &stringpool_contents)
878 const struct charset_alias *
879 charset_lookup (register const char *str, register size_t len)
880 {
881  static const struct charset_alias wordlist[] =
882  {
883  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
884  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
885  {-1,-1}, {-1,-1}, {-1,-1},
886 #line 228 "charset_lookup.gperf"
887  {(int)offsetof(struct stringpool_t, stringpool_str15), 0},
888 #line 235 "charset_lookup.gperf"
889  {(int)offsetof(struct stringpool_t, stringpool_str16), 47},
890 #line 232 "charset_lookup.gperf"
891  {(int)offsetof(struct stringpool_t, stringpool_str17), 57},
892  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
893  {-1,-1}, {-1,-1}, {-1,-1},
894 #line 233 "charset_lookup.gperf"
895  {(int)offsetof(struct stringpool_t, stringpool_str27), 45},
896 #line 272 "charset_lookup.gperf"
897  {(int)offsetof(struct stringpool_t, stringpool_str28), 84},
898  {-1,-1},
899 #line 375 "charset_lookup.gperf"
900  {(int)offsetof(struct stringpool_t, stringpool_str30), 65},
901 #line 359 "charset_lookup.gperf"
902  {(int)offsetof(struct stringpool_t, stringpool_str31), 84},
903  {-1,-1}, {-1,-1}, {-1,-1},
904 #line 268 "charset_lookup.gperf"
905  {(int)offsetof(struct stringpool_t, stringpool_str35), 83},
906 #line 337 "charset_lookup.gperf"
907  {(int)offsetof(struct stringpool_t, stringpool_str36), 0},
908  {-1,-1},
909 #line 345 "charset_lookup.gperf"
910  {(int)offsetof(struct stringpool_t, stringpool_str38), 56},
911 #line 372 "charset_lookup.gperf"
912  {(int)offsetof(struct stringpool_t, stringpool_str39), 48},
913 #line 342 "charset_lookup.gperf"
914  {(int)offsetof(struct stringpool_t, stringpool_str40), 53},
915 #line 360 "charset_lookup.gperf"
916  {(int)offsetof(struct stringpool_t, stringpool_str41), 61},
917 #line 356 "charset_lookup.gperf"
918  {(int)offsetof(struct stringpool_t, stringpool_str42), 57},
919 #line 357 "charset_lookup.gperf"
920  {(int)offsetof(struct stringpool_t, stringpool_str43), 83},
921 #line 231 "charset_lookup.gperf"
922  {(int)offsetof(struct stringpool_t, stringpool_str44), 52},
923 #line 362 "charset_lookup.gperf"
924  {(int)offsetof(struct stringpool_t, stringpool_str45), 1},
925 #line 10 "charset_lookup.gperf"
926  {(int)offsetof(struct stringpool_t, stringpool_str46), 26},
927 #line 338 "charset_lookup.gperf"
928  {(int)offsetof(struct stringpool_t, stringpool_str47), 48},
929 #line 318 "charset_lookup.gperf"
930  {(int)offsetof(struct stringpool_t, stringpool_str48), 5},
931  {-1,-1},
932 #line 358 "charset_lookup.gperf"
933  {(int)offsetof(struct stringpool_t, stringpool_str50), 83},
934  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
935 #line 229 "charset_lookup.gperf"
936  {(int)offsetof(struct stringpool_t, stringpool_str56), 50},
937 #line 7 "charset_lookup.gperf"
938  {(int)offsetof(struct stringpool_t, stringpool_str57), 88},
939  {-1,-1}, {-1,-1},
940 #line 343 "charset_lookup.gperf"
941  {(int)offsetof(struct stringpool_t, stringpool_str60), 54},
942  {-1,-1}, {-1,-1},
943 #line 346 "charset_lookup.gperf"
944  {(int)offsetof(struct stringpool_t, stringpool_str63), 0},
945  {-1,-1},
946 #line 354 "charset_lookup.gperf"
947  {(int)offsetof(struct stringpool_t, stringpool_str65), 56},
948 #line 374 "charset_lookup.gperf"
949  {(int)offsetof(struct stringpool_t, stringpool_str66), 0},
950 #line 351 "charset_lookup.gperf"
951  {(int)offsetof(struct stringpool_t, stringpool_str67), 53},
952  {-1,-1},
953 #line 355 "charset_lookup.gperf"
954  {(int)offsetof(struct stringpool_t, stringpool_str69), 57},
955 #line 368 "charset_lookup.gperf"
956  {(int)offsetof(struct stringpool_t, stringpool_str70), 55},
957 #line 168 "charset_lookup.gperf"
958  {(int)offsetof(struct stringpool_t, stringpool_str71), 0},
959 #line 234 "charset_lookup.gperf"
960  {(int)offsetof(struct stringpool_t, stringpool_str72), 46},
961 #line 176 "charset_lookup.gperf"
962  {(int)offsetof(struct stringpool_t, stringpool_str73), 56},
963 #line 347 "charset_lookup.gperf"
964  {(int)offsetof(struct stringpool_t, stringpool_str74), 48},
965 #line 173 "charset_lookup.gperf"
966  {(int)offsetof(struct stringpool_t, stringpool_str75), 53},
967  {-1,-1},
968 #line 177 "charset_lookup.gperf"
969  {(int)offsetof(struct stringpool_t, stringpool_str77), 57},
970  {-1,-1},
971 #line 127 "charset_lookup.gperf"
972  {(int)offsetof(struct stringpool_t, stringpool_str79), 0},
973  {-1,-1},
974 #line 139 "charset_lookup.gperf"
975  {(int)offsetof(struct stringpool_t, stringpool_str81), 56},
976 #line 170 "charset_lookup.gperf"
977  {(int)offsetof(struct stringpool_t, stringpool_str82), 48},
978 #line 136 "charset_lookup.gperf"
979  {(int)offsetof(struct stringpool_t, stringpool_str83), 53},
980  {-1,-1},
981 #line 140 "charset_lookup.gperf"
982  {(int)offsetof(struct stringpool_t, stringpool_str85), 57},
983  {-1,-1},
984 #line 352 "charset_lookup.gperf"
985  {(int)offsetof(struct stringpool_t, stringpool_str87), 54},
986  {-1,-1},
987 #line 162 "charset_lookup.gperf"
988  {(int)offsetof(struct stringpool_t, stringpool_str89), 8},
989 #line 131 "charset_lookup.gperf"
990  {(int)offsetof(struct stringpool_t, stringpool_str90), 48},
991 #line 206 "charset_lookup.gperf"
992  {(int)offsetof(struct stringpool_t, stringpool_str91), 63},
993 #line 230 "charset_lookup.gperf"
994  {(int)offsetof(struct stringpool_t, stringpool_str92), 51},
995 #line 371 "charset_lookup.gperf"
996  {(int)offsetof(struct stringpool_t, stringpool_str93), 47},
997 #line 341 "charset_lookup.gperf"
998  {(int)offsetof(struct stringpool_t, stringpool_str94), 52},
999 #line 174 "charset_lookup.gperf"
1000  {(int)offsetof(struct stringpool_t, stringpool_str95), 54},
1001  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1002 #line 154 "charset_lookup.gperf"
1003  {(int)offsetof(struct stringpool_t, stringpool_str100), 60},
1004 #line 158 "charset_lookup.gperf"
1005  {(int)offsetof(struct stringpool_t, stringpool_str101), 47},
1006 #line 163 "charset_lookup.gperf"
1007  {(int)offsetof(struct stringpool_t, stringpool_str102), 88},
1008 #line 137 "charset_lookup.gperf"
1009  {(int)offsetof(struct stringpool_t, stringpool_str103), 54},
1010 #line 9 "charset_lookup.gperf"
1011  {(int)offsetof(struct stringpool_t, stringpool_str104), 25},
1012 #line 112 "charset_lookup.gperf"
1013  {(int)offsetof(struct stringpool_t, stringpool_str105), 38},
1014  {-1,-1},
1015 #line 373 "charset_lookup.gperf"
1016  {(int)offsetof(struct stringpool_t, stringpool_str107), 88},
1017 #line 155 "charset_lookup.gperf"
1018  {(int)offsetof(struct stringpool_t, stringpool_str108), 11},
1019 #line 179 "charset_lookup.gperf"
1020  {(int)offsetof(struct stringpool_t, stringpool_str109), 0},
1021 #line 132 "charset_lookup.gperf"
1022  {(int)offsetof(struct stringpool_t, stringpool_str110), 49},
1023 #line 202 "charset_lookup.gperf"
1024  {(int)offsetof(struct stringpool_t, stringpool_str111), 56},
1025  {-1,-1},
1026 #line 196 "charset_lookup.gperf"
1027  {(int)offsetof(struct stringpool_t, stringpool_str113), 53},
1028  {-1,-1},
1029 #line 204 "charset_lookup.gperf"
1030  {(int)offsetof(struct stringpool_t, stringpool_str115), 57},
1031 #line 219 "charset_lookup.gperf"
1032  {(int)offsetof(struct stringpool_t, stringpool_str116), 58},
1033  {-1,-1},
1034 #line 339 "charset_lookup.gperf"
1035  {(int)offsetof(struct stringpool_t, stringpool_str118), 50},
1036  {-1,-1},
1037 #line 185 "charset_lookup.gperf"
1038  {(int)offsetof(struct stringpool_t, stringpool_str120), 48},
1039 #line 350 "charset_lookup.gperf"
1040  {(int)offsetof(struct stringpool_t, stringpool_str121), 52},
1041 #line 8 "charset_lookup.gperf"
1042  {(int)offsetof(struct stringpool_t, stringpool_str122), 24},
1043 #line 151 "charset_lookup.gperf"
1044  {(int)offsetof(struct stringpool_t, stringpool_str123), 57},
1045 #line 186 "charset_lookup.gperf"
1046  {(int)offsetof(struct stringpool_t, stringpool_str124), 48},
1047  {-1,-1}, {-1,-1},
1048 #line 152 "charset_lookup.gperf"
1049  {(int)offsetof(struct stringpool_t, stringpool_str127), 59},
1050 #line 156 "charset_lookup.gperf"
1051  {(int)offsetof(struct stringpool_t, stringpool_str128), 61},
1052 #line 172 "charset_lookup.gperf"
1053  {(int)offsetof(struct stringpool_t, stringpool_str129), 52},
1054  {-1,-1}, {-1,-1}, {-1,-1},
1055 #line 198 "charset_lookup.gperf"
1056  {(int)offsetof(struct stringpool_t, stringpool_str133), 54},
1057  {-1,-1},
1058 #line 369 "charset_lookup.gperf"
1059  {(int)offsetof(struct stringpool_t, stringpool_str135), 45},
1060 #line 25 "charset_lookup.gperf"
1061  {(int)offsetof(struct stringpool_t, stringpool_str136), 9},
1062 #line 135 "charset_lookup.gperf"
1063  {(int)offsetof(struct stringpool_t, stringpool_str137), 52},
1064  {-1,-1}, {-1,-1},
1065 #line 187 "charset_lookup.gperf"
1066  {(int)offsetof(struct stringpool_t, stringpool_str140), 49},
1067 #line 224 "charset_lookup.gperf"
1068  {(int)offsetof(struct stringpool_t, stringpool_str141), 59},
1069 #line 143 "charset_lookup.gperf"
1070  {(int)offsetof(struct stringpool_t, stringpool_str142), 50},
1071 #line 149 "charset_lookup.gperf"
1072  {(int)offsetof(struct stringpool_t, stringpool_str143), 58},
1073 #line 130 "charset_lookup.gperf"
1074  {(int)offsetof(struct stringpool_t, stringpool_str144), 47},
1075 #line 348 "charset_lookup.gperf"
1076  {(int)offsetof(struct stringpool_t, stringpool_str145), 50},
1077 #line 220 "charset_lookup.gperf"
1078  {(int)offsetof(struct stringpool_t, stringpool_str146), 65},
1079  {-1,-1},
1080 #line 144 "charset_lookup.gperf"
1081  {(int)offsetof(struct stringpool_t, stringpool_str148), 51},
1082 #line 23 "charset_lookup.gperf"
1083  {(int)offsetof(struct stringpool_t, stringpool_str149), 7},
1084 #line 344 "charset_lookup.gperf"
1085  {(int)offsetof(struct stringpool_t, stringpool_str150), 55},
1086 #line 184 "charset_lookup.gperf"
1087  {(int)offsetof(struct stringpool_t, stringpool_str151), 47},
1088 #line 236 "charset_lookup.gperf"
1089  {(int)offsetof(struct stringpool_t, stringpool_str152), 0},
1090 #line 171 "charset_lookup.gperf"
1091  {(int)offsetof(struct stringpool_t, stringpool_str153), 50},
1092 #line 243 "charset_lookup.gperf"
1093  {(int)offsetof(struct stringpool_t, stringpool_str154), 47},
1094 #line 157 "charset_lookup.gperf"
1095  {(int)offsetof(struct stringpool_t, stringpool_str155), 46},
1096 #line 240 "charset_lookup.gperf"
1097  {(int)offsetof(struct stringpool_t, stringpool_str156), 57},
1098 #line 146 "charset_lookup.gperf"
1099  {(int)offsetof(struct stringpool_t, stringpool_str157), 55},
1100 #line 15 "charset_lookup.gperf"
1101  {(int)offsetof(struct stringpool_t, stringpool_str158), 88},
1102  {-1,-1}, {-1,-1},
1103 #line 133 "charset_lookup.gperf"
1104  {(int)offsetof(struct stringpool_t, stringpool_str161), 50},
1105  {-1,-1}, {-1,-1},
1106 #line 42 "charset_lookup.gperf"
1107  {(int)offsetof(struct stringpool_t, stringpool_str164), 0},
1108  {-1,-1}, {-1,-1},
1109 #line 194 "charset_lookup.gperf"
1110  {(int)offsetof(struct stringpool_t, stringpool_str167), 52},
1111  {-1,-1}, {-1,-1},
1112 #line 273 "charset_lookup.gperf"
1113  {(int)offsetof(struct stringpool_t, stringpool_str170), 85},
1114 #line 148 "charset_lookup.gperf"
1115  {(int)offsetof(struct stringpool_t, stringpool_str171), 56},
1116  {-1,-1},
1117 #line 336 "charset_lookup.gperf"
1118  {(int)offsetof(struct stringpool_t, stringpool_str173), 8},
1119 #line 183 "charset_lookup.gperf"
1120  {(int)offsetof(struct stringpool_t, stringpool_str174), 47},
1121  {-1,-1},
1122 #line 241 "charset_lookup.gperf"
1123  {(int)offsetof(struct stringpool_t, stringpool_str176), 45},
1124 #line 353 "charset_lookup.gperf"
1125  {(int)offsetof(struct stringpool_t, stringpool_str177), 55},
1126 #line 169 "charset_lookup.gperf"
1127  {(int)offsetof(struct stringpool_t, stringpool_str178), 45},
1128 #line 150 "charset_lookup.gperf"
1129  {(int)offsetof(struct stringpool_t, stringpool_str179), 53},
1130  {-1,-1}, {-1,-1}, {-1,-1},
1131 #line 188 "charset_lookup.gperf"
1132  {(int)offsetof(struct stringpool_t, stringpool_str183), 49},
1133  {-1,-1},
1134 #line 175 "charset_lookup.gperf"
1135  {(int)offsetof(struct stringpool_t, stringpool_str185), 55},
1136 #line 128 "charset_lookup.gperf"
1137  {(int)offsetof(struct stringpool_t, stringpool_str186), 45},
1138  {-1,-1}, {-1,-1},
1139 #line 370 "charset_lookup.gperf"
1140  {(int)offsetof(struct stringpool_t, stringpool_str189), 46},
1141 #line 340 "charset_lookup.gperf"
1142  {(int)offsetof(struct stringpool_t, stringpool_str190), 51},
1143 #line 190 "charset_lookup.gperf"
1144  {(int)offsetof(struct stringpool_t, stringpool_str191), 50},
1145 #line 145 "charset_lookup.gperf"
1146  {(int)offsetof(struct stringpool_t, stringpool_str192), 52},
1147 #line 138 "charset_lookup.gperf"
1148  {(int)offsetof(struct stringpool_t, stringpool_str193), 55},
1149 #line 45 "charset_lookup.gperf"
1150  {(int)offsetof(struct stringpool_t, stringpool_str194), 26},
1151 #line 49 "charset_lookup.gperf"
1152  {(int)offsetof(struct stringpool_t, stringpool_str195), 30},
1153 #line 361 "charset_lookup.gperf"
1154  {(int)offsetof(struct stringpool_t, stringpool_str196), 61},
1155 #line 302 "charset_lookup.gperf"
1156  {(int)offsetof(struct stringpool_t, stringpool_str197), 94},
1157 #line 160 "charset_lookup.gperf"
1158  {(int)offsetof(struct stringpool_t, stringpool_str198), 49},
1159 #line 292 "charset_lookup.gperf"
1160  {(int)offsetof(struct stringpool_t, stringpool_str199), 88},
1161 #line 164 "charset_lookup.gperf"
1162  {(int)offsetof(struct stringpool_t, stringpool_str200), 62},
1163 #line 161 "charset_lookup.gperf"
1164  {(int)offsetof(struct stringpool_t, stringpool_str201), 9},
1165 #line 117 "charset_lookup.gperf"
1166  {(int)offsetof(struct stringpool_t, stringpool_str202), 0},
1167 #line 379 "charset_lookup.gperf"
1168  {(int)offsetof(struct stringpool_t, stringpool_str203), 78},
1169 #line 258 "charset_lookup.gperf"
1170  {(int)offsetof(struct stringpool_t, stringpool_str204), 15},
1171 #line 380 "charset_lookup.gperf"
1172  {(int)offsetof(struct stringpool_t, stringpool_str205), 79},
1173  {-1,-1},
1174 #line 31 "charset_lookup.gperf"
1175  {(int)offsetof(struct stringpool_t, stringpool_str207), 14},
1176 #line 153 "charset_lookup.gperf"
1177  {(int)offsetof(struct stringpool_t, stringpool_str208), 45},
1178 #line 38 "charset_lookup.gperf"
1179  {(int)offsetof(struct stringpool_t, stringpool_str209), 21},
1180 #line 239 "charset_lookup.gperf"
1181  {(int)offsetof(struct stringpool_t, stringpool_str210), 52},
1182 #line 35 "charset_lookup.gperf"
1183  {(int)offsetof(struct stringpool_t, stringpool_str211), 18},
1184 #line 181 "charset_lookup.gperf"
1185  {(int)offsetof(struct stringpool_t, stringpool_str212), 45},
1186 #line 331 "charset_lookup.gperf"
1187  {(int)offsetof(struct stringpool_t, stringpool_str213), 26},
1188 #line 366 "charset_lookup.gperf"
1189  {(int)offsetof(struct stringpool_t, stringpool_str214), 30},
1190  {-1,-1},
1191 #line 180 "charset_lookup.gperf"
1192  {(int)offsetof(struct stringpool_t, stringpool_str216), 45},
1193 #line 349 "charset_lookup.gperf"
1194  {(int)offsetof(struct stringpool_t, stringpool_str217), 51},
1195 #line 269 "charset_lookup.gperf"
1196  {(int)offsetof(struct stringpool_t, stringpool_str218), 83},
1197 #line 24 "charset_lookup.gperf"
1198  {(int)offsetof(struct stringpool_t, stringpool_str219), 8},
1199 #line 207 "charset_lookup.gperf"
1200  {(int)offsetof(struct stringpool_t, stringpool_str220), 62},
1201  {-1,-1}, {-1,-1},
1202 #line 200 "charset_lookup.gperf"
1203  {(int)offsetof(struct stringpool_t, stringpool_str223), 55},
1204  {-1,-1},
1205 #line 378 "charset_lookup.gperf"
1206  {(int)offsetof(struct stringpool_t, stringpool_str225), 74},
1207 #line 320 "charset_lookup.gperf"
1208  {(int)offsetof(struct stringpool_t, stringpool_str226), 14},
1209 #line 363 "charset_lookup.gperf"
1210  {(int)offsetof(struct stringpool_t, stringpool_str227), 0},
1211 #line 327 "charset_lookup.gperf"
1212  {(int)offsetof(struct stringpool_t, stringpool_str228), 21},
1213 #line 90 "charset_lookup.gperf"
1214  {(int)offsetof(struct stringpool_t, stringpool_str229), 55},
1215 #line 324 "charset_lookup.gperf"
1216  {(int)offsetof(struct stringpool_t, stringpool_str230), 18},
1217 #line 36 "charset_lookup.gperf"
1218  {(int)offsetof(struct stringpool_t, stringpool_str231), 19},
1219 #line 120 "charset_lookup.gperf"
1220  {(int)offsetof(struct stringpool_t, stringpool_str232), 26},
1221 #line 134 "charset_lookup.gperf"
1222  {(int)offsetof(struct stringpool_t, stringpool_str233), 51},
1223 #line 237 "charset_lookup.gperf"
1224  {(int)offsetof(struct stringpool_t, stringpool_str234), 50},
1225 #line 19 "charset_lookup.gperf"
1226  {(int)offsetof(struct stringpool_t, stringpool_str235), 5},
1227 #line 266 "charset_lookup.gperf"
1228  {(int)offsetof(struct stringpool_t, stringpool_str236), 81},
1229 #line 261 "charset_lookup.gperf"
1230  {(int)offsetof(struct stringpool_t, stringpool_str237), 13},
1231  {-1,-1},
1232 #line 165 "charset_lookup.gperf"
1233  {(int)offsetof(struct stringpool_t, stringpool_str239), 9},
1234 #line 129 "charset_lookup.gperf"
1235  {(int)offsetof(struct stringpool_t, stringpool_str240), 46},
1236  {-1,-1},
1237 #line 142 "charset_lookup.gperf"
1238  {(int)offsetof(struct stringpool_t, stringpool_str242), 0},
1239 #line 17 "charset_lookup.gperf"
1240  {(int)offsetof(struct stringpool_t, stringpool_str243), 5},
1241  {-1,-1}, {-1,-1}, {-1,-1},
1242 #line 147 "charset_lookup.gperf"
1243  {(int)offsetof(struct stringpool_t, stringpool_str247), 54},
1244 #line 109 "charset_lookup.gperf"
1245  {(int)offsetof(struct stringpool_t, stringpool_str248), 55},
1246  {-1,-1},
1247 #line 325 "charset_lookup.gperf"
1248  {(int)offsetof(struct stringpool_t, stringpool_str250), 19},
1249  {-1,-1},
1250 #line 44 "charset_lookup.gperf"
1251  {(int)offsetof(struct stringpool_t, stringpool_str252), 25},
1252 #line 39 "charset_lookup.gperf"
1253  {(int)offsetof(struct stringpool_t, stringpool_str253), 22},
1254  {-1,-1},
1255 #line 103 "charset_lookup.gperf"
1256  {(int)offsetof(struct stringpool_t, stringpool_str255), 29},
1257  {-1,-1}, {-1,-1},
1258 #line 91 "charset_lookup.gperf"
1259  {(int)offsetof(struct stringpool_t, stringpool_str258), 55},
1260  {-1,-1},
1261 #line 43 "charset_lookup.gperf"
1262  {(int)offsetof(struct stringpool_t, stringpool_str260), 24},
1263 #line 48 "charset_lookup.gperf"
1264  {(int)offsetof(struct stringpool_t, stringpool_str261), 29},
1265 #line 50 "charset_lookup.gperf"
1266  {(int)offsetof(struct stringpool_t, stringpool_str262), 31},
1267 #line 192 "charset_lookup.gperf"
1268  {(int)offsetof(struct stringpool_t, stringpool_str263), 51},
1269  {-1,-1},
1270 #line 34 "charset_lookup.gperf"
1271  {(int)offsetof(struct stringpool_t, stringpool_str265), 17},
1272 #line 242 "charset_lookup.gperf"
1273  {(int)offsetof(struct stringpool_t, stringpool_str266), 46},
1274  {-1,-1}, {-1,-1}, {-1,-1},
1275 #line 182 "charset_lookup.gperf"
1276  {(int)offsetof(struct stringpool_t, stringpool_str270), 46},
1277 #line 330 "charset_lookup.gperf"
1278  {(int)offsetof(struct stringpool_t, stringpool_str271), 25},
1279  {-1,-1},
1280 #line 46 "charset_lookup.gperf"
1281  {(int)offsetof(struct stringpool_t, stringpool_str273), 27},
1282 #line 79 "charset_lookup.gperf"
1283  {(int)offsetof(struct stringpool_t, stringpool_str274), 65},
1284 #line 98 "charset_lookup.gperf"
1285  {(int)offsetof(struct stringpool_t, stringpool_str275), 33},
1286  {-1,-1}, {-1,-1}, {-1,-1},
1287 #line 329 "charset_lookup.gperf"
1288  {(int)offsetof(struct stringpool_t, stringpool_str279), 24},
1289 #line 365 "charset_lookup.gperf"
1290  {(int)offsetof(struct stringpool_t, stringpool_str280), 29},
1291 #line 367 "charset_lookup.gperf"
1292  {(int)offsetof(struct stringpool_t, stringpool_str281), 31},
1293  {-1,-1},
1294 #line 94 "charset_lookup.gperf"
1295  {(int)offsetof(struct stringpool_t, stringpool_str283), 33},
1296 #line 323 "charset_lookup.gperf"
1297  {(int)offsetof(struct stringpool_t, stringpool_str284), 17},
1298 #line 89 "charset_lookup.gperf"
1299  {(int)offsetof(struct stringpool_t, stringpool_str285), 54},
1300  {-1,-1}, {-1,-1},
1301 #line 334 "charset_lookup.gperf"
1302  {(int)offsetof(struct stringpool_t, stringpool_str288), 33},
1303 #line 32 "charset_lookup.gperf"
1304  {(int)offsetof(struct stringpool_t, stringpool_str289), 15},
1305 #line 119 "charset_lookup.gperf"
1306  {(int)offsetof(struct stringpool_t, stringpool_str290), 25},
1307 #line 61 "charset_lookup.gperf"
1308  {(int)offsetof(struct stringpool_t, stringpool_str291), 60},
1309 #line 332 "charset_lookup.gperf"
1310  {(int)offsetof(struct stringpool_t, stringpool_str292), 27},
1311 #line 166 "charset_lookup.gperf"
1312  {(int)offsetof(struct stringpool_t, stringpool_str293), 58},
1313 #line 51 "charset_lookup.gperf"
1314  {(int)offsetof(struct stringpool_t, stringpool_str294), 88},
1315 #line 96 "charset_lookup.gperf"
1316  {(int)offsetof(struct stringpool_t, stringpool_str295), 10},
1317  {-1,-1},
1318 #line 286 "charset_lookup.gperf"
1319  {(int)offsetof(struct stringpool_t, stringpool_str297), 87},
1320 #line 118 "charset_lookup.gperf"
1321  {(int)offsetof(struct stringpool_t, stringpool_str298), 24},
1322  {-1,-1}, {-1,-1},
1323 #line 108 "charset_lookup.gperf"
1324  {(int)offsetof(struct stringpool_t, stringpool_str301), 55},
1325 #line 167 "charset_lookup.gperf"
1326  {(int)offsetof(struct stringpool_t, stringpool_str302), 88},
1327 #line 92 "charset_lookup.gperf"
1328  {(int)offsetof(struct stringpool_t, stringpool_str303), 10},
1329 #line 278 "charset_lookup.gperf"
1330  {(int)offsetof(struct stringpool_t, stringpool_str304), 61},
1331 #line 376 "charset_lookup.gperf"
1332  {(int)offsetof(struct stringpool_t, stringpool_str305), 69},
1333 #line 238 "charset_lookup.gperf"
1334  {(int)offsetof(struct stringpool_t, stringpool_str306), 51},
1335 #line 30 "charset_lookup.gperf"
1336  {(int)offsetof(struct stringpool_t, stringpool_str307), 13},
1337 #line 321 "charset_lookup.gperf"
1338  {(int)offsetof(struct stringpool_t, stringpool_str308), 15},
1339 #line 284 "charset_lookup.gperf"
1340  {(int)offsetof(struct stringpool_t, stringpool_str309), 2},
1341 #line 69 "charset_lookup.gperf"
1342  {(int)offsetof(struct stringpool_t, stringpool_str310), 0},
1343  {-1,-1},
1344 #line 277 "charset_lookup.gperf"
1345  {(int)offsetof(struct stringpool_t, stringpool_str312), 61},
1346 #line 275 "charset_lookup.gperf"
1347  {(int)offsetof(struct stringpool_t, stringpool_str313), 85},
1348 #line 73 "charset_lookup.gperf"
1349  {(int)offsetof(struct stringpool_t, stringpool_str314), 57},
1350  {-1,-1}, {-1,-1}, {-1,-1},
1351 #line 104 "charset_lookup.gperf"
1352  {(int)offsetof(struct stringpool_t, stringpool_str318), 9},
1353 #line 47 "charset_lookup.gperf"
1354  {(int)offsetof(struct stringpool_t, stringpool_str319), 28},
1355 #line 16 "charset_lookup.gperf"
1356  {(int)offsetof(struct stringpool_t, stringpool_str320), 54},
1357 #line 37 "charset_lookup.gperf"
1358  {(int)offsetof(struct stringpool_t, stringpool_str321), 20},
1359  {-1,-1}, {-1,-1},
1360 #line 222 "charset_lookup.gperf"
1361  {(int)offsetof(struct stringpool_t, stringpool_str324), 67},
1362  {-1,-1},
1363 #line 319 "charset_lookup.gperf"
1364  {(int)offsetof(struct stringpool_t, stringpool_str326), 13},
1365  {-1,-1}, {-1,-1},
1366 #line 111 "charset_lookup.gperf"
1367  {(int)offsetof(struct stringpool_t, stringpool_str329), 83},
1368  {-1,-1},
1369 #line 265 "charset_lookup.gperf"
1370  {(int)offsetof(struct stringpool_t, stringpool_str331), 84},
1371  {-1,-1},
1372 #line 87 "charset_lookup.gperf"
1373  {(int)offsetof(struct stringpool_t, stringpool_str333), 94},
1374 #line 74 "charset_lookup.gperf"
1375  {(int)offsetof(struct stringpool_t, stringpool_str334), 45},
1376 #line 225 "charset_lookup.gperf"
1377  {(int)offsetof(struct stringpool_t, stringpool_str335), 59},
1378 #line 270 "charset_lookup.gperf"
1379  {(int)offsetof(struct stringpool_t, stringpool_str336), 84},
1380 #line 159 "charset_lookup.gperf"
1381  {(int)offsetof(struct stringpool_t, stringpool_str337), 48},
1382 #line 364 "charset_lookup.gperf"
1383  {(int)offsetof(struct stringpool_t, stringpool_str338), 28},
1384 #line 218 "charset_lookup.gperf"
1385  {(int)offsetof(struct stringpool_t, stringpool_str339), 22},
1386 #line 326 "charset_lookup.gperf"
1387  {(int)offsetof(struct stringpool_t, stringpool_str340), 20},
1388  {-1,-1},
1389 #line 14 "charset_lookup.gperf"
1390  {(int)offsetof(struct stringpool_t, stringpool_str342), 4},
1391  {-1,-1}, {-1,-1},
1392 #line 178 "charset_lookup.gperf"
1393  {(int)offsetof(struct stringpool_t, stringpool_str345), 88},
1394  {-1,-1},
1395 #line 274 "charset_lookup.gperf"
1396  {(int)offsetof(struct stringpool_t, stringpool_str347), 85},
1397  {-1,-1},
1398 #line 97 "charset_lookup.gperf"
1399  {(int)offsetof(struct stringpool_t, stringpool_str349), 32},
1400 #line 301 "charset_lookup.gperf"
1401  {(int)offsetof(struct stringpool_t, stringpool_str350), 1},
1402 #line 315 "charset_lookup.gperf"
1403  {(int)offsetof(struct stringpool_t, stringpool_str351), 64},
1404 #line 102 "charset_lookup.gperf"
1405  {(int)offsetof(struct stringpool_t, stringpool_str352), 10},
1406 #line 316 "charset_lookup.gperf"
1407  {(int)offsetof(struct stringpool_t, stringpool_str353), 62},
1408 #line 126 "charset_lookup.gperf"
1409  {(int)offsetof(struct stringpool_t, stringpool_str354), 44},
1410 #line 260 "charset_lookup.gperf"
1411  {(int)offsetof(struct stringpool_t, stringpool_str355), 14},
1412 #line 124 "charset_lookup.gperf"
1413  {(int)offsetof(struct stringpool_t, stringpool_str356), 42},
1414 #line 93 "charset_lookup.gperf"
1415  {(int)offsetof(struct stringpool_t, stringpool_str357), 32},
1416 #line 299 "charset_lookup.gperf"
1417  {(int)offsetof(struct stringpool_t, stringpool_str358), 1},
1418 #line 303 "charset_lookup.gperf"
1419  {(int)offsetof(struct stringpool_t, stringpool_str359), 94},
1420 #line 40 "charset_lookup.gperf"
1421  {(int)offsetof(struct stringpool_t, stringpool_str360), 88},
1422 #line 33 "charset_lookup.gperf"
1423  {(int)offsetof(struct stringpool_t, stringpool_str361), 16},
1424 #line 333 "charset_lookup.gperf"
1425  {(int)offsetof(struct stringpool_t, stringpool_str362), 32},
1426  {-1,-1},
1427 #line 377 "charset_lookup.gperf"
1428  {(int)offsetof(struct stringpool_t, stringpool_str364), 73},
1429 #line 293 "charset_lookup.gperf"
1430  {(int)offsetof(struct stringpool_t, stringpool_str365), 88},
1431 #line 271 "charset_lookup.gperf"
1432  {(int)offsetof(struct stringpool_t, stringpool_str366), 84},
1433  {-1,-1},
1434 #line 72 "charset_lookup.gperf"
1435  {(int)offsetof(struct stringpool_t, stringpool_str368), 52},
1436 #line 279 "charset_lookup.gperf"
1437  {(int)offsetof(struct stringpool_t, stringpool_str369), 61},
1438  {-1,-1},
1439 #line 52 "charset_lookup.gperf"
1440  {(int)offsetof(struct stringpool_t, stringpool_str371), 5},
1441  {-1,-1}, {-1,-1},
1442 #line 121 "charset_lookup.gperf"
1443  {(int)offsetof(struct stringpool_t, stringpool_str374), 39},
1444  {-1,-1}, {-1,-1},
1445 #line 41 "charset_lookup.gperf"
1446  {(int)offsetof(struct stringpool_t, stringpool_str377), 23},
1447  {-1,-1},
1448 #line 26 "charset_lookup.gperf"
1449  {(int)offsetof(struct stringpool_t, stringpool_str379), 5},
1450 #line 322 "charset_lookup.gperf"
1451  {(int)offsetof(struct stringpool_t, stringpool_str380), 16},
1452 #line 13 "charset_lookup.gperf"
1453  {(int)offsetof(struct stringpool_t, stringpool_str381), 54},
1454  {-1,-1},
1455 #line 317 "charset_lookup.gperf"
1456  {(int)offsetof(struct stringpool_t, stringpool_str383), 60},
1457 #line 60 "charset_lookup.gperf"
1458  {(int)offsetof(struct stringpool_t, stringpool_str384), 58},
1459  {-1,-1}, {-1,-1},
1460 #line 101 "charset_lookup.gperf"
1461  {(int)offsetof(struct stringpool_t, stringpool_str387), 35},
1462  {-1,-1},
1463 #line 285 "charset_lookup.gperf"
1464  {(int)offsetof(struct stringpool_t, stringpool_str389), 86},
1465  {-1,-1}, {-1,-1},
1466 #line 70 "charset_lookup.gperf"
1467  {(int)offsetof(struct stringpool_t, stringpool_str392), 50},
1468 #line 107 "charset_lookup.gperf"
1469  {(int)offsetof(struct stringpool_t, stringpool_str393), 37},
1470 #line 227 "charset_lookup.gperf"
1471  {(int)offsetof(struct stringpool_t, stringpool_str394), 59},
1472 #line 29 "charset_lookup.gperf"
1473  {(int)offsetof(struct stringpool_t, stringpool_str395), 12},
1474 #line 328 "charset_lookup.gperf"
1475  {(int)offsetof(struct stringpool_t, stringpool_str396), 23},
1476 #line 125 "charset_lookup.gperf"
1477  {(int)offsetof(struct stringpool_t, stringpool_str397), 43},
1478 #line 115 "charset_lookup.gperf"
1479  {(int)offsetof(struct stringpool_t, stringpool_str398), 88},
1480  {-1,-1}, {-1,-1},
1481 #line 283 "charset_lookup.gperf"
1482  {(int)offsetof(struct stringpool_t, stringpool_str401), 3},
1483 #line 288 "charset_lookup.gperf"
1484  {(int)offsetof(struct stringpool_t, stringpool_str402), 3},
1485  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1486 #line 209 "charset_lookup.gperf"
1487  {(int)offsetof(struct stringpool_t, stringpool_str409), 58},
1488  {-1,-1},
1489 #line 259 "charset_lookup.gperf"
1490  {(int)offsetof(struct stringpool_t, stringpool_str411), 19},
1491  {-1,-1}, {-1,-1}, {-1,-1},
1492 #line 116 "charset_lookup.gperf"
1493  {(int)offsetof(struct stringpool_t, stringpool_str415), 23},
1494  {-1,-1}, {-1,-1},
1495 #line 244 "charset_lookup.gperf"
1496  {(int)offsetof(struct stringpool_t, stringpool_str418), 69},
1497  {-1,-1}, {-1,-1}, {-1,-1},
1498 #line 295 "charset_lookup.gperf"
1499  {(int)offsetof(struct stringpool_t, stringpool_str422), 90},
1500  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1501 #line 123 "charset_lookup.gperf"
1502  {(int)offsetof(struct stringpool_t, stringpool_str428), 41},
1503 #line 28 "charset_lookup.gperf"
1504  {(int)offsetof(struct stringpool_t, stringpool_str429), 11},
1505  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1506 #line 306 "charset_lookup.gperf"
1507  {(int)offsetof(struct stringpool_t, stringpool_str434), 14},
1508 #line 313 "charset_lookup.gperf"
1509  {(int)offsetof(struct stringpool_t, stringpool_str435), 21},
1510 #line 310 "charset_lookup.gperf"
1511  {(int)offsetof(struct stringpool_t, stringpool_str436), 18},
1512  {-1,-1},
1513 #line 75 "charset_lookup.gperf"
1514  {(int)offsetof(struct stringpool_t, stringpool_str438), 54},
1515  {-1,-1}, {-1,-1},
1516 #line 263 "charset_lookup.gperf"
1517  {(int)offsetof(struct stringpool_t, stringpool_str441), 18},
1518  {-1,-1}, {-1,-1},
1519 #line 88 "charset_lookup.gperf"
1520  {(int)offsetof(struct stringpool_t, stringpool_str444), 53},
1521 #line 210 "charset_lookup.gperf"
1522  {(int)offsetof(struct stringpool_t, stringpool_str445), 62},
1523 #line 311 "charset_lookup.gperf"
1524  {(int)offsetof(struct stringpool_t, stringpool_str446), 19},
1525  {-1,-1},
1526 #line 226 "charset_lookup.gperf"
1527  {(int)offsetof(struct stringpool_t, stringpool_str448), 59},
1528  {-1,-1},
1529 #line 287 "charset_lookup.gperf"
1530  {(int)offsetof(struct stringpool_t, stringpool_str450), 30},
1531  {-1,-1},
1532 #line 22 "charset_lookup.gperf"
1533  {(int)offsetof(struct stringpool_t, stringpool_str452), 5},
1534  {-1,-1},
1535 #line 27 "charset_lookup.gperf"
1536  {(int)offsetof(struct stringpool_t, stringpool_str454), 10},
1537 #line 106 "charset_lookup.gperf"
1538  {(int)offsetof(struct stringpool_t, stringpool_str455), 36},
1539  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1540 #line 18 "charset_lookup.gperf"
1541  {(int)offsetof(struct stringpool_t, stringpool_str460), 5},
1542 #line 59 "charset_lookup.gperf"
1543  {(int)offsetof(struct stringpool_t, stringpool_str461), 26},
1544 #line 300 "charset_lookup.gperf"
1545  {(int)offsetof(struct stringpool_t, stringpool_str462), 93},
1546 #line 309 "charset_lookup.gperf"
1547  {(int)offsetof(struct stringpool_t, stringpool_str463), 17},
1548 #line 71 "charset_lookup.gperf"
1549  {(int)offsetof(struct stringpool_t, stringpool_str464), 51},
1550 #line 289 "charset_lookup.gperf"
1551  {(int)offsetof(struct stringpool_t, stringpool_str465), 93},
1552  {-1,-1},
1553 #line 66 "charset_lookup.gperf"
1554  {(int)offsetof(struct stringpool_t, stringpool_str467), 9},
1555  {-1,-1}, {-1,-1},
1556 #line 298 "charset_lookup.gperf"
1557  {(int)offsetof(struct stringpool_t, stringpool_str470), 93},
1558  {-1,-1},
1559 #line 105 "charset_lookup.gperf"
1560  {(int)offsetof(struct stringpool_t, stringpool_str472), 8},
1561  {-1,-1},
1562 #line 65 "charset_lookup.gperf"
1563  {(int)offsetof(struct stringpool_t, stringpool_str474), 44},
1564 #line 307 "charset_lookup.gperf"
1565  {(int)offsetof(struct stringpool_t, stringpool_str475), 15},
1566 #line 223 "charset_lookup.gperf"
1567  {(int)offsetof(struct stringpool_t, stringpool_str476), 68},
1568  {-1,-1}, {-1,-1},
1569 #line 203 "charset_lookup.gperf"
1570  {(int)offsetof(struct stringpool_t, stringpool_str479), 56},
1571 #line 197 "charset_lookup.gperf"
1572  {(int)offsetof(struct stringpool_t, stringpool_str480), 53},
1573  {-1,-1}, {-1,-1},
1574 #line 205 "charset_lookup.gperf"
1575  {(int)offsetof(struct stringpool_t, stringpool_str483), 57},
1576 #line 305 "charset_lookup.gperf"
1577  {(int)offsetof(struct stringpool_t, stringpool_str484), 13},
1578 #line 251 "charset_lookup.gperf"
1579  {(int)offsetof(struct stringpool_t, stringpool_str485), 76},
1580 #line 77 "charset_lookup.gperf"
1581  {(int)offsetof(struct stringpool_t, stringpool_str486), 55},
1582 #line 122 "charset_lookup.gperf"
1583  {(int)offsetof(struct stringpool_t, stringpool_str487), 40},
1584 #line 211 "charset_lookup.gperf"
1585  {(int)offsetof(struct stringpool_t, stringpool_str488), 64},
1586 #line 208 "charset_lookup.gperf"
1587  {(int)offsetof(struct stringpool_t, stringpool_str489), 64},
1588 #line 212 "charset_lookup.gperf"
1589  {(int)offsetof(struct stringpool_t, stringpool_str490), 62},
1590 #line 312 "charset_lookup.gperf"
1591  {(int)offsetof(struct stringpool_t, stringpool_str491), 20},
1592  {-1,-1}, {-1,-1},
1593 #line 62 "charset_lookup.gperf"
1594  {(int)offsetof(struct stringpool_t, stringpool_str494), 39},
1595  {-1,-1},
1596 #line 262 "charset_lookup.gperf"
1597  {(int)offsetof(struct stringpool_t, stringpool_str496), 16},
1598  {-1,-1}, {-1,-1}, {-1,-1},
1599 #line 100 "charset_lookup.gperf"
1600  {(int)offsetof(struct stringpool_t, stringpool_str500), 32},
1601  {-1,-1}, {-1,-1},
1602 #line 221 "charset_lookup.gperf"
1603  {(int)offsetof(struct stringpool_t, stringpool_str503), 66},
1604 #line 280 "charset_lookup.gperf"
1605  {(int)offsetof(struct stringpool_t, stringpool_str504), 61},
1606 #line 253 "charset_lookup.gperf"
1607  {(int)offsetof(struct stringpool_t, stringpool_str505), 69},
1608 #line 314 "charset_lookup.gperf"
1609  {(int)offsetof(struct stringpool_t, stringpool_str506), 27},
1610 #line 195 "charset_lookup.gperf"
1611  {(int)offsetof(struct stringpool_t, stringpool_str507), 52},
1612  {-1,-1},
1613 #line 80 "charset_lookup.gperf"
1614  {(int)offsetof(struct stringpool_t, stringpool_str509), 59},
1615  {-1,-1},
1616 #line 308 "charset_lookup.gperf"
1617  {(int)offsetof(struct stringpool_t, stringpool_str511), 16},
1618  {-1,-1}, {-1,-1},
1619 #line 294 "charset_lookup.gperf"
1620  {(int)offsetof(struct stringpool_t, stringpool_str514), 89},
1621 #line 68 "charset_lookup.gperf"
1622  {(int)offsetof(struct stringpool_t, stringpool_str515), 62},
1623 #line 64 "charset_lookup.gperf"
1624  {(int)offsetof(struct stringpool_t, stringpool_str516), 43},
1625  {-1,-1}, {-1,-1}, {-1,-1},
1626 #line 215 "charset_lookup.gperf"
1627  {(int)offsetof(struct stringpool_t, stringpool_str520), 60},
1628 #line 254 "charset_lookup.gperf"
1629  {(int)offsetof(struct stringpool_t, stringpool_str521), 77},
1630 #line 85 "charset_lookup.gperf"
1631  {(int)offsetof(struct stringpool_t, stringpool_str522), 3},
1632 #line 255 "charset_lookup.gperf"
1633  {(int)offsetof(struct stringpool_t, stringpool_str523), 78},
1634  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1635 #line 297 "charset_lookup.gperf"
1636  {(int)offsetof(struct stringpool_t, stringpool_str528), 92},
1637  {-1,-1}, {-1,-1},
1638 #line 58 "charset_lookup.gperf"
1639  {(int)offsetof(struct stringpool_t, stringpool_str531), 83},
1640  {-1,-1}, {-1,-1},
1641 #line 189 "charset_lookup.gperf"
1642  {(int)offsetof(struct stringpool_t, stringpool_str534), 0},
1643  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1644 #line 21 "charset_lookup.gperf"
1645  {(int)offsetof(struct stringpool_t, stringpool_str541), 6},
1646  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1647 #line 199 "charset_lookup.gperf"
1648  {(int)offsetof(struct stringpool_t, stringpool_str546), 54},
1649 #line 216 "charset_lookup.gperf"
1650  {(int)offsetof(struct stringpool_t, stringpool_str547), 60},
1651 #line 63 "charset_lookup.gperf"
1652  {(int)offsetof(struct stringpool_t, stringpool_str548), 41},
1653 #line 20 "charset_lookup.gperf"
1654  {(int)offsetof(struct stringpool_t, stringpool_str549), 6},
1655  {-1,-1}, {-1,-1}, {-1,-1},
1656 #line 84 "charset_lookup.gperf"
1657  {(int)offsetof(struct stringpool_t, stringpool_str553), 84},
1658  {-1,-1},
1659 #line 193 "charset_lookup.gperf"
1660  {(int)offsetof(struct stringpool_t, stringpool_str555), 51},
1661  {-1,-1},
1662 #line 214 "charset_lookup.gperf"
1663  {(int)offsetof(struct stringpool_t, stringpool_str557), 62},
1664  {-1,-1}, {-1,-1},
1665 #line 78 "charset_lookup.gperf"
1666  {(int)offsetof(struct stringpool_t, stringpool_str560), 56},
1667 #line 76 "charset_lookup.gperf"
1668  {(int)offsetof(struct stringpool_t, stringpool_str561), 53},
1669  {-1,-1},
1670 #line 141 "charset_lookup.gperf"
1671  {(int)offsetof(struct stringpool_t, stringpool_str563), 47},
1672 #line 113 "charset_lookup.gperf"
1673  {(int)offsetof(struct stringpool_t, stringpool_str564), 38},
1674  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1675 #line 11 "charset_lookup.gperf"
1676  {(int)offsetof(struct stringpool_t, stringpool_str571), 88},
1677 #line 110 "charset_lookup.gperf"
1678  {(int)offsetof(struct stringpool_t, stringpool_str572), 56},
1679  {-1,-1}, {-1,-1},
1680 #line 191 "charset_lookup.gperf"
1681  {(int)offsetof(struct stringpool_t, stringpool_str575), 50},
1682  {-1,-1},
1683 #line 67 "charset_lookup.gperf"
1684  {(int)offsetof(struct stringpool_t, stringpool_str577), 8},
1685  {-1,-1}, {-1,-1}, {-1,-1},
1686 #line 56 "charset_lookup.gperf"
1687  {(int)offsetof(struct stringpool_t, stringpool_str581), 10},
1688 #line 12 "charset_lookup.gperf"
1689  {(int)offsetof(struct stringpool_t, stringpool_str582), 88},
1690 #line 86 "charset_lookup.gperf"
1691  {(int)offsetof(struct stringpool_t, stringpool_str583), 93},
1692 #line 213 "charset_lookup.gperf"
1693  {(int)offsetof(struct stringpool_t, stringpool_str584), 62},
1694  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1695 #line 201 "charset_lookup.gperf"
1696  {(int)offsetof(struct stringpool_t, stringpool_str591), 55},
1697  {-1,-1}, {-1,-1},
1698 #line 99 "charset_lookup.gperf"
1699  {(int)offsetof(struct stringpool_t, stringpool_str594), 34},
1700  {-1,-1},
1701 #line 53 "charset_lookup.gperf"
1702  {(int)offsetof(struct stringpool_t, stringpool_str596), 33},
1703  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1704 #line 95 "charset_lookup.gperf"
1705  {(int)offsetof(struct stringpool_t, stringpool_str602), 34},
1706  {-1,-1}, {-1,-1},
1707 #line 247 "charset_lookup.gperf"
1708  {(int)offsetof(struct stringpool_t, stringpool_str605), 72},
1709  {-1,-1},
1710 #line 335 "charset_lookup.gperf"
1711  {(int)offsetof(struct stringpool_t, stringpool_str607), 34},
1712  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1713 #line 282 "charset_lookup.gperf"
1714  {(int)offsetof(struct stringpool_t, stringpool_str614), 61},
1715  {-1,-1}, {-1,-1},
1716 #line 249 "charset_lookup.gperf"
1717  {(int)offsetof(struct stringpool_t, stringpool_str617), 74},
1718  {-1,-1}, {-1,-1},
1719 #line 296 "charset_lookup.gperf"
1720  {(int)offsetof(struct stringpool_t, stringpool_str620), 91},
1721  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1722 #line 252 "charset_lookup.gperf"
1723  {(int)offsetof(struct stringpool_t, stringpool_str625), 69},
1724  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1725  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1726 #line 291 "charset_lookup.gperf"
1727  {(int)offsetof(struct stringpool_t, stringpool_str637), 2},
1728  {-1,-1}, {-1,-1}, {-1,-1},
1729 #line 264 "charset_lookup.gperf"
1730  {(int)offsetof(struct stringpool_t, stringpool_str641), 17},
1731  {-1,-1}, {-1,-1}, {-1,-1},
1732 #line 257 "charset_lookup.gperf"
1733  {(int)offsetof(struct stringpool_t, stringpool_str645), 80},
1734  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1735 #line 114 "charset_lookup.gperf"
1736  {(int)offsetof(struct stringpool_t, stringpool_str651), 12},
1737  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1738 #line 246 "charset_lookup.gperf"
1739  {(int)offsetof(struct stringpool_t, stringpool_str658), 71},
1740  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1741 #line 267 "charset_lookup.gperf"
1742  {(int)offsetof(struct stringpool_t, stringpool_str663), 82},
1743 #line 281 "charset_lookup.gperf"
1744  {(int)offsetof(struct stringpool_t, stringpool_str664), 61},
1745  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1746  {-1,-1}, {-1,-1}, {-1,-1},
1747 #line 217 "charset_lookup.gperf"
1748  {(int)offsetof(struct stringpool_t, stringpool_str674), 60},
1749  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1750  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1751  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1752  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1753 #line 245 "charset_lookup.gperf"
1754  {(int)offsetof(struct stringpool_t, stringpool_str697), 70},
1755  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1756  {-1,-1}, {-1,-1},
1757 #line 290 "charset_lookup.gperf"
1758  {(int)offsetof(struct stringpool_t, stringpool_str706), 3},
1759  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1760  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1761  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1762 #line 83 "charset_lookup.gperf"
1763  {(int)offsetof(struct stringpool_t, stringpool_str723), 25},
1764  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1765  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1766  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1767  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1768 #line 248 "charset_lookup.gperf"
1769  {(int)offsetof(struct stringpool_t, stringpool_str748), 73},
1770  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1771  {-1,-1},
1772 #line 304 "charset_lookup.gperf"
1773  {(int)offsetof(struct stringpool_t, stringpool_str756), 20},
1774  {-1,-1},
1775 #line 276 "charset_lookup.gperf"
1776  {(int)offsetof(struct stringpool_t, stringpool_str758), 85},
1777  {-1,-1}, {-1,-1}, {-1,-1},
1778 #line 81 "charset_lookup.gperf"
1779  {(int)offsetof(struct stringpool_t, stringpool_str762), 69},
1780  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1781  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1782  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1783  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1784  {-1,-1},
1785 #line 57 "charset_lookup.gperf"
1786  {(int)offsetof(struct stringpool_t, stringpool_str788), 64},
1787  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1788  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1789  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1790  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1791  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1792  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1793  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1794  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1795  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1796  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1797  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1798  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1799  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1800  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1801  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1802  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1803 #line 250 "charset_lookup.gperf"
1804  {(int)offsetof(struct stringpool_t, stringpool_str884), 75},
1805  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1806  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1807  {-1,-1}, {-1,-1},
1808 #line 256 "charset_lookup.gperf"
1809  {(int)offsetof(struct stringpool_t, stringpool_str899), 79},
1810  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1811 #line 82 "charset_lookup.gperf"
1812  {(int)offsetof(struct stringpool_t, stringpool_str905), 24},
1813  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1814  {-1,-1}, {-1,-1}, {-1,-1},
1815 #line 55 "charset_lookup.gperf"
1816  {(int)offsetof(struct stringpool_t, stringpool_str915), 34},
1817  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1818  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1819  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1820  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1821  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1822  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1823  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1824  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1825  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1826  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1827  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1828  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1829  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1830  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1831  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1832  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1833  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1834  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1835  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1836  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1837  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1838  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1839  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1840  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1841  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1842  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1843  {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1},
1844  {-1,-1},
1845 #line 54 "charset_lookup.gperf"
1846  {(int)offsetof(struct stringpool_t, stringpool_str1079), 32}
1847  };
1848 
1849  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
1850  {
1851  register unsigned int key = hash_charset (str, len);
1852 
1853  if (key <= MAX_HASH_VALUE)
1854  {
1855  register int o = wordlist[key].alias_pos;
1856  if (o >= 0)
1857  {
1858  register const char *s = o + stringpool;
1859 
1860  if (*str == *s && !strcmp (str + 1, s + 1))
1861  return &wordlist[key];
1862  }
1863  }
1864  }
1865  return 0;
1866 }
1867 #line 381 "charset_lookup.gperf"
1868 
Definition: charset_lookup.h:124
Definition: charset_lookup.h:36
freetds-1.3.6/doc/reference/a00395_source.html000644 025423 025423 00000040130 14162303413 022370 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/checks.h Source File
FreeTDS API
checks.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2004 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef TDS_CHECKS_H
21 #define TDS_CHECKS_H
22 
23 #include <freetds/pushvis.h>
24 
25 #if ENABLE_EXTRA_CHECKS
26 #define CHECK_STRUCT_EXTRA(func,s) func(s)
27 #else
28 #define CHECK_STRUCT_EXTRA(func,s)
29 #endif
30 
31 #define CHECK_TDS_EXTRA(tds) CHECK_STRUCT_EXTRA(tds_check_tds_extra,tds)
32 #define CHECK_CONTEXT_EXTRA(ctx) CHECK_STRUCT_EXTRA(tds_check_context_extra,ctx)
33 #define CHECK_TDSENV_EXTRA(env) CHECK_STRUCT_EXTRA(tds_check_env_extra,env)
34 #define CHECK_COLUMN_EXTRA(column) CHECK_STRUCT_EXTRA(tds_check_column_extra,column)
35 #define CHECK_RESULTINFO_EXTRA(res_info) CHECK_STRUCT_EXTRA(tds_check_resultinfo_extra,res_info)
36 #define CHECK_PARAMINFO_EXTRA(res_info) CHECK_STRUCT_EXTRA(tds_check_resultinfo_extra,res_info)
37 #define CHECK_CURSOR_EXTRA(cursor) CHECK_STRUCT_EXTRA(tds_check_cursor_extra,cursor)
38 #define CHECK_DYNAMIC_EXTRA(dynamic) CHECK_STRUCT_EXTRA(tds_check_dynamic_extra,dynamic)
39 #define CHECK_FREEZE_EXTRA(freeze) CHECK_STRUCT_EXTRA(tds_check_freeze_extra,freeze)
40 #define CHECK_CONN_EXTRA(conn)
41 
42 #if ENABLE_EXTRA_CHECKS
43 void tds_check_tds_extra(const TDSSOCKET * tds);
44 void tds_check_context_extra(const TDSCONTEXT * ctx);
45 void tds_check_env_extra(const TDSENV * env);
46 void tds_check_column_extra(const TDSCOLUMN * column);
47 void tds_check_resultinfo_extra(const TDSRESULTINFO * res_info);
48 void tds_check_cursor_extra(const TDSCURSOR * cursor);
49 void tds_check_dynamic_extra(const TDSDYNAMIC * dynamic);
50 void tds_check_freeze_extra(const TDSFREEZE * freeze);
51 #endif
52 
53 #if defined(HAVE_VALGRIND_MEMCHECK_H) && ENABLE_EXTRA_CHECKS
54 # include <valgrind/memcheck.h>
55 # define TDS_MARK_UNDEFINED(ptr, len) VALGRIND_MAKE_MEM_UNDEFINED(ptr, len)
56 #else
57 # define TDS_MARK_UNDEFINED(ptr, len) do {} while(0)
58 #endif
59 
60 #if ENABLE_EXTRA_CHECKS
61 void tds_extra_assert_check(const char *fn, int line, int cond, const char *cond_str);
62 # define tds_extra_assert(cond) \
63  tds_extra_assert_check(__FILE__, __LINE__, cond, #cond)
64 #else
65 # define tds_extra_assert(cond) do { } while(0)
66 #endif
67 
68 #include <freetds/popvis.h>
69 
70 #endif /* TDS_CHECKS_H */
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
Current environment as reported by the server.
Definition: tds.h:963
Holds informations about a cursor.
Definition: tds.h:937
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Hold information for any results.
Definition: tds.h:769
Information for a server connection.
Definition: tds.h:1163
Definition: tds.h:1029
Definition: tds.h:1571
freetds-1.3.6/doc/reference/a00398_source.html000644 025423 025423 00000023302 14162303413 022375 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/configs.h Source File
FreeTDS API
configs.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tds_configs_h_
21 #define _tds_configs_h_
22 
23 #include <freetds/sysconfdir.h>
24 
25 #ifndef _tds_h_
26 #error freetds/tds.h must be included before freetds/configs.h
27 #endif
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #if 0
33 }
34 #endif
35 #endif
36 
37 #define FREETDS_SYSCONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR "freetds.conf"
38 #define FREETDS_POOLCONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR "pool.conf"
39 #define FREETDS_LOCALECONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR "locales.conf"
40 
41 #ifdef __cplusplus
42 #if 0
43 {
44 #endif
45 }
46 #endif
47 
48 #endif /* _tds_configs_h_ */
freetds-1.3.6/doc/reference/a00401_source.html000644 025423 025423 00000052401 14162303413 022360 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/convert.h Source File
FreeTDS API
convert.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tdsconvert_h_
21 #define _tdsconvert_h_
22 
23 #include <freetds/pushvis.h>
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #if 0
29 }
30 #endif
31 #endif
32 
33 typedef union conv_result
34 {
35  /* fixed */
36  TDS_TINYINT ti;
37  TDS_SMALLINT si;
38  TDS_USMALLINT usi;
39  TDS_INT i;
40  TDS_UINT ui;
41  TDS_INT8 bi;
42  TDS_UINT8 ubi;
43  TDS_FLOAT f;
44  TDS_REAL r;
45  TDS_MONEY m;
46  TDS_MONEY4 m4;
47  TDS_DATETIME dt;
48  TDS_DATETIME4 dt4;
49  TDS_DATETIMEALL dta;
50  TDS_TIME time;
51  TDS_DATE date;
52  TDS_BIGTIME bigtime;
53  TDS_BIGDATETIME bigdatetime;
54  TDS_NUMERIC n;
55  TDS_UNIQUE u;
56 
57  /* variable */
58  TDS_CHAR *c;
59  TDS_CHAR *ib;
60 
61  /* sized buffer types */
62  struct cc_t {
63  TDS_CHAR *c;
64  TDS_UINT len;
65  } cc;
66  struct cb_t {
67  TDS_CHAR *ib;
68  TDS_UINT len;
69  } cb;
70 }
72 
73 /*
74  * Failure return codes for tds_convert()
75  */
76 #define TDS_CONVERT_FAIL -1 /* unspecified failure */
77 #define TDS_CONVERT_NOAVAIL -2 /* conversion does not exist */
78 #define TDS_CONVERT_SYNTAX -3 /* syntax error in source field */
79 #define TDS_CONVERT_NOMEM -4 /* insufficient memory */
80 #define TDS_CONVERT_OVERFLOW -5 /* result too large */
81 
82 /* sized types */
83 #define TDS_CONVERT_CHAR 256
84 #define TDS_CONVERT_BINARY 257
85 
86 unsigned char tds_willconvert(int srctype, int desttype);
87 
88 TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype);
89 TDS_INT tds_char2hex(TDS_CHAR *dest, TDS_UINT destlen, const TDS_CHAR * src, TDS_UINT srclen);
90 TDS_INT tds_convert(const TDSCONTEXT *context, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr);
91 
92 size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * timeptr, int prec);
93 
94 #ifdef __cplusplus
95 #if 0
96 {
97 #endif
98 }
99 #endif
100 
101 #include <freetds/popvis.h>
102 
103 #endif /* _tdsconvert_h_ */
Used by tds_datecrack.
Definition: tds.h:159
Definition: proto.h:39
size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *timeptr, int prec)
format a date string according to an "extended" strftime(3) formatting definition.
Definition: convert.c:2979
TDS_INT tds_convert(const TDSCONTEXT *context, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
tds_convert convert a type to another.
Definition: convert.c:1878
Definition: convert.h:34
Definition: proto.h:50
Definition: convert.h:66
TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype)
Get same type but nullable.
Definition: convert.c:2913
Definition: proto.h:62
Definition: proto.h:45
Definition: convert.h:62
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
Definition: proto.h:56
Definition: tds.h:1029
Definition: proto.h:26
unsigned char tds_willconvert(int srctype, int desttype)
Test if a conversion is possible.
Definition: convert.c:3093
freetds-1.3.6/doc/reference/a00404_source.html000644 025423 025423 00000042771 14162303413 022374 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/data.h Source File
FreeTDS API
data.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2014 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _freetds_data_h_
21 #define _freetds_data_h_
22 
23 #ifndef _tds_h_
24 # error Include tds.h before data.h
25 #endif
26 
27 #include <freetds/pushvis.h>
28 
29 #define TDS_COMMON_FUNCS(name) \
30 { \
31  tds_ ## name ## _get_info, \
32  tds_ ## name ## _get, \
33  tds_ ## name ## _row_len, \
34  tds_ ## name ## _put_info, \
35  tds_ ## name ## _put, \
36  TDS_EXTRA_CHECK(tds_ ## name ## _check) \
37 }
38 
39 tds_func_get_info tds_invalid_get_info;
40 tds_func_row_len tds_invalid_row_len;
41 tds_func_get_data tds_invalid_get;
42 tds_func_put_info tds_invalid_put_info;
43 tds_func_put_data tds_invalid_put;
44 tds_func_check tds_invalid_check;
45 
46 tds_func_get_info tds_generic_get_info;
47 tds_func_row_len tds_generic_row_len;
48 tds_func_get_data tds_generic_get;
49 tds_func_put_info tds_generic_put_info;
50 tds_func_put_data tds_generic_put;
51 tds_func_check tds_generic_check;
52 
53 tds_func_get_info tds_numeric_get_info;
54 tds_func_row_len tds_numeric_row_len;
55 tds_func_get_data tds_numeric_get;
56 tds_func_put_info tds_numeric_put_info;
57 tds_func_put_data tds_numeric_put;
58 tds_func_check tds_numeric_check;
59 
60 #define tds_variant_get_info tds_generic_get_info
61 #define tds_variant_row_len tds_generic_row_len
62 tds_func_get_data tds_variant_get;
63 tds_func_put_info tds_variant_put_info;
64 tds_func_put_data tds_variant_put;
65 tds_func_check tds_variant_check;
66 
67 tds_func_get_info tds_msdatetime_get_info;
68 tds_func_row_len tds_msdatetime_row_len;
69 tds_func_get_data tds_msdatetime_get;
70 tds_func_put_info tds_msdatetime_put_info;
71 tds_func_put_data tds_msdatetime_put;
72 tds_func_check tds_msdatetime_check;
73 
74 tds_func_get_info tds_clrudt_get_info;
75 tds_func_row_len tds_clrudt_row_len;
76 #define tds_clrudt_get tds_generic_get
77 tds_func_put_info tds_clrudt_put_info;
78 #define tds_clrudt_put tds_generic_put
79 tds_func_check tds_clrudt_check;
80 
81 tds_func_get_info tds_sybbigtime_get_info;
82 tds_func_row_len tds_sybbigtime_row_len;
83 tds_func_get_data tds_sybbigtime_get;
84 tds_func_put_info tds_sybbigtime_put_info;
85 tds_func_put_data tds_sybbigtime_put;
86 tds_func_check tds_sybbigtime_check;
87 
92 #ifndef TDS_DONT_DEFINE_DEFAULT_FUNCTIONS
93 # define TDS_DEFINE_DEFAULT_FUNCS(name) \
94  const TDSCOLUMNFUNCS tds_ ## name ## _funcs = TDS_COMMON_FUNCS(name)
95 
96 TDS_DEFINE_DEFAULT_FUNCS(invalid);
97 TDS_DEFINE_DEFAULT_FUNCS(generic);
98 TDS_DEFINE_DEFAULT_FUNCS(numeric);
99 TDS_DEFINE_DEFAULT_FUNCS(variant);
100 TDS_DEFINE_DEFAULT_FUNCS(msdatetime);
101 TDS_DEFINE_DEFAULT_FUNCS(clrudt);
102 TDS_DEFINE_DEFAULT_FUNCS(sybbigtime);
103 #endif
104 
105 #include <freetds/popvis.h>
106 
107 #endif
TDSRET tds_generic_put(TDSSOCKET *tds, TDSCOLUMN *curcol, int bcp7)
Write data to wire.
Definition: data.c:919
TDSRET tds_generic_get(TDSSOCKET *tds, TDSCOLUMN *curcol)
Read a data from wire.
Definition: data.c:713
TDSRET tds_generic_put_info(TDSSOCKET *tds, TDSCOLUMN *col)
Put data information to wire.
Definition: data.c:875
freetds-1.3.6/doc/reference/doc.png000644 025423 025423 00000001352 14162303421 020556 0ustar00fredianofrediano000000 000000 ‰PNG  IHDRÚ}\ˆ±IDATxíMOS[…Ÿžsúa?-XZ(PD4‚ AWbu`b 77wäHFÆCËÔÂÿà/`vo„ˆAPòq‹P @ ­ûÝè980 îà¤+»§Ýy×^ïZï9SW¹\83g‰3'°Nâçl¹¸_b¯p ïåûÆVÜÖ¡€Ÿ×"¬Ö†X€d]Ðà3“ÉÃÄÌ™xŸ ßMàœ[<çSPkvc—hÈ'…™˜^Åm™hØ7 `Û™¦ èÀåráq›‘œ¾!daeKŸþÆÕ˜:Ì*³_דâèi?I–eP*B7Ÿ¿åô!¹Ýgr6Ër6oKbëþãðôrI”ËTˆüªŒ¨xóö=›ù¢&‰(e+ßóÄkýÇ`ëÁÜb.“¸ÐW×w0¥°jÑzN™¬|©WEãµ¢a¯6[öX†AkÓù*/œ¨‰€ÉY­ ÿV’§–u²jÂ>1W *½·°PGŽzÿ¨/Eg{ ŸÇâaoŠÁVú:è¿™¤1$ôR§W,–ªà¨@ŠË56¾ÀÔÜ-¾,mê¸Î/æè¹– òr5¥T*S(Vf8ö9u’ Õ£w›ùóa=Í<{Ò¡UŒ÷r¯+ÉådDÏF$è°…£é¿`zþ»ÎúöN‘µÜ®0Q3£~_^Ëóâ¯N=ˆvpTà±LžT}ˆîkq†Òm<¼ÎÓ?Zh¿X£ï_þÝ¥[)ƒ `gêÃa_Ô*äÔ2`'=õ´Fÿ2EâÁPú ÷»›l=8‹Wv°%THqÉ¿<"¤ïG¾ÆxH{#ÆÖ«aÔJÕÞ‡—m‹„ çñKsÿàñVŠØ¡°·MâÒ^ TÁ– Ý›r¥ß½ømüÿ_™?ªWİ÷#uIEND®B`‚freetds-1.3.6/doc/reference/a00431.html000644 025423 025423 00000025743 14162303416 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/replacements/poll.h File Reference
FreeTDS API
poll.h File Reference

Provide poll call where missing. More...

#include <config.h>
#include <freetds/pushvis.h>
#include <freetds/popvis.h>
Include dependency graph for poll.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pollfd
 

Macros

#define _REPLACEMENTS_POLL_H
 
#define FD_SETSIZE   OPEN_MAX
 
#define poll(fds, nfds, timeout)   tds_poll(fds, nfds, timeout)
 
#define POLLERR   0x0008
 
#define POLLHUP   0x0010
 
#define POLLIN   0x0001
 
#define POLLNORM   POLLIN
 
#define POLLNVAL   0x0020
 
#define POLLOUT   0x0004
 
#define POLLPRI   POLLIN
 
#define POLLRDBAND   POLLIN
 
#define POLLRDNORM   POLLIN
 
#define POLLWRBAND   POLLOUT
 
#define POLLWRNORM   POLLOUT
 

Typedefs

typedef struct pollfd pollfd_t
 

Functions

int tds_poll (struct pollfd fds[], int nfds, int timeout)
 

Detailed Description

Provide poll call where missing.

freetds-1.3.6/doc/reference/a00407_source.html000644 025423 025423 00000276603 14162303413 022402 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/encodings.h Source File
FreeTDS API
encodings.h
1 /*
2  * This file produced from ./encodings.pl on Mon Dec 27 09:27:29 2021
3  */
4 #ifdef TDS_ICONV_ENCODING_TABLES
5 
6 static const TDS_ENCODING canonic_charsets[] = {
7  { "ISO-8859-1", 1, 1, 0}, /* 0 */
8  { "UTF-8", 1, 4, 1}, /* 1 */
9  { "UCS-2LE", 2, 2, 2}, /* 2 */
10  { "UCS-2BE", 2, 2, 3}, /* 3 */
11  { "ARMSCII-8", 1, 1, 4}, /* 4 */
12  { "BIG-5", 1, 2, 5}, /* 5 */
13  { "BIG5-HKSCS", 1, 2, 6}, /* 6 */
14  { "C99", 1, 1, 7}, /* 7 */
15  { "CHINESE", 1, 1, 8}, /* 8 */
16  { "CN", 1, 1, 9}, /* 9 */
17  { "CN-GB", 1, 2, 10}, /* 10 */
18  { "CN-GB-ISOIR165", 1, 1, 11}, /* 11 */
19  { "CP1133", 1, 1, 12}, /* 12 */
20  { "CP1250", 1, 1, 13}, /* 13 */
21  { "CP1251", 1, 1, 14}, /* 14 */
22  { "CP1252", 1, 1, 15}, /* 15 */
23  { "CP1253", 1, 1, 16}, /* 16 */
24  { "CP1254", 1, 1, 17}, /* 17 */
25  { "CP1255", 1, 1, 18}, /* 18 */
26  { "CP1256", 1, 1, 19}, /* 19 */
27  { "CP1257", 1, 1, 20}, /* 20 */
28  { "CP1258", 1, 1, 21}, /* 21 */
29  { "CP1361", 1, 2, 22}, /* 22 */
30  { "CP437", 1, 1, 23}, /* 23 */
31  { "CP850", 1, 1, 24}, /* 24 */
32  { "CP862", 1, 1, 25}, /* 25 */
33  { "CP866", 1, 1, 26}, /* 26 */
34  { "CP874", 1, 1, 27}, /* 27 */
35  { "CP932", 1, 2, 28}, /* 28 */
36  { "CP936", 1, 2, 29}, /* 29 */
37  { "CP949", 1, 2, 30}, /* 30 */
38  { "CP950", 1, 2, 31}, /* 31 */
39  { "EUC-JP", 1, 3, 32}, /* 32 */
40  { "EUC-KR", 1, 2, 33}, /* 33 */
41  { "EUC-TW", 1, 4, 34}, /* 34 */
42  { "GB18030", 1, 4, 35}, /* 35 */
43  { "GEORGIAN-ACADEMY", 1, 1, 36}, /* 36 */
44  { "GEORGIAN-PS", 1, 1, 37}, /* 37 */
45  { "HZ", 1, 1, 38}, /* 38 */
46  { "ISO-2022-CN", 1, 4, 39}, /* 39 */
47  { "ISO-2022-CN-EXT", 1, 4, 40}, /* 40 */
48  { "ISO-2022-JP", 1, 1, 41}, /* 41 */
49  { "ISO-2022-JP-1", 1, 1, 42}, /* 42 */
50  { "ISO-2022-JP-2", 1, 1, 43}, /* 43 */
51  { "ISO-2022-KR", 1, 2, 44}, /* 44 */
52  { "ISO-8859-10", 1, 1, 45}, /* 45 */
53  { "ISO-8859-13", 1, 1, 46}, /* 46 */
54  { "ISO-8859-14", 1, 1, 47}, /* 47 */
55  { "ISO-8859-15", 1, 1, 48}, /* 48 */
56  { "ISO-8859-16", 1, 1, 49}, /* 49 */
57  { "ISO-8859-2", 1, 1, 50}, /* 50 */
58  { "ISO-8859-3", 1, 1, 51}, /* 51 */
59  { "ISO-8859-4", 1, 1, 52}, /* 52 */
60  { "ISO-8859-5", 1, 1, 53}, /* 53 */
61  { "ISO-8859-6", 1, 1, 54}, /* 54 */
62  { "ISO-8859-7", 1, 1, 55}, /* 55 */
63  { "ISO-8859-8", 1, 1, 56}, /* 56 */
64  { "ISO-8859-9", 1, 1, 57}, /* 57 */
65  { "ISO-IR-14", 1, 1, 58}, /* 58 */
66  { "ISO-IR-149", 1, 1, 59}, /* 59 */
67  { "ISO-IR-159", 1, 1, 60}, /* 60 */
68  { "ISO-IR-166", 1, 1, 61}, /* 61 */
69  { "ISO-IR-87", 1, 1, 62}, /* 62 */
70  { "JAVA", 1, 1, 63}, /* 63 */
71  { "JISX0201-1976", 1, 1, 64}, /* 64 */
72  { "KOI8-R", 1, 1, 65}, /* 65 */
73  { "KOI8-RU", 1, 1, 66}, /* 66 */
74  { "KOI8-T", 1, 1, 67}, /* 67 */
75  { "KOI8-U", 1, 1, 68}, /* 68 */
76  { "MAC", 1, 1, 69}, /* 69 */
77  { "MACARABIC", 1, 1, 70}, /* 70 */
78  { "MACCENTRALEUROPE", 1, 1, 71}, /* 71 */
79  { "MACCROATIAN", 1, 1, 72}, /* 72 */
80  { "MACCYRILLIC", 1, 1, 73}, /* 73 */
81  { "MACGREEK", 1, 1, 74}, /* 74 */
82  { "MACHEBREW", 1, 1, 75}, /* 75 */
83  { "MACICELAND", 1, 1, 76}, /* 76 */
84  { "MACROMANIA", 1, 1, 77}, /* 77 */
85  { "MACTHAI", 1, 1, 78}, /* 78 */
86  { "MACTURKISH", 1, 1, 79}, /* 79 */
87  { "MACUKRAINE", 1, 1, 80}, /* 80 */
88  { "MULELAO-1", 1, 1, 81}, /* 81 */
89  { "NEXTSTEP", 1, 1, 82}, /* 82 */
90  { "ROMAN8", 1, 1, 83}, /* 83 */
91  { "SJIS", 1, 2, 84}, /* 84 */
92  { "TCVN", 1, 1, 85}, /* 85 */
93  { "UCS-4BE", 4, 4, 86}, /* 86 */
94  { "UCS-4LE", 4, 4, 87}, /* 87 */
95  { "US-ASCII", 1, 1, 88}, /* 88 */
96  { "UTF-16BE", 2, 4, 89}, /* 89 */
97  { "UTF-16LE", 2, 4, 90}, /* 90 */
98  { "UTF-32BE", 4, 4, 91}, /* 91 */
99  { "UTF-32LE", 4, 4, 92}, /* 92 */
100  { "UTF-7", 1, 4, 93}, /* 93 */
101  { "VISCII", 1, 1, 94}, /* 94 */
102 };
103 
104 static const CHARACTER_SET_ALIAS iconv_aliases[] = {
105  { "646", 88 },
106  { "850", 24 },
107  { "862", 25 },
108  { "866", 26 },
109  { "ANSI_X3.4-1968", 88 },
110  { "ANSI_X3.4-1986", 88 },
111  { "ARABIC", 54 },
112  { "ARMSCII-8", 4 },
113  { "ASCII", 88 },
114  { "ASMO-708", 54 },
115  { "BIG-5", 5 },
116  { "BIG-FIVE", 5 },
117  { "BIG5", 5 },
118  { "BIG5-HKSCS", 6 },
119  { "BIG5HKSCS", 6 },
120  { "BIGFIVE", 5 },
121  { "C99", 7 },
122  { "CHINESE", 8 },
123  { "CN", 9 },
124  { "CN-BIG5", 5 },
125  { "CN-GB", 10 },
126  { "CN-GB-ISOIR165", 11 },
127  { "CP1133", 12 },
128  { "CP1250", 13 },
129  { "CP1251", 14 },
130  { "CP1252", 15 },
131  { "CP1253", 16 },
132  { "CP1254", 17 },
133  { "CP1255", 18 },
134  { "CP1256", 19 },
135  { "CP1257", 20 },
136  { "CP1258", 21 },
137  { "CP1361", 22 },
138  { "CP367", 88 },
139  { "CP437", 23 },
140  { "CP819", 0 },
141  { "CP850", 24 },
142  { "CP862", 25 },
143  { "CP866", 26 },
144  { "CP874", 27 },
145  { "CP932", 28 },
146  { "CP936", 29 },
147  { "CP949", 30 },
148  { "CP950", 31 },
149  { "CSASCII", 88 },
150  { "CSBIG5", 5 },
151  { "CSEUCKR", 33 },
152  { "CSEUCPKDFMTJAPANESE", 32 },
153  { "CSEUCTW", 34 },
154  { "CSGB2312", 10 },
155  { "CSHALFWIDTHKATAKANA", 64 },
156  { "CSHPROMAN8", 83 },
157  { "CSIBM866", 26 },
158  { "CSISO14JISC6220RO", 58 },
159  { "CSISO159JISX02121990", 60 },
160  { "CSISO2022CN", 39 },
161  { "CSISO2022JP", 41 },
162  { "CSISO2022JP2", 43 },
163  { "CSISO2022KR", 44 },
164  { "CSISO57GB1988", 9 },
165  { "CSISO58GB231280", 8 },
166  { "CSISO87JISX0208", 62 },
167  { "CSISOLATIN1", 0 },
168  { "CSISOLATIN2", 50 },
169  { "CSISOLATIN3", 51 },
170  { "CSISOLATIN4", 52 },
171  { "CSISOLATIN5", 57 },
172  { "CSISOLATIN6", 45 },
173  { "CSISOLATINARABIC", 54 },
174  { "CSISOLATINCYRILLIC", 53 },
175  { "CSISOLATINGREEK", 55 },
176  { "CSISOLATINHEBREW", 56 },
177  { "CSKOI8R", 65 },
178  { "CSKSC56011987", 59 },
179  { "CSMACINTOSH", 69 },
180  { "CSPC850MULTILINGUAL", 24 },
181  { "CSPC862LATINHEBREW", 25 },
182  { "CSSHIFTJIS", 84 },
183  { "CSUNICODE11", 3 },
184  { "CSUNICODE11UTF7", 93 },
185  { "CSVISCII", 94 },
186  { "CYRILLIC", 53 },
187  { "ECMA-114", 54 },
188  { "ECMA-118", 55 },
189  { "ELOT_928", 55 },
190  { "EUC-CN", 10 },
191  { "EUC-JP", 32 },
192  { "EUC-KR", 33 },
193  { "EUC-TW", 34 },
194  { "EUCCN", 10 },
195  { "EUCJP", 32 },
196  { "EUCKR", 33 },
197  { "EUCTW", 34 },
198  {"EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", 32 },
199  { "GB18030", 35 },
200  { "GB2312", 10 },
201  { "GBK", 29 },
202  { "GB_1988-80", 9 },
203  { "GB_2312-80", 8 },
204  { "GEORGIAN-ACADEMY", 36 },
205  { "GEORGIAN-PS", 37 },
206  { "GREEK", 55 },
207  { "GREEK8", 55 },
208  { "HEBREW", 56 },
209  { "HP-ROMAN8", 83 },
210  { "HZ", 38 },
211  { "HZ-GB-2312", 38 },
212  { "IBM-CP1133", 12 },
213  { "IBM367", 88 },
214  { "IBM437", 23 },
215  { "IBM819", 0 },
216  { "IBM850", 24 },
217  { "IBM862", 25 },
218  { "IBM866", 26 },
219  { "ISO-2022-CN", 39 },
220  { "ISO-2022-CN-EXT", 40 },
221  { "ISO-2022-JP", 41 },
222  { "ISO-2022-JP-1", 42 },
223  { "ISO-2022-JP-2", 43 },
224  { "ISO-2022-KR", 44 },
225  { "ISO-8859-1", 0 },
226  { "ISO-8859-10", 45 },
227  { "ISO-8859-13", 46 },
228  { "ISO-8859-14", 47 },
229  { "ISO-8859-15", 48 },
230  { "ISO-8859-16", 49 },
231  { "ISO-8859-2", 50 },
232  { "ISO-8859-3", 51 },
233  { "ISO-8859-4", 52 },
234  { "ISO-8859-5", 53 },
235  { "ISO-8859-6", 54 },
236  { "ISO-8859-7", 55 },
237  { "ISO-8859-8", 56 },
238  { "ISO-8859-9", 57 },
239  { "ISO-CELTIC", 47 },
240  { "ISO-IR-100", 0 },
241  { "ISO-IR-101", 50 },
242  { "ISO-IR-109", 51 },
243  { "ISO-IR-110", 52 },
244  { "ISO-IR-126", 55 },
245  { "ISO-IR-127", 54 },
246  { "ISO-IR-138", 56 },
247  { "ISO-IR-14", 58 },
248  { "ISO-IR-144", 53 },
249  { "ISO-IR-148", 57 },
250  { "ISO-IR-149", 59 },
251  { "ISO-IR-157", 45 },
252  { "ISO-IR-159", 60 },
253  { "ISO-IR-165", 11 },
254  { "ISO-IR-166", 61 },
255  { "ISO-IR-179", 46 },
256  { "ISO-IR-199", 47 },
257  { "ISO-IR-203", 48 },
258  { "ISO-IR-226", 49 },
259  { "ISO-IR-57", 9 },
260  { "ISO-IR-58", 8 },
261  { "ISO-IR-6", 88 },
262  { "ISO-IR-87", 62 },
263  { "ISO646-CN", 9 },
264  { "ISO646-JP", 58 },
265  { "ISO646-US", 88 },
266  { "ISO8859-1", 0 },
267  { "ISO8859-10", 45 },
268  { "ISO8859-15", 48 },
269  { "ISO8859-2", 50 },
270  { "ISO8859-4", 52 },
271  { "ISO8859-5", 53 },
272  { "ISO8859-6", 54 },
273  { "ISO8859-7", 55 },
274  { "ISO8859-8", 56 },
275  { "ISO8859-9", 57 },
276  { "ISO_646.IRV:1991", 88 },
277  { "ISO_8859-1", 0 },
278  { "ISO_8859-10", 45 },
279  { "ISO_8859-10:1992", 45 },
280  { "ISO_8859-13", 46 },
281  { "ISO_8859-14", 47 },
282  { "ISO_8859-14:1998", 47 },
283  { "ISO_8859-15", 48 },
284  { "ISO_8859-15:1998", 48 },
285  { "ISO_8859-16", 49 },
286  { "ISO_8859-16:2000", 49 },
287  { "ISO_8859-1:1987", 0 },
288  { "ISO_8859-2", 50 },
289  { "ISO_8859-2:1987", 50 },
290  { "ISO_8859-3", 51 },
291  { "ISO_8859-3:1988", 51 },
292  { "ISO_8859-4", 52 },
293  { "ISO_8859-4:1988", 52 },
294  { "ISO_8859-5", 53 },
295  { "ISO_8859-5:1988", 53 },
296  { "ISO_8859-6", 54 },
297  { "ISO_8859-6:1987", 54 },
298  { "ISO_8859-7", 55 },
299  { "ISO_8859-7:1987", 55 },
300  { "ISO_8859-8", 56 },
301  { "ISO_8859-8:1988", 56 },
302  { "ISO_8859-9", 57 },
303  { "ISO_8859-9:1989", 57 },
304  { "JAVA", 63 },
305  { "JIS0208", 62 },
306  { "JISX0201-1976", 64 },
307  { "JIS_C6220-1969-RO", 58 },
308  { "JIS_C6226-1983", 62 },
309  { "JIS_X0201", 64 },
310  { "JIS_X0208", 62 },
311  { "JIS_X0208-1983", 62 },
312  { "JIS_X0208-1990", 62 },
313  { "JIS_X0212", 60 },
314  { "JIS_X0212-1990", 60 },
315  { "JIS_X0212.1990-0", 60 },
316  { "JOHAB", 22 },
317  { "JP", 58 },
318  { "KOI8-R", 65 },
319  { "KOI8-RU", 66 },
320  { "KOI8-T", 67 },
321  { "KOI8-U", 68 },
322  { "KOREAN", 59 },
323  { "KSC_5601", 59 },
324  { "KS_C_5601-1987", 59 },
325  { "KS_C_5601-1989", 59 },
326  { "L1", 0 },
327  { "L2", 50 },
328  { "L3", 51 },
329  { "L4", 52 },
330  { "L5", 57 },
331  { "L6", 45 },
332  { "L7", 46 },
333  { "L8", 47 },
334  { "LATIN1", 0 },
335  { "LATIN2", 50 },
336  { "LATIN3", 51 },
337  { "LATIN4", 52 },
338  { "LATIN5", 57 },
339  { "LATIN6", 45 },
340  { "LATIN7", 46 },
341  { "LATIN8", 47 },
342  { "MAC", 69 },
343  { "MACARABIC", 70 },
344  { "MACCENTRALEUROPE", 71 },
345  { "MACCROATIAN", 72 },
346  { "MACCYRILLIC", 73 },
347  { "MACGREEK", 74 },
348  { "MACHEBREW", 75 },
349  { "MACICELAND", 76 },
350  { "MACINTOSH", 69 },
351  { "MACROMAN", 69 },
352  { "MACROMANIA", 77 },
353  { "MACTHAI", 78 },
354  { "MACTURKISH", 79 },
355  { "MACUKRAINE", 80 },
356  { "MS-ANSI", 15 },
357  { "MS-ARAB", 19 },
358  { "MS-CYRL", 14 },
359  { "MS-EE", 13 },
360  { "MS-GREEK", 16 },
361  { "MS-HEBR", 18 },
362  { "MS-TURK", 17 },
363  { "MS_KANJI", 84 },
364  { "MULELAO-1", 81 },
365  { "NEXTSTEP", 82 },
366  { "R8", 83 },
367  { "ROMAN8", 83 },
368  { "SHIFT-JIS", 84 },
369  { "SHIFT_JIS", 84 },
370  { "SJIS", 84 },
371  { "TCVN", 85 },
372  { "TCVN-5712", 85 },
373  { "TCVN5712-1", 85 },
374  { "TCVN5712-1:1993", 85 },
375  { "TIS-620", 61 },
376  { "TIS620", 61 },
377  { "TIS620-0", 61 },
378  { "TIS620.2529-1", 61 },
379  { "TIS620.2533-0", 61 },
380  { "TIS620.2533-1", 61 },
381  { "UCS-2BE", 3 },
382  { "UCS-2LE", 2 },
383  { "UCS-4BE", 86 },
384  { "UCS-4LE", 87 },
385  { "UHC", 30 },
386  { "UNICODE-1-1", 3 },
387  { "UNICODE-1-1-UTF-7", 93 },
388  { "UNICODEBIG", 3 },
389  { "UNICODELITTLE", 2 },
390  { "US", 88 },
391  { "US-ASCII", 88 },
392  { "UTF-16BE", 89 },
393  { "UTF-16LE", 90 },
394  { "UTF-32BE", 91 },
395  { "UTF-32LE", 92 },
396  { "UTF-7", 93 },
397  { "UTF-8", 1 },
398  { "UTF7", 93 },
399  { "UTF8", 1 },
400  { "VISCII", 94 },
401  { "VISCII1.1-1", 94 },
402  { "WINBALTRIM", 20 },
403  { "WINDOWS-1250", 13 },
404  { "WINDOWS-1251", 14 },
405  { "WINDOWS-1252", 15 },
406  { "WINDOWS-1253", 16 },
407  { "WINDOWS-1254", 17 },
408  { "WINDOWS-1255", 18 },
409  { "WINDOWS-1256", 19 },
410  { "WINDOWS-1257", 20 },
411  { "WINDOWS-1258", 21 },
412  { "WINDOWS-874", 27 },
413  { "X0201", 64 },
414  { "X0208", 62 },
415  { "X0212", 60 },
416  { "big5", 5 },
417  { "cp1250", 13 },
418  { "cp1251", 14 },
419  { "cp1252", 15 },
420  { "cp1253", 16 },
421  { "cp1254", 17 },
422  { "cp1255", 18 },
423  { "cp1256", 19 },
424  { "cp1257", 20 },
425  { "cp1258", 21 },
426  { "cp437", 23 },
427  { "cp850", 24 },
428  { "cp862", 25 },
429  { "cp866", 26 },
430  { "cp874", 27 },
431  { "eucJP", 32 },
432  { "eucKR", 33 },
433  { "eucTW", 34 },
434  { "hp15CN", 8 },
435  { "iso81", 0 },
436  { "iso815", 48 },
437  { "iso82", 50 },
438  { "iso83", 51 },
439  { "iso84", 52 },
440  { "iso85", 53 },
441  { "iso86", 54 },
442  { "iso87", 55 },
443  { "iso88", 56 },
444  { "iso88591", 0 },
445  { "iso885915", 48 },
446  { "iso88592", 50 },
447  { "iso88593", 51 },
448  { "iso88594", 52 },
449  { "iso88595", 53 },
450  { "iso88596", 54 },
451  { "iso88597", 55 },
452  { "iso88598", 56 },
453  { "iso88599", 57 },
454  { "iso89", 57 },
455  { "roma8", 83 },
456  { "roman8", 83 },
457  { "sjis", 84 },
458  { "thai8", 61 },
459  { "tis620", 61 },
460  { "utf8", 1 },
461  {NULL, 0}
462 };
463 
464 #endif
465 
466 enum {
467  TDS_CHARSET_ISO_8859_1 = 0,
468  TDS_CHARSET_UTF_8 = 1,
469  TDS_CHARSET_UCS_2LE = 2,
470  TDS_CHARSET_UCS_2BE = 3,
471  TDS_CHARSET_ARMSCII_8 = 4,
472  TDS_CHARSET_BIG_5 = 5,
473  TDS_CHARSET_BIG5_HKSCS = 6,
474  TDS_CHARSET_C99 = 7,
475  TDS_CHARSET_CHINESE = 8,
476  TDS_CHARSET_CN = 9,
477  TDS_CHARSET_CN_GB = 10,
478  TDS_CHARSET_CN_GB_ISOIR165 = 11,
479  TDS_CHARSET_CP1133 = 12,
480  TDS_CHARSET_CP1250 = 13,
481  TDS_CHARSET_CP1251 = 14,
482  TDS_CHARSET_CP1252 = 15,
483  TDS_CHARSET_CP1253 = 16,
484  TDS_CHARSET_CP1254 = 17,
485  TDS_CHARSET_CP1255 = 18,
486  TDS_CHARSET_CP1256 = 19,
487  TDS_CHARSET_CP1257 = 20,
488  TDS_CHARSET_CP1258 = 21,
489  TDS_CHARSET_CP1361 = 22,
490  TDS_CHARSET_CP437 = 23,
491  TDS_CHARSET_CP850 = 24,
492  TDS_CHARSET_CP862 = 25,
493  TDS_CHARSET_CP866 = 26,
494  TDS_CHARSET_CP874 = 27,
495  TDS_CHARSET_CP932 = 28,
496  TDS_CHARSET_CP936 = 29,
497  TDS_CHARSET_CP949 = 30,
498  TDS_CHARSET_CP950 = 31,
499  TDS_CHARSET_EUC_JP = 32,
500  TDS_CHARSET_EUC_KR = 33,
501  TDS_CHARSET_EUC_TW = 34,
502  TDS_CHARSET_GB18030 = 35,
503  TDS_CHARSET_GEORGIAN_ACADEMY = 36,
504  TDS_CHARSET_GEORGIAN_PS = 37,
505  TDS_CHARSET_HZ = 38,
506  TDS_CHARSET_ISO_2022_CN = 39,
507  TDS_CHARSET_ISO_2022_CN_EXT = 40,
508  TDS_CHARSET_ISO_2022_JP = 41,
509  TDS_CHARSET_ISO_2022_JP_1 = 42,
510  TDS_CHARSET_ISO_2022_JP_2 = 43,
511  TDS_CHARSET_ISO_2022_KR = 44,
512  TDS_CHARSET_ISO_8859_10 = 45,
513  TDS_CHARSET_ISO_8859_13 = 46,
514  TDS_CHARSET_ISO_8859_14 = 47,
515  TDS_CHARSET_ISO_8859_15 = 48,
516  TDS_CHARSET_ISO_8859_16 = 49,
517  TDS_CHARSET_ISO_8859_2 = 50,
518  TDS_CHARSET_ISO_8859_3 = 51,
519  TDS_CHARSET_ISO_8859_4 = 52,
520  TDS_CHARSET_ISO_8859_5 = 53,
521  TDS_CHARSET_ISO_8859_6 = 54,
522  TDS_CHARSET_ISO_8859_7 = 55,
523  TDS_CHARSET_ISO_8859_8 = 56,
524  TDS_CHARSET_ISO_8859_9 = 57,
525  TDS_CHARSET_ISO_IR_14 = 58,
526  TDS_CHARSET_ISO_IR_149 = 59,
527  TDS_CHARSET_ISO_IR_159 = 60,
528  TDS_CHARSET_ISO_IR_166 = 61,
529  TDS_CHARSET_ISO_IR_87 = 62,
530  TDS_CHARSET_JAVA = 63,
531  TDS_CHARSET_JISX0201_1976 = 64,
532  TDS_CHARSET_KOI8_R = 65,
533  TDS_CHARSET_KOI8_RU = 66,
534  TDS_CHARSET_KOI8_T = 67,
535  TDS_CHARSET_KOI8_U = 68,
536  TDS_CHARSET_MAC = 69,
537  TDS_CHARSET_MACARABIC = 70,
538  TDS_CHARSET_MACCENTRALEUROPE = 71,
539  TDS_CHARSET_MACCROATIAN = 72,
540  TDS_CHARSET_MACCYRILLIC = 73,
541  TDS_CHARSET_MACGREEK = 74,
542  TDS_CHARSET_MACHEBREW = 75,
543  TDS_CHARSET_MACICELAND = 76,
544  TDS_CHARSET_MACROMANIA = 77,
545  TDS_CHARSET_MACTHAI = 78,
546  TDS_CHARSET_MACTURKISH = 79,
547  TDS_CHARSET_MACUKRAINE = 80,
548  TDS_CHARSET_MULELAO_1 = 81,
549  TDS_CHARSET_NEXTSTEP = 82,
550  TDS_CHARSET_ROMAN8 = 83,
551  TDS_CHARSET_SJIS = 84,
552  TDS_CHARSET_TCVN = 85,
553  TDS_CHARSET_UCS_4BE = 86,
554  TDS_CHARSET_UCS_4LE = 87,
555  TDS_CHARSET_US_ASCII = 88,
556  TDS_CHARSET_UTF_16BE = 89,
557  TDS_CHARSET_UTF_16LE = 90,
558  TDS_CHARSET_UTF_32BE = 91,
559  TDS_CHARSET_UTF_32LE = 92,
560  TDS_CHARSET_UTF_7 = 93,
561  TDS_CHARSET_VISCII = 94,
562  TDS_NUM_CHARSETS = 95
563 };
564 
Information relevant to libiconv.
Definition: tds.h:618
Definition: iconv.h:73
freetds-1.3.6/doc/reference/a00410_source.html000644 025423 025423 00000055353 14162303413 022371 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/enum_cap.h Source File
FreeTDS API
enum_cap.h
1 typedef enum tds_request_capability
2  { TDS_REQ_LANG = 1
3  , TDS_REQ_RPC = 2
4  , TDS_REQ_EVT = 3
5  , TDS_REQ_MSTMT = 4
6  , TDS_REQ_BCP = 5
7  , TDS_REQ_CURSOR = 6
8  , TDS_REQ_DYNF = 7
9  , TDS_REQ_MSG = 8
10  , TDS_REQ_PARAM = 9
11  , TDS_REQ_DATA_INT1 = 10
12  , TDS_REQ_DATA_INT2 = 11
13  , TDS_REQ_DATA_INT4 = 12
14  , TDS_REQ_DATA_BIT = 13
15  , TDS_REQ_DATA_CHAR = 14
16  , TDS_REQ_DATA_VCHAR = 15
17  , TDS_REQ_DATA_BIN = 16
18  , TDS_REQ_DATA_VBIN = 17
19  , TDS_REQ_DATA_MNY8 = 18
20  , TDS_REQ_DATA_MNY4 = 19
21  , TDS_REQ_DATA_DATE8 = 20
22  , TDS_REQ_DATA_DATE4 = 21
23  , TDS_REQ_DATA_FLT4 = 22
24  , TDS_REQ_DATA_FLT8 = 23
25  , TDS_REQ_DATA_NUM = 24
26  , TDS_REQ_DATA_TEXT = 25
27  , TDS_REQ_DATA_IMAGE = 26
28  , TDS_REQ_DATA_DEC = 27
29  , TDS_REQ_DATA_LCHAR = 28
30  , TDS_REQ_DATA_LBIN = 29
31  , TDS_REQ_DATA_INTN = 30
32  , TDS_REQ_DATA_DATETIMEN = 31
33  , TDS_REQ_DATA_MONEYN = 32
34  , TDS_REQ_CSR_PREV = 33
35  , TDS_REQ_CSR_FIRST = 34
36  , TDS_REQ_CSR_LAST = 35
37  , TDS_REQ_CSR_ABS = 36
38  , TDS_REQ_CSR_REL = 37
39  , TDS_REQ_CSR_MULTI = 38
40  , TDS_REQ_CON_OOB = 39
41  , TDS_REQ_CON_INBAND = 40
42  , TDS_REQ_CON_LOGICAL = 41
43  , TDS_REQ_PROTO_TEXT = 42
44  , TDS_REQ_PROTO_BULK = 43
45  , TDS_REQ_URGEVT = 44
46  , TDS_REQ_DATA_SENSITIVITY = 45
47  , TDS_REQ_DATA_BOUNDARY = 46
48  , TDS_REQ_PROTO_DYNAMIC = 47
49  , TDS_REQ_PROTO_DYNPROC = 48
50  , TDS_REQ_DATA_FLTN = 49
51  , TDS_REQ_DATA_BITN = 50
52  , TDS_REQ_DATA_INT8 = 51
53  , TDS_REQ_DATA_VOID = 52
54  , TDS_REQ_DOL_BULK = 53
55  , TDS_REQ_OBJECT_JAVA1 = 54
56  , TDS_REQ_OBJECT_CHAR = 55
57  , TDS_REQ_OBJECT_BINARY = 57
58  , TDS_REQ_DATA_COLUMNSTATUS = 58
59  , TDS_REQ_WIDETABLE = 59
60  , TDS_REQ_DATA_UINT2 = 61
61  , TDS_REQ_DATA_UINT4 = 62
62  , TDS_REQ_DATA_UINT8 = 63
63  , TDS_REQ_DATA_UINTN = 64
64  , TDS_REQ_CUR_IMPLICIT = 65
65  , TDS_REQ_DATA_NLBIN = 66
66  , TDS_REQ_IMAGE_NCHAR = 67
67  , TDS_OBS_BLOB_NCHAR_16 = 68 /* obsolete */
68  , TDS_REQ_BLOB_NCHAR_8 = 69
69  , TDS_REQ_BLOB_NCHAR_SCSU = 70
70  , TDS_REQ_DATA_DATE = 71
71  , TDS_REQ_DATA_TIME = 72
72  , TDS_REQ_DATA_INTERVAL = 73
73  , TDS_REQ_CSR_SCROLL = 74
74  , TDS_REQ_CSR_SENSITIVE = 75
75  , TDS_REQ_CSR_INSENSITIVE = 76
76  , TDS_REQ_CSR_SEMISENSITIVE = 77
77  , TDS_REQ_CSR_KEYSETDRIVEN = 78
78  , TDS_REQ_SRVPKTSIZE = 79
79  , TDS_REQ_DATA_UNITEXT = 80
80  , TDS_REQ_CAP_CLUSTERFAILOVER = 81
81  , TDS_REQ_DATA_SINT1 = 82
82  , TDS_REQ_LARGEIDENT = 83
83  , TDS_REQ_BLOB_NCHAR_16 = 84
84  , TDS_REQ_DATA_XML = 85
85  , TDS_REQ_CURINFO3 = 86
86  , TDS_REQ_DBRPC2 = 87
87  , TDS_REQ_MIGRATE = 89
88  , TDS_REQ_DATA_BIGDATETIME = 93
89  , TDS_REQ_DATA_BIGTIME = 94
90  , TDS_REQ_CAP_MAX = 94 /* repeats last enum */
91  } TDS_REQUEST_CAPABILITY;
92 
93 typedef enum tds_response_capability
94  { TDS_RES_NOMSG = 1
95  , TDS_RES_NOEED = 2
96  , TDS_RES_NOPARAM = 3
97  , TDS_RES_DATA_NOINT1 = 4
98  , TDS_RES_DATA_NOINT2 = 5
99  , TDS_RES_DATA_NOINT4 = 6
100  , TDS_RES_DATA_NOBIT = 7
101  , TDS_RES_DATA_NOCHAR = 8
102  , TDS_RES_DATA_NOVCHAR = 9
103  , TDS_RES_DATA_NOBIN = 10
104  , TDS_RES_DATA_NOVBIN = 11
105  , TDS_RES_DATA_NOMNY8 = 12
106  , TDS_RES_DATA_NOMNY4 = 13
107  , TDS_RES_DATA_NODATE8 = 14
108  , TDS_RES_DATA_NODATE4 = 15
109  , TDS_RES_DATA_NOFLT4 = 16
110  , TDS_RES_DATA_NOFLT8 = 17
111  , TDS_RES_DATA_NONUM = 18
112  , TDS_RES_DATA_NOTEXT = 19
113  , TDS_RES_DATA_NOIMAGE = 20
114  , TDS_RES_DATA_NODEC = 21
115  , TDS_RES_DATA_NOLCHAR = 22
116  , TDS_RES_DATA_NOLBIN = 23
117  , TDS_RES_DATA_INTN = 24
118  , TDS_RES_DATA_NODATETIMEN = 25
119  , TDS_RES_DATA_NOMONEYN = 26
120  , TDS_RES_CON_NOOOB = 27
121  , TDS_RES_CON_NOINBAND = 28
122  , TDS_RES_PROTO_NOTEXT = 29
123  , TDS_RES_PROTO_NOBULK = 30
124  , TDS_RES_DATA_NOSENSITIVITY = 31
125  , TDS_RES_DATA_NOBOUNDARY = 32
126  , TDS_RES_NOTDSDEBUG = 33
127  , TDS_RES_NOSTRIPBLANKS = 34
128  , TDS_RES_DATA_NOINT8 = 35
129  , TDS_RES_OBJECT_NOJAVA1 = 36
130  , TDS_RES_OBJECT_NOCHAR = 37
131  , TDS_RES_DATA_NOCOLUMNSTATUS = 38
132  , TDS_RES_OBJECT_NOBINARY = 39
133  , TDS_RES_DATA_NOUINT2 = 41
134  , TDS_RES_DATA_NOUINT4 = 42
135  , TDS_RES_DATA_NOUINT8 = 43
136  , TDS_RES_DATA_NOUINTN = 44
137  , TDS_RES_NO_WIDETABLES = 45
138  , TDS_RES_DATA_NONLBIN = 46
139  , TDS_RES_IMAGE_NONCHAR = 47
140  , TDS_RES_BLOB_NONCHAR_16 = 48
141  , TDS_RES_BLOB_NONCHAR_8 = 49
142  , TDS_RES_BLOB_NONCHAR_SCSU = 50
143  , TDS_RES_DATA_NODATE = 51
144  , TDS_RES_DATA_NOTIME = 52
145  , TDS_RES_DATA_NOINTERVAL = 53
146  , TDS_RES_DATA_NOUNITEXT = 54
147  , TDS_RES_DATA_NOSINT1 = 55
148  , TDS_RES_NO_LARGEIDENT = 56
149  , TDS_RES_NO_BLOB_NCHAR_16 = 57
150  , TDS_RES_NO_SRVPKTSIZE = 58
151  , TDS_RES_DATA_NOXML = 59
152  , TDS_RES_NONINT_RETURN_VALUE = 60
153  , TDS_RES_NOXNLDATA = 61
154  , TDS_RES_SUPPRESS_FMT = 62
155  , TDS_RES_SUPPRESS_DONEINPROC = 63
156  , TDS_RES_FORCE_ROWFMT2 = 64
157  , TDS_RES_CAP_MAX = 64 /* repeats last enum */
158  } TDS_RESPONSE_CAPABILITY;
freetds-1.3.6/doc/reference/a00413_source.html000644 025423 025423 00000063305 14162303413 022370 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/iconv.h Source File
FreeTDS API
iconv.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2002, 2003, 2004 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tds_iconv_h_
21 #define _tds_iconv_h_
22 
23 #if HAVE_ICONV
24 #include <iconv.h>
25 #else
26 /* Define iconv_t for src/replacements/iconv.c. */
27 #undef iconv_t
28 typedef void *iconv_t;
29 #endif /* HAVE_ICONV */
30 
31 #if HAVE_ERRNO_H
32 #include <errno.h>
33 #endif
34 
35 #if HAVE_WCHAR_H
36 #include <wchar.h>
37 #endif
38 
39 /* The following EILSEQ advice is borrowed verbatim from GNU iconv. */
40 /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS,
41  have EILSEQ in a different header. On these systems, define EILSEQ
42  ourselves. */
43 #ifndef EILSEQ
44 # define EILSEQ ENOENT
45 #endif
46 
47 #if HAVE_STDLIB_H
48 #include <stdlib.h>
49 #endif /* HAVE_STDLIB_H */
50 
51 #include <freetds/pushvis.h>
52 
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57 
58 #if ! HAVE_ICONV
59 iconv_t tds_sys_iconv_open(const char *tocode, const char *fromcode);
60 size_t tds_sys_iconv(iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft);
61 int tds_sys_iconv_close(iconv_t cd);
62 #else
63 #define tds_sys_iconv_open iconv_open
64 #define tds_sys_iconv iconv
65 #define tds_sys_iconv_close iconv_close
66 #endif /* !HAVE_ICONV */
67 
68 
69 typedef enum
70 { to_server, to_client } TDS_ICONV_DIRECTION;
71 
72 typedef struct _character_set_alias
73 {
74  const char *alias;
75  int canonic;
77 
78 typedef struct tds_errno_message_flags {
79  unsigned int e2big:1;
80  unsigned int eilseq:1;
81  unsigned int einval:1;
83 
84 typedef struct tdsiconvdir
85 {
86  TDS_ENCODING charset;
87 
88  iconv_t cd;
89 } TDSICONVDIR;
90 
92 {
93  struct tdsiconvdir to, from;
94 
95 #define TDS_ENCODING_MEMCPY 1
96  unsigned int flags;
97 
98  /*
99  * Suppress error messages that would otherwise be emitted by tds_iconv().
100  * Functions that process large buffers ask tds_iconv to convert it in "chunks".
101  * We don't want to emit spurious EILSEQ errors or multiple errors for one
102  * buffer. tds_iconv() checks this structure before emiting a message, and
103  * adds to it whenever it emits one. Callers that handle a particular situation themselves
104  * can prepopulate it.
105  */
106  TDS_ERRNO_MESSAGE_FLAGS suppress;
107 
108 };
109 
110 /* We use ICONV_CONST for tds_iconv(), even if we don't have iconv() */
111 #ifndef ICONV_CONST
112 # define ICONV_CONST const
113 #endif
114 
115 size_t tds_iconv(TDSSOCKET * tds, TDSICONV * char_conv, TDS_ICONV_DIRECTION io,
116  const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft);
117 int tds_canonical_charset(const char *charset_name);
118 const char *tds_canonical_charset_name(const char *charset_name);
119 TDSICONV *tds_iconv_get(TDSCONNECTION * conn, const char *client_charset, const char *server_charset);
120 TDSICONV *tds_iconv_get_info(TDSCONNECTION * conn, int canonic_client, int canonic_server);
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #include <freetds/popvis.h>
127 
128 #endif /* _tds_iconv_h_ */
Definition: iconv.h:85
int tds_canonical_charset(const char *charset_name)
Determine canonical iconv character set.
Definition: iconv.c:970
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
Definition: iconv.h:78
const char * tds_canonical_charset_name(const char *charset_name)
Determine canonical iconv character set name.
Definition: iconv.c:982
Definition: iconv.h:92
Definition: tds.h:1091
iconv_t tds_sys_iconv_open(const char *tocode, const char *fromcode)
Inputs are FreeTDS canonical names, no other.
Definition: iconv.c:360
size_t tds_iconv(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Wrapper around iconv(3).
Definition: iconv.c:592
Information for a server connection.
Definition: tds.h:1163
Information relevant to libiconv.
Definition: tds.h:618
Definition: iconv.h:73
freetds-1.3.6/doc/reference/a00416_source.html000644 025423 025423 00000034401 14162303413 022366 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/macros.h Source File
FreeTDS API
macros.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns
3  * Copyright (C) 2010-2017 Frediano Ziglio
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _freetds_macros_h_
22 #define _freetds_macros_h_
23 
24 #ifndef _freetds_config_h_
25 #error should include config.h before
26 #endif
27 
28 #if HAVE_STDDEF_H
29 #include <stddef.h>
30 #endif /* HAVE_STDDEF_H */
31 
32 #include "tds_sysdep_public.h"
33 
34 #define TDS_ZERO_FREE(x) do {free((x)); (x) = NULL;} while(0)
35 #define TDS_VECTOR_SIZE(x) (sizeof(x)/sizeof(x[0]))
36 
37 #ifdef offsetof
38 #define TDS_OFFSET(type, field) offsetof(type, field)
39 #else
40 #define TDS_OFFSET(type, field) (((char*)&((type*)0)->field)-((char*)0))
41 #endif
42 
43 #if ENABLE_EXTRA_CHECKS
44 # if defined(__llvm__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)))
45 # define TDS_COMPILE_CHECK(name,check) \
46  _Static_assert(check,#name)
47 # elif defined(__GNUC__) && __GNUC__ >= 2
48 # define TDS_COMPILE_CHECK(name,check) \
49  extern int name[(check)?1:-1] __attribute__ ((unused))
50 # else
51 # define TDS_COMPILE_CHECK(name,check) \
52  extern int name[(check)?1:-1]
53 # endif
54 # define TDS_EXTRA_CHECK(stmt) stmt
55 #else
56 # define TDS_COMPILE_CHECK(name,check) \
57  extern int disabled_check_##name
58 # define TDS_EXTRA_CHECK(stmt)
59 #endif
60 
61 #if defined(__GNUC__) && __GNUC__ >= 3
62 # define TDS_LIKELY(x) __builtin_expect(!!(x), 1)
63 # define TDS_UNLIKELY(x) __builtin_expect(!!(x), 0)
64 #else
65 # define TDS_LIKELY(x) (x)
66 # define TDS_UNLIKELY(x) (x)
67 #endif
68 
69 #if ENABLE_EXTRA_CHECKS && defined(__GNUC__) && __GNUC__ >= 4
70 #define TDS_WUR __attribute__ ((__warn_unused_result__))
71 #else
72 #define TDS_WUR
73 #endif
74 
75 #define TDS_INT2PTR(i) ((void*)(((char*)0)+((intptr_t)(i))))
76 #define TDS_PTR2INT(p) ((int)(((char*)(p))-((char*)0)))
77 
78 #endif
freetds-1.3.6/doc/reference/a00419_source.html000644 025423 025423 00000360573 14162303413 022405 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/odbc.h Source File
FreeTDS API
odbc.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns
3  * Copyright (C) 2004-2010 Frediano Ziglio
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _sql_h_
22 #define _sql_h_
23 
24 #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS
25 #include <freetds/tds.h>
26 #include <freetds/thread.h>
27 #include <freetds/data.h>
28 
29 #if defined(UNIXODBC) || defined(_WIN32) || defined(TDS_NO_DM)
30 #include <sql.h>
31 #include <sqlext.h>
32 #if defined(UNIXODBC) || defined(_WIN32)
33 #include <odbcinst.h>
34 #endif
35 #else /* IODBC */
36 #include <isql.h>
37 #include <isqlext.h>
38 #ifdef HAVE_IODBCINST_H
39 #include <iodbcinst.h>
40 #endif /* HAVE_IODBCINST_H */
41 #endif
42 
43 #ifdef HAVE_WCHAR_H
44 #include <wchar.h>
45 #endif
46 
47 #ifndef HAVE_SQLLEN
48 #ifndef SQLULEN
49 #define SQLULEN SQLUINTEGER
50 #endif
51 #ifndef SQLLEN
52 #define SQLLEN SQLINTEGER
53 #endif
54 #endif
55 
56 #ifndef HAVE_SQLSETPOSIROW
57 #define SQLSETPOSIROW SQLUSMALLINT
58 #endif
59 
60 #ifndef HAVE_SQLROWOFFSET
61 #define SQLROWOFFSET SQLLEN
62 #endif
63 
64 #ifndef HAVE_SQLROWSETSIZE
65 #define SQLROWSETSIZE SQLULEN
66 #endif
67 
68 #ifdef __cplusplus
69 extern "C"
70 {
71 #if 0
72 }
73 #endif
74 #endif
75 
76 #include <freetds/pushvis.h>
77 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
78 #define ODBC_API SQL_API __attribute__((externally_visible))
79 #else
80 #define ODBC_API SQL_API
81 #endif
82 
83 #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(__GNUC__)
84 # define ODBC_PUBLIC __attribute__((dllexport))
85 #else
86 # define ODBC_PUBLIC
87 #endif
88 
89 #define ODBC_MAX(a,b) ( (a) > (b) ? (a) : (b) )
90 #define ODBC_MIN(a,b) ( (a) < (b) ? (a) : (b) )
91 #define ODBC_CLAMP(x,a,b) ( (x) < (a) ? (a) : (x) > (b) ? (b) : (x) )
92 
93 struct _sql_error
94 {
95  const char *msg;
96  char state2[6];
97  char state3[6];
98  TDS_UINT native;
99  char *server;
100  int linenum;
101  int msgstate;
102  int row;
103 };
104 
106 {
107  struct _sql_error *errs;
108  int num_errors;
109  SQLRETURN lastrc;
110  char ranked;
111 };
112 
113 typedef struct _sql_errors TDS_ERRS;
114 
115 #if ENABLE_EXTRA_CHECKS
116 void odbc_check_struct_extra(void *p);
117 #else
118 static inline void odbc_check_struct_extra(void *p) {}
119 #endif
120 
121 #define ODBC_RETURN(handle, rc) \
122  do { odbc_check_struct_extra(handle); \
123  return handle->errs.lastrc = (rc); } while(0)
124 #define ODBC_RETURN_(handle) \
125  do { odbc_check_struct_extra(handle); \
126  return handle->errs.lastrc; } while(0)
127 
128 #define ODBC_EXIT(handle, rc) \
129  do { SQLRETURN _odbc_rc = handle->errs.lastrc = (rc); \
130  odbc_check_struct_extra(handle); \
131  tds_mutex_unlock(&handle->mtx); \
132  return _odbc_rc; } while(0)
133 #define ODBC_EXIT_(handle) \
134  do { SQLRETURN _odbc_rc = handle->errs.lastrc; \
135  odbc_check_struct_extra(handle); \
136  tds_mutex_unlock(&handle->mtx); \
137  return _odbc_rc; } while(0)
138 
139 
141 void odbc_errs_reset(struct _sql_errors *errs);
142 
144 void odbc_errs_add(struct _sql_errors *errs, const char *sqlstate, const char *msg);
145 
147 void odbc_errs_add_rdbms(struct _sql_errors *errs, TDS_UINT native, const char *sqlstate, const char *msg, int linenum,
148  int msgstate, const char *server, int row);
149 
150 struct _dheader
151 {
152  SQLSMALLINT sql_desc_alloc_type;
153  SQLINTEGER sql_desc_bind_type;
154  SQLULEN sql_desc_array_size;
155  /* TODO SQLLEN ?? see http://support.microsoft.com/default.aspx?scid=kb;en-us;298678 */
156  SQLSMALLINT sql_desc_count;
157  SQLUSMALLINT *sql_desc_array_status_ptr;
158  SQLULEN *sql_desc_rows_processed_ptr;
159  SQLLEN *sql_desc_bind_offset_ptr;
160 };
161 
162 struct _drecord
163 {
164  SQLUINTEGER sql_desc_auto_unique_value;
165  DSTR sql_desc_base_column_name;
166  DSTR sql_desc_base_table_name;
167  SQLINTEGER sql_desc_case_sensitive;
168  DSTR sql_desc_catalog_name;
169  SQLSMALLINT sql_desc_concise_type;
170  SQLPOINTER sql_desc_data_ptr;
171  SQLSMALLINT sql_desc_datetime_interval_code;
172  SQLINTEGER sql_desc_datetime_interval_precision;
173  SQLLEN sql_desc_display_size;
174  SQLSMALLINT sql_desc_fixed_prec_scale;
175  SQLLEN *sql_desc_indicator_ptr;
176  DSTR sql_desc_label;
177  SQLULEN sql_desc_length;
178  /* this point to a constant buffer, do not free or modify */
179  const char *sql_desc_literal_prefix;
180  /* this point to a constant buffer, do not free or modify */
181  const char *sql_desc_literal_suffix;
182  DSTR sql_desc_local_type_name;
183  DSTR sql_desc_name;
184  SQLSMALLINT sql_desc_nullable;
185  SQLINTEGER sql_desc_num_prec_radix;
186  SQLLEN sql_desc_octet_length;
187  SQLLEN *sql_desc_octet_length_ptr;
188  SQLSMALLINT sql_desc_parameter_type;
189  SQLSMALLINT sql_desc_precision;
190  SQLSMALLINT sql_desc_rowver;
191  SQLSMALLINT sql_desc_scale;
192  DSTR sql_desc_schema_name;
193  SQLSMALLINT sql_desc_searchable;
194  DSTR sql_desc_table_name;
195  SQLSMALLINT sql_desc_type;
196  /* this point to a constant buffer, do not free or modify */
197  const char *sql_desc_type_name;
198  SQLSMALLINT sql_desc_unnamed;
199  SQLSMALLINT sql_desc_unsigned;
200  SQLSMALLINT sql_desc_updatable;
201 };
202 
203 struct _hdesc
204 {
205  SQLSMALLINT htype; /* do not reorder this field */
206  struct _sql_errors errs; /* do not reorder this field */
207  tds_mutex mtx;
208  int type;
209  SQLHANDLE parent;
210  struct _dheader header;
211  struct _drecord *records;
212 };
213 
214 typedef struct _hdesc TDS_DESC;
215 
216 #define DESC_IRD 1
217 #define DESC_IPD 2
218 #define DESC_ARD 3
219 #define DESC_APD 4
220 
221 struct _heattr
222 {
223  SQLUINTEGER connection_pooling;
224  SQLUINTEGER cp_match;
225  SQLINTEGER odbc_version;
226  SQLINTEGER output_nts;
227 };
228 
229 struct _hchk
230 {
231  SQLSMALLINT htype; /* do not reorder this field */
232  struct _sql_errors errs; /* do not reorder this field */
233  tds_mutex mtx;
234 };
235 
236 struct _henv
237 {
238  SQLSMALLINT htype; /* do not reorder this field */
239  struct _sql_errors errs; /* do not reorder this field */
240  tds_mutex mtx;
241  TDSCONTEXT *tds_ctx;
242  struct _heattr attr;
243 };
244 
245 struct _hcattr
246 {
247  SQLUINTEGER access_mode;
248  SQLUINTEGER async_enable;
249  SQLUINTEGER auto_ipd;
250  SQLUINTEGER autocommit;
251  SQLUINTEGER connection_dead;
252  SQLUINTEGER connection_timeout;
253  DSTR current_catalog;
254  SQLUINTEGER login_timeout;
255  SQLUINTEGER metadata_id;
256  SQLUINTEGER odbc_cursors;
257  SQLUINTEGER packet_size;
258  SQLHWND quite_mode;
259  DSTR translate_lib;
260  SQLUINTEGER translate_option;
261  SQLUINTEGER txn_isolation;
262  SQLUINTEGER mars_enabled;
263  SQLUINTEGER cursor_type;
264  SQLUINTEGER bulk_enabled;
265 #ifdef TDS_NO_DM
266  SQLUINTEGER trace;
267  DSTR tracefile;
268 #endif
269 };
270 
271 #define TDS_MAX_APP_DESC 100
272 
273 struct _hstmt;
274 struct _hdbc
275 {
276  SQLSMALLINT htype; /* do not reorder this field */
277  struct _sql_errors errs; /* do not reorder this field */
278  tds_mutex mtx;
279  struct _henv *env;
281  DSTR dsn;
282  DSTR oldpwd;
283 #ifdef ENABLE_ODBC_WIDE
284  int original_charset_num;
285  TDSICONV *mb_conv;
286 #endif
287 
295  struct _hstmt *stmt_list;
296  struct _hcattr attr;
298  TDS_DESC *uad[TDS_MAX_APP_DESC];
300  unsigned int cursor_support:1;
301  unsigned int use_oldpwd:1;
302  TDS_INT default_query_timeout;
303 
304  TDSBCPINFO *bcpinfo;
305  char *bcphint;
306 };
307 
308 struct _hsattr
309 {
310  /* TODO remove IRD, ARD, IPD, APD from statement, do not duplicate */
311 /* TDS_DESC *app_row_desc; */
312 /* TDS_DESC *app_param_desc; */
313  SQLUINTEGER async_enable;
314  SQLUINTEGER concurrency;
315  SQLUINTEGER cursor_scrollable;
316  SQLUINTEGER cursor_sensitivity;
317  SQLUINTEGER cursor_type;
318  SQLUINTEGER enable_auto_ipd;
319  SQLPOINTER fetch_bookmark_ptr;
320  SQLULEN keyset_size;
321  SQLULEN max_length;
322  SQLULEN max_rows;
323  SQLUINTEGER metadata_id;
324  SQLUINTEGER noscan;
325  /* apd->sql_desc_bind_offset_ptr */
326  /* SQLUINTEGER *param_bind_offset_ptr; */
327  /* apd->sql_desc_bind_type */
328  /* SQLUINTEGER param_bind_type; */
329  /* apd->sql_desc_array_status_ptr */
330  /* SQLUSMALLINT *param_operation_ptr; */
331  /* ipd->sql_desc_array_status_ptr */
332  /* SQLUSMALLINT *param_status_ptr; */
333  /* ipd->sql_desc_rows_processed_ptr */
334  /* SQLUSMALLINT *params_processed_ptr; */
335  /* apd->sql_desc_array_size */
336  /* SQLUINTEGER paramset_size; */
337  SQLUINTEGER query_timeout;
338  SQLUINTEGER retrieve_data;
339  /* ard->sql_desc_bind_offset_ptr */
340  /* SQLUINTEGER *row_bind_offset_ptr; */
341  /* ard->sql_desc_array_size */
342  /* SQLUINTEGER row_array_size; */
343  /* ard->sql_desc_bind_type */
344  /* SQLUINTEGER row_bind_type; */
345  SQLULEN row_number;
346  /* ard->sql_desc_array_status_ptr */
347  /* SQLUINTEGER *row_operation_ptr; */
348  /* ird->sql_desc_array_status_ptr */
349  /* SQLUINTEGER *row_status_ptr; */
350  /* ird->sql_desc_rows_processed_ptr */
351  /* SQLUINTEGER *rows_fetched_ptr; */
352  SQLUINTEGER simulate_cursor;
353  SQLUINTEGER use_bookmarks;
354  /* SQLGetStmtAttr only */
355 /* TDS_DESC *imp_row_desc; */
356 /* TDS_DESC *imp_param_desc; */
357  DSTR qn_msgtext;
358  DSTR qn_options;
359  SQLUINTEGER qn_timeout;
360 };
361 
362 typedef enum
363 {
364  NOT_IN_ROW,
365  IN_NORMAL_ROW,
366  IN_COMPUTE_ROW,
367  AFTER_COMPUTE_ROW,
368  PRE_NORMAL_ROW
369 } TDS_ODBC_ROW_STATUS;
370 
371 typedef enum
372 {
373  ODBC_SPECIAL_NONE = 0,
374  ODBC_SPECIAL_GETTYPEINFO = 1,
375  ODBC_SPECIAL_COLUMNS = 2,
376  ODBC_SPECIAL_PROCEDURECOLUMNS = 3,
377  ODBC_SPECIAL_SPECIALCOLUMNS = 4
378 } TDS_ODBC_SPECIAL_ROWS;
379 
380 struct _hstmt
381 {
382  SQLSMALLINT htype; /* do not reorder this field */
383  struct _sql_errors errs; /* do not reorder this field */
384  tds_mutex mtx;
385  struct _hdbc *dbc;
390 
392  struct _hstmt *next;
394  struct _hstmt *prev;
395 
396  /* begin prepared query stuff */
397  unsigned is_prepared_query:1;
398  unsigned prepared_query_is_func:1;
399  unsigned prepared_query_is_rpc:1;
404  unsigned need_reprepare:1;
405  unsigned param_data_called:1;
406  /* end prepared query stuff */
407 
413  size_t prepared_pos;
414 
415  unsigned int curr_param_row, num_param_rows;
416 
418  unsigned int param_count;
419  int row;
421  TDS_INT8 row_count;
423  TDS_ODBC_ROW_STATUS row_status;
424  /* do NOT free dynamic, free from socket or attach to connection */
425  TDSDYNAMIC *dyn;
426  TDS_DESC *ard, *ird, *apd, *ipd;
427  TDS_DESC *orig_ard, *orig_apd;
428  SQLULEN sql_rowset_size;
429  struct _hsattr attr;
430  DSTR cursor_name; /* auto generated cursor name */
431  TDS_ODBC_SPECIAL_ROWS special_row;
432  /* do NOT free cursor, free from socket or attach to connection */
433  TDSCURSOR *cursor;
434 };
435 
436 typedef struct _henv TDS_ENV;
437 typedef struct _hdbc TDS_DBC;
438 typedef struct _hstmt TDS_STMT;
439 typedef struct _hchk TDS_CHK;
440 
441 typedef struct {
442  /* this must be the first member */
443  TDSCOLUMNFUNCS common;
444  void (*set_type_info)(TDSCOLUMN *col, struct _drecord *drec, SQLINTEGER odbc_ver);
445 } TDS_FUNCS;
446 
447 #define IS_HENV(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_ENV)
448 #define IS_HDBC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DBC)
449 #define IS_HSTMT(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_STMT)
450 #define IS_HDESC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DESC)
451 
452 /* fix a bug in MingW headers */
453 #ifdef __MINGW32__
454 #if SQL_INTERVAL_YEAR == (100 + SQL_CODE_SECOND)
455 
456 #undef SQL_INTERVAL_YEAR
457 #undef SQL_INTERVAL_MONTH
458 #undef SQL_INTERVAL_DAY
459 #undef SQL_INTERVAL_HOUR
460 #undef SQL_INTERVAL_MINUTE
461 #undef SQL_INTERVAL_SECOND
462 #undef SQL_INTERVAL_YEAR_TO_MONTH
463 #undef SQL_INTERVAL_DAY_TO_HOUR
464 #undef SQL_INTERVAL_DAY_TO_MINUTE
465 #undef SQL_INTERVAL_DAY_TO_SECOND
466 #undef SQL_INTERVAL_HOUR_TO_MINUTE
467 #undef SQL_INTERVAL_HOUR_TO_SECOND
468 #undef SQL_INTERVAL_MINUTE_TO_SECOND
469 
470 #define SQL_INTERVAL_YEAR (100 + SQL_CODE_YEAR)
471 #define SQL_INTERVAL_MONTH (100 + SQL_CODE_MONTH)
472 #define SQL_INTERVAL_DAY (100 + SQL_CODE_DAY)
473 #define SQL_INTERVAL_HOUR (100 + SQL_CODE_HOUR)
474 #define SQL_INTERVAL_MINUTE (100 + SQL_CODE_MINUTE)
475 #define SQL_INTERVAL_SECOND (100 + SQL_CODE_SECOND)
476 #define SQL_INTERVAL_YEAR_TO_MONTH (100 + SQL_CODE_YEAR_TO_MONTH)
477 #define SQL_INTERVAL_DAY_TO_HOUR (100 + SQL_CODE_DAY_TO_HOUR)
478 #define SQL_INTERVAL_DAY_TO_MINUTE (100 + SQL_CODE_DAY_TO_MINUTE)
479 #define SQL_INTERVAL_DAY_TO_SECOND (100 + SQL_CODE_DAY_TO_SECOND)
480 #define SQL_INTERVAL_HOUR_TO_MINUTE (100 + SQL_CODE_HOUR_TO_MINUTE)
481 #define SQL_INTERVAL_HOUR_TO_SECOND (100 + SQL_CODE_HOUR_TO_SECOND)
482 #define SQL_INTERVAL_MINUTE_TO_SECOND (100 + SQL_CODE_MINUTE_TO_SECOND)
483 
484 #endif
485 #endif
486 
487 #ifdef _WIN32
488 bool get_login_info(HWND hwndParent, TDSLOGIN * login);
489 #endif
490 
491 #define ODBC_PARAM_LIST \
492  ODBC_PARAM(Servername) \
493  ODBC_PARAM(Server) \
494  ODBC_PARAM(DSN) \
495  ODBC_PARAM(UID) \
496  ODBC_PARAM(PWD) \
497  ODBC_PARAM(Address) \
498  ODBC_PARAM(Port) \
499  ODBC_PARAM(TDS_Version) \
500  ODBC_PARAM(Language) \
501  ODBC_PARAM(Database) \
502  ODBC_PARAM(TextSize) \
503  ODBC_PARAM(PacketSize) \
504  ODBC_PARAM(ClientCharset) \
505  ODBC_PARAM(DumpFile) \
506  ODBC_PARAM(DumpFileAppend) \
507  ODBC_PARAM(DebugFlags) \
508  ODBC_PARAM(Encryption) \
509  ODBC_PARAM(Trusted_Connection) \
510  ODBC_PARAM(APP) \
511  ODBC_PARAM(WSID) \
512  ODBC_PARAM(UseNTLMv2) \
513  ODBC_PARAM(MARS_Connection) \
514  ODBC_PARAM(REALM) \
515  ODBC_PARAM(ServerSPN) \
516  ODBC_PARAM(AttachDbFilename) \
517  ODBC_PARAM(ApplicationIntent) \
518  ODBC_PARAM(Timeout)
519 
520 #define ODBC_PARAM(p) ODBC_PARAM_##p,
521 enum {
522  ODBC_PARAM_LIST
523  ODBC_PARAM_SIZE
524 };
525 #undef ODBC_PARAM
526 
527 
528 /*
529  * connectparams.h
530  */
531 
532 typedef struct {
533  const char *p;
534  size_t len;
536 
544 int odbc_parse_connect_string(TDS_ERRS *errs, const char *connect_string, const char *connect_string_end, TDSLOGIN * login, TDS_PARSED_PARAM *parsed_params);
545 int odbc_get_dsn_info(TDS_ERRS *errs, const char *DSN, TDSLOGIN * login);
546 #ifdef _WIN32
547 int odbc_build_connect_string(TDS_ERRS *errs, TDS_PARSED_PARAM *params, char **out);
548 #endif
549 
550 /*
551  * convert_tds2sql.c
552  */
553 SQLLEN odbc_tds2sql_col(TDS_STMT * stmt, TDSCOLUMN *curcol, int desttype, TDS_CHAR * dest, SQLULEN destlen, const struct _drecord *drec_ixd);
554 SQLLEN odbc_tds2sql_int4(TDS_STMT * stmt, TDS_INT *src, int desttype, TDS_CHAR * dest, SQLULEN destlen);
555 
556 
557 
558 /*
559  * descriptor.c
560  */
561 TDS_DESC *desc_alloc(SQLHANDLE parent, int desc_type, int alloc_type);
562 SQLRETURN desc_free(TDS_DESC * desc);
563 SQLRETURN desc_alloc_records(TDS_DESC * desc, unsigned count);
564 SQLRETURN desc_copy(TDS_DESC * dest, TDS_DESC * src);
565 SQLRETURN desc_free_records(TDS_DESC * desc);
566 TDS_DBC *desc_get_dbc(TDS_DESC *desc);
567 
568 /*
569  * odbc.c
570  */
571 SQLRETURN _SQLRowCount(SQLHSTMT hstmt, SQLLEN FAR * pcrow);
572 
573 /*
574  * odbc_checks.h
575  */
576 #if ENABLE_EXTRA_CHECKS
577 /* macro */
578 #define CHECK_ENV_EXTRA(env) odbc_check_env_extra(env)
579 #define CHECK_DBC_EXTRA(dbc) odbc_check_dbc_extra(dbc)
580 #define CHECK_STMT_EXTRA(stmt) odbc_check_stmt_extra(stmt)
581 #define CHECK_DESC_EXTRA(desc) odbc_check_desc_extra(desc)
582 /* declarations*/
583 void odbc_check_env_extra(TDS_ENV * env);
584 void odbc_check_dbc_extra(TDS_DBC * dbc);
585 void odbc_check_stmt_extra(TDS_STMT * stmt);
586 void odbc_check_desc_extra(TDS_DESC * desc);
587 #else
588 /* macro */
589 #define CHECK_ENV_EXTRA(env)
590 #define CHECK_DBC_EXTRA(dbc)
591 #define CHECK_STMT_EXTRA(stmt)
592 #define CHECK_DESC_EXTRA(desc)
593 #endif
594 
595 /*
596  * odbc_util.h
597  */
598 
599 /* helpers for ODBC wide string support */
600 #undef _wide
601 #undef _WIDE
602 #ifdef ENABLE_ODBC_WIDE
603 typedef union {
604  char mb[1];
605  SQLWCHAR wide[1];
606 } ODBC_CHAR;
607 # define _wide ,wide
608 # define _wide0 ,0
609 # define _WIDE ,int wide
610 #else
611 # define _wide
612 # define _wide0
613 # define _WIDE
614 # define ODBC_CHAR SQLCHAR
615 #endif
616 int odbc_set_stmt_query(struct _hstmt *stmt, const ODBC_CHAR *sql, int sql_len _WIDE);
617 void odbc_set_return_status(struct _hstmt *stmt, unsigned int n_row);
618 void odbc_set_return_params(struct _hstmt *stmt, unsigned int n_row);
619 
620 void odbc_set_sql_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver);
621 
622 int odbc_sql_to_c_type_default(int sql_type);
623 TDS_SERVER_TYPE odbc_sql_to_server_type(TDSCONNECTION * conn, int sql_type, int sql_unsigned);
624 TDS_SERVER_TYPE odbc_c_to_server_type(int c_type);
625 
626 unsigned int odbc_get_string_size(int size, const ODBC_CHAR * str _WIDE);
627 void odbc_rdbms_version(TDSSOCKET * tds_socket, char *pversion_string);
628 SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC* axd, unsigned int n_row);
629 
630 #ifdef ENABLE_ODBC_WIDE
631 DSTR* odbc_dstr_copy_flag(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str, int flag);
632 #define odbc_dstr_copy(dbc, s, len, out) \
633  odbc_dstr_copy_flag(dbc, s, len, sizeof((out)->mb) ? (out) : (out), wide)
634 #define odbc_dstr_copy_oct(dbc, s, len, out) \
635  odbc_dstr_copy_flag(dbc, s, len, out, wide|0x20)
636 #else
637 DSTR* odbc_dstr_copy(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str);
638 #define odbc_dstr_copy_oct odbc_dstr_copy
639 #endif
640 
641 
642 SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR * pcbBuffer, const char *s, int len, int flag);
643 #ifdef ENABLE_ODBC_WIDE
644 #define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) \
645  odbc_set_string_flag(dbc, sizeof((buf)->mb) ? (buf) : (buf), buf_len, out_len, s, s_len, (wide) | (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10))
646 #define odbc_set_string_oct(dbc, buf, buf_len, out_len, s, s_len) \
647  odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (wide) | (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30))
648 #else
649 #define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) \
650  odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10))
651 #define odbc_set_string_oct(dbc, buf, buf_len, out_len, s, s_len) \
652  odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30))
653 #endif
654 
655 #define odbc_set_dstr_oct(dbc, buf, buf_len, out_len, s) odbc_set_string_oct(dbc, buf, buf_len, out_len, tds_dstr_cstr(s), tds_dstr_len(s))
656 #define odbc_set_dstr(dbc, buf, buf_len, out_len, s) odbc_set_string(dbc, buf, buf_len, out_len, tds_dstr_cstr(s), tds_dstr_len(s))
657 
658 SQLSMALLINT odbc_get_concise_sql_type(SQLSMALLINT type, SQLSMALLINT interval);
659 SQLRETURN odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only);
660 SQLSMALLINT odbc_get_concise_c_type(SQLSMALLINT type, SQLSMALLINT interval);
661 SQLRETURN odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only);
662 
663 SQLLEN odbc_get_octet_len(int c_type, const struct _drecord *drec);
664 void odbc_convert_err_set(struct _sql_errors *errs, TDS_INT err);
665 
666 /*
667  * prepare_query.c
668  */
669 SQLRETURN prepare_call(struct _hstmt *stmt);
670 SQLRETURN native_sql(struct _hdbc *dbc, DSTR *s);
671 int parse_prepared_query(struct _hstmt *stmt, bool compute_row);
672 int start_parse_prepared_query(struct _hstmt *stmt, bool compute_row);
673 int continue_parse_prepared_query(struct _hstmt *stmt, SQLPOINTER DataPtr, SQLLEN StrLen_or_Ind);
674 const char *parse_const_param(const char * s, TDS_SERVER_TYPE *type);
675 const char *odbc_skip_rpc_name(const char *s);
676 
677 /*
678  * sql2tds.c
679  */
680 SQLRETURN odbc_sql2tds(TDS_STMT * stmt, const struct _drecord *drec_ixd, const struct _drecord *drec_axd, TDSCOLUMN *curcol, bool compute_row, const TDS_DESC* axd, unsigned int n_row);
681 TDS_INT convert_datetime2server(int bindtype, const void *src, TDS_DATETIMEALL * dta);
682 
683 /*
684  * bcp.c
685  */
686 void odbc_bcp_free_storage(TDS_DBC *dbc);
687 void odbc_bcp_init(TDS_DBC *dbc, const ODBC_CHAR *tblname, const ODBC_CHAR *hfile, const ODBC_CHAR *errfile, int direction _WIDE);
688 void odbc_bcp_control(TDS_DBC *dbc, int field, void *value);
689 void odbc_bcp_colptr(TDS_DBC *dbc, const void * colptr, int table_column);
690 void odbc_bcp_sendrow(TDS_DBC *dbc);
691 int odbc_bcp_batch(TDS_DBC *dbc);
692 int odbc_bcp_done(TDS_DBC *dbc);
693 void odbc_bcp_bind(TDS_DBC *dbc, const void * varaddr, int prefixlen, int varlen, const void * terminator, int termlen, int vartype, int table_column);
694 
695 /*
696  * sqlwchar.c
697  */
698 #if SIZEOF_SQLWCHAR != SIZEOF_WCHAR_T
699 size_t sqlwcslen(const SQLWCHAR * s);
700 
701 typedef struct sqlwstr_buf {
702  struct sqlwstr_buf *next;
703  wchar_t buf[256];
704 } SQLWSTRBUF;
705 const wchar_t *sqlwstr(const SQLWCHAR * s, SQLWSTRBUF **bufs);
706 void sqlwstr_free(SQLWSTRBUF *bufs);
707 #define SQLWSTR_BUFS(n) SQLWSTRBUF *bufs = NULL
708 #define SQLWSTR(s) sqlwstr(s, &bufs)
709 #define SQLWSTR_FREE() sqlwstr_free(bufs)
710 #else
711 #define sqlwcslen(s) wcslen(s)
712 
713 #define SQLWSTR_BUFS(n) do {} while(0)
714 #define SQLWSTR(s) ((const wchar_t*)(s))
715 #define SQLWSTR_FREE() do {} while(0)
716 #endif
717 
718 int odbc_get_wide_canonic(TDSCONNECTION *conn);
719 
720 #include <freetds/popvis.h>
721 
722 #ifdef __cplusplus
723 #if 0
724 {
725 #endif
726 }
727 #endif
728 
729 #endif
Definition: tds.h:643
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
Definition: odbc.h:275
struct _hstmt * stmt_list
list of all statements allocated from this connection
Definition: odbc.h:295
Definition: odbc.h:163
void odbc_rdbms_version(TDSSOCKET *tds_socket, char *pversion_string)
Returns the version of the RDBMS in the ODBC format.
Definition: odbc_util.c:852
struct _hstmt * next
next in list
Definition: odbc.h:392
TDS_SERVER_TYPE odbc_c_to_server_type(int c_type)
Pass this an SQL_C_* type and get a SYB* type which most closely corresponds to the SQL_C_* type.
Definition: odbc_util.c:601
Main include file for libtds.
SQLRETURN odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
Set concise type and all cascading field.
Definition: odbc_util.c:976
Definition: odbc.h:204
unsigned int param_count
number of parameter in current query
Definition: odbc.h:418
Holds informations about a cursor.
Definition: tds.h:937
struct _hstmt * current_statement
Statement executing.
Definition: odbc.h:293
Definition: odbc.h:151
unsigned int cursor_support
<>0 if server handle cursors
Definition: odbc.h:300
Definition: odbc.h:94
TDS_ODBC_ROW_STATUS row_status
status of row, it can happen that this flag mark that we are still parsing row, this it's normal
Definition: odbc.h:423
size_t prepared_pos
position in prepared query to check parameters, used only in RPC
Definition: odbc.h:413
int param_num
last valid parameter in params, it's a ODBC index (from 1 relative to descriptor)
Definition: odbc.h:411
TDS_DESC * uad[TDS_MAX_APP_DESC]
descriptors associated to connection
Definition: odbc.h:298
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
Definition: odbc.h:381
Definition: tds.h:1091
TDS_INT8 row_count
row count to return
Definition: odbc.h:421
DSTR query
query to execute
Definition: odbc.h:387
Definition: odbc.h:230
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row)
Return length of parameter from parameter information.
Definition: odbc_util.c:861
unsigned need_reprepare
Prepared statement needs to be prepared again.
Definition: odbc.h:404
SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR *pcbBuffer, const char *s, int len, int flag)
Copy a string to client setting size according to ODBC convenction.
Definition: odbc_util.c:301
Definition: odbc.h:532
Definition: odbc.h:246
Definition: odbc.h:106
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
Definition: tds.h:1661
Definition: odbc.h:441
Information for a server connection.
Definition: tds.h:1163
struct _hstmt * prev
previous in list
Definition: odbc.h:394
Definition: odbc.h:309
Definition: odbc.h:237
Definition: tds.h:1029
TDSSOCKET * tds
socket (only if active)
Definition: odbc.h:389
Definition: tds.h:517
TDSPARAMINFO * params
parameters saved
Definition: odbc.h:409
Definition: odbc.h:222
SQLRETURN odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
Set concise type and all cascading field.
Definition: odbc_util.c:1098
freetds-1.3.6/doc/reference/a00422_source.html000644 025423 025423 00000007070 14162303413 022365 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/popvis.h Source File
FreeTDS API
popvis.h
1 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
2 #pragma GCC visibility pop
3 #endif
freetds-1.3.6/doc/reference/a00425_source.html000644 025423 025423 00000237035 14162303413 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/proto.h Source File
FreeTDS API
proto.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns
3  * Copyright (C) 2010, 2011 Frediano Ziglio
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 /*
22  * This file contains defines and structures strictly related to TDS protocol
23  */
24 
25 typedef struct tdsnumeric
26 {
27  unsigned char precision;
28  unsigned char scale;
29  unsigned char array[33];
30 } TDS_NUMERIC;
31 
32 typedef struct tdsoldmoney
33 {
34  TDS_INT mnyhigh;
35  TDS_UINT mnylow;
37 
38 typedef union tdsmoney
39 {
41  TDS_INT8 mny;
42 } TDS_MONEY;
43 
44 typedef struct tdsmoney4
45 {
46  TDS_INT mny4;
47 } TDS_MONEY4;
48 
49 typedef struct tdsdatetime
50 {
51  TDS_INT dtdays;
52  TDS_INT dttime;
53 } TDS_DATETIME;
54 
55 typedef struct tdsdatetime4
56 {
57  TDS_USMALLINT days;
58  TDS_USMALLINT minutes;
60 
61 typedef struct tdsunique
62 {
63  TDS_UINT Data1;
64  TDS_USMALLINT Data2;
65  TDS_USMALLINT Data3;
66  TDS_UCHAR Data4[8];
67 } TDS_UNIQUE;
68 
69 typedef TDS_INT TDS_DATE;
70 typedef TDS_INT TDS_TIME;
71 
72 typedef TDS_UINT8 TDS_BIGTIME;
73 typedef TDS_UINT8 TDS_BIGDATETIME;
74 
75 #define TDS5_PARAMFMT2_TOKEN 32 /* 0x20 */
76 #define TDS_LANGUAGE_TOKEN 33 /* 0x21 TDS 5.0 only */
77 #define TDS_ORDERBY2_TOKEN 34 /* 0x22 */
78 #define TDS_ROWFMT2_TOKEN 97 /* 0x61 TDS 5.0 only */
79 #define TDS_MSG_TOKEN 101 /* 0x65 TDS 5.0 only */
80 #define TDS_LOGOUT_TOKEN 113 /* 0x71 TDS 5.0 only? ct_close() */
81 #define TDS_RETURNSTATUS_TOKEN 121 /* 0x79 */
82 #define TDS_PROCID_TOKEN 124 /* 0x7C TDS 4.2 only - TDS_PROCID */
83 #define TDS7_RESULT_TOKEN 129 /* 0x81 TDS 7.0 only */
84 #define TDS7_COMPUTE_RESULT_TOKEN 136 /* 0x88 TDS 7.0 only */
85 #define TDS_COLNAME_TOKEN 160 /* 0xA0 TDS 4.2 only */
86 #define TDS_COLFMT_TOKEN 161 /* 0xA1 TDS 4.2 only - TDS_COLFMT */
87 #define TDS_DYNAMIC2_TOKEN 163 /* 0xA3 */
88 #define TDS_TABNAME_TOKEN 164 /* 0xA4 */
89 #define TDS_COLINFO_TOKEN 165 /* 0xA5 */
90 #define TDS_OPTIONCMD_TOKEN 166 /* 0xA6 */
91 #define TDS_COMPUTE_NAMES_TOKEN 167 /* 0xA7 */
92 #define TDS_COMPUTE_RESULT_TOKEN 168 /* 0xA8 */
93 #define TDS_ORDERBY_TOKEN 169 /* 0xA9 TDS_ORDER */
94 #define TDS_ERROR_TOKEN 170 /* 0xAA */
95 #define TDS_INFO_TOKEN 171 /* 0xAB */
96 #define TDS_PARAM_TOKEN 172 /* 0xAC RETURNVALUE? */
97 #define TDS_LOGINACK_TOKEN 173 /* 0xAD */
98 #define TDS_CONTROL_FEATUREEXTACK_TOKEN \
99  174 /* 0xAE TDS_CONTROL/TDS_FEATUREEXTACK */
100 #define TDS_ROW_TOKEN 209 /* 0xD1 */
101 #define TDS_NBC_ROW_TOKEN 210 /* 0xD2 as of TDS 7.3.B */
102 #define TDS_CMP_ROW_TOKEN 211 /* 0xD3 */
103 #define TDS5_PARAMS_TOKEN 215 /* 0xD7 TDS 5.0 only */
104 #define TDS_CAPABILITY_TOKEN 226 /* 0xE2 */
105 #define TDS_ENVCHANGE_TOKEN 227 /* 0xE3 */
106 #define TDS_SESSIONSTATE_TOKEN 228 /* 0xE4 TDS 7.4 */
107 #define TDS_EED_TOKEN 229 /* 0xE5 */
108 #define TDS_DBRPC_TOKEN 230 /* 0xE6 TDS 5.0 only */
109 #define TDS5_DYNAMIC_TOKEN 231 /* 0xE7 TDS 5.0 only */
110 #define TDS5_PARAMFMT_TOKEN 236 /* 0xEC TDS 5.0 only */
111 #define TDS_AUTH_TOKEN 237 /* 0xED TDS 7.0 only */
112 #define TDS_RESULT_TOKEN 238 /* 0xEE */
113 #define TDS_DONE_TOKEN 253 /* 0xFD TDS_DONE */
114 #define TDS_DONEPROC_TOKEN 254 /* 0xFE TDS_DONEPROC */
115 #define TDS_DONEINPROC_TOKEN 255 /* 0xFF TDS_DONEINPROC */
116 
117 /* CURSOR support: TDS 5.0 only*/
118 #define TDS_CURCLOSE_TOKEN 128 /* 0x80 TDS 5.0 only */
119 #define TDS_CURDELETE_TOKEN 129 /* 0x81 TDS 5.0 only */
120 #define TDS_CURFETCH_TOKEN 130 /* 0x82 TDS 5.0 only */
121 #define TDS_CURINFO_TOKEN 131 /* 0x83 TDS 5.0 only */
122 #define TDS_CUROPEN_TOKEN 132 /* 0x84 TDS 5.0 only */
123 #define TDS_CURDECLARE_TOKEN 134 /* 0x86 TDS 5.0 only */
124 
125 
126 /* environment type field */
127 #define TDS_ENV_DATABASE 1
128 #define TDS_ENV_LANG 2
129 #define TDS_ENV_CHARSET 3
130 #define TDS_ENV_PACKSIZE 4
131 #define TDS_ENV_LCID 5
132 #define TDS_ENV_SQLCOLLATION 7
133 #define TDS_ENV_BEGINTRANS 8
134 #define TDS_ENV_COMMITTRANS 9
135 #define TDS_ENV_ROLLBACKTRANS 10
136 #define TDS_ENV_ROUTING 20
137 
138 /* Microsoft internal stored procedure id's */
139 #define TDS_SP_CURSOR 1
140 #define TDS_SP_CURSOROPEN 2
141 #define TDS_SP_CURSORPREPARE 3
142 #define TDS_SP_CURSOREXECUTE 4
143 #define TDS_SP_CURSORPREPEXEC 5
144 #define TDS_SP_CURSORUNPREPARE 6
145 #define TDS_SP_CURSORFETCH 7
146 #define TDS_SP_CURSOROPTION 8
147 #define TDS_SP_CURSORCLOSE 9
148 #define TDS_SP_EXECUTESQL 10
149 #define TDS_SP_PREPARE 11
150 #define TDS_SP_EXECUTE 12
151 #define TDS_SP_PREPEXEC 13
152 #define TDS_SP_PREPEXECRPC 14
153 #define TDS_SP_UNPREPARE 15
154 
155 /*
156  * <rant> Sybase does an awful job of this stuff, non null ints of size 1 2
157  * and 4 have there own codes but nullable ints are lumped into INTN
158  * sheesh! </rant>
159  */
160 typedef enum
161 {
162  SYBCHAR = 47, /* 0x2F */
163  SYBVARCHAR = 39, /* 0x27 */
164  SYBINTN = 38, /* 0x26 */
165  SYBINT1 = 48, /* 0x30 */
166  SYBINT2 = 52, /* 0x34 */
167  SYBINT4 = 56, /* 0x38 */
168  SYBFLT8 = 62, /* 0x3E */
169  SYBDATETIME = 61, /* 0x3D */
170  SYBBIT = 50, /* 0x32 */
171  SYBTEXT = 35, /* 0x23 */
172  SYBNTEXT = 99, /* 0x63 */
173  SYBIMAGE = 34, /* 0x22 */
174  SYBMONEY4 = 122, /* 0x7A */
175  SYBMONEY = 60, /* 0x3C */
176  SYBDATETIME4 = 58, /* 0x3A */
177  SYBREAL = 59, /* 0x3B */
178  SYBBINARY = 45, /* 0x2D */
179  SYBVOID = 31, /* 0x1F */
180  SYBVARBINARY = 37, /* 0x25 */
181  SYBBITN = 104, /* 0x68 */
182  SYBNUMERIC = 108, /* 0x6C */
183  SYBDECIMAL = 106, /* 0x6A */
184  SYBFLTN = 109, /* 0x6D */
185  SYBMONEYN = 110, /* 0x6E */
186  SYBDATETIMN = 111, /* 0x6F */
187 
188 /*
189  * MS only types
190  */
191  SYBNVARCHAR = 103, /* 0x67 */
192  SYBINT8 = 127, /* 0x7F */
193  XSYBCHAR = 175, /* 0xAF */
194  XSYBVARCHAR = 167, /* 0xA7 */
195  XSYBNVARCHAR = 231, /* 0xE7 */
196  XSYBNCHAR = 239, /* 0xEF */
197  XSYBVARBINARY = 165, /* 0xA5 */
198  XSYBBINARY = 173, /* 0xAD */
199  SYBUNIQUE = 36, /* 0x24 */
200  SYBVARIANT = 98, /* 0x62 */
201  SYBMSUDT = 240, /* 0xF0 */
202  SYBMSXML = 241, /* 0xF1 */
203  SYBMSDATE = 40, /* 0x28 */
204  SYBMSTIME = 41, /* 0x29 */
205  SYBMSDATETIME2 = 42, /* 0x2a */
206  SYBMSDATETIMEOFFSET = 43,/* 0x2b */
207 
208 /*
209  * Sybase only types
210  */
211  SYBLONGBINARY = 225, /* 0xE1 */
212  SYBUINT1 = 64, /* 0x40 */
213  SYBUINT2 = 65, /* 0x41 */
214  SYBUINT4 = 66, /* 0x42 */
215  SYBUINT8 = 67, /* 0x43 */
216  SYBBLOB = 36, /* 0x24 */
217  SYBBOUNDARY = 104, /* 0x68 */
218  SYBDATE = 49, /* 0x31 */
219  SYBDATEN = 123, /* 0x7B */
220  SYB5INT8 = 191, /* 0xBF */
221  SYBINTERVAL = 46, /* 0x2E */
222  SYBLONGCHAR = 175, /* 0xAF */
223  SYBSENSITIVITY = 103, /* 0x67 */
224  SYBSINT1 = 176, /* 0xB0 */
225  SYBTIME = 51, /* 0x33 */
226  SYBTIMEN = 147, /* 0x93 */
227  SYBUINTN = 68, /* 0x44 */
228  SYBUNITEXT = 174, /* 0xAE */
229  SYBXML = 163, /* 0xA3 */
230  SYB5BIGDATETIME = 187, /* 0xBB */
231  SYB5BIGTIME = 188, /* 0xBC */
232 
233 } TDS_SERVER_TYPE;
234 
235 typedef enum
236 {
237  USER_UNICHAR_TYPE = 34, /* 0x22 */
238  USER_UNIVARCHAR_TYPE = 35 /* 0x23 */
239 } TDS_USER_TYPE;
240 
241 /* compute operator */
242 #define SYBAOPCNT 75 /* 0x4B */
243 #define SYBAOPCNTU 76 /* 0x4C, obsolete */
244 #define SYBAOPSUM 77 /* 0x4D */
245 #define SYBAOPSUMU 78 /* 0x4E, obsolete */
246 #define SYBAOPAVG 79 /* 0x4F */
247 #define SYBAOPAVGU 80 /* 0x50, obsolete */
248 #define SYBAOPMIN 81 /* 0x51 */
249 #define SYBAOPMAX 82 /* 0x52 */
250 
251 /* mssql2k compute operator */
252 #define SYBAOPCNT_BIG 9 /* 0x09 */
253 #define SYBAOPSTDEV 48 /* 0x30 */
254 #define SYBAOPSTDEVP 49 /* 0x31 */
255 #define SYBAOPVAR 50 /* 0x32 */
256 #define SYBAOPVARP 51 /* 0x33 */
257 #define SYBAOPCHECKSUM_AGG 114 /* 0x72 */
258 
262 typedef enum
263 {
264  TDS_OPT_SET = 1
265  , TDS_OPT_DEFAULT = 2
266  , TDS_OPT_LIST = 3
267  , TDS_OPT_INFO = 4
268 } TDS_OPTION_CMD;
269 
270 typedef enum
271 {
272  TDS_OPT_DATEFIRST = 1 /* 0x01 */
273  , TDS_OPT_TEXTSIZE = 2 /* 0x02 */
274  , TDS_OPT_STAT_TIME = 3 /* 0x03 */
275  , TDS_OPT_STAT_IO = 4 /* 0x04 */
276  , TDS_OPT_ROWCOUNT = 5 /* 0x05 */
277  , TDS_OPT_NATLANG = 6 /* 0x06 */
278  , TDS_OPT_DATEFORMAT = 7 /* 0x07 */
279  , TDS_OPT_ISOLATION = 8 /* 0x08 */
280  , TDS_OPT_AUTHON = 9 /* 0x09 */
281  , TDS_OPT_CHARSET = 10 /* 0x0a */
282  , TDS_OPT_SHOWPLAN = 13 /* 0x0d */
283  , TDS_OPT_NOEXEC = 14 /* 0x0e */
284  , TDS_OPT_ARITHIGNOREON = 15 /* 0x0f */
285  , TDS_OPT_ARITHABORTON = 17 /* 0x11 */
286  , TDS_OPT_PARSEONLY = 18 /* 0x12 */
287  , TDS_OPT_GETDATA = 20 /* 0x14 */
288  , TDS_OPT_NOCOUNT = 21 /* 0x15 */
289  , TDS_OPT_FORCEPLAN = 23 /* 0x17 */
290  , TDS_OPT_FORMATONLY = 24 /* 0x18 */
291  , TDS_OPT_CHAINXACTS = 25 /* 0x19 */
292  , TDS_OPT_CURCLOSEONXACT = 26 /* 0x1a */
293  , TDS_OPT_FIPSFLAG = 27 /* 0x1b */
294  , TDS_OPT_RESTREES = 28 /* 0x1c */
295  , TDS_OPT_IDENTITYON = 29 /* 0x1d */
296  , TDS_OPT_CURREAD = 30 /* 0x1e */
297  , TDS_OPT_CURWRITE = 31 /* 0x1f */
298  , TDS_OPT_IDENTITYOFF = 32 /* 0x20 */
299  , TDS_OPT_AUTHOFF = 33 /* 0x21 */
300  , TDS_OPT_ANSINULL = 34 /* 0x22 */
301  , TDS_OPT_QUOTED_IDENT = 35 /* 0x23 */
302  , TDS_OPT_ARITHIGNOREOFF = 36 /* 0x24 */
303  , TDS_OPT_ARITHABORTOFF = 37 /* 0x25 */
304  , TDS_OPT_TRUNCABORT = 38 /* 0x26 */
305 } TDS_OPTION;
306 
307 enum {
308  TDS_OPT_ARITHOVERFLOW = 0x01,
309  TDS_OPT_NUMERICTRUNC = 0x02
310 };
311 
312 enum TDS_OPT_DATEFIRST_CHOICE
313 {
314  TDS_OPT_MONDAY = 1, TDS_OPT_TUESDAY = 2, TDS_OPT_WEDNESDAY = 3, TDS_OPT_THURSDAY = 4, TDS_OPT_FRIDAY = 5, TDS_OPT_SATURDAY =
315  6, TDS_OPT_SUNDAY = 7
316 };
317 
318 enum TDS_OPT_DATEFORMAT_CHOICE
319 {
320  TDS_OPT_FMTMDY = 1, TDS_OPT_FMTDMY = 2, TDS_OPT_FMTYMD = 3, TDS_OPT_FMTYDM = 4, TDS_OPT_FMTMYD = 5, TDS_OPT_FMTDYM = 6
321 };
322 enum TDS_OPT_ISOLATION_CHOICE
323 {
324  TDS_OPT_LEVEL0 = 0,
325  TDS_OPT_LEVEL1 = 1,
326  TDS_OPT_LEVEL2 = 2,
327  TDS_OPT_LEVEL3 = 3
328 };
329 
330 
331 typedef enum tds_packet_type
332 {
333  TDS_QUERY = 1,
334  TDS_LOGIN = 2,
335  TDS_RPC = 3,
336  TDS_REPLY = 4,
337  TDS_CANCEL = 6,
338  TDS_BULK = 7,
339  TDS7_TRANS = 14, /* transaction management */
340  TDS_NORMAL = 15,
341  TDS7_LOGIN = 16,
342  TDS7_AUTH = 17,
343  TDS71_PRELOGIN = 18,
344  TDS72_SMP = 0x53
345 } TDS_PACKET_TYPE;
346 
350 typedef struct
351 {
352  TDS_USMALLINT locale_id; /* master..syslanguages.lcid */
353  TDS_USMALLINT flags;
354  TDS_UCHAR charset_id; /* or zero */
356 
360 typedef struct
361 {
362  TDS_UCHAR signature; /* TDS72_SMP */
363  TDS_UCHAR type;
364  TDS_USMALLINT sid;
365  TDS_UINT size;
366  TDS_UINT seq;
367  TDS_UINT wnd;
369 
370 enum {
371  TDS_SMP_SYN = 1,
372  TDS_SMP_ACK = 2,
373  TDS_SMP_FIN = 4,
374  TDS_SMP_DATA = 8,
375 };
376 
377 /* SF stands for "sort flag" */
378 #define TDS_SF_BIN (TDS_USMALLINT) 0x100
379 #define TDS_SF_WIDTH_INSENSITIVE (TDS_USMALLINT) 0x080
380 #define TDS_SF_KATATYPE_INSENSITIVE (TDS_USMALLINT) 0x040
381 #define TDS_SF_ACCENT_SENSITIVE (TDS_USMALLINT) 0x020
382 #define TDS_SF_CASE_INSENSITIVE (TDS_USMALLINT) 0x010
383 
384 /* UT stands for user type */
385 #define TDS_UT_TIMESTAMP 80
386 
387 
388 /* mssql login options flags */
389 enum option_flag1_values {
390  TDS_BYTE_ORDER_X86 = 0,
391  TDS_CHARSET_ASCII = 0,
392  TDS_DUMPLOAD_ON = 0,
393  TDS_FLOAT_IEEE_754 = 0,
394  TDS_INIT_DB_WARN = 0,
395  TDS_SET_LANG_OFF = 0,
396  TDS_USE_DB_SILENT = 0,
397  TDS_BYTE_ORDER_68000 = 0x01,
398  TDS_CHARSET_EBDDIC = 0x02,
399  TDS_FLOAT_VAX = 0x04,
400  TDS_FLOAT_ND5000 = 0x08,
401  TDS_DUMPLOAD_OFF = 0x10, /* prevent BCP */
402  TDS_USE_DB_NOTIFY = 0x20,
403  TDS_INIT_DB_FATAL = 0x40,
404  TDS_SET_LANG_ON = 0x80
405 };
406 
407 enum option_flag2_values {
408  TDS_INIT_LANG_WARN = 0,
409  TDS_INTEGRATED_SECURTY_OFF = 0,
410  TDS_ODBC_OFF = 0,
411  TDS_USER_NORMAL = 0, /* SQL Server login */
412  TDS_INIT_LANG_REQUIRED = 0x01,
413  TDS_ODBC_ON = 0x02,
414  TDS_TRANSACTION_BOUNDARY71 = 0x04, /* removed in TDS 7.2 */
415  TDS_CACHE_CONNECT71 = 0x08, /* removed in TDS 7.2 */
416  TDS_USER_SERVER = 0x10, /* reserved */
417  TDS_USER_REMUSER = 0x20, /* DQ login */
418  TDS_USER_SQLREPL = 0x40, /* replication login */
419  TDS_INTEGRATED_SECURITY_ON = 0x80
420 };
421 
422 enum option_flag3_values {
423  TDS_RESTRICTED_COLLATION = 0,
424  TDS_CHANGE_PASSWORD = 0x01, /* TDS 7.2 */
425  TDS_SEND_YUKON_BINARY_XML = 0x02, /* TDS 7.2 */
426  TDS_REQUEST_USER_INSTANCE = 0x04, /* TDS 7.2 */
427  TDS_UNKNOWN_COLLATION_HANDLING = 0x08, /* TDS 7.3 */
428  TDS_EXTENSION = 0x10, /* TDS 7.4 */
429 };
430 
431 enum type_flags {
432  TDS_OLEDB_ON = 0x10,
433  TDS_READONLY_INTENT = 0x20,
434 };
435 
436 /* Sybase dynamic types */
437 enum dynamic_types {
438  TDS_DYN_PREPARE = 0x01,
439  TDS_DYN_EXEC = 0x02,
440  TDS_DYN_DEALLOC = 0x04,
441  TDS_DYN_EXEC_IMMED = 0x08,
442  TDS_DYN_PROCNAME = 0x10,
443  TDS_DYN_ACK = 0x20,
444  TDS_DYN_DESCIN = 0x40,
445  TDS_DYN_DESCOUT = 0x80,
446 };
447 
448 /* http://jtds.sourceforge.net/apiCursors.html */
449 /* Cursor scroll option, must be one of 0x01 - 0x10, OR'd with other bits */
450 enum {
451  TDS_CUR_TYPE_KEYSET = 0x0001, /* default */
452  TDS_CUR_TYPE_DYNAMIC = 0x0002,
453  TDS_CUR_TYPE_FORWARD = 0x0004,
454  TDS_CUR_TYPE_STATIC = 0x0008,
455  TDS_CUR_TYPE_FASTFORWARDONLY = 0x0010,
456  TDS_CUR_TYPE_PARAMETERIZED = 0x1000,
457  TDS_CUR_TYPE_AUTO_FETCH = 0x2000
458 };
459 
460 enum {
461  TDS_CUR_CONCUR_READ_ONLY = 1,
462  TDS_CUR_CONCUR_SCROLL_LOCKS = 2,
463  TDS_CUR_CONCUR_OPTIMISTIC = 4, /* default */
464  TDS_CUR_CONCUR_OPTIMISTIC_VALUES = 8
465 };
466 
467 /* TDS 4/5 login*/
468 #define TDS_MAXNAME 30 /* maximum login name lenghts */
469 #define TDS_PROGNLEN 10 /* maximum program lenght */
470 #define TDS_PKTLEN 6 /* maximum packet lenght in login */
471 
472 /* TDS 5 login security flags */
473 enum {
474  TDS5_SEC_LOG_ENCRYPT = 1,
475  TDS5_SEC_LOG_CHALLENGE = 2,
476  TDS5_SEC_LOG_LABELS = 4,
477  TDS5_SEC_LOG_APPDEFINED = 8,
478  TDS5_SEC_LOG_SECSESS = 16,
479  TDS5_SEC_LOG_ENCRYPT2 = 32,
480  TDS5_SEC_LOG_ENCRYPT3 = 128,
481 };
482 
484 enum {
485  TDS5_MSG_SEC_ENCRYPT = 1,
486  TDS5_MSG_SEC_LOGPWD = 2,
487  TDS5_MSG_SEC_REMPWD = 3,
488  TDS5_MSG_SEC_CHALLENGE = 4,
489  TDS5_MSG_SEC_RESPONSE = 5,
490  TDS5_MSG_SEC_GETLABEL = 6,
491  TDS5_MSG_SEC_LABEL = 7,
492  TDS5_MSG_SQL_TBLNAME = 8,
493  TDS5_MSG_GW_RESERVED = 9,
494  TDS5_MSG_OMNI_CAPABILITIES = 10,
495  TDS5_MSG_SEC_OPAQUE = 11,
496  TDS5_MSG_HAFAILOVER = 12,
497  TDS5_MSG_EMPTY = 13,
500  TDS5_MSG_SEC_ENCRYPT2 = 14,
501  TDS5_MSG_SEC_LOGPWD2 = 15,
502  TDS5_MSG_SEC_SUP_CIPHER = 16,
503  TDS5_MSG_MIG_REQ = 17,
505  TDS5_MSG_MIG_SYNC = 18,
506  TDS5_MSG_MIG_CONT = 19,
507  TDS5_MSG_MIG_IGN = 20,
508  TDS5_MSG_MIG_FAIL = 21,
510  TDS5_MSG_SEC_REMPWD2 = 22,
511  TDS5_MSG_MIG_RESUME = 23,
512  TDS5_MSG_SEC_ENCRYPT3 = 30,
513  TDS5_MSG_SEC_LOGPWD3 = 31,
514  TDS5_MSG_SEC_REMPWD3 = 32,
515  TDS5_MSG_DR_MAP = 33,
516 };
517 
528 enum {
529  TDS5_SEC_SECSESS = 1,
530  TDS5_SEC_FORWARD = 2,
531  TDS5_SEC_SIGN = 3,
532  TDS5_SEC_OTHER = 4,
533 };
534 
538 enum {
539  TDS5_SEC_NETWORK_AUTHENTICATION = 0x1,
540  TDS5_SEC_MUTUAL_AUTHENTICATION = 0x2,
541  TDS5_SEC_DELEGATION = 0x4,
542  TDS5_SEC_INTEGRITY = 0x8,
543  TDS5_SEC_CONFIDENTIALITY = 0x10,
544  TDS5_SEC_DETECT_REPLAY = 0x20,
545  TDS5_SEC_DETECT_SEQUENCE = 0x40,
546  TDS5_SEC_DATA_ORIGIN = 0x80,
547  TDS5_SEC_CHANNEL_BINDING = 0x100,
548 };
549 
550 enum {
551  TDS5_SEC_VERSION = 50,
552 };
553 
554 /* MS encryption byte (pre login) */
555 enum {
556  TDS7_ENCRYPT_OFF,
557  TDS7_ENCRYPT_ON,
558  TDS7_ENCRYPT_NOT_SUP,
559  TDS7_ENCRYPT_REQ,
560 };
Definition: proto.h:39
Definition: proto.h:50
TDS 7.2 SMP packet header.
Definition: proto.h:361
Definition: proto.h:62
Definition: proto.h:45
Definition: proto.h:33
Definition: proto.h:56
Definition: proto.h:26
TDS 7.1 collation informations.
Definition: proto.h:351
freetds-1.3.6/doc/reference/a00428_source.html000644 025423 025423 00000007103 14162303413 022370 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/pushvis.h Source File
FreeTDS API
pushvis.h
1 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
2 #pragma GCC visibility push(hidden)
3 #endif
freetds-1.3.6/doc/reference/a00431_source.html000644 025423 025423 00000035356 14162303413 022375 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/replacements/poll.h Source File
FreeTDS API
poll.h
Go to the documentation of this file.
1 
5 #if !defined(_REPLACEMENTS_POLL_H) && !defined(HAVE_POLL)
6 #define _REPLACEMENTS_POLL_H
7 
8 #include <config.h>
9 
10 #if HAVE_LIMITS_H
11 #include <limits.h>
12 #endif
13 
14 #if HAVE_SYS_SELECT_H
15 #include <sys/select.h>
16 #endif
17 
18 #if defined(_WIN32)
19 #include <winsock2.h>
20 #endif
21 
22 #if defined(__VMS)
23 #include <time.h> /* FD_SETSIZE is in here */
24 #endif
25 
26 #if !defined(FD_SETSIZE)
27 # if !defined(OPEN_MAX)
28 # error cannot establish FD_SETSIZE
29 # endif
30 #define FD_SETSIZE OPEN_MAX
31 #endif
32 
33 #include <freetds/pushvis.h>
34 
35 #ifndef _WIN32
36 /* poll flags */
37 # define POLLIN 0x0001
38 # define POLLOUT 0x0004
39 # define POLLERR 0x0008
40 
41 /* synonyms */
42 # define POLLNORM POLLIN
43 # define POLLPRI POLLIN
44 # define POLLRDNORM POLLIN
45 # define POLLRDBAND POLLIN
46 # define POLLWRNORM POLLOUT
47 # define POLLWRBAND POLLOUT
48 
49 /* ignored */
50 # define POLLHUP 0x0010
51 # define POLLNVAL 0x0020
52 typedef struct pollfd {
53  int fd; /* file descriptor to poll */
54  short events; /* events of interest on fd */
55  short revents; /* events that occurred on fd */
56 } pollfd_t;
57 
58 #else /* Windows */
59 /*
60  * Windows use different constants then Unix
61  * Newer version have a WSAPoll which is equal to Unix poll
62  */
63 # if !defined(POLLRDNORM) && !defined(POLLWRNORM)
64 # define POLLIN 0x0300
65 # define POLLOUT 0x0010
66 # define POLLERR 0x0001
67 # define POLLRDNORM 0x0100
68 # define POLLWRNORM 0x0010
69 typedef struct pollfd {
70  SOCKET fd; /* file descriptor to poll */
71  short events; /* events of interest on fd */
72  short revents; /* events that occurred on fd */
73 } pollfd_t;
74 # else
75 typedef struct pollfd pollfd_t;
76 # endif
77 #endif
78 
79 #undef poll
80 int tds_poll(struct pollfd fds[], int nfds, int timeout);
81 #define poll(fds, nfds, timeout) tds_poll(fds, nfds, timeout)
82 
83 #include <freetds/popvis.h>
84 
85 #endif
Definition: poll.h:52
freetds-1.3.6/doc/reference/a00432.dot000644 025423 025423 00000002116 14162303416 020627 0ustar00fredianofrediano000000 000000 digraph "include/freetds/replacements/poll.h" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="include/freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Provide poll call where missing."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00433.dot000644 025423 025423 00000010706 14162303416 020634 0ustar00fredianofrediano000000 000000 digraph "include/freetds/replacements/poll.h" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="include/freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Provide poll call where missing."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="include/freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="src/dblib/bcp.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01400.html",tooltip="Implementation of db-lib bulk copy functions."]; Node2 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="src/dblib/dblib.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00080.html",tooltip="Main implementation file for db-lib."]; Node2 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="src/tds/bulk.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00239.html",tooltip="Handle bulk copy."]; Node2 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="src/tds/token.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00308.html",tooltip="Contains all routines to get replies from server."]; Node2 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="include/freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node7 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="src/pool/pool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00164_source.html",tooltip=" "]; Node7 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="src/replacements/iconv.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01424.html",tooltip="This file implements a very simple iconv."]; Node7 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="src/tds/data.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00248.html",tooltip="Handle different data handling from network."]; Node7 -> Node11 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="src/tds/iconv.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01427.html",tooltip="Handle character conversions to/from server."]; Node7 -> Node12 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 [label="src/tds/read.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00281.html",tooltip="Grab data from TDS packets."]; Node7 -> Node13 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="src/tds/stream.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html",tooltip="Handle stream of data."]; Node7 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 -> Node14 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="include/ctlib.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00368_source.html",tooltip=" "]; Node7 -> Node15 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="include/freetds/odbc.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00419_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00434_source.html000644 025423 025423 00000032403 14162303413 022366 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/replacements/readpassphrase.h Source File
FreeTDS API
readpassphrase.h
1 /* OPENBSD ORIGINAL: include/readpassphrase.h */
2 
3 /* $OpenBSD: readpassphrase.h,v 1.3 2002/06/28 12:32:22 millert Exp $ */
4 
5 /*
6  * Copyright (c) 2000 Todd C. Miller <Todd.Miller@courtesan.com>
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * 3. The name of the author may not be used to endorse or promote products
18  * derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef FREETDS_READPASSPHRASE_H_
33 #define FREETDS_READPASSPHRASE_H_
34 
35 #ifndef _freetds_config_h_
36 #error should include config.h before
37 #endif
38 
39 #ifdef HAVE_READPASSPHRASE
40 
41 # include <readpassphrase.h>
42 
43 #else /* !HAVE_READPASSPHRASE */
44 
45 #include <freetds/pushvis.h>
46 
47 #define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */
48 #define RPP_ECHO_ON 0x01 /* Leave echo on. */
49 #define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */
50 #define RPP_FORCELOWER 0x04 /* Force input to lower case. */
51 #define RPP_FORCEUPPER 0x08 /* Force input to upper case. */
52 #define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */
53 #define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */
54 
55 #undef readpassphrase
56 char * tds_readpassphrase(const char *, char *, size_t, int);
57 #define readpassphrase tds_readpassphrase
58 
59 #include <freetds/popvis.h>
60 
61 #endif /* !HAVE_READPASSPHRASE */
62 
63 #endif /* !FREETDS_READPASSPHRASE_H_ */
freetds-1.3.6/doc/reference/a00437_source.html000644 025423 025423 00000101300 14162303413 022362 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/replacements.h Source File
FreeTDS API
replacements.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _replacements_h_
21 #define _replacements_h_
22 
23 #include <stdarg.h>
24 #include "tds_sysdep_public.h"
25 #include <freetds/sysdep_private.h>
26 
27 #include <freetds/replacements/readpassphrase.h>
28 
29 /* these headers are needed for basename */
30 #ifdef HAVE_STRING_H
31 # include <string.h>
32 #endif
33 #ifdef HAVE_LIBGEN_H
34 # include <libgen.h>
35 #endif
36 #ifdef HAVE_GETOPT_H
37 # include <getopt.h>
38 #endif
39 
40 #if !HAVE_POLL
42 #endif /* !HAVE_POLL */
43 
44 #include <freetds/pushvis.h>
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50 
51 #if !HAVE_ASPRINTF
52 #undef asprintf
53 int tds_asprintf(char **ret, const char *fmt, ...);
54 #define asprintf tds_asprintf
55 #endif /* !HAVE_ASPRINTF */
56 
57 #if !HAVE_VASPRINTF
58 #undef vasprintf
59 int tds_vasprintf(char **ret, const char *fmt, va_list ap);
60 #define vasprintf tds_vasprintf
61 #endif /* !HAVE_VASPRINTF */
62 
63 #if !HAVE_STRTOK_R
64 /* Some MinGW define strtok_r macro thread-safe but not reentrant but we
65  need both so avoid using the macro */
66 #undef strtok_r
67 #if defined(_WIN32) && HAVE_STRTOK_S
68 #define strtok_r strtok_s
69 #else
70 char *tds_strtok_r(char *str, const char *sep, char **lasts);
71 #define strtok_r tds_strtok_r
72 #endif
73 #endif /* !HAVE_STRTOK_R */
74 
75 #if !HAVE_STRSEP
76 #undef strsep
77 char *tds_strsep(char **stringp, const char *delim);
78 #define strsep tds_strsep
79 #endif /* !HAVE_STRSEP */
80 
81 #if !HAVE_STRLCPY
82 size_t tds_strlcpy(char *dest, const char *src, size_t len);
83 #undef strlcpy
84 #define strlcpy(d,s,l) tds_strlcpy(d,s,l)
85 #endif
86 
87 #if !HAVE_GETADDRINFO
88 typedef struct tds_addrinfo {
89  int ai_flags;
90  int ai_family;
91  int ai_socktype;
92  int ai_protocol;
93  size_t ai_addrlen;
94  struct sockaddr *ai_addr;
95  char *ai_canonname;
96  struct tds_addrinfo *ai_next;
97 } tds_addrinfo;
98 
99 int tds_getaddrinfo(const char *node, const char *service, const struct tds_addrinfo *hints, struct tds_addrinfo **res);
100 int tds_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
101 void tds_freeaddrinfo(struct tds_addrinfo *addr);
102 #define addrinfo tds_addrinfo
103 #define getaddrinfo(n,s,h,r) tds_getaddrinfo(n,s,h,r)
104 #define getnameinfo(a,b,c,d,e,f,g) tds_getnameinfo(a,b,c,d,e,f,g)
105 #define freeaddrinfo(a) tds_freeaddrinfo(a)
106 #endif
107 
108 #ifndef AI_FQDN
109 #define AI_FQDN 0
110 #endif
111 
112 #if !HAVE_STRLCAT
113 size_t tds_strlcat(char *dest, const char *src, size_t len);
114 #undef strlcat
115 #define strlcat(d,s,l) tds_strlcat(d,s,l)
116 #endif
117 
118 #if !HAVE_BASENAME
119 char *tds_basename(char *path);
120 #define basename(path) tds_basename(path)
121 #endif
122 
123 /*
124  * Microsoft's C Runtime library is missing strcasecmp and strncasecmp.
125  * Other Win32 C runtime libraries, notably MinGW, may define it.
126  * There is no symbol uniquely defined in Microsoft's header files that
127  * can be used by the preprocessor to know whether we're compiling for
128  * Microsoft's library or not (or which version). Thus there's no
129  * way to automatically decide whether or not to define strcasecmp
130  * in terms of stricmp.
131  *
132  * The Microsoft *compiler* defines _MSC_VER. On the assumption that
133  * anyone using their compiler is also using their library, the below
134  * tests check _MSC_VER as a proxy.
135  */
136 #if defined(_WIN32)
137 # if !defined(strcasecmp) && defined(_MSC_VER)
138 # define strcasecmp(A, B) stricmp((A), (B))
139 # endif
140 # if !defined(strncasecmp) && defined(_MSC_VER)
141 # define strncasecmp(x,y,z) strnicmp((x),(y),(z))
142 # endif
143 
144 #undef gettimeofday
145 int tds_gettimeofday (struct timeval *tv, void *tz);
146 #define gettimeofday tds_gettimeofday
147 
148 /* Older MinGW-w64 versions don't define these flags. */
149 #if defined(__MINGW32__) && !defined(AI_ADDRCONFIG)
150 # define AI_ADDRCONFIG 0x00000400
151 #endif
152 #if defined(__MINGW32__) && !defined(AI_V4MAPPED)
153 # define AI_V4MAPPED 0x00000800
154 #endif
155 
156 #endif
157 
158 #if defined(_WIN32) && defined(_MSC_VER)
159 #define tds_strtoll _strtoi64
160 #else
161 #define tds_strtoll strtoll
162 #endif
163 
164 #if !HAVE_GETOPT
165 #undef getopt
166 int tds_getopt(int argc, char * const argv[], const char *optstring);
167 #define getopt tds_getopt
168 
169 extern char *optarg;
170 extern int optind, offset, opterr, optreset;
171 #endif
172 
173 #if !HAVE_SOCKETPAIR
174 int tds_socketpair(int domain, int type, int protocol, TDS_SYS_SOCKET sv[2]);
175 #define socketpair(d,t,p,s) tds_socketpair(d,t,p,s)
176 #endif
177 
178 #if !HAVE_DAEMON
179 int tds_daemon(int no_chdir, int no_close);
180 #define daemon(d,c) tds_daemon(d,c)
181 #endif
182 
183 #if !HAVE_SETENV
184 int tds_setenv(const char *name, const char *value, int overwrite);
185 #define setenv(n,v,o) tds_setenv(n,v,o)
186 int tds_unsetenv(const char *name);
187 #define unsetenv(n) tds_unsetenv(n)
188 #endif
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #include <freetds/popvis.h>
195 
196 #endif
Provide poll call where missing.
Definition: replacements.h:88
freetds-1.3.6/doc/reference/a00440_source.html000644 025423 025423 00000040424 14162303413 022365 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/server.h Source File
FreeTDS API
server.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tdsserver_h_
21 #define _tdsserver_h_
22 #endif
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 #if 0
29 }
30 #endif
31 
32 /* login.c */
33 unsigned char *tds7_decrypt_pass(const unsigned char *crypt_pass, int len, unsigned char *clear_pass);
34 TDSSOCKET *tds_listen(TDSCONTEXT * ctx, int ip_port);
35 int tds_read_login(TDSSOCKET * tds, TDSLOGIN * login);
36 int tds7_read_login(TDSSOCKET * tds, TDSLOGIN * login);
37 TDSLOGIN *tds_alloc_read_login(TDSSOCKET * tds);
38 
39 /* query.c */
40 char *tds_get_query(TDSSOCKET * tds);
41 char *tds_get_generic_query(TDSSOCKET * tds);
42 
43 /* server.c */
44 void tds_env_change(TDSSOCKET * tds, int type, const char *oldvalue, const char *newvalue);
45 void tds_send_msg(TDSSOCKET * tds, int msgno, int msgstate, int severity, const char *msgtext, const char *srvname,
46  const char *procname, int line);
47 void tds_send_login_ack(TDSSOCKET * tds, const char *progname);
48 void tds_send_eed(TDSSOCKET * tds, int msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line);
49 void tds_send_err(TDSSOCKET * tds, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr);
50 void tds_send_capabilities_token(TDSSOCKET * tds);
51 /* TODO remove, use tds_send_done */
52 void tds_send_done_token(TDSSOCKET * tds, TDS_SMALLINT flags, TDS_INT numrows);
53 void tds_send_done(TDSSOCKET * tds, int token, TDS_SMALLINT flags, TDS_INT numrows);
54 void tds_send_control_token(TDSSOCKET * tds, TDS_SMALLINT numcols);
55 void tds_send_col_name(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
56 void tds_send_col_info(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
57 void tds_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
58 void tds7_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
59 void tds_send_table_header(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
60 void tds_send_row(TDSSOCKET * tds, TDSRESULTINFO * resinfo);
61 void tds71_send_prelogin(TDSSOCKET * tds);
62 
63 #if 0
64 {
65 #endif
66 #ifdef __cplusplus
67 }
68 #endif
Hold information for any results.
Definition: tds.h:769
Information for a server connection.
Definition: tds.h:1163
Definition: tds.h:1029
Definition: tds.h:517
freetds-1.3.6/doc/reference/a00443_source.html000644 025423 025423 00000062461 14162303413 022375 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/stream.h Source File
FreeTDS API
stream.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2013 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _freetds_stream_h_
21 #define _freetds_stream_h_
22 
23 #ifndef _tds_h_
24 #error Include tds.h first
25 #endif
26 
27 #include <freetds/pushvis.h>
28 
30 typedef struct tds_input_stream {
35  int (*read)(struct tds_input_stream *stream, void *ptr, size_t len);
36 } TDSINSTREAM;
37 
39 typedef struct tds_output_stream {
41  int (*write)(struct tds_output_stream *stream, size_t len);
50  char *buffer;
51  size_t buf_len;
52 } TDSOUTSTREAM;
53 
55 TDSRET tds_convert_stream(TDSSOCKET * tds, TDSICONV * char_conv, TDS_ICONV_DIRECTION direction,
56  TDSINSTREAM * istream, TDSOUTSTREAM *ostream);
58 TDSRET tds_copy_stream(TDSINSTREAM * istream, TDSOUTSTREAM * ostream);
59 
60 /* Additional streams */
61 
63 typedef struct tds_datain_stream {
64  TDSINSTREAM stream;
65  size_t wire_size;
66  TDSSOCKET *tds;
68 
69 void tds_datain_stream_init(TDSDATAINSTREAM * stream, TDSSOCKET * tds, size_t wire_size);
70 
72 typedef struct tds_dataout_stream {
73  TDSOUTSTREAM stream;
74  TDSSOCKET *tds;
75  size_t written;
77 
79 
81 typedef struct tds_staticin_stream {
82  TDSINSTREAM stream;
83  const char *buffer;
84  size_t buf_left;
86 
87 void tds_staticin_stream_init(TDSSTATICINSTREAM * stream, const void *ptr, size_t len);
88 
92 typedef struct tds_staticout_stream {
93  TDSOUTSTREAM stream;
95 
96 void tds_staticout_stream_init(TDSSTATICOUTSTREAM * stream, void *ptr, size_t len);
97 
99 typedef struct tds_dynamic_stream {
100  TDSOUTSTREAM stream;
102  void **buf;
104  size_t allocated;
106  size_t size;
108 
109 TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM * stream, void **ptr, size_t allocated);
110 
111 #include <freetds/popvis.h>
112 
113 #endif
114 
output stream to write data to a static buffer.
Definition: stream.h:92
char * buffer
write buffer.
Definition: stream.h:50
int(* read)(struct tds_input_stream *stream, void *ptr, size_t len)
read some data Return 0 if end of stream Return <0 if error (actually not defined)
Definition: stream.h:35
input stream to read data from a static buffer
Definition: stream.h:81
output stream to write data to tds protocol
Definition: stream.h:72
void tds_datain_stream_init(TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
Initialize a data input stream.
Definition: stream.c:204
input stream to read data from tds protocol
Definition: stream.h:63
void ** buf
where is stored the pointer
Definition: stream.h:102
int(* write)(struct tds_output_stream *stream, size_t len)
write len bytes from buffer, return <0 if error or len
Definition: stream.h:41
define a stream of data used for input
Definition: stream.h:30
Definition: iconv.h:92
size_t wire_size
bytes still to read
Definition: stream.h:65
TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated)
Initialize a dynamic output stream.
Definition: stream.c:354
output stream to write data to a dynamic buffer
Definition: stream.h:99
TDSRET tds_copy_stream(TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream to another.
Definition: stream.c:163
size_t allocated
currently allocated buffer
Definition: stream.h:104
TDSRET tds_convert_stream(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream converting characters.
Definition: stream.c:71
void tds_staticin_stream_init(TDSSTATICINSTREAM *stream, const void *ptr, size_t len)
Initialize an input stream for read from a static allocated buffer.
Definition: stream.c:286
Information for a server connection.
Definition: tds.h:1163
void tds_dataout_stream_init(TDSDATAOUTSTREAM *stream, TDSSOCKET *tds)
Initialize a data output stream.
Definition: stream.c:244
define a stream of data used for output
Definition: stream.h:39
void tds_staticout_stream_init(TDSSTATICOUTSTREAM *stream, void *ptr, size_t len)
Initialize an output stream for write into a static allocated buffer.
Definition: stream.c:313
size_t size
size of data inside buffer
Definition: stream.h:106
freetds-1.3.6/doc/reference/a00446_source.html000644 025423 025423 00000122444 14162303413 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/sysdep_private.h Source File
FreeTDS API
sysdep_private.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3  * Copyright (C) 2010 Frediano Ziglio
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _tds_sysdep_private_h_
22 #define _tds_sysdep_private_h_
23 
24 #define TDS_ADDITIONAL_SPACE 16
25 
26 #ifdef MSG_NOSIGNAL
27 # define TDS_NOSIGNAL MSG_NOSIGNAL
28 #else
29 # define TDS_NOSIGNAL 0L
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #if 0
36 }
37 #endif
38 #endif
39 
40 #ifdef __INCvxWorksh
41 #include <ioLib.h> /* for FIONBIO */
42 #endif /* __INCvxWorksh */
43 
44 #if defined(DOS32X)
45 #define READSOCKET(a,b,c) recv((a), (b), (c), TDS_NOSIGNAL)
46 #define WRITESOCKET(a,b,c) send((a), (b), (c), TDS_NOSIGNAL)
47 #define CLOSESOCKET(a) closesocket((a))
48 #define IOCTLSOCKET(a,b,c) ioctlsocket((a), (b), (char*)(c))
49 #define SOCKLEN_T int
50 #define select select_s
51 typedef int pid_t;
52 #define strcasecmp stricmp
53 #define strncasecmp strnicmp
54 /* TODO this has nothing to do with ip ... */
55 #define getpid() _gethostid()
56 #endif /* defined(DOS32X) */
57 
58 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
59 #include <freetds/windows.h>
60 #define READSOCKET(a,b,c) recv((a), (char *) (b), (c), TDS_NOSIGNAL)
61 #define WRITESOCKET(a,b,c) send((a), (const char *) (b), (c), TDS_NOSIGNAL)
62 #define CLOSESOCKET(a) closesocket((a))
63 #define IOCTLSOCKET(a,b,c) ioctlsocket((a), (b), (c))
64 #define SOCKLEN_T int
65 int tds_socket_init(void);
66 #define INITSOCKET() tds_socket_init()
67 void tds_socket_done(void);
68 #define DONESOCKET() tds_socket_done()
69 #define NETDB_REENTRANT 1 /* BSD-style netdb interface is reentrant */
70 
71 #define TDSSOCK_EINTR WSAEINTR
72 #define TDSSOCK_EINPROGRESS WSAEWOULDBLOCK
73 #define TDSSOCK_ETIMEDOUT WSAETIMEDOUT
74 #define TDSSOCK_WOULDBLOCK(e) ((e)==WSAEWOULDBLOCK)
75 #define TDSSOCK_ECONNRESET WSAECONNRESET
76 #define sock_errno WSAGetLastError()
77 #define set_sock_errno(err) WSASetLastError(err)
78 #define sock_strerror(n) tds_prwsaerror(n)
79 #define sock_strerror_free(s) tds_prwsaerror_free(s)
80 #ifndef __MINGW32__
81 typedef DWORD pid_t;
82 #endif
83 #undef strcasecmp
84 #define strcasecmp stricmp
85 #undef strncasecmp
86 #define strncasecmp strnicmp
87 #if defined(HAVE__SNPRINTF) && !defined(HAVE_SNPRINTF)
88 #define snprintf _snprintf
89 #endif
90 
91 #ifndef WIN32
92 #define WIN32 1
93 #endif
94 
95 #if defined(_WIN64) && !defined(WIN64)
96 #define WIN64 1
97 #endif
98 
99 #define TDS_SDIR_SEPARATOR "\\"
100 
101 /* use macros to use new style names */
102 #if defined(__MSVCRT__) || defined(_MSC_VER)
103 /* Use API as always present and not causing problems */
104 #undef getpid
105 #define getpid() GetCurrentProcessId()
106 #define strdup(s) _strdup(s)
107 #define unlink(f) _unlink(f)
108 #define putenv(s) _putenv(s)
109 #undef fileno
110 #define fileno(f) _fileno(f)
111 #undef close
112 #define close(f) _close(f)
113 #undef open
114 #define open(fn,...) _open(fn,__VA_ARGS__)
115 #undef dup2
116 #define dup2(o,n) _dup2(o,n)
117 #define stricmp(s1,s2) _stricmp(s1,s2)
118 #define strnicmp(s1,s2,n) _strnicmp(s1,s2,n)
119 #endif
120 
121 #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */
122 
123 #ifndef sock_errno
124 #define sock_errno errno
125 #endif
126 
127 #ifndef set_sock_errno
128 #define set_sock_errno(err) do { errno = (err); } while(0)
129 #endif
130 
131 #ifndef sock_strerror
132 #define sock_strerror(n) strerror(n)
133 #define sock_strerror_free(s) do {} while(0)
134 #endif
135 
136 #ifndef TDSSOCK_EINTR
137 #define TDSSOCK_EINTR EINTR
138 #endif
139 
140 #ifndef TDSSOCK_EINPROGRESS
141 #define TDSSOCK_EINPROGRESS EINPROGRESS
142 #endif
143 
144 #ifndef TDSSOCK_ETIMEDOUT
145 #define TDSSOCK_ETIMEDOUT ETIMEDOUT
146 #endif
147 
148 #ifndef TDSSOCK_WOULDBLOCK
149 # if defined(EWOULDBLOCK) && EAGAIN != EWOULDBLOCK
150 # define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN||(e)==EWOULDBLOCK)
151 # else
152 # define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN)
153 # endif
154 #endif
155 
156 #ifndef TDSSOCK_ECONNRESET
157 #define TDSSOCK_ECONNRESET ECONNRESET
158 #endif
159 
160 #ifndef INITSOCKET
161 #define INITSOCKET() 0
162 #endif /* !INITSOCKET */
163 
164 #ifndef DONESOCKET
165 #define DONESOCKET() do { } while(0)
166 #endif /* !DONESOCKET */
167 
168 #ifndef READSOCKET
169 # ifdef MSG_NOSIGNAL
170 # define READSOCKET(s,b,l) recv((s), (b), (l), MSG_NOSIGNAL)
171 # else
172 # define READSOCKET(s,b,l) read((s), (b), (l))
173 # endif
174 #endif /* !READSOCKET */
175 
176 #ifndef WRITESOCKET
177 # ifdef MSG_NOSIGNAL
178 # define WRITESOCKET(s,b,l) send((s), (b), (l), MSG_NOSIGNAL)
179 # else
180 # define WRITESOCKET(s,b,l) write((s), (b), (l))
181 # endif
182 #endif /* !WRITESOCKET */
183 
184 #ifndef CLOSESOCKET
185 #define CLOSESOCKET(s) close((s))
186 #endif /* !CLOSESOCKET */
187 
188 #ifndef IOCTLSOCKET
189 #define IOCTLSOCKET(s,b,l) ioctl((s), (b), (l))
190 #endif /* !IOCTLSOCKET */
191 
192 #ifndef SOCKLEN_T
193 # define SOCKLEN_T socklen_t
194 #endif
195 
196 #if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32)
197 typedef int TDS_SYS_SOCKET;
198 #define INVALID_SOCKET -1
199 #define TDS_IS_SOCKET_INVALID(s) ((s) < 0)
200 #else
201 typedef SOCKET TDS_SYS_SOCKET;
202 #define TDS_IS_SOCKET_INVALID(s) ((s) == INVALID_SOCKET)
203 #endif
204 
205 #define tds_accept accept
206 #define tds_getpeername getpeername
207 #define tds_getsockopt getsockopt
208 #define tds_getsockname getsockname
209 #define tds_recvfrom recvfrom
210 
211 #if defined(__hpux__) && SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
212 # if HAVE__XPG_ACCEPT
213 # undef tds_accept
214 # define tds_accept _xpg_accept
215 # elif HAVE___ACCEPT
216 # undef tds_accept
217 # define tds_accept __accept
218 # endif
219 # if HAVE__XPG_GETPEERNAME
220 # undef tds_getpeername
221 # define tds_getpeername _xpg_getpeername
222 # elif HAVE___GETPEERNAME
223 # undef tds_getpeername
224 # define tds_getpeername __getpeername
225 # endif
226 # if HAVE__XPG_GETSOCKOPT
227 # undef tds_getsockopt
228 # define tds_getsockopt _xpg_getsockopt
229 # elif HAVE___GETSOCKOPT
230 # undef tds_getsockopt
231 # define tds_getsockopt __getsockopt
232 # endif
233 # if HAVE__XPG_GETSOCKNAME
234 # undef tds_getsockname
235 # define tds_getsockname _xpg_getsockname
236 # elif HAVE___GETSOCKNAME
237 # undef tds_getsockname
238 # define tds_getsockname __getsockname
239 # endif
240 # if HAVE__XPG_RECVFROM
241 # undef tds_recvfrom
242 # define tds_recvfrom _xpg_recvfrom
243 # elif HAVE___RECVFROM
244 # undef tds_recvfrom
245 # define tds_recvfrom __recvfrom
246 # endif
247 #endif
248 
249 #ifndef TDS_SDIR_SEPARATOR
250 #define TDS_SDIR_SEPARATOR "/"
251 #endif /* !TDS_SDIR_SEPARATOR */
252 
253 #ifdef HAVE_INTTYPES_H
254 #include <inttypes.h>
255 #endif
256 
257 #ifndef PRId64
258 #define PRId64 TDS_I64_PREFIX "d"
259 #endif
260 #ifndef PRIu64
261 #define PRIu64 TDS_I64_PREFIX "u"
262 #endif
263 #ifndef PRIx64
264 #define PRIx64 TDS_I64_PREFIX "x"
265 #endif
266 
267 #ifdef __cplusplus
268 #if 0
269 {
270 #endif
271 }
272 #endif
273 
274 #endif /* _tds_sysdep_private_h_ */
freetds-1.3.6/doc/reference/a00449.html000644 025423 025423 00001153032 14162303416 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/tds.h File Reference
FreeTDS API
tds.h File Reference

Main include file for libtds. More...

#include <stdarg.h>
#include <stdio.h>
#include <time.h>
#include <freetds/version.h>
#include <freetds/sysdep_private.h>
#include <freetds/thread.h>
#include <freetds/bool.h>
#include <freetds/macros.h>
#include <freetds/utils/string.h>
#include <freetds/replacements.h>
#include <freetds/pushvis.h>
#include <freetds/proto.h>
#include <freetds/popvis.h>
Include dependency graph for tds.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  tds_align_struct
 
struct  tds_authentication
 
struct  tds_bcpcoldata
 
struct  tds_bcpinfo
 
struct  tds_blob
 Information about blobs (e.g. More...
 
struct  tds_capabilities
 
struct  tds_capability_type
 
struct  tds_column
 Metadata about columns in regular and compute rows. More...
 
struct  tds_column_funcs
 
struct  tds_compiletime_settings
 A structure to hold all the compile-time settings. More...
 
struct  tds_connection
 
struct  tds_context
 
struct  tds_cursor
 Holds informations about a cursor. More...
 
struct  tds_cursor_status
 
struct  TDS_DATETIMEALL
 this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information. More...
 
struct  tds_dynamic
 Holds information for a dynamic (also called prepared) query. More...
 
struct  tds_encoding
 Information relevant to libiconv. More...
 
struct  tds_env
 Current environment as reported by the server. More...
 
struct  tds_freeze
 
struct  tds_headers
 
struct  tds_locale
 
struct  tds_login
 
struct  tds_message
 
struct  tds_multiple
 
union  tds_option_arg
 
struct  tds_packet
 
struct  tds_poll_wakeup
 
struct  tds_result_info
 Hold information for any results. More...
 
struct  tds_socket
 Information for a server connection. More...
 
struct  tds_upd_col
 
struct  tds_variant
 Store variant informations. More...
 
struct  tdsdaterec
 Used by tds_datecrack. More...
 
struct  tdsdump_off_item
 

Macros

#define is_ascii_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_ASCII) != 0)
 
#define is_binary_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_BINARY) != 0)
 
#define is_blob_col(x)   ((x)->column_varint_size > 2)
 
#define is_blob_type(x)   ((x)==SYBTEXT || (x)==SYBIMAGE || (x)==SYBNTEXT)
 
#define is_char_type(x)   ((tds_type_flags_ms[x] & (TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_UNICODE)) != 0)
 
#define is_collate_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_COLLATE) != 0)
 
#define is_datetime_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_DATETIME) != 0)
 return true if type is a datetime (but not date or time)
 
#define is_end_token(x)   ((x) >= TDS_DONE_TOKEN && (x) <= TDS_DONEINPROC_TOKEN)
 
#define is_fixed_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_FIXED) != 0)
 
#define is_nullable_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_NULLABLE) != 0)
 
#define is_numeric_type(x)   ((x)==SYBNUMERIC || (x)==SYBDECIMAL)
 
#define is_similar_type(x, y)   (is_char_type(x) && is_char_type(y))
 
#define IS_TDS42(x)   (x->tds_version==0x402)
 
#define IS_TDS46(x)   (x->tds_version==0x406)
 
#define IS_TDS50(x)   (x->tds_version==0x500)
 
#define IS_TDS50_PLUS(x)   ((x)->tds_version>=0x500)
 
#define IS_TDS70(x)   (x->tds_version==0x700)
 
#define IS_TDS71(x)   (x->tds_version==0x701)
 
#define IS_TDS71_PLUS(x)   ((x)->tds_version>=0x701)
 
#define IS_TDS72(x)   (x->tds_version==0x702)
 
#define IS_TDS72_PLUS(x)   ((x)->tds_version>=0x702)
 
#define IS_TDS73(x)   (x->tds_version==0x703)
 
#define IS_TDS73_PLUS(x)   ((x)->tds_version>=0x703)
 
#define IS_TDS74_PLUS(x)   ((x)->tds_version>=0x704)
 
#define IS_TDS7_PLUS(x)   ((x)->tds_version>=0x700)
 
#define IS_TDSDEAD(x)   (((x) == NULL) || (x)->state == TDS_DEAD)
 
#define is_unicode_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_UNICODE) != 0)
 
#define is_variable_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIABLE) != 0)
 
#define is_variant_inner_type(x)   ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIANT) != 0)
 
#define MAXPRECISION   77
 
#define TDS_ALIGN_SIZE   sizeof(tds_align_struct)
 
#define TDS_BYTE_SWAP16(value)
 
#define TDS_BYTE_SWAP32(value)
 
#define TDS_CANCELLED   ((TDSRET)-2)
 
#define tds_capability_has_req(conn, cap)    tds_capability_enabled(&conn->capabilities.types[0], cap)
 
#define tds_capability_has_res(conn, cap)    tds_capability_enabled(&conn->capabilities.types[1], cap)
 
#define TDS_CMD_DONE   4046
 
#define TDS_CMD_FAIL   4048
 
#define TDS_CMD_SUCCEED   4047
 
#define TDS_COMPUTE_RESULT   4045
 
#define TDS_COMPUTEFMT_RESULT   4050
 
#define tds_convert_string_free(original, converted)    do { if (original != converted) free((char*) converted); } while(0)
 
#define TDS_DBG_ERROR   __FILE__, ((__LINE__ << 4) | 2)
 
#define TDS_DBG_FUNC   __FILE__, ((__LINE__ << 4) | 7)
 
#define TDS_DBG_HEADER   __FILE__, ((__LINE__ << 4) | 10)
 
#define TDS_DBG_INFO1   __FILE__, ((__LINE__ << 4) | 5)
 
#define TDS_DBG_INFO2   __FILE__, ((__LINE__ << 4) | 6)
 
#define TDS_DBG_LOGIN   __FILE__, ((__LINE__ << 4) | 11)
 
#define TDS_DBG_NETWORK   __FILE__, ((__LINE__ << 4) | 4)
 
#define TDS_DBG_SEVERE   __FILE__, ((__LINE__ << 4) | 1)
 
#define TDS_DBG_WARN   __FILE__, ((__LINE__ << 4) | 3)
 
#define TDS_DBGFLAG_ALL   0xfff
 
#define TDS_DBGFLAG_ERROR   0x04
 
#define TDS_DBGFLAG_FUNC   0x80
 
#define TDS_DBGFLAG_HEADER   0x0400
 
#define TDS_DBGFLAG_INFO1   0x20
 
#define TDS_DBGFLAG_INFO2   0x40
 
#define TDS_DBGFLAG_LOGIN   0x0800
 
#define TDS_DBGFLAG_NETWORK   0x10
 
#define TDS_DBGFLAG_PID   0x1000
 
#define TDS_DBGFLAG_SEVERE   0x02
 
#define TDS_DBGFLAG_SOURCE   0x4000
 
#define TDS_DBGFLAG_THREAD   0x8000
 
#define TDS_DBGFLAG_TIME   0x2000
 
#define TDS_DBGFLAG_WARN   0x08
 
#define TDS_DEF_BLKSZ   512
 
#define TDS_DEF_CHARSET   "iso_1"
 
#define TDS_DEF_LANG   "us_english"
 
#define TDS_DEF_PORT   1433
 
#define TDS_DEF_SERVER   "SYBASE"
 
#define TDS_DEFAULT_VERSION   0x000
 
#define TDS_DESCRIBE_RESULT   4051
 
#define TDS_DONE_RESULT   4052
 
#define TDS_DONEINPROC_RESULT   4054
 
#define TDS_DONEPROC_RESULT   4053
 
#define TDS_END_LEN   while(0); } while(tds_freeze_close(current_freeze), 0); } while(0);
 
#define TDS_FAIL   ((TDSRET)-1)
 
#define TDS_FAILED(rc)   ((rc)<0)
 
#define tds_get_ctx(tds)   ((tds)->conn->tds_ctx)
 
#define tds_get_int(tds)   ((TDS_INT) tds_get_uint(tds))
 
#define tds_get_int8(tds)   ((TDS_INT8) tds_get_uint8(tds))
 
#define tds_get_parent(tds)   ((tds)->parent)
 
#define tds_get_s(tds)   ((tds)->conn->s)
 
#define tds_get_smallint(tds)   ((TDS_SMALLINT) tds_get_usmallint(tds))
 
#define TDS_GSSAPI_DELEGATION   "enable gssapi delegation"
 
#define TDS_INT_CANCEL   2
 
#define TDS_INT_CONTINUE   1
 
#define TDS_INT_TIMEOUT   3
 
#define TDS_INVALID_TYPE   ((TDS_SERVER_TYPE) 0)
 
#define TDS_IS_MSSQL(x)   (((x)->conn->product_version & 0x80000000u)!=0)
 Check if product is Microsft SQL Server. More...
 
#define TDS_IS_SYBASE(x)   (!((x)->conn->product_version & 0x80000000u))
 Check if product is Sybase (such as Adaptive Server Enterrprice). More...
 
#define TDS_MAJOR(x)   ((x)->tds_version >> 8)
 
#define TDS_MAX_CAPABILITY   32
 
#define TDS_MAX_CONN   4096
 
#define TDS_MAX_DYNID_LEN   30
 
#define TDS_MAX_LOGIN_STR_SZ   128
 
#define TDS_MINOR(x)   ((x)->tds_version & 0xff)
 
#define TDS_MS_VER(maj, min, x)   (0x80000000u|((maj)<<24)|((min)<<16)|(x))
 Calc a version number for mssql. More...
 
#define TDS_MSG_RESULT   4044
 
#define tds_new(type, n)   ((type *) malloc(sizeof(type) * (n)))
 
#define tds_new0(type, n)   ((type *) calloc(n, sizeof(type)))
 
#define TDS_NO_COUNT   -1
 
#define TDS_NO_MORE_RESULTS   ((TDSRET)1)
 
#define TDS_NULLTERM   -9
 
#define TDS_OTHERS_RESULT   4055
 
#define tds_packet_get_data_start(pkt)   0
 
#define tds_packet_zero_data_start(pkt)   do { } while(0)
 
#define TDS_PARAM_RESULT   4042
 
#define TDS_PROPAGATE(rc)    do { TDSRET _tds_ret = (rc); if (TDS_FAILED(_tds_ret)) return _tds_ret; } while(0)
 
#define TDS_PUT_BYTE(tds, v)   tds_put_byte((tds), ((unsigned char)(v)))
 
#define TDS_PUT_INT(tds, v)   tds_put_int((tds), ((TDS_INT)(v)))
 
#define TDS_PUT_SMALLINT(tds, v)   tds_put_smallint((tds), ((TDS_SMALLINT)(v)))
 
#define tds_put_tinyint(tds, ti)   tds_put_byte(tds,ti)
 Output a tinyint value.
 
#define TDS_RESIZE(p, n_elem)    tds_realloc((void **) &(p), sizeof(*(p)) * (size_t) (n_elem))
 
#define TDS_ROW_RESULT   4040
 
#define TDS_ROWFMT_RESULT   4049
 
#define tds_set_ctx(tds, val)   do { ((tds)->conn->tds_ctx) = (val); } while(0)
 
#define tds_set_parent(tds, val)   do { ((tds)->parent) = (val); } while(0)
 
#define tds_set_s(tds, val)   do { ((tds)->conn->s) = (val); } while(0)
 
#define TDS_START_LEN_GENERIC(tds_socket, len)
 
#define TDS_START_LEN_TINYINT(tds_socket)   TDS_START_LEN_GENERIC(tds_socket, 1)
 
#define TDS_START_LEN_UINT(tds_socket)   TDS_START_LEN_GENERIC(tds_socket, 4)
 
#define TDS_START_LEN_USMALLINT(tds_socket)   TDS_START_LEN_GENERIC(tds_socket, 2)
 
#define TDS_STATUS_RESULT   4043
 
#define TDS_STR_APPENDMODE   "dump file append"
 
#define TDS_STR_ASA_DATABASE   "asa database"
 
#define TDS_STR_BLKSZ   "initial block size"
 
#define TDS_STR_CAFILE   "ca file"
 
#define TDS_STR_CHARSET   "charset"
 
#define TDS_STR_CHECKSSLHOSTNAME   "check certificate hostname"
 
#define TDS_STR_CLCHARSET   "client charset"
 
#define TDS_STR_CONNTIMEOUT   "connect timeout"
 
#define TDS_STR_CRLFILE   "crl file"
 
#define TDS_STR_DATABASE   "database"
 
#define TDS_STR_DATEFMT   "date format"
 
#define TDS_STR_DBFILENAME   "database filename"
 
#define TDS_STR_DEBUGFLAGS   "debug flags"
 
#define TDS_STR_DEBUGLVL   "debug level"
 
#define TDS_STR_DUMPFILE   "dump file"
 
#define TDS_STR_EMUL_LE   "emulate little endian"
 
#define TDS_STR_ENABLE_TLS_V1   "enable tls v1"
 
#define TDS_STR_ENCRYPTION   "encryption"
 
#define TDS_STR_ENCRYPTION_OFF   "off"
 
#define TDS_STR_ENCRYPTION_REQUEST   "request"
 
#define TDS_STR_ENCRYPTION_REQUIRE   "require"
 
#define TDS_STR_HOST   "host"
 
#define TDS_STR_HOSTNAME   "hostname"
 
#define TDS_STR_INSTANCE   "instance"
 
#define TDS_STR_LANGUAGE   "language"
 
#define TDS_STR_MUTUAL_AUTHENTICATION   "mutual authentication"
 
#define TDS_STR_PORT   "port"
 
#define TDS_STR_QUERY_TIMEOUT   "query timeout"
 
#define TDS_STR_READONLY_INTENT   "read-only intent"
 
#define TDS_STR_REALM   "realm"
 
#define TDS_STR_SPN   "spn"
 
#define TDS_STR_SWAPDT   "swap broken dates"
 
#define TDS_STR_TEXTSZ   "text size"
 
#define TDS_STR_TIMEOUT   "timeout"
 
#define TDS_STR_USE_UTF_16   "use utf-16"
 
#define TDS_STR_USELANMAN   "use lanman"
 
#define TDS_STR_USENTLMV2   "use ntlmv2"
 
#define TDS_STR_VERSION   "tds version"
 
#define TDS_SUCCEED(rc)   ((rc)>=0)
 
#define TDS_SUCCESS   ((TDSRET)0)
 
#define TDS_SYB_VER(maj, min, x)   (((maj)<<24)|((min)<<16)|(x)<<8)
 Calc a version number for Sybase.
 
#define TDS_TOKEN_FLAG(flag)   TDS_RETURN_##flag = (1 << (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << (TDS_TOKEN_RES_##flag*2))
 
#define TDSDUMP_BUF_FAST   if (TDS_UNLIKELY(tds_write_dump)) tdsdump_dump_buf
 
#define tdsdump_dump_buf   TDSDUMP_BUF_FAST
 
#define tdsdump_log   TDSDUMP_LOG_FAST
 
#define TDSDUMP_LOG_FAST   if (TDS_UNLIKELY(tds_write_dump)) tdsdump_log
 
#define TDSSELREAD   POLLIN
 
#define TDSSELWRITE   POLLOUT
 
#define TLS_STR_OPENSSL_CIPHERS   "openssl ciphers"
 

Typedefs

typedef struct tds_bcpcoldata BCPCOLDATA
 
typedef int(* err_handler_t) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *)
 
typedef TDSRET(* tds_bcp_get_col_data) (TDSBCPINFO *bulk, TDSCOLUMN *bcpcol, int offset)
 
typedef void(* tds_bcp_null_error) (TDSBCPINFO *bulk, int index, int offset)
 
typedef struct tds_capabilities TDS_CAPABILITIES
 
typedef struct tds_capability_type TDS_CAPABILITY_TYPE
 
typedef char TDS_CHAR
 
typedef struct tds_compiletime_settings TDS_COMPILETIME_SETTINGS
 A structure to hold all the compile-time settings. More...
 
typedef enum tds_cursor_fetch TDS_CURSOR_FETCH
 
typedef enum tds_cursor_operation TDS_CURSOR_OPERATION
 
typedef struct tds_cursor_status TDS_CURSOR_STATUS
 
typedef struct tds_encoding TDS_ENCODING
 Information relevant to libiconv. More...
 
typedef enum tds_encryption_level TDS_ENCRYPTION_LEVEL
 
typedef tds_sysdep_real64_type TDS_FLOAT
 
typedef int tds_func_check(const TDSCOLUMN *col)
 
typedef TDSRET tds_func_get_data(TDSSOCKET *tds, TDSCOLUMN *col)
 
typedef TDSRET tds_func_get_info(TDSSOCKET *tds, TDSCOLUMN *col)
 
typedef TDSRET tds_func_put_data(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7)
 
typedef TDSRET tds_func_put_info(TDSSOCKET *tds, TDSCOLUMN *col)
 
typedef TDS_INT tds_func_row_len(TDSCOLUMN *col)
 
typedef int32_t TDS_INT
 
typedef int64_t TDS_INT8
 
typedef intptr_t TDS_INTPTR
 
typedef enum tds_operations TDS_OPERATION
 
typedef union tds_option_arg TDS_OPTION_ARG
 
typedef tds_sysdep_real32_type TDS_REAL
 
typedef int16_t TDS_SMALLINT
 
typedef enum tds_states TDS_STATE
 values for tds->state
 
typedef uint8_t TDS_TINYINT
 
typedef uint8_t TDS_UCHAR
 
typedef uint32_t TDS_UINT
 
typedef uint64_t TDS_UINT8
 
typedef uintptr_t TDS_UINTPTR
 
typedef uint16_t TDS_USMALLINT
 
typedef struct tds_authentication TDSAUTHENTICATION
 
typedef struct tds_bcpinfo TDSBCPINFO
 
typedef struct tds_blob TDSBLOB
 Information about blobs (e.g. More...
 
typedef struct tds_column TDSCOLUMN
 
typedef struct tds_column_funcs TDSCOLUMNFUNCS
 
typedef struct tds_result_info TDSCOMPUTEINFO
 
typedef void(* TDSCONFPARSE) (const char *option, const char *value, void *param)
 
typedef struct tds_connection TDSCONNECTION
 
typedef struct tds_context TDSCONTEXT
 
typedef struct tds_cursor TDSCURSOR
 Holds informations about a cursor.
 
typedef struct tdsdaterec TDSDATEREC
 Used by tds_datecrack.
 
typedef struct tdsdump_off_item TDSDUMP_OFF_ITEM
 
typedef struct tds_dynamic TDSDYNAMIC
 Holds information for a dynamic (also called prepared) query.
 
typedef struct tds_env TDSENV
 Current environment as reported by the server.
 
typedef struct tds_freeze TDSFREEZE
 
typedef struct tds_headers TDSHEADERS
 
typedef struct tdsiconvinfo TDSICONV
 
typedef struct tds_locale TDSLOCALE
 
typedef struct tds_login TDSLOGIN
 
typedef struct tds_message TDSMESSAGE
 
typedef struct tds_multiple TDSMULTIPLE
 
typedef struct tds_packet TDSPACKET
 
typedef TDSRESULTINFO TDSPARAMINFO
 
typedef struct tds_poll_wakeup TDSPOLLWAKEUP
 
typedef struct tds_result_info TDSRESULTINFO
 Hold information for any results.
 
typedef int TDSRET
 
typedef struct tds_socket TDSSOCKET
 
typedef struct tds_upd_col TDSUPDCOL
 
typedef struct tds_variant TDSVARIANT
 Store variant informations.
 

Enumerations

enum  {
  OPT_VERSION = 0x01, OPT_TIMER = 0x02, OPT_NOFOOTER = 0x04, OPT_NOHEADER = 0x08,
  OPT_QUIET = 0x10, OPT_VERBOSE = 0x20, OPT_INSTANCES = 0x40, POS_ISO1,
  POS_UTF8, POS_UCS2LE, POS_UCS2BE, MUL_STARTED = 1,
  ASN1_SEQUENCE = ASN1_TAG_SEQUENCE, CS_USERNAME = 9100, CS_USERNAME = 9100, CS_PASSWORD = 9101,
  CS_PASSWORD = 9101, CS_APPNAME = 9102, CS_APPNAME = 9102, CS_HOSTNAME = 9103,
  CS_HOSTNAME = 9103, CS_LOGIN_STATUS = 9104, CS_LOGIN_STATUS = 9104, CS_TDS_VERSION = 9105,
  CS_TDS_VERSION = 9105, CS_CHARSETCNV = 9106, CS_CHARSETCNV = 9106, CS_PACKETSIZE = 9107,
  CS_PACKETSIZE = 9107, CS_USERDATA = 9108, CS_USERDATA = 9108, CS_NETIO = 9110,
  CS_NETIO = 9110, CS_TEXTLIMIT = 9112, CS_TEXTLIMIT = 9112, CS_HIDDEN_KEYS = 9113,
  CS_HIDDEN_KEYS = 9113, CS_VERSION = 9114, CS_VERSION = 9114, CS_IFILE = 9115,
  CS_IFILE = 9115, CS_LOGIN_TIMEOUT = 9116, CS_LOGIN_TIMEOUT = 9116, CS_TIMEOUT = 9117,
  CS_TIMEOUT = 9117, CS_MAX_CONNECT = 9118, CS_MAX_CONNECT = 9118, CS_EXPOSE_FMTS = 9120,
  CS_EXPOSE_FMTS = 9120, CS_EXTRA_INF = 9121, CS_EXTRA_INF = 9121, CS_ANSI_BINDS = 9123,
  CS_ANSI_BINDS = 9123, CS_BULK_LOGIN = 9124, CS_BULK_LOGIN = 9124, CS_LOC_PROP = 9125,
  CS_LOC_PROP = 9125, CS_PARENT_HANDLE = 9130, CS_PARENT_HANDLE = 9130, CS_EED_CMD = 9131,
  CS_EED_CMD = 9131, CS_DIAG_TIMEOUT = 9132, CS_DIAG_TIMEOUT = 9132, CS_DISABLE_POLL = 9133,
  CS_DISABLE_POLL = 9133, CS_SEC_ENCRYPTION = 9135, CS_SEC_ENCRYPTION = 9135, CS_SEC_CHALLENGE = 9136,
  CS_SEC_CHALLENGE = 9136, CS_SEC_NEGOTIATE = 9137, CS_SEC_NEGOTIATE = 9137, CS_CON_STATUS = 9143,
  CS_CON_STATUS = 9143, CS_VER_STRING = 9144, CS_VER_STRING = 9144, CS_SERVERNAME = 9146,
  CS_SERVERNAME = 9146, CS_SEC_APPDEFINED = 9149, CS_SEC_APPDEFINED = 9149, CS_STICKY_BINDS = 9151,
  CS_STICKY_BINDS = 9151, CS_SEC_NETWORKAUTH = 9175, CS_SEC_NETWORKAUTH = 9175, CS_SEC_DELEGATION = 9176,
  CS_SEC_DELEGATION = 9176, CS_SEC_MUTUALAUTH = 9177, CS_SEC_MUTUALAUTH = 9177, CS_SEC_SERVERPRINCIPAL = 9188,
  CS_SEC_SERVERPRINCIPAL = 9188, CS_SERVERADDR = 9206, CS_SERVERADDR = 9206, CS_PORT = 9300,
  CS_PORT = 9300, CS_CLIENTCHARSET = 9301, CS_CLIENTCHARSET = 9301, CS_DATABASE,
  dblib_msdblib = 0, TDS_CHARSET_ISO_8859_1 = 0, TDS_CHARSET_UTF_8 = 1, TDS_CHARSET_UCS_2LE = 2,
  TDS_CHARSET_UCS_2BE = 3, TDS_CHARSET_ARMSCII_8 = 4, TDS_CHARSET_BIG_5 = 5, TDS_CHARSET_BIG5_HKSCS = 6,
  TDS_CHARSET_C99 = 7, TDS_CHARSET_CHINESE = 8, TDS_CHARSET_CN = 9, TDS_CHARSET_CN_GB = 10,
  TDS_CHARSET_CN_GB_ISOIR165 = 11, TDS_CHARSET_CP1133 = 12, TDS_CHARSET_CP1250 = 13, TDS_CHARSET_CP1251 = 14,
  TDS_CHARSET_CP1252 = 15, TDS_CHARSET_CP1253 = 16, TDS_CHARSET_CP1254 = 17, TDS_CHARSET_CP1255 = 18,
  TDS_CHARSET_CP1256 = 19, TDS_CHARSET_CP1257 = 20, TDS_CHARSET_CP1258 = 21, TDS_CHARSET_CP1361 = 22,
  TDS_CHARSET_CP437 = 23, TDS_CHARSET_CP850 = 24, TDS_CHARSET_CP862 = 25, TDS_CHARSET_CP866 = 26,
  TDS_CHARSET_CP874 = 27, TDS_CHARSET_CP932 = 28, TDS_CHARSET_CP936 = 29, TDS_CHARSET_CP949 = 30,
  TDS_CHARSET_CP950 = 31, TDS_CHARSET_EUC_JP = 32, TDS_CHARSET_EUC_KR = 33, TDS_CHARSET_EUC_TW = 34,
  TDS_CHARSET_GB18030 = 35, TDS_CHARSET_GEORGIAN_ACADEMY = 36, TDS_CHARSET_GEORGIAN_PS = 37, TDS_CHARSET_HZ = 38,
  TDS_CHARSET_ISO_2022_CN = 39, TDS_CHARSET_ISO_2022_CN_EXT = 40, TDS_CHARSET_ISO_2022_JP = 41, TDS_CHARSET_ISO_2022_JP_1 = 42,
  TDS_CHARSET_ISO_2022_JP_2 = 43, TDS_CHARSET_ISO_2022_KR = 44, TDS_CHARSET_ISO_8859_10 = 45, TDS_CHARSET_ISO_8859_13 = 46,
  TDS_CHARSET_ISO_8859_14 = 47, TDS_CHARSET_ISO_8859_15 = 48, TDS_CHARSET_ISO_8859_16 = 49, TDS_CHARSET_ISO_8859_2 = 50,
  TDS_CHARSET_ISO_8859_3 = 51, TDS_CHARSET_ISO_8859_4 = 52, TDS_CHARSET_ISO_8859_5 = 53, TDS_CHARSET_ISO_8859_6 = 54,
  TDS_CHARSET_ISO_8859_7 = 55, TDS_CHARSET_ISO_8859_8 = 56, TDS_CHARSET_ISO_8859_9 = 57, TDS_CHARSET_ISO_IR_14 = 58,
  TDS_CHARSET_ISO_IR_149 = 59, TDS_CHARSET_ISO_IR_159 = 60, TDS_CHARSET_ISO_IR_166 = 61, TDS_CHARSET_ISO_IR_87 = 62,
  TDS_CHARSET_JAVA = 63, TDS_CHARSET_JISX0201_1976 = 64, TDS_CHARSET_KOI8_R = 65, TDS_CHARSET_KOI8_RU = 66,
  TDS_CHARSET_KOI8_T = 67, TDS_CHARSET_KOI8_U = 68, TDS_CHARSET_MAC = 69, TDS_CHARSET_MACARABIC = 70,
  TDS_CHARSET_MACCENTRALEUROPE = 71, TDS_CHARSET_MACCROATIAN = 72, TDS_CHARSET_MACCYRILLIC = 73, TDS_CHARSET_MACGREEK = 74,
  TDS_CHARSET_MACHEBREW = 75, TDS_CHARSET_MACICELAND = 76, TDS_CHARSET_MACROMANIA = 77, TDS_CHARSET_MACTHAI = 78,
  TDS_CHARSET_MACTURKISH = 79, TDS_CHARSET_MACUKRAINE = 80, TDS_CHARSET_MULELAO_1 = 81, TDS_CHARSET_NEXTSTEP = 82,
  TDS_CHARSET_ROMAN8 = 83, TDS_CHARSET_SJIS = 84, TDS_CHARSET_TCVN = 85, TDS_CHARSET_UCS_4BE = 86,
  TDS_CHARSET_UCS_4LE = 87, TDS_CHARSET_US_ASCII = 88, TDS_CHARSET_UTF_16BE = 89, TDS_CHARSET_UTF_16LE = 90,
  TDS_CHARSET_UTF_32BE = 91, TDS_CHARSET_UTF_32LE = 92, TDS_CHARSET_UTF_7 = 93, TDS_CHARSET_VISCII = 94,
  TDS_NUM_CHARSETS = 95, ODBC_PARAM_SIZE, TDS_OPT_ARITHOVERFLOW = 0x01, TDS_OPT_NUMERICTRUNC = 0x02,
  TDS_CUR_ISTAT_UNUSED = 0x00, TDS_CUR_ISTAT_DECLARED = 0x01, TDS_CUR_ISTAT_OPEN = 0x02, TDS_CUR_ISTAT_CLOSED = 0x04,
  TDS_CUR_ISTAT_RDONLY = 0x08, TDS_CUR_ISTAT_UPDATABLE = 0x10, TDS_CUR_ISTAT_ROWCNT = 0x20, TDS_CUR_ISTAT_DEALLOC = 0x40,
  SYBCHAR = 47, SYBCHAR = 47, SYBVARCHAR = 39, SYBVARCHAR = 39,
  SYBINTN = 38, SYBINTN = 38, SYBINT1 = 48, SYBINT1 = 48,
  SYBINT2 = 52, SYBINT2 = 52, SYBINT4 = 56, SYBINT4 = 56,
  SYBINT8 = 127, SYBINT8 = 127, SYBFLT8 = 62, SYBFLT8 = 62,
  SYBDATETIME = 61, SYBDATETIME = 61, SYBBIT = 50, SYBBIT = 50,
  SYBBITN = 104, SYBBITN = 104, SYBTEXT = 35, SYBTEXT = 35,
  SYBNTEXT = 99, SYBNTEXT = 99, SYBIMAGE = 34, SYBIMAGE = 34,
  SYBMONEY4 = 122, SYBMONEY4 = 122, SYBMONEY = 60, SYBMONEY = 60,
  SYBDATETIME4 = 58, SYBDATETIME4 = 58, SYBREAL = 59, SYBREAL = 59,
  SYBBINARY = 45, SYBBINARY = 45, SYBVOID = 31, SYBVOID = 31,
  SYBVARBINARY = 37, SYBVARBINARY = 37, SYBNUMERIC = 108, SYBNUMERIC = 108,
  SYBDECIMAL = 106, SYBDECIMAL = 106, SYBFLTN = 109, SYBFLTN = 109,
  SYBMONEYN = 110, SYBMONEYN = 110, SYBDATETIMN = 111, SYBDATETIMN = 111,
  SYBNVARCHAR = 103, SYBNVARCHAR = 103, SYBDATE = 49, SYBDATE = 49,
  SYBTIME = 51, SYBTIME = 51, SYBBIGDATETIME = 187, SYBBIGDATETIME = 187,
  SYBBIGTIME = 188, SYBBIGTIME = 188, SYBMSDATE = 40, SYBMSDATE = 40,
  SYBMSTIME = 41, SYBMSTIME = 41, SYBMSDATETIME2 = 42, SYBMSDATETIME2 = 42,
  SYBMSDATETIMEOFFSET = 43, SYBMSDATETIMEOFFSET = 43
}
 
enum  {
  hash_len = 20, CS_ADD = 1, CS_SUB, CS_MULT,
  CS_DIV, TDS_SMP_SYN = 1, TDS_SMP_ACK = 2, TDS_SMP_FIN = 4,
  TDS_SMP_DATA = 8, TDS_TYPEFLAG_INVALID = 0, TDS_TYPEFLAG_NULLABLE = 1, TDS_TYPEFLAG_FIXED = 2,
  TDS_TYPEFLAG_VARIABLE = 4, TDS_TYPEFLAG_COLLATE = 8, TDS_TYPEFLAG_ASCII = 16, TDS_TYPEFLAG_UNICODE = 32,
  TDS_TYPEFLAG_BINARY = 64, TDS_TYPEFLAG_DATETIME = 128, TDS_TYPEFLAG_NUMERIC = 256, TDS_TYPEFLAG_VARIANT = 512,
  MAXCOLNAMELEN = 512
}
 
enum  tds_bcp_directions { TDS_BCP_IN = 1, TDS_BCP_OUT = 2, TDS_BCP_QUERYOUT = 3 }
 bcp direction
 
enum  tds_cursor_fetch {
  TDS_CURSOR_FETCH_NEXT = 1, TDS_CURSOR_FETCH_PREV, TDS_CURSOR_FETCH_FIRST, TDS_CURSOR_FETCH_LAST,
  TDS_CURSOR_FETCH_ABSOLUTE, TDS_CURSOR_FETCH_RELATIVE
}
 
enum  tds_cursor_operation { TDS_CURSOR_POSITION = 0, TDS_CURSOR_UPDATE = 1, TDS_CURSOR_DELETE = 2, TDS_CURSOR_INSERT = 4 }
 
enum  TDS_CURSOR_STATE { TDS_CURSOR_STATE_UNACTIONED = 0, TDS_CURSOR_STATE_REQUESTED = 1, TDS_CURSOR_STATE_SENT = 2, TDS_CURSOR_STATE_ACTIONED = 3 }
 
enum  tds_encryption_level { TDS_ENCRYPTION_DEFAULT, TDS_ENCRYPTION_OFF, TDS_ENCRYPTION_REQUEST, TDS_ENCRYPTION_REQUIRE }
 
enum  tds_end {
  TDS_DONE_FINAL = 0x00, TDS_DONE_MORE_RESULTS = 0x01, TDS_DONE_ERROR = 0x02, TDS_DONE_INXACT = 0x04,
  TDS_DONE_PROC = 0x08, TDS_DONE_COUNT = 0x10, TDS_DONE_CANCELLED = 0x20, TDS_DONE_EVENT = 0x40,
  TDS_DONE_SRVERROR = 0x100, TDS_DONE_NO_TRAN = 0, TDS_DONE_TRAN_SUCCEED = 1, TDS_DONE_TRAN_PROGRESS = 2,
  TDS_DONE_STMT_ABORT = 3, TDS_DONE_TRAN_ABORT = 4
}
 Flags returned in TDS_DONE token. More...
 
enum  TDS_ICONV_ENTRY { client2ucs2, client2server_chardata, initial_char_conv_count }
 
enum  TDS_MULTIPLE_TYPE { TDS_MULTIPLE_QUERY, TDS_MULTIPLE_EXECUTE, TDS_MULTIPLE_RPC }
 
enum  tds_operations {
  TDS_OP_NONE = 0, TDS_OP_CURSOR = TDS_SP_CURSOR, TDS_OP_CURSOROPEN = TDS_SP_CURSOROPEN, TDS_OP_CURSORPREPARE = TDS_SP_CURSORPREPARE,
  TDS_OP_CURSOREXECUTE = TDS_SP_CURSOREXECUTE, TDS_OP_CURSORPREPEXEC = TDS_SP_CURSORPREPEXEC, TDS_OP_CURSORUNPREPARE = TDS_SP_CURSORUNPREPARE, TDS_OP_CURSORFETCH = TDS_SP_CURSORFETCH,
  TDS_OP_CURSOROPTION = TDS_SP_CURSOROPTION, TDS_OP_CURSORCLOSE = TDS_SP_CURSORCLOSE, TDS_OP_EXECUTESQL = TDS_SP_EXECUTESQL, TDS_OP_PREPARE = TDS_SP_PREPARE,
  TDS_OP_EXECUTE = TDS_SP_EXECUTE, TDS_OP_PREPEXEC = TDS_SP_PREPEXEC, TDS_OP_PREPEXECRPC = TDS_SP_PREPEXECRPC, TDS_OP_UNPREPARE = TDS_SP_UNPREPARE,
  TDS_OP_DYN_DEALLOC = 100
}
 
enum  tds_states {
  TDS_IDLE, TDS_WRITING, TDS_SENDING, TDS_PENDING,
  TDS_READING, TDS_DEAD
}
 values for tds->state More...
 
enum  tds_token_flags {
  TDS_HANDLE_ALL = 0, TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_FLAG =(OTHERS),
  TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_FLAG =(OTHERS),
  TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_FLAG =(OTHERS), TDS_TOKEN_RESULTS = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC,
  TDS_TOKEN_TRAILING = TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS
}
 
enum  tds_token_results {
  TDS_TOKEN_RES_OTHERS, TDS_TOKEN_RES_ROWFMT, TDS_TOKEN_RES_COMPUTEFMT, TDS_TOKEN_RES_PARAMFMT,
  TDS_TOKEN_RES_DONE, TDS_TOKEN_RES_ROW, TDS_TOKEN_RES_COMPUTE, TDS_TOKEN_RES_PROC,
  TDS_TOKEN_RES_MSG, TDS_TOKEN_RES_ENV
}
 
enum  TDSERRNO {
  TDSEOK = TDS_SUCCESS, TDSEVERDOWN = 100, TDSEINPROGRESS, TDSEICONVIU = 2400,
  TDSEICONVAVAIL = 2401, TDSEICONVO = 2402, TDSEICONVI = 2403, TDSEICONV2BIG = 2404,
  TDSEPORTINSTANCE = 2500, TDSESYNC = 20001, TDSEFCON = 20002, TDSETIME = 20003,
  TDSEREAD = 20004, TDSEWRIT = 20006, TDSESOCK = 20008, TDSECONN = 20009,
  TDSEMEM = 20010, TDSEINTF = 20012, TDSEUHST = 20013, TDSEPWD = 20014,
  TDSESEOF = 20017, TDSERPND = 20019, TDSEBTOK = 20020, TDSEOOB = 20022,
  TDSECLOS = 20056, TDSEUSCT = 20058, TDSEUTDS = 20146, TDSEEUNR = 20185,
  TDSECAP = 20203, TDSENEG = 20210, TDSEUMSG = 20212, TDSECAPTYP = 20213,
  TDSECONF = 20214, TDSEBPROBADTYP = 20250, TDSECLOSEIN = 20292
}
 

Functions

static bool is_tds_type_valid (int type)
 
TDSRET tds5_gss_send (TDSSOCKET *tds)
 
TDSAUTHENTICATIONtds5_negotiate_get_auth (TDSSOCKET *tds)
 
static void tds5_negotiate_set_msg_type (TDSAUTHENTICATION *tds_auth, unsigned msg_type)
 
int tds5_send_optioncmd (TDSSOCKET *tds, TDS_OPTION_CMD tds_command, TDS_OPTION tds_option, TDS_OPTION_ARG *tds_argument, TDS_INT *tds_argsize)
 
TDSRET tds71_submit_prepexec (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
 Creates a temporary stored procedure in the server and execute it. More...
 
int tds7_get_instance_port (struct addrinfo *addr, const char *instance)
 Get port of given instance. More...
 
int tds7_get_instance_ports (FILE *output, struct addrinfo *addr)
 Get port of all instances. More...
 
void tds7_srv_charset_changed (TDSCONNECTION *conn, TDS_UCHAR collate[5])
 
const char * tds_addrinfo2str (struct addrinfo *addr, char *name, int namemax)
 
TDSSOCKETtds_alloc_additional_socket (TDSCONNECTION *conn)
 
BCPCOLDATAtds_alloc_bcp_column_data (unsigned int column_size)
 
TDSBCPINFOtds_alloc_bcpinfo (void)
 
char * tds_alloc_client_sqlstate (int msgno)
 
TDSCOMPUTEINFO ** tds_alloc_compute_results (TDSSOCKET *tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
 
TDSRET tds_alloc_compute_row (TDSCOMPUTEINFO *res_info)
 
TDSCONTEXTtds_alloc_context (void *parent)
 
TDSCURSORtds_alloc_cursor (TDSSOCKET *tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen)
 
TDSDYNAMICtds_alloc_dynamic (TDSCONNECTION *conn, const char *id)
 Allocate a dynamic statement. More...
 
TDSLOCALEtds_alloc_locale (void)
 
TDSLOGINtds_alloc_login (int use_environment)
 
char * tds_alloc_lookup_sqlstate (TDSSOCKET *tds, int msgno)
 
TDSPACKETtds_alloc_packet (void *buf, unsigned len)
 
void * tds_alloc_param_data (TDSCOLUMN *curparam)
 Allocate data for a parameter. More...
 
TDSPARAMINFOtds_alloc_param_result (TDSPARAMINFO *old_param)
 Adds a output parameter to TDSPARAMINFO. More...
 
TDSRESULTINFOtds_alloc_results (TDS_USMALLINT num_cols)
 
TDSRET tds_alloc_row (TDSRESULTINFO *res_info)
 Allocate space for row store return NULL on out of memory.
 
TDSSOCKETtds_alloc_socket (TDSCONTEXT *context, unsigned int bufsize)
 
TDSRET tds_bcp_done (TDSSOCKET *tds, int *rows_copied)
 Tell we finished sending BCP data to server. More...
 
TDSRET tds_bcp_fread (TDSSOCKET *tds, TDSICONV *conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
 Read a data file, passing the data through iconv(). More...
 
TDSRET tds_bcp_init (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Initialize BCP information. More...
 
TDSRET tds_bcp_send_record (TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset)
 Send one row of data to server. More...
 
TDSRET tds_bcp_start (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Start sending BCP data to server. More...
 
TDSRET tds_bcp_start_copy_in (TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
 Start bulk copy to server. More...
 
static bool tds_capability_enabled (const TDS_CAPABILITY_TYPE *cap, unsigned cap_num)
 
void tds_close_socket (TDSSOCKET *tds)
 Close current socket. More...
 
int tds_config_boolean (const char *option, const char *value, TDSLOGIN *login)
 
TDS_USMALLINT * tds_config_verstr (const char *tdsver, TDSLOGIN *login)
 Set TDS version from given string. More...
 
int tds_connect_and_login (TDSSOCKET *tds, TDSLOGIN *login)
 
void tds_connection_close (TDSCONNECTION *conn)
 
int tds_connection_read (TDSSOCKET *tds, unsigned char *buf, int buflen)
 
int tds_connection_write (TDSSOCKET *tds, const unsigned char *buf, int buflen, int final)
 
const char * tds_convert_string (TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len)
 Convert a string in an allocated buffer. More...
 
void tds_convert_string_free (const char *original, const char *converted)
 
int tds_count_placeholders (const char *query)
 Count the number of placeholders ('?') in a query. More...
 
TDSRET tds_cursor_close (TDSSOCKET *tds, TDSCURSOR *cursor)
 
TDSRET tds_cursor_dealloc (TDSSOCKET *tds, TDSCURSOR *cursor)
 Send a deallocation request to server.
 
void tds_cursor_deallocated (TDSCONNECTION *conn, TDSCURSOR *cursor)
 
TDSRET tds_cursor_declare (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *send)
 
TDSRET tds_cursor_fetch (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row)
 
TDSRET tds_cursor_get_cursor_info (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_UINT *row_number, TDS_UINT *row_count)
 
TDSRET tds_cursor_open (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *send)
 
TDSRET tds_cursor_setname (TDSSOCKET *tds, TDSCURSOR *cursor)
 
TDSRET tds_cursor_setrows (TDSSOCKET *tds, TDSCURSOR *cursor, int *send)
 
TDSRET tds_cursor_update (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO *params)
 
TDSRET tds_datecrack (TDS_INT datetype, const void *di, TDSDATEREC *dr)
 Convert from db date format to a structured date format. More...
 
TDSRET tds_deferred_cursor_dealloc (TDSCONNECTION *conn, TDSCURSOR *cursor)
 Deallocate cursor on idle. More...
 
TDSRET tds_deferred_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 Unprepare dynamic on idle. More...
 
void tds_deinit_bcpinfo (TDSBCPINFO *bcpinfo)
 
void tds_detach_results (TDSRESULTINFO *info)
 Detach result info from it current socket.
 
TDSRET tds_disconnect (TDSSOCKET *tds)
 
DSTRtds_dstr_get (TDSSOCKET *tds, DSTR *s, size_t len)
 Reads a string from wire and put in a DSTR. More...
 
void tds_dynamic_deallocated (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 
size_t tds_fix_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol)
 Get column size for wire.
 
void tds_fix_login (TDSLOGIN *login)
 Fix configuration after reading it. More...
 
TDSRET tds_flush_packet (TDSSOCKET *tds)
 Flush packet to server. More...
 
void tds_free_all_results (TDSSOCKET *tds)
 
void tds_free_bcp_column_data (BCPCOLDATA *coldata)
 
void tds_free_bcpinfo (TDSBCPINFO *bcpinfo)
 
void tds_free_context (TDSCONTEXT *locale)
 
void tds_free_input_params (TDSDYNAMIC *dyn)
 Frees all allocated input parameters of a dynamic statement. More...
 
void tds_free_locale (TDSLOCALE *locale)
 
void tds_free_login (TDSLOGIN *login)
 
void tds_free_msg (TDSMESSAGE *message)
 
void tds_free_packets (TDSPACKET *packet)
 
void tds_free_param_result (TDSPARAMINFO *param_info)
 Delete latest parameter.
 
void tds_free_param_results (TDSPARAMINFO *param_info)
 
void tds_free_results (TDSRESULTINFO *res_info)
 
void tds_free_row (TDSRESULTINFO *res_info, unsigned char *row)
 
void tds_free_socket (TDSSOCKET *tds)
 
void tds_freeze (TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
 Stop writing to server and cache every packet not sending them to server. More...
 
TDSRET tds_freeze_abort (TDSFREEZE *freeze)
 Discard all data written after the freeze. More...
 
TDSRET tds_freeze_close (TDSFREEZE *freeze)
 Stop keeping data for this specific freeze. More...
 
TDSRET tds_freeze_close_len (TDSFREEZE *freeze, int32_t size)
 Stop keeping data for this specific freeze. More...
 
size_t tds_freeze_written (TDSFREEZE *freeze)
 Compute how many bytes has been written from freeze. More...
 
unsigned char tds_get_byte (TDSSOCKET *tds)
 Return a single byte from the input buffer. More...
 
TDS_SERVER_TYPE tds_get_cardinal_type (TDS_SERVER_TYPE datatype, int usertype)
 
TDSRET tds_get_char_data (TDSSOCKET *tds, char *dest, size_t wire_size, TDSCOLUMN *curcol)
 Fetch character data the wire. More...
 
TDSRET tds_get_column_declaration (TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
 Return declaration for column (like "varchar(20)"). More...
 
const TDS_COMPILETIME_SETTINGStds_get_compiletime_settings (void)
 Return a structure capturing the compile-time settings provided to the configure script. More...
 
TDS_SERVER_TYPE tds_get_conversion_type (TDS_SERVER_TYPE srctype, int colsize)
 Return type suitable for conversions (convert all nullable types to fixed type) More...
 
char * tds_get_home_file (const char *file)
 Return filename from HOME directory. More...
 
TDSLOCALEtds_get_locale (void)
 Get locale information. More...
 
bool tds_get_n (TDSSOCKET *tds, void *dest, size_t n)
 Get N bytes from the buffer and return them in the already allocated space
given to us. More...
 
int tds_get_size_by_type (TDS_SERVER_TYPE servertype)
 Return the number of bytes needed by specified type.
 
size_t tds_get_string (TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
 Fetch a string from the wire. More...
 
int tds_get_token_size (int marker)
 tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determine how to read past a token More...
 
TDS_UINT tds_get_uint (TDSSOCKET *tds)
 Get an int32 from the server. More...
 
TDS_UINT8 tds_get_uint8 (TDSSOCKET *tds)
 Get an uint64 from the server. More...
 
TDS_USMALLINT tds_get_usmallint (TDSSOCKET *tds)
 Get an int16 from the server.
 
int tds_get_varint_size (TDSCONNECTION *conn, int datatype)
 tds_get_varint_size() returns the size of a variable length integer returned in a result string
 
void tds_getmac (TDS_SYS_SOCKET s, unsigned char mac[6])
 
unsigned int tds_gettime_ms (void)
 
int tds_goodread (TDSSOCKET *tds, unsigned char *buf, int buflen)
 Loops until we have received some characters return -1 on failure.
 
int tds_goodwrite (TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
 
TDSAUTHENTICATIONtds_gss_get_auth (TDSSOCKET *tds)
 
int tds_iconv_alloc (TDSCONNECTION *conn)
 Allocate iconv stuff. More...
 
void tds_iconv_close (TDSCONNECTION *conn)
 
void tds_iconv_free (TDSCONNECTION *conn)
 
TDSICONVtds_iconv_from_collate (TDSCONNECTION *conn, TDS_UCHAR collate[5])
 Get iconv information from a LCID (to support different column encoding under MSSQL2K)
 
TDSRET tds_iconv_open (TDSCONNECTION *conn, const char *charset, int use_utf16)
 
TDSLOGINtds_init_login (TDSLOGIN *login, TDSLOCALE *locale)
 Initialize login structure with locale information and other stuff for connection. More...
 
int tds_init_write_buf (TDSSOCKET *tds)
 
TDSDYNAMICtds_lookup_dynamic (TDSCONNECTION *conn, const char *id)
 Finds a dynamic given string id. More...
 
struct addrinfo * tds_lookup_host (const char *servername)
 Get the IP address for a hostname. More...
 
TDSRET tds_lookup_host_set (const char *servername, struct addrinfo **addr)
 
char * tds_money_to_string (const TDS_MONEY *money, char *s, bool use_2_digits)
 
TDSRET tds_multiple_done (TDSSOCKET *tds, TDSMULTIPLE *multiple)
 
TDSRET tds_multiple_execute (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC *dyn)
 
TDSRET tds_multiple_init (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS *head)
 
TDSRET tds_multiple_query (TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO *params)
 
int tds_needs_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
 Check if dynamic request must be unprepared. More...
 
const char * tds_next_placeholder (const char *start)
 Get position of next placeholder. More...
 
TDSAUTHENTICATIONtds_ntlm_get_auth (TDSSOCKET *tds)
 Build a NTLMSPP packet to send to server. More...
 
TDS_INT tds_numeric_change_prec_scale (TDS_NUMERIC *numeric, unsigned char new_prec, unsigned char new_scale)
 
TDS_INT tds_numeric_to_string (const TDS_NUMERIC *numeric, char *s)
 
TDSERRNO tds_open_socket (TDSSOCKET *tds, struct addrinfo *ipaddr, unsigned int port, int timeout, int *p_oserr)
 
int tds_parse_boolean (const char *value, int default_value)
 
void tds_parse_conf_section (const char *option, const char *value, void *param)
 
unsigned char tds_peek (TDSSOCKET *tds)
 Reads a byte from the TDS stream without removing it. More...
 
TDSRET tds_process_cancel (TDSSOCKET *tds)
 
TDSRET tds_process_login_tokens (TDSSOCKET *tds)
 tds_process_login_tokens() is called after sending the login packet to the server. More...
 
TDSRET tds_process_simple_query (TDSSOCKET *tds)
 Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results, beware they are discarded. More...
 
TDSRET tds_process_tokens (TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
 process all streams. More...
 
const char * tds_prtype (int token)
 Returns string representation of the given type. More...
 
char * tds_prwsaerror (int erc)
 
void tds_prwsaerror_free (char *s)
 
int tds_put_buf (TDSSOCKET *tds, const unsigned char *buf, int dsize, int ssize)
 
int tds_put_byte (TDSSOCKET *tds, unsigned char c)
 
int tds_put_cancel (TDSSOCKET *tds)
 
int tds_put_int (TDSSOCKET *tds, TDS_INT i)
 
int tds_put_int8 (TDSSOCKET *tds, TDS_INT8 i)
 
int tds_put_n (TDSSOCKET *tds, const void *buf, size_t n)
 
int tds_put_smallint (TDSSOCKET *tds, TDS_SMALLINT si)
 
int tds_put_string (TDSSOCKET *tds, const char *buf, int len)
 Output a string to wire automatic translate string to unicode if needed. More...
 
size_t tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id, int idlen)
 Quote an id. More...
 
size_t tds_quote_id_rpc (TDSSOCKET *tds, char *buffer, const char *id, int idlen)
 Quote an id for a RPC call. More...
 
size_t tds_quote_string (TDSSOCKET *tds, char *buffer, const char *str, int len)
 Quote a string. More...
 
void tds_random_buffer (unsigned char *out, int len)
 
bool tds_read_conf_file (TDSLOGIN *login, const char *server)
 Read configuration info for given server return 0 on error. More...
 
bool tds_read_conf_section (FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param)
 Read a section of configuration file (INI style file) More...
 
TDSLOGINtds_read_config_info (TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
 tds_read_config_info() will fill the tds connection structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values More...
 
int tds_read_packet (TDSSOCKET *tds)
 Read in one 'packet' from the server. More...
 
void * tds_realloc (void **pp, size_t new_size)
 Reallocate a pointer and update it if success. More...
 
TDSPACKETtds_realloc_packet (TDSPACKET *packet, unsigned len)
 
TDSSOCKETtds_realloc_socket (TDSSOCKET *tds, size_t bufsize)
 
static void tds_release_cur_dyn (TDSSOCKET *tds)
 
void tds_release_cursor (TDSCURSOR **pcursor)
 
void tds_release_dynamic (TDSDYNAMIC **dyn)
 Frees dynamic statement. More...
 
int tds_select (TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
 Select on a socket until it's available or the timeout expires. More...
 
TDSRET tds_send_cancel (TDSSOCKET *tds)
 tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called directly after this. More...
 
bool tds_set_app (TDSLOGIN *tds_login, const char *application) TDS_WUR
 
void tds_set_bulk (TDSLOGIN *tds_login, bool enabled)
 
bool tds_set_client_charset (TDSLOGIN *tds_login, const char *charset) TDS_WUR
 
void tds_set_column_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency. More...
 
void tds_set_cur_dyn (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Set current dynamic. More...
 
void tds_set_current_results (TDSSOCKET *tds, TDSRESULTINFO *info)
 
static void tds_set_current_send_packet (TDSSOCKET *tds, TDSPACKET *pkt)
 
bool tds_set_host (TDSLOGIN *tds_login, const char *hostname) TDS_WUR
 
TDSRET tds_set_interfaces_file_loc (const char *interfloc)
 Set the full name of interface file. More...
 
bool tds_set_language (TDSLOGIN *tds_login, const char *language) TDS_WUR
 
bool tds_set_library (TDSLOGIN *tds_login, const char *library) TDS_WUR
 
void tds_set_packet (TDSLOGIN *tds_login, int packet_size)
 
void tds_set_param_type (TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
 Set type of column initializing all dependency. More...
 
bool tds_set_passwd (TDSLOGIN *tds_login, const char *password) TDS_WUR
 
void tds_set_port (TDSLOGIN *tds_login, int port)
 
bool tds_set_server (TDSLOGIN *tds_login, const char *server) TDS_WUR
 Set the servername in a TDSLOGIN structure. More...
 
TDS_STATE tds_set_state (TDSSOCKET *tds, TDS_STATE state)
 Set state of TDS connection, with logging and checking. More...
 
bool tds_set_user (TDSLOGIN *tds_login, const char *username) TDS_WUR
 
void tds_set_version (TDSLOGIN *tds_login, TDS_TINYINT major_ver, TDS_TINYINT minor_ver)
 
const char * tds_skip_comment (const char *s)
 Skip a comment in a query. More...
 
const char * tds_skip_quoted (const char *s)
 Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]) More...
 
void tds_socket_flush (TDS_SYS_SOCKET sock)
 
int tds_socket_set_nonblocking (TDS_SYS_SOCKET sock)
 Set socket to non-blocking. More...
 
void tds_srv_charset_changed (TDSCONNECTION *conn, const char *charset)
 
void tds_start_query (TDSSOCKET *tds, unsigned char packet_type)
 Start query packet of a given type. More...
 
char * tds_strndup (const void *s, TDS_INTPTR len)
 Copy a string of length len to a new allocated buffer This function does not read more than len bytes Please note that some system implementation of strndup do not assure they don't read past len bytes as they use still strlen to check length to copy limiting after strlen to size passed String returned is NUL terminated. More...
 
TDSRET tds_submit_begin_tran (TDSSOCKET *tds)
 Send a rollback request. More...
 
TDSRET tds_submit_commit (TDSSOCKET *tds, int cont)
 Send a commit request. More...
 
TDSRET tds_submit_execdirect (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
 Submit a prepared query with parameters. More...
 
TDSRET tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Sends a previously prepared dynamic statement to the server. More...
 
TDSRET tds_submit_optioncmd (TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
 Send option commands to server. More...
 
TDSRET tds_submit_prepare (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
 Creates a temporary stored procedure in the server. More...
 
TDSRET tds_submit_query (TDSSOCKET *tds, const char *query)
 Sends a language string to the database server for processing. More...
 
TDSRET tds_submit_query_params (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
 Sends a language string to the database server for processing. More...
 
TDSRET tds_submit_queryf (TDSSOCKET *tds, const char *queryf,...)
 Format and submit a query. More...
 
TDSRET tds_submit_rollback (TDSSOCKET *tds, int cont)
 Send a rollback request. More...
 
TDSRET tds_submit_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
 Calls a RPC from server. More...
 
TDSRET tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn)
 Send a unprepare request for a prepared query. More...
 
void tds_swap_bytes (void *buf, int bytes)
 
void tds_unget_byte (TDSSOCKET *tds)
 Unget will always work as long as you don't call it twice in a row. More...
 
TDSRET tds_vstrbuild (char *buffer, int buflen, int *resultlen, const char *text, int textlen, const char *formats, int formatlen, va_list ap)
 
void tds_wakeup_close (TDSPOLLWAKEUP *wakeup)
 
static TDS_SYS_SOCKET tds_wakeup_get_fd (const TDSPOLLWAKEUP *wakeup)
 
int tds_wakeup_init (TDSPOLLWAKEUP *wakeup)
 
void tds_wakeup_send (TDSPOLLWAKEUP *wakeup, char cancel)
 
TDSRET tds_write_packet (TDSSOCKET *tds, unsigned char final)
 
TDSRET tds_writetext_continue (TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
 Send some data in the writetext request started by tds_writetext_start. More...
 
TDSRET tds_writetext_end (TDSSOCKET *tds)
 Finish sending writetext data. More...
 
TDSRET tds_writetext_start (TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
 Start writing writetext request. More...
 
void tdsdump_close (void)
 Close the TDS dump log file.
 
void tdsdump_col (const TDSCOLUMN *col)
 Write a column value to the debug log. More...
 
void tdsdump_dump_buf (const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
 Dump the contents of data into the log file in a human readable format. More...
 
int tdsdump_isopen (void)
 
void tdsdump_log (const char *file, unsigned int level_line, const char *fmt,...)
 Write a message to the debug log. More...
 
void tdsdump_off (TDSDUMP_OFF_ITEM *off_item)
 Temporarily turn off logging for current thread. More...
 
void tdsdump_on (TDSDUMP_OFF_ITEM *off_item)
 Turn logging back on for current thread. More...
 
int tdsdump_open (const char *filename)
 Create and truncate a human readable dump file for the TDS traffic. More...
 
int tdserror (const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
 Call the client library's error handler (for library-generated errors only) More...
 

Variables

const char STD_DATETIME_FMT []
 
int tds_debug_flags
 
int tds_g_append_mode
 
const char tds_hex_digits []
 
const int tds_numeric_bytes_per_prec []
 The following little table is indexed by precision and will tell us the number of bytes required to store the specified precision. More...
 
const uint16_t tds_type_flags_ms [256]
 
int tds_write_dump
 Tell if TDS debug logging is turned on or off.
 

Detailed Description

Main include file for libtds.

Macro Definition Documentation

◆ TDS_BYTE_SWAP16

#define TDS_BYTE_SWAP16 (   value)
Value:
(((((uint16_t)value)<<8) & 0xFF00u) | \
((((uint16_t)value)>>8) & 0x00FFu))

◆ TDS_BYTE_SWAP32

#define TDS_BYTE_SWAP32 (   value)
Value:
(((((uint32_t)value)<<24) & 0xFF000000u)| \
((((uint32_t)value)<< 8) & 0x00FF0000u)| \
((((uint32_t)value)>> 8) & 0x0000FF00u)| \
((((uint32_t)value)>>24) & 0x000000FFu))

◆ TDS_IS_MSSQL

#define TDS_IS_MSSQL (   x)    (((x)->conn->product_version & 0x80000000u)!=0)

Check if product is Microsft SQL Server.

x should be a TDSSOCKET*.

◆ TDS_IS_SYBASE

#define TDS_IS_SYBASE (   x)    (!((x)->conn->product_version & 0x80000000u))

Check if product is Sybase (such as Adaptive Server Enterrprice).

x should be a TDSSOCKET*.

◆ TDS_MS_VER

#define TDS_MS_VER (   maj,
  min,
 
)    (0x80000000u|((maj)<<24)|((min)<<16)|(x))

Calc a version number for mssql.

Use with TDS_MS_VER(7,0,842). For test for a range of version you can use check like if (tds->product_version >= TDS_MS_VER(7,0,0) && tds->product_version < TDS_MS_VER(8,0,0))

◆ TDS_START_LEN_GENERIC

#define TDS_START_LEN_GENERIC (   tds_socket,
  len 
)
Value:
do { \
TDSFREEZE current_freeze[1]; \
tds_freeze((tds_socket), current_freeze, (len)); do { do

Typedef Documentation

◆ TDS_COMPILETIME_SETTINGS

A structure to hold all the compile-time settings.

This structure is returned by tds_get_compiletime_settings

◆ TDS_ENCODING

typedef struct tds_encoding TDS_ENCODING

Information relevant to libiconv.

The name is an iconv name, not the same as found in master..syslanguages.

◆ TDSBLOB

typedef struct tds_blob TDSBLOB

Information about blobs (e.g.

text or image). current_row contains this structure.

Enumeration Type Documentation

◆ tds_end

enum tds_end

Flags returned in TDS_DONE token.

Enumerator
TDS_DONE_FINAL 

final result set, command completed successfully.

TDS_DONE_MORE_RESULTS 

more results follow

TDS_DONE_ERROR 

error occurred

TDS_DONE_INXACT 

transaction in progress

TDS_DONE_PROC 

results are from a stored procedure

TDS_DONE_COUNT 

count field in packet is valid

TDS_DONE_CANCELLED 

acknowledging an attention command (usually a cancel)

TDS_DONE_SRVERROR 

SQL server server error.

◆ tds_states

enum tds_states

values for tds->state

Enumerator
TDS_IDLE 

no data expected

TDS_WRITING 

client is writing data

TDS_SENDING 

client would send data

TDS_PENDING 

cilent is waiting for data

TDS_READING 

client is reading data

TDS_DEAD 

no connection

Function Documentation

◆ tds_bcp_done()

TDSRET tds_bcp_done ( TDSSOCKET tds,
int *  rows_copied 
)

Tell we finished sending BCP data to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
[out]rows_copiednumber of rows copied to server
Here is the call graph for this function:

◆ tds_bcp_fread()

TDSRET tds_bcp_fread ( TDSSOCKET tds,
TDSICONV char_conv,
FILE *  stream,
const char *  terminator,
size_t  term_len,
char **  outbuf,
size_t *  outbytes 
)

Read a data file, passing the data through iconv().

Return values
TDS_SUCCESSsuccess
TDS_FAILerror reading the column
TDS_NO_MORE_RESULTSend of file detected
Here is the call graph for this function:

◆ tds_bcp_init()

TDSRET tds_bcp_init ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

Initialize BCP information.

Query structure of the table to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information to initialize. Structure should be allocate and table name and direction should be already set.

◆ tds_bcp_send_record()

TDSRET tds_bcp_send_record ( TDSSOCKET tds,
TDSBCPINFO bcpinfo,
tds_bcp_get_col_data  get_col_data,
tds_bcp_null_error  null_error,
int  offset 
)

Send one row of data to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information
get_col_datafunction to call to retrieve data to be sent
ignoredfunction to call if we try to send NULL if not allowed (not used)
offsetpassed to get_col_data and null_error to specify the row to get
Returns
TDS_SUCCESS or TDS_FAIL.

◆ tds_bcp_start()

TDSRET tds_bcp_start ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

Start sending BCP data to server.

Initialize stream to accept data.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information already prepared
Here is the call graph for this function:

◆ tds_bcp_start_copy_in()

TDSRET tds_bcp_start_copy_in ( TDSSOCKET tds,
TDSBCPINFO bcpinfo 
)

Start bulk copy to server.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
bcpinfoBCP information already prepared
Here is the call graph for this function:

◆ tds_get_conversion_type()

TDS_SERVER_TYPE tds_get_conversion_type ( TDS_SERVER_TYPE  srctype,
int  colsize 
)

Return type suitable for conversions (convert all nullable types to fixed type)

Parameters
srctypetype to convert
colsizesize of type
Returns
type for conversion
Here is the caller graph for this function:

◆ tds_get_locale()

TDSLOCALE* tds_get_locale ( void  )

Get locale information.

Returns
allocated structure with all information or NULL if error

◆ tds_iconv_alloc()

int tds_iconv_alloc ( TDSCONNECTION conn)

Allocate iconv stuff.

Returns
0 for success

◆ tds_numeric_to_string()

TDS_INT tds_numeric_to_string ( const TDS_NUMERIC numeric,
char *  s 
)
Returns
<0 if error

◆ tds_set_column_type()

void tds_set_column_type ( TDSCONNECTION conn,
TDSCOLUMN curcol,
TDS_SERVER_TYPE  type 
)

Set type of column initializing all dependency.

column_usertype should already be set.

Parameters
curcolcolumn to set
typetype to set

◆ tds_set_param_type()

void tds_set_param_type ( TDSCONNECTION conn,
TDSCOLUMN curcol,
TDS_SERVER_TYPE  type 
)

Set type of column initializing all dependency.

Parameters
tdsstate information for the socket and the TDS protocol
curcolcolumn to set
typetype to set

◆ tds_set_server()

bool tds_set_server ( TDSLOGIN tds_login,
const char *  server 
)

Set the servername in a TDSLOGIN structure.

Normally copies server into tds_login. If server does not point to a plausible name, the environment variables TDSQUERY and DSQUERY are used, in that order. If they don't exist, the "default default" servername is "SYBASE" (although the utility of that choice is a bit murky).

Parameters
tds_loginpoints to a TDSLOGIN structure
serverthe servername, or NULL, or a zero-length string
Todo:
open the log file earlier, so these messages can be seen.
Here is the call graph for this function:

◆ tds_set_state()

TDS_STATE tds_set_state ( TDSSOCKET tds,
TDS_STATE  state 
)

Set state of TDS connection, with logging and checking.

Parameters
tdsstate information for the socket and the TDS protocol
statethe new state of the connection, cf. TDS_STATE.
Returns
the new state, which might not be state.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tds_strndup()

char* tds_strndup ( const void *  s,
TDS_INTPTR  len 
)

Copy a string of length len to a new allocated buffer This function does not read more than len bytes Please note that some system implementation of strndup do not assure they don't read past len bytes as they use still strlen to check length to copy limiting after strlen to size passed String returned is NUL terminated.

Parameters
sstring to copy from
lenlength to copy
Returns
string copied or NULL if errors

◆ tds_writetext_continue()

TDSRET tds_writetext_continue ( TDSSOCKET tds,
const TDS_UCHAR *  text,
TDS_UINT  size 
)

Send some data in the writetext request started by tds_writetext_start.

You should write in total (with multiple calls to this function) all bytes declared calling tds_writetext_start.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
textdata to write
sizedata size in bytes
Here is the call graph for this function:

◆ tds_writetext_end()

TDSRET tds_writetext_end ( TDSSOCKET tds)

Finish sending writetext data.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
Here is the call graph for this function:

◆ tds_writetext_start()

TDSRET tds_writetext_start ( TDSSOCKET tds,
const char *  objname,
const char *  textptr,
const char *  timestamp,
int  with_log,
TDS_UINT  size 
)

Start writing writetext request.

This request start a bulk session.

Parameters
tdsA pointer to the TDSSOCKET structure managing a client/server operation.
objnametable name
textptrTEXTPTR (see sql documentation)
timestampdata timestamp
with_logis log is enabled during insert
sizebytes to be inserted
Here is the call graph for this function:

◆ tdsdump_col()

void tdsdump_col ( const TDSCOLUMN col)

Write a column value to the debug log.


Parameters
colcolumn to dump

◆ tdsdump_dump_buf()

void tdsdump_dump_buf ( const char *  file,
unsigned int  level_line,
const char *  msg,
const void *  buf,
size_t  length 
)

Dump the contents of data into the log file in a human readable format.

Parameters
filesource file name
level_lineline and level combined. This and file are automatically computed by TDS_DBG_* macros.
msgmessage to print before dump
bufbuffer to dump
lengthnumber of bytes in the buffer

◆ tdsdump_log()

void tdsdump_log ( const char *  file,
unsigned int  level_line,
const char *  fmt,
  ... 
)

Write a message to the debug log.


Parameters
filename of the log file
level_linekind of detail to be included
fmtprintf-like format string

◆ tdsdump_off()

void tdsdump_off ( TDSDUMP_OFF_ITEM off_item)

Temporarily turn off logging for current thread.

Parameters
off_itemList item to be used by the function. The item will be initialized by the function. It's retained till is removed with tdsdump_on so it must be kept alive.

◆ tdsdump_on()

void tdsdump_on ( TDSDUMP_OFF_ITEM off_item)

Turn logging back on for current thread.

Parameters
off_itemList item to remove from global list. Previously used by tdsdump_off().

◆ tdsdump_open()

int tdsdump_open ( const char *  filename)

Create and truncate a human readable dump file for the TDS traffic.

The name of the file is specified by the filename parameter. If that is given as NULL or an empty string, any existing log file will be closed.

Returns
true if the file was opened, false if it couldn't be opened.
Here is the caller graph for this function:

◆ tdserror()

int tdserror ( const TDSCONTEXT tds_ctx,
TDSSOCKET tds,
int  msgno,
int  errnum 
)

Call the client library's error handler (for library-generated errors only)

The client library error handler may return: TDS_INT_CANCEL – Return TDS_FAIL to the calling function. For TDSETIME, closes the connection first. TDS_INT_CONTINUE – For TDSETIME only, retry the network read/write operation. Else invalid. TDS_INT_TIMEOUT – For TDSETIME only, send a TDSCANCEL packet. Else invalid.

These are Sybase semantics, but they serve all purposes.
The application tells the library to quit, fail, retry, or attempt to cancel. In the event of a network timeout, a failed operation necessarily means the connection becomes unusable, because no cancellation dialog was concluded with the server.

It is the client library's duty to call the error handler installed by the application, if any, and to interpret the installed handler's return code. It may return to this function one of the above codes only. This function will not check the return code because there's nothing that can be done here except abort. It is merely passed to the calling function, which will (we hope) DTRT.

Parameters
tds_ctxpoints to a TDSCONTEXT structure
tdsthe connection structure, may be NULL if not connected
msgnoan enumerated libtds msgno, cf. tds.h
errnumthe OS errno, if it matters, else zero
Returns
client library function's return code

Variable Documentation

◆ tds_numeric_bytes_per_prec

const int tds_numeric_bytes_per_prec[]
extern

The following little table is indexed by precision and will tell us the number of bytes required to store the specified precision.

The following little table is indexed by precision and will tell us the number of bytes required to store the specified precision.

Support precision up to 77 digits

Information for a server connection.
Definition: tds.h:1163
freetds-1.3.6/doc/reference/a00449_source.html000644 025423 025423 00001305005 14162303413 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/tds.h Source File
FreeTDS API
tds.h
Go to the documentation of this file.
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns
3  * Copyright (C) 2010, 2011 Frediano Ziglio
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _tds_h_
22 #define _tds_h_
23 
24 #ifndef _freetds_config_h_
25 #error should include config.h before
26 #endif
27 
28 #include <stdarg.h>
29 #include <stdio.h>
30 #include <time.h>
31 
32 #ifdef HAVE_STDDEF_H
33 #include <stddef.h>
34 #endif
35 
36 #if HAVE_NETDB_H
37 #include <netdb.h>
38 #endif /* HAVE_NETDB_H */
39 
40 #if HAVE_NETINET_IN_H
41 #include <netinet/in.h>
42 #endif /* HAVE_NET_INET_IN_H */
43 #if HAVE_ARPA_INET_H
44 #include <arpa/inet.h>
45 #endif /* HAVE_ARPA_INET_H */
46 
47 #if HAVE_SYS_SOCKET_H
48 #include <sys/socket.h>
49 #endif /* HAVE_SYS_SOCKET_H */
50 
51 /* forward declaration */
52 typedef struct tdsiconvinfo TDSICONV;
53 typedef struct tds_connection TDSCONNECTION;
54 typedef struct tds_socket TDSSOCKET;
55 typedef struct tds_column TDSCOLUMN;
56 typedef struct tds_bcpinfo TDSBCPINFO;
57 
58 #include <freetds/version.h>
59 #include <freetds/sysdep_private.h>
60 #include <freetds/thread.h>
61 #include <freetds/bool.h>
62 #include <freetds/macros.h>
63 #include <freetds/utils/string.h>
64 #include <freetds/replacements.h>
65 
66 #include <freetds/pushvis.h>
67 
68 #ifdef __cplusplus
69 extern "C"
70 {
71 #if 0
72 }
73 #endif
74 #endif
75 
82 {
83  const char *freetds_version; /* release version of FreeTDS */
84  const char *sysconfdir; /* location of freetds.conf */
85  const char *last_update; /* latest software_version date among the modules */
86  const char *tdsver; /* TDS protocol version (4.2/4.6/5.0/7.0/7.1) 5.0 */
87  bool msdblib; /* for MS style dblib */
88  bool sybase_compat; /* enable increased Open Client binary compatibility */
89  bool threadsafe; /* compile for thread safety default=no */
90  bool libiconv; /* search for libiconv in DIR/include and DIR/lib */
91  bool iodbc; /* build odbc driver against iODBC in DIR */
92  bool unixodbc; /* build odbc driver against unixODBC in DIR */
93  bool openssl; /* build against OpenSSL */
94  bool gnutls; /* build against GnuTLS */
95  bool mars; /* MARS enabled */
96  bool sspi; /* SSPI enabled */
97  bool kerberos; /* Kerberos enabled */
99 
115 /*
116  * All references to data that touch the wire should use the following typedefs.
117  *
118  * If you have problems on 64-bit machines and the code is
119  * using a native datatype, please change it to use
120  * these. (In the TDS layer only, the API layers have their
121  * own typedefs which equate to these).
122  */
123 typedef char TDS_CHAR; /* 8-bit char */
124 typedef uint8_t TDS_UCHAR; /* 8-bit uchar */
125 typedef uint8_t TDS_TINYINT; /* 8-bit unsigned */
126 typedef int16_t TDS_SMALLINT; /* 16-bit int */
127 typedef uint16_t TDS_USMALLINT; /* 16-bit unsigned */
128 typedef int32_t TDS_INT; /* 32-bit int */
129 typedef uint32_t TDS_UINT; /* 32-bit unsigned */
130 typedef int64_t TDS_INT8; /* 64-bit integer */
131 typedef uint64_t TDS_UINT8; /* 64-bit unsigned */
132 typedef intptr_t TDS_INTPTR;
133 typedef uintptr_t TDS_UINTPTR;
134 typedef tds_sysdep_real32_type TDS_REAL; /* 32-bit real */
135 typedef tds_sysdep_real64_type TDS_FLOAT; /* 64-bit real */
136 
137 #include <freetds/proto.h>
138 
139 #define TDS_INVALID_TYPE ((TDS_SERVER_TYPE) 0)
140 
145 typedef struct
146 {
147  TDS_UINT8 time;
148  TDS_INT date;
149  TDS_SMALLINT offset;
150  TDS_USMALLINT time_prec:3;
151  TDS_USMALLINT _tds_reserved:10;
152  TDS_USMALLINT has_time:1;
153  TDS_USMALLINT has_date:1;
154  TDS_USMALLINT has_offset:1;
156 
158 typedef struct tdsdaterec
159 {
160  TDS_INT year;
161  TDS_INT quarter;
162  TDS_INT month;
163  TDS_INT day;
164  TDS_INT dayofyear;
165  TDS_INT weekday;
166  TDS_INT hour;
167  TDS_INT minute;
168  TDS_INT second;
169  TDS_INT decimicrosecond;
170  TDS_INT timezone;
172 
178 extern const int tds_numeric_bytes_per_prec[];
179 
180 typedef int TDSRET;
181 #define TDS_NO_MORE_RESULTS ((TDSRET)1)
182 #define TDS_SUCCESS ((TDSRET)0)
183 #define TDS_FAIL ((TDSRET)-1)
184 #define TDS_CANCELLED ((TDSRET)-2)
185 #define TDS_FAILED(rc) ((rc)<0)
186 #define TDS_SUCCEED(rc) ((rc)>=0)
187 #define TDS_PROPAGATE(rc) \
188  do { TDSRET _tds_ret = (rc); if (TDS_FAILED(_tds_ret)) return _tds_ret; } while(0)
189 
190 #define TDS_INT_CONTINUE 1
191 #define TDS_INT_CANCEL 2
192 #define TDS_INT_TIMEOUT 3
193 
194 
195 #define TDS_NO_COUNT -1
196 
197 #define TDS_ROW_RESULT 4040
198 #define TDS_PARAM_RESULT 4042
199 #define TDS_STATUS_RESULT 4043
200 #define TDS_MSG_RESULT 4044
201 #define TDS_COMPUTE_RESULT 4045
202 #define TDS_CMD_DONE 4046
203 #define TDS_CMD_SUCCEED 4047
204 #define TDS_CMD_FAIL 4048
205 #define TDS_ROWFMT_RESULT 4049
206 #define TDS_COMPUTEFMT_RESULT 4050
207 #define TDS_DESCRIBE_RESULT 4051
208 #define TDS_DONE_RESULT 4052
209 #define TDS_DONEPROC_RESULT 4053
210 #define TDS_DONEINPROC_RESULT 4054
211 #define TDS_OTHERS_RESULT 4055
212 
213 enum tds_token_results
214 {
215  TDS_TOKEN_RES_OTHERS,
216  TDS_TOKEN_RES_ROWFMT,
217  TDS_TOKEN_RES_COMPUTEFMT,
218  TDS_TOKEN_RES_PARAMFMT,
219  TDS_TOKEN_RES_DONE,
220  TDS_TOKEN_RES_ROW,
221  TDS_TOKEN_RES_COMPUTE,
222  TDS_TOKEN_RES_PROC,
223  TDS_TOKEN_RES_MSG,
224  TDS_TOKEN_RES_ENV,
225 };
226 
227 #define TDS_TOKEN_FLAG(flag) TDS_RETURN_##flag = (1 << (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << (TDS_TOKEN_RES_##flag*2))
228 
229 enum tds_token_flags
230 {
231  TDS_HANDLE_ALL = 0,
232  TDS_TOKEN_FLAG(OTHERS),
233  TDS_TOKEN_FLAG(ROWFMT),
234  TDS_TOKEN_FLAG(COMPUTEFMT),
235  TDS_TOKEN_FLAG(PARAMFMT),
236  TDS_TOKEN_FLAG(DONE),
237  TDS_TOKEN_FLAG(ROW),
238  TDS_TOKEN_FLAG(COMPUTE),
239  TDS_TOKEN_FLAG(PROC),
240  TDS_TOKEN_FLAG(MSG),
241  TDS_TOKEN_FLAG(ENV),
242  TDS_TOKEN_RESULTS = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC,
243  TDS_TOKEN_TRAILING = TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS
244 };
245 
250 {
251  TDS_DONE_FINAL = 0x00
253  , TDS_DONE_ERROR = 0x02
254  , TDS_DONE_INXACT = 0x04
255  , TDS_DONE_PROC = 0x08
256  , TDS_DONE_COUNT = 0x10
258  , TDS_DONE_EVENT = 0x40 /* part of an event notification. */
259  , TDS_DONE_SRVERROR = 0x100
261  /* after the above flags, a TDS_DONE packet has a field describing the state of the transaction */
262  , TDS_DONE_NO_TRAN = 0 /* No transaction in effect */
263  , TDS_DONE_TRAN_SUCCEED = 1 /* Transaction completed successfully */
264  , TDS_DONE_TRAN_PROGRESS= 2 /* Transaction in progress */
265  , TDS_DONE_STMT_ABORT = 3 /* A statement aborted */
266  , TDS_DONE_TRAN_ABORT = 4 /* Transaction aborted */
267 };
268 
269 
270 /*
271  * TDSERRNO is emitted by libtds to the client library's error handler
272  * (which may in turn call the client's error handler).
273  * These match the db-lib msgno, because the same values have the same meaning
274  * in db-lib and ODBC. ct-lib maps them to ct-lib numbers (todo).
275  */
276 typedef enum { TDSEOK = TDS_SUCCESS,
277  TDSEVERDOWN = 100,
278  TDSEINPROGRESS,
279  TDSEICONVIU = 2400,
280  TDSEICONVAVAIL = 2401,
281  TDSEICONVO = 2402,
282  TDSEICONVI = 2403,
283  TDSEICONV2BIG = 2404,
284  TDSEPORTINSTANCE = 2500,
285  TDSESYNC = 20001,
286  TDSEFCON = 20002,
287  TDSETIME = 20003,
288  TDSEREAD = 20004,
289  TDSEWRIT = 20006,
290  TDSESOCK = 20008,
291  TDSECONN = 20009,
292  TDSEMEM = 20010,
293  TDSEINTF = 20012, /* Server name not found in interface file */
294  TDSEUHST = 20013, /* Unknown host machine name. */
295  TDSEPWD = 20014,
296  TDSESEOF = 20017,
297  TDSERPND = 20019,
298  TDSEBTOK = 20020,
299  TDSEOOB = 20022,
300  TDSECLOS = 20056,
301  TDSEUSCT = 20058,
302  TDSEUTDS = 20146,
303  TDSEEUNR = 20185,
304  TDSECAP = 20203,
305  TDSENEG = 20210,
306  TDSEUMSG = 20212,
307  TDSECAPTYP = 20213,
308  TDSECONF = 20214,
309  TDSEBPROBADTYP = 20250,
310  TDSECLOSEIN = 20292
311 } TDSERRNO;
312 
313 
314 enum {
315  TDS_CUR_ISTAT_UNUSED = 0x00,
316  TDS_CUR_ISTAT_DECLARED = 0x01,
317  TDS_CUR_ISTAT_OPEN = 0x02,
318  TDS_CUR_ISTAT_CLOSED = 0x04,
319  TDS_CUR_ISTAT_RDONLY = 0x08,
320  TDS_CUR_ISTAT_UPDATABLE = 0x10,
321  TDS_CUR_ISTAT_ROWCNT = 0x20,
322  TDS_CUR_ISTAT_DEALLOC = 0x40
323 };
324 
325 /* string types */
326 #define TDS_NULLTERM -9
327 
328 
329 typedef union tds_option_arg
330 {
331  TDS_TINYINT ti;
332  TDS_INT i;
333  TDS_CHAR *c;
335 
336 
337 typedef enum tds_encryption_level {
338  TDS_ENCRYPTION_DEFAULT,
339  TDS_ENCRYPTION_OFF,
340  TDS_ENCRYPTION_REQUEST,
341  TDS_ENCRYPTION_REQUIRE
342 } TDS_ENCRYPTION_LEVEL;
343 
344 /*
345  * TODO use system macros for optimization
346  * See mcrypt for reference and linux kernel source for optimization
347  * check if unaligned access and use fast write/read when implemented
348  */
349 #define TDS_BYTE_SWAP16(value) \
350  (((((uint16_t)value)<<8) & 0xFF00u) | \
351  ((((uint16_t)value)>>8) & 0x00FFu))
352 
353 #define TDS_BYTE_SWAP32(value) \
354  (((((uint32_t)value)<<24) & 0xFF000000u)| \
355  ((((uint32_t)value)<< 8) & 0x00FF0000u)| \
356  ((((uint32_t)value)>> 8) & 0x0000FF00u)| \
357  ((((uint32_t)value)>>24) & 0x000000FFu))
358 
359 #define is_end_token(x) ((x) >= TDS_DONE_TOKEN && (x) <= TDS_DONEINPROC_TOKEN)
360 
361 enum {
362  TDS_TYPEFLAG_INVALID = 0,
363  TDS_TYPEFLAG_NULLABLE = 1,
364  TDS_TYPEFLAG_FIXED = 2,
365  TDS_TYPEFLAG_VARIABLE = 4,
366  TDS_TYPEFLAG_COLLATE = 8,
367  TDS_TYPEFLAG_ASCII = 16,
368  TDS_TYPEFLAG_UNICODE = 32,
369  TDS_TYPEFLAG_BINARY = 64,
370  TDS_TYPEFLAG_DATETIME = 128,
371  TDS_TYPEFLAG_NUMERIC = 256,
372  TDS_TYPEFLAG_VARIANT = 512,
373 };
374 
375 extern const uint16_t tds_type_flags_ms[256];
376 #if 0
377 extern const uint16_t tds_type_flags_syb[256];
378 extern const char *const tds_type_names[256];
379 #endif
380 
381 #define is_fixed_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_FIXED) != 0)
382 #define is_nullable_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_NULLABLE) != 0)
383 #define is_variable_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIABLE) != 0)
384 #define is_variant_inner_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIANT) != 0)
385 
386 
387 #define is_blob_type(x) ((x)==SYBTEXT || (x)==SYBIMAGE || (x)==SYBNTEXT)
388 #define is_blob_col(x) ((x)->column_varint_size > 2)
389 /* large type means it has a two byte size field */
390 /* define is_large_type(x) (x>128) */
391 #define is_numeric_type(x) ((x)==SYBNUMERIC || (x)==SYBDECIMAL)
392 
393 #define is_datetime_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_DATETIME) != 0)
394 #define is_unicode_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_UNICODE) != 0)
395 #define is_collate_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_COLLATE) != 0)
396 #define is_ascii_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_ASCII) != 0)
397 #define is_binary_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_BINARY) != 0)
398 #define is_char_type(x) ((tds_type_flags_ms[x] & (TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_UNICODE)) != 0)
399 #define is_similar_type(x, y) (is_char_type(x) && is_char_type(y))
400 static inline
401 bool is_tds_type_valid(int type)
402 {
403  return (unsigned) type < 256u && tds_type_flags_ms[type] != 0;
404 }
405 
406 
407 #define TDS_MAX_CAPABILITY 32
408 #define MAXPRECISION 77
409 #define TDS_MAX_CONN 4096
410 #define TDS_MAX_DYNID_LEN 30
411 
412 /* defaults to use if no others are found */
413 #define TDS_DEF_SERVER "SYBASE"
414 #define TDS_DEF_BLKSZ 512
415 #define TDS_DEF_CHARSET "iso_1"
416 #define TDS_DEF_LANG "us_english"
417 #if TDS50
418 #define TDS_DEFAULT_VERSION 0x500
419 #define TDS_DEF_PORT 4000
420 #elif TDS71
421 #define TDS_DEFAULT_VERSION 0x701
422 #define TDS_DEF_PORT 1433
423 #elif TDS72
424 #define TDS_DEFAULT_VERSION 0x702
425 #define TDS_DEF_PORT 1433
426 #elif TDS73
427 #define TDS_DEFAULT_VERSION 0x703
428 #define TDS_DEF_PORT 1433
429 #elif TDS74
430 #define TDS_DEFAULT_VERSION 0x704
431 #define TDS_DEF_PORT 1433
432 #else
433 #define TDS_DEFAULT_VERSION 0x000
434 #define TDS_DEF_PORT 1433
435 #endif
436 
437 /* normalized strings from freetds.conf file */
438 #define TDS_STR_VERSION "tds version"
439 #define TDS_STR_BLKSZ "initial block size"
440 #define TDS_STR_SWAPDT "swap broken dates"
441 #define TDS_STR_DUMPFILE "dump file"
442 #define TDS_STR_DEBUGLVL "debug level"
443 #define TDS_STR_DEBUGFLAGS "debug flags"
444 #define TDS_STR_TIMEOUT "timeout"
445 #define TDS_STR_QUERY_TIMEOUT "query timeout"
446 #define TDS_STR_CONNTIMEOUT "connect timeout"
447 #define TDS_STR_HOSTNAME "hostname"
448 #define TDS_STR_HOST "host"
449 #define TDS_STR_PORT "port"
450 #define TDS_STR_TEXTSZ "text size"
451 /* for big endian hosts, obsolete, ignored */
452 #define TDS_STR_EMUL_LE "emulate little endian"
453 #define TDS_STR_CHARSET "charset"
454 #define TDS_STR_CLCHARSET "client charset"
455 #define TDS_STR_USE_UTF_16 "use utf-16"
456 #define TDS_STR_LANGUAGE "language"
457 #define TDS_STR_APPENDMODE "dump file append"
458 #define TDS_STR_DATEFMT "date format"
459 #define TDS_STR_INSTANCE "instance"
460 #define TDS_STR_ASA_DATABASE "asa database"
461 #define TDS_STR_DATABASE "database"
462 #define TDS_STR_ENCRYPTION "encryption"
463 #define TDS_STR_USENTLMV2 "use ntlmv2"
464 #define TDS_STR_USELANMAN "use lanman"
465 /* conf values */
466 #define TDS_STR_ENCRYPTION_OFF "off"
467 #define TDS_STR_ENCRYPTION_REQUEST "request"
468 #define TDS_STR_ENCRYPTION_REQUIRE "require"
469 /* Defines to enable optional GSSAPI delegation */
470 #define TDS_GSSAPI_DELEGATION "enable gssapi delegation"
471 /* Mutual authentication */
472 #define TDS_STR_MUTUAL_AUTHENTICATION "mutual authentication"
473 /* Kerberos realm name */
474 #define TDS_STR_REALM "realm"
475 /* Kerberos SPN */
476 #define TDS_STR_SPN "spn"
477 /* CA file */
478 #define TDS_STR_CAFILE "ca file"
479 /* CRL file */
480 #define TDS_STR_CRLFILE "crl file"
481 /* check SSL hostname */
482 #define TDS_STR_CHECKSSLHOSTNAME "check certificate hostname"
483 /* database filename to attach on login (MSSQL) */
484 #define TDS_STR_DBFILENAME "database filename"
485 /* Application Intent MSSQL 2012 support */
486 #define TDS_STR_READONLY_INTENT "read-only intent"
487 /* configurable cipher suite to send to openssl's SSL_set_cipher_list() function */
488 #define TLS_STR_OPENSSL_CIPHERS "openssl ciphers"
489 /* enable old TLS v1, required for instance if you are using a really old Windows XP */
490 #define TDS_STR_ENABLE_TLS_V1 "enable tls v1"
491 
492 
493 /* TODO do a better check for alignment than this */
494 typedef union
495 {
496  void *p;
497  int i;
498  int64_t ui;
500 
501 #define TDS_ALIGN_SIZE sizeof(tds_align_struct)
502 
503 typedef struct tds_capability_type
504 {
505  unsigned char type;
506  unsigned char len; /* always sizeof(values) */
507  unsigned char values[TDS_MAX_CAPABILITY/2-2];
509 
510 typedef struct tds_capabilities
511 {
512  TDS_CAPABILITY_TYPE types[2];
514 
515 #define TDS_MAX_LOGIN_STR_SZ 128
516 typedef struct tds_login
517 {
519  int port;
520  TDS_USMALLINT tds_version;
521  int block_size;
522  DSTR language; /* e.g. us-english */
524  TDS_INT connect_timeout;
525  DSTR client_host_name;
526  DSTR server_host_name;
532  DSTR openssl_ciphers;
533  DSTR app_name;
538  DSTR library; /* Ct-Library, DB-Library, TDS-Library or ODBC */
539  TDS_TINYINT encryption_level;
540 
541  TDS_INT query_timeout;
542  TDS_CAPABILITIES capabilities;
543  DSTR client_charset;
544  DSTR database;
545 
546  struct addrinfo *ip_addrs;
547  DSTR instance_name;
548  DSTR dump_file;
549  int debug_flags;
550  int text_size;
551  DSTR routing_address;
552  uint16_t routing_port;
553 
554  unsigned char option_flag2;
555 
556  unsigned int bulk_copy:1;
557  unsigned int suppress_language:1;
558  unsigned int gssapi_use_delegation:1;
559  unsigned int mutual_authentication:1;
560  unsigned int use_ntlmv2:1;
561  unsigned int use_ntlmv2_specified:1;
562  unsigned int use_lanman:1;
563  unsigned int mars:1;
564  unsigned int use_utf16:1;
565  unsigned int use_new_password:1;
566  unsigned int valid_configuration:1;
567  unsigned int check_ssl_hostname:1;
568  unsigned int readonly_intent:1;
569  unsigned int enable_tls_v1:1;
570  unsigned int server_is_valid:1;
571 } TDSLOGIN;
572 
573 typedef struct tds_headers
574 {
575  const char *qn_options;
576  const char *qn_msgtext;
577  TDS_INT qn_timeout;
578  /* TDS 7.4+: trace activity ID char[20] */
579 } TDSHEADERS;
580 
581 typedef struct tds_locale
582 {
583  char *language;
584  char *server_charset;
585  char *date_fmt;
586 } TDSLOCALE;
587 
592 typedef struct tds_blob
593 {
594  TDS_CHAR *textvalue;
595  TDS_CHAR textptr[16];
596  TDS_CHAR timestamp[8];
597  unsigned char valid_ptr;
599 
603 typedef struct tds_variant
604 {
605  /* this MUST have same position and place of textvalue in tds_blob */
606  TDS_CHAR *data;
607  TDS_INT size;
608  TDS_INT data_len;
609  TDS_SERVER_TYPE type;
610  TDS_UCHAR collation[5];
612 
617 typedef struct tds_encoding
618 {
620  const char *name;
621  unsigned char min_bytes_per_char;
622  unsigned char max_bytes_per_char;
624  unsigned char canonic;
626 
627 typedef struct tds_bcpcoldata
628 {
629  TDS_UCHAR *data;
630  TDS_INT datalen;
631  bool is_null;
632 } BCPCOLDATA;
633 
634 
635 typedef TDSRET tds_func_get_info(TDSSOCKET *tds, TDSCOLUMN *col);
636 typedef TDSRET tds_func_get_data(TDSSOCKET *tds, TDSCOLUMN *col);
637 typedef TDS_INT tds_func_row_len(TDSCOLUMN *col);
638 typedef TDSRET tds_func_put_info(TDSSOCKET *tds, TDSCOLUMN *col);
639 typedef TDSRET tds_func_put_data(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7);
640 typedef int tds_func_check(const TDSCOLUMN *col);
641 
642 typedef struct tds_column_funcs
643 {
644  tds_func_get_info *get_info;
645  tds_func_get_data *get_data;
646  tds_func_row_len *row_len;
652  tds_func_put_info *put_info;
662  tds_func_put_data *put_data;
663 #if ENABLE_EXTRA_CHECKS
664 
678  tds_func_check *check;
679 #endif
680 #if 0
681  TDSRET (*convert)(TDSSOCKET *tds, TDSCOLUMN *col);
682 #endif
684 
689 {
690  const TDSCOLUMNFUNCS *funcs;
691  TDS_INT column_usertype;
692  TDS_INT column_flags;
693 
694  TDS_INT column_size;
696  TDS_SERVER_TYPE column_type;
701  TDS_TINYINT column_varint_size;
703  TDS_TINYINT column_prec;
704  TDS_TINYINT column_scale;
706  struct
707  {
708  TDS_SERVER_TYPE column_type;
709  TDS_INT column_size;
710  } on_server;
711 
714  DSTR table_name;
715  DSTR column_name;
716  DSTR table_column_name;
717 
718  unsigned char *column_data;
719  void (*column_data_free)(struct tds_column *column);
720  unsigned char column_nullable:1;
721  unsigned char column_writeable:1;
722  unsigned char column_identity:1;
723  unsigned char column_key:1;
724  unsigned char column_hidden:1;
725  unsigned char column_output:1;
726  unsigned char column_timestamp:1;
727  unsigned char column_computed:1;
728  TDS_UCHAR column_collation[5];
729 
730  /* additional fields flags for compute results */
731  TDS_SMALLINT column_operand;
732  TDS_TINYINT column_operator;
733 
734  /* FIXME this is data related, not column */
737 
738  /* related to binding or info stored by client libraries */
739  /* FIXME find a best place to store these data, some are unused */
740  TDS_SMALLINT column_bindtype;
741  TDS_SMALLINT column_bindfmt;
742  TDS_UINT column_bindlen;
743  TDS_SMALLINT *column_nullbind;
744  TDS_CHAR *column_varaddr;
745  TDS_INT *column_lenbind;
746  TDS_INT column_textpos;
747  TDS_INT column_text_sqlgetdatapos;
748  TDS_CHAR column_text_sqlputdatainfo;
749  unsigned char column_iconv_left;
750  char column_iconv_buf[9];
751 
752  BCPCOLDATA *bcp_column_data;
761  TDS_INT bcp_prefix_len;
762  TDS_INT bcp_term_len;
763  TDS_CHAR *bcp_terminator;
764 };
765 
766 
768 typedef struct tds_result_info
769 {
770  /* TODO those fields can became a struct */
771  TDSCOLUMN **columns;
772  TDS_USMALLINT num_cols;
773  TDS_USMALLINT computeid;
774  TDS_INT ref_count;
775  TDSSOCKET *attached_to;
776  unsigned char *current_row;
777  void (*row_free)(struct tds_result_info* result, unsigned char *row);
778  TDS_INT row_size;
779 
780  TDS_SMALLINT *bycolumns;
781  TDS_USMALLINT by_cols;
782  bool rows_exist;
783  /* TODO remove ?? used only in dblib */
784  bool more_results;
786 
788 typedef enum tds_states
789 {
795  TDS_DEAD
797 
798 typedef enum tds_operations
799 {
800  TDS_OP_NONE = 0,
801 
802  /* mssql operations */
803  TDS_OP_CURSOR = TDS_SP_CURSOR,
804  TDS_OP_CURSOROPEN = TDS_SP_CURSOROPEN,
805  TDS_OP_CURSORPREPARE = TDS_SP_CURSORPREPARE,
806  TDS_OP_CURSOREXECUTE = TDS_SP_CURSOREXECUTE,
807  TDS_OP_CURSORPREPEXEC = TDS_SP_CURSORPREPEXEC,
808  TDS_OP_CURSORUNPREPARE = TDS_SP_CURSORUNPREPARE,
809  TDS_OP_CURSORFETCH = TDS_SP_CURSORFETCH,
810  TDS_OP_CURSOROPTION = TDS_SP_CURSOROPTION,
811  TDS_OP_CURSORCLOSE = TDS_SP_CURSORCLOSE,
812  TDS_OP_EXECUTESQL = TDS_SP_EXECUTESQL,
813  TDS_OP_PREPARE = TDS_SP_PREPARE,
814  TDS_OP_EXECUTE = TDS_SP_EXECUTE,
815  TDS_OP_PREPEXEC = TDS_SP_PREPEXEC,
816  TDS_OP_PREPEXECRPC = TDS_SP_PREPEXECRPC,
817  TDS_OP_UNPREPARE = TDS_SP_UNPREPARE,
818 
819  /* sybase operations */
820  TDS_OP_DYN_DEALLOC = 100,
821 } TDS_OPERATION;
822 
823 #define TDS_DBG_LOGIN __FILE__, ((__LINE__ << 4) | 11)
824 #define TDS_DBG_HEADER __FILE__, ((__LINE__ << 4) | 10)
825 #define TDS_DBG_FUNC __FILE__, ((__LINE__ << 4) | 7)
826 #define TDS_DBG_INFO2 __FILE__, ((__LINE__ << 4) | 6)
827 #define TDS_DBG_INFO1 __FILE__, ((__LINE__ << 4) | 5)
828 #define TDS_DBG_NETWORK __FILE__, ((__LINE__ << 4) | 4)
829 #define TDS_DBG_WARN __FILE__, ((__LINE__ << 4) | 3)
830 #define TDS_DBG_ERROR __FILE__, ((__LINE__ << 4) | 2)
831 #define TDS_DBG_SEVERE __FILE__, ((__LINE__ << 4) | 1)
832 
833 #define TDS_DBGFLAG_FUNC 0x80
834 #define TDS_DBGFLAG_INFO2 0x40
835 #define TDS_DBGFLAG_INFO1 0x20
836 #define TDS_DBGFLAG_NETWORK 0x10
837 #define TDS_DBGFLAG_WARN 0x08
838 #define TDS_DBGFLAG_ERROR 0x04
839 #define TDS_DBGFLAG_SEVERE 0x02
840 #define TDS_DBGFLAG_ALL 0xfff
841 #define TDS_DBGFLAG_LOGIN 0x0800
842 #define TDS_DBGFLAG_HEADER 0x0400
843 #define TDS_DBGFLAG_PID 0x1000
844 #define TDS_DBGFLAG_TIME 0x2000
845 #define TDS_DBGFLAG_SOURCE 0x4000
846 #define TDS_DBGFLAG_THREAD 0x8000
847 
848 #if 0
849 
854 enum TDS_DBG_LOG_STATE
855 {
856  TDS_DBG_LOGIN = (1 << 0)
858  , TDS_DBG_API = (1 << 1)
859  , TDS_DBG_ASYNC = (1 << 2)
860  , TDS_DBG_DIAG = (1 << 3)
861  , TDS_DBG_error = (1 << 4)
862  /* TODO: ^^^^^ make upper case when old #defines (above) are removed */
863  /* Log FreeTDS runtime/logic error occurs. */
864  , TDS_DBG_PACKET = (1 << 5)
865  , TDS_DBG_LIBTDS = (1 << 6)
866  , TDS_DBG_CONFIG = (1 << 7)
867  , TDS_DBG_DEFAULT = 0xFE
868 };
869 #endif
870 
871 typedef struct tds_result_info TDSCOMPUTEINFO;
872 
874 
875 typedef struct tds_message
876 {
877  TDS_CHAR *server;
878  TDS_CHAR *message;
879  TDS_CHAR *proc_name;
880  TDS_CHAR *sql_state;
881  TDS_INT msgno;
882  TDS_INT line_number;
883  /* -1 .. 255 */
884  TDS_SMALLINT state;
885  TDS_TINYINT priv_msg_type;
886  TDS_TINYINT severity;
887  /* for library-generated errors */
888  int oserr;
889 } TDSMESSAGE;
890 
891 typedef struct tds_upd_col
892 {
893  struct tds_upd_col *next;
894  TDS_INT colnamelength;
895  char * columnname;
896 } TDSUPDCOL;
897 
898 typedef enum {
899  TDS_CURSOR_STATE_UNACTIONED = 0 /* initial value */
900  , TDS_CURSOR_STATE_REQUESTED = 1 /* called by ct_cursor */
901  , TDS_CURSOR_STATE_SENT = 2 /* sent to server */
902  , TDS_CURSOR_STATE_ACTIONED = 3 /* acknowledged by server */
903 } TDS_CURSOR_STATE;
904 
905 typedef struct tds_cursor_status
906 {
907  TDS_CURSOR_STATE declare;
908  TDS_CURSOR_STATE cursor_row;
909  TDS_CURSOR_STATE open;
910  TDS_CURSOR_STATE fetch;
911  TDS_CURSOR_STATE close;
912  TDS_CURSOR_STATE dealloc;
914 
915 typedef enum tds_cursor_operation
916 {
917  TDS_CURSOR_POSITION = 0,
918  TDS_CURSOR_UPDATE = 1,
919  TDS_CURSOR_DELETE = 2,
920  TDS_CURSOR_INSERT = 4
921 } TDS_CURSOR_OPERATION;
922 
923 typedef enum tds_cursor_fetch
924 {
925  TDS_CURSOR_FETCH_NEXT = 1,
926  TDS_CURSOR_FETCH_PREV,
927  TDS_CURSOR_FETCH_FIRST,
928  TDS_CURSOR_FETCH_LAST,
929  TDS_CURSOR_FETCH_ABSOLUTE,
930  TDS_CURSOR_FETCH_RELATIVE
931 } TDS_CURSOR_FETCH;
932 
936 typedef struct tds_cursor
937 {
938  struct tds_cursor *next;
939  TDS_INT ref_count;
940  char *cursor_name;
941  TDS_INT cursor_id;
942  TDS_TINYINT options;
947  char *query;
948  /* TODO for updatable columns */
949  /* TDS_TINYINT number_upd_cols; */
950  /* TDSUPDCOL *cur_col_list; */
951  TDS_INT cursor_rows;
952  /* TDSPARAMINFO *params; */
954  TDS_USMALLINT srv_status;
955  TDSRESULTINFO *res_info;
956  TDS_INT type, concurrency;
958 
962 typedef struct tds_env
963 {
966  char *language;
968  char *charset;
970  char *database;
972 
976 typedef struct tds_dynamic
977 {
978  struct tds_dynamic *next;
979  TDS_INT ref_count;
981  TDS_INT num_id;
987  char id[30];
993  TDS_TINYINT emulated;
998  /* int dyn_state; */ /* TODO use it */
1009  char *query;
1011 
1012 typedef enum {
1013  TDS_MULTIPLE_QUERY,
1014  TDS_MULTIPLE_EXECUTE,
1015  TDS_MULTIPLE_RPC
1016 } TDS_MULTIPLE_TYPE;
1017 
1018 typedef struct tds_multiple
1019 {
1020  TDS_MULTIPLE_TYPE type;
1021  unsigned int flags;
1022 } TDSMULTIPLE;
1023 
1024 /* forward declaration */
1025 typedef struct tds_context TDSCONTEXT;
1026 typedef int (*err_handler_t) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *);
1027 
1029 {
1030  TDSLOCALE *locale;
1031  void *parent;
1032  /* handlers */
1033  int (*msg_handler) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *);
1034  int (*err_handler) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *);
1035  int (*int_handler) (void *);
1036  bool money_use_2_digits;
1037 };
1038 
1039 enum TDS_ICONV_ENTRY
1040 {
1041  client2ucs2
1042  , client2server_chardata
1043  , initial_char_conv_count /* keep last */
1044 };
1045 
1046 typedef struct tds_authentication
1047 {
1048  uint8_t *packet;
1049  int packet_len;
1050  /* TDS_MSG_TOKEN type, for TDS5 */
1051  uint16_t msg_type;
1052  TDSRET (*free)(TDSCONNECTION* conn, struct tds_authentication * auth);
1053  TDSRET (*handle_next)(TDSSOCKET * tds, struct tds_authentication * auth, size_t len);
1055 
1056 typedef struct tds_packet
1057 {
1058  struct tds_packet *next;
1059  uint16_t sid;
1060 
1061 #if ENABLE_ODBC_MARS
1062 
1065  uint8_t data_start;
1066 #endif
1067 
1071  unsigned data_len;
1072  unsigned capacity;
1073  unsigned char buf[1];
1074 } TDSPACKET;
1075 
1076 #if ENABLE_ODBC_MARS
1077 #define tds_packet_zero_data_start(pkt) do { (pkt)->data_start = 0; } while(0)
1078 #define tds_packet_get_data_start(pkt) ((pkt)->data_start)
1079 #else
1080 #define tds_packet_zero_data_start(pkt) do { } while(0)
1081 #define tds_packet_get_data_start(pkt) 0
1082 #endif
1083 
1084 typedef struct tds_poll_wakeup
1085 {
1086  TDS_SYS_SOCKET s_signal, s_signaled;
1087 } TDSPOLLWAKEUP;
1088 
1089 /* field related to connection */
1091 {
1092  TDS_USMALLINT tds_version;
1093  TDS_UINT product_version;
1094  char *product_name;
1095 
1096  TDS_SYS_SOCKET s;
1097  TDSPOLLWAKEUP wakeup;
1098  const TDSCONTEXT *tds_ctx;
1099 
1102 
1113 
1114  int char_conv_count;
1115  TDSICONV **char_convs;
1116 
1117  TDS_UCHAR collation[5];
1118  TDS_UCHAR tds72_transaction[8];
1119 
1120  TDS_CAPABILITIES capabilities;
1121  unsigned int use_iconv:1;
1122  unsigned int tds71rev1:1;
1123  unsigned int pending_close:1;
1124  unsigned int encrypt_single_packet:1;
1125 #if ENABLE_ODBC_MARS
1126  unsigned int mars:1;
1127 
1128  TDSSOCKET *in_net_tds;
1129  TDSPACKET *packets;
1130  TDSPACKET *recv_packet;
1131  TDSPACKET *send_packets;
1132  unsigned send_pos, recv_pos;
1133 
1134 #define BUSY_SOCKET ((TDSSOCKET*)(TDS_UINTPTR)1)
1135 #define TDSSOCKET_VALID(tds) (((TDS_UINTPTR)(tds)) > 1)
1136  struct tds_socket **sessions;
1137  unsigned num_sessions;
1138 #endif
1139  tds_mutex list_mtx;
1140 
1141  unsigned num_cached_packets;
1142  TDSPACKET *packet_cache;
1143 
1144  int spid;
1145  int client_spid;
1146 
1147  void *tls_session;
1148 #if defined(HAVE_GNUTLS)
1149  void *tls_credentials;
1150 #elif defined(HAVE_OPENSSL)
1151  void *tls_ctx;
1152 #else
1153  void *tls_dummy;
1154 #endif
1155  TDSAUTHENTICATION *authentication;
1156  char *server;
1157 };
1158 
1163 {
1164 #if ENABLE_ODBC_MARS
1165  TDSCONNECTION *conn;
1166 #else
1167  TDSCONNECTION conn[1];
1168 #endif
1169 
1170  void *parent;
1171 
1177  unsigned char *in_buf;
1178 
1185  unsigned char *out_buf;
1186 
1191  unsigned int out_buf_max;
1192  unsigned in_pos;
1193  unsigned out_pos;
1194  unsigned in_len;
1195  unsigned char in_flag;
1196  unsigned char out_flag;
1198  unsigned frozen;
1204 
1205 #if ENABLE_ODBC_MARS
1206 
1210  uint16_t sid;
1211 
1216  tds_condition packet_cond;
1217 
1222  TDSPACKET *sending_packet;
1223  TDS_UINT recv_seq;
1224  TDS_UINT send_seq;
1225  TDS_UINT recv_wnd;
1226  TDS_UINT send_wnd;
1227 #endif
1228  /* packet we received */
1229  TDSPACKET *recv_packet;
1232 
1239  TDSRESULTINFO *res_info;
1240  TDS_UINT num_comp_info;
1241  TDSCOMPUTEINFO **comp_info;
1242  TDSPARAMINFO *param_info;
1244  bool bulk_query;
1245  bool has_status;
1246  bool in_row;
1247  volatile
1248  unsigned char in_cancel;
1250  TDS_INT ret_status;
1251  TDS_STATE state;
1252 
1253  TDS_INT query_timeout;
1254  TDS_INT8 rows_affected;
1260  void (*env_chg_func) (TDSSOCKET * tds, int type, char *oldval, char *newval);
1261  TDS_OPERATION current_op;
1262 
1263  int option_value;
1264  tds_mutex wire_mtx;
1265 };
1266 
1267 #define tds_get_ctx(tds) ((tds)->conn->tds_ctx)
1268 #define tds_set_ctx(tds, val) do { ((tds)->conn->tds_ctx) = (val); } while(0)
1269 #define tds_get_parent(tds) ((tds)->parent)
1270 #define tds_set_parent(tds, val) do { ((tds)->parent) = (val); } while(0)
1271 #define tds_get_s(tds) ((tds)->conn->s)
1272 #define tds_set_s(tds, val) do { ((tds)->conn->s) = (val); } while(0)
1273 
1274 
1275 /* config.c */
1277 typedef void (*TDSCONFPARSE) (const char *option, const char *value, void *param);
1278 bool tds_read_conf_section(FILE * in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param);
1279 bool tds_read_conf_file(TDSLOGIN * login, const char *server);
1280 void tds_parse_conf_section(const char *option, const char *value, void *param);
1281 TDSLOGIN *tds_read_config_info(TDSSOCKET * tds, TDSLOGIN * login, TDSLOCALE * locale);
1282 void tds_fix_login(TDSLOGIN* login);
1283 TDS_USMALLINT * tds_config_verstr(const char *tdsver, TDSLOGIN* login);
1284 struct addrinfo *tds_lookup_host(const char *servername);
1285 TDSRET tds_lookup_host_set(const char *servername, struct addrinfo **addr);
1286 const char *tds_addrinfo2str(struct addrinfo *addr, char *name, int namemax);
1287 char *tds_get_home_file(const char *file);
1288 
1289 TDSRET tds_set_interfaces_file_loc(const char *interfloc);
1290 extern const char STD_DATETIME_FMT[];
1291 int tds_parse_boolean(const char *value, int default_value);
1292 int tds_config_boolean(const char *option, const char *value, TDSLOGIN * login);
1293 
1294 TDSLOCALE *tds_get_locale(void);
1295 TDSRET tds_alloc_row(TDSRESULTINFO * res_info);
1296 TDSRET tds_alloc_compute_row(TDSCOMPUTEINFO * res_info);
1297 BCPCOLDATA * tds_alloc_bcp_column_data(unsigned int column_size);
1298 TDSDYNAMIC *tds_lookup_dynamic(TDSCONNECTION * conn, const char *id);
1299 /*@observer@*/ const char *tds_prtype(int token);
1300 int tds_get_varint_size(TDSCONNECTION * conn, int datatype);
1301 TDS_SERVER_TYPE tds_get_cardinal_type(TDS_SERVER_TYPE datatype, int usertype);
1302 
1303 
1304 /* iconv.c */
1305 TDSRET tds_iconv_open(TDSCONNECTION * conn, const char *charset, int use_utf16);
1306 void tds_iconv_close(TDSCONNECTION * conn);
1307 void tds_srv_charset_changed(TDSCONNECTION * conn, const char *charset);
1308 void tds7_srv_charset_changed(TDSCONNECTION * conn, TDS_UCHAR collate[5]);
1309 int tds_iconv_alloc(TDSCONNECTION * conn);
1310 void tds_iconv_free(TDSCONNECTION * conn);
1311 TDSICONV *tds_iconv_from_collate(TDSCONNECTION * conn, TDS_UCHAR collate[5]);
1312 
1313 
1314 /* mem.c */
1315 void tds_free_socket(TDSSOCKET * tds);
1316 void tds_free_all_results(TDSSOCKET * tds);
1317 void tds_free_results(TDSRESULTINFO * res_info);
1318 void tds_free_param_results(TDSPARAMINFO * param_info);
1319 void tds_free_param_result(TDSPARAMINFO * param_info);
1320 void tds_free_msg(TDSMESSAGE * message);
1321 void tds_cursor_deallocated(TDSCONNECTION *conn, TDSCURSOR *cursor);
1322 void tds_release_cursor(TDSCURSOR **pcursor);
1323 void tds_free_bcp_column_data(BCPCOLDATA * coldata);
1324 TDSRESULTINFO *tds_alloc_results(TDS_USMALLINT num_cols);
1325 TDSCOMPUTEINFO **tds_alloc_compute_results(TDSSOCKET * tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols);
1326 TDSCONTEXT *tds_alloc_context(void * parent);
1327 void tds_free_context(TDSCONTEXT * locale);
1329 void tds_free_input_params(TDSDYNAMIC * dyn);
1330 void tds_release_dynamic(TDSDYNAMIC ** dyn);
1331 static inline
1332 void tds_release_cur_dyn(TDSSOCKET * tds)
1333 {
1335 }
1336 void tds_dynamic_deallocated(TDSCONNECTION *conn, TDSDYNAMIC *dyn);
1337 void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn);
1338 TDSSOCKET *tds_realloc_socket(TDSSOCKET * tds, size_t bufsize);
1339 char *tds_alloc_client_sqlstate(int msgno);
1340 char *tds_alloc_lookup_sqlstate(TDSSOCKET * tds, int msgno);
1341 TDSLOGIN *tds_alloc_login(int use_environment);
1342 TDSDYNAMIC *tds_alloc_dynamic(TDSCONNECTION * conn, const char *id);
1343 void tds_free_login(TDSLOGIN * login);
1344 TDSLOGIN *tds_init_login(TDSLOGIN * login, TDSLOCALE * locale);
1345 TDSLOCALE *tds_alloc_locale(void);
1346 void *tds_alloc_param_data(TDSCOLUMN * curparam);
1347 void tds_free_locale(TDSLOCALE * locale);
1348 TDSCURSOR * tds_alloc_cursor(TDSSOCKET * tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen);
1349 void tds_free_row(TDSRESULTINFO * res_info, unsigned char *row);
1350 TDSSOCKET *tds_alloc_socket(TDSCONTEXT * context, unsigned int bufsize);
1351 TDSSOCKET *tds_alloc_additional_socket(TDSCONNECTION *conn);
1352 void tds_set_current_results(TDSSOCKET *tds, TDSRESULTINFO *info);
1353 void tds_detach_results(TDSRESULTINFO *info);
1354 void * tds_realloc(void **pp, size_t new_size);
1355 #define TDS_RESIZE(p, n_elem) \
1356  tds_realloc((void **) &(p), sizeof(*(p)) * (size_t) (n_elem))
1357 #define tds_new(type, n) ((type *) malloc(sizeof(type) * (n)))
1358 #define tds_new0(type, n) ((type *) calloc(n, sizeof(type)))
1359 
1360 TDSPACKET *tds_alloc_packet(void *buf, unsigned len);
1361 TDSPACKET *tds_realloc_packet(TDSPACKET *packet, unsigned len);
1362 void tds_free_packets(TDSPACKET *packet);
1363 TDSBCPINFO *tds_alloc_bcpinfo(void);
1364 void tds_free_bcpinfo(TDSBCPINFO *bcpinfo);
1365 void tds_deinit_bcpinfo(TDSBCPINFO *bcpinfo);
1366 
1367 
1368 /* login.c */
1369 void tds_set_packet(TDSLOGIN * tds_login, int packet_size);
1370 void tds_set_port(TDSLOGIN * tds_login, int port);
1371 bool tds_set_passwd(TDSLOGIN * tds_login, const char *password) TDS_WUR;
1372 void tds_set_bulk(TDSLOGIN * tds_login, bool enabled);
1373 bool tds_set_user(TDSLOGIN * tds_login, const char *username) TDS_WUR;
1374 bool tds_set_app(TDSLOGIN * tds_login, const char *application) TDS_WUR;
1375 bool tds_set_host(TDSLOGIN * tds_login, const char *hostname) TDS_WUR;
1376 bool tds_set_library(TDSLOGIN * tds_login, const char *library) TDS_WUR;
1377 bool tds_set_server(TDSLOGIN * tds_login, const char *server) TDS_WUR;
1378 bool tds_set_client_charset(TDSLOGIN * tds_login, const char *charset) TDS_WUR;
1379 bool tds_set_language(TDSLOGIN * tds_login, const char *language) TDS_WUR;
1380 void tds_set_version(TDSLOGIN * tds_login, TDS_TINYINT major_ver, TDS_TINYINT minor_ver);
1381 int tds_connect_and_login(TDSSOCKET * tds, TDSLOGIN * login);
1382 
1383 
1384 /* query.c */
1385 void tds_start_query(TDSSOCKET *tds, unsigned char packet_type);
1386 
1387 TDSRET tds_submit_query(TDSSOCKET * tds, const char *query);
1388 TDSRET tds_submit_query_params(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params, TDSHEADERS * head);
1389 TDSRET tds_submit_queryf(TDSSOCKET * tds, const char *queryf, ...);
1390 TDSRET tds_submit_prepare(TDSSOCKET * tds, const char *query, const char *id, TDSDYNAMIC ** dyn_out, TDSPARAMINFO * params);
1391 TDSRET tds_submit_execdirect(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params, TDSHEADERS * head);
1392 TDSRET tds71_submit_prepexec(TDSSOCKET * tds, const char *query, const char *id, TDSDYNAMIC ** dyn_out, TDSPARAMINFO * params);
1393 TDSRET tds_submit_execute(TDSSOCKET * tds, TDSDYNAMIC * dyn);
1394 TDSRET tds_send_cancel(TDSSOCKET * tds);
1395 const char *tds_next_placeholder(const char *start);
1396 int tds_count_placeholders(const char *query);
1397 int tds_needs_unprepare(TDSCONNECTION * conn, TDSDYNAMIC * dyn);
1398 TDSRET tds_deferred_unprepare(TDSCONNECTION * conn, TDSDYNAMIC * dyn);
1399 TDSRET tds_submit_unprepare(TDSSOCKET * tds, TDSDYNAMIC * dyn);
1400 TDSRET tds_submit_rpc(TDSSOCKET * tds, const char *rpc_name, TDSPARAMINFO * params, TDSHEADERS * head);
1401 TDSRET tds_submit_optioncmd(TDSSOCKET * tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size);
1402 TDSRET tds_submit_begin_tran(TDSSOCKET *tds);
1403 TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont);
1404 TDSRET tds_submit_commit(TDSSOCKET *tds, int cont);
1405 TDSRET tds_disconnect(TDSSOCKET * tds);
1406 size_t tds_quote_id(TDSSOCKET * tds, char *buffer, const char *id, int idlen);
1407 size_t tds_quote_id_rpc(TDSSOCKET * tds, char *buffer, const char *id, int idlen);
1408 size_t tds_quote_string(TDSSOCKET * tds, char *buffer, const char *str, int len);
1409 const char *tds_skip_comment(const char *s);
1410 const char *tds_skip_quoted(const char *s);
1411 size_t tds_fix_column_size(TDSSOCKET * tds, TDSCOLUMN * curcol);
1412 const char *tds_convert_string(TDSSOCKET * tds, TDSICONV * char_conv, const char *s, int len, size_t *out_len);
1413 void tds_convert_string_free(const char *original, const char *converted);
1414 #if !ENABLE_EXTRA_CHECKS
1415 #define tds_convert_string_free(original, converted) \
1416  do { if (original != converted) free((char*) converted); } while(0)
1417 #endif
1418 TDSRET tds_get_column_declaration(TDSSOCKET * tds, TDSCOLUMN * curcol, char *out);
1419 
1420 TDSRET tds_cursor_declare(TDSSOCKET * tds, TDSCURSOR * cursor, TDSPARAMINFO *params, int *send);
1421 TDSRET tds_cursor_setrows(TDSSOCKET * tds, TDSCURSOR * cursor, int *send);
1422 TDSRET tds_cursor_open(TDSSOCKET * tds, TDSCURSOR * cursor, TDSPARAMINFO *params, int *send);
1423 TDSRET tds_cursor_fetch(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row);
1424 TDSRET tds_cursor_get_cursor_info(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_UINT * row_number, TDS_UINT * row_count);
1425 TDSRET tds_cursor_close(TDSSOCKET * tds, TDSCURSOR * cursor);
1426 TDSRET tds_cursor_dealloc(TDSSOCKET * tds, TDSCURSOR * cursor);
1427 TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR * cursor);
1428 TDSRET tds_cursor_update(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO * params);
1429 TDSRET tds_cursor_setname(TDSSOCKET * tds, TDSCURSOR * cursor);
1430 
1431 TDSRET tds_multiple_init(TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS * head);
1432 TDSRET tds_multiple_done(TDSSOCKET *tds, TDSMULTIPLE *multiple);
1433 TDSRET tds_multiple_query(TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO * params);
1434 TDSRET tds_multiple_execute(TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC * dyn);
1435 
1436 
1437 /* token.c */
1438 TDSRET tds_process_cancel(TDSSOCKET * tds);
1439 int tds_get_token_size(int marker);
1440 TDSRET tds_process_login_tokens(TDSSOCKET * tds);
1441 TDSRET tds_process_simple_query(TDSSOCKET * tds);
1442 int tds5_send_optioncmd(TDSSOCKET * tds, TDS_OPTION_CMD tds_command, TDS_OPTION tds_option, TDS_OPTION_ARG * tds_argument,
1443  TDS_INT * tds_argsize);
1444 TDSRET tds_process_tokens(TDSSOCKET * tds, /*@out@*/ TDS_INT * result_type, /*@out@*/ int *done_flags, unsigned flag);
1445 
1446 
1447 /* data.c */
1448 void tds_set_param_type(TDSCONNECTION * conn, TDSCOLUMN * curcol, TDS_SERVER_TYPE type);
1449 void tds_set_column_type(TDSCONNECTION * conn, TDSCOLUMN * curcol, TDS_SERVER_TYPE type);
1450 #ifdef WORDS_BIGENDIAN
1451 void tds_swap_datatype(int coltype, void *b);
1452 #endif
1453 
1454 
1455 /* tds_convert.c */
1456 TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC * dr);
1457 TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize);
1458 extern const char tds_hex_digits[];
1459 
1460 
1461 /* write.c */
1462 int tds_init_write_buf(TDSSOCKET * tds);
1463 int tds_put_n(TDSSOCKET * tds, const void *buf, size_t n);
1464 int tds_put_string(TDSSOCKET * tds, const char *buf, int len);
1465 int tds_put_int(TDSSOCKET * tds, TDS_INT i);
1466 int tds_put_int8(TDSSOCKET * tds, TDS_INT8 i);
1467 int tds_put_smallint(TDSSOCKET * tds, TDS_SMALLINT si);
1469 #define tds_put_tinyint(tds, ti) tds_put_byte(tds,ti)
1470 int tds_put_byte(TDSSOCKET * tds, unsigned char c);
1471 TDSRET tds_flush_packet(TDSSOCKET * tds);
1472 int tds_put_buf(TDSSOCKET * tds, const unsigned char *buf, int dsize, int ssize);
1473 
1474 
1475 /* read.c */
1476 unsigned char tds_get_byte(TDSSOCKET * tds);
1477 void tds_unget_byte(TDSSOCKET * tds);
1478 unsigned char tds_peek(TDSSOCKET * tds);
1479 TDS_USMALLINT tds_get_usmallint(TDSSOCKET * tds);
1480 #define tds_get_smallint(tds) ((TDS_SMALLINT) tds_get_usmallint(tds))
1481 TDS_UINT tds_get_uint(TDSSOCKET * tds);
1482 #define tds_get_int(tds) ((TDS_INT) tds_get_uint(tds))
1483 TDS_UINT8 tds_get_uint8(TDSSOCKET * tds);
1484 #define tds_get_int8(tds) ((TDS_INT8) tds_get_uint8(tds))
1485 size_t tds_get_string(TDSSOCKET * tds, size_t string_len, char *dest, size_t dest_size);
1486 TDSRET tds_get_char_data(TDSSOCKET * tds, char *dest, size_t wire_size, TDSCOLUMN * curcol);
1487 bool tds_get_n(TDSSOCKET * tds, /*@out@*/ /*@null@*/ void *dest, size_t n);
1488 int tds_get_size_by_type(TDS_SERVER_TYPE servertype);
1489 DSTR* tds_dstr_get(TDSSOCKET * tds, DSTR * s, size_t len);
1490 
1491 
1492 /* util.c */
1493 int tdserror (const TDSCONTEXT * tds_ctx, TDSSOCKET * tds, int msgno, int errnum);
1495 void tds_swap_bytes(void *buf, int bytes);
1496 unsigned int tds_gettime_ms(void);
1497 char *tds_strndup(const void *s, TDS_INTPTR len);
1498 
1499 
1500 /* log.c */
1501 typedef struct tdsdump_off_item {
1502  struct tdsdump_off_item *next;
1503  tds_thread_id thread_id;
1505 void tdsdump_off(TDSDUMP_OFF_ITEM *off_item);
1506 void tdsdump_on(TDSDUMP_OFF_ITEM *off_item);
1507 int tdsdump_isopen(void);
1508 #include <freetds/popvis.h>
1509 int tdsdump_open(const char *filename);
1510 #include <freetds/pushvis.h>
1511 void tdsdump_close(void);
1512 void tdsdump_dump_buf(const char* file, unsigned int level_line, const char *msg, const void *buf, size_t length);
1513 void tdsdump_col(const TDSCOLUMN *col);
1514 #undef tdsdump_log
1515 void tdsdump_log(const char* file, unsigned int level_line, const char *fmt, ...)
1516 #if defined(__GNUC__) && __GNUC__ >= 2
1517 #if defined(__MINGW32__)
1518  __attribute__ ((__format__ (ms_printf, 3, 4)))
1519 #else
1520  __attribute__ ((__format__ (__printf__, 3, 4)))
1521 #endif
1522 #endif
1523 ;
1524 #define TDSDUMP_LOG_FAST if (TDS_UNLIKELY(tds_write_dump)) tdsdump_log
1525 #define tdsdump_log TDSDUMP_LOG_FAST
1526 #define TDSDUMP_BUF_FAST if (TDS_UNLIKELY(tds_write_dump)) tdsdump_dump_buf
1527 #define tdsdump_dump_buf TDSDUMP_BUF_FAST
1528 
1529 extern int tds_write_dump;
1530 extern int tds_debug_flags;
1531 extern int tds_g_append_mode;
1532 
1533 
1534 /* net.c */
1535 TDSERRNO tds_open_socket(TDSSOCKET * tds, struct addrinfo *ipaddr, unsigned int port, int timeout, int *p_oserr);
1536 void tds_close_socket(TDSSOCKET * tds);
1537 int tds7_get_instance_ports(FILE *output, struct addrinfo *addr);
1538 int tds7_get_instance_port(struct addrinfo *addr, const char *instance);
1539 char *tds_prwsaerror(int erc);
1540 void tds_prwsaerror_free(char *s);
1541 int tds_connection_read(TDSSOCKET * tds, unsigned char *buf, int buflen);
1542 int tds_connection_write(TDSSOCKET *tds, const unsigned char *buf, int buflen, int final);
1543 #define TDSSELREAD POLLIN
1544 #define TDSSELWRITE POLLOUT
1545 int tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds);
1546 void tds_connection_close(TDSCONNECTION *conn);
1547 int tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen);
1548 int tds_goodwrite(TDSSOCKET * tds, const unsigned char *buffer, size_t buflen);
1549 void tds_socket_flush(TDS_SYS_SOCKET sock);
1550 int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock);
1551 int tds_wakeup_init(TDSPOLLWAKEUP *wakeup);
1552 void tds_wakeup_close(TDSPOLLWAKEUP *wakeup);
1553 void tds_wakeup_send(TDSPOLLWAKEUP *wakeup, char cancel);
1554 static inline TDS_SYS_SOCKET tds_wakeup_get_fd(const TDSPOLLWAKEUP *wakeup)
1555 {
1556  return wakeup->s_signaled;
1557 }
1558 
1559 
1560 /* packet.c */
1561 int tds_read_packet(TDSSOCKET * tds);
1562 TDSRET tds_write_packet(TDSSOCKET * tds, unsigned char final);
1563 #if ENABLE_ODBC_MARS
1564 int tds_append_cancel(TDSSOCKET *tds);
1565 TDSRET tds_append_syn(TDSSOCKET *tds);
1566 TDSRET tds_append_fin(TDSSOCKET *tds);
1567 #else
1568 int tds_put_cancel(TDSSOCKET * tds);
1569 #endif
1570 
1571 typedef struct tds_freeze {
1577  unsigned pkt_pos;
1579  unsigned size_len;
1580 } TDSFREEZE;
1581 
1582 void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len);
1583 size_t tds_freeze_written(TDSFREEZE *freeze);
1584 TDSRET tds_freeze_abort(TDSFREEZE *freeze);
1585 TDSRET tds_freeze_close(TDSFREEZE *freeze);
1586 TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size);
1587 
1588 static void inline
1589 tds_set_current_send_packet(TDSSOCKET *tds, TDSPACKET *pkt)
1590 {
1591  tds->send_packet = pkt;
1592  tds->out_buf = pkt->buf + tds_packet_get_data_start(pkt);
1593 }
1594 
1595 /* Macros to allow some indentation of the packets.
1596  *
1597  * The 3 nested fake loops require some explanation:
1598  * - first is to allows to declare variables;
1599  * - second is to force using brackets;
1600  * - third is to avoids that a break inside will skip the close.
1601  */
1602 #define TDS_START_LEN_GENERIC(tds_socket, len) do { \
1603  TDSFREEZE current_freeze[1]; \
1604  tds_freeze((tds_socket), current_freeze, (len)); do { do
1605 #define TDS_END_LEN while(0); } while(tds_freeze_close(current_freeze), 0); } while(0);
1606 
1607 #define TDS_START_LEN_TINYINT(tds_socket) TDS_START_LEN_GENERIC(tds_socket, 1)
1608 #define TDS_START_LEN_USMALLINT(tds_socket) TDS_START_LEN_GENERIC(tds_socket, 2)
1609 #define TDS_START_LEN_UINT(tds_socket) TDS_START_LEN_GENERIC(tds_socket, 4)
1610 
1611 /* vstrbuild.c */
1612 TDSRET tds_vstrbuild(char *buffer, int buflen, int *resultlen, const char *text, int textlen, const char *formats, int formatlen,
1613  va_list ap);
1614 
1615 
1616 /* numeric.c */
1617 char *tds_money_to_string(const TDS_MONEY * money, char *s, bool use_2_digits);
1618 TDS_INT tds_numeric_to_string(const TDS_NUMERIC * numeric, char *s);
1619 TDS_INT tds_numeric_change_prec_scale(TDS_NUMERIC * numeric, unsigned char new_prec, unsigned char new_scale);
1620 
1621 
1622 /* getmac.c */
1623 void tds_getmac(TDS_SYS_SOCKET s, unsigned char mac[6]);
1624 
1625 
1626 /* challenge.c */
1627 #ifndef HAVE_SSPI
1629 TDSAUTHENTICATION * tds_gss_get_auth(TDSSOCKET * tds);
1630 #else
1631 TDSAUTHENTICATION * tds_sspi_get_auth(TDSSOCKET * tds);
1632 #endif
1633 TDSRET tds5_gss_send(TDSSOCKET *tds);
1634 
1635 
1636 /* random.c */
1637 void tds_random_buffer(unsigned char *out, int len);
1638 
1639 
1640 /* sec_negotiate.c */
1641 TDSAUTHENTICATION * tds5_negotiate_get_auth(TDSSOCKET * tds);
1642 static inline
1643 void tds5_negotiate_set_msg_type(TDSAUTHENTICATION * tds_auth, unsigned msg_type)
1644 {
1645  if (tds_auth)
1646  tds_auth->msg_type = msg_type;
1647 }
1648 
1649 
1650 /* bulk.c */
1651 
1654 {
1655  TDS_BCP_IN = 1,
1656  TDS_BCP_OUT = 2,
1657  TDS_BCP_QUERYOUT = 3
1658 };
1659 
1661 {
1662  const char *hint;
1663  void *parent;
1664  DSTR tablename;
1665  TDS_CHAR *insert_stmt;
1666  TDS_INT direction;
1667  TDS_INT identity_insert_on;
1668  TDS_INT xfer_init;
1669  TDS_INT bind_count;
1670  TDSRESULTINFO *bindinfo;
1671 };
1672 
1673 TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo);
1674 typedef TDSRET (*tds_bcp_get_col_data) (TDSBCPINFO *bulk, TDSCOLUMN *bcpcol, int offset);
1675 typedef void (*tds_bcp_null_error) (TDSBCPINFO *bulk, int index, int offset);
1676 TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset);
1677 TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied);
1678 TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo);
1679 TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo);
1680 
1681 TDSRET tds_bcp_fread(TDSSOCKET * tds, TDSICONV * conv, FILE * stream,
1682  const char *terminator, size_t term_len, char **outbuf, size_t * outbytes);
1683 
1684 TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size);
1685 TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size);
1686 TDSRET tds_writetext_end(TDSSOCKET *tds);
1687 
1688 
1689 static inline
1690 bool tds_capability_enabled(const TDS_CAPABILITY_TYPE *cap, unsigned cap_num)
1691 {
1692  return (cap->values[sizeof(cap->values)-1-(cap_num>>3)] >> (cap_num&7)) & 1;
1693 }
1694 #define tds_capability_has_req(conn, cap) \
1695  tds_capability_enabled(&conn->capabilities.types[0], cap)
1696 #define tds_capability_has_res(conn, cap) \
1697  tds_capability_enabled(&conn->capabilities.types[1], cap)
1698 
1699 #define IS_TDS42(x) (x->tds_version==0x402)
1700 #define IS_TDS46(x) (x->tds_version==0x406)
1701 #define IS_TDS50(x) (x->tds_version==0x500)
1702 #define IS_TDS70(x) (x->tds_version==0x700)
1703 #define IS_TDS71(x) (x->tds_version==0x701)
1704 #define IS_TDS72(x) (x->tds_version==0x702)
1705 #define IS_TDS73(x) (x->tds_version==0x703)
1706 
1707 #define IS_TDS50_PLUS(x) ((x)->tds_version>=0x500)
1708 #define IS_TDS7_PLUS(x) ((x)->tds_version>=0x700)
1709 #define IS_TDS71_PLUS(x) ((x)->tds_version>=0x701)
1710 #define IS_TDS72_PLUS(x) ((x)->tds_version>=0x702)
1711 #define IS_TDS73_PLUS(x) ((x)->tds_version>=0x703)
1712 #define IS_TDS74_PLUS(x) ((x)->tds_version>=0x704)
1713 
1714 #define TDS_MAJOR(x) ((x)->tds_version >> 8)
1715 #define TDS_MINOR(x) ((x)->tds_version & 0xff)
1716 
1717 #define IS_TDSDEAD(x) (((x) == NULL) || (x)->state == TDS_DEAD)
1718 
1720 #define TDS_IS_SYBASE(x) (!((x)->conn->product_version & 0x80000000u))
1721 
1722 #define TDS_IS_MSSQL(x) (((x)->conn->product_version & 0x80000000u)!=0)
1723 
1727 #define TDS_MS_VER(maj,min,x) (0x80000000u|((maj)<<24)|((min)<<16)|(x))
1728 
1729 /* TODO test if not similar to ms one*/
1731 #define TDS_SYB_VER(maj,min,x) (((maj)<<24)|((min)<<16)|(x)<<8)
1732 
1733 #ifdef __cplusplus
1734 #if 0
1735 {
1736 #endif
1737 }
1738 #endif
1739 
1740 #include <freetds/popvis.h>
1741 
1742 #define TDS_PUT_INT(tds,v) tds_put_int((tds), ((TDS_INT)(v)))
1743 #define TDS_PUT_SMALLINT(tds,v) tds_put_smallint((tds), ((TDS_SMALLINT)(v)))
1744 #define TDS_PUT_BYTE(tds,v) tds_put_byte((tds), ((unsigned char)(v)))
1745 
1746 #endif /* _tds_h_ */
size_t tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len)
Quote a string.
Definition: query.c:2241
Definition: tds.h:643
TDSLOCALE * tds_get_locale(void)
Get locale information.
Definition: locale.c:50
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
void tdsdump_off(TDSDUMP_OFF_ITEM *off_item)
Temporarily turn off logging for current thread.
Definition: log.c:81
const int tds_numeric_bytes_per_prec[]
The following little table is indexed by precision and will tell us the number of bytes required to s...
Definition: numeric.c:41
bool bulk_query
true is query sent was a bulk query so we need to switch state to QUERYING
Definition: tds.h:1244
void tds_start_query(TDSSOCKET *tds, unsigned char packet_type)
Start query packet of a given type.
Definition: query.c:332
TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start sending BCP data to server.
Definition: bulk.c:866
tds_func_put_data * put_data
Send column data to server.
Definition: tds.h:662
TDSPACKET * pkt
first packet frozen
Definition: tds.h:1575
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
TDS_INT quarter
quarter (0-3)
Definition: tds.h:161
TDSPACKET * frozen_packets
list of packets frozen, points to first one.
Definition: tds.h:1203
char * charset
character set encoding
Definition: tds.h:968
Definition: tds.h:1057
Used by tds_datecrack.
Definition: tds.h:159
bool defer_close
true if dynamic was marker to be closed when connection is idle
Definition: tds.h:997
TDS_INT cursor_rows
< number of updatable columns
Definition: tds.h:951
TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor)
Deallocate cursor on idle.
Definition: query.c:3057
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied)
Tell we finished sending BCP data to server.
Definition: bulk.c:836
@ TDS_READING
client is reading data
Definition: tds.h:794
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:953
TDSRET tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Sends a language string to the database server for processing.
Definition: query.c:350
TDSCURSOR * cursors
linked list of cursors allocated for this connection contains only cursors allocated on the server
Definition: tds.h:1107
bool has_status
true is ret_status is valid
Definition: tds.h:1245
Definition: proto.h:39
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:256
DSTR password
password of account login
Definition: tds.h:535
TDS_INT decimicrosecond
0-9999999
Definition: tds.h:169
Definition: tds.h:582
const char * tds_prtype(int token)
Returns string representation of the given type.
Definition: token.c:3056
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
TDS_INT date
date, 0 = 1900-01-01
Definition: tds.h:148
size_t tds_freeze_written(TDSFREEZE *freeze)
Compute how many bytes has been written from freeze.
Definition: packet.c:935
TDSICONV * tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5])
Get iconv information from a LCID (to support different column encoding under MSSQL2K)
Definition: iconv.c:1245
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
TDS_INT day
day of month (1-31)
Definition: tds.h:163
bool tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param)
Read a section of configuration file (INI style file)
Definition: config.c:503
Current environment as reported by the server.
Definition: tds.h:963
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1258
int tds7_get_instance_ports(FILE *output, struct addrinfo *addr)
Get port of all instances.
Definition: net.c:1093
struct addrinfo * tds_lookup_host(const char *servername)
Get the IP address for a hostname.
Definition: config.c:987
void tds_unget_byte(TDSSOCKET *tds)
Unget will always work as long as you don't call it twice in a row.
Definition: read.c:89
unsigned char canonic
internal numeric index into array of all encodings
Definition: tds.h:624
Holds informations about a cursor.
Definition: tds.h:937
unsigned char * out_buf
Output buffer.
Definition: tds.h:1185
int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock)
Set socket to non-blocking.
Definition: net.c:168
TDSLOGIN * tds_init_login(TDSLOGIN *login, TDSLOCALE *locale)
Initialize login structure with locale information and other stuff for connection.
Definition: mem.c:800
TDSRET tds_freeze_abort(TDSFREEZE *freeze)
Discard all data written after the freeze.
Definition: packet.c:961
TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize)
Return type suitable for conversions (convert all nullable types to fixed type)
Definition: tds_types.h:125
enum tds_states TDS_STATE
values for tds->state
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Set current dynamic.
Definition: query.c:192
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1093
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:941
TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION *conn, const char *id)
Allocate a dynamic statement.
Definition: mem.c:160
void tds_fix_login(TDSLOGIN *login)
Fix configuration after reading it.
Definition: config.c:285
TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size)
Stop keeping data for this specific freeze.
Definition: packet.c:1031
struct tds_blob TDSBLOB
Information about blobs (e.g.
TDS_INT weekday
day of week (0-6, 0 = sunday)
Definition: tds.h:165
TDSRET tds_bcp_fread(TDSSOCKET *tds, TDSICONV *conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes)
Read a data file, passing the data through iconv().
Definition: bulk.c:1077
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
TDSPACKET * send_packet
packet we are preparing to send
Definition: tds.h:1231
struct tds_env TDSENV
Current environment as reported by the server.
@ TDS_DONE_SRVERROR
SQL server server error.
Definition: tds.h:259
void tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:224
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1243
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
const char * tds_skip_quoted(const char *s)
Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])
Definition: query.c:515
@ TDS_DONE_PROC
results are from a stored procedure
Definition: tds.h:255
TDS_USMALLINT * tds_config_verstr(const char *tdsver, TDSLOGIN *login)
Set TDS version from given string.
Definition: config.c:923
TDSDYNAMIC * dyns
list of dynamic allocated for this connection contains only dynamic allocated on the server
Definition: tds.h:1112
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
TDSLOGIN * tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
tds_read_config_info() will fill the tds connection structure based on configuration information gath...
Definition: config.c:138
int tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen)
Loops until we have received some characters return -1 on failure.
Definition: net.c:916
TDSRET tds_set_interfaces_file_loc(const char *interfloc)
Set the full name of interface file.
Definition: config.c:961
unsigned data_len
data length, this does not account SMP header, only TDS part
Definition: tds.h:1071
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
bool in_row
true if we are getting rows
Definition: tds.h:1246
unsigned size_len
length size (0, 1, 2 or 4)
Definition: tds.h:1579
DSTR server_realm_name
server realm name (in freetds.conf)
Definition: tds.h:527
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:993
TDSRET tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2554
Definition: tds.h:906
bool tds_set_server(TDSLOGIN *tds_login, const char *server) TDS_WUR
Set the servername in a TDSLOGIN structure.
Definition: login.c:129
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:881
int tds_get_token_size(int marker)
tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determi...
Definition: token.c:2754
@ TDS_DONE_INXACT
transaction in progress
Definition: tds.h:254
tds_func_put_info * put_info
Send metadata column information to server.
Definition: tds.h:652
TDSRET tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...)
Format and submit a query.
Definition: query.c:467
int tds_get_varint_size(TDSCONNECTION *conn, int datatype)
tds_get_varint_size() returns the size of a variable length integer returned in a result string
Definition: tds_types.h:57
TDSPARAMINFO * params
query parameters.
Definition: tds.h:1007
TDSRET tds_submit_begin_tran(TDSSOCKET *tds)
Send a rollback request.
Definition: query.c:3665
unsigned char tds_peek(TDSSOCKET *tds)
Reads a byte from the TDS stream without removing it.
Definition: read.c:100
Store variant informations.
Definition: tds.h:604
TDS_INT type
row fetched from this cursor
Definition: tds.h:956
TDS_INT dayofyear
day of year (1-366)
Definition: tds.h:164
TDSDYNAMIC * tds_lookup_dynamic(TDSCONNECTION *conn, const char *id)
Finds a dynamic given string id.
Definition: token.c:2587
size_t tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id for a RPC call.
Definition: query.c:2216
Definition: tds.h:876
DSTR db_filename
database filename to attach (MSSQL)
Definition: tds.h:529
TDSRET tds_send_cancel(TDSSOCKET *tds)
tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire...
Definition: query.c:2026
char * query
SQL query.
Definition: tds.h:947
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
struct tds_cursor * next
next in linked list, keep first
Definition: tds.h:938
TDS_UINT8 tds_get_uint8(TDSSOCKET *tds)
Get an uint64 from the server.
Definition: read.c:140
TDSRET tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server and execute it.
Definition: query.c:1401
TDS_TINYINT options
read only|updatable TODO use it
Definition: tds.h:942
const char * name
name of the encoding (ie UTF-8)
Definition: tds.h:620
Definition: tds.h:1091
Definition: tds.h:495
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:939
TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size)
Send some data in the writetext request started by tds_writetext_start.
Definition: bulk.c:1185
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
TDSRET tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
Send option commands to server.
Definition: query.c:3389
DSTR * tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len)
Reads a string from wire and put in a DSTR.
Definition: read.c:293
const char * tds_skip_comment(const char *s)
Skip a comment in a query.
Definition: query.c:490
TDS_SYS_SOCKET s
tcp socket, INVALID_SOCKET if not connected
Definition: tds.h:1096
const char * tds_next_placeholder(const char *start)
Get position of next placeholder.
Definition: query.c:535
unsigned char out_flag
output buffer type
Definition: tds.h:1196
tds_states
values for tds->state
Definition: tds.h:789
int tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
Definition: net.c:987
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:978
Definition: tds.h:628
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1248
size_t tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
Fetch a string from the wire.
Definition: read.c:166
bool tds_read_conf_file(TDSLOGIN *login, const char *server)
Read configuration info for given server return 0 on error.
Definition: config.c:346
TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr)
Convert from db date format to a structured date format.
Definition: convert.c:3159
bool defer_close
true if cursor was marker to be closed when connection is idle
Definition: tds.h:946
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:979
Definition: thread.h:278
TDSRET tds_submit_query(TDSSOCKET *tds, const char *query)
Sends a language string to the database server for processing.
Definition: query.c:210
@ TDS_SENDING
client would send data
Definition: tds.h:792
Information about blobs (e.g.
Definition: tds.h:593
TDSRET tds_process_login_tokens(TDSSOCKET *tds)
tds_process_login_tokens() is called after sending the login packet to the server.
Definition: token.c:411
struct tds_result_info TDSRESULTINFO
Hold information for any results.
unsigned int bulk_copy
if bulk copy should be enabled
Definition: tds.h:556
DSTR new_password
new password to set (TDS 7.2+)
Definition: tds.h:536
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
Definition: tds.h:1019
struct tds_variant TDSVARIANT
Store variant informations.
Structure to hold a string.
Definition: string.h:36
TDS_USMALLINT tds_version
TDS version.
Definition: tds.h:520
Hold information for any results.
Definition: tds.h:769
TDS_INT hour
0-23
Definition: tds.h:166
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1256
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
struct addrinfo * ip_addrs
ip(s) of server
Definition: tds.h:546
char * cursor_name
name of the cursor
Definition: tds.h:940
const char * tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len)
Convert a string in an allocated buffer.
Definition: query.c:126
TDS_INT month
month number (0-11)
Definition: tds.h:162
@ TDS_WRITING
client is writing data
Definition: tds.h:791
TDS_INT second
0-59
Definition: tds.h:168
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
int tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
Select on a socket until it's available or the timeout expires.
Definition: net.c:612
int tds_get_size_by_type(TDS_SERVER_TYPE servertype)
Return the number of bytes needed by specified type.
Definition: tds_types.h:9
TDSRET tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Sends a previously prepared dynamic statement to the server.
Definition: query.c:1630
void tds_free_input_params(TDSDYNAMIC *dyn)
Frees all allocated input parameters of a dynamic statement.
Definition: mem.c:206
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
unsigned in_len
input buffer length
Definition: tds.h:1194
unsigned out_pos
current position in out_buf
Definition: tds.h:1193
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET *tds)
Build a NTLMSPP packet to send to server.
Definition: challenge.c:721
TDSRET tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
Submit a prepared query with parameters.
Definition: query.c:1256
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1250
TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size)
Start writing writetext request.
Definition: bulk.c:1147
int tds_iconv_alloc(TDSCONNECTION *conn)
Allocate iconv stuff.
Definition: iconv.c:307
TDS_INT timezone
-840 - 840 minutes from UTC
Definition: tds.h:170
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
char * query
saved query, we need to know original query if prepare is impossible
Definition: tds.h:1009
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
int tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Check if dynamic request must be unprepared.
Definition: query.c:1752
TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont)
Send a rollback request.
Definition: query.c:3693
int tdsdump_open(const char *filename)
Create and truncate a human readable dump file for the TDS traffic.
Definition: log.c:131
size_t tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol)
Get column size for wire.
Definition: query.c:1491
TDSRET tds_get_char_data(TDSSOCKET *tds, char *dest, size_t wire_size, TDSCOLUMN *curcol)
Fetch character data the wire.
Definition: read.c:195
TDS_INT year
year
Definition: tds.h:160
Definition: tds.h:1501
Definition: tds.h:511
int tds_put_string(TDSSOCKET *tds, const char *buf, int len)
Output a string to wire automatic translate string to unicode if needed.
Definition: write.c:97
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
int port
port of database service
Definition: tds.h:519
void * tds_realloc(void **pp, size_t new_size)
Reallocate a pointer and update it if success.
Definition: mem.c:1876
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
tds_end
Flags returned in TDS_DONE token.
Definition: tds.h:250
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
TDSPARAMINFO * res_info
query results
Definition: tds.h:999
TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Start bulk copy to server.
Definition: bulk.c:916
DSTR user_name
account for login
Definition: tds.h:534
struct tds_dynamic TDSDYNAMIC
Holds information for a dynamic (also called prepared) query.
@ TDS_DEAD
no connection
Definition: tds.h:795
char * tds_strndup(const void *s, TDS_INTPTR len)
Copy a string of length len to a new allocated buffer This function does not read more than len bytes...
Definition: util.c:406
TDS_SMALLINT offset
time offset
Definition: tds.h:149
void tds_release_dynamic(TDSDYNAMIC **dyn)
Frees dynamic statement.
Definition: mem.c:253
char * database
database name
Definition: tds.h:970
TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo)
Initialize BCP information.
Definition: bulk.c:84
DSTR crlfile
certificate revocation file
Definition: tds.h:531
TDS_UINT8 time
time, 7 digit precision
Definition: tds.h:147
@ TDS_DONE_FINAL
final result set, command completed successfully.
Definition: tds.h:251
TDSSOCKET * tds
which socket we refer to
Definition: tds.h:1573
Definition: tds.h:1047
this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.
Definition: tds.h:146
unsigned int pending_close
true is connection has pending closing (cursors or dynamic)
Definition: tds.h:1123
struct tdsdaterec TDSDATEREC
Used by tds_datecrack.
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t n)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
@ TDS_IDLE
no data expected
Definition: tds.h:790
Definition: tds.h:1661
Definition: tds.h:574
struct tds_encoding TDS_ENCODING
Information relevant to libiconv.
Information for a server connection.
Definition: tds.h:1163
Definition: tds.h:504
int tds_count_placeholders(const char *query)
Count the number of placeholders ('?') in a query.
Definition: query.c:571
TDS_INT bcp_prefix_len
The length, in bytes, of any length prefix this column may have.
Definition: tds.h:761
unsigned char in_flag
input buffer type
Definition: tds.h:1195
DSTR server_spn
server SPN (in freetds.conf)
Definition: tds.h:528
TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset)
Send one row of data to server.
Definition: bulk.c:468
void tdsdump_on(TDSDUMP_OFF_ITEM *off_item)
Turn logging back on for current thread.
Definition: log.c:101
Information relevant to libiconv.
Definition: tds.h:618
TDSRET tds_writetext_end(TDSSOCKET *tds)
Finish sending writetext data.
Definition: bulk.c:1202
TDS_INT minute
0-59
Definition: tds.h:167
int tds7_get_instance_port(struct addrinfo *addr, const char *instance)
Get port of given instance.
Definition: net.c:1229
TDSRET tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
Calls a RPC from server.
Definition: query.c:1929
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1191
@ TDS_DONE_CANCELLED
acknowledging an attention command (usually a cancel)
Definition: tds.h:257
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
TDSRET tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
Return declaration for column (like "varchar(20)").
Definition: query.c:718
unsigned pkt_pos
position in pkt
Definition: tds.h:1577
TDSRET tds_freeze_close(TDSFREEZE *freeze)
Stop keeping data for this specific freeze.
Definition: packet.c:996
Definition: tds.h:892
void tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type)
Set type of column initializing all dependency.
Definition: data.c:246
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:981
DSTR server_charset
charset of server e.g.
Definition: tds.h:523
Definition: tds.h:1085
Definition: tds.h:330
TDSRET tds_submit_commit(TDSSOCKET *tds, int cont)
Send a commit request.
Definition: query.c:3724
tds_bcp_directions
bcp direction
Definition: tds.h:1654
void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
Stop writing to server and cache every packet not sending them to server.
Definition: packet.c:907
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
int block_size
packet size (512-65535)
Definition: tds.h:965
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
Definition: tds.h:1029
struct tds_compiletime_settings TDS_COMPILETIME_SETTINGS
A structure to hold all the compile-time settings.
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
A structure to hold all the compile-time settings.
Definition: tds.h:82
TDS_USMALLINT tds_get_usmallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:113
TDSRET tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn)
Unprepare dynamic on idle.
Definition: query.c:1774
struct tds_cursor TDSCURSOR
Holds informations about a cursor.
Definition: proto.h:26
Definition: tds.h:1571
Definition: tds.h:517
const TDS_COMPILETIME_SETTINGS * tds_get_compiletime_settings(void)
Return a structure capturing the compile-time settings provided to the configure script.
Definition: config.c:1337
DSTR cafile
certificate authorities file
Definition: tds.h:530
@ TDS_DONE_MORE_RESULTS
more results follow
Definition: tds.h:252
void tdsdump_close(void)
Close the TDS dump log file.
Definition: log.c:212
TDSRET tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
Creates a temporary stored procedure in the server.
Definition: query.c:1124
void tds_detach_results(TDSRESULTINFO *info)
Detach result info from it current socket.
Definition: mem.c:488
TDS_INT tds_numeric_to_string(const TDS_NUMERIC *numeric, char *s)
Definition: numeric.c:95
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:320
char * tds_get_home_file(const char *file)
Return filename from HOME directory.
Definition: config.c:325
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
void tdsdump_col(const TDSCOLUMN *col)
Write a column value to the debug log.
Definition: log.c:455
freetds-1.3.6/doc/reference/a00450.dot000644 025423 025423 00000013336 14162303416 020635 0ustar00fredianofrediano000000 000000 digraph "include/freetds/tds.h" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="include/freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Main include file for libtds."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node4 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node7 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node8 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="float.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node11 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node12 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node12 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node15 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node16 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node17 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node17 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node1 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00449_a0383d5dcb629582266a442f0f0dbd13a_icgraph.dot000644 025423 025423 00000001450 14162303416 027040 0ustar00fredianofrediano000000 000000 digraph "tds_get_conversion_type" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_get_conversion_type",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return type suitable for conversions (convert all nullable types to fixed type)"]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="_bcp_convert_out",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01400.html#a230fa5b56ae4e3509a69bd266495732b",tooltip="Convert column for output (usually to a file) Conversion is slightly different from input as:"]; } freetds-1.3.6/doc/reference/a00449_a16db200d2281f76fe46fc1cbe37ca9df_cgraph.dot000644 025423 025423 00000001260 14162303416 027177 0ustar00fredianofrediano000000 000000 digraph "tds_set_state" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set state of TDS connection, with logging and checking."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00449_a16db200d2281f76fe46fc1cbe37ca9df_icgraph.dot000644 025423 025423 00000003630 14162303416 027353 0ustar00fredianofrediano000000 000000 digraph "tds_set_state" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set state of TDS connection, with logging and checking."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_query_flush_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gada27f4cfce925240ad33b71b63ca692d",tooltip="Flush query packet."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds4_send_emulated_rpc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080",tooltip="Send RPC as string query."]; Node1 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_submit_rpc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga5f071b94ad7889690762dc85646c74ab",tooltip="Calls a RPC from server."]; Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_writetext_continue",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab68dead99a2ebec55895a10cd3db5202",tooltip="Send some data in the writetext request started by tds_writetext_start."]; Node1 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="tds_writetext_end",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ac1e460551f1188620ea478238864ac4b",tooltip="Finish sending writetext data."]; } freetds-1.3.6/doc/reference/a00449_a24471508ddfde7cc0f8577801e70c42f_icgraph.dot000644 025423 025423 00000001734 14162303416 027071 0ustar00fredianofrediano000000 000000 digraph "tdsdump_open" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tdsdump_open",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Create and truncate a human readable dump file for the TDS traffic."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdbopen",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00554.html#ga2c99ec565452279e9a382451d89642eb",tooltip="Form a connection with the server."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="dbopen",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00506.html#ae408d8e1c2ab0767d8bfd26d00d1ff6a",tooltip="Normally not used."]; } freetds-1.3.6/doc/reference/a00449_a3ab8874994a0776acdaff797afdb710a_cgraph.dot000644 025423 025423 00000001246 14162303416 027144 0ustar00fredianofrediano000000 000000 digraph "tds_set_server" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_set_server",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set the servername in a TDSLOGIN structure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00449_a5eec23828b0610c58de248c4edb53879_cgraph.dot000644 025423 025423 00000001243 14162303416 026716 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_start_copy_in" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_start_copy_in",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start bulk copy to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00449_a7711612cc544a7da2c7aa212b870acb2_cgraph.dot000644 025423 025423 00000001245 14162303416 026732 0ustar00fredianofrediano000000 000000 digraph "tds_writetext_start" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_writetext_start",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start writing writetext request."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_submit_queryf",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gad695defcbf663b0023851a198206a772",tooltip="Format and submit a query."]; } freetds-1.3.6/doc/reference/a00449_a8184311543c685f2ee0bcccfb725ca02_cgraph.dot000644 025423 025423 00000001323 14162303416 026747 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_fread" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_fread",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Read a data file, passing the data through iconv()."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_file_stream_read",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00239.html#a1b83c9db016b481aa1fa0352f976d50d",tooltip="Reads a chunk of data from file stream checking for terminator."]; } freetds-1.3.6/doc/reference/a00451.dot000644 025423 025423 00000006773 14162303416 020645 0ustar00fredianofrediano000000 000000 digraph "include/freetds/tds.h" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="include/freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Main include file for libtds."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="src/dblib/bcp.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01400.html",tooltip="Implementation of db-lib bulk copy functions."]; Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="src/dblib/dblib.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00080.html",tooltip="Main implementation file for db-lib."]; Node1 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="src/pool/pool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00164_source.html",tooltip=" "]; Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="src/replacements/iconv.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01424.html",tooltip="This file implements a very simple iconv."]; Node1 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="src/tds/bulk.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00239.html",tooltip="Handle bulk copy."]; Node1 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="src/tds/data.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00248.html",tooltip="Handle different data handling from network."]; Node1 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="src/tds/iconv.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01427.html",tooltip="Handle character conversions to/from server."]; Node1 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="src/tds/read.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00281.html",tooltip="Grab data from TDS packets."]; Node1 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="src/tds/stream.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html",tooltip="Handle stream of data."]; Node1 -> Node11 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="src/tds/token.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00308.html",tooltip="Contains all routines to get replies from server."]; Node1 -> Node12 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 [label="include/ctlib.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00368_source.html",tooltip=" "]; Node1 -> Node13 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="include/freetds/odbc.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00419_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00449_a8208eef2a3974ae1f0cf3c8c8ab011ce_cgraph.dot000644 025423 025423 00000001232 14162303416 027171 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_start" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_start",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start sending BCP data to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00449_ab68dead99a2ebec55895a10cd3db5202_cgraph.dot000644 025423 025423 00000002012 14162303416 027173 0ustar00fredianofrediano000000 000000 digraph "tds_writetext_continue" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_writetext_continue",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send some data in the writetext request started by tds_writetext_start."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a16db200d2281f76fe46fc1cbe37ca9df",tooltip="Set state of TDS connection, with logging and checking."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00449_ac1e460551f1188620ea478238864ac4b_cgraph.dot000644 025423 025423 00000001727 14162303416 026472 0ustar00fredianofrediano000000 000000 digraph "tds_writetext_end" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_writetext_end",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Finish sending writetext data."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a16db200d2281f76fe46fc1cbe37ca9df",tooltip="Set state of TDS connection, with logging and checking."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00449_ade7df2db455b61edc83819ad60edb339_cgraph.dot000644 025423 025423 00000001243 14162303416 027212 0ustar00fredianofrediano000000 000000 digraph "tds_bcp_done" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcp_done",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Tell we finished sending BCP data to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00452_source.html000644 025423 025423 00000172322 14162303413 022373 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/thread.h Source File
FreeTDS API
thread.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  *
3  * Copyright (C) 2005 Liam Widdowson
4  * Copyright (C) 2010-2012 Frediano Ziglio
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef TDSTHREAD_H
23 #define TDSTHREAD_H 1
24 
25 #undef TDS_HAVE_MUTEX
26 
27 #if defined(_THREAD_SAFE) && defined(TDS_HAVE_PTHREAD_MUTEX)
28 
29 #include <tds_sysdep_public.h>
30 #include <pthread.h>
31 #include <errno.h>
32 
33 #include <freetds/pushvis.h>
34 
35 typedef pthread_mutex_t tds_raw_mutex;
36 #define TDS_RAW_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
37 
38 static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx)
39 {
40  pthread_mutex_lock(mtx);
41 }
42 
43 static inline int tds_raw_mutex_trylock(tds_raw_mutex *mtx)
44 {
45  return pthread_mutex_trylock(mtx);
46 }
47 
48 static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx)
49 {
50  pthread_mutex_unlock(mtx);
51 }
52 
53 static inline int tds_raw_mutex_init(tds_raw_mutex *mtx)
54 {
55  return pthread_mutex_init(mtx, NULL);
56 }
57 
58 static inline void tds_raw_mutex_free(tds_raw_mutex *mtx)
59 {
60  pthread_mutex_destroy(mtx);
61 }
62 
63 typedef pthread_cond_t tds_condition;
64 
65 int tds_raw_cond_init(tds_condition *cond);
66 static inline int tds_raw_cond_destroy(tds_condition *cond)
67 {
68  return pthread_cond_destroy(cond);
69 }
70 static inline int tds_raw_cond_signal(tds_condition *cond)
71 {
72  return pthread_cond_signal(cond);
73 }
74 static inline int tds_raw_cond_wait(tds_condition *cond, tds_raw_mutex *mtx)
75 {
76  return pthread_cond_wait(cond, mtx);
77 }
78 int tds_raw_cond_timedwait(tds_condition *cond, tds_raw_mutex *mtx, int timeout_sec);
79 
80 #define TDS_HAVE_MUTEX 1
81 
82 typedef pthread_t tds_thread;
83 typedef pthread_t tds_thread_id;
84 typedef void *(*tds_thread_proc)(void *arg);
85 #define TDS_THREAD_PROC_DECLARE(name, arg) \
86  void *name(void *arg)
87 #define TDS_THREAD_RESULT(n) ((void*)(intptr_t)(n))
88 
89 static inline int tds_thread_create(tds_thread *ret, tds_thread_proc proc, void *arg)
90 {
91  return pthread_create(ret, NULL, proc, arg);
92 }
93 
94 static inline int tds_thread_create_detached(tds_thread_proc proc, void *arg)
95 {
96  tds_thread th;
97  int ret = pthread_create(&th, NULL, proc, arg);
98  if (!ret)
99  pthread_detach(th);
100  return ret;
101 }
102 
103 static inline int tds_thread_join(tds_thread th, void **ret)
104 {
105  return pthread_join(th, ret);
106 }
107 
108 static inline tds_thread_id tds_thread_get_current_id(void)
109 {
110  return pthread_self();
111 }
112 
113 static inline int tds_thread_is_current(tds_thread_id th)
114 {
115  return pthread_equal(th, pthread_self());
116 }
117 
118 #include <freetds/popvis.h>
119 
120 #elif defined(_WIN32)
121 
122 #include <freetds/windows.h>
123 #include <errno.h>
124 
125 /* old version of Windows do not define this constant */
126 #ifndef ETIMEDOUT
127 #define ETIMEDOUT 138
128 #endif
129 
130 struct ptw32_mcs_node_t_;
131 
132 typedef struct {
133  struct ptw32_mcs_node_t_ *lock;
134  LONG done;
135  DWORD thread_id;
136  CRITICAL_SECTION crit;
137 } tds_raw_mutex;
138 
139 #define TDS_RAW_MUTEX_INITIALIZER { NULL, 0, 0 }
140 
141 static inline int
142 tds_raw_mutex_init(tds_raw_mutex *mtx)
143 {
144  mtx->lock = NULL;
145  mtx->done = 0;
146  mtx->thread_id = 0;
147  return 0;
148 }
149 
150 void tds_win_mutex_lock(tds_raw_mutex *mutex);
151 
152 static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx)
153 {
154  if (mtx->done) {
155  EnterCriticalSection(&mtx->crit);
156  mtx->thread_id = GetCurrentThreadId();
157  } else {
158  tds_win_mutex_lock(mtx);
159  }
160 }
161 
162 int tds_raw_mutex_trylock(tds_raw_mutex *mtx);
163 
164 static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx)
165 {
166  mtx->thread_id = 0;
167  LeaveCriticalSection(&mtx->crit);
168 }
169 
170 static inline void tds_raw_mutex_free(tds_raw_mutex *mtx)
171 {
172  if (mtx->done) {
173  DeleteCriticalSection(&mtx->crit);
174  mtx->done = 0;
175  }
176 }
177 
178 #define TDS_HAVE_MUTEX 1
179 
180 /* easy way, only single signal supported */
181 typedef void *TDS_CONDITION_VARIABLE;
182 typedef union {
183  HANDLE ev;
184  TDS_CONDITION_VARIABLE cv;
185 } tds_condition;
186 
187 extern int (*tds_raw_cond_init)(tds_condition *cond);
188 extern int (*tds_raw_cond_destroy)(tds_condition *cond);
189 extern int (*tds_raw_cond_signal)(tds_condition *cond);
190 extern int (*tds_raw_cond_timedwait)(tds_condition *cond, tds_raw_mutex *mtx, int timeout_sec);
191 static inline int tds_raw_cond_wait(tds_condition *cond, tds_raw_mutex *mtx)
192 {
193  return tds_raw_cond_timedwait(cond, mtx, -1);
194 }
195 
196 typedef HANDLE tds_thread;
197 typedef DWORD tds_thread_id;
198 typedef DWORD (WINAPI *tds_thread_proc)(void *arg);
199 #define TDS_THREAD_PROC_DECLARE(name, arg) \
200  DWORD WINAPI name(void *arg)
201 #define TDS_THREAD_RESULT(n) ((DWORD)(int)(n))
202 
203 static inline int tds_thread_create(tds_thread *ret, tds_thread_proc proc, void *arg)
204 {
205  *ret = CreateThread(NULL, 0, proc, arg, 0, NULL);
206  return *ret != NULL ? 0 : 11 /* EAGAIN */;
207 }
208 
209 static inline int tds_thread_create_detached(tds_thread_proc proc, void *arg)
210 {
211  HANDLE h = CreateThread(NULL, 0, proc, arg, 0, NULL);
212  if (h)
213  return 0;
214  CloseHandle(h);
215  return 11 /* EAGAIN */;
216 }
217 
218 static inline int tds_thread_join(tds_thread th, void **ret)
219 {
220  if (WaitForSingleObject(th, INFINITE) == WAIT_OBJECT_0) {
221  if (ret) {
222  DWORD r;
223  if (!GetExitCodeThread(th, &r))
224  r = 0xffffffffu;
225  *ret = (void*) (((char*)0) + r);
226  }
227 
228  CloseHandle(th);
229  return 0;
230  }
231  CloseHandle(th);
232  return 22 /* EINVAL */;
233 }
234 
235 static inline tds_thread_id tds_thread_get_current_id(void)
236 {
237  return GetCurrentThreadId();
238 }
239 
240 static inline int tds_thread_is_current(tds_thread_id th)
241 {
242  return th == GetCurrentThreadId();
243 }
244 
245 #else
246 
247 #include <tds_sysdep_public.h>
248 
249 /* define noops as "successful" */
250 typedef struct {
251  char dummy[0]; /* compiler compatibility */
252 } tds_raw_mutex;
253 
254 #define TDS_RAW_MUTEX_INITIALIZER {}
255 
256 static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx)
257 {
258 }
259 
260 static inline int tds_raw_mutex_trylock(tds_raw_mutex *mtx)
261 {
262  return 0;
263 }
264 
265 static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx)
266 {
267 }
268 
269 static inline int tds_raw_mutex_init(tds_raw_mutex *mtx)
270 {
271  return 0;
272 }
273 
274 static inline void tds_raw_mutex_free(tds_raw_mutex *mtx)
275 {
276 }
277 
278 typedef struct {
279  char dummy[0]; /* compiler compatibility */
280 } tds_condition;
281 
282 static inline int tds_raw_cond_init(tds_condition *cond)
283 {
284  return 0;
285 }
286 static inline int tds_raw_cond_destroy(tds_condition *cond)
287 {
288  return 0;
289 }
290 #define tds_raw_cond_signal(cond) \
291  FreeTDS_Condition_not_compiled
292 
293 #define tds_raw_cond_wait(cond, mtx) \
294  FreeTDS_Condition_not_compiled
295 
296 #define tds_raw_cond_timedwait(cond, mtx, timeout_sec) \
297  FreeTDS_Condition_not_compiled
298 
299 typedef struct {
300  char dummy[0]; /* compiler compatibility */
301 } tds_thread;
302 typedef int tds_thread_id;
303 
304 typedef void *(*tds_thread_proc)(void *arg);
305 #define TDS_THREAD_PROC_DECLARE(name, arg) \
306  void *name(void *arg)
307 #define TDS_THREAD_RESULT(n) ((void*)(intptr_t)(n))
308 
309 #define tds_thread_create(ret, proc, arg) \
310  FreeTDS_Thread_not_compiled
311 
312 #define tds_thread_create_detached(proc, arg) \
313  FreeTDS_Thread_not_compiled
314 
315 #define tds_thread_join(th, ret) \
316  FreeTDS_Thread_not_compiled
317 
318 static inline tds_thread_id tds_thread_get_current_id(void)
319 {
320  return 0;
321 }
322 
323 static inline int tds_thread_is_current(tds_thread_id th)
324 {
325  return 1;
326 }
327 
328 #endif
329 
330 # define tds_cond_init tds_raw_cond_init
331 # define tds_cond_destroy tds_raw_cond_destroy
332 # define tds_cond_signal tds_raw_cond_signal
333 # if !ENABLE_EXTRA_CHECKS
334 # define TDS_MUTEX_INITIALIZER TDS_RAW_MUTEX_INITIALIZER
335 # define tds_mutex tds_raw_mutex
336 # define tds_mutex_lock tds_raw_mutex_lock
337 # define tds_mutex_trylock tds_raw_mutex_trylock
338 # define tds_mutex_unlock tds_raw_mutex_unlock
339 # define tds_mutex_check_owned(mtx) do {} while(0)
340 # define tds_mutex_init tds_raw_mutex_init
341 # define tds_mutex_free tds_raw_mutex_free
342 # define tds_cond_wait tds_raw_cond_wait
343 # define tds_cond_timedwait tds_raw_cond_timedwait
344 # else
345 # include <assert.h>
346 
347 typedef struct tds_mutex
348 {
349  tds_raw_mutex mtx;
350  volatile int locked;
351  volatile tds_thread_id locked_by;
352 } tds_mutex;
353 
354 # define TDS_MUTEX_INITIALIZER { TDS_RAW_MUTEX_INITIALIZER, 0 }
355 
356 static inline void tds_mutex_lock(tds_mutex *mtx)
357 {
358  assert(mtx);
359  tds_raw_mutex_lock(&mtx->mtx);
360  assert(!mtx->locked);
361  mtx->locked = 1;
362  mtx->locked_by = tds_thread_get_current_id();
363 }
364 
365 static inline int tds_mutex_trylock(tds_mutex *mtx)
366 {
367  int ret;
368  assert(mtx);
369  ret = tds_raw_mutex_trylock(&mtx->mtx);
370  if (!ret) {
371  assert(!mtx->locked);
372  mtx->locked = 1;
373  mtx->locked_by = tds_thread_get_current_id();
374  }
375  return ret;
376 }
377 
378 static inline void tds_mutex_unlock(tds_mutex *mtx)
379 {
380  assert(mtx && mtx->locked);
381  mtx->locked = 0;
382  tds_raw_mutex_unlock(&mtx->mtx);
383 }
384 
385 static inline void tds_mutex_check_owned(tds_mutex *mtx)
386 {
387  int ret;
388  assert(mtx);
389  ret = tds_raw_mutex_trylock(&mtx->mtx);
390  assert(ret);
391  assert(mtx->locked);
392  assert(tds_thread_is_current(mtx->locked_by));
393 }
394 
395 static inline int tds_mutex_init(tds_mutex *mtx)
396 {
397  mtx->locked = 0;
398  return tds_raw_mutex_init(&mtx->mtx);
399 }
400 
401 static inline void tds_mutex_free(tds_mutex *mtx)
402 {
403  assert(mtx && !mtx->locked);
404  tds_raw_mutex_free(&mtx->mtx);
405 }
406 
407 static inline int tds_cond_wait(tds_condition *cond, tds_mutex *mtx)
408 {
409  int ret;
410  assert(mtx && mtx->locked);
411  mtx->locked = 0;
412  ret = tds_raw_cond_wait(cond, &mtx->mtx);
413  mtx->locked = 1;
414  mtx->locked_by = tds_thread_get_current_id();
415  return ret;
416 }
417 
418 static inline int tds_cond_timedwait(tds_condition *cond, tds_mutex *mtx, int timeout_sec)
419 {
420  int ret;
421  assert(mtx && mtx->locked);
422  mtx->locked = 0;
423  ret = tds_raw_cond_timedwait(cond, &mtx->mtx, timeout_sec);
424  mtx->locked = 1;
425  mtx->locked_by = tds_thread_get_current_id();
426  return ret;
427 }
428 
429 # endif
430 
431 #endif
Definition: ptw32_MCS_lock.c:98
Definition: thread.h:250
Definition: thread.h:299
Definition: thread.h:278
freetds-1.3.6/doc/reference/a00455_source.html000644 025423 025423 00000011005 14162303413 022364 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/time.h Source File
FreeTDS API
time.h
1 #if TIME_WITH_SYS_TIME
2 # include <sys/time.h>
3 # include <time.h>
4 #else
5 # if HAVE_SYS_TIME_H
6 # include <sys/time.h>
7 # else
8 # include <time.h>
9 # endif
10 #endif
11 
freetds-1.3.6/doc/reference/a00458_source.html000644 025423 025423 00000051603 14162303413 022377 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/tls.h Source File
FreeTDS API
tls.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2015 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _freetds_tls_h_
21 #define _freetds_tls_h_
22 
23 #ifndef _tds_h_
24 #error tds.h must be included before tls.h
25 #endif
26 
27 #ifdef HAVE_GNUTLS
28 # if defined(_THREAD_SAFE) && defined(TDS_HAVE_PTHREAD_MUTEX)
29 # include <freetds/thread.h>
30 # ifndef GNUTLS_USE_NETTLE
31 # include <gcrypt.h>
32 # endif
33 # endif
34 # include <gnutls/gnutls.h>
35 # include <gnutls/x509.h>
36 #elif defined(HAVE_OPENSSL)
37 # include <openssl/ssl.h>
38 # include <openssl/x509v3.h>
39 # include <openssl/err.h>
40 #endif
41 
42 #include <freetds/pushvis.h>
43 
44 #if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL)
45 TDSRET tds_ssl_init(TDSSOCKET *tds);
46 void tds_ssl_deinit(TDSCONNECTION *conn);
47 
48 # ifdef HAVE_GNUTLS
49 
50 static inline int
51 tds_ssl_pending(TDSCONNECTION *conn)
52 {
53  return gnutls_record_check_pending((gnutls_session_t) conn->tls_session);
54 }
55 
56 static inline int
57 tds_ssl_read(TDSCONNECTION *conn, unsigned char *buf, int buflen)
58 {
59  return gnutls_record_recv((gnutls_session_t) conn->tls_session, buf, buflen);
60 }
61 
62 static inline int
63 tds_ssl_write(TDSCONNECTION *conn, const unsigned char *buf, int buflen)
64 {
65  return gnutls_record_send((gnutls_session_t) conn->tls_session, buf, buflen);
66 }
67 # else
68 
69 /* compatibility for LibreSSL 2.7 */
70 #ifdef LIBRESSL_VERSION_NUMBER
71 #define TLS_ST_OK SSL_ST_OK
72 #endif
73 
74 static inline int
75 tds_ssl_pending(TDSCONNECTION *conn)
76 {
77  return SSL_pending((SSL *) conn->tls_session);
78 }
79 
80 static inline int
81 tds_ssl_read(TDSCONNECTION *conn, unsigned char *buf, int buflen)
82 {
83  return SSL_read((SSL *) conn->tls_session, buf, buflen);
84 }
85 
86 static inline int
87 tds_ssl_write(TDSCONNECTION *conn, const unsigned char *buf, int buflen)
88 {
89  return SSL_write((SSL *) conn->tls_session, buf, buflen);
90 }
91 # endif
92 #else
93 static inline TDSRET
94 tds_ssl_init(TDSSOCKET *tds)
95 {
96  return TDS_FAIL;
97 }
98 
99 static inline void
100 tds_ssl_deinit(TDSCONNECTION *conn)
101 {
102 }
103 
104 static inline int
105 tds_ssl_pending(TDSCONNECTION *conn)
106 {
107  return 0;
108 }
109 
110 static inline int
111 tds_ssl_read(TDSCONNECTION *conn, unsigned char *buf, int buflen)
112 {
113  return -1;
114 }
115 
116 static inline int
117 tds_ssl_write(TDSCONNECTION *conn, const unsigned char *buf, int buflen)
118 {
119  return -1;
120 }
121 #endif
122 
123 #include <freetds/popvis.h>
124 
125 #endif /* _freetds_tls_h_ */
Definition: tds.h:1091
Information for a server connection.
Definition: tds.h:1163
freetds-1.3.6/doc/reference/a00461_source.html000644 025423 025423 00000017766 14162303413 022405 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/bjoern-utf8.h Source File
FreeTDS API
bjoern-utf8.h
1 /*
2  * Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5  *
6  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9  *
10  * See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
11  */
12 
13 #include <tds_sysdep_public.h>
14 
15 #define UTF8_ACCEPT 0
16 #define UTF8_REJECT 12
17 
18 extern const uint8_t utf8_table[];
19 
20 static inline uint32_t
21 decode_utf8(uint32_t* state, uint32_t* codep, uint32_t byte)
22 {
23  uint32_t type = utf8_table[byte];
24 
25  *codep = (*state != UTF8_ACCEPT) ?
26  (byte & 0x3fu) | (*codep << 6) :
27  (0xff >> type) & (byte);
28 
29  *state = utf8_table[256 + *state + type];
30  return *state;
31 }
freetds-1.3.6/doc/reference/a00464_source.html000644 025423 025423 00000023013 14162303413 022366 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/des.h Source File
FreeTDS API
des.h
1 #ifndef DES_H
2 #define DES_H
3 
4 #ifdef HAVE_NETTLE
5 #include <nettle/des.h>
6 
7 typedef struct des_ctx DES_KEY;
8 #endif
9 
10 #include <freetds/pushvis.h>
11 
12 typedef uint8_t des_cblock[8];
13 
14 #ifndef HAVE_NETTLE
15 typedef struct des_key
16 {
17  uint8_t kn[16][8];
18  uint32_t sp[8][64];
19  uint8_t iperm[16][16][8];
20  uint8_t fperm[16][16][8];
21 } DES_KEY;
22 
23 int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len);
24 void tds_des_encrypt(const DES_KEY * key, des_cblock block);
25 #endif
26 
27 void tds_des_set_odd_parity(des_cblock key);
28 int tds_des_ecb_encrypt(const void *plaintext, int len, DES_KEY * akey, uint8_t *output);
29 
30 #include <freetds/popvis.h>
31 
32 #ifdef HAVE_NETTLE
33 static inline void tds_des_encrypt(const DES_KEY * key, des_cblock block)
34 {
35  nettle_des_encrypt(key, sizeof(des_cblock), block, block);
36 }
37 
38 static inline int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len)
39 {
40  return nettle_des_set_key(dkey, user_key);
41 }
42 #endif
43 
44 #endif /* !DES_H */
Definition: des.h:16
freetds-1.3.6/doc/reference/a00467_source.html000644 025423 025423 00000024366 14162303413 022405 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/dlist.h Source File
FreeTDS API
dlist.h
1 /* Dlist - dynamic list
2  * Copyright (C) 2016 Frediano Ziglio
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
20 #ifndef TDS_DLIST_H
21 #define TDS_DLIST_H
22 
23 typedef struct dlist_ring {
24  struct dlist_ring *next;
25  struct dlist_ring *prev;
26 } dlist_ring;
27 
28 #if ENABLE_EXTRA_CHECKS
29 void dlist_ring_check(dlist_ring *ring);
30 #endif
31 
32 #define DLIST_FIELDS(name) \
33  dlist_ring name
34 
35 #define DLIST_FOREACH(prefix, list, p) \
36  for (p = prefix ## _ ## first(list); p != NULL; p = prefix ## _ ## next(list, p))
37 
38 static inline void dlist_insert_after(dlist_ring *ring_pos, dlist_ring *ring_item)
39 {
40  assert(!ring_item->next && !ring_item->prev);
41  ring_pos->next->prev = ring_item;
42  ring_item->prev = ring_pos;
43  ring_item->next = ring_pos->next;
44  ring_pos->next = ring_item;
45  assert(ring_item->next && ring_item->prev);
46 }
47 
48 #endif /* TDS_DLIST_H */
Definition: dlist.h:23
freetds-1.3.6/doc/reference/a00470_source.html000644 025423 025423 00000047467 14162303413 022406 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/dlist.tmpl.h Source File
FreeTDS API
dlist.tmpl.h
1 /* Dlist - dynamic list
2  * Copyright (C) 2016 Frediano Ziglio
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
20 #include <freetds/bool.h>
21 #include <freetds/utils.h>
22 #include <freetds/macros.h>
23 
24 #if !defined(DLIST_PREFIX) || !defined(DLIST_ITEM_TYPE) || !defined(DLIST_LIST_TYPE)
25 #error Required defines for dlist missing!
26 #endif
27 
28 #if defined(DLIST_NAME) || defined(DLIST_PASTER) || \
29  defined(DLIST_EVALUATOR) || defined(DLIST_ITEM)
30 #error Some internal dlist macros already defined
31 #endif
32 
33 typedef struct
34 {
35  dlist_ring ring;
37 
38 #define DLIST_PASTER(x,y) x ## _ ## y
39 #define DLIST_EVALUATOR(x,y) DLIST_PASTER(x,y)
40 #define DLIST_NAME(suffix) DLIST_EVALUATOR(DLIST_PREFIX, suffix)
41 #define DLIST_ITEM(ring) \
42  ((DLIST_ITEM_TYPE *) (((char *) (ring)) - TDS_OFFSET(DLIST_ITEM_TYPE, DLIST_NAME(item))))
43 
44 static inline void DLIST_NAME(check)(DLIST_LIST_TYPE *list)
45 {
46 #if ENABLE_EXTRA_CHECKS
47  assert(list != NULL);
48  dlist_ring_check(&list->ring);
49 #endif
50 }
51 
52 static inline void DLIST_NAME(init)(DLIST_LIST_TYPE *list)
53 {
54  list->ring.next = list->ring.prev = &list->ring;
55  DLIST_NAME(check)(list);
56 }
57 
58 static inline DLIST_ITEM_TYPE *DLIST_NAME(first)(DLIST_LIST_TYPE *list)
59 {
60  return list->ring.next == &list->ring ? NULL : DLIST_ITEM(list->ring.next);
61 }
62 
63 static inline DLIST_ITEM_TYPE *DLIST_NAME(last)(DLIST_LIST_TYPE *list)
64 {
65  return list->ring.prev == &list->ring ? NULL : DLIST_ITEM(list->ring.prev);
66 }
67 
68 static inline DLIST_ITEM_TYPE *DLIST_NAME(next)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item)
69 {
70  return item->DLIST_NAME(item).next == &list->ring ? NULL : DLIST_ITEM(item->DLIST_NAME(item).next);
71 }
72 
73 static inline DLIST_ITEM_TYPE *DLIST_NAME(prev)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item)
74 {
75  return item->DLIST_NAME(item).prev == &list->ring ? NULL : DLIST_ITEM(item->DLIST_NAME(item).prev);
76 }
77 
78 static inline void DLIST_NAME(prepend)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item)
79 {
80  DLIST_NAME(check)(list);
81  dlist_insert_after(&list->ring, &item->DLIST_NAME(item));
82  DLIST_NAME(check)(list);
83 }
84 
85 static inline void DLIST_NAME(append)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item)
86 {
87  DLIST_NAME(check)(list);
88  dlist_insert_after(list->ring.prev, &item->DLIST_NAME(item));
89  DLIST_NAME(check)(list);
90 }
91 
92 static inline void DLIST_NAME(remove)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item)
93 {
94  dlist_ring *prev = item->DLIST_NAME(item).prev, *next = item->DLIST_NAME(item).next;
95  DLIST_NAME(check)(list);
96  if (prev) {
97  prev->next = next;
98  next->prev = prev;
99  }
100  item->DLIST_NAME(item).prev = NULL;
101  item->DLIST_NAME(item).next = NULL;
102  DLIST_NAME(check)(list);
103 }
104 
105 static inline bool DLIST_NAME(in_list)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item)
106 {
107  DLIST_NAME(check)(list);
108  return item->DLIST_NAME(item).prev != NULL || item->DLIST_NAME(item).next != NULL;
109 }
110 
111 #undef DLIST_ITEM
112 #undef DLIST_NAME
113 #undef DLIST_ITEM_TYPE
114 #undef DLIST_LIST_TYPE
115 #undef DLIST_PREFIX
116 #undef DLIST_PASTER
117 #undef DLIST_EVALUATOR
118 
Definition: dlist.tmpl.h:34
Definition: dlist.h:23
freetds-1.3.6/doc/reference/a00473_source.html000644 025423 025423 00000017251 14162303413 022375 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/hmac_md5.h Source File
FreeTDS API
hmac_md5.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2008 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _hmac_md5_h_
21 #define _hmac_md5_h_
22 
23 #include <freetds/pushvis.h>
24 void hmac_md5(const unsigned char key[16],
25  const unsigned char* data, size_t data_len,
26  unsigned char* digest);
27 #include <freetds/popvis.h>
28 
29 #endif
freetds-1.3.6/doc/reference/a00476_source.html000644 025423 025423 00000022776 14162303413 022410 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/md4.h Source File
FreeTDS API
md4.h
1 #ifndef MD4_H
2 #define MD4_H
3 
4 #ifndef HAVE_NETTLE
5 
6 #include <freetds/pushvis.h>
7 
8 struct MD4Context
9 {
10  uint32_t buf[4];
11  uint64_t bytes;
12  uint32_t in[16];
13 };
14 
15 void MD4Init(struct MD4Context *context);
16 void MD4Update(struct MD4Context *context, const uint8_t *buf, size_t len);
17 void MD4Final(struct MD4Context *context, uint8_t *digest);
18 
19 typedef struct MD4Context MD4_CTX;
20 
21 #include <freetds/popvis.h>
22 
23 #else
24 
25 #include <nettle/md4.h>
26 
27 typedef struct md4_ctx MD4_CTX;
28 
29 static inline void MD4Init(MD4_CTX *ctx)
30 {
31  nettle_md4_init(ctx);
32 }
33 
34 static inline void MD4Update(MD4_CTX *ctx, const uint8_t *buf, size_t len)
35 {
36  nettle_md4_update(ctx, len, buf);
37 }
38 
39 static inline void MD4Final(MD4_CTX *ctx, uint8_t *digest)
40 {
41  nettle_md4_digest(ctx, 16, digest);
42 }
43 
44 
45 #endif
46 
47 #endif /* !MD4_H */
Definition: md4.h:9
freetds-1.3.6/doc/reference/a00506.html000644 025423 025423 00001442123 14162303416 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: include/sybdb.h File Reference
FreeTDS API
sybdb.h File Reference

Primary include file for db-lib applications. More...

#include "tds_sysdep_public.h"
Include dependency graph for sybdb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DBCOL
 
struct  DBCOL2
 
struct  DBDATETIME
 
struct  DBDATETIME4
 
struct  DBDATETIMEALL
 
struct  DBMONEY
 
struct  DBMONEY4
 
struct  DBNUMERIC
 
struct  dbstring
 
struct  dbtypeinfo
 
struct  DBVARYBIN
 
struct  DBVARYCHAR
 
struct  tds_microsoft_dbdaterec
 
struct  tds_microsoft_dbdaterec2
 
struct  tds_sybase_dbdaterec
 
struct  tds_sybase_dbdaterec2
 

Macros

#define BCP_SETL(x, y)   dbsetlbool((x), (y), DBSETBCP)
 Enable (or prevent) bcp operations for connections made with a login. More...
 
#define BCP_SETLABELED(x, y)   dbsetlbool((x), (y), DBSETLABELED)
 
#define BCPBATCH   4
 
#define BCPFIRST   2
 
#define BCPHINTS   6
 
#define BCPKEEPIDENTITY   8
 
#define BCPLABELED   5
 
#define BCPLAST   3
 
#define BCPMAXERRS   1
 
#define BIGDATETIMEBIND   23
 
#define BIGINTBIND   30
 
#define BIGTIMEBIND   24
 
#define BINARYBIND   15
 
#define BITBIND   16
 
#define BUF_FULL   -3
 
#define CHARBIND   0
 
#define DATEBIND   21
 
#define DATETIME2BIND   31
 
#define DATETIMEBIND   11
 
#define DB_IN   1
 
#define DB_OUT   2
 
#define DB_QUERYOUT   3
 
#define DBARITHABORT   6
 
#define DBARITHIGNORE   4
 
#define DBAUTH   29
 
#define DBBOTH   2
 
#define DBBROWSE   8
 
#define DBBUFFER   14
 
#define DBCHAINXACTS   26
 
#define DBCLIENTCURSORS   33
 
#define DBCMDNONE   0
 
#define DBCMDPEND   1
 
#define DBCMDROW(x)   dbcmdrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBCMDSENT   2
 
#define DBCONFIRM   12
 
#define DBCOUNT(x)   dbcount((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBCURCMD(x)   dbcurcmd((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBCURROW(x)   dbcurrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBDATEFIRST   25
 
#define DBDATEFORMAT   19
 
#define DBDATESHORT   32
 
#define DBDEAD(x)   dbdead((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBDOUBLE   1
 
#define DBERRLVL   11
 
#define DBESTIMATE   1
 
#define DBFIPSFLAG   27
 
#define DBFIRSTROW(x)   dbfirstrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBGETTIME   dbgettime
 
#define DBIDENTITY   30
 
#define DBINTERRUPT   4
 
#define DBIORDESC(x)   dbiordesc((x))
 Sybase macro, maps to the internal (lower-case) function. More...
 
#define DBIOWDESC(x)   dbiowdesc((x))
 Sybase macro, maps to the internal (lower-case) function. More...
 
#define DBISAVAIL(x)   dbisavail((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBISOLATION   28
 
#define DBLASTROW(x)   dblastrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBLFCONVERT   24
 
#define DBMAXNAME   128
 
#define DBMAXNUMLEN   33
 
#define DBMORECMDS(x)   dbmorecmds((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBNATLANG   18
 
#define DBNOAUTOFREE   15
 
#define DBNOCOUNT   5
 
#define DBNOERR   -1
 
#define DBNOEXEC   3
 
#define DBNOIDCOL   31
 
#define DBNOSAVE   0
 
#define DBNOTIFICATION   2
 
#define DBNUMOPTIONS   36
 
#define DBOFFSET   9
 
#define dbopen(x, y)   tdsdbopen((x),(y), 0)
 
#define DBPADOFF   0
 
#define DBPADON   1
 
#define DBPARSEONLY   0
 
#define DBPRCOLSEP   21
 
#define DBPRCOLSEP   21
 
#define DBPRLINELEN   22
 
#define DBPRLINELEN   22
 
#define DBPRLINESEP   23
 
#define DBPRPAD   20
 
#define DBQUOTEDIDENT   35
 
#define DBRESULT   1
 
#define DBROWCOUNT   16
 
#define DBROWS(x)   dbrows((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBROWTYPE(x)   dbrowtype((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBRPCCURSOR   TDS_STATIC_CAST(DBSMALLINT, 0x0008)
 
#define DBRPCDEFAULT   2
 
#define DBRPCNORETURN   0
 
#define DBRPCRECOMPILE   TDS_STATIC_CAST(DBSMALLINT, 0x0001)
 
#define DBRPCRESET   TDS_STATIC_CAST(DBSMALLINT, 0x0002)
 
#define DBRPCRETURN   1
 
#define DBSAVE   1
 
#define DBSETAPP   5
 
#define DBSETBCP   6
 
#define DBSETCHARSET   10
 
#define DBSETDBNAME   14
 
#define DBSETDELEGATION   1004
 
#define DBSETENCRYPT   12
 
#define DBSETHOST   1
 
#define DBSETLABELED   13
 
#define DBSETLAPP(x, y)   dbsetlname((x), (y), DBSETAPP)
 Set the (client) application name in the login packet. More...
 
#define dbsetlapp(x, y)   dbsetlname((x), (y), DBSETAPP)
 
#define DBSETLCHARSET(x, y)   dbsetlname((x), (y), DBSETCHARSET)
 Set the client character set in the login packet. More...
 
#define DBSETLDBNAME(x, y)   dbsetlname((x), (y), DBSETDBNAME)
 
#define DBSETLDELEGATION(x, y)   dbsetlbool((x), (y), DBSETDELEGATION)
 
#define DBSETLENCRYPT(x, y)   dbsetlbool((x), (y), DBSETENCRYPT)
 Enable (or not) network password encryption for Sybase servers version 10.0 or above. More...
 
#define DBSETLHOST(x, y)   dbsetlname((x), (y), DBSETHOST)
 Set the (client) host name in the login packet. More...
 
#define dbsetlhost(x, y)   dbsetlname((x), (y), DBSETHOST)
 
#define DBSETLLABELED(x, y)   dbsetlbool((x), (y), DBSETLABELED)
 Alternative way to set login packet fields. More...
 
#define DBSETLMUTUALAUTH(x, y)   dbsetlbool((x), (y), DBSETMUTUALAUTH)
 
#define DBSETLNATLANG(x, y)   dbsetlname((x), (y), DBSETNATLANG)
 Set the language the server should use for messages. More...
 
#define dbsetlnatlang(x, y)   dbsetlname((x), (y), DBSETNATLANG)
 Set the language the server should use for messages. More...
 
#define DBSETLNETWORKAUTH(x, y)   dbsetlbool((x), (y), DBSETNETWORKAUTH)
 
#define DBSETLNTLMV2(x, y)   dbsetlbool((x), (y), DBSETNTLMV2)
 
#define DBSETLPACKET(x, y)   dbsetllong((x), (y), DBSETPACKET)
 Set the packet size in the login packet for new connections. More...
 
#define dbsetlpacket(x, y)   dbsetllong((x), (y), DBSETPACKET)
 Set the packet size in the login packet for new connections. More...
 
#define DBSETLPWD(x, y)   dbsetlname((x), (y), DBSETPWD)
 Set the password in the login packet. More...
 
#define dbsetlpwd(x, y)   dbsetlname((x), (y), DBSETPWD)
 
#define DBSETLREADONLY(x, y)   dbsetlbool((x), (y), DBSETREADONLY)
 
#define DBSETLSECURE(x)   dbsetlbool((x), (1), DBSETBCP)
 
#define DBSETLSERVERPRINCIPAL(x, y)   dbsetlname((x), (y), DBSETSERVERPRINCIPAL)
 
#define DBSETLUSER(x, y)   dbsetlname((x), (y), DBSETUSER)
 Set the username in the login packet. More...
 
#define dbsetluser(x, y)   dbsetlname((x), (y), DBSETUSER)
 
#define DBSETLUTF16(x, y)   dbsetlbool((x), (y), DBSETUTF16)
 
#define DBSETLVERSION(login, version)   dbsetlversion((login), (version))
 maps to the Microsoft (lower-case) function. More...
 
#define DBSETMUTUALAUTH   102
 
#define DBSETNATLANG   7
 
#define DBSETNETWORKAUTH   101
 
#define DBSETNTLMV2   1002
 
#define DBSETPACKET   11
 
#define DBSETPWD   3
 
#define DBSETREADONLY   1003
 
#define DBSETSERVERPRINCIPAL   103
 
#define DBSETTIME   34
 
#define DBSETUSER   2
 
#define DBSETUTF16   1001
 
#define DBSHOWPLAN   2
 
#define DBSINGLE   0
 
#define DBSTAT   10
 
#define DBSTORPROCID   13
 
#define DBTDS(a)   dbtds(a)
 Sybase macro, maps to the internal (lower-case) function. More...
 
#define DBTDS_2_0   1 /* pre 4.0 SQL Server */
 
#define DBTDS_3_4   2 /* Microsoft SQL Server (3.0) */
 
#define DBTDS_4_0   3 /* 4.0 SQL Server */
 
#define DBTDS_4_2   4 /* 4.2 SQL Server */
 
#define DBTDS_4_6   5 /* 2.0 OpenServer and 4.6 SQL Server. */
 
#define DBTDS_4_9_5   6 /* 4.9.5 (NCR) SQL Server */
 
#define DBTDS_5_0   7 /* 5.0 SQL Server */
 
#define DBTDS_7_0   8 /* Microsoft SQL Server 7.0 */
 
#define DBTDS_7_1   9 /* Microsoft SQL Server 2000 */
 
#define DBTDS_7_2   10 /* Microsoft SQL Server 2005 */
 
#define DBTDS_7_3   11 /* Microsoft SQL Server 2008 */
 
#define DBTDS_7_4   12 /* Microsoft SQL Server 2012/2014 */
 
#define DBTDS_8_0   9 /* Microsoft SQL Server 2000 */
 
#define DBTDS_9_0   10 /* Microsoft SQL Server 2005 */
 
#define DBTDS_UNKNOWN   0
 DBTDS_xxx are returned by DBTDS() The integer values of the constants are poorly chosen. More...
 
#define DBTEXTLIMIT   7
 
#define DBTEXTSIZE   17
 
#define DBTIMEOUT   3
 
#define DBTXPLEN   16
 
#define DBTXTSLEN   8
 
#define DBVER42   DBVERSION_42
 
#define DBVER60   DBVERSION_70 /* our best approximation */
 
#define DBVERSION_100   2
 
#define DBVERSION_42   3
 
#define DBVERSION_46   1
 
#define DBVERSION_70   4
 
#define DBVERSION_71   5
 
#define DBVERSION_72   6
 
#define DBVERSION_73   7
 
#define DBVERSION_74   8
 
#define DBVERSION_UNKNOWN   0
 DBVERSION_xxx are used with dbsetversion()
 
#define DECIMALBIND   18
 
#define FAIL   0
 
#define FALSE   0
 
#define FLT8BIND   9
 
#define INT_CANCEL   2
 
#define INT_CONTINUE   1
 
#define INT_EXIT   0
 
#define INT_TIMEOUT   3
 
#define INTBIND   8
 
#define MAXBINDTYPES   32 /* keep last */
 
#define MAXOPTTEXT   32
 
#define MONEYBIND   13
 
#define MORE_ROWS   -1
 
#define NO_MORE_RESULTS   2
 
#define NO_MORE_ROWS   -2
 
#define NOSUCHOPTION   2
 
#define NTBSTRINGBIND   2
 
#define NUMERICBIND   17
 
#define OFF   0
 
#define ON   1
 
#define REALBIND   10
 
#define REG_ROW   -1
 
#define SMALLBIND   7
 
#define SMALLDATETIMEBIND   12
 
#define SMALLMONEYBIND   14
 
#define SRCDECIMALBIND   20
 
#define SRCNUMERICBIND   19
 
#define STRINGBIND   1
 
#define SUCCEED   1
 
#define SYBAOPAVG   0x4f
 
#define SYBAOPAVGU   0x50
 
#define SYBAOPCHECKSUM_AGG   0x72
 
#define SYBAOPCNT   0x4b
 
#define SYBAOPCNT_BIG   0x09
 
#define SYBAOPCNTU   0x4c
 
#define SYBAOPMAX   0x52
 
#define SYBAOPMIN   0x51
 
#define SYBAOPSTDEV   0x30
 
#define SYBAOPSTDEVP   0x31
 
#define SYBAOPSUM   0x4d
 
#define SYBAOPSUMU   0x4e
 
#define SYBAOPVAR   0x32
 
#define SYBAOPVARP   0x33
 
#define SYBBIGDATETIME   SYBBIGDATETIME
 
#define SYBBIGTIME   SYBBIGTIME
 
#define SYBBINARY   SYBBINARY
 
#define SYBBIT   SYBBIT
 
#define SYBBITN   SYBBITN
 
#define SYBCHAR   SYBCHAR
 
#define SYBDATE   SYBDATE
 
#define SYBDATETIME   SYBDATETIME
 
#define SYBDATETIME4   SYBDATETIME4
 
#define SYBDATETIMN   SYBDATETIMN
 
#define SYBDECIMAL   SYBDECIMAL
 
#define SYBEAAMT   20035 /* User attempted a dbaltbind() with mismatched column and variable types. */
 
#define SYBEABMT   20033 /* User attempted a dbbind() with mismatched column and variable types. */
 
#define SYBEABNC   20032 /* Attempt to bind to a non-existent column. */
 
#define SYBEABNP   20034 /* Attempt to bind using NULL pointers. */
 
#define SYBEABNV   20046 /* Attempt to bind to a NULL program variable. */
 
#define SYBEACNV   20148 /* Attemp to do conversion with NULL destination variable. */
 
#define SYBEADST   20128 /* Error in attempting to determine the size of a pair of translation tables. */
 
#define SYBEAICF   20127 /* Error in attempting to install custom format. */
 
#define SYBEALTT   20129 /* Error in attempting to load a pair of translation tables. */
 
#define SYBEAOLF   20133 /* Error in attempting to open a localization file. */
 
#define SYBEAPCT   20130 /* Error in attempting to perform a character-set translation. */
 
#define SYBEAPUT   20040 /* Attempt to print unknown token. */
 
#define SYBEARDI   20134 /* Error in attempting to read datetime information from a localization file. */
 
#define SYBEARDL   20136 /* Error in attempting to read the dblib.loc localization file. */
 
#define SYBEASEC   20091 /* Attempt to send an empty command buffer to the SQL Server. */
 
#define SYBEASNL   20041 /* Attempt to set fields in a null loginrec. */
 
#define SYBEASTF   20089 /* VMS: Unable to setmode for control_c ast. */
 
#define SYBEASTL   20197 /* Synchronous I/O attempted at AST level. */
 
#define SYBEASUL   20043 /* Attempt to set unknown loginrec field. */
 
#define SYBEATTNACK   20296 /* Timed out waiting for server to acknowledge attention." */
 
#define SYBEAUTN   20062 /* Attempt to update the timestamp of a table which has no timestamp column. */
 
#define SYBEBADPK   20201 /* Packet size of %1! not supported. -- size of %2! used instead. */
 
#define SYBEBADTYPE   20254 /* Illegal value for type parameter given to %1!. */
 
#define SYBEBBCI   20068 /* Batch successfully bulk-copied to SQL Server. */
 
#define SYBEBBFL   20297 /* -001- Batch failed in bulk-copy to SQL Server */
 
#define SYBEBBL   20215 /* Bad bindlen parameter passed to dbsetnull() */
 
#define SYBEBCBC   20081 /* bcp_columns() must be called before bcp_colfmt() and bcp_colfmt_ps(). */
 
#define SYBEBCBNPR   20230 /* bcp_bind(): if varaddr is NULL, prefixlen must be 0 and no terminator should be specified. */
 
#define SYBEBCBNTYP   20231 /* bcp_bind(): if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */
 
#define SYBEBCBPREF   20236 /* Illegal prefix length. Legal values are 0, 1, 2 or 4. */
 
#define SYBEBCFO   20082 /* Bcp host-files must contain at least one column. */
 
#define SYBEBCHLEN   20235 /* host_collen should be greater than or equal to -1. */
 
#define SYBEBCIS   20075 /* Attempt to bulk-copy an illegally-sized column value to the SQL Server. */
 
#define SYBEBCIT   20107 /* It's illegal to use BCP terminators with program variables other than SYBCHAR, SYBBINARY, SYBTEXT, or SYBIMAGE. */
 
#define SYBEBCITBLEN   20239 /* bcp_init(): tblname parameter is too long. */
 
#define SYBEBCITBNM   20238 /* bcp_init(): tblname parameter cannot be NULL. */
 
#define SYBEBCMTXT   20228 /* bcp_moretext() may be used only when there is at least one text or image column in the server table. */
 
#define SYBEBCNL   20105 /* Negative length-prefix found in BCP data-file. */
 
#define SYBEBCNN   20073 /* Attempt to bulk-copy a NULL value into Server column %d, which does not accept NULL values. */
 
#define SYBEBCNT   20064 /* Attempt to use Bulk Copy with a non-existent Server table. */
 
#define SYBEBCOR   20074 /* Attempt to bulk-copy an oversized row to the SQL Server. */
 
#define SYBEBCPB   20078 /* bcp_bind(), bcp_moretext() and bcp_sendrow() may NOT be used after bcp_init() has been passed a non-NULL input file name. */
 
#define SYBEBCPCTYP   20233 /* bcp_colfmt(): If table_colnum is 0, host_type cannot be 0. */
 
#define SYBEBCPI   20076 /* bcp_init() must be called before any other bcp routines. */
 
#define SYBEBCPN   20077 /* bcp_bind(), bcp_collen(), bcp_colptr(), bcp_moretext() and bcp_sendrow() may be used only after bcp_init() has been called with the copy direction set to DB_IN. */
 
#define SYBEBCPOPT   20294 /* The option cannot be called while a bulk copy operation is progress. */
 
#define SYBEBCPREC   20229 /* Column %1!: Illegal precision value encountered. */
 
#define SYBEBCPREF   20237 /* Illegal prefix length. Legal values are -1, 0, 1, 2 or 4. */
 
#define SYBEBCRE   20070 /* I/O error while reading bcp data-file. */
 
#define SYBEBCRO   20111 /* The BCP hostfile '%s' contains only %ld rows. It was impossible to read the requested %ld rows. */
 
#define SYBEBCSA   20108 /* The BCP hostfile '%s' contains only %ld rows. Skipping all of these rows is not allowed. */
 
#define SYBEBCSET   20221 /* Unknown character-set encountered." */
 
#define SYBEBCSI   20106 /* Host-file columns may be skipped only when copying INto the Server. */
 
#define SYBEBCSNDROW   20240 /* bcp_sendrow() may NOT be called unless all text data for the previous row has been sent using bcp_moretext(). */
 
#define SYBEBCSNTYP   20232 /* column number %1!: if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */
 
#define SYBEBCUC   20085 /* Bcp: Unable to close host data-file. */
 
#define SYBEBCUO   20084 /* Bcp: Unable to open host data-file. */
 
#define SYBEBCVH   20083 /* bcp_exec() may be called only after bcp_init() has been passed a valid host file. */
 
#define SYBEBCVLEN   20234 /* varlen should be greater than or equal to -1. */
 
#define SYBEBCWE   20072 /* I/O error while writing bcp data-file. */
 
#define SYBEBDIO   20063 /* Bad bulk-copy direction. Must be either IN or OUT. */
 
#define SYBEBEOF   20104 /* Unexpected EOF encountered in BCP data-file. */
 
#define SYBEBIHC   20103 /* Incorrect host-column number found in bcp format-file. */
 
#define SYBEBIVI   20080 /* bcp_columns(), bcp_colfmt() and bcp_colfmt_ps() may be used only after bcp_init() has been passed a valid input file. */
 
#define SYBEBNCR   20024 /* Attempt to bind user variable to a non-existent compute row. */
 
#define SYBEBNUM   20214 /* Bad numbytes parameter passed to dbstrcpy() */
 
#define SYBEBOOL   20293 /* Boolean parameters must be TRUE or FALSE. */
 
#define SYBEBPKS   20193 /* In DBSETLPACKET(), the packet size parameter must be between 0 and 999999. */
 
#define SYBEBPREC   20216 /* Illegal precision specified */
 
#define SYBEBPROBADDEF   20249 /* bcp protocol error: illegal default column id received. */
 
#define SYBEBPROBADLEN   20251 /* bcp protocol error: illegal datatype length received. */
 
#define SYBEBPROBADPREC   20252 /* bcp protocol error: illegal precision value received. */
 
#define SYBEBPROBADSCL   20253 /* bcp protocol error: illegal scale value received. */
 
#define SYBEBPROBADTYP   20250 /* bcp protocol error: unknown column datatype. */
 
#define SYBEBPROCOL   20241 /* bcp protocol error: returned column count differs from the actual number of columns received. */
 
#define SYBEBPRODEF   20242 /* bcp protocol error: expected default information and got none. */
 
#define SYBEBPRODEFID   20244 /* bcp protocol error: default column id and actual column id are not same */
 
#define SYBEBPRODEFTYP   20246 /* bcp protocol error: default value datatype differs from column datatype. */
 
#define SYBEBPROEXTDEF   20247 /* bcp protocol error: more than one row of default information received. */
 
#define SYBEBPROEXTRES   20248 /* bcp protocol error: unexpected set of results received. */
 
#define SYBEBPRONODEF   20245 /* bcp protocol error: default value received for column that does not have default. */
 
#define SYBEBPRONUMDEF   20243 /* bcp protocol error: expected number of defaults differs from the actual number of defaults received. */
 
#define SYBEBRFF   20100 /* I/O error while reading bcp format-file. */
 
#define SYBEBSCALE   20217 /* Illegal scale specified */
 
#define SYBEBTMT   20095 /* Attempt to send too much TEXT data via the bcp_moretext() call. */
 
#define SYBEBTOK   20020 /* Bad token from SQL Server: Data-stream processing out of sync. */
 
#define SYBEBTYP   20023 /* Unknown bind type passed to DB-LIBRARY function. */
 
#define SYBEBTYPSRV   20220 /* Datatype is not supported by the server. */
 
#define SYBEBUCE   20087 /* Bcp: Unable to close error-file. */
 
#define SYBEBUCF   20099 /* Bcp: Unable to close format-file. */
 
#define SYBEBUDF   20102 /* Bcp: Unrecognized datatype found in format-file. */
 
#define SYBEBUFF   20147 /* Bcp: Unable to create format-file. */
 
#define SYBEBUFL   20005 /* DB-LIBRARY internal error - send buffer length corrupted. */
 
#define SYBEBULKINSERT   20599 /* cannot build bulk insert statement */
 
#define SYBEBUOE   20086 /* Bcp: Unable to open error-file. */
 
#define SYBEBUOF   20098 /* Bcp: Unable to open format-file. */
 
#define SYBEBWEF   20088 /* I/O error while writing bcp error-file. */
 
#define SYBEBWFF   20101 /* I/O error while writing bcp format-file. */
 
#define SYBECAP   20203 /* DB-Library capabilities not accepted by the Server. */
 
#define SYBECAPTYP   20213 /* Unexpected capability type in CAPABILITY datastream. */
 
#define SYBECDNS   20031 /* Datastream indicates that a compute column is derived from a non-existent select-list member. */
 
#define SYBECDOMAIN   20218 /* Source field value is not within the domain of legal values. */
 
#define SYBECINTERNAL   20219 /* Internal Conversion error. */
 
#define SYBECLOS   20056 /* Error in closing network connection. */
 
#define SYBECLOSEIN   20292 /* Unable to close interface file. */
 
#define SYBECLPR   20051 /* Data-conversion resulted in loss of precision. */
 
#define SYBECNOR   20026 /* Column number out of range. */
 
#define SYBECNOV   20052 /* Attempt to set variable to NULL resulted in overflow. */
 
#define SYBECOFL   20049 /* Data-conversion resulted in overflow. */
 
#define SYBECOLSIZE   22000 /* Invalid column information structure size */
 
#define SYBECONN   20009 /* Unable to connect socket -- SQL Server is unavailable or does not exist. */
 
#define SYBECRNC   20116 /* The current row is not a result of compute clause %d, so it is illegal to attempt to extract that data from this row. */
 
#define SYBECRSAGR   20263 /* Aggregate functions are not allowed in a cursor statement. */
 
#define SYBECRSBROL   20266 /* Backward scrolling cannot be used in a forward scrolling cursor. */
 
#define SYBECRSBSKEY   20268 /* Keyset cannot be scrolled backward in mixed cursors with a previous fetch type. */
 
#define SYBECRSBUFR   20260 /* Row buffering should not be turned on when using cursor APIs. */
 
#define SYBECRSDIS   20262 /* Cursor statement contains one of the disallowed phrases 'compute', 'union', 'for browse', or 'select into'. */
 
#define SYBECRSFLAST   20265 /* Fetch type LAST requires fully keyset driven cursors. */
 
#define SYBECRSFRAND   20264 /* Fetch types RANDOM and RELATIVE can only be used within the keyset of keyset driven cursors. */
 
#define SYBECRSFROWN   20267 /* Row number to be fetched is outside valid range. */
 
#define SYBECRSFTYPE   20280 /* Unknown fetch type. */
 
#define SYBECRSINV   20277 /* Invalid cursor statement. */
 
#define SYBECRSINVALID   20281 /* The cursor handle is invalid. */
 
#define SYBECRSMROWS   20282 /* Multiple rows are returned, only one is expected. */
 
#define SYBECRSNOBIND   20279 /* Cursor bind must be called prior to updating cursor */
 
#define SYBECRSNOCOUNT   20270 /* The DBNOCOUNT option should not be turned on when doing updates or deletes with dbcursor(). */
 
#define SYBECRSNOFREE   20261 /* The DBNOAUTOFREE option should not be turned on when using cursor APIs. */
 
#define SYBECRSNOIND   20256 /* One of the tables involved in the cursor statement does not have a unique index. */
 
#define SYBECRSNOKEYS   20278 /* The entire keyset must be defined for KEYSET cursors. */
 
#define SYBECRSNOLEN   20284 /* No unique index found. */
 
#define SYBECRSNOPTCC   20285 /* No OPTCC was found. */
 
#define SYBECRSNORDER   20286 /* The order of clauses must be from, where, and order by. */
 
#define SYBECRSNORES   20255 /* Cursor statement generated no results. */
 
#define SYBECRSNOTABLE   20287 /* Table name is NULL. */
 
#define SYBECRSNOUPD   20276 /* Update or delete operation did not affect any rows. */
 
#define SYBECRSNOWHERE   20273 /* A WHERE clause is not allowed in a cursor update or insert. */
 
#define SYBECRSNROWS   20283 /* No rows returned, at least one is expected. */
 
#define SYBECRSNUNIQUE   20288 /* No unique keys associated with this view. */
 
#define SYBECRSORD   20259 /* Only fully keyset driven cursors can have 'order by', ' group by', or 'having' phrases. */
 
#define SYBECRSRO   20269 /* Data locking or modifications cannot be made in a READONLY cursor. */
 
#define SYBECRSSET   20274 /* A SET clause is required for a cursor update or insert. */
 
#define SYBECRSTAB   20271 /* Table name must be determined in operations involving data locking or modifications. */
 
#define SYBECRSUPDNB   20272 /* Update or insert operations cannot use bind variables when binding type is NOBIND. */
 
#define SYBECRSUPDTAB   20275 /* Update or insert operations using bind variables require single table cursors. */
 
#define SYBECRSVAR   20289 /* There is no valid address associated with this bind. */
 
#define SYBECRSVIEW   20257 /* A view cannot be joined with another table or a view in a cursor statement. */
 
#define SYBECRSVIIND   20258 /* The view used in the cursor statement does not include all the unique index columns of the underlying tables. */
 
#define SYBECS   20299 /* -004- cs context Error */
 
#define SYBECSYN   20050 /* Attempt to convert data stopped by syntax error in source field. */
 
#define SYBECUFL   20048 /* Data-conversion resulted in underflow. */
 
#define SYBECWLL   20123 /* Attempt to set column width less than 1. */
 
#define SYBEDBPS   20011 /* Maximum number of DBPROCESSes already allocated. */
 
#define SYBEDCL   20298 /* -004- DCL Error */
 
#define SYBEDDNE   20047 /* DBPROCESS is dead or not enabled. */
 
#define SYBEDIVZ   20196 /* Attempt to divide by $0.00 in function %1!. */
 
#define SYBEDNTI   20094 /* Attempt to use dbtxtsput() to put a new text-timestamp into a column whose datatype is neither SYBTEXT nor SYBIMAGE. */
 
#define SYBEDPOR   20149 /* Out-of-range datepart constant. */
 
#define SYBEDVOR   20152 /* Day values must be between 1 and 7. */
 
#define SYBEECAN   20184 /* Attempted to cancel unrequested event notification. */
 
#define SYBEECRT   20183 /* Must call dbregdefine() before dbregcreate(). */
 
#define SYBEEINI   20182 /* Must call dbreginit() before dbregraise(). */
 
#define SYBEEQVA   20059 /* Error in queueing VMS AST routine. */
 
#define SYBEERRLABEL   20295 /* An illegal value was returned from the security label handler. */
 
#define SYBEESSL   20172 /* Login security level entered does not agree with operating system level */
 
#define SYBEETD   20164 /* Failure to send the expected amount of TEXT or IMAGE data via dbmoretext(). */
 
#define SYBEEUNR   20185 /* Unsolicited event notification received. */
 
#define SYBEEVOP   20178 /* Called dbregwatch() with a bad options parameter. */
 
#define SYBEEVST   20181 /* Must initiate a transaction before calling dbregparam(). */
 
#define SYBEFCON   20002 /* SQL Server connection failed. */
 
#define SYBEFENC   20222 /* Password Encryption failed." */
 
#define SYBEFGTL   20122 /* Bcp: Row number of the first row to be copied cannot be greater than the row number for the last row to be copied. */
 
#define SYBEFMODE   20167 /* Read/Write/Append mode denied on file. */
 
#define SYBEFRES   20223 /* Challenge-Response function failed.", */
 
#define SYBEFSHD   20132 /* Error in attempting to find the Sybase home directory. */
 
#define SYBEFUNC   20204 /* Functionality not supported at the specified version level. */
 
#define SYBEGENOS   20161 /* General Operating System Error. */
 
#define SYBEICN   20038 /* Invalid computeid or compute column number. */
 
#define SYBEICONV2BIG   2404 /* Buffer overflow converting characters from client into server's character set.*/
 
#define SYBEICONVAVAIL   2401 /* Character set conversion is not available between client character set '%.*s' and server character set '%.*s'.*/
 
#define SYBEICONVI   2403 /* Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?').*/
 
#define SYBEICONVIU   2400 /* Some character(s) could not be converted into client's character set. */
 
#define SYBEICONVO   2402 /* Error converting characters into server's character set. Some character(s) could not be converted.*/
 
#define SYBEIDCL   20143 /* Illegal datetime column length returned by DataServer. Legal datetime lengths are 4 and 8 bytes. */
 
#define SYBEIDECCL   20227 /* Invalid decimal column length returned by the server. */
 
#define SYBEIFCL   20145 /* Illegal floating-point column length returned by DataServer. Legal floating-point lengths are 4 and 8 bytes. */
 
#define SYBEIFNB   20065 /* Illegal field number passed to bcp_control(). */
 
#define SYBEIICL   20025 /* Illegal integer column length returned by SQL Server. Legal integer lengths are 1, 2, and 4 bytes. */
 
#define SYBEIMCL   20144 /* Illegal money column length returned by DataServer. Legal money lengths are 4 and 8 bytes. */
 
#define SYBEINLN   20016 /* Interface file: unexpected end-of-line. */
 
#define SYBEINTF   20012 /* Server name not found in interface file */
 
#define SYBEINUMCL   20226 /* Invalid numeric column length returned by the server. */
 
#define SYBEIPV   20194 /* %1! is an illegal value for the %2! parameter of %3!. */
 
#define SYBEISOI   20142 /* Invalid sort-order information found. */
 
#define SYBEISRVPREC   20224 /* Illegal precision value returned by the server. */
 
#define SYBEISRVSCL   20225 /* Illegal scale value returned by the server. */
 
#define SYBEITIM   20021 /* Illegal timeout value specified. */
 
#define SYBEIVERS   20206 /* Illegal version level specified. */
 
#define SYBEKBCI   20069 /* Bcp: 1000 rows sent to SQL Server. */
 
#define SYBEKBCO   20067 /* 1000 rows successfully bulk-copied to host-file. */
 
#define SYBELBLEN   20211 /* Security labels should be less than 256 characters long. */
 
#define SYBEMEM   20010 /* Unable to allocate sufficient memory */
 
#define SYBEMOV   20195 /* Money arithmetic resulted in overflow in function %1!. */
 
#define SYBEMPLL   20112 /* Attempt to set maximum number of DBPROCESSes lower than 1. */
 
#define SYBEMVOR   20151 /* Month values must be between 1 and 12. */
 
#define SYBENBUF   20175 /* called dbsendpassthru() with a NULL buf pointer. */
 
#define SYBENBVP   20153 /* Cannot pass dbsetnull() a NULL bindval pointer. */
 
#define SYBENDC   20150 /* Cannot have negative component in date in numeric form. */
 
#define SYBENDTP   20155 /* Called dbdatecrack() with a NULL datetime parameter. */
 
#define SYBENEG   20210 /* Negotiated login attempt failed. */
 
#define SYBENEHA   20179 /* Called dbreghandle() with a NULL handler parameter. */
 
#define SYBENHAN   20174 /* called dbrecvpassthru() with a NULL handler parameter. */
 
#define SYBENLNL   20173 /* Program not linked with specified network library. */
 
#define SYBENMOB   20039 /* No such member of 'order by' clause. */
 
#define SYBENOEV   20200 /* dbpoll() cannot be called if registered procedure notifications have been disabled. */
 
#define SYBENOTI   20177 /* No event handler installed. */
 
#define SYBENOVALUE   20290 /* Security labels require both a name and a value */
 
#define SYBENPRM   20027 /* NULL parameter not allowed for this dboption. */
 
#define SYBENSIP   20045 /* Negative starting index passed to dbstrcpy(). */
 
#define SYBENTLL   20042 /* Name too long for loginrec field. */
 
#define SYBENTST   20170 /* The file being opened must be a stream_lf. */
 
#define SYBENTTN   20093 /* Attempt to use dbtxtsput() to put a new text-timestamp into a non-existent data row. */
 
#define SYBENULL   20109 /* NULL DBPROCESS pointer passed to DB-Library. */
 
#define SYBENULP   20176 /* Called %s with a NULL %s parameter. */
 
#define SYBENUM   20159 /* Incorrect number of arguments given to DB-Library. */
 
#define SYBENXID   20036 /* The Server did not grant us a distributed-transaction ID. */
 
#define SYBEONCE   20207 /* Function can be called only once. */
 
#define SYBEOOB   20022 /* Error in sending out-of-band data to SQL Server. */
 
#define SYBEOPIN   20015 /* Could not open interface file. */
 
#define SYBEOPNA   20121 /* The text/image facility is available only when using a SQL Server whose version number is 4.0 or greater. */
 
#define SYBEOPTNO   20163 /* Option is not allowed or is unreconized */
 
#define SYBEOREN   20141 /* Warning: an out-of-range error-number was encountered in dblib.loc. The maximum permissible error-number is defined as DBERRCOUNT in sybdb.h. */
 
#define SYBEORPF   20096 /* Attempt to set remote password would overflow the login-record's remote-password field. */
 
#define SYBEOSSL   20171 /* Operating system login level not in range of Secure SQL Server */
 
#define SYBEPAGE   20162 /* wrong resource type or length given for dbpage() operation. */
 
#define SYBEPOLL   20199 /* Only one dbpoll() can be active at a time. */
 
#define SYBEPORT   2500 /* Both port and instance specified */
 
#define SYBEPRTF   20191 /* dbtracestring() may only be called from a printfunc(). */
 
#define SYBEPWD   20014 /* Incorrect password. */
 
#define SYBERDCN   20053 /* Requested data-conversion does not exist. */
 
#define SYBERDNR   20044 /* Attempt to retrieve data from a non-existent row. */
 
#define SYBEREAD   20004 /* Read from SQL Server failed. */
 
#define SYBERESP   20205 /* Response function address passed to dbresponse() must be non-NULL. */
 
#define SYBERFILE   20166 /* "Can not open resource file." */
 
#define SYBERPCS   20186 /* Must call dbrpcinit() before dbrpcparam(). */
 
#define SYBERPIL   20113 /* It is illegal to pass -1 to dbrpcparam() for the datalen of parameters which are of type SYBCHAR, SYBVARCHAR, SYBBINARY, or SYBVARBINARY. */
 
#define SYBERPNA   20120 /* The RPC facility is available only when using a SQL Server whose version number is 4.0 or greater. */
 
#define SYBERPND   20019 /* Attempt to initiate a new SQL Server operation with results pending. */
 
#define SYBERPNULL   20208 /* value parameter for dbprcparam() can be NULL, only if the datalen parameter is 0 */
 
#define SYBERPTXTIM   20209 /* RPC parameters cannot be of type Text/Image. */
 
#define SYBERPUL   20114 /* When passing a SYBINTN, SYBDATETIMN, SYBMONEYN, or SYBFLTN parameter via dbrpcparam(), it's necessary to specify the parameter's maximum or actual length, so that DB-Library can recognize it as a SYBINT1, SYBINT2, SYBINT4, SYBMONEY, or SYBMONEY4, etc. */
 
#define SYBERTCC   20117 /* dbreadtext() may not be used to receive the results of a query which contains a COMPUTE clause. */
 
#define SYBERTSC   20118 /* dbreadtext() may only be used to receive the results of a query which contains a single result column. */
 
#define SYBERTYPE   20165 /* Invalid resource type given to DB-Library. */
 
#define SYBERXID   20037 /* The Server did not recognize our distributed-transaction ID. */
 
#define SYBESECURE   20202 /* Secure Server function not supported in this version. */
 
#define SYBESEFA   20198 /* DBSETNOTIFS cannot be called if connections are present. */
 
#define SYBESEOF   20017 /* Unexpected EOF from SQL Server. */
 
#define SYBESFOV   20054 /* dbsafestr() overflowed its destination buffer. */
 
#define SYBESLCT   20168 /* Could not select or copy field specified */
 
#define SYBESMSG   20018 /* General SQL Server error: Check messages from the SQL Server. */
 
#define SYBESOCK   20008 /* Unable to open socket */
 
#define SYBESPID   20154 /* Called dbspid() with a NULL dbproc. */
 
#define SYBESYNC   20001 /* Read attempted while out of synchronization with SQL Server. */
 
#define SYBETDSVER   2410 /* Cannot bcp with TDSVER < 5.0 */
 
#define SYBETEXS   20188 /* Called dbmoretext() with a bad size parameter. */
 
#define SYBETIME   20003 /* SQL Server connection timed out. */
 
#define SYBETMCF   20126 /* Attempt to install too many custom formats via dbfmtinstall(). */
 
#define SYBETMTD   20092 /* Attempt to send too much TEXT data via the dbmoretext() call. */
 
#define SYBETPAR   20187 /* No SYBTEXT or SYBIMAGE parameters were defined. */
 
#define SYBETPTN   20071 /* Syntax error: only two periods are permitted in table names. */
 
#define SYBETRAC   20189 /* Attempted to turn off a trace flag that was not on. */
 
#define SYBETRAN   20180 /* DBPROCESS is being used for another transaction. */
 
#define SYBETRAS   20190 /* DB-Library internal error - trace structure not found. */
 
#define SYBETRSN   20192 /* Bad numbytes parameter passed to dbtracestring(). */
 
#define SYBETSIT   20061 /* Attempt to call dbtsput() with an invalid timestamp. */
 
#define SYBETTS   20066 /* The table which bulk-copy is attempting to copy to a host-file is shorter than the number of rows which bulk-copy was instructed to skip. */
 
#define SYBETYPE   20160 /* Invalid argument type given to DB-Library. */
 
#define SYBEUACS   20090 /* VMS: Unable to assign channel to sys$command. */
 
#define SYBEUAVE   20057 /* Unable to allocate VMS event flag. */
 
#define SYBEUCPT   20125 /* Unrecognized custom-format parameter-type encountered in dbstrbuild(). */
 
#define SYBEUCRR   20119 /* Internal software error: Unknown connection result reported by * dbpasswd(). */
 
#define SYBEUDTY   20060 /* Unknown datatype encountered. */
 
#define SYBEUFDS   20124 /* Unrecognized format encountered in dbstrbuild(). */
 
#define SYBEUFDT   20029 /* Unknown fixed-length datatype encountered. */
 
#define SYBEUHST   20013 /* Unknown host machine name */
 
#define SYBEUMSG   20212 /* Unknown message-id in MSG datastream. */
 
#define SYBEUNAM   20110 /* Unable to get current username from operating system. */
 
#define SYBEUNOP   20115 /* Unknown option passed to dbsetopt(). */
 
#define SYBEUNT   20055 /* Unknown network type found in interface file. */
 
#define SYBEURCI   20135 /* Unable to read copyright information from the dblib localization file. */
 
#define SYBEUREI   20140 /* Unable to read error information from the dblib localization file. */
 
#define SYBEUREM   20138 /* Unable to read error mnemonic from the dblib localization file. */
 
#define SYBEURES   20139 /* Unable to read error string from the dblib localization file. */
 
#define SYBEURMI   20137 /* Unable to read money-format information from the dblib localization file. */
 
#define SYBEUSCT   20058 /* Unable to set communications timer. */
 
#define SYBEUTDS   20146 /* Unrecognized TDS version received from SQL Server. */
 
#define SYBEUVBF   20097 /* Attempt to read an unknown version of BCP format-file. */
 
#define SYBEUVDT   20028 /* Unknown variable-length datatype encountered. */
 
#define SYBEVDPT   20079 /* For bulk copy, all variable-length data must have either a length-prefix or a terminator specified. */
 
#define SYBEVERDOWN   100 /* TDS version downgraded . */
 
#define SYBEVMS   20007 /* Sendflush: VMS I/O error. */
 
#define SYBEVOIDRET   20291 /* Parameter of type SYBVOID cannot be a return parameter. */
 
#define SYBEWAID   20030 /* DB-LIBRARY internal error: ALTFMT following ALTNAME has wrong id. */
 
#define SYBEWRIT   20006 /* Write to SQL Server failed. */
 
#define SYBEXOCI   20131 /* A character-set translation overflowed its destination buffer while using bcp to copy data from a host-file to the SQL Server. */
 
#define SYBEXTDN   20157 /* Warning: the xlt_todisp parameter to dbfree_xlate() was NULL. The space associated with the xlt_tosrv parameter has been freed. */
 
#define SYBEXTN   20156 /* The xlt_todisp and xlt_tosrv parameters to dbfree_xlate() were NULL. */
 
#define SYBEXTSN   20158 /* Warning: the xlt_tosrv parameter to dbfree_xlate() was NULL. The space associated with the xlt_todisp parameter has been freed. */
 
#define SYBEZTXT   20169 /* Attempt to send zero length TEXT or IMAGE to dataserver via dbwritetext(). */
 
#define SYBFLT8   SYBFLT8
 
#define SYBFLTN   SYBFLTN
 
#define SYBIMAGE   SYBIMAGE
 
#define SYBINT1   SYBINT1
 
#define SYBINT2   SYBINT2
 
#define SYBINT4   SYBINT4
 
#define SYBINT8   SYBINT8
 
#define SYBINTN   SYBINTN
 
#define SYBMONEY   SYBMONEY
 
#define SYBMONEY4   SYBMONEY4
 
#define SYBMONEYN   SYBMONEYN
 
#define SYBMSDATE   SYBMSDATE
 
#define SYBMSDATETIME2   SYBMSDATETIME2
 
#define SYBMSDATETIMEOFFSET   SYBMSDATETIMEOFFSET
 
#define SYBMSTIME   SYBMSTIME
 
#define SYBNTEXT   SYBNTEXT
 
#define SYBNUMERIC   SYBNUMERIC
 
#define SYBNVARCHAR   SYBNVARCHAR
 
#define SYBREAL   SYBREAL
 
#define SYBTEXT   SYBTEXT
 
#define SYBTIME   SYBTIME
 
#define SYBVARBINARY   SYBVARBINARY
 
#define SYBVARCHAR   SYBVARCHAR
 
#define SYBVOID   SYBVOID
 
#define TDS_STATIC_CAST(type, a)   ((type)(a))
 
#define TIMEBIND   22
 
#define TINYBIND   6
 
#define TRUE   1
 
#define VARYBINBIND   4
 
#define VARYCHARBIND   3
 

Typedefs

typedef int BOOL
 
typedef unsigned char BYTE
 
typedef DBWAITFUNC(* DB_DBBUSY_FUNC) (void *dbproc)
 
typedef int(* DB_DBCHKINTR_FUNC) (void *dbproc)
 
typedef int(* DB_DBHNDLINTR_FUNC) (void *dbproc)
 
typedef void(* DB_DBIDLE_FUNC) (DBWAITFUNC dfunc, void *dbproc)
 
typedef int64_t DBBIGINT
 
typedef unsigned char DBBINARY
 
typedef unsigned char DBBIT
 
typedef unsigned char DBBOOL
 
typedef char DBCHAR
 
typedef void DBCURSOR
 
typedef struct tds_sybase_dbdaterec DBDATEREC
 
typedef struct tds_sybase_dbdaterec2 DBDATEREC2
 
typedef DBNUMERIC DBDECIMAL
 
typedef tds_sysdep_real64_type DBFLT8
 
typedef int32_t DBINT
 
typedef void DBLOGINFO
 
typedef void(* DBPIVOT_FUNC) (struct col_t *output, const struct col_t *input)
 
typedef struct tds_dblib_dbprocess DBPROCESS
 
typedef tds_sysdep_real32_type DBREAL
 
typedef int16_t DBSMALLINT
 
typedef void DBSORTORDER
 
typedef struct dbstring DBSTRING
 
typedef unsigned char DBTINYINT
 
typedef struct dbtypeinfo DBTYPEINFO
 
typedef uint64_t DBUBIGINT
 
typedef uint32_t DBUINT
 
typedef uint16_t DBUSMALLINT
 
typedef void * DBVOIDPTR
 
typedef int(* DBWAITFUNC) (void)
 
typedef void DBXLATE
 
typedef int(* EHANDLEFUNC) (DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
 
typedef int(* INTFUNCPTR) (void *,...)
 
typedef struct tds_dblib_loginrec LOGINREC
 
typedef int(* MHANDLEFUNC) (DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *proc, int line)
 
typedef int RETCODE
 
typedef short SHORT
 
typedef int STATUS
 
typedef unsigned short USHORT
 

Enumerations

enum  {
  OPT_VERSION = 0x01, OPT_TIMER = 0x02, OPT_NOFOOTER = 0x04, OPT_NOHEADER = 0x08,
  OPT_QUIET = 0x10, OPT_VERBOSE = 0x20, OPT_INSTANCES = 0x40, POS_ISO1,
  POS_UTF8, POS_UCS2LE, POS_UCS2BE, MUL_STARTED = 1,
  ASN1_SEQUENCE = ASN1_TAG_SEQUENCE, CS_USERNAME = 9100, CS_USERNAME = 9100, CS_PASSWORD = 9101,
  CS_PASSWORD = 9101, CS_APPNAME = 9102, CS_APPNAME = 9102, CS_HOSTNAME = 9103,
  CS_HOSTNAME = 9103, CS_LOGIN_STATUS = 9104, CS_LOGIN_STATUS = 9104, CS_TDS_VERSION = 9105,
  CS_TDS_VERSION = 9105, CS_CHARSETCNV = 9106, CS_CHARSETCNV = 9106, CS_PACKETSIZE = 9107,
  CS_PACKETSIZE = 9107, CS_USERDATA = 9108, CS_USERDATA = 9108, CS_NETIO = 9110,
  CS_NETIO = 9110, CS_TEXTLIMIT = 9112, CS_TEXTLIMIT = 9112, CS_HIDDEN_KEYS = 9113,
  CS_HIDDEN_KEYS = 9113, CS_VERSION = 9114, CS_VERSION = 9114, CS_IFILE = 9115,
  CS_IFILE = 9115, CS_LOGIN_TIMEOUT = 9116, CS_LOGIN_TIMEOUT = 9116, CS_TIMEOUT = 9117,
  CS_TIMEOUT = 9117, CS_MAX_CONNECT = 9118, CS_MAX_CONNECT = 9118, CS_EXPOSE_FMTS = 9120,
  CS_EXPOSE_FMTS = 9120, CS_EXTRA_INF = 9121, CS_EXTRA_INF = 9121, CS_ANSI_BINDS = 9123,
  CS_ANSI_BINDS = 9123, CS_BULK_LOGIN = 9124, CS_BULK_LOGIN = 9124, CS_LOC_PROP = 9125,
  CS_LOC_PROP = 9125, CS_PARENT_HANDLE = 9130, CS_PARENT_HANDLE = 9130, CS_EED_CMD = 9131,
  CS_EED_CMD = 9131, CS_DIAG_TIMEOUT = 9132, CS_DIAG_TIMEOUT = 9132, CS_DISABLE_POLL = 9133,
  CS_DISABLE_POLL = 9133, CS_SEC_ENCRYPTION = 9135, CS_SEC_ENCRYPTION = 9135, CS_SEC_CHALLENGE = 9136,
  CS_SEC_CHALLENGE = 9136, CS_SEC_NEGOTIATE = 9137, CS_SEC_NEGOTIATE = 9137, CS_CON_STATUS = 9143,
  CS_CON_STATUS = 9143, CS_VER_STRING = 9144, CS_VER_STRING = 9144, CS_SERVERNAME = 9146,
  CS_SERVERNAME = 9146, CS_SEC_APPDEFINED = 9149, CS_SEC_APPDEFINED = 9149, CS_STICKY_BINDS = 9151,
  CS_STICKY_BINDS = 9151, CS_SEC_NETWORKAUTH = 9175, CS_SEC_NETWORKAUTH = 9175, CS_SEC_DELEGATION = 9176,
  CS_SEC_DELEGATION = 9176, CS_SEC_MUTUALAUTH = 9177, CS_SEC_MUTUALAUTH = 9177, CS_SEC_SERVERPRINCIPAL = 9188,
  CS_SEC_SERVERPRINCIPAL = 9188, CS_SERVERADDR = 9206, CS_SERVERADDR = 9206, CS_PORT = 9300,
  CS_PORT = 9300, CS_CLIENTCHARSET = 9301, CS_CLIENTCHARSET = 9301, CS_DATABASE,
  dblib_msdblib = 0, TDS_CHARSET_ISO_8859_1 = 0, TDS_CHARSET_UTF_8 = 1, TDS_CHARSET_UCS_2LE = 2,
  TDS_CHARSET_UCS_2BE = 3, TDS_CHARSET_ARMSCII_8 = 4, TDS_CHARSET_BIG_5 = 5, TDS_CHARSET_BIG5_HKSCS = 6,
  TDS_CHARSET_C99 = 7, TDS_CHARSET_CHINESE = 8, TDS_CHARSET_CN = 9, TDS_CHARSET_CN_GB = 10,
  TDS_CHARSET_CN_GB_ISOIR165 = 11, TDS_CHARSET_CP1133 = 12, TDS_CHARSET_CP1250 = 13, TDS_CHARSET_CP1251 = 14,
  TDS_CHARSET_CP1252 = 15, TDS_CHARSET_CP1253 = 16, TDS_CHARSET_CP1254 = 17, TDS_CHARSET_CP1255 = 18,
  TDS_CHARSET_CP1256 = 19, TDS_CHARSET_CP1257 = 20, TDS_CHARSET_CP1258 = 21, TDS_CHARSET_CP1361 = 22,
  TDS_CHARSET_CP437 = 23, TDS_CHARSET_CP850 = 24, TDS_CHARSET_CP862 = 25, TDS_CHARSET_CP866 = 26,
  TDS_CHARSET_CP874 = 27, TDS_CHARSET_CP932 = 28, TDS_CHARSET_CP936 = 29, TDS_CHARSET_CP949 = 30,
  TDS_CHARSET_CP950 = 31, TDS_CHARSET_EUC_JP = 32, TDS_CHARSET_EUC_KR = 33, TDS_CHARSET_EUC_TW = 34,
  TDS_CHARSET_GB18030 = 35, TDS_CHARSET_GEORGIAN_ACADEMY = 36, TDS_CHARSET_GEORGIAN_PS = 37, TDS_CHARSET_HZ = 38,
  TDS_CHARSET_ISO_2022_CN = 39, TDS_CHARSET_ISO_2022_CN_EXT = 40, TDS_CHARSET_ISO_2022_JP = 41, TDS_CHARSET_ISO_2022_JP_1 = 42,
  TDS_CHARSET_ISO_2022_JP_2 = 43, TDS_CHARSET_ISO_2022_KR = 44, TDS_CHARSET_ISO_8859_10 = 45, TDS_CHARSET_ISO_8859_13 = 46,
  TDS_CHARSET_ISO_8859_14 = 47, TDS_CHARSET_ISO_8859_15 = 48, TDS_CHARSET_ISO_8859_16 = 49, TDS_CHARSET_ISO_8859_2 = 50,
  TDS_CHARSET_ISO_8859_3 = 51, TDS_CHARSET_ISO_8859_4 = 52, TDS_CHARSET_ISO_8859_5 = 53, TDS_CHARSET_ISO_8859_6 = 54,
  TDS_CHARSET_ISO_8859_7 = 55, TDS_CHARSET_ISO_8859_8 = 56, TDS_CHARSET_ISO_8859_9 = 57, TDS_CHARSET_ISO_IR_14 = 58,
  TDS_CHARSET_ISO_IR_149 = 59, TDS_CHARSET_ISO_IR_159 = 60, TDS_CHARSET_ISO_IR_166 = 61, TDS_CHARSET_ISO_IR_87 = 62,
  TDS_CHARSET_JAVA = 63, TDS_CHARSET_JISX0201_1976 = 64, TDS_CHARSET_KOI8_R = 65, TDS_CHARSET_KOI8_RU = 66,
  TDS_CHARSET_KOI8_T = 67, TDS_CHARSET_KOI8_U = 68, TDS_CHARSET_MAC = 69, TDS_CHARSET_MACARABIC = 70,
  TDS_CHARSET_MACCENTRALEUROPE = 71, TDS_CHARSET_MACCROATIAN = 72, TDS_CHARSET_MACCYRILLIC = 73, TDS_CHARSET_MACGREEK = 74,
  TDS_CHARSET_MACHEBREW = 75, TDS_CHARSET_MACICELAND = 76, TDS_CHARSET_MACROMANIA = 77, TDS_CHARSET_MACTHAI = 78,
  TDS_CHARSET_MACTURKISH = 79, TDS_CHARSET_MACUKRAINE = 80, TDS_CHARSET_MULELAO_1 = 81, TDS_CHARSET_NEXTSTEP = 82,
  TDS_CHARSET_ROMAN8 = 83, TDS_CHARSET_SJIS = 84, TDS_CHARSET_TCVN = 85, TDS_CHARSET_UCS_4BE = 86,
  TDS_CHARSET_UCS_4LE = 87, TDS_CHARSET_US_ASCII = 88, TDS_CHARSET_UTF_16BE = 89, TDS_CHARSET_UTF_16LE = 90,
  TDS_CHARSET_UTF_32BE = 91, TDS_CHARSET_UTF_32LE = 92, TDS_CHARSET_UTF_7 = 93, TDS_CHARSET_VISCII = 94,
  TDS_NUM_CHARSETS = 95, ODBC_PARAM_SIZE, TDS_OPT_ARITHOVERFLOW = 0x01, TDS_OPT_NUMERICTRUNC = 0x02,
  TDS_CUR_ISTAT_UNUSED = 0x00, TDS_CUR_ISTAT_DECLARED = 0x01, TDS_CUR_ISTAT_OPEN = 0x02, TDS_CUR_ISTAT_CLOSED = 0x04,
  TDS_CUR_ISTAT_RDONLY = 0x08, TDS_CUR_ISTAT_UPDATABLE = 0x10, TDS_CUR_ISTAT_ROWCNT = 0x20, TDS_CUR_ISTAT_DEALLOC = 0x40,
  SYBCHAR = 47, SYBCHAR = 47, SYBVARCHAR = 39, SYBVARCHAR = 39,
  SYBINTN = 38, SYBINTN = 38, SYBINT1 = 48, SYBINT1 = 48,
  SYBINT2 = 52, SYBINT2 = 52, SYBINT4 = 56, SYBINT4 = 56,
  SYBINT8 = 127, SYBINT8 = 127, SYBFLT8 = 62, SYBFLT8 = 62,
  SYBDATETIME = 61, SYBDATETIME = 61, SYBBIT = 50, SYBBIT = 50,
  SYBBITN = 104, SYBBITN = 104, SYBTEXT = 35, SYBTEXT = 35,
  SYBNTEXT = 99, SYBNTEXT = 99, SYBIMAGE = 34, SYBIMAGE = 34,
  SYBMONEY4 = 122, SYBMONEY4 = 122, SYBMONEY = 60, SYBMONEY = 60,
  SYBDATETIME4 = 58, SYBDATETIME4 = 58, SYBREAL = 59, SYBREAL = 59,
  SYBBINARY = 45, SYBBINARY = 45, SYBVOID = 31, SYBVOID = 31,
  SYBVARBINARY = 37, SYBVARBINARY = 37, SYBNUMERIC = 108, SYBNUMERIC = 108,
  SYBDECIMAL = 106, SYBDECIMAL = 106, SYBFLTN = 109, SYBFLTN = 109,
  SYBMONEYN = 110, SYBMONEYN = 110, SYBDATETIMN = 111, SYBDATETIMN = 111,
  SYBNVARCHAR = 103, SYBNVARCHAR = 103, SYBDATE = 49, SYBDATE = 49,
  SYBTIME = 51, SYBTIME = 51, SYBBIGDATETIME = 187, SYBBIGDATETIME = 187,
  SYBBIGTIME = 188, SYBBIGTIME = 188, SYBMSDATE = 40, SYBMSDATE = 40,
  SYBMSTIME = 41, SYBMSTIME = 41, SYBMSDATETIME2 = 42, SYBMSDATETIME2 = 42,
  SYBMSDATETIMEOFFSET = 43, SYBMSDATETIMEOFFSET = 43
}
 
enum  {
  hash_len = 20, CS_ADD = 1, CS_SUB, CS_MULT,
  CS_DIV, TDS_SMP_SYN = 1, TDS_SMP_ACK = 2, TDS_SMP_FIN = 4,
  TDS_SMP_DATA = 8, TDS_TYPEFLAG_INVALID = 0, TDS_TYPEFLAG_NULLABLE = 1, TDS_TYPEFLAG_FIXED = 2,
  TDS_TYPEFLAG_VARIABLE = 4, TDS_TYPEFLAG_COLLATE = 8, TDS_TYPEFLAG_ASCII = 16, TDS_TYPEFLAG_UNICODE = 32,
  TDS_TYPEFLAG_BINARY = 64, TDS_TYPEFLAG_DATETIME = 128, TDS_TYPEFLAG_NUMERIC = 256, TDS_TYPEFLAG_VARIANT = 512,
  MAXCOLNAMELEN = 512
}
 
enum  CI_TYPE { CI_REGULAR =1, CI_ALTERNATE =2, CI_CURSOR =3 }
 

Functions

DBINT bcp_batch (DBPROCESS *dbproc)
 Commit a set of rows to the table. More...
 
RETCODE bcp_bind (DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int type, int table_column)
 Bind a program host variable to a database column. More...
 
RETCODE bcp_colfmt (DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int colnum)
 Specify the format of a datafile prior to writing to a table. More...
 
RETCODE bcp_colfmt_ps (DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int colnum, DBTYPEINFO *typeinfo)
 Specify the format of a host file for bulk copy purposes, with precision and scale support for numeric and decimal columns. More...
 
RETCODE bcp_collen (DBPROCESS *dbproc, DBINT varlen, int table_column)
 Set the length of a host variable to be written to a table. More...
 
RETCODE bcp_colptr (DBPROCESS *dbproc, BYTE *colptr, int table_column)
 Override bcp_bind() by pointing to a different host variable. More...
 
RETCODE bcp_columns (DBPROCESS *dbproc, int host_colcount)
 Indicate how many columns are to be found in the datafile. More...
 
RETCODE bcp_control (DBPROCESS *dbproc, int field, DBINT value)
 Set BCP options for uploading a datafile. More...
 
DBINT bcp_done (DBPROCESS *dbproc)
 Conclude the transfer of data from program variables. More...
 
RETCODE bcp_exec (DBPROCESS *dbproc, DBINT *rows_copied)
 Write a datafile to a table. More...
 
int bcp_getbatchsize (DBPROCESS *dbproc)
 
DBBOOL bcp_getl (LOGINREC *login)
 See if BCP_SETL() was used to set the LOGINREC for BCP work. More...
 
RETCODE bcp_init (DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
 Prepare for bulk copy operation on a table. More...
 
RETCODE bcp_options (DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
 Set "hints" for uploading a file. More...
 
RETCODE bcp_readfmt (DBPROCESS *dbproc, const char filename[])
 Read a format definition file. More...
 
RETCODE bcp_sendrow (DBPROCESS *dbproc)
 Write data in host variables to the table. More...
 
const char * dbacolname (DBPROCESS *dbproc, int computeid, int column)
 Return name of a computed result column. More...
 
BYTE * dbadata (DBPROCESS *dbproc, int computeid, int column)
 Get address of compute column data. More...
 
DBINT dbadlen (DBPROCESS *dbproc, int computeid, int column)
 Get size of data in a compute column. More...
 
RETCODE dbaltbind (DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
 Bind a compute column to a program variable. More...
 
RETCODE dbaltbind_ps (DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr, DBTYPEINFO *typeinfo)
 
int dbaltcolid (DBPROCESS *dbproc, int computeid, int column)
 Get column ID of a compute column. More...
 
DBINT dbaltlen (DBPROCESS *dbproc, int computeid, int column)
 Get size of data in compute column. More...
 
int dbaltop (DBPROCESS *dbproc, int computeid, int column)
 Get aggregation operator for a compute column. More...
 
int dbalttype (DBPROCESS *dbproc, int computeid, int column)
 Get datatype for a compute column. More...
 
DBINT dbaltutype (DBPROCESS *dbproc, int computeid, int column)
 Get user-defined datatype of a compute column. More...
 
RETCODE dbanullbind (DBPROCESS *dbprocess, int computeid, int column, DBINT *indicator)
 Tie a null-indicator to a compute result column. More...
 
RETCODE dbanydatecrack (DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
 Break any kind of date or time value into useful pieces. More...
 
RETCODE dbbind (DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
 Tie a host variable to a resultset column. More...
 
RETCODE dbbind_ps (DBPROCESS *dbprocess, int column, int vartype, DBINT varlen, BYTE *varaddr, DBTYPEINFO *typeinfo)
 
int dbbufsize (DBPROCESS *dbprocess)
 
BYTE * dbbylist (DBPROCESS *dbproc, int computeid, int *size)
 Get bylist for a compute row. More...
 
RETCODE dbcancel (DBPROCESS *dbproc)
 Cancel the current command batch. More...
 
RETCODE dbcanquery (DBPROCESS *dbproc)
 Cancel the query currently being retrieved, discarding all pending rows. More...
 
char * dbchange (DBPROCESS *dbprocess)
 See if a command caused the current database to change. More...
 
DBBOOL dbcharsetconv (DBPROCESS *dbprocess)
 
void dbclose (DBPROCESS *dbproc)
 Close a connection to the server and free associated resources. More...
 
void dbclrbuf (DBPROCESS *dbproc, DBINT n)
 Clear n rows from the row buffer. More...
 
RETCODE dbclropt (DBPROCESS *dbproc, int option, const char param[])
 Reset an option. More...
 
RETCODE dbcmd (DBPROCESS *dbproc, const char cmdstring[])
 Append SQL to the command buffer. More...
 
RETCODE dbcmdrow (DBPROCESS *dbproc)
 See if the current command can return rows. More...
 
RETCODE dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol)
 Get a bunch of column attributes with a single call (Microsoft-compatibility feature). More...
 
DBINT dbcollen (DBPROCESS *dbproc, int column)
 Get size of a regular result column. More...
 
char * dbcolname (DBPROCESS *dbproc, int column)
 Return name of a regular result column. More...
 
char * dbcolsource (DBPROCESS *dbproc, int colnum)
 Get base database column name for a result set column. More...
 
int dbcoltype (DBPROCESS *dbproc, int column)
 Get the datatype of a regular result set column. More...
 
DBTYPEINFOdbcoltypeinfo (DBPROCESS *dbproc, int column)
 Get precision and scale information for a regular result column. More...
 
DBINT dbcolutype (DBPROCESS *dbprocess, int column)
 Get user-defined datatype of a regular result column. More...
 
DBINT dbconvert (DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
 cf. More...
 
DBINT dbconvert_ps (DBPROCESS *dbprocess, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
 Convert one datatype to another. More...
 
DBINT dbcount (DBPROCESS *dbproc)
 Get count of rows processed. More...
 
int dbcurcmd (DBPROCESS *dbproc)
 Get number of the row just returned. More...
 
DBINT dbcurrow (DBPROCESS *dbproc)
 Get number of the row currently being read. More...
 
BYTE * dbdata (DBPROCESS *dbproc, int column)
 Get address of data in a regular result column. More...
 
int dbdatecmp (DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
 Compare DBDATETIME values, similar to strcmp(3). More...
 
RETCODE dbdatecrack (DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *dt)
 Break a DBDATETIME value into useful pieces. More...
 
DBINT dbdatlen (DBPROCESS *dbproc, int column)
 Get size of current row's data in a regular result column. More...
 
DBBOOL dbdead (DBPROCESS *dbproc)
 Check if dbproc is an ex-parrot.
More...
 
EHANDLEFUNC dberrhandle (EHANDLEFUNC handler)
 Set an error handler, for messages from db-lib. More...
 
void dbexit (void)
 Close server connections and free all related structures. More...
 
RETCODE dbfcmd (DBPROCESS *dbproc, const char *fmt,...)
 printf-like way to form SQL to send to the server. More...
 
DBINT dbfirstrow (DBPROCESS *dbproc)
 See if a server response has arrived. More...
 
void dbfreebuf (DBPROCESS *dbproc)
 Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt(). More...
 
char * dbgetchar (DBPROCESS *dbprocess, int n)
 Get address of a position in the command buffer. More...
 
char * dbgetcharset (DBPROCESS *dbprocess)
 
int dbgetlusername (LOGINREC *login, BYTE *name_buffer, int buffer_len)
 
int dbgetmaxprocs (void)
 get maximum simultaneous connections db-lib will open to the server. More...
 
char * dbgetnatlanf (DBPROCESS *dbprocess)
 
int dbgetpacket (DBPROCESS *dbproc)
 Get TDS packet size for the connection. More...
 
RETCODE dbgetrow (DBPROCESS *dbproc, DBINT row)
 Read a row from the row buffer. More...
 
int dbgettime (void)
 Get maximum seconds db-lib waits for a server response to query. More...
 
BYTE * dbgetuserdata (DBPROCESS *dbproc)
 Get address of user-allocated data from a DBPROCESS. More...
 
DBBOOL dbhasretstat (DBPROCESS *dbproc)
 Determine if query generated a return status number. More...
 
RETCODE dbinit (void)
 Initialize db-lib. More...
 
int dbiordesc (DBPROCESS *dbproc)
 Get file descriptor of the socket used by a DBPROCESS to read data coming from the server. (!) More...
 
int dbiowdesc (DBPROCESS *dbproc)
 Get file descriptor of the socket used by a DBPROCESS to write data coming to the server. (!) More...
 
DBBOOL dbisavail (DBPROCESS *dbprocess)
 
BOOL dbiscount (DBPROCESS *dbproc)
 Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature). More...
 
DBBOOL dbisopt (DBPROCESS *dbproc, int option, const char param[])
 Get value of an option. More...
 
DBINT dblastrow (DBPROCESS *dbproc)
 Get number of the last row in the row buffer. More...
 
LOGINRECdblogin (void)
 Allocate a LOGINREC structure. More...
 
void dbloginfree (LOGINREC *login)
 free the LOGINREC
 
RETCODE dbmny4add (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
 Add two DBMONEY4 values. More...
 
int dbmny4cmp (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
 Compare two DBMONEY4 values. More...
 
RETCODE dbmny4copy (DBPROCESS *dbprocess, DBMONEY4 *m1, DBMONEY4 *m2)
 Copy a DBMONEY4 value. More...
 
RETCODE dbmny4minus (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
 Negate a DBMONEY4 value. More...
 
RETCODE dbmny4sub (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
 Subtract two DBMONEY4 values. More...
 
RETCODE dbmny4zero (DBPROCESS *dbproc, DBMONEY4 *dest)
 Zero a DBMONEY4 value. More...
 
int dbmnycmp (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
 Compare two DBMONEY values. More...
 
RETCODE dbmnycopy (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
 Copy a DBMONEY value. More...
 
RETCODE dbmnydec (DBPROCESS *dbproc, DBMONEY *mnyptr)
 Subtract $0.0001 from a DBMONEY value. More...
 
RETCODE dbmnyinc (DBPROCESS *dbproc, DBMONEY *mnyptr)
 Add $0.0001 to a DBMONEY value. More...
 
RETCODE dbmnymaxneg (DBPROCESS *dbproc, DBMONEY *dest)
 Get maximum negative DBMONEY value supported. More...
 
RETCODE dbmnymaxpos (DBPROCESS *dbproc, DBMONEY *dest)
 Get maximum positive DBMONEY value supported. More...
 
RETCODE dbmnyminus (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
 Negate a DBMONEY value. More...
 
RETCODE dbmnysub (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2, DBMONEY *diff)
 
RETCODE dbmnyzero (DBPROCESS *dbproc, DBMONEY *dest)
 Set a DBMONEY value to zero. More...
 
const char * dbmonthname (DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
 Get name of a month, in some human language. More...
 
RETCODE dbmorecmds (DBPROCESS *dbproc)
 See if more commands are to be processed. More...
 
RETCODE dbmoretext (DBPROCESS *dbproc, DBINT size, const BYTE text[])
 Send chunk of a text/image value to the server. More...
 
MHANDLEFUNC dbmsghandle (MHANDLEFUNC handler)
 Set a message handler, for messages from the server. More...
 
char * dbname (DBPROCESS *dbproc)
 Get name of current database. More...
 
STATUS dbnextrow (DBPROCESS *dbproc)
 
STATUS dbnextrow_pivoted (DBPROCESS *dbproc, struct pivot_t *pp)
 
RETCODE dbnullbind (DBPROCESS *dbproc, int column, DBINT *indicator)
 Tie a null-indicator to a regular result column. More...
 
int dbnumalts (DBPROCESS *dbproc, int computeid)
 Get count of columns in a compute row. More...
 
int dbnumcols (DBPROCESS *dbproc)
 Return number of regular columns in a result set. More...
 
int dbnumcompute (DBPROCESS *dbprocess)
 Get count of COMPUTE clauses for a result set. More...
 
int dbnumrets (DBPROCESS *dbproc)
 Get count of output parameters filled by a stored procedure. More...
 
DBPROCESSdbopen (LOGINREC *login, const char *server)
 Normally not used. More...
 
RETCODE dbpivot (DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val)
 Pivot the rows, creating a new resultset. More...
 
void dbpivot_count (struct col_t *output, const struct col_t *input)
 
DBPIVOT_FUNC dbpivot_lookup_name (const char name[])
 
void dbpivot_max (struct col_t *output, const struct col_t *input)
 
void dbpivot_min (struct col_t *output, const struct col_t *input)
 
void dbpivot_sum (struct col_t *output, const struct col_t *input)
 
DBINT dbprcollen (DBPROCESS *dbproc, int column)
 Get size of a result column needed to print column. More...
 
void dbprhead (DBPROCESS *dbproc)
 Print result set headings to stdout. More...
 
RETCODE dbprrow (DBPROCESS *dbproc)
 Print a result set to stdout. More...
 
const char * dbprtype (int token)
 Print a token value's name to a buffer. More...
 
STATUS dbreadtext (DBPROCESS *dbproc, void *buf, DBINT bufsize)
 Fetch part of a text or image value from the server. More...
 
void dbrecftos (const char filename[])
 Record to a file all SQL commands sent to the server. More...
 
RETCODE dbresults (DBPROCESS *dbproc)
 Set up query results. More...
 
RETCODE dbresults_r (DBPROCESS *dbproc, int recursive)
 
BYTE * dbretdata (DBPROCESS *dbproc, int retnum)
 Get value of an output parameter filled by a stored procedure. More...
 
int dbretlen (DBPROCESS *dbproc, int retnum)
 Get size of an output parameter filled by a stored procedure. More...
 
char * dbretname (DBPROCESS *dbproc, int retnum)
 Get name of an output parameter filled by a stored procedure. More...
 
DBINT dbretstatus (DBPROCESS *dbproc)
 Fetch status value returned by query or remote procedure call. More...
 
int dbrettype (DBPROCESS *dbproc, int retnum)
 Get datatype of a stored procedure's return parameter. More...
 
RETCODE dbrows (DBPROCESS *dbproc)
 Indicate whether a query returned rows. More...
 
struct pivot_tdbrows_pivoted (DBPROCESS *dbproc)
 
STATUS dbrowtype (DBPROCESS *dbprocess)
 Get returned row's type. More...
 
RETCODE dbrpcinit (DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
 Initialize a remote procedure call. More...
 
RETCODE dbrpcparam (DBPROCESS *dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE *value)
 Add a parameter to a remote procedure call. More...
 
RETCODE dbrpcsend (DBPROCESS *dbproc)
 Execute the procedure and free associated memory. More...
 
RETCODE dbsafestr (DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
 safely quotes character values in SQL text. More...
 
RETCODE * dbsechandle (DBINT type, INTFUNCPTR handler)
 
char * dbservcharset (DBPROCESS *dbprocess)
 Get syscharset name of the server character set. More...
 
void dbsetavail (DBPROCESS *dbprocess)
 Mark a DBPROCESS as "available". More...
 
void dbsetbusy (DBPROCESS *dbprocess, DB_DBBUSY_FUNC busyfunc)
 
RETCODE dbsetdefcharset (char *charset)
 
void dbsetidle (DBPROCESS *dbprocess, DB_DBIDLE_FUNC idlefunc)
 
void dbsetifile (char *filename)
 set name and location of the interfaces file FreeTDS should use to look up a servername. More...
 
void dbsetinterrupt (DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
 Set interrupt handler for db-lib to use while blocked against a read from the server. More...
 
RETCODE dbsetlbool (LOGINREC *login, int value, int which)
 Set a boolean value in a LOGINREC structure.
More...
 
RETCODE dbsetllong (LOGINREC *login, long value, int which)
 Set an integer value in a LOGINREC structure.
More...
 
RETCODE dbsetlname (LOGINREC *login, const char *value, int which)
 Set the value of a string in a LOGINREC structure.
More...
 
RETCODE dbsetlogintime (int seconds)
 Set maximum seconds db-lib waits for a server response to a login attempt. More...
 
RETCODE dbsetlshort (LOGINREC *login, int value, int which)
 
RETCODE dbsetlversion (LOGINREC *login, BYTE version)
 Set TDS version for future connections.
 
RETCODE dbsetmaxprocs (int maxprocs)
 Set maximum simultaneous connections db-lib will open to the server. More...
 
RETCODE dbsetnull (DBPROCESS *dbprocess, int bindtype, int bindlen, BYTE *bindval)
 Define substitution values to be used when binding null values. More...
 
RETCODE dbsetopt (DBPROCESS *dbproc, int option, const char *char_param, int int_param)
 Set db-lib or server option. More...
 
STATUS dbsetrow (DBPROCESS *dbprocess, DBINT row)
 Make a buffered row "current" without fetching it into bound variables. More...
 
RETCODE dbsettime (int seconds)
 Set maximum seconds db-lib waits for a server response to query. More...
 
void dbsetuserdata (DBPROCESS *dbproc, BYTE *ptr)
 Associate client-allocated (and defined) data with a DBPROCESS. More...
 
RETCODE dbsetversion (DBINT version)
 Specify a db-lib version level. More...
 
int dbspid (DBPROCESS *dbproc)
 Get server process ID for a DBPROCESS. More...
 
RETCODE dbspr1row (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
 Print a regular result row to a buffer. More...
 
DBINT dbspr1rowlen (DBPROCESS *dbproc)
 Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row(). More...
 
RETCODE dbsprhead (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
 Print result set headings to a buffer. More...
 
RETCODE dbsprline (DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
 Get formatted string for underlining dbsprhead() column names. More...
 
RETCODE dbsqlexec (DBPROCESS *dbproc)
 send the SQL command to the server and wait for an answer. More...
 
RETCODE dbsqlok (DBPROCESS *dbproc)
 Wait for results of a query from the server. More...
 
RETCODE dbsqlsend (DBPROCESS *dbproc)
 Transmit the command buffer to the server. More...
 
int dbstrbuild (DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
 Build a printable string from text containing placeholders for variables. More...
 
RETCODE dbstrcpy (DBPROCESS *dbproc, int start, int numbytes, char *dest)
 Get a copy of a chunk of the command buffer. More...
 
int dbstrlen (DBPROCESS *dbproc)
 Get size of the command buffer, in bytes. More...
 
RETCODE dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
 describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo) More...
 
int dbtds (DBPROCESS *dbprocess)
 Get the TDS version in use for dbproc.
More...
 
DBINT dbtextsize (DBPROCESS *dbprocess)
 
DBBINARY * dbtxptr (DBPROCESS *dbproc, int column)
 Get text pointer for a column in the current row. More...
 
DBBINARY * dbtxtimestamp (DBPROCESS *dbproc, int column)
 Get text timestamp for a column in the current row. More...
 
DBBINARY * dbtxtsnewval (DBPROCESS *dbprocess)
 
RETCODE dbtxtsput (DBPROCESS *dbprocess, DBBINARY newtxts, int colnum)
 
RETCODE dbuse (DBPROCESS *dbproc, const char *name)
 Change current database. More...
 
DBINT dbvarylen (DBPROCESS *dbproc, int column)
 Determine whether a column can vary in size. More...
 
const char * dbversion (void)
 See which version of db-lib is in use. More...
 
DBBOOL dbwillconvert (int srctype, int desttype)
 Test whether or not a datatype can be converted to another datatype. More...
 
RETCODE dbwritetext (DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text)
 Send text or image data to the server. More...
 
DBBOOL DRBUF (DBPROCESS *dbprocess)
 
DBPROCESStdsdbopen (LOGINREC *login, const char *server, int msdblib)
 Form a connection with the server. More...
 

Detailed Description

Primary include file for db-lib applications.

Declares macros, functions, enumerated types, and defined tokens used by the db-lib API.

Macro Definition Documentation

◆ DBTDS_UNKNOWN

#define DBTDS_UNKNOWN   0

DBTDS_xxx are returned by DBTDS() The integer values of the constants are poorly chosen.


Function Documentation

◆ dbcolinfo()

RETCODE dbcolinfo ( DBPROCESS dbproc,
CI_TYPE  type,
DBINT  column,
DBINT  computeid,
DBCOL pdbcol 
)

Get a bunch of column attributes with a single call (Microsoft-compatibility feature).


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
typemust be CI_REGULAR or CI_ALTERNATE (CI_CURSOR is defined by the vendor, but is not yet implemented).
columnNth in the result set, starting from 1.
computeid(ignored)
pdbcoladdress of structure to be populated by this function.
Returns
SUCCEED or FAIL.
See also
dbcolbrowse(), dbqual(), dbtabbrowse(), dbtabcount(), dbtabname(), dbtabsource(), dbtsnewlen(), dbtsnewval(), dbtsput().
Todo:
Support cursor rows.
Here is the call graph for this function:

◆ dbopen()

DBPROCESS* dbopen ( LOGINREC login,
const char *  server 
)

Normally not used.

The function is linked in only if the –enable-sybase-compat configure option is used.
Cf. sybdb.h dbopen() macros, and dbdatecrack().

Here is the call graph for this function:

◆ dbpivot()

RETCODE dbpivot ( DBPROCESS dbproc,
int  nkeys,
int *  keys,
int  ncols,
int *  cols,
DBPIVOT_FUNC  func,
int  val 
)

Pivot the rows, creating a new resultset.

Call dbpivot() immediately after dbresults(). It calls dbnextrow() as long as it returns REG_ROW, transforming the results into a cross-tab report.
dbpivot() modifies the metadata such that DB-Library can be used tranparently: retrieve the rows as usual with dbnumcols(), dbnextrow(), etc.

@dbproc, our old friend @nkeys the number of left-edge columns to group by @keys an array of left-edge columns to group by @ncols the number of top-edge columns to group by @cols an array of top-edge columns to group by @func the aggregation function to use @val the number of the column to which @func is applied

Returns
the return code from the final call to dbnextrow().
Success is normally indicated by NO_MORE_ROWS.
freetds-1.3.6/doc/reference/a00479_source.html000644 025423 025423 00000023357 14162303413 022407 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/md5.h Source File
FreeTDS API
md5.h
1 #ifndef MD5_H
2 #define MD5_H
3 
4 #ifndef HAVE_NETTLE
5 
6 #include <freetds/pushvis.h>
7 
8 struct MD5Context {
9  uint32_t buf[4];
10  uint64_t bytes;
11  uint32_t in[16];
12 };
13 
14 void MD5Init(struct MD5Context *context);
15 void MD5Update(struct MD5Context *context, const uint8_t *buf, size_t len);
16 void MD5Final(struct MD5Context *context, uint8_t *digest);
17 
18 /*
19  * This is needed to make RSAREF happy on some MS-DOS compilers.
20  */
21 typedef struct MD5Context MD5_CTX;
22 
23 #include <freetds/popvis.h>
24 
25 #else
26 
27 #include <nettle/md5.h>
28 
29 typedef struct md5_ctx MD5_CTX;
30 
31 static inline void MD5Init(MD5_CTX *ctx)
32 {
33  nettle_md5_init(ctx);
34 }
35 
36 static inline void MD5Update(MD5_CTX *ctx, const uint8_t *buf, size_t len)
37 {
38  nettle_md5_update(ctx, len, buf);
39 }
40 
41 static inline void MD5Final(MD5_CTX *ctx, uint8_t *digest)
42 {
43  nettle_md5_digest(ctx, 16, digest);
44 }
45 
46 #endif
47 
48 #endif /* !MD5_H */
Definition: md5.h:8
freetds-1.3.6/doc/reference/a00482_source.html000644 025423 025423 00000055061 14162303413 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils/string.h Source File
FreeTDS API
string.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tdsstring_h_
21 #define _tdsstring_h_
22 
23 #include <freetds/macros.h>
24 
25 #include <freetds/pushvis.h>
26 
36 typedef struct tds_dstr {
37  size_t dstr_size;
38  char dstr_s[1];
39 } *DSTR;
40 
42 extern const struct tds_dstr tds_str_empty;
43 
49 #define DSTR_INITIALIZER ((struct tds_dstr*) &tds_str_empty)
50 
52 static inline void
54 {
55  *(s) = DSTR_INITIALIZER;
56 }
57 
59 static inline int
61 {
62  return (*s)->dstr_size == 0;
63 }
64 
70 static inline char *
72 {
73  return (*s)->dstr_s;
74 }
75 
77 static inline const char *
78 tds_dstr_cstr(const DSTR * s)
79 {
80  return (*s)->dstr_s;
81 }
82 
84 static inline size_t
85 tds_dstr_len(const DSTR * s)
86 {
87  return (*s)->dstr_size;
88 }
89 
91 #define tds_dstr_empty(s) \
92  tds_dstr_free(s)
93 
94 void tds_dstr_zero(DSTR * s);
95 void tds_dstr_free(DSTR * s);
96 
97 DSTR* tds_dstr_dup(DSTR * s, const DSTR * src) TDS_WUR;
98 DSTR* tds_dstr_copy(DSTR * s, const char *src) TDS_WUR;
99 DSTR* tds_dstr_copyn(DSTR * s, const char *src, size_t length) TDS_WUR;
100 DSTR* tds_dstr_set(DSTR * s, char *src) TDS_WUR;
101 
102 DSTR* tds_dstr_setlen(DSTR *s, size_t length);
103 DSTR* tds_dstr_alloc(DSTR *s, size_t length) TDS_WUR;
104 
107 #include <freetds/popvis.h>
108 
109 #endif /* _tdsstring_h_ */
static void tds_dstr_init(DSTR *s)
init a string with empty
Definition: string.h:53
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
const struct tds_dstr tds_str_empty
Internal representation for an empty string.
Definition: tdsstring.c:45
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
struct tds_dstr * DSTR
Structure to hold a string.
Structure to hold a string.
Definition: string.h:36
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
static size_t tds_dstr_len(const DSTR *s)
Returns the length of the string in bytes.
Definition: string.h:85
#define DSTR_INITIALIZER
Initializer, used to initialize string like in the following example.
Definition: string.h:49
static char * tds_dstr_buf(DSTR *s)
Returns a buffer to edit the string.
Definition: string.h:71
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
freetds-1.3.6/doc/reference/a00485_source.html000644 025423 025423 00000026312 14162303413 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/utils.h Source File
FreeTDS API
utils.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2016 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _freetds_utils_h_
21 #define _freetds_utils_h_
22 
23 #if HAVE_STDDEF_H
24 #include <stddef.h>
25 #endif /* HAVE_STDDEF_H */
26 
27 #include <freetds/time.h>
28 #include <freetds/sysdep_private.h>
29 
30 #include <freetds/pushvis.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 void tds_sleep_s(unsigned sec);
37 void tds_sleep_ms(unsigned ms);
38 
39 char *tds_getpassarg(char *arg);
40 
41 char *tds_timestamp_str(char *str, int maxlen);
42 struct tm *tds_localtime_r(const time_t *timep, struct tm *result);
43 int tds_getservice(const char *name);
44 char *tds_get_homedir(void);
45 
46 int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on);
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 
52 #include <freetds/popvis.h>
53 
54 #endif
int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on)
Set socket to not throw SIGPIPE.
Definition: net.c:72
freetds-1.3.6/doc/reference/a00488_source.html000644 025423 025423 00000017235 14162303413 022405 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/version.h Source File
FreeTDS API
version.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tdsversion_h_
21 #define _tdsversion_h_
22 
23 /* $Id: 9640daf619734147e3b5ff6a1dad56ad305ffa51 $ */
24 
25 #define TDS_VERSION_NO "freetds v1.3.6"
26 
27 #define TDS_VERSION_MAJOR 1
28 #define TDS_VERSION_MINOR 3
29 #define TDS_VERSION_SUBVERSION 6
30 #define TDS_VERSION_BUILD_NUMBER 361
31 
32 #endif
freetds-1.3.6/doc/reference/a00491_source.html000644 025423 025423 00000016541 14162303413 022376 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/windows.h Source File
FreeTDS API
windows.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2018 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef freetds_windows_h_
21 #define freetds_windows_h_
22 
23 #ifdef _WIN32
24 #include <winsock2.h>
25 #include <ws2tcpip.h>
26 #include <windows.h>
27 #endif
28 
29 #endif /* freetds_windows_h_ */
freetds-1.3.6/doc/reference/a00494_source.html000644 025423 025423 00000162475 14162303413 022411 0ustar00fredianofrediano000000 000000 FreeTDS API: include/odbcss.h Source File
FreeTDS API
odbcss.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2008 Frediano Ziglio
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _odbcss_h_
21 #define _odbcss_h_
22 
23 #ifdef TDSODBC_BCP
24 #include <sql.h>
25 #endif
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #define SQL_DIAG_SS_MSGSTATE (-1150)
32 #define SQL_DIAG_SS_LINE (-1154)
33 
34 #define SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT 1233
35 #define SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT 1234
36 #define SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS 1235
37 
38 #ifndef SQL_SS_LENGTH_UNLIMITED
39 #define SQL_SS_LENGTH_UNLIMITED 0
40 #endif
41 
42 #ifndef SQL_COPT_SS_BASE
43 #define SQL_COPT_SS_BASE 1200
44 #endif
45 
46 #ifndef SQL_COPT_SS_MARS_ENABLED
47 #define SQL_COPT_SS_MARS_ENABLED (SQL_COPT_SS_BASE+24)
48 #endif
49 
50 #ifndef SQL_COPT_SS_OLDPWD
51 #define SQL_COPT_SS_OLDPWD (SQL_COPT_SS_BASE+26)
52 #endif
53 
54 #define SQL_INFO_FREETDS_TDS_VERSION 1300
55 #define SQL_INFO_FREETDS_SOCKET 1301
56 
57 #ifndef SQL_MARS_ENABLED_NO
58 #define SQL_MARS_ENABLED_NO 0
59 #endif
60 
61 #ifndef SQL_MARS_ENABLED_YES
62 #define SQL_MARS_ENABLED_YES 1
63 #endif
64 
65 #ifndef SQL_SS_VARIANT
66 #define SQL_SS_VARIANT (-150)
67 #endif
68 
69 #ifndef SQL_SS_UDT
70 #define SQL_SS_UDT (-151)
71 #endif
72 
73 #ifndef SQL_SS_XML
74 #define SQL_SS_XML (-152)
75 #endif
76 
77 #ifndef SQL_SS_TABLE
78 #define SQL_SS_TABLE (-153)
79 #endif
80 
81 #ifndef SQL_SS_TIME2
82 #define SQL_SS_TIME2 (-154)
83 #endif
84 
85 #ifndef SQL_SS_TIMESTAMPOFFSET
86 #define SQL_SS_TIMESTAMPOFFSET (-155)
87 #endif
88 
89 /*
90  * these types are used from conversion from client to server
91  */
92 #ifndef SQL_C_SS_TIME2
93 #define SQL_C_SS_TIME2 (0x4000)
94 #endif
95 
96 #ifndef SQL_C_SS_TIMESTAMPOFFSET
97 #define SQL_C_SS_TIMESTAMPOFFSET (0x4001)
98 #endif
99 
100 #ifndef SQL_CA_SS_BASE
101 #define SQL_CA_SS_BASE 1200
102 #endif
103 
104 #ifndef SQL_CA_SS_UDT_CATALOG_NAME
105 #define SQL_CA_SS_UDT_CATALOG_NAME (SQL_CA_SS_BASE+18)
106 #endif
107 
108 #ifndef SQL_CA_SS_UDT_SCHEMA_NAME
109 #define SQL_CA_SS_UDT_SCHEMA_NAME (SQL_CA_SS_BASE+19)
110 #endif
111 
112 #ifndef SQL_CA_SS_UDT_TYPE_NAME
113 #define SQL_CA_SS_UDT_TYPE_NAME (SQL_CA_SS_BASE+20)
114 #endif
115 
116 #ifndef SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME
117 #define SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME (SQL_CA_SS_BASE+21)
118 #endif
119 
120 #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME
121 #define SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME (SQL_CA_SS_BASE+22)
122 #endif
123 
124 #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME
125 #define SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME (SQL_CA_SS_BASE+23)
126 #endif
127 
128 #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_NAME
129 #define SQL_CA_SS_XML_SCHEMACOLLECTION_NAME (SQL_CA_SS_BASE+24)
130 #endif
131 
132 typedef struct tagSS_TIME2_STRUCT {
133  SQLUSMALLINT hour;
134  SQLUSMALLINT minute;
135  SQLUSMALLINT second;
136  SQLUINTEGER fraction;
138 
140  SQLSMALLINT year;
141  SQLUSMALLINT month;
142  SQLUSMALLINT day;
143  SQLUSMALLINT hour;
144  SQLUSMALLINT minute;
145  SQLUSMALLINT second;
146  SQLUINTEGER fraction;
147  SQLSMALLINT timezone_hour;
148  SQLSMALLINT timezone_minute;
150 
151 
152 #ifdef TDSODBC_BCP
153 
154 #ifndef SUCCEED
155 #define SUCCEED 1
156 #endif
157 #ifndef FAIL
158 #define FAIL 0
159 #endif
160 
161 #ifndef BCPKEEPIDENTITY
162 #define BCPKEEPIDENTITY 8
163 #endif
164 #ifndef BCPHINTS
165 #define BCPHINTS 6
166 #endif
167 
168 #define BCP_DIRECTION_IN 1
169 
170 #define SQL_COPT_SS_BCP (SQL_COPT_SS_BASE+19)
171 #define SQL_BCP_OFF 0
172 #define SQL_BCP_ON 1
173 
174 #define SQL_COPT_TDSODBC_IMPL_BASE 1500
175 #define SQL_COPT_TDSODBC_IMPL_BCP_INITA (SQL_COPT_TDSODBC_IMPL_BASE)
176 #define SQL_COPT_TDSODBC_IMPL_BCP_CONTROL (SQL_COPT_TDSODBC_IMPL_BASE+1)
177 #define SQL_COPT_TDSODBC_IMPL_BCP_COLPTR (SQL_COPT_TDSODBC_IMPL_BASE+2)
178 #define SQL_COPT_TDSODBC_IMPL_BCP_SENDROW (SQL_COPT_TDSODBC_IMPL_BASE+3)
179 #define SQL_COPT_TDSODBC_IMPL_BCP_BATCH (SQL_COPT_TDSODBC_IMPL_BASE+4)
180 #define SQL_COPT_TDSODBC_IMPL_BCP_DONE (SQL_COPT_TDSODBC_IMPL_BASE+5)
181 #define SQL_COPT_TDSODBC_IMPL_BCP_BIND (SQL_COPT_TDSODBC_IMPL_BASE+6)
182 #define SQL_COPT_TDSODBC_IMPL_BCP_INITW (SQL_COPT_TDSODBC_IMPL_BASE+7)
183 
184 #define SQL_VARLEN_DATA -10
185 
186 /* copied from sybdb.h which was copied from tds.h */
187 /* TODO find a much better way... */
188 enum
189 {
190  BCP_TYPE_SQLCHAR = 47, /* 0x2F */
191 #define BCP_TYPE_SQLCHAR BCP_TYPE_SQLCHAR
192  BCP_TYPE_SQLVARCHAR = 39, /* 0x27 */
193 #define BCP_TYPE_SQLVARCHAR BCP_TYPE_SQLVARCHAR
194  BCP_TYPE_SQLINTN = 38, /* 0x26 */
195 #define BCP_TYPE_SQLINTN BCP_TYPE_SQLINTN
196  BCP_TYPE_SQLINT1 = 48, /* 0x30 */
197 #define BCP_TYPE_SQLINT1 BCP_TYPE_SQLINT1
198  BCP_TYPE_SQLINT2 = 52, /* 0x34 */
199 #define BCP_TYPE_SQLINT2 BCP_TYPE_SQLINT2
200  BCP_TYPE_SQLINT4 = 56, /* 0x38 */
201 #define BCP_TYPE_SQLINT4 BCP_TYPE_SQLINT4
202  BCP_TYPE_SQLINT8 = 127, /* 0x7F */
203 #define BCP_TYPE_SQLINT8 BCP_TYPE_SQLINT8
204  BCP_TYPE_SQLFLT8 = 62, /* 0x3E */
205 #define BCP_TYPE_SQLFLT8 BCP_TYPE_SQLFLT8
206  BCP_TYPE_SQLDATETIME = 61, /* 0x3D */
207 #define BCP_TYPE_SQLDATETIME BCP_TYPE_SQLDATETIME
208  BCP_TYPE_SQLBIT = 50, /* 0x32 */
209 #define BCP_TYPE_SQLBIT BCP_TYPE_SQLBIT
210  BCP_TYPE_SQLBITN = 104, /* 0x68 */
211 #define BCP_TYPE_SQLBITN BCP_TYPE_SQLBITN
212  BCP_TYPE_SQLTEXT = 35, /* 0x23 */
213 #define BCP_TYPE_SQLTEXT BCP_TYPE_SQLTEXT
214  BCP_TYPE_SQLNTEXT = 99, /* 0x63 */
215 #define BCP_TYPE_SQLNTEXT BCP_TYPE_SQLNTEXT
216  BCP_TYPE_SQLIMAGE = 34, /* 0x22 */
217 #define BCP_TYPE_SQLIMAGE BCP_TYPE_SQLIMAGE
218  BCP_TYPE_SQLMONEY4 = 122, /* 0x7A */
219 #define BCP_TYPE_SQLMONEY4 BCP_TYPE_SQLMONEY4
220  BCP_TYPE_SQLMONEY = 60, /* 0x3C */
221 #define BCP_TYPE_SQLMONEY BCP_TYPE_SQLMONEY
222  BCP_TYPE_SQLDATETIME4 = 58, /* 0x3A */
223 #define BCP_TYPE_SQLDATETIME4 BCP_TYPE_SQLDATETIME4
224  BCP_TYPE_SQLREAL = 59, /* 0x3B */
225  BCP_TYPE_SQLFLT4 = 59, /* 0x3B */
226 #define BCP_TYPE_SQLREAL BCP_TYPE_SQLREAL
227 #define BCP_TYPE_SQLFLT4 BCP_TYPE_SQLFLT4
228  BCP_TYPE_SQLBINARY = 45, /* 0x2D */
229 #define BCP_TYPE_SQLBINARY BCP_TYPE_SQLBINARY
230  BCP_TYPE_SQLVOID = 31, /* 0x1F */
231 #define BCP_TYPE_SQLVOID BCP_TYPE_SQLVOID
232  BCP_TYPE_SQLVARBINARY = 37, /* 0x25 */
233 #define BCP_TYPE_SQLVARBINARY BCP_TYPE_SQLVARBINARY
234  BCP_TYPE_SQLNUMERIC = 108, /* 0x6C */
235 #define BCP_TYPE_SQLNUMERIC BCP_TYPE_SQLNUMERIC
236  BCP_TYPE_SQLDECIMAL = 106, /* 0x6A */
237 #define BCP_TYPE_SQLDECIMAL BCP_TYPE_SQLDECIMAL
238  BCP_TYPE_SQLFLTN = 109, /* 0x6D */
239 #define BCP_TYPE_SQLFLTN BCP_TYPE_SQLFLTN
240  BCP_TYPE_SQLMONEYN = 110, /* 0x6E */
241 #define BCP_TYPE_SQLMONEYN BCP_TYPE_SQLMONEYN
242  BCP_TYPE_SQLDATETIMN = 111, /* 0x6F */
243 #define BCP_TYPE_SQLDATETIMN BCP_TYPE_SQLDATETIMN
244  BCP_TYPE_SQLNVARCHAR = 103, /* 0x67 */
245 #define BCP_TYPE_SQLNVARCHAR BCP_TYPE_SQLNVARCHAR
246  BCP_TYPE_SQLUNIQUEID = 36, /* 0x24 */
247 #define BCP_TYPE_SQLUNIQUEID BCP_TYPE_SQLUNIQUEID
248  BCP_TYPE_SQLDATETIME2 = 42, /* 0x2a */
249 #define BCP_TYPE_SQLDATETIME2 BCP_TYPE_SQLDATETIME2
250 };
251 
252 typedef struct
253 {
254  int dtdays;
255  int dttime;
256 } DBDATETIME;
257 
258 #ifdef _MSC_VER
259 #define TDSODBC_INLINE __inline
260 #else
261 #define TDSODBC_INLINE __inline__
262 #endif
263 
264 struct tdsodbc_impl_bcp_init_params
265 {
266  const void *tblname;
267  const void *hfile;
268  const void *errfile;
269  int direction;
270 };
271 
272 static TDSODBC_INLINE RETCODE SQL_API
273 bcp_initA(HDBC hdbc, const char *tblname, const char *hfile, const char *errfile, int direction)
274 {
275  struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction};
276  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITA, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
277 }
278 
279 static TDSODBC_INLINE RETCODE SQL_API
280 bcp_initW(HDBC hdbc, const SQLWCHAR *tblname, const SQLWCHAR *hfile, const SQLWCHAR *errfile, int direction)
281 {
282  struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction};
283  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITW, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
284 }
285 
286 struct tdsodbc_impl_bcp_control_params
287 {
288  int field;
289  void *value;
290 };
291 
292 static TDSODBC_INLINE RETCODE SQL_API
293 bcp_control(HDBC hdbc, int field, void *value)
294 {
295  struct tdsodbc_impl_bcp_control_params params = {field, value};
296  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_CONTROL, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
297 }
298 
299 struct tdsodbc_impl_bcp_colptr_params
300 {
301  const unsigned char * colptr;
302  int table_column;
303 };
304 
305 static TDSODBC_INLINE RETCODE SQL_API
306 bcp_colptr(HDBC hdbc, const unsigned char * colptr, int table_column)
307 {
308  struct tdsodbc_impl_bcp_colptr_params params = {colptr, table_column};
309  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_COLPTR, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
310 }
311 
312 static TDSODBC_INLINE RETCODE SQL_API
313 bcp_sendrow(HDBC hdbc)
314 {
315  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_SENDROW, NULL, SQL_IS_POINTER)) ? SUCCEED : FAIL;
316 }
317 
318 struct tdsodbc_impl_bcp_batch_params
319 {
320  int rows;
321 };
322 
323 static TDSODBC_INLINE int SQL_API
324 bcp_batch(HDBC hdbc)
325 {
326  struct tdsodbc_impl_bcp_batch_params params = {-1};
327  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BATCH, &params, SQL_IS_POINTER)) ? params.rows : -1;
328 }
329 
330 struct tdsodbc_impl_bcp_done_params
331 {
332  int rows;
333 };
334 
335 static TDSODBC_INLINE int SQL_API
336 bcp_done(HDBC hdbc)
337 {
338  struct tdsodbc_impl_bcp_done_params params = {-1};
339  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_DONE, &params, SQL_IS_POINTER)) ? params.rows : -1;
340 }
341 
342 struct tdsodbc_impl_bcp_bind_params
343 {
344  const unsigned char * varaddr;
345  int prefixlen;
346  int varlen;
347  const unsigned char * terminator;
348  int termlen;
349  int vartype;
350  int table_column;
351 };
352 
353 static TDSODBC_INLINE RETCODE SQL_API
354 bcp_bind(HDBC hdbc, const unsigned char * varaddr, int prefixlen, int varlen,
355  const unsigned char * terminator, int termlen, int vartype, int table_column)
356 {
357  struct tdsodbc_impl_bcp_bind_params params = {varaddr, prefixlen, varlen, terminator, termlen, vartype, table_column};
358  return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BIND, &params, SQL_IS_POINTER)) ? SUCCEED : FAIL;
359 }
360 
361 #ifdef UNICODE
362 #define bcp_init bcp_initW
363 #else
364 #define bcp_init bcp_initA
365 #endif
366 
367 #endif /* TDSODBC_BCP */
368 
369 #ifdef __cplusplus
370 }
371 #endif
372 
373 #endif /* _odbcss_h_ */
RETCODE bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int db_vartype, int table_column)
Bind a program host variable to a database column.
Definition: bcp.c:2079
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition: bcp.c:544
Definition: odbcss.h:132
DBINT bcp_done(DBPROCESS *dbproc)
Conclude the transfer of data from program variables.
Definition: bcp.c:2037
RETCODE bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column)
Override bcp_bind() by pointing to a different host variable.
Definition: bcp.c:671
RETCODE bcp_sendrow(DBPROCESS *dbproc)
Write data in host variables to the table.
Definition: bcp.c:1381
Definition: odbcss.h:139
DBINT bcp_batch(DBPROCESS *dbproc)
Commit a set of rows to the table.
Definition: bcp.c:2010
Definition: sybdb.h:295
freetds-1.3.6/doc/reference/a00497_source.html000644 025423 025423 00000071557 14162303413 022414 0ustar00fredianofrediano000000 000000 FreeTDS API: include/sqldb.h Source File
FreeTDS API
sqldb.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef SQLDB_h
21 #define SQLDB_h
22 
23 #include "./sybdb.h"
24 
25 #define SQLCHAR SYBCHAR
26 #define SQLVARCHAR SYBVARCHAR
27 #define SQLINTN SYBINTN
28 #define SQLINT1 SYBINT1
29 #define SQLINT2 SYBINT2
30 #define SQLINT4 SYBINT4
31 #define SQLINT8 SYBINT8
32 #define SQLFLT8 SYBFLT8
33 #define SQLDATETIME SYBDATETIME
34 #define SQLBIT SYBBIT
35 #define SQLTEXT SYBTEXT
36 #define SQLIMAGE SYBIMAGE
37 #define SQLMONEY4 SYBMONEY4
38 #define SQLMONEY SYBMONEY
39 #define SQLDATETIM4 SYBDATETIME4
40 #define SQLFLT4 SYBREAL
41 #define SQLBINARY SYBBINARY
42 #define SQLVARBINARY SYBVARBINARY
43 #define SQLNUMERIC SYBNUMERIC
44 #define SQLDECIMAL SYBDECIMAL
45 #define SQLFLTN SYBFLTN
46 #define SQLMONEYN SYBMONEYN
47 #define SQLDATETIMN SYBDATETIMN
48 #define SQLVOID SYBVOID
49 
50 #define SMALLDATETIBIND SMALLDATETIMEBIND
51 
52 #define DBERRHANDLE_PROC EHANDLEFUNC
53 #define DBMSGHANDLE_PROC MHANDLEFUNC
54 
55 /* DB-Library errors as defined by Microsoft */
56 #define SQLEMEM SYBEMEM
57 #define SQLENULL SYBENULL
58 #define SQLENLOG SYBENLOG
59 #define SQLEPWD SYBEPWD
60 #define SQLECONN SYBECONN
61 #define SQLEDDNE SYBEDDNE
62 #define SQLENULLO SYBENULLO
63 #define SQLESMSG SYBESMSG
64 #define SQLEBTOK SYBEBTOK
65 #define SQLENSPE SYBENSPE
66 #define SQLEREAD SYBEREAD
67 #define SQLECNOR SYBECNOR
68 #define SQLETSIT SYBETSIT
69 #define SQLEPARM SYBEPARM
70 #define SQLEAUTN SYBEAUTN
71 #define SQLECOFL SYBECOFL
72 #define SQLERDCN SYBERDCN
73 #define SQLEICN SYBEICN
74 #define SQLECLOS SYBECLOS
75 #define SQLENTXT SYBENTXT
76 #define SQLEDNTI SYBEDNTI
77 #define SQLETMTD SYBETMTD
78 #define SQLEASEC SYBEASEC
79 #define SQLENTLL SYBENTLL
80 #define SQLETIME SYBETIME
81 #define SQLEWRIT SYBEWRIT
82 #define SQLEMODE SYBEMODE
83 #define SQLEOOB SYBEOOB
84 #define SQLEITIM SYBEITIM
85 #define SQLEDBPS SYBEDBPS
86 #define SQLEIOPT SYBEIOPT
87 #define SQLEASNL SYBEASNL
88 #define SQLEASUL SYBEASUL
89 #define SQLENPRM SYBENPRM
90 #define SQLEDBOP SYBEDBOP
91 #define SQLENSIP SYBENSIP
92 #define SQLECNULL SYBECNULL
93 #define SQLESEOF SYBESEOF
94 #define SQLERPND SYBERPND
95 #define SQLECSYN SYBECSYN
96 #define SQLENONET SYBENONET
97 #define SQLEBTYP SYBEBTYP
98 #define SQLEABNC SYBEABNC
99 #define SQLEABMT SYBEABMT
100 #define SQLEABNP SYBEABNP
101 #define SQLEBNCR SYBEBNCR
102 #define SQLEAAMT SYBEAAMT
103 #define SQLENXID SYBENXID
104 #define SQLEIFNB SYBEIFNB
105 #define SQLEKBCO SYBEKBCO
106 #define SQLEBBCI SYBEBBCI
107 #define SQLEKBCI SYBEKBCI
108 #define SQLEBCWE SYBEBCWE
109 #define SQLEBCNN SYBEBCNN
110 #define SQLEBCOR SYBEBCOR
111 #define SQLEBCPI SYBEBCPI
112 #define SQLEBCPN SYBEBCPN
113 #define SQLEBCPB SYBEBCPB
114 #define SQLEVDPT SYBEVDPT
115 #define SQLEBIVI SYBEBIVI
116 #define SQLEBCBC SYBEBCBC
117 #define SQLEBCFO SYBEBCFO
118 #define SQLEBCVH SYBEBCVH
119 #define SQLEBCUO SYBEBCUO
120 #define SQLEBUOE SYBEBUOE
121 #define SQLEBWEF SYBEBWEF
122 #define SQLEBTMT SYBEBTMT
123 #define SQLEBEOF SYBEBEOF
124 #define SQLEBCSI SYBEBCSI
125 #define SQLEPNUL SYBEPNUL
126 #define SQLEBSKERR SYBEBSKERR
127 #define SQLEBDIO SYBEBDIO
128 #define SQLEBCNT SYBEBCNT
129 #define SQLEMDBP SYBEMDBP
130 #define SQLINIT SYBINIT
131 #define SQLCRSINV SYBCRSINV
132 #define SQLCRSCMD SYBCRSCMD
133 #define SQLCRSNOIND SYBCRSNOIND
134 #define SQLCRSDIS SYBCRSDIS
135 #define SQLCRSAGR SYBCRSAGR
136 #define SQLCRSORD SYBCRSORD
137 #define SQLCRSMEM SYBCRSMEM
138 #define SQLCRSBSKEY SYBCRSBSKEY
139 #define SQLCRSNORES SYBCRSNORES
140 #define SQLCRSVIEW SYBCRSVIEW
141 #define SQLCRSBUFR SYBCRSBUFR
142 #define SQLCRSFROWN SYBCRSFROWN
143 #define SQLCRSBROL SYBCRSBROL
144 #define SQLCRSFRAND SYBCRSFRAND
145 #define SQLCRSFLAST SYBCRSFLAST
146 #define SQLCRSRO SYBCRSRO
147 #define SQLCRSTAB SYBCRSTAB
148 #define SQLCRSUPDTAB SYBCRSUPDTAB
149 #define SQLCRSUPDNB SYBCRSUPDNB
150 #define SQLCRSVIIND SYBCRSVIIND
151 #define SQLCRSNOUPD SYBCRSNOUPD
152 #define SQLCRSOS SYBCRSOS
153 #define SQLEBCSA SYBEBCSA
154 #define SQLEBCRO SYBEBCRO
155 #define SQLEBCNE SYBEBCNE
156 #define SQLEBCSK SYBEBCSK
157 #define SQLEUVBF SYBEUVBF
158 #define SQLEBIHC SYBEBIHC
159 #define SQLEBWFF SYBEBWFF
160 #define SQLNUMVAL SYBNUMVAL
161 #define SQLEOLDVR SYBEOLDVR
162 #define SQLEBCPS SYBEBCPS
163 #define SQLEDTC SYBEDTC
164 #define SQLENOTIMPL SYBENOTIMPL
165 #define SQLENONFLOAT SYBENONFLOAT
166 #define SQLECONNFB SYBECONNFB
167 
168 
169 #define dbfreelogin(x) dbloginfree((x))
170 
171 #define dbprocerrhandle(p, h) dberrhandle((h))
172 #define dbprocmsghandle(p, h) dbmsghandle((h))
173 
174 #define dbwinexit()
175 
176 static const char rcsid_sqldb_h[] = "$Id: sqldb.h,v 1.6 2009-12-02 22:35:18 jklowden Exp $";
177 static const void *const no_unused_sqldb_h_warn[] = { rcsid_sqldb_h, no_unused_sqldb_h_warn };
178 
179 
180 #endif
Primary include file for db-lib applications.
freetds-1.3.6/doc/reference/a00500_source.html000644 025423 025423 00000031440 14162303413 022360 0ustar00fredianofrediano000000 000000 FreeTDS API: include/sqlfront.h Source File
FreeTDS API
sqlfront.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  * Copyright (C) 2011 Frediano Ziglio
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef SQLFRONT_h
22 #define SQLFRONT_h
23 
24 #include "./sybfront.h"
25 
26 static const char rcsid_sqlfront_h[] = "$Id: sqlfront.h,v 1.10 2011-07-13 11:06:31 freddy77 Exp $";
27 static const void *const no_unused_sqlfront_h_warn[] = { rcsid_sqlfront_h, no_unused_sqlfront_h_warn };
28 
29 typedef DBPROCESS * PDBPROCESS;
30 typedef LOGINREC * PLOGINREC;
31 typedef DBCURSOR * PDBCURSOR;
32 
33 typedef int * LPINT;
34 typedef char * LPSTR;
35 #if !defined(PHP_MSSQL_H) || !defined(PHP_MSSQL_API)
36 typedef BYTE * LPBYTE;
37 #endif
38 typedef void * LPVOID;
39 typedef const char * LPCSTR;
40 
41 typedef const LPINT LPCINT;
42 #ifndef _LPCBYTE_DEFINED
43 #define _LPCBYTE_DEFINED
44 typedef const BYTE * LPCBYTE;
45 #endif
46 typedef USHORT * LPUSHORT;
47 typedef const LPUSHORT LPCUSHORT;
48 typedef DBINT * LPDBINT;
49 typedef const LPDBINT LPCDBINT;
50 typedef DBBINARY * LPDBBINARY;
51 typedef const LPDBBINARY LPCDBBINARY;
52 typedef DBDATEREC * LPDBDATEREC;
53 typedef const LPDBDATEREC LPCDBDATEREC;
54 typedef DBDATETIME * LPDBDATETIME;
55 typedef const LPDBDATETIME LPCDBDATETIME;
56 
57 #endif
Definition: bsqlodbc.c:100
Definition: sybdb.h:474
Definition: dblib.h:123
Definition: sybdb.h:295
freetds-1.3.6/doc/reference/a00503_source.html000644 025423 025423 00000022122 14162303413 022360 0ustar00fredianofrediano000000 000000 FreeTDS API: include/sybdb.dox.h Source File
FreeTDS API
sybdb.dox.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2005 James K. Lowden
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
93  /*------------------------*/
119  /*------------------------*/
135 /* \fn DBSETLHID(x,y) (not implemented)
136  * \ingroup dblib_core
137  * \brief
138  * \sa dbsetlhid()
139  */
140 /* \fn DBSETLNOSHORT(x,y) (not implemented)
141  * \ingroup dblib_core
142  * \brief
143  * \sa dbsetlnoshort()
144  */
145 /* \fn DBSETLHIER(x,y) (not implemented)
146  * \ingroup dblib_core
147  * \brief
148  * \sa dbsetlhier()
149  */
171 /* \fn BCP_SETLABELED(x,y) (not implemented)
172  * \ingroup dblib_internal
173  * \brief Sybase macro mapping to the Microsoft (lower-case) function.
174  * \sa bcp_setlabeled()
175  */
182  /*------------------------*/
183 
freetds-1.3.6/doc/reference/a00506_a9b73fd1afa2c3ccfca481635212d2e43_cgraph.dot000644 025423 025423 00000001307 14162303416 027100 0ustar00fredianofrediano000000 000000 digraph "dbcolinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcolinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get a bunch of column attributes with a single call (Microsoft-compatibility feature)."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00506_ae408d8e1c2ab0767d8bfd26d00d1ff6a_cgraph.dot000644 025423 025423 00000002340 14162303416 027167 0ustar00fredianofrediano000000 000000 digraph "dbopen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbopen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Normally not used."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdbopen",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00554.html#ga2c99ec565452279e9a382451d89642eb",tooltip="Form a connection with the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; Node2 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tdsdump_open",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a24471508ddfde7cc0f8577801e70c42f",tooltip="Create and truncate a human readable dump file for the TDS traffic."]; } freetds-1.3.6/doc/reference/a00506_source.html000644 025423 025423 00001212032 14162303413 022365 0ustar00fredianofrediano000000 000000 FreeTDS API: include/sybdb.h Source File
FreeTDS API
sybdb.h
Go to the documentation of this file.
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns
3  * Copyright (C) 2010, 2011 Frediano Ziglio
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
28 #ifndef _sybdb_h_
29 #define _sybdb_h_
30 
31 #include "tds_sysdep_public.h"
32 
33 #undef TDS_STATIC_CAST
34 #ifdef __cplusplus
35 #define TDS_STATIC_CAST(type, a) static_cast<type>(a)
36 extern "C"
37 {
38 #if 0
39 }
40 #endif
41 #else
42 #define TDS_STATIC_CAST(type, a) ((type)(a))
43 #endif
44 
45 #ifdef FALSE
46 #undef FALSE
47 #endif
48 #ifdef TRUE
49 #undef TRUE
50 #endif
51 #define FALSE 0
52 #define TRUE 1
53 
54 #define DBSAVE 1
55 #define DBNOSAVE 0
56 #define DBNOERR -1
57 
58 #define INT_EXIT 0
59 #define INT_CONTINUE 1
60 #define INT_CANCEL 2
61 #define INT_TIMEOUT 3
62 
63 #define DBMAXNUMLEN 33
64 /* https://msdn.microsoft.com/en-us/library/ms176061.aspx */
65 #define DBMAXNAME 128
66 
70 #define DBVERSION_UNKNOWN 0
71 #define DBVERSION_46 1
72 #define DBVERSION_100 2
73 #define DBVERSION_42 3
74 #define DBVERSION_70 4
75 #define DBVERSION_71 5
76 #define DBVERSION_72 6
77 #define DBVERSION_73 7
78 #define DBVERSION_74 8
79 
80 /* these two are defined by Microsoft for dbsetlversion() */
81 #define DBVER42 DBVERSION_42
82 #define DBVER60 DBVERSION_70 /* our best approximation */
83 
88 #define DBTDS_UNKNOWN 0
89 #define DBTDS_2_0 1 /* pre 4.0 SQL Server */
90 #define DBTDS_3_4 2 /* Microsoft SQL Server (3.0) */
91 #define DBTDS_4_0 3 /* 4.0 SQL Server */
92 #define DBTDS_4_2 4 /* 4.2 SQL Server */
93 #define DBTDS_4_6 5 /* 2.0 OpenServer and 4.6 SQL Server. */
94 #define DBTDS_4_9_5 6 /* 4.9.5 (NCR) SQL Server */
95 #define DBTDS_5_0 7 /* 5.0 SQL Server */
96 #define DBTDS_7_0 8 /* Microsoft SQL Server 7.0 */
97 #define DBTDS_8_0 9 /* Microsoft SQL Server 2000 */
98 #define DBTDS_9_0 10 /* Microsoft SQL Server 2005 */
99 #define DBTDS_7_1 9 /* Microsoft SQL Server 2000 */
100 #define DBTDS_7_2 10 /* Microsoft SQL Server 2005 */
101 #define DBTDS_7_3 11 /* Microsoft SQL Server 2008 */
102 #define DBTDS_7_4 12 /* Microsoft SQL Server 2012/2014 */
103 
104 #define DBTXPLEN 16
105 
106 #define BCPMAXERRS 1
107 #define BCPFIRST 2
108 #define BCPLAST 3
109 #define BCPBATCH 4
110 #define BCPKEEPIDENTITY 8
111 
112 #define BCPLABELED 5
113 #define BCPHINTS 6
114 
115 #define DBCMDNONE 0
116 #define DBCMDPEND 1
117 #define DBCMDSENT 2
118 
119 typedef int RETCODE;
120 
121 typedef void DBCURSOR;
122 typedef void DBXLATE;
123 typedef void DBSORTORDER;
124 typedef void DBLOGINFO;
125 typedef void *DBVOIDPTR;
126 typedef short SHORT;
127 typedef unsigned short USHORT;
128 typedef int (*INTFUNCPTR) (void *, ...);
129 typedef int (*DBWAITFUNC) (void);
130 typedef DBWAITFUNC(*DB_DBBUSY_FUNC) (void *dbproc);
131 typedef void (*DB_DBIDLE_FUNC) (DBWAITFUNC dfunc, void *dbproc);
132 typedef int (*DB_DBCHKINTR_FUNC) (void *dbproc);
133 typedef int (*DB_DBHNDLINTR_FUNC) (void *dbproc);
134 
135 #ifndef __INCvxWorksh
136 /* VxWorks already defines STATUS and BOOL. Compiler gets mad if you
137 ** redefine them. */
138 /* __INCvxWorksh will get #defined by std. include files included from tds.h
139 */
140 #ifdef STATUS
141 /* On DU4.0d we get a conflicting STATUS definition from arpa/nameser.h
142  when _REENTRANT is defined.
143 */
144 #undef STATUS
145 #endif
146 typedef int STATUS;
147 #if !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(DOS32X)
148 typedef int BOOL;
149 #endif
150 #endif
151 
152 #ifndef _tds_h_
153 /* copied from tds.h */
154 /* TODO find a best way... */
155 enum
156 {
157  SYBCHAR = 47, /* 0x2F */
158 #define SYBCHAR SYBCHAR
159  SYBVARCHAR = 39, /* 0x27 */
160 #define SYBVARCHAR SYBVARCHAR
161  SYBINTN = 38, /* 0x26 */
162 #define SYBINTN SYBINTN
163  SYBINT1 = 48, /* 0x30 */
164 #define SYBINT1 SYBINT1
165  SYBINT2 = 52, /* 0x34 */
166 #define SYBINT2 SYBINT2
167  SYBINT4 = 56, /* 0x38 */
168 #define SYBINT4 SYBINT4
169  SYBINT8 = 127, /* 0x7F */
170 #define SYBINT8 SYBINT8
171  SYBFLT8 = 62, /* 0x3E */
172 #define SYBFLT8 SYBFLT8
173  SYBDATETIME = 61, /* 0x3D */
174 #define SYBDATETIME SYBDATETIME
175  SYBBIT = 50, /* 0x32 */
176 #define SYBBIT SYBBIT
177  SYBBITN = 104, /* 0x68 */
178 #define SYBBITN SYBBITN
179  SYBTEXT = 35, /* 0x23 */
180 #define SYBTEXT SYBTEXT
181  SYBNTEXT = 99, /* 0x63 */
182 #define SYBNTEXT SYBNTEXT
183  SYBIMAGE = 34, /* 0x22 */
184 #define SYBIMAGE SYBIMAGE
185  SYBMONEY4 = 122, /* 0x7A */
186 #define SYBMONEY4 SYBMONEY4
187  SYBMONEY = 60, /* 0x3C */
188 #define SYBMONEY SYBMONEY
189  SYBDATETIME4 = 58, /* 0x3A */
190 #define SYBDATETIME4 SYBDATETIME4
191  SYBREAL = 59, /* 0x3B */
192 #define SYBREAL SYBREAL
193  SYBBINARY = 45, /* 0x2D */
194 #define SYBBINARY SYBBINARY
195  SYBVOID = 31, /* 0x1F */
196 #define SYBVOID SYBVOID
197  SYBVARBINARY = 37, /* 0x25 */
198 #define SYBVARBINARY SYBVARBINARY
199  SYBNUMERIC = 108, /* 0x6C */
200 #define SYBNUMERIC SYBNUMERIC
201  SYBDECIMAL = 106, /* 0x6A */
202 #define SYBDECIMAL SYBDECIMAL
203  SYBFLTN = 109, /* 0x6D */
204 #define SYBFLTN SYBFLTN
205  SYBMONEYN = 110, /* 0x6E */
206 #define SYBMONEYN SYBMONEYN
207  SYBDATETIMN = 111, /* 0x6F */
208 #define SYBDATETIMN SYBDATETIMN
209  SYBNVARCHAR = 103, /* 0x67 */
210 #define SYBNVARCHAR SYBNVARCHAR
211  SYBDATE = 49, /* 0x31 */
212 #define SYBDATE SYBDATE
213  SYBTIME = 51, /* 0x33 */
214 #define SYBTIME SYBTIME
215  SYBBIGDATETIME = 187, /* 0xBB */
216 #define SYBBIGDATETIME SYBBIGDATETIME
217  SYBBIGTIME = 188, /* 0xBC */
218 #define SYBBIGTIME SYBBIGTIME
219  SYBMSDATE = 40, /* 0x28 */
220 #define SYBMSDATE SYBMSDATE
221  SYBMSTIME = 41, /* 0x29 */
222 #define SYBMSTIME SYBMSTIME
223  SYBMSDATETIME2 = 42, /* 0x2A */
224 #define SYBMSDATETIME2 SYBMSDATETIME2
225  SYBMSDATETIMEOFFSET = 43, /* 0x2B */
226 #define SYBMSDATETIMEOFFSET SYBMSDATETIMEOFFSET
227 };
228 
229 #define SYBAOPCNT 0x4b
230 #define SYBAOPCNTU 0x4c
231 #define SYBAOPSUM 0x4d
232 #define SYBAOPSUMU 0x4e
233 #define SYBAOPAVG 0x4f
234 #define SYBAOPAVGU 0x50
235 #define SYBAOPMIN 0x51
236 #define SYBAOPMAX 0x52
237 
238 /* mssql2k compute operator */
239 #define SYBAOPCNT_BIG 0x09
240 #define SYBAOPSTDEV 0x30
241 #define SYBAOPSTDEVP 0x31
242 #define SYBAOPVAR 0x32
243 #define SYBAOPVARP 0x33
244 #define SYBAOPCHECKSUM_AGG 0x72
245 
246 #endif
247 
248 typedef unsigned char DBBOOL;
249 typedef char DBCHAR;
250 typedef unsigned char DBBIT;
251 typedef unsigned char DBTINYINT;
252 typedef int16_t DBSMALLINT;
253 typedef int32_t DBINT;
254 typedef int64_t DBBIGINT;
255 typedef unsigned char DBBINARY;
256 typedef tds_sysdep_real32_type DBREAL;
257 typedef tds_sysdep_real64_type DBFLT8;
258 typedef uint16_t DBUSMALLINT;
259 typedef uint32_t DBUINT;
260 typedef uint64_t DBUBIGINT;
261 
262 typedef struct
263 {
264  DBSMALLINT len;
265  char str[256];
266 } DBVARYCHAR;
267 
268 typedef struct
269 {
270  DBSMALLINT len;
271  unsigned char array[256];
272 } DBVARYBIN;
273 
274 typedef struct
275 {
276  unsigned char precision;
277  unsigned char scale;
278  unsigned char array[33];
279 } DBNUMERIC;
280 
281 typedef DBNUMERIC DBDECIMAL;
282 
283 typedef struct
284 {
285  DBINT mnyhigh;
286  DBUINT mnylow;
287 } DBMONEY;
288 
289 typedef struct
290 {
291  DBINT mny4;
292 } DBMONEY4;
293 
294 typedef struct
295 {
296  DBINT dtdays;
297  DBINT dttime;
298 } DBDATETIME;
299 
300 typedef struct
301 {
302  DBUSMALLINT days; /* days since Jan-1-1900 */
303  DBUSMALLINT minutes; /* minutes since midnight */
304 } DBDATETIME4;
305 
306 typedef struct
307 {
308  DBUBIGINT time;
309  DBINT date;
310  DBSMALLINT offset;
311  DBUSMALLINT time_prec:3;
312 /* fix a problem with some public headers defining _res */
313 #undef _res
314  DBUSMALLINT _res:10;
315  DBUSMALLINT has_time:1;
316  DBUSMALLINT has_date:1;
317  DBUSMALLINT has_offset:1;
318 } DBDATETIMEALL;
319 
320 #ifdef MSDBLIB
321 # define SQLCHAR SYBCHAR
322  typedef struct
323  {
324  DBUSMALLINT numdays;
325  DBUSMALLINT nummins;
326  } DBDATETIM4;
327 #endif
328 
329 typedef struct tds_dblib_loginrec LOGINREC;
330 
331 #ifndef DOS32X
332 typedef unsigned char BYTE;
333 #endif
334 
335 typedef struct dbtypeinfo
336 {
337  DBINT precision;
338  DBINT scale;
339 } DBTYPEINFO;
340 
341 struct dbstring
342 {
343  BYTE *strtext;
344  DBINT strtotlen;
345  struct dbstring *strnext;
346 };
347 typedef struct dbstring DBSTRING;
348 
349 /* Used by dbcolinfo */
350 enum
351 { MAXCOLNAMELEN = 512 }; /* duplicates TDS_SYSNAME_SIZE */
352 typedef enum { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 } CI_TYPE;
353 
354 typedef struct
355 {
356  DBINT SizeOfStruct;
357  DBCHAR Name[MAXCOLNAMELEN+2];
358  DBCHAR ActualName[MAXCOLNAMELEN+2];
359  DBCHAR TableName[MAXCOLNAMELEN+2];
360  SHORT Type;
361  DBINT UserType;
362  DBINT MaxLength;
363  BYTE Precision;
364  BYTE Scale;
365  BOOL VarLength;
366  BYTE Null;
367  BYTE CaseSensitive;
368  BYTE Updatable;
369  BOOL Identity;
370 
371 } DBCOL;
372 
373 typedef struct
374 {
375  DBINT SizeOfStruct;
376  DBCHAR Name[MAXCOLNAMELEN+2];
377  DBCHAR ActualName[MAXCOLNAMELEN+2];
378  DBCHAR TableName[MAXCOLNAMELEN+2];
379  SHORT Type;
380  DBINT UserType;
381  DBINT MaxLength;
382  BYTE Precision;
383  BYTE Scale;
384  BOOL VarLength;
385  BYTE Null;
386  BYTE CaseSensitive;
387  BYTE Updatable;
388  BOOL Identity;
389  SHORT ServerType;
390  DBINT ServerMaxLength;
391  DBCHAR ServerTypeDeclaration[256];
392 } DBCOL2;
393 /* end dbcolinfo stuff */
394 
395 
396 
397 /* a large list of options, DBTEXTSIZE is needed by sybtcl */
398 #define DBPARSEONLY 0
399 #define DBESTIMATE 1
400 #define DBSHOWPLAN 2
401 #define DBNOEXEC 3
402 #define DBARITHIGNORE 4
403 #define DBNOCOUNT 5
404 #define DBARITHABORT 6
405 #define DBTEXTLIMIT 7
406 #define DBBROWSE 8
407 #define DBOFFSET 9
408 #define DBSTAT 10
409 #define DBERRLVL 11
410 #define DBCONFIRM 12
411 #define DBSTORPROCID 13
412 #define DBBUFFER 14
413 #define DBNOAUTOFREE 15
414 #define DBROWCOUNT 16
415 #define DBTEXTSIZE 17
416 #define DBNATLANG 18
417 #define DBDATEFORMAT 19
418 #define DBPRPAD 20
419 #define DBPRCOLSEP 21
420 #define DBPRLINELEN 22
421 #define DBPRLINESEP 23
422 #define DBLFCONVERT 24
423 #define DBDATEFIRST 25
424 #define DBCHAINXACTS 26
425 #define DBFIPSFLAG 27
426 #define DBISOLATION 28
427 #define DBAUTH 29
428 #define DBIDENTITY 30
429 #define DBNOIDCOL 31
430 #define DBDATESHORT 32
431 #define DBCLIENTCURSORS 33
432 #define DBSETTIME 34
433 #define DBQUOTEDIDENT 35
434 
435 #define DBNUMOPTIONS 36
436 
437 #define DBPADOFF 0
438 #define DBPADON 1
439 
440 #define OFF 0
441 #define ON 1
442 
443 #define NOSUCHOPTION 2
444 
445 #define MAXOPTTEXT 32
446 
447 typedef struct tds_dblib_dbprocess DBPROCESS;
448 
449 /*
450  * Sybase & Microsoft use different names for the dbdaterec members.
451  * Keep these two structures physically identical in memory.
452  * dbdatecrack() casts one to the other for ease of implementation.
453  *
454  * Giving credit where credit is due, we can acknowledge that
455  * Microsoft chose the better names here, hands down. ("datedmonth"?!)
456  */
458 {
459  DBINT year; /* 1753 - 9999 */
460  DBINT quarter; /* 1 - 4 */
461  DBINT month; /* 1 - 12 */
462  DBINT day; /* 1 - 31 */
463  DBINT dayofyear; /* 1 - 366 */
464  DBINT week; /* 1 - 54 (for leap years) */
465  DBINT weekday; /* 1 - 7 (Mon. - Sun.) */
466  DBINT hour; /* 0 - 23 */
467  DBINT minute; /* 0 - 59 */
468  DBINT second; /* 0 - 59 */
469  DBINT millisecond; /* 0 - 999 */
470  DBINT tzone; /* -840 - 840 */
471 };
472 
474 {
475  DBINT dateyear; /* 1900 and counting */
476  DBINT quarter; /* 0 - 3 (Microsoft only) */
477  DBINT datemonth; /* 0 - 11 */
478  DBINT datedmonth; /* 1 - 31 */
479  DBINT datedyear; /* 1 - 366 */
480  DBINT week; /* 1 - 54 (Microsoft only) */
481  DBINT datedweek; /* 0 - 6 */
482  DBINT datehour; /* 0 - 23 */
483  DBINT dateminute; /* 0 - 59 */
484  DBINT datesecond; /* 0 - 59 */
485  DBINT datemsecond; /* 0 - 999 */
486  DBINT datetzone; /* -840 - 840 */
487 };
488 
490 {
491  DBINT year; /* 1753 - 9999 */
492  DBINT quarter; /* 1 - 4 */
493  DBINT month; /* 1 - 12 */
494  DBINT day; /* 1 - 31 */
495  DBINT dayofyear; /* 1 - 366 */
496  DBINT week; /* 1 - 54 (for leap years) */
497  DBINT weekday; /* 1 - 7 (Mon. - Sun.) */
498  DBINT hour; /* 0 - 23 */
499  DBINT minute; /* 0 - 59 */
500  DBINT second; /* 0 - 59 */
501  DBINT nanosecond; /* 0 - 999999999 */
502  DBINT tzone; /* 0 - 127 (Sybase only) */
503 };
504 
506 {
507  DBINT dateyear; /* 1900 and counting */
508  DBINT quarter; /* 0 - 3 (Microsoft only) */
509  DBINT datemonth; /* 0 - 11 */
510  DBINT datedmonth; /* 1 - 31 */
511  DBINT datedyear; /* 1 - 366 */
512  DBINT week; /* 1 - 54 (Microsoft only) */
513  DBINT datedweek; /* 0 - 6 */
514  DBINT datehour; /* 0 - 23 */
515  DBINT dateminute; /* 0 - 59 */
516  DBINT datesecond; /* 0 - 59 */
517  DBINT datensecond; /* 0 - 999999999 */
518  DBINT datetzone; /* 0 - 127 */
519 };
520 
521 
522 #ifdef MSDBLIB
523 typedef struct tds_microsoft_dbdaterec DBDATEREC;
524 typedef struct tds_microsoft_dbdaterec2 DBDATEREC2;
525 #else
526 typedef struct tds_sybase_dbdaterec DBDATEREC;
527 typedef struct tds_sybase_dbdaterec2 DBDATEREC2;
528 #endif
529 
530 typedef int (*EHANDLEFUNC) (DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr);
531 
532 typedef int (*MHANDLEFUNC) (DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname,
533  char *proc, int line);
534 
535 /* dbpoll() result codes, sybtcl needs DBRESULT */
536 #define DBRESULT 1
537 #define DBNOTIFICATION 2
538 #define DBTIMEOUT 3
539 #define DBINTERRUPT 4
540 
541 /* more sybtcl needs: */
542 #define DBTXTSLEN 8
543 
544 /* bind types */
545 #define CHARBIND 0
546 #define STRINGBIND 1
547 #define NTBSTRINGBIND 2
548 #define VARYCHARBIND 3
549 #define VARYBINBIND 4
550 #define TINYBIND 6
551 #define SMALLBIND 7
552 #define INTBIND 8
553 #define FLT8BIND 9
554 #define REALBIND 10
555 #define DATETIMEBIND 11
556 #define SMALLDATETIMEBIND 12
557 #define MONEYBIND 13
558 #define SMALLMONEYBIND 14
559 #define BINARYBIND 15
560 #define BITBIND 16
561 #define NUMERICBIND 17
562 #define DECIMALBIND 18
563 #define SRCNUMERICBIND 19
564 #define SRCDECIMALBIND 20
565 #define DATEBIND 21
566 #define TIMEBIND 22
567 #define BIGDATETIMEBIND 23
568 #define BIGTIMEBIND 24
569 #define BIGINTBIND 30
570 #define DATETIME2BIND 31
571 #define MAXBINDTYPES 32 /* keep last */
572 
573 #define DBPRCOLSEP 21
574 #define DBPRLINELEN 22
575 #define DBRPCNORETURN 0
576 #define DBRPCRETURN 1
577 #define DBRPCDEFAULT 2
578 
579 #define REG_ROW -1
580 #define MORE_ROWS -1
581 #define NO_MORE_ROWS -2
582 #define BUF_FULL -3
583 #define NO_MORE_RESULTS 2
584 #define SUCCEED 1
585 #define FAIL 0
586 
587 #define DB_IN 1
588 #define DB_OUT 2
589 #define DB_QUERYOUT 3
590 
591 #define DBSINGLE 0
592 #define DBDOUBLE 1
593 #define DBBOTH 2
594 
595 /* remote procedure call (rpc) options */
596 #define DBRPCRECOMPILE TDS_STATIC_CAST(DBSMALLINT, 0x0001)
597 #define DBRPCRESET TDS_STATIC_CAST(DBSMALLINT, 0x0002)
598 #define DBRPCCURSOR TDS_STATIC_CAST(DBSMALLINT, 0x0008)
599 
600 #if defined(DBLIB_UNIMPLEMENTED)
601 DBBOOL db12hour(DBPROCESS * dbprocess, const char language[]);
602 
603 DBBOOL dbcolbrowse(DBPROCESS * dbprocess, int colnum);
604 
605 RETCODE dbcursor(DBCURSOR * hc, DBINT optype, DBINT bufno, BYTE * table, BYTE * values);
606 RETCODE dbcursorbind(DBCURSOR * hc, int col, int vartype, DBINT varlen, DBINT * poutlen, BYTE * pvaraddr, DBTYPEINFO * typeinfo);
607 void dbcursorclose(DBCURSOR * hc);
608 RETCODE dbcursorcolinfo(DBCURSOR * hc, DBINT column, DBCHAR * colname, DBINT * coltype, DBINT * collen, DBINT * usertype);
609 RETCODE dbcursorfetch(DBCURSOR * hc, DBINT fetchtype, DBINT rownum);
610 RETCODE dbcursorinfo(DBCURSOR * hc, DBINT * ncols, DBINT * nrows);
611 DBCURSOR *dbcursoropen(DBPROCESS * dbprocess, BYTE * stmt, SHORT scollopt, SHORT concuropt, USHORT nrows, DBINT * pstatus);
612 
613 int dbdate4cmp(DBPROCESS * dbprocess, DBDATETIME4 * d1, DBDATETIME4 * d2);
614 RETCODE dbdate4zero(DBPROCESS * dbprocess, DBDATETIME4 * d1);
615 RETCODE dbdatechar(DBPROCESS * dbprocess, char *buf, int datepart, int value);
616 int dbdatename(DBPROCESS * dbprocess, char *buf, int date, DBDATETIME * datetime);
617 char *dateorder(DBPROCESS * dbprocess, char *language);
618 DBINT dbdatepart(DBPROCESS * dbprocess, int datepart, DBDATETIME * datetime);
619 RETCODE dbdatezero(DBPROCESS * dbprocess, DBDATETIME * d1);
620 char *dbdayname(DBPROCESS * dbprocess, char *language, int daynum);
621 
622 int dbgetoff(DBPROCESS * dbprocess, DBUSMALLINT offtype, int startfrom);
623 
624 char *dbqual(DBPROCESS * dbprocess, int tabnum, char *tabname);
625 void dbfreequal(char *qualptr);
626 
627 DBSORTORDER *dbloadsort(DBPROCESS * dbprocess);
628 RETCODE dbfreesort(DBPROCESS * dbprocess, DBSORTORDER * sortorder);
629 
630 RETCODE dbload_xlate(DBPROCESS * dbprocess, char *srv_charset, char *clt_name, DBXLATE ** xlt_tosrv, DBXLATE ** xlt_todisp);
631 
632 RETCODE dbmny4divide(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * quotient);
633 RETCODE dbmny4mul(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * prod);
634 RETCODE dbmnyadd(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * sum);
635 RETCODE dbmnydivide(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * quotient);
636 RETCODE dbmnydown(DBPROCESS * dbproc, DBMONEY * mnyptr, int divisor, int *remainder);
637 RETCODE dbmnyinit(DBPROCESS * dbproc, DBMONEY * mnyptr, int trim, DBBOOL * negative);
638 RETCODE dbmnyndigit(DBPROCESS * dbproc, DBMONEY * mnyptr, DBCHAR * value, DBBOOL * zero);
639 RETCODE dbmnymul(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * prod);
640 RETCODE dbmnydigit(DBPROCESS * dbprocess, DBMONEY * m1, DBCHAR * value, DBBOOL * zero);
641 RETCODE dbmnyscale(DBPROCESS * dbproc, DBMONEY * dest, int multiplier, int addend);
642 
643 
644 RETCODE dbnpcreate(DBPROCESS * dbprocess);
645 RETCODE dbnpdefine(DBPROCESS * dbprocess, DBCHAR * procedure_name, DBSMALLINT namelen);
646 
647 int DBNUMORDERS(DBPROCESS * dbprocess);
648 
649 RETCODE dbpoll(DBPROCESS * dbproc, long milliseconds, DBPROCESS ** ready_dbproc, int *return_reason);
650 int dbordercol(DBPROCESS * dbprocess, int order);
651 
652 RETCODE dbregdrop(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen);
653 RETCODE dbregexec(DBPROCESS * dbproc, DBUSMALLINT options);
654 RETCODE dbreghandle(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, INTFUNCPTR handler);
655 RETCODE dbreginit(DBPROCESS * dbproc, DBCHAR * procedure_name, DBSMALLINT namelen);
656 RETCODE dbreglist(DBPROCESS * dbproc);
657 RETCODE dbregnowatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen);
658 RETCODE dbregparam(DBPROCESS * dbproc, char *param_name, int type, DBINT datalen, BYTE * data);
659 RETCODE dbregwatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, DBUSMALLINT options);
660 RETCODE dbregwatchlist(DBPROCESS * dbprocess);
661 
662 void dbrpwclr(LOGINREC * login);
663 RETCODE dbrpwset(LOGINREC * login, char *srvname, char *password, int pwlen);
664 
665 DBINT dbreadpage(DBPROCESS * dbprocess, char *p_dbname, DBINT pageno, BYTE * buf);
666 RETCODE dbwritepage(DBPROCESS * dbprocess, char *p_dbname, DBINT pageno, DBINT size, BYTE * buf);
667 
668 RETCODE dbsetdeflang(char *language);
669 
670 int dbstrcmp(DBPROCESS * dbprocess, char *s1, int l1, char *s2, int l2, DBSORTORDER * sort);
671 int dbstrsort(DBPROCESS * dbprocess, char *s1, int l1, char *s2, int l2, DBSORTORDER * sort);
672 
673 DBBOOL dbtabbrowse(DBPROCESS * dbprocess, int tabnum);
674 int dbtabcount(DBPROCESS * dbprocess);
675 char *dbtabname(DBPROCESS * dbprocess, int tabnum);
676 char *dbtabsource(DBPROCESS * dbprocess, int colnum, int *tabnum);
677 
678 RETCODE dbsendpassthru(DBPROCESS * dbprocess, DBVOIDPTR bufp);
679 RETCODE dbrecvpassthru(DBPROCESS * dbprocess, DBVOIDPTR * bufp);
680 
681 RETCODE dbgetloginfo(DBPROCESS * dbprocess, DBLOGINFO ** loginfo);
682 RETCODE dbsetloginfo(LOGINREC * loginrec, DBLOGINFO * loginfo);
683 
684 int dbtsnewlen(DBPROCESS * dbprocess);
685 DBBINARY *dbtsnewval(DBPROCESS * dbprocess);
686 RETCODE dbtsput(DBPROCESS * dbprocess, DBBINARY * newts, int newtslen, int tabnum, char *tabname);
687 
688 RETCODE dbfree_xlate(DBPROCESS * dbprocess, DBXLATE * xlt_tosrv, DBXLATE * clt_todisp);
689 int dbxlate(DBPROCESS * dbprocess, char *src, int srclen, char *dest, int destlen, DBXLATE * xlt, int *srcbytes_used,
690  DBBOOL srcend, int status);
691 
692 RETCODE bcp_moretext(DBPROCESS * dbproc, DBINT size, BYTE * text);
693 RETCODE bcp_writefmt(DBPROCESS * dbproc, const char filename[]);
694 
695 void build_xact_string(char *xact_name, char *service_name, DBINT commid, char *result);
696 RETCODE remove_xact(DBPROCESS * connect, DBINT commid, int n);
697 RETCODE abort_xact(DBPROCESS * connect, DBINT commid);
698 void close_commit(DBPROCESS * connect);
699 RETCODE commit_xact(DBPROCESS * connect, DBINT commid);
700 DBPROCESS *open_commit(LOGINREC * login, char *servername);
701 RETCODE scan_xact(DBPROCESS * connect, DBINT commid);
702 DBINT start_xact(DBPROCESS * connect, char *application_name, char *xact_name, int site_count);
703 DBINT stat_xact(DBPROCESS * connect, DBINT commid);
704 
705 #endif /* define unimplemented */
706 
707 BYTE *dbadata(DBPROCESS * dbproc, int computeid, int column);
708 DBINT dbadlen(DBPROCESS * dbproc, int computeid, int column);
709 RETCODE dbaltbind(DBPROCESS * dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE * varaddr);
710 RETCODE dbaltbind_ps(DBPROCESS * dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE * varaddr,
711  DBTYPEINFO * typeinfo);
712 int dbaltcolid(DBPROCESS * dbproc, int computeid, int column);
713 DBINT dbaltlen(DBPROCESS * dbproc, int computeid, int column);
714 int dbaltop(DBPROCESS * dbproc, int computeid, int column);
715 int dbalttype(DBPROCESS * dbproc, int computeid, int column);
716 DBINT dbaltutype(DBPROCESS * dbproc, int computeid, int column);
717 RETCODE dbanullbind(DBPROCESS * dbprocess, int computeid, int column, DBINT * indicator);
718 RETCODE dbbind(DBPROCESS * dbproc, int column, int vartype, DBINT varlen, BYTE * varaddr);
719 RETCODE dbbind_ps(DBPROCESS * dbprocess, int column, int vartype, DBINT varlen, BYTE * varaddr, DBTYPEINFO * typeinfo);
720 int dbbufsize(DBPROCESS * dbprocess);
721 BYTE *dbbylist(DBPROCESS * dbproc, int computeid, int *size);
722 RETCODE dbcancel(DBPROCESS * dbproc);
723 RETCODE dbcanquery(DBPROCESS * dbproc);
724 char *dbchange(DBPROCESS * dbprocess);
725 DBBOOL dbcharsetconv(DBPROCESS * dbprocess);
726 void dbclose(DBPROCESS * dbproc);
727 void dbclrbuf(DBPROCESS * dbproc, DBINT n);
728 RETCODE dbclropt(DBPROCESS * dbproc, int option, const char param[]);
729 RETCODE dbcmd(DBPROCESS * dbproc, const char cmdstring[]);
730 RETCODE dbcmdrow(DBPROCESS * dbproc);
731 
732 #define DBCMDROW(x) dbcmdrow((x))
733 RETCODE dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol );
734 RETCODE dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol);
735 DBINT dbcollen(DBPROCESS * dbproc, int column);
736 char *dbcolname(DBPROCESS * dbproc, int column);
737 const char *dbacolname(DBPROCESS * dbproc, int computeid, int column);
738 char *dbcolsource(DBPROCESS * dbproc, int colnum);
739 int dbcoltype(DBPROCESS * dbproc, int column);
740 DBTYPEINFO *dbcoltypeinfo(DBPROCESS * dbproc, int column);
741 DBINT dbcolutype(DBPROCESS * dbprocess, int column);
742 DBINT dbconvert(DBPROCESS * dbproc, int srctype, const BYTE * src, DBINT srclen, int desttype, BYTE * dest, DBINT destlen);
743 DBINT dbconvert_ps(DBPROCESS * dbprocess, int srctype, const BYTE * src, DBINT srclen, int desttype, BYTE * dest, DBINT destlen,
744  DBTYPEINFO * typeinfo);
745 BOOL dbiscount(DBPROCESS * dbproc);
746 DBINT dbcount(DBPROCESS * dbproc);
747 
748 #define DBCOUNT(x) dbcount((x))
749 int dbcurcmd(DBPROCESS * dbproc);
750 
751 #define DBCURCMD(x) dbcurcmd((x))
752 DBINT dbcurrow(DBPROCESS * dbproc);
753 
754 #define DBCURROW(x) dbcurrow((x))
755 BYTE *dbdata(DBPROCESS * dbproc, int column);
756 int dbdatecmp(DBPROCESS * dbproc, DBDATETIME * d1, DBDATETIME * d2);
757 RETCODE dbdatecrack(DBPROCESS * dbproc, DBDATEREC * di, DBDATETIME * dt);
758 RETCODE dbanydatecrack(DBPROCESS * dbproc, DBDATEREC2 * di, int type, const void *data);
759 DBINT dbdatlen(DBPROCESS * dbproc, int column);
760 DBBOOL dbdead(DBPROCESS * dbproc);
761 
762 #define DBDEAD(x) dbdead((x))
763 EHANDLEFUNC dberrhandle(EHANDLEFUNC handler);
764 void dbexit(void);
765 RETCODE dbfcmd(DBPROCESS * dbproc, const char *fmt, ...);
766 DBINT dbfirstrow(DBPROCESS * dbproc);
767 
768 #define DBFIRSTROW(x) dbfirstrow((x))
769 void dbfreebuf(DBPROCESS * dbproc);
770 char *dbgetchar(DBPROCESS * dbprocess, int n);
771 char *dbgetcharset(DBPROCESS * dbprocess);
772 int dbgetlusername(LOGINREC * login, BYTE * name_buffer, int buffer_len);
773 int dbgetmaxprocs(void);
774 char *dbgetnatlanf(DBPROCESS * dbprocess);
775 int dbgetpacket(DBPROCESS * dbproc);
776 RETCODE dbgetrow(DBPROCESS * dbproc, DBINT row);
777 int dbgettime(void);
778 #define DBGETTIME dbgettime
779 BYTE *dbgetuserdata(DBPROCESS * dbproc);
780 DBBOOL dbhasretstat(DBPROCESS * dbproc);
781 RETCODE dbinit(void);
782 int dbiordesc(DBPROCESS * dbproc);
783 
784 #define DBIORDESC(x) dbiordesc((x))
785 int dbiowdesc(DBPROCESS * dbproc);
786 
787 #define DBIOWDESC(x) dbiowdesc((x))
788 DBBOOL dbisavail(DBPROCESS * dbprocess);
789 
790 #define DBISAVAIL(x) dbisavail((x))
791 DBBOOL dbisopt(DBPROCESS * dbproc, int option, const char param[]);
792 DBINT dblastrow(DBPROCESS * dbproc);
793 
794 #define DBLASTROW(x) dblastrow((x))
795 LOGINREC *dblogin(void);
796 void dbloginfree(LOGINREC * login);
797 
798 int dbmny4cmp(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2);
799 int dbmnycmp(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2);
800 
801 RETCODE dbmny4add(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * sum);
802 RETCODE dbmnydec(DBPROCESS * dbproc, DBMONEY * mnyptr);
803 RETCODE dbmnyinc(DBPROCESS * dbproc, DBMONEY * mnyptr);
804 RETCODE dbmnymaxpos(DBPROCESS * dbproc, DBMONEY * dest);
805 RETCODE dbmnymaxneg(DBPROCESS * dbproc, DBMONEY * dest);
806 RETCODE dbmny4minus(DBPROCESS * dbproc, DBMONEY4 * src, DBMONEY4 * dest);
807 RETCODE dbmnyminus(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest);
808 RETCODE dbmny4sub(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * diff);
809 RETCODE dbmnysub(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * diff);
810 
811 RETCODE dbmny4copy(DBPROCESS * dbprocess, DBMONEY4 * m1, DBMONEY4 * m2);
812 RETCODE dbmnycopy(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest);
813 
814 RETCODE dbmny4zero(DBPROCESS * dbproc, DBMONEY4 * dest);
815 RETCODE dbmnyzero(DBPROCESS * dbproc, DBMONEY * dest);
816 
817 const char *dbmonthname(DBPROCESS * dbproc, char *language, int monthnum, DBBOOL shortform);
818 RETCODE dbmorecmds(DBPROCESS * dbproc);
819 
820 #define DBMORECMDS(x) dbmorecmds((x))
821 RETCODE dbmoretext(DBPROCESS * dbproc, DBINT size, const BYTE text[]);
822 MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler);
823 char *dbname(DBPROCESS * dbproc);
824 STATUS dbnextrow(DBPROCESS * dbproc);
825 RETCODE dbnullbind(DBPROCESS * dbproc, int column, DBINT * indicator);
826 int dbnumalts(DBPROCESS * dbproc, int computeid);
827 int dbnumcols(DBPROCESS * dbproc);
828 int dbnumcompute(DBPROCESS * dbprocess);
829 int dbnumrets(DBPROCESS * dbproc);
830 DBPROCESS *tdsdbopen(LOGINREC * login, const char *server, int msdblib);
831 DBPROCESS *dbopen(LOGINREC * login, const char *server);
832 
833 /* pivot functions */
834 struct col_t;
835 void dbpivot_count (struct col_t *output, const struct col_t *input);
836 void dbpivot_sum (struct col_t *output, const struct col_t *input);
837 void dbpivot_min (struct col_t *output, const struct col_t *input);
838 void dbpivot_max (struct col_t *output, const struct col_t *input);
839 
840 struct pivot_t;
841 typedef void (*DBPIVOT_FUNC)(struct col_t *output, const struct col_t *input);
842 struct pivot_t * dbrows_pivoted(DBPROCESS *dbproc);
843 STATUS dbnextrow_pivoted(DBPROCESS *dbproc, struct pivot_t *pp);
844 RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val);
845 
846 DBPIVOT_FUNC dbpivot_lookup_name( const char name[] );
847 
848 #ifdef MSDBLIB
849 #define dbopen(x,y) tdsdbopen((x),(y), 1)
850 #else
851 #define dbopen(x,y) tdsdbopen((x),(y), 0)
852 #endif
853 
854 /* fix PHP problem */
855 #ifdef PHP_SYBASE_DBOPEN
856 #undef PHP_SYBASE_DBOPEN
857 #define PHP_SYBASE_DBOPEN dbopen
858 #endif
859 
860 void dbprhead(DBPROCESS * dbproc);
861 DBINT dbprcollen(DBPROCESS * dbproc, int column);
862 RETCODE dbprrow(DBPROCESS * dbproc);
863 const char *dbprtype(int token);
864 DBBOOL DRBUF(DBPROCESS * dbprocess);
865 STATUS dbreadtext(DBPROCESS * dbproc, void *buf, DBINT bufsize);
866 void dbrecftos(const char filename[]);
867 RETCODE dbresults(DBPROCESS * dbproc);
868 RETCODE dbresults_r(DBPROCESS * dbproc, int recursive);
869 BYTE *dbretdata(DBPROCESS * dbproc, int retnum);
870 int dbretlen(DBPROCESS * dbproc, int retnum);
871 char *dbretname(DBPROCESS * dbproc, int retnum);
872 DBINT dbretstatus(DBPROCESS * dbproc);
873 int dbrettype(DBPROCESS * dbproc, int retnum);
874 RETCODE dbrows(DBPROCESS * dbproc);
875 
876 #define DBROWS(x) dbrows((x))
877 STATUS dbrowtype(DBPROCESS * dbprocess);
878 
879 #define DBROWTYPE(x) dbrowtype((x))
880 RETCODE dbrpcinit(DBPROCESS * dbproc, const char rpcname[], DBSMALLINT options);
881 RETCODE dbrpcparam(DBPROCESS * dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE * value);
882 RETCODE dbrpcsend(DBPROCESS * dbproc);
883 RETCODE dbsafestr(DBPROCESS * dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype);
884 RETCODE *dbsechandle(DBINT type, INTFUNCPTR handler);
885 char *dbservcharset(DBPROCESS * dbprocess);
886 void dbsetavail(DBPROCESS * dbprocess);
887 void dbsetbusy(DBPROCESS * dbprocess, DB_DBBUSY_FUNC busyfunc);
888 RETCODE dbsetdefcharset(char *charset);
889 void dbsetidle(DBPROCESS * dbprocess, DB_DBIDLE_FUNC idlefunc);
890 void dbsetifile(char *filename);
891 void dbsetinterrupt(DBPROCESS * dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr);
892 RETCODE dbsetlogintime(int seconds);
893 RETCODE dbsetmaxprocs(int maxprocs);
894 RETCODE dbsetnull(DBPROCESS * dbprocess, int bindtype, int bindlen, BYTE * bindval);
895 RETCODE dbsetopt(DBPROCESS * dbproc, int option, const char *char_param, int int_param);
896 STATUS dbsetrow(DBPROCESS * dbprocess, DBINT row);
897 RETCODE dbsettime(int seconds);
898 void dbsetuserdata(DBPROCESS * dbproc, BYTE * ptr);
899 RETCODE dbsetversion(DBINT version);
900 
901 int dbspid(DBPROCESS * dbproc);
902 RETCODE dbspr1row(DBPROCESS * dbproc, char *buffer, DBINT buf_len);
903 DBINT dbspr1rowlen(DBPROCESS * dbproc);
904 RETCODE dbsprhead(DBPROCESS * dbproc, char *buffer, DBINT buf_len);
905 RETCODE dbsprline(DBPROCESS * dbproc, char *buffer, DBINT buf_len, DBCHAR line_char);
906 RETCODE dbsqlexec(DBPROCESS * dbproc);
907 RETCODE dbsqlok(DBPROCESS * dbproc);
908 RETCODE dbsqlsend(DBPROCESS * dbproc);
909 int dbstrbuild(DBPROCESS * dbproc, char *charbuf, int bufsize, char *text, char *formats, ...);
910 RETCODE dbstrcpy(DBPROCESS * dbproc, int start, int numbytes, char *dest);
911 int dbstrlen(DBPROCESS * dbproc);
912 DBINT dbvarylen(DBPROCESS * dbproc, int column);
913 
914 #define SYBEVERDOWN 100 /* TDS version downgraded . */
915 #define SYBEICONVIU 2400 /* Some character(s) could not be converted into client's character set. */
916 #define SYBEICONVAVAIL 2401 /* Character set conversion is not available between client character set '%.*s' and server character set '%.*s'.*/
917 #define SYBEICONVO 2402 /* Error converting characters into server's character set. Some character(s) could not be converted.*/
918 #define SYBEICONVI 2403 /* Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?').*/
919 #define SYBEICONV2BIG 2404 /* Buffer overflow converting characters from client into server's character set.*/
920  /* cf. doc/dblib_errors.txt for more iconv error values. */
921  /* Reserve a few slots for other iconv-related issues. */
922 #define SYBETDSVER 2410 /* Cannot bcp with TDSVER < 5.0 */
923 #define SYBEPORT 2500 /* Both port and instance specified */
924 #define SYBESYNC 20001 /* Read attempted while out of synchronization with SQL Server. */
925 #define SYBEFCON 20002 /* SQL Server connection failed. */
926 #define SYBETIME 20003 /* SQL Server connection timed out. */
927 #define SYBEREAD 20004 /* Read from SQL Server failed. */
928 #define SYBEBUFL 20005 /* DB-LIBRARY internal error - send buffer length corrupted. */
929 #define SYBEWRIT 20006 /* Write to SQL Server failed. */
930 #define SYBEVMS 20007 /* Sendflush: VMS I/O error. */
931 #define SYBESOCK 20008 /* Unable to open socket */
932 #define SYBECONN 20009 /* Unable to connect socket -- SQL Server is unavailable or does not exist. */
933 #define SYBEMEM 20010 /* Unable to allocate sufficient memory */
934 #define SYBEDBPS 20011 /* Maximum number of DBPROCESSes already allocated. */
935 #define SYBEINTF 20012 /* Server name not found in interface file */
936 #define SYBEUHST 20013 /* Unknown host machine name */
937 #define SYBEPWD 20014 /* Incorrect password. */
938 #define SYBEOPIN 20015 /* Could not open interface file. */
939 #define SYBEINLN 20016 /* Interface file: unexpected end-of-line. */
940 #define SYBESEOF 20017 /* Unexpected EOF from SQL Server. */
941 #define SYBESMSG 20018 /* General SQL Server error: Check messages from the SQL Server. */
942 #define SYBERPND 20019 /* Attempt to initiate a new SQL Server operation with results pending. */
943 #define SYBEBTOK 20020 /* Bad token from SQL Server: Data-stream processing out of sync. */
944 #define SYBEITIM 20021 /* Illegal timeout value specified. */
945 #define SYBEOOB 20022 /* Error in sending out-of-band data to SQL Server. */
946 #define SYBEBTYP 20023 /* Unknown bind type passed to DB-LIBRARY function. */
947 #define SYBEBNCR 20024 /* Attempt to bind user variable to a non-existent compute row. */
948 #define SYBEIICL 20025 /* Illegal integer column length returned by SQL Server. Legal integer lengths are 1, 2, and 4 bytes. */
949 #define SYBECNOR 20026 /* Column number out of range. */
950 #define SYBENPRM 20027 /* NULL parameter not allowed for this dboption. */
951 #define SYBEUVDT 20028 /* Unknown variable-length datatype encountered. */
952 #define SYBEUFDT 20029 /* Unknown fixed-length datatype encountered. */
953 #define SYBEWAID 20030 /* DB-LIBRARY internal error: ALTFMT following ALTNAME has wrong id. */
954 #define SYBECDNS 20031 /* Datastream indicates that a compute column is derived from a non-existent select-list member. */
955 #define SYBEABNC 20032 /* Attempt to bind to a non-existent column. */
956 #define SYBEABMT 20033 /* User attempted a dbbind() with mismatched column and variable types. */
957 #define SYBEABNP 20034 /* Attempt to bind using NULL pointers. */
958 #define SYBEAAMT 20035 /* User attempted a dbaltbind() with mismatched column and variable types. */
959 #define SYBENXID 20036 /* The Server did not grant us a distributed-transaction ID. */
960 #define SYBERXID 20037 /* The Server did not recognize our distributed-transaction ID. */
961 #define SYBEICN 20038 /* Invalid computeid or compute column number. */
962 #define SYBENMOB 20039 /* No such member of 'order by' clause. */
963 #define SYBEAPUT 20040 /* Attempt to print unknown token. */
964 #define SYBEASNL 20041 /* Attempt to set fields in a null loginrec. */
965 #define SYBENTLL 20042 /* Name too long for loginrec field. */
966 #define SYBEASUL 20043 /* Attempt to set unknown loginrec field. */
967 #define SYBERDNR 20044 /* Attempt to retrieve data from a non-existent row. */
968 #define SYBENSIP 20045 /* Negative starting index passed to dbstrcpy(). */
969 #define SYBEABNV 20046 /* Attempt to bind to a NULL program variable. */
970 #define SYBEDDNE 20047 /* DBPROCESS is dead or not enabled. */
971 #define SYBECUFL 20048 /* Data-conversion resulted in underflow. */
972 #define SYBECOFL 20049 /* Data-conversion resulted in overflow. */
973 #define SYBECSYN 20050 /* Attempt to convert data stopped by syntax error in source field. */
974 #define SYBECLPR 20051 /* Data-conversion resulted in loss of precision. */
975 #define SYBECNOV 20052 /* Attempt to set variable to NULL resulted in overflow. */
976 #define SYBERDCN 20053 /* Requested data-conversion does not exist. */
977 #define SYBESFOV 20054 /* dbsafestr() overflowed its destination buffer. */
978 #define SYBEUNT 20055 /* Unknown network type found in interface file. */
979 #define SYBECLOS 20056 /* Error in closing network connection. */
980 #define SYBEUAVE 20057 /* Unable to allocate VMS event flag. */
981 #define SYBEUSCT 20058 /* Unable to set communications timer. */
982 #define SYBEEQVA 20059 /* Error in queueing VMS AST routine. */
983 #define SYBEUDTY 20060 /* Unknown datatype encountered. */
984 #define SYBETSIT 20061 /* Attempt to call dbtsput() with an invalid timestamp. */
985 #define SYBEAUTN 20062 /* Attempt to update the timestamp of a table which has no timestamp column. */
986 #define SYBEBDIO 20063 /* Bad bulk-copy direction. Must be either IN or OUT. */
987 #define SYBEBCNT 20064 /* Attempt to use Bulk Copy with a non-existent Server table. */
988 #define SYBEIFNB 20065 /* Illegal field number passed to bcp_control(). */
989 #define SYBETTS 20066 /* The table which bulk-copy is attempting to copy to a host-file is shorter than the number of rows which bulk-copy was instructed to skip. */
990 #define SYBEKBCO 20067 /* 1000 rows successfully bulk-copied to host-file. */
991 #define SYBEBBCI 20068 /* Batch successfully bulk-copied to SQL Server. */
992 #define SYBEKBCI 20069 /* Bcp: 1000 rows sent to SQL Server. */
993 #define SYBEBCRE 20070 /* I/O error while reading bcp data-file. */
994 #define SYBETPTN 20071 /* Syntax error: only two periods are permitted in table names. */
995 #define SYBEBCWE 20072 /* I/O error while writing bcp data-file. */
996 #define SYBEBCNN 20073 /* Attempt to bulk-copy a NULL value into Server column %d, which does not accept NULL values. */
997 #define SYBEBCOR 20074 /* Attempt to bulk-copy an oversized row to the SQL Server. */
998 #define SYBEBCIS 20075 /* Attempt to bulk-copy an illegally-sized column value to the SQL Server. */
999 #define SYBEBCPI 20076 /* bcp_init() must be called before any other bcp routines. */
1000 #define SYBEBCPN 20077 /* bcp_bind(), bcp_collen(), bcp_colptr(), bcp_moretext() and bcp_sendrow() may be used only after bcp_init() has been called with the copy direction set to DB_IN. */
1001 #define SYBEBCPB 20078 /* bcp_bind(), bcp_moretext() and bcp_sendrow() may NOT be used after bcp_init() has been passed a non-NULL input file name. */
1002 #define SYBEVDPT 20079 /* For bulk copy, all variable-length data must have either a length-prefix or a terminator specified. */
1003 #define SYBEBIVI 20080 /* bcp_columns(), bcp_colfmt() and bcp_colfmt_ps() may be used only after bcp_init() has been passed a valid input file. */
1004 #define SYBEBCBC 20081 /* bcp_columns() must be called before bcp_colfmt() and bcp_colfmt_ps(). */
1005 #define SYBEBCFO 20082 /* Bcp host-files must contain at least one column. */
1006 #define SYBEBCVH 20083 /* bcp_exec() may be called only after bcp_init() has been passed a valid host file. */
1007 #define SYBEBCUO 20084 /* Bcp: Unable to open host data-file. */
1008 #define SYBEBCUC 20085 /* Bcp: Unable to close host data-file. */
1009 #define SYBEBUOE 20086 /* Bcp: Unable to open error-file. */
1010 #define SYBEBUCE 20087 /* Bcp: Unable to close error-file. */
1011 #define SYBEBWEF 20088 /* I/O error while writing bcp error-file. */
1012 #define SYBEASTF 20089 /* VMS: Unable to setmode for control_c ast. */
1013 #define SYBEUACS 20090 /* VMS: Unable to assign channel to sys$command. */
1014 #define SYBEASEC 20091 /* Attempt to send an empty command buffer to the SQL Server. */
1015 #define SYBETMTD 20092 /* Attempt to send too much TEXT data via the dbmoretext() call. */
1016 #define SYBENTTN 20093 /* Attempt to use dbtxtsput() to put a new text-timestamp into a non-existent data row. */
1017 #define SYBEDNTI 20094 /* Attempt to use dbtxtsput() to put a new text-timestamp into a column whose datatype is neither SYBTEXT nor SYBIMAGE. */
1018 #define SYBEBTMT 20095 /* Attempt to send too much TEXT data via the bcp_moretext() call. */
1019 #define SYBEORPF 20096 /* Attempt to set remote password would overflow the login-record's remote-password field. */
1020 #define SYBEUVBF 20097 /* Attempt to read an unknown version of BCP format-file. */
1021 #define SYBEBUOF 20098 /* Bcp: Unable to open format-file. */
1022 #define SYBEBUCF 20099 /* Bcp: Unable to close format-file. */
1023 #define SYBEBRFF 20100 /* I/O error while reading bcp format-file. */
1024 #define SYBEBWFF 20101 /* I/O error while writing bcp format-file. */
1025 #define SYBEBUDF 20102 /* Bcp: Unrecognized datatype found in format-file. */
1026 #define SYBEBIHC 20103 /* Incorrect host-column number found in bcp format-file. */
1027 #define SYBEBEOF 20104 /* Unexpected EOF encountered in BCP data-file. */
1028 #define SYBEBCNL 20105 /* Negative length-prefix found in BCP data-file. */
1029 #define SYBEBCSI 20106 /* Host-file columns may be skipped only when copying INto the Server. */
1030 #define SYBEBCIT 20107 /* It's illegal to use BCP terminators with program variables other than SYBCHAR, SYBBINARY, SYBTEXT, or SYBIMAGE. */
1031 #define SYBEBCSA 20108 /* The BCP hostfile '%s' contains only %ld rows. Skipping all of these rows is not allowed. */
1032 #define SYBENULL 20109 /* NULL DBPROCESS pointer passed to DB-Library. */
1033 #define SYBEUNAM 20110 /* Unable to get current username from operating system. */
1034 #define SYBEBCRO 20111 /* The BCP hostfile '%s' contains only %ld rows. It was impossible to read the requested %ld rows. */
1035 #define SYBEMPLL 20112 /* Attempt to set maximum number of DBPROCESSes lower than 1. */
1036 #define SYBERPIL 20113 /* It is illegal to pass -1 to dbrpcparam() for the datalen of parameters which are of type SYBCHAR, SYBVARCHAR, SYBBINARY, or SYBVARBINARY. */
1037 #define SYBERPUL 20114 /* When passing a SYBINTN, SYBDATETIMN, SYBMONEYN, or SYBFLTN parameter via dbrpcparam(), it's necessary to specify the parameter's maximum or actual length, so that DB-Library can recognize it as a SYBINT1, SYBINT2, SYBINT4, SYBMONEY, or SYBMONEY4, etc. */
1038 #define SYBEUNOP 20115 /* Unknown option passed to dbsetopt(). */
1039 #define SYBECRNC 20116 /* The current row is not a result of compute clause %d, so it is illegal to attempt to extract that data from this row. */
1040 #define SYBERTCC 20117 /* dbreadtext() may not be used to receive the results of a query which contains a COMPUTE clause. */
1041 #define SYBERTSC 20118 /* dbreadtext() may only be used to receive the results of a query which contains a single result column. */
1042 #define SYBEUCRR 20119 /* Internal software error: Unknown connection result reported by * dbpasswd(). */
1043 #define SYBERPNA 20120 /* The RPC facility is available only when using a SQL Server whose version number is 4.0 or greater. */
1044 #define SYBEOPNA 20121 /* The text/image facility is available only when using a SQL Server whose version number is 4.0 or greater. */
1045 #define SYBEFGTL 20122 /* Bcp: Row number of the first row to be copied cannot be greater than the row number for the last row to be copied. */
1046 #define SYBECWLL 20123 /* Attempt to set column width less than 1. */
1047 #define SYBEUFDS 20124 /* Unrecognized format encountered in dbstrbuild(). */
1048 #define SYBEUCPT 20125 /* Unrecognized custom-format parameter-type encountered in dbstrbuild(). */
1049 #define SYBETMCF 20126 /* Attempt to install too many custom formats via dbfmtinstall(). */
1050 #define SYBEAICF 20127 /* Error in attempting to install custom format. */
1051 #define SYBEADST 20128 /* Error in attempting to determine the size of a pair of translation tables. */
1052 #define SYBEALTT 20129 /* Error in attempting to load a pair of translation tables. */
1053 #define SYBEAPCT 20130 /* Error in attempting to perform a character-set translation. */
1054 #define SYBEXOCI 20131 /* A character-set translation overflowed its destination buffer while using bcp to copy data from a host-file to the SQL Server. */
1055 #define SYBEFSHD 20132 /* Error in attempting to find the Sybase home directory. */
1056 #define SYBEAOLF 20133 /* Error in attempting to open a localization file. */
1057 #define SYBEARDI 20134 /* Error in attempting to read datetime information from a localization file. */
1058 #define SYBEURCI 20135 /* Unable to read copyright information from the dblib localization file. */
1059 #define SYBEARDL 20136 /* Error in attempting to read the dblib.loc localization file. */
1060 #define SYBEURMI 20137 /* Unable to read money-format information from the dblib localization file. */
1061 #define SYBEUREM 20138 /* Unable to read error mnemonic from the dblib localization file. */
1062 #define SYBEURES 20139 /* Unable to read error string from the dblib localization file. */
1063 #define SYBEUREI 20140 /* Unable to read error information from the dblib localization file. */
1064 #define SYBEOREN 20141 /* Warning: an out-of-range error-number was encountered in dblib.loc. The maximum permissible error-number is defined as DBERRCOUNT in sybdb.h. */
1065 #define SYBEISOI 20142 /* Invalid sort-order information found. */
1066 #define SYBEIDCL 20143 /* Illegal datetime column length returned by DataServer. Legal datetime lengths are 4 and 8 bytes. */
1067 #define SYBEIMCL 20144 /* Illegal money column length returned by DataServer. Legal money lengths are 4 and 8 bytes. */
1068 #define SYBEIFCL 20145 /* Illegal floating-point column length returned by DataServer. Legal floating-point lengths are 4 and 8 bytes. */
1069 #define SYBEUTDS 20146 /* Unrecognized TDS version received from SQL Server. */
1070 #define SYBEBUFF 20147 /* Bcp: Unable to create format-file. */
1071 #define SYBEACNV 20148 /* Attemp to do conversion with NULL destination variable. */
1072 #define SYBEDPOR 20149 /* Out-of-range datepart constant. */
1073 #define SYBENDC 20150 /* Cannot have negative component in date in numeric form. */
1074 #define SYBEMVOR 20151 /* Month values must be between 1 and 12. */
1075 #define SYBEDVOR 20152 /* Day values must be between 1 and 7. */
1076 #define SYBENBVP 20153 /* Cannot pass dbsetnull() a NULL bindval pointer. */
1077 #define SYBESPID 20154 /* Called dbspid() with a NULL dbproc. */
1078 #define SYBENDTP 20155 /* Called dbdatecrack() with a NULL datetime parameter. */
1079 #define SYBEXTN 20156 /* The xlt_todisp and xlt_tosrv parameters to dbfree_xlate() were NULL. */
1080 #define SYBEXTDN 20157 /* Warning: the xlt_todisp parameter to dbfree_xlate() was NULL. The space associated with the xlt_tosrv parameter has been freed. */
1081 #define SYBEXTSN 20158 /* Warning: the xlt_tosrv parameter to dbfree_xlate() was NULL. The space associated with the xlt_todisp parameter has been freed. */
1082 #define SYBENUM 20159 /* Incorrect number of arguments given to DB-Library. */
1083 #define SYBETYPE 20160 /* Invalid argument type given to DB-Library. */
1084 #define SYBEGENOS 20161 /* General Operating System Error. */
1085 #define SYBEPAGE 20162 /* wrong resource type or length given for dbpage() operation. */
1086 #define SYBEOPTNO 20163 /* Option is not allowed or is unreconized */
1087 #define SYBEETD 20164 /* Failure to send the expected amount of TEXT or IMAGE data via dbmoretext(). */
1088 #define SYBERTYPE 20165 /* Invalid resource type given to DB-Library. */
1089 #define SYBERFILE 20166 /* "Can not open resource file." */
1090 #define SYBEFMODE 20167 /* Read/Write/Append mode denied on file. */
1091 #define SYBESLCT 20168 /* Could not select or copy field specified */
1092 #define SYBEZTXT 20169 /* Attempt to send zero length TEXT or IMAGE to dataserver via dbwritetext(). */
1093 #define SYBENTST 20170 /* The file being opened must be a stream_lf. */
1094 #define SYBEOSSL 20171 /* Operating system login level not in range of Secure SQL Server */
1095 #define SYBEESSL 20172 /* Login security level entered does not agree with operating system level */
1096 #define SYBENLNL 20173 /* Program not linked with specified network library. */
1097 #define SYBENHAN 20174 /* called dbrecvpassthru() with a NULL handler parameter. */
1098 #define SYBENBUF 20175 /* called dbsendpassthru() with a NULL buf pointer. */
1099 #define SYBENULP 20176 /* Called %s with a NULL %s parameter. */
1100 #define SYBENOTI 20177 /* No event handler installed. */
1101 #define SYBEEVOP 20178 /* Called dbregwatch() with a bad options parameter. */
1102 #define SYBENEHA 20179 /* Called dbreghandle() with a NULL handler parameter. */
1103 #define SYBETRAN 20180 /* DBPROCESS is being used for another transaction. */
1104 #define SYBEEVST 20181 /* Must initiate a transaction before calling dbregparam(). */
1105 #define SYBEEINI 20182 /* Must call dbreginit() before dbregraise(). */
1106 #define SYBEECRT 20183 /* Must call dbregdefine() before dbregcreate(). */
1107 #define SYBEECAN 20184 /* Attempted to cancel unrequested event notification. */
1108 #define SYBEEUNR 20185 /* Unsolicited event notification received. */
1109 #define SYBERPCS 20186 /* Must call dbrpcinit() before dbrpcparam(). */
1110 #define SYBETPAR 20187 /* No SYBTEXT or SYBIMAGE parameters were defined. */
1111 #define SYBETEXS 20188 /* Called dbmoretext() with a bad size parameter. */
1112 #define SYBETRAC 20189 /* Attempted to turn off a trace flag that was not on. */
1113 #define SYBETRAS 20190 /* DB-Library internal error - trace structure not found. */
1114 #define SYBEPRTF 20191 /* dbtracestring() may only be called from a printfunc(). */
1115 #define SYBETRSN 20192 /* Bad numbytes parameter passed to dbtracestring(). */
1116 #define SYBEBPKS 20193 /* In DBSETLPACKET(), the packet size parameter must be between 0 and 999999. */
1117 #define SYBEIPV 20194 /* %1! is an illegal value for the %2! parameter of %3!. */
1118 #define SYBEMOV 20195 /* Money arithmetic resulted in overflow in function %1!. */
1119 #define SYBEDIVZ 20196 /* Attempt to divide by $0.00 in function %1!. */
1120 #define SYBEASTL 20197 /* Synchronous I/O attempted at AST level. */
1121 #define SYBESEFA 20198 /* DBSETNOTIFS cannot be called if connections are present. */
1122 #define SYBEPOLL 20199 /* Only one dbpoll() can be active at a time. */
1123 #define SYBENOEV 20200 /* dbpoll() cannot be called if registered procedure notifications have been disabled. */
1124 #define SYBEBADPK 20201 /* Packet size of %1! not supported. -- size of %2! used instead. */
1125 #define SYBESECURE 20202 /* Secure Server function not supported in this version. */
1126 #define SYBECAP 20203 /* DB-Library capabilities not accepted by the Server. */
1127 #define SYBEFUNC 20204 /* Functionality not supported at the specified version level. */
1128 #define SYBERESP 20205 /* Response function address passed to dbresponse() must be non-NULL. */
1129 #define SYBEIVERS 20206 /* Illegal version level specified. */
1130 #define SYBEONCE 20207 /* Function can be called only once. */
1131 #define SYBERPNULL 20208 /* value parameter for dbprcparam() can be NULL, only if the datalen parameter is 0 */
1132 #define SYBERPTXTIM 20209 /* RPC parameters cannot be of type Text/Image. */
1133 #define SYBENEG 20210 /* Negotiated login attempt failed. */
1134 #define SYBELBLEN 20211 /* Security labels should be less than 256 characters long. */
1135 #define SYBEUMSG 20212 /* Unknown message-id in MSG datastream. */
1136 #define SYBECAPTYP 20213 /* Unexpected capability type in CAPABILITY datastream. */
1137 #define SYBEBNUM 20214 /* Bad numbytes parameter passed to dbstrcpy() */
1138 #define SYBEBBL 20215 /* Bad bindlen parameter passed to dbsetnull() */
1139 #define SYBEBPREC 20216 /* Illegal precision specified */
1140 #define SYBEBSCALE 20217 /* Illegal scale specified */
1141 #define SYBECDOMAIN 20218 /* Source field value is not within the domain of legal values. */
1142 #define SYBECINTERNAL 20219 /* Internal Conversion error. */
1143 #define SYBEBTYPSRV 20220 /* Datatype is not supported by the server. */
1144 #define SYBEBCSET 20221 /* Unknown character-set encountered." */
1145 #define SYBEFENC 20222 /* Password Encryption failed." */
1146 #define SYBEFRES 20223 /* Challenge-Response function failed.", */
1147 #define SYBEISRVPREC 20224 /* Illegal precision value returned by the server. */
1148 #define SYBEISRVSCL 20225 /* Illegal scale value returned by the server. */
1149 #define SYBEINUMCL 20226 /* Invalid numeric column length returned by the server. */
1150 #define SYBEIDECCL 20227 /* Invalid decimal column length returned by the server. */
1151 #define SYBEBCMTXT 20228 /* bcp_moretext() may be used only when there is at least one text or image column in the server table. */
1152 #define SYBEBCPREC 20229 /* Column %1!: Illegal precision value encountered. */
1153 #define SYBEBCBNPR 20230 /* bcp_bind(): if varaddr is NULL, prefixlen must be 0 and no terminator should be specified. */
1154 #define SYBEBCBNTYP 20231 /* bcp_bind(): if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */
1155 #define SYBEBCSNTYP 20232 /* column number %1!: if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */
1156 #define SYBEBCPCTYP 20233 /* bcp_colfmt(): If table_colnum is 0, host_type cannot be 0. */
1157 #define SYBEBCVLEN 20234 /* varlen should be greater than or equal to -1. */
1158 #define SYBEBCHLEN 20235 /* host_collen should be greater than or equal to -1. */
1159 #define SYBEBCBPREF 20236 /* Illegal prefix length. Legal values are 0, 1, 2 or 4. */
1160 #define SYBEBCPREF 20237 /* Illegal prefix length. Legal values are -1, 0, 1, 2 or 4. */
1161 #define SYBEBCITBNM 20238 /* bcp_init(): tblname parameter cannot be NULL. */
1162 #define SYBEBCITBLEN 20239 /* bcp_init(): tblname parameter is too long. */
1163 #define SYBEBCSNDROW 20240 /* bcp_sendrow() may NOT be called unless all text data for the previous row has been sent using bcp_moretext(). */
1164 #define SYBEBPROCOL 20241 /* bcp protocol error: returned column count differs from the actual number of columns received. */
1165 #define SYBEBPRODEF 20242 /* bcp protocol error: expected default information and got none. */
1166 #define SYBEBPRONUMDEF 20243 /* bcp protocol error: expected number of defaults differs from the actual number of defaults received. */
1167 #define SYBEBPRODEFID 20244 /* bcp protocol error: default column id and actual column id are not same */
1168 #define SYBEBPRONODEF 20245 /* bcp protocol error: default value received for column that does not have default. */
1169 #define SYBEBPRODEFTYP 20246 /* bcp protocol error: default value datatype differs from column datatype. */
1170 #define SYBEBPROEXTDEF 20247 /* bcp protocol error: more than one row of default information received. */
1171 #define SYBEBPROEXTRES 20248 /* bcp protocol error: unexpected set of results received. */
1172 #define SYBEBPROBADDEF 20249 /* bcp protocol error: illegal default column id received. */
1173 #define SYBEBPROBADTYP 20250 /* bcp protocol error: unknown column datatype. */
1174 #define SYBEBPROBADLEN 20251 /* bcp protocol error: illegal datatype length received. */
1175 #define SYBEBPROBADPREC 20252 /* bcp protocol error: illegal precision value received. */
1176 #define SYBEBPROBADSCL 20253 /* bcp protocol error: illegal scale value received. */
1177 #define SYBEBADTYPE 20254 /* Illegal value for type parameter given to %1!. */
1178 #define SYBECRSNORES 20255 /* Cursor statement generated no results. */
1179 #define SYBECRSNOIND 20256 /* One of the tables involved in the cursor statement does not have a unique index. */
1180 #define SYBECRSVIEW 20257 /* A view cannot be joined with another table or a view in a cursor statement. */
1181 #define SYBECRSVIIND 20258 /* The view used in the cursor statement does not include all the unique index columns of the underlying tables. */
1182 #define SYBECRSORD 20259 /* Only fully keyset driven cursors can have 'order by', ' group by', or 'having' phrases. */
1183 #define SYBECRSBUFR 20260 /* Row buffering should not be turned on when using cursor APIs. */
1184 #define SYBECRSNOFREE 20261 /* The DBNOAUTOFREE option should not be turned on when using cursor APIs. */
1185 #define SYBECRSDIS 20262 /* Cursor statement contains one of the disallowed phrases 'compute', 'union', 'for browse', or 'select into'. */
1186 #define SYBECRSAGR 20263 /* Aggregate functions are not allowed in a cursor statement. */
1187 #define SYBECRSFRAND 20264 /* Fetch types RANDOM and RELATIVE can only be used within the keyset of keyset driven cursors. */
1188 #define SYBECRSFLAST 20265 /* Fetch type LAST requires fully keyset driven cursors. */
1189 #define SYBECRSBROL 20266 /* Backward scrolling cannot be used in a forward scrolling cursor. */
1190 #define SYBECRSFROWN 20267 /* Row number to be fetched is outside valid range. */
1191 #define SYBECRSBSKEY 20268 /* Keyset cannot be scrolled backward in mixed cursors with a previous fetch type. */
1192 #define SYBECRSRO 20269 /* Data locking or modifications cannot be made in a READONLY cursor. */
1193 #define SYBECRSNOCOUNT 20270 /* The DBNOCOUNT option should not be turned on when doing updates or deletes with dbcursor(). */
1194 #define SYBECRSTAB 20271 /* Table name must be determined in operations involving data locking or modifications. */
1195 #define SYBECRSUPDNB 20272 /* Update or insert operations cannot use bind variables when binding type is NOBIND. */
1196 #define SYBECRSNOWHERE 20273 /* A WHERE clause is not allowed in a cursor update or insert. */
1197 #define SYBECRSSET 20274 /* A SET clause is required for a cursor update or insert. */
1198 #define SYBECRSUPDTAB 20275 /* Update or insert operations using bind variables require single table cursors. */
1199 #define SYBECRSNOUPD 20276 /* Update or delete operation did not affect any rows. */
1200 #define SYBECRSINV 20277 /* Invalid cursor statement. */
1201 #define SYBECRSNOKEYS 20278 /* The entire keyset must be defined for KEYSET cursors. */
1202 #define SYBECRSNOBIND 20279 /* Cursor bind must be called prior to updating cursor */
1203 #define SYBECRSFTYPE 20280 /* Unknown fetch type. */
1204 #define SYBECRSINVALID 20281 /* The cursor handle is invalid. */
1205 #define SYBECRSMROWS 20282 /* Multiple rows are returned, only one is expected. */
1206 #define SYBECRSNROWS 20283 /* No rows returned, at least one is expected. */
1207 #define SYBECRSNOLEN 20284 /* No unique index found. */
1208 #define SYBECRSNOPTCC 20285 /* No OPTCC was found. */
1209 #define SYBECRSNORDER 20286 /* The order of clauses must be from, where, and order by. */
1210 #define SYBECRSNOTABLE 20287 /* Table name is NULL. */
1211 #define SYBECRSNUNIQUE 20288 /* No unique keys associated with this view. */
1212 #define SYBECRSVAR 20289 /* There is no valid address associated with this bind. */
1213 #define SYBENOVALUE 20290 /* Security labels require both a name and a value */
1214 #define SYBEVOIDRET 20291 /* Parameter of type SYBVOID cannot be a return parameter. */
1215 #define SYBECLOSEIN 20292 /* Unable to close interface file. */
1216 #define SYBEBOOL 20293 /* Boolean parameters must be TRUE or FALSE. */
1217 #define SYBEBCPOPT 20294 /* The option cannot be called while a bulk copy operation is progress. */
1218 #define SYBEERRLABEL 20295 /* An illegal value was returned from the security label handler. */
1219 #define SYBEATTNACK 20296 /* Timed out waiting for server to acknowledge attention." */
1220 #define SYBEBBFL 20297 /* -001- Batch failed in bulk-copy to SQL Server */
1221 #define SYBEDCL 20298 /* -004- DCL Error */
1222 #define SYBECS 20299 /* -004- cs context Error */
1223 #define SYBEBULKINSERT 20599 /* cannot build bulk insert statement */
1224 #define SYBECOLSIZE 22000 /* Invalid column information structure size */
1225 
1226 int dbtds(DBPROCESS * dbprocess);
1227 
1228 #define DBTDS(a) dbtds(a)
1229 DBINT dbtextsize(DBPROCESS * dbprocess);
1230 DBBINARY *dbtxptr(DBPROCESS * dbproc, int column);
1231 DBBINARY *dbtxtimestamp(DBPROCESS * dbproc, int column);
1232 DBBINARY *dbtxtsnewval(DBPROCESS * dbprocess);
1233 RETCODE dbtxtsput(DBPROCESS * dbprocess, DBBINARY newtxts, int colnum);
1234 RETCODE dbuse(DBPROCESS * dbproc, const char *name);
1235 const char *dbversion(void);
1236 DBBOOL dbwillconvert(int srctype, int desttype);
1237 RETCODE dbwritetext(DBPROCESS * dbproc, char *objname, DBBINARY * textptr, DBTINYINT textptrlen, DBBINARY * timestamp,
1238  DBBOOL log, DBINT size, BYTE * text);
1239 
1240 /* LOGINREC manipulation */
1241 RETCODE dbsetlname(LOGINREC * login, const char *value, int which);
1242 RETCODE dbsetlbool(LOGINREC * login, int value, int which);
1243 RETCODE dbsetlshort(LOGINREC * login, int value, int which);
1244 RETCODE dbsetllong(LOGINREC * login, long value, int which);
1245 RETCODE dbsetlversion (LOGINREC * login, BYTE version);
1246 
1247 #define DBSETHOST 1
1248 #define DBSETLHOST(x,y) dbsetlname((x), (y), DBSETHOST)
1249 #define dbsetlhost(x,y) dbsetlname((x), (y), DBSETHOST)
1250 #define DBSETUSER 2
1251 #define DBSETLUSER(x,y) dbsetlname((x), (y), DBSETUSER)
1252 #define dbsetluser(x,y) dbsetlname((x), (y), DBSETUSER)
1253 #define DBSETPWD 3
1254 #define DBSETLPWD(x,y) dbsetlname((x), (y), DBSETPWD)
1255 #define dbsetlpwd(x,y) dbsetlname((x), (y), DBSETPWD)
1256 #if defined(DBLIB_UNIMPLEMENTED)
1257 # define DBSETHID 4 /* not implemented */
1258 # define DBSETLHID(x,y) dbsetlname((x), (y), DBSETHID)
1259 #endif
1260 #define DBSETAPP 5
1261 #define DBSETLAPP(x,y) dbsetlname((x), (y), DBSETAPP)
1262 #define dbsetlapp(x,y) dbsetlname((x), (y), DBSETAPP)
1263 #define DBSETBCP 6
1264 #define BCP_SETL(x,y) dbsetlbool((x), (y), DBSETBCP)
1265 #define DBSETLSECURE(x) dbsetlbool((x), (1), DBSETBCP)
1266 #define DBSETNATLANG 7
1267 #define DBSETLNATLANG(x,y) dbsetlname((x), (y), DBSETNATLANG)
1268 #define dbsetlnatlang(x,y) dbsetlname((x), (y), DBSETNATLANG)
1269 #if defined(DBLIB_UNIMPLEMENTED)
1270 # define DBSETNOSHORT 8 /* not implemented */
1271 # define DBSETLNOSHORT(x,y) dbsetlbool((x), (y), DBSETNOSHORT)
1272 # define DBSETHIER 9 /* not implemented */
1273 # define DBSETLHIER(x,y) dbsetlshort((x), (y), DBSETHIER)
1274 #endif
1275 #define DBSETCHARSET 10
1276 #define DBSETLCHARSET(x,y) dbsetlname((x), (y), DBSETCHARSET)
1277 #define DBSETPACKET 11
1278 #define DBSETLPACKET(x,y) dbsetllong((x), (y), DBSETPACKET)
1279 #define dbsetlpacket(x,y) dbsetllong((x), (y), DBSETPACKET)
1280 #define DBSETENCRYPT 12
1281 #define DBSETLENCRYPT(x,y) dbsetlbool((x), (y), DBSETENCRYPT)
1282 #define DBSETLABELED 13
1283 #define DBSETLLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED)
1284 #define BCP_SETLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED)
1285 #define DBSETDBNAME 14
1286 #define DBSETLDBNAME(x,y) dbsetlname((x), (y), DBSETDBNAME)
1287 #define DBSETLVERSION(login, version) dbsetlversion((login), (version))
1288 #define DBSETNETWORKAUTH 101
1289 #define DBSETLNETWORKAUTH(x, y) dbsetlbool((x), (y), DBSETNETWORKAUTH)
1290 #define DBSETMUTUALAUTH 102
1291 #define DBSETLMUTUALAUTH(x, y) dbsetlbool((x), (y), DBSETMUTUALAUTH)
1292 #define DBSETSERVERPRINCIPAL 103
1293 #define DBSETLSERVERPRINCIPAL(x,y) dbsetlname((x), (y), DBSETSERVERPRINCIPAL)
1294 /* settings from here are purely FreeTDS extensions */
1295 #define DBSETUTF16 1001
1296 #define DBSETLUTF16(x,y) dbsetlbool((x), (y), DBSETUTF16)
1297 #define DBSETNTLMV2 1002
1298 #define DBSETLNTLMV2(x,y) dbsetlbool((x), (y), DBSETNTLMV2)
1299 #define DBSETREADONLY 1003
1300 #define DBSETLREADONLY(x,y) dbsetlbool((x), (y), DBSETREADONLY)
1301 #define DBSETDELEGATION 1004
1302 #define DBSETLDELEGATION(x, y) dbsetlbool((x), (y), DBSETDELEGATION)
1303 
1304 RETCODE bcp_init(DBPROCESS * dbproc, const char *tblname, const char *hfile, const char *errfile, int direction);
1305 DBINT bcp_done(DBPROCESS * dbproc);
1306 
1307 DBINT bcp_batch(DBPROCESS * dbproc);
1308 RETCODE bcp_bind(DBPROCESS * dbproc, BYTE * varaddr, int prefixlen, DBINT varlen, BYTE * terminator, int termlen, int type,
1309  int table_column);
1310 RETCODE bcp_collen(DBPROCESS * dbproc, DBINT varlen, int table_column);
1311 RETCODE bcp_columns(DBPROCESS * dbproc, int host_colcount);
1312 RETCODE bcp_colfmt(DBPROCESS * dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen,
1313  const BYTE * host_term, int host_termlen, int colnum);
1314 RETCODE bcp_colfmt_ps(DBPROCESS * dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen,
1315  BYTE * host_term, int host_termlen, int colnum, DBTYPEINFO * typeinfo);
1316 RETCODE bcp_colptr(DBPROCESS * dbproc, BYTE * colptr, int table_column);
1317 RETCODE bcp_control(DBPROCESS * dbproc, int field, DBINT value);
1318 int bcp_getbatchsize(DBPROCESS * dbproc); /* FreeTDS only */
1319 RETCODE bcp_exec(DBPROCESS * dbproc, DBINT * rows_copied);
1320 DBBOOL bcp_getl(LOGINREC * login);
1321 RETCODE bcp_options(DBPROCESS * dbproc, int option, BYTE * value, int valuelen);
1322 RETCODE bcp_readfmt(DBPROCESS * dbproc, const char filename[]);
1323 RETCODE bcp_sendrow(DBPROCESS * dbproc);
1324 
1325 #ifdef __cplusplus
1326 #if 0
1327 {
1328 #endif
1329 }
1330 #endif
1331 
1332 #endif
Definition: sybdb.h:284
RETCODE dbrpcsend(DBPROCESS *dbproc)
Execute the procedure and free associated memory.
Definition: rpc.c:281
RETCODE dbsettime(int seconds)
Set maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4192
RETCODE dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[])
Send chunk of a text/image value to the server.
Definition: dblib.c:6732
DBTYPEINFO * dbcoltypeinfo(DBPROCESS *dbproc, int column)
Get precision and scale information for a regular result column.
Definition: dblib.c:3016
RETCODE bcp_readfmt(DBPROCESS *dbproc, const char filename[])
Read a format definition file.
Definition: bcp.c:1678
void dbsetifile(char *filename)
set name and location of the interfaces file FreeTDS should use to look up a servername.
Definition: dblib.c:2711
const char * dbversion(void)
See which version of db-lib is in use.
Definition: dblib.c:6840
Definition: sybdb.h:307
int dbretlen(DBPROCESS *dbproc, int retnum)
Get size of an output parameter filled by a stored procedure.
Definition: dblib.c:4779
RETCODE dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *dt)
Break a DBDATETIME value into useful pieces.
Definition: dblib.c:5847
void dbclose(DBPROCESS *dbproc)
Close a connection to the server and free associated resources.
Definition: dblib.c:1485
RETCODE dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
Subtract two DBMONEY4 values.
Definition: dblib.c:5624
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
Definition: dblib.c:4471
const char * dbacolname(DBPROCESS *dbproc, int computeid, int column)
Return name of a computed result column.
Definition: dblib.c:1898
RETCODE dbmnydec(DBPROCESS *dbproc, DBMONEY *mnyptr)
Subtract $0.0001 from a DBMONEY value.
Definition: dblib.c:5491
int dbnumrets(DBPROCESS *dbproc)
Get count of output parameters filled by a stored procedure.
Definition: dblib.c:4692
RETCODE dbsetversion(DBINT version)
Specify a db-lib version level.
Definition: dblib.c:5976
Definition: sybdb.h:490
int dbnumcompute(DBPROCESS *dbprocess)
Get count of COMPUTE clauses for a result set.
Definition: dblib.c:4973
char * dbgetchar(DBPROCESS *dbprocess, int n)
Get address of a position in the command buffer.
Definition: dblib.c:6310
DBBOOL dbdead(DBPROCESS *dbproc)
Check if dbproc is an ex-parrot.
Definition: dblib.c:5058
BYTE * dbbylist(DBPROCESS *dbproc, int computeid, int *size)
Get bylist for a compute row.
Definition: dblib.c:4999
RETCODE dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator)
Tie a null-indicator to a regular result column.
Definition: dblib.c:2740
char * dbcolsource(DBPROCESS *dbproc, int colnum)
Get base database column name for a result set column.
Definition: dblib.c:3144
RETCODE dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
safely quotes character values in SQL text.
Definition: dblib.c:6386
Definition: sybdb.h:275
void dbexit(void)
Close server connections and free all related structures.
Definition: dblib.c:1552
RETCODE bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
Prepare for bulk copy operation on a table.
Definition: bcp.c:167
RETCODE dbaltbind(DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
Bind a compute column to a program variable.
Definition: dblib.c:4369
int dbaltcolid(DBPROCESS *dbproc, int computeid, int column)
Get column ID of a compute column.
Definition: dblib.c:4284
Definition: sybdb.h:269
Definition: bsqlodbc.c:100
RETCODE dbprrow(DBPROCESS *dbproc)
Print a result set to stdout.
Definition: dblib.c:3540
STATUS dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize)
Fetch part of a text or image value from the server.
Definition: dblib.c:6663
RETCODE dbsqlsend(DBPROCESS *dbproc)
Transmit the command buffer to the server.
Definition: dblib.c:7043
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
Definition: dblib.c:5121
DBBOOL bcp_getl(LOGINREC *login)
See if BCP_SETL() was used to set the LOGINREC for BCP work.
Definition: bcp.c:707
BYTE * dbgetuserdata(DBPROCESS *dbproc)
Get address of user-allocated data from a DBPROCESS.
Definition: dblib.c:5958
DBINT dbaltutype(DBPROCESS *dbproc, int computeid, int column)
Get user-defined datatype of a compute column.
Definition: dblib.c:7114
RETCODE dbclropt(DBPROCESS *dbproc, int option, const char param[])
Reset an option.
Definition: dblib.c:6095
int dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
Compare two DBMONEY values.
Definition: dblib.c:5266
RETCODE bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column)
Set the length of a host variable to be written to a table.
Definition: bcp.c:267
RETCODE dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
Add two DBMONEY4 values.
Definition: dblib.c:5593
RETCODE dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
Initialize a remote procedure call.
Definition: rpc.c:72
RETCODE dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest)
Zero a DBMONEY4 value.
Definition: dblib.c:5570
DBPROCESS * tdsdbopen(LOGINREC *login, const char *server, int msdblib)
Form a connection with the server.
Definition: dblib.c:1179
RETCODE dbmorecmds(DBPROCESS *dbproc)
See if more commands are to be processed.
Definition: dblib.c:6237
RETCODE dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Copy a DBMONEY value.
Definition: dblib.c:6010
RETCODE dbsetlogintime(int seconds)
Set maximum seconds db-lib waits for a server response to a login attempt.
Definition: dblib.c:4239
Definition: sybdb.h:263
int dbiowdesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to write data coming to the server....
Definition: dblib.c:7247
RETCODE dbsetlversion(LOGINREC *login, BYTE version)
Set TDS version for future connections.
Definition: dblib.c:947
RETCODE bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int type, int table_column)
Bind a program host variable to a database column.
Definition: bcp.c:2079
int dbrettype(DBPROCESS *dbproc, int retnum)
Get datatype of a stored procedure's return parameter.
Definition: dblib.c:6266
DBINT dbprcollen(DBPROCESS *dbproc, int column)
Get size of a result column needed to print column.
Definition: dblib.c:3192
RETCODE bcp_columns(DBPROCESS *dbproc, int host_colcount)
Indicate how many columns are to be found in the datafile.
Definition: bcp.c:301
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
Definition: dblib.c:1694
int dbalttype(DBPROCESS *dbproc, int computeid, int column)
Get datatype for a compute column.
Definition: dblib.c:4340
RETCODE dbsetlbool(LOGINREC *login, int value, int which)
Set a boolean value in a LOGINREC structure.
Definition: dblib.c:896
RETCODE dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
Negate a DBMONEY value.
Definition: dblib.c:5519
DBUBIGINT time
time, 7 digit precision
Definition: sybdb.h:308
RETCODE bcp_control(DBPROCESS *dbproc, int field, DBINT value)
Set BCP options for uploading a datafile.
Definition: bcp.c:544
char * dbchange(DBPROCESS *dbprocess)
See if a command caused the current database to change.
Definition: dblib.c:6987
RETCODE bcp_colfmt(DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int colnum)
Specify the format of a datafile prior to writing to a table.
Definition: bcp.c:377
RETCODE dbmnyinc(DBPROCESS *dbproc, DBMONEY *mnyptr)
Add $0.0001 to a DBMONEY value.
Definition: dblib.c:5463
char * dbretname(DBPROCESS *dbproc, int retnum)
Get name of an output parameter filled by a stored procedure.
Definition: dblib.c:4724
void dbsetavail(DBPROCESS *dbprocess)
Mark a DBPROCESS as "available".
Definition: dblib.c:7275
DBINT dbvarylen(DBPROCESS *dbproc, int column)
Determine whether a column can vary in size.
Definition: dblib.c:3218
void dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr)
Associate client-allocated (and defined) data with a DBPROCESS.
Definition: dblib.c:5940
RETCODE dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
Break any kind of date or time value into useful pieces.
Definition: dblib.c:5868
void dbprhead(DBPROCESS *dbproc)
Print result set headings to stdout.
Definition: dblib.c:3959
DBSMALLINT offset
time offset
Definition: sybdb.h:310
Definition: dblib.h:44
RETCODE dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print a regular result row to a buffer.
Definition: dblib.c:3457
Definition: sybdb.h:342
DBINT dbretstatus(DBPROCESS *dbproc)
Fetch status value returned by query or remote procedure call.
Definition: dblib.c:4674
int dbiordesc(DBPROCESS *dbproc)
Get file descriptor of the socket used by a DBPROCESS to read data coming from the server....
Definition: dblib.c:7231
void dbclrbuf(DBPROCESS *dbproc, DBINT n)
Clear n rows from the row buffer.
Definition: dblib.c:2844
RETCODE dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
Negate a DBMONEY4 value.
Definition: dblib.c:5546
int dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
Compare DBDATETIME values, similar to strcmp(3).
Definition: dblib.c:5765
RETCODE dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol)
Get a bunch of column attributes with a single call (Microsoft-compatibility feature).
Definition: dblib.c:3045
RETCODE dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *dest)
Get maximum negative DBMONEY value supported.
Definition: dblib.c:5366
const char * dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
Get name of a month, in some human language.
Definition: dblib.c:6958
RETCODE dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
Get formatted string for underlining dbsprhead() column names.
Definition: dblib.c:3837
DBINT dblastrow(DBPROCESS *dbproc)
Get number of the last row in the row buffer.
Definition: dblib.c:7207
RETCODE dbcmd(DBPROCESS *dbproc, const char cmdstring[])
Append SQL to the command buffer.
Definition: dblib.c:1373
RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val)
Pivot the rows, creating a new resultset.
Definition: dbpivot.c:914
RETCODE dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *dest)
Get maximum positive DBMONEY value supported.
Definition: dblib.c:5345
DBINT dbcolutype(DBPROCESS *dbprocess, int column)
Get user-defined datatype of a regular result column.
Definition: dblib.c:2993
STATUS dbsetrow(DBPROCESS *dbprocess, DBINT row)
Make a buffered row "current" without fetching it into bound variables.
Definition: dblib.c:2045
RETCODE dbcancel(DBPROCESS *dbproc)
Cancel the current command batch.
Definition: dblib.c:3394
Definition: sybdb.h:506
const char * dbprtype(int token)
Print a token value's name to a buffer.
Definition: dblib.c:6447
STATUS dbrowtype(DBPROCESS *dbprocess)
Get returned row's type.
Definition: dblib.c:6203
RETCODE dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
Tie a host variable to a resultset column.
Definition: dblib.c:2634
int dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
Compare two DBMONEY4 values.
Definition: dblib.c:5712
Definition: sybdb.h:290
int dbspid(DBPROCESS *dbproc)
Get server process ID for a DBPROCESS.
Definition: dblib.c:5920
RETCODE dbsqlok(DBPROCESS *dbproc)
Wait for results of a query from the server.
Definition: dblib.c:4814
int dbgettime(void)
Get maximum seconds db-lib waits for a server response to query.
Definition: dblib.c:4223
DBPROCESS * dbopen(LOGINREC *login, const char *server)
Normally not used.
Definition: dbopen.c:36
int dbgetpacket(DBPROCESS *dbproc)
Get TDS packet size for the connection.
Definition: dblib.c:4075
DBBINARY * dbtxptr(DBPROCESS *dbproc, int column)
Get text pointer for a column in the current row.
Definition: dblib.c:6557
RETCODE dbsetmaxprocs(int maxprocs)
Set maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:4099
Definition: dbpivot.c:772
DBINT bcp_done(DBPROCESS *dbproc)
Conclude the transfer of data from program variables.
Definition: bcp.c:2037
int dbcoltype(DBPROCESS *dbproc, int column)
Get the datatype of a regular result set column.
Definition: dblib.c:2970
DBINT dbdatlen(DBPROCESS *dbproc, int column)
Get size of current row's data in a regular result column.
Definition: dblib.c:3324
DBBOOL dbhasretstat(DBPROCESS *dbproc)
Determine if query generated a return status number.
Definition: dblib.c:4650
RETCODE dbanullbind(DBPROCESS *dbprocess, int computeid, int column, DBINT *indicator)
Tie a null-indicator to a compute result column.
Definition: dblib.c:2776
RETCODE dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)
Definition: dblib.c:6464
RETCODE dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest)
Set a DBMONEY value to zero.
Definition: dblib.c:5324
DBINT dbcollen(DBPROCESS *dbproc, int column)
Get size of a regular result column.
Definition: dblib.c:3169
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
Definition: dblib.c:5140
RETCODE dbinit(void)
Initialize db-lib.
Definition: dblib.c:660
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
Definition: dblib.c:1419
DBINT dbconvert_ps(DBPROCESS *dbprocess, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
Convert one datatype to another.
Definition: dblib.c:2300
RETCODE bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column)
Override bcp_bind() by pointing to a different host variable.
Definition: bcp.c:671
DBINT dbcurrow(DBPROCESS *dbproc)
Get number of the row currently being read.
Definition: dblib.c:6186
BYTE * dbadata(DBPROCESS *dbproc, int computeid, int column)
Get address of compute column data.
Definition: dblib.c:4415
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:7007
RETCODE dbfcmd(DBPROCESS *dbproc, const char *fmt,...)
printf-like way to form SQL to send to the server.
Definition: dblib.c:1334
RETCODE bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
Set "hints" for uploading a file.
Definition: bcp.c:622
char * dbservcharset(DBPROCESS *dbprocess)
Get syscharset name of the server character set.
Definition: dblib.c:7023
int dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
Build a printable string from text containing placeholders for variables.
Definition: dblib.c:7300
Definition: sybdb.h:374
BOOL dbiscount(DBPROCESS *dbproc)
Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature).
Definition: dblib.c:2804
int dbnumalts(DBPROCESS *dbproc, int computeid)
Get count of columns in a compute row.
Definition: dblib.c:4940
RETCODE bcp_colfmt_ps(DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int colnum, DBTYPEINFO *typeinfo)
Specify the format of a host file for bulk copy purposes, with precision and scale support for numeri...
Definition: bcp.c:509
DBINT dbfirstrow(DBPROCESS *dbproc)
See if a server response has arrived.
Definition: dblib.c:7192
RETCODE dbrows(DBPROCESS *dbproc)
Indicate whether a query returned rows.
Definition: dblib.c:4034
RETCODE dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
Definition: dblib.c:1445
DBINT date
date, 0 = 1900-01-01
Definition: sybdb.h:309
int dbtds(DBPROCESS *dbprocess)
Get the TDS version in use for dbproc.
Definition: dblib.c:6801
void dbrecftos(const char filename[])
Record to a file all SQL commands sent to the server.
Definition: dblib.c:6767
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
Definition: dblib.c:1872
DBINT dbaltlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in compute column.
Definition: dblib.c:7137
Definition: sybdb.h:301
BYTE * dbretdata(DBPROCESS *dbproc, int retnum)
Get value of an output parameter filled by a stored procedure.
Definition: dblib.c:4753
DBBINARY * dbtxtimestamp(DBPROCESS *dbproc, int column)
Get text timestamp for a column in the current row.
Definition: dblib.c:6527
Definition: sybdb.h:474
RETCODE bcp_sendrow(DBPROCESS *dbproc)
Write data in host variables to the table.
Definition: bcp.c:1381
void dbloginfree(LOGINREC *login)
free the LOGINREC
Definition: dblib.c:737
RETCODE dbrpcparam(DBPROCESS *dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE *value)
Add a parameter to a remote procedure call.
Definition: rpc.c:155
RETCODE bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied)
Write a datafile to a table.
Definition: bcp.c:1617
RETCODE dbsetlname(LOGINREC *login, const char *value, int which)
Set the value of a string in a LOGINREC structure.
Definition: dblib.c:759
Definition: sybdb.h:355
int dbcurcmd(DBPROCESS *dbproc)
Get number of the row just returned.
Definition: dblib.c:6220
Definition: dblib.h:123
RETCODE dbcmdrow(DBPROCESS *dbproc)
See if the current command can return rows.
Definition: dblib.c:4260
DBINT dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
cf.
Definition: dblib.c:2593
DBINT dbcount(DBPROCESS *dbproc)
Get count of rows processed.
Definition: dblib.c:2824
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
Definition: dblib.c:1848
BYTE * dbdata(DBPROCESS *dbproc, int column)
Get address of data in a regular result column.
Definition: dblib.c:3352
RETCODE dbsetnull(DBPROCESS *dbprocess, int bindtype, int bindlen, BYTE *bindval)
Define substitution values to be used when binding null values.
Definition: dblib.c:1962
RETCODE dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len)
Print result set headings to a buffer.
Definition: dblib.c:3895
RETCODE dbmny4copy(DBPROCESS *dbprocess, DBMONEY4 *m1, DBMONEY4 *m2)
Copy a DBMONEY4 value.
Definition: dblib.c:5740
int dbstrlen(DBPROCESS *dbproc)
Get size of the command buffer, in bytes.
Definition: dblib.c:6291
Definition: sybdb.h:336
DBBOOL dbwillconvert(int srctype, int desttype)
Test whether or not a datatype can be converted to another datatype.
Definition: dblib.c:2874
DBINT bcp_batch(DBPROCESS *dbproc)
Commit a set of rows to the table.
Definition: bcp.c:2010
RETCODE dbgetrow(DBPROCESS *dbproc, DBINT row)
Read a row from the row buffer.
Definition: dblib.c:1930
Definition: dbpivot.c:77
Definition: sybdb.h:295
void dbfreebuf(DBPROCESS *dbproc)
Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().
Definition: dblib.c:6060
DBINT dbspr1rowlen(DBPROCESS *dbproc)
Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(),...
Definition: dblib.c:3419
DBINT dbadlen(DBPROCESS *dbproc, int computeid, int column)
Get size of data in a compute column.
Definition: dblib.c:4310
RETCODE dbsetllong(LOGINREC *login, long value, int which)
Set an integer value in a LOGINREC structure.
Definition: dblib.c:825
DBBOOL dbisopt(DBPROCESS *dbproc, int option, const char param[])
Get value of an option.
Definition: dblib.c:6163
RETCODE dbcanquery(DBPROCESS *dbproc)
Cancel the query currently being retrieved, discarding all pending rows.
Definition: dblib.c:6031
Definition: sybdb.h:458
void dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
Set interrupt handler for db-lib to use while blocked against a read from the server.
Definition: dblib.c:4631
RETCODE dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest)
Get a copy of a chunk of the command buffer.
Definition: dblib.c:6342
int dbaltop(DBPROCESS *dbproc, int computeid, int column)
Get aggregation operator for a compute column.
Definition: dblib.c:4444
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
Definition: dblib.c:705
RETCODE dbwritetext(DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text)
Send text or image data to the server.
Definition: dblib.c:6594
int dbgetmaxprocs(void)
get maximum simultaneous connections db-lib will open to the server.
Definition: dblib.c:4171
freetds-1.3.6/doc/reference/a00507.dot000644 025423 025423 00000001457 14162303416 020641 0ustar00fredianofrediano000000 000000 digraph "include/sybdb.h" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="include/sybdb.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Primary include file for db-lib applications."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="float.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; } freetds-1.3.6/doc/reference/a00508.dot000644 025423 025423 00000003521 14162303416 020634 0ustar00fredianofrediano000000 000000 digraph "include/sybdb.h" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="include/sybdb.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Primary include file for db-lib applications."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="src/dblib/bcp.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01400.html",tooltip="Implementation of db-lib bulk copy functions."]; Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="src/dblib/dblib.c",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00080.html",tooltip="Main implementation file for db-lib."]; Node1 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="include/sqldb.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00497_source.html",tooltip=" "]; Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="include/sybfront.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00512_source.html",tooltip=" "]; Node5 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="include/sqlfront.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00500_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00509_source.html000644 025423 025423 00000025024 14162303413 022372 0ustar00fredianofrediano000000 000000 FreeTDS API: include/syberror.h Source File
FreeTDS API
syberror.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _syberror_h_
21 #define _syberror_h_
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #if 0
27 }
28 #endif
29 #endif
30 
31 static const char rcsid_syberror_h[] = "$Id: syberror.h,v 1.4 2004-10-28 12:42:12 freddy77 Exp $";
32 static const void *const no_unused_syberror_h_warn[] = { rcsid_syberror_h, no_unused_syberror_h_warn };
33 
34 /* severity levels, gleaned from google */
35 #define EXINFO 1
36 #define EXUSER 2
37 #define EXNONFATAL 3
38 #define EXCONVERSION 4
39 #define EXSERVER 5
40 #define EXTIME 6
41 #define EXPROGRAM 7
42 #define EXRESOURCE 8
43 #define EXCOMM 9
44 #define EXFATAL 10
45 #define EXCONSISTENCY 11
46 
47 #ifdef __cplusplus
48 #if 0
49 {
50 #endif
51 }
52 #endif
53 
54 #endif
freetds-1.3.6/doc/reference/a00545.html000644 025423 025423 00000020535 14162303416 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Todo List
FreeTDS API
Todo List
Member dbsetopt (DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Implement more options.
Member DBSETLENCRYPT (x, y)
Unimplemented.
Member tds_process_tokens (TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
Complete TDS_DESCRIBE_RESULT description
Member tds_set_server (TDSLOGIN *tds_login, const char *server) TDS_WUR
open the log file earlier, so these messages can be seen.
Member tds_iconv (TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)

Support alternative to '?' for the replacement character.

For reads, cope with outbuf encodings that don't have the equivalent of an ASCII '?'.

Use more robust error message generation.

Check for variable multibyte non-UTF-8 input character set.

Member dbfirstrow (DBPROCESS *dbproc)
Unimplemented.
Member dbmoretext (DBPROCESS *dbproc, DBINT size, const BYTE text[])
Check return value of called functions and return FAIL if appropriate.
Member dbcurcmd (DBPROCESS *dbproc)
Unimplemented.
Member dbcurrow (DBPROCESS *dbproc)
Unimplemented.
Member dbretdata (DBPROCESS *dbproc, int retnum)
Handle blobs.
Member dbcancel (DBPROCESS *dbproc)
Check for failure and return accordingly.
Member dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol)
Support cursor rows.
Member dbanullbind (DBPROCESS *dbproc, int computeid, int column, DBINT *indicator)
Never fails, but only because failure conditions aren't checked.
Member dbconvert_ps (DBPROCESS *dbproc, int db_srctype, const BYTE *src, DBINT srclen, int db_desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)

Microsoft and Sybase define this function differently.

What happens if client does not reset values?

Member dbexit ()
breaks if ctlib/dblib used in same process.
Member tdsdbopen (LOGINREC *login, const char *server, int msdblib)

separate error messages for no-such-server and no-such-user.

use asprintf() to avoid buffer overflow.

Member dbsetlbool (LOGINREC *login, int value, int which)
DBSETNOSHORT, DBSETENCRYPT, DBSETLABELED
Member bcp_options (DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
Simplify. Remove valuelen, and dbproc->bcpinfo->hint = strdup(hints[i])
Member bcp_colfmt_ps (DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int table_colnum, DBTYPEINFO *typeinfo)
Not implemented.
freetds-1.3.6/doc/reference/a00546.html000644 025423 025423 00000006317 14162303416 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Bug List
FreeTDS API
Bug List
Member dbcolname (DBPROCESS *dbproc, int column)
Relies on ASCII column names, post iconv conversion.
Will not work as described for UTF-8 or UCS-2 clients.
But maybe it shouldn't.
freetds-1.3.6/doc/reference/a00512_source.html000644 025423 025423 00000022666 14162303413 022375 0ustar00fredianofrediano000000 000000 FreeTDS API: include/sybfront.h Source File
FreeTDS API
sybfront.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-1999 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef SYBFRONT_h
21 #define SYBFRONT_h
22 
23 #include "sybdb.h"
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #if 0
29 }
30 #endif
31 #endif
32 
33 static const char rcsid_sybfront_h[] = "$Id: sybfront.h,v 1.3 2004-10-28 12:42:12 freddy77 Exp $";
34 static const void *const no_unused_sybfront_h_warn[] = { rcsid_sybfront_h, no_unused_sybfront_h_warn };
35 
36 
37 
38 #ifdef __cplusplus
39 #if 0
40 {
41 #endif
42 }
43 #endif
44 
45 
46 #endif
Primary include file for db-lib applications.
freetds-1.3.6/doc/reference/a00515_source.html000644 025423 025423 00000060370 14162303413 022372 0ustar00fredianofrediano000000 000000 FreeTDS API: include/tds_sysdep_public.h Source File
FreeTDS API
tds_sysdep_public.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 1998-2011 Brian Bruns
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef _tds_sysdep_public_h_
21 #define _tds_sysdep_public_h_
22 
23 /*
24  * This file is publicly installed.
25  * MUST not include config.h
26  */
27 
28 #if (!defined(_MSC_VER) && defined(__cplusplus) && __cplusplus >= 201103L) || \
29  (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
30 # include <stdint.h>
31 #elif (defined(__sun) && defined(__SVR4)) || defined(__hpux)
32 # include <inttypes.h>
33 #else
34 typedef signed char int8_t; /* 8-bit int */
35 typedef unsigned char uint8_t; /* 8-bit int */
36 /*
37  * This is where platform-specific changes need to be made.
38  */
39 # if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
40 # include <winsock2.h>
41 # include <ws2tcpip.h>
42 # include <windows.h>
43  typedef signed short int16_t; /* 16-bit int */
44  typedef unsigned short uint16_t; /* 16-bit int */
45  typedef signed int int32_t; /* 32-bit int */
46  typedef unsigned int uint32_t; /* 32-bit int */
47  typedef signed __int64 int64_t; /* 64-bit int */
48  typedef unsigned __int64 uint64_t; /* 64-bit int */
49 # if !defined(WIN64) && !defined(_WIN64)
50  typedef signed int intptr_t; /* 32-bit int */
51  typedef unsigned int uintptr_t; /* 32-bit int */
52 # else
53  typedef signed __int64 intptr_t; /* 64-bit int */
54  typedef unsigned __int64 uintptr_t; /* 64-bit int */
55 # endif
56 # else /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */
57  typedef signed short int16_t; /* 16-bit int */
58  typedef unsigned short uint16_t; /* 16-bit int */
59  typedef signed int int32_t; /* 32-bit int */
60  typedef unsigned int uint32_t; /* 32-bit int */
61  typedef signed long int64_t; /* 64-bit int */
62  typedef unsigned long uint64_t; /* 64-bit int */
63  typedef signed long intptr_t;
64  typedef unsigned long uintptr_t;
65 # endif
66 #endif
67 
68 #include <float.h>
69 
70 /* try to understand float sizes using float.h constants */
71 #if FLT_RADIX == 2
72 # if FLT_MANT_DIG == 24 && FLT_MAX_EXP == 128
73 # define tds_sysdep_real32_type float /* 32-bit real */
74 # elif DBL_MANT_DIG == 24 && DBL_MAX_EXP == 128
75 # define tds_sysdep_real32_type double /* 32-bit real */
76 # elif LDBL_MANT_DIG == 24 && LDBL_MAX_EXP == 128
77 # define tds_sysdep_real32_type long double /* 32-bit real */
78 # endif
79 # if FLT_MANT_DIG == 53 && FLT_MAX_EXP == 1024
80 # define tds_sysdep_real64_type float /* 64-bit real */
81 # elif DBL_MANT_DIG == 53 && DBL_MAX_EXP == 1024
82 # define tds_sysdep_real64_type double /* 64-bit real */
83 # elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
84 # define tds_sysdep_real64_type long double /* 64-bit real */
85 # endif
86 # if !defined(tds_sysdep_real32_type) || !defined(tds_sysdep_real64_type)
87 # error Some float type was not found!
88 # endif
89 #else
90 # if FLT_DIG == 6 && FLT_MAX_10_EXP == 38
91 # define tds_sysdep_real32_type float /* 32-bit real */
92 # elif DBL_DIG == 6 && DBL_MAX_10_EXP == 38
93 # define tds_sysdep_real32_type double /* 32-bit real */
94 # elif LDBL_DIG == 6 && LDBL_MAX_10_EXP == 38
95 # define tds_sysdep_real32_type long double /* 32-bit real */
96 # endif
97 # if FLT_DIG == 15 && FLT_MAX_10_EXP == 308
98 # define tds_sysdep_real64_type float /* 64-bit real */
99 # elif DBL_DIG == 15 && DBL_MAX_10_EXP == 308
100 # define tds_sysdep_real64_type double /* 64-bit real */
101 # elif LDBL_DIG == 15 && LDBL_MAX_10_EXP == 308
102 # define tds_sysdep_real64_type long double /* 64-bit real */
103 # endif
104 #endif
105 
106 /* fall back to configure.ac types */
107 #ifndef tds_sysdep_real32_type
108 #define tds_sysdep_real32_type float /* 32-bit real */
109 #endif /* !tds_sysdep_real32_type */
110 
111 #ifndef tds_sysdep_real64_type
112 #define tds_sysdep_real64_type double /* 64-bit real */
113 #endif /* !tds_sysdep_real64_type */
114 
115 #if !defined(MSDBLIB) && !defined(SYBDBLIB)
116 #define SYBDBLIB 1
117 #endif
118 #if defined(MSDBLIB) && defined(SYBDBLIB)
119 #error MSDBLIB and SYBDBLIB cannot both be defined
120 #endif
121 
122 #endif /* _tds_sysdep_public_h_ */
freetds-1.3.6/doc/reference/a00518_source.html000644 025423 025423 00000006405 14162303416 022377 0ustar00fredianofrediano000000 000000 FreeTDS API: win32/freetds/sysconfdir.h Source File
FreeTDS API
sysconfdir.h
1 #define FREETDS_SYSCONFDIR "c:"
freetds-1.3.6/doc/reference/a00527_source.html000644 025423 025423 00000175073 14162303416 022407 0ustar00fredianofrediano000000 000000 FreeTDS API: vms/stdint.h Source File
FreeTDS API
stdint.h
1 #include <inttypes.h>
Holds information for a dynamic (also called prepared) query.
Definition: tds.h:977
bool bulk_query
true is query sent was a bulk query so we need to switch state to QUERYING
Definition: tds.h:1244
TDSRET tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Send a unprepare request for a prepared query.
Definition: query.c:1797
static TDSRET tds_process_param_result(TDSSOCKET *tds, TDSPARAMINFO **info)
process output parameters of a stored procedure.
Definition: token.c:1302
char * charset
character set encoding
Definition: tds.h:968
static TDSRET tds5_process_result(TDSSOCKET *tds)
tds5_process_result() is the TDS 5.0 result set processing routine.
Definition: token.c:1734
bool defer_close
true if dynamic was marker to be closed when connection is idle
Definition: tds.h:997
Definition: ptw32_MCS_lock.c:98
static const char * tds_pr_op(int op)
Returns string representation for a given operation.
Definition: token.c:3023
TDS_STATE tds_set_state(TDSSOCKET *tds, TDS_STATE state)
Set state of TDS connection, with logging and checking.
Definition: util.c:58
@ TDS_READING
client is reading data
Definition: tds.h:794
TDS_CURSOR_STATUS status
cursor parameter
Definition: tds.h:953
static const char * tds_dstr_cstr(const DSTR *s)
Returns a C version (NUL terminated string) of dstr.
Definition: string.h:78
TDSCURSOR * cursors
linked list of cursors allocated for this connection contains only cursors allocated on the server
Definition: tds.h:1107
bool has_status
true is ret_status is valid
Definition: tds.h:1245
@ TDS_DONE_COUNT
count field in packet is valid
Definition: tds.h:256
static TDSRET tds7_process_compute_result(TDSSOCKET *tds)
tds7_process_compute_result() processes compute result sets for TDS 7/8.
Definition: token.c:2837
Definition: thread.h:250
const char * tds_prtype(int type)
Returns string representation of the given type.
Definition: token.c:3056
unsigned in_pos
current position in in_buf
Definition: tds.h:1192
Main include file for libtds.
TDSENV env
environment is shared between all sessions
Definition: tds.h:1101
static TDSRET tds5_process_optioncmd(TDSSOCKET *tds)
Process option cmd results.
Definition: token.c:2972
static int tds_dstr_isempty(const DSTR *s)
test if string is empty
Definition: string.h:60
input stream to read data from a static buffer
Definition: stream.h:81
TDSLOGIN * login
config for login stuff.
Definition: tds.h:1258
void tds_unget_byte(TDSSOCKET *tds)
Unget will always work as long as you don't call it twice in a row.
Definition: read.c:89
output stream to write data to tds protocol
Definition: stream.h:72
unsigned char canonic
internal numeric index into array of all encodings
Definition: tds.h:624
Holds informations about a cursor.
Definition: tds.h:937
unsigned char * out_buf
Output buffer.
Definition: tds.h:1185
void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn)
Set current dynamic.
Definition: query.c:192
Definition: vstrbuild.c:37
TDS_UINT product_version
version of product (Sybase/MS and full version)
Definition: tds.h:1093
TDS_INT cursor_id
cursor id returned by the server after cursor declare
Definition: tds.h:941
static TDSRET tds_process_col_fmt(TDSSOCKET *tds)
tds_process_col_fmt() is the other half of result set processing under TDS 4.2.
Definition: token.c:1052
TDS_INT8 rows_affected
rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
Definition: tds.h:1254
TDS_TINYINT column_prec
precision for decimal/numeric
Definition: tds.h:703
unsigned char * in_buf
Input buffer.
Definition: tds.h:1177
TDSCURSOR * cur_cursor
cursor in use
Definition: tds.h:1243
void tds_close_socket(TDSSOCKET *tds)
Close current socket.
Definition: net.c:548
Definition: poll.h:52
TDSDYNAMIC * dyns
list of dynamic allocated for this connection contains only dynamic allocated on the server
Definition: tds.h:1112
TDSRET tds_alloc_row(TDSRESULTINFO *res_info)
Allocate space for row store return NULL on out of memory.
Definition: mem.c:524
Holds list of names.
Definition: token.c:914
static const char * tds_token_name(unsigned char marker)
Returns string representation for a given token type.
Definition: token.c:3130
int tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen)
Loops until we have received some characters return -1 on failure.
Definition: net.c:916
Definition: md5.h:8
TDSRET tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor)
Send a deallocation request to server.
Definition: query.c:3006
bool in_row
true if we are getting rows
Definition: tds.h:1246
TDSICONV * tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server)
Get a iconv info structure, allocate and initialize if needed.
Definition: iconv.c:758
static TDSRET tds_process_compute(TDSSOCKET *tds)
tds_process_compute() processes compute rows and places them in the row buffer.
Definition: token.c:1903
Provide poll call where missing.
static void adjust_character_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol)
Adjust column size according to client's encoding.
Definition: token.c:3226
TDS_TINYINT emulated
this dynamic query cannot be prepared so libTDS have to construct a simple query.
Definition: tds.h:993
TDSRET tds_process_cancel(TDSSOCKET *tds)
Definition: token.c:2554
static TDSRET tds_process_auth(TDSSOCKET *tds)
Process authentication token.
Definition: token.c:457
TDSRET tds_process_simple_query(TDSSOCKET *tds)
Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results,...
Definition: token.c:881
int tds_get_token_size(int marker)
tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determi...
Definition: token.c:2754
DSTR * tds_dstr_copyn(DSTR *s, const char *src, size_t length)
Set string to a given buffer of characters.
Definition: tdsstring.c:77
DSTR * tds_dstr_dup(DSTR *s, const DSTR *src)
Duplicate a string from another dynamic string.
Definition: tdsstring.c:134
static TDSRET tds_process_row(TDSSOCKET *tds)
tds_process_row() processes rows and places them in the row buffer.
Definition: token.c:1942
unsigned char tds_peek(TDSSOCKET *tds)
Reads a byte from the TDS stream without removing it.
Definition: read.c:100
TDSDYNAMIC * tds_lookup_dynamic(TDSCONNECTION *conn, const char *id)
Finds a dynamic given string id.
Definition: token.c:2587
DSTR * tds_dstr_setlen(DSTR *s, size_t length)
limit length of string, MUST be <= current length
Definition: tdsstring.c:145
const struct tds_dstr tds_str_empty
Internal representation for an empty string.
Definition: tdsstring.c:45
static TDSRET tds_get_data_info(TDSSOCKET *tds, TDSCOLUMN *curcol, int is_param)
Reads data metadata from wire.
Definition: token.c:1646
Definition: tds.h:876
DSTR * tds_dstr_set(DSTR *s, char *src)
set a string from another buffer.
Definition: tdsstring.c:107
static TDSRET tds_process_colinfo(TDSSOCKET *tds, char **names, int num_names)
Reads column information.
Definition: token.c:1237
Definition: md4.h:9
Metadata about columns in regular and compute rows.
Definition: tds.h:689
Definition: iconv.h:92
struct tds_cursor * next
next in linked list, keep first
Definition: tds.h:938
const char * name
name of the encoding (ie UTF-8)
Definition: tds.h:620
Definition: tds.h:1091
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:939
unsigned char tds_get_byte(TDSSOCKET *tds)
Return a single byte from the input buffer.
Definition: read.c:72
static TDSRET tds_process_col_name(TDSSOCKET *tds)
tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names,...
Definition: token.c:1004
DSTR * tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len)
Reads a string from wire and put in a DSTR.
Definition: read.c:293
unsigned char out_flag
output buffer type
Definition: tds.h:1196
int tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
Definition: net.c:987
static TDSRET tds_process_tabname(TDSSOCKET *tds)
Process list of table from network.
Definition: token.c:1188
struct tds_dynamic * next
next in linked list, keep first
Definition: tds.h:978
Definition: dlist.h:23
volatile unsigned char in_cancel
indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cance...
Definition: tds.h:1248
size_t tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
Fetch a string from the wire.
Definition: read.c:166
bool defer_close
true if cursor was marker to be closed when connection is idle
Definition: tds.h:946
TDS_INT ref_count
reference counter so client can retain safely a pointer
Definition: tds.h:979
Definition: thread.h:278
@ TDS_SENDING
client would send data
Definition: tds.h:792
TDSRET tds_process_login_tokens(TDSSOCKET *tds)
tds_process_login_tokens() is called after sending the login packet to the server.
Definition: token.c:411
int tds_read_packet(TDSSOCKET *tds)
Read in one 'packet' from the server.
Definition: packet.c:527
Structure to hold a string.
Definition: string.h:36
Hold information for any results.
Definition: tds.h:769
TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO *old_param)
Adds a output parameter to TDSPARAMINFO.
Definition: mem.c:284
TDSDYNAMIC * cur_dyn
dynamic structure in use
Definition: tds.h:1256
static TDSRET tds7_get_data_info(TDSSOCKET *tds, TDSCOLUMN *curcol)
Reads data information from wire.
Definition: token.c:1514
TDSRESULTINFO * current_results
Current query information.
Definition: tds.h:1238
void * tds_alloc_param_data(TDSCOLUMN *curparam)
Allocate data for a parameter.
Definition: mem.c:364
static int tds_alloc_get_string(TDSSOCKET *tds, char **string, size_t len)
Reads a string from wire in a new allocated buffer.
Definition: token.c:2527
DSTR server_name
server name (in freetds.conf)
Definition: tds.h:518
unsigned in_len
input buffer length
Definition: tds.h:1194
static TDSRET tds_process_param_result_tokens(TDSSOCKET *tds)
Process parameters from networks.
Definition: token.c:1358
unsigned out_pos
current position in out_buf
Definition: tds.h:1193
TDS_INT column_size
maximun size of data.
Definition: tds.h:694
DSTR * tds_dstr_alloc(DSTR *s, size_t length)
allocate space for length char
Definition: tdsstring.c:165
char * name
string name
Definition: token.c:916
TDS_INT ret_status
return status from store procedure
Definition: tds.h:1250
TDSRET tds_convert_stream(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
Reads and writes from a stream converting characters.
Definition: stream.c:71
static TDSRET tds_process_info(TDSSOCKET *tds, int marker)
tds_process_info() is called for INFO, ERR, or EED tokens and is responsible for calling the CLI's me...
Definition: token.c:2332
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Definition: tds.h:736
TDSICONV * char_conv
refers to previously allocated iconv information
Definition: tds.h:712
TDS_TINYINT column_varint_size
size of length when reading from wire (0, 1, 2 or 4)
Definition: tds.h:701
static TDSRET tds_process_compute_result(TDSSOCKET *tds)
tds_process_compute_result() processes compute result sets.
Definition: token.c:1414
void tds_staticin_stream_init(TDSSTATICINSTREAM *stream, const void *ptr, size_t len)
Initialize an input stream for read from a static allocated buffer.
Definition: stream.c:286
#define TDS_IS_MSSQL(x)
Check if product is Microsft SQL Server.
Definition: tds.h:1722
void tds_dstr_free(DSTR *s)
free string
Definition: tdsstring.c:62
DSTR * tds_dstr_copy(DSTR *s, const char *src)
copy a string from another
Definition: tdsstring.c:122
static TDSDYNAMIC * tds_process_dynamic(TDSSOCKET *tds)
tds_process_dynamic() finds the element of the dyns array for the id
Definition: token.c:2607
int tds_put_string(TDSSOCKET *tds, const char *s, int len)
Output a string to wire automatic translate string to unicode if needed.
Definition: write.c:97
static TDSRET tds_process_env_chg(TDSSOCKET *tds)
tds_process_env_chg() when ever certain things change on the server, such as database,...
Definition: token.c:2195
int tdserror(const TDSCONTEXT *tds_ctx, TDSSOCKET *tds, int msgno, int errnum)
Call the client library's error handler (for library-generated errors only)
Definition: util.c:321
size_t tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen)
Quote an id.
Definition: query.c:2171
void tdsdump_dump_buf(const char *file, unsigned int level_line, const char *msg, const void *buf, size_t length)
Dump the contents of data into the log file in a human readable format.
Definition: log.c:293
static TDSRET tds_process_params_result_token(TDSSOCKET *tds)
tds_process_params_result_token() processes params on TDS5.
Definition: token.c:1388
TDS_TINYINT column_scale
scale for decimal/numeric
Definition: tds.h:704
TDSPARAMINFO * res_info
query results
Definition: tds.h:999
static void tds_free_namelist(struct namelist *head)
Frees list of names.
Definition: token.c:926
@ TDS_DEAD
no connection
Definition: tds.h:795
void tds_release_dynamic(TDSDYNAMIC **pdyn)
Frees dynamic statement.
Definition: mem.c:253
char * database
database name
Definition: tds.h:970
static TDSRET tds_process_cursor_tokens(TDSSOCKET *tds)
Reads cursor command results.
Definition: token.c:2929
DSTR crlfile
certificate revocation file
Definition: tds.h:531
static int determine_adjusted_size(const TDSICONV *char_conv, int size)
Allow for maximum possible size of converted data, while being careful about integer division truncat...
Definition: token.c:3294
static int tds71_read_table_names(TDSSOCKET *tds, int remainder, struct namelist **p_head)
Reads table names for TDS 7.1+.
Definition: token.c:1105
static TDSRET tds5_process_dyn_result2(TDSSOCKET *tds)
Process new TDS 5.0 token for describing output parameters.
Definition: token.c:2685
static TDSRET tds5_process_result2(TDSSOCKET *tds)
tds5_process_result2() is the new TDS 5.0 result set processing routine.
Definition: token.c:1781
char id[30]
id of dynamic.
Definition: tds.h:987
Definition: tds.h:1047
static TDSRET tds_process_default_tokens(TDSSOCKET *tds, int marker)
tds_process_default_tokens() is a catch all function that is called to process tokens not known to ot...
Definition: token.c:122
static int tds_read_namelist(TDSSOCKET *tds, int remainder, struct namelist **p_head, int large)
Reads list of names (usually table names)
Definition: token.c:946
static TDSRET tds_process_end(TDSSOCKET *tds, int marker, int *flags_parm)
tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens.
Definition: token.c:2082
unsigned int pending_close
true is connection has pending closing (cursors or dynamic)
Definition: tds.h:1123
bool tds_get_n(TDSSOCKET *tds, void *dest, size_t need)
Get N bytes from the buffer and return them in the already allocated space given to us.
Definition: read.c:230
static void tds_process_pending_closes(TDSSOCKET *tds)
Attempt to close all deferred closes (dynamics and cursors).
Definition: token.c:2018
@ TDS_IDLE
no data expected
Definition: tds.h:790
Information for a server connection.
Definition: tds.h:1163
Definition: tds.h:504
struct namelist * next
next element in the list
Definition: token.c:918
Definition: des.h:16
Information relevant to libiconv.
Definition: tds.h:618
void tds_dataout_stream_init(TDSDATAOUTSTREAM *stream, TDSSOCKET *tds)
Initialize a data output stream.
Definition: stream.c:244
#define TDS_SYB_VER(maj, min, x)
Calc a version number for Sybase.
Definition: tds.h:1731
unsigned int out_buf_max
Maximum size of packet pointed by out_buf.
Definition: tds.h:1191
static TDSRET tds_process_dyn_result(TDSSOCKET *tds)
Process results from dynamic.
Definition: token.c:2643
@ TDS_DONE_CANCELLED
acknowledging an attention command (usually a cancel)
Definition: tds.h:257
@ TDS_DONE_ERROR
error occurred
Definition: tds.h:253
TDSRET tds_flush_packet(TDSSOCKET *tds)
Flush packet to server.
Definition: write.c:224
static TDSRET tds7_process_result(TDSSOCKET *tds)
tds7_process_result() is the TDS 7.0 result set processing routine.
Definition: token.c:1571
static TDSRET tds_process_compute_names(TDSSOCKET *tds)
tds_process_compute_names() processes compute result sets.
Definition: token.c:2777
TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
process all streams.
Definition: token.c:531
TDS_INT num_id
numeric id for mssql7+
Definition: tds.h:981
@ TDS_PENDING
cilent is waiting for data
Definition: tds.h:793
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
Definition: tds.h:696
int tds_write_dump
Tell if TDS debug logging is turned on or off.
Definition: log.c:58
TDS_UINT tds_get_uint(TDSSOCKET *tds)
Get an int32 from the server.
Definition: read.c:127
TDS_USMALLINT tds_get_usmallint(TDSSOCKET *tds)
Get an int16 from the server.
Definition: read.c:113
DSTR cafile
certificate authorities file
Definition: tds.h:530
@ TDS_DONE_MORE_RESULTS
more results follow
Definition: tds.h:252
static TDSRET tds_process_nbcrow(TDSSOCKET *tds)
tds_process_nbcrow() processes rows and places them in the row buffer.
Definition: token.c:1966
void tds_free_param_result(TDSPARAMINFO *param_info)
Delete latest parameter.
Definition: mem.c:320
void tds_dstr_zero(DSTR *s)
clear all string filling with zeroes (mainly for security reason)
Definition: tdsstring.c:55
void tdsdump_log(const char *file, unsigned int level_line, const char *fmt,...)
Write a message to the debug log.
Definition: log.c:396
void tdsdump_col(const TDSCOLUMN *col)
Write a column value to the debug log.
Definition: log.c:455
freetds-1.3.6/doc/reference/a00530_source.html000644 025423 025423 00000031600 14162303416 022364 0ustar00fredianofrediano000000 000000 FreeTDS API: vms/vargdefs.h Source File
FreeTDS API
vargdefs.h
1 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2  * Copyright (C) 2010 Craig A. Berry craigberry@mac.com
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18 
19 /*
20  * Definitions used by the VMSARG parsing and mapping routines.
21  *
22  * Based on VMSARG Version 2.0 by Tom Wade <t.wade@vms.eurokom.ei>
23  *
24  * Extensively revised for inclusion in FreeTDS by Craig A. Berry.
25  *
26  * From the VMSARG 2.0 documentation:
27  *
28  * The product is aimed at . . . people who are porting a package from
29  * Unix to VMS. This software is made freely available for inclusion in
30  * such products, whether they are freeware, public domain or commercial.
31  * No licensing is required.
32  */
33 
34 #if __CRTL_VER >= 70302000 && !defined(__VAX)
35 #define QUAL_LENGTH (4000+1)
36 #define S_LENGTH (4096+1)
37 #else
38 #define QUAL_LENGTH (255+1)
39 #define S_LENGTH (1024+1)
40 #endif
41 
42 #define MAX_ARGS 255
43 
44 /* bit fields for arg flags.
45 */
46 
47 #define VARG_M_AFFIRM 1
48 #define VARG_M_NEGATIVE 2
49 #define VARG_M_KEYWORDS 4
50 #define VARG_M_SEPARATOR 8
51 #define VARG_M_DATE 16
52 #define VARG_M_APPEND 32
53 #define VARG_M_HELP 64
54 
55 /* bit fields for action flags.
56 */
57 
58 #define VARGACT_M_UPPER 1
59 #define VARGACT_M_LOWER 2
60 #define VARGACT_M_SPECIAL 4
61 #define VARGACT_M_ESCAPE 8
62 #define VARGACT_M_DOUBLE 16
63 #define VARGACT_M_IMAGE 32
64 #define VARGACT_M_SYMBOL 64
65 #define VARGACT_M_COMMAND 128
66 #define VARGACT_M_RETURN 256
67 #define VARGACT_M_PROTECT 512
68 #define VARGACT_M_UNIXARG 1024
69 
70 #define VARGACT_M_PROTMASK 1+2+4+8+16
freetds-1.3.6/doc/reference/a00547.dot000644 025423 025423 00000004067 14162303416 020645 0ustar00fredianofrediano000000 000000 digraph "The db-lib API" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions callable by db-lib client programs."]; Node3 [label="Remote Procedure functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00549.html",tooltip="Functions used with stored procedures."]; Node5 [label="Money functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00552.html",tooltip="Functions to manipulate the MONEY datatype."]; Node7 [label="Internals",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00554.html",tooltip="Functions called within db-lib for self-help."]; Node2 [label="Primary functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00548.html",tooltip="Core functions needed by most db-lib programs."]; Node6 [label="Datetime functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00553.html",tooltip="Functions to manipulate DBDATETIME structures."]; Node8 [label="Unimplemented",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00555.html",tooltip="Functions thus far not implemented in the FreeTDS db-lib implementation."]; Node4 [label="Bulk copy functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00550.html",tooltip="Functions to bulk-copy (a/k/a bcp) data to/from the database."]; Node1->Node2 [shape=plaintext, dir="back", style="solid"]; Node1->Node3 [shape=plaintext, dir="back", style="solid"]; Node1->Node4 [shape=plaintext, dir="back", style="solid"]; Node1->Node5 [shape=plaintext, dir="back", style="solid"]; Node1->Node6 [shape=plaintext, dir="back", style="solid"]; Node1->Node7 [shape=plaintext, dir="back", style="solid"]; Node1->Node8 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00547.html000644 025423 025423 00000036572 14162303416 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: The db-lib API
FreeTDS API
The db-lib API

Functions callable by db-lib client programs. More...

Collaboration diagram for The db-lib API:

Modules

 Primary functions
 Core functions needed by most db-lib programs.
 
 Remote Procedure functions
 Functions used with stored procedures.
 
 Bulk copy functions
 Functions to bulk-copy (a/k/a bcp) data to/from the database.
 
 Money functions
 Functions to manipulate the MONEY datatype.
 
 Datetime functions
 Functions to manipulate DBDATETIME structures.
 
 Internals
 Functions called within db-lib for self-help.
 
 Unimplemented
 Functions thus far not implemented in the FreeTDS db-lib implementation.
 

Macros

#define BCP_SETL(x, y)   dbsetlbool((x), (y), DBSETBCP)
 Enable (or prevent) bcp operations for connections made with a login. More...
 
#define DBSETLAPP(x, y)   dbsetlname((x), (y), DBSETAPP)
 Set the (client) application name in the login packet. More...
 
#define DBSETLHOST(x, y)   dbsetlname((x), (y), DBSETHOST)
 Set the (client) host name in the login packet. More...
 
#define DBSETLPWD(x, y)   dbsetlname((x), (y), DBSETPWD)
 Set the password in the login packet. More...
 
#define DBSETLUSER(x, y)   dbsetlname((x), (y), DBSETUSER)
 Set the username in the login packet. More...
 

Detailed Description

Functions callable by db-lib client programs.

The db_lib interface is implemented by both Sybase and Microsoft. FreeTDS seeks to implement first the intersection of the functions defined by the vendors.

Macro Definition Documentation

◆ BCP_SETL

BCP_SETL (   x,
 
)    dbsetlbool((x), (y), DBSETBCP)

Enable (or prevent) bcp operations for connections made with a login.


See also
bcp_setl()

◆ DBSETLAPP

DBSETLAPP (   x,
 
)    dbsetlname((x), (y), DBSETAPP)

Set the (client) application name in the login packet.


See also
dbsetlapp()

◆ DBSETLHOST

DBSETLHOST (   x,
 
)    dbsetlname((x), (y), DBSETHOST)

Set the (client) host name in the login packet.


See also
dbsetlhost()

◆ DBSETLPWD

DBSETLPWD (   x,
 
)    dbsetlname((x), (y), DBSETPWD)

Set the password in the login packet.


See also
dbsetlpwd()

◆ DBSETLUSER

DBSETLUSER (   x,
 
)    dbsetlname((x), (y), DBSETUSER)

Set the username in the login packet.


See also
dbsetluser()
freetds-1.3.6/doc/reference/a00548.dot000644 025423 025423 00000001147 14162303416 020642 0ustar00fredianofrediano000000 000000 digraph "Primary functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00547.html",tooltip="Functions callable by db-lib client programs."]; Node1 [label="Primary functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Core functions needed by most db-lib programs."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00548.html000644 025423 025423 00001161671 14162303417 021033 0ustar00fredianofrediano000000 000000 FreeTDS API: Primary functions
FreeTDS API
Primary functions

Core functions needed by most db-lib programs. More...

Collaboration diagram for Primary functions:

Macros

#define DBCMDROW(x)   dbcmdrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBCOUNT(x)   dbcount((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBCURCMD(x)   dbcurcmd((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBCURROW(x)   dbcurrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBDEAD(x)   dbdead((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBFIRSTROW(x)   dbfirstrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBIORDESC(x)   dbiordesc((x))
 Sybase macro, maps to the internal (lower-case) function. More...
 
#define DBIOWDESC(x)   dbiowdesc((x))
 Sybase macro, maps to the internal (lower-case) function. More...
 
#define DBISAVAIL(x)   dbisavail((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBLASTROW(x)   dblastrow((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBMORECMDS(x)   dbmorecmds((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBROWS(x)   dbrows((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBROWTYPE(x)   dbrowtype((x))
 Sybase macro mapping to the Microsoft (lower-case) function. More...
 
#define DBSETLCHARSET(x, y)   dbsetlname((x), (y), DBSETCHARSET)
 Set the client character set in the login packet. More...
 
#define DBSETLENCRYPT(x, y)   dbsetlbool((x), (y), DBSETENCRYPT)
 Enable (or not) network password encryption for Sybase servers version 10.0 or above. More...
 
#define DBSETLNATLANG(x, y)   dbsetlname((x), (y), DBSETNATLANG)
 Set the language the server should use for messages. More...
 
#define dbsetlnatlang(x, y)   dbsetlname((x), (y), DBSETNATLANG)
 Set the language the server should use for messages. More...
 
#define DBSETLPACKET(x, y)   dbsetllong((x), (y), DBSETPACKET)
 Set the packet size in the login packet for new connections. More...
 
#define dbsetlpacket(x, y)   dbsetllong((x), (y), DBSETPACKET)
 Set the packet size in the login packet for new connections. More...
 
#define DBTDS(a)   dbtds(a)
 Sybase macro, maps to the internal (lower-case) function. More...
 

Functions

static RETCODE _dbresults (DBPROCESS *dbproc)
 
const char * dbacolname (DBPROCESS *dbproc, int computeid, int column)
 Return name of a computed result column. More...
 
BYTE * dbadata (DBPROCESS *dbproc, int computeid, int column)
 Get address of compute column data. More...
 
DBINT dbadlen (DBPROCESS *dbproc, int computeid, int column)
 Get size of data in a compute column. More...
 
RETCODE dbaltbind (DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr)
 Bind a compute column to a program variable. More...
 
int dbaltcolid (DBPROCESS *dbproc, int computeid, int column)
 Get column ID of a compute column. More...
 
DBINT dbaltlen (DBPROCESS *dbproc, int computeid, int column)
 Get size of data in compute column. More...
 
int dbaltop (DBPROCESS *dbproc, int computeid, int column)
 Get aggregation operator for a compute column. More...
 
int dbalttype (DBPROCESS *dbproc, int computeid, int column)
 Get datatype for a compute column. More...
 
DBINT dbaltutype (DBPROCESS *dbproc, int computeid, int column)
 Get user-defined datatype of a compute column. More...
 
RETCODE dbanullbind (DBPROCESS *dbproc, int computeid, int column, DBINT *indicator)
 Tie a null-indicator to a compute result column. More...
 
RETCODE dbanydatecrack (DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data)
 Break any kind of date or time value into useful pieces. More...
 
RETCODE dbbind (DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
 Tie a host variable to a resultset column. More...
 
BYTE * dbbylist (DBPROCESS *dbproc, int computeid, int *size)
 Get bylist for a compute row. More...
 
RETCODE dbcancel (DBPROCESS *dbproc)
 Cancel the current command batch. More...
 
RETCODE dbcanquery (DBPROCESS *dbproc)
 Cancel the query currently being retrieved, discarding all pending rows. More...
 
char * dbchange (DBPROCESS *dbproc)
 See if a command caused the current database to change. More...
 
void dbclose (DBPROCESS *dbproc)
 Close a connection to the server and free associated resources. More...
 
void dbclrbuf (DBPROCESS *dbproc, DBINT n)
 Clear n rows from the row buffer. More...
 
RETCODE dbclropt (DBPROCESS *dbproc, int option, const char param[])
 Reset an option. More...
 
RETCODE dbcmd (DBPROCESS *dbproc, const char cmdstring[])
 Append SQL to the command buffer. More...
 
DBINT dbcollen (DBPROCESS *dbproc, int column)
 Get size of a regular result column. More...
 
char * dbcolname (DBPROCESS *dbproc, int column)
 Return name of a regular result column. More...
 
char * dbcolsource (DBPROCESS *dbproc, int column)
 Get base database column name for a result set column. More...
 
int dbcoltype (DBPROCESS *dbproc, int column)
 Get the datatype of a regular result set column. More...
 
DBTYPEINFOdbcoltypeinfo (DBPROCESS *dbproc, int column)
 Get precision and scale information for a regular result column. More...
 
int dbcolutype (DBPROCESS *dbproc, int column)
 Get user-defined datatype of a regular result column. More...
 
DBINT dbconvert (DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen)
 cf. More...
 
DBINT dbconvert_ps (DBPROCESS *dbproc, int db_srctype, const BYTE *src, DBINT srclen, int db_desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo)
 Convert one datatype to another. More...
 
DBINT dbcount (DBPROCESS *dbproc)
 Get count of rows processed. More...
 
BYTE * dbdata (DBPROCESS *dbproc, int column)
 Get address of data in a regular result column. More...
 
RETCODE dbdatecrack (DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime)
 Break a DBDATETIME value into useful pieces. More...
 
DBINT dbdatlen (DBPROCESS *dbproc, int column)
 Get size of current row's data in a regular result column. More...
 
EHANDLEFUNC dberrhandle (EHANDLEFUNC handler)
 Set an error handler, for messages from db-lib. More...
 
void dbexit ()
 Close server connections and free all related structures. More...
 
RETCODE dbfcmd (DBPROCESS *dbproc, const char *fmt,...)
 printf-like way to form SQL to send to the server. More...
 
void dbfreebuf (DBPROCESS *dbproc)
 Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt(). More...
 
char * dbgetchar (DBPROCESS *dbproc, int pos)
 Get address of a position in the command buffer. More...
 
int dbgetmaxprocs (void)
 get maximum simultaneous connections db-lib will open to the server. More...
 
int dbgetpacket (DBPROCESS *dbproc)
 Get TDS packet size for the connection. More...
 
RETCODE dbgetrow (DBPROCESS *dbproc, DBINT row)
 Read a row from the row buffer. More...
 
int dbgettime (void)
 Get maximum seconds db-lib waits for a server response to query. More...
 
BYTE * dbgetuserdata (DBPROCESS *dbproc)
 Get address of user-allocated data from a DBPROCESS. More...
 
RETCODE dbinit (void)
 Initialize db-lib. More...
 
BOOL dbiscount (DBPROCESS *dbproc)
 Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature). More...
 
DBBOOL dbisopt (DBPROCESS *dbproc, int option, const char param[])
 Get value of an option. More...
 
LOGINRECdblogin (void)
 Allocate a LOGINREC structure. More...
 
void dbloginfree (LOGINREC *login)
 free the LOGINREC
 
RETCODE dbmorecmds (DBPROCESS *dbproc)
 See if more commands are to be processed. More...
 
RETCODE dbmoretext (DBPROCESS *dbproc, DBINT size, const BYTE text[])
 Send chunk of a text/image value to the server. More...
 
MHANDLEFUNC dbmsghandle (MHANDLEFUNC handler)
 Set a message handler, for messages from the server. More...
 
char * dbname (DBPROCESS *dbproc)
 Get name of current database. More...
 
RETCODE dbnullbind (DBPROCESS *dbproc, int column, DBINT *indicator)
 Tie a null-indicator to a regular result column. More...
 
int dbnumalts (DBPROCESS *dbproc, int computeid)
 Get count of columns in a compute row. More...
 
int dbnumcols (DBPROCESS *dbproc)
 Return number of regular columns in a result set. More...
 
int dbnumcompute (DBPROCESS *dbproc)
 Get count of COMPUTE clauses for a result set. More...
 
DBINT dbprcollen (DBPROCESS *dbproc, int column)
 Get size of a result column needed to print column. More...
 
void dbprhead (DBPROCESS *dbproc)
 Print result set headings to stdout. More...
 
RETCODE dbprrow (DBPROCESS *dbproc)
 Print a result set to stdout. More...
 
const char * dbprtype (int token)
 Print a token value's name to a buffer. More...
 
STATUS dbreadtext (DBPROCESS *dbproc, void *buf, DBINT bufsize)
 Fetch part of a text or image value from the server. More...
 
void dbrecftos (const char filename[])
 Record to a file all SQL commands sent to the server. More...
 
RETCODE dbresults (DBPROCESS *dbproc)
 Set up query results. More...
 
RETCODE dbsafestr (DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype)
 safely quotes character values in SQL text. More...
 
char * dbservcharset (DBPROCESS *dbproc)
 Get syscharset name of the server character set. More...
 
void dbsetifile (char *filename)
 set name and location of the interfaces file FreeTDS should use to look up a servername. More...
 
void dbsetinterrupt (DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr)
 Set interrupt handler for db-lib to use while blocked against a read from the server. More...
 
RETCODE dbsetlogintime (int seconds)
 Set maximum seconds db-lib waits for a server response to a login attempt. More...
 
RETCODE dbsetlversion (LOGINREC *login, BYTE version)
 Set TDS version for future connections.
 
RETCODE dbsetmaxprocs (int maxprocs)
 Set maximum simultaneous connections db-lib will open to the server. More...
 
RETCODE dbsetnull (DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval)
 Define substitution values to be used when binding null values. More...
 
RETCODE dbsetopt (DBPROCESS *dbproc, int option, const char *char_param, int int_param)
 Set db-lib or server option. More...
 
STATUS dbsetrow (DBPROCESS *dbproc, DBINT row)
 Make a buffered row "current" without fetching it into bound variables. More...
 
RETCODE dbsettime (int seconds)
 Set maximum seconds db-lib waits for a server response to query. More...
 
void dbsetuserdata (DBPROCESS *dbproc, BYTE *ptr)
 Associate client-allocated (and defined) data with a DBPROCESS. More...
 
RETCODE dbsetversion (DBINT version)
 Specify a db-lib version level. More...
 
int dbspid (DBPROCESS *dbproc)
 Get server process ID for a DBPROCESS. More...
 
RETCODE dbspr1row (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
 Print a regular result row to a buffer. More...
 
DBINT dbspr1rowlen (DBPROCESS *dbproc)
 Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row(). More...
 
RETCODE dbsprhead (DBPROCESS *dbproc, char *buffer, DBINT buf_len)
 Print result set headings to a buffer. More...
 
RETCODE dbsprline (DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char)
 Get formatted string for underlining dbsprhead() column names. More...
 
RETCODE dbsqlexec (DBPROCESS *dbproc)
 send the SQL command to the server and wait for an answer. More...
 
RETCODE dbsqlok (DBPROCESS *dbproc)
 Wait for results of a query from the server. More...
 
RETCODE dbsqlsend (DBPROCESS *dbproc)
 Transmit the command buffer to the server. More...
 
RETCODE dbstrbuild (DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...)
 Build a printable string from text containing placeholders for variables. More...
 
RETCODE dbstrcpy (DBPROCESS *dbproc, int start, int numbytes, char *dest)
 Get a copy of a chunk of the command buffer. More...
 
int dbstrlen (DBPROCESS *dbproc)
 Get size of the command buffer, in bytes. More...
 
RETCODE dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol)
 describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo) More...
 
DBBINARY * dbtxptr (DBPROCESS *dbproc, int column)
 Get text pointer for a column in the current row. More...
 
DBBINARY * dbtxtimestamp (DBPROCESS *dbproc, int column)
 Get text timestamp for a column in the current row. More...
 
RETCODE dbuse (DBPROCESS *dbproc, const char *name)
 Change current database. More...
 
DBINT dbvarylen (DBPROCESS *dbproc, int column)
 Determine whether a column can vary in size. More...
 
const char * dbversion ()
 See which version of db-lib is in use. More...
 
DBBOOL dbwillconvert (int srctype, int desttype)
 Test whether or not a datatype can be converted to another datatype. More...
 
RETCODE dbwritetext (DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text)
 Send text or image data to the server. More...
 

Detailed Description

Core functions needed by most db-lib programs.


Macro Definition Documentation

◆ DBCMDROW

DBCMDROW (   x)    dbcmdrow((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbcmdrow()

◆ DBCOUNT

DBCOUNT (   x)    dbcount((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbcount()

◆ DBCURCMD

DBCURCMD (   x)    dbcurcmd((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbcurcmd()

◆ DBCURROW

DBCURROW (   x)    dbcurrow((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbcurrow()

◆ DBDEAD

DBDEAD (   x)    dbdead((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbdead()

◆ DBFIRSTROW

DBFIRSTROW (   x)    dbfirstrow((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbfirstrow()

◆ DBIORDESC

DBIORDESC (   x)    dbiordesc((x))

Sybase macro, maps to the internal (lower-case) function.


See also
dbiordesc()

◆ DBIOWDESC

DBIOWDESC (   x)    dbiowdesc((x))

Sybase macro, maps to the internal (lower-case) function.


See also
dbiowdesc()

◆ DBISAVAIL

DBISAVAIL (   x)    dbisavail((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbisavail()

◆ DBLASTROW

DBLASTROW (   x)    dblastrow((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dblastrow(), DBFIRSTROW()

◆ DBMORECMDS

DBMORECMDS (   x)    dbmorecmds((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbmorecmds()

◆ DBROWS

DBROWS (   x)    dbrows((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbrows()

◆ DBROWTYPE

DBROWTYPE (   x)    dbrowtype((x))

Sybase macro mapping to the Microsoft (lower-case) function.


See also
dbrowtype()

◆ DBSETLCHARSET

DBSETLCHARSET (   x,
 
)    dbsetlname((x), (y), DBSETCHARSET)

Set the client character set in the login packet.

Remarks
Has no effect on TDS 7.0+ connections.

◆ DBSETLENCRYPT

DBSETLENCRYPT (   x,
 
)    dbsetlbool((x), (y), DBSETENCRYPT)

Enable (or not) network password encryption for Sybase servers version 10.0 or above.

Todo:
Unimplemented.
See also
dbsetlencrypt()

◆ DBSETLNATLANG

DBSETLNATLANG (   x,
 
)    dbsetlname((x), (y), DBSETNATLANG)

Set the language the server should use for messages.


See also
dbsetlnatlang(), dbsetlname()

◆ dbsetlnatlang

dbsetlnatlang (   x,
 
)    dbsetlname((x), (y), DBSETNATLANG)

Set the language the server should use for messages.


See also
DBSETLNATLANG(), dbsetlname()

◆ DBSETLPACKET

DBSETLPACKET (   x,
 
)    dbsetllong((x), (y), DBSETPACKET)

Set the packet size in the login packet for new connections.


See also
dbsetlpacket(), dbsetllong()

◆ dbsetlpacket

dbsetlpacket (   x,
 
)    dbsetllong((x), (y), DBSETPACKET)

Set the packet size in the login packet for new connections.


See also
DBSETLPACKET(), dbsetllong()

◆ DBTDS

DBTDS (   a)    dbtds(a)

Sybase macro, maps to the internal (lower-case) function.


See also
dbtds()

Function Documentation

◆ _dbresults()

static RETCODE _dbresults ( DBPROCESS dbproc)
static
Remarks
Either SYBDBLIB or MSDBLIB (not both) must be defined. This affects how certain application-addressable strucures are defined.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbacolname()

const char* dbacolname ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Return name of a computed result column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeididentifies which one of potientially many compute rows is meant. The first compute clause has computeid == 1.
columnNth in the result set, starting with 1.
Returns
pointer to ASCII null-terminated string, the name of the column.
Return values
NULLcolumn is not in range.
See also
dbcollen(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().
Here is the call graph for this function:

◆ dbadata()

BYTE* dbadata ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Get address of compute column data.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
Returns
pointer to columns's data buffer.
Return values
NULLno such computeid or column.
See also
dbadlen(), dbaltbind(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts().
Here is the call graph for this function:

◆ dbadlen()

DBINT dbadlen ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Get size of data in a compute column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
Returns
size of the data, in bytes.
Return values
-1no such column or computeid.
0data are NULL.
See also
dbadata(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts().

◆ dbaltbind()

RETCODE dbaltbind ( DBPROCESS dbproc,
int  computeid,
int  column,
int  vartype,
DBINT  varlen,
BYTE *  varaddr 
)

Bind a compute column to a program variable.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
vartypedatatype of the host variable that will receive the data
varlensize of host variable pointed to varaddr
varaddraddress of host variable
Return values
SUCCEEDeverything worked.
FAILno such computeid or column, or no such conversion possible, or target buffer too small.
See also
dbadata(), dbaltbind_ps(), dbanullbind(), dbbind(), dbbind_ps(), dbconvert(), dbconvert_ps(), dbnullbind(), dbsetnull(), dbsetversion(), dbwillconvert().
Here is the call graph for this function:

◆ dbaltcolid()

int dbaltcolid ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Get column ID of a compute column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
Returns
Nth column in the base result set, on which column was computed.
See also
dbadata(), dbadlen(), dbaltlen(), dbgetrow(), dbnextrow(), dbnumalts(), dbprtype().
Here is the call graph for this function:

◆ dbaltlen()

DBINT dbaltlen ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Get size of data in compute column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
See also
dbadata(), dbadlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts().
Here is the call graph for this function:

◆ dbaltop()

int dbaltop ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Get aggregation operator for a compute column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
Returns
token value for the type of the compute column's aggregation operator.
Return values
-1no such computeid or column.
See also
dbadata(), dbadlen(), dbaltlen(), dbnextrow(), dbnumalts(), dbprtype().
Here is the call graph for this function:

◆ dbalttype()

int dbalttype ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Get datatype for a compute column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
Returns
SYB* dataype token.
Return values
-1no such column or computeid.
See also
dbadata(), dbadlen(), dbaltlen(), dbnextrow(), dbnumalts(), dbprtype().
Here is the call graph for this function:

◆ dbaltutype()

DBINT dbaltutype ( DBPROCESS dbproc,
int  computeid,
int  column 
)

Get user-defined datatype of a compute column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
columnNth column in computeid, starting from 1.
Returns
user-defined datatype of compute column, else -1.
See also
dbalttype(), dbcolutype().
Here is the call graph for this function:

◆ dbanullbind()

RETCODE dbanullbind ( DBPROCESS dbproc,
int  computeid,
int  column,
DBINT *  indicator 
)

Tie a null-indicator to a compute result column.

When a row is fetched, the indicator variable tells the state of the column's data.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeididentifies which one of potientially many compute rows is meant. The first compute clause has computeid == 1.
columnNth column in the result set, starting with 1.
indicatoraddress of host variable.
Return values
SUCCEEDvariable accepted.
FAILindicator is NULL or column is out of range.
Remarks
Contents of indicator are set with dbnextrow(). Possible values are:
  • 0 column bound successfully
  • -1 column is NULL.
  • >0 true length of data, had column not been truncated due to insufficient space in the columns bound host variable .
See also
dbadata(), dbadlen(), dbaltbind(), dbnextrow(), dbnullbind().
Todo:
Never fails, but only because failure conditions aren't checked.
Here is the call graph for this function:

◆ dbanydatecrack()

RETCODE dbanydatecrack ( DBPROCESS dbproc,
DBDATEREC2 di,
int  type,
const void *  data 
)

Break any kind of date or time value into useful pieces.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
dioutput: structure to contain the exploded parts of datetime.
typeinput: type of date/time value returned by dbcoltype().
datainput: date/time value to be converted.
Return values
SUCCEEDalways.
Remarks
The members of di have different names, depending on whether –with-msdblib was configured.

This is an extension to dbdatecrack(), see it for more information.

See also
dbdatecrack(), dbconvert(), dbdata(), dbdatechar(), dbdatename(), dbdatepart(), tdsdbopen().

◆ dbbind()

RETCODE dbbind ( DBPROCESS dbproc,
int  column,
int  vartype,
DBINT  varlen,
BYTE *  varaddr 
)

Tie a host variable to a resultset column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth column, starting at 1.
vartypedatatype of the host variable that will receive the data
varlensize of host variable pointed to varaddr
varaddraddress of host variable
Return values
SUCCEEDeverything worked.
FAILno such column or no such conversion possible, or target buffer too small.
See also
Here is the call graph for this function:

◆ dbbylist()

BYTE* dbbylist ( DBPROCESS dbproc,
int  computeid,
int *  size 
)

Get bylist for a compute row.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
sizeoutput: size of bylist buffer whose address is returned, possibly zero.
Returns
address of bylist for computeid.
Return values
NULLno such computeid.
Remarks
Do not free returned pointer.
See also
dbadata(), dbadlen(), dbaltlen(), dbalttype(), dbcolname(), dbgetrow(), dbnextrow().
Here is the call graph for this function:

◆ dbcancel()

RETCODE dbcancel ( DBPROCESS dbproc)

Cancel the current command batch.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Return values
SUCCEEDalways.
See also
dbcanquery(), dbnextrow(), dbresults(), dbsetinterrupt(), dbsqlexec(), dbsqlok(), dbsqlsend().
Todo:
Check for failure and return accordingly.
Here is the call graph for this function:

◆ dbcanquery()

RETCODE dbcanquery ( DBPROCESS dbproc)

Cancel the query currently being retrieved, discarding all pending rows.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also
Here is the call graph for this function:

◆ dbchange()

char* dbchange ( DBPROCESS dbproc)

See if a command caused the current database to change.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
name of new database, if changed, as a null-terminated ASCII string, else NULL.
See also
dbname(), dbresults(), dbsqlexec(), dbsqlsend(), dbuse().
Here is the call graph for this function:

◆ dbclose()

void dbclose ( DBPROCESS dbproc)

Close a connection to the server and free associated resources.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also
dbexit(), dbopen().
Here is the call graph for this function:

◆ dbclrbuf()

void dbclrbuf ( DBPROCESS dbproc,
DBINT  n 
)

Clear n rows from the row buffer.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
nnumber of rows to remove, >= 0.
See also
dbgetrow(), dbnextrow(), dbsetopt().
Here is the call graph for this function:

◆ dbclropt()

RETCODE dbclropt ( DBPROCESS dbproc,
int  option,
const char  param[] 
)

Reset an option.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
optionto be turned off.
paramclearing some options requires a parameter, believe it or not.
Return values
SUCCEEDoption and parameter seem sane.
FAILno such option.
Remarks
Only the following options are recognized:
  • DBARITHABORT
  • DBARITHIGNORE
  • DBCHAINXACTS
  • DBFIPSFLAG
  • DBISOLATION
  • DBNOCOUNT
  • DBNOEXEC
  • DBPARSEONLY
  • DBSHOWPLAN
  • DBSTORPROCID
  • DBQUOTEDIDENT
  • DBSETTIME
See also
dbisopt(), dbsetopt().
Here is the call graph for this function:

◆ dbcmd()

RETCODE dbcmd ( DBPROCESS dbproc,
const char  cmdstring[] 
)

Append SQL to the command buffer.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
cmdstringSQL to append to the command buffer.
Return values
SUCCEEDsuccess.
FAILinsufficient memory.
Remarks
set command state to DBCMDPEND unless the command state is DBCMDSENT, in which case it frees the command buffer. This latter may or may not be the Right Thing to do.
See also
dbfcmd(), dbfreebuf(), dbgetchar(), dbopen(), dbstrcpy(), dbstrlen().
Here is the call graph for this function:

◆ dbcollen()

DBINT dbcollen ( DBPROCESS dbproc,
int  column 
)

Get size of a regular result column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
size of the column (not of data in any particular row). On error, -1.
See also
dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().
Here is the call graph for this function:

◆ dbcolname()

char* dbcolname ( DBPROCESS dbproc,
int  column 
)

Return name of a regular result column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting with 1.
Returns
pointer to ASCII null-terminated string, the name of the column.
Return values
NULLcolumn is not in range.
See also
dbcollen(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().
Bug:
Relies on ASCII column names, post iconv conversion.
Will not work as described for UTF-8 or UCS-2 clients.
But maybe it shouldn't.
Here is the call graph for this function:

◆ dbcolsource()

char* dbcolsource ( DBPROCESS dbproc,
int  column 
)

Get base database column name for a result set column.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
pointer to ASCII null-terminated string, the name of the column. On error, NULL.
See also
dbcolbrowse(), dbqual(), dbtabbrowse(), dbtabcount(), dbtabname(), dbtabsource(), dbtsnewlen(), dbtsnewval(), dbtsput().
Here is the call graph for this function:

◆ dbcoltype()

int dbcoltype ( DBPROCESS dbproc,
int  column 
)

Get the datatype of a regular result set column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
SYB* datetype token value, or zero if column out of range
See also
dbcollen(), dbcolname(), dbdata(), dbdatlen(), dbnumcols(), dbprtype(), dbvarylen().
Here is the call graph for this function:

◆ dbcoltypeinfo()

DBTYPEINFO* dbcoltypeinfo ( DBPROCESS dbproc,
int  column 
)

Get precision and scale information for a regular result column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
Pointer to a DBTYPEINFO structure . NULL column is out of range.
See also
dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(), dbprtype(), dbvarylen().
Here is the call graph for this function:

◆ dbcolutype()

int dbcolutype ( DBPROCESS dbproc,
int  column 
)

Get user-defined datatype of a regular result column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
SYB* datetype token value, or -1 if column out of range
See also
dbaltutype(), dbcoltype().
Here is the call graph for this function:

◆ dbconvert()

DBINT dbconvert ( DBPROCESS dbproc,
int  srctype,
const BYTE *  src,
DBINT  srclen,
int  desttype,
BYTE *  dest,
DBINT  destlen 
)

cf.

dbconvert_ps(), above

Sybase: Convert numeric types.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
srctypedatatype of the data to convert.
srcbuffer to convert
srclenlength of src
desttypetarget datatype
destoutput buffer
destlensize of dest
typeinfoaddress of a DBTYPEINFO structure that governs the precision & scale of the output, may be NULL.
See also
dbaltbind(), dbaltbind_ps(), dbbind(), dbbind_ps(), dbconvert_ps(), dberrhandle(), dbsetnull(), dbsetversion(), dbwillconvert().
Here is the call graph for this function:

◆ dbconvert_ps()

DBINT dbconvert_ps ( DBPROCESS dbproc,
int  db_srctype,
const BYTE *  src,
DBINT  srclen,
int  db_desttype,
BYTE *  dest,
DBINT  destlen,
DBTYPEINFO typeinfo 
)

Convert one datatype to another.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
srctypedatatype of the data to convert.
srcbuffer to convert
srclenlength of src
desttypetarget datatype
destoutput buffer
destlensize of dest
Returns
On success, the count of output bytes in dest, else -1. On failure, it will call any user-supplied error handler.
Remarks
Causes of failure:
  • No such conversion unavailable.
  • Character data output was truncated, or numerical data overflowed or lost precision.
  • In converting character data to one of the numeric types, the string could not be interpreted as a number.

Conversion functions are handled in the TDS layer.

The main reason for this is that ct-lib and ODBC (and presumably DBI) need to be able to do conversions between datatypes. This is possible because the format of complex data (dates, money, numeric, decimal) is defined by its representation on the wire; thus what we call DBMONEY is exactly its format on the wire. CLIs that need a different representation (ODBC?) need to convert from this format anyway, so the code would already be in place.

Each datatype is also defined by its Server-type so all CLIs should be able to map native types to server types as well.

tds_convert() copies from src to dest and returns the output data length, period. All padding and termination is the responsibility of the API library and is done post-conversion. The peculiar rule in dbconvert() is that a destlen of -1 and a desttype of SYBCHAR means the output buffer should be null-terminated.

See also
dbaltbind(), dbaltbind_ps(), dbbind(), dbbind_ps(), dbconvert_ps(), dberrhandle(), dbsetnull(), dbsetversion(), dbwillconvert().
Todo:
What happens if client does not reset values?
Todo:
Microsoft and Sybase define this function differently.

◆ dbcount()

DBINT dbcount ( DBPROCESS dbproc)

Get count of rows processed.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
  • for insert/update/delete, count of rows affected.
  • for select, count of rows returned, after all rows have been fetched.
See also
DBCOUNT(), dbnextrow(), dbresults().
Here is the call graph for this function:

◆ dbdata()

BYTE* dbdata ( DBPROCESS dbproc,
int  column 
)

Get address of data in a regular result column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
pointer the data, or NULL if data are NULL, or if column is out of range.
See also
dbbind(), dbcollen(), dbcolname(), dbcoltype(), dbdatlen(), dbnumcols().
Here is the call graph for this function:

◆ dbdatecrack()

RETCODE dbdatecrack ( DBPROCESS dbproc,
DBDATEREC di,
DBDATETIME datetime 
)

Break a DBDATETIME value into useful pieces.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
dioutput: structure to contain the exploded parts of datetime.
datetimeinput: DBDATETIME to be converted.
Return values
SUCCEEDalways.
Remarks
The members of di have different names, depending on whether –with-msdblib was configured.

If DBPROCESS is NULL, dbdatecrack() uses the compiled in default value of MSDBLIB as of when libsybdb was compiled, irrespective of its value when the application is compiled. This can lead to incorrect results because Sybase and Microsoft use different ranges – [0,11] vs. [1,12] – for the month.

See also
dbconvert(), dbdata(), dbdatechar(), dbdatename(), dbdatepart(), tdsdbopen().

◆ dbdatlen()

DBINT dbdatlen ( DBPROCESS dbproc,
int  column 
)

Get size of current row's data in a regular result column.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
size of the data, in bytes.
See also
dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbnumcols().

◆ dberrhandle()

EHANDLEFUNC dberrhandle ( EHANDLEFUNC  handler)

Set an error handler, for messages from db-lib.

Parameters
handlerpointer to callback function that will handle errors. Pass NULL to restore the default handler.
Returns
address of prior handler, or NULL if none was previously installed.
See also
DBDEAD(), dbmsghandle().

◆ dbexit()

void dbexit ( void  )

Close server connections and free all related structures.


See also
dbclose(), dbinit(), dbopen().
Todo:
breaks if ctlib/dblib used in same process.
Here is the call graph for this function:

◆ dbfcmd()

RETCODE dbfcmd ( DBPROCESS dbproc,
const char *  fmt,
  ... 
)

printf-like way to form SQL to send to the server.


Forms a command string and writes to the command buffer with dbcmd().

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
fmt man vasprintf for details.
Return values
SUCCEEDsuccess.
FAILinsufficient memory, or dbcmd() failed.
See also
dbcmd(), dbfreebuf(), dbgetchar(), dbopen(), dbstrcpy(), dbstrlen().

◆ dbfreebuf()

void dbfreebuf ( DBPROCESS dbproc)

Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt().

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also
dbcmd(), dbfcmd(), dbgetchar(), dbsqlexec(), dbsqlsend(), dbsetopt(), dbstrcpy(), dbstrlen().
Here is the call graph for this function:

◆ dbgetchar()

char* dbgetchar ( DBPROCESS dbproc,
int  pos 
)

Get address of a position in the command buffer.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
posoffset within the command buffer, starting at 0.
Remarks
A bit overspecialized, this one.
See also
dbcmd(), dbfcmd(), dbfreebuf(), dbstrcpy(), dbstrlen(),
Here is the call graph for this function:

◆ dbgetmaxprocs()

int dbgetmaxprocs ( void  )

get maximum simultaneous connections db-lib will open to the server.

Returns
Current maximum.
See also
dbsetmaxprocs(), dbopen()
Here is the call graph for this function:

◆ dbgetpacket()

int dbgetpacket ( DBPROCESS dbproc)

Get TDS packet size for the connection.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
TDS packet size, in bytes.
See also
DBSETLPACKET()
Here is the call graph for this function:

◆ dbgetrow()

RETCODE dbgetrow ( DBPROCESS dbproc,
DBINT  row 
)

Read a row from the row buffer.

When row buffering is enabled (DBBUFFER option is on), the client can use dbgetrow() to re-read a row previously fetched with dbnextrow(). The effect is to move the row pointer – analogous to fseek() – back to row.
Calls to dbnextrow() read from row + 1 until the buffer is exhausted, at which point it resumes its normal behavior, except that as each row is fetched from the server, it is added to the row buffer (in addition to being returned to the client). When the buffer is filled, dbnextrow() returns FAIL until the buffer is at least partially emptied with dbclrbuf().

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
rowNth row to read, starting with 1.
Return values
REG_ROWreturned row is a regular row.
Returns
computeid when returned row is a compute row.
Return values
NO_MORE_ROWSno such row in the row buffer. Current row is unchanged.
FAILunsuccessful; row buffer may be full.
See also
dbaltbind(), dbbind(), dbclrbuf(), DBCURROW(), DBFIRSTROW(), DBLASTROW(), dbnextrow(), dbsetrow().

◆ dbgettime()

int dbgettime ( void  )

Get maximum seconds db-lib waits for a server response to query.


Return values
querytimeout limit, in seconds
See also
dberrhandle(), DBSETTIME(), dbsetlogintime(), dbsqlexec(), dbsqlok(), dbsqlsend().
Here is the call graph for this function:

◆ dbgetuserdata()

BYTE* dbgetuserdata ( DBPROCESS dbproc)

Get address of user-allocated data from a DBPROCESS.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
address of user-defined data that db-lib associated with dbproc when the client called dbsetuserdata().
Return values
undefined(probably NULL) dbsetuserdata() was not previously called.
See also
dbsetuserdata().
Here is the call graph for this function:

◆ dbinit()

RETCODE dbinit ( void  )

Initialize db-lib.


Remarks
Call this function before trying to use db-lib in any way.
Allocates various internal structures and reads locales.conf (if any) to determine the default date format.
Return values
SUCCEEDnormal.
FAILcannot allocate an array of TDS_MAX_CONN TDSSOCKET pointers.

◆ dbiscount()

BOOL dbiscount ( DBPROCESS dbproc)

Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature).

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
TRUE if the count returned by dbcount is real or FALSE if the count returned by dbcount is not real.
See also
DBCOUNT(), dbcount().
Here is the call graph for this function:

◆ dbisopt()

DBBOOL dbisopt ( DBPROCESS dbproc,
int  option,
const char  param[] 
)

Get value of an option.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
optionthe option
parama parameter to option.
See also
dbclropt(), dbsetopt().
Here is the call graph for this function:

◆ dblogin()

LOGINREC* dblogin ( void  )

Allocate a LOGINREC structure.


Remarks
A LOGINREC structure is passed to dbopen() to create a connection to the database. Does not communicate to the server; interacts strictly with library.
Return values
NULLthe LOGINREC cannot be allocated.
LOGINREC*to valid memory, otherwise.
Here is the call graph for this function:

◆ dbmorecmds()

RETCODE dbmorecmds ( DBPROCESS dbproc)

See if more commands are to be processed.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also
DBMORECMDS(). DBCMDROW(), dbresults(), DBROWS(), DBROWTYPE().
Here is the call graph for this function:

◆ dbmoretext()

RETCODE dbmoretext ( DBPROCESS dbproc,
DBINT  size,
const BYTE  text[] 
)

Send chunk of a text/image value to the server.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
sizecount of bytes to send.
texttextpointer, obtained from dbtxptr.
Return values
SUCCEEDalways.
See also
dbtxptr(), dbtxtimestamp(), dbwritetext().
Todo:
Check return value of called functions and return FAIL if appropriate.
Here is the call graph for this function:

◆ dbmsghandle()

MHANDLEFUNC dbmsghandle ( MHANDLEFUNC  handler)

Set a message handler, for messages from the server.

Parameters
handleraddress of the function that will process the messages.
See also
DBDEAD(), dberrhandle().

◆ dbname()

char* dbname ( DBPROCESS dbproc)

Get name of current database.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
current database name, as null-terminated ASCII string.
See also
dbchange(), dbuse().
Here is the call graph for this function:

◆ dbnullbind()

RETCODE dbnullbind ( DBPROCESS dbproc,
int  column,
DBINT *  indicator 
)

Tie a null-indicator to a regular result column.

When a row is fetched, the indicator variable tells the state of the column's data.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth column in the result set, starting with 1.
indicatoraddress of host variable.
Return values
SUCCEEDvariable accepted.
FAILindicator is NULL or column is out of range.
Remarks
Contents of indicator are set with dbnextrow(). Possible values are:
  • 0 column bound successfully
  • -1 column is NULL.
  • >0 true length of data, had column not been truncated due to insufficient space in the columns bound host variable .
See also
dbanullbind(), dbbind(), dbdata(), dbdatlen(), dbnextrow().
Here is the call graph for this function:

◆ dbnumalts()

int dbnumalts ( DBPROCESS dbproc,
int  computeid 
)

Get count of columns in a compute row.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
computeidof COMPUTE clause to which we're referring.
Returns
number of columns, else -1 if no such computeid.
See also
dbadata(), dbadlen(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumcols().
Here is the call graph for this function:

◆ dbnumcols()

int dbnumcols ( DBPROCESS dbproc)

Return number of regular columns in a result set.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also
dbcollen(), dbcolname(), dbnumalts().
Here is the call graph for this function:

◆ dbnumcompute()

int dbnumcompute ( DBPROCESS dbproc)

Get count of COMPUTE clauses for a result set.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
number of compute clauses for the current query, possibly zero.
See also
dbnumalts(), dbresults().
Here is the call graph for this function:

◆ dbprcollen()

DBINT dbprcollen ( DBPROCESS dbproc,
int  column 
)

Get size of a result column needed to print column.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Returns
size of the column in characters (not of data in any particular row). On error, -1.
See also
dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols().
Here is the call graph for this function:

◆ dbprhead()

void dbprhead ( DBPROCESS dbproc)

Print result set headings to stdout.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also

◆ dbprrow()

RETCODE dbprrow ( DBPROCESS dbproc)

Print a result set to stdout.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also
dbbind(), dbnextrow(), dbprhead(), dbresults(), dbspr1row(), dbsprhead(), dbsprline().

◆ dbprtype()

const char* dbprtype ( int  token)

Print a token value's name to a buffer.

Parameters
tokenserver SYB* value, e.g. SYBINT.
Returns
ASCII null-terminated string.
See also
dbaltop(), dbalttype(), dbcoltype(), dbrettype().
Here is the call graph for this function:

◆ dbreadtext()

STATUS dbreadtext ( DBPROCESS dbproc,
void *  buf,
DBINT  bufsize 
)

Fetch part of a text or image value from the server.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
bufoutput: buffer into which text will be placed.
bufsizesize of buf, in bytes.
Returns
  • >0 count of bytes placed in buf.
  • 0 end of row.
  • -1 error, no result set ready for dbproc.
  • NO_MORE_ROWS all rows read, no further data.
See also
dbmoretext(), dbnextrow(), dbwritetext().
Here is the call graph for this function:

◆ dbrecftos()

void dbrecftos ( const char  filename[])

Record to a file all SQL commands sent to the server.

Parameters
filenamename of file to write to.
Remarks
Files are named filename.n, where n is an integer, starting with 0, and incremented with each callto dbopen().
See also
dbopen(), TDSDUMP environment variable().
Here is the call graph for this function:

◆ dbresults()

RETCODE dbresults ( DBPROCESS dbproc)

Set up query results.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Return values
SUCCEEDSome results are available.
FAILquery was not processed successfully by the server
NO_MORE_RESULTSquery produced no results.
Remarks
Call dbresults() after calling dbsqlexec() or dbsqlok(), or dbrpcsend() returns SUCCEED. Unless one of them fails, dbresults will return either SUCCEED or NO_MORE_RESULTS.

The meaning of results is very specific and not very intuitive. Results are created by either

  • a SELECT statement

    • a stored procedure

    When dbresults returns SUCCEED, therefore, it indicates the server processed the query successfully and that one or more of these is present:

  • metadata – dbnumcols() returns 1 or more
  • data – dbnextrow() returns SUCCEED
  • return status – dbhasretstat() returns TRUE
  • output parameters – dbnumrets() returns 1 or more

If none of the above are present, dbresults() returns NO_MORE_RESULTS.

SUCCEED does not imply that DBROWS() will return TRUE or even that dbnumcols() will return nonzero.
A general algorithm for reading results will call dbresults() until it return NO_MORE_RESULTS (or FAIL).
An application should check for all the above kinds of results within the dbresults() loop.

See also
dbsqlexec(), dbsqlok(), dbrpcsend(), dbcancel(), DBROWS(), dbnextrow(), dbnumcols(), dbhasretstat(), dbretstatus(), dbnumrets()
Here is the call graph for this function:

◆ dbsafestr()

RETCODE dbsafestr ( DBPROCESS dbproc,
const char *  src,
DBINT  srclen,
char *  dest,
DBINT  destlen,
int  quotetype 
)

safely quotes character values in SQL text.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
srcinput string.
srclenlength of src in bytes, or -1 to indicate it's null-terminated.
destoutput: client-provided output buffer.
destlensize of dest in bytes, or -1 to indicate it's "big enough" and the data should be null-terminated.
quotetype
  • DBSINGLE Doubles all single quotes (').
  • DBDOUBLE Doubles all double quotes (").
  • DBBOTH Doubles all single and double quotes.
Return values
SUCCEEDeverything worked.
FAILno such quotetype, or insufficient room in dest.
See also
dbcmd(), dbfcmd().

◆ dbservcharset()

char* dbservcharset ( DBPROCESS dbproc)

Get syscharset name of the server character set.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
name of server's charset, as null-terminated ASCII string.
See also
dbcharsetconv(), dbgetcharset(), DBSETLCHARSET().
Here is the call graph for this function:

◆ dbsetifile()

void dbsetifile ( char *  filename)

set name and location of the interfaces file FreeTDS should use to look up a servername.

Does not affect lookups or location of freetds.conf.

Parameters
filenamename of interfaces
See also
dbopen()
Here is the call graph for this function:

◆ dbsetinterrupt()

void dbsetinterrupt ( DBPROCESS dbproc,
DB_DBCHKINTR_FUNC  chkintr,
DB_DBHNDLINTR_FUNC  hndlintr 
)

Set interrupt handler for db-lib to use while blocked against a read from the server.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
chkintr
hndlintr
See also
dbcancel(), dbgetuserdata(), dbsetuserdata(), dbsetbusy(), dbsetidle().

◆ dbsetlogintime()

RETCODE dbsetlogintime ( int  seconds)

Set maximum seconds db-lib waits for a server response to a login attempt.


Parameters
secondsNew limit for application.
Return values
SUCCEEDAlways.
See also
dberrhandle(), dbsettime()
Here is the call graph for this function:

◆ dbsetmaxprocs()

RETCODE dbsetmaxprocs ( int  maxprocs)

Set maximum simultaneous connections db-lib will open to the server.

Parameters
maxprocsLimit for process.
Return values
SUCCEEDAlways.
See also
dbgetmaxprocs(), dbopen()
Here is the call graph for this function:

◆ dbsetnull()

RETCODE dbsetnull ( DBPROCESS dbproc,
int  bindtype,
int  bindlen,
BYTE *  bindval 
)

Define substitution values to be used when binding null values.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
bindtypetype of binding to which the substitute value will apply.
bindlensize of the substitute value you are supplying, in bytes. Ignored except for CHARBIND and BINARYBIND.
bindvalpointer to a buffer containing the substitute value.
Return values
SUCCEEDquery was processed without errors.
FAILquery was not processed
See also
dbaltbind(), dbbind(), dbconvert(), dbnullbind().
Here is the call graph for this function:

◆ dbsetopt()

RETCODE dbsetopt ( DBPROCESS dbproc,
int  option,
const char *  char_param,
int  int_param 
)

Set db-lib or server option.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
optionoption to set.
char_paramvalue to set option to, if it wants a null-teminated ASCII string.
int_paramvalue to set option to, if it wants an integer value.
Return values
SUCCEEDeverything worked.
FAILno such option, or insufficient memory, or unimplemented.
Remarks
Many are unimplemented.
See also
dbclropt(), dbisopt().
Todo:
Implement more options.
Here is the call graph for this function:

◆ dbsetrow()

STATUS dbsetrow ( DBPROCESS dbproc,
DBINT  row 
)

Make a buffered row "current" without fetching it into bound variables.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Return values
MORE_ROWSrow found
NO_MORE_ROWSrow not found
FAILdbproc is dead or not enabled
See also
dbaltbind(), dbbind(), dbcanquery(), dbclrbuf(), dbgetrow(), dbnextrow(), dbprrow().
Here is the call graph for this function:

◆ dbsettime()

RETCODE dbsettime ( int  seconds)

Set maximum seconds db-lib waits for a server response to query.


Parameters
secondsNew limit for application.
Return values
SUCCEEDAlways.
See also
dberrhandle(), DBGETTIME(), dbsetlogintime(), dbsqlexec(), dbsqlok(), dbsqlsend().
Here is the call graph for this function:

◆ dbsetuserdata()

void dbsetuserdata ( DBPROCESS dbproc,
BYTE *  ptr 
)

Associate client-allocated (and defined) data with a DBPROCESS.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
ptraddress of client-defined data.
Remarks
ptr is the location of user data that db-lib will associate with dbproc. The client allocates the buffer addressed by ptr. db-lib never examines or uses the information; it just stashes the pointer for later retrieval by the application with dbgetuserdata().
See also
dbgetuserdata().
Here is the call graph for this function:

◆ dbsetversion()

RETCODE dbsetversion ( DBINT  version)

Specify a db-lib version level.

Parameters
versionanything, really.
Return values
SUCCEEDAlways.
Remarks
No effect on behavior of db-lib in FreeTDS.
See also
Here is the call graph for this function:

◆ dbspid()

int dbspid ( DBPROCESS dbproc)

Get server process ID for a DBPROCESS.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
"spid", the server's process ID.
See also
dbopen().
Here is the call graph for this function:

◆ dbspr1row()

RETCODE dbspr1row ( DBPROCESS dbproc,
char *  buffer,
DBINT  buf_len 
)

Print a regular result row to a buffer.


Fills a buffer with one data row, represented as a null-terminated ASCII string. Helpful for debugging.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
bufferoutput: Address of a buffer to hold ASCII null-terminated string.
buf_lensize of buffer, in bytes.
Return values
SUCCEEDon success.
FAILtrouble encountered.
See also
dbclropt(), dbisopt(), dbprhead(), dbprrow(), dbspr1rowlen(), dbsprhead(), dbsprline().

◆ dbspr1rowlen()

DBINT dbspr1rowlen ( DBPROCESS dbproc)

Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row().

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Returns
size of buffer requirement, in bytes.
Remarks
An esoteric function.
See also
dbprhead(), dbprrow(), dbspr1row(), dbsprhead(), dbsprline().

◆ dbsprhead()

RETCODE dbsprhead ( DBPROCESS dbproc,
char *  buffer,
DBINT  buf_len 
)

Print result set headings to a buffer.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
bufferoutput buffer
buf_lensize of buffer
Return values
SUCCEEDbuffer filled.
FAILinsufficient space in buffer, usually.
See also
dbprhead(), dbprrow(), dbsetopt(), dbspr1row(), dbspr1rowlen(), dbsprline().
Here is the call graph for this function:

◆ dbsprline()

RETCODE dbsprline ( DBPROCESS dbproc,
char *  buffer,
DBINT  buf_len,
DBCHAR  line_char 
)

Get formatted string for underlining dbsprhead() column names.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
bufferoutput buffer
buf_lensize of buffer
line_charcharacter to use to represent underlining.
Return values
SUCCEEDbuffer filled.
FAILinsufficient space in buffer, usually.
See also
dbprhead(), dbprrow(), dbspr1row(), dbspr1rowlen(), dbsprhead().

◆ dbsqlexec()

RETCODE dbsqlexec ( DBPROCESS dbproc)

send the SQL command to the server and wait for an answer.


Please be patient. This function waits for the server to respond. dbsqlexec is equivalent to dbsqlsend() followed by dbsqlok().

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Return values
SUCCEEDquery was processed without errors.
FAILwas returned by dbsqlsend() or dbsqlok().
See also
dbcmd(), dbfcmd(), dbnextrow(), dbresults(), dbretstatus(), dbsettime(), dbsqlok(), dbsqlsend()

◆ dbsqlok()

RETCODE dbsqlok ( DBPROCESS dbproc)

Wait for results of a query from the server.


Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Return values
SUCCEEDeverything worked, fetch results with dbnextresults().
FAILSQL syntax error, typically.
See also
dbcmd(), dbfcmd(), DBIORDESC(), DBIOWDESC(), dbmoretext(), dbnextrow(), dbpoll(), DBRBUF(), dbresults(), dbretstatus(), dbrpcsend(), dbsettime(), dbsqlexec(), dbsqlsend(), dbwritetext().

◆ dbsqlsend()

RETCODE dbsqlsend ( DBPROCESS dbproc)

Transmit the command buffer to the server.

Non-blocking, does not wait for a response.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
Return values
SUCCEEDSQL sent.
FAILprotocol problem, unless dbsqlsend() when it's not supposed to be (in which case a db-lib error message will be emitted).
See also
dbcmd(), dbfcmd(), DBIORDESC(), DBIOWDESC(), dbnextrow(), dbpoll(), dbresults(), dbsettime(), dbsqlexec(), dbsqlok().
Here is the call graph for this function:

◆ dbstrbuild()

RETCODE dbstrbuild ( DBPROCESS dbproc,
char *  charbuf,
int  bufsize,
char *  text,
char *  formats,
  ... 
)

Build a printable string from text containing placeholders for variables.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
charbufoutput: buffer that will contain the ASCII null-terminated string built by dbstrbuild().
bufsizesize of charbuf, in bytes.
textnull-terminated ASCII string, with placeholders for variables. A Placeholder is a three-byte string, made up of:
  • '' a percent sign
  • 0-9 an integer (designates the argument number to use, starting with 1.)
  • '!' an exclamation point
formatsnull-terminated ASCII sprintf-style string. Has one format specifier for each placeholder in text.
Remarks
Following formats are the arguments, the values to substitute for the placeholders.
See also
dbconvert(), dbdatename(), dbdatepart().
Here is the call graph for this function:

◆ dbstrcpy()

RETCODE dbstrcpy ( DBPROCESS dbproc,
int  start,
int  numbytes,
char *  dest 
)

Get a copy of a chunk of the command buffer.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
startposition in the command buffer to start copying from, starting from 0.
If start is past the end of the command buffer, dbstrcpy() inserts a null terminator at dest[0].
numbytesnumber of bytes to copy.
  • If -1, dbstrcpy() copies the whole command buffer.
  • If 0 dbstrcpy() writes a NULL to dest[0].
  • If the command buffer contains fewer than numbytes (taking start into account) dbstrcpy() copies the rest of it.
destoutput: the buffer to write to. Make sure it's big enough.
Return values
SUCCEEDthe inputs were valid and dest was affected.
FAILstart < 0 or numbytes < -1.
See also
dbcmd(), dbfcmd(), dbfreebuf(), dbgetchar(), dbstrlen().
Here is the call graph for this function:

◆ dbstrlen()

int dbstrlen ( DBPROCESS dbproc)

Get size of the command buffer, in bytes.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
See also
dbcmd(), dbfcmd(), dbfreebuf(), dbgetchar(), dbstrcpy().
Here is the call graph for this function:

◆ dbtablecolinfo()

RETCODE dbtablecolinfo ( DBPROCESS dbproc,
DBINT  column,
DBCOL pdbcol 
)

describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
pdbcoladdress of structure to be populated by this function.
Returns
SUCCEED or FAIL.
See also
dbcolinfo().
Here is the call graph for this function:

◆ dbtxptr()

DBBINARY* dbtxptr ( DBPROCESS dbproc,
int  column 
)

Get text pointer for a column in the current row.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnnumber of the column in the SELECT statement, starting at 1.
Returns
text pointer for column, may be NULL.
See also
dbtxtimestamp(), dbwritetext().
Here is the call graph for this function:

◆ dbtxtimestamp()

DBBINARY* dbtxtimestamp ( DBPROCESS dbproc,
int  column 
)

Get text timestamp for a column in the current row.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnnumber of the column in the SELECT statement, starting at 1.
Returns
timestamp for column, may be NULL.
See also
dbtxptr(), dbwritetext().
Here is the call graph for this function:

◆ dbuse()

RETCODE dbuse ( DBPROCESS dbproc,
const char *  name 
)

Change current database.

Analagous to the unix command cd, dbuse() makes name the default database. Waits for an answer from the server.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
namedatabase to use.
Return values
SUCCEEDquery was processed without errors.
FAILquery was not processed
See also
dbchange(), dbname().
Here is the call graph for this function:

◆ dbvarylen()

DBINT dbvarylen ( DBPROCESS dbproc,
int  column 
)

Determine whether a column can vary in size.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
columnNth in the result set, starting from 1.
Return values
TRUEdatatype of column can vary in size, or is nullable.
FALSEdatatype of column is fixed and is not nullable.
See also
dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(), dbprtype().
Here is the call graph for this function:

◆ dbversion()

const char* dbversion ( void  )

See which version of db-lib is in use.

Returns
null-terminated ASCII string representing the version of db-lib.
Remarks
FreeTDS returns the CVS version string of dblib.c.
See also
Here is the call graph for this function:

◆ dbwillconvert()

DBBOOL dbwillconvert ( int  srctype,
int  desttype 
)

Test whether or not a datatype can be converted to another datatype.

Parameters
srctypetype converting from
desttypetype converting to
Remarks
dbwillconvert() lies sometimes. Some datatypes should be convertible but aren't yet in our implementation.
Legal unimplemented conversions return TRUE.
Return values
TRUEconvertible, or should be.
FAILnot convertible.
See also
dbaltbind(), dbbind(), dbconvert(), dbconvert_ps(), src/dblib/unittests/convert().c().
Here is the call graph for this function:

◆ dbwritetext()

RETCODE dbwritetext ( DBPROCESS dbproc,
char *  objname,
DBBINARY *  textptr,
DBTINYINT  textptrlen,
DBBINARY *  timestamp,
DBBOOL  log,
DBINT  size,
BYTE *  text 
)

Send text or image data to the server.

Parameters
dbproccontains all information needed by db-lib to manage communications with the server.
objnametable name
textptrtext pointer to be modified, obtained from dbtxptr().
textptrlenIgnored. Supposed to be DBTXPLEN.
timestamptext timestamp to be modified, obtained from dbtxtimestamp() or dbtxtsnewval(), may be NULL.
logTRUE if the operation is to be recorded in the transaction log.
sizeoverall size of the data (in total, not just for this call), in bytes. A guideline, must not overstate the case.
textthe chunk of data to write.
Return values
SUCCEEDeverything worked.
FAILnot sent, possibly because timestamp is invalid or was changed in the database since it was fetched.
See also
dbmoretext(), dbtxptr(), dbtxtimestamp(), dbwritetext(), dbtxtsput().
Here is the call graph for this function:
freetds-1.3.6/doc/reference/a00548_ga01404b179a251c249aecfdae72ec6ca4_cgraph.dot000644 025423 025423 00000001220 14162303416 027244 0ustar00fredianofrediano000000 000000 digraph "dbclrbuf" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbclrbuf",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Clear n rows from the row buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga0984798bb806f7451a53bffa7e2c430f_cgraph.dot000644 025423 025423 00000001213 14162303416 027063 0ustar00fredianofrediano000000 000000 digraph "dblogin" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dblogin",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Allocate a LOGINREC structure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga0fcfcf6846442dac9dd5584d270ec72a_cgraph.dot000644 025423 025423 00000001270 14162303416 027302 0ustar00fredianofrediano000000 000000 digraph "dbfreebuf" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbfreebuf",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Erase the command buffer, in case DBNOAUTOFREE was set with dbsetopt()."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga13caa07ec45cd6f64e9197d29e3cfe5e_cgraph.dot000644 025423 025423 00000001230 14162303417 027363 0ustar00fredianofrediano000000 000000 digraph "dbstrlen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbstrlen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get size of the command buffer, in bytes."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/menu.js000644 025423 025423 00000006226 14162303412 020612 0ustar00fredianofrediano000000 000000 /* @licstart The following is the entire license notice for the JavaScript code in this file. The MIT License (MIT) Copyright (C) 1997-2020 by Dimitri van Heesch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @licend The above is the entire license notice for the JavaScript code in this file */ function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { function makeTree(data,relPath) { var result=''; if ('children' in data) { result+=''; } return result; } $('#main-nav').append(makeTree(menudata,relPath)); $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); if (searchEnabled) { if (serverSide) { $('#main-menu').append('
  • '); } else { $('#main-menu').append('
  • '); } } $('#main-menu').smartmenus(); } /* @license-end */ freetds-1.3.6/doc/reference/a00549.dot000644 025423 025423 00000001161 14162303417 020640 0ustar00fredianofrediano000000 000000 digraph "Remote Procedure functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00547.html",tooltip="Functions callable by db-lib client programs."]; Node1 [label="Remote Procedure functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions used with stored procedures."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00548_ga223a6d333f95e726b0b42ec19a076731_cgraph.dot000644 025423 025423 00000001221 14162303417 026677 0ustar00fredianofrediano000000 000000 digraph "dbspid" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbspid",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get server process ID for a DBPROCESS."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga32eb72f6fb3edb130e59fb3dd0766e7e_cgraph.dot000644 025423 025423 00000001164 14162303416 027361 0ustar00fredianofrediano000000 000000 digraph "dbconvert" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbconvert",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="cf."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga39302e8efbb476ba01cff109ffb3661e_cgraph.dot000644 025423 025423 00000001251 14162303417 027270 0ustar00fredianofrediano000000 000000 digraph "dbservcharset" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbservcharset",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get syscharset name of the server character set."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga399512ec78c15ce3db79ea88ef3b1293_cgraph.dot000644 025423 025423 00000001260 14162303417 027155 0ustar00fredianofrediano000000 000000 digraph "dbsetnull" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetnull",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Define substitution values to be used when binding null values."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga3a96d0188e5e0eb9eea661b3685fdcc3_cgraph.dot000644 025423 025423 00000001253 14162303416 027305 0ustar00fredianofrediano000000 000000 digraph "dbcolsource" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcolsource",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get base database column name for a result set column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga3c33e72c41b40e08dbcfdfa0d16bc399_cgraph.dot000644 025423 025423 00000001271 14162303416 027337 0ustar00fredianofrediano000000 000000 digraph "dbcoltypeinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcoltypeinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get precision and scale information for a regular result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga466690ceda8682382223d98a6ffb63bd_cgraph.dot000644 025423 025423 00000001233 14162303416 027072 0ustar00fredianofrediano000000 000000 digraph "dbacolname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbacolname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return name of a computed result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga4e26d949be2c3bf71b1a33c75b11d931_cgraph.dot000644 025423 025423 00000001740 14162303417 027125 0ustar00fredianofrediano000000 000000 digraph "dbresults" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbresults",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set up query results."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="_dbresults",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00548.html#gaf1879b85e8238c015b9648d077665285",tooltip=" "]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00548_ga548153eb2eae76c48aa9d4b72258dc1c_cgraph.dot000644 025423 025423 00000001233 14162303417 027214 0ustar00fredianofrediano000000 000000 digraph "dbwritetext" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbwritetext",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send text or image data to the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga559e24ba70d0d96c3469eb6ab8f74e05_cgraph.dot000644 025423 025423 00000001273 14162303416 027150 0ustar00fredianofrediano000000 000000 digraph "dbcanquery" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcanquery",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Cancel the query currently being retrieved, discarding all pending rows."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga57c856964a9a0b4cc43f5192647c51e7_cgraph.dot000644 025423 025423 00000001235 14162303417 026734 0ustar00fredianofrediano000000 000000 digraph "dbvarylen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbvarylen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Determine whether a column can vary in size."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga57e4098b153a030f0be02bcd98e08ba2_cgraph.dot000644 025423 025423 00000001236 14162303417 027115 0ustar00fredianofrediano000000 000000 digraph "dbtxptr" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbtxptr",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get text pointer for a column in the current row."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga5ea23272124fff03b8d87538c1ec3ee5_cgraph.dot000644 025423 025423 00000001220 14162303416 027127 0ustar00fredianofrediano000000 000000 digraph "dbcancel" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcancel",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Cancel the current command batch."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga5f1281c07dde5a6d28e60ef62c501d1d_cgraph.dot000644 025423 025423 00000001305 14162303417 027202 0ustar00fredianofrediano000000 000000 digraph "dbsetlogintime" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetlogintime",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set maximum seconds db-lib waits for a server response to a login attempt."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga636e6f1b64743f3cf22158a56eef371f_cgraph.dot000644 025423 025423 00000001241 14162303416 027064 0ustar00fredianofrediano000000 000000 digraph "dbcoltype" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcoltype",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get the datatype of a regular result set column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga663350909fec3a1d152316c45a65e708_cgraph.dot000644 025423 025423 00000001313 14162303417 026627 0ustar00fredianofrediano000000 000000 digraph "dbsetifile" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetifile",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="set name and location of the interfaces file FreeTDS should use to look up a servername."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga666726c86108342b1c1f27eecf68e13c_cgraph.dot000644 025423 025423 00000001227 14162303417 027004 0ustar00fredianofrediano000000 000000 digraph "dbversion" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbversion",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="See which version of db-lib is in use."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga66ea891910f0a357cc78107d6ab7d962_cgraph.dot000644 025423 025423 00000001201 14162303417 026777 0ustar00fredianofrediano000000 000000 digraph "dbuse" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbuse",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Change current database."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga67934deac3bebbf8238eff8c0559389a_cgraph.dot000644 025423 025423 00000001227 14162303417 027324 0ustar00fredianofrediano000000 000000 digraph "dbnumalts" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbnumalts",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get count of columns in a compute row."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga6ba2a7f18cb76d24776e45fd71141494_cgraph.dot000644 025423 025423 00000001322 14162303416 027001 0ustar00fredianofrediano000000 000000 digraph "dbiscount" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbiscount",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature)."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga6ccffbb3f0cfb10883ad349f1e47c50e_cgraph.dot000644 025423 025423 00000001261 14162303416 027427 0ustar00fredianofrediano000000 000000 digraph "dbgettime" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbgettime",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get maximum seconds db-lib waits for a server response to query."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga6f13381522a1fa0b6ce2c15378088cdd_cgraph.dot000644 025423 025423 00000001242 14162303416 027037 0ustar00fredianofrediano000000 000000 digraph "dbmoretext" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmoretext",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send chunk of a text/image value to the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga85dcc40c3615f94be96b09b2ec043533_cgraph.dot000644 025423 025423 00000001243 14162303417 027052 0ustar00fredianofrediano000000 000000 digraph "dbnullbind" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbnullbind",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Tie a null-indicator to a regular result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga873bc0f4663165e711655ade1dfae795_cgraph.dot000644 025423 025423 00000001225 14162303416 027064 0ustar00fredianofrediano000000 000000 digraph "dbbind" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbbind",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Tie a host variable to a resultset column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga87b39d9863316b4ba85654b0885d53a0_cgraph.dot000644 025423 025423 00000001212 14162303416 026644 0ustar00fredianofrediano000000 000000 digraph "dbcmd" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcmd",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Append SQL to the command buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga89fc5589b4bf41932324d2cfc6ad6433_cgraph.dot000644 025423 025423 00000001223 14162303416 027064 0ustar00fredianofrediano000000 000000 digraph "dbcollen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcollen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get size of a regular result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga8cbc761b1266bd947783d843aeeec264_cgraph.dot000644 025423 025423 00000001246 14162303416 027152 0ustar00fredianofrediano000000 000000 digraph "dbchange" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbchange",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="See if a command caused the current database to change."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga939c2a2e67b9992c787e2cec5b6cc1a7_cgraph.dot000644 025423 025423 00000001245 14162303416 027241 0ustar00fredianofrediano000000 000000 digraph "dbanullbind" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbanullbind",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Tie a null-indicator to a compute result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga93ee3c8ca34a08588f88784898fd69e0_cgraph.dot000644 025423 025423 00000001177 14162303416 027055 0ustar00fredianofrediano000000 000000 digraph "dbclropt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbclropt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reset an option."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga9433bc200c0978569964354451d9b64e_cgraph.dot000644 025423 025423 00000001211 14162303416 026505 0ustar00fredianofrediano000000 000000 digraph "dbcount" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcount",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get count of rows processed."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga947837a5c8fd99898c043435945b668c_cgraph.dot000644 025423 025423 00000001233 14162303416 026626 0ustar00fredianofrediano000000 000000 digraph "dbaltop" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbaltop",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get aggregation operator for a compute column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga9804fc70ae6ed35c92cd75d410dad570_cgraph.dot000644 025423 025423 00000001340 14162303417 027212 0ustar00fredianofrediano000000 000000 digraph "dbtablecolinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbtablecolinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo)"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga9a35c8d3cd0e35c10555baf8f6a01e93_cgraph.dot000644 025423 025423 00000001222 14162303416 027202 0ustar00fredianofrediano000000 000000 digraph "dbaltlen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbaltlen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get size of data in compute column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_ga9d660d278f3f58871b4086c0e175f4c6_cgraph.dot000644 025423 025423 00000001213 14162303417 026736 0ustar00fredianofrediano000000 000000 digraph "dbsetopt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetopt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set db-lib or server option."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaa5714a91d7c14365fa1e5b164bb2b0b6_cgraph.dot000644 025423 025423 00000001255 14162303416 027112 0ustar00fredianofrediano000000 000000 digraph "dbgetuserdata" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbgetuserdata",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get address of user-allocated data from a DBPROCESS."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaa85171e020dc606f2bd3395ad1d3ab4f_cgraph.dot000644 025423 025423 00000001223 14162303416 027165 0ustar00fredianofrediano000000 000000 digraph "dbalttype" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbalttype",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get datatype for a compute column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaaa4839a9c88e5b90f33bd2407fcbc43e_cgraph.dot000644 025423 025423 00000001227 14162303417 027302 0ustar00fredianofrediano000000 000000 digraph "dbsprhead" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsprhead",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Print result set headings to a buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaaf8349999c16b3c36caf5947747a2915_cgraph.dot000644 025423 025423 00000001275 14162303417 026754 0ustar00fredianofrediano000000 000000 digraph "dbwillconvert" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbwillconvert",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Test whether or not a datatype can be converted to another datatype."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gab185982ffe0b85b8fd19747bd1f433fe_cgraph.dot000644 025423 025423 00000001210 14162303416 027231 0ustar00fredianofrediano000000 000000 digraph "dbname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get name of current database."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gab33d2f4fd44f50e55b6c71902db4fdae_cgraph.dot000644 025423 025423 00000001250 14162303416 027344 0ustar00fredianofrediano000000 000000 digraph "dbcolutype" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcolutype",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get user-defined datatype of a regular result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gab5fe0cd5f24d4fd33670111035a4fbed_cgraph.dot000644 025423 025423 00000001274 14162303417 027257 0ustar00fredianofrediano000000 000000 digraph "dbstrbuild" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbstrbuild",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Build a printable string from text containing placeholders for variables."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gab9aa181fb3081ffb314340cbd71e434d_cgraph.dot000644 025423 025423 00000001226 14162303417 027171 0ustar00fredianofrediano000000 000000 digraph "dbsetversion" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetversion",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Specify a db-lib version level."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gabaf9aa756f7cb8bbec80d1c7201c6238_cgraph.dot000644 025423 025423 00000001234 14162303416 027346 0ustar00fredianofrediano000000 000000 digraph "dbgetpacket" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbgetpacket",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get TDS packet size for the connection."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gabb14ad9f268b92a8d63fa506098b24dd_cgraph.dot000644 025423 025423 00000001246 14162303417 027221 0ustar00fredianofrediano000000 000000 digraph "dbrecftos" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbrecftos",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Record to a file all SQL commands sent to the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gabcc14a1ca58b65bc46cce6c81c45218c_cgraph.dot000644 025423 025423 00000001220 14162303416 027330 0ustar00fredianofrediano000000 000000 digraph "dbadata" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbadata",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get address of compute column data."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gabea9c70d02bf3e46bbb1d759915cb91e_cgraph.dot000644 025423 025423 00000001270 14162303417 027351 0ustar00fredianofrediano000000 000000 digraph "dbsetuserdata" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetuserdata",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Associate client-allocated (and defined) data with a DBPROCESS."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gac0cb0584f6500d61a2ac95a891da73eb_cgraph.dot000644 025423 025423 00000001246 14162303417 027201 0ustar00fredianofrediano000000 000000 digraph "dbprcollen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbprcollen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get size of a result column needed to print column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gac25ae21ca19777ffab1c013bd6049ebf_cgraph.dot000644 025423 025423 00000001226 14162303417 027337 0ustar00fredianofrediano000000 000000 digraph "dbprtype" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbprtype",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Print a token value's name to a buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gac3ba9f53cc77e4dde8f48335ed94ac19_cgraph.dot000644 025423 025423 00000001234 14162303416 027375 0ustar00fredianofrediano000000 000000 digraph "dbmorecmds" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmorecmds",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="See if more commands are to be processed."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gac3eb8cb53f50998403ea9aebc6263df9_cgraph.dot000644 025423 025423 00000001204 14162303416 027303 0ustar00fredianofrediano000000 000000 digraph "dbisopt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbisopt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get value of an option."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gac3f11142ec7ff25b1f8972af10fe9454_cgraph.dot000644 025423 025423 00000001254 14162303417 027140 0ustar00fredianofrediano000000 000000 digraph "dbtxtimestamp" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbtxtimestamp",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get text timestamp for a column in the current row."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gac554d2cb2da0c9f9fd3d4867998edcc4_cgraph.dot000644 025423 025423 00000001245 14162303417 027402 0ustar00fredianofrediano000000 000000 digraph "dbnumcompute" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbnumcompute",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get count of COMPUTE clauses for a result set."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gac980139b9cea03cf93e373d425991481_cgraph.dot000644 025423 025423 00000001233 14162303417 026730 0ustar00fredianofrediano000000 000000 digraph "dbsqlsend" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsqlsend",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Transmit the command buffer to the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gad0044401c8c83205583f93a4764f2d8b_cgraph.dot000644 025423 025423 00000001244 14162303416 026632 0ustar00fredianofrediano000000 000000 digraph "dbexit" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbexit",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Close server connections and free all related structures."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gad06f5deddac18604dfa858b2580e232f_cgraph.dot000644 025423 025423 00000001230 14162303416 027266 0ustar00fredianofrediano000000 000000 digraph "dbcolname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcolname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return name of a regular result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gad10c9fd75a86c7a0ac375937df0e90a6_cgraph.dot000644 025423 025423 00000001225 14162303416 027220 0ustar00fredianofrediano000000 000000 digraph "dbaltcolid" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbaltcolid",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get column ID of a compute column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gada4b41f34542a87f0cd87e78e56d18bb_cgraph.dot000644 025423 025423 00000001261 14162303417 027224 0ustar00fredianofrediano000000 000000 digraph "dbsettime" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsettime",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set maximum seconds db-lib waits for a server response to query."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gadaa9482a082aa3fe52231e17749c2993_cgraph.dot000644 025423 025423 00000001242 14162303417 026772 0ustar00fredianofrediano000000 000000 digraph "dbnumcols" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbnumcols",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return number of regular columns in a result set."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gadb34c5c2aae50ac9f2a26d8984136997_cgraph.dot000644 025423 025423 00000001275 14162303416 027147 0ustar00fredianofrediano000000 000000 digraph "dbgetmaxprocs" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbgetmaxprocs",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="get maximum simultaneous connections db-lib will open to the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gadd5685565c8c6c86079e17b8a73b324c_cgraph.dot000644 025423 025423 00000001247 14162303417 027024 0ustar00fredianofrediano000000 000000 digraph "dbreadtext" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbreadtext",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Fetch part of a text or image value from the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gae658a0cd5270f3bd6f22de17b2cb2e64_cgraph.dot000644 025423 025423 00000001214 14162303416 027260 0ustar00fredianofrediano000000 000000 digraph "dbbylist" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbbylist",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get bylist for a compute row."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaeb3d621e4f6846bb228b0a596d8758c0_cgraph.dot000644 025423 025423 00000001270 14162303417 027063 0ustar00fredianofrediano000000 000000 digraph "dbsetrow" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetrow",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Make a buffered row \"current\" without fetching it into bound variables."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaee60c306a22383805a4b9caa647a1e16_cgraph.dot000644 025423 025423 00000001232 14162303416 027030 0ustar00fredianofrediano000000 000000 digraph "dbdata" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbdata",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get address of data in a regular result column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaef740b394b44eb33925c2718f7b30d69_cgraph.dot000644 025423 025423 00000001254 14162303416 027005 0ustar00fredianofrediano000000 000000 digraph "dbclose" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbclose",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Close a connection to the server and free associated resources."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaf130b12e9e58b1bfd4a6685e33f5b3cd_cgraph.dot000644 025423 025423 00000001233 14162303417 027270 0ustar00fredianofrediano000000 000000 digraph "dbstrcpy" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbstrcpy",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get a copy of a chunk of the command buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaf1879b85e8238c015b9648d077665285_cgraph.dot000644 025423 025423 00000001164 14162303416 026534 0ustar00fredianofrediano000000 000000 digraph "_dbresults" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_dbresults",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaf1879b85e8238c015b9648d077665285_icgraph.dot000644 025423 025423 00000001162 14162303416 026703 0ustar00fredianofrediano000000 000000 digraph "_dbresults" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="_dbresults",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="dbresults",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00548.html#ga4e26d949be2c3bf71b1a33c75b11d931",tooltip="Set up query results."]; } freetds-1.3.6/doc/reference/a00548_gaf1c00d83dfa88dc99a3fb449c49660ea_cgraph.dot000644 025423 025423 00000001241 14162303416 027304 0ustar00fredianofrediano000000 000000 digraph "dbaltutype" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbaltutype",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get user-defined datatype of a compute column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaf2ca0e63f800b3839684c894ff651dd4_cgraph.dot000644 025423 025423 00000001275 14162303417 027077 0ustar00fredianofrediano000000 000000 digraph "dbsetmaxprocs" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetmaxprocs",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set maximum simultaneous connections db-lib will open to the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gaf917cf746c954a5d1b718afe3c4d1940_cgraph.dot000644 025423 025423 00000001241 14162303416 027143 0ustar00fredianofrediano000000 000000 digraph "dbgetchar" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbgetchar",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get address of a position in the command buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00548_gafefd17e15b22adda84366c817178dd7d_cgraph.dot000644 025423 025423 00000001235 14162303416 027304 0ustar00fredianofrediano000000 000000 digraph "dbaltbind" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbaltbind",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Bind a compute column to a program variable."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549.html000644 025423 025423 00000106555 14162303417 021033 0ustar00fredianofrediano000000 000000 FreeTDS API: Remote Procedure functions
    FreeTDS API
    Remote Procedure functions

    Functions used with stored procedures. More...

    Collaboration diagram for Remote Procedure functions:

    Functions

    DBBOOL dbhasretstat (DBPROCESS *dbproc)
     Determine if query generated a return status number. More...
     
    int dbnumrets (DBPROCESS *dbproc)
     Get count of output parameters filled by a stored procedure. More...
     
    BYTE * dbretdata (DBPROCESS *dbproc, int retnum)
     Get value of an output parameter filled by a stored procedure. More...
     
    int dbretlen (DBPROCESS *dbproc, int retnum)
     Get size of an output parameter filled by a stored procedure. More...
     
    char * dbretname (DBPROCESS *dbproc, int retnum)
     Get name of an output parameter filled by a stored procedure. More...
     
    DBINT dbretstatus (DBPROCESS *dbproc)
     Fetch status value returned by query or remote procedure call. More...
     
    int dbrettype (DBPROCESS *dbproc, int retnum)
     Get datatype of a stored procedure's return parameter. More...
     
    RETCODE dbrpcinit (DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options)
     Initialize a remote procedure call. More...
     
    RETCODE dbrpcparam (DBPROCESS *dbproc, const char paramname[], BYTE status, int db_type, DBINT maxlen, DBINT datalen, BYTE *value)
     Add a parameter to a remote procedure call. More...
     
    RETCODE dbrpcsend (DBPROCESS *dbproc)
     Execute the procedure and free associated memory. More...
     

    Detailed Description

    Functions used with stored procedures.


    Especially useful for OUTPUT parameters, because modern Microsoft servers do not return output parameter data to the client unless the procedure was invoked with dbrpcsend().

    Function Documentation

    ◆ dbhasretstat()

    DBBOOL dbhasretstat ( DBPROCESS dbproc)

    Determine if query generated a return status number.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Return values
    TRUEfetch return status with dbretstatus().
    FALSEno return status.
    See also
    dbnextrow(), dbresults(), dbretdata(), dbretstatus(), dbrpcinit(), dbrpcparam(), dbrpcsend().
    Here is the call graph for this function:

    ◆ dbnumrets()

    int dbnumrets ( DBPROCESS dbproc)

    Get count of output parameters filled by a stored procedure.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Returns
    How many, possibly zero.
    Remarks
    This name sounds funny.
    See also
    Here is the call graph for this function:

    ◆ dbretdata()

    BYTE* dbretdata ( DBPROCESS dbproc,
    int  retnum 
    )

    Get value of an output parameter filled by a stored procedure.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    retnumNth parameter between 1 and the return value from dbnumrets().
    Returns
    Address of a return parameter value, or NULL if no such retnum.
    See also
    dbnextrow(), dbnumrets(), dbresults(), dbretlen(), dbretname(), dbrettype(), dbrpcinit(), dbrpcparam().
    Todo:
    Handle blobs.
    Here is the call graph for this function:

    ◆ dbretlen()

    int dbretlen ( DBPROCESS dbproc,
    int  retnum 
    )

    Get size of an output parameter filled by a stored procedure.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    retnumNth parameter between 1 and the return value from dbnumrets().
    Returns
    Size of a return parameter value, or NULL if no such retnum.
    See also
    dbnextrow(), dbnumrets(), dbresults(), dbretdata(), dbretname(), dbrettype(), dbrpcinit(), dbrpcparam().
    Here is the call graph for this function:

    ◆ dbretname()

    char* dbretname ( DBPROCESS dbproc,
    int  retnum 
    )

    Get name of an output parameter filled by a stored procedure.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    retnumNth parameter between 1 and the return value from dbnumrets().
    Returns
    ASCII null-terminated string, NULL if no such retnum.
    See also
    dbnextrow(), dbnumrets(), dbresults(), dbretdata(), dbretlen(), dbrettype(), dbrpcinit(), dbrpcparam().
    Here is the call graph for this function:

    ◆ dbretstatus()

    DBINT dbretstatus ( DBPROCESS dbproc)

    Fetch status value returned by query or remote procedure call.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Returns
    return value
    See also
    dbhasretstat(), dbnextrow(), dbresults(), dbretdata(), dbrpcinit(), dbrpcparam(), dbrpcsend().
    Here is the call graph for this function:

    ◆ dbrettype()

    int dbrettype ( DBPROCESS dbproc,
    int  retnum 
    )

    Get datatype of a stored procedure's return parameter.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    retnumNth return parameter, between 1 and dbnumrets().
    Returns
    SYB* datatype token, or -1 if retnum is out of range.
    See also
    dbnextrow(), dbnumrets(), dbprtype(), dbresults(), dbretdata(), dbretlen(), dbretname(), dbrpcinit(), dbrpcparam().
    Here is the call graph for this function:

    ◆ dbrpcinit()

    RETCODE dbrpcinit ( DBPROCESS dbproc,
    const char  rpcname[],
    DBSMALLINT  options 
    )

    Initialize a remote procedure call.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    rpcnamename of the stored procedure to be run.
    optionsOnly supported option would be DBRPCRECOMPILE, which causes the stored procedure to be recompiled before executing.
    Remarks
    The RPC functions are the only way to get back OUTPUT parameter data with db-lib from modern Microsoft servers.
    Return values
    SUCCEEDnormal.
    FAILon error
    See also
    dbrpcparam(), dbrpcsend()
    Here is the call graph for this function:

    ◆ dbrpcparam()

    RETCODE dbrpcparam ( DBPROCESS dbproc,
    const char  paramname[],
    BYTE  status,
    int  db_type,
    DBINT  maxlen,
    DBINT  datalen,
    BYTE *  value 
    )

    Add a parameter to a remote procedure call.

    Call between dbrpcinit() and dbrpcsend()

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    paramnameliteral name of the parameter, according to the stored procedure (starts with '@'). Optional.
    If not used, parameters will be passed in order instead of by name.
    statusmust be DBRPCRETURN, if this parameter is a return parameter, else 0.
    typedatatype of the value parameter e.g., SYBINT4, SYBCHAR.
    maxlenMaximum output size of the parameter's value to be returned by the stored procedure, usually the size of your host variable. Fixed-length datatypes take -1 (NULL or not).
    Non-OUTPUT parameters also use -1.
    Use 0 to send a NULL value for a variable length datatype.
    datalenFor variable-length datatypes, the byte size of the data to be sent, exclusive of any null terminator. For fixed-length datatypes use -1. To send a NULL value, use 0.
    valueAddress of your host variable.
    Return values
    SUCCEEDnormal.
    FAILon error
    See also
    dbrpcinit(), dbrpcsend()
    Here is the call graph for this function:

    ◆ dbrpcsend()

    RETCODE dbrpcsend ( DBPROCESS dbproc)

    Execute the procedure and free associated memory.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Return values
    SUCCEEDnormal.
    FAILon error
    See also
    dbrpcinit(), dbrpcparam()
    Here is the call graph for this function:
    freetds-1.3.6/doc/reference/a00550.dot000644 025423 025423 00000001562 14162303417 020635 0ustar00fredianofrediano000000 000000 digraph "Bulk copy functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00547.html",tooltip="Functions callable by db-lib client programs."]; Node3 [label="Internal bcp functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00551.html",tooltip="Static functions internal to the bcp library."]; Node1 [label="Bulk copy functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions to bulk-copy (a/k/a bcp) data to/from the database."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; Node1->Node3 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00550.html000644 025423 025423 00000203344 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Bulk copy functions
    FreeTDS API
    Bulk copy functions

    Functions to bulk-copy (a/k/a bcp) data to/from the database. More...

    Collaboration diagram for Bulk copy functions:

    Modules

     Internal bcp functions
     Static functions internal to the bcp library.
     

    Functions

    DBINT bcp_batch (DBPROCESS *dbproc)
     Commit a set of rows to the table. More...
     
    RETCODE bcp_bind (DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int db_vartype, int table_column)
     Bind a program host variable to a database column. More...
     
    RETCODE bcp_colfmt (DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int table_colnum)
     Specify the format of a datafile prior to writing to a table. More...
     
    RETCODE bcp_colfmt_ps (DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int table_colnum, DBTYPEINFO *typeinfo)
     Specify the format of a host file for bulk copy purposes, with precision and scale support for numeric and decimal columns. More...
     
    RETCODE bcp_collen (DBPROCESS *dbproc, DBINT varlen, int table_column)
     Set the length of a host variable to be written to a table. More...
     
    RETCODE bcp_colptr (DBPROCESS *dbproc, BYTE *colptr, int table_column)
     Override bcp_bind() by pointing to a different host variable. More...
     
    RETCODE bcp_columns (DBPROCESS *dbproc, int host_colcount)
     Indicate how many columns are to be found in the datafile. More...
     
    RETCODE bcp_control (DBPROCESS *dbproc, int field, DBINT value)
     Set BCP options for uploading a datafile. More...
     
    DBINT bcp_done (DBPROCESS *dbproc)
     Conclude the transfer of data from program variables. More...
     
    RETCODE bcp_exec (DBPROCESS *dbproc, DBINT *rows_copied)
     Write a datafile to a table. More...
     
    DBBOOL bcp_getl (LOGINREC *login)
     See if BCP_SETL() was used to set the LOGINREC for BCP work. More...
     
    RETCODE bcp_init (DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
     Prepare for bulk copy operation on a table. More...
     
    RETCODE bcp_options (DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
     Set "hints" for uploading a file. More...
     
    RETCODE bcp_readfmt (DBPROCESS *dbproc, const char filename[])
     Read a format definition file. More...
     
    RETCODE bcp_sendrow (DBPROCESS *dbproc)
     Write data in host variables to the table. More...
     

    Detailed Description

    Functions to bulk-copy (a/k/a bcp) data to/from the database.


    Function Documentation

    ◆ bcp_batch()

    DBINT bcp_batch ( DBPROCESS dbproc)

    Commit a set of rows to the table.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Remarks
    If not called, bcp_done() will cause the rows to be saved.
    Returns
    Count of rows saved, or -1 on error.
    See also
    bcp_bind(), bcp_done(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ bcp_bind()

    RETCODE bcp_bind ( DBPROCESS dbproc,
    BYTE *  varaddr,
    int  prefixlen,
    DBINT  varlen,
    BYTE *  terminator,
    int  termlen,
    int  db_vartype,
    int  table_column 
    )

    Bind a program host variable to a database column.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    varaddraddress of host variable
    prefixlenlength of any prefix found at the beginning of varaddr, in bytes.
    Use zero for fixed-length datatypes.
    varlenbytes of data in varaddr. Zero for NULL, -1 for fixed-length datatypes.
    terminatorbyte sequence that marks the end of the data in varaddr
    termlenlength of terminator
    vartypedatatype of the host variable
    table_columnNth column, starting at 1, in the table.
    Remarks
    The order of operation is:
    Returns
    SUCCEED or FAIL.
    See also
    bcp_batch(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_moretext(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ bcp_colfmt()

    RETCODE bcp_colfmt ( DBPROCESS dbproc,
    int  host_colnum,
    int  host_type,
    int  host_prefixlen,
    DBINT  host_collen,
    const BYTE *  host_term,
    int  host_termlen,
    int  table_colnum 
    )

    Specify the format of a datafile prior to writing to a table.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    host_colnumdatafile column number (starting with 1, not zero).
    host_typedataype token describing the data type in host_colnum. E.g. SYBCHAR for character data.
    host_prefixlensize of the prefix in the datafile column, if any. For delimited files: zero.
    May be 0, 1, 2, or 4 bytes. The prefix will be read as an integer (not a character string) from the data file, and will be interpreted the data size of that column, in bytes.
    host_collenmaximum size of datafile column, exclusive of any prefix/terminator. Just the data, ma'am.
    Special values:
    • 0 indicates NULL.
    • -1 for fixed-length non-null datatypes
    • -1 for variable-length datatypes (e.g. SYBCHAR) where the length is established by a prefix/terminator.
    host_termthe sequence of characters that will serve as a column terminator (delimiter) in the datafile.
    Often a tab character, but can be any string of any length. Zero indicates no terminator.
    Special characters:
    • '\0' terminator is an ASCII NUL.
    • '\t' terminator is an ASCII TAB.
    • '\n' terminator is an ASCII NL.
    host_termlenthe length of host_term, in bytes.
    table_colnumNth column, starting at 1, in the table that maps to host_colnum.
    If there is a column in the datafile that does not map to a table column, set table_colnum to zero.
    Remarks
    bcp_colfmt() is called once for each column in the datafile, as specified with bcp_columns().
    In so doing, you describe to FreeTDS how to parse each line of your datafile, and where to send each field.

    When a prefix or terminator is used with variable-length data, host_collen may have one of three values:

    • positive indicating the maximum number of bytes to be used
    • 0 indicating NULL
    • -1 indicating no maximum; all data, as described by the prefix/terminator will be used.
    Returns
    SUCCEED or FAIL.
    See also
    bcp_batch(), bcp_bind(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_init(), bcp_sendrow
    Here is the call graph for this function:

    ◆ bcp_colfmt_ps()

    RETCODE bcp_colfmt_ps ( DBPROCESS dbproc,
    int  host_colnum,
    int  host_type,
    int  host_prefixlen,
    DBINT  host_collen,
    BYTE *  host_term,
    int  host_termlen,
    int  table_colnum,
    DBTYPEINFO typeinfo 
    )

    Specify the format of a host file for bulk copy purposes, with precision and scale support for numeric and decimal columns.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    host_colnumdatafile column number (starting with 1, not zero).
    host_typedataype token describing the data type in host_colnum. E.g. SYBCHAR for character data.
    host_prefixlensize of the prefix in the datafile column, if any. For delimited files: zero.
    May be 0, 1, 2, or 4 bytes. The prefix will be read as an integer (not a character string) from the data file, and will be interpreted the data size of that column, in bytes.
    host_collenmaximum size of datafile column, exclusive of any prefix/terminator. Just the data, ma'am.
    Special values:
    • 0 indicates NULL.
    • -1 for fixed-length non-null datatypes
    • -1 for variable-length datatypes (e.g. SYBCHAR) where the length is established by a prefix/terminator.
    host_termthe sequence of characters that will serve as a column terminator (delimiter) in the datafile.
    Often a tab character, but can be any string of any length. Zero indicates no terminator.
    Special characters:
    • '\0' terminator is an ASCII NUL.
    • '\t' terminator is an ASCII TAB.
    • '\n' terminator is an ASCII NL.
    host_termlenthe length of host_term, in bytes.
    table_colnumNth column, starting at 1, in the table that maps to host_colnum.
    If there is a column in the datafile that does not map to a table column, set table_colnum to zero.
    typeinfosomething
    Todo:
    Not implemented.
    Returns
    SUCCEED or FAIL.
    See also
    bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_init(), bcp_sendrow
    Here is the call graph for this function:

    ◆ bcp_collen()

    RETCODE bcp_collen ( DBPROCESS dbproc,
    DBINT  varlen,
    int  table_column 
    )

    Set the length of a host variable to be written to a table.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    varlensize of the variable, in bytes, or
    • 0 indicating NULL
    • -1 indicating size is determined by the prefix or terminator.
      (If both a prefix and a terminator are present, bcp is supposed to use the smaller of the two. This feature might or might not actually work.)
      Parameters
      table_columnthe number of the column in the table (starting with 1, not zero).
      Returns
      SUCCEED or FAIL.
      See also
      bcp_bind(), bcp_colptr(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ bcp_colptr()

    RETCODE bcp_colptr ( DBPROCESS dbproc,
    BYTE *  colptr,
    int  table_column 
    )

    Override bcp_bind() by pointing to a different host variable.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    colptrThe pointer, the address of your variable.
    table_columnThe 1-based column ordinal in the table.
    Remarks
    Use between calls to bcp_sendrow(). After calling bcp_colptr(), subsequent calls to bcp_sendrow() will bind to the new address.
    Returns
    SUCCEED or FAIL.
    See also
    bcp_bind(), bcp_collen(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ bcp_columns()

    RETCODE bcp_columns ( DBPROCESS dbproc,
    int  host_colcount 
    )

    Indicate how many columns are to be found in the datafile.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    host_colcountcount of columns in the datafile, irrespective of how many you intend to use.
    Remarks
    This function describes the file as it is, not how it will be used.
    Returns
    SUCCEED or FAIL. It's hard to see how it could fail.
    See also
    bcp_colfmt()
    Here is the call graph for this function:

    ◆ bcp_control()

    RETCODE bcp_control ( DBPROCESS dbproc,
    int  field,
    DBINT  value 
    )

    Set BCP options for uploading a datafile.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    fieldsymbolic constant indicating the option to be set, one of:
    • BCPMAXERRS Maximum errors tolerated before quitting. The default is 10.
    • BCPFIRST The first row to read in the datafile. The default is 1.
    • BCPLAST The last row to read in the datafile. The default is to copy all rows. A value of -1 resets this field to its default?
    • BCPBATCH The number of rows per batch. Default is 0, meaning a single batch.
    valueThe value for field.
    Remarks
    These options control the behavior of bcp_exec().
    When writing to a table from application host memory variables, program logic controls error tolerance and batch size.
    Returns
    SUCCEED or FAIL.
    See also
    bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_done(), bcp_exec(), bcp_options()
    Here is the call graph for this function:

    ◆ bcp_done()

    DBINT bcp_done ( DBPROCESS dbproc)

    Conclude the transfer of data from program variables.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Remarks
    Do not overlook this function. According to Sybase, failure to call bcp_done() "will result in unpredictable errors".
    Returns
    As with bcp_batch(), the count of rows saved, or -1 on error.
    See also
    bcp_batch(), bcp_bind(), bcp_moretext(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ bcp_exec()

    RETCODE bcp_exec ( DBPROCESS dbproc,
    DBINT *  rows_copied 
    )

    Write a datafile to a table.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    rows_copiedbcp_exec will write the count of rows successfully written to this address. If rows_copied is NULL, it will be ignored by db-lib.
    Returns
    SUCCEED or FAIL.
    See also
    bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_init(), bcp_sendrow()

    ◆ bcp_getl()

    DBBOOL bcp_getl ( LOGINREC login)

    See if BCP_SETL() was used to set the LOGINREC for BCP work.


    Parameters
    loginAddress of the LOGINREC variable to be passed to dbopen().
    Returns
    TRUE or FALSE.
    See also
    BCP_SETL(), bcp_init(), dblogin(), dbopen()
    Here is the call graph for this function:

    ◆ bcp_init()

    RETCODE bcp_init ( DBPROCESS dbproc,
    const char *  tblname,
    const char *  hfile,
    const char *  errfile,
    int  direction 
    )

    Prepare for bulk copy operation on a table.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    tblnamethe name of the table receiving or providing the data.
    hfilethe data file opposite the table, if any.
    errfilethe "error file" captures messages and, if errors are encountered, copies of any rows that could not be written to the table.
    directionone of
    • DB_IN writing to the table
    • DB_OUT writing to the host file
    Remarks
    bcp_init() sets the host file data format and acquires the table metadata. It is called before the other bulk copy functions.

    When writing to a table, bcp can use as its data source a data file (hfile), or program data in an application's variables. In the latter case, call bcp_bind() to associate your data with the appropriate table column.

    Returns
    SUCCEED or FAIL.
    See also
    BCP_SETL(), bcp_bind(), bcp_done(), bcp_exec()
    Here is the call graph for this function:

    ◆ bcp_options()

    RETCODE bcp_options ( DBPROCESS dbproc,
    int  option,
    BYTE *  value,
    int  valuelen 
    )

    Set "hints" for uploading a file.

    A FreeTDS-only function.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    optionsymbolic constant indicating the option to be set, one of:
    • BCPLABELED Not implemented.
    • BCPHINTS The hint to be passed when the bulk-copy begins.
    valueThe string constant for option a/k/a the hint. One of:
    • ORDER The data are ordered in accordance with the table's clustered index.
    • ROWS_PER_BATCH The batch size
    • KILOBYTES_PER_BATCH The approximate number of kilobytes to use for a batch size
    • TABLOCK Lock the table
    • CHECK_CONSTRAINTS Apply constraints
    • FIRE_TRIGGERS Fire any INSERT triggers on the target table
    valuelenThe strlen of value.
    Returns
    SUCCEED or FAIL.
    See also
    bcp_control(), bcp_exec(),
    Todo:
    Simplify. Remove valuelen, and dbproc->bcpinfo->hint = strdup(hints[i])
    Here is the call graph for this function:

    ◆ bcp_readfmt()

    RETCODE bcp_readfmt ( DBPROCESS dbproc,
    const char  filename[] 
    )

    Read a format definition file.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    filenameName that will be passed to fopen(3).
    Remarks
    Reads a format file and calls bcp_columns() and bcp_colfmt() as needed.
    Returns
    SUCCEED or FAIL.
    See also
    bcp_colfmt(), bcp_colfmt_ps(), bcp_columns(), bcp_writefmt()
    Here is the call graph for this function:

    ◆ bcp_sendrow()

    RETCODE bcp_sendrow ( DBPROCESS dbproc)

    Write data in host variables to the table.


    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Remarks
    Call bcp_bind() first to describe the variables to be used.
    Use bcp_batch() to commit sets of rows. After sending the last row call bcp_done().
    Returns
    SUCCEED or FAIL.
    See also
    bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_init(), bcp_moretext(), bcp_options()
    Here is the call graph for this function:
    freetds-1.3.6/doc/reference/a00549_ga0311328d63bae5d9bd5aea5ea4914223_cgraph.dot000644 025423 025423 00000001256 14162303417 027117 0ustar00fredianofrediano000000 000000 digraph "dbretname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbretname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get name of an output parameter filled by a stored procedure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_ga2306039d73fbc7045f257b0e750c37b4_cgraph.dot000644 025423 025423 00000001263 14162303417 026710 0ustar00fredianofrediano000000 000000 digraph "dbretstatus" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbretstatus",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Fetch status value returned by query or remote procedure call."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_ga42e187003b74fec6e9ca92d410bfb9c0_cgraph.dot000644 025423 025423 00000001257 14162303417 027214 0ustar00fredianofrediano000000 000000 digraph "dbretdata" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbretdata",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get value of an output parameter filled by a stored procedure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_ga5b4374c13c7a83cd4345b0bfa3e787bd_cgraph.dot000644 025423 025423 00000001224 14162303417 027207 0ustar00fredianofrediano000000 000000 digraph "dbrpcinit" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbrpcinit",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Initialize a remote procedure call."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_ga7a5062dac92ccedc8459f6d4a530ffb7_cgraph.dot000644 025423 025423 00000001253 14162303417 027363 0ustar00fredianofrediano000000 000000 digraph "dbhasretstat" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbhasretstat",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Determine if query generated a return status number."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_gaa478c8b96923bca02d158d966172ec1b_cgraph.dot000644 025423 025423 00000001247 14162303417 027066 0ustar00fredianofrediano000000 000000 digraph "dbrettype" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbrettype",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get datatype of a stored procedure's return parameter."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_gab705bf94be535e9d8fc4edc0f48c98b0_cgraph.dot000644 025423 025423 00000001254 14162303417 027400 0ustar00fredianofrediano000000 000000 digraph "dbretlen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbretlen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get size of an output parameter filled by a stored procedure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_gaf6b6b0a641180a5c28382df39cd7d346_cgraph.dot000644 025423 025423 00000001236 14162303417 027056 0ustar00fredianofrediano000000 000000 digraph "dbrpcparam" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbrpcparam",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Add a parameter to a remote procedure call."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_gafa4dfd181be21e49c397f7daaa9cf96c_cgraph.dot000644 025423 025423 00000001242 14162303417 027530 0ustar00fredianofrediano000000 000000 digraph "dbrpcsend" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbrpcsend",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Execute the procedure and free associated memory."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00549_gaff09873008411a0573f6d1a9e6c7cf4b_cgraph.dot000644 025423 025423 00000001255 14162303417 027063 0ustar00fredianofrediano000000 000000 digraph "dbnumrets" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbnumrets",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get count of output parameters filled by a stored procedure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_ga0ed03c69e698336d015bb315ad755fd5_cgraph.dot000644 025423 025423 00000001260 14162303417 027045 0ustar00fredianofrediano000000 000000 digraph "bcp_colfmt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_colfmt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Specify the format of a datafile prior to writing to a table."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_ga220f6b043602da1028f98dacb2fd00c0_cgraph.dot000644 025423 025423 00000001253 14162303417 027066 0ustar00fredianofrediano000000 000000 digraph "bcp_getl" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_getl",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="See if BCP_SETL() was used to set the LOGINREC for BCP work."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_ga244547855b41788fa3a67756956fbc81_cgraph.dot000644 025423 025423 00000001236 14162303417 026602 0ustar00fredianofrediano000000 000000 digraph "bcp_control" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_control",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set BCP options for uploading a datafile."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_ga330b9f1028f856a9eec5115550bcb4f7_cgraph.dot000644 025423 025423 00000001257 14162303417 027051 0ustar00fredianofrediano000000 000000 digraph "bcp_columns" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_columns",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Indicate how many columns are to be found in the datafile."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_ga6498235e4ef8e41ea43b01494b28998d_cgraph.dot000644 025423 025423 00000001260 14162303417 026731 0ustar00fredianofrediano000000 000000 digraph "bcp_colptr" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_colptr",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Override bcp_bind() by pointing to a different host variable."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00551.dot000644 025423 025423 00000001205 14162303417 020630 0ustar00fredianofrediano000000 000000 digraph "Internal bcp functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Internal bcp functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Static functions internal to the bcp library."]; Node2 [label="Bulk copy functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00550.html",tooltip="Functions to bulk-copy (a/k/a bcp) data to/from the database."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00551.html000644 025423 025423 00000111267 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Internal bcp functions
    FreeTDS API
    Internal bcp functions

    Static functions internal to the bcp library. More...

    Collaboration diagram for Internal bcp functions:

    Functions

    static RETCODE _bcp_exec_in (DBPROCESS *dbproc, DBINT *rows_copied)
     
    static RETCODE _bcp_exec_out (DBPROCESS *dbproc, DBINT *rows_copied)
     
    static char * _bcp_fgets (char *buffer, int size, FILE *f)
     
    static void _bcp_free_columns (DBPROCESS *dbproc)
     
    static void _bcp_free_storage (DBPROCESS *dbproc)
     
    static TDSRET _bcp_get_col_data (TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset)
     For a bcp in from program variables, get the data from the host variable. More...
     
    static int _bcp_get_term_var (const BYTE *pdata, const BYTE *term, int term_len)
     Get the data for bcp-in from program variables, where the program data have been identified as character terminated,
    This is a low-level, internal function. More...
     
    static STATUS _bcp_read_hostfile (DBPROCESS *dbproc, FILE *hostfile, int *row_error, bool skip)
     
    static int _bcp_readfmt_colinfo (DBPROCESS *dbproc, char *buf, BCP_HOSTCOLINFO *ci)
     
    static int rtrim (char *str, int len)
     trim a string of trailing blanks More...
     

    Detailed Description

    Static functions internal to the bcp library.


    Function Documentation

    ◆ _bcp_exec_in()

    static RETCODE _bcp_exec_in ( DBPROCESS dbproc,
    DBINT *  rows_copied 
    )
    static
    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    rows_copied
    Returns
    SUCCEED or FAIL.
    See also
    BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ _bcp_exec_out()

    static RETCODE _bcp_exec_out ( DBPROCESS dbproc,
    DBINT *  rows_copied 
    )
    static
    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    rows_copied
    Returns
    SUCCEED or FAIL.
    See also
    BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()

    ◆ _bcp_fgets()

    static char* _bcp_fgets ( char *  buffer,
    int  size,
    FILE *  f 
    )
    static

    ◆ _bcp_free_columns()

    static void _bcp_free_columns ( DBPROCESS dbproc)
    static
    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Here is the call graph for this function:

    ◆ _bcp_free_storage()

    static void _bcp_free_storage ( DBPROCESS dbproc)
    static
    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    bcp_done(), bcp_exec(), bcp_init()
    Here is the call graph for this function:

    ◆ _bcp_get_col_data()

    static TDSRET _bcp_get_col_data ( TDSBCPINFO bcpinfo,
    TDSCOLUMN bindcol,
    int  offset 
    )
    static

    For a bcp in from program variables, get the data from the host variable.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    bindcol
    Returns
    TDS_SUCCESS or TDS_FAIL.
    See also
    _bcp_add_fixed_columns, _bcp_add_variable_columns, _bcp_send_bcp_record
    Here is the call graph for this function:

    ◆ _bcp_get_term_var()

    static int _bcp_get_term_var ( const BYTE *  pdata,
    const BYTE *  term,
    int  term_len 
    )
    static

    Get the data for bcp-in from program variables, where the program data have been identified as character terminated,
    This is a low-level, internal function.

    Call it correctly.

    Parameters
    pdata
    term
    term_len
    Returns
    data length.

    ◆ _bcp_read_hostfile()

    static STATUS _bcp_read_hostfile ( DBPROCESS dbproc,
    FILE *  hostfile,
    int *  row_error,
    bool  skip 
    )
    static
    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    hostfile
    row_error
    Returns
    MORE_ROWS, NO_MORE_ROWS, or FAIL.
    See also
    BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ _bcp_readfmt_colinfo()

    static int _bcp_readfmt_colinfo ( DBPROCESS dbproc,
    char *  buf,
    BCP_HOSTCOLINFO ci 
    )
    static
    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    buf
    ci
    Returns
    SUCCEED or FAIL.
    See also
    BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow()
    Here is the call graph for this function:

    ◆ rtrim()

    static int rtrim ( char *  str,
    int  len 
    )
    static

    trim a string of trailing blanks

    Replaces spaces at the end of a string with NULs

    Parameters
    strpointer to a character buffer (not null-terminated)
    lensize of the str in bytes
    Returns
    modified length
    freetds-1.3.6/doc/reference/a00552.dot000644 025423 025423 00000001140 14162303417 020627 0ustar00fredianofrediano000000 000000 digraph "Money functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00547.html",tooltip="Functions callable by db-lib client programs."]; Node1 [label="Money functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions to manipulate the MONEY datatype."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00550_ga6cf03708baaf02eb016b9ee77160d879_cgraph.dot000644 025423 025423 00000001241 14162303417 027123 0ustar00fredianofrediano000000 000000 digraph "bcp_bind" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_bind",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Bind a program host variable to a database column."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_ga8b85f79f53a62ac7a728fe626d609b65_cgraph.dot000644 025423 025423 00000001244 14162303417 027077 0ustar00fredianofrediano000000 000000 digraph "bcp_done" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_done",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Conclude the transfer of data from program variables."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_ga963c5e38bca7668afc57f5cc123d10fb_cgraph.dot000644 025423 025423 00000001223 14162303417 027267 0ustar00fredianofrediano000000 000000 digraph "bcp_readfmt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_readfmt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Read a format definition file."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_gaa23f8e5c7f437a94746c90292dd1cb01_cgraph.dot000644 025423 025423 00000001223 14162303417 027045 0ustar00fredianofrediano000000 000000 digraph "bcp_batch" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_batch",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Commit a set of rows to the table."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_gada8e987c4a6225b9276c05ba3a4f47a0_cgraph.dot000644 025423 025423 00000001232 14162303417 027122 0ustar00fredianofrediano000000 000000 digraph "bcp_init" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_init",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Prepare for bulk copy operation on a table."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_gae41d196a22c544d66212dacc5b555791_cgraph.dot000644 025423 025423 00000001256 14162303417 026762 0ustar00fredianofrediano000000 000000 digraph "bcp_collen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_collen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set the length of a host variable to be written to a table."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_gaf1130ac97f6af55e86ec70b0aa4f5b40_cgraph.dot000644 025423 025423 00000001237 14162303417 027256 0ustar00fredianofrediano000000 000000 digraph "bcp_sendrow" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_sendrow",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Write data in host variables to the table."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_gaf13b2bb12b4200752718f3a3face3870_cgraph.dot000644 025423 025423 00000001341 14162303417 027014 0ustar00fredianofrediano000000 000000 digraph "bcp_colfmt_ps" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_colfmt_ps",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Specify the format of a host file for bulk copy purposes, with precision and scale support for numeri..."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00550_gafec3feb5bac1cb33545ba01efb0a67b8_cgraph.dot000644 025423 025423 00000001230 14162303417 027534 0ustar00fredianofrediano000000 000000 digraph "bcp_options" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="bcp_options",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set \"hints\" for uploading a file."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00551_ga0f8def4cad04c5c1e27c2b653d482dd8_cgraph.dot000644 025423 025423 00000001312 14162303417 027340 0ustar00fredianofrediano000000 000000 digraph "_bcp_get_col_data" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_bcp_get_col_data",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="For a bcp in from program variables, get the data from the host variable."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00551_ga1b57d952a9d72f375c3296124affa908_cgraph.dot000644 025423 025423 00000001204 14162303417 026776 0ustar00fredianofrediano000000 000000 digraph "_bcp_read_hostfile" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_bcp_read_hostfile",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00551_ga7370f1223f13510d6b33e98f2de09fb5_cgraph.dot000644 025423 025423 00000001170 14162303417 026762 0ustar00fredianofrediano000000 000000 digraph "_bcp_exec_in" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_bcp_exec_in",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00551_gaa134c1c3ccc4326e693adb8357272f1d_cgraph.dot000644 025423 025423 00000001202 14162303417 027106 0ustar00fredianofrediano000000 000000 digraph "_bcp_free_storage" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_bcp_free_storage",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00551_gacf69ac4cbe8e3c3e6ea665e31e5e85b8_cgraph.dot000644 025423 025423 00000001202 14162303417 027441 0ustar00fredianofrediano000000 000000 digraph "_bcp_free_columns" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_bcp_free_columns",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00551_gafc23d62bc86b38fb757e3ac4aadca0a4_cgraph.dot000644 025423 025423 00000001210 14162303417 027463 0ustar00fredianofrediano000000 000000 digraph "_bcp_readfmt_colinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_bcp_readfmt_colinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552.html000644 025423 025423 00000137520 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Money functions
    FreeTDS API
    Money functions

    Functions to manipulate the MONEY datatype. More...

    Collaboration diagram for Money functions:

    Functions

    RETCODE dbmny4add (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum)
     Add two DBMONEY4 values. More...
     
    int dbmny4cmp (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2)
     Compare two DBMONEY4 values. More...
     
    RETCODE dbmny4copy (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
     Copy a DBMONEY4 value. More...
     
    RETCODE dbmny4minus (DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest)
     Negate a DBMONEY4 value. More...
     
    RETCODE dbmny4sub (DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff)
     Subtract two DBMONEY4 values. More...
     
    RETCODE dbmny4zero (DBPROCESS *dbproc, DBMONEY4 *dest)
     Zero a DBMONEY4 value. More...
     
    int dbmnycmp (DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2)
     Compare two DBMONEY values. More...
     
    RETCODE dbmnycopy (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
     Copy a DBMONEY value. More...
     
    RETCODE dbmnydec (DBPROCESS *dbproc, DBMONEY *amount)
     Subtract $0.0001 from a DBMONEY value. More...
     
    RETCODE dbmnyinc (DBPROCESS *dbproc, DBMONEY *amount)
     Add $0.0001 to a DBMONEY value. More...
     
    RETCODE dbmnymaxneg (DBPROCESS *dbproc, DBMONEY *amount)
     Get maximum negative DBMONEY value supported. More...
     
    RETCODE dbmnymaxpos (DBPROCESS *dbproc, DBMONEY *amount)
     Get maximum positive DBMONEY value supported. More...
     
    RETCODE dbmnyminus (DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest)
     Negate a DBMONEY value. More...
     
    RETCODE dbmnyzero (DBPROCESS *dbproc, DBMONEY *dest)
     Set a DBMONEY value to zero. More...
     

    Detailed Description

    Functions to manipulate the MONEY datatype.


    Function Documentation

    ◆ dbmny4add()

    RETCODE dbmny4add ( DBPROCESS dbproc,
    DBMONEY4 m1,
    DBMONEY4 m2,
    DBMONEY4 sum 
    )

    Add two DBMONEY4 values.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    m1first operand.
    m2other operand.
    sumoutput: result of computation.
    Return values
    SUCCEEDusually.
    FAILon overflow.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmny4cmp()

    int dbmny4cmp ( DBPROCESS dbproc,
    DBMONEY4 m1,
    DBMONEY4 m2 
    )

    Compare two DBMONEY4 values.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    m1some money.
    m2some other money.
    Return values
    0m1 == m2.
    -1m1 < m2.
    1m1 > m2.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmny4copy()

    RETCODE dbmny4copy ( DBPROCESS dbproc,
    DBMONEY4 src,
    DBMONEY4 dest 
    )

    Copy a DBMONEY4 value.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    srcaddress of a DBMONEY4 structure.
    destoutput: new money.
    Return values
    SUCCEEDor FAIL if src/dest NULL.
    See also
    dbmnycopy(), dbmnyminus(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmny4minus()

    RETCODE dbmny4minus ( DBPROCESS dbproc,
    DBMONEY4 src,
    DBMONEY4 dest 
    )

    Negate a DBMONEY4 value.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    srcaddress of a DBMONEY4 structure.
    destoutput: result of negation.
    Return values
    SUCCEEDusually.
    FAILon overflow.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmny4sub()

    RETCODE dbmny4sub ( DBPROCESS dbproc,
    DBMONEY4 m1,
    DBMONEY4 m2,
    DBMONEY4 diff 
    )

    Subtract two DBMONEY4 values.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    m1first operand.
    m2other operand, subtracted from m1.
    diffoutput: result of computation.
    Return values
    SUCCEEDusually.
    FAILon overflow.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmny4zero()

    RETCODE dbmny4zero ( DBPROCESS dbproc,
    DBMONEY4 dest 
    )

    Zero a DBMONEY4 value.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    destaddress of a DBMONEY structure.
    Return values
    SUCCEEDusually.
    FAILdest is NULL.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmnycmp()

    int dbmnycmp ( DBPROCESS dbproc,
    DBMONEY m1,
    DBMONEY m2 
    )

    Compare two DBMONEY values.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    m1some money.
    m2some other money.
    Return values
    0m1 == m2.
    -1m1 < m2.
    1m1 > m2.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmnycopy()

    RETCODE dbmnycopy ( DBPROCESS dbproc,
    DBMONEY src,
    DBMONEY dest 
    )

    Copy a DBMONEY value.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    srcaddress of a DBMONEY structure.
    destoutput: new money.
    Return values
    SUCCEEDalways, unless src or dest is NULL.
    See also
    Here is the call graph for this function:

    ◆ dbmnydec()

    RETCODE dbmnydec ( DBPROCESS dbproc,
    DBMONEY amount 
    )

    Subtract $0.0001 from a DBMONEY value.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    amountaddress of a DBMONEY structure.
    Return values
    SUCCEEDor FAIL if overflow or amount NULL.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmnyinc()

    RETCODE dbmnyinc ( DBPROCESS dbproc,
    DBMONEY amount 
    )

    Add $0.0001 to a DBMONEY value.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    amountaddress of a DBMONEY structure.
    Return values
    SUCCEEDor FAIL if overflow or amount NULL.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmnymaxneg()

    RETCODE dbmnymaxneg ( DBPROCESS dbproc,
    DBMONEY amount 
    )

    Get maximum negative DBMONEY value supported.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    amountaddress of a DBMONEY structure.
    Return values
    SUCCEEDAlways.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmnymaxpos()

    RETCODE dbmnymaxpos ( DBPROCESS dbproc,
    DBMONEY amount 
    )

    Get maximum positive DBMONEY value supported.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    amountaddress of a DBMONEY structure.
    Return values
    SUCCEEDAlways.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmnyminus()

    RETCODE dbmnyminus ( DBPROCESS dbproc,
    DBMONEY src,
    DBMONEY dest 
    )

    Negate a DBMONEY value.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    srcaddress of a DBMONEY structure.
    destoutput: result of negation.
    Return values
    SUCCEEDor FAIL if overflow or src/dest NULL.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:

    ◆ dbmnyzero()

    RETCODE dbmnyzero ( DBPROCESS dbproc,
    DBMONEY dest 
    )

    Set a DBMONEY value to zero.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    destaddress of a DBMONEY structure.
    Return values
    SUCCEEDunless amount is NULL.
    See also
    dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus().
    Here is the call graph for this function:
    freetds-1.3.6/doc/reference/a00553.dot000644 025423 025423 00000001151 14162303417 020632 0ustar00fredianofrediano000000 000000 digraph "Datetime functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00547.html",tooltip="Functions callable by db-lib client programs."]; Node1 [label="Datetime functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions to manipulate DBDATETIME structures."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00553.html000644 025423 025423 00000024246 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Datetime functions
    FreeTDS API
    Datetime functions

    Functions to manipulate DBDATETIME structures. More...

    Collaboration diagram for Datetime functions:

    Functions

    int dbdatecmp (DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2)
     Compare DBDATETIME values, similar to strcmp(3). More...
     
    const char * dbmonthname (DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform)
     Get name of a month, in some human language. More...
     

    Detailed Description

    Functions to manipulate DBDATETIME structures.

    Defined by Sybase only.
    These are not implemented:

    • dbdate4cmp()
    • dbdate4zero()
    • dbdatechar()
    • dbdatename()
    • dbdateorder()
    • dbdatepart()
    • dbdatezero()
    • dbdayname()

    Function Documentation

    ◆ dbdatecmp()

    int dbdatecmp ( DBPROCESS dbproc,
    DBDATETIME d1,
    DBDATETIME d2 
    )

    Compare DBDATETIME values, similar to strcmp(3).

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    d1a DBDATETIME structure address
    d2another DBDATETIME structure address
    Return values
    0d1 = d2.
    -1d1 < d2.
    1d1 > d2.
    See also
    dbdate4cmp(), dbmnycmp(), dbmny4cmp().
    Here is the call graph for this function:

    ◆ dbmonthname()

    const char* dbmonthname ( DBPROCESS dbproc,
    char *  language,
    int  monthnum,
    DBBOOL  shortform 
    )

    Get name of a month, in some human language.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    languageignored.
    monthnumnumber of the month, starting with 1.
    shortformset to TRUE for a three letter output ("Jan" - "Dec"), else zero.
    Returns
    address of null-terminated ASCII string, or NULL on error.
    See also
    db12hour(), dbdateorder(), dbdayname(), DBSETLNATLANG(), dbsetopt().
    Here is the call graph for this function:
    freetds-1.3.6/doc/reference/a00552_ga070e94f72f12c138a16a7bcdf732fa8b_cgraph.dot000644 025423 025423 00000001211 14162303417 027175 0ustar00fredianofrediano000000 000000 digraph "dbmny4zero" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmny4zero",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Zero a DBMONEY4 value."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga0a384938a6586b7411fc42420ffad6ed_cgraph.dot000644 025423 025423 00000001211 14162303417 027043 0ustar00fredianofrediano000000 000000 digraph "dbmny4add" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmny4add",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Add two DBMONEY4 values."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga109d4868baccb08fad3b26b6f031dc78_cgraph.dot000644 025423 025423 00000001215 14162303417 027260 0ustar00fredianofrediano000000 000000 digraph "dbmny4cmp" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmny4cmp",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Compare two DBMONEY4 values."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga70ca2474f6c93acd6e3b842330b712c7_cgraph.dot000644 025423 025423 00000001242 14162303417 027036 0ustar00fredianofrediano000000 000000 digraph "dbmnymaxpos" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnymaxpos",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get maximum positive DBMONEY value supported."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga76177eb61a67dd52424236aba1b16bc9_cgraph.dot000644 025423 025423 00000001215 14162303417 027035 0ustar00fredianofrediano000000 000000 digraph "dbmny4minus" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmny4minus",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Negate a DBMONEY4 value."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga826bca98da4fd1c3188da45c383c3a68_cgraph.dot000644 025423 025423 00000001212 14162303417 027210 0ustar00fredianofrediano000000 000000 digraph "dbmnyminus" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnyminus",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Negate a DBMONEY value."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga856143f4f9c7a5c15fb15633af81487d_cgraph.dot000644 025423 025423 00000001216 14162303417 027004 0ustar00fredianofrediano000000 000000 digraph "dbmny4sub" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmny4sub",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Subtract two DBMONEY4 values."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga8eab0959d5a3cd534487b350258c939e_cgraph.dot000644 025423 025423 00000001215 14162303417 027005 0ustar00fredianofrediano000000 000000 digraph "dbmnyzero" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnyzero",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set a DBMONEY value to zero."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_ga8f1e9aa0280c1cb46c10e5c90b8faced_cgraph.dot000644 025423 025423 00000001206 14162303417 027410 0ustar00fredianofrediano000000 000000 digraph "dbmnycopy" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnycopy",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Copy a DBMONEY value."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_gaa6d4c700b628f6a18a9d1ed9f8e2ba62_cgraph.dot000644 025423 025423 00000001211 14162303417 027263 0ustar00fredianofrediano000000 000000 digraph "dbmny4copy" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmny4copy",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Copy a DBMONEY4 value."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_gabc3cb44d33bf1b9b18fd59f23e4da722_cgraph.dot000644 025423 025423 00000001242 14162303417 027337 0ustar00fredianofrediano000000 000000 digraph "dbmnymaxneg" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnymaxneg",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get maximum negative DBMONEY value supported."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_gabedce74748a31ea8a6e4068a5d44d8e4_cgraph.dot000644 025423 025423 00000001225 14162303417 027277 0ustar00fredianofrediano000000 000000 digraph "dbmnydec" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnydec",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Subtract $0.0001 from a DBMONEY value."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_gabf5216aaaa59ea7e7f07899f82a27faf_cgraph.dot000644 025423 025423 00000001216 14162303417 027365 0ustar00fredianofrediano000000 000000 digraph "dbmnyinc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnyinc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Add $0.0001 to a DBMONEY value."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00552_gadddacad5c3028aa8d3726246c3825651_cgraph.dot000644 025423 025423 00000001212 14162303417 027111 0ustar00fredianofrediano000000 000000 digraph "dbmnycmp" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmnycmp",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Compare two DBMONEY values."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00553_ga129d2922d347121a6b312dd8e75ed6d2_cgraph.dot000644 025423 025423 00000001241 14162303417 026757 0ustar00fredianofrediano000000 000000 digraph "dbdatecmp" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbdatecmp",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Compare DBDATETIME values, similar to strcmp(3)."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554.dot000644 025423 025423 00000001126 14162303417 020635 0ustar00fredianofrediano000000 000000 digraph "Internals" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00547.html",tooltip="Functions callable by db-lib client programs."]; Node1 [label="Internals",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions called within db-lib for self-help."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00554.html000644 025423 025423 00000206746 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: Internals
    FreeTDS API

    Functions called within db-lib for self-help. More...

    Collaboration diagram for Internals:

    Classes

    struct  _dblib_error_message
     

    Macros

    #define DBSETLLABELED(x, y)   dbsetlbool((x), (y), DBSETLABELED)
     Alternative way to set login packet fields. More...
     
    #define DBSETLVERSION(login, version)   dbsetlversion((login), (version))
     maps to the Microsoft (lower-case) function. More...
     

    Typedefs

    typedef struct _dblib_error_message DBLIB_ERROR_MESSAGE
     

    Functions

    static BYTE * _dbcoldata (TDSCOLUMN *colinfo)
     Return data from a column. More...
     
    int _dblib_check_and_handle_interrupt (void *vdbproc)
     check interrupts for libtds. More...
     
    RETCODE dbcmdrow (DBPROCESS *dbproc)
     See if the current command can return rows. More...
     
    static TDSCOLUMNdbcolptr (DBPROCESS *dbproc, int column)
     Sanity checks for column-oriented functions.
    More...
     
    int dbcurcmd (DBPROCESS *dbproc)
     Get number of the row just returned. More...
     
    DBINT dbcurrow (DBPROCESS *dbproc)
     Get number of the row currently being read. More...
     
    DBBOOL dbdead (DBPROCESS *dbproc)
     Check if dbproc is an ex-parrot.
    More...
     
    DBINT dbfirstrow (DBPROCESS *dbproc)
     See if a server response has arrived. More...
     
    int dbiordesc (DBPROCESS *dbproc)
     Get file descriptor of the socket used by a DBPROCESS to read data coming from the server. (!) More...
     
    int dbiowdesc (DBPROCESS *dbproc)
     Get file descriptor of the socket used by a DBPROCESS to write data coming to the server. (!) More...
     
    DBINT dblastrow (DBPROCESS *dbproc)
     Get number of the last row in the row buffer. More...
     
    int dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum,...)
     Call client-installed error handler. More...
     
    RETCODE dbrows (DBPROCESS *dbproc)
     Indicate whether a query returned rows. More...
     
    STATUS dbrowtype (DBPROCESS *dbproc)
     Get returned row's type. More...
     
    void dbsetavail (DBPROCESS *dbproc)
     Mark a DBPROCESS as "available". More...
     
    RETCODE dbsetlbool (LOGINREC *login, int value, int which)
     Set a boolean value in a LOGINREC structure.
    More...
     
    RETCODE dbsetllong (LOGINREC *login, long value, int which)
     Set an integer value in a LOGINREC structure.
    More...
     
    RETCODE dbsetlname (LOGINREC *login, const char *value, int which)
     Set the value of a string in a LOGINREC structure.
    More...
     
    int dbtds (DBPROCESS *dbproc)
     Get the TDS version in use for dbproc.
    More...
     
    static int default_err_handler (DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
     default error handler for db-lib (handles library-generated errors) More...
     
    DBPROCESStdsdbopen (LOGINREC *login, const char *server, int msdblib)
     Form a connection with the server. More...
     

    Detailed Description

    Functions called within db-lib for self-help.


    These functions are of interest only to people hacking on the FreeTDS db-lib implementation.

    Macro Definition Documentation

    ◆ DBSETLLABELED

    DBSETLLABELED (   x,
     
    )    dbsetlbool((x), (y), DBSETLABELED)

    Alternative way to set login packet fields.


    See also
    dbsetllabeled()

    ◆ DBSETLVERSION

    DBSETLVERSION (   login,
      version 
    )    dbsetlversion((login), (version))

    maps to the Microsoft (lower-case) function.


    See also
    dbsetlversion()

    Typedef Documentation

    ◆ DBLIB_ERROR_MESSAGE

    Remarks
    member msgno Vendor-defined message number
    member severity Is passed to the error handler
    member msgtext Text of message

    Function Documentation

    ◆ _dbcoldata()

    static BYTE * _dbcoldata ( TDSCOLUMN colinfo)
    static

    Return data from a column.

    Parameters
    colinfocontains information on a result column.
    Returns
    pointer to the data, or NULL if data are NULL
    See also
    dbdata(), dbretdata()

    ◆ _dblib_check_and_handle_interrupt()

    int _dblib_check_and_handle_interrupt ( void *  vdbproc)

    check interrupts for libtds.

    Parameters
    vdbproca DBPROCESS pointer, contains all information needed by db-lib to manage communications with the server.
    See also
    DBDEAD(), dbsetinterrupt().

    ◆ dbcmdrow()

    RETCODE dbcmdrow ( DBPROCESS dbproc)

    See if the current command can return rows.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Return values
    SUCCEEDYes, it can.
    FAILNo, it can't.
    Remarks
    Use DBCMDROW() macro instead.
    See also
    DBCMDROW(), dbnextrow(), dbresults(), DBROWS(), DBROWTYPE().
    Here is the call graph for this function:

    ◆ dbcolptr()

    static TDSCOLUMN* dbcolptr ( DBPROCESS dbproc,
    int  column 
    )
    static

    Sanity checks for column-oriented functions.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    pcolinfoaddress of pointer to a TDSCOLUMN structure.
    Remarks
    Makes sure dbproc and the requested column are valid.
    Calls dbperror() if not.
    Returns
    appropriate error or SUCCEED
    Here is the call graph for this function:

    ◆ dbcurcmd()

    int dbcurcmd ( DBPROCESS dbproc)

    Get number of the row just returned.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    DBCURROW().
    Todo:
    Unimplemented.
    Here is the call graph for this function:

    ◆ dbcurrow()

    DBINT dbcurrow ( DBPROCESS dbproc)

    Get number of the row currently being read.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Returns
    ostensibly the row number, or 0 if no rows have been read yet.
    Return values
    0Always.
    See also
    DBCURROW(), dbclrbuf(), DBFIRSTROW(), dbgetrow(), DBLASTROW(), dbnextrow(), dbsetopt(),.
    Todo:
    Unimplemented.
    Here is the call graph for this function:

    ◆ dbdead()

    DBBOOL dbdead ( DBPROCESS dbproc)

    Check if dbproc is an ex-parrot.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Return values
    TRUEprocess has been marked dead.
    FALSEprocess is OK.
    Remarks
    dbdead() does not communicate with the server.
    Unless a previously db-lib marked dbproc dead, dbdead() returns FALSE.
    See also
    dberrhandle().
    Here is the call graph for this function:

    ◆ dbfirstrow()

    DBINT dbfirstrow ( DBPROCESS dbproc)

    See if a server response has arrived.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    millisecondshow long to wait for the server before returning:
    • 0 return immediately.
    • -1 do not return until the server responds or a system interrupt occurs.
    ready_dbprocoutput: DBPROCESS for which a response arrived, of NULL.
    return_reasonoutput:
    • DBRESULT server responded.
    • DBNOTIFICATION registered procedure notification has arrived. dbpoll() the registered handler, if any, before it returns.
    • DBTIMEOUT milliseconds elapsed before the server responded.
    • DBINTERRUPT operating-system interrupt occurred before the server responded.
    Return values
    SUCCEEDeverything worked.
    FAILa server connection died.
    See also
    DBIORDESC(), DBRBUF(), dbresults(), dbreghandle(), dbsqlok().
    Todo:
    Unimplemented.

    Get number of the first row in the row buffer.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    DBFIRSTROW(), dbclrbuf(), DBCURROW(), dbgetrow(), DBLASTROW(), dbnextrow(), dbsetopt().
    Here is the call graph for this function:

    ◆ dbiordesc()

    int dbiordesc ( DBPROCESS dbproc)

    Get file descriptor of the socket used by a DBPROCESS to read data coming from the server. (!)

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    dbcmd(), DBIORDESC(), DBIOWDESC(), dbnextrow(), dbpoll(), DBRBUF(), dbresults(), dbsqlok(), dbsqlsend().
    Here is the call graph for this function:

    ◆ dbiowdesc()

    int dbiowdesc ( DBPROCESS dbproc)

    Get file descriptor of the socket used by a DBPROCESS to write data coming to the server. (!)

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    dbcmd(), DBIORDESC(), DBIOWDESC(), dbnextrow(), dbpoll(), DBRBUF(), dbresults(), dbsqlok(), dbsqlsend().
    Here is the call graph for this function:

    ◆ dblastrow()

    DBINT dblastrow ( DBPROCESS dbproc)

    Get number of the last row in the row buffer.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    DBLASTROW(), dbclrbuf(), DBCURROW(), DBFIRSTROW(), dbgetrow(), dbnextrow(), dbsetopt().
    Here is the call graph for this function:

    ◆ dbperror()

    int dbperror ( DBPROCESS dbproc,
    DBINT  msgno,
    long  errnum,
      ... 
    )

    Call client-installed error handler.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    msgnoidentifies the error message to be passed to the client's handler.
    errnumidentifies the OS error (errno), if any. Use 0 if not applicable.
    Returns
    the handler's return code, subject to correction and adjustment for vendor style:
    • INT_CANCEL The db-lib function that encountered the error will return FAIL.
    • INT_TIMEOUT The db-lib function will cancel the operation and return FAIL. dbproc remains useable.
    • INT_CONTINUE The db-lib function will retry the operation.
    Remarks
    The client-installed handler may also return INT_EXIT. If Sybase semantics are used, this function notifies the user and calls exit(3). If Microsoft semantics are used, this function returns INT_CANCEL.

    If the client-installed handler returns something other than these four INT_* values, or returns timeout-related value for anything but SYBETIME, it's treated here as INT_EXIT (see above).

    Instead of sprinkling error text all over db-lib, we consolidate it here, where it can be translated (one day), and where it can be mapped to the TDS error number.
    The libraries don't use consistent error numbers or messages, so when libtds has to emit an error message, it can't include the text. It can pass its error number to a client-library function, which will interpret it, add the text, call the application's installed handler (if any) and return the handler's return code back to the caller.

    The call stack may look something like this:

    1. application
    2. db-lib function (encounters error)
    3. dbperror
    4. error handler (installed by application)

    The error handling in this case is unambiguous: the caller invokes this function, the client's handler returns its instruction, which the caller receives. Quite often the caller will get INT_CANCEL, in which case it should put its house in order and return FAIL.

    The call stack may otherwise look something like this:

    1. application
    2. db-lib function
    3. libtds function (encounters error)
    4. _dblib_handle_err_message
    5. dbperror
    6. error handler (installed by application)

    Because different client libraries specify their handler semantics differently, and because libtds doesn't know which client library is in charge of any given connection, it cannot interpret the raw return code from a db-lib error handler. For these reasons, libtds calls _dblib_handle_err_message, which translates between libtds and db-lib semantics.

    See also
    dberrhandle(), _dblib_handle_err_message().
    Here is the caller graph for this function:

    ◆ dbrows()

    RETCODE dbrows ( DBPROCESS dbproc)

    Indicate whether a query returned rows.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    DBROWS(), DBCMDROW(), dbnextrow(), dbresults(), DBROWTYPE().
    Here is the call graph for this function:

    ◆ dbrowtype()

    STATUS dbrowtype ( DBPROCESS dbproc)

    Get returned row's type.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    See also
    DBROWTYPE().
    Here is the call graph for this function:

    ◆ dbsetavail()

    void dbsetavail ( DBPROCESS dbproc)

    Mark a DBPROCESS as "available".

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Remarks
    Basically bogus. FreeTDS behaves the way Sybase's implementation does, but so what?
    Many db-lib functions set the DBPROCESS to "not available", but only dbsetavail() resets it to "available".
    See also
    DBISAVAIL(). DBSETAVAIL().
    Here is the call graph for this function:

    ◆ dbsetlbool()

    RETCODE dbsetlbool ( LOGINREC login,
    int  value,
    int  which 
    )

    Set a boolean value in a LOGINREC structure.

    Called by various macros to populate login.

    Parameters
    loginthe LOGINREC* to modify.
    valuethe value to set it to.
    whichthe field to set.
    Remarks
    Only DBSETBCP is implemented.
    Return values
    SUCCEEDthe value was set.
    FAILinvalid value passed for which.
    Todo:
    DBSETNOSHORT, DBSETENCRYPT, DBSETLABELED
    Here is the call graph for this function:

    ◆ dbsetllong()

    RETCODE dbsetllong ( LOGINREC login,
    long  value,
    int  which 
    )

    Set an integer value in a LOGINREC structure.

    Called by various macros to populate login.

    Parameters
    loginthe LOGINREC* to modify.
    valuethe value to set it to.
    whichthe field to set.
    Return values
    SUCCEEDthe value was set.
    FAILanything other than DBSETPACKET was passed for which.
    Here is the call graph for this function:

    ◆ dbsetlname()

    RETCODE dbsetlname ( LOGINREC login,
    const char *  value,
    int  which 
    )

    Set the value of a string in a LOGINREC structure.

    Called by various macros to populate login.

    Parameters
    loginthe LOGINREC* to modify.
    valuethe value to set it to.
    whichthe field to set.
    Return values
    SUCCEEDthe value was set.
    FAILDBSETHID or other invalid which was tried.
    Here is the call graph for this function:

    ◆ dbtds()

    int dbtds ( DBPROCESS dbproc)

    Get the TDS version in use for dbproc.

    Parameters
    dbproccontains all information needed by db-lib to manage communications with the server.
    Returns
    a DBTDS* token.
    Remarks
    The integer values of the constants are counterintuitive.
    See also
    DBTDS().
    Here is the call graph for this function:

    ◆ default_err_handler()

    static int default_err_handler ( DBPROCESS dbproc,
    int  severity,
    int  dberr,
    int  oserr,
    char *  dberrstr,
    char *  oserrstr 
    )
    static

    default error handler for db-lib (handles library-generated errors)

    The default error handler doesn't print anything. If you want to see your messages printed, install an error handler. If you think that should be an optional compile- or run-time default, submit a patch. It could be done.

    See also
    DBDEAD(), dberrhandle().
    Here is the call graph for this function:

    ◆ tdsdbopen()

    DBPROCESS* tdsdbopen ( LOGINREC login,
    const char *  server,
    int  msdblib 
    )

    Form a connection with the server.

    Called by the dbopen() macro, normally. If FreeTDS was configured with –enable-msdblib, this function is called by (exported) dbopen() function. tdsdbopen is so-named to avoid namespace conflicts with other database libraries that use the same function name.

    Parameters
    loginLOGINREC* carrying the account information.
    servername of the dataserver to connect to.
    Returns
    valid pointer on successful login.
    Return values
    NULLinsufficient memory, unable to connect for any reason.
    See also
    dbopen()
    Todo:
    use asprintf() to avoid buffer overflow.
    Todo:
    separate error messages for no-such-server and no-such-user.
    Here is the call graph for this function:
    Here is the caller graph for this function:
    freetds-1.3.6/doc/reference/a00555.dot000644 025423 025423 00000001171 14162303417 020636 0ustar00fredianofrediano000000 000000 digraph "Unimplemented" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="The db-lib API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00547.html",tooltip="Functions callable by db-lib client programs."]; Node1 [label="Unimplemented",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions thus far not implemented in the FreeTDS db-lib implementation."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00553_ga38ecd55ae5827bfa0fd12e2baf0950dd_cgraph.dot000644 025423 025423 00000001241 14162303417 027416 0ustar00fredianofrediano000000 000000 digraph "dbmonthname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbmonthname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get name of a month, in some human language."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga01e7fb38bece3bb07526532fa6be50e5_cgraph.dot000644 025423 025423 00000001223 14162303417 027255 0ustar00fredianofrediano000000 000000 digraph "dbcurcmd" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcurcmd",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get number of the row just returned."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga03e850369aca6fba074da5e9da4effd7_cgraph.dot000644 025423 025423 00000001237 14162303417 027436 0ustar00fredianofrediano000000 000000 digraph "dbsetlbool" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetlbool",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set a boolean value in a LOGINREC structure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga0fc84c7073ed4876d9596c3eccac3609_cgraph.dot000644 025423 025423 00000001234 14162303417 027153 0ustar00fredianofrediano000000 000000 digraph "dbcolptr" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcolptr",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Sanity checks for column-oriented functions."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="dbperror",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00554.html#ga302a4ce6559b81808e3be51615cd1b67",tooltip="Call client-installed error handler."]; } freetds-1.3.6/doc/reference/a00554_ga13ead146339b43b3a4d9049eb124ef4b_cgraph.dot000644 025423 025423 00000001236 14162303417 027116 0ustar00fredianofrediano000000 000000 digraph "dblastrow" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dblastrow",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get number of the last row in the row buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga196f6d67de47f34a32fcc2103ab0f416_cgraph.dot000644 025423 025423 00000001232 14162303417 027120 0ustar00fredianofrediano000000 000000 digraph "dbcmdrow" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcmdrow",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="See if the current command can return rows."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga2c99ec565452279e9a382451d89642eb_cgraph.dot000644 025423 025423 00000001726 14162303417 026670 0ustar00fredianofrediano000000 000000 digraph "tdsdbopen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tdsdbopen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Form a connection with the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_open",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a24471508ddfde7cc0f8577801e70c42f",tooltip="Create and truncate a human readable dump file for the TDS traffic."]; } freetds-1.3.6/doc/reference/a00554_ga2c99ec565452279e9a382451d89642eb_icgraph.dot000644 025423 025423 00000001212 14162303417 027027 0ustar00fredianofrediano000000 000000 digraph "tdsdbopen" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tdsdbopen",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Form a connection with the server."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="dbopen",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00506.html#ae408d8e1c2ab0767d8bfd26d00d1ff6a",tooltip="Normally not used."]; } freetds-1.3.6/doc/reference/a00554_ga302a4ce6559b81808e3be51615cd1b67_icgraph.dot000644 025423 025423 00000001247 14162303417 027143 0ustar00fredianofrediano000000 000000 digraph "dbperror" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="dbperror",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Call client-installed error handler."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="dbcolptr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00554.html#ga0fc84c7073ed4876d9596c3eccac3609",tooltip="Sanity checks for column-oriented functions."]; } freetds-1.3.6/doc/reference/a00554_ga4be2ab59dc7161d6b93c17202e7ae9b1_cgraph.dot000644 025423 025423 00000001222 14162303417 027176 0ustar00fredianofrediano000000 000000 digraph "dbrows" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbrows",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Indicate whether a query returned rows."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga5ce245ff327a3d333280fe7b43d69ded_cgraph.dot000644 025423 025423 00000001225 14162303417 027216 0ustar00fredianofrediano000000 000000 digraph "dbsetavail" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetavail",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Mark a DBPROCESS as \"available\"."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga666a4d0609ee7f241deb0a62893d2cfa_cgraph.dot000644 025423 025423 00000001315 14162303417 027210 0ustar00fredianofrediano000000 000000 digraph "dbiowdesc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbiowdesc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get file descriptor of the socket used by a DBPROCESS to write data coming to the server...."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga8d765d810a40dfa01b39995a8e7406f0_cgraph.dot000644 025423 025423 00000001217 14162303417 026777 0ustar00fredianofrediano000000 000000 digraph "dbtds" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbtds",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get the TDS version in use for dbproc."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_ga9e23a95d84192b4fc83db7544d772d16_cgraph.dot000644 025423 025423 00000001232 14162303417 027007 0ustar00fredianofrediano000000 000000 digraph "dbcurrow" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbcurrow",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get number of the row currently being read."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_gaa2dc8c062342f76adffe53ee280b7fb4_cgraph.dot000644 025423 025423 00000001211 14162303417 027343 0ustar00fredianofrediano000000 000000 digraph "dbrowtype" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbrowtype",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get returned row's type."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_gab842baac0ec420b265d8c199cc45059d_cgraph.dot000644 025423 025423 00000001316 14162303417 027200 0ustar00fredianofrediano000000 000000 digraph "dbiordesc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbiordesc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get file descriptor of the socket used by a DBPROCESS to read data coming from the server...."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_gabdcccf4e0d093ff48c0e7048a4bfaf84_cgraph.dot000644 025423 025423 00000001240 14162303417 027506 0ustar00fredianofrediano000000 000000 digraph "dbsetllong" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetllong",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set an integer value in a LOGINREC structure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_gaccbc6d98d9528c48cf0254d809ca73ff_cgraph.dot000644 025423 025423 00000001310 14162303417 027307 0ustar00fredianofrediano000000 000000 digraph "default_err_handler" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="default_err_handler",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="default error handler for db-lib (handles library-generated errors)"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_gae1fc46447c4f8a9ff7f66607b8cd23b6_cgraph.dot000644 025423 025423 00000001245 14162303417 027241 0ustar00fredianofrediano000000 000000 digraph "dbsetlname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbsetlname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set the value of a string in a LOGINREC structure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_gaed43cb21ed54dc1a6340075d6290e4b0_cgraph.dot000644 025423 025423 00000001213 14162303417 027101 0ustar00fredianofrediano000000 000000 digraph "dbdead" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbdead",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Check if dbproc is an ex-parrot."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00554_gaf40b925f3b3ba43804720dd4ae584935_cgraph.dot000644 025423 025423 00000001230 14162303417 026761 0ustar00fredianofrediano000000 000000 digraph "dbfirstrow" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dbfirstrow",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="See if a server response has arrived."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00555.html000644 025423 025423 00000010006 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: Unimplemented
    FreeTDS API
    Unimplemented

    Functions thus far not implemented in the FreeTDS db-lib implementation. More...

    Collaboration diagram for Unimplemented:

    Functions thus far not implemented in the FreeTDS db-lib implementation.


    While some of these are simply awaiting someone with time and skill (and inclination) it might be noted here that the old browse functions (e.g. dbcolbrowse()) are on the never-to-do list.
    They were defined by Sybase and were superseded long ago, although they're still present in Microsoft's implementation.
    They were never popular and today better alternatives are available.
    For completeness, they are:

    • dbcolbrowse()
    • dbcolsource()
    • dbfreequal()
    • dbqual()
    • dbtabbrowse()
    • dbtabcount()
    • dbtabname()
    • dbtabsource()
    • dbtsnewlen()
    • dbtsnewval()
    • dbtsput()
    freetds-1.3.6/doc/reference/a00556.dot000644 025423 025423 00000001107 14162303417 020636 0ustar00fredianofrediano000000 000000 digraph "ODBC API" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="ODBC API",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions callable by ODBC client programs."]; Node2 [label="ODBC utility",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00557.html",tooltip="Functions called within ODBC driver."]; Node1->Node2 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00556.html000644 025423 025423 00000007411 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: ODBC API
    FreeTDS API
    ODBC API

    Functions callable by ODBC client programs. More...

    Collaboration diagram for ODBC API:

    Modules

     ODBC utility
     Functions called within ODBC driver.
     

    Detailed Description

    Functions callable by ODBC client programs.

    freetds-1.3.6/doc/reference/a00557.dot000644 025423 025423 00000001113 14162303417 020634 0ustar00fredianofrediano000000 000000 digraph "ODBC utility" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node2 [label="ODBC API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00556.html",tooltip="Functions callable by ODBC client programs."]; Node1 [label="ODBC utility",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions called within ODBC driver."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00557.html000644 025423 025423 00000051043 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: ODBC utility
    FreeTDS API
    ODBC utility

    Functions called within ODBC driver. More...

    Collaboration diagram for ODBC utility:

    Macros

    #define C_TYPES
     
    #define SQL_TYPES
     
    #define TYPE_NORMAL_SQL_C_GUID
     
    #define TYPE_NORMAL_SQL_GUID
     

    Functions

    TDS_SERVER_TYPE odbc_c_to_server_type (int c_type)
     Pass this an SQL_C_* type and get a SYB* type which most closely corresponds to the SQL_C_* type. More...
     
    void odbc_convert_err_set (struct _sql_errors *errs, TDS_INT err)
     
    DSTRodbc_dstr_copy (TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR *str)
     
    SQLSMALLINT odbc_get_concise_c_type (SQLSMALLINT type, SQLSMALLINT interval)
     
    SQLSMALLINT odbc_get_concise_sql_type (SQLSMALLINT type, SQLSMALLINT interval)
     
    SQLLEN odbc_get_octet_len (int c_type, const struct _drecord *drec)
     
    SQLINTEGER odbc_get_param_len (const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row)
     Return length of parameter from parameter information.
     
    unsigned int odbc_get_string_size (int size, const ODBC_CHAR *str _WIDE)
     
    void odbc_rdbms_version (TDSSOCKET *tds, char *pversion_string)
     Returns the version of the RDBMS in the ODBC format.
     
    SQLRETURN odbc_set_concise_c_type (SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
     Set concise type and all cascading field. More...
     
    SQLRETURN odbc_set_concise_sql_type (SQLSMALLINT concise_type, struct _drecord *drec, int check_only)
     Set concise type and all cascading field. More...
     
    void odbc_set_return_params (struct _hstmt *stmt, unsigned int n_row)
     
    void odbc_set_return_status (struct _hstmt *stmt, unsigned int n_row)
     
    int odbc_set_stmt_query (TDS_STMT *stmt, const ODBC_CHAR *sql, int sql_len _WIDE)
     
    SQLRETURN odbc_set_string_flag (TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR *pcbBuffer, const char *s, int len, int flag)
     Copy a string to client setting size according to ODBC convenction. More...
     
    int odbc_sql_to_c_type_default (int sql_type)
     
    TDS_SERVER_TYPE odbc_sql_to_server_type (TDSCONNECTION *conn, int sql_type, int sql_unsigned)
     

    Detailed Description

    Functions called within ODBC driver.

    Function Documentation

    ◆ odbc_c_to_server_type()

    TDS_SERVER_TYPE odbc_c_to_server_type ( int  c_type)

    Pass this an SQL_C_* type and get a SYB* type which most closely corresponds to the SQL_C_* type.

    This function can return XSYBNVARCHAR or SYBUINTx even if server do not support it

    ◆ odbc_set_concise_c_type()

    SQLRETURN odbc_set_concise_c_type ( SQLSMALLINT  concise_type,
    struct _drecord drec,
    int  check_only 
    )

    Set concise type and all cascading field.

    Parameters
    concise_typeconcise type to set
    drecrecord to set. NULL to test error without setting
    check_onlyit <>0 (true) check only, do not set type

    ◆ odbc_set_concise_sql_type()

    SQLRETURN odbc_set_concise_sql_type ( SQLSMALLINT  concise_type,
    struct _drecord drec,
    int  check_only 
    )

    Set concise type and all cascading field.

    Parameters
    concise_typeconcise type to set
    drecrecord to set. NULL to test error without setting
    check_onlyit <>0 (true) check only, do not set type

    ◆ odbc_set_string_flag()

    SQLRETURN odbc_set_string_flag ( TDS_DBC dbc,
    SQLPOINTER  buffer,
    SQLINTEGER  cbBuffer,
    void FAR *  pcbBuffer,
    const char *  s,
    int  len,
    int  flag 
    )

    Copy a string to client setting size according to ODBC convenction.

    Parameters
    dbcdatabase connection. Can be NULL
    bufferclient buffer
    cbBufferclient buffer size (in bytes)
    pcbBufferpointer to SQLSMALLINT to hold string size
    sstring to copy
    lenlen of string to copy. <0 null terminated
    flagset of flags. 0x01 wide string in buffer 0x10 pcbBuffer is SQLINTEGER otherwise SQLSMALLINT 0x20 size is in bytes, not characters
    freetds-1.3.6/doc/reference/a00558.dot000644 025423 025423 00000001105 14162303417 020636 0ustar00fredianofrediano000000 000000 digraph "Authentication" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Authentication",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions for handling authentication."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00558.html000644 025423 025423 00000125030 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Authentication
    FreeTDS API

    Functions for handling authentication. More...

    Collaboration diagram for Authentication:

    Classes

    struct  asn1_der_iterator
     
    struct  mpz_t
     
    struct  names_blob_prefix_t
     
    struct  rsa_public_key
     
    struct  tds_answer
     
    struct  tds_ntlm_auth
     

    Macros

    #define dump(b)   dumpl(b, sizeof(b))
     
    #define dumpl(b, l)   tdsdump_dump_buf(TDS_DBG_INFO1, #b, b, l)
     
    #define hash_func   sha1
     
    #define HAVE_GMP   1
     
    #define HAVE_NETTLE   1
     
    #define mpz_clear(n)   gcry_mpi_release((n)->num)
     
    #define mpz_init(n)   do { (n)->num = NULL; } while(0)
     
    #define mpz_powm(w, n, e, m)    gcry_mpi_powm((w)->num, (n)->num, (e)->num, (m)->num);
     

    Typedefs

    typedef void nettle_random_func(void *ctx, size_t len, uint8_t *out)
     
    typedef struct tds_answer TDSANSWER
     
    typedef struct tds_ntlm_auth TDSNTLMAUTH
     

    Enumerations

    enum  {
      OPT_VERSION = 0x01, OPT_TIMER = 0x02, OPT_NOFOOTER = 0x04, OPT_NOHEADER = 0x08,
      OPT_QUIET = 0x10, OPT_VERBOSE = 0x20, OPT_INSTANCES = 0x40, POS_ISO1,
      POS_UTF8, POS_UCS2LE, POS_UCS2BE, MUL_STARTED = 1,
      ASN1_SEQUENCE = ASN1_TAG_SEQUENCE, CS_USERNAME = 9100, CS_USERNAME = 9100, CS_PASSWORD = 9101,
      CS_PASSWORD = 9101, CS_APPNAME = 9102, CS_APPNAME = 9102, CS_HOSTNAME = 9103,
      CS_HOSTNAME = 9103, CS_LOGIN_STATUS = 9104, CS_LOGIN_STATUS = 9104, CS_TDS_VERSION = 9105,
      CS_TDS_VERSION = 9105, CS_CHARSETCNV = 9106, CS_CHARSETCNV = 9106, CS_PACKETSIZE = 9107,
      CS_PACKETSIZE = 9107, CS_USERDATA = 9108, CS_USERDATA = 9108, CS_NETIO = 9110,
      CS_NETIO = 9110, CS_TEXTLIMIT = 9112, CS_TEXTLIMIT = 9112, CS_HIDDEN_KEYS = 9113,
      CS_HIDDEN_KEYS = 9113, CS_VERSION = 9114, CS_VERSION = 9114, CS_IFILE = 9115,
      CS_IFILE = 9115, CS_LOGIN_TIMEOUT = 9116, CS_LOGIN_TIMEOUT = 9116, CS_TIMEOUT = 9117,
      CS_TIMEOUT = 9117, CS_MAX_CONNECT = 9118, CS_MAX_CONNECT = 9118, CS_EXPOSE_FMTS = 9120,
      CS_EXPOSE_FMTS = 9120, CS_EXTRA_INF = 9121, CS_EXTRA_INF = 9121, CS_ANSI_BINDS = 9123,
      CS_ANSI_BINDS = 9123, CS_BULK_LOGIN = 9124, CS_BULK_LOGIN = 9124, CS_LOC_PROP = 9125,
      CS_LOC_PROP = 9125, CS_PARENT_HANDLE = 9130, CS_PARENT_HANDLE = 9130, CS_EED_CMD = 9131,
      CS_EED_CMD = 9131, CS_DIAG_TIMEOUT = 9132, CS_DIAG_TIMEOUT = 9132, CS_DISABLE_POLL = 9133,
      CS_DISABLE_POLL = 9133, CS_SEC_ENCRYPTION = 9135, CS_SEC_ENCRYPTION = 9135, CS_SEC_CHALLENGE = 9136,
      CS_SEC_CHALLENGE = 9136, CS_SEC_NEGOTIATE = 9137, CS_SEC_NEGOTIATE = 9137, CS_CON_STATUS = 9143,
      CS_CON_STATUS = 9143, CS_VER_STRING = 9144, CS_VER_STRING = 9144, CS_SERVERNAME = 9146,
      CS_SERVERNAME = 9146, CS_SEC_APPDEFINED = 9149, CS_SEC_APPDEFINED = 9149, CS_STICKY_BINDS = 9151,
      CS_STICKY_BINDS = 9151, CS_SEC_NETWORKAUTH = 9175, CS_SEC_NETWORKAUTH = 9175, CS_SEC_DELEGATION = 9176,
      CS_SEC_DELEGATION = 9176, CS_SEC_MUTUALAUTH = 9177, CS_SEC_MUTUALAUTH = 9177, CS_SEC_SERVERPRINCIPAL = 9188,
      CS_SEC_SERVERPRINCIPAL = 9188, CS_SERVERADDR = 9206, CS_SERVERADDR = 9206, CS_PORT = 9300,
      CS_PORT = 9300, CS_CLIENTCHARSET = 9301, CS_CLIENTCHARSET = 9301, CS_DATABASE,
      dblib_msdblib = 0, TDS_CHARSET_ISO_8859_1 = 0, TDS_CHARSET_UTF_8 = 1, TDS_CHARSET_UCS_2LE = 2,
      TDS_CHARSET_UCS_2BE = 3, TDS_CHARSET_ARMSCII_8 = 4, TDS_CHARSET_BIG_5 = 5, TDS_CHARSET_BIG5_HKSCS = 6,
      TDS_CHARSET_C99 = 7, TDS_CHARSET_CHINESE = 8, TDS_CHARSET_CN = 9, TDS_CHARSET_CN_GB = 10,
      TDS_CHARSET_CN_GB_ISOIR165 = 11, TDS_CHARSET_CP1133 = 12, TDS_CHARSET_CP1250 = 13, TDS_CHARSET_CP1251 = 14,
      TDS_CHARSET_CP1252 = 15, TDS_CHARSET_CP1253 = 16, TDS_CHARSET_CP1254 = 17, TDS_CHARSET_CP1255 = 18,
      TDS_CHARSET_CP1256 = 19, TDS_CHARSET_CP1257 = 20, TDS_CHARSET_CP1258 = 21, TDS_CHARSET_CP1361 = 22,
      TDS_CHARSET_CP437 = 23, TDS_CHARSET_CP850 = 24, TDS_CHARSET_CP862 = 25, TDS_CHARSET_CP866 = 26,
      TDS_CHARSET_CP874 = 27, TDS_CHARSET_CP932 = 28, TDS_CHARSET_CP936 = 29, TDS_CHARSET_CP949 = 30,
      TDS_CHARSET_CP950 = 31, TDS_CHARSET_EUC_JP = 32, TDS_CHARSET_EUC_KR = 33, TDS_CHARSET_EUC_TW = 34,
      TDS_CHARSET_GB18030 = 35, TDS_CHARSET_GEORGIAN_ACADEMY = 36, TDS_CHARSET_GEORGIAN_PS = 37, TDS_CHARSET_HZ = 38,
      TDS_CHARSET_ISO_2022_CN = 39, TDS_CHARSET_ISO_2022_CN_EXT = 40, TDS_CHARSET_ISO_2022_JP = 41, TDS_CHARSET_ISO_2022_JP_1 = 42,
      TDS_CHARSET_ISO_2022_JP_2 = 43, TDS_CHARSET_ISO_2022_KR = 44, TDS_CHARSET_ISO_8859_10 = 45, TDS_CHARSET_ISO_8859_13 = 46,
      TDS_CHARSET_ISO_8859_14 = 47, TDS_CHARSET_ISO_8859_15 = 48, TDS_CHARSET_ISO_8859_16 = 49, TDS_CHARSET_ISO_8859_2 = 50,
      TDS_CHARSET_ISO_8859_3 = 51, TDS_CHARSET_ISO_8859_4 = 52, TDS_CHARSET_ISO_8859_5 = 53, TDS_CHARSET_ISO_8859_6 = 54,
      TDS_CHARSET_ISO_8859_7 = 55, TDS_CHARSET_ISO_8859_8 = 56, TDS_CHARSET_ISO_8859_9 = 57, TDS_CHARSET_ISO_IR_14 = 58,
      TDS_CHARSET_ISO_IR_149 = 59, TDS_CHARSET_ISO_IR_159 = 60, TDS_CHARSET_ISO_IR_166 = 61, TDS_CHARSET_ISO_IR_87 = 62,
      TDS_CHARSET_JAVA = 63, TDS_CHARSET_JISX0201_1976 = 64, TDS_CHARSET_KOI8_R = 65, TDS_CHARSET_KOI8_RU = 66,
      TDS_CHARSET_KOI8_T = 67, TDS_CHARSET_KOI8_U = 68, TDS_CHARSET_MAC = 69, TDS_CHARSET_MACARABIC = 70,
      TDS_CHARSET_MACCENTRALEUROPE = 71, TDS_CHARSET_MACCROATIAN = 72, TDS_CHARSET_MACCYRILLIC = 73, TDS_CHARSET_MACGREEK = 74,
      TDS_CHARSET_MACHEBREW = 75, TDS_CHARSET_MACICELAND = 76, TDS_CHARSET_MACROMANIA = 77, TDS_CHARSET_MACTHAI = 78,
      TDS_CHARSET_MACTURKISH = 79, TDS_CHARSET_MACUKRAINE = 80, TDS_CHARSET_MULELAO_1 = 81, TDS_CHARSET_NEXTSTEP = 82,
      TDS_CHARSET_ROMAN8 = 83, TDS_CHARSET_SJIS = 84, TDS_CHARSET_TCVN = 85, TDS_CHARSET_UCS_4BE = 86,
      TDS_CHARSET_UCS_4LE = 87, TDS_CHARSET_US_ASCII = 88, TDS_CHARSET_UTF_16BE = 89, TDS_CHARSET_UTF_16LE = 90,
      TDS_CHARSET_UTF_32BE = 91, TDS_CHARSET_UTF_32LE = 92, TDS_CHARSET_UTF_7 = 93, TDS_CHARSET_VISCII = 94,
      TDS_NUM_CHARSETS = 95, ODBC_PARAM_SIZE, TDS_OPT_ARITHOVERFLOW = 0x01, TDS_OPT_NUMERICTRUNC = 0x02,
      TDS_CUR_ISTAT_UNUSED = 0x00, TDS_CUR_ISTAT_DECLARED = 0x01, TDS_CUR_ISTAT_OPEN = 0x02, TDS_CUR_ISTAT_CLOSED = 0x04,
      TDS_CUR_ISTAT_RDONLY = 0x08, TDS_CUR_ISTAT_UPDATABLE = 0x10, TDS_CUR_ISTAT_ROWCNT = 0x20, TDS_CUR_ISTAT_DEALLOC = 0x40,
      SYBCHAR = 47, SYBCHAR = 47, SYBVARCHAR = 39, SYBVARCHAR = 39,
      SYBINTN = 38, SYBINTN = 38, SYBINT1 = 48, SYBINT1 = 48,
      SYBINT2 = 52, SYBINT2 = 52, SYBINT4 = 56, SYBINT4 = 56,
      SYBINT8 = 127, SYBINT8 = 127, SYBFLT8 = 62, SYBFLT8 = 62,
      SYBDATETIME = 61, SYBDATETIME = 61, SYBBIT = 50, SYBBIT = 50,
      SYBBITN = 104, SYBBITN = 104, SYBTEXT = 35, SYBTEXT = 35,
      SYBNTEXT = 99, SYBNTEXT = 99, SYBIMAGE = 34, SYBIMAGE = 34,
      SYBMONEY4 = 122, SYBMONEY4 = 122, SYBMONEY = 60, SYBMONEY = 60,
      SYBDATETIME4 = 58, SYBDATETIME4 = 58, SYBREAL = 59, SYBREAL = 59,
      SYBBINARY = 45, SYBBINARY = 45, SYBVOID = 31, SYBVOID = 31,
      SYBVARBINARY = 37, SYBVARBINARY = 37, SYBNUMERIC = 108, SYBNUMERIC = 108,
      SYBDECIMAL = 106, SYBDECIMAL = 106, SYBFLTN = 109, SYBFLTN = 109,
      SYBMONEYN = 110, SYBMONEYN = 110, SYBDATETIMN = 111, SYBDATETIMN = 111,
      SYBNVARCHAR = 103, SYBNVARCHAR = 103, SYBDATE = 49, SYBDATE = 49,
      SYBTIME = 51, SYBTIME = 51, SYBBIGDATETIME = 187, SYBBIGDATETIME = 187,
      SYBBIGTIME = 188, SYBBIGTIME = 188, SYBMSDATE = 40, SYBMSDATE = 40,
      SYBMSTIME = 41, SYBMSTIME = 41, SYBMSDATETIME2 = 42, SYBMSDATETIME2 = 42,
      SYBMSDATETIMEOFFSET = 43, SYBMSDATETIMEOFFSET = 43
    }
     
    enum  {
      hash_len = 20, CS_ADD = 1, CS_SUB, CS_MULT,
      CS_DIV, TDS_SMP_SYN = 1, TDS_SMP_ACK = 2, TDS_SMP_FIN = 4,
      TDS_SMP_DATA = 8, TDS_TYPEFLAG_INVALID = 0, TDS_TYPEFLAG_NULLABLE = 1, TDS_TYPEFLAG_FIXED = 2,
      TDS_TYPEFLAG_VARIABLE = 4, TDS_TYPEFLAG_COLLATE = 8, TDS_TYPEFLAG_ASCII = 16, TDS_TYPEFLAG_UNICODE = 32,
      TDS_TYPEFLAG_BINARY = 64, TDS_TYPEFLAG_DATETIME = 128, TDS_TYPEFLAG_NUMERIC = 256, TDS_TYPEFLAG_VARIANT = 512,
      MAXCOLNAMELEN = 512
    }
     
    enum  {
      key_size_max = 1024, CS_TDS_AUTO = 0, CS_TDS_AUTO = 0, CS_TDS_40 = 7360,
      CS_TDS_42, CS_TDS_46, CS_TDS_495, CS_TDS_50,
      CS_TDS_70, CS_TDS_71, CS_TDS_71, CS_TDS_72,
      CS_TDS_72, CS_TDS_73, CS_TDS_73, CS_TDS_74,
      CS_TDS_74, TDS_CUR_TYPE_KEYSET = 0x0001, TDS_CUR_TYPE_DYNAMIC = 0x0002, TDS_CUR_TYPE_FORWARD = 0x0004,
      TDS_CUR_TYPE_STATIC = 0x0008, TDS_CUR_TYPE_FASTFORWARDONLY = 0x0010, TDS_CUR_TYPE_PARAMETERIZED = 0x1000, TDS_CUR_TYPE_AUTO_FETCH = 0x2000
    }
     
    enum  asn1_iterator_result { ASN1_ITERATOR_ERROR, ASN1_ITERATOR_PRIMITIVE, ASN1_ITERATOR_CONSTRUCTED, ASN1_ITERATOR_END }
     

    Functions

    static enum asn1_iterator_result asn1_der_iterator_first (struct asn1_der_iterator *der, int size, const void *der_buf)
     
    static enum asn1_iterator_result asn1_der_iterator_next (struct asn1_der_iterator *der)
     
    static void convert_to_upper (char *buf, size_t len)
     
    static size_t convert_to_usc2le_string (TDSSOCKET *tds, const char *s, size_t len, char *out)
     
    static void fill_names_blob_prefix (names_blob_prefix_t *prefix)
     
    static unsigned char * make_lm_v2_response (const unsigned char ntlm_v2_hash[16], const unsigned char *client_data, int client_data_len, const unsigned char challenge[8])
     
    static TDSRET make_ntlm_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_hash[16])
     
    static TDSRET make_ntlm_v2_hash (TDSSOCKET *tds, const char *passwd, unsigned char ntlm_v2_hash[16])
     
    static void memxor (uint8_t *dest, const uint8_t *src, size_t len)
     
    static void mgf_mask (uint8_t *dest, size_t dest_len, const uint8_t *mask, size_t mask_len)
     
    static void nettle_mpz_get_str_256 (unsigned length, uint8_t *s, const mpz_t x)
     
    static void nettle_mpz_set_str_256_u (mpz_t x, unsigned length, const uint8_t *s)
     
    static int oaep_encrypt (size_t key_size, void *random_ctx, nettle_random_func *random, size_t length, const uint8_t *message, mpz_t m)
     
    static void rnd_func (void *ctx, size_t len, uint8_t *out)
     
    static int rsa_encrypt_oaep (const struct rsa_public_key *key, void *random_ctx, nettle_random_func *random, size_t length, const uint8_t *message, mpz_t gibberish)
     
    static const BIGNUM * rsa_get_n (const RSA *rsa)
     
    static void rsa_public_key_clear (struct rsa_public_key *key)
     
    static int rsa_public_key_from_der_iterator (struct rsa_public_key *key, unsigned key_bits, struct asn1_der_iterator *der)
     
    static void rsa_public_key_init (struct rsa_public_key *key)
     
    static void sha1 (uint8_t *hash, const void *data, size_t len)
     
    TDSAUTHENTICATIONtds5_negotiate_get_auth (TDSSOCKET *tds)
     
    static void * tds5_rsa_encrypt (const void *key, size_t key_len, const void *nonce, size_t nonce_len, const char *pwd, size_t *em_size)
     
    static TDSRET tds7_send_auth (TDSSOCKET *tds, const unsigned char *challenge, uint32_t flags, const unsigned char *names_blob, int names_blob_len)
     
    static TDSRET tds_answer_challenge (TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
     Crypt a given password using schema required for NTLMv1 or NTLM2 authentication. More...
     
    static TDSRET tds_answer_challenge_ntlmv2 (TDSSOCKET *tds, TDSLOGIN *login, const unsigned char *challenge, uint32_t *flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER *answer, unsigned char **ntlm_v2_response)
     
    static void tds_convert_key (const unsigned char *key_56, DES_KEY *ks)
     
    static void tds_encrypt_answer (const unsigned char *hash, const unsigned char *challenge, unsigned char *answer)
     
    static TDSRET tds_ntlm_free (TDSCONNECTION *conn, TDSAUTHENTICATION *tds_auth)
     
    TDSAUTHENTICATIONtds_ntlm_get_auth (TDSSOCKET *tds)
     Build a NTLMSPP packet to send to server. More...
     
    static TDSRET tds_ntlm_handle_next (TDSSOCKET *tds, struct tds_authentication *auth, size_t len)
     
    static void unix_to_nt_time (uint64_t *nt, struct timeval *tv)
     put a 8 byte filetime from a time_t This takes GMT as input
     

    Variables

    static const char label [] = ""
     
    static const unsigned char ntlm_id [] = "NTLMSSP"
     

    Detailed Description

    Functions for handling authentication.

    Function Documentation

    ◆ tds_answer_challenge()

    static TDSRET tds_answer_challenge ( TDSSOCKET tds,
    TDSLOGIN login,
    const unsigned char *  challenge,
    uint32_t *  flags,
    const unsigned char *  names_blob,
    int  names_blob_len,
    TDSANSWER answer,
    unsigned char **  ntlm_v2_response 
    )
    static

    Crypt a given password using schema required for NTLMv1 or NTLM2 authentication.

    Parameters
    passwdclear text domain password
    challengechallenge data given by server
    flagsNTLM flags from server side
    answerbuffer where to store crypted password
    Here is the call graph for this function:

    ◆ tds_ntlm_get_auth()

    TDSAUTHENTICATION* tds_ntlm_get_auth ( TDSSOCKET tds)

    Build a NTLMSPP packet to send to server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Returns
    authentication info
    Here is the call graph for this function:
    freetds-1.3.6/doc/reference/a00559.dot000644 025423 025423 00000001075 14162303417 020645 0ustar00fredianofrediano000000 000000 digraph "Configuration" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Configuration",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Handle reading of configuration."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00559.html000644 025423 025423 00000115641 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: Configuration
    FreeTDS API

    Handle reading of configuration. More...

    Collaboration diagram for Configuration:

    Classes

    struct  tdsvername_t
     

    Macros

    #define TDS_FIND(k, b, c)   tds_find(k, b, TDS_VECTOR_SIZE(b), sizeof(b[0]), c)
     

    Functions

    static int hex2num (char *hex)
     
    static int hexdigit (int c)
     
    static int parse_server_name_for_port (TDSLOGIN *connection, TDSLOGIN *login, bool update_server)
     Check the server name to find port info first Warning: connection-> & login-> are all modified when needed. More...
     
    static int search_interface_file (TDSLOGIN *login, const char *dir, const char *file, const char *host)
     Open and read the file 'file' searching for a logical server by the name of 'host'. More...
     
    int tds_config_boolean (const char *option, const char *value, TDSLOGIN *login)
     
    static void tds_config_encryption (const char *value, TDSLOGIN *login)
     
    static int tds_config_env_tdsdump (TDSLOGIN *login)
     
    static int tds_config_env_tdshost (TDSLOGIN *login)
     
    static void tds_config_env_tdsport (TDSLOGIN *login)
     
    static void tds_config_env_tdsver (TDSLOGIN *login)
     
    static int tds_config_login (TDSLOGIN *connection, TDSLOGIN *login)
     
    TDS_USMALLINT * tds_config_verstr (const char *tdsver, TDSLOGIN *login)
     Set TDS version from given string. More...
     
    static const void * tds_find (const void *key, const void *base, size_t nelem, size_t width, int(*compar)(const void *, const void *))
     
    void tds_fix_login (TDSLOGIN *login)
     Fix configuration after reading it. More...
     
    const TDS_COMPILETIME_SETTINGStds_get_compiletime_settings (void)
     Return a structure capturing the compile-time settings provided to the configure script. More...
     
    char * tds_get_home_file (const char *file)
     Return filename from HOME directory. More...
     
    struct addrinfo * tds_lookup_host (const char *servername)
     Get the IP address for a hostname. More...
     
    TDSRET tds_lookup_host_set (const char *servername, struct addrinfo **addr)
     
    static int tds_lookup_port (const char *portname)
     Given a portname lookup the port. More...
     
    int tds_parse_boolean (const char *value, int default_value)
     
    void tds_parse_conf_section (const char *option, const char *value, void *param)
     
    bool tds_read_conf_file (TDSLOGIN *login, const char *server)
     Read configuration info for given server return 0 on error. More...
     
    bool tds_read_conf_section (FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
     Read a section of configuration file (INI style file) More...
     
    static bool tds_read_conf_sections (FILE *in, const char *server, TDSLOGIN *login)
     
    TDSLOGINtds_read_config_info (TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
     tds_read_config_info() will fill the tds connection structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values More...
     
    static int tds_read_interfaces (const char *server, TDSLOGIN *login)
     Try to find the IP number and port for a (possibly) logical server name. More...
     
    TDSRET tds_set_interfaces_file_loc (const char *interf)
     Set the full name of interface file. More...
     
    static bool tds_try_conf_file (const char *path, const char *how, const char *server, TDSLOGIN *login)
     
    static int tds_vername_cmp (const void *key, const void *pelem)
     

    Variables

    struct {
       unsigned char   to_return
     
       char   value [7]
     
    boolean_values []
     

    Detailed Description

    Handle reading of configuration.

    Function Documentation

    ◆ parse_server_name_for_port()

    static int parse_server_name_for_port ( TDSLOGIN connection,
    TDSLOGIN login,
    bool  update_server 
    )
    static

    Check the server name to find port info first Warning: connection-> & login-> are all modified when needed.

    Returns
    1 when found, else 0
    Here is the call graph for this function:

    ◆ search_interface_file()

    static int search_interface_file ( TDSLOGIN login,
    const char *  dir,
    const char *  file,
    const char *  host 
    )
    static

    Open and read the file 'file' searching for a logical server by the name of 'host'.

    If one is found then lookup the IP address and port number and store them in 'login'

    Parameters
    dirname of base directory for interface file
    filename of the interface file
    hostlogical host to search for
    Returns
    0 if not fount 1 if found
    Here is the call graph for this function:

    ◆ tds_config_verstr()

    TDS_USMALLINT* tds_config_verstr ( const char *  tdsver,
    TDSLOGIN login 
    )

    Set TDS version from given string.

    Parameters
    tdsvertds string version
    loginwhere to store information
    Returns
    as encoded hex value: high nybble major, low nybble minor.

    ◆ tds_fix_login()

    void tds_fix_login ( TDSLOGIN login)

    Fix configuration after reading it.

    Currently this read some environment variables and replace some options.

    ◆ tds_get_compiletime_settings()

    const TDS_COMPILETIME_SETTINGS* tds_get_compiletime_settings ( void  )

    Return a structure capturing the compile-time settings provided to the configure script.


    ◆ tds_get_home_file()

    char* tds_get_home_file ( const char *  file)

    Return filename from HOME directory.

    Returns
    allocated string or NULL if error

    ◆ tds_lookup_host()

    struct addrinfo* tds_lookup_host ( const char *  servername)

    Get the IP address for a hostname.

    Store server's IP address in the string 'ip' in dotted-decimal notation. (The "hostname" might itself be a dotted-decimal address.

    If we can't determine the IP address then 'ip' will be set to empty string.

    ◆ tds_lookup_port()

    static int tds_lookup_port ( const char *  portname)
    static

    Given a portname lookup the port.

    If we can't determine the port number then return 0.

    ◆ tds_read_conf_file()

    bool tds_read_conf_file ( TDSLOGIN login,
    const char *  server 
    )

    Read configuration info for given server return 0 on error.

    Parameters
    loginwhere to store configuration
    serversection of file configuration that hold configuration for a server

    ◆ tds_read_conf_section()

    bool tds_read_conf_section ( FILE *  in,
    const char *  section,
    TDSCONFPARSE  tds_conf_parse,
    void *  param 
    )

    Read a section of configuration file (INI style file)

    Parameters
    inconfiguration file
    sectionsection to read
    tds_conf_parsecallback that receive every entry in section
    paramparameter to pass to callback function

    ◆ tds_read_config_info()

    TDSLOGIN* tds_read_config_info ( TDSSOCKET tds,
    TDSLOGIN login,
    TDSLOCALE locale 
    )

    tds_read_config_info() will fill the tds connection structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values

    .tdsrc and freetds.conf have been added to make the package easier to integration with various Linux and *BSD distributions.

    ◆ tds_read_interfaces()

    static int tds_read_interfaces ( const char *  server,
    TDSLOGIN login 
    )
    static

    Try to find the IP number and port for a (possibly) logical server name.

    Note
    This function uses only the interfaces file and is deprecated.
    Here is the call graph for this function:

    ◆ tds_set_interfaces_file_loc()

    TDSRET tds_set_interfaces_file_loc ( const char *  interf)

    Set the full name of interface file.

    Parameters
    interffile name

    Variable Documentation

    ◆ boolean_values

    const { ... } boolean_values[]
    Initial value:
    = {
    { "yes", 1 },
    { "no", 0 },
    { "on", 1 },
    { "off", 0 },
    { "true", 1 },
    { "false", 0 }
    }
    freetds-1.3.6/doc/reference/a00558_ga679f2d22b4a4bdefe0fa475d63503778_cgraph.dot000644 025423 025423 00000001753 14162303417 027153 0ustar00fredianofrediano000000 000000 digraph "tds_ntlm_get_auth" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_ntlm_get_auth",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Build a NTLMSPP packet to send to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_cstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga5f351a208e7aa13b4cc2d32cac8fc0fa",tooltip="Returns a C version (NUL terminated string) of dstr."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_dstr_len",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga396f139e4f886ac1b224a735138e73dd",tooltip="Returns the length of the string in bytes."]; } freetds-1.3.6/doc/reference/a00558_ga8adf4e719762fef6fdb091d15d4d5d7f_cgraph.dot000644 025423 025423 00000001355 14162303417 027405 0ustar00fredianofrediano000000 000000 digraph "tds_answer_challenge" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_answer_challenge",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Crypt a given password using schema required for NTLMv1 or NTLM2 authentication."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_cstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga5f351a208e7aa13b4cc2d32cac8fc0fa",tooltip="Returns a C version (NUL terminated string) of dstr."]; } freetds-1.3.6/doc/reference/a00559_ga6631af35ee817f93827c62bbda41674a_cgraph.dot000644 025423 025423 00000001315 14162303417 027064 0ustar00fredianofrediano000000 000000 digraph "tds_read_interfaces" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_read_interfaces",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Try to find the IP number and port for a (possibly) logical server name."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00559_ga82ac44924fb1ae41042c233573a4ac8d_cgraph.dot000644 025423 025423 00000002665 14162303417 027044 0ustar00fredianofrediano000000 000000 digraph "parse_server_name_for_port" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="parse_server_name_for_port",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Check the server name to find port info first Warning: connection-> & login-> are all modified when n..."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_copy",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#gad96366d9fa93bfc283cef1299fbe97ab",tooltip="copy a string from another"]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_dstr_copyn",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga656718f240d7403f986ae887d84a6ca1",tooltip="Set string to a given buffer of characters."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_dstr_cstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga5f351a208e7aa13b4cc2d32cac8fc0fa",tooltip="Returns a C version (NUL terminated string) of dstr."]; } freetds-1.3.6/doc/reference/a00559_gaca20b6e5f5a5ac1727126712dd39564b_cgraph.dot000644 025423 025423 00000001334 14162303417 027044 0ustar00fredianofrediano000000 000000 digraph "search_interface_file" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="search_interface_file",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Open and read the file 'file' searching for a logical server by the name of 'host'."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00560.dot000644 025423 025423 00000001065 14162303417 020634 0ustar00fredianofrediano000000 000000 digraph "Conversion" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Conversion",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Conversions between datatypes."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00560.html000644 025423 025423 00000166200 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Conversion
    FreeTDS API

    Conversions between datatypes. More...

    Collaboration diagram for Conversion:

    Macros

    #define CASE_ALL_BINARY
     
    #define CASE_ALL_CHAR    SYBCHAR: case SYBVARCHAR: case SYBTEXT: case XSYBCHAR: case XSYBVARCHAR
     
    #define is_monthname(s)   (store_monthname(s, NULL) >= 0)
     

    Functions

    static TDS_INT binary_to_result (int desttype, const void *data, size_t len, CONV_RESULT *cr)
     Copy binary data to to result and return len or TDS_CONVERT_NOMEM.
     
    static bool is_alphabetic (const char *)
     
    static bool is_ampm (const char *)
     
    static bool is_dd_mon_yyyy (char *t)
     
    static bool is_numeric (const char *)
     
    static bool is_numeric_dateformat (const char *)
     
    static bool is_timeformat (const char *)
     
    static TDS_INT parse_int8 (const char *buf, const char *pend, TDS_UINT8 *res, bool *p_negative)
     convert a number in string to TDS_INT8 More...
     
    static const char * parse_numeric (const char *buf, const char *pend, bool *p_negative, size_t *p_digits, size_t *p_decimals)
     Parse a string for numbers. More...
     
    static int store_dd_mon_yyy_date (char *datestr, struct tds_time *t)
     
    static int store_hour (const char *, const char *, struct tds_time *)
     
    static int store_mday (const char *, struct tds_time *)
     
    static int store_monthname (const char *datestr, struct tds_time *t)
     Test if a string is a month name and store correct month number. More...
     
    static int store_numeric_date (const char *, struct tds_time *)
     
    static int store_time (const char *, struct tds_time *)
     
    static int store_year (int, struct tds_time *)
     
    static int store_yymmdd_date (const char *, struct tds_time *)
     
    static int string_to_datetime (const char *datestr, TDS_UINT len, int desttype, CONV_RESULT *cr)
     
    static TDS_INT string_to_float (const TDS_CHAR *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
     
    static TDS_INT string_to_int (const char *buf, const char *pend, TDS_INT *res)
     convert a number in string to TDS_INT More...
     
    static TDS_INT string_to_int8 (const char *buf, const char *pend, TDS_INT8 *res)
     convert a number in string to TDS_INT8 More...
     
    static int string_to_numeric (const char *instr, const char *pend, CONV_RESULT *cr)
     convert a number in string to a TDSNUMERIC More...
     
    static TDS_INT string_to_result (int desttype, const char *s, CONV_RESULT *cr)
     Copy a terminated string to result and return len or TDS_CONVERT_NOMEM.
     
    static TDS_INT string_to_uint8 (const char *buf, const char *pend, TDS_UINT8 *res)
     convert a number in string to TDS_UINT8 More...
     
    static int stringz_to_numeric (const char *instr, CONV_RESULT *cr)
     convert a zero terminated string to NUMERIC More...
     
    TDS_INT tds_char2hex (TDS_CHAR *dest, TDS_UINT destlen, const TDS_CHAR *src, TDS_UINT srclen)
     
    TDS_INT tds_convert (const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
     tds_convert convert a type to another. More...
     
    static TDS_INT tds_convert_bigdatetime (const TDSCONTEXT *tds_ctx, const TDS_BIGDATETIME *bigdatetime, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_bigtime (const TDSCONTEXT *tds_ctx, const TDS_BIGTIME *bigtime, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_binary (const TDS_UCHAR *src, TDS_INT srclen, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_bit (const TDS_CHAR *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_char (const TDS_CHAR *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_date (const TDSCONTEXT *tds_ctx, const TDS_DATE *date, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_datetime (const TDSCONTEXT *tds_ctx, const TDS_DATETIME *dt, int desttype, unsigned precision, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_datetime4 (const TDSCONTEXT *tds_ctx, const TDS_DATETIME4 *dt4, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_datetimeall (const TDSCONTEXT *tds_ctx, int srctype, const TDS_DATETIMEALL *dta, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_flt8 (const TDS_FLOAT *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_int (TDS_INT num, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_int1 (const TDS_TINYINT *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_int2 (const TDS_SMALLINT *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_int4 (const TDS_INT *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_int8 (const TDS_INT8 *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_int8_numeric (unsigned char scale, unsigned char sign, TDS_UINT8 num, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_int_numeric (unsigned char scale, unsigned char sign, TDS_UINT num, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_money (const TDSCONTEXT *tds_ctx, const TDS_MONEY *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_money4 (const TDSCONTEXT *tds_ctx, const TDS_MONEY4 *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_numeric (const TDS_NUMERIC *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_real (const TDS_REAL *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_time (const TDSCONTEXT *tds_ctx, const TDS_TIME *time, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_to_binary (int srctype, const TDS_CHAR *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_uint2 (const TDS_USMALLINT *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_uint4 (const TDS_UINT *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_uint8 (const TDS_UINT8 *src, int desttype, CONV_RESULT *cr)
     
    static TDS_INT tds_convert_unique (const TDS_CHAR *src, int desttype, CONV_RESULT *cr)
     
    TDSRET tds_datecrack (TDS_INT datetype, const void *di, TDSDATEREC *dr)
     Convert from db date format to a structured date format. More...
     
    TDS_SERVER_TYPE tds_get_null_type (TDS_SERVER_TYPE srctype)
     Get same type but nullable. More...
     
    size_t tds_strftime (char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec)
     format a date string according to an "extended" strftime(3) formatting definition. More...
     
    unsigned char tds_willconvert (int srctype, int desttype)
     Test if a conversion is possible. More...
     
    static void two_digit (char *out, int num)
     

    Variables

    const char tds_hex_digits [] = "0123456789abcdef"
     

    Detailed Description

    Conversions between datatypes.

    Supports, for example, dbconvert().

    Macro Definition Documentation

    ◆ CASE_ALL_BINARY

    #define CASE_ALL_BINARY
    Value:
    SYBBINARY: case SYBVARBINARY: case SYBIMAGE: case XSYBBINARY: case XSYBVARBINARY: \
    case SYBLONGBINARY: case TDS_CONVERT_BINARY

    Function Documentation

    ◆ parse_int8()

    static TDS_INT parse_int8 ( const char *  buf,
    const char *  pend,
    TDS_UINT8 *  res,
    bool *  p_negative 
    )
    static

    convert a number in string to TDS_INT8

    Returns
    TDS_CONVERT_* or failure code on error
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ parse_numeric()

    static const char * parse_numeric ( const char *  buf,
    const char *  pend,
    bool *  p_negative,
    size_t *  p_digits,
    size_t *  p_decimals 
    )
    static

    Parse a string for numbers.

    Syntax can be something like " *[+-] *[0-9]*\.[0-9]* *".

    The function ignore all spaces. It strips leading zeroes which could possibly lead to overflow. The function returns a pointer to the integer part followed by *p_digits digits followed by a dot followed by *p_decimals digits (dot and fractional digits are optional, in this case *p_decimals is 0).

    Parameters
    bufstart of string
    pendpointer to string end
    p_negativestore if number is negative
    p_digitsstore number of integer digits
    p_decimalsstore number of fractional digits
    Returns
    pointer to first not zero digit. If NULL this indicate a syntax error.
    Here is the caller graph for this function:

    ◆ store_monthname()

    static int store_monthname ( const char *  datestr,
    struct tds_time t 
    )
    static

    Test if a string is a month name and store correct month number.

    Returns
    month number (0-11) or -1 if not match
    Parameters
    datestrstring to check
    twhere to store month (if NULL no store is done)
    Here is the call graph for this function:

    ◆ string_to_int()

    static TDS_INT string_to_int ( const char *  buf,
    const char *  pend,
    TDS_INT *  res 
    )
    static

    convert a number in string to TDS_INT

    Returns
    TDS_CONVERT_* or failure code on error
    Remarks
    Sybase's char->int conversion tolerates embedded blanks, such that "convert( int, ' - 13 ' )" works.
    If we find blanks, we copy the string to a temporary buffer, skipping the blanks.
    We return the results of atoi() with a clean string.

    n.b. it is possible to embed all sorts of non-printable characters, but we only check for spaces. at this time, no one on the project has tested anything else.

    Here is the call graph for this function:

    ◆ string_to_int8()

    static TDS_INT string_to_int8 ( const char *  buf,
    const char *  pend,
    TDS_INT8 *  res 
    )
    static

    convert a number in string to TDS_INT8

    Returns
    TDS_CONVERT_* or failure code on error
    Here is the call graph for this function:

    ◆ string_to_numeric()

    static int string_to_numeric ( const char *  instr,
    const char *  pend,
    CONV_RESULT cr 
    )
    static

    convert a number in string to a TDSNUMERIC

    Returns
    sizeof(TDS_NUMERIC) on success, TDS_CONVERT_* failure code on failure
    Here is the caller graph for this function:

    ◆ string_to_uint8()

    static TDS_INT string_to_uint8 ( const char *  buf,
    const char *  pend,
    TDS_UINT8 *  res 
    )
    static

    convert a number in string to TDS_UINT8

    Returns
    TDS_CONVERT_* or failure code on error
    Here is the call graph for this function:

    ◆ stringz_to_numeric()

    static int stringz_to_numeric ( const char *  instr,
    CONV_RESULT cr 
    )
    static

    convert a zero terminated string to NUMERIC

    Returns
    sizeof(TDS_NUMERIC) on success, TDS_CONVERT_* failure code on failure
    Here is the call graph for this function:

    ◆ tds_convert()

    TDS_INT tds_convert ( const TDSCONTEXT tds_ctx,
    int  srctype,
    const void *  src,
    TDS_UINT  srclen,
    int  desttype,
    CONV_RESULT cr 
    )

    tds_convert convert a type to another.

    If you convert to SYBDECIMAL/SYBNUMERIC you MUST initialize precision and scale of cr. Do not expect strings to be zero terminated. Databases support zero inside string. Using strlen may result on data loss or even a segmentation fault. Instead, use memcpy to copy destination using length returned. This function does not handle NULL, srclen should be >0. Client libraries handle NULLs each in their own way.

    Parameters
    tds_ctxcontext (used in conversion to data and to return messages)
    srctypetype of source
    srcpointer to source data to convert
    srclenlength in bytes of source (not counting terminator or strings)
    desttypetype of destination
    crstructure to hold result
    Returns
    length of result or TDS_CONVERT_* failure code on failure. All TDS_CONVERT_* constants are <0.

    ◆ tds_datecrack()

    TDSRET tds_datecrack ( TDS_INT  datetype,
    const void *  di,
    TDSDATEREC dr 
    )

    Convert from db date format to a structured date format.

    Parameters
    datetypesource date type. SYBDATETIME or SYBDATETIME4
    disource date
    drdestination date
    Returns
    TDS_FAIL or TDS_SUCCESS

    ◆ tds_get_null_type()

    TDS_SERVER_TYPE tds_get_null_type ( TDS_SERVER_TYPE  srctype)

    Get same type but nullable.

    Parameters
    srctypetype requires
    Returns
    nullable type

    ◆ tds_strftime()

    size_t tds_strftime ( char *  buf,
    size_t  maxsize,
    const char *  format,
    const TDSDATEREC dr,
    int  prec 
    )

    format a date string according to an "extended" strftime(3) formatting definition.

    Parameters
    bufoutput buffer
    maxsizesize of buffer in bytes (space include terminator)
    formatformat string passed to strftime(3), except that z represents fraction of seconds.
    drdate to convert
    precsecond fraction precision (0-7).
    Returns
    length of string returned, 0 for error

    ◆ tds_willconvert()

    unsigned char tds_willconvert ( int  srctype,
    int  desttype 
    )

    Test if a conversion is possible.

    Parameters
    srctypesource type
    desttypedestination type
    Returns
    0 if not convertible
    Here is the call graph for this function:
    freetds-1.3.6/doc/reference/a00560_ga0176fafd412b5b8005bf1202fbc13b00_cgraph.dot000644 025423 025423 00000001233 14162303417 027056 0ustar00fredianofrediano000000 000000 digraph "string_to_int" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="string_to_int",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="convert a number in string to TDS_INT"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="parse_numeric",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga53a19b5da172ff364d01e8f04b97015a",tooltip="Parse a string for numbers."]; } freetds-1.3.6/doc/reference/a00560_ga17a0597ec3522c7f1ddb54956226dbfc_cgraph.dot000644 025423 025423 00000001275 14162303417 027135 0ustar00fredianofrediano000000 000000 digraph "store_monthname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="store_monthname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Test if a string is a month name and store correct month number."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00561.dot000644 025423 025423 00000001112 14162303417 020626 0ustar00fredianofrediano000000 000000 digraph "Charset conversion" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Charset conversion",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Convert between different charsets."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00560_ga28c75aff2615032005257af7455ed70d_icgraph.dot000644 025423 025423 00000001310 14162303417 027045 0ustar00fredianofrediano000000 000000 digraph "string_to_numeric" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="string_to_numeric",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="convert a number in string to a TDSNUMERIC"]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="stringz_to_numeric",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga467401163bf05ed167f7b2b7e8bd875a",tooltip="convert a zero terminated string to NUMERIC"]; } freetds-1.3.6/doc/reference/a00560_ga467401163bf05ed167f7b2b7e8bd875a_cgraph.dot000644 025423 025423 00000001276 14162303417 027061 0ustar00fredianofrediano000000 000000 digraph "stringz_to_numeric" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="stringz_to_numeric",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="convert a zero terminated string to NUMERIC"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="string_to_numeric",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga28c75aff2615032005257af7455ed70d",tooltip="convert a number in string to a TDSNUMERIC"]; } freetds-1.3.6/doc/reference/a00560_ga53a19b5da172ff364d01e8f04b97015a_icgraph.dot000644 025423 025423 00000003100 14162303417 027177 0ustar00fredianofrediano000000 000000 digraph "parse_numeric" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="parse_numeric",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Parse a string for numbers."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="parse_int8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#gace939c1fa676d172cb0cae94848b7fac",tooltip="convert a number in string to TDS_INT8"]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="string_to_int8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga933f87cca76156648e91f472650b98f3",tooltip="convert a number in string to TDS_INT8"]; Node2 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="string_to_uint8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#gae8e173a9f8d2e3f152ada9f48d3d5f28",tooltip="convert a number in string to TDS_UINT8"]; Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="string_to_int",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga0176fafd412b5b8005bf1202fbc13b00",tooltip="convert a number in string to TDS_INT"]; } freetds-1.3.6/doc/reference/a00560_ga80487b313213f60d8be71a50a002bb2c_cgraph.dot000644 025423 025423 00000001236 14162303417 026732 0ustar00fredianofrediano000000 000000 digraph "tds_willconvert" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_willconvert",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Test if a conversion is possible."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00560_ga933f87cca76156648e91f472650b98f3_cgraph.dot000644 025423 025423 00000001703 14162303417 026665 0ustar00fredianofrediano000000 000000 digraph "string_to_int8" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="string_to_int8",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="convert a number in string to TDS_INT8"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="parse_int8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#gace939c1fa676d172cb0cae94848b7fac",tooltip="convert a number in string to TDS_INT8"]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="parse_numeric",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga53a19b5da172ff364d01e8f04b97015a",tooltip="Parse a string for numbers."]; } freetds-1.3.6/doc/reference/a00560_gace939c1fa676d172cb0cae94848b7fac_cgraph.dot000644 025423 025423 00000001226 14162303417 027361 0ustar00fredianofrediano000000 000000 digraph "parse_int8" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="parse_int8",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="convert a number in string to TDS_INT8"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="parse_numeric",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga53a19b5da172ff364d01e8f04b97015a",tooltip="Parse a string for numbers."]; } freetds-1.3.6/doc/reference/a00560_gace939c1fa676d172cb0cae94848b7fac_icgraph.dot000644 025423 025423 00000001743 14162303417 027536 0ustar00fredianofrediano000000 000000 digraph "parse_int8" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="parse_int8",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="convert a number in string to TDS_INT8"]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="string_to_int8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga933f87cca76156648e91f472650b98f3",tooltip="convert a number in string to TDS_INT8"]; Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="string_to_uint8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#gae8e173a9f8d2e3f152ada9f48d3d5f28",tooltip="convert a number in string to TDS_UINT8"]; } freetds-1.3.6/doc/reference/a00560_gae8e173a9f8d2e3f152ada9f48d3d5f28_cgraph.dot000644 025423 025423 00000001706 14162303417 027313 0ustar00fredianofrediano000000 000000 digraph "string_to_uint8" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="string_to_uint8",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="convert a number in string to TDS_UINT8"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="parse_int8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#gace939c1fa676d172cb0cae94848b7fac",tooltip="convert a number in string to TDS_INT8"]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="parse_numeric",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html#ga53a19b5da172ff364d01e8f04b97015a",tooltip="Parse a string for numbers."]; } freetds-1.3.6/doc/reference/a00561.html000644 025423 025423 00000117201 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Charset conversion
    FreeTDS API

    Convert between different charsets. More...

    Collaboration diagram for Charset conversion:

    Macros

    #define CHUNK_ALLOC   4
     

    Typedefs

    typedef uint32_t ICONV_CHAR
     
    typedef int(* iconv_get_t) (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    typedef int(* iconv_put_t) (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     

    Enumerations

    enum  ICONV_CD_VALUE { Like_to_Like = 0x100 }
     

    Functions

    static void _iconv_close (iconv_t *cd)
     
    static int collate2charset (TDSCONNECTION *conn, TDS_UCHAR collate[5])
     
    static int get_ascii (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_cp1252 (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_err (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_iso1 (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_ucs4be (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_ucs4le (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_utf16be (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_utf16le (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_utf8 (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int put_ascii (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_cp1252 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_err (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_iso1 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_ucs4be (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_ucs4le (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_utf16be (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_utf16le (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_utf8 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static size_t skip_one_input_sequence (iconv_t cd, const TDS_ENCODING *charset, const char **input, size_t *input_size)
     Move the input sequence pointer to the next valid position. More...
     
    void tds7_srv_charset_changed (TDSCONNECTION *conn, TDS_UCHAR collation[5])
     
    int tds_canonical_charset (const char *charset_name)
     Determine canonical iconv character set. More...
     
    const char * tds_canonical_charset_name (const char *charset_name)
     Determine canonical iconv character set name. More...
     
    size_t tds_iconv (TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
     Wrapper around iconv(3). More...
     
    void tds_iconv_close (TDSCONNECTION *conn)
     
    static void tds_iconv_err (TDSSOCKET *tds, int err)
     
    void tds_iconv_free (TDSCONNECTION *conn)
     
    TDSICONVtds_iconv_from_collate (TDSCONNECTION *conn, TDS_UCHAR collate[5])
     Get iconv information from a LCID (to support different column encoding under MSSQL2K)
     
    TDSICONVtds_iconv_get (TDSCONNECTION *conn, const char *client_charset, const char *server_charset)
     
    TDSICONVtds_iconv_get_info (TDSCONNECTION *conn, int canonic_client, int canonic_server)
     Get a iconv info structure, allocate and initialize if needed.
     
    static void tds_iconv_info_close (TDSICONV *char_conv)
     
    static int tds_iconv_info_init (TDSICONV *char_conv, int client_canonical, int server_canonical)
     Open iconv descriptors to convert between character sets (both directions). More...
     
    TDSRET tds_iconv_open (TDSCONNECTION *conn, const char *charset, int use_utf16)
     
    void tds_srv_charset_changed (TDSCONNECTION *conn, const char *charset)
     
    static void tds_srv_charset_changed_num (TDSCONNECTION *conn, int canonic_charset_num)
     
    size_t tds_sys_iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
     
    int tds_sys_iconv_close (iconv_t cd)
     
    iconv_t tds_sys_iconv_open (const char *tocode, const char *fromcode)
     Inputs are FreeTDS canonical names, no other. More...
     

    Variables

    static const iconv_get_t iconv_gets [16]
     
    static const iconv_put_t iconv_puts [16]
     

    Detailed Description

    Convert between different charsets.

    Set up the initial iconv conversion descriptors.

    When the socket is allocated, three TDSICONV structures are attached to iconv.
    They have fixed meanings:

    • 0. Client <-> UCS-2 (client2ucs2)
    • 1. Client <-> server single-byte charset (client2server_chardata)

    Other designs that use less data are possible, but these three conversion needs are very often needed. By reserving them, we avoid searching the array for our most common purposes.

    To solve different iconv names and portability problems FreeTDS maintains a list of aliases each charset.

    First we discover the names of our minimum required charsets (UTF-8, ISO8859-1 and UCS2).
    Later, as and when it's needed, we try to discover others.

    There is one list of canonic names (GNU iconv names) and two sets of aliases (one for other iconv implementations and another for Sybase). For every canonic charset name we cache the iconv name found during discovery.

    Function Documentation

    ◆ skip_one_input_sequence()

    static size_t skip_one_input_sequence ( iconv_t  cd,
    const TDS_ENCODING charset,
    const char **  input,
    size_t *  input_size 
    )
    static

    Move the input sequence pointer to the next valid position.

    Used when an input character cannot be converted.

    Returns
    number of bytes to skip.

    ◆ tds_canonical_charset()

    int tds_canonical_charset ( const char *  charset_name)

    Determine canonical iconv character set.

    Returns
    canonical position, or -1 if lookup failed.
    Remarks
    Returned name can be used in bytes_per_char(), above.
    Here is the caller graph for this function:

    ◆ tds_canonical_charset_name()

    const char* tds_canonical_charset_name ( const char *  charset_name)

    Determine canonical iconv character set name.


    Returns
    canonical name, or NULL if lookup failed.
    Remarks
    Returned name can be used in bytes_per_char(), above.
    Here is the call graph for this function:

    ◆ tds_iconv()

    size_t tds_iconv ( TDSSOCKET tds,
    TDSICONV conv,
    TDS_ICONV_DIRECTION  io,
    const char **  inbuf,
    size_t *  inbytesleft,
    char **  outbuf,
    size_t *  outbytesleft 
    )

    Wrapper around iconv(3).

    Same parameters, with slightly different behavior.

    Parameters
    tdsstate information for the socket and the TDS protocol
    ioEnumerated value indicating whether the data are being sent to or received from the server.
    convinformation about the encodings involved, including the iconv(3) conversion descriptors.
    inbufaddress of pointer to the input buffer of data to be converted.
    inbytesleftaddress of count of bytes in inbuf.
    outbufaddress of pointer to the output buffer.
    outbytesleftaddress of count of bytes in outbuf.
    Return values
    numberof irreversible conversions performed. -1 on error, see iconv(3) documentation for a description of the possible values of errno.
    Remarks
    Unlike iconv(3), none of the arguments can be nor point to NULL. Like iconv(3), all pointers will be updated. Success is signified by a nonnegative return code and *inbytesleft == 0.
    If the conversion descriptor in iconv is -1 or NULL, inbuf is copied to outbuf, and all parameters updated accordingly.

    If a character in inbuf cannot be converted because no such cbaracter exists in the outbuf character set, we emit messages similar to the ones Sybase emits when it fails such a conversion. The message varies depending on the direction of the data.
    On a read error, we emit Msg 2403, Severity 16 (EX_INFO): "WARNING! Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?')." On a write error we emit Msg 2402, Severity 16 (EX_USER): "Error converting client characters into server's character set. Some character(s) could not be converted." and return an error code. Client libraries relying on this routine should reflect an error back to the application.

    Todo:
    Check for variable multibyte non-UTF-8 input character set.
    Todo:
    Use more robust error message generation.
    Todo:
    For reads, cope with outbuf encodings that don't have the equivalent of an ASCII '?'.
    Todo:
    Support alternative to '?' for the replacement character.
    Here is the call graph for this function:

    ◆ tds_iconv_info_init()

    static int tds_iconv_info_init ( TDSICONV char_conv,
    int  client_canonical,
    int  server_canonical 
    )
    static

    Open iconv descriptors to convert between character sets (both directions).

    1. Look up the canonical names of the character sets.
    2. Look up their widths.
    3. Ask iconv to open a conversion descriptor.
    4. Fail if any of the above offer any resistance.
      Remarks
      The charset names written to iconv will be the canonical names, not necessarily the names passed in.
    Here is the call graph for this function:

    ◆ tds_sys_iconv_open()

    iconv_t tds_sys_iconv_open ( const char *  tocode,
    const char *  fromcode 
    )

    Inputs are FreeTDS canonical names, no other.

    No alias list is consulted.

    Here is the call graph for this function:

    Variable Documentation

    ◆ iconv_gets

    const iconv_get_t iconv_gets[16]
    static
    Initial value:
    = {
    get_iso1, get_ascii, get_utf16le, get_utf16be, get_ucs4le, get_ucs4be, get_utf8, get_cp1252,
    get_err, get_err, get_err, get_err, get_err, get_err, get_err, get_err,
    }

    ◆ iconv_puts

    const iconv_put_t iconv_puts[16]
    static
    Initial value:
    = {
    put_iso1, put_ascii, put_utf16le, put_utf16be, put_ucs4le, put_ucs4be, put_utf8, put_cp1252,
    put_err, put_err, put_err, put_err, put_err, put_err, put_err, put_err,
    }
    freetds-1.3.6/doc/reference/a00561_ga3a7a7b4d6ed344127e164dd0b443d790_cgraph.dot000644 025423 025423 00000001320 14162303417 027034 0ustar00fredianofrediano000000 000000 digraph "tds_iconv_info_init" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_iconv_info_init",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Open iconv descriptors to convert between character sets (both directions)."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00561_ga6561d1dba1a04c168431b16ec17d7e4c_cgraph.dot000644 025423 025423 00000001322 14162303417 027102 0ustar00fredianofrediano000000 000000 digraph "tds_canonical_charset_name" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_canonical_charset_name",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Determine canonical iconv character set name."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_canonical_charset",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00561.html#gac01180352db7052e786463e3b07a8a9e",tooltip="Determine canonical iconv character set."]; } freetds-1.3.6/doc/reference/a00561_ga87db49044919f1bc84c0ff5e9ab00304_cgraph.dot000644 025423 025423 00000001211 14162303417 027042 0ustar00fredianofrediano000000 000000 digraph "tds_iconv" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_iconv",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Wrapper around iconv(3)."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00561_ga900b0bce08c6bfc2e7c988f4b5970516_cgraph.dot000644 025423 025423 00000001260 14162303417 027135 0ustar00fredianofrediano000000 000000 digraph "tds_sys_iconv_open" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_sys_iconv_open",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Inputs are FreeTDS canonical names, no other."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00561_gac01180352db7052e786463e3b07a8a9e_icgraph.dot000644 025423 025423 00000001330 14162303417 027047 0ustar00fredianofrediano000000 000000 digraph "tds_canonical_charset" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_canonical_charset",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Determine canonical iconv character set."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_canonical_charset_name",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00561.html#ga6561d1dba1a04c168431b16ec17d7e4c",tooltip="Determine canonical iconv character set name."]; } freetds-1.3.6/doc/reference/a00562.dot000644 025423 025423 00000001100 14162303417 020624 0ustar00fredianofrediano000000 000000 digraph "Memory allocation" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Memory allocation",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Allocate or free resources."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00562.html000644 025423 025423 00000143070 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Memory allocation
    FreeTDS API
    Memory allocation

    Allocate or free resources. More...

    Collaboration diagram for Memory allocation:

    Macros

    #define REQ(i, n)   |(((TDS_REQ_ ## n / 8) == i)?(1<<(TDS_REQ_ ## n & 7)):0)
     
    #define REQB(i)   0 SUPPORTED_REQ_CAP(i)
     
    #define RES(i, n)   |(((TDS_RES_ ## n / 8) == i)?(1<<(TDS_RES_ ## n & 7)):0)
     
    #define RESB(i)   0 SUPPORTED_RES_CAP(i)
     
    #define SQLS_ENTRY(number, state)   case number: p = state; break
     
    #define SUPPORTED_REQ_CAP(i)
     
    #define SUPPORTED_RES_CAP(i)    RES(i,CON_NOOOB) RES(i,PROTO_NOTEXT) RES(i,PROTO_NOBULK) RES(i,NOTDSDEBUG)
     

    Functions

    BCPCOLDATAtds_alloc_bcp_column_data (unsigned int column_size)
     
    TDSBCPINFOtds_alloc_bcpinfo (void)
     
    char * tds_alloc_client_sqlstate (int msgno)
     
    static TDSCOLUMNtds_alloc_column (void)
     
    static TDSCOMPUTEINFOtds_alloc_compute_result (TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
     Allocate memory for storing compute info return NULL on out of memory.
     
    TDSCOMPUTEINFO ** tds_alloc_compute_results (TDSSOCKET *tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols)
     
    TDSRET tds_alloc_compute_row (TDSCOMPUTEINFO *res_info)
     
    TDSCONTEXTtds_alloc_context (void *parent)
     
    TDSCURSORtds_alloc_cursor (TDSSOCKET *tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen)
     
    TDSDYNAMICtds_alloc_dynamic (TDSCONNECTION *conn, const char *id)
     Allocate a dynamic statement. More...
     
    TDSLOCALEtds_alloc_locale (void)
     
    TDSLOGINtds_alloc_login (int use_environment)
     
    char * tds_alloc_lookup_sqlstate (TDSSOCKET *tds, int msgno)
     
    TDSPACKETtds_alloc_packet (void *buf, unsigned len)
     
    void * tds_alloc_param_data (TDSCOLUMN *curparam)
     Allocate data for a parameter. More...
     
    TDSPARAMINFOtds_alloc_param_result (TDSPARAMINFO *old_param)
     Adds a output parameter to TDSPARAMINFO. More...
     
    TDSRESULTINFOtds_alloc_results (TDS_USMALLINT num_cols)
     
    TDSRET tds_alloc_row (TDSRESULTINFO *res_info)
     Allocate space for row store return NULL on out of memory.
     
    TDSSOCKETtds_alloc_socket (TDSCONTEXT *context, unsigned int bufsize)
     
     TDS_COMPILE_CHECK (tds_cap_len, sizeof(defaultcaps)==TDS_MAX_CAPABILITY)
     
     TDS_COMPILE_CHECK (tds_values_len, sizeof(defaultcaps.types[0].values)==14)
     
    static void tds_connection_remove_socket (TDSCONNECTION *conn, TDSSOCKET *tds)
     
    void tds_cursor_deallocated (TDSCONNECTION *conn, TDSCURSOR *cursor)
     
    void tds_deinit_bcpinfo (TDSBCPINFO *bcpinfo)
     
    static void tds_deinit_connection (TDSCONNECTION *conn)
     
    void tds_detach_results (TDSRESULTINFO *info)
     Detach result info from it current socket.
     
    void tds_dynamic_deallocated (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
     
    void tds_free_all_results (TDSSOCKET *tds)
     
    void tds_free_bcp_column_data (BCPCOLDATA *coldata)
     
    void tds_free_bcpinfo (TDSBCPINFO *bcpinfo)
     
    static void tds_free_column (TDSCOLUMN *col)
     
    static void tds_free_compute_result (TDSCOMPUTEINFO *comp_info)
     
    static void tds_free_compute_results (TDSSOCKET *tds)
     
    void tds_free_context (TDSCONTEXT *context)
     
    static void tds_free_env (TDSCONNECTION *conn)
     
    void tds_free_input_params (TDSDYNAMIC *dyn)
     Frees all allocated input parameters of a dynamic statement. More...
     
    void tds_free_locale (TDSLOCALE *locale)
     
    void tds_free_login (TDSLOGIN *login)
     
    void tds_free_msg (TDSMESSAGE *message)
     
    void tds_free_packets (TDSPACKET *packet)
     
    void tds_free_param_result (TDSPARAMINFO *param_info)
     Delete latest parameter.
     
    void tds_free_param_results (TDSPARAMINFO *param_info)
     
    void tds_free_results (TDSRESULTINFO *res_info)
     
    void tds_free_row (TDSRESULTINFO *res_info, unsigned char *row)
     
    void tds_free_socket (TDSSOCKET *tds)
     
    static char * tds_get_dynid (TDSCONNECTION *conn, char *id)
     Get an id for dynamic query based on TDS information. More...
     
    static TDSCONNECTIONtds_init_connection (TDSCONNECTION *conn, TDSCONTEXT *context, unsigned int bufsize)
     
    TDSLOGINtds_init_login (TDSLOGIN *login, TDSLOCALE *locale)
     Initialize login structure with locale information and other stuff for connection. More...
     
    static TDSSOCKETtds_init_socket (TDSSOCKET *tds_socket, unsigned int bufsize)
     
    static void tds_param_free (TDSCOLUMN *col)
     
    void * tds_realloc (void **pp, size_t new_size)
     Reallocate a pointer and update it if success. More...
     
    TDSPACKETtds_realloc_packet (TDSPACKET *packet, unsigned len)
     
    TDSSOCKETtds_realloc_socket (TDSSOCKET *tds, size_t bufsize)
     
    void tds_release_cursor (TDSCURSOR **pcursor)
     
    void tds_release_dynamic (TDSDYNAMIC **pdyn)
     Frees dynamic statement. More...
     
    static void tds_row_free (TDSRESULTINFO *res_info, unsigned char *row)
     
    void tds_set_current_results (TDSSOCKET *tds, TDSRESULTINFO *info)
     
    static int winsock_initialized (void)
     

    Variables

    static const TDS_CAPABILITIES defaultcaps
     
    static volatile unsigned int inc_num = 1
     
    const TDSCOLUMNFUNCS tds_invalid_funcs
     

    Detailed Description

    Allocate or free resources.

    Allocation can fail only on out of memory. In such case they return NULL and leave the state as before call. Mainly function names are in the form tds_alloc_XX or tds_free_XXX. tds_alloc_XXX functions allocate structures and return pointer to allocated data while tds_free_XXX take structure pointers and free them. Some functions require additional parameters to initialize structure correctly. The main exception are structures that use reference counting. These structures have tds_alloc_XXX functions but instead of tds_free_XXX use tds_release_XXX.

    Macro Definition Documentation

    ◆ SUPPORTED_REQ_CAP

    #define SUPPORTED_REQ_CAP (   i)
    Value:
    REQ(i,LANG) REQ(i,RPC) REQ(i,EVT) REQ(i,MSTMT) REQ(i,BCP) REQ(i,CURSOR) REQ(i,DYNF) \
    REQ(i,MSG) REQ(i,PARAM) REQ(i,DATA_INT1) REQ(i,DATA_INT2) REQ(i,DATA_INT4) REQ(i,DATA_BIT) \
    REQ(i,DATA_CHAR) REQ(i,DATA_VCHAR) REQ(i,DATA_BIN) REQ(i,DATA_VBIN) REQ(i,DATA_MNY8) \
    REQ(i,DATA_MNY4) REQ(i,DATA_DATE8) REQ(i,DATA_DATE4) REQ(i,DATA_FLT4) REQ(i,DATA_FLT8) \
    REQ(i,DATA_NUM) REQ(i,DATA_TEXT) REQ(i,DATA_IMAGE) REQ(i,DATA_DEC) REQ(i,DATA_LCHAR) \
    REQ(i,DATA_LBIN) REQ(i,DATA_INTN) REQ(i,DATA_DATETIMEN) REQ(i,DATA_MONEYN) \
    REQ(i,CSR_PREV) REQ(i,CSR_FIRST) REQ(i,CSR_LAST) REQ(i,CSR_ABS) REQ(i,CSR_REL) \
    REQ(i,CSR_MULTI) REQ(i,CON_INBAND) REQ(i,PROTO_TEXT) REQ(i,PROTO_BULK) \
    REQ(i,DATA_SENSITIVITY) REQ(i,DATA_BOUNDARY) REQ(i,PROTO_DYNPROC) REQ(i,DATA_FLTN) \
    REQ(i,DATA_BITN) REQ(i,DATA_INT8) REQ(i,WIDETABLE) \
    REQ(i,DATA_UINT2) REQ(i,DATA_UINT4) REQ(i,DATA_UINT8) REQ(i,DATA_UINTN) REQ(i,LARGEIDENT) \
    REQ(i,SRVPKTSIZE) REQ(i,DATA_DATE) REQ(i,DATA_TIME) REQ(i,DATA_BIGTIME) REQ(i,DATA_BIGDATETIME)

    Function Documentation

    ◆ tds_alloc_dynamic()

    TDSDYNAMIC * tds_alloc_dynamic ( TDSCONNECTION conn,
    const char *  id 
    )

    Allocate a dynamic statement.

    Parameters
    connthe connection within which to allocate the statement.
    ida character label identifying the statement.
    Returns
    a pointer to the allocated structure (NULL on failure).

    tds_alloc_dynamic is used to implement placeholder code under TDS 5.0

    Here is the call graph for this function:

    ◆ tds_alloc_param_data()

    void* tds_alloc_param_data ( TDSCOLUMN curparam)

    Allocate data for a parameter.

    Parameters
    curparamparameter to retrieve size information
    Returns
    NULL on failure or new data

    ◆ tds_alloc_param_result()

    TDSPARAMINFO * tds_alloc_param_result ( TDSPARAMINFO old_param)

    Adds a output parameter to TDSPARAMINFO.

    Parameters
    old_parama pointer to the TDSPARAMINFO structure containing the current set of output parameter, or NULL if none exists.
    Returns
    a pointer to the new TDSPARAMINFO structure.

    tds_alloc_param_result() works a bit differently than the other alloc result functions. Output parameters come in individually with no total number given in advance, so we simply call this func every time with get a TDS_PARAM_TOKEN and let it realloc the columns struct one bigger. tds_free_all_results() usually cleans up after us.

    ◆ tds_free_input_params()

    void tds_free_input_params ( TDSDYNAMIC dyn)

    Frees all allocated input parameters of a dynamic statement.

    Parameters
    dynthe dynamic statement whose input parameter are to be freed

    tds_free_input_params frees all parameters for the give dynamic statement

    ◆ tds_get_dynid()

    static char* tds_get_dynid ( TDSCONNECTION conn,
    char *  id 
    )
    static

    Get an id for dynamic query based on TDS information.

    Parameters
    connstate information for the connection and the TDS protocol
    Returns
    TDS_FAIL or TDS_SUCCESS
    Here is the caller graph for this function:

    ◆ tds_init_login()

    TDSLOGIN* tds_init_login ( TDSLOGIN login,
    TDSLOCALE locale 
    )

    Initialize login structure with locale information and other stuff for connection.

    Parameters
    localelocale information (copied to configuration information)
    Returns
    login structure or NULL if initialization error

    ◆ tds_realloc()

    void* tds_realloc ( void **  pp,
    size_t  new_size 
    )

    Reallocate a pointer and update it if success.

    Parameters
    pppointer to pointer to be reallocated
    new_sizenew size to be allocated
    Returns
    new pointer allocated, NULL on failure

    ◆ tds_release_dynamic()

    void tds_release_dynamic ( TDSDYNAMIC **  pdyn)

    Frees dynamic statement.

    Parameters
    pdynpointer to dynamic statement to be freed.
    Here is the call graph for this function:

    Variable Documentation

    ◆ defaultcaps

    const TDS_CAPABILITIES defaultcaps
    static
    Initial value:
    = { {
    { 1, 14, { REQB(13), REQB(12), REQB(11), REQB(10), REQB(9), REQB(8), REQB(7),
    REQB(6), REQB(5), REQB(4), REQB(3), REQB(2), REQB(1), REQB(0) } },
    { 2, 14, { RESB(13), RESB(12), RESB(11), RESB(10), RESB(9), RESB(8), RESB(7),
    RESB(6), RESB(5), RESB(4), RESB(3), RESB(2), RESB(1), RESB(0) } }
    } }
    freetds-1.3.6/doc/reference/a00562_ga501af7e6186e59c257729599a044a30b_icgraph.dot000644 025423 025423 00000001274 14162303417 027016 0ustar00fredianofrediano000000 000000 digraph "tds_get_dynid" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_get_dynid",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get an id for dynamic query based on TDS information."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_alloc_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00562.html#ga69559de43b47f4a9e2eecc7a56527444",tooltip="Allocate a dynamic statement."]; } freetds-1.3.6/doc/reference/a00563.dot000644 025423 025423 00000001046 14162303417 020636 0ustar00fredianofrediano000000 000000 digraph "Query" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Query",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Function to handle query."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00563.html000644 025423 025423 00000446367 14162303417 021037 0ustar00fredianofrediano000000 000000 FreeTDS API: Query
    FreeTDS API

    Function to handle query. More...

    Collaboration diagram for Query:

    Classes

    struct  tds_quoteout_stream
     

    Macros

    #define TDS_PUT_N_AS_UCS2(tds, s)
     Utility to convert a constant ascii string to ucs2 and send to server. More...
     

    Typedefs

    typedef struct tds_quoteout_stream TDSQUOTEOUTSTREAM
     

    Enumerations

    enum  {
      OPT_VERSION = 0x01, OPT_TIMER = 0x02, OPT_NOFOOTER = 0x04, OPT_NOHEADER = 0x08,
      OPT_QUIET = 0x10, OPT_VERBOSE = 0x20, OPT_INSTANCES = 0x40, POS_ISO1,
      POS_UTF8, POS_UCS2LE, POS_UCS2BE, MUL_STARTED = 1,
      ASN1_SEQUENCE = ASN1_TAG_SEQUENCE, CS_USERNAME = 9100, CS_USERNAME = 9100, CS_PASSWORD = 9101,
      CS_PASSWORD = 9101, CS_APPNAME = 9102, CS_APPNAME = 9102, CS_HOSTNAME = 9103,
      CS_HOSTNAME = 9103, CS_LOGIN_STATUS = 9104, CS_LOGIN_STATUS = 9104, CS_TDS_VERSION = 9105,
      CS_TDS_VERSION = 9105, CS_CHARSETCNV = 9106, CS_CHARSETCNV = 9106, CS_PACKETSIZE = 9107,
      CS_PACKETSIZE = 9107, CS_USERDATA = 9108, CS_USERDATA = 9108, CS_NETIO = 9110,
      CS_NETIO = 9110, CS_TEXTLIMIT = 9112, CS_TEXTLIMIT = 9112, CS_HIDDEN_KEYS = 9113,
      CS_HIDDEN_KEYS = 9113, CS_VERSION = 9114, CS_VERSION = 9114, CS_IFILE = 9115,
      CS_IFILE = 9115, CS_LOGIN_TIMEOUT = 9116, CS_LOGIN_TIMEOUT = 9116, CS_TIMEOUT = 9117,
      CS_TIMEOUT = 9117, CS_MAX_CONNECT = 9118, CS_MAX_CONNECT = 9118, CS_EXPOSE_FMTS = 9120,
      CS_EXPOSE_FMTS = 9120, CS_EXTRA_INF = 9121, CS_EXTRA_INF = 9121, CS_ANSI_BINDS = 9123,
      CS_ANSI_BINDS = 9123, CS_BULK_LOGIN = 9124, CS_BULK_LOGIN = 9124, CS_LOC_PROP = 9125,
      CS_LOC_PROP = 9125, CS_PARENT_HANDLE = 9130, CS_PARENT_HANDLE = 9130, CS_EED_CMD = 9131,
      CS_EED_CMD = 9131, CS_DIAG_TIMEOUT = 9132, CS_DIAG_TIMEOUT = 9132, CS_DISABLE_POLL = 9133,
      CS_DISABLE_POLL = 9133, CS_SEC_ENCRYPTION = 9135, CS_SEC_ENCRYPTION = 9135, CS_SEC_CHALLENGE = 9136,
      CS_SEC_CHALLENGE = 9136, CS_SEC_NEGOTIATE = 9137, CS_SEC_NEGOTIATE = 9137, CS_CON_STATUS = 9143,
      CS_CON_STATUS = 9143, CS_VER_STRING = 9144, CS_VER_STRING = 9144, CS_SERVERNAME = 9146,
      CS_SERVERNAME = 9146, CS_SEC_APPDEFINED = 9149, CS_SEC_APPDEFINED = 9149, CS_STICKY_BINDS = 9151,
      CS_STICKY_BINDS = 9151, CS_SEC_NETWORKAUTH = 9175, CS_SEC_NETWORKAUTH = 9175, CS_SEC_DELEGATION = 9176,
      CS_SEC_DELEGATION = 9176, CS_SEC_MUTUALAUTH = 9177, CS_SEC_MUTUALAUTH = 9177, CS_SEC_SERVERPRINCIPAL = 9188,
      CS_SEC_SERVERPRINCIPAL = 9188, CS_SERVERADDR = 9206, CS_SERVERADDR = 9206, CS_PORT = 9300,
      CS_PORT = 9300, CS_CLIENTCHARSET = 9301, CS_CLIENTCHARSET = 9301, CS_DATABASE,
      dblib_msdblib = 0, TDS_CHARSET_ISO_8859_1 = 0, TDS_CHARSET_UTF_8 = 1, TDS_CHARSET_UCS_2LE = 2,
      TDS_CHARSET_UCS_2BE = 3, TDS_CHARSET_ARMSCII_8 = 4, TDS_CHARSET_BIG_5 = 5, TDS_CHARSET_BIG5_HKSCS = 6,
      TDS_CHARSET_C99 = 7, TDS_CHARSET_CHINESE = 8, TDS_CHARSET_CN = 9, TDS_CHARSET_CN_GB = 10,
      TDS_CHARSET_CN_GB_ISOIR165 = 11, TDS_CHARSET_CP1133 = 12, TDS_CHARSET_CP1250 = 13, TDS_CHARSET_CP1251 = 14,
      TDS_CHARSET_CP1252 = 15, TDS_CHARSET_CP1253 = 16, TDS_CHARSET_CP1254 = 17, TDS_CHARSET_CP1255 = 18,
      TDS_CHARSET_CP1256 = 19, TDS_CHARSET_CP1257 = 20, TDS_CHARSET_CP1258 = 21, TDS_CHARSET_CP1361 = 22,
      TDS_CHARSET_CP437 = 23, TDS_CHARSET_CP850 = 24, TDS_CHARSET_CP862 = 25, TDS_CHARSET_CP866 = 26,
      TDS_CHARSET_CP874 = 27, TDS_CHARSET_CP932 = 28, TDS_CHARSET_CP936 = 29, TDS_CHARSET_CP949 = 30,
      TDS_CHARSET_CP950 = 31, TDS_CHARSET_EUC_JP = 32, TDS_CHARSET_EUC_KR = 33, TDS_CHARSET_EUC_TW = 34,
      TDS_CHARSET_GB18030 = 35, TDS_CHARSET_GEORGIAN_ACADEMY = 36, TDS_CHARSET_GEORGIAN_PS = 37, TDS_CHARSET_HZ = 38,
      TDS_CHARSET_ISO_2022_CN = 39, TDS_CHARSET_ISO_2022_CN_EXT = 40, TDS_CHARSET_ISO_2022_JP = 41, TDS_CHARSET_ISO_2022_JP_1 = 42,
      TDS_CHARSET_ISO_2022_JP_2 = 43, TDS_CHARSET_ISO_2022_KR = 44, TDS_CHARSET_ISO_8859_10 = 45, TDS_CHARSET_ISO_8859_13 = 46,
      TDS_CHARSET_ISO_8859_14 = 47, TDS_CHARSET_ISO_8859_15 = 48, TDS_CHARSET_ISO_8859_16 = 49, TDS_CHARSET_ISO_8859_2 = 50,
      TDS_CHARSET_ISO_8859_3 = 51, TDS_CHARSET_ISO_8859_4 = 52, TDS_CHARSET_ISO_8859_5 = 53, TDS_CHARSET_ISO_8859_6 = 54,
      TDS_CHARSET_ISO_8859_7 = 55, TDS_CHARSET_ISO_8859_8 = 56, TDS_CHARSET_ISO_8859_9 = 57, TDS_CHARSET_ISO_IR_14 = 58,
      TDS_CHARSET_ISO_IR_149 = 59, TDS_CHARSET_ISO_IR_159 = 60, TDS_CHARSET_ISO_IR_166 = 61, TDS_CHARSET_ISO_IR_87 = 62,
      TDS_CHARSET_JAVA = 63, TDS_CHARSET_JISX0201_1976 = 64, TDS_CHARSET_KOI8_R = 65, TDS_CHARSET_KOI8_RU = 66,
      TDS_CHARSET_KOI8_T = 67, TDS_CHARSET_KOI8_U = 68, TDS_CHARSET_MAC = 69, TDS_CHARSET_MACARABIC = 70,
      TDS_CHARSET_MACCENTRALEUROPE = 71, TDS_CHARSET_MACCROATIAN = 72, TDS_CHARSET_MACCYRILLIC = 73, TDS_CHARSET_MACGREEK = 74,
      TDS_CHARSET_MACHEBREW = 75, TDS_CHARSET_MACICELAND = 76, TDS_CHARSET_MACROMANIA = 77, TDS_CHARSET_MACTHAI = 78,
      TDS_CHARSET_MACTURKISH = 79, TDS_CHARSET_MACUKRAINE = 80, TDS_CHARSET_MULELAO_1 = 81, TDS_CHARSET_NEXTSTEP = 82,
      TDS_CHARSET_ROMAN8 = 83, TDS_CHARSET_SJIS = 84, TDS_CHARSET_TCVN = 85, TDS_CHARSET_UCS_4BE = 86,
      TDS_CHARSET_UCS_4LE = 87, TDS_CHARSET_US_ASCII = 88, TDS_CHARSET_UTF_16BE = 89, TDS_CHARSET_UTF_16LE = 90,
      TDS_CHARSET_UTF_32BE = 91, TDS_CHARSET_UTF_32LE = 92, TDS_CHARSET_UTF_7 = 93, TDS_CHARSET_VISCII = 94,
      TDS_NUM_CHARSETS = 95, ODBC_PARAM_SIZE, TDS_OPT_ARITHOVERFLOW = 0x01, TDS_OPT_NUMERICTRUNC = 0x02,
      TDS_CUR_ISTAT_UNUSED = 0x00, TDS_CUR_ISTAT_DECLARED = 0x01, TDS_CUR_ISTAT_OPEN = 0x02, TDS_CUR_ISTAT_CLOSED = 0x04,
      TDS_CUR_ISTAT_RDONLY = 0x08, TDS_CUR_ISTAT_UPDATABLE = 0x10, TDS_CUR_ISTAT_ROWCNT = 0x20, TDS_CUR_ISTAT_DEALLOC = 0x40,
      SYBCHAR = 47, SYBCHAR = 47, SYBVARCHAR = 39, SYBVARCHAR = 39,
      SYBINTN = 38, SYBINTN = 38, SYBINT1 = 48, SYBINT1 = 48,
      SYBINT2 = 52, SYBINT2 = 52, SYBINT4 = 56, SYBINT4 = 56,
      SYBINT8 = 127, SYBINT8 = 127, SYBFLT8 = 62, SYBFLT8 = 62,
      SYBDATETIME = 61, SYBDATETIME = 61, SYBBIT = 50, SYBBIT = 50,
      SYBBITN = 104, SYBBITN = 104, SYBTEXT = 35, SYBTEXT = 35,
      SYBNTEXT = 99, SYBNTEXT = 99, SYBIMAGE = 34, SYBIMAGE = 34,
      SYBMONEY4 = 122, SYBMONEY4 = 122, SYBMONEY = 60, SYBMONEY = 60,
      SYBDATETIME4 = 58, SYBDATETIME4 = 58, SYBREAL = 59, SYBREAL = 59,
      SYBBINARY = 45, SYBBINARY = 45, SYBVOID = 31, SYBVOID = 31,
      SYBVARBINARY = 37, SYBVARBINARY = 37, SYBNUMERIC = 108, SYBNUMERIC = 108,
      SYBDECIMAL = 106, SYBDECIMAL = 106, SYBFLTN = 109, SYBFLTN = 109,
      SYBMONEYN = 110, SYBMONEYN = 110, SYBDATETIMN = 111, SYBDATETIMN = 111,
      SYBNVARCHAR = 103, SYBNVARCHAR = 103, SYBDATE = 49, SYBDATE = 49,
      SYBTIME = 51, SYBTIME = 51, SYBBIGDATETIME = 187, SYBBIGDATETIME = 187,
      SYBBIGTIME = 188, SYBBIGTIME = 188, SYBMSDATE = 40, SYBMSDATE = 40,
      SYBMSTIME = 41, SYBMSTIME = 41, SYBMSDATETIME2 = 42, SYBMSDATETIME2 = 42,
      SYBMSDATETIMEOFFSET = 43, SYBMSDATETIMEOFFSET = 43
    }
     

    Functions

    static TDSRET tds4_send_emulated_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params)
     Send RPC as string query. More...
     
    static char * tds5_fix_dot_query (const char *query, size_t *query_len, TDSPARAMINFO *params)
     Substitute ?-style placeholders with named (@param) ones. More...
     
    static TDSRET tds5_put_params (TDSSOCKET *tds, TDSPARAMINFO *info, int flags)
     Send parameters to server. More...
     
    TDSRET tds71_submit_prepexec (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
     Creates a temporary stored procedure in the server and execute it. More...
     
    static void tds7_put_cursor_fetch (TDSSOCKET *tds, TDS_INT cursor_id, TDS_TINYINT fetch_type, TDS_INT i_row, TDS_INT num_rows)
     
    static void tds7_put_query_params (TDSSOCKET *tds, const char *query, size_t query_len)
     Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec) More...
     
    static TDSRET tds7_send_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
     Send dynamic request on TDS 7+ to be executed. More...
     
    static TDSRET tds7_write_param_def_from_params (TDSSOCKET *tds, const char *query, size_t query_len, TDSPARAMINFO *params)
     Write string with parameters definition, useful for TDS7+. More...
     
    static TDSRET tds7_write_param_def_from_query (TDSSOCKET *tds, const char *converted_query, size_t converted_query_len, TDSPARAMINFO *params)
     Write string with parameters definition, useful for TDS7+. More...
     
    static size_t tds_ascii_to_ucs2 (char *buffer, const char *buf)
     Accept an ASCII string, convert it to UCS2-LE The input is NUL-terminated, but the output does not contains the NUL. More...
     
    const char * tds_convert_string (TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len)
     Convert a string in an allocated buffer. More...
     
    int tds_count_placeholders (const char *query)
     Count the number of placeholders ('?') in a query. More...
     
    static int tds_count_placeholders_ucs2le (const char *query, const char *query_end)
     Count the number of placeholders ('?') in a query. More...
     
    static bool tds_cursor_check_allocated (TDSCONNECTION *conn, TDSCURSOR *cursor)
     Check if a cursor is allocated into the server. More...
     
    TDSRET tds_cursor_close (TDSSOCKET *tds, TDSCURSOR *cursor)
     
    TDSRET tds_cursor_dealloc (TDSSOCKET *tds, TDSCURSOR *cursor)
     Send a deallocation request to server.
     
    TDSRET tds_cursor_declare (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *something_to_send)
     
    TDSRET tds_cursor_fetch (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row)
     
    TDSRET tds_cursor_get_cursor_info (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_UINT *prow_number, TDS_UINT *prow_count)
     
    TDSRET tds_cursor_open (TDSSOCKET *tds, TDSCURSOR *cursor, TDSPARAMINFO *params, int *something_to_send)
     
    TDSRET tds_cursor_setname (TDSSOCKET *tds, TDSCURSOR *cursor)
     
    TDSRET tds_cursor_setrows (TDSSOCKET *tds, TDSCURSOR *cursor, int *something_to_send)
     
    TDSRET tds_cursor_update (TDSSOCKET *tds, TDSCURSOR *cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO *params)
     
    TDSRET tds_deferred_cursor_dealloc (TDSCONNECTION *conn, TDSCURSOR *cursor)
     Deallocate cursor on idle. More...
     
    TDSRET tds_deferred_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
     Unprepare dynamic on idle. More...
     
    TDSRET tds_disconnect (TDSSOCKET *tds)
     
    size_t tds_fix_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol)
     Get column size for wire.
     
    TDSRET tds_get_column_declaration (TDSSOCKET *tds, TDSCOLUMN *curcol, char *out)
     Return declaration for column (like "varchar(20)"). More...
     
    TDSRET tds_multiple_done (TDSSOCKET *tds, TDSMULTIPLE *multiple)
     
    TDSRET tds_multiple_execute (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC *dyn)
     
    TDSRET tds_multiple_init (TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS *head)
     
    TDSRET tds_multiple_query (TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO *params)
     
    int tds_needs_unprepare (TDSCONNECTION *conn, TDSDYNAMIC *dyn)
     Check if dynamic request must be unprepared. More...
     
    const char * tds_next_placeholder (const char *start)
     Get position of next placeholder. More...
     
    static const char * tds_next_placeholder_ucs2le (const char *start, const char *end, int named)
     Found the next placeholder (? or @param) in a string. More...
     
    static TDSRET tds_put_char_param_as_string (TDSSOCKET *tds, const TDSCOLUMN *curcol)
     
    static TDSRET tds_put_data (TDSSOCKET *tds, TDSCOLUMN *curcol)
     Write data to wire. More...
     
    static TDSRET tds_put_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol, int flags)
     Put data information to wire. More...
     
    static TDSRET tds_put_param_as_string (TDSSOCKET *tds, TDSPARAMINFO *params, int n)
     Send a parameter to server. More...
     
    static TDSRET tds_query_flush_packet (TDSSOCKET *tds)
     Flush query packet. More...
     
    static size_t tds_quote (TDSSOCKET *tds, char *buffer, char quoting, const char *id, size_t len)
     Quote a string properly. More...
     
    static void tds_quote_and_put (TDSSOCKET *tds, const char *s, const char *end)
     Send a string to server while quoting it. More...
     
    size_t tds_quote_id (TDSSOCKET *tds, char *buffer, const char *id, int idlen)
     Quote an id. More...
     
    size_t tds_quote_id_rpc (TDSSOCKET *tds, char *buffer, const char *id, int idlen)
     Quote an id for a RPC call. More...
     
    size_t tds_quote_string (TDSSOCKET *tds, char *buffer, const char *str, int len)
     Quote a string. More...
     
    static void tds_quoteout_stream_init (TDSQUOTEOUTSTREAM *stream, TDSSOCKET *tds)
     
    static int tds_quoteout_stream_write (TDSOUTSTREAM *stream, size_t len)
     
    TDSRET tds_send_cancel (TDSSOCKET *tds)
     tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called directly after this. More...
     
    static TDSRET tds_send_emulated_execute (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params)
     Emulate prepared execute traslating to a normal language.
     
    static void tds_set_cur_cursor (TDSSOCKET *tds, TDSCURSOR *cursor)
     Set current cursor. More...
     
    void tds_set_cur_dyn (TDSSOCKET *tds, TDSDYNAMIC *dyn)
     Set current dynamic. More...
     
    const char * tds_skip_comment (const char *s)
     Skip a comment in a query. More...
     
    static const char * tds_skip_comment_ucs2le (const char *s, const char *end)
     Skip a comment in a query. More...
     
    const char * tds_skip_quoted (const char *s)
     Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]) More...
     
    static const char * tds_skip_quoted_ucs2le (const char *s, const char *end)
     Return pointer to end of a quoted string. More...
     
    void tds_start_query (TDSSOCKET *tds, unsigned char packet_type)
     Start query packet of a given type. More...
     
    static TDSRET tds_start_query_head (TDSSOCKET *tds, unsigned char packet_type, TDSHEADERS *head)
     Start query packet of a given type. More...
     
    TDSRET tds_submit_begin_tran (TDSSOCKET *tds)
     Send a rollback request. More...
     
    TDSRET tds_submit_commit (TDSSOCKET *tds, int cont)
     Send a commit request. More...
     
    TDSRET tds_submit_execdirect (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
     Submit a prepared query with parameters. More...
     
    TDSRET tds_submit_execute (TDSSOCKET *tds, TDSDYNAMIC *dyn)
     Sends a previously prepared dynamic statement to the server. More...
     
    TDSRET tds_submit_optioncmd (TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size)
     Send option commands to server. More...
     
    TDSRET tds_submit_prepare (TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params)
     Creates a temporary stored procedure in the server. More...
     
    TDSRET tds_submit_query (TDSSOCKET *tds, const char *query)
     Sends a language string to the database server for processing. More...
     
    TDSRET tds_submit_query_params (TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head)
     Sends a language string to the database server for processing. More...
     
    TDSRET tds_submit_queryf (TDSSOCKET *tds, const char *queryf,...)
     Format and submit a query. More...
     
    TDSRET tds_submit_rollback (TDSSOCKET *tds, int cont)
     Send a rollback request. More...
     
    TDSRET tds_submit_rpc (TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head)
     Calls a RPC from server. More...
     
    TDSRET tds_submit_unprepare (TDSSOCKET *tds, TDSDYNAMIC *dyn)
     Send a unprepare request for a prepared query. More...
     

    Variables

    static const TDSCONTEXT empty_ctx = {0}
     

    Detailed Description

    Function to handle query.

    Macro Definition Documentation

    ◆ TDS_PUT_N_AS_UCS2

    #define TDS_PUT_N_AS_UCS2 (   tds,
     
    )
    Value:
    do { \
    char buffer[sizeof(s)*2-2]; \
    tds_put_smallint(tds, sizeof(buffer)/2); \
    tds_put_n(tds, buffer, tds_ascii_to_ucs2(buffer, s)); \
    } while(0)

    Utility to convert a constant ascii string to ucs2 and send to server.

    Used to send internal store procedure names to server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    sconstanst string to send

    Function Documentation

    ◆ tds4_send_emulated_rpc()

    static TDSRET tds4_send_emulated_rpc ( TDSSOCKET tds,
    const char *  rpc_name,
    TDSPARAMINFO params 
    )
    static

    Send RPC as string query.

    This function is used on old protocol which does not support RPC queries.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    rpc_namename of RPC to invoke
    paramsparameters to send to server
    Returns
    TDS_FAIL or TDS_SUCCESS
    Here is the call graph for this function:

    ◆ tds5_fix_dot_query()

    static char* tds5_fix_dot_query ( const char *  query,
    size_t *  query_len,
    TDSPARAMINFO params 
    )
    static

    Substitute ?-style placeholders with named (@param) ones.

    Sybase does not support ?-style placeholders so convert them. Also the function replace parameter names.

    Parameters
    queryquery string
    [in,out]query_lenpointer to query length. On input length of input query, on output length of output query
    paramsparameters to send to server
    Returns
    new query or NULL on error

    ◆ tds5_put_params()

    static TDSRET tds5_put_params ( TDSSOCKET tds,
    TDSPARAMINFO info,
    int  flags 
    )
    static

    Send parameters to server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    infoparameters to send
    flags0 or TDS_PUT_DATA_USE_NAME
    Here is the call graph for this function:

    ◆ tds71_submit_prepexec()

    TDSRET tds71_submit_prepexec ( TDSSOCKET tds,
    const char *  query,
    const char *  id,
    TDSDYNAMIC **  dyn_out,
    TDSPARAMINFO params 
    )

    Creates a temporary stored procedure in the server and execute it.

    Parameters
    tdsstate information for the socket and the TDS protocol
    querylanguage query with given placeholders ('?')
    idstring to identify the dynamic query. Pass NULL for automatic generation.
    dyn_outwill receive allocated TDSDYNAMIC*. Any older allocated dynamic won't be freed. Can be NULL.
    paramsparameters to use. It can be NULL even if parameters are present.
    Returns
    TDS_FAIL or TDS_SUCCESS

    ◆ tds7_put_query_params()

    static void tds7_put_query_params ( TDSSOCKET tds,
    const char *  query,
    size_t  query_len 
    )
    static

    Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec)

    Parameters
    tdsstate information for the socket and the TDS protocol
    queryquery (encoded in ucs2le)
    query_lenquery length in bytes

    ◆ tds7_send_execute()

    static TDSRET tds7_send_execute ( TDSSOCKET tds,
    TDSDYNAMIC dyn 
    )
    static

    Send dynamic request on TDS 7+ to be executed.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    dyndynamic query to execute

    ◆ tds7_write_param_def_from_params()

    static TDSRET tds7_write_param_def_from_params ( TDSSOCKET tds,
    const char *  query,
    size_t  query_len,
    TDSPARAMINFO params 
    )
    static

    Write string with parameters definition, useful for TDS7+.

    Looks like "@P1 INT, @P2 VARCHAR(100)"

    Parameters
    tdsstate information for the socket and the TDS protocol
    queryquery to send to server encoded in ucs2le
    query_lenquery length in bytes
    paramsparameters to build declaration
    Returns
    result of the operation

    ◆ tds7_write_param_def_from_query()

    static TDSRET tds7_write_param_def_from_query ( TDSSOCKET tds,
    const char *  converted_query,
    size_t  converted_query_len,
    TDSPARAMINFO params 
    )
    static

    Write string with parameters definition, useful for TDS7+.

    Looks like "@P1 INT, @P2 VARCHAR(100)"

    Parameters
    tdsstate information for the socket and the TDS protocol
    converted_queryquery to send to server in ucs2le encoding
    converted_query_lenquery length in bytes
    paramsparameters to build declaration
    Returns
    result of write

    ◆ tds_ascii_to_ucs2()

    static size_t tds_ascii_to_ucs2 ( char *  buffer,
    const char *  buf 
    )
    static

    Accept an ASCII string, convert it to UCS2-LE The input is NUL-terminated, but the output does not contains the NUL.

    Parameters
    bufferbuffer where to store output
    bufstring to write
    Returns
    bytes written

    ◆ tds_convert_string()

    const char* tds_convert_string ( TDSSOCKET tds,
    TDSICONV char_conv,
    const char *  s,
    int  len,
    size_t *  out_len 
    )

    Convert a string in an allocated buffer.

    Parameters
    tdsstate information for the socket and the TDS protocol
    char_convinformation about the encodings involved
    sinput string
    leninput string length (in bytes), -1 for NUL-terminated
    out_lenreturned output length (in bytes)
    Returns
    string allocated (or input pointer if no conversion required) or NULL if error

    ◆ tds_count_placeholders()

    int tds_count_placeholders ( const char *  query)

    Count the number of placeholders ('?') in a query.

    Parameters
    queryquery string
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_count_placeholders_ucs2le()

    static int tds_count_placeholders_ucs2le ( const char *  query,
    const char *  query_end 
    )
    static

    Count the number of placeholders ('?') in a query.

    Parameters
    queryquery encoded in ucs2le
    query_endend of query
    Returns
    number of placeholders found
    Here is the call graph for this function:

    ◆ tds_cursor_check_allocated()

    static bool tds_cursor_check_allocated ( TDSCONNECTION conn,
    TDSCURSOR cursor 
    )
    static

    Check if a cursor is allocated into the server.

    If is not allocated it assures is removed from the connection list

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Returns
    true if allocated false otherwise
    Here is the caller graph for this function:

    ◆ tds_deferred_cursor_dealloc()

    TDSRET tds_deferred_cursor_dealloc ( TDSCONNECTION conn,
    TDSCURSOR cursor 
    )

    Deallocate cursor on idle.

    This let libTDS close the cursor when possible.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    cursorcursor to close
    Here is the call graph for this function:

    ◆ tds_deferred_unprepare()

    TDSRET tds_deferred_unprepare ( TDSCONNECTION conn,
    TDSDYNAMIC dyn 
    )

    Unprepare dynamic on idle.

    This let libTDS close the prepared statement when possible.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    dyndynamic request to close
    Here is the call graph for this function:

    ◆ tds_get_column_declaration()

    TDSRET tds_get_column_declaration ( TDSSOCKET tds,
    TDSCOLUMN curcol,
    char *  out 
    )

    Return declaration for column (like "varchar(20)").

    This depends on:

    • on_server.column_type
    • varint_size (for varchar(max) distinction)
    • column_size
    • precision/scale (numeric)
    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    curcolcolumn
    outbuffer to hold declaration
    Returns
    TDS_FAIL or TDS_SUCCESS
    Here is the caller graph for this function:

    ◆ tds_needs_unprepare()

    int tds_needs_unprepare ( TDSCONNECTION conn,
    TDSDYNAMIC dyn 
    )

    Check if dynamic request must be unprepared.

    Depending on status and protocol version request should be unprepared or not.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    dyndynamic request to check
    Here is the caller graph for this function:

    ◆ tds_next_placeholder()

    const char* tds_next_placeholder ( const char *  start)

    Get position of next placeholder.

    Parameters
    startpointer to part of query to search
    Returns
    next placeholder or NULL if not found
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_next_placeholder_ucs2le()

    static const char* tds_next_placeholder_ucs2le ( const char *  start,
    const char *  end,
    int  named 
    )
    static

    Found the next placeholder (? or @param) in a string.

    String must be encoded in ucs2le.

    Parameters
    startstart of the string (or part of it)
    endend of string
    namedtrue if named parameters should be returned
    Returns
    either start of next placeholder or end if not found
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_put_data()

    static TDSRET tds_put_data ( TDSSOCKET tds,
    TDSCOLUMN curcol 
    )
    inlinestatic

    Write data to wire.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    curcolcolumn where store column information
    Returns
    TDS_FAIL on error or TDS_SUCCESS

    ◆ tds_put_data_info()

    static TDSRET tds_put_data_info ( TDSSOCKET tds,
    TDSCOLUMN curcol,
    int  flags 
    )
    static

    Put data information to wire.

    Parameters
    tdsstate information for the socket and the TDS protocol
    curcolcolumn where to store information
    flagsbit flags on how to send data (use TDS_PUT_DATA_USE_NAME for use name information)
    Returns
    TDS_SUCCESS or TDS_FAIL

    ◆ tds_put_param_as_string()

    static TDSRET tds_put_param_as_string ( TDSSOCKET tds,
    TDSPARAMINFO params,
    int  n 
    )
    static

    Send a parameter to server.

    Parameters are converted to string and sent to server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    paramsparameters structure
    nnumber of parameter to send
    Returns
    TDS_FAIL or TDS_SUCCESS
    Here is the caller graph for this function:

    ◆ tds_query_flush_packet()

    static TDSRET tds_query_flush_packet ( TDSSOCKET tds)
    static

    Flush query packet.

    Used at the end of packet write to really send packet to server. This also changes the state to TDS_PENDING.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_quote()

    static size_t tds_quote ( TDSSOCKET tds,
    char *  buffer,
    char  quoting,
    const char *  id,
    size_t  len 
    )
    static

    Quote a string properly.

    Output string is always NUL-terminated

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    bufferoutput buffer. If NULL function will just return required bytes
    quotingquote character (should be one of '\'', '"', ']')
    idstring to quote
    lenlength of string to quote
    Returns
    size of output string

    ◆ tds_quote_and_put()

    static void tds_quote_and_put ( TDSSOCKET tds,
    const char *  s,
    const char *  end 
    )
    static

    Send a string to server while quoting it.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    sstring start
    endstring end
    Here is the call graph for this function:

    ◆ tds_quote_id()

    size_t tds_quote_id ( TDSSOCKET tds,
    char *  buffer,
    const char *  id,
    int  idlen 
    )

    Quote an id.

    Parameters
    tdsstate information for the socket and the TDS protocol
    bufferbuffer to store quoted id. If NULL do not write anything (useful to compute quote length)
    idid to quote
    idlenid length (< 0 for NUL terminated)
    Returns
    written chars (not including needed terminator)
    See also
    tds_quote_id_rpc

    ◆ tds_quote_id_rpc()

    size_t tds_quote_id_rpc ( TDSSOCKET tds,
    char *  buffer,
    const char *  id,
    int  idlen 
    )

    Quote an id for a RPC call.

    Parameters
    tdsstate information for the socket and the TDS protocol
    bufferbuffer to store quoted id. If NULL do not write anything (useful to compute quote length)
    idid to quote
    idlenid length (< 0 for NUL terminated)
    Returns
    written chars (not including needed terminator)
    See also
    tds_quote_id

    ◆ tds_quote_string()

    size_t tds_quote_string ( TDSSOCKET tds,
    char *  buffer,
    const char *  str,
    int  len 
    )

    Quote a string.

    Parameters
    tdsstate information for the socket and the TDS protocol
    bufferbuffer to store quoted id. If NULL do not write anything (useful to compute quote length)
    strstring to quote (not necessary NUL-terminated)
    lenlength of string (-1 for NUL-terminated)
    Returns
    written chars (not including needed terminator)

    ◆ tds_send_cancel()

    TDSRET tds_send_cancel ( TDSSOCKET tds)

    tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called directly after this.

    Parameters
    tdsstate information for the socket and the TDS protocol
    Remarks
    tcp will either deliver the packet or time out. (TIME_WAIT determines how long it waits between retries.)

    On sending the cancel, we may get EAGAIN. We then select(2) until we know either 1) it succeeded or 2) it didn't. On failure, close the socket, tell the app, and fail the function.

    On success, we read(2) and wait for a reply with select(2). If we get one, great. If the client's timeout expires, we tell him, but all we can do is wait some more or give up and close the connection. If he tells us to cancel again, we wait some more.

    Here is the call graph for this function:

    ◆ tds_set_cur_cursor()

    static void tds_set_cur_cursor ( TDSSOCKET tds,
    TDSCURSOR cursor 
    )
    inlinestatic

    Set current cursor.

    Current cursor is the one will receive output from server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    cursorcursor to set as current

    ◆ tds_set_cur_dyn()

    void tds_set_cur_dyn ( TDSSOCKET tds,
    TDSDYNAMIC dyn 
    )

    Set current dynamic.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    dyndynamic to set

    ◆ tds_skip_comment()

    const char* tds_skip_comment ( const char *  s)

    Skip a comment in a query.

    Parameters
    sstart of the string (or part of it)
    Returns
    pointer to end of comment
    Here is the caller graph for this function:

    ◆ tds_skip_comment_ucs2le()

    static const char* tds_skip_comment_ucs2le ( const char *  s,
    const char *  end 
    )
    static

    Skip a comment in a query.

    Parameters
    sstart of the string (or part of it). Encoded in ucs2le
    endend of string
    Returns
    pointer to end of comment
    Here is the caller graph for this function:

    ◆ tds_skip_quoted()

    const char* tds_skip_quoted ( const char *  s)

    Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd])

    Parameters
    spointer to first quoting character.
    Should be ', " or [. 
    Returns
    character after quoting
    Here is the caller graph for this function:

    ◆ tds_skip_quoted_ucs2le()

    static const char* tds_skip_quoted_ucs2le ( const char *  s,
    const char *  end 
    )
    static

    Return pointer to end of a quoted string.

    At the beginning pointer should point to delimiter.

    Parameters
    sstart of string to skip encoded in ucs2le
    endpointer to end of string
    Here is the caller graph for this function:

    ◆ tds_start_query()

    void tds_start_query ( TDSSOCKET tds,
    unsigned char  packet_type 
    )

    Start query packet of a given type.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    packet_typepacket type
    Here is the call graph for this function:

    ◆ tds_start_query_head()

    static TDSRET tds_start_query_head ( TDSSOCKET tds,
    unsigned char  packet_type,
    TDSHEADERS head 
    )
    static

    Start query packet of a given type.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    packet_typepacket type
    headextra information to put in a TDS7 header
    Here is the caller graph for this function:

    ◆ tds_submit_begin_tran()

    TDSRET tds_submit_begin_tran ( TDSSOCKET tds)

    Send a rollback request.

    TDS 7.2+ need this in order to handle transactions correctly if MARS is used.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    See also
    tds_submit_commit, tds_submit_rollback

    ◆ tds_submit_commit()

    TDSRET tds_submit_commit ( TDSSOCKET tds,
    int  cont 
    )

    Send a commit request.

    TDS 7.2+ need this in order to handle transactions correctly if MARS is used.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    conttrue to start a new transaction
    See also
    tds_submit_rollback, tds_submit_begin_tran

    ◆ tds_submit_execdirect()

    TDSRET tds_submit_execdirect ( TDSSOCKET tds,
    const char *  query,
    TDSPARAMINFO params,
    TDSHEADERS head 
    )

    Submit a prepared query with parameters.

    Parameters
    tdsstate information for the socket and the TDS protocol
    querylanguage query with given placeholders (?)
    paramsparameters to send
    Returns
    TDS_FAIL or TDS_SUCCESS

    ◆ tds_submit_execute()

    TDSRET tds_submit_execute ( TDSSOCKET tds,
    TDSDYNAMIC dyn 
    )

    Sends a previously prepared dynamic statement to the server.

    Parameters
    tdsstate information for the socket and the TDS protocol
    dyndynamic proc to execute. Must build from same tds.
    Here is the call graph for this function:

    ◆ tds_submit_optioncmd()

    TDSRET tds_submit_optioncmd ( TDSSOCKET tds,
    TDS_OPTION_CMD  command,
    TDS_OPTION  option,
    TDS_OPTION_ARG param,
    TDS_INT  param_size 
    )

    Send option commands to server.

    Option commands are used to change server options.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    commandcommand type.
    optionoption to set/get.
    paramparameter value
    param_sizelength of parameter value in bytes
    Here is the call graph for this function:

    ◆ tds_submit_prepare()

    TDSRET tds_submit_prepare ( TDSSOCKET tds,
    const char *  query,
    const char *  id,
    TDSDYNAMIC **  dyn_out,
    TDSPARAMINFO params 
    )

    Creates a temporary stored procedure in the server.

    Under TDS 4.2 dynamic statements are emulated building sql command. TDS 5 does not uses parameters type. TDS 7+ uses parameter types to prepare the query. You should prepare again the query if parameters changes.

    Parameters
    tdsstate information for the socket and the TDS protocol
    querylanguage query with given placeholders (?)
    idstring to identify the dynamic query. Pass NULL for automatic generation.
    dyn_outwill receive allocated TDSDYNAMIC*. Any older allocated dynamic won't be freed, Can be NULL.
    paramsparameters to use. It can be NULL even if parameters are present. Used only for TDS7+
    Returns
    TDS_FAIL or TDS_SUCCESS

    ◆ tds_submit_query()

    TDSRET tds_submit_query ( TDSSOCKET tds,
    const char *  query 
    )

    Sends a language string to the database server for processing.

    TDS 4.2 is a plain text message with a packet type of 0x01, TDS 7.0 is a unicode string with packet type 0x01, and TDS 5.0 uses a TDS_LANGUAGE_TOKEN to encapsulate the query and a packet type of 0x0f.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    querylanguage query to submit
    Returns
    TDS_FAIL or TDS_SUCCESS
    Here is the call graph for this function:

    ◆ tds_submit_query_params()

    TDSRET tds_submit_query_params ( TDSSOCKET tds,
    const char *  query,
    TDSPARAMINFO params,
    TDSHEADERS head 
    )

    Sends a language string to the database server for processing.

    TDS 4.2 is a plain text message with a packet type of 0x01, TDS 7.0 is a unicode string with packet type 0x01, and TDS 5.0 uses a TDS_LANGUAGE_TOKEN to encapsulate the query and a packet type of 0x0f.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    querylanguage query to submit
    paramsparameters of query
    Returns
    TDS_FAIL or TDS_SUCCESS
    Here is the caller graph for this function:

    ◆ tds_submit_queryf()

    TDSRET tds_submit_queryf ( TDSSOCKET tds,
    const char *  queryf,
      ... 
    )

    Format and submit a query.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    queryfquery format. printf like expansion is performed on this query.
    Here is the caller graph for this function:

    ◆ tds_submit_rollback()

    TDSRET tds_submit_rollback ( TDSSOCKET tds,
    int  cont 
    )

    Send a rollback request.

    TDS 7.2+ need this in order to handle transactions correctly if MARS is used.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    conttrue to start a new transaction
    See also
    tds_submit_begin_tran, tds_submit_commit

    ◆ tds_submit_rpc()

    TDSRET tds_submit_rpc ( TDSSOCKET tds,
    const char *  rpc_name,
    TDSPARAMINFO params,
    TDSHEADERS head 
    )

    Calls a RPC from server.

    Output parameters will be stored in tds->param_info.

    Parameters
    tdsstate information for the socket and the TDS protocol
    rpc_namename of RPC
    paramsparameters informations. NULL for no parameters
    Here is the call graph for this function:

    ◆ tds_submit_unprepare()

    TDSRET tds_submit_unprepare ( TDSSOCKET tds,
    TDSDYNAMIC dyn 
    )

    Send a unprepare request for a prepared query.

    Parameters
    tdsstate information for the socket and the TDS protocol
    dyndynamic query
    Returns
    TDS_SUCCESS or TDS_FAIL
    static size_t tds_ascii_to_ucs2(char *buffer, const char *buf)
    Accept an ASCII string, convert it to UCS2-LE The input is NUL-terminated, but the output does not co...
    Definition: query.c:91
    freetds-1.3.6/doc/reference/a00564.dot000644 025423 025423 00000001123 14162303417 020633 0ustar00fredianofrediano000000 000000 digraph "Network functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Network functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Functions for reading or writing from network."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00562_ga69559de43b47f4a9e2eecc7a56527444_cgraph.dot000644 025423 025423 00000001734 14162303417 027103 0ustar00fredianofrediano000000 000000 digraph "tds_alloc_dynamic" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_alloc_dynamic",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Allocate a dynamic statement."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_dynid",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00562.html#ga501af7e6186e59c257729599a044a30b",tooltip="Get an id for dynamic query based on TDS information."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_lookup_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga595fe391e60a71bd98ffd53b4c015e44",tooltip="Finds a dynamic given string id."]; } freetds-1.3.6/doc/reference/a00562_gabf2fdb0def5388508602ee7dd2f49506_cgraph.dot000644 025423 025423 00000001256 14162303417 027226 0ustar00fredianofrediano000000 000000 digraph "tds_release_dynamic" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_release_dynamic",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Frees dynamic statement."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_detach_results",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00562.html#ga1d60bf443e274797b1d1a9e7418ab962",tooltip="Detach result info from it current socket."]; } freetds-1.3.6/doc/reference/a00563_ga05ac7bab753d19b6ba1ffc7505d8fcd0_icgraph.dot000644 025423 025423 00000001301 14162303417 027563 0ustar00fredianofrediano000000 000000 digraph "tds_needs_unprepare" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_needs_unprepare",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Check if dynamic request must be unprepared."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_deferred_unprepare",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga9f80fdf732b084aef7de7a323261aa61",tooltip="Unprepare dynamic on idle."]; } freetds-1.3.6/doc/reference/a00563_ga0cd19215e9169ea299a6c9cbf5b2fb60_cgraph.dot000644 025423 025423 00000002516 14162303417 027222 0ustar00fredianofrediano000000 000000 digraph "tds_count_placeholders_ucs2le" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_count_placeholders\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Count the number of placeholders ('?') in a query."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_next_placeholder\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaa823973b74efdf1ff00f340496bff614",tooltip="Found the next placeholder (? or @param) in a string."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_skip_comment_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gab304fda9f325e852ba5c5252079d22e3",tooltip="Skip a comment in a query."]; Node2 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_skip_quoted_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2361ec4629aa0eac38f1702b03ed8185",tooltip="Return pointer to end of a quoted string."]; } freetds-1.3.6/doc/reference/a00563_ga0da385231bfa3dc49377e1fb2bea2c07_cgraph.dot000644 025423 025423 00000001254 14162303417 027252 0ustar00fredianofrediano000000 000000 digraph "tds_start_query" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_start_query",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start query packet of a given type."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_start_query_head",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga9ad2e6defce530a8778791cce0166ccd",tooltip="Start query packet of a given type."]; } freetds-1.3.6/doc/reference/a00563_ga0e2e7230c425e925402d7856ff5b4b18_icgraph.dot000644 025423 025423 00000001267 14162303417 027070 0ustar00fredianofrediano000000 000000 digraph "tds_put_param_as_string" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_put_param_as_string",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send a parameter to server."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds4_send_emulated_rpc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080",tooltip="Send RPC as string query."]; } freetds-1.3.6/doc/reference/a00563_ga11338742dc30fd0c2711f58eb830316f_cgraph.dot000644 025423 025423 00000001345 14162303417 026677 0ustar00fredianofrediano000000 000000 digraph "tds_send_cancel" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_send_cancel",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds_send_cancel() sends an empty packet (8 byte header only) tds_process_cancel should be called dire..."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00563_ga2361ec4629aa0eac38f1702b03ed8185_icgraph.dot000644 025423 025423 00000002067 14162303417 027211 0ustar00fredianofrediano000000 000000 digraph "tds_skip_quoted_ucs2le" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_skip_quoted_ucs2le",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return pointer to end of a quoted string."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_next_placeholder\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaa823973b74efdf1ff00f340496bff614",tooltip="Found the next placeholder (? or @param) in a string."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_count_placeholders\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga0cd19215e9169ea299a6c9cbf5b2fb60",tooltip="Count the number of placeholders ('?') in a query."]; } freetds-1.3.6/doc/reference/a00563_ga26b26296d060dca75f6a43e9ac41e58d_cgraph.dot000644 025423 025423 00000001325 14162303417 027133 0ustar00fredianofrediano000000 000000 digraph "tds_quote_and_put" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_quote_and_put",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send a string to server while quoting it."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_put_string",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga1fcaf8d488cc1390f106ce3ad0bf37b4",tooltip="Output a string to wire automatic translate string to unicode if needed."]; } freetds-1.3.6/doc/reference/a00563_ga2a64baaf4aa50ef601a49b801dfdaaf6_icgraph.dot000644 025423 025423 00000001331 14162303417 027630 0ustar00fredianofrediano000000 000000 digraph "tds_cursor_check_allocated" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_cursor_check_allocated",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Check if a cursor is allocated into the server."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_deferred_cursor\l_dealloc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga57bd0fabe5bcdeb3ef091259b3a7c1fc",tooltip="Deallocate cursor on idle."]; } freetds-1.3.6/doc/reference/a00563_ga2d0a06c1a30dd2470dc7a788de21b080_cgraph.dot000644 025423 025423 00000006516 14162303417 027106 0ustar00fredianofrediano000000 000000 digraph "tds4_send_emulated_rpc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds4_send_emulated_rpc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send RPC as string query."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_cstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga5f351a208e7aa13b4cc2d32cac8fc0fa",tooltip="Returns a C version (NUL terminated string) of dstr."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_dstr_isempty",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga197c6af67f2e7469d06c2aa055917b1e",tooltip="test if string is empty"]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_dstr_len",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga396f139e4f886ac1b224a735138e73dd",tooltip="Returns the length of the string in bytes."]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_get_column_declaration",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga50d62edeb2a432e2dc668263f3f958ff",tooltip="Return declaration for column (like \"varchar(20)\")."]; Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="tds_put_param_as_string",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga0e2e7230c425e925402d7856ff5b4b18",tooltip="Send a parameter to server."]; Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="tds_put_string",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga1fcaf8d488cc1390f106ce3ad0bf37b4",tooltip="Output a string to wire automatic translate string to unicode if needed."]; Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="tds_query_flush_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gada27f4cfce925240ad33b71b63ca692d",tooltip="Flush query packet."]; Node8 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="tds_flush_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga5feb53554e8917a81bbbc332163a61fb",tooltip="Flush packet to server."]; Node8 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a16db200d2281f76fe46fc1cbe37ca9df",tooltip="Set state of TDS connection, with logging and checking."]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00563_ga3e7b4793c6f799fbc6c174f673bb5b32_cgraph.dot000644 025423 025423 00000001277 14162303417 027165 0ustar00fredianofrediano000000 000000 digraph "tds_submit_execute" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_submit_execute",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Sends a previously prepared dynamic statement to the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00563_ga4f1f0a4f77bc4ea1440dfdebc19a157c_cgraph.dot000644 025423 025423 00000001277 14162303417 027424 0ustar00fredianofrediano000000 000000 digraph "tds5_put_params" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds5_put_params",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send parameters to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_freeze",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga6b2b012b999bd0a4f159fabc8d11a5bf",tooltip="Stop writing to server and cache every packet not sending them to server."]; } freetds-1.3.6/doc/reference/a00563_ga50d62edeb2a432e2dc668263f3f958ff_icgraph.dot000644 025423 025423 00000001327 14162303417 027377 0ustar00fredianofrediano000000 000000 digraph "tds_get_column_declaration" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_get_column_declaration",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return declaration for column (like \"varchar(20)\")."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds4_send_emulated_rpc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080",tooltip="Send RPC as string query."]; } freetds-1.3.6/doc/reference/a00563_ga57bd0fabe5bcdeb3ef091259b3a7c1fc_cgraph.dot000644 025423 025423 00000001317 14162303417 027561 0ustar00fredianofrediano000000 000000 digraph "tds_deferred_cursor_dealloc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_deferred_cursor\l_dealloc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Deallocate cursor on idle."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_cursor_check_allocated",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2a64baaf4aa50ef601a49b801dfdaaf6",tooltip="Check if a cursor is allocated into the server."]; } freetds-1.3.6/doc/reference/a00563_ga5a29ae7f99d089dc3cea85ec6ee5f3ab_cgraph.dot000644 025423 025423 00000001347 14162303417 027541 0ustar00fredianofrediano000000 000000 digraph "tds_submit_query" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_submit_query",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Sends a language string to the database server for processing."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_submit_query_params",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga95e0fccedc459a4404f496eec74a369a",tooltip="Sends a language string to the database server for processing."]; } freetds-1.3.6/doc/reference/a00563_ga5dbe51ce9533218f2da23f69ff63dda4_icgraph.dot000644 025423 025423 00000002544 14162303417 027454 0ustar00fredianofrediano000000 000000 digraph "tds_skip_quoted" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_skip_quoted",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Skip quoting string (like 'sfsf', \"dflkdj\" or [dfkjd])"]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_next_placeholder",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga6455b2991afbf7da90270787f2059d31",tooltip="Get position of next placeholder."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_count_placeholders",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaaa7b4d37bf796019e72f25c6e7fe7bea",tooltip="Count the number of placeholders ('?') in a query."]; Node3 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_send_emulated_execute",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga02c6ce3ff96369603a6ee4efee64caae",tooltip="Emulate prepared execute traslating to a normal language."]; } freetds-1.3.6/doc/reference/a00563_ga5f071b94ad7889690762dc85646c74ab_cgraph.dot000644 025423 025423 00000001713 14162303417 026744 0ustar00fredianofrediano000000 000000 digraph "tds_submit_rpc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_submit_rpc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Calls a RPC from server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a16db200d2281f76fe46fc1cbe37ca9df",tooltip="Set state of TDS connection, with logging and checking."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00563_ga6455b2991afbf7da90270787f2059d31_cgraph.dot000644 025423 025423 00000001743 14162303417 026731 0ustar00fredianofrediano000000 000000 digraph "tds_next_placeholder" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_next_placeholder",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get position of next placeholder."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_skip_comment",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaac7347ba9380d77d726648b85e9fab8f",tooltip="Skip a comment in a query."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_skip_quoted",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga5dbe51ce9533218f2da23f69ff63dda4",tooltip="Skip quoting string (like 'sfsf', \"dflkdj\" or [dfkjd])"]; } freetds-1.3.6/doc/reference/a00563_ga6455b2991afbf7da90270787f2059d31_icgraph.dot000644 025423 025423 00000002042 14162303417 027073 0ustar00fredianofrediano000000 000000 digraph "tds_next_placeholder" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_next_placeholder",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get position of next placeholder."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_count_placeholders",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaaa7b4d37bf796019e72f25c6e7fe7bea",tooltip="Count the number of placeholders ('?') in a query."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_send_emulated_execute",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga02c6ce3ff96369603a6ee4efee64caae",tooltip="Emulate prepared execute traslating to a normal language."]; } freetds-1.3.6/doc/reference/a00563_ga95e0fccedc459a4404f496eec74a369a_icgraph.dot000644 025423 025423 00000001371 14162303417 027462 0ustar00fredianofrediano000000 000000 digraph "tds_submit_query_params" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_submit_query_params",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Sends a language string to the database server for processing."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_submit_query",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga5a29ae7f99d089dc3cea85ec6ee5f3ab",tooltip="Sends a language string to the database server for processing."]; } freetds-1.3.6/doc/reference/a00563_ga9ad2e6defce530a8778791cce0166ccd_icgraph.dot000644 025423 025423 00000001274 14162303417 027541 0ustar00fredianofrediano000000 000000 digraph "tds_start_query_head" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_start_query_head",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Start query packet of a given type."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_start_query",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga0da385231bfa3dc49377e1fb2bea2c07",tooltip="Start query packet of a given type."]; } freetds-1.3.6/doc/reference/a00563_ga9f80fdf732b084aef7de7a323261aa61_cgraph.dot000644 025423 025423 00000001271 14162303417 027210 0ustar00fredianofrediano000000 000000 digraph "tds_deferred_unprepare" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_deferred_unprepare",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Unprepare dynamic on idle."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_needs_unprepare",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga05ac7bab753d19b6ba1ffc7505d8fcd0",tooltip="Check if dynamic request must be unprepared."]; } freetds-1.3.6/doc/reference/a00563_gaa823973b74efdf1ff00f340496bff614_cgraph.dot000644 025423 025423 00000002006 14162303417 027137 0ustar00fredianofrediano000000 000000 digraph "tds_next_placeholder_ucs2le" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_next_placeholder\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Found the next placeholder (? or @param) in a string."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_skip_comment_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gab304fda9f325e852ba5c5252079d22e3",tooltip="Skip a comment in a query."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_skip_quoted_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2361ec4629aa0eac38f1702b03ed8185",tooltip="Return pointer to end of a quoted string."]; } freetds-1.3.6/doc/reference/a00563_gaa823973b74efdf1ff00f340496bff614_icgraph.dot000644 025423 025423 00000001375 14162303417 027320 0ustar00fredianofrediano000000 000000 digraph "tds_next_placeholder_ucs2le" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_next_placeholder\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Found the next placeholder (? or @param) in a string."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_count_placeholders\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga0cd19215e9169ea299a6c9cbf5b2fb60",tooltip="Count the number of placeholders ('?') in a query."]; } freetds-1.3.6/doc/reference/a00563_gaaa7b4d37bf796019e72f25c6e7fe7bea_cgraph.dot000644 025423 025423 00000002442 14162303417 027371 0ustar00fredianofrediano000000 000000 digraph "tds_count_placeholders" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_count_placeholders",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Count the number of placeholders ('?') in a query."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_next_placeholder",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga6455b2991afbf7da90270787f2059d31",tooltip="Get position of next placeholder."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_skip_comment",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaac7347ba9380d77d726648b85e9fab8f",tooltip="Skip a comment in a query."]; Node2 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_skip_quoted",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga5dbe51ce9533218f2da23f69ff63dda4",tooltip="Skip quoting string (like 'sfsf', \"dflkdj\" or [dfkjd])"]; } freetds-1.3.6/doc/reference/a00563_gaaa7b4d37bf796019e72f25c6e7fe7bea_icgraph.dot000644 025423 025423 00000001357 14162303417 027546 0ustar00fredianofrediano000000 000000 digraph "tds_count_placeholders" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_count_placeholders",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Count the number of placeholders ('?') in a query."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_send_emulated_execute",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga02c6ce3ff96369603a6ee4efee64caae",tooltip="Emulate prepared execute traslating to a normal language."]; } freetds-1.3.6/doc/reference/a00563_gaac7347ba9380d77d726648b85e9fab8f_icgraph.dot000644 025423 025423 00000002510 14162303417 027332 0ustar00fredianofrediano000000 000000 digraph "tds_skip_comment" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_skip_comment",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Skip a comment in a query."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_next_placeholder",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga6455b2991afbf7da90270787f2059d31",tooltip="Get position of next placeholder."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_count_placeholders",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaaa7b4d37bf796019e72f25c6e7fe7bea",tooltip="Count the number of placeholders ('?') in a query."]; Node3 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_send_emulated_execute",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga02c6ce3ff96369603a6ee4efee64caae",tooltip="Emulate prepared execute traslating to a normal language."]; } freetds-1.3.6/doc/reference/a00563_gab304fda9f325e852ba5c5252079d22e3_icgraph.dot000644 025423 025423 00000002052 14162303417 027212 0ustar00fredianofrediano000000 000000 digraph "tds_skip_comment_ucs2le" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_skip_comment_ucs2le",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Skip a comment in a query."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_next_placeholder\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gaa823973b74efdf1ff00f340496bff614",tooltip="Found the next placeholder (? or @param) in a string."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_count_placeholders\l_ucs2le",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga0cd19215e9169ea299a6c9cbf5b2fb60",tooltip="Count the number of placeholders ('?') in a query."]; } freetds-1.3.6/doc/reference/a00563_gad695defcbf663b0023851a198206a772_icgraph.dot000644 025423 025423 00000001255 14162303417 027146 0ustar00fredianofrediano000000 000000 digraph "tds_submit_queryf" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_submit_queryf",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Format and submit a query."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_writetext_start",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a7711612cc544a7da2c7aa212b870acb2",tooltip="Start writing writetext request."]; } freetds-1.3.6/doc/reference/a00563_gada27f4cfce925240ad33b71b63ca692d_cgraph.dot000644 025423 025423 00000002362 14162303417 027263 0ustar00fredianofrediano000000 000000 digraph "tds_query_flush_packet" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_query_flush_packet",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Flush query packet."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_flush_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga5feb53554e8917a81bbbc332163a61fb",tooltip="Flush packet to server."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_set_state",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a16db200d2281f76fe46fc1cbe37ca9df",tooltip="Set state of TDS connection, with logging and checking."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00563_gada27f4cfce925240ad33b71b63ca692d_icgraph.dot000644 025423 025423 00000001255 14162303417 027434 0ustar00fredianofrediano000000 000000 digraph "tds_query_flush_packet" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_query_flush_packet",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Flush query packet."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds4_send_emulated_rpc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080",tooltip="Send RPC as string query."]; } freetds-1.3.6/doc/reference/a00563_gaf0da49585d39e99780a004ee2ca23479_cgraph.dot000644 025423 025423 00000001246 14162303417 027011 0ustar00fredianofrediano000000 000000 digraph "tds_submit_optioncmd" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_submit_optioncmd",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Send option commands to server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00564.html000644 025423 025423 00000226021 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Network functions
    FreeTDS API
    Network functions

    Functions for reading or writing from network. More...

    Collaboration diagram for Network functions:

    Classes

    struct  retry_addr
     

    Functions

    static size_t read_and_convert (TDSSOCKET *tds, TDSICONV *char_conv, size_t *wire_size, char *outbuf, size_t outbytesleft)
     For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not aligned with the character boundary. More...
     
    int tds7_get_instance_port (struct addrinfo *addr, const char *instance)
     Get port of given instance. More...
     
    int tds7_get_instance_ports (FILE *output, struct addrinfo *addr)
     Get port of all instances. More...
     
    const char * tds_addrinfo2str (struct addrinfo *addr, char *name, int namemax)
     
    static void tds_addrinfo_set_port (struct addrinfo *addr, unsigned int port)
     
    void tds_close_socket (TDSSOCKET *tds)
     Close current socket. More...
     
     TDS_COMPILE_CHECK (additional, TDS_ADDITIONAL_SPACE !=0)
     
    void tds_connection_close (TDSCONNECTION *conn)
     
    int tds_connection_read (TDSSOCKET *tds, unsigned char *buf, int buflen)
     
    static int tds_connection_signaled (TDSCONNECTION *conn)
     
    int tds_connection_write (TDSSOCKET *tds, const unsigned char *buf, int buflen, int final)
     
    DSTRtds_dstr_get (TDSSOCKET *tds, DSTR *s, size_t len)
     Reads a string from wire and put in a DSTR. More...
     
    TDSRET tds_flush_packet (TDSSOCKET *tds)
     Flush packet to server. More...
     
    void tds_freeze (TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len)
     Stop writing to server and cache every packet not sending them to server. More...
     
    TDSRET tds_freeze_abort (TDSFREEZE *freeze)
     Discard all data written after the freeze. More...
     
    TDSRET tds_freeze_close (TDSFREEZE *freeze)
     Stop keeping data for this specific freeze. More...
     
    TDSRET tds_freeze_close_len (TDSFREEZE *freeze, int32_t size)
     Stop keeping data for this specific freeze. More...
     
    static void tds_freeze_update_size (const TDSFREEZE *freeze, int32_t size)
     
    size_t tds_freeze_written (TDSFREEZE *freeze)
     Compute how many bytes has been written from freeze. More...
     
    unsigned char tds_get_byte (TDSSOCKET *tds)
     Return a single byte from the input buffer. More...
     
    TDSRET tds_get_char_data (TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol)
     Fetch character data the wire. More...
     
    bool tds_get_n (TDSSOCKET *tds, void *dest, size_t need)
     Get N bytes from the buffer and return them in the already allocated space
    given to us. More...
     
    static TDSPACKETtds_get_packet (TDSCONNECTION *conn, unsigned len)
     
    static int tds_get_socket_error (TDS_SYS_SOCKET sock)
     Returns error stored in the socket.
     
    size_t tds_get_string (TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size)
     Fetch a string from the wire. More...
     
    TDS_UINT tds_get_uint (TDSSOCKET *tds)
     Get an int32 from the server. More...
     
    TDS_UINT8 tds_get_uint8 (TDSSOCKET *tds)
     Get an uint64 from the server. More...
     
    TDS_USMALLINT tds_get_usmallint (TDSSOCKET *tds)
     Get an int16 from the server.
     
    int tds_goodread (TDSSOCKET *tds, unsigned char *buf, int buflen)
     Loops until we have received some characters return -1 on failure.
     
    int tds_goodwrite (TDSSOCKET *tds, const unsigned char *buffer, size_t buflen)
     
    int tds_init_write_buf (TDSSOCKET *tds)
     
    TDSERRNO tds_open_socket (TDSSOCKET *tds, struct addrinfo *addr, unsigned int port, int timeout, int *p_oserr)
     
    static void tds_packet_cache_add (TDSCONNECTION *conn, TDSPACKET *packet)
     
    unsigned char tds_peek (TDSSOCKET *tds)
     Reads a byte from the TDS stream without removing it. More...
     
    int tds_put_buf (TDSSOCKET *tds, const unsigned char *buf, int dsize, int ssize)
     
    int tds_put_byte (TDSSOCKET *tds, unsigned char c)
     
    int tds_put_cancel (TDSSOCKET *tds)
     
    int tds_put_int (TDSSOCKET *tds, TDS_INT i)
     
    int tds_put_int8 (TDSSOCKET *tds, TDS_INT8 i)
     
    int tds_put_n (TDSSOCKET *tds, const void *buf, size_t n)
     
    int tds_put_smallint (TDSSOCKET *tds, TDS_SMALLINT si)
     
    int tds_put_string (TDSSOCKET *tds, const char *s, int len)
     Output a string to wire automatic translate string to unicode if needed. More...
     
    int tds_read_packet (TDSSOCKET *tds)
     Read in one 'packet' from the server. More...
     
    int tds_select (TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds)
     Select on a socket until it's available or the timeout expires. More...
     
    static TDSERRNO tds_setup_socket (TDS_SYS_SOCKET *p_sock, struct addrinfo *addr, unsigned int port, int *p_oserr)
     Setup the socket and attempt a connection. More...
     
    void tds_socket_flush (TDS_SYS_SOCKET sock)
     
    static int tds_socket_read (TDSCONNECTION *conn, TDSSOCKET *tds, unsigned char *buf, int buflen)
     Read from an OS socket @TODO remove tds, save error somewhere, report error in another way. More...
     
    int tds_socket_set_nonblocking (TDS_SYS_SOCKET sock)
     Set socket to non-blocking. More...
     
    int tds_socket_set_nosigpipe (TDS_SYS_SOCKET sock, int on)
     Set socket to not throw SIGPIPE. More...
     
    static int tds_socket_write (TDSCONNECTION *conn, TDSSOCKET *tds, const unsigned char *buf, int buflen)
     Write to an OS socket. More...
     
    void tds_unget_byte (TDSSOCKET *tds)
     Unget will always work as long as you don't call it twice in a row. More...
     
    void tds_wakeup_close (TDSPOLLWAKEUP *wakeup)
     
    int tds_wakeup_init (TDSPOLLWAKEUP *wakeup)
     
    void tds_wakeup_send (TDSPOLLWAKEUP *wakeup, char cancel)
     
    TDSRET tds_write_packet (TDSSOCKET *tds, unsigned char final)
     

    Detailed Description

    Functions for reading or writing from network.

    Function Documentation

    ◆ read_and_convert()

    static size_t read_and_convert ( TDSSOCKET tds,
    TDSICONV char_conv,
    size_t *  wire_size,
    char *  outbuf,
    size_t  outbytesleft 
    )
    static

    For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not aligned with the character boundary.

    In that event, it will return an error, and some number of bytes (less than a character) will remain in the tail end of temp[]. They are moved to the beginning, ptemp is adjusted to point just behind them, and the next chunk is read.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    char_convconversion structure
    [out]wire_sizesize readed from wire
    outbufbuffer to write to
    outbytesleftbuffer length
    Returns
    bytes readed
    Here is the call graph for this function:

    ◆ tds7_get_instance_port()

    int tds7_get_instance_port ( struct addrinfo *  addr,
    const char *  instance 
    )

    Get port of given instance.

    Returns
    port number or 0 if error

    ◆ tds7_get_instance_ports()

    int tds7_get_instance_ports ( FILE *  output,
    struct addrinfo *  addr 
    )

    Get port of all instances.

    Returns
    default port number or 0 if error
    Remarks
    experimental, cf. MC-SQLR.pdf.

    ◆ tds_close_socket()

    void tds_close_socket ( TDSSOCKET tds)

    Close current socket.

    For last socket close entire connection. For MARS send FIN request. This attempts a graceful disconnection, for ungraceful call tds_connection_close.

    ◆ tds_dstr_get()

    DSTR* tds_dstr_get ( TDSSOCKET tds,
    DSTR s,
    size_t  len 
    )

    Reads a string from wire and put in a DSTR.

    On error we read the bytes from the wire anyway.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    [out]soutput string
    [in]lenstring length (in characters)
    Returns
    string or NULL on error

    ◆ tds_flush_packet()

    TDSRET tds_flush_packet ( TDSSOCKET tds)

    Flush packet to server.

    Returns
    TDS_FAIL or TDS_SUCCESS
    Here is the caller graph for this function:

    ◆ tds_freeze()

    void tds_freeze ( TDSSOCKET tds,
    TDSFREEZE freeze,
    unsigned  size_len 
    )

    Stop writing to server and cache every packet not sending them to server.

    This is used to write data without worrying to compute length before. If size_len is provided the number of bytes written between tds_freeze and tds_freeze_close will be written as a number of size size_len. This call should be followed by a tds_freeze_close, tds_freeze_close_len or a tds_freeze_abort. Failing to match tds_freeze with a close would possibly result in a disconnection from the server.

    Parameters
    [out]freezestructure to initialize
    size_lenlength of the size to automatically write on close (0, 1, 2, or 4)
    Here is the caller graph for this function:

    ◆ tds_freeze_abort()

    TDSRET tds_freeze_abort ( TDSFREEZE freeze)

    Discard all data written after the freeze.

    After this call freeze should not be used.

    Parameters
    [in]freezestructure to work on

    ◆ tds_freeze_close()

    TDSRET tds_freeze_close ( TDSFREEZE freeze)

    Stop keeping data for this specific freeze.

    If size_len was used for tds_freeze this function write the written bytes at position when tds_freeze was called. After this call freeze should not be used.

    Parameters
    [in]freezestructure to work on
    Here is the call graph for this function:

    ◆ tds_freeze_close_len()

    TDSRET tds_freeze_close_len ( TDSFREEZE freeze,
    int32_t  size 
    )

    Stop keeping data for this specific freeze.

    Similar to tds_freeze_close but specify the size to be written instead of letting tds_freeze_close compute it. After this call freeze should not be used.

    Parameters
    [in]freezestructure to work on
    [in]sizesize to write
    Here is the caller graph for this function:

    ◆ tds_freeze_written()

    size_t tds_freeze_written ( TDSFREEZE freeze)

    Compute how many bytes has been written from freeze.

    Returns
    bytes written since tds_freeze call
    Here is the caller graph for this function:

    ◆ tds_get_byte()

    unsigned char tds_get_byte ( TDSSOCKET tds)

    Return a single byte from the input buffer.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_get_char_data()

    TDSRET tds_get_char_data ( TDSSOCKET tds,
    char *  row_buffer,
    size_t  wire_size,
    TDSCOLUMN curcol 
    )

    Fetch character data the wire.

    Output is NOT null terminated. If char_conv is not NULL, convert data accordingly.

    Parameters
    tdsstate information for the socket and the TDS protocol
    row_bufferdestination buffer in current_row. Can't be NULL
    wire_sizesize to read from wire (in bytes)
    curcolcolumn information
    Returns
    TDS_SUCCESS or TDS_FAIL (probably memory error on text data)

    ◆ tds_get_n()

    bool tds_get_n ( TDSSOCKET tds,
    void *  dest,
    size_t  need 
    )

    Get N bytes from the buffer and return them in the already allocated space
    given to us.

    We ASSUME that the person calling this function has done the
    bounds checking for us since they know how many bytes they want here. dest of NULL means we just want to eat the bytes. (tethe.nosp@m.row@.nosp@m.nol.o.nosp@m.rg)

    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_get_string()

    size_t tds_get_string ( TDSSOCKET tds,
    size_t  string_len,
    char *  dest,
    size_t  dest_size 
    )

    Fetch a string from the wire.

    Output string is NOT null terminated. If TDS version is 7 or 8 read unicode string and convert it. This function should be use to read server default encoding strings like columns name, table names, etc, not for data (use tds_get_char_data instead)

    Returns
    bytes written to dest
    Parameters
    tdsconnection information
    string_lenlength of string to read from wire (in server characters, bytes for tds4-tds5, ucs2 for tds7+)
    destdestination buffer, if NULL string is read and discarded
    dest_sizedestination buffer size, in bytes

    ◆ tds_get_uint()

    TDS_UINT tds_get_uint ( TDSSOCKET tds)

    Get an int32 from the server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_get_uint8()

    TDS_UINT8 tds_get_uint8 ( TDSSOCKET tds)

    Get an uint64 from the server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_goodwrite()

    int tds_goodwrite ( TDSSOCKET tds,
    const unsigned char *  buffer,
    size_t  buflen 
    )
    Parameters
    tdsthe famous socket
    bufferdata to send
    buflenbytes in buffer
    last1 if this is the last packet, else 0
    Returns
    length written (>0), <0 on failure

    ◆ tds_peek()

    unsigned char tds_peek ( TDSSOCKET tds)

    Reads a byte from the TDS stream without removing it.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_put_string()

    int tds_put_string ( TDSSOCKET tds,
    const char *  s,
    int  len 
    )

    Output a string to wire automatic translate string to unicode if needed.

    Returns
    bytes written to wire
    Parameters
    tdsstate information for the socket and the TDS protocol
    sstring to write
    lenlength of string in characters, or -1 for null terminated
    Here is the caller graph for this function:

    ◆ tds_read_packet()

    int tds_read_packet ( TDSSOCKET tds)

    Read in one 'packet' from the server.

    This is a wrapped outer packet of the protocol (they bundle result packets into chunks and wrap them at what appears to be 512 bytes regardless of how that breaks internal packet up. (tetherow@nol.org)

    Returns
    bytes read or -1 on failure
    Here is the caller graph for this function:

    ◆ tds_select()

    int tds_select ( TDSSOCKET tds,
    unsigned  tds_sel,
    int  timeout_seconds 
    )

    Select on a socket until it's available or the timeout expires.

    Meanwhile, call the interrupt function.

    Returns
    >0 ready descriptors 0 timeout <0 error (cf. errno). Caller should close socket and return failure. This function does not call tdserror or close the socket because it can't know the context in which it's being called.

    ◆ tds_setup_socket()

    static TDSERRNO tds_setup_socket ( TDS_SYS_SOCKET *  p_sock,
    struct addrinfo *  addr,
    unsigned int  port,
    int *  p_oserr 
    )
    static

    Setup the socket and attempt a connection.

    Function allocate the socket in *p_sock and try to start a connection.

    Parameters
    p_sockwhere returned socket is stored. Socket is stored even on error. Can be INVALID_SOCKET.
    addraddress to use for attempting the connection
    portport to connect to
    p_oserrwhere system error is returned
    Returns
    TDSEOK is success, TDSEINPROGRESS if connection attempt is started or any other error.

    ◆ tds_socket_read()

    static int tds_socket_read ( TDSCONNECTION conn,
    TDSSOCKET tds,
    unsigned char *  buf,
    int  buflen 
    )
    static

    Read from an OS socket @TODO remove tds, save error somewhere, report error in another way.

    Returns
    0 if blocking, <0 error >0 bytes read

    ◆ tds_socket_set_nonblocking()

    int tds_socket_set_nonblocking ( TDS_SYS_SOCKET  sock)

    Set socket to non-blocking.

    Parameters
    socksocket to set
    Returns
    0 on success or error code

    ◆ tds_socket_set_nosigpipe()

    int tds_socket_set_nosigpipe ( TDS_SYS_SOCKET  sock,
    int  on 
    )

    Set socket to not throw SIGPIPE.

    Not many systems support this feature (in this case ENOTSUP can be returned).

    Parameters
    socksocket to set
    onflag if enable or disable
    Returns
    0 on success or error code

    ◆ tds_socket_write()

    static int tds_socket_write ( TDSCONNECTION conn,
    TDSSOCKET tds,
    const unsigned char *  buf,
    int  buflen 
    )
    static

    Write to an OS socket.

    Returns
    0 if blocking, <0 error >0 bytes readed

    ◆ tds_unget_byte()

    void tds_unget_byte ( TDSSOCKET tds)

    Unget will always work as long as you don't call it twice in a row.

    It it may work if you call it multiple times as long as you don't backup over the beginning of network packet boundary which can occur anywhere in the token stream.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    freetds-1.3.6/doc/reference/a00564_ga0cb72d3f6943795c39db1fa692be0a58_cgraph.dot000644 025423 025423 00000001253 14162303417 027143 0ustar00fredianofrediano000000 000000 digraph "tds_get_byte" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_get_byte",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return a single byte from the input buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00564_ga0cb72d3f6943795c39db1fa692be0a58_icgraph.dot000644 025423 025423 00000002001 14162303417 027304 0ustar00fredianofrediano000000 000000 digraph "tds_get_byte" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_get_byte",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Return a single byte from the input buffer."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_peek",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga221e98a9c8be96ec6c8547891e1b53af",tooltip="Reads a byte from the TDS stream without removing it."]; Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_process_param_result\l_tokens",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga9fdef8228d29cab7fa9098f07fa73fba",tooltip="Process parameters from networks."]; } freetds-1.3.6/doc/reference/a00564_ga1fcaf8d488cc1390f106ce3ad0bf37b4_icgraph.dot000644 025423 025423 00000002014 14162303417 027510 0ustar00fredianofrediano000000 000000 digraph "tds_put_string" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_put_string",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Output a string to wire automatic translate string to unicode if needed."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds4_send_emulated_rpc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080",tooltip="Send RPC as string query."]; Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_quote_and_put",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga26b26296d060dca75f6a43e9ac41e58d",tooltip="Send a string to server while quoting it."]; } freetds-1.3.6/doc/reference/a00564_ga221e98a9c8be96ec6c8547891e1b53af_cgraph.dot000644 025423 025423 00000001731 14162303417 027163 0ustar00fredianofrediano000000 000000 digraph "tds_peek" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_peek",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reads a byte from the TDS stream without removing it."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_byte",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga0cb72d3f6943795c39db1fa692be0a58",tooltip="Return a single byte from the input buffer."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00564_ga2660b893ae2bf36fe1b63b354e748bad_icgraph.dot000644 025423 025423 00000001315 14162303417 027363 0ustar00fredianofrediano000000 000000 digraph "tds_freeze_close_len" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_freeze_close_len",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Stop keeping data for this specific freeze."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_freeze_close",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga633f62fb8e5310abfa42c02fba9c6500",tooltip="Stop keeping data for this specific freeze."]; } freetds-1.3.6/doc/reference/a00564_ga410619783bdf2bb60b0f27a5578e0e07_icgraph.dot000644 025423 025423 00000014022 14162303417 027134 0ustar00fredianofrediano000000 000000 digraph "tds_read_packet" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Read in one 'packet' from the server."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_byte",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga0cb72d3f6943795c39db1fa692be0a58",tooltip="Return a single byte from the input buffer."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_peek",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga221e98a9c8be96ec6c8547891e1b53af",tooltip="Reads a byte from the TDS stream without removing it."]; Node2 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_process_param_result\l_tokens",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga9fdef8228d29cab7fa9098f07fa73fba",tooltip="Process parameters from networks."]; Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node5 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="tds_get_uint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga9ac121c269e203337a48c5bf8afc48c3",tooltip="Get an int32 from the server."]; Node6 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="tds5_process_dyn_result2",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gae688b515631141acfbc41bbb91c8b921",tooltip="Process new TDS 5.0 token for describing output parameters."]; Node5 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="tds_get_uint8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga8ab6c87318eaf15ea17a9575763f7809",tooltip="Get an uint64 from the server."]; Node5 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node9 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="tds_process_col_fmt",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga4e3dd9d3614f5f0433b78b761dd68741",tooltip="tds_process_col_fmt() is the other half of result set processing under TDS 4.2."]; Node9 -> Node11 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_process_col_name",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga905d2fa5e1b602817bd16bb0fcf9eadb",tooltip="tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names,..."]; Node9 -> Node12 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 [label="tds_process_colinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga22c7f413d43fc0d511e122a3de389166",tooltip="Reads column information."]; Node9 -> Node13 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="tds_process_compute\l_names",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gae5b3e01f3d665f9e377de091f46f1ab9",tooltip="tds_process_compute_names() processes compute result sets."]; Node9 -> Node14 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="tds_process_cursor\l_tokens",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga315d875d90c64d12d61fc9e33b4dee96",tooltip="Reads cursor command results."]; Node9 -> Node15 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="tds_process_dyn_result",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga416cf119c1d4a0fca27dc5b50c261358",tooltip="Process results from dynamic."]; Node9 -> Node16 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="tds_process_end",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga7a081cf9bb8f04ead12f0299fb7c4cd9",tooltip="tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens."]; Node9 -> Node17 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="tds_process_env_chg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga3e1b4df4410a86a563a8c155e7799720",tooltip="tds_process_env_chg() when ever certain things change on the server, such as database,..."]; Node9 -> Node18 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="tds_process_tabname",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gaeec59bca9bd0c5388e245f0d19d9c81a",tooltip="Process list of table from network."]; Node5 -> Node12 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00565.dot000644 025423 025423 00000001100 14162303417 020627 0ustar00fredianofrediano000000 000000 digraph "Results processing" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Results processing",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Handle tokens in packets."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00565.html000644 025423 025423 00000314346 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: Results processing
    FreeTDS API
    Results processing

    Handle tokens in packets. More...

    Collaboration diagram for Results processing:

    Classes

    struct  namelist
     Holds list of names. More...
     

    Functions

    static void adjust_character_column_size (TDSSOCKET *tds, TDSCOLUMN *curcol)
     Adjust column size according to client's encoding. More...
     
    static int determine_adjusted_size (const TDSICONV *char_conv, int size)
     Allow for maximum possible size of converted data, while being careful about integer division truncation. More...
     
    static TDSRET tds5_process_dyn_result2 (TDSSOCKET *tds)
     Process new TDS 5.0 token for describing output parameters. More...
     
    static TDSRET tds5_process_optioncmd (TDSSOCKET *tds)
     Process option cmd results. More...
     
    static TDSRET tds5_process_result (TDSSOCKET *tds)
     tds5_process_result() is the TDS 5.0 result set processing routine. More...
     
    static TDSRET tds5_process_result2 (TDSSOCKET *tds)
     tds5_process_result2() is the new TDS 5.0 result set processing routine. More...
     
    static int tds71_read_table_names (TDSSOCKET *tds, int remainder, struct namelist **p_head)
     Reads table names for TDS 7.1+. More...
     
    static TDSRET tds7_get_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol)
     Reads data information from wire. More...
     
    static TDSRET tds7_process_compute_result (TDSSOCKET *tds)
     tds7_process_compute_result() processes compute result sets for TDS 7/8. More...
     
    static TDSRET tds7_process_result (TDSSOCKET *tds)
     tds7_process_result() is the TDS 7.0 result set processing routine. More...
     
    static int tds_alloc_get_string (TDSSOCKET *tds, char **string, size_t len)
     Reads a string from wire in a new allocated buffer. More...
     
    static void tds_free_namelist (struct namelist *head)
     Frees list of names. More...
     
    static TDSRET tds_get_data_info (TDSSOCKET *tds, TDSCOLUMN *curcol, int is_param)
     Reads data metadata from wire. More...
     
    int tds_get_token_size (int marker)
     tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determine how to read past a token More...
     
    TDSDYNAMICtds_lookup_dynamic (TDSCONNECTION *conn, const char *id)
     Finds a dynamic given string id. More...
     
    static const char * tds_pr_op (int op)
     Returns string representation for a given operation. More...
     
    static TDSRET tds_process_auth (TDSSOCKET *tds)
     Process authentication token. More...
     
    TDSRET tds_process_cancel (TDSSOCKET *tds)
     
    static TDSRET tds_process_col_fmt (TDSSOCKET *tds)
     tds_process_col_fmt() is the other half of result set processing under TDS 4.2. More...
     
    static TDSRET tds_process_col_name (TDSSOCKET *tds)
     tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names, a TDS_COLFMT_TOKEN should immediately follow this token with the datatype/size information This is a 4.2 only function More...
     
    static TDSRET tds_process_colinfo (TDSSOCKET *tds, char **names, int num_names)
     Reads column information. More...
     
    static TDSRET tds_process_compute (TDSSOCKET *tds)
     tds_process_compute() processes compute rows and places them in the row buffer. More...
     
    static TDSRET tds_process_compute_names (TDSSOCKET *tds)
     tds_process_compute_names() processes compute result sets. More...
     
    static TDSRET tds_process_compute_result (TDSSOCKET *tds)
     tds_process_compute_result() processes compute result sets. More...
     
    static TDSRET tds_process_cursor_tokens (TDSSOCKET *tds)
     Reads cursor command results. More...
     
    static TDSRET tds_process_default_tokens (TDSSOCKET *tds, int marker)
     tds_process_default_tokens() is a catch all function that is called to process tokens not known to other tds_process_* routines More...
     
    static TDSRET tds_process_dyn_result (TDSSOCKET *tds)
     Process results from dynamic. More...
     
    static TDSDYNAMICtds_process_dynamic (TDSSOCKET *tds)
     tds_process_dynamic() finds the element of the dyns array for the id More...
     
    static TDSRET tds_process_end (TDSSOCKET *tds, int marker, int *flags_parm)
     tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens. More...
     
    static TDSRET tds_process_env_chg (TDSSOCKET *tds)
     tds_process_env_chg() when ever certain things change on the server, such as database, character set, language, or block size. More...
     
    static TDSRET tds_process_env_routing (TDSSOCKET *tds)
     
    static TDSRET tds_process_featureextack (TDSSOCKET *tds)
     
    static TDSRET tds_process_info (TDSSOCKET *tds, int marker)
     tds_process_info() is called for INFO, ERR, or EED tokens and is responsible for calling the CLI's message handling routine More...
     
    TDSRET tds_process_login_tokens (TDSSOCKET *tds)
     tds_process_login_tokens() is called after sending the login packet to the server. More...
     
    static TDSRET tds_process_loginack (TDSSOCKET *tds, TDSRET *login_succeeded)
     
    static TDSRET tds_process_nbcrow (TDSSOCKET *tds)
     tds_process_nbcrow() processes rows and places them in the row buffer.
     
    static TDSRET tds_process_param_result (TDSSOCKET *tds, TDSPARAMINFO **pinfo)
     process output parameters of a stored procedure. More...
     
    static TDSRET tds_process_param_result_tokens (TDSSOCKET *tds)
     Process parameters from networks. More...
     
    static TDSRET tds_process_params_result_token (TDSSOCKET *tds)
     tds_process_params_result_token() processes params on TDS5. More...
     
    static void tds_process_pending_closes (TDSSOCKET *tds)
     Attempt to close all deferred closes (dynamics and cursors). More...
     
    static TDSRET tds_process_row (TDSSOCKET *tds)
     tds_process_row() processes rows and places them in the row buffer. More...
     
    TDSRET tds_process_simple_query (TDSSOCKET *tds)
     Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results, beware they are discarded. More...
     
    static TDSRET tds_process_tabname (TDSSOCKET *tds)
     Process list of table from network. More...
     
    TDSRET tds_process_tokens (TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag)
     process all streams. More...
     
    const char * tds_prtype (int type)
     Returns string representation of the given type. More...
     
    static int tds_read_namelist (TDSSOCKET *tds, int remainder, struct namelist **p_head, int large)
     Reads list of names (usually table names) More...
     
    static const char * tds_token_name (unsigned char marker)
     Returns string representation for a given token type. More...
     

    Detailed Description

    Handle tokens in packets.

    Many PDU (packets data unit) contain tokens. (like result description, rows, data, errors and many other).

    Function Documentation

    ◆ adjust_character_column_size()

    static void adjust_character_column_size ( TDSSOCKET tds,
    TDSCOLUMN curcol 
    )
    static

    Adjust column size according to client's encoding.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    curcolcolumn to adjust

    ◆ determine_adjusted_size()

    static int determine_adjusted_size ( const TDSICONV char_conv,
    int  size 
    )
    static

    Allow for maximum possible size of converted data, while being careful about integer division truncation.

    All character data pass through iconv. It doesn't matter if the server side is Unicode or not; even Latin1 text need conversion if, for example, the client is UTF-8.

    Parameters
    char_convconversion structure
    sizeunconverted byte size
    Returns
    maximum size for converted string

    ◆ tds5_process_dyn_result2()

    static TDSRET tds5_process_dyn_result2 ( TDSSOCKET tds)
    static

    Process new TDS 5.0 token for describing output parameters.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds5_process_optioncmd()

    static TDSRET tds5_process_optioncmd ( TDSSOCKET tds)
    static

    Process option cmd results.

    This token is available only on TDS 5.0 (Sybase).

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds5_process_result()

    static TDSRET tds5_process_result ( TDSSOCKET tds)
    static

    tds5_process_result() is the TDS 5.0 result set processing routine.

    It is responsible for populating the tds->res_info structure. This is a TDS 5.0 only function

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds5_process_result2()

    static TDSRET tds5_process_result2 ( TDSSOCKET tds)
    static

    tds5_process_result2() is the new TDS 5.0 result set processing routine.

    It is responsible for populating the tds->res_info structure. This is a TDS 5.0 only function

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds71_read_table_names()

    static int tds71_read_table_names ( TDSSOCKET tds,
    int  remainder,
    struct namelist **  p_head 
    )
    static

    Reads table names for TDS 7.1+.

    TDS 7.1+ return table names as an array of names (so database.schema.owner.name as separate names)

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    remainderbytes left to read
    p_headpointer to list head to return
    Returns
    number of element returned or -1 on error

    ◆ tds7_get_data_info()

    static TDSRET tds7_get_data_info ( TDSSOCKET tds,
    TDSCOLUMN curcol 
    )
    static

    Reads data information from wire.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    curcolcolumn where to store information

    ◆ tds7_process_compute_result()

    static TDSRET tds7_process_compute_result ( TDSSOCKET tds)
    static

    tds7_process_compute_result() processes compute result sets for TDS 7/8.

    They is are very similar to normal result sets.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds7_process_result()

    static TDSRET tds7_process_result ( TDSSOCKET tds)
    static

    tds7_process_result() is the TDS 7.0 result set processing routine.

    It is responsible for populating the tds->res_info structure. This is a TDS 7.0 only function

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_alloc_get_string()

    static int tds_alloc_get_string ( TDSSOCKET tds,
    char **  string,
    size_t  len 
    )
    static

    Reads a string from wire in a new allocated buffer.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    stringoutput string
    lenlength of string to read
    Returns
    0 for success, -1 on error.

    ◆ tds_free_namelist()

    static void tds_free_namelist ( struct namelist head)
    static

    Frees list of names.

    Parameters
    headlist head to free

    ◆ tds_get_data_info()

    static TDSRET tds_get_data_info ( TDSSOCKET tds,
    TDSCOLUMN curcol,
    int  is_param 
    )
    static

    Reads data metadata from wire.

    Parameters
    tdsstate information for the socket and the TDS protocol
    curcolcolumn where to store information
    is_paramtrue if metadata are for a parameter (false for normal column)
    Here is the call graph for this function:

    ◆ tds_get_token_size()

    int tds_get_token_size ( int  marker)

    tds_get_token_size() returns the size of a fixed length token used by tds_process_cancel() to determine how to read past a token

    Parameters
    markertoken type.

    ◆ tds_lookup_dynamic()

    TDSDYNAMIC* tds_lookup_dynamic ( TDSCONNECTION conn,
    const char *  id 
    )

    Finds a dynamic given string id.

    Returns
    dynamic or NULL is not found
    Parameters
    connstate information for the socket and the TDS protocol
    iddynamic id to search
    Here is the caller graph for this function:

    ◆ tds_pr_op()

    static const char * tds_pr_op ( int  op)
    static

    Returns string representation for a given operation.

    Parameters
    opoperation code
    Returns
    string representation. Empty if not found.

    ◆ tds_process_auth()

    static TDSRET tds_process_auth ( TDSSOCKET tds)
    static

    Process authentication token.

    This token is only TDS 7.0+.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_cancel()

    TDSRET tds_process_cancel ( TDSSOCKET tds)
    Remarks
    Process the incoming token stream until it finds an end token (DONE, DONEPROC, DONEINPROC) with the cancel flag set. At that point the connection should be ready to handle a new query.
    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_col_fmt()

    static TDSRET tds_process_col_fmt ( TDSSOCKET tds)
    static

    tds_process_col_fmt() is the other half of result set processing under TDS 4.2.

    It follows tds_process_col_name(). It contains all the column type and size information. This is a 4.2 only function

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_col_name()

    static TDSRET tds_process_col_name ( TDSSOCKET tds)
    static

    tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names, a TDS_COLFMT_TOKEN should immediately follow this token with the datatype/size information This is a 4.2 only function

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_colinfo()

    static TDSRET tds_process_colinfo ( TDSSOCKET tds,
    char **  names,
    int  num_names 
    )
    static

    Reads column information.

    This token is only TDS 4.2

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    [in]namestable names
    [in]num_namesnumber of table names
    Here is the call graph for this function:

    ◆ tds_process_compute()

    static TDSRET tds_process_compute ( TDSSOCKET tds)
    static

    tds_process_compute() processes compute rows and places them in the row buffer.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_compute_names()

    static TDSRET tds_process_compute_names ( TDSSOCKET tds)
    static

    tds_process_compute_names() processes compute result sets.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_compute_result()

    static TDSRET tds_process_compute_result ( TDSSOCKET tds)
    static

    tds_process_compute_result() processes compute result sets.

    These functions need work but since they get little use, nobody has complained! It is very similar to normal result sets.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_cursor_tokens()

    static TDSRET tds_process_cursor_tokens ( TDSSOCKET tds)
    static

    Reads cursor command results.

    This contains status of cursors.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_default_tokens()

    static TDSRET tds_process_default_tokens ( TDSSOCKET tds,
    int  marker 
    )
    static

    tds_process_default_tokens() is a catch all function that is called to process tokens not known to other tds_process_* routines

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    markerToken type
    Here is the call graph for this function:

    ◆ tds_process_dyn_result()

    static TDSRET tds_process_dyn_result ( TDSSOCKET tds)
    static

    Process results from dynamic.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_dynamic()

    static TDSDYNAMIC * tds_process_dynamic ( TDSSOCKET tds)
    static

    tds_process_dynamic() finds the element of the dyns array for the id

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Returns
    allocated dynamic or NULL on failure.

    ◆ tds_process_end()

    static TDSRET tds_process_end ( TDSSOCKET tds,
    int  marker,
    int *  flags_parm 
    )
    static

    tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens.

    Parameters
    tdsstate information for the socket and the TDS protocol
    markerTDS token number
    flags_parmfilled with bit flags (see TDS_DONE_ constants). Is NULL nothing is returned
    Here is the call graph for this function:

    ◆ tds_process_env_chg()

    static TDSRET tds_process_env_chg ( TDSSOCKET tds)
    static

    tds_process_env_chg() when ever certain things change on the server, such as database, character set, language, or block size.

    A environment change message is generated There is no action taken currently, but certain functions at the CLI level that return the name of the current database will need to use this.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_info()

    static TDSRET tds_process_info ( TDSSOCKET tds,
    int  marker 
    )
    static

    tds_process_info() is called for INFO, ERR, or EED tokens and is responsible for calling the CLI's message handling routine

    Returns
    TDS_SUCCESS if informational, TDS_FAIL if error.

    ◆ tds_process_login_tokens()

    TDSRET tds_process_login_tokens ( TDSSOCKET tds)

    tds_process_login_tokens() is called after sending the login packet to the server.

    It returns the success or failure of the login dependent on the protocol version. 4.2 sends an ACK token only when successful, TDS 5.0 sends it always with a success byte within

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_param_result()

    static TDSRET tds_process_param_result ( TDSSOCKET tds,
    TDSPARAMINFO **  pinfo 
    )
    static

    process output parameters of a stored procedure.

    This differs from regular row/compute results in that there is no total number of parameters given, they just show up singly.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    [out]pinfooutput parameter. Should point to a not allocated structure
    Here is the call graph for this function:

    ◆ tds_process_param_result_tokens()

    static TDSRET tds_process_param_result_tokens ( TDSSOCKET tds)
    static

    Process parameters from networks.

    Read all consecutives paramaters, not a single one. Parameters are then stored in tds->param_info or tds->cur_dyn->res_info depending if we are reading cursor results or normal parameters.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_params_result_token()

    static TDSRET tds_process_params_result_token ( TDSSOCKET tds)
    static

    tds_process_params_result_token() processes params on TDS5.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_pending_closes()

    static void tds_process_pending_closes ( TDSSOCKET tds)
    static

    Attempt to close all deferred closes (dynamics and cursors).

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_row()

    static TDSRET tds_process_row ( TDSSOCKET tds)
    static

    tds_process_row() processes rows and places them in the row buffer.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.

    ◆ tds_process_simple_query()

    TDSRET tds_process_simple_query ( TDSSOCKET tds)

    Process results for simple query as "SET TEXTSIZE" or "USE dbname" If the statement returns results, beware they are discarded.

    This function was written to avoid direct calls to tds_process_default_tokens (which caused problems such as ignoring query errors). Results are read until idle state or severe failure (do not stop for statement failure).

    Returns
    see tds_process_tokens for results (TDS_NO_MORE_RESULTS is never returned)

    ◆ tds_process_tabname()

    static TDSRET tds_process_tabname ( TDSSOCKET tds)
    static

    Process list of table from network.

    This token is only TDS 4.2

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_process_tokens()

    TDSRET tds_process_tokens ( TDSSOCKET tds,
    TDS_INT *  result_type,
    int *  done_flags,
    unsigned  flag 
    )

    process all streams.

    tds_process_tokens() is called after submitting a query with tds_submit_query() and is responsible for calling the routines to populate tds->res_info if appropriate (some query have no result sets)

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    result_typeA pointer to an integer variable which tds_process_tokens sets to indicate the current type of result.
    Values that indicate command status
    TDS_DONE_RESULTThe results of a command have been completely processed. This command returned no rows.
    TDS_DONEPROC_RESULTThe results of a command have been completely processed.
    This command returned rows.
    TDS_DONEINPROC_RESULTThe results of a command have been completely processed.
    This command returned rows.
    Values that indicate results information is available
    TDS_ROWFMT_RESULTRegular Data format information tds->res_info now contains the result details ; tds->current_results now points to that data
    TDS_COMPUTEFMT_ RESULTCompute data format information tds->comp_info now contains the result data; tds->current_results now points to that data
    TDS_DESCRIBE_RESULT
    Values that indicate data is available
    ValueMeaningInformation returned
    TDS_ROW_RESULTRegular row results 1 or more rows of regular data can now be retrieved
    TDS_COMPUTE_RESULTCompute row results A single row of compute data can now be retrieved
    TDS_PARAM_RESULTReturn parameter results param_info or cur_dyn->params contain returned parameters
    TDS_STATUS_RESULTStored procedure status results tds->ret_status contain the returned code
    Parameters
    done_flagsFlags contained in the TDS_DONE*_TOKEN readed
    flagFlags to select token type to stop/return
    Todo:
    Complete TDS_DESCRIBE_RESULT description
    Return values
    TDS_SUCCESSif a result set is available for processing.
    TDS_FAILon error.
    TDS_NO_MORE_RESULTSif all results have been completely processed.
    anythingreturned by one of the many functions it calls. :-(
    Here is the call graph for this function:

    ◆ tds_prtype()

    const char* tds_prtype ( int  type)

    Returns string representation of the given type.

    Parameters
    typedata type
    Returns
    type as string. Empty if not found.

    ◆ tds_read_namelist()

    static int tds_read_namelist ( TDSSOCKET tds,
    int  remainder,
    struct namelist **  p_head,
    int  large 
    )
    static

    Reads list of names (usually table names)

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    remainderbytes left to read
    p_headlist head to return
    largetrue if name length from network are 2 byte (usually 1)
    Here is the caller graph for this function:

    ◆ tds_token_name()

    static const char * tds_token_name ( unsigned char  marker)
    static

    Returns string representation for a given token type.

    Parameters
    markertoken type
    Returns
    string representation. Empty if not token not valid.
    freetds-1.3.6/doc/reference/a00564_ga528cc96da09c11bc2930daae64e33e83_icgraph.dot000644 025423 025423 00000001322 14162303417 027352 0ustar00fredianofrediano000000 000000 digraph "tds_freeze_written" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_freeze_written",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Compute how many bytes has been written from freeze."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_freeze_close",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga633f62fb8e5310abfa42c02fba9c6500",tooltip="Stop keeping data for this specific freeze."]; } freetds-1.3.6/doc/reference/a00564_ga5feb53554e8917a81bbbc332163a61fb_icgraph.dot000644 025423 025423 00000001716 14162303417 027302 0ustar00fredianofrediano000000 000000 digraph "tds_flush_packet" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_flush_packet",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Flush packet to server."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_query_flush_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#gada27f4cfce925240ad33b71b63ca692d",tooltip="Flush query packet."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds4_send_emulated_rpc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080",tooltip="Send RPC as string query."]; } freetds-1.3.6/doc/reference/a00564_ga633f62fb8e5310abfa42c02fba9c6500_cgraph.dot000644 025423 025423 00000001771 14162303417 027174 0ustar00fredianofrediano000000 000000 digraph "tds_freeze_close" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_freeze_close",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Stop keeping data for this specific freeze."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_freeze_close_len",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga2660b893ae2bf36fe1b63b354e748bad",tooltip="Stop keeping data for this specific freeze."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_freeze_written",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga528cc96da09c11bc2930daae64e33e83",tooltip="Compute how many bytes has been written from freeze."]; } freetds-1.3.6/doc/reference/a00564_ga676c4dee6522815b16fdc8e448e43590_cgraph.dot000644 025423 025423 00000003260 14162303417 027014 0ustar00fredianofrediano000000 000000 digraph "read_and_convert" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="read_and_convert",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not al..."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_convert_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html#a9d8eb43a81ff58ab423dce0ce95b9564",tooltip="Reads and writes from a stream converting characters."]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_datain_stream_init",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html#abc3a77c8aa28842e7f28583cbabc1415",tooltip="Initialize a data input stream."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_datain_stream_read",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html#a04b537d889f7d4c9b9701eb81baf7efd",tooltip="Reads data from network for input stream."]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_staticout_stream_init",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html#a9fe0d3799d2e3bde49b614c9d0c3785d",tooltip="Initialize an output stream for write into a static allocated buffer."]; } freetds-1.3.6/doc/reference/a00564_ga6b2b012b999bd0a4f159fabc8d11a5bf_icgraph.dot000644 025423 025423 00000001305 14162303417 027505 0ustar00fredianofrediano000000 000000 digraph "tds_freeze" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_freeze",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Stop writing to server and cache every packet not sending them to server."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds5_put_params",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html#ga4f1f0a4f77bc4ea1440dfdebc19a157c",tooltip="Send parameters to server."]; } freetds-1.3.6/doc/reference/a00564_ga8ab6c87318eaf15ea17a9575763f7809_cgraph.dot000644 025423 025423 00000001767 14162303417 027034 0ustar00fredianofrediano000000 000000 digraph "tds_get_uint8" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_get_uint8",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get an uint64 from the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00564_ga9ac121c269e203337a48c5bf8afc48c3_cgraph.dot000644 025423 025423 00000001764 14162303417 027136 0ustar00fredianofrediano000000 000000 digraph "tds_get_uint" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_get_uint",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get an int32 from the server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00564_ga9ac121c269e203337a48c5bf8afc48c3_icgraph.dot000644 025423 025423 00000001307 14162303417 027300 0ustar00fredianofrediano000000 000000 digraph "tds_get_uint" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_get_uint",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get an int32 from the server."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds5_process_dyn_result2",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gae688b515631141acfbc41bbb91c8b921",tooltip="Process new TDS 5.0 token for describing output parameters."]; } freetds-1.3.6/doc/reference/a00564_gae777dd57e8d1bb40349d7d7d8434fddf_cgraph.dot000644 025423 025423 00000001323 14162303417 027321 0ustar00fredianofrediano000000 000000 digraph "tds_get_n" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00564_gae777dd57e8d1bb40349d7d7d8434fddf_icgraph.dot000644 025423 025423 00000011431 14162303417 027473 0ustar00fredianofrediano000000 000000 digraph "tds_get_n" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_uint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga9ac121c269e203337a48c5bf8afc48c3",tooltip="Get an int32 from the server."]; Node2 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds5_process_dyn_result2",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gae688b515631141acfbc41bbb91c8b921",tooltip="Process new TDS 5.0 token for describing output parameters."]; Node1 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_get_uint8",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga8ab6c87318eaf15ea17a9575763f7809",tooltip="Get an uint64 from the server."]; Node1 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node5 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="tds_process_col_fmt",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga4e3dd9d3614f5f0433b78b761dd68741",tooltip="tds_process_col_fmt() is the other half of result set processing under TDS 4.2."]; Node5 -> Node7 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="tds_process_col_name",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga905d2fa5e1b602817bd16bb0fcf9eadb",tooltip="tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names,..."]; Node5 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="tds_process_colinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga22c7f413d43fc0d511e122a3de389166",tooltip="Reads column information."]; Node5 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="tds_process_compute\l_names",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gae5b3e01f3d665f9e377de091f46f1ab9",tooltip="tds_process_compute_names() processes compute result sets."]; Node5 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="tds_process_cursor\l_tokens",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga315d875d90c64d12d61fc9e33b4dee96",tooltip="Reads cursor command results."]; Node5 -> Node11 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_process_dyn_result",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga416cf119c1d4a0fca27dc5b50c261358",tooltip="Process results from dynamic."]; Node5 -> Node12 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 [label="tds_process_end",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga7a081cf9bb8f04ead12f0299fb7c4cd9",tooltip="tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens."]; Node5 -> Node13 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="tds_process_env_chg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga3e1b4df4410a86a563a8c155e7799720",tooltip="tds_process_env_chg() when ever certain things change on the server, such as database,..."]; Node5 -> Node14 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="tds_process_tabname",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gaeec59bca9bd0c5388e245f0d19d9c81a",tooltip="Process list of table from network."]; Node1 -> Node8 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00565_ga22c7f413d43fc0d511e122a3de389166_cgraph.dot000644 025423 025423 00000003705 14162303417 026762 0ustar00fredianofrediano000000 000000 digraph "tds_process_colinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_colinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reads column information."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_copy",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#gad96366d9fa93bfc283cef1299fbe97ab",tooltip="copy a string from another"]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_dstr_copyn",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga656718f240d7403f986ae887d84a6ca1",tooltip="Set string to a given buffer of characters."]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node6 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00565_ga315d875d90c64d12d61fc9e33b4dee96_cgraph.dot000644 025423 025423 00000002463 14162303417 027154 0ustar00fredianofrediano000000 000000 digraph "tds_process_cursor_tokens" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_cursor\l_tokens",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reads cursor command results."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00565_ga39453d084f3f780ac4602d4abf2839f7_cgraph.dot000644 025423 025423 00000001375 14162303417 027012 0ustar00fredianofrediano000000 000000 digraph "tds_process_default_tokens" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_default\l_tokens",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds_process_default_tokens() is a catch all function that is called to process tokens not known to ot..."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_ga3e1b4df4410a86a563a8c155e7799720_cgraph.dot000644 025423 025423 00000003201 14162303417 026713 0ustar00fredianofrediano000000 000000 digraph "tds_process_env_chg" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_env_chg",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds_process_env_chg() when ever certain things change on the server, such as database,..."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_ga416cf119c1d4a0fca27dc5b50c261358_cgraph.dot000644 025423 025423 00000002453 14162303417 027114 0ustar00fredianofrediano000000 000000 digraph "tds_process_dyn_result" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_dyn_result",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Process results from dynamic."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00566.dot000644 025423 025423 00000001111 14162303417 020632 0ustar00fredianofrediano000000 000000 digraph "Dynamic string functions" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node1 [label="Dynamic string functions",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Handle dynamic string."]; Node2 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00567.html",tooltip="Callable functions in libtds."]; Node2->Node1 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00566.html000644 025423 025423 00000071340 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Dynamic string functions
    FreeTDS API
    Dynamic string functions

    Handle dynamic string. More...

    Collaboration diagram for Dynamic string functions:

    Classes

    struct  tds_dstr
     Structure to hold a string. More...
     

    Macros

    #define DSTR_INITIALIZER   ((struct tds_dstr*) &tds_str_empty)
     Initializer, used to initialize string like in the following example. More...
     
    #define tds_dstr_empty(s)    tds_dstr_free(s)
     Make a string empty.
     

    Typedefs

    typedef struct tds_dstrDSTR
     Structure to hold a string. More...
     

    Functions

    DSTRtds_dstr_alloc (DSTR *s, size_t length)
     allocate space for length char More...
     
    static char * tds_dstr_buf (DSTR *s)
     Returns a buffer to edit the string. More...
     
    DSTRtds_dstr_copy (DSTR *s, const char *src)
     copy a string from another More...
     
    DSTRtds_dstr_copyn (DSTR *s, const char *src, size_t length)
     Set string to a given buffer of characters. More...
     
    static const char * tds_dstr_cstr (const DSTR *s)
     Returns a C version (NUL terminated string) of dstr.
     
    DSTRtds_dstr_dup (DSTR *s, const DSTR *src)
     Duplicate a string from another dynamic string. More...
     
    void tds_dstr_free (DSTR *s)
     free string
     
    static void tds_dstr_init (DSTR *s)
     init a string with empty
     
    static int tds_dstr_isempty (const DSTR *s)
     test if string is empty
     
    static size_t tds_dstr_len (const DSTR *s)
     Returns the length of the string in bytes.
     
    DSTRtds_dstr_set (DSTR *s, char *src)
     set a string from another buffer. More...
     
    DSTRtds_dstr_setlen (DSTR *s, size_t length)
     limit length of string, MUST be <= current length More...
     
    void tds_dstr_zero (DSTR *s)
     clear all string filling with zeroes (mainly for security reason)
     

    Variables

    const struct tds_dstr tds_str_empty
     Internal representation for an empty string.
     

    Detailed Description

    Handle dynamic string.

    In this string are always valid (you don't have NULL pointer, only empty strings)

    Macro Definition Documentation

    ◆ DSTR_INITIALIZER

    #define DSTR_INITIALIZER   ((struct tds_dstr*) &tds_str_empty)

    Initializer, used to initialize string like in the following example.

    Typedef Documentation

    ◆ DSTR

    typedef struct tds_dstr * DSTR

    Structure to hold a string.

    Use tds_dstr_* functions/macros, do not access members directly. There should be always a buffer.

    Function Documentation

    ◆ tds_dstr_alloc()

    DSTR * tds_dstr_alloc ( DSTR s,
    size_t  length 
    )

    allocate space for length char

    Parameters
    sdynamic string
    lengthnew length
    Returns
    string allocated or NULL on memory error

    ◆ tds_dstr_buf()

    static char* tds_dstr_buf ( DSTR s)
    inlinestatic

    Returns a buffer to edit the string.

    Be careful to avoid buffer overflows and remember to set the correct length at the end of the editing if changed.

    ◆ tds_dstr_copy()

    DSTR * tds_dstr_copy ( DSTR s,
    const char *  src 
    )

    copy a string from another

    Parameters
    sdynamic string
    srcsource buffer
    Returns
    string copied or NULL on memory error
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_dstr_copyn()

    DSTR * tds_dstr_copyn ( DSTR s,
    const char *  src,
    size_t  length 
    )

    Set string to a given buffer of characters.

    Parameters
    sdynamic string
    srcsource buffer
    lengthlength of source buffer
    Returns
    string copied or NULL on memory error
    Here is the caller graph for this function:

    ◆ tds_dstr_dup()

    DSTR * tds_dstr_dup ( DSTR s,
    const DSTR src 
    )

    Duplicate a string from another dynamic string.

    Parameters
    soutput string
    srcsource string to copy
    Returns
    string copied or NULL on memory error
    Here is the call graph for this function:

    ◆ tds_dstr_set()

    DSTR * tds_dstr_set ( DSTR s,
    char *  src 
    )

    set a string from another buffer.

    The string will use the supplied buffer (it not copy the string), so it should be a pointer returned by malloc.

    Parameters
    sdynamic string
    srcsource buffer
    Returns
    string copied or NULL on memory error
    Here is the call graph for this function:

    ◆ tds_dstr_setlen()

    DSTR * tds_dstr_setlen ( DSTR s,
    size_t  length 
    )

    limit length of string, MUST be <= current length

    Parameters
    sdynamic string
    lengthnew length
    Structure to hold a string.
    Definition: string.h:36
    #define DSTR_INITIALIZER
    Initializer, used to initialize string like in the following example.
    Definition: string.h:49
    freetds-1.3.6/doc/reference/a00567.dot000644 025423 025423 00000004527 14162303417 020651 0ustar00fredianofrediano000000 000000 digraph "LibTDS API" { edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=box]; rankdir=LR; Node8 [label="Network functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html",tooltip="Functions for reading or writing from network."]; Node7 [label="Query",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00563.html",tooltip="Function to handle query."]; Node6 [label="Memory allocation",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00562.html",tooltip="Allocate or free resources."]; Node2 [label="Authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00558.html",tooltip="Functions for handling authentication."]; Node10 [label="Dynamic string functions",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html",tooltip="Handle dynamic string."]; Node4 [label="Conversion",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00560.html",tooltip="Conversions between datatypes."]; Node9 [label="Results processing",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html",tooltip="Handle tokens in packets."]; Node3 [label="Configuration",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00559.html",tooltip="Handle reading of configuration."]; Node5 [label="Charset conversion",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00561.html",tooltip="Convert between different charsets."]; Node1 [label="LibTDS API",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Callable functions in libtds."]; Node1->Node2 [shape=plaintext, dir="back", style="solid"]; Node1->Node3 [shape=plaintext, dir="back", style="solid"]; Node1->Node4 [shape=plaintext, dir="back", style="solid"]; Node1->Node5 [shape=plaintext, dir="back", style="solid"]; Node1->Node6 [shape=plaintext, dir="back", style="solid"]; Node1->Node7 [shape=plaintext, dir="back", style="solid"]; Node1->Node8 [shape=plaintext, dir="back", style="solid"]; Node1->Node9 [shape=plaintext, dir="back", style="solid"]; Node1->Node10 [shape=plaintext, dir="back", style="solid"]; } freetds-1.3.6/doc/reference/a00565_ga4e3dd9d3614f5f0433b78b761dd68741_cgraph.dot000644 025423 025423 00000002527 14162303417 027015 0ustar00fredianofrediano000000 000000 digraph "tds_process_col_fmt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_col_fmt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds_process_col_fmt() is the other half of result set processing under TDS 4.2."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00565_ga595fe391e60a71bd98ffd53b4c015e44_icgraph.dot000644 025423 025423 00000001261 14162303417 027315 0ustar00fredianofrediano000000 000000 digraph "tds_lookup_dynamic" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_lookup_dynamic",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Finds a dynamic given string id."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_alloc_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00562.html#ga69559de43b47f4a9e2eecc7a56527444",tooltip="Allocate a dynamic statement."]; } freetds-1.3.6/doc/reference/a00565_ga7a081cf9bb8f04ead12f0299fb7c4cd9_cgraph.dot000644 025423 025423 00000002514 14162303417 027362 0ustar00fredianofrediano000000 000000 digraph "tds_process_end" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_end",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC tokens."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00565_ga905d2fa5e1b602817bd16bb0fcf9eadb_cgraph.dot000644 025423 025423 00000003240 14162303417 027416 0ustar00fredianofrediano000000 000000 digraph "tds_process_col_name" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_col_name",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names,..."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_read_namelist",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#gaeaaed2ea1d8c827da1a0f5b419524ae1",tooltip="Reads list of names (usually table names)"]; } freetds-1.3.6/doc/reference/a00565_ga9fdef8228d29cab7fa9098f07fa73fba_cgraph.dot000644 025423 025423 00000001765 14162303417 027471 0ustar00fredianofrediano000000 000000 digraph "tds_process_param_result_tokens" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_param_result\l_tokens",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Process parameters from networks."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_byte",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga0cb72d3f6943795c39db1fa692be0a58",tooltip="Return a single byte from the input buffer."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00565_gaa6a7e5aeb10a1322911c47be9c43e2d2_cgraph.dot000644 025423 025423 00000001246 14162303417 027170 0ustar00fredianofrediano000000 000000 digraph "tds5_process_optioncmd" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds5_process_optioncmd",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Process option cmd results."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_gabe2bdd5a41ce067cb31aef18ff81cb1c_cgraph.dot000644 025423 025423 00000001317 14162303417 027553 0ustar00fredianofrediano000000 000000 digraph "tds5_process_result2" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds5_process_result2",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds5_process_result2() is the new TDS 5.0 result set processing routine."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_gabfc9de1d1fe718818caf63a4be4035a6_cgraph.dot000644 025423 025423 00000001227 14162303417 027355 0ustar00fredianofrediano000000 000000 digraph "tds_process_tokens" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_tokens",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="process all streams."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_gaca56fc22d65a24a96d1bef310ade73aa_cgraph.dot000644 025423 025423 00000001310 14162303417 027403 0ustar00fredianofrediano000000 000000 digraph "tds7_process_result" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds7_process_result",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds7_process_result() is the TDS 7.0 result set processing routine."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_gacb3354443bcefe7a500a500a4904cc05_cgraph.dot000644 025423 025423 00000001277 14162303417 027105 0ustar00fredianofrediano000000 000000 digraph "tds_process_param_result" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_param_result",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="process output parameters of a stored procedure."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_gad9b6b86f48be077fb44ac603845a0c27_cgraph.dot000644 025423 025423 00000001237 14162303417 027144 0ustar00fredianofrediano000000 000000 digraph "tds_get_data_info" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_get_data_info",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reads data metadata from wire."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_gae5b3e01f3d665f9e377de091f46f1ab9_cgraph.dot000644 025423 025423 00000003160 14162303417 027230 0ustar00fredianofrediano000000 000000 digraph "tds_process_compute_names" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_compute\l_names",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="tds_process_compute_names() processes compute result sets."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tdsdump_log",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#ab45c291105027e69836002e1dd586141",tooltip="Write a message to the debug log."]; } freetds-1.3.6/doc/reference/a00565_gae688b515631141acfbc41bbb91c8b921_cgraph.dot000644 025423 025423 00000003305 14162303417 027120 0ustar00fredianofrediano000000 000000 digraph "tds5_process_dyn_result2" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds5_process_dyn_result2",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Process new TDS 5.0 token for describing output parameters."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_uint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga9ac121c269e203337a48c5bf8afc48c3",tooltip="Get an int32 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node5 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00565_gaeaaed2ea1d8c827da1a0f5b419524ae1_icgraph.dot000644 025423 025423 00000001405 14162303417 027560 0ustar00fredianofrediano000000 000000 digraph "tds_read_namelist" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_read_namelist",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reads list of names (usually table names)"]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_process_col_name",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga905d2fa5e1b602817bd16bb0fcf9eadb",tooltip="tds_process_col_name() is one half of the result set under TDS 4.2 it contains all the column names,..."]; } freetds-1.3.6/doc/reference/a00565_gaeec59bca9bd0c5388e245f0d19d9c81a_cgraph.dot000644 025423 025423 00000002453 14162303417 027367 0ustar00fredianofrediano000000 000000 digraph "tds_process_tabname" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_process_tabname",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Process list of table from network."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_usmallint",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gad38aa5b9547817854ccba1fcc7855861",tooltip="Get an int16 from the server."]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_get_n",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf",tooltip="Get N bytes from the buffer and return them in the already allocated space given to us."]; Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_read_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga410619783bdf2bb60b0f27a5578e0e07",tooltip="Read in one 'packet' from the server."]; } freetds-1.3.6/doc/reference/a00566_ga4e6d9fa6f9b9551a5a3390e10a5322e6_cgraph.dot000644 025423 025423 00000001264 14162303417 027060 0ustar00fredianofrediano000000 000000 digraph "tds_dstr_dup" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dstr_dup",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Duplicate a string from another dynamic string."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_copyn",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga656718f240d7403f986ae887d84a6ca1",tooltip="Set string to a given buffer of characters."]; } freetds-1.3.6/doc/reference/a00566_ga656718f240d7403f986ae887d84a6ca1_icgraph.dot000644 025423 025423 00000004050 14162303417 027110 0ustar00fredianofrediano000000 000000 digraph "tds_dstr_copyn" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_dstr_copyn",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Set string to a given buffer of characters."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="parse_server_name_for_port",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00559.html#ga82ac44924fb1ae41042c233573a4ac8d",tooltip="Check the server name to find port info first Warning: connection-> & login-> are all modified when n..."]; Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_dstr_copy",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#gad96366d9fa93bfc283cef1299fbe97ab",tooltip="copy a string from another"]; Node3 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_dstr_set",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#gab78cc59b110df2817b00f9bed74c6ff1",tooltip="set a string from another buffer."]; Node3 -> Node5 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="tds_process_colinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga22c7f413d43fc0d511e122a3de389166",tooltip="Reads column information."]; Node1 -> Node6 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="tds_dstr_dup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga4e6d9fa6f9b9551a5a3390e10a5322e6",tooltip="Duplicate a string from another dynamic string."]; } freetds-1.3.6/doc/reference/a00566_gab78cc59b110df2817b00f9bed74c6ff1_cgraph.dot000644 025423 025423 00000001702 14162303417 027275 0ustar00fredianofrediano000000 000000 digraph "tds_dstr_set" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dstr_set",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="set a string from another buffer."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_copy",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#gad96366d9fa93bfc283cef1299fbe97ab",tooltip="copy a string from another"]; Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_dstr_copyn",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga656718f240d7403f986ae887d84a6ca1",tooltip="Set string to a given buffer of characters."]; } freetds-1.3.6/doc/reference/a00566_gad96366d9fa93bfc283cef1299fbe97ab_cgraph.dot000644 025423 025423 00000001241 14162303417 027406 0ustar00fredianofrediano000000 000000 digraph "tds_dstr_copy" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dstr_copy",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="copy a string from another"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dstr_copyn",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#ga656718f240d7403f986ae887d84a6ca1",tooltip="Set string to a given buffer of characters."]; } freetds-1.3.6/doc/reference/a00566_gad96366d9fa93bfc283cef1299fbe97ab_icgraph.dot000644 025423 025423 00000002516 14162303417 027565 0ustar00fredianofrediano000000 000000 digraph "tds_dstr_copy" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_dstr_copy",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="copy a string from another"]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="parse_server_name_for_port",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00559.html#ga82ac44924fb1ae41042c233573a4ac8d",tooltip="Check the server name to find port info first Warning: connection-> & login-> are all modified when n..."]; Node1 -> Node3 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="tds_dstr_set",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00566.html#gab78cc59b110df2817b00f9bed74c6ff1",tooltip="set a string from another buffer."]; Node1 -> Node4 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="tds_process_colinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00565.html#ga22c7f413d43fc0d511e122a3de389166",tooltip="Reads column information."]; } freetds-1.3.6/doc/reference/a00567.html000644 025423 025423 00000016254 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: LibTDS API
    FreeTDS API
    LibTDS API

    Callable functions in libtds. More...

    Collaboration diagram for LibTDS API:

    Modules

     Authentication
     Functions for handling authentication.
     
     Configuration
     Handle reading of configuration.
     
     Conversion
     Conversions between datatypes.
     
     Charset conversion
     Convert between different charsets.
     
     Memory allocation
     Allocate or free resources.
     
     Query
     Function to handle query.
     
     Network functions
     Functions for reading or writing from network.
     
     Results processing
     Handle tokens in packets.
     
     Dynamic string functions
     Handle dynamic string.
     

    Detailed Description

    Callable functions in libtds.

    The libtds library is for use internal to FreeTDS. It is not intended for use by applications. Although any use is permitted, you're encouraged to use one of the established public APIs instead, because their interfaces are stable and documented by the vendors.

    freetds-1.3.6/doc/reference/a00568.html000644 025423 025423 00000012166 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    METADATA Member List

    This is the complete list of members for METADATA, including all inherited members.

    format_string (defined in METADATA)METADATA
    name (defined in METADATA)METADATA
    nchars (defined in METADATA)METADATA
    size (defined in METADATA)METADATA
    size (defined in METADATA)METADATA
    source (defined in METADATA)METADATA
    type (defined in METADATA)METADATA
    type (defined in METADATA)METADATA
    width (defined in METADATA)METADATA
    width (defined in METADATA)METADATA
    freetds-1.3.6/doc/reference/a00571.html000644 025423 025423 00000015135 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: METADATA Struct Reference
    FreeTDS API
    METADATA Struct Reference

    Public Attributes

    char * format_string
     
    char * name
     
    SQLINTEGER nchars
     
    int size
     
    SQLULEN size
     
    const char * source
     
    int type
     
    SQLSMALLINT type
     
    int width
     
    SQLULEN width
     

    The documentation for this struct was generated from the following files:
    • src/apps/bsqldb.c
    • src/apps/bsqlodbc.c
    freetds-1.3.6/doc/reference/a00572.html000644 025423 025423 00000007111 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DATA Member List

    This is the complete list of members for DATA, including all inherited members.

    buffer (defined in DATA)DATA
    len (defined in DATA)DATA
    status (defined in DATA)DATA
    freetds-1.3.6/doc/reference/a00575.html000644 025423 025423 00000010344 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: DATA Struct Reference
    FreeTDS API
    DATA Struct Reference

    Public Attributes

    char * buffer
     
    SQLLEN len
     
    int status
     

    The documentation for this struct was generated from the following files:
    • src/apps/bsqldb.c
    • src/apps/bsqlodbc.c
    freetds-1.3.6/doc/reference/a00576.html000644 025423 025423 00000007151 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    METACOMP Member List

    This is the complete list of members for METACOMP, including all inherited members.

    data (defined in METACOMP)METACOMP
    meta (defined in METACOMP)METACOMP
    numalts (defined in METACOMP)METACOMP
    freetds-1.3.6/doc/reference/a00577.dot000644 025423 025423 00000001446 14162303417 020647 0ustar00fredianofrediano000000 000000 digraph "METACOMP" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="METACOMP",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" meta" ,fontname="Helvetica"]; Node2 [label="METADATA",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00571.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" data" ,fontname="Helvetica"]; Node3 [label="DATA",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00575.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00579.html000644 025423 025423 00000011013 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: METACOMP Struct Reference
    FreeTDS API
    METACOMP Struct Reference
    Collaboration diagram for METACOMP:

    Public Attributes

    struct DATAdata
     
    struct METADATAmeta
     
    int numalts
     

    The documentation for this struct was generated from the following file:
    • src/apps/bsqldb.c
    freetds-1.3.6/doc/reference/a00580.html000644 025423 025423 00000007440 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    KEY_T Member List

    This is the complete list of members for KEY_T, including all inherited members.

    keys (defined in KEY_T)KEY_T
    keys (defined in KEY_T)KEY_T
    nkeys (defined in KEY_T)KEY_T
    nkeys (defined in KEY_T)KEY_T
    freetds-1.3.6/doc/reference/a00581.dot000644 025423 025423 00000001054 14162303417 020635 0ustar00fredianofrediano000000 000000 digraph "KEY_T" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="KEY_T",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" keys" ,fontname="Helvetica"]; Node2 [label="col_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00623.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00583.html000644 025423 025423 00000011505 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: KEY_T Struct Reference
    FreeTDS API
    KEY_T Struct Reference
    Collaboration diagram for KEY_T:

    Public Attributes

    int * keys
     
    struct col_tkeys
     
    size_t nkeys
     
    int nkeys
     

    The documentation for this struct was generated from the following files:
    • src/apps/bsqldb.c
    • src/dblib/dbpivot.c
    freetds-1.3.6/doc/reference/search/000755 025423 025423 00000000000 14162303412 020547 5ustar00fredianofrediano000000 000000 freetds-1.3.6/doc/reference/a00584.html000644 025423 025423 00000014405 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _options Member List

    This is the complete list of members for _options, including all inherited members.

    appname (defined in _options)_options
    colsep (defined in _options)_options
    database (defined in _options)_options
    error_filename (defined in _options)_options
    fquiet (defined in _options)_options
    fverbose (defined in _options)_options
    headers (defined in _options)_options
    hostname (defined in _options)_options
    input_filename (defined in _options)_options
    odbc_version (defined in _options)_options
    optind (defined in _options)_options
    output_filename (defined in _options)_options
    pivot (defined in _options)_options
    servername (defined in _options)_options
    verbose (defined in _options)_options
    freetds-1.3.6/doc/reference/a00585.dot000644 025423 025423 00000002243 14162303417 020642 0ustar00fredianofrediano000000 000000 digraph "_options" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_options",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pivot" ,fontname="Helvetica"]; Node2 [label="_options::pivot_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00591.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" func" ,fontname="Helvetica"]; Node3 [label="col_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00623.html",tooltip=" "]; Node4 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" col_key\nrow_key" ,fontname="Helvetica"]; Node4 [label="KEY_T",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00583.html",tooltip=" "]; Node3 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" keys" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00587.html000644 025423 025423 00000022074 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: _options Struct Reference
    FreeTDS API
    _options Struct Reference
    Collaboration diagram for _options:

    Classes

    struct  pivot_t
     

    Public Attributes

    char * appname
     
    const char * colsep
     
    char * database
     
    char * error_filename
     
    int fquiet
     
    int fverbose
     
    FILE * headers
     
    char hostname [128]
     
    char * input_filename
     
    size_t odbc_version
     
    int optind
     
    char * output_filename
     
    struct _options::pivot_t pivot
     
    char * servername
     
    FILE * verbose
     

    The documentation for this struct was generated from the following files:
    • src/apps/bsqldb.c
    • src/apps/bsqlodbc.c
    • src/apps/defncopy.c
    freetds-1.3.6/doc/reference/a00588.html000644 025423 025423 00000010144 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _options::pivot_t Member List

    This is the complete list of members for _options::pivot_t, including all inherited members.

    col_key (defined in _options::pivot_t)_options::pivot_t
    func (defined in _options::pivot_t)_options::pivot_t
    row_key (defined in _options::pivot_t)_options::pivot_t
    val_col (defined in _options::pivot_t)_options::pivot_t
    freetds-1.3.6/doc/reference/a00589.dot000644 025423 025423 00000001666 14162303417 020656 0ustar00fredianofrediano000000 000000 digraph "_options::pivot_t" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_options::pivot_t",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" func" ,fontname="Helvetica"]; Node2 [label="col_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00623.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" col_key\nrow_key" ,fontname="Helvetica"]; Node3 [label="KEY_T",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00583.html",tooltip=" "]; Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" keys" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00591.html000644 025423 025423 00000012071 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: _options::pivot_t Struct Reference
    FreeTDS API
    _options::pivot_t Struct Reference
    Collaboration diagram for _options::pivot_t:

    Public Attributes

    KEY_T col_key
     
    DBPIVOT_FUNC func
     
    KEY_T row_key
     
    int val_col
     

    The documentation for this struct was generated from the following file:
    • src/apps/bsqldb.c
    freetds-1.3.6/doc/reference/a00592.html000644 025423 025423 00000010446 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    LOGINREC Member List

    This is the complete list of members for LOGINREC, including all inherited members.

    client_charset (defined in LOGINREC)LOGINREC
    client_hostname (defined in LOGINREC)LOGINREC
    connect_timeout (defined in LOGINREC)LOGINREC
    password (defined in LOGINREC)LOGINREC
    query_timeout (defined in LOGINREC)LOGINREC
    username (defined in LOGINREC)LOGINREC
    freetds-1.3.6/doc/reference/a00595.html000644 025423 025423 00000012375 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: LOGINREC Struct Reference
    FreeTDS API
    LOGINREC Struct Reference

    Public Attributes

    char * client_charset
     
    char * client_hostname
     
    int connect_timeout
     
    char * password
     
    int query_timeout
     
    char * username
     

    The documentation for this struct was generated from the following file:
    • src/apps/bsqlodbc.c
    freetds-1.3.6/doc/reference/a00596.html000644 025423 025423 00000010073 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    OBJECTINFO Member List

    This is the complete list of members for OBJECTINFO, including all inherited members.

    db (defined in OBJECTINFO)OBJECTINFO
    dbobject (defined in OBJECTINFO)OBJECTINFO
    pass (defined in OBJECTINFO)OBJECTINFO
    server (defined in OBJECTINFO)OBJECTINFO
    user (defined in OBJECTINFO)OBJECTINFO
    freetds-1.3.6/doc/reference/a00599.html000644 025423 025423 00000011604 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: OBJECTINFO Struct Reference
    FreeTDS API
    OBJECTINFO Struct Reference

    Public Attributes

    char * db
     
    char * dbobject
     
    char * pass
     
    char * server
     
    char * user
     

    The documentation for this struct was generated from the following file:
    • src/apps/datacopy.c
    freetds-1.3.6/doc/reference/a00600.html000644 025423 025423 00000032377 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    pd Member List

    This is the complete list of members for pd, including all inherited members.

    Aflag (defined in pd)pd
    aflag (defined in pd)pd
    batchsize (defined in pd)pd
    bflag (defined in pd)pd
    cflag (defined in pd)pd
    charset (defined in pd)pd
    dbdirection (defined in pd)pd
    dbname (defined in pd)pd
    dbobject (defined in pd)pd
    dest (defined in pd)pd
    Dflag (defined in pd)pd
    direction (defined in pd)pd
    Eflag (defined in pd)pd
    eflag (defined in pd)pd
    errorfile (defined in pd)pd
    Fflag (defined in pd)pd
    fflag (defined in pd)pd
    fieldterm (defined in pd)pd
    fieldtermlen (defined in pd)pd
    firstrow (defined in pd)pd
    formatfile (defined in pd)pd
    hint (defined in pd)pd
    hostfilename (defined in pd)pd
    Iflag (defined in pd)pd
    inputfile (defined in pd)pd
    interfacesfile (defined in pd)pd
    lastrow (defined in pd)pd
    Lflag (defined in pd)pd
    maxerrors (defined in pd)pd
    mflag (defined in pd)pd
    nflag (defined in pd)pd
    options (defined in pd)pd
    outputfile (defined in pd)pd
    owner (defined in pd)pd
    packetsize (defined in pd)pd
    pass (defined in pd)pd
    pflag (defined in pd)pd
    Pflag (defined in pd)pd
    rflag (defined in pd)pd
    rowterm (defined in pd)pd
    rowtermlen (defined in pd)pd
    server (defined in pd)pd
    Sflag (defined in pd)pd
    src (defined in pd)pd
    textsize (defined in pd)pd
    tflag (defined in pd)pd
    Tflag (defined in pd)pd
    Uflag (defined in pd)pd
    user (defined in pd)pd
    vflag (defined in pd)pd
    freetds-1.3.6/doc/reference/a00601.dot000644 025423 025423 00000001060 14162303417 020623 0ustar00fredianofrediano000000 000000 digraph "pd" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="pd",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dest\nsrc" ,fontname="Helvetica"]; Node2 [label="OBJECTINFO",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00599.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00603.html000644 025423 025423 00000050467 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: pd Struct Reference
    FreeTDS API
    pd Struct Reference
    Collaboration diagram for pd:

    Public Attributes

    int aflag
     
    int Aflag
     
    int batchsize
     
    int bflag
     
    int cflag
     
    char * charset
     
    char dbdirection [10]
     
    char * dbname
     
    char * dbobject
     
    OBJECTINFO dest
     
    int Dflag
     
    DBINT direction
     
    int Eflag
     
    int eflag
     
    char * errorfile
     
    int fflag
     
    int Fflag
     
    char * fieldterm
     
    int fieldtermlen
     
    int firstrow
     
    char * formatfile
     
    char * hint
     
    char * hostfilename
     
    int Iflag
     
    char * inputfile
     
    char * interfacesfile
     
    int lastrow
     
    int Lflag
     
    int maxerrors
     
    int mflag
     
    int nflag
     
    char * options
     
    char * outputfile
     
    char * owner
     
    int packetsize
     
    char * pass
     
    int pflag
     
    int Pflag
     
    int rflag
     
    char * rowterm
     
    int rowtermlen
     
    char * server
     
    int Sflag
     
    OBJECTINFO src
     
    int textsize
     
    int tflag
     
    int Tflag
     
    int Uflag
     
    char * user
     
    int vflag
     

    The documentation for this struct was generated from the following files:
    freetds-1.3.6/doc/reference/a00604.html000644 025423 025423 00000006620 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _procedure Member List

    This is the complete list of members for _procedure, including all inherited members.

    name (defined in _procedure)_procedure
    owner (defined in _procedure)_procedure
    freetds-1.3.6/doc/reference/a00607.html000644 025423 025423 00000007607 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: _procedure Struct Reference
    FreeTDS API
    _procedure Struct Reference

    Public Attributes

    char name [512]
     
    char owner [512]
     

    The documentation for this struct was generated from the following file:
    • src/apps/defncopy.c
    freetds-1.3.6/doc/reference/a00608.html000644 025423 025423 00000007477 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    dblib_buffer_row Member List

    This is the complete list of members for dblib_buffer_row, including all inherited members.

    resinfodblib_buffer_row
    rowdblib_buffer_row
    row_datadblib_buffer_row
    sizesdblib_buffer_row
    freetds-1.3.6/doc/reference/a00609.dot000644 025423 025423 00000012066 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "dblib_buffer_row" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dblib_buffer_row",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" resinfo" ,fontname="Helvetica"]; Node2 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node3 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node4 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node7 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node7 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node8 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node8 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node9 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node10 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node10 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node2 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node10 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node12 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node12 [label="tds_connection",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node8 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node9 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node18 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node18 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node10 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node22 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node22 [label="tds_column",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node18 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node7 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node23 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" funcs" ,fontname="Helvetica"]; Node23 [label="tds_column_funcs",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01171.html",tooltip=" "]; Node24 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcp_column_data" ,fontname="Helvetica"]; Node24 [label="tds_bcpcoldata",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01167.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00611.html000644 025423 025423 00000013417 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: dblib_buffer_row Struct Reference
    FreeTDS API
    dblib_buffer_row Struct Reference
    Collaboration diagram for dblib_buffer_row:

    Public Attributes

    TDSRESULTINFOresinfo
     pointer to result informations
     
    DBINT row
     row number
     
    unsigned char * row_data
     row data, NULL for resinfo->current_row
     
    TDS_INT * sizes
     save old sizes
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00612.html000644 025423 025423 00000012360 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    dblib_context Member List

    This is the complete list of members for dblib_context, including all inherited members.

    connection_list (defined in dblib_context)dblib_context
    connection_list_size (defined in dblib_context)dblib_context
    connection_list_size_represented (defined in dblib_context)dblib_context
    login_timeoutdblib_context
    query_timeoutdblib_context
    recftos_filename (defined in dblib_context)dblib_context
    recftos_filenum (defined in dblib_context)dblib_context
    ref_countdblib_context
    tds_ctxdblib_context
    tds_ctx_ref_countdblib_context
    freetds-1.3.6/doc/reference/a00613.dot000644 025423 025423 00000013425 14162303417 020636 0ustar00fredianofrediano000000 000000 digraph "dblib_context" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="dblib_context",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" connection_list" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node22 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00615.html000644 025423 025423 00000020450 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: dblib_context Struct Reference
    FreeTDS API
    dblib_context Struct Reference
    Collaboration diagram for dblib_context:

    Public Attributes

    TDSSOCKET ** connection_list
     
    int connection_list_size
     
    int connection_list_size_represented
     
    int login_timeout
     not used unless positive
     
    int query_timeout
     not used unless positive
     
    char * recftos_filename
     
    int recftos_filenum
     
    int ref_count
     reference count, time dbinit called
     
    TDSCONTEXTtds_ctx
     libTDS context
     
    int tds_ctx_ref_count
     libTDS context reference counter
     

    Detailed Description

    \dblib_internal

    Remarks
    A db-lib connection has an implicit TDS context.

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00616.html000644 025423 025423 00000007316 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _dblib_error_message Member List

    This is the complete list of members for _dblib_error_message, including all inherited members.

    msgno (defined in _dblib_error_message)_dblib_error_message
    msgtext (defined in _dblib_error_message)_dblib_error_message
    severity (defined in _dblib_error_message)_dblib_error_message
    freetds-1.3.6/doc/reference/a00619.html000644 025423 025423 00000011326 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: _dblib_error_message Struct Reference
    FreeTDS API
    _dblib_error_message Struct Reference

    Public Attributes

    DBINT msgno
     
    const char * msgtext
     
    int severity
     

    Detailed Description

    Remarks
    member msgno Vendor-defined message number
    member severity Is passed to the error handler
    member msgtext Text of message

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00620.html000644 025423 025423 00000012036 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    col_t Member List

    This is the complete list of members for col_t, including all inherited members.

    data (defined in col_t)col_t
    f (defined in col_t)col_t
    i (defined in col_t)col_t
    len (defined in col_t)col_t
    null_indicator (defined in col_t)col_t
    r (defined in col_t)col_t
    s (defined in col_t)col_t
    si (defined in col_t)col_t
    ti (defined in col_t)col_t
    type (defined in col_t)col_t
    freetds-1.3.6/doc/reference/a00623.html000644 025423 025423 00000014277 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: col_t Struct Reference
    FreeTDS API
    col_t Struct Reference

    Public Attributes

    union {
       DBFLT8   f
     
       DBINT   i
     
       DBREAL   r
     
       DBSMALLINT   si
     
       DBTINYINT   ti
     
    data
     
    size_t len
     
    int null_indicator
     
    char * s
     
    TDS_SERVER_TYPE type
     

    The documentation for this struct was generated from the following file:
    • src/dblib/dbpivot.c
    freetds-1.3.6/doc/reference/a00628.html000644 025423 025423 00000007125 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    agg_t Member List

    This is the complete list of members for agg_t, including all inherited members.

    col_key (defined in agg_t)agg_t
    row_key (defined in agg_t)agg_t
    value (defined in agg_t)agg_t
    freetds-1.3.6/doc/reference/a00629.dot000644 025423 025423 00000001637 14162303417 020647 0ustar00fredianofrediano000000 000000 digraph "agg_t" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="agg_t",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" value" ,fontname="Helvetica"]; Node2 [label="col_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00623.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" col_key\nrow_key" ,fontname="Helvetica"]; Node3 [label="KEY_T",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00583.html",tooltip=" "]; Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" keys" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00631.html000644 025423 025423 00000011042 14162303417 021005 0ustar00fredianofrediano000000 000000 FreeTDS API: agg_t Struct Reference
    FreeTDS API
    agg_t Struct Reference
    Collaboration diagram for agg_t:

    Public Attributes

    KEY_T col_key
     
    KEY_T row_key
     
    struct col_t value
     

    The documentation for this struct was generated from the following file:
    • src/dblib/dbpivot.c
    freetds-1.3.6/doc/reference/a00632.html000644 025423 025423 00000007170 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    metadata_t Member List

    This is the complete list of members for metadata_t, including all inherited members.

    col (defined in metadata_t)metadata_t
    name (defined in metadata_t)metadata_t
    pacross (defined in metadata_t)metadata_t
    freetds-1.3.6/doc/reference/a00633.dot000644 025423 025423 00000001636 14162303417 020641 0ustar00fredianofrediano000000 000000 digraph "metadata_t" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="metadata_t",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" col" ,fontname="Helvetica"]; Node2 [label="col_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00623.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pacross" ,fontname="Helvetica"]; Node3 [label="KEY_T",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00583.html",tooltip=" "]; Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" keys" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00635.html000644 025423 025423 00000011012 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: metadata_t Struct Reference
    FreeTDS API
    metadata_t Struct Reference
    Collaboration diagram for metadata_t:

    Public Attributes

    struct col_t col
     
    char * name
     
    KEY_Tpacross
     

    The documentation for this struct was generated from the following file:
    • src/dblib/dbpivot.c
    freetds-1.3.6/doc/reference/a00636.html000644 025423 025423 00000010736 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    pivot_t Member List

    This is the complete list of members for pivot_t, including all inherited members.

    across (defined in pivot_t)pivot_t
    dbproc (defined in pivot_t)pivot_t
    dbresults_state (defined in pivot_t)pivot_t
    nacross (defined in pivot_t)pivot_t
    nout (defined in pivot_t)pivot_t
    output (defined in pivot_t)pivot_t
    status (defined in pivot_t)pivot_t
    freetds-1.3.6/doc/reference/a00637.dot000644 025423 025423 00000020771 14162303417 020646 0ustar00fredianofrediano000000 000000 digraph "pivot_t" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="pivot_t",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" across" ,fontname="Helvetica"]; Node2 [label="KEY_T",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00583.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" keys" ,fontname="Helvetica"]; Node3 [label="col_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00623.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" output" ,fontname="Helvetica"]; Node4 [label="agg_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00631.html",tooltip=" "]; Node3 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" value" ,fontname="Helvetica"]; Node2 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" col_key\nrow_key" ,fontname="Helvetica"]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dbproc" ,fontname="Helvetica"]; Node5 [label="tds_dblib_dbprocess",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00943.html",tooltip=" "]; Node6 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" nullreps" ,fontname="Helvetica"]; Node6 [label="NULLREP",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00939.html",tooltip=" "]; Node7 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" hostfileinfo" ,fontname="Helvetica"]; Node7 [label="BCP_HOSTFILEINFO",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00923.html",tooltip=" "]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" host_columns" ,fontname="Helvetica"]; Node8 [label="BCP_HOSTCOLINFO",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00919.html",tooltip=" "]; Node9 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_socket" ,fontname="Helvetica"]; Node9 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node10 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node10 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node13 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node13 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node14 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node14 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node14 -> Node14 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node15 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node15 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node15 -> Node15 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node16 -> Node15 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node16 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node9 -> Node16 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node16 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node24 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node24 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node16 -> Node24 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node24 -> Node24 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node26 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node26 [label="tds_connection",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node14 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node15 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node24 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node32 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcpinfo" ,fontname="Helvetica"]; Node32 [label="tds_bcpinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01247.html",tooltip=" "]; Node16 -> Node32 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bindinfo" ,fontname="Helvetica"]; Node13 -> Node32 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tablename" ,fontname="Helvetica"]; Node33 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dboptcmd" ,fontname="Helvetica"]; Node33 [label="dbstring",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01331.html",tooltip=" "]; Node33 -> Node33 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" strnext" ,fontname="Helvetica"]; Node34 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" row_buf" ,fontname="Helvetica"]; Node34 [label="DBPROC_ROWBUF",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00915.html",tooltip=" "]; Node35 -> Node34 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rows" ,fontname="Helvetica"]; Node35 [label="dblib_buffer_row",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00611.html",tooltip=" "]; Node16 -> Node35 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" resinfo" ,fontname="Helvetica"]; Node36 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dbopts" ,fontname="Helvetica"]; Node36 [label="dboption",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00935.html",tooltip=" "]; Node33 -> Node36 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param" ,fontname="Helvetica"]; Node37 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rpc" ,fontname="Helvetica"]; Node37 [label="DBREMOTE_PROC",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00931.html",tooltip=" "]; Node38 -> Node37 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node38 [label="DBREMOTE_PROC_PARAM",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00927.html",tooltip=" "]; Node38 -> Node38 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node37 -> Node37 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node39 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" typeinfo" ,fontname="Helvetica"]; Node39 [label="dbtypeinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01327.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00639.html000644 025423 025423 00000013633 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: pivot_t Struct Reference
    FreeTDS API
    pivot_t Struct Reference
    Collaboration diagram for pivot_t:

    Public Attributes

    KEY_Tacross
     
    DBPROCESSdbproc
     
    DB_RESULT_STATE dbresults_state
     
    size_t nacross
     
    size_t nout
     
    AGG_Toutput
     
    STATUS status
     

    The documentation for this struct was generated from the following file:
    • src/dblib/dbpivot.c
    freetds-1.3.6/doc/reference/a00640.html000644 025423 025423 00000006567 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    name_t Member List

    This is the complete list of members for name_t, including all inherited members.

    func (defined in name_t)name_t
    name (defined in name_t)name_t
    freetds-1.3.6/doc/reference/a00641.dot000644 025423 025423 00000001056 14162303417 020634 0ustar00fredianofrediano000000 000000 digraph "name_t" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="name_t",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" func" ,fontname="Helvetica"]; Node2 [label="col_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00623.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00643.html000644 025423 025423 00000010136 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: name_t Struct Reference
    FreeTDS API
    name_t Struct Reference
    Collaboration diagram for name_t:

    Public Attributes

    DBPIVOT_FUNC func
     
    char name [14]
     

    The documentation for this struct was generated from the following file:
    • src/dblib/dbpivot.c
    freetds-1.3.6/doc/reference/a00644.html000644 025423 025423 00000010134 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    ProfileParam Member List

    This is the complete list of members for ProfileParam, including all inherited members.

    buffer (defined in ProfileParam)ProfileParam
    buffer_len (defined in ProfileParam)ProfileParam
    entry (defined in ProfileParam)ProfileParam
    found (defined in ProfileParam)ProfileParam
    ret_val (defined in ProfileParam)ProfileParam
    freetds-1.3.6/doc/reference/a00647.html000644 025423 025423 00000011614 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: ProfileParam Struct Reference
    FreeTDS API
    ProfileParam Struct Reference

    Public Attributes

    LPSTR buffer
     
    int buffer_len
     
    LPCSTR entry
     
    int found
     
    int ret_val
     

    The documentation for this struct was generated from the following file:
    • src/odbc/connectparams.c
    freetds-1.3.6/doc/reference/a00648.html000644 025423 025423 00000006630 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    s_SqlMsgMap Member List

    This is the complete list of members for s_SqlMsgMap, including all inherited members.

    msg (defined in s_SqlMsgMap)s_SqlMsgMap
    sqlstate (defined in s_SqlMsgMap)s_SqlMsgMap
    freetds-1.3.6/doc/reference/a00651.html000644 025423 025423 00000007610 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: s_SqlMsgMap Struct Reference
    FreeTDS API
    s_SqlMsgMap Struct Reference

    Public Attributes

    const char * msg
     
    char sqlstate [6]
     

    The documentation for this struct was generated from the following file:
    • src/odbc/error.c
    freetds-1.3.6/doc/reference/a00652.html000644 025423 025423 00000006613 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    s_v3to2map Member List

    This is the complete list of members for s_v3to2map, including all inherited members.

    v2 (defined in s_v3to2map)s_v3to2map
    v3 (defined in s_v3to2map)s_v3to2map
    freetds-1.3.6/doc/reference/a00655.html000644 025423 025423 00000007573 14162303417 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: s_v3to2map Struct Reference
    FreeTDS API
    s_v3to2map Struct Reference

    Public Attributes

    char v2 [6]
     
    char v3 [6]
     

    The documentation for this struct was generated from the following file:
    • src/odbc/error.c
    freetds-1.3.6/doc/reference/a00656.html000644 025423 025423 00000007522 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    func_info Member List

    This is the complete list of members for func_info, including all inherited members.

    name (defined in func_info)func_info
    num_param (defined in func_info)func_info
    special (defined in func_info)func_info
    sql_name (defined in func_info)func_info
    freetds-1.3.6/doc/reference/a00657.dot000644 025423 025423 00000001075 14162303417 020644 0ustar00fredianofrediano000000 000000 digraph "func_info" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="func_info",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" special" ,fontname="Helvetica"]; Node2 [label="native_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00663.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00659.html000644 025423 025423 00000011441 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: func_info Struct Reference
    FreeTDS API
    func_info Struct Reference
    Collaboration diagram for func_info:

    Public Attributes

    const char * name
     
    int num_param
     
    special_fn special
     
    const char * sql_name
     

    The documentation for this struct was generated from the following file:
    • src/odbc/native.c
    freetds-1.3.6/doc/reference/a00660.html000644 025423 025423 00000006624 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    native_info Member List

    This is the complete list of members for native_info, including all inherited members.

    d (defined in native_info)native_info
    length (defined in native_info)native_info
    freetds-1.3.6/doc/reference/a00663.html000644 025423 025423 00000007572 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: native_info Struct Reference
    FreeTDS API
    native_info Struct Reference

    Public Attributes

    char * d
     
    int length
     

    The documentation for this struct was generated from the following file:
    • src/odbc/native.c
    freetds-1.3.6/doc/reference/a00664.html000644 025423 025423 00000007075 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DSNINFO Member List

    This is the complete list of members for DSNINFO, including all inherited members.

    dsnDSNINFO
    loginDSNINFO
    origdsnDSNINFO
    freetds-1.3.6/doc/reference/a00665.dot000644 025423 025423 00000003075 14162303417 020645 0ustar00fredianofrediano000000 000000 digraph "DSNINFO" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="DSNINFO",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node2 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node3 [label="tds_capabilities",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" types" ,fontname="Helvetica"]; Node4 [label="tds_capability_type",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01135.html",tooltip=" "]; Node5 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node5 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dsn\norigdsn" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00667.html000644 025423 025423 00000012363 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: DSNINFO Struct Reference
    FreeTDS API
    DSNINFO Struct Reference
    Collaboration diagram for DSNINFO:

    Public Attributes

    DSTR dsn
     edited name of the data source
     
    TDSLOGINlogin
     everything else
     
    DSTR origdsn
     original name of the data source
     

    The documentation for this struct was generated from the following file:
    • src/odbc/winsetup.c
    freetds-1.3.6/doc/reference/a00668.html000644 025423 025423 00000006624 14162303417 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    conf_params Member List

    This is the complete list of members for conf_params, including all inherited members.

    err (defined in conf_params)conf_params
    pool (defined in conf_params)conf_params
    freetds-1.3.6/doc/reference/a00669.dot000644 025423 025423 00000002645 14162303417 020653 0ustar00fredianofrediano000000 000000 digraph "conf_params" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="conf_params",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pool" ,fontname="Helvetica"]; Node2 [label="tds_pool",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00699.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ctx" ,fontname="Helvetica"]; Node3 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node4 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node5 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" events" ,fontname="Helvetica"]; Node5 [label="tds_pool_event",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00683.html",tooltip=" "]; Node5 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" execute\nnext" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00671.html000644 025423 025423 00000010213 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: conf_params Struct Reference
    FreeTDS API
    conf_params Struct Reference
    Collaboration diagram for conf_params:

    Public Attributes

    char ** err
     
    TDS_POOLpool
     

    The documentation for this struct was generated from the following file:
    • src/pool/config.c
    freetds-1.3.6/doc/reference/a00672.html000644 025423 025423 00000007177 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    select_info Member List

    This is the complete list of members for select_info, including all inherited members.

    maxfd (defined in select_info)select_info
    rfds (defined in select_info)select_info
    wfds (defined in select_info)select_info
    freetds-1.3.6/doc/reference/a00675.html000644 025423 025423 00000010333 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: select_info Struct Reference
    FreeTDS API
    select_info Struct Reference

    Public Attributes

    TDS_SYS_SOCKET maxfd
     
    fd_set rfds
     
    fd_set wfds
     

    The documentation for this struct was generated from the following file:
    • src/pool/main.c
    freetds-1.3.6/doc/reference/a00676.html000644 025423 025423 00000007567 14162303417 021037 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    CONNECT_EVENT Member List

    This is the complete list of members for CONNECT_EVENT, including all inherited members.

    common (defined in CONNECT_EVENT)CONNECT_EVENT
    pmbr (defined in CONNECT_EVENT)CONNECT_EVENT
    pool (defined in CONNECT_EVENT)CONNECT_EVENT
    tds_version (defined in CONNECT_EVENT)CONNECT_EVENT
    freetds-1.3.6/doc/reference/a00677.dot000644 025423 025423 00000005017 14162303417 020646 0ustar00fredianofrediano000000 000000 digraph "CONNECT_EVENT" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="CONNECT_EVENT",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pmbr" ,fontname="Helvetica"]; Node2 [label="tds_pool_member",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00695.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_user" ,fontname="Helvetica"]; Node3 [label="tds_pool_user",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00691.html",tooltip=" "]; Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" assigned_member" ,fontname="Helvetica"]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node4 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node8 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node8 [label="tds_pool_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00687.html",tooltip=" "]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node28 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pool" ,fontname="Helvetica"]; Node28 [label="tds_pool",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00699.html",tooltip=" "]; Node25 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ctx" ,fontname="Helvetica"]; Node25 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node29 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" events" ,fontname="Helvetica"]; Node29 [label="tds_pool_event",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00683.html",tooltip=" "]; Node29 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" execute\nnext" ,fontname="Helvetica"]; Node29 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" common" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00679.html000644 025423 025423 00000011640 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: CONNECT_EVENT Struct Reference
    FreeTDS API
    CONNECT_EVENT Struct Reference
    Collaboration diagram for CONNECT_EVENT:

    Public Attributes

    TDS_POOL_EVENT common
     
    TDS_POOL_MEMBERpmbr
     
    TDS_POOLpool
     
    int tds_version
     

    The documentation for this struct was generated from the following file:
    • src/pool/member.c
    freetds-1.3.6/doc/reference/a00680.html000644 025423 025423 00000006652 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_pool_event Member List

    This is the complete list of members for tds_pool_event, including all inherited members.

    execute (defined in tds_pool_event)tds_pool_event
    next (defined in tds_pool_event)tds_pool_event
    freetds-1.3.6/doc/reference/a00681.dot000644 025423 025423 00000000711 14162303417 020635 0ustar00fredianofrediano000000 000000 digraph "tds_pool_event" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_pool_event",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" execute\nnext" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00683.html000644 025423 025423 00000010321 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_pool_event Struct Reference
    FreeTDS API
    tds_pool_event Struct Reference
    Collaboration diagram for tds_pool_event:

    Public Attributes

    TDS_POOL_EXECUTE execute
     
    TDS_POOL_EVENTnext
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00684.html000644 025423 025423 00000007247 14162303417 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_pool_socket Member List

    This is the complete list of members for tds_pool_socket, including all inherited members.

    poll_recv (defined in tds_pool_socket)tds_pool_socket
    poll_send (defined in tds_pool_socket)tds_pool_socket
    tds (defined in tds_pool_socket)tds_pool_socket
    freetds-1.3.6/doc/reference/a00685.dot000644 025423 025423 00000013225 14162303417 020645 0ustar00fredianofrediano000000 000000 digraph "tds_pool_socket" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_pool_socket",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00687.html000644 025423 025423 00000011035 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_pool_socket Struct Reference
    FreeTDS API
    tds_pool_socket Struct Reference
    Collaboration diagram for tds_pool_socket:

    Public Attributes

    bool poll_recv
     
    bool poll_send
     
    TDSSOCKETtds
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00688.html000644 025423 025423 00000010206 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_pool_user Member List

    This is the complete list of members for tds_pool_user, including all inherited members.

    assigned_member (defined in tds_pool_user)tds_pool_user
    DLIST_FIELDS(dlist_user_item) (defined in tds_pool_user)tds_pool_user
    login (defined in tds_pool_user)tds_pool_user
    sock (defined in tds_pool_user)tds_pool_user
    user_state (defined in tds_pool_user)tds_pool_user
    freetds-1.3.6/doc/reference/a00689.dot000644 025423 025423 00000003276 14162303417 020656 0ustar00fredianofrediano000000 000000 digraph "tds_pool_user" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_pool_user",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" assigned_member" ,fontname="Helvetica"]; Node2 [label="tds_pool_member",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00695.html",tooltip=" "]; Node1 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_user" ,fontname="Helvetica"]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node3 [label="tds_pool_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00687.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node4 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node5 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node5 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00691.html000644 025423 025423 00000013045 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_pool_user Struct Reference
    FreeTDS API
    Collaboration diagram for tds_pool_user:

    Public Member Functions

     DLIST_FIELDS (dlist_user_item)
     

    Public Attributes

    TDS_POOL_MEMBERassigned_member
     
    TDSLOGINlogin
     
    TDS_POOL_SOCKET sock
     
    TDS_USER_STATE user_state
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00692.html000644 025423 025423 00000010245 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_pool_member Member List

    This is the complete list of members for tds_pool_member, including all inherited members.

    current_user (defined in tds_pool_member)tds_pool_member
    DLIST_FIELDS(dlist_member_item) (defined in tds_pool_member)tds_pool_member
    doing_async (defined in tds_pool_member)tds_pool_member
    last_used_tm (defined in tds_pool_member)tds_pool_member
    sock (defined in tds_pool_member)tds_pool_member
    freetds-1.3.6/doc/reference/a00693.dot000644 025423 025423 00000004513 14162303417 020644 0ustar00fredianofrediano000000 000000 digraph "tds_pool_member" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_pool_member",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_user" ,fontname="Helvetica"]; Node2 [label="tds_pool_user",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00691.html",tooltip=" "]; Node1 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" assigned_member" ,fontname="Helvetica"]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node7 [label="tds_pool_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00687.html",tooltip=" "]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node8 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00695.html000644 025423 025423 00000012775 14162303417 021035 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_pool_member Struct Reference
    FreeTDS API
    tds_pool_member Struct Reference
    Collaboration diagram for tds_pool_member:

    Public Member Functions

     DLIST_FIELDS (dlist_member_item)
     

    Public Attributes

    TDS_POOL_USERcurrent_user
     
    bool doing_async
     
    time_t last_used_tm
     
    TDS_POOL_SOCKET sock
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00696.html000644 025423 025423 00000020722 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_pool Member List

    This is the complete list of members for tds_pool, including all inherited members.

    active_members (defined in tds_pool)tds_pool
    ctx (defined in tds_pool)tds_pool
    database (defined in tds_pool)tds_pool
    event_fd (defined in tds_pool)tds_pool
    events (defined in tds_pool)tds_pool
    events_mtx (defined in tds_pool)tds_pool
    idle_members (defined in tds_pool)tds_pool
    listen_fd (defined in tds_pool)tds_pool
    max_member_age (defined in tds_pool)tds_pool
    max_open_conn (defined in tds_pool)tds_pool
    member_logins (defined in tds_pool)tds_pool
    min_open_conn (defined in tds_pool)tds_pool
    name (defined in tds_pool)tds_pool
    num_active_members (defined in tds_pool)tds_pool
    num_users (defined in tds_pool)tds_pool
    password (defined in tds_pool)tds_pool
    port (defined in tds_pool)tds_pool
    server (defined in tds_pool)tds_pool
    server_password (defined in tds_pool)tds_pool
    server_user (defined in tds_pool)tds_pool
    user (defined in tds_pool)tds_pool
    user_logins (defined in tds_pool)tds_pool
    users (defined in tds_pool)tds_pool
    waiterstds_pool
    wakeup_fd (defined in tds_pool)tds_pool
    freetds-1.3.6/doc/reference/a00697.dot000644 025423 025423 00000002252 14162303417 020646 0ustar00fredianofrediano000000 000000 digraph "tds_pool" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_pool",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ctx" ,fontname="Helvetica"]; Node2 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node3 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" events" ,fontname="Helvetica"]; Node4 [label="tds_pool_event",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00683.html",tooltip=" "]; Node4 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" execute\nnext" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00699.html000644 025423 025423 00000030437 14162303417 021034 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_pool Struct Reference
    FreeTDS API
    tds_pool Struct Reference
    Collaboration diagram for tds_pool:

    Public Attributes

    dlist_members active_members
     
    TDSCONTEXTctx
     
    char * database
     
    TDS_SYS_SOCKET event_fd
     
    TDS_POOL_EVENTevents
     
    tds_mutex events_mtx
     
    dlist_members idle_members
     
    TDS_SYS_SOCKET listen_fd
     
    int max_member_age
     
    int max_open_conn
     
    unsigned long member_logins
     
    int min_open_conn
     
    char * name
     
    int num_active_members
     
    int num_users
     
    char * password
     
    int port
     
    char * server
     
    char * server_password
     
    char * server_user
     
    char * user
     
    unsigned long user_logins
     
    dlist_users users
     
    dlist_users waiters
     users in wait state
     
    TDS_SYS_SOCKET wakeup_fd
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00700.html000644 025423 025423 00000006656 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tmp_col_struct Member List

    This is the complete list of members for tmp_col_struct, including all inherited members.

    column_name (defined in tmp_col_struct)tmp_col_struct
    next (defined in tmp_col_struct)tmp_col_struct
    freetds-1.3.6/doc/reference/a00701.dot000644 025423 025423 00000000700 14162303417 020624 0ustar00fredianofrediano000000 000000 digraph "tmp_col_struct" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tmp_col_struct",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00703.html000644 025423 025423 00000010250 14162303417 021005 0ustar00fredianofrediano000000 000000 FreeTDS API: tmp_col_struct Struct Reference
    FreeTDS API
    tmp_col_struct Struct Reference
    Collaboration diagram for tmp_col_struct:

    Public Attributes

    char * column_name
     
    struct tmp_col_structnext
     

    The documentation for this struct was generated from the following file:
    • src/pool/stream.c
    freetds-1.3.6/doc/reference/a00704.html000644 025423 025423 00000007540 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    LOGIN_EVENT Member List

    This is the complete list of members for LOGIN_EVENT, including all inherited members.

    common (defined in LOGIN_EVENT)LOGIN_EVENT
    pool (defined in LOGIN_EVENT)LOGIN_EVENT
    puser (defined in LOGIN_EVENT)LOGIN_EVENT
    success (defined in LOGIN_EVENT)LOGIN_EVENT
    freetds-1.3.6/doc/reference/a00705.dot000644 025423 025423 00000005376 14162303417 020646 0ustar00fredianofrediano000000 000000 digraph "LOGIN_EVENT" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="LOGIN_EVENT",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pool" ,fontname="Helvetica"]; Node2 [label="tds_pool",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00699.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ctx" ,fontname="Helvetica"]; Node3 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node4 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node5 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" events" ,fontname="Helvetica"]; Node5 [label="tds_pool_event",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00683.html",tooltip=" "]; Node5 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" execute\nnext" ,fontname="Helvetica"]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" puser" ,fontname="Helvetica"]; Node6 [label="tds_pool_user",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00691.html",tooltip=" "]; Node7 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" assigned_member" ,fontname="Helvetica"]; Node7 [label="tds_pool_member",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00695.html",tooltip=" "]; Node6 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_user" ,fontname="Helvetica"]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node8 [label="tds_pool_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00687.html",tooltip=" "]; Node10 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node10 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node8 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" common" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00707.html000644 025423 025423 00000011624 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: LOGIN_EVENT Struct Reference
    FreeTDS API
    LOGIN_EVENT Struct Reference
    Collaboration diagram for LOGIN_EVENT:

    Public Attributes

    TDS_POOL_EVENT common
     
    TDS_POOLpool
     
    TDS_POOL_USERpuser
     
    bool success
     

    The documentation for this struct was generated from the following file:
    • src/pool/user.c
    freetds-1.3.6/doc/reference/a00708.html000644 025423 025423 00000007610 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    END_LOGIN_EVENT Member List

    This is the complete list of members for END_LOGIN_EVENT, including all inherited members.

    common (defined in END_LOGIN_EVENT)END_LOGIN_EVENT
    pool (defined in END_LOGIN_EVENT)END_LOGIN_EVENT
    puser (defined in END_LOGIN_EVENT)END_LOGIN_EVENT
    success (defined in END_LOGIN_EVENT)END_LOGIN_EVENT
    freetds-1.3.6/doc/reference/a00709.dot000644 025423 025423 00000005406 14162303417 020644 0ustar00fredianofrediano000000 000000 digraph "END_LOGIN_EVENT" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="END_LOGIN_EVENT",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pool" ,fontname="Helvetica"]; Node2 [label="tds_pool",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00699.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ctx" ,fontname="Helvetica"]; Node3 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node4 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node5 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" events" ,fontname="Helvetica"]; Node5 [label="tds_pool_event",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00683.html",tooltip=" "]; Node5 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" execute\nnext" ,fontname="Helvetica"]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" puser" ,fontname="Helvetica"]; Node6 [label="tds_pool_user",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00691.html",tooltip=" "]; Node7 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" assigned_member" ,fontname="Helvetica"]; Node7 [label="tds_pool_member",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00695.html",tooltip=" "]; Node6 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_user" ,fontname="Helvetica"]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node8 [label="tds_pool_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00687.html",tooltip=" "]; Node10 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node10 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node8 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sock" ,fontname="Helvetica"]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" common" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00711.html000644 025423 025423 00000011640 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: END_LOGIN_EVENT Struct Reference
    FreeTDS API
    END_LOGIN_EVENT Struct Reference
    Collaboration diagram for END_LOGIN_EVENT:

    Public Attributes

    TDS_POOL_EVENT common
     
    TDS_POOLpool
     
    TDS_POOL_USERpuser
     
    bool success
     

    The documentation for this struct was generated from the following file:
    • src/pool/user.c
    freetds-1.3.6/doc/reference/a00712.html000644 025423 025423 00000007102 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_pbcb Member List

    This is the complete list of members for tds_pbcb, including all inherited members.

    cbtds_pbcb
    from_malloctds_pbcb
    pbtds_pbcb
    freetds-1.3.6/doc/reference/a00715.html000644 025423 025423 00000012112 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_pbcb Struct Reference
    FreeTDS API
    tds_pbcb Struct Reference

    Holds clause buffer. More...

    Public Attributes

    unsigned int cb
     buffer length
     
    unsigned int from_malloc
     true is buffer came from malloc
     
    char * pb
     buffer
     

    Detailed Description

    Holds clause buffer.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00716.html000644 025423 025423 00000010400 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_file_stream Member List

    This is the complete list of members for tds_file_stream, including all inherited members.

    ftds_file_stream
    lefttds_file_stream
    left_pos (defined in tds_file_stream)tds_file_stream
    streamtds_file_stream
    term_lentds_file_stream
    terminatortds_file_stream
    freetds-1.3.6/doc/reference/a00717.dot000644 025423 025423 00000001214 14162303417 020634 0ustar00fredianofrediano000000 000000 digraph "tds_file_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_file_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="input stream to read a file"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node2 [label="tds_input_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01087.html",tooltip="define a stream of data used for input"]; } freetds-1.3.6/doc/reference/a00719.html000644 025423 025423 00000015541 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_file_stream Struct Reference
    FreeTDS API
    tds_file_stream Struct Reference

    input stream to read a file More...

    Collaboration diagram for tds_file_stream:

    Public Attributes

    FILE * f
     file to read from
     
    char * left
     buffer for store bytes readed that could be the terminator
     
    size_t left_pos
     
    TDSINSTREAM stream
     common fields, must be the first field
     
    size_t term_len
     terminator length in bytes
     
    const char * terminator
     terminator
     

    Detailed Description

    input stream to read a file


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00720.html000644 025423 025423 00000006625 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_answer Member List

    This is the complete list of members for tds_answer, including all inherited members.

    lm_resp (defined in tds_answer)tds_answer
    nt_resp (defined in tds_answer)tds_answer
    freetds-1.3.6/doc/reference/a00723.html000644 025423 025423 00000010043 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_answer Struct Reference
    FreeTDS API

    Public Attributes

    unsigned char lm_resp [24]
     
    unsigned char nt_resp [24]
     

    The documentation for this struct was generated from the following file:
    • src/tds/challenge.c
    freetds-1.3.6/doc/reference/a00724.html000644 025423 025423 00000011650 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    names_blob_prefix_t Member List

    This is the complete list of members for names_blob_prefix_t, including all inherited members.

    challenge (defined in names_blob_prefix_t)names_blob_prefix_t
    max_response_type (defined in names_blob_prefix_t)names_blob_prefix_t
    reserved1 (defined in names_blob_prefix_t)names_blob_prefix_t
    reserved2 (defined in names_blob_prefix_t)names_blob_prefix_t
    response_type (defined in names_blob_prefix_t)names_blob_prefix_t
    target_info (defined in names_blob_prefix_t)names_blob_prefix_t
    timestamp (defined in names_blob_prefix_t)names_blob_prefix_t
    unknown (defined in names_blob_prefix_t)names_blob_prefix_t
    freetds-1.3.6/doc/reference/a00727.html000644 025423 025423 00000014143 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: names_blob_prefix_t Struct Reference
    FreeTDS API
    names_blob_prefix_t Struct Reference

    Public Attributes

    uint8_t challenge [8]
     
    uint8_t max_response_type
     
    uint16_t reserved1
     
    uint32_t reserved2
     
    uint8_t response_type
     
    uint8_t target_info [4]
     
    uint64_t timestamp
     
    uint32_t unknown
     

    The documentation for this struct was generated from the following file:
    • src/tds/challenge.c
    freetds-1.3.6/doc/reference/a00728.html000644 025423 025423 00000006305 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_ntlm_auth Member List

    This is the complete list of members for tds_ntlm_auth, including all inherited members.

    tds_auth (defined in tds_ntlm_auth)tds_ntlm_auth
    freetds-1.3.6/doc/reference/a00729.dot000644 025423 025423 00000001115 14162303417 020637 0ustar00fredianofrediano000000 000000 digraph "tds_ntlm_auth" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_ntlm_auth",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_auth" ,fontname="Helvetica"]; Node2 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00731.html000644 025423 025423 00000007717 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_ntlm_auth Struct Reference
    FreeTDS API
    tds_ntlm_auth Struct Reference
    Collaboration diagram for tds_ntlm_auth:

    Public Attributes

    TDSAUTHENTICATION tds_auth
     

    The documentation for this struct was generated from the following file:
    • src/tds/challenge.c
    freetds-1.3.6/doc/reference/a00736.html000644 025423 025423 00000006636 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsvername_t Member List

    This is the complete list of members for tdsvername_t, including all inherited members.

    name (defined in tdsvername_t)tdsvername_t
    version (defined in tdsvername_t)tdsvername_t
    freetds-1.3.6/doc/reference/a00739.html000644 025423 025423 00000010027 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsvername_t Struct Reference
    FreeTDS API

    Public Attributes

    const char name [6]
     
    TDS_USMALLINT version
     

    The documentation for this struct was generated from the following file:
    • src/tds/config.c
    freetds-1.3.6/doc/reference/a00740.html000644 025423 025423 00000010615 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_time Member List

    This is the complete list of members for tds_time, including all inherited members.

    tm_hourtds_time
    tm_mdaytds_time
    tm_mintds_time
    tm_montds_time
    tm_nstds_time
    tm_sectds_time
    tm_yeartds_time
    freetds-1.3.6/doc/reference/a00743.html000644 025423 025423 00000015713 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_time Struct Reference
    FreeTDS API
    tds_time Struct Reference

    Public Attributes

    int tm_hour
     hours (0-23)
     
    int tm_mday
     month day (1-31)
     
    int tm_min
     minutes (0-59)
     
    int tm_mon
     month (0-11)
     
    int tm_ns
     nanoseconds (0-999999999)
     
    int tm_sec
     seconds (0-59)
     
    int tm_year
     year (0=1900)
     

    The documentation for this struct was generated from the following file:
    • src/tds/convert.c
    freetds-1.3.6/doc/reference/a00744.html000644 025423 025423 00000007265 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_varmax_stream Member List

    This is the complete list of members for tds_varmax_stream, including all inherited members.

    chunk_left (defined in tds_varmax_stream)tds_varmax_stream
    stream (defined in tds_varmax_stream)tds_varmax_stream
    tds (defined in tds_varmax_stream)tds_varmax_stream
    freetds-1.3.6/doc/reference/a00745.dot000644 025423 025423 00000013677 14162303417 020655 0ustar00fredianofrediano000000 000000 digraph "tds_varmax_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_varmax_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node25 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node25 [label="tds_input_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01087.html",tooltip="define a stream of data used for input"]; } freetds-1.3.6/doc/reference/a00747.html000644 025423 025423 00000011110 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_varmax_stream Struct Reference
    FreeTDS API
    tds_varmax_stream Struct Reference
    Collaboration diagram for tds_varmax_stream:

    Public Attributes

    TDS_INT chunk_left
     
    TDSINSTREAM stream
     
    TDSSOCKETtds
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00752.html000644 025423 025423 00000006632 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_save_msg Member List

    This is the complete list of members for tds_save_msg, including all inherited members.

    msg (defined in tds_save_msg)tds_save_msg
    type (defined in tds_save_msg)tds_save_msg
    freetds-1.3.6/doc/reference/a00753.dot000644 025423 025423 00000001077 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "tds_save_msg" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_save_msg",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msg" ,fontname="Helvetica"]; Node2 [label="tds_message",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01187.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00755.html000644 025423 025423 00000010211 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_save_msg Struct Reference
    FreeTDS API
    tds_save_msg Struct Reference
    Collaboration diagram for tds_save_msg:

    Public Attributes

    TDSMESSAGE msg
     
    char type
     

    The documentation for this struct was generated from the following file:
    • src/tds/login.c
    freetds-1.3.6/doc/reference/a00756.html000644 025423 025423 00000007212 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_save_env Member List

    This is the complete list of members for tds_save_env, including all inherited members.

    newval (defined in tds_save_env)tds_save_env
    oldval (defined in tds_save_env)tds_save_env
    type (defined in tds_save_env)tds_save_env
    freetds-1.3.6/doc/reference/a00759.html000644 025423 025423 00000010325 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_save_env Struct Reference
    FreeTDS API
    tds_save_env Struct Reference

    Public Attributes

    char * newval
     
    char * oldval
     
    int type
     

    The documentation for this struct was generated from the following file:
    • src/tds/login.c
    freetds-1.3.6/doc/reference/a00760.html000644 025423 025423 00000010204 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_save_context Member List

    This is the complete list of members for tds_save_context, including all inherited members.

    ctx (defined in tds_save_context)tds_save_context
    envs (defined in tds_save_context)tds_save_context
    msgs (defined in tds_save_context)tds_save_context
    num_env (defined in tds_save_context)tds_save_context
    num_msg (defined in tds_save_context)tds_save_context
    freetds-1.3.6/doc/reference/a00761.dot000644 025423 025423 00000003051 14162303417 020634 0ustar00fredianofrediano000000 000000 digraph "tds_save_context" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_save_context",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ctx" ,fontname="Helvetica"]; Node2 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node3 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" envs" ,fontname="Helvetica"]; Node4 [label="tds_save_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00759.html",tooltip=" "]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msgs" ,fontname="Helvetica"]; Node5 [label="tds_save_msg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00755.html",tooltip=" "]; Node6 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msg" ,fontname="Helvetica"]; Node6 [label="tds_message",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01187.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00763.html000644 025423 025423 00000012421 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_save_context Struct Reference
    FreeTDS API
    tds_save_context Struct Reference
    Collaboration diagram for tds_save_context:

    Public Attributes

    TDSCONTEXT ctx
     
    struct tds_save_env envs [10]
     
    struct tds_save_msg msgs [10]
     
    unsigned num_env
     
    unsigned num_msg
     

    The documentation for this struct was generated from the following file:
    • src/tds/login.c
    freetds-1.3.6/doc/reference/a00764.html000644 025423 025423 00000007210 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    retry_addr Member List

    This is the complete list of members for retry_addr, including all inherited members.

    addr (defined in retry_addr)retry_addr
    next_retry_time (defined in retry_addr)retry_addr
    retry_count (defined in retry_addr)retry_addr
    freetds-1.3.6/doc/reference/a00767.html000644 025423 025423 00000010571 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: retry_addr Struct Reference
    FreeTDS API

    Public Attributes

    struct addrinfo * addr
     
    unsigned next_retry_time
     
    unsigned retry_count
     

    The documentation for this struct was generated from the following file:
    • src/tds/net.c
    freetds-1.3.6/doc/reference/a00768.html000644 025423 025423 00000007301 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_quoteout_stream Member List

    This is the complete list of members for tds_quoteout_stream, including all inherited members.

    buffer (defined in tds_quoteout_stream)tds_quoteout_stream
    stream (defined in tds_quoteout_stream)tds_quoteout_stream
    tds (defined in tds_quoteout_stream)tds_quoteout_stream
    freetds-1.3.6/doc/reference/a00769.dot000644 025423 025423 00000013705 14162303417 020653 0ustar00fredianofrediano000000 000000 digraph "tds_quoteout_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_quoteout_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node25 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node25 [label="tds_output_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01091.html",tooltip="define a stream of data used for output"]; } freetds-1.3.6/doc/reference/a00771.html000644 025423 025423 00000011251 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_quoteout_stream Struct Reference
    FreeTDS API
    tds_quoteout_stream Struct Reference
    Collaboration diagram for tds_quoteout_stream:

    Public Attributes

    char buffer [2048]
     
    TDSOUTSTREAM stream
     
    TDSSOCKETtds
     

    The documentation for this struct was generated from the following file:
    • src/tds/query.c
    freetds-1.3.6/doc/reference/a00772.html000644 025423 025423 00000006240 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    mpz_t Member List

    This is the complete list of members for mpz_t, including all inherited members.

    num (defined in mpz_t)mpz_t
    freetds-1.3.6/doc/reference/a00775.html000644 025423 025423 00000007337 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: mpz_t Struct Reference
    FreeTDS API

    Public Attributes

    gcry_mpi_t num
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00776.html000644 025423 025423 00000007634 14162303417 021033 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    asn1_der_iterator Member List

    This is the complete list of members for asn1_der_iterator, including all inherited members.

    data (defined in asn1_der_iterator)asn1_der_iterator
    data_end (defined in asn1_der_iterator)asn1_der_iterator
    length (defined in asn1_der_iterator)asn1_der_iterator
    type (defined in asn1_der_iterator)asn1_der_iterator
    freetds-1.3.6/doc/reference/a00779.html000644 025423 025423 00000011450 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: asn1_der_iterator Struct Reference
    FreeTDS API
    asn1_der_iterator Struct Reference

    Public Attributes

    const unsigned char * data
     
    const unsigned char * data_end
     
    unsigned long length
     
    unsigned long type
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00780.html000644 025423 025423 00000007220 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    rsa_public_key Member List

    This is the complete list of members for rsa_public_key, including all inherited members.

    e (defined in rsa_public_key)rsa_public_key
    n (defined in rsa_public_key)rsa_public_key
    size (defined in rsa_public_key)rsa_public_key
    freetds-1.3.6/doc/reference/a00781.dot000644 025423 025423 00000001076 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "rsa_public_key" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="rsa_public_key",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" e\nn" ,fontname="Helvetica"]; Node2 [label="mpz_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00775.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00783.html000644 025423 025423 00000011305 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: rsa_public_key Struct Reference
    FreeTDS API
    rsa_public_key Struct Reference
    Collaboration diagram for rsa_public_key:

    Public Attributes

    mpz_t e
     
    mpz_t n
     
    unsigned size
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00784.html000644 025423 025423 00000006551 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    namelist Member List

    This is the complete list of members for namelist, including all inherited members.

    namenamelist
    nextnamelist
    freetds-1.3.6/doc/reference/a00785.dot000644 025423 025423 00000000707 14162303417 020647 0ustar00fredianofrediano000000 000000 digraph "namelist" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="namelist",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Holds list of names."]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00787.html000644 025423 025423 00000011663 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: namelist Struct Reference
    FreeTDS API

    Holds list of names. More...

    Collaboration diagram for namelist:

    Public Attributes

    char * name
     string name
     
    struct namelistnext
     next element in the list
     

    Detailed Description

    Holds list of names.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00788.html000644 025423 025423 00000007266 14162303417 021037 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_error_message Member List

    This is the complete list of members for tds_error_message, including all inherited members.

    msgno (defined in tds_error_message)tds_error_message
    msgtext (defined in tds_error_message)tds_error_message
    severity (defined in tds_error_message)tds_error_message
    freetds-1.3.6/doc/reference/a00791.html000644 025423 025423 00000010352 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_error_message Struct Reference
    FreeTDS API
    tds_error_message Struct Reference

    Public Attributes

    TDSERRNO msgno
     
    const char * msgtext
     
    int severity
     

    The documentation for this struct was generated from the following file:
    • src/tds/util.c
    freetds-1.3.6/doc/reference/a00792.html000644 025423 025423 00000006676 14162303417 021036 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    string_linked_list Member List

    This is the complete list of members for string_linked_list, including all inherited members.

    next (defined in string_linked_list)string_linked_list
    str (defined in string_linked_list)string_linked_list
    freetds-1.3.6/doc/reference/a00793.dot000644 025423 025423 00000000710 14162303417 020640 0ustar00fredianofrediano000000 000000 digraph "string_linked_list" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="string_linked_list",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00795.html000644 025423 025423 00000010262 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: string_linked_list Struct Reference
    FreeTDS API
    string_linked_list Struct Reference
    Collaboration diagram for string_linked_list:

    Public Attributes

    struct string_linked_listnext
     
    char * str
     

    The documentation for this struct was generated from the following file:
    • src/tds/vstrbuild.c
    freetds-1.3.6/doc/reference/a00796.html000644 025423 025423 00000007637 14162303417 021040 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    ptw32_mcs_node_t_ Member List

    This is the complete list of members for ptw32_mcs_node_t_, including all inherited members.

    lock (defined in ptw32_mcs_node_t_)ptw32_mcs_node_t_
    next (defined in ptw32_mcs_node_t_)ptw32_mcs_node_t_
    nextFlag (defined in ptw32_mcs_node_t_)ptw32_mcs_node_t_
    readyFlag (defined in ptw32_mcs_node_t_)ptw32_mcs_node_t_
    freetds-1.3.6/doc/reference/a00797.dot000644 025423 025423 00000000714 14162303417 020650 0ustar00fredianofrediano000000 000000 digraph "ptw32_mcs_node_t_" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="ptw32_mcs_node_t_",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" lock\nnext" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00799.html000644 025423 025423 00000011645 14162303417 021035 0ustar00fredianofrediano000000 000000 FreeTDS API: ptw32_mcs_node_t_ Struct Reference
    FreeTDS API
    ptw32_mcs_node_t_ Struct Reference
    Collaboration diagram for ptw32_mcs_node_t_:

    Public Attributes

    struct ptw32_mcs_node_t_ ** lock
     
    struct ptw32_mcs_node_t_next
     
    void * nextFlag
     
    void * readyFlag
     

    The documentation for this struct was generated from the following file:
    • src/utils/ptw32_MCS_lock.c
    freetds-1.3.6/doc/reference/a00800.html000644 025423 025423 00000012320 14162303417 021003 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_objname Member List

    This is the complete list of members for _cs_objname, including all inherited members.

    first_name (defined in _cs_objname)_cs_objname
    fnlen (defined in _cs_objname)_cs_objname
    last_name (defined in _cs_objname)_cs_objname
    lnlen (defined in _cs_objname)_cs_objname
    object_type (defined in _cs_objname)_cs_objname
    scope (defined in _cs_objname)_cs_objname
    scopelen (defined in _cs_objname)_cs_objname
    thinkexists (defined in _cs_objname)_cs_objname
    thread (defined in _cs_objname)_cs_objname
    threadlen (defined in _cs_objname)_cs_objname
    freetds-1.3.6/doc/reference/a00803.html000644 025423 025423 00000015247 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_objname Struct Reference
    FreeTDS API
    _cs_objname Struct Reference

    Public Attributes

    CS_CHAR first_name [CS_MAX_NAME]
     
    CS_INT fnlen
     
    CS_CHAR last_name [CS_MAX_NAME]
     
    CS_INT lnlen
     
    CS_INT object_type
     
    CS_VOID * scope
     
    CS_INT scopelen
     
    CS_BOOL thinkexists
     
    CS_VOID * thread
     
    CS_INT threadlen
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00804.html000644 025423 025423 00000010132 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_objdata Member List

    This is the complete list of members for _cs_objdata, including all inherited members.

    actuallyexists (defined in _cs_objdata)_cs_objdata
    buffer (defined in _cs_objdata)_cs_objdata
    buflen (defined in _cs_objdata)_cs_objdata
    command (defined in _cs_objdata)_cs_objdata
    connection (defined in _cs_objdata)_cs_objdata
    freetds-1.3.6/doc/reference/a00805.dot000644 025423 025423 00000012275 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "_cs_objdata" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_objdata",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" command" ,fontname="Helvetica"]; Node2 [label="_cs_command",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00899.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" iodesc" ,fontname="Helvetica"]; Node3 [label="_cs_iodesc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00823.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node4 [label="_cs_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00907.html",tooltip=" "]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node5 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" input_params" ,fontname="Helvetica"]; Node5 [label="_cs_param",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00887.html",tooltip=" "]; Node5 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node6 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyn" ,fontname="Helvetica"]; Node6 [label="_cs_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00895.html",tooltip=" "]; Node7 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tdsdyn" ,fontname="Helvetica"]; Node7 [label="tds_dynamic",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node5 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node6 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node15 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursor" ,fontname="Helvetica"]; Node15 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node15 -> Node15 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node30 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" con" ,fontname="Helvetica"]; Node30 [label="_cs_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00883.html",tooltip=" "]; Node4 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node9 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_socket" ,fontname="Helvetica"]; Node9 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node10 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node10 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node7 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node15 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node10 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_login" ,fontname="Helvetica"]; Node2 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cmds" ,fontname="Helvetica"]; Node31 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _clientmsg_cb\n_servermsg_cb\nctx" ,fontname="Helvetica"]; Node31 [label="_cs_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00875.html",tooltip=" "]; Node31 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _clientmsg_cb\n_cslibmsg_cb\n_servermsg_cb" ,fontname="Helvetica"]; Node6 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dynlist" ,fontname="Helvetica"]; Node38 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rpc" ,fontname="Helvetica"]; Node38 [label="_csremote_proc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00891.html",tooltip=" "]; Node5 -> Node38 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node30 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" connection" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00807.html000644 025423 025423 00000012405 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_objdata Struct Reference
    FreeTDS API
    _cs_objdata Struct Reference
    Collaboration diagram for _cs_objdata:

    Public Attributes

    CS_BOOL actuallyexists
     
    CS_VOID * buffer
     
    CS_INT buflen
     
    CS_COMMANDcommand
     
    CS_CONNECTIONconnection
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00808.html000644 025423 025423 00000007205 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_numeric Member List

    This is the complete list of members for _cs_numeric, including all inherited members.

    array (defined in _cs_numeric)_cs_numeric
    precision (defined in _cs_numeric)_cs_numeric
    scale (defined in _cs_numeric)_cs_numeric
    freetds-1.3.6/doc/reference/a00811.html000644 025423 025423 00000010454 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_numeric Struct Reference
    FreeTDS API
    _cs_numeric Struct Reference

    Public Attributes

    unsigned char array [CS_MAX_NUMLEN]
     
    unsigned char precision
     
    unsigned char scale
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00812.html000644 025423 025423 00000006641 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_varbinary Member List

    This is the complete list of members for _cs_varbinary, including all inherited members.

    array (defined in _cs_varbinary)_cs_varbinary
    len (defined in _cs_varbinary)_cs_varbinary
    freetds-1.3.6/doc/reference/a00815.html000644 025423 025423 00000007672 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_varbinary Struct Reference
    FreeTDS API
    _cs_varbinary Struct Reference

    Public Attributes

    CS_CHAR array [256]
     
    CS_SMALLINT len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00816.html000644 025423 025423 00000006623 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_varchar Member List

    This is the complete list of members for _cs_varchar, including all inherited members.

    len (defined in _cs_varchar)_cs_varchar
    str (defined in _cs_varchar)_cs_varchar
    freetds-1.3.6/doc/reference/a00819.html000644 025423 025423 00000007664 14162303417 021034 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_varchar Struct Reference
    FreeTDS API
    _cs_varchar Struct Reference

    Public Attributes

    CS_SMALLINT len
     
    CS_CHAR str [256]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00820.html000644 025423 025423 00000013563 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_iodesc Member List

    This is the complete list of members for _cs_iodesc, including all inherited members.

    datatype (defined in _cs_iodesc)_cs_iodesc
    iotype (defined in _cs_iodesc)_cs_iodesc
    locale (defined in _cs_iodesc)_cs_iodesc
    log_on_update (defined in _cs_iodesc)_cs_iodesc
    name (defined in _cs_iodesc)_cs_iodesc
    namelen (defined in _cs_iodesc)_cs_iodesc
    offset (defined in _cs_iodesc)_cs_iodesc
    textptr (defined in _cs_iodesc)_cs_iodesc
    textptrlen (defined in _cs_iodesc)_cs_iodesc
    timestamp (defined in _cs_iodesc)_cs_iodesc
    timestamplen (defined in _cs_iodesc)_cs_iodesc
    total_txtlen (defined in _cs_iodesc)_cs_iodesc
    usertype (defined in _cs_iodesc)_cs_iodesc
    freetds-1.3.6/doc/reference/a00821.dot000644 025423 025423 00000001075 14162303417 020635 0ustar00fredianofrediano000000 000000 digraph "_cs_iodesc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_iodesc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node2 [label="_cs_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00907.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00823.html000644 025423 025423 00000017713 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_iodesc Struct Reference
    FreeTDS API
    _cs_iodesc Struct Reference
    Collaboration diagram for _cs_iodesc:

    Public Attributes

    CS_INT datatype
     
    CS_INT iotype
     
    CS_LOCALElocale
     
    CS_BOOL log_on_update
     
    CS_CHAR name [CS_OBJ_NAME]
     
    CS_INT namelen
     
    CS_INT offset
     
    CS_BYTE textptr [CS_TP_SIZE]
     
    CS_INT textptrlen
     
    CS_BYTE timestamp [CS_TS_SIZE]
     
    CS_INT timestamplen
     
    CS_INT total_txtlen
     
    CS_INT usertype
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00824.html000644 025423 025423 00000012657 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_datafmt Member List

    This is the complete list of members for _cs_datafmt, including all inherited members.

    count (defined in _cs_datafmt)_cs_datafmt
    datatype (defined in _cs_datafmt)_cs_datafmt
    format (defined in _cs_datafmt)_cs_datafmt
    locale (defined in _cs_datafmt)_cs_datafmt
    maxlength (defined in _cs_datafmt)_cs_datafmt
    name (defined in _cs_datafmt)_cs_datafmt
    namelen (defined in _cs_datafmt)_cs_datafmt
    precision (defined in _cs_datafmt)_cs_datafmt
    scale (defined in _cs_datafmt)_cs_datafmt
    status (defined in _cs_datafmt)_cs_datafmt
    usertype (defined in _cs_datafmt)_cs_datafmt
    freetds-1.3.6/doc/reference/a00825.dot000644 025423 025423 00000001077 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "_cs_datafmt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_datafmt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node2 [label="_cs_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00907.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00827.html000644 025423 025423 00000016352 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_datafmt Struct Reference
    FreeTDS API
    _cs_datafmt Struct Reference
    Collaboration diagram for _cs_datafmt:

    Public Attributes

    CS_INT count
     
    CS_INT datatype
     
    CS_INT format
     
    CS_LOCALElocale
     
    CS_INT maxlength
     
    CS_CHAR name [CS_MAX_NAME]
     
    CS_INT namelen
     
    CS_INT precision
     
    CS_INT scale
     
    CS_INT status
     
    CS_INT usertype
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00828.html000644 025423 025423 00000006616 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_money Member List

    This is the complete list of members for _cs_money, including all inherited members.

    mnyhigh (defined in _cs_money)_cs_money
    mnylow (defined in _cs_money)_cs_money
    freetds-1.3.6/doc/reference/a00831.html000644 025423 025423 00000007654 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_money Struct Reference
    FreeTDS API
    _cs_money Struct Reference

    Public Attributes

    CS_INT mnyhigh
     
    CS_UINT mnylow
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00832.html000644 025423 025423 00000006265 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_money4 Member List

    This is the complete list of members for _cs_money4, including all inherited members.

    mny4 (defined in _cs_money4)_cs_money4
    freetds-1.3.6/doc/reference/a00835.html000644 025423 025423 00000007122 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_money4 Struct Reference
    FreeTDS API
    _cs_money4 Struct Reference

    Public Attributes

    CS_INT mny4
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00836.html000644 025423 025423 00000006637 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_datetime Member List

    This is the complete list of members for _cs_datetime, including all inherited members.

    dtdays (defined in _cs_datetime)_cs_datetime
    dttime (defined in _cs_datetime)_cs_datetime
    freetds-1.3.6/doc/reference/a00839.html000644 025423 025423 00000007660 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_datetime Struct Reference
    FreeTDS API
    _cs_datetime Struct Reference

    Public Attributes

    CS_INT dtdays
     
    CS_INT dttime
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00840.html000644 025423 025423 00000006644 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_datetime4 Member List

    This is the complete list of members for _cs_datetime4, including all inherited members.

    days (defined in _cs_datetime4)_cs_datetime4
    minutes (defined in _cs_datetime4)_cs_datetime4
    freetds-1.3.6/doc/reference/a00843.html000644 025423 025423 00000007667 14162303417 021034 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_datetime4 Struct Reference
    FreeTDS API
    _cs_datetime4 Struct Reference

    Public Attributes

    CS_USHORT days
     
    CS_USHORT minutes
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00844.html000644 025423 025423 00000013261 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_daterec Member List

    This is the complete list of members for _cs_daterec, including all inherited members.

    datedmonth (defined in _cs_daterec)_cs_daterec
    datedweek (defined in _cs_daterec)_cs_daterec
    datedyear (defined in _cs_daterec)_cs_daterec
    datehour (defined in _cs_daterec)_cs_daterec
    dateminute (defined in _cs_daterec)_cs_daterec
    datemonth (defined in _cs_daterec)_cs_daterec
    datemsecond (defined in _cs_daterec)_cs_daterec
    datesecfrac (defined in _cs_daterec)_cs_daterec
    datesecond (defined in _cs_daterec)_cs_daterec
    datesecprec (defined in _cs_daterec)_cs_daterec
    datetzone (defined in _cs_daterec)_cs_daterec
    dateyear (defined in _cs_daterec)_cs_daterec
    freetds-1.3.6/doc/reference/a00847.html000644 025423 025423 00000016511 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_daterec Struct Reference
    FreeTDS API
    _cs_daterec Struct Reference

    Public Attributes

    CS_INT datedmonth
     
    CS_INT datedweek
     
    CS_INT datedyear
     
    CS_INT datehour
     
    CS_INT dateminute
     
    CS_INT datemonth
     
    CS_INT datemsecond
     
    CS_INT datesecfrac
     
    CS_INT datesecond
     
    CS_INT datesecprec
     
    CS_INT datetzone
     
    CS_INT dateyear
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00848.html000644 025423 025423 00000012407 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_clientmsg Member List

    This is the complete list of members for _cs_clientmsg, including all inherited members.

    msgnumber (defined in _cs_clientmsg)_cs_clientmsg
    msgstring (defined in _cs_clientmsg)_cs_clientmsg
    msgstringlen (defined in _cs_clientmsg)_cs_clientmsg
    osnumber (defined in _cs_clientmsg)_cs_clientmsg
    osstring (defined in _cs_clientmsg)_cs_clientmsg
    osstringlen (defined in _cs_clientmsg)_cs_clientmsg
    severity (defined in _cs_clientmsg)_cs_clientmsg
    sqlstate (defined in _cs_clientmsg)_cs_clientmsg
    sqlstatelen (defined in _cs_clientmsg)_cs_clientmsg
    status (defined in _cs_clientmsg)_cs_clientmsg
    freetds-1.3.6/doc/reference/a00851.html000644 025423 025423 00000015303 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_clientmsg Struct Reference
    FreeTDS API
    _cs_clientmsg Struct Reference

    Public Attributes

    CS_MSGNUM msgnumber
     
    CS_CHAR msgstring [CS_MAX_MSG]
     
    CS_INT msgstringlen
     
    CS_INT osnumber
     
    CS_CHAR osstring [CS_MAX_MSG]
     
    CS_INT osstringlen
     
    CS_INT severity
     
    CS_BYTE sqlstate [CS_SQLSTATE_SIZE]
     
    CS_INT sqlstatelen
     
    CS_INT status
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00852.html000644 025423 025423 00000013662 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_servermsg Member List

    This is the complete list of members for _cs_servermsg, including all inherited members.

    line (defined in _cs_servermsg)_cs_servermsg
    msgnumber (defined in _cs_servermsg)_cs_servermsg
    proc (defined in _cs_servermsg)_cs_servermsg
    proclen (defined in _cs_servermsg)_cs_servermsg
    severity (defined in _cs_servermsg)_cs_servermsg
    sqlstate (defined in _cs_servermsg)_cs_servermsg
    sqlstatelen (defined in _cs_servermsg)_cs_servermsg
    state (defined in _cs_servermsg)_cs_servermsg
    status (defined in _cs_servermsg)_cs_servermsg
    svrname (defined in _cs_servermsg)_cs_servermsg
    svrnlen (defined in _cs_servermsg)_cs_servermsg
    text (defined in _cs_servermsg)_cs_servermsg
    textlen (defined in _cs_servermsg)_cs_servermsg
    freetds-1.3.6/doc/reference/a00855.html000644 025423 025423 00000017306 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_servermsg Struct Reference
    FreeTDS API
    _cs_servermsg Struct Reference

    Public Attributes

    CS_INT line
     
    CS_MSGNUM msgnumber
     
    CS_CHAR proc [CS_MAX_NAME]
     
    CS_INT proclen
     
    CS_INT severity
     
    CS_BYTE sqlstate [CS_SQLSTATE_SIZE]
     
    CS_INT sqlstatelen
     
    CS_INT state
     
    CS_INT status
     
    CS_CHAR svrname [CS_MAX_NAME]
     
    CS_INT svrnlen
     
    CS_CHAR text [CS_MAX_MSG]
     
    CS_INT textlen
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00856.html000644 025423 025423 00000006302 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_config Member List

    This is the complete list of members for _cs_config, including all inherited members.

    cs_expose_formats (defined in _cs_config)_cs_config
    freetds-1.3.6/doc/reference/a00859.html000644 025423 025423 00000007134 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_config Struct Reference
    FreeTDS API
    _cs_config Struct Reference

    Public Attributes

    short cs_expose_formats
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00860.html000644 025423 025423 00000006704 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    cs_diag_msg_client Member List

    This is the complete list of members for cs_diag_msg_client, including all inherited members.

    clientmsg (defined in cs_diag_msg_client)cs_diag_msg_client
    next (defined in cs_diag_msg_client)cs_diag_msg_client
    freetds-1.3.6/doc/reference/a00861.dot000644 025423 025423 00000001307 14162303417 020637 0ustar00fredianofrediano000000 000000 digraph "cs_diag_msg_client" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="cs_diag_msg_client",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" clientmsg" ,fontname="Helvetica"]; Node2 [label="_cs_clientmsg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00851.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00863.html000644 025423 025423 00000010415 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: cs_diag_msg_client Struct Reference
    FreeTDS API
    cs_diag_msg_client Struct Reference
    Collaboration diagram for cs_diag_msg_client:

    Public Attributes

    CS_CLIENTMSGclientmsg
     
    struct cs_diag_msg_clientnext
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00864.html000644 025423 025423 00000006662 14162303417 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    cs_diag_msg_svr Member List

    This is the complete list of members for cs_diag_msg_svr, including all inherited members.

    next (defined in cs_diag_msg_svr)cs_diag_msg_svr
    servermsg (defined in cs_diag_msg_svr)cs_diag_msg_svr
    freetds-1.3.6/doc/reference/a00865.dot000644 025423 025423 00000001301 14162303417 020635 0ustar00fredianofrediano000000 000000 digraph "cs_diag_msg_svr" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="cs_diag_msg_svr",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" servermsg" ,fontname="Helvetica"]; Node2 [label="_cs_servermsg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00855.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00867.html000644 025423 025423 00000010401 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: cs_diag_msg_svr Struct Reference
    FreeTDS API
    cs_diag_msg_svr Struct Reference
    Collaboration diagram for cs_diag_msg_svr:

    Public Attributes

    struct cs_diag_msg_svrnext
     
    CS_SERVERMSGservermsg
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00868.html000644 025423 025423 00000006624 14162303417 021033 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    cs_diag_msg Member List

    This is the complete list of members for cs_diag_msg, including all inherited members.

    msg (defined in cs_diag_msg)cs_diag_msg
    next (defined in cs_diag_msg)cs_diag_msg
    freetds-1.3.6/doc/reference/a00869.dot000644 025423 025423 00000001263 14162303417 020650 0ustar00fredianofrediano000000 000000 digraph "cs_diag_msg" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="cs_diag_msg",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msg" ,fontname="Helvetica"]; Node2 [label="_cs_clientmsg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00851.html",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00871.html000644 025423 025423 00000010353 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: cs_diag_msg Struct Reference
    FreeTDS API
    cs_diag_msg Struct Reference
    Collaboration diagram for cs_diag_msg:

    Public Attributes

    CS_CLIENTMSGmsg
     
    struct cs_diag_msgnext
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00872.html000644 025423 025423 00000016105 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_context Member List

    This is the complete list of members for _cs_context, including all inherited members.

    _clientmsg_cb (defined in _cs_context)_cs_context
    _cslibmsg_cb (defined in _cs_context)_cs_context
    _servermsg_cb (defined in _cs_context)_cs_context
    clientstore (defined in _cs_context)_cs_context
    config (defined in _cs_context)_cs_context
    cs_diag_msglimit (defined in _cs_context)_cs_context
    cs_diag_msglimit_client (defined in _cs_context)_cs_context
    cs_diag_msglimit_server (defined in _cs_context)_cs_context
    cs_diag_msglimit_total (defined in _cs_context)_cs_context
    cs_errhandletype (defined in _cs_context)_cs_context
    date_convert_fmt (defined in _cs_context)_cs_context
    login_timeout_cs_context
    msgstore (defined in _cs_context)_cs_context
    query_timeout_cs_context
    svrstore (defined in _cs_context)_cs_context
    tds_ctx (defined in _cs_context)_cs_context
    userdata (defined in _cs_context)_cs_context
    userdata_len (defined in _cs_context)_cs_context
    freetds-1.3.6/doc/reference/a00873.dot000644 025423 025423 00000005634 14162303417 020651 0ustar00fredianofrediano000000 000000 digraph "_cs_context" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_context",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" clientstore" ,fontname="Helvetica"]; Node2 [label="cs_diag_msg_client",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00863.html",tooltip=" "]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" clientmsg" ,fontname="Helvetica"]; Node3 [label="_cs_clientmsg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00851.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node4 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node5 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node5 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" config" ,fontname="Helvetica"]; Node6 [label="_cs_config",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00859.html",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _clientmsg_cb\n_cslibmsg_cb\n_servermsg_cb" ,fontname="Helvetica"]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" svrstore" ,fontname="Helvetica"]; Node7 [label="cs_diag_msg_svr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00867.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" servermsg" ,fontname="Helvetica"]; Node8 [label="_cs_servermsg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00855.html",tooltip=" "]; Node9 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msgstore" ,fontname="Helvetica"]; Node9 [label="cs_diag_msg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00871.html",tooltip=" "]; Node3 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msg" ,fontname="Helvetica"]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00875.html000644 025423 025423 00000024522 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_context Struct Reference
    FreeTDS API
    _cs_context Struct Reference
    Collaboration diagram for _cs_context:

    Public Attributes

    CS_CLIENTMSG_FUNC _clientmsg_cb
     
    CS_CSLIBMSG_FUNC _cslibmsg_cb
     
    CS_SERVERMSG_FUNC _servermsg_cb
     
    struct cs_diag_msg_clientclientstore
     
    CS_CONFIG config
     
    CS_INT cs_diag_msglimit
     
    CS_INT cs_diag_msglimit_client
     
    CS_INT cs_diag_msglimit_server
     
    CS_INT cs_diag_msglimit_total
     
    CS_INT cs_errhandletype
     
    CS_INT date_convert_fmt
     
    int login_timeout
     not used unless positive
     
    struct cs_diag_msgmsgstore
     
    int query_timeout
     not used unless positive
     
    struct cs_diag_msg_svrsvrstore
     
    TDSCONTEXTtds_ctx
     
    void * userdata
     
    int userdata_len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00876.html000644 025423 025423 00000006276 14162303417 021035 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _ct_colinfo Member List

    This is the complete list of members for _ct_colinfo, including all inherited members.

    indicator (defined in _ct_colinfo)_ct_colinfo
    freetds-1.3.6/doc/reference/a00879.html000644 025423 025423 00000007137 14162303417 021035 0ustar00fredianofrediano000000 000000 FreeTDS API: _ct_colinfo Struct Reference
    FreeTDS API
    _ct_colinfo Struct Reference

    Public Attributes

    TDS_SMALLINT * indicator
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00880.html000644 025423 025423 00000013370 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_connection Member List

    This is the complete list of members for _cs_connection, including all inherited members.

    _clientmsg_cb (defined in _cs_connection)_cs_connection
    _servermsg_cb (defined in _cs_connection)_cs_connection
    cmds (defined in _cs_connection)_cs_connection
    ctx (defined in _cs_connection)_cs_connection
    dynlist (defined in _cs_connection)_cs_connection
    locale (defined in _cs_connection)_cs_connection
    network_auth (defined in _cs_connection)_cs_connection
    server_addr (defined in _cs_connection)_cs_connection
    tds_login (defined in _cs_connection)_cs_connection
    tds_socket (defined in _cs_connection)_cs_connection
    userdata (defined in _cs_connection)_cs_connection
    userdata_len (defined in _cs_connection)_cs_connection
    freetds-1.3.6/doc/reference/a00881.dot000644 025423 025423 00000025671 14162303417 020653 0ustar00fredianofrediano000000 000000 digraph "_cs_connection" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_cs_connection",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node2 [label="_cs_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00907.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_socket" ,fontname="Helvetica"]; Node3 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node4 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node5 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node5 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node7 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node7 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node8 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node8 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node9 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node10 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node10 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node3 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node10 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node18 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node18 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node19 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node19 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node10 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node18 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node20 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node20 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node5 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node21 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node21 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node22 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node22 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node23 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node23 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node25 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node25 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node8 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node9 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node12 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node12 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node18 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_login" ,fontname="Helvetica"]; Node26 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cmds" ,fontname="Helvetica"]; Node26 [label="_cs_command",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00899.html",tooltip=" "]; Node27 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" iodesc" ,fontname="Helvetica"]; Node27 [label="_cs_iodesc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00823.html",tooltip=" "]; Node2 -> Node27 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node26 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node28 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" input_params" ,fontname="Helvetica"]; Node28 [label="_cs_param",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00887.html",tooltip=" "]; Node28 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node29 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyn" ,fontname="Helvetica"]; Node29 [label="_cs_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00895.html",tooltip=" "]; Node9 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tdsdyn" ,fontname="Helvetica"]; Node28 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node29 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node18 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursor" ,fontname="Helvetica"]; Node1 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" con" ,fontname="Helvetica"]; Node30 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rpc" ,fontname="Helvetica"]; Node30 [label="_csremote_proc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00891.html",tooltip=" "]; Node28 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node31 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _clientmsg_cb\n_servermsg_cb\nctx" ,fontname="Helvetica"]; Node31 [label="_cs_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00875.html",tooltip=" "]; Node32 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" clientstore" ,fontname="Helvetica"]; Node32 [label="cs_diag_msg_client",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00863.html",tooltip=" "]; Node32 -> Node32 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node33 -> Node32 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" clientmsg" ,fontname="Helvetica"]; Node33 [label="_cs_clientmsg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00851.html",tooltip=" "]; Node23 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node34 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" config" ,fontname="Helvetica"]; Node34 [label="_cs_config",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00859.html",tooltip=" "]; Node31 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _clientmsg_cb\n_cslibmsg_cb\n_servermsg_cb" ,fontname="Helvetica"]; Node35 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" svrstore" ,fontname="Helvetica"]; Node35 [label="cs_diag_msg_svr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00867.html",tooltip=" "]; Node35 -> Node35 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node36 -> Node35 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" servermsg" ,fontname="Helvetica"]; Node36 [label="_cs_servermsg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00855.html",tooltip=" "]; Node37 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msgstore" ,fontname="Helvetica"]; Node37 [label="cs_diag_msg",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00871.html",tooltip=" "]; Node33 -> Node37 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msg" ,fontname="Helvetica"]; Node37 -> Node37 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node29 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dynlist" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00883.html000644 025423 025423 00000017474 14162303417 021035 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_connection Struct Reference
    FreeTDS API
    _cs_connection Struct Reference
    Collaboration diagram for _cs_connection:

    Public Attributes

    CS_CLIENTMSG_FUNC _clientmsg_cb
     
    CS_SERVERMSG_FUNC _servermsg_cb
     
    CS_COMMANDcmds
     
    CS_CONTEXTctx
     
    CS_DYNAMICdynlist
     
    CS_LOCALElocale
     
    bool network_auth
     
    char * server_addr
     
    TDSLOGINtds_login
     
    TDSSOCKETtds_socket
     
    void * userdata
     
    int userdata_len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00884.html000644 025423 025423 00000013516 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_param Member List

    This is the complete list of members for _cs_param, including all inherited members.

    datalen (defined in _cs_param)_cs_param
    datalen_value (defined in _cs_param)_cs_param
    datatype (defined in _cs_param)_cs_param
    ind (defined in _cs_param)_cs_param
    indicator_value (defined in _cs_param)_cs_param
    maxlen (defined in _cs_param)_cs_param
    name (defined in _cs_param)_cs_param
    next (defined in _cs_param)_cs_param
    param_by_value (defined in _cs_param)_cs_param
    precision (defined in _cs_param)_cs_param
    scale (defined in _cs_param)_cs_param
    status (defined in _cs_param)_cs_param
    value (defined in _cs_param)_cs_param
    freetds-1.3.6/doc/reference/a00885.dot000644 025423 025423 00000000666 14162303417 020654 0ustar00fredianofrediano000000 000000 digraph "_cs_param" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_param",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00887.html000644 025423 025423 00000017640 14162303417 021034 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_param Struct Reference
    FreeTDS API
    _cs_param Struct Reference
    Collaboration diagram for _cs_param:

    Public Attributes

    CS_INT * datalen
     
    CS_INT datalen_value
     
    int datatype
     
    CS_SMALLINT * ind
     
    CS_SMALLINT indicator_value
     
    CS_INT maxlen
     
    char * name
     
    struct _cs_paramnext
     
    int param_by_value
     
    CS_INT precision
     
    CS_INT scale
     
    int status
     
    CS_BYTE * value
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00888.html000644 025423 025423 00000007237 14162303417 021036 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _csremote_proc Member List

    This is the complete list of members for _csremote_proc, including all inherited members.

    name (defined in _csremote_proc)_csremote_proc
    options (defined in _csremote_proc)_csremote_proc
    param_list (defined in _csremote_proc)_csremote_proc
    freetds-1.3.6/doc/reference/a00889.dot000644 025423 025423 00000001274 14162303417 020654 0ustar00fredianofrediano000000 000000 digraph "_csremote_proc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_csremote_proc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node2 [label="_cs_param",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00887.html",tooltip=" "]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00891.html000644 025423 025423 00000011055 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: _csremote_proc Struct Reference
    FreeTDS API
    _csremote_proc Struct Reference
    Collaboration diagram for _csremote_proc:

    Public Attributes

    char * name
     
    CS_SMALLINT options
     
    CSREMOTE_PROC_PARAMparam_list
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00892.html000644 025423 025423 00000010111 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_dynamic Member List

    This is the complete list of members for _cs_dynamic, including all inherited members.

    id (defined in _cs_dynamic)_cs_dynamic
    next (defined in _cs_dynamic)_cs_dynamic
    param_list (defined in _cs_dynamic)_cs_dynamic
    stmt (defined in _cs_dynamic)_cs_dynamic
    tdsdyn (defined in _cs_dynamic)_cs_dynamic
    freetds-1.3.6/doc/reference/a00893.dot000644 025423 025423 00000004542 14162303417 020650 0ustar00fredianofrediano000000 000000 digraph "_cs_dynamic" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_dynamic",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tdsdyn" ,fontname="Helvetica"]; Node2 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node3 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node4 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node2 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node3 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node22 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node22 [label="tds_column",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node25 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node25 [label="_cs_param",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00887.html",tooltip=" "]; Node25 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00895.html000644 025423 025423 00000012505 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_dynamic Struct Reference
    FreeTDS API
    _cs_dynamic Struct Reference
    Collaboration diagram for _cs_dynamic:

    Public Attributes

    char * id
     
    struct _cs_dynamicnext
     
    CS_DYNAMIC_PARAMparam_list
     
    char * stmt
     
    TDSDYNAMICtdsdyn
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00896.html000644 025423 025423 00000020310 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_command Member List

    This is the complete list of members for _cs_command, including all inherited members.

    bind_count (defined in _cs_command)_cs_command
    cancel_state (defined in _cs_command)_cs_command
    client_cursor_id (defined in _cs_command)_cs_command
    command_state (defined in _cs_command)_cs_command
    command_type (defined in _cs_command)_cs_command
    con (defined in _cs_command)_cs_command
    curr_result_type (defined in _cs_command)_cs_command
    cursor (defined in _cs_command)_cs_command
    cursor_state (defined in _cs_command)_cs_command
    dyn (defined in _cs_command)_cs_command
    dynamic_cmd (defined in _cs_command)_cs_command
    get_data_bytes_returned (defined in _cs_command)_cs_command
    get_data_item (defined in _cs_command)_cs_command
    input_params (defined in _cs_command)_cs_command
    iodesc (defined in _cs_command)_cs_command
    next (defined in _cs_command)_cs_command
    query (defined in _cs_command)_cs_command
    results_state (defined in _cs_command)_cs_command
    row_prefetched (defined in _cs_command)_cs_command
    rpc (defined in _cs_command)_cs_command
    send_data_started (defined in _cs_command)_cs_command
    userdata (defined in _cs_command)_cs_command
    userdata_len (defined in _cs_command)_cs_command
    freetds-1.3.6/doc/reference/a00897.dot000644 025423 025423 00000016141 14162303417 020652 0ustar00fredianofrediano000000 000000 digraph "_cs_command" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_command",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" iodesc" ,fontname="Helvetica"]; Node2 [label="_cs_iodesc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00823.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node3 [label="_cs_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00907.html",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" input_params" ,fontname="Helvetica"]; Node4 [label="_cs_param",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00887.html",tooltip=" "]; Node4 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyn" ,fontname="Helvetica"]; Node5 [label="_cs_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00895.html",tooltip=" "]; Node6 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tdsdyn" ,fontname="Helvetica"]; Node6 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node6 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node7 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node7 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node8 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node9 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node6 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node7 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node14 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node14 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node7 -> Node14 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node14 -> Node14 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node4 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node5 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node14 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursor" ,fontname="Helvetica"]; Node29 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" con" ,fontname="Helvetica"]; Node29 [label="_cs_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00883.html",tooltip=" "]; Node3 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node8 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_socket" ,fontname="Helvetica"]; Node9 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_login" ,fontname="Helvetica"]; Node1 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cmds" ,fontname="Helvetica"]; Node30 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _clientmsg_cb\n_servermsg_cb\nctx" ,fontname="Helvetica"]; Node30 [label="_cs_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00875.html",tooltip=" "]; Node31 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" clientstore" ,fontname="Helvetica"]; Node31 [label="cs_diag_msg_client",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00863.html",tooltip=" "]; Node31 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node19 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node33 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" config" ,fontname="Helvetica"]; Node33 [label="_cs_config",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00859.html",tooltip=" "]; Node30 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" _clientmsg_cb\n_cslibmsg_cb\n_servermsg_cb" ,fontname="Helvetica"]; Node34 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" svrstore" ,fontname="Helvetica"]; Node34 [label="cs_diag_msg_svr",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00867.html",tooltip=" "]; Node34 -> Node34 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node36 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" msgstore" ,fontname="Helvetica"]; Node36 [label="cs_diag_msg",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00871.html",tooltip=" "]; Node36 -> Node36 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node5 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dynlist" ,fontname="Helvetica"]; Node37 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rpc" ,fontname="Helvetica"]; Node37 [label="_csremote_proc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00891.html",tooltip=" "]; Node4 -> Node37 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00899.html000644 025423 025423 00000027173 14162303417 021041 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_command Struct Reference
    FreeTDS API
    _cs_command Struct Reference
    Collaboration diagram for _cs_command:

    Public Attributes

    int bind_count
     
    CS_INT cancel_state
     
    CS_INT client_cursor_id
     
    CS_INT command_state
     
    CS_INT command_type
     
    CS_CONNECTIONcon
     
    int curr_result_type
     
    TDSCURSORcursor
     
    CS_INT cursor_state
     
    CS_DYNAMICdyn
     
    short dynamic_cmd
     
    int get_data_bytes_returned
     
    int get_data_item
     
    CS_PARAMinput_params
     
    CS_IODESCiodesc
     
    struct _cs_commandnext
     
    CS_CHAR * query
     
    CS_INT results_state
     
    int row_prefetched
     
    CSREMOTE_PROCrpc
     
    CS_INT send_data_started
     
    void * userdata
     
    int userdata_len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00900.html000644 025423 025423 00000006274 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_blkdesc Member List

    This is the complete list of members for _cs_blkdesc, including all inherited members.

    bcpinfo (defined in _cs_blkdesc)_cs_blkdesc
    freetds-1.3.6/doc/reference/a00901.dot000644 025423 025423 00000003773 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "_cs_blkdesc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_cs_blkdesc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcpinfo" ,fontname="Helvetica"]; Node2 [label="tds_bcpinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01247.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bindinfo" ,fontname="Helvetica"]; Node3 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node4 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node23 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node23 [label="tds_column",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node8 -> Node23 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node8 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tablename" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00903.html000644 025423 025423 00000007542 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_blkdesc Struct Reference
    FreeTDS API
    _cs_blkdesc Struct Reference
    Collaboration diagram for _cs_blkdesc:

    Public Attributes

    TDSBCPINFO bcpinfo
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00904.html000644 025423 025423 00000007532 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _cs_locale Member List

    This is the complete list of members for _cs_locale, including all inherited members.

    charset (defined in _cs_locale)_cs_locale
    collate (defined in _cs_locale)_cs_locale
    language (defined in _cs_locale)_cs_locale
    time (defined in _cs_locale)_cs_locale
    freetds-1.3.6/doc/reference/a00907.html000644 025423 025423 00000011134 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: _cs_locale Struct Reference
    FreeTDS API
    _cs_locale Struct Reference

    Public Attributes

    char * charset
     
    char * collate
     
    char * language
     
    char * time
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00908.html000644 025423 025423 00000006714 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_dblib_loginrec Member List

    This is the complete list of members for tds_dblib_loginrec, including all inherited members.

    network_auth (defined in tds_dblib_loginrec)tds_dblib_loginrec
    tds_login (defined in tds_dblib_loginrec)tds_dblib_loginrec
    freetds-1.3.6/doc/reference/a00909.dot000644 025423 025423 00000002733 14162303417 020646 0ustar00fredianofrediano000000 000000 digraph "tds_dblib_loginrec" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_dblib_loginrec",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_login" ,fontname="Helvetica"]; Node2 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node3 [label="tds_capabilities",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" types" ,fontname="Helvetica"]; Node4 [label="tds_capability_type",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01135.html",tooltip=" "]; Node5 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node5 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; } freetds-1.3.6/doc/reference/a00911.html000644 025423 025423 00000010325 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_dblib_loginrec Struct Reference
    FreeTDS API
    tds_dblib_loginrec Struct Reference
    Collaboration diagram for tds_dblib_loginrec:

    Public Attributes

    bool network_auth
     
    TDSLOGINtds_login
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00912.html000644 025423 025423 00000010506 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBPROC_ROWBUF Member List

    This is the complete list of members for DBPROC_ROWBUF, including all inherited members.

    capacity (defined in DBPROC_ROWBUF)DBPROC_ROWBUF
    current (defined in DBPROC_ROWBUF)DBPROC_ROWBUF
    head (defined in DBPROC_ROWBUF)DBPROC_ROWBUF
    received (defined in DBPROC_ROWBUF)DBPROC_ROWBUF
    rows (defined in DBPROC_ROWBUF)DBPROC_ROWBUF
    tail (defined in DBPROC_ROWBUF)DBPROC_ROWBUF
    freetds-1.3.6/doc/reference/a00913.dot000644 025423 025423 00000003121 14162303417 020631 0ustar00fredianofrediano000000 000000 digraph "DBPROC_ROWBUF" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="DBPROC_ROWBUF",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rows" ,fontname="Helvetica"]; Node2 [label="dblib_buffer_row",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00611.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" resinfo" ,fontname="Helvetica"]; Node3 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node4 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node23 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node23 [label="tds_column",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; } freetds-1.3.6/doc/reference/a00915.html000644 025423 025423 00000013036 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: DBPROC_ROWBUF Struct Reference
    FreeTDS API
    DBPROC_ROWBUF Struct Reference
    Collaboration diagram for DBPROC_ROWBUF:

    Public Attributes

    int capacity
     
    int current
     
    int head
     
    int received
     
    struct dblib_buffer_rowrows
     
    int tail
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00916.html000644 025423 025423 00000011533 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    BCP_HOSTCOLINFO Member List

    This is the complete list of members for BCP_HOSTCOLINFO, including all inherited members.

    column_error (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    column_len (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    datatype (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    host_column (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    prefix_len (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    tab_colnum (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    term_len (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    terminator (defined in BCP_HOSTCOLINFO)BCP_HOSTCOLINFO
    freetds-1.3.6/doc/reference/a00919.html000644 025423 025423 00000013734 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: BCP_HOSTCOLINFO Struct Reference
    FreeTDS API
    BCP_HOSTCOLINFO Struct Reference

    Public Attributes

    int column_error
     
    DBINT column_len
     
    TDS_SERVER_TYPE datatype
     
    int host_column
     
    int prefix_len
     
    int tab_colnum
     
    int term_len
     
    BYTE * terminator
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00920.html000644 025423 025423 00000012140 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    BCP_HOSTFILEINFO Member List

    This is the complete list of members for BCP_HOSTFILEINFO, including all inherited members.

    batch (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    bcp_errfileptr (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    errorfile (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    firstrow (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    host_colcount (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    host_columns (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    hostfile (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    lastrow (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    maxerrs (defined in BCP_HOSTFILEINFO)BCP_HOSTFILEINFO
    freetds-1.3.6/doc/reference/a00921.dot000644 025423 025423 00000001124 14162303417 020631 0ustar00fredianofrediano000000 000000 digraph "BCP_HOSTFILEINFO" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="BCP_HOSTFILEINFO",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" host_columns" ,fontname="Helvetica"]; Node2 [label="BCP_HOSTCOLINFO",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00919.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00923.html000644 025423 025423 00000015142 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: BCP_HOSTFILEINFO Struct Reference
    FreeTDS API
    BCP_HOSTFILEINFO Struct Reference
    Collaboration diagram for BCP_HOSTFILEINFO:

    Public Attributes

    TDS_INT batch
     
    FILE * bcp_errfileptr
     
    TDS_CHAR * errorfile
     
    TDS_INT firstrow
     
    TDS_INT host_colcount
     
    BCP_HOSTCOLINFO ** host_columns
     
    TDS_CHAR * hostfile
     
    TDS_INT lastrow
     
    TDS_INT maxerrs
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00924.html000644 025423 025423 00000011220 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBREMOTE_PROC_PARAM Member List

    This is the complete list of members for DBREMOTE_PROC_PARAM, including all inherited members.

    datalen (defined in DBREMOTE_PROC_PARAM)DBREMOTE_PROC_PARAM
    maxlen (defined in DBREMOTE_PROC_PARAM)DBREMOTE_PROC_PARAM
    name (defined in DBREMOTE_PROC_PARAM)DBREMOTE_PROC_PARAM
    next (defined in DBREMOTE_PROC_PARAM)DBREMOTE_PROC_PARAM
    status (defined in DBREMOTE_PROC_PARAM)DBREMOTE_PROC_PARAM
    type (defined in DBREMOTE_PROC_PARAM)DBREMOTE_PROC_PARAM
    value (defined in DBREMOTE_PROC_PARAM)DBREMOTE_PROC_PARAM
    freetds-1.3.6/doc/reference/a00925.dot000644 025423 025423 00000000712 14162303417 020637 0ustar00fredianofrediano000000 000000 digraph "DBREMOTE_PROC_PARAM" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="DBREMOTE_PROC_PARAM",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00927.html000644 025423 025423 00000013632 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: DBREMOTE_PROC_PARAM Struct Reference
    FreeTDS API
    DBREMOTE_PROC_PARAM Struct Reference
    Collaboration diagram for DBREMOTE_PROC_PARAM:

    Public Attributes

    DBINT datalen
     
    DBINT maxlen
     
    char * name
     
    struct DBREMOTE_PROC_PARAMnext
     
    BYTE status
     
    TDS_SERVER_TYPE type
     
    BYTE * value
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00928.html000644 025423 025423 00000007567 14162303417 021037 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBREMOTE_PROC Member List

    This is the complete list of members for DBREMOTE_PROC, including all inherited members.

    name (defined in DBREMOTE_PROC)DBREMOTE_PROC
    next (defined in DBREMOTE_PROC)DBREMOTE_PROC
    options (defined in DBREMOTE_PROC)DBREMOTE_PROC
    param_list (defined in DBREMOTE_PROC)DBREMOTE_PROC
    freetds-1.3.6/doc/reference/a00929.dot000644 025423 025423 00000001470 14162303417 020645 0ustar00fredianofrediano000000 000000 digraph "DBREMOTE_PROC" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="DBREMOTE_PROC",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node2 [label="DBREMOTE_PROC_PARAM",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00927.html",tooltip=" "]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00931.html000644 025423 025423 00000011664 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: DBREMOTE_PROC Struct Reference
    FreeTDS API
    DBREMOTE_PROC Struct Reference
    Collaboration diagram for DBREMOTE_PROC:

    Public Attributes

    char * name
     
    struct DBREMOTE_PROCnext
     
    DBSMALLINT options
     
    DBREMOTE_PROC_PARAMparam_list
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00932.html000644 025423 025423 00000007152 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    dboption Member List

    This is the complete list of members for dboption, including all inherited members.

    factive (defined in dboption)dboption
    param (defined in dboption)dboption
    text (defined in dboption)dboption
    freetds-1.3.6/doc/reference/a00933.dot000644 025423 025423 00000001255 14162303417 020641 0ustar00fredianofrediano000000 000000 digraph "dboption" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="dboption",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param" ,fontname="Helvetica"]; Node2 [label="dbstring",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01331.html",tooltip=" "]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" strnext" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a00935.html000644 025423 025423 00000011014 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: dboption Struct Reference
    FreeTDS API
    dboption Struct Reference
    Collaboration diagram for dboption:

    Public Attributes

    DBBOOL factive
     
    DBSTRINGparam
     
    const char * text
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00936.html000644 025423 025423 00000006577 14162303417 021036 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    NULLREP Member List

    This is the complete list of members for NULLREP, including all inherited members.

    bindval (defined in NULLREP)NULLREP
    len (defined in NULLREP)NULLREP
    freetds-1.3.6/doc/reference/a00939.html000644 025423 025423 00000007650 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: NULLREP Struct Reference
    FreeTDS API
    NULLREP Struct Reference

    Public Attributes

    const BYTE * bindval
     
    size_t len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00940.html000644 025423 025423 00000023676 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_dblib_dbprocess Member List

    This is the complete list of members for tds_dblib_dbprocess, including all inherited members.

    avail_flag (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    bcpinfo (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    chkintr (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    command_state (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    dbbuf (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    dbbufsz (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    dbcurdb (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    dboptcmd (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    dbopts (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    dbresults_retcode (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    dbresults_state (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    envchange_rcv (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    ftos (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    hndlintr (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    hostfileinfo (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    more_results (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    msdblibtds_dblib_dbprocess
    noautofree (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    ntimeouts (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    nullrepstds_dblib_dbprocess
    row_buf (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    row_type (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    rpc (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    servcharset (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    tds_socket (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    text_sent (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    text_size (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    typeinfo (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    user_data (defined in tds_dblib_dbprocess)tds_dblib_dbprocess
    freetds-1.3.6/doc/reference/a00941.dot000644 025423 025423 00000022357 14162303417 020646 0ustar00fredianofrediano000000 000000 digraph "tds_dblib_dbprocess" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dblib_dbprocess",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" nullreps" ,fontname="Helvetica"]; Node2 [label="NULLREP",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00939.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" hostfileinfo" ,fontname="Helvetica"]; Node3 [label="BCP_HOSTFILEINFO",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00923.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" host_columns" ,fontname="Helvetica"]; Node4 [label="BCP_HOSTCOLINFO",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00919.html",tooltip=" "]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_socket" ,fontname="Helvetica"]; Node5 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node6 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node6 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node7 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node7 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node9 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node9 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node10 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node10 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node10 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node11 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node11 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node11 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node12 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node12 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node5 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node12 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node20 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node20 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node21 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node21 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node12 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node20 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node22 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node22 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node7 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node23 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node23 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node24 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node24 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node25 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node25 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node27 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node27 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node10 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node11 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node14 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node14 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node20 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node28 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcpinfo" ,fontname="Helvetica"]; Node28 [label="tds_bcpinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01247.html",tooltip=" "]; Node12 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bindinfo" ,fontname="Helvetica"]; Node9 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tablename" ,fontname="Helvetica"]; Node29 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dboptcmd" ,fontname="Helvetica"]; Node29 [label="dbstring",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01331.html",tooltip=" "]; Node29 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" strnext" ,fontname="Helvetica"]; Node30 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" row_buf" ,fontname="Helvetica"]; Node30 [label="DBPROC_ROWBUF",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00915.html",tooltip=" "]; Node31 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rows" ,fontname="Helvetica"]; Node31 [label="dblib_buffer_row",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00611.html",tooltip=" "]; Node12 -> Node31 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" resinfo" ,fontname="Helvetica"]; Node32 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dbopts" ,fontname="Helvetica"]; Node32 [label="dboption",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00935.html",tooltip=" "]; Node29 -> Node32 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param" ,fontname="Helvetica"]; Node33 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" rpc" ,fontname="Helvetica"]; Node33 [label="DBREMOTE_PROC",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00931.html",tooltip=" "]; Node34 -> Node33 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" param_list" ,fontname="Helvetica"]; Node34 [label="DBREMOTE_PROC_PARAM",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00927.html",tooltip=" "]; Node34 -> Node34 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node33 -> Node33 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node35 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" typeinfo" ,fontname="Helvetica"]; Node35 [label="dbtypeinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01327.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00943.html000644 025423 025423 00000034272 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_dblib_dbprocess Struct Reference
    FreeTDS API
    tds_dblib_dbprocess Struct Reference
    Collaboration diagram for tds_dblib_dbprocess:

    Public Attributes

    unsigned char avail_flag
     
    TDSBCPINFObcpinfo
     
    DB_DBCHKINTR_FUNC chkintr
     
    int command_state
     
    unsigned char * dbbuf
     
    int dbbufsz
     
    char dbcurdb [DBMAXNAME+1]
     
    DBSTRINGdboptcmd
     
    DBOPTIONdbopts
     
    int dbresults_retcode
     
    DB_RESULT_STATE dbresults_state
     
    DBUSMALLINT envchange_rcv
     
    FILE * ftos
     
    DB_DBHNDLINTR_FUNC hndlintr
     
    BCP_HOSTFILEINFOhostfileinfo
     
    int more_results
     
    int msdblib
     boolean use ms behaviour
     
    int noautofree
     
    int ntimeouts
     
    NULLREP nullreps [MAXBINDTYPES]
     default null values
     
    DBPROC_ROWBUF row_buf
     
    STATUS row_type
     
    DBREMOTE_PROCrpc
     
    char servcharset [DBMAXNAME+1]
     
    TDSSOCKETtds_socket
     
    TDS_INT text_sent
     
    TDS_INT text_size
     
    DBTYPEINFO typeinfo
     
    BYTE * user_data
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00944.html000644 025423 025423 00000007211 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    TDS_MAY_ALIAS Member List

    This is the complete list of members for TDS_MAY_ALIAS, including all inherited members.

    uc (defined in TDS_MAY_ALIAS)TDS_MAY_ALIAS
    ui (defined in TDS_MAY_ALIAS)TDS_MAY_ALIAS
    usi (defined in TDS_MAY_ALIAS)TDS_MAY_ALIAS
    freetds-1.3.6/doc/reference/a00947.html000644 025423 025423 00000010413 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: TDS_MAY_ALIAS Union Reference
    FreeTDS API
    TDS_MAY_ALIAS Union Reference

    Public Attributes

    uint8_t uc [2]
     
    uint32_t ui
     
    uint16_t usi
     

    The documentation for this union was generated from the following file:
    freetds-1.3.6/doc/reference/a00948.html000644 025423 025423 00000006651 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    charset_alias Member List

    This is the complete list of members for charset_alias, including all inherited members.

    alias_pos (defined in charset_alias)charset_alias
    canonic (defined in charset_alias)charset_alias
    freetds-1.3.6/doc/reference/a00951.html000644 025423 025423 00000007713 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: charset_alias Struct Reference
    FreeTDS API
    charset_alias Struct Reference

    Public Attributes

    short int alias_pos
     
    short int canonic
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00952.html000644 025423 025423 00000266163 14162303417 021033 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    stringpool_t Member List

    This is the complete list of members for stringpool_t, including all inherited members.

    stringpool_str100 (defined in stringpool_t)stringpool_t
    stringpool_str101 (defined in stringpool_t)stringpool_t
    stringpool_str102 (defined in stringpool_t)stringpool_t
    stringpool_str103 (defined in stringpool_t)stringpool_t
    stringpool_str104 (defined in stringpool_t)stringpool_t
    stringpool_str105 (defined in stringpool_t)stringpool_t
    stringpool_str107 (defined in stringpool_t)stringpool_t
    stringpool_str1079 (defined in stringpool_t)stringpool_t
    stringpool_str108 (defined in stringpool_t)stringpool_t
    stringpool_str109 (defined in stringpool_t)stringpool_t
    stringpool_str110 (defined in stringpool_t)stringpool_t
    stringpool_str111 (defined in stringpool_t)stringpool_t
    stringpool_str113 (defined in stringpool_t)stringpool_t
    stringpool_str115 (defined in stringpool_t)stringpool_t
    stringpool_str116 (defined in stringpool_t)stringpool_t
    stringpool_str118 (defined in stringpool_t)stringpool_t
    stringpool_str120 (defined in stringpool_t)stringpool_t
    stringpool_str121 (defined in stringpool_t)stringpool_t
    stringpool_str122 (defined in stringpool_t)stringpool_t
    stringpool_str123 (defined in stringpool_t)stringpool_t
    stringpool_str124 (defined in stringpool_t)stringpool_t
    stringpool_str127 (defined in stringpool_t)stringpool_t
    stringpool_str128 (defined in stringpool_t)stringpool_t
    stringpool_str129 (defined in stringpool_t)stringpool_t
    stringpool_str133 (defined in stringpool_t)stringpool_t
    stringpool_str135 (defined in stringpool_t)stringpool_t
    stringpool_str136 (defined in stringpool_t)stringpool_t
    stringpool_str137 (defined in stringpool_t)stringpool_t
    stringpool_str140 (defined in stringpool_t)stringpool_t
    stringpool_str141 (defined in stringpool_t)stringpool_t
    stringpool_str142 (defined in stringpool_t)stringpool_t
    stringpool_str143 (defined in stringpool_t)stringpool_t
    stringpool_str144 (defined in stringpool_t)stringpool_t
    stringpool_str145 (defined in stringpool_t)stringpool_t
    stringpool_str146 (defined in stringpool_t)stringpool_t
    stringpool_str148 (defined in stringpool_t)stringpool_t
    stringpool_str149 (defined in stringpool_t)stringpool_t
    stringpool_str15 (defined in stringpool_t)stringpool_t
    stringpool_str150 (defined in stringpool_t)stringpool_t
    stringpool_str151 (defined in stringpool_t)stringpool_t
    stringpool_str152 (defined in stringpool_t)stringpool_t
    stringpool_str153 (defined in stringpool_t)stringpool_t
    stringpool_str154 (defined in stringpool_t)stringpool_t
    stringpool_str155 (defined in stringpool_t)stringpool_t
    stringpool_str156 (defined in stringpool_t)stringpool_t
    stringpool_str157 (defined in stringpool_t)stringpool_t
    stringpool_str158 (defined in stringpool_t)stringpool_t
    stringpool_str16 (defined in stringpool_t)stringpool_t
    stringpool_str161 (defined in stringpool_t)stringpool_t
    stringpool_str164 (defined in stringpool_t)stringpool_t
    stringpool_str167 (defined in stringpool_t)stringpool_t
    stringpool_str17 (defined in stringpool_t)stringpool_t
    stringpool_str170 (defined in stringpool_t)stringpool_t
    stringpool_str171 (defined in stringpool_t)stringpool_t
    stringpool_str173 (defined in stringpool_t)stringpool_t
    stringpool_str174 (defined in stringpool_t)stringpool_t
    stringpool_str176 (defined in stringpool_t)stringpool_t
    stringpool_str177 (defined in stringpool_t)stringpool_t
    stringpool_str178 (defined in stringpool_t)stringpool_t
    stringpool_str179 (defined in stringpool_t)stringpool_t
    stringpool_str183 (defined in stringpool_t)stringpool_t
    stringpool_str185 (defined in stringpool_t)stringpool_t
    stringpool_str186 (defined in stringpool_t)stringpool_t
    stringpool_str189 (defined in stringpool_t)stringpool_t
    stringpool_str190 (defined in stringpool_t)stringpool_t
    stringpool_str191 (defined in stringpool_t)stringpool_t
    stringpool_str192 (defined in stringpool_t)stringpool_t
    stringpool_str193 (defined in stringpool_t)stringpool_t
    stringpool_str194 (defined in stringpool_t)stringpool_t
    stringpool_str195 (defined in stringpool_t)stringpool_t
    stringpool_str196 (defined in stringpool_t)stringpool_t
    stringpool_str197 (defined in stringpool_t)stringpool_t
    stringpool_str198 (defined in stringpool_t)stringpool_t
    stringpool_str199 (defined in stringpool_t)stringpool_t
    stringpool_str200 (defined in stringpool_t)stringpool_t
    stringpool_str201 (defined in stringpool_t)stringpool_t
    stringpool_str202 (defined in stringpool_t)stringpool_t
    stringpool_str203 (defined in stringpool_t)stringpool_t
    stringpool_str204 (defined in stringpool_t)stringpool_t
    stringpool_str205 (defined in stringpool_t)stringpool_t
    stringpool_str207 (defined in stringpool_t)stringpool_t
    stringpool_str208 (defined in stringpool_t)stringpool_t
    stringpool_str209 (defined in stringpool_t)stringpool_t
    stringpool_str210 (defined in stringpool_t)stringpool_t
    stringpool_str211 (defined in stringpool_t)stringpool_t
    stringpool_str212 (defined in stringpool_t)stringpool_t
    stringpool_str213 (defined in stringpool_t)stringpool_t
    stringpool_str214 (defined in stringpool_t)stringpool_t
    stringpool_str216 (defined in stringpool_t)stringpool_t
    stringpool_str217 (defined in stringpool_t)stringpool_t
    stringpool_str218 (defined in stringpool_t)stringpool_t
    stringpool_str219 (defined in stringpool_t)stringpool_t
    stringpool_str220 (defined in stringpool_t)stringpool_t
    stringpool_str223 (defined in stringpool_t)stringpool_t
    stringpool_str225 (defined in stringpool_t)stringpool_t
    stringpool_str226 (defined in stringpool_t)stringpool_t
    stringpool_str227 (defined in stringpool_t)stringpool_t
    stringpool_str228 (defined in stringpool_t)stringpool_t
    stringpool_str229 (defined in stringpool_t)stringpool_t
    stringpool_str230 (defined in stringpool_t)stringpool_t
    stringpool_str231 (defined in stringpool_t)stringpool_t
    stringpool_str232 (defined in stringpool_t)stringpool_t
    stringpool_str233 (defined in stringpool_t)stringpool_t
    stringpool_str234 (defined in stringpool_t)stringpool_t
    stringpool_str235 (defined in stringpool_t)stringpool_t
    stringpool_str236 (defined in stringpool_t)stringpool_t
    stringpool_str237 (defined in stringpool_t)stringpool_t
    stringpool_str239 (defined in stringpool_t)stringpool_t
    stringpool_str240 (defined in stringpool_t)stringpool_t
    stringpool_str242 (defined in stringpool_t)stringpool_t
    stringpool_str243 (defined in stringpool_t)stringpool_t
    stringpool_str247 (defined in stringpool_t)stringpool_t
    stringpool_str248 (defined in stringpool_t)stringpool_t
    stringpool_str250 (defined in stringpool_t)stringpool_t
    stringpool_str252 (defined in stringpool_t)stringpool_t
    stringpool_str253 (defined in stringpool_t)stringpool_t
    stringpool_str255 (defined in stringpool_t)stringpool_t
    stringpool_str258 (defined in stringpool_t)stringpool_t
    stringpool_str260 (defined in stringpool_t)stringpool_t
    stringpool_str261 (defined in stringpool_t)stringpool_t
    stringpool_str262 (defined in stringpool_t)stringpool_t
    stringpool_str263 (defined in stringpool_t)stringpool_t
    stringpool_str265 (defined in stringpool_t)stringpool_t
    stringpool_str266 (defined in stringpool_t)stringpool_t
    stringpool_str27 (defined in stringpool_t)stringpool_t
    stringpool_str270 (defined in stringpool_t)stringpool_t
    stringpool_str271 (defined in stringpool_t)stringpool_t
    stringpool_str273 (defined in stringpool_t)stringpool_t
    stringpool_str274 (defined in stringpool_t)stringpool_t
    stringpool_str275 (defined in stringpool_t)stringpool_t
    stringpool_str279 (defined in stringpool_t)stringpool_t
    stringpool_str28 (defined in stringpool_t)stringpool_t
    stringpool_str280 (defined in stringpool_t)stringpool_t
    stringpool_str281 (defined in stringpool_t)stringpool_t
    stringpool_str283 (defined in stringpool_t)stringpool_t
    stringpool_str284 (defined in stringpool_t)stringpool_t
    stringpool_str285 (defined in stringpool_t)stringpool_t
    stringpool_str288 (defined in stringpool_t)stringpool_t
    stringpool_str289 (defined in stringpool_t)stringpool_t
    stringpool_str290 (defined in stringpool_t)stringpool_t
    stringpool_str291 (defined in stringpool_t)stringpool_t
    stringpool_str292 (defined in stringpool_t)stringpool_t
    stringpool_str293 (defined in stringpool_t)stringpool_t
    stringpool_str294 (defined in stringpool_t)stringpool_t
    stringpool_str295 (defined in stringpool_t)stringpool_t
    stringpool_str297 (defined in stringpool_t)stringpool_t
    stringpool_str298 (defined in stringpool_t)stringpool_t
    stringpool_str30 (defined in stringpool_t)stringpool_t
    stringpool_str301 (defined in stringpool_t)stringpool_t
    stringpool_str302 (defined in stringpool_t)stringpool_t
    stringpool_str303 (defined in stringpool_t)stringpool_t
    stringpool_str304 (defined in stringpool_t)stringpool_t
    stringpool_str305 (defined in stringpool_t)stringpool_t
    stringpool_str306 (defined in stringpool_t)stringpool_t
    stringpool_str307 (defined in stringpool_t)stringpool_t
    stringpool_str308 (defined in stringpool_t)stringpool_t
    stringpool_str309 (defined in stringpool_t)stringpool_t
    stringpool_str31 (defined in stringpool_t)stringpool_t
    stringpool_str310 (defined in stringpool_t)stringpool_t
    stringpool_str312 (defined in stringpool_t)stringpool_t
    stringpool_str313 (defined in stringpool_t)stringpool_t
    stringpool_str314 (defined in stringpool_t)stringpool_t
    stringpool_str318 (defined in stringpool_t)stringpool_t
    stringpool_str319 (defined in stringpool_t)stringpool_t
    stringpool_str320 (defined in stringpool_t)stringpool_t
    stringpool_str321 (defined in stringpool_t)stringpool_t
    stringpool_str324 (defined in stringpool_t)stringpool_t
    stringpool_str326 (defined in stringpool_t)stringpool_t
    stringpool_str329 (defined in stringpool_t)stringpool_t
    stringpool_str331 (defined in stringpool_t)stringpool_t
    stringpool_str333 (defined in stringpool_t)stringpool_t
    stringpool_str334 (defined in stringpool_t)stringpool_t
    stringpool_str335 (defined in stringpool_t)stringpool_t
    stringpool_str336 (defined in stringpool_t)stringpool_t
    stringpool_str337 (defined in stringpool_t)stringpool_t
    stringpool_str338 (defined in stringpool_t)stringpool_t
    stringpool_str339 (defined in stringpool_t)stringpool_t
    stringpool_str340 (defined in stringpool_t)stringpool_t
    stringpool_str342 (defined in stringpool_t)stringpool_t
    stringpool_str345 (defined in stringpool_t)stringpool_t
    stringpool_str347 (defined in stringpool_t)stringpool_t
    stringpool_str349 (defined in stringpool_t)stringpool_t
    stringpool_str35 (defined in stringpool_t)stringpool_t
    stringpool_str350 (defined in stringpool_t)stringpool_t
    stringpool_str351 (defined in stringpool_t)stringpool_t
    stringpool_str352 (defined in stringpool_t)stringpool_t
    stringpool_str353 (defined in stringpool_t)stringpool_t
    stringpool_str354 (defined in stringpool_t)stringpool_t
    stringpool_str355 (defined in stringpool_t)stringpool_t
    stringpool_str356 (defined in stringpool_t)stringpool_t
    stringpool_str357 (defined in stringpool_t)stringpool_t
    stringpool_str358 (defined in stringpool_t)stringpool_t
    stringpool_str359 (defined in stringpool_t)stringpool_t
    stringpool_str36 (defined in stringpool_t)stringpool_t
    stringpool_str360 (defined in stringpool_t)stringpool_t
    stringpool_str361 (defined in stringpool_t)stringpool_t
    stringpool_str362 (defined in stringpool_t)stringpool_t
    stringpool_str364 (defined in stringpool_t)stringpool_t
    stringpool_str365 (defined in stringpool_t)stringpool_t
    stringpool_str366 (defined in stringpool_t)stringpool_t
    stringpool_str368 (defined in stringpool_t)stringpool_t
    stringpool_str369 (defined in stringpool_t)stringpool_t
    stringpool_str371 (defined in stringpool_t)stringpool_t
    stringpool_str374 (defined in stringpool_t)stringpool_t
    stringpool_str377 (defined in stringpool_t)stringpool_t
    stringpool_str379 (defined in stringpool_t)stringpool_t
    stringpool_str38 (defined in stringpool_t)stringpool_t
    stringpool_str380 (defined in stringpool_t)stringpool_t
    stringpool_str381 (defined in stringpool_t)stringpool_t
    stringpool_str383 (defined in stringpool_t)stringpool_t
    stringpool_str384 (defined in stringpool_t)stringpool_t
    stringpool_str387 (defined in stringpool_t)stringpool_t
    stringpool_str389 (defined in stringpool_t)stringpool_t
    stringpool_str39 (defined in stringpool_t)stringpool_t
    stringpool_str392 (defined in stringpool_t)stringpool_t
    stringpool_str393 (defined in stringpool_t)stringpool_t
    stringpool_str394 (defined in stringpool_t)stringpool_t
    stringpool_str395 (defined in stringpool_t)stringpool_t
    stringpool_str396 (defined in stringpool_t)stringpool_t
    stringpool_str397 (defined in stringpool_t)stringpool_t
    stringpool_str398 (defined in stringpool_t)stringpool_t
    stringpool_str40 (defined in stringpool_t)stringpool_t
    stringpool_str401 (defined in stringpool_t)stringpool_t
    stringpool_str402 (defined in stringpool_t)stringpool_t
    stringpool_str409 (defined in stringpool_t)stringpool_t
    stringpool_str41 (defined in stringpool_t)stringpool_t
    stringpool_str411 (defined in stringpool_t)stringpool_t
    stringpool_str415 (defined in stringpool_t)stringpool_t
    stringpool_str418 (defined in stringpool_t)stringpool_t
    stringpool_str42 (defined in stringpool_t)stringpool_t
    stringpool_str422 (defined in stringpool_t)stringpool_t
    stringpool_str428 (defined in stringpool_t)stringpool_t
    stringpool_str429 (defined in stringpool_t)stringpool_t
    stringpool_str43 (defined in stringpool_t)stringpool_t
    stringpool_str434 (defined in stringpool_t)stringpool_t
    stringpool_str435 (defined in stringpool_t)stringpool_t
    stringpool_str436 (defined in stringpool_t)stringpool_t
    stringpool_str438 (defined in stringpool_t)stringpool_t
    stringpool_str44 (defined in stringpool_t)stringpool_t
    stringpool_str441 (defined in stringpool_t)stringpool_t
    stringpool_str444 (defined in stringpool_t)stringpool_t
    stringpool_str445 (defined in stringpool_t)stringpool_t
    stringpool_str446 (defined in stringpool_t)stringpool_t
    stringpool_str448 (defined in stringpool_t)stringpool_t
    stringpool_str45 (defined in stringpool_t)stringpool_t
    stringpool_str450 (defined in stringpool_t)stringpool_t
    stringpool_str452 (defined in stringpool_t)stringpool_t
    stringpool_str454 (defined in stringpool_t)stringpool_t
    stringpool_str455 (defined in stringpool_t)stringpool_t
    stringpool_str46 (defined in stringpool_t)stringpool_t
    stringpool_str460 (defined in stringpool_t)stringpool_t
    stringpool_str461 (defined in stringpool_t)stringpool_t
    stringpool_str462 (defined in stringpool_t)stringpool_t
    stringpool_str463 (defined in stringpool_t)stringpool_t
    stringpool_str464 (defined in stringpool_t)stringpool_t
    stringpool_str465 (defined in stringpool_t)stringpool_t
    stringpool_str467 (defined in stringpool_t)stringpool_t
    stringpool_str47 (defined in stringpool_t)stringpool_t
    stringpool_str470 (defined in stringpool_t)stringpool_t
    stringpool_str472 (defined in stringpool_t)stringpool_t
    stringpool_str474 (defined in stringpool_t)stringpool_t
    stringpool_str475 (defined in stringpool_t)stringpool_t
    stringpool_str476 (defined in stringpool_t)stringpool_t
    stringpool_str479 (defined in stringpool_t)stringpool_t
    stringpool_str48 (defined in stringpool_t)stringpool_t
    stringpool_str480 (defined in stringpool_t)stringpool_t
    stringpool_str483 (defined in stringpool_t)stringpool_t
    stringpool_str484 (defined in stringpool_t)stringpool_t
    stringpool_str485 (defined in stringpool_t)stringpool_t
    stringpool_str486 (defined in stringpool_t)stringpool_t
    stringpool_str487 (defined in stringpool_t)stringpool_t
    stringpool_str488 (defined in stringpool_t)stringpool_t
    stringpool_str489 (defined in stringpool_t)stringpool_t
    stringpool_str490 (defined in stringpool_t)stringpool_t
    stringpool_str491 (defined in stringpool_t)stringpool_t
    stringpool_str494 (defined in stringpool_t)stringpool_t
    stringpool_str496 (defined in stringpool_t)stringpool_t
    stringpool_str50 (defined in stringpool_t)stringpool_t
    stringpool_str500 (defined in stringpool_t)stringpool_t
    stringpool_str503 (defined in stringpool_t)stringpool_t
    stringpool_str504 (defined in stringpool_t)stringpool_t
    stringpool_str505 (defined in stringpool_t)stringpool_t
    stringpool_str506 (defined in stringpool_t)stringpool_t
    stringpool_str507 (defined in stringpool_t)stringpool_t
    stringpool_str509 (defined in stringpool_t)stringpool_t
    stringpool_str511 (defined in stringpool_t)stringpool_t
    stringpool_str514 (defined in stringpool_t)stringpool_t
    stringpool_str515 (defined in stringpool_t)stringpool_t
    stringpool_str516 (defined in stringpool_t)stringpool_t
    stringpool_str520 (defined in stringpool_t)stringpool_t
    stringpool_str521 (defined in stringpool_t)stringpool_t
    stringpool_str522 (defined in stringpool_t)stringpool_t
    stringpool_str523 (defined in stringpool_t)stringpool_t
    stringpool_str528 (defined in stringpool_t)stringpool_t
    stringpool_str531 (defined in stringpool_t)stringpool_t
    stringpool_str534 (defined in stringpool_t)stringpool_t
    stringpool_str541 (defined in stringpool_t)stringpool_t
    stringpool_str546 (defined in stringpool_t)stringpool_t
    stringpool_str547 (defined in stringpool_t)stringpool_t
    stringpool_str548 (defined in stringpool_t)stringpool_t
    stringpool_str549 (defined in stringpool_t)stringpool_t
    stringpool_str553 (defined in stringpool_t)stringpool_t
    stringpool_str555 (defined in stringpool_t)stringpool_t
    stringpool_str557 (defined in stringpool_t)stringpool_t
    stringpool_str56 (defined in stringpool_t)stringpool_t
    stringpool_str560 (defined in stringpool_t)stringpool_t
    stringpool_str561 (defined in stringpool_t)stringpool_t
    stringpool_str563 (defined in stringpool_t)stringpool_t
    stringpool_str564 (defined in stringpool_t)stringpool_t
    stringpool_str57 (defined in stringpool_t)stringpool_t
    stringpool_str571 (defined in stringpool_t)stringpool_t
    stringpool_str572 (defined in stringpool_t)stringpool_t
    stringpool_str575 (defined in stringpool_t)stringpool_t
    stringpool_str577 (defined in stringpool_t)stringpool_t
    stringpool_str581 (defined in stringpool_t)stringpool_t
    stringpool_str582 (defined in stringpool_t)stringpool_t
    stringpool_str583 (defined in stringpool_t)stringpool_t
    stringpool_str584 (defined in stringpool_t)stringpool_t
    stringpool_str591 (defined in stringpool_t)stringpool_t
    stringpool_str594 (defined in stringpool_t)stringpool_t
    stringpool_str596 (defined in stringpool_t)stringpool_t
    stringpool_str60 (defined in stringpool_t)stringpool_t
    stringpool_str602 (defined in stringpool_t)stringpool_t
    stringpool_str605 (defined in stringpool_t)stringpool_t
    stringpool_str607 (defined in stringpool_t)stringpool_t
    stringpool_str614 (defined in stringpool_t)stringpool_t
    stringpool_str617 (defined in stringpool_t)stringpool_t
    stringpool_str620 (defined in stringpool_t)stringpool_t
    stringpool_str625 (defined in stringpool_t)stringpool_t
    stringpool_str63 (defined in stringpool_t)stringpool_t
    stringpool_str637 (defined in stringpool_t)stringpool_t
    stringpool_str641 (defined in stringpool_t)stringpool_t
    stringpool_str645 (defined in stringpool_t)stringpool_t
    stringpool_str65 (defined in stringpool_t)stringpool_t
    stringpool_str651 (defined in stringpool_t)stringpool_t
    stringpool_str658 (defined in stringpool_t)stringpool_t
    stringpool_str66 (defined in stringpool_t)stringpool_t
    stringpool_str663 (defined in stringpool_t)stringpool_t
    stringpool_str664 (defined in stringpool_t)stringpool_t
    stringpool_str67 (defined in stringpool_t)stringpool_t
    stringpool_str674 (defined in stringpool_t)stringpool_t
    stringpool_str69 (defined in stringpool_t)stringpool_t
    stringpool_str697 (defined in stringpool_t)stringpool_t
    stringpool_str70 (defined in stringpool_t)stringpool_t
    stringpool_str706 (defined in stringpool_t)stringpool_t
    stringpool_str71 (defined in stringpool_t)stringpool_t
    stringpool_str72 (defined in stringpool_t)stringpool_t
    stringpool_str723 (defined in stringpool_t)stringpool_t
    stringpool_str73 (defined in stringpool_t)stringpool_t
    stringpool_str74 (defined in stringpool_t)stringpool_t
    stringpool_str748 (defined in stringpool_t)stringpool_t
    stringpool_str75 (defined in stringpool_t)stringpool_t
    stringpool_str756 (defined in stringpool_t)stringpool_t
    stringpool_str758 (defined in stringpool_t)stringpool_t
    stringpool_str762 (defined in stringpool_t)stringpool_t
    stringpool_str77 (defined in stringpool_t)stringpool_t
    stringpool_str788 (defined in stringpool_t)stringpool_t
    stringpool_str79 (defined in stringpool_t)stringpool_t
    stringpool_str81 (defined in stringpool_t)stringpool_t
    stringpool_str82 (defined in stringpool_t)stringpool_t
    stringpool_str83 (defined in stringpool_t)stringpool_t
    stringpool_str85 (defined in stringpool_t)stringpool_t
    stringpool_str87 (defined in stringpool_t)stringpool_t
    stringpool_str884 (defined in stringpool_t)stringpool_t
    stringpool_str89 (defined in stringpool_t)stringpool_t
    stringpool_str899 (defined in stringpool_t)stringpool_t
    stringpool_str90 (defined in stringpool_t)stringpool_t
    stringpool_str905 (defined in stringpool_t)stringpool_t
    stringpool_str91 (defined in stringpool_t)stringpool_t
    stringpool_str915 (defined in stringpool_t)stringpool_t
    stringpool_str92 (defined in stringpool_t)stringpool_t
    stringpool_str93 (defined in stringpool_t)stringpool_t
    stringpool_str94 (defined in stringpool_t)stringpool_t
    stringpool_str95 (defined in stringpool_t)stringpool_t
    freetds-1.3.6/doc/reference/a00955.html000644 025423 025423 00000437267 14162303417 021043 0ustar00fredianofrediano000000 000000 FreeTDS API: stringpool_t Struct Reference
    FreeTDS API
    stringpool_t Struct Reference

    Public Attributes

    char stringpool_str100 [sizeof("ISO-IR-159")]
     
    char stringpool_str101 [sizeof("ISO-IR-199")]
     
    char stringpool_str102 [sizeof("ISO-IR-6")]
     
    char stringpool_str103 [sizeof("ISO-8859-6")]
     
    char stringpool_str104 [sizeof("862")]
     
    char stringpool_str105 [sizeof("HZ")]
     
    char stringpool_str107 [sizeof("iso646")]
     
    char stringpool_str1079 [sizeof("CSEUCPKDFMTJAPANESE")]
     
    char stringpool_str108 [sizeof("ISO-IR-165")]
     
    char stringpool_str109 [sizeof("ISO_8859-1")]
     
    char stringpool_str110 [sizeof("ISO-8859-16")]
     
    char stringpool_str111 [sizeof("ISO_8859-8")]
     
    char stringpool_str113 [sizeof("ISO_8859-5")]
     
    char stringpool_str115 [sizeof("ISO_8859-9")]
     
    char stringpool_str116 [sizeof("JP")]
     
    char stringpool_str118 [sizeof("iso82")]
     
    char stringpool_str120 [sizeof("ISO_8859-15")]
     
    char stringpool_str121 [sizeof("iso88594")]
     
    char stringpool_str122 [sizeof("850")]
     
    char stringpool_str123 [sizeof("ISO-IR-148")]
     
    char stringpool_str124 [sizeof("ISO_8859-15:1998")]
     
    char stringpool_str127 [sizeof("ISO-IR-149")]
     
    char stringpool_str128 [sizeof("ISO-IR-166")]
     
    char stringpool_str129 [sizeof("ISO8859-4")]
     
    char stringpool_str133 [sizeof("ISO_8859-6")]
     
    char stringpool_str135 [sizeof("iso10")]
     
    char stringpool_str136 [sizeof("CN")]
     
    char stringpool_str137 [sizeof("ISO-8859-4")]
     
    char stringpool_str140 [sizeof("ISO_8859-16")]
     
    char stringpool_str141 [sizeof("KOREAN")]
     
    char stringpool_str142 [sizeof("ISO-IR-101")]
     
    char stringpool_str143 [sizeof("ISO-IR-14")]
     
    char stringpool_str144 [sizeof("ISO-8859-14")]
     
    char stringpool_str145 [sizeof("iso88592")]
     
    char stringpool_str146 [sizeof("KOI8-R")]
     
    char stringpool_str148 [sizeof("ISO-IR-109")]
     
    char stringpool_str149 [sizeof("C99")]
     
    char stringpool_str15 [sizeof("L1")]
     
    char stringpool_str150 [sizeof("iso87")]
     
    char stringpool_str151 [sizeof("ISO_8859-14:1998")]
     
    char stringpool_str152 [sizeof("LATIN1")]
     
    char stringpool_str153 [sizeof("ISO8859-2")]
     
    char stringpool_str154 [sizeof("LATIN8")]
     
    char stringpool_str155 [sizeof("ISO-IR-179")]
     
    char stringpool_str156 [sizeof("LATIN5")]
     
    char stringpool_str157 [sizeof("ISO-IR-126")]
     
    char stringpool_str158 [sizeof("ASCII")]
     
    char stringpool_str16 [sizeof("L8")]
     
    char stringpool_str161 [sizeof("ISO-8859-2")]
     
    char stringpool_str164 [sizeof("CP819")]
     
    char stringpool_str167 [sizeof("ISO_8859-4")]
     
    char stringpool_str17 [sizeof("L5")]
     
    char stringpool_str170 [sizeof("TCVN")]
     
    char stringpool_str171 [sizeof("ISO-IR-138")]
     
    char stringpool_str173 [sizeof("hp15CN")]
     
    char stringpool_str174 [sizeof("ISO_8859-14")]
     
    char stringpool_str176 [sizeof("LATIN6")]
     
    char stringpool_str177 [sizeof("iso88597")]
     
    char stringpool_str178 [sizeof("ISO8859-10")]
     
    char stringpool_str179 [sizeof("ISO-IR-144")]
     
    char stringpool_str183 [sizeof("ISO_8859-16:2000")]
     
    char stringpool_str185 [sizeof("ISO8859-7")]
     
    char stringpool_str186 [sizeof("ISO-8859-10")]
     
    char stringpool_str189 [sizeof("iso13")]
     
    char stringpool_str190 [sizeof("iso83")]
     
    char stringpool_str191 [sizeof("ISO_8859-2")]
     
    char stringpool_str192 [sizeof("ISO-IR-110")]
     
    char stringpool_str193 [sizeof("ISO-8859-7")]
     
    char stringpool_str194 [sizeof("CP866")]
     
    char stringpool_str195 [sizeof("CP949")]
     
    char stringpool_str196 [sizeof("tis620")]
     
    char stringpool_str197 [sizeof("VISCII")]
     
    char stringpool_str198 [sizeof("ISO-IR-226")]
     
    char stringpool_str199 [sizeof("US")]
     
    char stringpool_str200 [sizeof("ISO-IR-87")]
     
    char stringpool_str201 [sizeof("ISO-IR-57")]
     
    char stringpool_str202 [sizeof("IBM819")]
     
    char stringpool_str203 [sizeof("macthai")]
     
    char stringpool_str204 [sizeof("MS-ANSI")]
     
    char stringpool_str205 [sizeof("macturk")]
     
    char stringpool_str207 [sizeof("CP1251")]
     
    char stringpool_str208 [sizeof("ISO-IR-157")]
     
    char stringpool_str209 [sizeof("CP1258")]
     
    char stringpool_str210 [sizeof("LATIN4")]
     
    char stringpool_str211 [sizeof("CP1255")]
     
    char stringpool_str212 [sizeof("ISO_8859-10:1992")]
     
    char stringpool_str213 [sizeof("cp866")]
     
    char stringpool_str214 [sizeof("cp949")]
     
    char stringpool_str216 [sizeof("ISO_8859-10")]
     
    char stringpool_str217 [sizeof("iso88593")]
     
    char stringpool_str218 [sizeof("ROMAN8")]
     
    char stringpool_str219 [sizeof("CHINESE")]
     
    char stringpool_str220 [sizeof("JIS0208")]
     
    char stringpool_str223 [sizeof("ISO_8859-7")]
     
    char stringpool_str225 [sizeof("macgreek")]
     
    char stringpool_str226 [sizeof("cp1251")]
     
    char stringpool_str227 [sizeof("ascii_8")]
     
    char stringpool_str228 [sizeof("cp1258")]
     
    char stringpool_str229 [sizeof("ECMA-118")]
     
    char stringpool_str230 [sizeof("cp1255")]
     
    char stringpool_str231 [sizeof("CP1256")]
     
    char stringpool_str232 [sizeof("IBM866")]
     
    char stringpool_str233 [sizeof("ISO-8859-3")]
     
    char stringpool_str234 [sizeof("LATIN2")]
     
    char stringpool_str235 [sizeof("BIG5")]
     
    char stringpool_str236 [sizeof("MULELAO-1")]
     
    char stringpool_str237 [sizeof("MS-EE")]
     
    char stringpool_str239 [sizeof("ISO646-CN")]
     
    char stringpool_str240 [sizeof("ISO-8859-13")]
     
    char stringpool_str242 [sizeof("ISO-IR-100")]
     
    char stringpool_str243 [sizeof("BIG-5")]
     
    char stringpool_str247 [sizeof("ISO-IR-127")]
     
    char stringpool_str248 [sizeof("GREEK8")]
     
    char stringpool_str250 [sizeof("cp1256")]
     
    char stringpool_str252 [sizeof("CP862")]
     
    char stringpool_str253 [sizeof("CP1361")]
     
    char stringpool_str255 [sizeof("GBK")]
     
    char stringpool_str258 [sizeof("ELOT_928")]
     
    char stringpool_str260 [sizeof("CP850")]
     
    char stringpool_str261 [sizeof("CP936")]
     
    char stringpool_str262 [sizeof("CP950")]
     
    char stringpool_str263 [sizeof("ISO_8859-3")]
     
    char stringpool_str265 [sizeof("CP1254")]
     
    char stringpool_str266 [sizeof("LATIN7")]
     
    char stringpool_str27 [sizeof("L6")]
     
    char stringpool_str270 [sizeof("ISO_8859-13")]
     
    char stringpool_str271 [sizeof("cp862")]
     
    char stringpool_str273 [sizeof("CP874")]
     
    char stringpool_str274 [sizeof("CSKOI8R")]
     
    char stringpool_str275 [sizeof("EUCKR")]
     
    char stringpool_str279 [sizeof("cp850")]
     
    char stringpool_str28 [sizeof("SJIS")]
     
    char stringpool_str280 [sizeof("cp936")]
     
    char stringpool_str281 [sizeof("cp950")]
     
    char stringpool_str283 [sizeof("EUC-KR")]
     
    char stringpool_str284 [sizeof("cp1254")]
     
    char stringpool_str285 [sizeof("ECMA-114")]
     
    char stringpool_str288 [sizeof("eucKR")]
     
    char stringpool_str289 [sizeof("CP1252")]
     
    char stringpool_str290 [sizeof("IBM862")]
     
    char stringpool_str291 [sizeof("CSISO159JISX02121990")]
     
    char stringpool_str292 [sizeof("cp874")]
     
    char stringpool_str293 [sizeof("ISO646-JP")]
     
    char stringpool_str294 [sizeof("CSASCII")]
     
    char stringpool_str295 [sizeof("EUCCN")]
     
    char stringpool_str297 [sizeof("UCS-4LE")]
     
    char stringpool_str298 [sizeof("IBM850")]
     
    char stringpool_str30 [sizeof("koi8")]
     
    char stringpool_str301 [sizeof("GREEK")]
     
    char stringpool_str302 [sizeof("ISO646-US")]
     
    char stringpool_str303 [sizeof("EUC-CN")]
     
    char stringpool_str304 [sizeof("TIS620")]
     
    char stringpool_str305 [sizeof("mac")]
     
    char stringpool_str306 [sizeof("LATIN3")]
     
    char stringpool_str307 [sizeof("CP1250")]
     
    char stringpool_str308 [sizeof("cp1252")]
     
    char stringpool_str309 [sizeof("UCS-2LE")]
     
    char stringpool_str31 [sizeof("sjis")]
     
    char stringpool_str310 [sizeof("CSISOLATIN1")]
     
    char stringpool_str312 [sizeof("TIS-620")]
     
    char stringpool_str313 [sizeof("TCVN5712-1")]
     
    char stringpool_str314 [sizeof("CSISOLATIN5")]
     
    char stringpool_str318 [sizeof("GB_1988-80")]
     
    char stringpool_str319 [sizeof("CP932")]
     
    char stringpool_str320 [sizeof("ASMO-708")]
     
    char stringpool_str321 [sizeof("CP1257")]
     
    char stringpool_str324 [sizeof("KOI8-T")]
     
    char stringpool_str326 [sizeof("cp1250")]
     
    char stringpool_str329 [sizeof("HP-ROMAN8")]
     
    char stringpool_str331 [sizeof("MS_KANJI")]
     
    char stringpool_str333 [sizeof("CSVISCII")]
     
    char stringpool_str334 [sizeof("CSISOLATIN6")]
     
    char stringpool_str335 [sizeof("KSC_5601")]
     
    char stringpool_str336 [sizeof("SHIFT-JIS")]
     
    char stringpool_str337 [sizeof("ISO-IR-203")]
     
    char stringpool_str338 [sizeof("cp932")]
     
    char stringpool_str339 [sizeof("JOHAB")]
     
    char stringpool_str340 [sizeof("cp1257")]
     
    char stringpool_str342 [sizeof("ARMSCII-8")]
     
    char stringpool_str345 [sizeof("ISO_646.IRV:1991")]
     
    char stringpool_str347 [sizeof("TCVN-5712")]
     
    char stringpool_str349 [sizeof("EUCJP")]
     
    char stringpool_str35 [sizeof("R8")]
     
    char stringpool_str350 [sizeof("UTF8")]
     
    char stringpool_str351 [sizeof("X0201")]
     
    char stringpool_str352 [sizeof("GB2312")]
     
    char stringpool_str353 [sizeof("X0208")]
     
    char stringpool_str354 [sizeof("ISO-2022-KR")]
     
    char stringpool_str355 [sizeof("MS-CYRL")]
     
    char stringpool_str356 [sizeof("ISO-2022-JP-1")]
     
    char stringpool_str357 [sizeof("EUC-JP")]
     
    char stringpool_str358 [sizeof("UTF-8")]
     
    char stringpool_str359 [sizeof("VISCII1.1-1")]
     
    char stringpool_str36 [sizeof("iso81")]
     
    char stringpool_str360 [sizeof("CP367")]
     
    char stringpool_str361 [sizeof("CP1253")]
     
    char stringpool_str362 [sizeof("eucJP")]
     
    char stringpool_str364 [sizeof("mac_cyr")]
     
    char stringpool_str365 [sizeof("US-ASCII")]
     
    char stringpool_str366 [sizeof("SHIFT_JIS")]
     
    char stringpool_str368 [sizeof("CSISOLATIN4")]
     
    char stringpool_str369 [sizeof("TIS620-0")]
     
    char stringpool_str371 [sizeof("CSBIG5")]
     
    char stringpool_str374 [sizeof("ISO-2022-CN")]
     
    char stringpool_str377 [sizeof("CP437")]
     
    char stringpool_str379 [sizeof("CN-BIG5")]
     
    char stringpool_str38 [sizeof("iso88")]
     
    char stringpool_str380 [sizeof("cp1253")]
     
    char stringpool_str381 [sizeof("ARABIC")]
     
    char stringpool_str383 [sizeof("X0212")]
     
    char stringpool_str384 [sizeof("CSISO14JISC6220RO")]
     
    char stringpool_str387 [sizeof("GB18030")]
     
    char stringpool_str389 [sizeof("UCS-4BE")]
     
    char stringpool_str39 [sizeof("iso15")]
     
    char stringpool_str392 [sizeof("CSISOLATIN2")]
     
    char stringpool_str393 [sizeof("GEORGIAN-PS")]
     
    char stringpool_str394 [sizeof("KS_C_5601-1989")]
     
    char stringpool_str395 [sizeof("CP1133")]
     
    char stringpool_str396 [sizeof("cp437")]
     
    char stringpool_str397 [sizeof("ISO-2022-JP-2")]
     
    char stringpool_str398 [sizeof("IBM367")]
     
    char stringpool_str40 [sizeof("iso85")]
     
    char stringpool_str401 [sizeof("UCS-2BE")]
     
    char stringpool_str402 [sizeof("UNICODE-1-1")]
     
    char stringpool_str409 [sizeof("JIS_C6220-1969-RO")]
     
    char stringpool_str41 [sizeof("thai8")]
     
    char stringpool_str411 [sizeof("MS-ARAB")]
     
    char stringpool_str415 [sizeof("IBM437")]
     
    char stringpool_str418 [sizeof("MAC")]
     
    char stringpool_str42 [sizeof("iso89")]
     
    char stringpool_str422 [sizeof("UTF-16LE")]
     
    char stringpool_str428 [sizeof("ISO-2022-JP")]
     
    char stringpool_str429 [sizeof("CN-GB-ISOIR165")]
     
    char stringpool_str43 [sizeof("roma8")]
     
    char stringpool_str434 [sizeof("WINDOWS-1251")]
     
    char stringpool_str435 [sizeof("WINDOWS-1258")]
     
    char stringpool_str436 [sizeof("WINDOWS-1255")]
     
    char stringpool_str438 [sizeof("CSISOLATINARABIC")]
     
    char stringpool_str44 [sizeof("L4")]
     
    char stringpool_str441 [sizeof("MS-HEBR")]
     
    char stringpool_str444 [sizeof("CYRILLIC")]
     
    char stringpool_str445 [sizeof("JIS_C6226-1983")]
     
    char stringpool_str446 [sizeof("WINDOWS-1256")]
     
    char stringpool_str448 [sizeof("KS_C_5601-1987")]
     
    char stringpool_str45 [sizeof("utf8")]
     
    char stringpool_str450 [sizeof("UHC")]
     
    char stringpool_str452 [sizeof("BIGFIVE")]
     
    char stringpool_str454 [sizeof("CN-GB")]
     
    char stringpool_str455 [sizeof("GEORGIAN-ACADEMY")]
     
    char stringpool_str46 [sizeof("866")]
     
    char stringpool_str460 [sizeof("BIG-FIVE")]
     
    char stringpool_str461 [sizeof("CSIBM866")]
     
    char stringpool_str462 [sizeof("UTF7")]
     
    char stringpool_str463 [sizeof("WINDOWS-1254")]
     
    char stringpool_str464 [sizeof("CSISOLATIN3")]
     
    char stringpool_str465 [sizeof("UNICODE-1-1-UTF-7")]
     
    char stringpool_str467 [sizeof("CSISO57GB1988")]
     
    char stringpool_str47 [sizeof("iso815")]
     
    char stringpool_str470 [sizeof("UTF-7")]
     
    char stringpool_str472 [sizeof("GB_2312-80")]
     
    char stringpool_str474 [sizeof("CSISO2022KR")]
     
    char stringpool_str475 [sizeof("WINDOWS-1252")]
     
    char stringpool_str476 [sizeof("KOI8-U")]
     
    char stringpool_str479 [sizeof("ISO_8859-8:1988")]
     
    char stringpool_str48 [sizeof("big5")]
     
    char stringpool_str480 [sizeof("ISO_8859-5:1988")]
     
    char stringpool_str483 [sizeof("ISO_8859-9:1989")]
     
    char stringpool_str484 [sizeof("WINDOWS-1250")]
     
    char stringpool_str485 [sizeof("MACICELAND")]
     
    char stringpool_str486 [sizeof("CSISOLATINGREEK")]
     
    char stringpool_str487 [sizeof("ISO-2022-CN-EXT")]
     
    char stringpool_str488 [sizeof("JIS_X0201")]
     
    char stringpool_str489 [sizeof("JISX0201-1976")]
     
    char stringpool_str490 [sizeof("JIS_X0208")]
     
    char stringpool_str491 [sizeof("WINDOWS-1257")]
     
    char stringpool_str494 [sizeof("CSISO2022CN")]
     
    char stringpool_str496 [sizeof("MS-GREEK")]
     
    char stringpool_str50 [sizeof("roman8")]
     
    char stringpool_str500 [sizeof("EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE")]
     
    char stringpool_str503 [sizeof("KOI8-RU")]
     
    char stringpool_str504 [sizeof("TIS620.2529-1")]
     
    char stringpool_str505 [sizeof("MACROMAN")]
     
    char stringpool_str506 [sizeof("WINDOWS-874")]
     
    char stringpool_str507 [sizeof("ISO_8859-4:1988")]
     
    char stringpool_str509 [sizeof("CSKSC56011987")]
     
    char stringpool_str511 [sizeof("WINDOWS-1253")]
     
    char stringpool_str514 [sizeof("UTF-16BE")]
     
    char stringpool_str515 [sizeof("CSISO87JISX0208")]
     
    char stringpool_str516 [sizeof("CSISO2022JP2")]
     
    char stringpool_str520 [sizeof("JIS_X0212")]
     
    char stringpool_str521 [sizeof("MACROMANIA")]
     
    char stringpool_str522 [sizeof("CSUNICODE11")]
     
    char stringpool_str523 [sizeof("MACTHAI")]
     
    char stringpool_str528 [sizeof("UTF-32LE")]
     
    char stringpool_str531 [sizeof("CSHPROMAN8")]
     
    char stringpool_str534 [sizeof("ISO_8859-1:1987")]
     
    char stringpool_str541 [sizeof("BIG5HKSCS")]
     
    char stringpool_str546 [sizeof("ISO_8859-6:1987")]
     
    char stringpool_str547 [sizeof("JIS_X0212-1990")]
     
    char stringpool_str548 [sizeof("CSISO2022JP")]
     
    char stringpool_str549 [sizeof("BIG5-HKSCS")]
     
    char stringpool_str553 [sizeof("CSSHIFTJIS")]
     
    char stringpool_str555 [sizeof("ISO_8859-3:1988")]
     
    char stringpool_str557 [sizeof("JIS_X0208-1990")]
     
    char stringpool_str56 [sizeof("L2")]
     
    char stringpool_str560 [sizeof("CSISOLATINHEBREW")]
     
    char stringpool_str561 [sizeof("CSISOLATINCYRILLIC")]
     
    char stringpool_str563 [sizeof("ISO-CELTIC")]
     
    char stringpool_str564 [sizeof("HZ-GB-2312")]
     
    char stringpool_str57 [sizeof("646")]
     
    char stringpool_str571 [sizeof("ANSI_X3.4-1968")]
     
    char stringpool_str572 [sizeof("HEBREW")]
     
    char stringpool_str575 [sizeof("ISO_8859-2:1987")]
     
    char stringpool_str577 [sizeof("CSISO58GB231280")]
     
    char stringpool_str581 [sizeof("CSGB2312")]
     
    char stringpool_str582 [sizeof("ANSI_X3.4-1986")]
     
    char stringpool_str583 [sizeof("CSUNICODE11UTF7")]
     
    char stringpool_str584 [sizeof("JIS_X0208-1983")]
     
    char stringpool_str591 [sizeof("ISO_8859-7:1987")]
     
    char stringpool_str594 [sizeof("EUCTW")]
     
    char stringpool_str596 [sizeof("CSEUCKR")]
     
    char stringpool_str60 [sizeof("iso86")]
     
    char stringpool_str602 [sizeof("EUC-TW")]
     
    char stringpool_str605 [sizeof("MACCROATIAN")]
     
    char stringpool_str607 [sizeof("eucTW")]
     
    char stringpool_str614 [sizeof("TIS620.2533-1")]
     
    char stringpool_str617 [sizeof("MACGREEK")]
     
    char stringpool_str620 [sizeof("UTF-32BE")]
     
    char stringpool_str625 [sizeof("MACINTOSH")]
     
    char stringpool_str63 [sizeof("iso88591")]
     
    char stringpool_str637 [sizeof("UNICODELITTLE")]
     
    char stringpool_str641 [sizeof("MS-TURK")]
     
    char stringpool_str645 [sizeof("MACUKRAINE")]
     
    char stringpool_str65 [sizeof("iso88598")]
     
    char stringpool_str651 [sizeof("IBM-CP1133")]
     
    char stringpool_str658 [sizeof("MACCENTRALEUROPE")]
     
    char stringpool_str66 [sizeof("iso_1")]
     
    char stringpool_str663 [sizeof("NEXTSTEP")]
     
    char stringpool_str664 [sizeof("TIS620.2533-0")]
     
    char stringpool_str67 [sizeof("iso88595")]
     
    char stringpool_str674 [sizeof("JIS_X0212.1990-0")]
     
    char stringpool_str69 [sizeof("iso88599")]
     
    char stringpool_str697 [sizeof("MACARABIC")]
     
    char stringpool_str70 [sizeof("greek8")]
     
    char stringpool_str706 [sizeof("UNICODEBIG")]
     
    char stringpool_str71 [sizeof("ISO8859-1")]
     
    char stringpool_str72 [sizeof("L7")]
     
    char stringpool_str723 [sizeof("CSPC862LATINHEBREW")]
     
    char stringpool_str73 [sizeof("ISO8859-8")]
     
    char stringpool_str74 [sizeof("iso885915")]
     
    char stringpool_str748 [sizeof("MACCYRILLIC")]
     
    char stringpool_str75 [sizeof("ISO8859-5")]
     
    char stringpool_str756 [sizeof("WINBALTRIM")]
     
    char stringpool_str758 [sizeof("TCVN5712-1:1993")]
     
    char stringpool_str762 [sizeof("CSMACINTOSH")]
     
    char stringpool_str77 [sizeof("ISO8859-9")]
     
    char stringpool_str788 [sizeof("CSHALFWIDTHKATAKANA")]
     
    char stringpool_str79 [sizeof("ISO-8859-1")]
     
    char stringpool_str81 [sizeof("ISO-8859-8")]
     
    char stringpool_str82 [sizeof("ISO8859-15")]
     
    char stringpool_str83 [sizeof("ISO-8859-5")]
     
    char stringpool_str85 [sizeof("ISO-8859-9")]
     
    char stringpool_str87 [sizeof("iso88596")]
     
    char stringpool_str884 [sizeof("MACHEBREW")]
     
    char stringpool_str89 [sizeof("ISO-IR-58")]
     
    char stringpool_str899 [sizeof("MACTURKISH")]
     
    char stringpool_str90 [sizeof("ISO-8859-15")]
     
    char stringpool_str905 [sizeof("CSPC850MULTILINGUAL")]
     
    char stringpool_str91 [sizeof("JAVA")]
     
    char stringpool_str915 [sizeof("CSEUCTW")]
     
    char stringpool_str92 [sizeof("L3")]
     
    char stringpool_str93 [sizeof("iso14")]
     
    char stringpool_str94 [sizeof("iso84")]
     
    char stringpool_str95 [sizeof("ISO8859-6")]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00956.html000644 025423 025423 00000020353 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    conv_result Member List

    This is the complete list of members for conv_result, including all inherited members.

    bi (defined in conv_result)conv_result
    bigdatetime (defined in conv_result)conv_result
    bigtime (defined in conv_result)conv_result
    c (defined in conv_result)conv_result
    cb (defined in conv_result)conv_result
    cc (defined in conv_result)conv_result
    date (defined in conv_result)conv_result
    dt (defined in conv_result)conv_result
    dt4 (defined in conv_result)conv_result
    dta (defined in conv_result)conv_result
    f (defined in conv_result)conv_result
    i (defined in conv_result)conv_result
    ib (defined in conv_result)conv_result
    m (defined in conv_result)conv_result
    m4 (defined in conv_result)conv_result
    n (defined in conv_result)conv_result
    r (defined in conv_result)conv_result
    si (defined in conv_result)conv_result
    ti (defined in conv_result)conv_result
    time (defined in conv_result)conv_result
    u (defined in conv_result)conv_result
    ubi (defined in conv_result)conv_result
    ui (defined in conv_result)conv_result
    usi (defined in conv_result)conv_result
    freetds-1.3.6/doc/reference/a00957.dot000644 025423 025423 00000005545 14162303417 020655 0ustar00fredianofrediano000000 000000 digraph "conv_result" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="conv_result",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dta" ,fontname="Helvetica"]; Node2 [label="TDS_DATETIMEALL",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01119.html",tooltip="this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information."]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cc" ,fontname="Helvetica"]; Node3 [label="conv_result::cc_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00963.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cb" ,fontname="Helvetica"]; Node4 [label="conv_result::cb_t",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00967.html",tooltip=" "]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" u" ,fontname="Helvetica"]; Node5 [label="tdsunique",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01067.html",tooltip=" "]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dt" ,fontname="Helvetica"]; Node6 [label="tdsdatetime",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01059.html",tooltip=" "]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" m" ,fontname="Helvetica"]; Node7 [label="tdsmoney",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01051.html",tooltip=" "]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tdsoldmoney" ,fontname="Helvetica"]; Node8 [label="tdsoldmoney",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01047.html",tooltip=" "]; Node9 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" n" ,fontname="Helvetica"]; Node9 [label="tdsnumeric",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01043.html",tooltip=" "]; Node10 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" m4" ,fontname="Helvetica"]; Node10 [label="tdsmoney4",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01055.html",tooltip=" "]; Node11 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dt4" ,fontname="Helvetica"]; Node11 [label="tdsdatetime4",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01063.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00959.html000644 025423 025423 00000031160 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: conv_result Union Reference
    FreeTDS API
    conv_result Union Reference
    Collaboration diagram for conv_result:

    Classes

    struct  cb_t
     
    struct  cc_t
     

    Public Attributes

    TDS_INT8 bi
     
    TDS_BIGDATETIME bigdatetime
     
    TDS_BIGTIME bigtime
     
    TDS_CHAR * c
     
    struct conv_result::cb_t cb
     
    struct conv_result::cc_t cc
     
    TDS_DATE date
     
    TDS_DATETIME dt
     
    TDS_DATETIME4 dt4
     
    TDS_DATETIMEALL dta
     
    TDS_FLOAT f
     
    TDS_INT i
     
    TDS_CHAR * ib
     
    TDS_MONEY m
     
    TDS_MONEY4 m4
     
    TDS_NUMERIC n
     
    TDS_REAL r
     
    TDS_SMALLINT si
     
    TDS_TINYINT ti
     
    TDS_TIME time
     
    TDS_UNIQUE u
     
    TDS_UINT8 ubi
     
    TDS_UINT ui
     
    TDS_USMALLINT usi
     

    The documentation for this union was generated from the following file:
    freetds-1.3.6/doc/reference/a00960.html000644 025423 025423 00000007172 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    conv_result::cc_t Member List

    This is the complete list of members for conv_result::cc_t, including all inherited members.

    c (defined in conv_result::cc_t)conv_result::cc_t
    len (defined in conv_result::cc_t)conv_result::cc_t
    freetds-1.3.6/doc/reference/a00963.html000644 025423 025423 00000010205 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: conv_result::cc_t Struct Reference
    FreeTDS API
    conv_result::cc_t Struct Reference

    Public Attributes

    TDS_CHAR * c
     
    TDS_UINT len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00964.html000644 025423 025423 00000007173 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    conv_result::cb_t Member List

    This is the complete list of members for conv_result::cb_t, including all inherited members.

    ib (defined in conv_result::cb_t)conv_result::cb_t
    len (defined in conv_result::cb_t)conv_result::cb_t
    freetds-1.3.6/doc/reference/a00967.html000644 025423 025423 00000010206 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: conv_result::cb_t Struct Reference
    FreeTDS API
    conv_result::cb_t Struct Reference

    Public Attributes

    TDS_CHAR * ib
     
    TDS_UINT len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00968.html000644 025423 025423 00000006717 14162303417 021037 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _character_set_alias Member List

    This is the complete list of members for _character_set_alias, including all inherited members.

    alias (defined in _character_set_alias)_character_set_alias
    canonic (defined in _character_set_alias)_character_set_alias
    freetds-1.3.6/doc/reference/a00971.html000644 025423 025423 00000007711 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: _character_set_alias Struct Reference
    FreeTDS API
    _character_set_alias Struct Reference

    Public Attributes

    const char * alias
     
    int canonic
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00972.html000644 025423 025423 00000007343 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_errno_message_flags Member List

    This is the complete list of members for tds_errno_message_flags, including all inherited members.

    e2big (defined in tds_errno_message_flags)tds_errno_message_flags
    eilseq (defined in tds_errno_message_flags)tds_errno_message_flags
    einval (defined in tds_errno_message_flags)tds_errno_message_flags
    freetds-1.3.6/doc/reference/a00975.html000644 025423 025423 00000010473 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_errno_message_flags Struct Reference
    FreeTDS API
    tds_errno_message_flags Struct Reference

    Public Attributes

    unsigned int e2big:1
     
    unsigned int eilseq:1
     
    unsigned int einval:1
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00976.html000644 025423 025423 00000006626 14162303417 021035 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsiconvdir Member List

    This is the complete list of members for tdsiconvdir, including all inherited members.

    cd (defined in tdsiconvdir)tdsiconvdir
    charset (defined in tdsiconvdir)tdsiconvdir
    freetds-1.3.6/doc/reference/a00977.dot000644 025423 025423 00000001142 14162303417 020644 0ustar00fredianofrediano000000 000000 digraph "tdsiconvdir" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tdsiconvdir",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" charset" ,fontname="Helvetica"]; Node2 [label="tds_encoding",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01163.html",tooltip="Information relevant to libiconv."]; } freetds-1.3.6/doc/reference/a00979.html000644 025423 025423 00000010343 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsiconvdir Struct Reference
    FreeTDS API
    tdsiconvdir Struct Reference
    Collaboration diagram for tdsiconvdir:

    Public Attributes

    iconv_t cd
     
    TDS_ENCODING charset
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00980.html000644 025423 025423 00000007213 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsiconvinfo Member List

    This is the complete list of members for tdsiconvinfo, including all inherited members.

    flags (defined in tdsiconvinfo)tdsiconvinfo
    from (defined in tdsiconvinfo)tdsiconvinfo
    suppress (defined in tdsiconvinfo)tdsiconvinfo
    freetds-1.3.6/doc/reference/a00981.dot000644 025423 025423 00000002144 14162303417 020642 0ustar00fredianofrediano000000 000000 digraph "tdsiconvinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tdsiconvinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" suppress" ,fontname="Helvetica"]; Node2 [label="tds_errno_message_flags",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00975.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" from" ,fontname="Helvetica"]; Node3 [label="tdsiconvdir",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00979.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" charset" ,fontname="Helvetica"]; Node4 [label="tds_encoding",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01163.html",tooltip="Information relevant to libiconv."]; } freetds-1.3.6/doc/reference/a00983.html000644 025423 025423 00000011142 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsiconvinfo Struct Reference
    FreeTDS API
    tdsiconvinfo Struct Reference
    Collaboration diagram for tdsiconvinfo:

    Public Attributes

    unsigned int flags
     
    struct tdsiconvdir to from
     
    TDS_ERRNO_MESSAGE_FLAGS suppress
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00984.html000644 025423 025423 00000011337 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _sql_error Member List

    This is the complete list of members for _sql_error, including all inherited members.

    linenum (defined in _sql_error)_sql_error
    msg (defined in _sql_error)_sql_error
    msgstate (defined in _sql_error)_sql_error
    native (defined in _sql_error)_sql_error
    row (defined in _sql_error)_sql_error
    server (defined in _sql_error)_sql_error
    state2 (defined in _sql_error)_sql_error
    state3 (defined in _sql_error)_sql_error
    freetds-1.3.6/doc/reference/a00987.html000644 025423 025423 00000013701 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: _sql_error Struct Reference
    FreeTDS API
    _sql_error Struct Reference

    Public Attributes

    int linenum
     
    const char * msg
     
    int msgstate
     
    TDS_UINT native
     
    int row
     
    char * server
     
    char state2 [6]
     
    char state3 [6]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00988.html000644 025423 025423 00000007544 14162303417 021040 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _sql_errors Member List

    This is the complete list of members for _sql_errors, including all inherited members.

    errs (defined in _sql_errors)_sql_errors
    lastrc (defined in _sql_errors)_sql_errors
    num_errors (defined in _sql_errors)_sql_errors
    ranked (defined in _sql_errors)_sql_errors
    freetds-1.3.6/doc/reference/a00989.dot000644 025423 025423 00000001075 14162303417 020654 0ustar00fredianofrediano000000 000000 digraph "_sql_errors" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_sql_errors",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node2 [label="_sql_error",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00987.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a00991.html000644 025423 025423 00000011571 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: _sql_errors Struct Reference
    FreeTDS API
    _sql_errors Struct Reference
    Collaboration diagram for _sql_errors:

    Public Attributes

    struct _sql_errorerrs
     
    SQLRETURN lastrc
     
    int num_errors
     
    char ranked
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00992.html000644 025423 025423 00000011116 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _dheader Member List

    This is the complete list of members for _dheader, including all inherited members.

    sql_desc_alloc_type (defined in _dheader)_dheader
    sql_desc_array_size (defined in _dheader)_dheader
    sql_desc_array_status_ptr (defined in _dheader)_dheader
    sql_desc_bind_offset_ptr (defined in _dheader)_dheader
    sql_desc_bind_type (defined in _dheader)_dheader
    sql_desc_count (defined in _dheader)_dheader
    sql_desc_rows_processed_ptr (defined in _dheader)_dheader
    freetds-1.3.6/doc/reference/a00995.html000644 025423 025423 00000013351 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: _dheader Struct Reference
    FreeTDS API
    _dheader Struct Reference

    Public Attributes

    SQLSMALLINT sql_desc_alloc_type
     
    SQLULEN sql_desc_array_size
     
    SQLUSMALLINT * sql_desc_array_status_ptr
     
    SQLLEN * sql_desc_bind_offset_ptr
     
    SQLINTEGER sql_desc_bind_type
     
    SQLSMALLINT sql_desc_count
     
    SQLULEN * sql_desc_rows_processed_ptr
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a00996.html000644 025423 025423 00000025507 14162303417 021036 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _drecord Member List

    This is the complete list of members for _drecord, including all inherited members.

    sql_desc_auto_unique_value (defined in _drecord)_drecord
    sql_desc_base_column_name (defined in _drecord)_drecord
    sql_desc_base_table_name (defined in _drecord)_drecord
    sql_desc_case_sensitive (defined in _drecord)_drecord
    sql_desc_catalog_name (defined in _drecord)_drecord
    sql_desc_concise_type (defined in _drecord)_drecord
    sql_desc_data_ptr (defined in _drecord)_drecord
    sql_desc_datetime_interval_code (defined in _drecord)_drecord
    sql_desc_datetime_interval_precision (defined in _drecord)_drecord
    sql_desc_display_size (defined in _drecord)_drecord
    sql_desc_fixed_prec_scale (defined in _drecord)_drecord
    sql_desc_indicator_ptr (defined in _drecord)_drecord
    sql_desc_label (defined in _drecord)_drecord
    sql_desc_length (defined in _drecord)_drecord
    sql_desc_literal_prefix (defined in _drecord)_drecord
    sql_desc_literal_suffix (defined in _drecord)_drecord
    sql_desc_local_type_name (defined in _drecord)_drecord
    sql_desc_name (defined in _drecord)_drecord
    sql_desc_nullable (defined in _drecord)_drecord
    sql_desc_num_prec_radix (defined in _drecord)_drecord
    sql_desc_octet_length (defined in _drecord)_drecord
    sql_desc_octet_length_ptr (defined in _drecord)_drecord
    sql_desc_parameter_type (defined in _drecord)_drecord
    sql_desc_precision (defined in _drecord)_drecord
    sql_desc_rowver (defined in _drecord)_drecord
    sql_desc_scale (defined in _drecord)_drecord
    sql_desc_schema_name (defined in _drecord)_drecord
    sql_desc_searchable (defined in _drecord)_drecord
    sql_desc_table_name (defined in _drecord)_drecord
    sql_desc_type (defined in _drecord)_drecord
    sql_desc_type_name (defined in _drecord)_drecord
    sql_desc_unnamed (defined in _drecord)_drecord
    sql_desc_unsigned (defined in _drecord)_drecord
    sql_desc_updatable (defined in _drecord)_drecord
    freetds-1.3.6/doc/reference/a00997.dot000644 025423 025423 00000001405 14162303417 020650 0ustar00fredianofrediano000000 000000 digraph "_drecord" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_drecord",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sql_desc_base_column\l_name\nsql_desc_base_table\l_name\nsql_desc_catalog\l_name\nsql_desc_label\nsql_desc_local\l_type_name\nsql_desc_name\nsql_desc_schema\l_name\nsql_desc_table\l_name" ,fontname="Helvetica"]; Node2 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; } freetds-1.3.6/doc/reference/a00999.html000644 025423 025423 00000040033 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: _drecord Struct Reference
    FreeTDS API
    _drecord Struct Reference
    Collaboration diagram for _drecord:

    Public Attributes

    SQLUINTEGER sql_desc_auto_unique_value
     
    DSTR sql_desc_base_column_name
     
    DSTR sql_desc_base_table_name
     
    SQLINTEGER sql_desc_case_sensitive
     
    DSTR sql_desc_catalog_name
     
    SQLSMALLINT sql_desc_concise_type
     
    SQLPOINTER sql_desc_data_ptr
     
    SQLSMALLINT sql_desc_datetime_interval_code
     
    SQLINTEGER sql_desc_datetime_interval_precision
     
    SQLLEN sql_desc_display_size
     
    SQLSMALLINT sql_desc_fixed_prec_scale
     
    SQLLEN * sql_desc_indicator_ptr
     
    DSTR sql_desc_label
     
    SQLULEN sql_desc_length
     
    const char * sql_desc_literal_prefix
     
    const char * sql_desc_literal_suffix
     
    DSTR sql_desc_local_type_name
     
    DSTR sql_desc_name
     
    SQLSMALLINT sql_desc_nullable
     
    SQLINTEGER sql_desc_num_prec_radix
     
    SQLLEN sql_desc_octet_length
     
    SQLLEN * sql_desc_octet_length_ptr
     
    SQLSMALLINT sql_desc_parameter_type
     
    SQLSMALLINT sql_desc_precision
     
    SQLSMALLINT sql_desc_rowver
     
    SQLSMALLINT sql_desc_scale
     
    DSTR sql_desc_schema_name
     
    SQLSMALLINT sql_desc_searchable
     
    DSTR sql_desc_table_name
     
    SQLSMALLINT sql_desc_type
     
    const char * sql_desc_type_name
     
    SQLSMALLINT sql_desc_unnamed
     
    SQLSMALLINT sql_desc_unsigned
     
    SQLSMALLINT sql_desc_updatable
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01000.html000644 025423 025423 00000010677 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _hdesc Member List

    This is the complete list of members for _hdesc, including all inherited members.

    errs (defined in _hdesc)_hdesc
    header (defined in _hdesc)_hdesc
    htype (defined in _hdesc)_hdesc
    mtx (defined in _hdesc)_hdesc
    parent (defined in _hdesc)_hdesc
    records (defined in _hdesc)_hdesc
    type (defined in _hdesc)_hdesc
    freetds-1.3.6/doc/reference/a01001.dot000644 025423 025423 00000003337 14162303417 020627 0ustar00fredianofrediano000000 000000 digraph "_hdesc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_hdesc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" header" ,fontname="Helvetica"]; Node2 [label="_dheader",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00995.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" records" ,fontname="Helvetica"]; Node3 [label="_drecord",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00999.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sql_desc_base_column\l_name\nsql_desc_base_table\l_name\nsql_desc_catalog\l_name\nsql_desc_label\nsql_desc_local\l_type_name\nsql_desc_name\nsql_desc_schema\l_name\nsql_desc_table\l_name" ,fontname="Helvetica"]; Node4 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node5 [label="_sql_errors",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00991.html",tooltip=" "]; Node6 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node6 [label="_sql_error",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00987.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01003.html000644 025423 025423 00000013720 14162303417 021004 0ustar00fredianofrediano000000 000000 FreeTDS API: _hdesc Struct Reference
    FreeTDS API
    _hdesc Struct Reference
    Collaboration diagram for _hdesc:

    Public Attributes

    struct _sql_errors errs
     
    struct _dheader header
     
    SQLSMALLINT htype
     
    tds_mutex mtx
     
    SQLHANDLE parent
     
    struct _drecordrecords
     
    int type
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01004.html000644 025423 025423 00000007522 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _heattr Member List

    This is the complete list of members for _heattr, including all inherited members.

    connection_pooling (defined in _heattr)_heattr
    cp_match (defined in _heattr)_heattr
    odbc_version (defined in _heattr)_heattr
    output_nts (defined in _heattr)_heattr
    freetds-1.3.6/doc/reference/a01007.html000644 025423 025423 00000011205 14162303417 021004 0ustar00fredianofrediano000000 000000 FreeTDS API: _heattr Struct Reference
    FreeTDS API
    _heattr Struct Reference

    Public Attributes

    SQLUINTEGER connection_pooling
     
    SQLUINTEGER cp_match
     
    SQLINTEGER odbc_version
     
    SQLINTEGER output_nts
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01008.html000644 025423 025423 00000007116 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _hchk Member List

    This is the complete list of members for _hchk, including all inherited members.

    errs (defined in _hchk)_hchk
    htype (defined in _hchk)_hchk
    mtx (defined in _hchk)_hchk
    freetds-1.3.6/doc/reference/a01009.dot000644 025423 025423 00000001451 14162303417 020632 0ustar00fredianofrediano000000 000000 digraph "_hchk" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_hchk",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node2 [label="_sql_errors",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00991.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node3 [label="_sql_error",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00987.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01011.html000644 025423 025423 00000011020 14162303417 020772 0ustar00fredianofrediano000000 000000 FreeTDS API: _hchk Struct Reference
    FreeTDS API
    _hchk Struct Reference
    Collaboration diagram for _hchk:

    Public Attributes

    struct _sql_errors errs
     
    SQLSMALLINT htype
     
    tds_mutex mtx
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01012.html000644 025423 025423 00000007776 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _henv Member List

    This is the complete list of members for _henv, including all inherited members.

    attr (defined in _henv)_henv
    errs (defined in _henv)_henv
    htype (defined in _henv)_henv
    mtx (defined in _henv)_henv
    tds_ctx (defined in _henv)_henv
    freetds-1.3.6/doc/reference/a01013.dot000644 025423 025423 00000003021 14162303417 020620 0ustar00fredianofrediano000000 000000 digraph "_henv" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_henv",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node2 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node3 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attr" ,fontname="Helvetica"]; Node4 [label="_heattr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01007.html",tooltip=" "]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node5 [label="_sql_errors",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00991.html",tooltip=" "]; Node6 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node6 [label="_sql_error",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00987.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01015.html000644 025423 025423 00000012427 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: _henv Struct Reference
    FreeTDS API
    _henv Struct Reference
    Collaboration diagram for _henv:

    Public Attributes

    struct _heattr attr
     
    struct _sql_errors errs
     
    SQLSMALLINT htype
     
    tds_mutex mtx
     
    TDSCONTEXTtds_ctx
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01016.html000644 025423 025423 00000015674 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _hcattr Member List

    This is the complete list of members for _hcattr, including all inherited members.

    access_mode (defined in _hcattr)_hcattr
    async_enable (defined in _hcattr)_hcattr
    auto_ipd (defined in _hcattr)_hcattr
    autocommit (defined in _hcattr)_hcattr
    bulk_enabled (defined in _hcattr)_hcattr
    connection_dead (defined in _hcattr)_hcattr
    connection_timeout (defined in _hcattr)_hcattr
    current_catalog (defined in _hcattr)_hcattr
    cursor_type (defined in _hcattr)_hcattr
    login_timeout (defined in _hcattr)_hcattr
    mars_enabled (defined in _hcattr)_hcattr
    metadata_id (defined in _hcattr)_hcattr
    odbc_cursors (defined in _hcattr)_hcattr
    packet_size (defined in _hcattr)_hcattr
    quite_mode (defined in _hcattr)_hcattr
    translate_lib (defined in _hcattr)_hcattr
    translate_option (defined in _hcattr)_hcattr
    txn_isolation (defined in _hcattr)_hcattr
    freetds-1.3.6/doc/reference/a01017.dot000644 025423 025423 00000001147 14162303417 020633 0ustar00fredianofrediano000000 000000 digraph "_hcattr" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_hcattr",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_catalog\ntranslate_lib" ,fontname="Helvetica"]; Node2 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; } freetds-1.3.6/doc/reference/a01019.html000644 025423 025423 00000023526 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: _hcattr Struct Reference
    FreeTDS API
    _hcattr Struct Reference
    Collaboration diagram for _hcattr:

    Public Attributes

    SQLUINTEGER access_mode
     
    SQLUINTEGER async_enable
     
    SQLUINTEGER auto_ipd
     
    SQLUINTEGER autocommit
     
    SQLUINTEGER bulk_enabled
     
    SQLUINTEGER connection_dead
     
    SQLUINTEGER connection_timeout
     
    DSTR current_catalog
     
    SQLUINTEGER cursor_type
     
    SQLUINTEGER login_timeout
     
    SQLUINTEGER mars_enabled
     
    SQLUINTEGER metadata_id
     
    SQLUINTEGER odbc_cursors
     
    SQLUINTEGER packet_size
     
    SQLHWND quite_mode
     
    DSTR translate_lib
     
    SQLUINTEGER translate_option
     
    SQLUINTEGER txn_isolation
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01020.html000644 025423 025423 00000014502 14162303417 021002 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _hdbc Member List

    This is the complete list of members for _hdbc, including all inherited members.

    attr (defined in _hdbc)_hdbc
    bcphint (defined in _hdbc)_hdbc
    bcpinfo (defined in _hdbc)_hdbc
    current_statement_hdbc
    cursor_support_hdbc
    default_query_timeout (defined in _hdbc)_hdbc
    dsn (defined in _hdbc)_hdbc
    env (defined in _hdbc)_hdbc
    errs (defined in _hdbc)_hdbc
    htype (defined in _hdbc)_hdbc
    mtx (defined in _hdbc)_hdbc
    oldpwd (defined in _hdbc)_hdbc
    stmt_list_hdbc
    tds_socket (defined in _hdbc)_hdbc
    uad_hdbc
    use_oldpwd (defined in _hdbc)_hdbc
    freetds-1.3.6/doc/reference/a01021.dot000644 025423 025423 00000021347 14162303417 020632 0ustar00fredianofrediano000000 000000 digraph "_hdbc" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_hdbc",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_statement\nstmt_list" ,fontname="Helvetica"]; Node2 [label="_hstmt",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01031.html",tooltip=" "]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next\nprev" ,fontname="Helvetica"]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node3 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node4 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node7 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node7 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node8 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node8 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node9 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node10 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node10 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node3 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node10 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node18 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node18 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node10 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node18 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node20 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node20 [label="tds_connection",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node23 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node23 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node8 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node9 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node18 -> Node20 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyn" ,fontname="Helvetica"]; Node1 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dbc" ,fontname="Helvetica"]; Node26 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attr" ,fontname="Helvetica"]; Node26 [label="_hsattr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01027.html",tooltip=" "]; Node7 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" qn_msgtext\nqn_options" ,fontname="Helvetica"]; Node10 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params" ,fontname="Helvetica"]; Node18 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursor" ,fontname="Helvetica"]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursor_name\nquery" ,fontname="Helvetica"]; Node27 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" apd\nard\nipd\nird\norig_apd\norig_ard" ,fontname="Helvetica"]; Node27 [label="_hdesc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01003.html",tooltip=" "]; Node28 -> Node27 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" header" ,fontname="Helvetica"]; Node28 [label="_dheader",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00995.html",tooltip=" "]; Node29 -> Node27 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" records" ,fontname="Helvetica"]; Node29 [label="_drecord",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00999.html",tooltip=" "]; Node7 -> Node29 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sql_desc_base_column\l_name\nsql_desc_base_table\l_name\nsql_desc_catalog\l_name\nsql_desc_label\nsql_desc_local\l_type_name\nsql_desc_name\nsql_desc_schema\l_name\nsql_desc_table\l_name" ,fontname="Helvetica"]; Node30 -> Node27 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node30 [label="_sql_errors",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00991.html",tooltip=" "]; Node30 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_socket" ,fontname="Helvetica"]; Node32 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcpinfo" ,fontname="Helvetica"]; Node32 [label="tds_bcpinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01247.html",tooltip=" "]; Node10 -> Node32 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bindinfo" ,fontname="Helvetica"]; Node7 -> Node32 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tablename" ,fontname="Helvetica"]; Node33 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attr" ,fontname="Helvetica"]; Node33 [label="_hcattr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01019.html",tooltip=" "]; Node7 -> Node33 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_catalog\ntranslate_lib" ,fontname="Helvetica"]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dsn\noldpwd" ,fontname="Helvetica"]; Node27 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" uad" ,fontname="Helvetica"]; Node30 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node34 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node34 [label="_henv",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01015.html",tooltip=" "]; Node23 -> Node34 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node35 -> Node34 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attr" ,fontname="Helvetica"]; Node35 [label="_heattr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01007.html",tooltip=" "]; Node30 -> Node34 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01023.html000644 025423 025423 00000025742 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: _hdbc Struct Reference
    FreeTDS API
    _hdbc Struct Reference
    Collaboration diagram for _hdbc:

    Public Attributes

    struct _hcattr attr
     
    char * bcphint
     
    TDSBCPINFObcpinfo
     
    struct _hstmtcurrent_statement
     Statement executing. More...
     
    unsigned int cursor_support:1
     <>0 if server handle cursors
     
    TDS_INT default_query_timeout
     
    DSTR dsn
     
    struct _henvenv
     
    struct _sql_errors errs
     
    SQLSMALLINT htype
     
    tds_mutex mtx
     
    DSTR oldpwd
     
    struct _hstmtstmt_list
     list of all statements allocated from this connection
     
    TDSSOCKETtds_socket
     
    TDS_DESCuad [TDS_MAX_APP_DESC]
     descriptors associated to connection
     
    unsigned int use_oldpwd:1
     

    Member Data Documentation

    ◆ current_statement

    struct _hstmt* _hdbc::current_statement

    Statement executing.

    This should be set AFTER sending query to avoid race condition and assure to not overwrite it if another statement is executing a query.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01024.html000644 025423 025423 00000016574 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _hsattr Member List

    This is the complete list of members for _hsattr, including all inherited members.

    async_enable (defined in _hsattr)_hsattr
    concurrency (defined in _hsattr)_hsattr
    cursor_scrollable (defined in _hsattr)_hsattr
    cursor_sensitivity (defined in _hsattr)_hsattr
    cursor_type (defined in _hsattr)_hsattr
    enable_auto_ipd (defined in _hsattr)_hsattr
    fetch_bookmark_ptr (defined in _hsattr)_hsattr
    keyset_size (defined in _hsattr)_hsattr
    max_length (defined in _hsattr)_hsattr
    max_rows (defined in _hsattr)_hsattr
    metadata_id (defined in _hsattr)_hsattr
    noscan (defined in _hsattr)_hsattr
    qn_msgtext (defined in _hsattr)_hsattr
    qn_options (defined in _hsattr)_hsattr
    qn_timeout (defined in _hsattr)_hsattr
    query_timeout (defined in _hsattr)_hsattr
    retrieve_data (defined in _hsattr)_hsattr
    row_number (defined in _hsattr)_hsattr
    simulate_cursor (defined in _hsattr)_hsattr
    use_bookmarks (defined in _hsattr)_hsattr
    freetds-1.3.6/doc/reference/a01025.dot000644 025423 025423 00000001137 14162303417 020631 0ustar00fredianofrediano000000 000000 digraph "_hsattr" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="_hsattr",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" qn_msgtext\nqn_options" ,fontname="Helvetica"]; Node2 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; } freetds-1.3.6/doc/reference/a01027.html000644 025423 025423 00000025012 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: _hsattr Struct Reference
    FreeTDS API
    _hsattr Struct Reference
    Collaboration diagram for _hsattr:

    Public Attributes

    SQLUINTEGER async_enable
     
    SQLUINTEGER concurrency
     
    SQLUINTEGER cursor_scrollable
     
    SQLUINTEGER cursor_sensitivity
     
    SQLUINTEGER cursor_type
     
    SQLUINTEGER enable_auto_ipd
     
    SQLPOINTER fetch_bookmark_ptr
     
    SQLULEN keyset_size
     
    SQLULEN max_length
     
    SQLULEN max_rows
     
    SQLUINTEGER metadata_id
     
    SQLUINTEGER noscan
     
    DSTR qn_msgtext
     
    DSTR qn_options
     
    SQLUINTEGER qn_timeout
     
    SQLUINTEGER query_timeout
     
    SQLUINTEGER retrieve_data
     
    SQLULEN row_number
     
    SQLUINTEGER simulate_cursor
     
    SQLUINTEGER use_bookmarks
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01028.html000644 025423 025423 00000024246 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    _hstmt Member List

    This is the complete list of members for _hstmt, including all inherited members.

    apd (defined in _hstmt)_hstmt
    ard (defined in _hstmt)_hstmt
    attr (defined in _hstmt)_hstmt
    curr_param_row (defined in _hstmt)_hstmt
    cursor (defined in _hstmt)_hstmt
    cursor_name (defined in _hstmt)_hstmt
    dbc (defined in _hstmt)_hstmt
    dyn (defined in _hstmt)_hstmt
    errs (defined in _hstmt)_hstmt
    htype (defined in _hstmt)_hstmt
    ipd (defined in _hstmt)_hstmt
    ird (defined in _hstmt)_hstmt
    is_prepared_query (defined in _hstmt)_hstmt
    mtx (defined in _hstmt)_hstmt
    need_reprepare_hstmt
    next_hstmt
    num_param_rows (defined in _hstmt)_hstmt
    orig_apd (defined in _hstmt)_hstmt
    orig_ard (defined in _hstmt)_hstmt
    param_count_hstmt
    param_data_called (defined in _hstmt)_hstmt
    param_num_hstmt
    params_hstmt
    prepared_pos_hstmt
    prepared_query_is_func (defined in _hstmt)_hstmt
    prepared_query_is_rpc (defined in _hstmt)_hstmt
    prev_hstmt
    query_hstmt
    row (defined in _hstmt)_hstmt
    row_count_hstmt
    row_status_hstmt
    special_row (defined in _hstmt)_hstmt
    sql_rowset_size (defined in _hstmt)_hstmt
    tds_hstmt
    freetds-1.3.6/doc/reference/a01029.dot000644 025423 025423 00000024664 14162303417 020647 0ustar00fredianofrediano000000 000000 digraph "_hstmt" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_hstmt",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next\nprev" ,fontname="Helvetica"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node8 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyn" ,fontname="Helvetica"]; Node25 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dbc" ,fontname="Helvetica"]; Node25 [label="_hdbc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01023.html",tooltip=" "]; Node1 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_statement\nstmt_list" ,fontname="Helvetica"]; Node2 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_socket" ,fontname="Helvetica"]; Node26 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcpinfo" ,fontname="Helvetica"]; Node26 [label="tds_bcpinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01247.html",tooltip=" "]; Node9 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bindinfo" ,fontname="Helvetica"]; Node6 -> Node26 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tablename" ,fontname="Helvetica"]; Node27 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attr" ,fontname="Helvetica"]; Node27 [label="_hcattr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01019.html",tooltip=" "]; Node6 -> Node27 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" current_catalog\ntranslate_lib" ,fontname="Helvetica"]; Node6 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dsn\noldpwd" ,fontname="Helvetica"]; Node28 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" uad" ,fontname="Helvetica"]; Node28 [label="_hdesc",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01003.html",tooltip=" "]; Node29 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" header" ,fontname="Helvetica"]; Node29 [label="_dheader",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00995.html",tooltip=" "]; Node30 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" records" ,fontname="Helvetica"]; Node30 [label="_drecord",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00999.html",tooltip=" "]; Node6 -> Node30 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" sql_desc_base_column\l_name\nsql_desc_base_table\l_name\nsql_desc_catalog\l_name\nsql_desc_label\nsql_desc_local\l_type_name\nsql_desc_name\nsql_desc_schema\l_name\nsql_desc_table\l_name" ,fontname="Helvetica"]; Node31 -> Node28 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node31 [label="_sql_errors",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00991.html",tooltip=" "]; Node31 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node33 -> Node25 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node33 [label="_henv",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01015.html",tooltip=" "]; Node22 -> Node33 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node34 -> Node33 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attr" ,fontname="Helvetica"]; Node34 [label="_heattr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01007.html",tooltip=" "]; Node31 -> Node33 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; Node35 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attr" ,fontname="Helvetica"]; Node35 [label="_hsattr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01027.html",tooltip=" "]; Node6 -> Node35 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" qn_msgtext\nqn_options" ,fontname="Helvetica"]; Node9 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params" ,fontname="Helvetica"]; Node17 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursor" ,fontname="Helvetica"]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursor_name\nquery" ,fontname="Helvetica"]; Node28 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" apd\nard\nipd\nird\norig_apd\norig_ard" ,fontname="Helvetica"]; Node31 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" errs" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01031.html000644 025423 025423 00000045711 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: _hstmt Struct Reference
    FreeTDS API
    _hstmt Struct Reference
    Collaboration diagram for _hstmt:

    Public Attributes

    TDS_DESCapd
     
    TDS_DESCard
     
    struct _hsattr attr
     
    unsigned int curr_param_row
     
    TDSCURSORcursor
     
    DSTR cursor_name
     
    struct _hdbcdbc
     
    TDSDYNAMICdyn
     
    struct _sql_errors errs
     
    SQLSMALLINT htype
     
    TDS_DESCipd
     
    TDS_DESCird
     
    unsigned is_prepared_query:1
     
    tds_mutex mtx
     
    unsigned need_reprepare:1
     Prepared statement needs to be prepared again. More...
     
    struct _hstmtnext
     next in list
     
    unsigned int num_param_rows
     
    TDS_DESCorig_apd
     
    TDS_DESCorig_ard
     
    unsigned int param_count
     number of parameter in current query
     
    unsigned param_data_called:1
     
    int param_num
     last valid parameter in params, it's a ODBC index (from 1 relative to descriptor)
     
    TDSPARAMINFOparams
     parameters saved
     
    size_t prepared_pos
     position in prepared query to check parameters, used only in RPC
     
    unsigned prepared_query_is_func:1
     
    unsigned prepared_query_is_rpc:1
     
    struct _hstmtprev
     previous in list
     
    DSTR query
     query to execute
     
    int row
     
    TDS_INT8 row_count
     row count to return
     
    TDS_ODBC_ROW_STATUS row_status
     status of row, it can happen that this flag mark that we are still parsing row, this it's normal
     
    TDS_ODBC_SPECIAL_ROWS special_row
     
    SQLULEN sql_rowset_size
     
    TDSSOCKETtds
     socket (only if active)
     

    Member Data Documentation

    ◆ need_reprepare

    unsigned _hstmt::need_reprepare

    Prepared statement needs to be prepared again.

    This can happen if the parameters was changed or not specified.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01032.html000644 025423 025423 00000006624 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    TDS_FUNCS Member List

    This is the complete list of members for TDS_FUNCS, including all inherited members.

    common (defined in TDS_FUNCS)TDS_FUNCS
    set_type_info (defined in TDS_FUNCS)TDS_FUNCS
    freetds-1.3.6/doc/reference/a01033.dot000644 025423 025423 00000001101 14162303417 020617 0ustar00fredianofrediano000000 000000 digraph "TDS_FUNCS" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="TDS_FUNCS",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" common" ,fontname="Helvetica"]; Node2 [label="tds_column_funcs",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01171.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01035.html000644 025423 025423 00000010515 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: TDS_FUNCS Struct Reference
    FreeTDS API
    TDS_FUNCS Struct Reference
    Collaboration diagram for TDS_FUNCS:

    Public Attributes

    TDSCOLUMNFUNCS common
     
    void(* set_type_info )(TDSCOLUMN *col, struct _drecord *drec, SQLINTEGER odbc_ver)
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01036.html000644 025423 025423 00000006657 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    TDS_PARSED_PARAM Member List

    This is the complete list of members for TDS_PARSED_PARAM, including all inherited members.

    len (defined in TDS_PARSED_PARAM)TDS_PARSED_PARAM
    p (defined in TDS_PARSED_PARAM)TDS_PARSED_PARAM
    freetds-1.3.6/doc/reference/a01039.html000644 025423 025423 00000007673 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: TDS_PARSED_PARAM Struct Reference
    FreeTDS API
    TDS_PARSED_PARAM Struct Reference

    Public Attributes

    size_t len
     
    const char * p
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01040.html000644 025423 025423 00000007175 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsnumeric Member List

    This is the complete list of members for tdsnumeric, including all inherited members.

    array (defined in tdsnumeric)tdsnumeric
    precision (defined in tdsnumeric)tdsnumeric
    scale (defined in tdsnumeric)tdsnumeric
    freetds-1.3.6/doc/reference/a01043.html000644 025423 025423 00000010445 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsnumeric Struct Reference
    FreeTDS API
    tdsnumeric Struct Reference

    Public Attributes

    unsigned char array [33]
     
    unsigned char precision
     
    unsigned char scale
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01044.html000644 025423 025423 00000006632 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsoldmoney Member List

    This is the complete list of members for tdsoldmoney, including all inherited members.

    mnyhigh (defined in tdsoldmoney)tdsoldmoney
    mnylow (defined in tdsoldmoney)tdsoldmoney
    freetds-1.3.6/doc/reference/a01047.html000644 025423 025423 00000007670 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsoldmoney Struct Reference
    FreeTDS API
    tdsoldmoney Struct Reference

    Public Attributes

    TDS_INT mnyhigh
     
    TDS_UINT mnylow
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01048.html000644 025423 025423 00000006611 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsmoney Member List

    This is the complete list of members for tdsmoney, including all inherited members.

    mny (defined in tdsmoney)tdsmoney
    tdsoldmoney (defined in tdsmoney)tdsmoney
    freetds-1.3.6/doc/reference/a01049.dot000644 025423 025423 00000001077 14162303417 020642 0ustar00fredianofrediano000000 000000 digraph "tdsmoney" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tdsmoney",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tdsoldmoney" ,fontname="Helvetica"]; Node2 [label="tdsoldmoney",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01047.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01051.html000644 025423 025423 00000010274 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsmoney Union Reference
    FreeTDS API
    tdsmoney Union Reference
    Collaboration diagram for tdsmoney:

    Public Attributes

    TDS_INT8 mny
     
    TDS_OLD_MONEY tdsoldmoney
     

    The documentation for this union was generated from the following file:
    freetds-1.3.6/doc/reference/a01052.html000644 025423 025423 00000006261 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsmoney4 Member List

    This is the complete list of members for tdsmoney4, including all inherited members.

    mny4 (defined in tdsmoney4)tdsmoney4
    freetds-1.3.6/doc/reference/a01055.html000644 025423 025423 00000007127 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsmoney4 Struct Reference
    FreeTDS API
    tdsmoney4 Struct Reference

    Public Attributes

    TDS_INT mny4
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01056.html000644 025423 025423 00000006631 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsdatetime Member List

    This is the complete list of members for tdsdatetime, including all inherited members.

    dtdays (defined in tdsdatetime)tdsdatetime
    dttime (defined in tdsdatetime)tdsdatetime
    freetds-1.3.6/doc/reference/a01059.html000644 025423 025423 00000007666 14162303417 021033 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsdatetime Struct Reference
    FreeTDS API
    tdsdatetime Struct Reference

    Public Attributes

    TDS_INT dtdays
     
    TDS_INT dttime
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01060.html000644 025423 025423 00000006636 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsdatetime4 Member List

    This is the complete list of members for tdsdatetime4, including all inherited members.

    days (defined in tdsdatetime4)tdsdatetime4
    minutes (defined in tdsdatetime4)tdsdatetime4
    freetds-1.3.6/doc/reference/a01063.html000644 025423 025423 00000007703 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsdatetime4 Struct Reference
    FreeTDS API
    tdsdatetime4 Struct Reference

    Public Attributes

    TDS_USMALLINT days
     
    TDS_USMALLINT minutes
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01064.html000644 025423 025423 00000007512 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsunique Member List

    This is the complete list of members for tdsunique, including all inherited members.

    Data1 (defined in tdsunique)tdsunique
    Data2 (defined in tdsunique)tdsunique
    Data3 (defined in tdsunique)tdsunique
    Data4 (defined in tdsunique)tdsunique
    freetds-1.3.6/doc/reference/a01067.html000644 025423 025423 00000011163 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsunique Struct Reference
    FreeTDS API
    tdsunique Struct Reference

    Public Attributes

    TDS_UINT Data1
     
    TDS_USMALLINT Data2
     
    TDS_USMALLINT Data3
     
    TDS_UCHAR Data4 [8]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01068.html000644 025423 025423 00000007252 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    TDS71_COLLATION Member List

    This is the complete list of members for TDS71_COLLATION, including all inherited members.

    charset_id (defined in TDS71_COLLATION)TDS71_COLLATION
    flags (defined in TDS71_COLLATION)TDS71_COLLATION
    locale_id (defined in TDS71_COLLATION)TDS71_COLLATION
    freetds-1.3.6/doc/reference/a01071.html000644 025423 025423 00000011164 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: TDS71_COLLATION Struct Reference
    FreeTDS API
    TDS71_COLLATION Struct Reference

    TDS 7.1 collation informations. More...

    #include <proto.h>

    Public Attributes

    TDS_UCHAR charset_id
     
    TDS_USMALLINT flags
     
    TDS_USMALLINT locale_id
     

    Detailed Description

    TDS 7.1 collation informations.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01072.html000644 025423 025423 00000010547 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    TDS72_SMP_HEADER Member List

    This is the complete list of members for TDS72_SMP_HEADER, including all inherited members.

    seq (defined in TDS72_SMP_HEADER)TDS72_SMP_HEADER
    sid (defined in TDS72_SMP_HEADER)TDS72_SMP_HEADER
    signature (defined in TDS72_SMP_HEADER)TDS72_SMP_HEADER
    size (defined in TDS72_SMP_HEADER)TDS72_SMP_HEADER
    type (defined in TDS72_SMP_HEADER)TDS72_SMP_HEADER
    wnd (defined in TDS72_SMP_HEADER)TDS72_SMP_HEADER
    freetds-1.3.6/doc/reference/a01075.html000644 025423 025423 00000013146 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: TDS72_SMP_HEADER Struct Reference
    FreeTDS API
    TDS72_SMP_HEADER Struct Reference

    TDS 7.2 SMP packet header. More...

    #include <proto.h>

    Public Attributes

    TDS_UINT seq
     
    TDS_USMALLINT sid
     
    TDS_UCHAR signature
     
    TDS_UINT size
     
    TDS_UCHAR type
     
    TDS_UINT wnd
     

    Detailed Description

    TDS 7.2 SMP packet header.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01076.html000644 025423 025423 00000007131 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    pollfd Member List

    This is the complete list of members for pollfd, including all inherited members.

    events (defined in pollfd)pollfd
    fd (defined in pollfd)pollfd
    revents (defined in pollfd)pollfd
    freetds-1.3.6/doc/reference/a01079.html000644 025423 025423 00000010406 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: pollfd Struct Reference
    FreeTDS API
    pollfd Struct Reference

    Public Attributes

    short events
     
    int fd
     
    short revents
     

    The documentation for this struct was generated from the following file:
    • include/freetds/replacements/poll.h
    freetds-1.3.6/doc/reference/a01080.html000644 025423 025423 00000011441 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_addrinfo Member List

    This is the complete list of members for tds_addrinfo, including all inherited members.

    ai_addr (defined in tds_addrinfo)tds_addrinfo
    ai_addrlen (defined in tds_addrinfo)tds_addrinfo
    ai_canonname (defined in tds_addrinfo)tds_addrinfo
    ai_family (defined in tds_addrinfo)tds_addrinfo
    ai_flags (defined in tds_addrinfo)tds_addrinfo
    ai_next (defined in tds_addrinfo)tds_addrinfo
    ai_protocol (defined in tds_addrinfo)tds_addrinfo
    ai_socktype (defined in tds_addrinfo)tds_addrinfo
    freetds-1.3.6/doc/reference/a01081.dot000644 025423 025423 00000000677 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "tds_addrinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_addrinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ai_next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01083.html000644 025423 025423 00000014400 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_addrinfo Struct Reference
    FreeTDS API
    tds_addrinfo Struct Reference
    Collaboration diagram for tds_addrinfo:

    Public Attributes

    struct sockaddr * ai_addr
     
    size_t ai_addrlen
     
    char * ai_canonname
     
    int ai_family
     
    int ai_flags
     
    struct tds_addrinfoai_next
     
    int ai_protocol
     
    int ai_socktype
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01084.html000644 025423 025423 00000006270 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_input_stream Member List

    This is the complete list of members for tds_input_stream, including all inherited members.

    readtds_input_stream
    freetds-1.3.6/doc/reference/a01087.html000644 025423 025423 00000010460 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_input_stream Struct Reference
    FreeTDS API
    tds_input_stream Struct Reference

    define a stream of data used for input More...

    #include <stream.h>

    Public Attributes

    int(* read )(struct tds_input_stream *stream, void *ptr, size_t len)
     read some data Return 0 if end of stream Return <0 if error (actually not defined)
     

    Detailed Description

    define a stream of data used for input


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01088.html000644 025423 025423 00000007210 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_output_stream Member List

    This is the complete list of members for tds_output_stream, including all inherited members.

    buf_len (defined in tds_output_stream)tds_output_stream
    buffertds_output_stream
    writetds_output_stream
    freetds-1.3.6/doc/reference/a01091.html000644 025423 025423 00000013660 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_output_stream Struct Reference
    FreeTDS API
    tds_output_stream Struct Reference

    define a stream of data used for output More...

    #include <stream.h>

    Public Attributes

    size_t buf_len
     
    char * buffer
     write buffer. More...
     
    int(* write )(struct tds_output_stream *stream, size_t len)
     write len bytes from buffer, return <0 if error or len
     

    Detailed Description

    define a stream of data used for output

    Member Data Documentation

    ◆ buffer

    char* tds_output_stream::buffer

    write buffer.

    client will write data into this buffer. not required that buffer is the result of any alloc function so buffer pointer can point in the middle of another buffer. client will write up to buf_len. client should not cache buffer and buf_len before a call to write as write can change these values.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01092.html000644 025423 025423 00000007236 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_datain_stream Member List

    This is the complete list of members for tds_datain_stream, including all inherited members.

    stream (defined in tds_datain_stream)tds_datain_stream
    tds (defined in tds_datain_stream)tds_datain_stream
    wire_sizetds_datain_stream
    freetds-1.3.6/doc/reference/a01093.dot000644 025423 025423 00000013751 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "tds_datain_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_datain_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="input stream to read data from tds protocol"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node25 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node25 [label="tds_input_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01087.html",tooltip="define a stream of data used for input"]; } freetds-1.3.6/doc/reference/a01095.html000644 025423 025423 00000012214 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_datain_stream Struct Reference
    FreeTDS API
    tds_datain_stream Struct Reference

    input stream to read data from tds protocol More...

    #include <stream.h>

    Collaboration diagram for tds_datain_stream:

    Public Attributes

    TDSINSTREAM stream
     
    TDSSOCKETtds
     
    size_t wire_size
     bytes still to read
     

    Detailed Description

    input stream to read data from tds protocol


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01096.html000644 025423 025423 00000007272 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_dataout_stream Member List

    This is the complete list of members for tds_dataout_stream, including all inherited members.

    stream (defined in tds_dataout_stream)tds_dataout_stream
    tds (defined in tds_dataout_stream)tds_dataout_stream
    written (defined in tds_dataout_stream)tds_dataout_stream
    freetds-1.3.6/doc/reference/a01097.dot000644 025423 025423 00000013755 14162303417 020653 0ustar00fredianofrediano000000 000000 digraph "tds_dataout_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dataout_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="output stream to write data to tds protocol"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node25 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node25 [label="tds_output_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01091.html",tooltip="define a stream of data used for output"]; } freetds-1.3.6/doc/reference/a01099.html000644 025423 025423 00000011673 14162303417 021030 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_dataout_stream Struct Reference
    FreeTDS API
    tds_dataout_stream Struct Reference

    output stream to write data to tds protocol More...

    #include <stream.h>

    Collaboration diagram for tds_dataout_stream:

    Public Attributes

    TDSOUTSTREAM stream
     
    TDSSOCKETtds
     
    size_t written
     

    Detailed Description

    output stream to write data to tds protocol


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01100.html000644 025423 025423 00000007306 14162303417 021005 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_staticin_stream Member List

    This is the complete list of members for tds_staticin_stream, including all inherited members.

    buf_left (defined in tds_staticin_stream)tds_staticin_stream
    buffer (defined in tds_staticin_stream)tds_staticin_stream
    stream (defined in tds_staticin_stream)tds_staticin_stream
    freetds-1.3.6/doc/reference/a01101.dot000644 025423 025423 00000001247 14162303417 020626 0ustar00fredianofrediano000000 000000 digraph "tds_staticin_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_staticin_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="input stream to read data from a static buffer"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node2 [label="tds_input_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01087.html",tooltip="define a stream of data used for input"]; } freetds-1.3.6/doc/reference/a01103.html000644 025423 025423 00000011643 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_staticin_stream Struct Reference
    FreeTDS API
    tds_staticin_stream Struct Reference

    input stream to read data from a static buffer More...

    #include <stream.h>

    Collaboration diagram for tds_staticin_stream:

    Public Attributes

    size_t buf_left
     
    const char * buffer
     
    TDSINSTREAM stream
     

    Detailed Description

    input stream to read data from a static buffer


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01104.html000644 025423 025423 00000006337 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_staticout_stream Member List

    This is the complete list of members for tds_staticout_stream, including all inherited members.

    stream (defined in tds_staticout_stream)tds_staticout_stream
    freetds-1.3.6/doc/reference/a01105.dot000644 025423 025423 00000001254 14162303417 020630 0ustar00fredianofrediano000000 000000 digraph "tds_staticout_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_staticout_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="output stream to write data to a static buffer."]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node2 [label="tds_output_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01091.html",tooltip="define a stream of data used for output"]; } freetds-1.3.6/doc/reference/a01107.html000644 025423 025423 00000010470 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_staticout_stream Struct Reference
    FreeTDS API
    tds_staticout_stream Struct Reference

    output stream to write data to a static buffer. More...

    #include <stream.h>

    Collaboration diagram for tds_staticout_stream:

    Public Attributes

    TDSOUTSTREAM stream
     

    Detailed Description

    output stream to write data to a static buffer.

    stream.buffer contains the pointer where stream will write to.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01108.html000644 025423 025423 00000007541 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_dynamic_stream Member List

    This is the complete list of members for tds_dynamic_stream, including all inherited members.

    allocatedtds_dynamic_stream
    buftds_dynamic_stream
    sizetds_dynamic_stream
    stream (defined in tds_dynamic_stream)tds_dynamic_stream
    freetds-1.3.6/doc/reference/a01109.dot000644 025423 025423 00000001250 14162303417 020630 0ustar00fredianofrediano000000 000000 digraph "tds_dynamic_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_dynamic_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="output stream to write data to a dynamic buffer"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" stream" ,fontname="Helvetica"]; Node2 [label="tds_output_stream",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01091.html",tooltip="define a stream of data used for output"]; } freetds-1.3.6/doc/reference/a01111.html000644 025423 025423 00000013601 14162303417 021002 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_dynamic_stream Struct Reference
    FreeTDS API
    tds_dynamic_stream Struct Reference

    output stream to write data to a dynamic buffer More...

    #include <stream.h>

    Collaboration diagram for tds_dynamic_stream:

    Public Attributes

    size_t allocated
     currently allocated buffer
     
    void ** buf
     where is stored the pointer
     
    size_t size
     size of data inside buffer
     
    TDSOUTSTREAM stream
     

    Detailed Description

    output stream to write data to a dynamic buffer


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01112.html000644 025423 025423 00000015372 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_compiletime_settings Member List
    freetds-1.3.6/doc/reference/a01115.html000644 025423 025423 00000021426 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_compiletime_settings Struct Reference
    FreeTDS API
    tds_compiletime_settings Struct Reference

    A structure to hold all the compile-time settings. More...

    #include <tds.h>

    Public Attributes

    const char * freetds_version
     
    bool gnutls
     
    bool iodbc
     
    bool kerberos
     
    const char * last_update
     
    bool libiconv
     
    bool mars
     
    bool msdblib
     
    bool openssl
     
    bool sspi
     
    bool sybase_compat
     
    const char * sysconfdir
     
    const char * tdsver
     
    bool threadsafe
     
    bool unixodbc
     

    Detailed Description

    A structure to hold all the compile-time settings.

    This structure is returned by tds_get_compiletime_settings


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01116.html000644 025423 025423 00000011416 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    TDS_DATETIMEALL Member List

    This is the complete list of members for TDS_DATETIMEALL, including all inherited members.

    _tds_reserved (defined in TDS_DATETIMEALL)TDS_DATETIMEALL
    dateTDS_DATETIMEALL
    has_date (defined in TDS_DATETIMEALL)TDS_DATETIMEALL
    has_offset (defined in TDS_DATETIMEALL)TDS_DATETIMEALL
    has_time (defined in TDS_DATETIMEALL)TDS_DATETIMEALL
    offsetTDS_DATETIMEALL
    timeTDS_DATETIMEALL
    time_prec (defined in TDS_DATETIMEALL)TDS_DATETIMEALL
    freetds-1.3.6/doc/reference/a01119.html000644 025423 025423 00000016115 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: TDS_DATETIMEALL Struct Reference
    FreeTDS API
    TDS_DATETIMEALL Struct Reference

    this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information. More...

    #include <tds.h>

    Public Attributes

    TDS_USMALLINT _tds_reserved:10
     
    TDS_INT date
     date, 0 = 1900-01-01
     
    TDS_USMALLINT has_date:1
     
    TDS_USMALLINT has_offset:1
     
    TDS_USMALLINT has_time:1
     
    TDS_SMALLINT offset
     time offset
     
    TDS_UINT8 time
     time, 7 digit precision
     
    TDS_USMALLINT time_prec:3
     

    Detailed Description

    this structure is not directed connected to a TDS protocol but keeps any DATE/TIME information.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01120.html000644 025423 025423 00000012363 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsdaterec Member List
    freetds-1.3.6/doc/reference/a01123.html000644 025423 025423 00000022747 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsdaterec Struct Reference
    FreeTDS API
    tdsdaterec Struct Reference

    Used by tds_datecrack. More...

    #include <tds.h>

    Public Attributes

    TDS_INT day
     day of month (1-31)
     
    TDS_INT dayofyear
     day of year (1-366)
     
    TDS_INT decimicrosecond
     0-9999999
     
    TDS_INT hour
     0-23
     
    TDS_INT minute
     0-59
     
    TDS_INT month
     month number (0-11)
     
    TDS_INT quarter
     quarter (0-3)
     
    TDS_INT second
     0-59
     
    TDS_INT timezone
     -840 - 840 minutes from UTC
     
    TDS_INT weekday
     day of week (0-6, 0 = sunday)
     
    TDS_INT year
     year
     

    Detailed Description

    Used by tds_datecrack.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01124.html000644 025423 025423 00000007216 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_option_arg Member List

    This is the complete list of members for tds_option_arg, including all inherited members.

    c (defined in tds_option_arg)tds_option_arg
    i (defined in tds_option_arg)tds_option_arg
    ti (defined in tds_option_arg)tds_option_arg
    freetds-1.3.6/doc/reference/a01127.html000644 025423 025423 00000010411 14162303417 021005 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_option_arg Union Reference
    FreeTDS API
    tds_option_arg Union Reference

    Public Attributes

    TDS_CHAR * c
     
    TDS_INT i
     
    TDS_TINYINT ti
     

    The documentation for this union was generated from the following file:
    freetds-1.3.6/doc/reference/a01128.html000644 025423 025423 00000007236 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_align_struct Member List

    This is the complete list of members for tds_align_struct, including all inherited members.

    i (defined in tds_align_struct)tds_align_struct
    p (defined in tds_align_struct)tds_align_struct
    ui (defined in tds_align_struct)tds_align_struct
    freetds-1.3.6/doc/reference/a01131.html000644 025423 025423 00000010401 14162303417 020777 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_align_struct Union Reference
    FreeTDS API
    tds_align_struct Union Reference

    Public Attributes

    int i
     
    void * p
     
    int64_t ui
     

    The documentation for this union was generated from the following file:
    freetds-1.3.6/doc/reference/a01132.html000644 025423 025423 00000007277 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_capability_type Member List

    This is the complete list of members for tds_capability_type, including all inherited members.

    len (defined in tds_capability_type)tds_capability_type
    type (defined in tds_capability_type)tds_capability_type
    values (defined in tds_capability_type)tds_capability_type
    freetds-1.3.6/doc/reference/a01135.html000644 025423 025423 00000010503 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_capability_type Struct Reference
    FreeTDS API
    tds_capability_type Struct Reference

    Public Attributes

    unsigned char len
     
    unsigned char type
     
    unsigned char values [TDS_MAX_CAPABILITY/2-2]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01136.html000644 025423 025423 00000006316 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_capabilities Member List

    This is the complete list of members for tds_capabilities, including all inherited members.

    types (defined in tds_capabilities)tds_capabilities
    freetds-1.3.6/doc/reference/a01137.dot000644 025423 025423 00000001121 14162303417 020626 0ustar00fredianofrediano000000 000000 digraph "tds_capabilities" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_capabilities",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" types" ,fontname="Helvetica"]; Node2 [label="tds_capability_type",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01135.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01139.html000644 025423 025423 00000007602 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_capabilities Struct Reference
    FreeTDS API
    tds_capabilities Struct Reference
    Collaboration diagram for tds_capabilities:

    Public Attributes

    TDS_CAPABILITY_TYPE types [2]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01140.html000644 025423 025423 00000033110 14162303417 021001 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_login Member List

    This is the complete list of members for tds_login, including all inherited members.

    app_name (defined in tds_login)tds_login
    block_size (defined in tds_login)tds_login
    bulk_copytds_login
    cafiletds_login
    capabilities (defined in tds_login)tds_login
    check_ssl_hostname (defined in tds_login)tds_login
    client_charset (defined in tds_login)tds_login
    client_host_name (defined in tds_login)tds_login
    connect_timeout (defined in tds_login)tds_login
    crlfiletds_login
    database (defined in tds_login)tds_login
    db_filenametds_login
    debug_flags (defined in tds_login)tds_login
    dump_file (defined in tds_login)tds_login
    enable_tls_v1 (defined in tds_login)tds_login
    encryption_level (defined in tds_login)tds_login
    gssapi_use_delegation (defined in tds_login)tds_login
    instance_name (defined in tds_login)tds_login
    ip_addrstds_login
    language (defined in tds_login)tds_login
    library (defined in tds_login)tds_login
    mars (defined in tds_login)tds_login
    mutual_authentication (defined in tds_login)tds_login
    new_passwordtds_login
    openssl_ciphers (defined in tds_login)tds_login
    option_flag2 (defined in tds_login)tds_login
    passwordtds_login
    porttds_login
    query_timeout (defined in tds_login)tds_login
    readonly_intent (defined in tds_login)tds_login
    routing_address (defined in tds_login)tds_login
    routing_port (defined in tds_login)tds_login
    server_charsettds_login
    server_host_name (defined in tds_login)tds_login
    server_is_valid (defined in tds_login)tds_login
    server_nametds_login
    server_realm_nametds_login
    server_spntds_login
    suppress_language (defined in tds_login)tds_login
    tds_versiontds_login
    text_size (defined in tds_login)tds_login
    use_lanman (defined in tds_login)tds_login
    use_new_password (defined in tds_login)tds_login
    use_ntlmv2 (defined in tds_login)tds_login
    use_ntlmv2_specified (defined in tds_login)tds_login
    use_utf16 (defined in tds_login)tds_login
    user_nametds_login
    valid_configuration (defined in tds_login)tds_login
    freetds-1.3.6/doc/reference/a01141.dot000644 025423 025423 00000002316 14162303417 020630 0ustar00fredianofrediano000000 000000 digraph "tds_login" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node2 [label="tds_capabilities",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" types" ,fontname="Helvetica"]; Node3 [label="tds_capability_type",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01135.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node4 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; } freetds-1.3.6/doc/reference/a01143.html000644 025423 025423 00000062101 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_login Struct Reference
    FreeTDS API
    tds_login Struct Reference
    Collaboration diagram for tds_login:

    Public Attributes

    DSTR app_name
     
    int block_size
     
    unsigned int bulk_copy:1
     if bulk copy should be enabled
     
    DSTR cafile
     certificate authorities file
     
    TDS_CAPABILITIES capabilities
     
    unsigned int check_ssl_hostname:1
     
    DSTR client_charset
     
    DSTR client_host_name
     
    TDS_INT connect_timeout
     
    DSTR crlfile
     certificate revocation file
     
    DSTR database
     
    DSTR db_filename
     database filename to attach (MSSQL)
     
    int debug_flags
     
    DSTR dump_file
     
    unsigned int enable_tls_v1:1
     
    TDS_TINYINT encryption_level
     
    unsigned int gssapi_use_delegation:1
     
    DSTR instance_name
     
    struct addrinfo * ip_addrs
     ip(s) of server
     
    DSTR language
     
    DSTR library
     
    unsigned int mars:1
     
    unsigned int mutual_authentication:1
     
    DSTR new_password
     new password to set (TDS 7.2+)
     
    DSTR openssl_ciphers
     
    unsigned char option_flag2
     
    DSTR password
     password of account login
     
    int port
     port of database service
     
    TDS_INT query_timeout
     
    unsigned int readonly_intent:1
     
    DSTR routing_address
     
    uint16_t routing_port
     
    DSTR server_charset
     charset of server e.g. More...
     
    DSTR server_host_name
     
    unsigned int server_is_valid:1
     
    DSTR server_name
     server name (in freetds.conf)
     
    DSTR server_realm_name
     server realm name (in freetds.conf)
     
    DSTR server_spn
     server SPN (in freetds.conf)
     
    unsigned int suppress_language:1
     
    TDS_USMALLINT tds_version
     TDS version.
     
    int text_size
     
    unsigned int use_lanman:1
     
    unsigned int use_new_password:1
     
    unsigned int use_ntlmv2:1
     
    unsigned int use_ntlmv2_specified:1
     
    unsigned int use_utf16:1
     
    DSTR user_name
     account for login
     
    unsigned int valid_configuration:1
     

    Member Data Documentation

    ◆ server_charset

    DSTR tds_login::server_charset

    charset of server e.g.

    iso_1


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01144.html000644 025423 025423 00000007220 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_headers Member List

    This is the complete list of members for tds_headers, including all inherited members.

    qn_msgtext (defined in tds_headers)tds_headers
    qn_options (defined in tds_headers)tds_headers
    qn_timeout (defined in tds_headers)tds_headers
    freetds-1.3.6/doc/reference/a01147.html000644 025423 025423 00000010443 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_headers Struct Reference
    FreeTDS API
    tds_headers Struct Reference

    Public Attributes

    const char * qn_msgtext
     
    const char * qn_options
     
    TDS_INT qn_timeout
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01148.html000644 025423 025423 00000007210 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_locale Member List

    This is the complete list of members for tds_locale, including all inherited members.

    date_fmt (defined in tds_locale)tds_locale
    language (defined in tds_locale)tds_locale
    server_charset (defined in tds_locale)tds_locale
    freetds-1.3.6/doc/reference/a01151.html000644 025423 025423 00000010424 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_locale Struct Reference
    FreeTDS API
    tds_locale Struct Reference

    Public Attributes

    char * date_fmt
     
    char * language
     
    char * server_charset
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01152.html000644 025423 025423 00000007516 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_blob Member List

    This is the complete list of members for tds_blob, including all inherited members.

    textptr (defined in tds_blob)tds_blob
    textvalue (defined in tds_blob)tds_blob
    timestamp (defined in tds_blob)tds_blob
    valid_ptr (defined in tds_blob)tds_blob
    freetds-1.3.6/doc/reference/a01155.html000644 025423 025423 00000011776 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_blob Struct Reference
    FreeTDS API
    tds_blob Struct Reference

    Information about blobs (e.g. More...

    #include <tds.h>

    Public Attributes

    TDS_CHAR textptr [16]
     
    TDS_CHAR * textvalue
     
    TDS_CHAR timestamp [8]
     
    unsigned char valid_ptr
     

    Detailed Description

    Information about blobs (e.g.

    text or image). current_row contains this structure.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01156.html000644 025423 025423 00000010114 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_variant Member List

    This is the complete list of members for tds_variant, including all inherited members.

    collation (defined in tds_variant)tds_variant
    data (defined in tds_variant)tds_variant
    data_len (defined in tds_variant)tds_variant
    size (defined in tds_variant)tds_variant
    type (defined in tds_variant)tds_variant
    freetds-1.3.6/doc/reference/a01159.html000644 025423 025423 00000012416 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_variant Struct Reference
    FreeTDS API
    tds_variant Struct Reference

    Store variant informations. More...

    #include <tds.h>

    Public Attributes

    TDS_UCHAR collation [5]
     
    TDS_CHAR * data
     
    TDS_INT data_len
     
    TDS_INT size
     
    TDS_SERVER_TYPE type
     

    Detailed Description

    Store variant informations.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01160.html000644 025423 025423 00000007541 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_encoding Member List

    This is the complete list of members for tds_encoding, including all inherited members.

    canonictds_encoding
    max_bytes_per_char (defined in tds_encoding)tds_encoding
    min_bytes_per_char (defined in tds_encoding)tds_encoding
    nametds_encoding
    freetds-1.3.6/doc/reference/a01163.html000644 025423 025423 00000013004 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_encoding Struct Reference
    FreeTDS API
    tds_encoding Struct Reference

    Information relevant to libiconv. More...

    #include <tds.h>

    Public Attributes

    unsigned char canonic
     internal numeric index into array of all encodings
     
    unsigned char max_bytes_per_char
     
    unsigned char min_bytes_per_char
     
    const char * name
     name of the encoding (ie UTF-8)
     

    Detailed Description

    Information relevant to libiconv.

    The name is an iconv name, not the same as found in master..syslanguages.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01164.html000644 025423 025423 00000007234 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_bcpcoldata Member List

    This is the complete list of members for tds_bcpcoldata, including all inherited members.

    data (defined in tds_bcpcoldata)tds_bcpcoldata
    datalen (defined in tds_bcpcoldata)tds_bcpcoldata
    is_null (defined in tds_bcpcoldata)tds_bcpcoldata
    freetds-1.3.6/doc/reference/a01167.html000644 025423 025423 00000010424 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_bcpcoldata Struct Reference
    FreeTDS API
    tds_bcpcoldata Struct Reference

    Public Attributes

    TDS_UCHAR * data
     
    TDS_INT datalen
     
    bool is_null
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01168.html000644 025423 025423 00000010150 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_column_funcs Member List

    This is the complete list of members for tds_column_funcs, including all inherited members.

    get_data (defined in tds_column_funcs)tds_column_funcs
    get_info (defined in tds_column_funcs)tds_column_funcs
    put_datatds_column_funcs
    put_infotds_column_funcs
    row_len (defined in tds_column_funcs)tds_column_funcs
    freetds-1.3.6/doc/reference/a01171.html000644 025423 025423 00000016354 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_column_funcs Struct Reference
    FreeTDS API
    tds_column_funcs Struct Reference

    Public Attributes

    tds_func_get_data * get_data
     
    tds_func_get_info * get_info
     
    tds_func_put_data * put_data
     Send column data to server. More...
     
    tds_func_put_info * put_info
     Send metadata column information to server. More...
     
    tds_func_row_len * row_len
     

    Member Data Documentation

    ◆ put_data

    tds_func_put_data* tds_column_funcs::put_data

    Send column data to server.

    Usually send parameters unless bcp7 is specified, in this case send BCP for TDS7+ (Sybase use a completely different format for BCP)

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    colcolumn to send
    bcp71 to send BCP column on TDS7+

    ◆ put_info

    tds_func_put_info* tds_column_funcs::put_info

    Send metadata column information to server.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    colcolumn to send

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01172.html000644 025423 025423 00000030721 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_column Member List

    This is the complete list of members for tds_column, including all inherited members.

    bcp_column_data (defined in tds_column)tds_column
    bcp_prefix_lentds_column
    bcp_term_len (defined in tds_column)tds_column
    bcp_terminator (defined in tds_column)tds_column
    char_convtds_column
    column_bindfmt (defined in tds_column)tds_column
    column_bindlen (defined in tds_column)tds_column
    column_bindtype (defined in tds_column)tds_column
    column_collation (defined in tds_column)tds_column
    column_computed (defined in tds_column)tds_column
    column_cur_sizetds_column
    column_data (defined in tds_column)tds_column
    column_data_free (defined in tds_column)tds_column
    column_flags (defined in tds_column)tds_column
    column_hidden (defined in tds_column)tds_column
    column_iconv_buf (defined in tds_column)tds_column
    column_iconv_left (defined in tds_column)tds_column
    column_identity (defined in tds_column)tds_column
    column_key (defined in tds_column)tds_column
    column_lenbind (defined in tds_column)tds_column
    column_name (defined in tds_column)tds_column
    column_nullable (defined in tds_column)tds_column
    column_nullbind (defined in tds_column)tds_column
    column_operand (defined in tds_column)tds_column
    column_operator (defined in tds_column)tds_column
    column_output (defined in tds_column)tds_column
    column_prectds_column
    column_scaletds_column
    column_sizetds_column
    column_text_sqlgetdatapos (defined in tds_column)tds_column
    column_text_sqlputdatainfo (defined in tds_column)tds_column
    column_textpos (defined in tds_column)tds_column
    column_timestamp (defined in tds_column)tds_column
    column_typetds_column
    column_usertype (defined in tds_column)tds_column
    column_varaddr (defined in tds_column)tds_column
    column_varint_sizetds_column
    column_writeable (defined in tds_column)tds_column
    funcs (defined in tds_column)tds_column
    on_server (defined in tds_column)tds_column
    table_column_name (defined in tds_column)tds_column
    table_name (defined in tds_column)tds_column
    freetds-1.3.6/doc/reference/a01173.dot000644 025423 025423 00000004311 14162303417 020632 0ustar00fredianofrediano000000 000000 digraph "tds_column" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_column",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Metadata about columns in regular and compute rows."]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node2 [label="tdsiconvinfo",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" suppress" ,fontname="Helvetica"]; Node3 [label="tds_errno_message_flags",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00975.html",tooltip=" "]; Node4 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" from" ,fontname="Helvetica"]; Node4 [label="tdsiconvdir",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00979.html",tooltip=" "]; Node5 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" charset" ,fontname="Helvetica"]; Node5 [label="tds_encoding",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01163.html",tooltip="Information relevant to libiconv."]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" funcs" ,fontname="Helvetica"]; Node7 [label="tds_column_funcs",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01171.html",tooltip=" "]; Node8 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcp_column_data" ,fontname="Helvetica"]; Node8 [label="tds_bcpcoldata",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01167.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01175.html000644 025423 025423 00000057667 14162303417 021040 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_column Struct Reference
    FreeTDS API
    tds_column Struct Reference

    Metadata about columns in regular and compute rows. More...

    #include <tds.h>

    Collaboration diagram for tds_column:

    Public Attributes

    BCPCOLDATAbcp_column_data
     
    TDS_INT bcp_prefix_len
     The length, in bytes, of any length prefix this column may have. More...
     
    TDS_INT bcp_term_len
     
    TDS_CHAR * bcp_terminator
     
    TDSICONVchar_conv
     refers to previously allocated iconv information
     
    TDS_SMALLINT column_bindfmt
     
    TDS_UINT column_bindlen
     
    TDS_SMALLINT column_bindtype
     
    TDS_UCHAR column_collation [5]
     
    unsigned char column_computed:1
     
    TDS_INT column_cur_size
     size written in variable (ie: char, text, binary). More...
     
    unsigned char * column_data
     
    void(* column_data_free )(struct tds_column *column)
     
    TDS_INT column_flags
     
    unsigned char column_hidden:1
     
    char column_iconv_buf [9]
     
    unsigned char column_iconv_left
     
    unsigned char column_identity:1
     
    unsigned char column_key:1
     
    TDS_INT * column_lenbind
     
    DSTR column_name
     
    unsigned char column_nullable:1
     
    TDS_SMALLINT * column_nullbind
     
    TDS_SMALLINT column_operand
     
    TDS_TINYINT column_operator
     
    unsigned char column_output:1
     
    TDS_TINYINT column_prec
     precision for decimal/numeric
     
    TDS_TINYINT column_scale
     scale for decimal/numeric
     
    TDS_INT column_size
     maximun size of data. More...
     
    TDS_INT column_text_sqlgetdatapos
     
    TDS_CHAR column_text_sqlputdatainfo
     
    TDS_INT column_textpos
     
    unsigned char column_timestamp:1
     
    TDS_SERVER_TYPE column_type
     This type can be different from wire type because conversion (e.g. More...
     
    TDS_INT column_usertype
     
    TDS_CHAR * column_varaddr
     
    TDS_TINYINT column_varint_size
     size of length when reading from wire (0, 1, 2 or 4)
     
    unsigned char column_writeable:1
     
    const TDSCOLUMNFUNCSfuncs
     
    struct {
       TDS_INT   column_size
     
       TDS_SERVER_TYPE   column_type
     type of data, saved from wire
     
    on_server
     
    DSTR table_column_name
     
    DSTR table_name
     

    Detailed Description

    Metadata about columns in regular and compute rows.

    Member Data Documentation

    ◆ bcp_prefix_len

    TDS_INT tds_column::bcp_prefix_len

    The length, in bytes, of any length prefix this column may have.

    For example, strings in some non-C programming languages are made up of a one-byte length prefix, followed by the string data itself. If the data do not have a length prefix, set prefixlen to 0. Currently not very used in code, however do not remove.

    ◆ column_cur_size

    TDS_INT tds_column::column_cur_size

    size written in variable (ie: char, text, binary).

    -1 if NULL.

    ◆ column_size

    TDS_INT tds_column::column_size

    maximun size of data.

    For fixed is the size.

    ◆ column_type

    TDS_SERVER_TYPE tds_column::column_type

    This type can be different from wire type because conversion (e.g.

    type of data, saved from wire

    UCS-2->Ascii) can be applied. I'm beginning to wonder about the wisdom of this, however. April 2003 jkl


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01180.html000644 025423 025423 00000013423 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_result_info Member List

    This is the complete list of members for tds_result_info, including all inherited members.

    attached_to (defined in tds_result_info)tds_result_info
    by_cols (defined in tds_result_info)tds_result_info
    bycolumns (defined in tds_result_info)tds_result_info
    columns (defined in tds_result_info)tds_result_info
    computeid (defined in tds_result_info)tds_result_info
    current_row (defined in tds_result_info)tds_result_info
    more_results (defined in tds_result_info)tds_result_info
    num_cols (defined in tds_result_info)tds_result_info
    ref_count (defined in tds_result_info)tds_result_info
    row_free (defined in tds_result_info)tds_result_info
    row_size (defined in tds_result_info)tds_result_info
    rows_exist (defined in tds_result_info)tds_result_info
    freetds-1.3.6/doc/reference/a01181.dot000644 025423 025423 00000014743 14162303417 020643 0ustar00fredianofrediano000000 000000 digraph "tds_result_info" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Hold information for any results."]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node1 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node1 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node9 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node10 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node10 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node1 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node11 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node11 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node12 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node12 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node13 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node13 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node14 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node14 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node16 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node16 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node17 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node17 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node9 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node21 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node21 [label="tds_column",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node17 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node6 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node22 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" funcs" ,fontname="Helvetica"]; Node22 [label="tds_column_funcs",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01171.html",tooltip=" "]; Node23 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcp_column_data" ,fontname="Helvetica"]; Node23 [label="tds_bcpcoldata",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01167.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01183.html000644 025423 025423 00000020126 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_result_info Struct Reference
    FreeTDS API
    tds_result_info Struct Reference

    Hold information for any results. More...

    #include <tds.h>

    Collaboration diagram for tds_result_info:

    Public Attributes

    TDSSOCKETattached_to
     
    TDS_USMALLINT by_cols
     
    TDS_SMALLINT * bycolumns
     
    TDSCOLUMN ** columns
     
    TDS_USMALLINT computeid
     
    unsigned char * current_row
     
    bool more_results
     
    TDS_USMALLINT num_cols
     
    TDS_INT ref_count
     
    void(* row_free )(struct tds_result_info *result, unsigned char *row)
     
    TDS_INT row_size
     
    bool rows_exist
     

    Detailed Description

    Hold information for any results.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01184.html000644 025423 025423 00000012317 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_message Member List

    This is the complete list of members for tds_message, including all inherited members.

    line_number (defined in tds_message)tds_message
    message (defined in tds_message)tds_message
    msgno (defined in tds_message)tds_message
    oserr (defined in tds_message)tds_message
    priv_msg_type (defined in tds_message)tds_message
    proc_name (defined in tds_message)tds_message
    server (defined in tds_message)tds_message
    severity (defined in tds_message)tds_message
    sql_state (defined in tds_message)tds_message
    state (defined in tds_message)tds_message
    freetds-1.3.6/doc/reference/a01187.html000644 025423 025423 00000015243 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_message Struct Reference
    FreeTDS API
    tds_message Struct Reference

    Public Attributes

    TDS_INT line_number
     
    TDS_CHAR * message
     
    TDS_INT msgno
     
    int oserr
     
    TDS_TINYINT priv_msg_type
     
    TDS_CHAR * proc_name
     
    TDS_CHAR * server
     
    TDS_TINYINT severity
     
    TDS_CHAR * sql_state
     
    TDS_SMALLINT state
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01188.html000644 025423 025423 00000007215 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_upd_col Member List

    This is the complete list of members for tds_upd_col, including all inherited members.

    colnamelength (defined in tds_upd_col)tds_upd_col
    columnname (defined in tds_upd_col)tds_upd_col
    next (defined in tds_upd_col)tds_upd_col
    freetds-1.3.6/doc/reference/a01189.dot000644 025423 025423 00000000672 14162303417 020647 0ustar00fredianofrediano000000 000000 digraph "tds_upd_col" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_upd_col",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01191.html000644 025423 025423 00000011053 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_upd_col Struct Reference
    FreeTDS API
    tds_upd_col Struct Reference
    Collaboration diagram for tds_upd_col:

    Public Attributes

    TDS_INT colnamelength
     
    char * columnname
     
    struct tds_upd_colnext
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01192.html000644 025423 025423 00000010601 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_cursor_status Member List

    This is the complete list of members for tds_cursor_status, including all inherited members.

    close (defined in tds_cursor_status)tds_cursor_status
    cursor_row (defined in tds_cursor_status)tds_cursor_status
    dealloc (defined in tds_cursor_status)tds_cursor_status
    declare (defined in tds_cursor_status)tds_cursor_status
    fetch (defined in tds_cursor_status)tds_cursor_status
    open (defined in tds_cursor_status)tds_cursor_status
    freetds-1.3.6/doc/reference/a01195.html000644 025423 025423 00000012534 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_cursor_status Struct Reference
    FreeTDS API
    tds_cursor_status Struct Reference

    Public Attributes

    TDS_CURSOR_STATE close
     
    TDS_CURSOR_STATE cursor_row
     
    TDS_CURSOR_STATE dealloc
     
    TDS_CURSOR_STATE declare
     
    TDS_CURSOR_STATE fetch
     
    TDS_CURSOR_STATE open
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01196.html000644 025423 025423 00000013333 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_cursor Member List
    freetds-1.3.6/doc/reference/a01197.dot000644 025423 025423 00000012062 14162303417 020642 0ustar00fredianofrediano000000 000000 digraph "tds_cursor" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Holds informations about a cursor."]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node2 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node3 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node3 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node4 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node5 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node5 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node8 -> Node5 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node8 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node9 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node9 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node10 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node10 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node10 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node3 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node3 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node1 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node11 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node11 [label="tds_connection",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node9 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node10 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node17 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node17 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node1 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node21 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node21 [label="tds_column",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node17 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node8 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node22 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" funcs" ,fontname="Helvetica"]; Node22 [label="tds_column_funcs",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01171.html",tooltip=" "]; Node23 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcp_column_data" ,fontname="Helvetica"]; Node23 [label="tds_bcpcoldata",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01167.html",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01199.html000644 025423 025423 00000026242 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_cursor Struct Reference
    FreeTDS API
    tds_cursor Struct Reference

    Holds informations about a cursor. More...

    #include <tds.h>

    Collaboration diagram for tds_cursor:

    Public Attributes

    TDS_INT concurrency
     
    TDS_INT cursor_id
     cursor id returned by the server after cursor declare
     
    char * cursor_name
     name of the cursor
     
    TDS_INT cursor_rows
     < number of updatable columns More...
     
    bool defer_close
     true if cursor was marker to be closed when connection is idle
     
    struct tds_cursornext
     next in linked list, keep first
     
    TDS_TINYINT options
     read only|updatable TODO use it
     
    char * query
     SQL query.
     
    TDS_INT ref_count
     reference counter so client can retain safely a pointer
     
    TDSRESULTINFOres_info
     
    TDS_USMALLINT srv_status
     
    TDS_CURSOR_STATUS status
     cursor parameter
     
    TDS_INT type
     row fetched from this cursor
     

    Detailed Description

    Holds informations about a cursor.

    Member Data Documentation

    ◆ cursor_rows

    TDS_INT tds_cursor::cursor_rows

    < number of updatable columns

    < updatable column list number of cursor rows to fetch


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01200.html000644 025423 025423 00000007437 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_env Member List

    This is the complete list of members for tds_env, including all inherited members.

    block_sizetds_env
    charsettds_env
    databasetds_env
    language (defined in tds_env)tds_env
    freetds-1.3.6/doc/reference/a01203.html000644 025423 025423 00000013077 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_env Struct Reference
    FreeTDS API
    tds_env Struct Reference

    Current environment as reported by the server. More...

    #include <tds.h>

    Public Attributes

    int block_size
     packet size (512-65535)
     
    char * charset
     character set encoding
     
    char * database
     database name
     
    char * language
     

    Detailed Description

    Current environment as reported by the server.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01204.html000644 025423 025423 00000011524 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_dynamic Member List
    freetds-1.3.6/doc/reference/a01205.dot000644 025423 025423 00000011453 14162303417 020633 0ustar00fredianofrediano000000 000000 digraph "tds_dynamic" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Holds information for a dynamic (also called prepared) query."]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node2 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node3 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node4 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node7 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node7 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node8 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node8 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node1 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node9 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node9 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node11 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node11 [label="tds_connection",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node8 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node1 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node17 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node17 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node9 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node21 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node21 [label="tds_column",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node17 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node7 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node22 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" funcs" ,fontname="Helvetica"]; Node22 [label="tds_column_funcs",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01171.html",tooltip=" "]; Node23 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcp_column_data" ,fontname="Helvetica"]; Node23 [label="tds_bcpcoldata",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01167.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01207.html000644 025423 025423 00000026005 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_dynamic Struct Reference
    FreeTDS API
    tds_dynamic Struct Reference

    Holds information for a dynamic (also called prepared) query. More...

    #include <tds.h>

    Collaboration diagram for tds_dynamic:

    Public Attributes

    bool defer_close
     true if dynamic was marker to be closed when connection is idle
     
    TDS_TINYINT emulated
     this dynamic query cannot be prepared so libTDS have to construct a simple query. More...
     
    char id [30]
     id of dynamic. More...
     
    struct tds_dynamicnext
     next in linked list, keep first
     
    TDS_INT num_id
     numeric id for mssql7+
     
    TDSPARAMINFOparams
     query parameters. More...
     
    char * query
     saved query, we need to know original query if prepare is impossible
     
    TDS_INT ref_count
     reference counter so client can retain safely a pointer
     
    TDSPARAMINFOres_info
     query results
     

    Detailed Description

    Holds information for a dynamic (also called prepared) query.

    Member Data Documentation

    ◆ emulated

    TDS_TINYINT tds_dynamic::emulated

    this dynamic query cannot be prepared so libTDS have to construct a simple query.

    This can happen for instance is tds protocol doesn't support dynamics or trying to prepare query under Sybase that have BLOBs as parameters.

    ◆ id

    char tds_dynamic::id[30]

    id of dynamic.

    Usually this id correspond to server one but if not specified is generated automatically by libTDS

    ◆ params

    TDSPARAMINFO* tds_dynamic::params

    query parameters.

    Mostly used executing query however is a good idea to prepare query again if parameter type change in an incompatible way (ie different types or larger size). Is also better to prepare a query knowing parameter types earlier.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01208.html000644 025423 025423 00000006634 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_multiple Member List

    This is the complete list of members for tds_multiple, including all inherited members.

    flags (defined in tds_multiple)tds_multiple
    type (defined in tds_multiple)tds_multiple
    freetds-1.3.6/doc/reference/a01211.html000644 025423 025423 00000007702 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_multiple Struct Reference
    FreeTDS API
    tds_multiple Struct Reference

    Public Attributes

    unsigned int flags
     
    TDS_MULTIPLE_TYPE type
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01212.html000644 025423 025423 00000010506 14162303417 021005 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_context Member List

    This is the complete list of members for tds_context, including all inherited members.

    err_handler (defined in tds_context)tds_context
    int_handler (defined in tds_context)tds_context
    locale (defined in tds_context)tds_context
    money_use_2_digits (defined in tds_context)tds_context
    msg_handler (defined in tds_context)tds_context
    parent (defined in tds_context)tds_context
    freetds-1.3.6/doc/reference/a01213.dot000644 025423 025423 00000001077 14162303417 020633 0ustar00fredianofrediano000000 000000 digraph "tds_context" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node2 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01215.html000644 025423 025423 00000013600 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_context Struct Reference
    FreeTDS API
    tds_context Struct Reference
    Collaboration diagram for tds_context:

    Public Attributes

    int(* err_handler )(const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *)
     
    int(* int_handler )(void *)
     
    TDSLOCALElocale
     
    bool money_use_2_digits
     
    int(* msg_handler )(const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *)
     
    void * parent
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01216.html000644 025423 025423 00000010252 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_authentication Member List

    This is the complete list of members for tds_authentication, including all inherited members.

    free (defined in tds_authentication)tds_authentication
    handle_next (defined in tds_authentication)tds_authentication
    msg_type (defined in tds_authentication)tds_authentication
    packet (defined in tds_authentication)tds_authentication
    packet_len (defined in tds_authentication)tds_authentication
    freetds-1.3.6/doc/reference/a01219.html000644 025423 025423 00000012342 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_authentication Struct Reference
    FreeTDS API
    tds_authentication Struct Reference

    Public Attributes

    TDSRET(* free )(TDSCONNECTION *conn, struct tds_authentication *auth)
     
    TDSRET(* handle_next )(TDSSOCKET *tds, struct tds_authentication *auth, size_t len)
     
    uint16_t msg_type
     
    uint8_t * packet
     
    int packet_len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01220.html000644 025423 025423 00000010056 14162303417 021004 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_packet Member List

    This is the complete list of members for tds_packet, including all inherited members.

    buf (defined in tds_packet)tds_packet
    capacity (defined in tds_packet)tds_packet
    data_lentds_packet
    next (defined in tds_packet)tds_packet
    sid (defined in tds_packet)tds_packet
    freetds-1.3.6/doc/reference/a01221.dot000644 025423 025423 00000000670 14162303417 020630 0ustar00fredianofrediano000000 000000 digraph "tds_packet" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01223.html000644 025423 025423 00000012726 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_packet Struct Reference
    FreeTDS API
    tds_packet Struct Reference
    Collaboration diagram for tds_packet:

    Public Attributes

    unsigned char buf [1]
     
    unsigned capacity
     
    unsigned data_len
     data length, this does not account SMP header, only TDS part
     
    struct tds_packetnext
     
    uint16_t sid
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01224.html000644 025423 025423 00000006667 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_poll_wakeup Member List

    This is the complete list of members for tds_poll_wakeup, including all inherited members.

    s_signal (defined in tds_poll_wakeup)tds_poll_wakeup
    s_signaled (defined in tds_poll_wakeup)tds_poll_wakeup
    freetds-1.3.6/doc/reference/a01227.html000644 025423 025423 00000007720 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_poll_wakeup Struct Reference
    FreeTDS API
    tds_poll_wakeup Struct Reference

    Public Attributes

    TDS_SYS_SOCKET s_signal
     
    TDS_SYS_SOCKET s_signaled
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01228.html000644 025423 025423 00000022226 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_connection Member List

    This is the complete list of members for tds_connection, including all inherited members.

    authentication (defined in tds_connection)tds_connection
    capabilities (defined in tds_connection)tds_connection
    char_conv_count (defined in tds_connection)tds_connection
    char_convs (defined in tds_connection)tds_connection
    client_spid (defined in tds_connection)tds_connection
    collation (defined in tds_connection)tds_connection
    cursorstds_connection
    dynstds_connection
    encrypt_single_packet (defined in tds_connection)tds_connection
    envtds_connection
    list_mtx (defined in tds_connection)tds_connection
    num_cached_packets (defined in tds_connection)tds_connection
    packet_cache (defined in tds_connection)tds_connection
    pending_closetds_connection
    product_name (defined in tds_connection)tds_connection
    product_versiontds_connection
    stds_connection
    server (defined in tds_connection)tds_connection
    spid (defined in tds_connection)tds_connection
    tds71rev1 (defined in tds_connection)tds_connection
    tds72_transaction (defined in tds_connection)tds_connection
    tds_ctx (defined in tds_connection)tds_connection
    tds_version (defined in tds_connection)tds_connection
    tls_dummy (defined in tds_connection)tds_connection
    tls_session (defined in tds_connection)tds_connection
    use_iconv (defined in tds_connection)tds_connection
    wakeup (defined in tds_connection)tds_connection
    freetds-1.3.6/doc/reference/a01229.dot000644 025423 025423 00000012500 14162303417 020633 0ustar00fredianofrediano000000 000000 digraph "tds_connection" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node2 [label="tds_capabilities",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" types" ,fontname="Helvetica"]; Node3 [label="tds_capability_type",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01135.html",tooltip=" "]; Node4 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node4 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node5 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node5 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node6 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node7 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node7 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node8 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node8 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node9 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node9 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node10 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node10 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node10 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node11 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node11 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node12 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node12 [label="tds_socket",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node9 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node10 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node11 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node15 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node15 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node11 -> Node15 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node15 -> Node15 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node1 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node17 -> Node11 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node17 [label="tds_column",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node18 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node18 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node15 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01231.html000644 025423 025423 00000035320 14162303417 021007 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_connection Struct Reference
    FreeTDS API
    tds_connection Struct Reference
    Collaboration diagram for tds_connection:

    Public Attributes

    TDSAUTHENTICATIONauthentication
     
    TDS_CAPABILITIES capabilities
     
    int char_conv_count
     
    TDSICONV ** char_convs
     
    int client_spid
     
    TDS_UCHAR collation [5]
     
    TDSCURSORcursors
     linked list of cursors allocated for this connection contains only cursors allocated on the server
     
    TDSDYNAMICdyns
     list of dynamic allocated for this connection contains only dynamic allocated on the server
     
    unsigned int encrypt_single_packet:1
     
    TDSENV env
     environment is shared between all sessions
     
    tds_mutex list_mtx
     
    unsigned num_cached_packets
     
    TDSPACKETpacket_cache
     
    unsigned int pending_close:1
     true is connection has pending closing (cursors or dynamic)
     
    char * product_name
     
    TDS_UINT product_version
     version of product (Sybase/MS and full version)
     
    TDS_SYS_SOCKET s
     tcp socket, INVALID_SOCKET if not connected
     
    char * server
     
    int spid
     
    unsigned int tds71rev1:1
     
    TDS_UCHAR tds72_transaction [8]
     
    const TDSCONTEXTtds_ctx
     
    TDS_USMALLINT tds_version
     
    void * tls_dummy
     
    void * tls_session
     
    unsigned int use_iconv:1
     
    TDSPOLLWAKEUP wakeup
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01232.html000644 025423 025423 00000024434 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_socket Member List
    freetds-1.3.6/doc/reference/a01233.dot000644 025423 025423 00000014726 14162303417 020642 0ustar00fredianofrediano000000 000000 digraph "tds_socket" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Information for a server connection."]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node2 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node3 [label="tds_capabilities",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" types" ,fontname="Helvetica"]; Node4 [label="tds_capability_type",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01135.html",tooltip=" "]; Node5 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node5 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node6 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node6 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node6 -> Node6 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node7 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node8 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node1 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node9 [label="tds_column",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node10 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node10 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node5 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node8 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node16 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node16 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node17 -> Node16 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node17 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node8 -> Node16 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node16 -> Node16 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node18 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node18 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node3 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node19 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node19 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node20 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node20 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node21 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node21 [label="tds_context",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node22 -> Node21 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" locale" ,fontname="Helvetica"]; Node22 [label="tds_locale",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01151.html",tooltip=" "]; Node23 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node23 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node6 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node7 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node10 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node16 -> Node18 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01235.html000644 025423 025423 00000060404 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_socket Struct Reference
    FreeTDS API
    tds_socket Struct Reference

    Information for a server connection. More...

    #include <tds.h>

    Collaboration diagram for tds_socket:

    Public Attributes

    bool bulk_query
     true is query sent was a bulk query so we need to switch state to QUERYING
     
    TDSCOMPUTEINFO ** comp_info
     
    TDSCONNECTION conn [1]
     
    TDSCURSORcur_cursor
     cursor in use
     
    TDSDYNAMICcur_dyn
     dynamic structure in use
     
    TDS_OPERATION current_op
     
    TDSRESULTINFOcurrent_results
     Current query information. More...
     
    void(* env_chg_func )(TDSSOCKET *tds, int type, char *oldval, char *newval)
     
    unsigned frozen
     
    TDSPACKETfrozen_packets
     list of packets frozen, points to first one. More...
     
    bool has_status
     true is ret_status is valid
     
    unsigned char * in_buf
     Input buffer. More...
     
    volatile unsigned char in_cancel
     indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cancel packet, 2 already sent.
     
    unsigned char in_flag
     input buffer type
     
    unsigned in_len
     input buffer length
     
    unsigned in_pos
     current position in in_buf
     
    bool in_row
     true if we are getting rows
     
    TDSLOGINlogin
     config for login stuff. More...
     
    TDS_UINT num_comp_info
     
    int option_value
     
    unsigned char * out_buf
     Output buffer. More...
     
    unsigned int out_buf_max
     Maximum size of packet pointed by out_buf. More...
     
    unsigned char out_flag
     output buffer type
     
    unsigned out_pos
     current position in out_buf
     
    TDSPARAMINFOparam_info
     
    void * parent
     
    TDS_INT query_timeout
     
    TDSPACKETrecv_packet
     
    TDSRESULTINFOres_info
     
    TDS_INT ret_status
     return status from store procedure
     
    TDS_INT8 rows_affected
     rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid
     
    TDSPACKETsend_packet
     packet we are preparing to send
     
    TDS_STATE state
     
    tds_mutex wire_mtx
     

    Detailed Description

    Information for a server connection.

    Member Data Documentation

    ◆ current_results

    TDSRESULTINFO* tds_socket::current_results

    Current query information.

    Contains information in process, both normal and compute results. This pointer shouldn't be freed; it's just an alias to another structure.

    ◆ frozen_packets

    TDSPACKET* tds_socket::frozen_packets

    list of packets frozen, points to first one.

    send_packet is the last packet in the list.

    ◆ in_buf

    unsigned char* tds_socket::in_buf

    Input buffer.

    Points to receiving packet buffer. As input buffer contains just the raw packet actually this pointer is the address of recv_packet->buf.

    ◆ login

    TDSLOGIN* tds_socket::login

    config for login stuff.

    After login this field is NULL

    ◆ out_buf

    unsigned char* tds_socket::out_buf

    Output buffer.

    Points to sending packet buffer. Output buffer can contain additional data before the raw TDS packet so this buffer can point some bytes after send_packet->buf. Specifically this will point to send_packet->buf + send_packet->data_start.

    ◆ out_buf_max

    unsigned int tds_socket::out_buf_max

    Maximum size of packet pointed by out_buf.

    The buffer is actually a bit larger to make possible to do some optimizations (at least TDS_ADDITIONAL_SPACE bytes).


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01236.html000644 025423 025423 00000006670 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tdsdump_off_item Member List

    This is the complete list of members for tdsdump_off_item, including all inherited members.

    next (defined in tdsdump_off_item)tdsdump_off_item
    thread_id (defined in tdsdump_off_item)tdsdump_off_item
    freetds-1.3.6/doc/reference/a01237.dot000644 025423 025423 00000000704 14162303417 020635 0ustar00fredianofrediano000000 000000 digraph "tdsdump_off_item" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="tdsdump_off_item",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01239.html000644 025423 025423 00000010345 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: tdsdump_off_item Struct Reference
    FreeTDS API
    tdsdump_off_item Struct Reference
    Collaboration diagram for tdsdump_off_item:

    Public Attributes

    struct tdsdump_off_itemnext
     
    tds_thread_id thread_id
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01240.html000644 025423 025423 00000007431 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_freeze Member List

    This is the complete list of members for tds_freeze, including all inherited members.

    pkttds_freeze
    pkt_postds_freeze
    size_lentds_freeze
    tdstds_freeze
    freetds-1.3.6/doc/reference/a01241.dot000644 025423 025423 00000013376 14162303417 020641 0ustar00fredianofrediano000000 000000 digraph "tds_freeze" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_freeze",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds" ,fontname="Helvetica"]; Node2 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node3 [label="tds_login",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node4 [label="tds_capabilities",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01139.html",tooltip=" "]; Node6 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node6 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node7 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node7 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node7 -> Node7 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node8 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node8 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node9 [label="tds_result_info",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node9 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node17 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node17 [label="tds_cursor",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node18 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" status" ,fontname="Helvetica"]; Node18 [label="tds_cursor_status",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01195.html",tooltip=" "]; Node9 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node17 -> Node17 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node19 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node19 [label="tds_connection",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node4 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" capabilities" ,fontname="Helvetica"]; Node20 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" wakeup" ,fontname="Helvetica"]; Node20 [label="tds_poll_wakeup",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01227.html",tooltip=" "]; Node21 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" env" ,fontname="Helvetica"]; Node21 [label="tds_env",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01203.html",tooltip="Current environment as reported by the server."]; Node22 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tds_ctx" ,fontname="Helvetica"]; Node22 [label="tds_context",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01215.html",tooltip=" "]; Node24 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" authentication" ,fontname="Helvetica"]; Node24 [label="tds_authentication",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01219.html",tooltip=" "]; Node7 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node8 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node11 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node11 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node17 -> Node19 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" pkt" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01243.html000644 025423 025423 00000013354 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_freeze Struct Reference
    FreeTDS API
    tds_freeze Struct Reference
    Collaboration diagram for tds_freeze:

    Public Attributes

    TDSPACKETpkt
     first packet frozen
     
    unsigned pkt_pos
     position in pkt
     
    unsigned size_len
     length size (0, 1, 2 or 4)
     
    TDSSOCKETtds
     which socket we refer to
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01244.html000644 025423 025423 00000011775 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_bcpinfo Member List

    This is the complete list of members for tds_bcpinfo, including all inherited members.

    bind_count (defined in tds_bcpinfo)tds_bcpinfo
    bindinfo (defined in tds_bcpinfo)tds_bcpinfo
    direction (defined in tds_bcpinfo)tds_bcpinfo
    hint (defined in tds_bcpinfo)tds_bcpinfo
    identity_insert_on (defined in tds_bcpinfo)tds_bcpinfo
    insert_stmt (defined in tds_bcpinfo)tds_bcpinfo
    parent (defined in tds_bcpinfo)tds_bcpinfo
    tablename (defined in tds_bcpinfo)tds_bcpinfo
    xfer_init (defined in tds_bcpinfo)tds_bcpinfo
    freetds-1.3.6/doc/reference/a01245.dot000644 025423 025423 00000012246 14162303417 020640 0ustar00fredianofrediano000000 000000 digraph "tds_bcpinfo" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_bcpinfo",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bindinfo" ,fontname="Helvetica"]; Node2 [label="tds_result_info",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01183.html",tooltip="Hold information for any results."]; Node3 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" attached_to" ,fontname="Helvetica"]; Node3 [label="tds_socket",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01235.html",tooltip="Information for a server connection."]; Node4 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" login" ,fontname="Helvetica"]; Node4 [label="tds_login",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01143.html",tooltip=" "]; Node7 -> Node4 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" app_name\ncafile\nclient_charset\nclient_host_name\ncrlfile\ndatabase\ndb_filename\ndump_file\ninstance_name\nlanguage\n..." ,fontname="Helvetica"]; Node7 [label="tds_dstr",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01283.html",tooltip="Structure to hold a string."]; Node8 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" frozen_packets\nrecv_packet\nsend_packet" ,fontname="Helvetica"]; Node8 [label="tds_packet",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01223.html",tooltip=" "]; Node8 -> Node8 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node9 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_dyn" ,fontname="Helvetica"]; Node9 [label="tds_dynamic",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01207.html",tooltip="Holds information for a dynamic (also called prepared) query."]; Node9 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node2 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" params\nres_info" ,fontname="Helvetica"]; Node2 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" comp_info\ncurrent_results\nparam_info\nres_info" ,fontname="Helvetica"]; Node10 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cur_cursor" ,fontname="Helvetica"]; Node10 [label="tds_cursor",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01199.html",tooltip="Holds informations about a cursor."]; Node2 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" res_info" ,fontname="Helvetica"]; Node10 -> Node10 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next" ,fontname="Helvetica"]; Node12 -> Node3 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" conn" ,fontname="Helvetica"]; Node12 [label="tds_connection",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a01231.html",tooltip=" "]; Node8 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" packet_cache" ,fontname="Helvetica"]; Node9 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" dyns" ,fontname="Helvetica"]; Node18 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_convs" ,fontname="Helvetica"]; Node18 [label="tdsiconvinfo",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00983.html",tooltip=" "]; Node10 -> Node12 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" cursors" ,fontname="Helvetica"]; Node22 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" columns" ,fontname="Helvetica"]; Node22 [label="tds_column",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01175.html",tooltip="Metadata about columns in regular and compute rows."]; Node18 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" char_conv" ,fontname="Helvetica"]; Node7 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" column_name\ntable_column_name\ntable_name" ,fontname="Helvetica"]; Node23 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" funcs" ,fontname="Helvetica"]; Node23 [label="tds_column_funcs",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01171.html",tooltip=" "]; Node24 -> Node22 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" bcp_column_data" ,fontname="Helvetica"]; Node24 [label="tds_bcpcoldata",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01167.html",tooltip=" "]; Node7 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" tablename" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01247.html000644 025423 025423 00000015300 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_bcpinfo Struct Reference
    FreeTDS API
    tds_bcpinfo Struct Reference
    Collaboration diagram for tds_bcpinfo:

    Public Attributes

    TDS_INT bind_count
     
    TDSRESULTINFObindinfo
     
    TDS_INT direction
     
    const char * hint
     
    TDS_INT identity_insert_on
     
    TDS_CHAR * insert_stmt
     
    void * parent
     
    DSTR tablename
     
    TDS_INT xfer_init
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01248.html000644 025423 025423 00000006302 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_raw_mutex Member List

    This is the complete list of members for tds_raw_mutex, including all inherited members.

    dummy (defined in tds_raw_mutex)tds_raw_mutex
    freetds-1.3.6/doc/reference/a01251.html000644 025423 025423 00000007142 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_raw_mutex Struct Reference
    FreeTDS API
    tds_raw_mutex Struct Reference

    Public Attributes

    char dummy [0]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01252.html000644 025423 025423 00000006302 14162303417 021010 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_condition Member List

    This is the complete list of members for tds_condition, including all inherited members.

    dummy (defined in tds_condition)tds_condition
    freetds-1.3.6/doc/reference/a01255.html000644 025423 025423 00000007142 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_condition Struct Reference
    FreeTDS API
    tds_condition Struct Reference

    Public Attributes

    char dummy [0]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01256.html000644 025423 025423 00000006266 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_thread Member List

    This is the complete list of members for tds_thread, including all inherited members.

    dummy (defined in tds_thread)tds_thread
    freetds-1.3.6/doc/reference/a01259.html000644 025423 025423 00000007134 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_thread Struct Reference
    FreeTDS API
    tds_thread Struct Reference

    Public Attributes

    char dummy [0]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01260.html000644 025423 025423 00000007460 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    des_key Member List

    This is the complete list of members for des_key, including all inherited members.

    fperm (defined in des_key)des_key
    iperm (defined in des_key)des_key
    kn (defined in des_key)des_key
    sp (defined in des_key)des_key
    freetds-1.3.6/doc/reference/a01263.html000644 025423 025423 00000011203 14162303417 021006 0ustar00fredianofrediano000000 000000 FreeTDS API: des_key Struct Reference
    FreeTDS API
    des_key Struct Reference

    Public Attributes

    uint8_t fperm [16][16][8]
     
    uint8_t iperm [16][16][8]
     
    uint8_t kn [16][8]
     
    uint32_t sp [8][64]
     

    The documentation for this struct was generated from the following file:
    • include/freetds/utils/des.h
    freetds-1.3.6/doc/reference/a01264.html000644 025423 025423 00000006617 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    dlist_ring Member List

    This is the complete list of members for dlist_ring, including all inherited members.

    next (defined in dlist_ring)dlist_ring
    prev (defined in dlist_ring)dlist_ring
    freetds-1.3.6/doc/reference/a01265.dot000644 025423 025423 00000000676 14162303417 020646 0ustar00fredianofrediano000000 000000 digraph "dlist_ring" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="dlist_ring",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next\nprev" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01267.html000644 025423 025423 00000010373 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: dlist_ring Struct Reference
    FreeTDS API
    dlist_ring Struct Reference
    Collaboration diagram for dlist_ring:

    Public Attributes

    struct dlist_ringnext
     
    struct dlist_ringprev
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01268.html000644 025423 025423 00000006311 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DLIST_LIST_TYPE Member List

    This is the complete list of members for DLIST_LIST_TYPE, including all inherited members.

    ring (defined in DLIST_LIST_TYPE)DLIST_LIST_TYPE
    freetds-1.3.6/doc/reference/a01269.dot000644 025423 025423 00000001277 14162303417 020650 0ustar00fredianofrediano000000 000000 digraph "DLIST_LIST_TYPE" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="DLIST_LIST_TYPE",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node2 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" ring" ,fontname="Helvetica"]; Node2 [label="dlist_ring",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01267.html",tooltip=" "]; Node2 -> Node2 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" next\nprev" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01271.html000644 025423 025423 00000007576 14162303417 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: DLIST_LIST_TYPE Struct Reference
    FreeTDS API
    DLIST_LIST_TYPE Struct Reference
    Collaboration diagram for DLIST_LIST_TYPE:

    Public Attributes

    dlist_ring ring
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01272.html000644 025423 025423 00000007164 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    MD4Context Member List

    This is the complete list of members for MD4Context, including all inherited members.

    buf (defined in MD4Context)MD4Context
    bytes (defined in MD4Context)MD4Context
    in (defined in MD4Context)MD4Context
    freetds-1.3.6/doc/reference/a01275.html000644 025423 025423 00000010425 14162303417 021016 0ustar00fredianofrediano000000 000000 FreeTDS API: MD4Context Struct Reference
    FreeTDS API
    MD4Context Struct Reference

    Public Attributes

    uint32_t buf [4]
     
    uint64_t bytes
     
    uint32_t in [16]
     

    The documentation for this struct was generated from the following file:
    • include/freetds/utils/md4.h
    freetds-1.3.6/doc/reference/a01276.html000644 025423 025423 00000007164 14162303417 021025 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    MD5Context Member List

    This is the complete list of members for MD5Context, including all inherited members.

    buf (defined in MD5Context)MD5Context
    bytes (defined in MD5Context)MD5Context
    in (defined in MD5Context)MD5Context
    freetds-1.3.6/doc/reference/a01279.html000644 025423 025423 00000010425 14162303417 021022 0ustar00fredianofrediano000000 000000 FreeTDS API: MD5Context Struct Reference
    FreeTDS API
    MD5Context Struct Reference

    Public Attributes

    uint32_t buf [4]
     
    uint64_t bytes
     
    uint32_t in [16]
     

    The documentation for this struct was generated from the following file:
    • include/freetds/utils/md5.h
    freetds-1.3.6/doc/reference/a01280.html000644 025423 025423 00000006612 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_dstr Member List

    This is the complete list of members for tds_dstr, including all inherited members.

    dstr_s (defined in tds_dstr)tds_dstr
    dstr_size (defined in tds_dstr)tds_dstr
    freetds-1.3.6/doc/reference/a01283.html000644 025423 025423 00000010767 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_dstr Struct Reference
    FreeTDS API

    Structure to hold a string. More...

    #include <string.h>

    Public Attributes

    char dstr_s [1]
     
    size_t dstr_size
     

    Detailed Description

    Structure to hold a string.

    Use tds_dstr_* functions/macros, do not access members directly. There should be always a buffer.


    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01284.html000644 025423 025423 00000007650 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tagSS_TIME2_STRUCT Member List

    This is the complete list of members for tagSS_TIME2_STRUCT, including all inherited members.

    fraction (defined in tagSS_TIME2_STRUCT)tagSS_TIME2_STRUCT
    hour (defined in tagSS_TIME2_STRUCT)tagSS_TIME2_STRUCT
    minute (defined in tagSS_TIME2_STRUCT)tagSS_TIME2_STRUCT
    second (defined in tagSS_TIME2_STRUCT)tagSS_TIME2_STRUCT
    freetds-1.3.6/doc/reference/a01287.html000644 025423 025423 00000011202 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: tagSS_TIME2_STRUCT Struct Reference
    FreeTDS API
    tagSS_TIME2_STRUCT Struct Reference

    Public Attributes

    SQLUINTEGER fraction
     
    SQLUSMALLINT hour
     
    SQLUSMALLINT minute
     
    SQLUSMALLINT second
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01288.html000644 025423 025423 00000012475 14162303417 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tagSS_TIMESTAMPOFFSET_STRUCT Member List
    freetds-1.3.6/doc/reference/a01291.html000644 025423 025423 00000014563 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: tagSS_TIMESTAMPOFFSET_STRUCT Struct Reference
    FreeTDS API
    tagSS_TIMESTAMPOFFSET_STRUCT Struct Reference

    Public Attributes

    SQLUSMALLINT day
     
    SQLUINTEGER fraction
     
    SQLUSMALLINT hour
     
    SQLUSMALLINT minute
     
    SQLUSMALLINT month
     
    SQLUSMALLINT second
     
    SQLSMALLINT timezone_hour
     
    SQLSMALLINT timezone_minute
     
    SQLSMALLINT year
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01292.html000644 025423 025423 00000006615 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBVARYCHAR Member List

    This is the complete list of members for DBVARYCHAR, including all inherited members.

    len (defined in DBVARYCHAR)DBVARYCHAR
    str (defined in DBVARYCHAR)DBVARYCHAR
    freetds-1.3.6/doc/reference/a01295.html000644 025423 025423 00000007654 14162303417 021032 0ustar00fredianofrediano000000 000000 FreeTDS API: DBVARYCHAR Struct Reference
    FreeTDS API
    DBVARYCHAR Struct Reference

    Public Attributes

    DBSMALLINT len
     
    char str [256]
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01296.html000644 025423 025423 00000006611 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBVARYBIN Member List

    This is the complete list of members for DBVARYBIN, including all inherited members.

    array (defined in DBVARYBIN)DBVARYBIN
    len (defined in DBVARYBIN)DBVARYBIN
    freetds-1.3.6/doc/reference/a01299.html000644 025423 025423 00000007665 14162303417 021040 0ustar00fredianofrediano000000 000000 FreeTDS API: DBVARYBIN Struct Reference
    FreeTDS API
    DBVARYBIN Struct Reference

    Public Attributes

    unsigned char array [256]
     
    DBSMALLINT len
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01300.html000644 025423 025423 00000007165 14162303417 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBNUMERIC Member List

    This is the complete list of members for DBNUMERIC, including all inherited members.

    array (defined in DBNUMERIC)DBNUMERIC
    precision (defined in DBNUMERIC)DBNUMERIC
    scale (defined in DBNUMERIC)DBNUMERIC
    freetds-1.3.6/doc/reference/a01303.html000644 025423 025423 00000010433 14162303417 021005 0ustar00fredianofrediano000000 000000 FreeTDS API: DBNUMERIC Struct Reference
    FreeTDS API
    DBNUMERIC Struct Reference

    Public Attributes

    unsigned char array [33]
     
    unsigned char precision
     
    unsigned char scale
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01304.html000644 025423 025423 00000006602 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBMONEY Member List

    This is the complete list of members for DBMONEY, including all inherited members.

    mnyhigh (defined in DBMONEY)DBMONEY
    mnylow (defined in DBMONEY)DBMONEY
    freetds-1.3.6/doc/reference/a01307.html000644 025423 025423 00000007644 14162303417 021023 0ustar00fredianofrediano000000 000000 FreeTDS API: DBMONEY Struct Reference
    FreeTDS API
    DBMONEY Struct Reference

    Public Attributes

    DBINT mnyhigh
     
    DBUINT mnylow
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01308.html000644 025423 025423 00000006255 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBMONEY4 Member List

    This is the complete list of members for DBMONEY4, including all inherited members.

    mny4 (defined in DBMONEY4)DBMONEY4
    freetds-1.3.6/doc/reference/a01311.html000644 025423 025423 00000007113 14162303417 021005 0ustar00fredianofrediano000000 000000 FreeTDS API: DBMONEY4 Struct Reference
    FreeTDS API
    DBMONEY4 Struct Reference

    Public Attributes

    DBINT mny4
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01312.html000644 025423 025423 00000006623 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBDATETIME Member List

    This is the complete list of members for DBDATETIME, including all inherited members.

    dtdays (defined in DBDATETIME)DBDATETIME
    dttime (defined in DBDATETIME)DBDATETIME
    freetds-1.3.6/doc/reference/a01315.html000644 025423 025423 00000007650 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: DBDATETIME Struct Reference
    FreeTDS API
    DBDATETIME Struct Reference

    Public Attributes

    DBINT dtdays
     
    DBINT dttime
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01316.html000644 025423 025423 00000006630 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBDATETIME4 Member List

    This is the complete list of members for DBDATETIME4, including all inherited members.

    days (defined in DBDATETIME4)DBDATETIME4
    minutes (defined in DBDATETIME4)DBDATETIME4
    freetds-1.3.6/doc/reference/a01319.html000644 025423 025423 00000007665 14162303417 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: DBDATETIME4 Struct Reference
    FreeTDS API
    DBDATETIME4 Struct Reference

    Public Attributes

    DBUSMALLINT days
     
    DBUSMALLINT minutes
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01320.html000644 025423 025423 00000011347 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBDATETIMEALL Member List

    This is the complete list of members for DBDATETIMEALL, including all inherited members.

    _res (defined in DBDATETIMEALL)DBDATETIMEALL
    dateDBDATETIMEALL
    has_date (defined in DBDATETIMEALL)DBDATETIMEALL
    has_offset (defined in DBDATETIMEALL)DBDATETIMEALL
    has_time (defined in DBDATETIMEALL)DBDATETIMEALL
    offsetDBDATETIMEALL
    timeDBDATETIMEALL
    time_prec (defined in DBDATETIMEALL)DBDATETIMEALL
    freetds-1.3.6/doc/reference/a01323.html000644 025423 025423 00000015145 14162303417 021014 0ustar00fredianofrediano000000 000000 FreeTDS API: DBDATETIMEALL Struct Reference
    FreeTDS API
    DBDATETIMEALL Struct Reference

    Public Attributes

    DBUSMALLINT _res:10
     
    DBINT date
     date, 0 = 1900-01-01
     
    DBUSMALLINT has_date:1
     
    DBUSMALLINT has_offset:1
     
    DBUSMALLINT has_time:1
     
    DBSMALLINT offset
     time offset
     
    DBUBIGINT time
     time, 7 digit precision
     
    DBUSMALLINT time_prec:3
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01324.html000644 025423 025423 00000006625 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    dbtypeinfo Member List

    This is the complete list of members for dbtypeinfo, including all inherited members.

    precision (defined in dbtypeinfo)dbtypeinfo
    scale (defined in dbtypeinfo)dbtypeinfo
    freetds-1.3.6/doc/reference/a01327.html000644 025423 025423 00000007652 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: dbtypeinfo Struct Reference
    FreeTDS API
    dbtypeinfo Struct Reference

    Public Attributes

    DBINT precision
     
    DBINT scale
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01328.html000644 025423 025423 00000007161 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    dbstring Member List

    This is the complete list of members for dbstring, including all inherited members.

    strnext (defined in dbstring)dbstring
    strtext (defined in dbstring)dbstring
    strtotlen (defined in dbstring)dbstring
    freetds-1.3.6/doc/reference/a01329.dot000644 025423 025423 00000000667 14162303417 020647 0ustar00fredianofrediano000000 000000 digraph "dbstring" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="dbstring",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip=" "]; Node1 -> Node1 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label=" strnext" ,fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01331.html000644 025423 025423 00000011023 14162303417 021002 0ustar00fredianofrediano000000 000000 FreeTDS API: dbstring Struct Reference
    FreeTDS API
    dbstring Struct Reference
    Collaboration diagram for dbstring:

    Public Attributes

    struct dbstringstrnext
     
    BYTE * strtext
     
    DBINT strtotlen
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01332.html000644 025423 025423 00000013670 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBCOL Member List

    This is the complete list of members for DBCOL, including all inherited members.

    ActualName (defined in DBCOL)DBCOL
    CaseSensitive (defined in DBCOL)DBCOL
    Identity (defined in DBCOL)DBCOL
    MaxLength (defined in DBCOL)DBCOL
    Name (defined in DBCOL)DBCOL
    Null (defined in DBCOL)DBCOL
    Precision (defined in DBCOL)DBCOL
    Scale (defined in DBCOL)DBCOL
    SizeOfStruct (defined in DBCOL)DBCOL
    TableName (defined in DBCOL)DBCOL
    Type (defined in DBCOL)DBCOL
    Updatable (defined in DBCOL)DBCOL
    UserType (defined in DBCOL)DBCOL
    VarLength (defined in DBCOL)DBCOL
    freetds-1.3.6/doc/reference/a01335.html000644 025423 025423 00000020001 14162303417 021002 0ustar00fredianofrediano000000 000000 FreeTDS API: DBCOL Struct Reference
    FreeTDS API
    DBCOL Struct Reference

    Public Attributes

    DBCHAR ActualName [MAXCOLNAMELEN+2]
     
    BYTE CaseSensitive
     
    BOOL Identity
     
    DBINT MaxLength
     
    DBCHAR Name [MAXCOLNAMELEN+2]
     
    BYTE Null
     
    BYTE Precision
     
    BYTE Scale
     
    DBINT SizeOfStruct
     
    DBCHAR TableName [MAXCOLNAMELEN+2]
     
    SHORT Type
     
    BYTE Updatable
     
    DBINT UserType
     
    BOOL VarLength
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01336.html000644 025423 025423 00000015210 14162303417 021011 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    DBCOL2 Member List

    This is the complete list of members for DBCOL2, including all inherited members.

    ActualName (defined in DBCOL2)DBCOL2
    CaseSensitive (defined in DBCOL2)DBCOL2
    Identity (defined in DBCOL2)DBCOL2
    MaxLength (defined in DBCOL2)DBCOL2
    Name (defined in DBCOL2)DBCOL2
    Null (defined in DBCOL2)DBCOL2
    Precision (defined in DBCOL2)DBCOL2
    Scale (defined in DBCOL2)DBCOL2
    ServerMaxLength (defined in DBCOL2)DBCOL2
    ServerType (defined in DBCOL2)DBCOL2
    ServerTypeDeclaration (defined in DBCOL2)DBCOL2
    SizeOfStruct (defined in DBCOL2)DBCOL2
    TableName (defined in DBCOL2)DBCOL2
    Type (defined in DBCOL2)DBCOL2
    Updatable (defined in DBCOL2)DBCOL2
    UserType (defined in DBCOL2)DBCOL2
    VarLength (defined in DBCOL2)DBCOL2
    freetds-1.3.6/doc/reference/a01339.html000644 025423 025423 00000022053 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: DBCOL2 Struct Reference
    FreeTDS API
    DBCOL2 Struct Reference

    Public Attributes

    DBCHAR ActualName [MAXCOLNAMELEN+2]
     
    BYTE CaseSensitive
     
    BOOL Identity
     
    DBINT MaxLength
     
    DBCHAR Name [MAXCOLNAMELEN+2]
     
    BYTE Null
     
    BYTE Precision
     
    BYTE Scale
     
    DBINT ServerMaxLength
     
    SHORT ServerType
     
    DBCHAR ServerTypeDeclaration [256]
     
    DBINT SizeOfStruct
     
    DBCHAR TableName [MAXCOLNAMELEN+2]
     
    SHORT Type
     
    BYTE Updatable
     
    DBINT UserType
     
    BOOL VarLength
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01340.html000644 025423 025423 00000013675 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_microsoft_dbdaterec Member List
    freetds-1.3.6/doc/reference/a01343.html000644 025423 025423 00000016447 14162303417 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_microsoft_dbdaterec Struct Reference
    FreeTDS API
    tds_microsoft_dbdaterec Struct Reference

    Public Attributes

    DBINT day
     
    DBINT dayofyear
     
    DBINT hour
     
    DBINT millisecond
     
    DBINT minute
     
    DBINT month
     
    DBINT quarter
     
    DBINT second
     
    DBINT tzone
     
    DBINT week
     
    DBINT weekday
     
    DBINT year
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01344.html000644 025423 025423 00000013620 14162303417 021013 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_sybase_dbdaterec Member List

    This is the complete list of members for tds_sybase_dbdaterec, including all inherited members.

    datedmonth (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    datedweek (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    datedyear (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    datehour (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    dateminute (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    datemonth (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    datemsecond (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    datesecond (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    datetzone (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    dateyear (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    quarter (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    week (defined in tds_sybase_dbdaterec)tds_sybase_dbdaterec
    freetds-1.3.6/doc/reference/a01347.html000644 025423 025423 00000016502 14162303417 021020 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_sybase_dbdaterec Struct Reference
    FreeTDS API
    tds_sybase_dbdaterec Struct Reference

    Public Attributes

    DBINT datedmonth
     
    DBINT datedweek
     
    DBINT datedyear
     
    DBINT datehour
     
    DBINT dateminute
     
    DBINT datemonth
     
    DBINT datemsecond
     
    DBINT datesecond
     
    DBINT datetzone
     
    DBINT dateyear
     
    DBINT quarter
     
    DBINT week
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01348.html000644 025423 025423 00000013726 14162303417 021026 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_microsoft_dbdaterec2 Member List
    freetds-1.3.6/doc/reference/a01351.html000644 025423 025423 00000016450 14162303417 021015 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_microsoft_dbdaterec2 Struct Reference
    FreeTDS API
    tds_microsoft_dbdaterec2 Struct Reference

    Public Attributes

    DBINT day
     
    DBINT dayofyear
     
    DBINT hour
     
    DBINT minute
     
    DBINT month
     
    DBINT nanosecond
     
    DBINT quarter
     
    DBINT second
     
    DBINT tzone
     
    DBINT week
     
    DBINT weekday
     
    DBINT year
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01352.html000644 025423 025423 00000013652 14162303417 021017 0ustar00fredianofrediano000000 000000 FreeTDS API: Member List
    FreeTDS API
    tds_sybase_dbdaterec2 Member List

    This is the complete list of members for tds_sybase_dbdaterec2, including all inherited members.

    datedmonth (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    datedweek (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    datedyear (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    datehour (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    dateminute (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    datemonth (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    datensecond (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    datesecond (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    datetzone (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    dateyear (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    quarter (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    week (defined in tds_sybase_dbdaterec2)tds_sybase_dbdaterec2
    freetds-1.3.6/doc/reference/a01355.html000644 025423 025423 00000016504 14162303417 021021 0ustar00fredianofrediano000000 000000 FreeTDS API: tds_sybase_dbdaterec2 Struct Reference
    FreeTDS API
    tds_sybase_dbdaterec2 Struct Reference

    Public Attributes

    DBINT datedmonth
     
    DBINT datedweek
     
    DBINT datedyear
     
    DBINT datehour
     
    DBINT dateminute
     
    DBINT datemonth
     
    DBINT datensecond
     
    DBINT datesecond
     
    DBINT datetzone
     
    DBINT dateyear
     
    DBINT quarter
     
    DBINT week
     

    The documentation for this struct was generated from the following file:
    freetds-1.3.6/doc/reference/a01356.html000644 025423 025423 00000032572 14162303416 021024 0ustar00fredianofrediano000000 000000 FreeTDS API: How to add a new type
    FreeTDS API
    How to add a new type

    Introduction

    Adding a new type in FreeTDS is a quite complicated task involving different tasks.

    To see an example you can look at commit id adb893f1381fd3ea40564c775e30dc8cdc81dcf2 ("Implement big(date)time types") and parent changes in the source repository.

    libTDS changes

    • protocol. First thing to do is add the type to the protocol. A type usually have some mnemonic constant and a structure. Declare them in include/freetds/proto.h file. Note that here you should declare the structure the server use not the structure to hold the data in libTDS.
      Cfr commit id a74a06e1f97f3137f6cf1bc7319dd7a2cfb52b1f.

    • base information. Add the type to misc/types.csv file (I use LibreOffice Calc to do it). This table maintain the base information for a type.
      Cfr commit id 680cb3371e042bb372cbc5e6feb4054e50d40c1a.

    • data. There should be some code to handle this type to/from the server. This code is implemented in include/freetds/data.h and src/tds/data.c. You can either add a new set of functions to handle this new type or add the type handling do another set of types depending on how complicated is that type. One thing you have to to at this step is determine how you store that type in libTDS. This is quite important at upper level libraries will have to use these structures or even present these data to client code (like DB-Library usually do). Due to the way FreeTDS works now you would get a linker error in the ODBC part. You can either ignore the error and proceed with libTDS, add the code to ODBC or disable temporarily ODBC.
      Cfr commit id 680cb3371e042bb372cbc5e6feb4054e50d40c1a.

    • enable the type from server. In order to receive the new type from the server you have to tell the server that we support that type. This can be either done changing the protocol (usually Microsoft) or enabling some flags (capabilities for Sybase).
      Cfr commit id a498703ff9e309c656b19dd990f4cad0283a47c7.

    • conversions. Conversions are not hard to write but usually require quite a bit of coding. After extending CONV_RESULT type in include/freetds/convert.h and adding the type to the script that generate the conversion tables in src/tds/tds_willconvert.pl you have to write the big part in src/tds/covnert.c. You have to implement all kind of conversions you declared in the previous file. Reuse the functions that are there (for instance there are some parser functions). Also if there are similar types it could be helpful to convert first your type to a super type then use the conversion for that type. For instance for SMALLINT type (tds_convert_int2) the type is just readed and then tds_convert_int is called which handle any int (actually 32 bit integer). Same for data where the TDS_DATETIMEALL structure is used. Note that conversions to binary (which usually are implemented) are done in another function (tds_convert_to_binary).
      Cfr commit id 9ed52cb78f725607ac109c8c284ca7c4658d87a9.

    • string definition. Add string for your type to src/tds/token.c in tds_prtype.
      Cfr commit id ac0d3b46db7d98436cd76f906b7d455f7651faae.

    • conversion tests. You probably will have done some mistake with conversions but don't mind, there are some tests which will help sorting this out. src/tds/unittests/convert.c try any possible combination of conversion to check if all conversion are implemented (it does not check the conversions themself). src/tds/unittests/t0007.c test that your conversion are working. Just add manually the conversions you want to try.
      Cfr commit id abcc09c9a88acd0e9a45b46dab3ca44309917a02.

    • parameter. Add type/parameter declaration in tds_get_column_declaration in src/tds/query.c. Also do any necessary step to initialize the parameter to send to server.
      Cfr commit id 54fdd3233e430c045cf5524ac385770738d9e92c, commit id 88cfea19d91245372779b8893a2d62b42696cd49.

    • emulated prepared/rpc. If needed handle your type in tds_put_param_as_string in src/tds/query.c.
      Cfr commit id 017b7bf2fee0f09847e64546d27382d2f2b756f4.

    ODBC changes

    ODBC is the most complicated library to add a type to. Usually its data are different from libTDS so you have to add additional code for conversions which are not required by other libraries.

    CT-Library changes

    This is quite easy as usual the conversion in libTDS are fine for this library.

    • define type in include/cspublic.h
    • implement conversion in src/ctlib/cs.h
    • set corrent conversion from cs types to server in src/ctlib/ct.c

    Cfr commit id c5e71e5ad4a557038ecedcec457e2531ab02a77b.

    DB-Library changes

    A bit more complicated than CT-Library but not that much.

    • add type and binding type to include/sybdb.h
    • add NULL handling in dbgetnull, dbsetnull and default_null_representation in src/dblib/dblib.c
    • add binding to dbbindtype
    • add support for conversion from/to server
    • add printable size
    • return correct type string

    Cfr commit id 99dd126e0eb248dd3079b2a7cf97437fe3bcd163.

    Applications changes

    datacopy application requires some changes too to support new types so add them to src/apps/datacopy.c.
    Cfr commit id e59c48ac39c76abb036651f8ec238090eef321c9.

    freetds-1.3.6/doc/reference/a01400.html000644 025423 025423 00000101145 14162303416 021003 0ustar00fredianofrediano000000 000000 FreeTDS API: src/dblib/bcp.c File Reference
    FreeTDS API
    bcp.c File Reference

    Implementation of db-lib bulk copy functions. More...

    #include <config.h>
    #include <stdarg.h>
    #include <stdio.h>
    #include <assert.h>
    #include <freetds/tds.h>
    #include <freetds/iconv.h>
    #include <freetds/convert.h>
    #include <freetds/bytes.h>
    #include <freetds/utils/string.h>
    #include <freetds/encodings.h>
    #include <freetds/replacements.h>
    #include <sybfront.h>
    #include <sybdb.h>
    #include <syberror.h>
    #include <dblib.h>
    Include dependency graph for bcp.c:

    Macros

    #define fseeko(f, o, w)   fseek(f,o,w)
     
    #define ftello(f)   ftell(f)
     
    #define HOST_COL_CONV_ERROR   1
     
    #define HOST_COL_NULL_ERROR   2
     
    #define MAX(a, b)   ( (a) > (b) ? (a) : (b) )
     

    Typedefs

    typedef long offset_type
     

    Functions

    static STATUS _bcp_check_eof (DBPROCESS *dbproc, FILE *file, int icol)
     
    static TDSRET _bcp_convert_in (DBPROCESS *dbproc, TDS_SERVER_TYPE srctype, const TDS_CHAR *src, TDS_UINT srclen, TDS_SERVER_TYPE desttype, BCPCOLDATA *coldata)
     Convert column for input to a table.
     
    static int _bcp_convert_out (DBPROCESS *dbproc, TDSCOLUMN *curcol, BCP_HOSTCOLINFO *hostcol, TDS_UCHAR **p_data, const char *bcpdatefmt)
     Convert column for output (usually to a file) Conversion is slightly different from input as: More...
     
    static RETCODE _bcp_exec_in (DBPROCESS *dbproc, DBINT *rows_copied)
     
    static RETCODE _bcp_exec_out (DBPROCESS *dbproc, DBINT *rows_copied)
     
    static char * _bcp_fgets (char *buffer, int size, FILE *f)
     
    static void _bcp_free_columns (DBPROCESS *dbproc)
     
    static void _bcp_free_storage (DBPROCESS *dbproc)
     
    static TDSRET _bcp_get_col_data (TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset)
     For a bcp in from program variables, get the data from the host variable. More...
     
    static int _bcp_get_term_var (const BYTE *pdata, const BYTE *term, int term_len)
     Get the data for bcp-in from program variables, where the program data have been identified as character terminated,
    This is a low-level, internal function. More...
     
    static TDSRET _bcp_no_get_col_data (TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset)
     Function to read data from file. More...
     
    static void _bcp_null_error (TDSBCPINFO *bcpinfo, int index, int offset)
     
    static STATUS _bcp_read_hostfile (DBPROCESS *dbproc, FILE *hostfile, int *row_error, bool skip)
     
    static int _bcp_readfmt_colinfo (DBPROCESS *dbproc, char *buf, BCP_HOSTCOLINFO *ci)
     
    DBINT bcp_batch (DBPROCESS *dbproc)
     Commit a set of rows to the table. More...
     
    RETCODE bcp_bind (DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int db_vartype, int table_column)
     Bind a program host variable to a database column. More...
     
    static int bcp_cache_prefix_len (BCP_HOSTCOLINFO *hostcol, const TDSCOLUMN *curcol)
     
    RETCODE bcp_colfmt (DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int table_colnum)
     Specify the format of a datafile prior to writing to a table. More...
     
    RETCODE bcp_colfmt_ps (DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int table_colnum, DBTYPEINFO *typeinfo)
     Specify the format of a host file for bulk copy purposes, with precision and scale support for numeric and decimal columns. More...
     
    RETCODE bcp_collen (DBPROCESS *dbproc, DBINT varlen, int table_column)
     Set the length of a host variable to be written to a table. More...
     
    RETCODE bcp_colptr (DBPROCESS *dbproc, BYTE *colptr, int table_column)
     Override bcp_bind() by pointing to a different host variable. More...
     
    RETCODE bcp_columns (DBPROCESS *dbproc, int host_colcount)
     Indicate how many columns are to be found in the datafile. More...
     
    RETCODE bcp_control (DBPROCESS *dbproc, int field, DBINT value)
     Set BCP options for uploading a datafile. More...
     
    DBINT bcp_done (DBPROCESS *dbproc)
     Conclude the transfer of data from program variables. More...
     
    RETCODE bcp_exec (DBPROCESS *dbproc, DBINT *rows_copied)
     Write a datafile to a table. More...
     
    int bcp_getbatchsize (DBPROCESS *dbproc)
     
    DBBOOL bcp_getl (LOGINREC *login)
     See if BCP_SETL() was used to set the LOGINREC for BCP work. More...
     
    RETCODE bcp_init (DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction)
     Prepare for bulk copy operation on a table. More...
     
    RETCODE bcp_options (DBPROCESS *dbproc, int option, BYTE *value, int valuelen)
     Set "hints" for uploading a file. More...
     
    RETCODE bcp_readfmt (DBPROCESS *dbproc, const char filename[])
     Read a format definition file. More...
     
    RETCODE bcp_sendrow (DBPROCESS *dbproc)
     Write data in host variables to the table. More...
     
    static RETCODE bcp_write_prefix (FILE *hostfile, BCP_HOSTCOLINFO *hostcol, TDSCOLUMN *curcol, int buflen)
     
    static void init_hostfile_columns (DBPROCESS *dbproc)
     
    static int rtrim (char *str, int len)
     trim a string of trailing blanks More...
     
    static void rtrim_bcpcol (TDSCOLUMN *bcpcol)
     
    static int rtrim_u16 (uint16_t *str, int len, uint16_t space)
     

    Detailed Description

    Implementation of db-lib bulk copy functions.

    Function Documentation

    ◆ _bcp_convert_out()

    static int _bcp_convert_out ( DBPROCESS dbproc,
    TDSCOLUMN curcol,
    BCP_HOSTCOLINFO hostcol,
    TDS_UCHAR **  p_data,
    const char *  bcpdatefmt 
    )
    static

    Convert column for output (usually to a file) Conversion is slightly different from input as:

    • date is formatted differently;
    • you have to set properly numeric while on input the column metadata are used;
    • we need to make sure buffer is always at least a minimum bytes.
    Here is the call graph for this function:

    ◆ _bcp_no_get_col_data()

    static TDSRET _bcp_no_get_col_data ( TDSBCPINFO bcpinfo,
    TDSCOLUMN bindcol,
    int  offset 
    )
    static

    Function to read data from file.

    I this case is empty as data are already on bcp_column_data

    freetds-1.3.6/doc/reference/a01400_a230fa5b56ae4e3509a69bd266495732b_cgraph.dot000644 025423 025423 00000001426 14162303416 026614 0ustar00fredianofrediano000000 000000 digraph "_bcp_convert_out" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="_bcp_convert_out",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Convert column for output (usually to a file) Conversion is slightly different from input as:"]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_get_conversion_type",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html#a0383d5dcb629582266a442f0f0dbd13a",tooltip="Return type suitable for conversions (convert all nullable types to fixed type)"]; } freetds-1.3.6/doc/reference/a01401.dot000644 025423 025423 00000021757 14162303416 020640 0ustar00fredianofrediano000000 000000 digraph "src/dblib/bcp.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/dblib/bcp.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Implementation of db-lib bulk copy functions."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node6 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node7 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node6 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node6 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node6 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node6 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node14 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node6 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node18 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node19 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node20 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node6 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node22 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/convert.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00401_source.html",tooltip=" "]; Node23 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="freetds/bytes.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00386_source.html",tooltip=" "]; Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="freetds/encodings.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00407_source.html",tooltip=" "]; Node1 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node26 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node26 [label="sybfront.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00512_source.html",tooltip=" "]; Node26 -> Node27 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node27 [label="sybdb.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00506.html",tooltip="Primary include file for db-lib applications."]; Node27 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node27 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node28 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node28 [label="syberror.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00509_source.html",tooltip=" "]; Node1 -> Node29 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node29 [label="dblib.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00374_source.html",tooltip=" "]; Node29 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node29 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01415.html000644 025423 025423 00000060511 14162303416 021012 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/stream.c File Reference
    FreeTDS API
    stream.c File Reference

    Handle stream of data. More...

    #include <config.h>
    #include <assert.h>
    #include <freetds/tds.h>
    #include <freetds/iconv.h>
    #include <freetds/stream.h>
    Include dependency graph for stream.c:

    Functions

    TDSRET tds_convert_stream (TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
     Reads and writes from a stream converting characters. More...
     
    TDSRET tds_copy_stream (TDSINSTREAM *istream, TDSOUTSTREAM *ostream)
     Reads and writes from a stream to another. More...
     
    void tds_datain_stream_init (TDSDATAINSTREAM *stream, TDSSOCKET *tds, size_t wire_size)
     Initialize a data input stream. More...
     
    static int tds_datain_stream_read (TDSINSTREAM *stream, void *ptr, size_t len)
     Reads data from network for input stream.
     
    void tds_dataout_stream_init (TDSDATAOUTSTREAM *stream, TDSSOCKET *tds)
     Initialize a data output stream. More...
     
    static int tds_dataout_stream_write (TDSOUTSTREAM *stream, size_t len)
     Writes data to network for output stream.
     
    TDSRET tds_dynamic_stream_init (TDSDYNAMICSTREAM *stream, void **ptr, size_t allocated)
     Initialize a dynamic output stream. More...
     
    static int tds_dynamic_stream_write (TDSOUTSTREAM *stream, size_t len)
     Writes data to a dynamic allocated buffer.
     
    void tds_staticin_stream_init (TDSSTATICINSTREAM *stream, const void *ptr, size_t len)
     Initialize an input stream for read from a static allocated buffer. More...
     
    static int tds_staticin_stream_read (TDSINSTREAM *stream, void *ptr, size_t len)
     Reads data from a static allocated buffer.
     
    void tds_staticout_stream_init (TDSSTATICOUTSTREAM *stream, void *ptr, size_t len)
     Initialize an output stream for write into a static allocated buffer. More...
     
    static int tds_staticout_stream_write (TDSOUTSTREAM *stream, size_t len)
     Writes data to a static allocated buffer.
     

    Detailed Description

    Handle stream of data.

    Function Documentation

    ◆ tds_convert_stream()

    TDSRET tds_convert_stream ( TDSSOCKET tds,
    TDSICONV char_conv,
    TDS_ICONV_DIRECTION  direction,
    TDSINSTREAM istream,
    TDSOUTSTREAM ostream 
    )

    Reads and writes from a stream converting characters.

    Convert a stream from istream to ostream using a specific conversion.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    char_convconversion structure
    directionspecify conversion to server or from server
    istreaminput stream
    ostreamoutput stream
    Returns
    TDS_SUCCESS of TDS_FAIL
    Here is the caller graph for this function:

    ◆ tds_copy_stream()

    TDSRET tds_copy_stream ( TDSINSTREAM istream,
    TDSOUTSTREAM ostream 
    )

    Reads and writes from a stream to another.

    Copy data from a stream to another.

    Parameters
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    istreaminput stream
    ostreamoutput stream
    Returns
    TDS_SUCCESS or TDS_FAIL

    ◆ tds_datain_stream_init()

    void tds_datain_stream_init ( TDSDATAINSTREAM stream,
    TDSSOCKET tds,
    size_t  wire_size 
    )

    Initialize a data input stream.

    This stream read data from network.

    Parameters
    streaminput stream to initialize
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    wire_sizebyte to read
    Here is the call graph for this function:
    Here is the caller graph for this function:

    ◆ tds_dataout_stream_init()

    void tds_dataout_stream_init ( TDSDATAOUTSTREAM stream,
    TDSSOCKET tds 
    )

    Initialize a data output stream.

    This stream writes data to network.

    Parameters
    streamoutput stream to initialize
    tdsA pointer to the TDSSOCKET structure managing a client/server operation.
    Here is the call graph for this function:

    ◆ tds_dynamic_stream_init()

    TDSRET tds_dynamic_stream_init ( TDSDYNAMICSTREAM stream,
    void **  ptr,
    size_t  allocated 
    )

    Initialize a dynamic output stream.

    This stream write data into a dynamic allocated buffer.

    Parameters
    streamstream to initialize
    ptrpointer to pointer to buffer to fill. Buffer will be extended as needed
    allocatedbytes initialially allocated for the buffer. Useful to reuse buffers
    Returns
    TDS_SUCCESS on success, TDS_FAIL otherwise
    Here is the call graph for this function:

    ◆ tds_staticin_stream_init()

    void tds_staticin_stream_init ( TDSSTATICINSTREAM stream,
    const void *  ptr,
    size_t  len 
    )

    Initialize an input stream for read from a static allocated buffer.

    Parameters
    streamstream to initialize
    ptrbuffer to read from
    lenbuffer size in bytes

    ◆ tds_staticout_stream_init()

    void tds_staticout_stream_init ( TDSSTATICOUTSTREAM stream,
    void *  ptr,
    size_t  len 
    )

    Initialize an output stream for write into a static allocated buffer.

    Parameters
    streamstream to initialize
    ptrbuffer to write to
    lenbuffer size in bytes
    Here is the caller graph for this function:
    freetds-1.3.6/doc/reference/a01416.dot000644 025423 025423 00000015556 14162303416 020646 0ustar00fredianofrediano000000 000000 digraph "src/tds/stream.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/tds/stream.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Handle stream of data."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node4 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node7 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node4 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node4 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node4 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node4 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node14 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node4 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node18 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node19 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node20 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node4 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node22 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/stream.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00443_source.html",tooltip=" "]; Node23 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; } freetds-1.3.6/doc/reference/a01424.html000644 025423 025423 00000037774 14162303416 021031 0ustar00fredianofrediano000000 000000 FreeTDS API: src/replacements/iconv.c File Reference
    FreeTDS API
    iconv.c File Reference

    This file implements a very simple iconv. More...

    #include <config.h>
    #include <assert.h>
    #include <ctype.h>
    #include <freetds/tds.h>
    #include <freetds/bytes.h>
    #include <freetds/iconv.h>
    #include <freetds/utils/bjoern-utf8.h>
    #include "iconv_charsets.h"
    Include dependency graph for iconv.c:

    Macros

    #define CD   ((int) (intptr_t) cd)
     
    #define CP1252(i, o)   case o: c = i; break;
     
    #define MASK(n)   ((0xffffffffu << (n)) & 0xffffffffu)
     

    Typedefs

    typedef uint32_t ICONV_CHAR
     
    typedef int(* iconv_get_t) (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    typedef int(* iconv_put_t) (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     

    Enumerations

    enum  ICONV_CD_VALUE { Like_to_Like = 0x100 }
     

    Functions

    static int get_ascii (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_cp1252 (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_err (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_iso1 (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_ucs4be (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_ucs4le (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_utf16be (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_utf16le (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int get_utf8 (const unsigned char *p, size_t len, ICONV_CHAR *out)
     
    static int put_ascii (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_cp1252 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_err (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_iso1 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_ucs4be (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_ucs4le (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_utf16be (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_utf16le (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    static int put_utf8 (unsigned char *buf, size_t buf_len, ICONV_CHAR c)
     
    size_t tds_sys_iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
     
    int tds_sys_iconv_close (iconv_t cd)
     
    iconv_t tds_sys_iconv_open (const char *tocode, const char *fromcode)
     Inputs are FreeTDS canonical names, no other. More...
     

    Variables

    static const iconv_get_t iconv_gets [16]
     
    static const iconv_put_t iconv_puts [16]
     

    Detailed Description

    This file implements a very simple iconv.


    Its purpose is to allow ASCII clients to communicate with Microsoft servers that encode their metadata in Unicode (UTF-16).

    It supports ISO-8859-1, ASCII, CP1252, UTF-16, UCS-4 and UTF-8

    freetds-1.3.6/doc/reference/a01425.dot000644 025423 025423 00000016744 14162303416 020646 0ustar00fredianofrediano000000 000000 digraph "src/replacements/iconv.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/replacements/iconv.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="This file implements a very simple iconv."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="ctype.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node5 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node5 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node5 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node8 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node5 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node5 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node12 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node5 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node5 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node15 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node16 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node16 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node5 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node19 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node21 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node5 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/bytes.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00386_source.html",tooltip=" "]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node24 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="freetds/utils/bjoern\l-utf8.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00461_source.html",tooltip=" "]; Node25 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node26 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node26 [label="iconv_charsets.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00197_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/a01415_a4f9e40da6941cb9407d0da5bc3030517_cgraph.dot000644 025423 025423 00000001310 14162303416 026654 0ustar00fredianofrediano000000 000000 digraph "tds_dynamic_stream_init" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dynamic_stream_init",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Initialize a dynamic output stream."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dynamic_stream\l_write",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html#abaf688c85ea04a2392103d519a55d04e",tooltip="Writes data to a dynamic allocated buffer."]; } freetds-1.3.6/doc/reference/a01415_a9d8eb43a81ff58ab423dce0ce95b9564_icgraph.dot000644 025423 025423 00000001420 14162303416 027301 0ustar00fredianofrediano000000 000000 digraph "tds_convert_stream" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_convert_stream",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Reads and writes from a stream converting characters."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="read_and_convert",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga676c4dee6522815b16fdc8e448e43590",tooltip="For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not al..."]; } freetds-1.3.6/doc/reference/a01415_a9fe0d3799d2e3bde49b614c9d0c3785d_icgraph.dot000644 025423 025423 00000001456 14162303416 027241 0ustar00fredianofrediano000000 000000 digraph "tds_staticout_stream_init" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_staticout_stream_init",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Initialize an output stream for write into a static allocated buffer."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="read_and_convert",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga676c4dee6522815b16fdc8e448e43590",tooltip="For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not al..."]; } freetds-1.3.6/doc/reference/a01415_aa038a9125979f8f0915dbd53cbf27e5a_cgraph.dot000644 025423 025423 00000001304 14162303416 026766 0ustar00fredianofrediano000000 000000 digraph "tds_dataout_stream_init" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_dataout_stream_init",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Initialize a data output stream."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_dataout_stream\l_write",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html#ae38a590ee08cf398e7adef536ac94538",tooltip="Writes data to network for output stream."]; } freetds-1.3.6/doc/reference/a01415_abc3a77c8aa28842e7f28583cbabc1415_cgraph.dot000644 025423 025423 00000001275 14162303416 027040 0ustar00fredianofrediano000000 000000 digraph "tds_datain_stream_init" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="LR"; Node1 [label="tds_datain_stream_init",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Initialize a data input stream."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="tds_datain_stream_read",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a01415.html#a04b537d889f7d4c9b9701eb81baf7efd",tooltip="Reads data from network for input stream."]; } freetds-1.3.6/doc/reference/a01415_abc3a77c8aa28842e7f28583cbabc1415_icgraph.dot000644 025423 025423 00000001402 14162303416 027201 0ustar00fredianofrediano000000 000000 digraph "tds_datain_stream_init" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; rankdir="RL"; Node1 [label="tds_datain_stream_init",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Initialize a data input stream."]; Node1 -> Node2 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="read_and_convert",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00564.html#ga676c4dee6522815b16fdc8e448e43590",tooltip="For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary is not al..."]; } freetds-1.3.6/doc/reference/a01427.html000644 025423 025423 00000076730 14162303416 021027 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/iconv.c File Reference
    FreeTDS API
    iconv.c File Reference

    Handle character conversions to/from server. More...

    #include <config.h>
    #include <stdarg.h>
    #include <stdio.h>
    #include <assert.h>
    #include <freetds/tds.h>
    #include <freetds/iconv.h>
    #include <freetds/bool.h>
    #include <freetds/bytes.h>
    #include <freetds/encodings.h>
    #include <freetds/charset_lookup.h>
    Include dependency graph for iconv.c:

    Macros

    #define CHARSIZE(charset)
     
    #define CHUNK_ALLOC   4
     
    #define TDS_ICONV_ENCODING_TABLES
     

    Enumerations

    enum  {
      OPT_VERSION = 0x01, OPT_TIMER = 0x02, OPT_NOFOOTER = 0x04, OPT_NOHEADER = 0x08,
      OPT_QUIET = 0x10, OPT_VERBOSE = 0x20, OPT_INSTANCES = 0x40, POS_ISO1,
      POS_UTF8, POS_UCS2LE, POS_UCS2BE, MUL_STARTED = 1,
      ASN1_SEQUENCE = ASN1_TAG_SEQUENCE, CS_USERNAME = 9100, CS_USERNAME = 9100, CS_PASSWORD = 9101,
      CS_PASSWORD = 9101, CS_APPNAME = 9102, CS_APPNAME = 9102, CS_HOSTNAME = 9103,
      CS_HOSTNAME = 9103, CS_LOGIN_STATUS = 9104, CS_LOGIN_STATUS = 9104, CS_TDS_VERSION = 9105,
      CS_TDS_VERSION = 9105, CS_CHARSETCNV = 9106, CS_CHARSETCNV = 9106, CS_PACKETSIZE = 9107,
      CS_PACKETSIZE = 9107, CS_USERDATA = 9108, CS_USERDATA = 9108, CS_NETIO = 9110,
      CS_NETIO = 9110, CS_TEXTLIMIT = 9112, CS_TEXTLIMIT = 9112, CS_HIDDEN_KEYS = 9113,
      CS_HIDDEN_KEYS = 9113, CS_VERSION = 9114, CS_VERSION = 9114, CS_IFILE = 9115,
      CS_IFILE = 9115, CS_LOGIN_TIMEOUT = 9116, CS_LOGIN_TIMEOUT = 9116, CS_TIMEOUT = 9117,
      CS_TIMEOUT = 9117, CS_MAX_CONNECT = 9118, CS_MAX_CONNECT = 9118, CS_EXPOSE_FMTS = 9120,
      CS_EXPOSE_FMTS = 9120, CS_EXTRA_INF = 9121, CS_EXTRA_INF = 9121, CS_ANSI_BINDS = 9123,
      CS_ANSI_BINDS = 9123, CS_BULK_LOGIN = 9124, CS_BULK_LOGIN = 9124, CS_LOC_PROP = 9125,
      CS_LOC_PROP = 9125, CS_PARENT_HANDLE = 9130, CS_PARENT_HANDLE = 9130, CS_EED_CMD = 9131,
      CS_EED_CMD = 9131, CS_DIAG_TIMEOUT = 9132, CS_DIAG_TIMEOUT = 9132, CS_DISABLE_POLL = 9133,
      CS_DISABLE_POLL = 9133, CS_SEC_ENCRYPTION = 9135, CS_SEC_ENCRYPTION = 9135, CS_SEC_CHALLENGE = 9136,
      CS_SEC_CHALLENGE = 9136, CS_SEC_NEGOTIATE = 9137, CS_SEC_NEGOTIATE = 9137, CS_CON_STATUS = 9143,
      CS_CON_STATUS = 9143, CS_VER_STRING = 9144, CS_VER_STRING = 9144, CS_SERVERNAME = 9146,
      CS_SERVERNAME = 9146, CS_SEC_APPDEFINED = 9149, CS_SEC_APPDEFINED = 9149, CS_STICKY_BINDS = 9151,
      CS_STICKY_BINDS = 9151, CS_SEC_NETWORKAUTH = 9175, CS_SEC_NETWORKAUTH = 9175, CS_SEC_DELEGATION = 9176,
      CS_SEC_DELEGATION = 9176, CS_SEC_MUTUALAUTH = 9177, CS_SEC_MUTUALAUTH = 9177, CS_SEC_SERVERPRINCIPAL = 9188,
      CS_SEC_SERVERPRINCIPAL = 9188, CS_SERVERADDR = 9206, CS_SERVERADDR = 9206, CS_PORT = 9300,
      CS_PORT = 9300, CS_CLIENTCHARSET = 9301, CS_CLIENTCHARSET = 9301, CS_DATABASE,
      dblib_msdblib = 0, TDS_CHARSET_ISO_8859_1 = 0, TDS_CHARSET_UTF_8 = 1, TDS_CHARSET_UCS_2LE = 2,
      TDS_CHARSET_UCS_2BE = 3, TDS_CHARSET_ARMSCII_8 = 4, TDS_CHARSET_BIG_5 = 5, TDS_CHARSET_BIG5_HKSCS = 6,
      TDS_CHARSET_C99 = 7, TDS_CHARSET_CHINESE = 8, TDS_CHARSET_CN = 9, TDS_CHARSET_CN_GB = 10,
      TDS_CHARSET_CN_GB_ISOIR165 = 11, TDS_CHARSET_CP1133 = 12, TDS_CHARSET_CP1250 = 13, TDS_CHARSET_CP1251 = 14,
      TDS_CHARSET_CP1252 = 15, TDS_CHARSET_CP1253 = 16, TDS_CHARSET_CP1254 = 17, TDS_CHARSET_CP1255 = 18,
      TDS_CHARSET_CP1256 = 19, TDS_CHARSET_CP1257 = 20, TDS_CHARSET_CP1258 = 21, TDS_CHARSET_CP1361 = 22,
      TDS_CHARSET_CP437 = 23, TDS_CHARSET_CP850 = 24, TDS_CHARSET_CP862 = 25, TDS_CHARSET_CP866 = 26,
      TDS_CHARSET_CP874 = 27, TDS_CHARSET_CP932 = 28, TDS_CHARSET_CP936 = 29, TDS_CHARSET_CP949 = 30,
      TDS_CHARSET_CP950 = 31, TDS_CHARSET_EUC_JP = 32, TDS_CHARSET_EUC_KR = 33, TDS_CHARSET_EUC_TW = 34,
      TDS_CHARSET_GB18030 = 35, TDS_CHARSET_GEORGIAN_ACADEMY = 36, TDS_CHARSET_GEORGIAN_PS = 37, TDS_CHARSET_HZ = 38,
      TDS_CHARSET_ISO_2022_CN = 39, TDS_CHARSET_ISO_2022_CN_EXT = 40, TDS_CHARSET_ISO_2022_JP = 41, TDS_CHARSET_ISO_2022_JP_1 = 42,
      TDS_CHARSET_ISO_2022_JP_2 = 43, TDS_CHARSET_ISO_2022_KR = 44, TDS_CHARSET_ISO_8859_10 = 45, TDS_CHARSET_ISO_8859_13 = 46,
      TDS_CHARSET_ISO_8859_14 = 47, TDS_CHARSET_ISO_8859_15 = 48, TDS_CHARSET_ISO_8859_16 = 49, TDS_CHARSET_ISO_8859_2 = 50,
      TDS_CHARSET_ISO_8859_3 = 51, TDS_CHARSET_ISO_8859_4 = 52, TDS_CHARSET_ISO_8859_5 = 53, TDS_CHARSET_ISO_8859_6 = 54,
      TDS_CHARSET_ISO_8859_7 = 55, TDS_CHARSET_ISO_8859_8 = 56, TDS_CHARSET_ISO_8859_9 = 57, TDS_CHARSET_ISO_IR_14 = 58,
      TDS_CHARSET_ISO_IR_149 = 59, TDS_CHARSET_ISO_IR_159 = 60, TDS_CHARSET_ISO_IR_166 = 61, TDS_CHARSET_ISO_IR_87 = 62,
      TDS_CHARSET_JAVA = 63, TDS_CHARSET_JISX0201_1976 = 64, TDS_CHARSET_KOI8_R = 65, TDS_CHARSET_KOI8_RU = 66,
      TDS_CHARSET_KOI8_T = 67, TDS_CHARSET_KOI8_U = 68, TDS_CHARSET_MAC = 69, TDS_CHARSET_MACARABIC = 70,
      TDS_CHARSET_MACCENTRALEUROPE = 71, TDS_CHARSET_MACCROATIAN = 72, TDS_CHARSET_MACCYRILLIC = 73, TDS_CHARSET_MACGREEK = 74,
      TDS_CHARSET_MACHEBREW = 75, TDS_CHARSET_MACICELAND = 76, TDS_CHARSET_MACROMANIA = 77, TDS_CHARSET_MACTHAI = 78,
      TDS_CHARSET_MACTURKISH = 79, TDS_CHARSET_MACUKRAINE = 80, TDS_CHARSET_MULELAO_1 = 81, TDS_CHARSET_NEXTSTEP = 82,
      TDS_CHARSET_ROMAN8 = 83, TDS_CHARSET_SJIS = 84, TDS_CHARSET_TCVN = 85, TDS_CHARSET_UCS_4BE = 86,
      TDS_CHARSET_UCS_4LE = 87, TDS_CHARSET_US_ASCII = 88, TDS_CHARSET_UTF_16BE = 89, TDS_CHARSET_UTF_16LE = 90,
      TDS_CHARSET_UTF_32BE = 91, TDS_CHARSET_UTF_32LE = 92, TDS_CHARSET_UTF_7 = 93, TDS_CHARSET_VISCII = 94,
      TDS_NUM_CHARSETS = 95, ODBC_PARAM_SIZE, TDS_OPT_ARITHOVERFLOW = 0x01, TDS_OPT_NUMERICTRUNC = 0x02,
      TDS_CUR_ISTAT_UNUSED = 0x00, TDS_CUR_ISTAT_DECLARED = 0x01, TDS_CUR_ISTAT_OPEN = 0x02, TDS_CUR_ISTAT_CLOSED = 0x04,
      TDS_CUR_ISTAT_RDONLY = 0x08, TDS_CUR_ISTAT_UPDATABLE = 0x10, TDS_CUR_ISTAT_ROWCNT = 0x20, TDS_CUR_ISTAT_DEALLOC = 0x40,
      SYBCHAR = 47, SYBCHAR = 47, SYBVARCHAR = 39, SYBVARCHAR = 39,
      SYBINTN = 38, SYBINTN = 38, SYBINT1 = 48, SYBINT1 = 48,
      SYBINT2 = 52, SYBINT2 = 52, SYBINT4 = 56, SYBINT4 = 56,
      SYBINT8 = 127, SYBINT8 = 127, SYBFLT8 = 62, SYBFLT8 = 62,
      SYBDATETIME = 61, SYBDATETIME = 61, SYBBIT = 50, SYBBIT = 50,
      SYBBITN = 104, SYBBITN = 104, SYBTEXT = 35, SYBTEXT = 35,
      SYBNTEXT = 99, SYBNTEXT = 99, SYBIMAGE = 34, SYBIMAGE = 34,
      SYBMONEY4 = 122, SYBMONEY4 = 122, SYBMONEY = 60, SYBMONEY = 60,
      SYBDATETIME4 = 58, SYBDATETIME4 = 58, SYBREAL = 59, SYBREAL = 59,
      SYBBINARY = 45, SYBBINARY = 45, SYBVOID = 31, SYBVOID = 31,
      SYBVARBINARY = 37, SYBVARBINARY = 37, SYBNUMERIC = 108, SYBNUMERIC = 108,
      SYBDECIMAL = 106, SYBDECIMAL = 106, SYBFLTN = 109, SYBFLTN = 109,
      SYBMONEYN = 110, SYBMONEYN = 110, SYBDATETIMN = 111, SYBDATETIMN = 111,
      SYBNVARCHAR = 103, SYBNVARCHAR = 103, SYBDATE = 49, SYBDATE = 49,
      SYBTIME = 51, SYBTIME = 51, SYBBIGDATETIME = 187, SYBBIGDATETIME = 187,
      SYBBIGTIME = 188, SYBBIGTIME = 188, SYBMSDATE = 40, SYBMSDATE = 40,
      SYBMSTIME = 41, SYBMSTIME = 41, SYBMSDATETIME2 = 42, SYBMSDATETIME2 = 42,
      SYBMSDATETIMEOFFSET = 43, SYBMSDATETIMEOFFSET = 43
    }
     

    Functions

    static void _iconv_close (iconv_t *cd)
     
    static int collate2charset (TDSCONNECTION *conn, TDS_UCHAR collate[5])
     
    static size_t skip_one_input_sequence (iconv_t cd, const TDS_ENCODING *charset, const char **input, size_t *input_size)
     Move the input sequence pointer to the next valid position. More...
     
    void tds7_srv_charset_changed (TDSCONNECTION *conn, TDS_UCHAR collation[5])
     
    int tds_canonical_charset (const char *charset_name)
     Determine canonical iconv character set. More...
     
    const char * tds_canonical_charset_name (const char *charset_name)
     Determine canonical iconv character set name. More...
     
    size_t tds_iconv (TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
     Wrapper around iconv(3). More...
     
    int tds_iconv_alloc (TDSCONNECTION *conn)
     Allocate iconv stuff. More...
     
    void tds_iconv_close (TDSCONNECTION *conn)
     
    static void tds_iconv_err (TDSSOCKET *tds, int err)
     
    void tds_iconv_free (TDSCONNECTION *conn)
     
    TDSICONVtds_iconv_from_collate (TDSCONNECTION *conn, TDS_UCHAR collate[5])
     Get iconv information from a LCID (to support different column encoding under MSSQL2K)
     
    TDSICONVtds_iconv_get (TDSCONNECTION *conn, const char *client_charset, const char *server_charset)
     
    TDSICONVtds_iconv_get_info (TDSCONNECTION *conn, int canonic_client, int canonic_server)
     Get a iconv info structure, allocate and initialize if needed.
     
    static void tds_iconv_info_close (TDSICONV *char_conv)
     
    static int tds_iconv_info_init (TDSICONV *char_conv, int client_canonical, int server_canonical)
     Open iconv descriptors to convert between character sets (both directions). More...
     
    static int tds_iconv_init (void)
     Initialize charset searching for UTF-8, UCS-2 and ISO8859-1.
     
    TDSRET tds_iconv_open (TDSCONNECTION *conn, const char *charset, int use_utf16)
     
    static void tds_iconv_reset (TDSICONV *conv)
     
    static const char * tds_set_iconv_name (int charset)
     Get iconv name given canonic.
     
    void tds_srv_charset_changed (TDSCONNECTION *conn, const char *charset)
     
    static void tds_srv_charset_changed_num (TDSCONNECTION *conn, int canonic_charset_num)
     

    Variables

    static int iconv_initialized = 0
     
    static const char * iconv_names [TDS_VECTOR_SIZE(canonic_charsets)]
     
    struct {
       char   data [12]
     
       uint32_t   len
     
    test_strings [4]
     
    static const char * ucs2name
     

    Detailed Description

    Handle character conversions to/from server.

    Macro Definition Documentation

    ◆ CHARSIZE

    #define CHARSIZE (   charset)
    Value:
    ( ((charset)->min_bytes_per_char == (charset)->max_bytes_per_char )? \
    (charset)->min_bytes_per_char : 0 )

    Function Documentation

    ◆ tds_iconv_alloc()

    int tds_iconv_alloc ( TDSCONNECTION conn)

    Allocate iconv stuff.

    Returns
    0 for success

    Variable Documentation

    ◆ test_strings

    const { ... } test_strings[4]
    Initial value:
    = {
    { 4, "Ao\xD3\xE5" },
    { 6, "Ao\xC3\x93\xC3\xA5" },
    { 8, "A\x00o\x000\xD3\x00\xE5\x00" },
    { 8, "\x00" "A\x00o\x000\xD3\x00\xE5" },
    }
    freetds-1.3.6/doc/reference/a01428.dot000644 025423 025423 00000016673 14162303416 020652 0ustar00fredianofrediano000000 000000 digraph "src/tds/iconv.c" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node1 [label="src/tds/iconv.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled", fontcolor="black",tooltip="Handle character conversions to/from server."]; Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node2 [label="config.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00359_source.html",tooltip=" "]; Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node3 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node4 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node5 [label="assert.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled",tooltip=" "]; Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 [label="freetds/tds.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00449.html",tooltip="Main include file for libtds."]; Node6 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node7 [label="time.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00455_source.html",tooltip=" "]; Node7 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node8 [label="freetds/version.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00488_source.html",tooltip=" "]; Node6 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node9 [label="freetds/sysdep_private.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00446_source.html",tooltip=" "]; Node6 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [label="freetds/thread.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00452_source.html",tooltip=" "]; Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [label="tds_sysdep_public.h",height=0.2,width=0.4,color="red", fillcolor="white", style="filled",URL="$a00515_source.html",tooltip=" "]; Node6 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [label="freetds/bool.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00383_source.html",tooltip=" "]; Node6 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [label="freetds/macros.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00416_source.html",tooltip=" "]; Node14 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [label="freetds/utils/string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00482_source.html",tooltip=" "]; Node15 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [label="freetds/pushvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00428_source.html",tooltip=" "]; Node15 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node17 [label="freetds/popvis.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00422_source.html",tooltip=" "]; Node6 -> Node18 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 [label="freetds/replacements.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00437_source.html",tooltip=" "]; Node18 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node19 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 [label="freetds/replacements\l/readpassphrase.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00434_source.html",tooltip=" "]; Node19 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node19 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node20 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 [label="freetds/replacements\l/poll.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00431.html",tooltip="Provide poll call where missing."]; Node20 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node20 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node18 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node6 -> Node21 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node21 [label="freetds/proto.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00425_source.html",tooltip=" "]; Node6 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node22 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 [label="freetds/iconv.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00413_source.html",tooltip=" "]; Node22 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node22 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node1 -> Node23 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node23 [label="freetds/bytes.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00386_source.html",tooltip=" "]; Node1 -> Node24 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node24 [label="freetds/encodings.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00407_source.html",tooltip=" "]; Node1 -> Node25 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node25 [label="freetds/charset_lookup.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$a00392_source.html",tooltip=" "]; } freetds-1.3.6/doc/reference/annotated.html000644 025423 025423 00000147643 14162303417 022171 0ustar00fredianofrediano000000 000000 FreeTDS API: Class List
    FreeTDS API
    Class List
    Here are the classes, structs, unions and interfaces with brief descriptions:
    [detail level 12]
     C_character_set_alias
     C_cs_blkdesc
     C_cs_clientmsg
     C_cs_command
     C_cs_config
     C_cs_connection
     C_cs_context
     C_cs_datafmt
     C_cs_daterec
     C_cs_datetime
     C_cs_datetime4
     C_cs_dynamic
     C_cs_iodesc
     C_cs_locale
     C_cs_money
     C_cs_money4
     C_cs_numeric
     C_cs_objdata
     C_cs_objname
     C_cs_param
     C_cs_servermsg
     C_cs_varbinary
     C_cs_varchar
     C_csremote_proc
     C_ct_colinfo
     C_dblib_error_message
     C_dheader
     C_drecord
     C_hcattr
     C_hchk
     C_hdbc
     C_hdesc
     C_heattr
     C_henv
     C_hsattr
     C_hstmt
     C_options
     C_procedure
     C_sql_error
     C_sql_errors
     Cagg_t
     Casn1_der_iterator
     CBCP_HOSTCOLINFO
     CBCP_HOSTFILEINFO
     Ccharset_alias
     Ccol_t
     Cconf_params
     CCONNECT_EVENT
     Cconv_result
     Ccs_diag_msg
     Ccs_diag_msg_client
     Ccs_diag_msg_svr
     CDATA
     CDBCOL
     CDBCOL2
     CDBDATETIME
     CDBDATETIME4
     CDBDATETIMEALL
     Cdblib_buffer_row
     Cdblib_context
     CDBMONEY
     CDBMONEY4
     CDBNUMERIC
     Cdboption
     CDBPROC_ROWBUF
     CDBREMOTE_PROC
     CDBREMOTE_PROC_PARAM
     Cdbstring
     Cdbtypeinfo
     CDBVARYBIN
     CDBVARYCHAR
     Cdes_key
     CDLIST_LIST_TYPE
     Cdlist_ring
     CDSNINFO
     CEND_LOGIN_EVENT
     Cfunc_info
     CKEY_T
     CLOGIN_EVENT
     CLOGINREC
     CMD4Context
     CMD5Context
     CMETACOMP
     CMETADATA
     Cmetadata_t
     Cmpz_t
     Cname_t
     CnamelistHolds list of names
     Cnames_blob_prefix_t
     Cnative_info
     CNULLREP
     COBJECTINFO
     Cpd
     Cpivot_t
     Cpollfd
     CProfileParam
     Cptw32_mcs_node_t_
     Cretry_addr
     Crsa_public_key
     Cs_SqlMsgMap
     Cs_v3to2map
     Cselect_info
     Cstring_linked_list
     Cstringpool_t
     CtagSS_TIME2_STRUCT
     CtagSS_TIMESTAMPOFFSET_STRUCT
     CTDS71_COLLATIONTDS 7.1 collation informations
     CTDS72_SMP_HEADERTDS 7.2 SMP packet header
     Ctds_addrinfo
     Ctds_align_struct
     Ctds_answer
     Ctds_authentication
     Ctds_bcpcoldata
     Ctds_bcpinfo
     Ctds_blobInformation about blobs (e.g
     Ctds_capabilities
     Ctds_capability_type
     Ctds_columnMetadata about columns in regular and compute rows
     Ctds_column_funcs
     Ctds_compiletime_settingsA structure to hold all the compile-time settings
     Ctds_condition
     Ctds_connection
     Ctds_context
     Ctds_cursorHolds informations about a cursor
     Ctds_cursor_status
     Ctds_datain_streamInput stream to read data from tds protocol
     Ctds_dataout_streamOutput stream to write data to tds protocol
     CTDS_DATETIMEALLThis structure is not directed connected to a TDS protocol but keeps any DATE/TIME information
     Ctds_dblib_dbprocess
     Ctds_dblib_loginrec
     Ctds_dstrStructure to hold a string
     Ctds_dynamicHolds information for a dynamic (also called prepared) query
     Ctds_dynamic_streamOutput stream to write data to a dynamic buffer
     Ctds_encodingInformation relevant to libiconv
     Ctds_envCurrent environment as reported by the server
     Ctds_errno_message_flags
     Ctds_error_message
     Ctds_file_streamInput stream to read a file
     Ctds_freeze
     CTDS_FUNCS
     Ctds_headers
     Ctds_input_streamDefine a stream of data used for input
     Ctds_locale
     Ctds_login
     CTDS_MAY_ALIAS
     Ctds_message
     Ctds_microsoft_dbdaterec
     Ctds_microsoft_dbdaterec2
     Ctds_multiple
     Ctds_ntlm_auth
     Ctds_option_arg
     Ctds_output_streamDefine a stream of data used for output
     Ctds_packet
     CTDS_PARSED_PARAM
     Ctds_pbcbHolds clause buffer
     Ctds_poll_wakeup
     Ctds_pool
     Ctds_pool_event
     Ctds_pool_member
     Ctds_pool_socket
     Ctds_pool_user
     Ctds_quoteout_stream
     Ctds_raw_mutex
     Ctds_result_infoHold information for any results
     Ctds_save_context
     Ctds_save_env
     Ctds_save_msg
     Ctds_socketInformation for a server connection
     Ctds_staticin_streamInput stream to read data from a static buffer
     Ctds_staticout_streamOutput stream to write data to a static buffer
     Ctds_sybase_dbdaterec
     Ctds_sybase_dbdaterec2
     Ctds_thread
     Ctds_time
     Ctds_upd_col
     Ctds_variantStore variant informations
     Ctds_varmax_stream
     CtdsdaterecUsed by tds_datecrack
     Ctdsdatetime
     Ctdsdatetime4
     Ctdsdump_off_item
     Ctdsiconvdir
     Ctdsiconvinfo
     Ctdsmoney
     Ctdsmoney4
     Ctdsnumeric
     Ctdsoldmoney
     Ctdsunique
     Ctdsvername_t
     Ctmp_col_struct
    freetds-1.3.6/doc/reference/bc_s.png000644 025423 025423 00000001244 14162303412 020717 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR€_ kIDATxíËkQÆÏ¹É̤I&“¦mš&156*nÄ…”ܸR,4 +Hµ(U­b”ª1‚ŠˆJ.º(E·mßúhëJmKS'C›(‚èäÑ…¤ï &äÖþ ‡ïrÎåü3gö(z÷ýÒ&_9ó}’ÕŸ@‰mÚu ` Øh`ñ÷Ô¯  „ú&·ññ×Ù~“½—Üò‡ÎÝÑM4¸%‰3²§?Êêh)€ÿù™\ÄYi>Jb @gûßiÞˆú²Ñkg§ãê\è½­šEUæv+?E€î"pæÖÛB\ƒY&ðØó$vM+ê’Dn¼)}òþ:§Xoâ ƒ3ŠÚ¯'¯¿.‚fÁ0ìuŠ9òLýj€f6¸%«3Gf”Ô#Ôsm(,ùÃk*Ê’³Jª…¯¼JË¢o䆔¼u_~ °r]%%mnu]z°r5[ÍÆ°«Úò•Xeµ’†Iù<ÈèÐÅg@IÔÚÞàµë3‚:/<JÇ’ÐQ) ñ¹…tÚß÷(Mû\63éCgl!ýí;ÿ¸4Ùhâñ=÷Zë29­w’ÝÒ´·ˆV;ÊL3ƒj&7©·º½÷a!I†)ëë$-öÇÓú³›‹7tIV¾VàñÔübf¨8¡ÈƒB<﫵imnÿœÈ‡„ lߣù‡ÛD —#É5“­'Æ4?쬲øM’™›°»g¬‚|5Åçµ½GNdÓÐr|ô”Ã&„ì"7+'³@ 5‡G➑Džâɬ^;õã–.3Òr"ý_R³¿Â@²oI¾å$IEND®B`‚freetds-1.3.6/doc/reference/bdwn.png000644 025423 025423 00000000223 14162303412 020737 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR5åZIDATxíË € DŸP–1ñlžmÀ r±j².e è†D[ØÉ¾ÙÏÔ¼µ¦ã´Þ|陣6€Všë3´Å?Ls'(}¬>+ žKó÷¥¿ch`‚ ^׃ÞnIEND®B`‚freetds-1.3.6/doc/reference/classes.html000644 025423 025423 00000061564 14162303417 021646 0ustar00fredianofrediano000000 000000 FreeTDS API: Class Index
    FreeTDS API
    Class Index
    _ | a | b | c | d | e | f | k | l | m | n | o | p | r | s | t
      _  
    asn1_der_iterator   
      f  
    string_linked_list    tds_message   
      b  
    stringpool_t    tds_microsoft_dbdaterec   
    _character_set_alias    func_info   
      t  
    tds_microsoft_dbdaterec2   
    _cs_blkdesc    BCP_HOSTCOLINFO   
      k  
    tds_multiple   
    _cs_clientmsg    BCP_HOSTFILEINFO    tagSS_TIME2_STRUCT    tds_ntlm_auth   
    _cs_command   
      c  
    KEY_T    tagSS_TIMESTAMPOFFSET_STRUCT    tds_option_arg   
    _cs_config   
      l  
    TDS71_COLLATION    tds_output_stream   
    _cs_connection    conv_result::cb_t    TDS72_SMP_HEADER    tds_packet   
    _cs_context    conv_result::cc_t    LOGIN_EVENT    tds_addrinfo    TDS_PARSED_PARAM   
    _cs_datafmt    charset_alias    LOGINREC    tds_align_struct    tds_pbcb   
    _cs_daterec    col_t   
      m  
    tds_answer    tds_poll_wakeup   
    _cs_datetime    conf_params    tds_authentication    tds_pool   
    _cs_datetime4    CONNECT_EVENT    MD4Context    tds_bcpcoldata    tds_pool_event   
    _cs_dynamic    conv_result    MD5Context    tds_bcpinfo    tds_pool_member   
    _cs_iodesc    cs_diag_msg    METACOMP    tds_blob    tds_pool_socket   
    _cs_locale    cs_diag_msg_client    METADATA    tds_capabilities    tds_pool_user   
    _cs_money    cs_diag_msg_svr    metadata_t    tds_capability_type    tds_quoteout_stream   
    _cs_money4   
      d  
    mpz_t    tds_column    tds_raw_mutex   
    _cs_numeric   
      n  
    tds_column_funcs    tds_result_info   
    _cs_objdata    DATA    tds_compiletime_settings    tds_save_context   
    _cs_objname    DBCOL    name_t    tds_condition    tds_save_env   
    _cs_param    DBCOL2    namelist    tds_connection    tds_save_msg   
    _cs_servermsg    DBDATETIME    names_blob_prefix_t    tds_context    tds_socket   
    _cs_varbinary    DBDATETIME4    native_info    tds_cursor    tds_staticin_stream   
    _cs_varchar    DBDATETIMEALL    NULLREP    tds_cursor_status    tds_staticout_stream   
    _csremote_proc    dblib_buffer_row   
      o  
    tds_datain_stream    tds_sybase_dbdaterec   
    _ct_colinfo    dblib_context    tds_dataout_stream    tds_sybase_dbdaterec2   
    _dblib_error_message    DBMONEY    OBJECTINFO    TDS_DATETIMEALL    tds_thread   
    _dheader    DBMONEY4   
      p  
    tds_dblib_dbprocess    tds_time   
    _drecord    DBNUMERIC    tds_dblib_loginrec    tds_upd_col   
    _hcattr    dboption    pd    tds_dstr    tds_variant   
    _hchk    DBPROC_ROWBUF    pivot_t    tds_dynamic    tds_varmax_stream   
    _hdbc    DBREMOTE_PROC    _options::pivot_t    tds_dynamic_stream    tdsdaterec   
    _hdesc    DBREMOTE_PROC_PARAM    pollfd    tds_encoding    tdsdatetime   
    _heattr    dbstring    ProfileParam    tds_env    tdsdatetime4   
    _henv    dbtypeinfo    ptw32_mcs_node_t_    tds_errno_message_flags    tdsdump_off_item   
    _hsattr    DBVARYBIN   
      r  
    tds_error_message    tdsiconvdir   
    _hstmt    DBVARYCHAR    tds_file_stream    tdsiconvinfo   
    _options    des_key    retry_addr    tds_freeze    tdsmoney   
    _procedure    DLIST_LIST_TYPE    rsa_public_key    TDS_FUNCS    tdsmoney4   
    _sql_error    dlist_ring   
      s  
    tds_headers    tdsnumeric   
    _sql_errors    DSNINFO    tds_input_stream    tdsoldmoney   
      a  
      e  
    s_SqlMsgMap    tds_locale    tdsunique   
    s_v3to2map    tds_login    tdsvername_t   
    agg_t    END_LOGIN_EVENT    select_info    TDS_MAY_ALIAS    tmp_col_struct   
    _ | a | b | c | d | e | f | k | l | m | n | o | p | r | s | t
    freetds-1.3.6/doc/reference/closed.png000644 025423 025423 00000000204 14162303412 021255 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR à‘KIDATxíÝm @!†ÑGk™É7À-`&séts¦Àñþòð@åk}ª2€… P%Á_Ëþ¿N² .:0Dk¥‹Â›x" Ö›)¡xÒ5õIEND®B`‚freetds-1.3.6/doc/reference/dir_000001_000002.html000644 025423 025423 00000006453 14162303417 022364 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds -> replacements Relation
    FreeTDS API

    freetds → replacements Relation

    File in include/freetdsIncludes file in include/freetds/replacements
    replacements.hpoll.h
    freetds-1.3.6/doc/reference/dir_000005_000000.html000644 025423 025423 00000011616 14162303417 022363 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps -> include Relation
    FreeTDS API

    apps → include Relation

    File in src/appsIncludes file in include
    bsqldb.csybdb.h
    datacopy.csybdb.h
    defncopy.csybdb.h
    freebcp.csybdb.h
    freebcp.cfreetds / tds.h
    tsql.cfreetds / tds.h
    fisql / edit.csybdb.h
    fisql / fisql.csybdb.h
    fisql / handlers.csybdb.h
    fisql / interrupt.csybdb.h
    freetds-1.3.6/doc/reference/dir_000006_000000.html000644 025423 025423 00000006510 14162303417 022361 0ustar00fredianofrediano000000 000000 FreeTDS API: src/ctlib -> include Relation
    FreeTDS API

    ctlib → include Relation

    File in src/ctlibIncludes file in include
    ctutil.cfreetds / tds.h
    freetds-1.3.6/doc/reference/dir_000007_000000.html000644 025423 025423 00000013125 14162303417 022362 0ustar00fredianofrediano000000 000000 FreeTDS API: src/dblib -> include Relation
    FreeTDS API

    dblib → include Relation

    File in src/dblibIncludes file in include
    bcp.csybdb.h
    bcp.cfreetds / tds.h
    dblib.csybdb.h
    dblib.cfreetds / tds.h
    dbopen.csybdb.h
    dbopen.cfreetds / tds.h
    dbpivot.csybdb.h
    dbpivot.cfreetds / tds.h
    dbutil.csybdb.h
    dbutil.cfreetds / tds.h
    rpc.csybdb.h
    rpc.cfreetds / tds.h
    xact.csybdb.h
    xact.cfreetds / tds.h
    freetds-1.3.6/doc/reference/dir_000008_000000.html000644 025423 025423 00000007365 14162303417 022374 0ustar00fredianofrediano000000 000000 FreeTDS API: src/odbc -> include Relation
    FreeTDS API

    odbc → include Relation

    File in src/odbcIncludes file in include
    bcp.cfreetds / tds.h
    winlogin.cfreetds / tds.h
    winsetup.cfreetds / tds.h
    freetds-1.3.6/doc/reference/dir_000009_000000.html000644 025423 025423 00000007032 14162303417 022364 0ustar00fredianofrediano000000 000000 FreeTDS API: src/pool -> include Relation
    FreeTDS API

    pool → include Relation

    File in src/poolIncludes file in include
    pool.hfreetds / tds.h
    stream.cfreetds / tds.h
    freetds-1.3.6/doc/reference/dir_000010_000000.html000644 025423 025423 00000006601 14162303417 022355 0ustar00fredianofrediano000000 000000 FreeTDS API: src/replacements -> include Relation
    FreeTDS API

    replacements → include Relation

    File in src/replacementsIncludes file in include
    iconv.cfreetds / tds.h
    freetds-1.3.6/doc/reference/dir_000011_000000.html000644 025423 025423 00000007724 14162303417 022365 0ustar00fredianofrediano000000 000000 FreeTDS API: src/server -> include Relation
    FreeTDS API

    server → include Relation

    File in src/serverIncludes file in include
    login.cfreetds / tds.h
    query.cfreetds / tds.h
    server.cfreetds / tds.h
    unittest.cfreetds / tds.h
    freetds-1.3.6/doc/reference/dir_000012_000000.html000644 025423 025423 00000021056 14162303417 022360 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds -> include Relation
    FreeTDS API

    tds → include Relation

    File in src/tdsIncludes file in include
    bulk.cfreetds / tds.h
    challenge.cfreetds / tds.h
    config.cfreetds / tds.h
    convert.cfreetds / tds.h
    data.cfreetds / tds.h
    getmac.cfreetds / tds.h
    iconv.cfreetds / tds.h
    locale.cfreetds / tds.h
    log.cfreetds / tds.h
    login.cfreetds / tds.h
    mem.cfreetds / tds.h
    net.cfreetds / tds.h
    numeric.cfreetds / tds.h
    packet.cfreetds / tds.h
    query.cfreetds / tds.h
    random.cfreetds / tds.h
    read.cfreetds / tds.h
    sec_negotiate.cfreetds / tds.h
    stream.cfreetds / tds.h
    tds_checks.cfreetds / tds.h
    tls.cfreetds / tds.h
    token.cfreetds / tds.h
    util.cfreetds / tds.h
    vstrbuild.cfreetds / tds.h
    write.cfreetds / tds.h
    freetds-1.3.6/doc/reference/dir_000014_000000.html000644 025423 025423 00000007350 14162303417 022363 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps/fisql -> include Relation
    FreeTDS API

    fisql → include Relation

    File in src/apps/fisqlIncludes file in include
    edit.csybdb.h
    fisql.csybdb.h
    handlers.csybdb.h
    interrupt.csybdb.h
    freetds-1.3.6/doc/reference/dir_075bb3ff235063c77951cd176d15a741.html000644 025423 025423 00000006312 14162303417 025172 0ustar00fredianofrediano000000 000000 FreeTDS API: src/server Directory Reference
    FreeTDS API
    server Directory Reference
    Directory dependency graph for server:
    freetds-1.3.6/doc/reference/dir_075bb3ff235063c77951cd176d15a741_dep.dot000644 025423 025423 00000001501 14162303417 025637 0ustar00fredianofrediano000000 000000 digraph "src/server" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] dir_075bb3ff235063c77951cd176d15a741 [shape=box, label="server", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_075bb3ff235063c77951cd176d15a741.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_075bb3ff235063c77951cd176d15a741->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="4", labeldistance=1.5 headhref="dir_000011_000000.html"]; } freetds-1.3.6/doc/reference/doxygen.css000644 025423 025423 00000073355 14162303412 021506 0ustar00fredianofrediano000000 000000 /* The standard CSS for doxygen 1.8.20 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; } p.reference, p.definition { font: 400 14px/22px Roboto,sans-serif; } /* @group Heading Levels */ h1.groupheader { font-size: 150%; } .title { font: 400 14px/28px Roboto,sans-serif; font-size: 150%; font-weight: bold; margin: 10px 2px; } h2.groupheader { border-bottom: 1px solid #879ECB; color: #354C7B; font-size: 150%; font-weight: normal; margin-top: 1.75em; padding-top: 8px; padding-bottom: 4px; width: 100%; } h3.groupheader { font-size: 100%; } h1, h2, h3, h4, h5, h6 { -webkit-transition: text-shadow 0.5s linear; -moz-transition: text-shadow 0.5s linear; -ms-transition: text-shadow 0.5s linear; -o-transition: text-shadow 0.5s linear; transition: text-shadow 0.5s linear; margin-right: 15px; } h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { text-shadow: 0 0 15px cyan; } dt { font-weight: bold; } ul.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; column-count: 3; } p.startli, p.startdd { margin-top: 2px; } th p.starttd, th p.intertd, th p.endtd { font-size: 100%; font-weight: 700; } p.starttd { margin-top: 0px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } p.interli { } p.interdd { } p.intertd { } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #FFFFFF; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #FFFFFF; } a.el { font-weight: bold; } a.elRef { } a.code, a.code:visited, a.line, a.line:visited { color: #4665A2; } a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } ul { overflow: hidden; /*Fixed: list item bullets overlap floating elements*/ } #side-nav ul { overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ } #main-nav ul { overflow: visible; /* reset ul rule for the navigation bar drop down lists */ } .fragment { text-align: left; direction: ltr; overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/ overflow-y: hidden; } pre.fragment { border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; font-family: monospace, fixed; font-size: 105%; } div.fragment { padding: 0 0 1px 0; /*Fixed: last line underline overlap border*/ margin: 4px 8px 4px 2px; background-color: #FBFCFD; border: 1px solid #C4CFE5; } div.line { font-family: monospace, fixed; font-size: 13px; min-height: 13px; line-height: 1.0; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; margin: 0px; -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } div.line:after { content:"\000A"; white-space: pre; } div.line.glow { background-color: cyan; box-shadow: 0 0 10px cyan; } span.lineno { padding-right: 4px; text-align: right; border-right: 2px solid #0F0; background-color: #E8E8E8; white-space: pre; } span.lineno a { background-color: #D8D8D8; } span.lineno a:hover { background-color: #C8C8C8; } .lineno { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } div.ah, span.ah { background-color: black; font-weight: bold; color: #FFFFFF; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); } div.classindex ul { list-style: none; padding-left: 0; } div.classindex span.ai { display: inline-block; } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 12px; margin-right: 8px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl, img.inline { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } blockquote.DocNodeRTL { border-left: 0; border-right: 2px solid #9CAFD4; margin: 0 4px 0 24px; padding: 0 16px 0 12px; } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .memberdecls td, .fieldtable tr { -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } .memberdecls td.glow, .fieldtable tr.glow { background-color: cyan; box-shadow: 0 0 15px cyan; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memSeparator { border-bottom: 1px solid #DEE4F0; line-height: 1px; margin: 0px; padding: 0px; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight, .memTemplItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; font-size: 80%; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtitle { padding: 8px; border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; border-top-right-radius: 4px; border-top-left-radius: 4px; margin-bottom: -1px; background-image: url('nav_f.png'); background-repeat: repeat-x; background-color: #E2E8F2; line-height: 1.25; font-weight: 300; float:left; } .permalink { font-size: 65%; display: inline-block; vertical-align: middle; } .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; margin-bottom: 10px; margin-right: 5px; -webkit-transition: box-shadow 0.5s linear; -moz-transition: box-shadow 0.5s linear; -ms-transition: box-shadow 0.5s linear; -o-transition: box-shadow 0.5s linear; transition: box-shadow 0.5s linear; display: table !important; width: 100%; } .memitem.glow { box-shadow: 0 0 15px cyan; } .memname { font-weight: 400; margin-left: 6px; } .memname td { vertical-align: bottom; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); background-color: #DFE5F1; /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 4px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 4px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 4px; } .overload { font-family: "courier new",courier,monospace; font-size: 65%; } .memdoc, dl.reflist dd { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 10px 2px 10px; background-color: #FBFCFD; border-top-width: 0; background-image:url('nav_g.png'); background-repeat:repeat-x; background-color: #FFFFFF; /* opera specific markup */ border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; /* webkit specific markup */ -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .paramname code { line-height: 14px; } .params, .retval, .exception, .tparams { margin-left: 0px; padding-left: 0px; } .params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { font-weight: bold; vertical-align: top; } .params .paramtype, .tparams .paramtype { font-style: italic; vertical-align: top; } .params .paramdir, .tparams .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } table.mlabels { border-spacing: 0px; } td.mlabels-left { width: 100%; padding: 0px; } td.mlabels-right { vertical-align: bottom; padding: 0px; white-space: nowrap; } span.mlabels { margin-left: 8px; } span.mlabel { background-color: #728DC1; border-top:1px solid #5373B4; border-left:1px solid #5373B4; border-right:1px solid #C4CFE5; border-bottom:1px solid #C4CFE5; text-shadow: none; color: white; margin-right: 4px; padding: 2px 3px; border-radius: 3px; font-size: 7pt; white-space: nowrap; vertical-align: middle; } /* @end */ /* these are for tree view inside a (index) page */ div.directory { margin: 10px 0px; border-top: 1px solid #9CAFD4; border-bottom: 1px solid #9CAFD4; width: 100%; } .directory table { border-collapse:collapse; } .directory td { margin: 0px; padding: 0px; vertical-align: top; } .directory td.entry { white-space: nowrap; padding-right: 6px; padding-top: 3px; } .directory td.entry a { outline:none; } .directory td.entry a img { border: none; } .directory td.desc { width: 100%; padding-left: 6px; padding-right: 6px; padding-top: 3px; border-left: 1px solid rgba(0,0,0,0.05); } .directory tr.even { padding-left: 6px; background-color: #F7F8FB; } .directory img { vertical-align: -30%; } .directory .levels { white-space: nowrap; width: 100%; text-align: right; font-size: 9pt; } .directory .levels span { cursor: pointer; padding-left: 2px; padding-right: 2px; color: #3D578C; } .arrow { color: #9CAFD4; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: pointer; font-size: 80%; display: inline-block; width: 16px; height: 22px; } .icon { font-family: Arial, Helvetica; font-weight: bold; font-size: 12px; height: 14px; width: 16px; display: inline-block; background-color: #728DC1; color: white; text-align: center; border-radius: 4px; margin-left: 2px; margin-right: 2px; } .icona { width: 24px; height: 22px; display: inline-block; } .iconfopen { width: 24px; height: 18px; margin-bottom: 4px; background-image:url('folderopen.png'); background-position: 0px -4px; background-repeat: repeat-y; vertical-align:top; display: inline-block; } .iconfclosed { width: 24px; height: 18px; margin-bottom: 4px; background-image:url('folderclosed.png'); background-position: 0px -4px; background-repeat: repeat-y; vertical-align:top; display: inline-block; } .icondoc { width: 24px; height: 18px; margin-bottom: 4px; background-image:url('doc.png'); background-position: 0px -4px; background-repeat: repeat-y; vertical-align:top; display: inline-block; } table.directory { font: 400 14px Roboto,sans-serif; } /* @end */ div.dynheader { margin-top: 8px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } address { font-style: normal; color: #2A3D61; } table.doxtable caption { caption-side: top; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { /*width: 100%;*/ margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fieldname { padding-top: 3px; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; /*width: 100%;*/ } .fieldtable td.fielddoc p:first-child { margin-top: 0px; } .fieldtable td.fielddoc p:last-child { margin-bottom: 2px; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; font-weight: 400; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; background-position: 0 -5px; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; color: #283A5D; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } table.classindex { margin: 10px; white-space: nowrap; margin-left: 3%; margin-right: 3%; width: 94%; border: 0; border-spacing: 0; padding: 0; } div.ingroups { font-size: 8pt; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 10px; } .PageDocRTL-title div.headertitle { text-align: right; direction: rtl; } dl { padding: 0 0 0 0; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug, dl.examples */ dl.section { margin-left: 0px; padding-left: 0px; } dl.section.DocNodeRTL { margin-right: 0px; padding-right: 0px; } dl.note { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #D0C000; } dl.note.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #D0C000; } dl.warning, dl.attention { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #FF0000; } dl.warning.DocNodeRTL, dl.attention.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #00D000; } dl.pre.DocNodeRTL, dl.post.DocNodeRTL, dl.invariant.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #00D000; } dl.deprecated { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #505050; } dl.deprecated.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #505050; } dl.todo { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #00C0E0; } dl.todo.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #00C0E0; } dl.test { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #3030E0; } dl.test.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #3030E0; } dl.bug { margin-left: -7px; padding-left: 3px; border-left: 4px solid; border-color: #C08050; } dl.bug.DocNodeRTL { margin-left: 0; padding-left: 0; border-left: 0; margin-right: -7px; padding-right: 3px; border-right: 4px solid; border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectalign { vertical-align: middle; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .plantumlgraph { text-align: center; } .diagraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; text-align:right; width:52px; } dl.citelist dd { margin:2px 0 2px 72px; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 8px 10px 10px; width: 200px; } .PageDocRTL-title div.toc { float: left !important; text-align: right; } div.toc li { background: url("bdwn.png") no-repeat scroll 0 5px transparent; font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } .PageDocRTL-title div.toc li { background-position-x: right !important; padding-left: 0 !important; padding-right: 10px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } .PageDocRTL-title div.toc li.level1 { margin-left: 0 !important; margin-right: 0; } .PageDocRTL-title div.toc li.level2 { margin-left: 0 !important; margin-right: 15px; } .PageDocRTL-title div.toc li.level3 { margin-left: 0 !important; margin-right: 30px; } .PageDocRTL-title div.toc li.level4 { margin-left: 0 !important; margin-right: 45px; } .inherit_header { font-weight: bold; color: gray; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .inherit_header td { padding: 6px 0px 2px 5px; } .inherit { display: none; } tr.heading h2 { margin-top: 12px; margin-bottom: 4px; } /* tooltip related style info */ .ttc { position: absolute; display: none; } #powerTip { cursor: default; white-space: nowrap; background-color: white; border: 1px solid gray; border-radius: 4px 4px 4px 4px; box-shadow: 1px 1px 7px gray; display: none; font-size: smaller; max-width: 80%; opacity: 0.9; padding: 1ex 1em 1em; position: absolute; z-index: 2147483647; } #powerTip div.ttdoc { color: grey; font-style: italic; } #powerTip div.ttname a { font-weight: bold; } #powerTip div.ttname { font-weight: bold; } #powerTip div.ttdeci { color: #006318; } #powerTip div { margin: 0px; padding: 0px; font: 12px/16px Roboto,sans-serif; } #powerTip:before, #powerTip:after { content: ""; position: absolute; margin: 0px; } #powerTip.n:after, #powerTip.n:before, #powerTip.s:after, #powerTip.s:before, #powerTip.w:after, #powerTip.w:before, #powerTip.e:after, #powerTip.e:before, #powerTip.ne:after, #powerTip.ne:before, #powerTip.se:after, #powerTip.se:before, #powerTip.nw:after, #powerTip.nw:before, #powerTip.sw:after, #powerTip.sw:before { border: solid transparent; content: " "; height: 0; width: 0; position: absolute; } #powerTip.n:after, #powerTip.s:after, #powerTip.w:after, #powerTip.e:after, #powerTip.nw:after, #powerTip.ne:after, #powerTip.sw:after, #powerTip.se:after { border-color: rgba(255, 255, 255, 0); } #powerTip.n:before, #powerTip.s:before, #powerTip.w:before, #powerTip.e:before, #powerTip.nw:before, #powerTip.ne:before, #powerTip.sw:before, #powerTip.se:before { border-color: rgba(128, 128, 128, 0); } #powerTip.n:after, #powerTip.n:before, #powerTip.ne:after, #powerTip.ne:before, #powerTip.nw:after, #powerTip.nw:before { top: 100%; } #powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { border-top-color: #FFFFFF; border-width: 10px; margin: 0px -10px; } #powerTip.n:before { border-top-color: #808080; border-width: 11px; margin: 0px -11px; } #powerTip.n:after, #powerTip.n:before { left: 50%; } #powerTip.nw:after, #powerTip.nw:before { right: 14px; } #powerTip.ne:after, #powerTip.ne:before { left: 14px; } #powerTip.s:after, #powerTip.s:before, #powerTip.se:after, #powerTip.se:before, #powerTip.sw:after, #powerTip.sw:before { bottom: 100%; } #powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { border-bottom-color: #FFFFFF; border-width: 10px; margin: 0px -10px; } #powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { border-bottom-color: #808080; border-width: 11px; margin: 0px -11px; } #powerTip.s:after, #powerTip.s:before { left: 50%; } #powerTip.sw:after, #powerTip.sw:before { right: 14px; } #powerTip.se:after, #powerTip.se:before { left: 14px; } #powerTip.e:after, #powerTip.e:before { left: 100%; } #powerTip.e:after { border-left-color: #FFFFFF; border-width: 10px; top: 50%; margin-top: -10px; } #powerTip.e:before { border-left-color: #808080; border-width: 11px; top: 50%; margin-top: -11px; } #powerTip.w:after, #powerTip.w:before { right: 100%; } #powerTip.w:after { border-right-color: #FFFFFF; border-width: 10px; top: 50%; margin-top: -10px; } #powerTip.w:before { border-right-color: #808080; border-width: 11px; top: 50%; margin-top: -11px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } } /* @group Markdown */ table.markdownTable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.markdownTable td, table.markdownTable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.markdownTable tr { } th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } th.markdownTableHeadLeft, td.markdownTableBodyLeft { text-align: left } th.markdownTableHeadRight, td.markdownTableBodyRight { text-align: right } th.markdownTableHeadCenter, td.markdownTableBodyCenter { text-align: center } .DocNodeRTL { text-align: right; direction: rtl; } .DocNodeLTR { text-align: left; direction: ltr; } table.DocNodeRTL { width: auto; margin-right: 0; margin-left: auto; } table.DocNodeLTR { width: auto; margin-right: auto; margin-left: 0; } tt, code, kbd, samp { display: inline-block; direction:ltr; } /* @end */ u { text-decoration: underline; } freetds-1.3.6/doc/reference/doxygen.svg000644 025423 025423 00000036026 14162303412 021507 0ustar00fredianofrediano000000 000000 freetds-1.3.6/doc/reference/dynsections.js000644 025423 025423 00000010544 14162303412 022206 0ustar00fredianofrediano000000 000000 /* @licstart The following is the entire license notice for the JavaScript code in this file. The MIT License (MIT) Copyright (C) 1997-2020 by Dimitri van Heesch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @licend The above is the entire license notice for the JavaScript code in this file */ function toggleVisibility(linkObj) { var base = $(linkObj).attr('id'); var summary = $('#'+base+'-summary'); var content = $('#'+base+'-content'); var trigger = $('#'+base+'-trigger'); var src=$(trigger).attr('src'); if (content.is(':visible')===true) { content.hide(); summary.show(); $(linkObj).addClass('closed').removeClass('opened'); $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); } else { content.show(); summary.hide(); $(linkObj).removeClass('closed').addClass('opened'); $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); } return false; } function updateStripes() { $('table.directory tr'). removeClass('even').filter(':visible:even').addClass('even'); } function toggleLevel(level) { $('table.directory tr').each(function() { var l = this.id.split('_').length-1; var i = $('#img'+this.id.substring(3)); var a = $('#arr'+this.id.substring(3)); if (l FreeTDS API: include/freetds/utils Directory Reference
    FreeTDS API
    utils Directory Reference
    freetds-1.3.6/doc/reference/dir_313caf1132e152dd9b58bea13a4052ca.html000644 025423 025423 00000006070 14162303417 025436 0ustar00fredianofrediano000000 000000 FreeTDS API: src/utils Directory Reference
    FreeTDS API
    utils Directory Reference
    freetds-1.3.6/doc/reference/dir_53adf0b982dc8545998aae3f283a5a58.html000644 025423 025423 00000006525 14162303417 025442 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps Directory Reference
    FreeTDS API
    apps Directory Reference
    Directory dependency graph for apps:

    Directories

    freetds-1.3.6/doc/reference/dir_53adf0b982dc8545998aae3f283a5a58_dep.dot000644 025423 025423 00000002274 14162303417 026111 0ustar00fredianofrediano000000 000000 digraph "src/apps" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] subgraph clusterdir_53adf0b982dc8545998aae3f283a5a58 { graph [ bgcolor="#eeeeff", pencolor="black", label="" URL="dir_53adf0b982dc8545998aae3f283a5a58.html"]; dir_53adf0b982dc8545998aae3f283a5a58 [shape=plaintext label="apps"]; dir_cbfc6763032c97ce96998fb3f3059024 [shape=box label="fisql" color="black" fillcolor="white" style="filled" URL="dir_cbfc6763032c97ce96998fb3f3059024.html"]; } } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_53adf0b982dc8545998aae3f283a5a58->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="10", labeldistance=1.5 headhref="dir_000005_000000.html"]; dir_cbfc6763032c97ce96998fb3f3059024->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="4", labeldistance=1.5 headhref="dir_000014_000000.html"]; } freetds-1.3.6/doc/reference/dir_55f38a2371e9df5f191489d3a446274f.html000644 025423 025423 00000006102 14162303417 025216 0ustar00fredianofrediano000000 000000 FreeTDS API: win32/freetds Directory Reference
    FreeTDS API
    freetds Directory Reference
    freetds-1.3.6/doc/reference/dir_66c0b1abd56d99bc52d1cf04cdcfa94c.html000644 025423 025423 00000006241 14162303417 025766 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds/example Directory Reference
    FreeTDS API
    example Directory Reference
    freetds-1.3.6/doc/reference/dir_68267d1309a1af8e8297ef4c3efbcdba.html000644 025423 025423 00000006356 14162303417 025656 0ustar00fredianofrediano000000 000000 FreeTDS API: src Directory Reference
    FreeTDS API
    src Directory Reference
    Directory dependency graph for src:

    Directories

    freetds-1.3.6/doc/reference/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.dot000644 025423 025423 00000006161 14162303417 026322 0ustar00fredianofrediano000000 000000 digraph "src" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#eeeeff", pencolor="black", label="" URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"]; dir_68267d1309a1af8e8297ef4c3efbcdba [shape=plaintext label="src"]; dir_53adf0b982dc8545998aae3f283a5a58 [shape=box label="apps" color="red" fillcolor="white" style="filled" URL="dir_53adf0b982dc8545998aae3f283a5a58.html"]; dir_99d384962ca3f8ea1fb7b61d44d1972c [shape=box label="ctlib" color="black" fillcolor="white" style="filled" URL="dir_99d384962ca3f8ea1fb7b61d44d1972c.html"]; dir_a40d3d1dfafadc5a5d3063931c3db36e [shape=box label="dblib" color="black" fillcolor="white" style="filled" URL="dir_a40d3d1dfafadc5a5d3063931c3db36e.html"]; dir_807893467092ee3c78fdb68ff7be3fa1 [shape=box label="odbc" color="black" fillcolor="white" style="filled" URL="dir_807893467092ee3c78fdb68ff7be3fa1.html"]; dir_e2de76ba30642a92752881ffd21fbc7e [shape=box label="pool" color="black" fillcolor="white" style="filled" URL="dir_e2de76ba30642a92752881ffd21fbc7e.html"]; dir_bee58700ce781bb55a015c4ff9b057cf [shape=box label="replacements" color="black" fillcolor="white" style="filled" URL="dir_bee58700ce781bb55a015c4ff9b057cf.html"]; dir_075bb3ff235063c77951cd176d15a741 [shape=box label="server" color="black" fillcolor="white" style="filled" URL="dir_075bb3ff235063c77951cd176d15a741.html"]; dir_f7308370ebb9c2ff76f3bdfe0748aabf [shape=box label="tds" color="red" fillcolor="white" style="filled" URL="dir_f7308370ebb9c2ff76f3bdfe0748aabf.html"]; dir_313caf1132e152dd9b58bea13a4052ca [shape=box label="utils" color="black" fillcolor="white" style="filled" URL="dir_313caf1132e152dd9b58bea13a4052ca.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_bee58700ce781bb55a015c4ff9b057cf->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="1", labeldistance=1.5 headhref="dir_000010_000000.html"]; dir_807893467092ee3c78fdb68ff7be3fa1->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="3", labeldistance=1.5 headhref="dir_000008_000000.html"]; dir_075bb3ff235063c77951cd176d15a741->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="4", labeldistance=1.5 headhref="dir_000011_000000.html"]; dir_99d384962ca3f8ea1fb7b61d44d1972c->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="1", labeldistance=1.5 headhref="dir_000006_000000.html"]; dir_f7308370ebb9c2ff76f3bdfe0748aabf->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="25", labeldistance=1.5 headhref="dir_000012_000000.html"]; dir_e2de76ba30642a92752881ffd21fbc7e->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="2", labeldistance=1.5 headhref="dir_000009_000000.html"]; dir_53adf0b982dc8545998aae3f283a5a58->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="10", labeldistance=1.5 headhref="dir_000005_000000.html"]; dir_a40d3d1dfafadc5a5d3063931c3db36e->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="14", labeldistance=1.5 headhref="dir_000007_000000.html"]; } freetds-1.3.6/doc/reference/dir_807893467092ee3c78fdb68ff7be3fa1.html000644 025423 025423 00000006302 14162303417 025450 0ustar00fredianofrediano000000 000000 FreeTDS API: src/odbc Directory Reference
    FreeTDS API
    odbc Directory Reference
    Directory dependency graph for odbc:
    freetds-1.3.6/doc/reference/files.html000644 025423 025423 00000066402 14162303417 021307 0ustar00fredianofrediano000000 000000 FreeTDS API: File List
    FreeTDS API
    File List
    Here is a list of all documented files with brief descriptions:
    [detail level 1234]
      include
      freetds
      replacements
     poll.hProvide poll call where missing
     readpassphrase.h
      utils
     bjoern-utf8.h
     des.h
     dlist.h
     dlist.tmpl.h
     hmac_md5.h
     md4.h
     md5.h
     string.h
     alloca.h
     alternative_character_sets.h
     bool.h
     bytes.h
     character_sets.h
     charset_lookup.h
     checks.h
     configs.h
     convert.h
     data.h
     encodings.h
     enum_cap.h
     iconv.h
     macros.h
     odbc.h
     popvis.h
     proto.h
     pushvis.h
     replacements.h
     server.h
     stream.h
     sysdep_private.h
     tds.hMain include file for libtds
     thread.h
     time.h
     tls.h
     utils.h
     version.h
     windows.h
     bkpublic.h
     config.h
     cspublic.h
     cstypes.h
     ctlib.h
     ctpublic.h
     dblib.h
     odbcss.h
     sqldb.h
     sqlfront.h
     sybdb.dox.h
     sybdb.hPrimary include file for db-lib applications
     syberror.h
     sybfront.h
     tds_sysdep_public.h
      src
      apps
      fisql
     edit.h
     handlers.h
     interrupt.h
     terminal.h
     freebcp.h
      dblib
     bcp.cImplementation of db-lib bulk copy functions
     buffering.h
     dblib.cMain implementation file for db-lib
     error_table.h
      odbc
     error_export.h
     odbc_export.h
     resource.h
     sqlwparams.h
      pool
     pool.h
      replacements
     iconv.cThis file implements a very simple iconv
     iconv_charsets.h
      tds
     bulk.cHandle bulk copy
     data.cHandle different data handling from network
     iconv.cHandle character conversions to/from server
     num_limits.h
     read.cGrab data from TDS packets
     sec_negotiate_gnutls.h
     sec_negotiate_openssl.h
     stream.cHandle stream of data
     tds_types.h
     tds_willconvert.h
     token.cContains all routines to get replies from server
      vms
     stdint.h
     vargdefs.h
      win32
      freetds
     sysconfdir.h
    freetds-1.3.6/doc/reference/dir_807893467092ee3c78fdb68ff7be3fa1_dep.dot000644 025423 025423 00000001475 14162303417 026130 0ustar00fredianofrediano000000 000000 digraph "src/odbc" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] dir_807893467092ee3c78fdb68ff7be3fa1 [shape=box, label="odbc", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_807893467092ee3c78fdb68ff7be3fa1.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_807893467092ee3c78fdb68ff7be3fa1->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="3", labeldistance=1.5 headhref="dir_000008_000000.html"]; } freetds-1.3.6/doc/reference/dir_88c98ec7a422f3972a0293d4e4a2e62e.html000644 025423 025423 00000005717 14162303417 025360 0ustar00fredianofrediano000000 000000 FreeTDS API: vms Directory Reference
    FreeTDS API
    vms Directory Reference
    freetds-1.3.6/doc/reference/dir_99d384962ca3f8ea1fb7b61d44d1972c.html000644 025423 025423 00000006306 14162303417 025437 0ustar00fredianofrediano000000 000000 FreeTDS API: src/ctlib Directory Reference
    FreeTDS API
    ctlib Directory Reference
    Directory dependency graph for ctlib:
    freetds-1.3.6/doc/reference/dir_99d384962ca3f8ea1fb7b61d44d1972c_dep.dot000644 025423 025423 00000001477 14162303417 026115 0ustar00fredianofrediano000000 000000 digraph "src/ctlib" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] dir_99d384962ca3f8ea1fb7b61d44d1972c [shape=box, label="ctlib", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_99d384962ca3f8ea1fb7b61d44d1972c.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_99d384962ca3f8ea1fb7b61d44d1972c->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="1", labeldistance=1.5 headhref="dir_000006_000000.html"]; } freetds-1.3.6/doc/reference/dir_a40d3d1dfafadc5a5d3063931c3db36e.html000644 025423 025423 00000010232 14162303417 025664 0ustar00fredianofrediano000000 000000 FreeTDS API: src/dblib Directory Reference
    FreeTDS API
    dblib Directory Reference
    Directory dependency graph for dblib:

    Files

    file  bcp.c
     Implementation of db-lib bulk copy functions.
     
    file  dblib.c
     Main implementation file for db-lib.
     
    freetds-1.3.6/doc/reference/dir_a40d3d1dfafadc5a5d3063931c3db36e_dep.dot000644 025423 025423 00000001500 14162303417 026334 0ustar00fredianofrediano000000 000000 digraph "src/dblib" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] dir_a40d3d1dfafadc5a5d3063931c3db36e [shape=box, label="dblib", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_a40d3d1dfafadc5a5d3063931c3db36e.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_a40d3d1dfafadc5a5d3063931c3db36e->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="14", labeldistance=1.5 headhref="dir_000007_000000.html"]; } freetds-1.3.6/doc/reference/dir_b4f92dd377abba25bba37a57cb06d57a.html000644 025423 025423 00000006150 14162303417 025701 0ustar00fredianofrediano000000 000000 FreeTDS API: win32 Directory Reference
    FreeTDS API
    win32 Directory Reference

    Directories

    freetds-1.3.6/doc/reference/dir_b663d705931e630ae54c555929c6aaad.html000644 025423 025423 00000007402 14162303417 025336 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds/replacements Directory Reference
    FreeTDS API
    replacements Directory Reference

    Files

    file  poll.h [code]
     Provide poll call where missing.
     
    freetds-1.3.6/doc/reference/dir_bee58700ce781bb55a015c4ff9b057cf.html000644 025423 025423 00000007406 14162303417 025561 0ustar00fredianofrediano000000 000000 FreeTDS API: src/replacements Directory Reference
    FreeTDS API
    replacements Directory Reference
    Directory dependency graph for replacements:

    Files

    file  iconv.c
     This file implements a very simple iconv.
     
    freetds-1.3.6/doc/reference/folderopen.png000644 025423 025423 00000001125 14162303421 022144 0ustar00fredianofrediano000000 000000 ‰PNG  IHDRÚ}\ˆIDATxí]?oÓPÿ9iš4i°;ii“¶‰ZЉ‘‰ÀÀ7`bèÔÙ¬Øù,HìU'ô$*Tµ]‚T¡DPÚÄ6wÏ}‰;¡C; a¿ÓߟûÝïîž¼jAÀ­InSþ}€9H“ÓŽ|?íÁ÷ =_ÊÆŠ­†¥Àue*;¯YEäsYäæB¢Ÿ¿þÄ—£sÙ½½ÙŒ† É«›©ÀYÇq !GÇ¿v̇¹ÑØ®š °Œ‚ÔF¹}q¥b]÷7í·0)Úd›¾ÿð-èº}Pfä£ÖY{4™ÑÂ@}úæôñ2ÛüÔ—ñúåNŒI‚ÁǃcçÁº%£¬UаI³mc±ô˜å¼ÔÆüÈ>é¸xþt9Æ$µý OæVE*õU´Ì‚ç#ž×ˆ•ïûr@l$øPÿrHaaÇ¥ ²›dZ®rè‘ãqI„o¼øT\Ž,tªj2FAxv-LŸp׌p TÄI/ \¥sfí½; jViTƒèú¤o^cpÅü¼ûû»Ïb]”€¢¤<†aþÕœ²“ßÓ˜y“£§9:Œîù+À³€ñà,E žf³6éNˆÄE£KU}Ü^;¶ØnZ¢uß­US4— ѬëbížN¶.Úk¦ØjTÄöº%µªâ i¯VÄÊÝò§™ Èù¸)ùÿG€™òºJ@T x”IEND®B`‚freetds-1.3.6/doc/reference/dir_bee58700ce781bb55a015c4ff9b057cf_dep.dot000644 025423 025423 00000001515 14162303417 026226 0ustar00fredianofrediano000000 000000 digraph "src/replacements" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] dir_bee58700ce781bb55a015c4ff9b057cf [shape=box, label="replacements", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_bee58700ce781bb55a015c4ff9b057cf.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_bee58700ce781bb55a015c4ff9b057cf->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="1", labeldistance=1.5 headhref="dir_000010_000000.html"]; } freetds-1.3.6/doc/reference/dir_cbfc6763032c97ce96998fb3f3059024.html000644 025423 025423 00000006453 14162303417 025307 0ustar00fredianofrediano000000 000000 FreeTDS API: src/apps/fisql Directory Reference
    FreeTDS API
    fisql Directory Reference
    Directory dependency graph for fisql:
    freetds-1.3.6/doc/reference/dir_cbfc6763032c97ce96998fb3f3059024_dep.dot000644 025423 025423 00000001505 14162303417 025752 0ustar00fredianofrediano000000 000000 digraph "src/apps/fisql" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_53adf0b982dc8545998aae3f283a5a58 { graph [ bgcolor="#ddddee", pencolor="black", label="apps" fontname="Helvetica", fontsize="10", URL="dir_53adf0b982dc8545998aae3f283a5a58.html"] dir_cbfc6763032c97ce96998fb3f3059024 [shape=box, label="fisql", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_cbfc6763032c97ce96998fb3f3059024.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_cbfc6763032c97ce96998fb3f3059024->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="4", labeldistance=1.5 headhref="dir_000014_000000.html"]; } freetds-1.3.6/doc/reference/dir_d44c64559bbebec7f509842c48db8b23.html000644 025423 025423 00000007515 14162303417 025516 0ustar00fredianofrediano000000 000000 FreeTDS API: include Directory Reference
    FreeTDS API
    include Directory Reference
    Directory dependency graph for include:

    Directories

    Files

    file  sybdb.h [code]
     Primary include file for db-lib applications.
     
    freetds-1.3.6/doc/reference/dir_d44c64559bbebec7f509842c48db8b23_dep.dot000644 025423 025423 00000001046 14162303417 026161 0ustar00fredianofrediano000000 000000 digraph "include" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_d44c64559bbebec7f509842c48db8b23 { graph [ bgcolor="#eeeeff", pencolor="black", label="" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_d44c64559bbebec7f509842c48db8b23 [shape=plaintext label="include"]; dir_f46f2c05841018b6ef8dbd3316ddb41a [shape=box label="freetds" color="red" fillcolor="white" style="filled" URL="dir_f46f2c05841018b6ef8dbd3316ddb41a.html"]; } } freetds-1.3.6/doc/reference/dir_e2de76ba30642a92752881ffd21fbc7e.html000644 025423 025423 00000006302 14162303417 025477 0ustar00fredianofrediano000000 000000 FreeTDS API: src/pool Directory Reference
    FreeTDS API
    pool Directory Reference
    Directory dependency graph for pool:
    freetds-1.3.6/doc/reference/dir_e2de76ba30642a92752881ffd21fbc7e_dep.dot000644 025423 025423 00000001475 14162303417 026157 0ustar00fredianofrediano000000 000000 digraph "src/pool" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] dir_e2de76ba30642a92752881ffd21fbc7e [shape=box, label="pool", style="filled", fillcolor="#eeeeff", pencolor="black", URL="dir_e2de76ba30642a92752881ffd21fbc7e.html"]; } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_e2de76ba30642a92752881ffd21fbc7e->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="2", labeldistance=1.5 headhref="dir_000009_000000.html"]; } freetds-1.3.6/doc/reference/dir_f46f2c05841018b6ef8dbd3316ddb41a.html000644 025423 025423 00000007646 14162303417 025477 0ustar00fredianofrediano000000 000000 FreeTDS API: include/freetds Directory Reference
    FreeTDS API
    freetds Directory Reference
    Directory dependency graph for freetds:

    Directories

    Files

    file  tds.h [code]
     Main include file for libtds.
     
    freetds-1.3.6/doc/reference/dir_f46f2c05841018b6ef8dbd3316ddb41a_dep.dot000644 025423 025423 00000002077 14162303417 026142 0ustar00fredianofrediano000000 000000 digraph "include/freetds" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_d44c64559bbebec7f509842c48db8b23 { graph [ bgcolor="#ddddee", pencolor="black", label="include" fontname="Helvetica", fontsize="10", URL="dir_d44c64559bbebec7f509842c48db8b23.html"] subgraph clusterdir_f46f2c05841018b6ef8dbd3316ddb41a { graph [ bgcolor="#eeeeff", pencolor="black", label="" URL="dir_f46f2c05841018b6ef8dbd3316ddb41a.html"]; dir_f46f2c05841018b6ef8dbd3316ddb41a [shape=plaintext label="freetds"]; dir_b663d705931e630ae54c555929c6aaad [shape=box label="replacements" color="black" fillcolor="white" style="filled" URL="dir_b663d705931e630ae54c555929c6aaad.html"]; dir_0da4150d9fb2a5fe66d7630d7a98e2a8 [shape=box label="utils" color="black" fillcolor="white" style="filled" URL="dir_0da4150d9fb2a5fe66d7630d7a98e2a8.html"]; } } dir_f46f2c05841018b6ef8dbd3316ddb41a->dir_b663d705931e630ae54c555929c6aaad [headlabel="1", labeldistance=1.5 headhref="dir_000001_000002.html"]; } freetds-1.3.6/doc/reference/functions.html000644 025423 025423 00000045427 14162303417 022221 0ustar00fredianofrediano000000 000000 FreeTDS API: Class Members
    FreeTDS API
    Here is a list of all documented class members with links to the class documentation for each member:

    - a -

    - b -

    - c -

    - d -

    - e -

    - f -

    - h -

    - i -

    - l -

    - m -

    - n -

    - o -

    - p -

    - q -

    - r -

    - s -

    - t -

    - u -

    - w -

    - y -

    freetds-1.3.6/doc/reference/dir_f7308370ebb9c2ff76f3bdfe0748aabf.html000644 025423 025423 00000013504 14162303417 025726 0ustar00fredianofrediano000000 000000 FreeTDS API: src/tds Directory Reference
    FreeTDS API
    tds Directory Reference
    Directory dependency graph for tds:

    Directories

    Files

    file  bulk.c
     Handle bulk copy.
     
    file  data.c
     Handle different data handling from network.
     
    file  iconv.c
     Handle character conversions to/from server.
     
    file  read.c
     Grab data from TDS packets.
     
    file  stream.c
     Handle stream of data.
     
    file  token.c
     Contains all routines to get replies from server.
     
    freetds-1.3.6/doc/reference/dir_f7308370ebb9c2ff76f3bdfe0748aabf_dep.dot000644 025423 025423 00000002051 14162303417 026373 0ustar00fredianofrediano000000 000000 digraph "src/tds" { compound=true node [ fontsize="10", fontname="Helvetica"]; edge [ labelfontsize="10", labelfontname="Helvetica"]; subgraph clusterdir_68267d1309a1af8e8297ef4c3efbcdba { graph [ bgcolor="#ddddee", pencolor="black", label="src" fontname="Helvetica", fontsize="10", URL="dir_68267d1309a1af8e8297ef4c3efbcdba.html"] subgraph clusterdir_f7308370ebb9c2ff76f3bdfe0748aabf { graph [ bgcolor="#eeeeff", pencolor="black", label="" URL="dir_f7308370ebb9c2ff76f3bdfe0748aabf.html"]; dir_f7308370ebb9c2ff76f3bdfe0748aabf [shape=plaintext label="tds"]; dir_66c0b1abd56d99bc52d1cf04cdcfa94c [shape=box label="example" color="black" fillcolor="white" style="filled" URL="dir_66c0b1abd56d99bc52d1cf04cdcfa94c.html"]; } } dir_d44c64559bbebec7f509842c48db8b23 [shape=box label="include" fillcolor="white" style="filled" color="red" URL="dir_d44c64559bbebec7f509842c48db8b23.html"]; dir_f7308370ebb9c2ff76f3bdfe0748aabf->dir_d44c64559bbebec7f509842c48db8b23 [headlabel="25", labeldistance=1.5 headhref="dir_000012_000000.html"]; } freetds-1.3.6/doc/reference/folderclosed.png000644 025423 025423 00000001150 14162303421 022452 0ustar00fredianofrediano000000 000000 ‰PNG  IHDRÚ}\ˆ/IDATxí]MOÔ@~ÚúuØlp]ö¿#›Å]PYECˆ\9ù¼yÑß`ÖÄÿàÿÀÉxóâ¢C &=qÐÄ£—vZçv¶3m؃‡vžLûNç}Þ÷}Þ½ZA@n° OäNp ’xóþK°ññ€xÜj”°8sÑ€“ “€œ_¼[Âíæ§ïD'‚•yye+ø¼û 7#rNŸlïük* ¾0Ь_d«_(àñÖ±àôz=ñxõv§÷h©‰z¹€šØP-äóä’̪uý¼$»\DãJc—B4¯ãÝÖ.:£Ï-ÑÏß}µŠLEíºþ #—ûáºÀÏgN;BŠ€6ïýñ䬜…ö@’Ðåñp&™h>p9¤™EEά¨ÎÊ‘" u¥n€$R"?{¹<˜…ë…%PNtâ$‰ß¶±úá+^<é"§2 ªDq”q´\¬«Ò™a–Œ‘©Aÿ€"Ôµ ™êŸèP£}#Eàz{û.8i îp³ê(ADwD¦E<ê¬cE¦$ HdÊÄ ”.:Ù GŽ-`ŒL‚ý¾'¢‰Ä<¤CIª½;ÙÇTZd±i};>èôß‚z×;K×§8t ¤Ž q”:uvÿv•Ý›¬²ÙvEân{„M·FXg¼ÌfZÖ¨°¹‰*›ßÌß©±ù©:›j–YqèÜë#3çÏSøWøÿÿÑr'ø Ôùù‚ ©¡IEND®B`‚freetds-1.3.6/doc/reference/functions_vars.html000644 025423 025423 00000045247 14162303417 023254 0ustar00fredianofrediano000000 000000 FreeTDS API: Class Members - Variables
    FreeTDS API
     

    - a -

    - b -

    - c -

    - d -

    - e -

    - f -

    - h -

    - i -

    - l -

    - m -

    - n -

    - o -

    - p -

    - q -

    - r -

    - s -

    - t -

    - u -

    - w -

    - y -

    freetds-1.3.6/doc/reference/globals.html000644 025423 025423 00000010464 14162303417 021625 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - _ -

    • _bcp_convert_in() : bcp.c
    • _bcp_convert_out() : bcp.c
    • _bcp_exec_in() : bcp.c
    • _bcp_exec_out() : bcp.c
    • _bcp_fgets() : bcp.c
    • _bcp_free_columns() : bcp.c
    • _bcp_free_storage() : bcp.c
    • _bcp_get_col_data() : bcp.c
    • _bcp_get_term_var() : bcp.c
    • _bcp_no_get_col_data() : bcp.c
    • _bcp_read_hostfile() : bcp.c
    • _bcp_readfmt_colinfo() : bcp.c
    • _dbcoldata() : dblib.c
    • _dbresults() : dblib.c
    freetds-1.3.6/doc/reference/globals_a.html000644 025423 025423 00000005702 14162303417 022124 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - a -

    • adjust_character_column_size() : token.c
    freetds-1.3.6/doc/reference/globals_b.html000644 025423 025423 00000013200 14162303417 022115 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - b -

    freetds-1.3.6/doc/reference/globals_d.html000644 025423 025423 00000076107 14162303417 022136 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - d -

    freetds-1.3.6/doc/reference/globals_defs.html000644 025423 025423 00000014602 14162303417 022624 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - b -

    - d -

    - i -

    • is_datetime_type : tds.h

    - t -

    freetds-1.3.6/doc/reference/globals_enum.html000644 025423 025423 00000005757 14162303417 022662 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     
    freetds-1.3.6/doc/reference/globals_eval.html000644 025423 025423 00000011062 14162303417 022627 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     
    freetds-1.3.6/doc/reference/globals_func.html000644 025423 025423 00000010317 14162303417 022635 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - _ -

    • _bcp_convert_in() : bcp.c
    • _bcp_convert_out() : bcp.c
    • _bcp_exec_in() : bcp.c
    • _bcp_exec_out() : bcp.c
    • _bcp_fgets() : bcp.c
    • _bcp_free_columns() : bcp.c
    • _bcp_free_storage() : bcp.c
    • _bcp_get_col_data() : bcp.c
    • _bcp_get_term_var() : bcp.c
    • _bcp_no_get_col_data() : bcp.c
    • _bcp_read_hostfile() : bcp.c
    • _bcp_readfmt_colinfo() : bcp.c
    • _dbcoldata() : dblib.c
    • _dbresults() : dblib.c
    freetds-1.3.6/doc/reference/globals_func_a.html000644 025423 025423 00000005535 14162303417 023143 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - a -

    • adjust_character_column_size() : token.c
    freetds-1.3.6/doc/reference/globals_func_b.html000644 025423 025423 00000012666 14162303417 023147 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - b -

    freetds-1.3.6/doc/reference/globals_func_d.html000644 025423 025423 00000067705 14162303417 023155 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - d -

    freetds-1.3.6/doc/reference/globals_func_r.html000644 025423 025423 00000005662 14162303417 023165 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - r -

    freetds-1.3.6/doc/reference/globals_func_s.html000644 025423 025423 00000005530 14162303417 023160 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - s -

    • skip_one_input_sequence() : iconv.c
    freetds-1.3.6/doc/reference/globals_func_t.html000644 025423 025423 00000061463 14162303417 023170 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     

    - t -

    freetds-1.3.6/doc/reference/globals_i.html000644 025423 025423 00000005661 14162303417 022140 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - i -

    • is_datetime_type : tds.h
    freetds-1.3.6/doc/reference/globals_r.html000644 025423 025423 00000006027 14162303417 022146 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - r -

    freetds-1.3.6/doc/reference/globals_s.html000644 025423 025423 00000005675 14162303417 022157 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - s -

    • skip_one_input_sequence() : iconv.c
    freetds-1.3.6/doc/reference/globals_t.html000644 025423 025423 00000071724 14162303417 022156 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
    Here is a list of all documented file members with links to the documentation:

    - t -

    freetds-1.3.6/doc/reference/globals_type.html000644 025423 025423 00000010122 14162303417 022655 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     
    freetds-1.3.6/doc/reference/globals_vars.html000644 025423 025423 00000005632 14162303417 022661 0ustar00fredianofrediano000000 000000 FreeTDS API: File Members
    FreeTDS API
     
    • tds_numeric_bytes_per_prec : tds.h
    • tds_write_dump : tds.h
    freetds-1.3.6/doc/reference/graph_legend.dot000644 025423 025423 00000004053 14162303417 022440 0ustar00fredianofrediano000000 000000 digraph "Graph Legend" { // LATEX_PDF_SIZE edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; node [fontname="Helvetica",fontsize="10",shape=record]; Node9 [shape="box",label="Inherited",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",fillcolor="grey75",style="filled" fontcolor="black"]; Node10 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node10 [shape="box",label="PublicBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black"]; Node11 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node11 [shape="box",label="Truncated",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="red"]; Node13 -> Node9 [dir="back",color="darkgreen",fontsize="10",style="solid",fontname="Helvetica"]; Node13 [shape="box",label="ProtectedBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black"]; Node14 -> Node9 [dir="back",color="firebrick4",fontsize="10",style="solid",fontname="Helvetica"]; Node14 [shape="box",label="PrivateBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black"]; Node15 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node15 [shape="box",label="Undocumented",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="grey75"]; Node16 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; Node16 [shape="box",label="Templ< int >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black"]; Node17 -> Node16 [dir="back",color="orange",fontsize="10",style="dashed",label="< int >",fontname="Helvetica"]; Node17 [shape="box",label="Templ< T >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black"]; Node18 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label="m_usedClass",fontname="Helvetica"]; Node18 [shape="box",label="Used",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black"]; } freetds-1.3.6/doc/reference/graph_legend.html000644 025423 025423 00000015636 14162303417 022627 0ustar00fredianofrediano000000 000000 FreeTDS API: Graph Legend
    FreeTDS API
    Graph Legend

    This page explains how to interpret the graphs that are generated by doxygen.

    Consider the following example:

    /*! Invisible class because of truncation */
    class Invisible { };
    /*! Truncated class, inheritance relation is hidden */
    class Truncated : public Invisible { };
    /* Class not documented with doxygen comments */
    class Undocumented { };
    /*! Class that is inherited using public inheritance */
    class PublicBase : public Truncated { };
    /*! A template class */
    template<class T> class Templ { };
    /*! Class that is inherited using protected inheritance */
    class ProtectedBase { };
    /*! Class that is inherited using private inheritance */
    class PrivateBase { };
    /*! Class that is used by the Inherited class */
    class Used { };
    /*! Super class that inherits a number of other classes */
    class Inherited : public PublicBase,
    protected ProtectedBase,
    private PrivateBase,
    public Undocumented,
    public Templ<int>
    {
    private:
    Used *m_usedClass;
    };

    This will result in the following graph:

    [!-- SVG 0 --]

    The boxes in the above graph have the following meaning:

    • A filled gray box represents the struct or class for which the graph is generated.
    • A box with a black border denotes a documented struct or class.
    • A box with a gray border denotes an undocumented struct or class.
    • A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.

    The arrows have the following meaning:

    • A dark blue arrow is used to visualize a public inheritance relation between two classes.
    • A dark green arrow is used for protected inheritance.
    • A dark red arrow is used for private inheritance.
    • A purple dashed arrow is used if a class is contained or used by another class. The arrow is labelled with the variable(s) through which the pointed class or struct is accessible.
    • A yellow dashed arrow denotes a relation between a template instance and the template class it was instantiated from. The arrow is labelled with the template parameters of the instance.
    freetds-1.3.6/doc/reference/index.html000644 025423 025423 00000011062 14162303417 021304 0ustar00fredianofrediano000000 000000 FreeTDS API: FreeTDS Reference Manual
    FreeTDS API
    FreeTDS Reference Manual

    Introduction

    Given that the vendors provide their own complete documentation for their implementations, one might ask why embark on this adventure at all? The answer is both principled and practical.

    First, this is our implementation, and to be complete it needs independent documentation.
    Unlike the vendors' offerings, ours offers some features from each version, while lacking others.
    When we have been forced to choose between documented behaviors, the FreeTDS user is presumably best served by the FreeTDS reference manual.

    Second, while the vendors today freely offer their documentation on the world wide web, that might not – in fact, surely will not – always be the case. Should the vendor decide to drop its offering for whatever reason, it will likely pull its documentation, too, sooner or later. Free sofware, in short, can lean on the capitalist model for support, but it can never rely on it.

    Status

    This manual is incomplete, and is being completed in fits and starts.
    The focus to date has been on db-lib and the underlying network library, libtds. It's the kind of enormous Quixoitic undertaking that you'd reasonably doubt will ever be completed. If you feel inclined to jump in, please don't hesitate.

    The organization of the manual could be better. We're still learning how to use Doxygen to best effect.

    Probably the most useful link at the moment is "Modules", above. That gives a categorized, alphabetical listing of the documented functions.

    freetds-1.3.6/doc/reference/jquery.js000644 025423 025423 00000526541 14162303412 021174 0ustar00fredianofrediano000000 000000 /*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
    ",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
    ",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
    "),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
    ").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
    "),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
    "),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element },_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),m&&(p-=l),g&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable});/** * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler * Licensed under MIT * @author Ariel Flesler * @version 2.1.2 */ ;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1-1){targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if(session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)}closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if(session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE,function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList,finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight()));return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")}function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(),elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight,viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 * http://www.smartmenus.org/ * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)),mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy(this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
    ').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?(this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for(var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&(this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]")||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i,downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2))&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})}return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$});freetds-1.3.6/doc/reference/menudata.js000644 025423 025423 00000011225 14162303417 021444 0ustar00fredianofrediano000000 000000 /* @licstart The following is the entire license notice for the JavaScript code in this file. The MIT License (MIT) Copyright (C) 1997-2020 by Dimitri van Heesch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @licend The above is the entire license notice for the JavaScript code in this file */ var menudata={children:[ {text:"Main Page",url:"index.html"}, {text:"Related Pages",url:"pages.html"}, {text:"Modules",url:"modules.html"}, {text:"Classes",url:"annotated.html",children:[ {text:"Class List",url:"annotated.html"}, {text:"Class Index",url:"classes.html"}, {text:"Class Members",url:"functions.html",children:[ {text:"All",url:"functions.html",children:[ {text:"a",url:"functions.html#index_a"}, {text:"b",url:"functions.html#index_b"}, {text:"c",url:"functions.html#index_c"}, {text:"d",url:"functions.html#index_d"}, {text:"e",url:"functions.html#index_e"}, {text:"f",url:"functions.html#index_f"}, {text:"h",url:"functions.html#index_h"}, {text:"i",url:"functions.html#index_i"}, {text:"l",url:"functions.html#index_l"}, {text:"m",url:"functions.html#index_m"}, {text:"n",url:"functions.html#index_n"}, {text:"o",url:"functions.html#index_o"}, {text:"p",url:"functions.html#index_p"}, {text:"q",url:"functions.html#index_q"}, {text:"r",url:"functions.html#index_r"}, {text:"s",url:"functions.html#index_s"}, {text:"t",url:"functions.html#index_t"}, {text:"u",url:"functions.html#index_u"}, {text:"w",url:"functions.html#index_w"}, {text:"y",url:"functions.html#index_y"}]}, {text:"Variables",url:"functions_vars.html",children:[ {text:"a",url:"functions_vars.html#index_a"}, {text:"b",url:"functions_vars.html#index_b"}, {text:"c",url:"functions_vars.html#index_c"}, {text:"d",url:"functions_vars.html#index_d"}, {text:"e",url:"functions_vars.html#index_e"}, {text:"f",url:"functions_vars.html#index_f"}, {text:"h",url:"functions_vars.html#index_h"}, {text:"i",url:"functions_vars.html#index_i"}, {text:"l",url:"functions_vars.html#index_l"}, {text:"m",url:"functions_vars.html#index_m"}, {text:"n",url:"functions_vars.html#index_n"}, {text:"o",url:"functions_vars.html#index_o"}, {text:"p",url:"functions_vars.html#index_p"}, {text:"q",url:"functions_vars.html#index_q"}, {text:"r",url:"functions_vars.html#index_r"}, {text:"s",url:"functions_vars.html#index_s"}, {text:"t",url:"functions_vars.html#index_t"}, {text:"u",url:"functions_vars.html#index_u"}, {text:"w",url:"functions_vars.html#index_w"}, {text:"y",url:"functions_vars.html#index_y"}]}]}]}, {text:"Files",url:"files.html",children:[ {text:"File List",url:"files.html"}, {text:"File Members",url:"globals.html",children:[ {text:"All",url:"globals.html",children:[ {text:"_",url:"globals.html#index__5F"}, {text:"a",url:"globals_a.html#index_a"}, {text:"b",url:"globals_b.html#index_b"}, {text:"d",url:"globals_d.html#index_d"}, {text:"i",url:"globals_i.html#index_i"}, {text:"r",url:"globals_r.html#index_r"}, {text:"s",url:"globals_s.html#index_s"}, {text:"t",url:"globals_t.html#index_t"}]}, {text:"Functions",url:"globals_func.html",children:[ {text:"_",url:"globals_func.html#index__5F"}, {text:"a",url:"globals_func_a.html#index_a"}, {text:"b",url:"globals_func_b.html#index_b"}, {text:"d",url:"globals_func_d.html#index_d"}, {text:"r",url:"globals_func_r.html#index_r"}, {text:"s",url:"globals_func_s.html#index_s"}, {text:"t",url:"globals_func_t.html#index_t"}]}, {text:"Variables",url:"globals_vars.html"}, {text:"Typedefs",url:"globals_type.html"}, {text:"Enumerations",url:"globals_enum.html"}, {text:"Enumerator",url:"globals_eval.html"}, {text:"Macros",url:"globals_defs.html",children:[ {text:"b",url:"globals_defs.html#index_b"}, {text:"d",url:"globals_defs.html#index_d"}, {text:"i",url:"globals_defs.html#index_i"}, {text:"t",url:"globals_defs.html#index_t"}]}]}]}]} freetds-1.3.6/doc/reference/modules.html000644 025423 025423 00000020743 14162303417 021653 0ustar00fredianofrediano000000 000000 FreeTDS API: Modules
    FreeTDS API
    Modules
    Here is a list of all modules:
    [detail level 123]
     The db-lib APIFunctions callable by db-lib client programs
     Primary functionsCore functions needed by most db-lib programs
     Remote Procedure functionsFunctions used with stored procedures
     Bulk copy functionsFunctions to bulk-copy (a/k/a bcp) data to/from the database
     Internal bcp functionsStatic functions internal to the bcp library
     Money functionsFunctions to manipulate the MONEY datatype
     Datetime functionsFunctions to manipulate DBDATETIME structures
     InternalsFunctions called within db-lib for self-help
     UnimplementedFunctions thus far not implemented in the FreeTDS db-lib implementation
     ODBC APIFunctions callable by ODBC client programs
     ODBC utilityFunctions called within ODBC driver
     LibTDS APICallable functions in libtds
     AuthenticationFunctions for handling authentication
     ConfigurationHandle reading of configuration
     ConversionConversions between datatypes
     Charset conversionConvert between different charsets
     Memory allocationAllocate or free resources
     QueryFunction to handle query
     Network functionsFunctions for reading or writing from network
     Results processingHandle tokens in packets
     Dynamic string functionsHandle dynamic string
    freetds-1.3.6/doc/reference/nav_f.png000644 025423 025423 00000000231 14162303412 021075 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR8³»`IDATxíÝK€ EÑ–·[†øBÑmkâÄÂH—prÓ¼.‚Žó‚ꎤR6Z VI±E‚5j³„lóš›iI˜¬ÞêçJ0ŒÑÑ/Žû›™uøñóÞ¿6sH ÝõyIEND®B`‚freetds-1.3.6/doc/reference/nav_g.png000644 025423 025423 00000000137 14162303412 021103 0ustar00fredianofrediano000000 000000 ‰PNG  IHDRô1&IDATxíÝ1 ÁOHf„á_ ->~¸åM iËMèÀƒS½ü‚<IEND®B`‚freetds-1.3.6/doc/reference/nav_h.png000644 025423 025423 00000000142 14162303412 021100 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR ,é@)IDATxíÝA @BQ­³šÛ›Ð¢Žáà) )ëý éaÅèÜ¿Æo‡RlÐßIEND®B`‚freetds-1.3.6/doc/reference/open.png000644 025423 025423 00000000173 14162303412 020752 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR à‘BIDATxíÝÁ €0 Ð׬ՙ\Àº€39—b!©9{|ðI>$#Àß´ý8/¨ÄØzƒ/Ï>2À[ÎgiU,/¬~¼Ï\ Ä9Ù¸IEND®B`‚freetds-1.3.6/doc/reference/pages.html000644 025423 025423 00000007036 14162303417 021302 0ustar00fredianofrediano000000 000000 FreeTDS API: Related Pages
    FreeTDS API
    Related Pages
    Here is a list of all related documentation pages:
    freetds-1.3.6/doc/reference/splitbar.png000644 025423 025423 00000000472 14162303421 021633 0ustar00fredianofrediano000000 000000 ‰PNG  IHDRM¸¿IDATxíÝ¡JCa‡ñç(˜ ëƒ%±Ø4 b±È˜Í¶3˜v^Á±˜…ãó–ŽELƒõ…¥•³ ,ÿb;íç{Ã/¼ðÞÀaYÕ¯åóøq:¼º¹›\òIIIIIIIIIIIIIIIIII-Òçl¹›«õ抢è_t/Ï»ã£ÑíYQVõðêäíã÷´×ùY¬Úÿµ§¦ivók¾_íåýÛ£I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$I@$ýC[Vì=ü[„fÆIEND®B`‚freetds-1.3.6/doc/reference/sync_off.png000644 025423 025423 00000001525 14162303412 021621 0ustar00fredianofrediano000000 000000 ‰PNG  IHDRàw=øIDATxíÝKhTWÀñÿä1I&3™8M¦Iš™†I3Ú©b$cÌ I1V1±-(Tö±±Ð.* t!‚K[¥Ä¥ˆ„¨´f£`l(øl©"Y”¤6ÆgÌTú}·sgîܹ ±d{8?æÌ¹÷;çÜuíÚ`:!±F¬¢BäŠ?ŰÄm'yÊÅ>ÑlU¯½üý‰è_‹?€Œê ]€Y(ŠNñ±8fý1°Öqún-eâ¨øtºmâÈ Ó0}b›ù%·©µ×Œ®=Ÿ0´³?Š1sŸ‹0€¯8À‘;_ ‹W|%\ Zð— >舽ln¨p©.aÇ{ )t;Ú b nŸš¯›65°¢¡2çÅÔ?Žž>Oдàuönm¤¢Ì`×­Z¬WjC~>‘Ö¾0+á {{©fÝ×Mæ·æÅ•ìÙ¼˜` Ý›%uA6´½ÅÆö¨Á,]k¢ÄW¼™u±›]‹ˆ7§¯iòh€ ¶¶¬ÏÖu1 ló —Ҷ̺–:ÞÍ\ÄcãÏxøhR²Êè‡Qt$¿ß§¨ ª fdºü<4BÿÙ[•f¸d7=.Mé9/—éªÃëù/ÿO Üaàò}€,‘j?Ÿõ.5Úšm?œÿŸ®ŽXÿ2¬#¸d píæ(£?cÛú¼!½›a1¥Þ—ŽòØ©ܾ7dÔK:‚ùÒ‰ì)Ê3‚Ü™àÌà]€,±H€µ+køöäu<|`·LhC7¹ÔeÍ Ÿ×Ÿ˜tÜ‹ óH$^2%l.êaeÐäýE”ÌÉ|ÅÜìî‰Ýsä }¸ýDû^hzé~ðR›¦Ã¡¿]|#ü¯@×—Ö‡[k¹–<|š(Ç*€Ý¹dÇtMé:Ýñø«Ø,êÅû¢]”' øXÓ_nò¡Æ|Øý /c§fžâOIEND®B`‚freetds-1.3.6/doc/reference/sync_on.png000644 025423 025423 00000001515 14162303412 021462 0ustar00fredianofrediano000000 000000 ‰PNG  IHDRàw=øIDATxíÝ_HTYÀñï8ã¤ó§i§4-g6ÆËÕ&kQ)¨Ô!Š0ÒURKÚ…„ê¡/»PEÁ>ìK-+KÁ²Ñ.Y”¾dEPaA‰ø°¥¶›ZSÓïÜ;3wºŠ–¯—߯gfîïœsçœWKÇñ.€ÉøD­¨a‘'¬âq_ôˆk¢ÀŒ ÀDŽøQ´ÄïC¨¶åñÏÿgÅ ñ 0„Y‚:qZ¦Á)~õâ€èLý0HVñ× žz-¿‰C“%¨g¦˜6€é8%Úõ¬ëwêÙUÏ¿˜ª³Ä }? ?€·3ÀÀž©Š À”K• @hà a±ðaÇæUe‹ sù~ë2²ì“&Ú&B*AÄljæºììi*˨,Ëçí»÷oÆ£T”,d[˜¼3-*ÁÀ…>å‡Ë çLÉŸçfk˜Ò éw#*AEjKUy>ûšËÉõ&{µ¢8—m5Ki¬ jjƒD*¿NŽÖigwÃ7Dª’mz骹úKÛ¾±ˆ¶M!æ¤ÍkÐ?šoý¬_åÓlXí#Ò~–¸¬ê×ÒÑXŠÓ‘ùRÙ*Eû‚ՂדðEÜ;6«e"Q(²Ù=–¿Ezæ5Kؼָ_ 1òzBªJë ±XŒì96åªjL^7{ùãJÑ÷1½i@%8'7M©_\Qœ#ÓUŒËñýÿyõ Wo Éx8¼s¥v¯ªì|×SnÜ q_m Ýé î>bèÕí[JX,½4[Tú{R£ë¼ôˆ¾þa€tÝjjzzÅ'ÅìȶiIžŽòwÏs ¡€—ÕKøõâC^ŽŒ˜Y­¨µÉ%6¨´êˆº]vÛðhâ½iWv–hôëê°Ò¨¾'æÌ‚·ñ|[ßìúÅ^€YrD=<ýDû]äÇ÷s€Ïõ‹8™ºCì? À ¨—t4õᩎ¡Jã‡W‹É± îr¼cjMɘìx| šE©øNÔ‰œøA¢þ«–€Z¼ñ‡jó î#™§¢¢4gIEND®B`‚freetds-1.3.6/doc/reference/tab_a.png000644 025423 025423 00000000216 14162303412 021055 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR$ÇÇ[UIDATxíK €0C'o¤(Šˆ[Žà%Üxÿ#Ù©­ç ùÁöó¦W¦e# 3t I 3+¼øEã~\D½9¯Ûàè’wM·¿öÿ}Yõ_êA4Yžã}IEND®B`‚freetds-1.3.6/doc/reference/tab_b.png000644 025423 025423 00000000251 14162303412 021055 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR$ÇÇ[pIDATxíÝMƒ EáÇ»ÐÔ¸¸u`âÀ´V0РÆ}:t]DÁ²s¿ä®‚¶ýËu¥ø|’xùî½À>ÿ1»& mÄ8ÜSÙÑxÜLÀUûšÞ²ÄiE–ŠåOs„¢’nxàÒêÓKN²~jIEND®B`‚freetds-1.3.6/doc/reference/tab_h.png000644 025423 025423 00000000261 14162303412 021064 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR$ÇÇ[xIDATxíÝMÁ@†áž~¥ÜÆÎ’Evˆ¿"!•²‘d*×rGq=Š{¼ßSݧçë­ÓÉHÇ uO^õø[À_‡¢ãXvyËþÒ±=·VCffææ{°öŠó´Rçœ%_õçÿŽ¢ö·°Çrug¶(?gh\i>|sIEND®B`‚freetds-1.3.6/doc/reference/tab_s.png000644 025423 025423 00000000270 14162303412 021077 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR$ÇÇ[IDATxíÝ ‚@@Ñ£?Q…¤"š¢%¦I‘—Šf–6[´HÃäQƒ<Þâõþ]ždr Í’s?ˆO=Ñññw'ÌF‡Ž íðö-~rÃ[œèŠ­ì¬mƒÖ¬ƒݯнŠÕF)Yº% §`nÌ,9B ™’©!ÑŒ\ý<Å#üîî•IEND®B`‚freetds-1.3.6/doc/reference/tabs.css000644 025423 025423 00000021740 14162303412 020751 0ustar00fredianofrediano000000 000000 .sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace!important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0!important;-webkit-border-radius:0;border-radius:0!important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px!important;-webkit-border-radius:5px;border-radius:5px!important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0!important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px!important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}}freetds-1.3.6/doc/reference/search/search_l.png000644 025423 025423 00000001067 14162303412 023041 0ustar00fredianofrediano000000 000000 ‰PNG  IHDR:…å>gAMA± üa cHRMm˜sŽà8‚ÕzÊ´3Dv„6*½bKGDÿ‡Ì¿ pHYs  šœtIMEâ  OíWß*IDAT(Ï’ÍJBQF÷&Š&ö ›ô>Ѥ|ƒ(‚ÀFAI õ–¢‘`šAP Õ ‘~ÀŸ&FzžÕ A튷oM6‡uß-È/iÃtyÝžÛæ «¬Ù¹6bSÞ%ÏÝž pA’476Iæìvܧäx£B•Ÿ6‰LîDüÿAxˆGüT¸%+ÍXùp§8;~ñóƒÉ'%u"÷óú !~\l:4¨‘‘ñt>ŠŒ)…¢O›7.œÄ^)2VòD‡6Ï$ZÚR Š> nܳ­ (:TUò\8’͇J%'N‡&éÝIÒär=tÒ—Ì®„,nóbfæB$‹Ê©6r§÷fn9à-Ë׻wÚ4Bx6êßïz|Ëûkmq$îH zXÔÝj«ÒyzÅÁe«X¸ZËE‡Éü°cû‘sÑÂ%tEXtdate:create2018-12-07T11:28:17+00:00-?CÛ%tEXtdate:modify2018-12-07T11:28:17+00:00\bûgIEND®B`‚freetds-1.3.6/doc/reference/search/close.svg000644 025423 025423 00000002404 14162303412 022375 0ustar00fredianofrediano000000 000000 image/svg+xml freetds-1.3.6/doc/reference/search/mag_sel.svg000644 025423 025423 00000004512 14162303412 022701 0ustar00fredianofrediano000000 000000 image/svg+xml freetds-1.3.6/doc/reference/search/search.css000644 025423 025423 00000010411 14162303412 022523 0ustar00fredianofrediano000000 000000 /*---------------- Search Box */ #MSearchBox { white-space : nowrap; background: white; border-radius: 0.65em; box-shadow: inset 0.5px 0.5px 3px 0px #555; z-index: 102; } #MSearchBox .left { display: inline-block; vertical-align: middle; height: 1.4em; } #MSearchSelect { display: inline-block; vertical-align: middle; height: 1.4em; padding: 0 0 0 0.3em; margin: 0; } #MSearchField { display: inline-block; vertical-align: middle; width: 7.5em; height: 1.1em; margin: 0 0.15em; padding: 0; line-height: 1em; border:none; color: #909090; outline: none; font-family: Arial, Verdana, sans-serif; -webkit-border-radius: 0px; border-radius: 0px; background: none; } #MSearchBox .right { display: inline-block; vertical-align: middle; width: 1.4em; height: 1.4em; } #MSearchClose { display: none; font-size: inherit; background : none; border: none; margin: 0; padding: 0; outline: none; } #MSearchCloseImg { height: 1.4em; padding: 0.3em; margin: 0; } .MSearchBoxActive #MSearchField { color: #000000; } #main-menu > li:last-child { /* This
  • object is the parent of the search bar */ display: flex; justify-content: center; align-items: center; height: 36px; margin-right: 1em; } /*---------------- Search filter selection */ #MSearchSelectWindow { display: none; position: absolute; left: 0; top: 0; border: 1px solid #90A5CE; background-color: #F9FAFC; z-index: 10001; padding-top: 4px; padding-bottom: 4px; -moz-border-radius: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); } .SelectItem { font: 8pt Arial, Verdana, sans-serif; padding-left: 2px; padding-right: 12px; border: 0px; } span.SelectionMark { margin-right: 4px; font-family: monospace; outline-style: none; text-decoration: none; } a.SelectItem { display: block; outline-style: none; color: #000000; text-decoration: none; padding-left: 6px; padding-right: 12px; } a.SelectItem:focus, a.SelectItem:active { color: #000000; outline-style: none; text-decoration: none; } a.SelectItem:hover { color: #FFFFFF; background-color: #3D578C; outline-style: none; text-decoration: none; cursor: pointer; display: block; } /*---------------- Search results window */ iframe#MSearchResults { width: 60ex; height: 15em; } #MSearchResultsWindow { display: none; position: absolute; left: 0; top: 0; border: 1px solid #000; background-color: #EEF1F7; z-index:10000; } /* ----------------------------------- */ #SRIndex { clear:both; padding-bottom: 15px; } .SREntry { font-size: 10pt; padding-left: 1ex; } .SRPage .SREntry { font-size: 8pt; padding: 1px 5px; } body.SRPage { margin: 5px 2px; } .SRChildren { padding-left: 3ex; padding-bottom: .5em } .SRPage .SRChildren { display: none; } .SRSymbol { font-weight: bold; color: #425E97; font-family: Arial, Verdana, sans-serif; text-decoration: none; outline: none; } a.SRScope { display: block; color: #425E97; font-family: Arial, Verdana, sans-serif; text-decoration: none; outline: none; } a.SRSymbol:focus, a.SRSymbol:active, a.SRScope:focus, a.SRScope:active { text-decoration: underline; } span.SRScope { padding-left: 4px; } .SRPage .SRStatus { padding: 2px 5px; font-size: 8pt; font-style: italic; } .SRResult { display: none; } DIV.searchresults { margin-left: 10px; margin-right: 10px; } /*---------------- External search page results */ .searchresult { background-color: #F0F3F8; } .pages b { color: white; padding: 5px 5px 3px 5px; background-image: url("../tab_a.png"); background-repeat: repeat-x; text-shadow: 0 1px 1px #000000; } .pages { line-height: 17px; margin-left: 4px; text-decoration: none; } .hl { font-weight: bold; } #searchresults { margin-bottom: 20px; } .searchpages { margin-top: 10px; } freetds-1.3.6/doc/reference/search/all_0.html000644 025423 025423 00000002616 14162303412 022431 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_0.js000644 025423 025423 00000010675 14162303412 022105 0ustar00fredianofrediano000000 000000 var searchData= [ ['_5fbcp_5fconvert_5fin_0',['_bcp_convert_in',['../a01400.html#a4e7740b6f755d7d3f2502a47b7d71a85',1,'bcp.c']]], ['_5fbcp_5fconvert_5fout_1',['_bcp_convert_out',['../a01400.html#a230fa5b56ae4e3509a69bd266495732b',1,'bcp.c']]], ['_5fbcp_5fexec_5fin_2',['_bcp_exec_in',['../a00551.html#ga7370f1223f13510d6b33e98f2de09fb5',1,'bcp.c']]], ['_5fbcp_5fexec_5fout_3',['_bcp_exec_out',['../a00551.html#gae67546338cb9542a4902aa914f57f314',1,'bcp.c']]], ['_5fbcp_5ffgets_4',['_bcp_fgets',['../a00551.html#gaf4e2c59203f2af21bb2803ef4a69bfa8',1,'bcp.c']]], ['_5fbcp_5ffree_5fcolumns_5',['_bcp_free_columns',['../a00551.html#gacf69ac4cbe8e3c3e6ea665e31e5e85b8',1,'bcp.c']]], ['_5fbcp_5ffree_5fstorage_6',['_bcp_free_storage',['../a00551.html#gaa134c1c3ccc4326e693adb8357272f1d',1,'bcp.c']]], ['_5fbcp_5fget_5fcol_5fdata_7',['_bcp_get_col_data',['../a00551.html#ga0f8def4cad04c5c1e27c2b653d482dd8',1,'bcp.c']]], ['_5fbcp_5fget_5fterm_5fvar_8',['_bcp_get_term_var',['../a00551.html#ga4f936fa1cb8e4373bf7b7f8a6ab96bc7',1,'bcp.c']]], ['_5fbcp_5fno_5fget_5fcol_5fdata_9',['_bcp_no_get_col_data',['../a01400.html#ad53f508d8f2177a898f8022736834afd',1,'bcp.c']]], ['_5fbcp_5fread_5fhostfile_10',['_bcp_read_hostfile',['../a00551.html#ga1b57d952a9d72f375c3296124affa908',1,'bcp.c']]], ['_5fbcp_5freadfmt_5fcolinfo_11',['_bcp_readfmt_colinfo',['../a00551.html#gafc23d62bc86b38fb757e3ac4aadca0a4',1,'bcp.c']]], ['_5fcharacter_5fset_5falias_12',['_character_set_alias',['../a00971.html',1,'']]], ['_5fcs_5fblkdesc_13',['_cs_blkdesc',['../a00903.html',1,'']]], ['_5fcs_5fclientmsg_14',['_cs_clientmsg',['../a00851.html',1,'']]], ['_5fcs_5fcommand_15',['_cs_command',['../a00899.html',1,'']]], ['_5fcs_5fconfig_16',['_cs_config',['../a00859.html',1,'']]], ['_5fcs_5fconnection_17',['_cs_connection',['../a00883.html',1,'']]], ['_5fcs_5fcontext_18',['_cs_context',['../a00875.html',1,'']]], ['_5fcs_5fdatafmt_19',['_cs_datafmt',['../a00827.html',1,'']]], ['_5fcs_5fdaterec_20',['_cs_daterec',['../a00847.html',1,'']]], ['_5fcs_5fdatetime_21',['_cs_datetime',['../a00839.html',1,'']]], ['_5fcs_5fdatetime4_22',['_cs_datetime4',['../a00843.html',1,'']]], ['_5fcs_5fdynamic_23',['_cs_dynamic',['../a00895.html',1,'']]], ['_5fcs_5fiodesc_24',['_cs_iodesc',['../a00823.html',1,'']]], ['_5fcs_5flocale_25',['_cs_locale',['../a00907.html',1,'']]], ['_5fcs_5fmoney_26',['_cs_money',['../a00831.html',1,'']]], ['_5fcs_5fmoney4_27',['_cs_money4',['../a00835.html',1,'']]], ['_5fcs_5fnumeric_28',['_cs_numeric',['../a00811.html',1,'']]], ['_5fcs_5fobjdata_29',['_cs_objdata',['../a00807.html',1,'']]], ['_5fcs_5fobjname_30',['_cs_objname',['../a00803.html',1,'']]], ['_5fcs_5fparam_31',['_cs_param',['../a00887.html',1,'']]], ['_5fcs_5fservermsg_32',['_cs_servermsg',['../a00855.html',1,'']]], ['_5fcs_5fvarbinary_33',['_cs_varbinary',['../a00815.html',1,'']]], ['_5fcs_5fvarchar_34',['_cs_varchar',['../a00819.html',1,'']]], ['_5fcsremote_5fproc_35',['_csremote_proc',['../a00891.html',1,'']]], ['_5fct_5fcolinfo_36',['_ct_colinfo',['../a00879.html',1,'']]], ['_5fdbcoldata_37',['_dbcoldata',['../a00554.html#ga3c6f474c0662158f3100fe464bf077d9',1,'dblib.c']]], ['_5fdblib_5fcheck_5fand_5fhandle_5finterrupt_38',['_dblib_check_and_handle_interrupt',['../a00554.html#gadf15185b0d417edc0bb8a6a4f0bae727',1,'_dblib_check_and_handle_interrupt(void *vdbproc): dbutil.c'],['../a00554.html#gadf15185b0d417edc0bb8a6a4f0bae727',1,'_dblib_check_and_handle_interrupt(void *vdbproc): dbutil.c']]], ['_5fdblib_5ferror_5fmessage_39',['_dblib_error_message',['../a00619.html',1,'']]], ['_5fdbresults_40',['_dbresults',['../a00548.html#gaf1879b85e8238c015b9648d077665285',1,'dblib.c']]], ['_5fdheader_41',['_dheader',['../a00995.html',1,'']]], ['_5fdrecord_42',['_drecord',['../a00999.html',1,'']]], ['_5fhcattr_43',['_hcattr',['../a01019.html',1,'']]], ['_5fhchk_44',['_hchk',['../a01011.html',1,'']]], ['_5fhdbc_45',['_hdbc',['../a01023.html',1,'']]], ['_5fhdesc_46',['_hdesc',['../a01003.html',1,'']]], ['_5fheattr_47',['_heattr',['../a01007.html',1,'']]], ['_5fhenv_48',['_henv',['../a01015.html',1,'']]], ['_5fhsattr_49',['_hsattr',['../a01027.html',1,'']]], ['_5fhstmt_50',['_hstmt',['../a01031.html',1,'']]], ['_5foptions_51',['_options',['../a00587.html',1,'']]], ['_5fprocedure_52',['_procedure',['../a00607.html',1,'']]], ['_5fsql_5ferror_53',['_sql_error',['../a00987.html',1,'']]], ['_5fsql_5ferrors_54',['_sql_errors',['../a00991.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_1.html000644 025423 025423 00000002616 14162303412 022432 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_1.js000644 025423 025423 00000000730 14162303412 022075 0ustar00fredianofrediano000000 000000 var searchData= [ ['adjust_5fcharacter_5fcolumn_5fsize_55',['adjust_character_column_size',['../a00565.html#ga91770634ce8c0d6f1fe007b45da186fd',1,'token.c']]], ['agg_5ft_56',['agg_t',['../a00631.html',1,'']]], ['allocated_57',['allocated',['../a01111.html#a9f32de09fe01879aeed23e858f3cef79',1,'tds_dynamic_stream']]], ['asn1_5fder_5fiterator_58',['asn1_der_iterator',['../a00779.html',1,'']]], ['authentication_59',['Authentication',['../a00558.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_2.html000644 025423 025423 00000002616 14162303412 022433 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_2.js000644 025423 025423 00000013723 14162303412 022104 0ustar00fredianofrediano000000 000000 var searchData= [ ['bcp_2ec_60',['bcp.c',['../a01400.html',1,'']]], ['bcp_5fbatch_61',['bcp_batch',['../a00550.html#gaa23f8e5c7f437a94746c90292dd1cb01',1,'bcp_batch(DBPROCESS *dbproc): bcp.c'],['../a00550.html#gaa23f8e5c7f437a94746c90292dd1cb01',1,'bcp_batch(DBPROCESS *dbproc): bcp.c']]], ['bcp_5fbind_62',['bcp_bind',['../a00550.html#ga6cf03708baaf02eb016b9ee77160d879',1,'bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int db_vartype, int table_column): bcp.c'],['../a00550.html#ga6cf03708baaf02eb016b9ee77160d879',1,'bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int type, int table_column): bcp.c']]], ['bcp_5fcolfmt_63',['bcp_colfmt',['../a00550.html#ga0ed03c69e698336d015bb315ad755fd5',1,'bcp_colfmt(DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int table_colnum): bcp.c'],['../a00550.html#ga0ed03c69e698336d015bb315ad755fd5',1,'bcp_colfmt(DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int colnum): bcp.c']]], ['bcp_5fcolfmt_5fps_64',['bcp_colfmt_ps',['../a00550.html#gaf13b2bb12b4200752718f3a3face3870',1,'bcp_colfmt_ps(DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int table_colnum, DBTYPEINFO *typeinfo): bcp.c'],['../a00550.html#gaf13b2bb12b4200752718f3a3face3870',1,'bcp_colfmt_ps(DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int colnum, DBTYPEINFO *typeinfo): bcp.c']]], ['bcp_5fcollen_65',['bcp_collen',['../a00550.html#gae41d196a22c544d66212dacc5b555791',1,'bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column): bcp.c'],['../a00550.html#gae41d196a22c544d66212dacc5b555791',1,'bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column): bcp.c']]], ['bcp_5fcolptr_66',['bcp_colptr',['../a00550.html#ga6498235e4ef8e41ea43b01494b28998d',1,'bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column): bcp.c'],['../a00550.html#ga6498235e4ef8e41ea43b01494b28998d',1,'bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column): bcp.c']]], ['bcp_5fcolumns_67',['bcp_columns',['../a00550.html#ga330b9f1028f856a9eec5115550bcb4f7',1,'bcp_columns(DBPROCESS *dbproc, int host_colcount): bcp.c'],['../a00550.html#ga330b9f1028f856a9eec5115550bcb4f7',1,'bcp_columns(DBPROCESS *dbproc, int host_colcount): bcp.c']]], ['bcp_5fcontrol_68',['bcp_control',['../a00550.html#ga244547855b41788fa3a67756956fbc81',1,'bcp_control(DBPROCESS *dbproc, int field, DBINT value): bcp.c'],['../a00550.html#ga244547855b41788fa3a67756956fbc81',1,'bcp_control(DBPROCESS *dbproc, int field, DBINT value): bcp.c']]], ['bcp_5fdone_69',['bcp_done',['../a00550.html#ga8b85f79f53a62ac7a728fe626d609b65',1,'bcp_done(DBPROCESS *dbproc): bcp.c'],['../a00550.html#ga8b85f79f53a62ac7a728fe626d609b65',1,'bcp_done(DBPROCESS *dbproc): bcp.c']]], ['bcp_5fexec_70',['bcp_exec',['../a00550.html#ga7a184158b27a50f713e9cfae3b746209',1,'bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied): bcp.c'],['../a00550.html#ga7a184158b27a50f713e9cfae3b746209',1,'bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied): bcp.c']]], ['bcp_5fgetl_71',['bcp_getl',['../a00550.html#ga220f6b043602da1028f98dacb2fd00c0',1,'bcp_getl(LOGINREC *login): bcp.c'],['../a00550.html#ga220f6b043602da1028f98dacb2fd00c0',1,'bcp_getl(LOGINREC *login): bcp.c']]], ['bcp_5fhostcolinfo_72',['BCP_HOSTCOLINFO',['../a00919.html',1,'']]], ['bcp_5fhostfileinfo_73',['BCP_HOSTFILEINFO',['../a00923.html',1,'']]], ['bcp_5finit_74',['bcp_init',['../a00550.html#gada8e987c4a6225b9276c05ba3a4f47a0',1,'bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction): bcp.c'],['../a00550.html#gada8e987c4a6225b9276c05ba3a4f47a0',1,'bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction): bcp.c']]], ['bcp_5foptions_75',['bcp_options',['../a00550.html#gafec3feb5bac1cb33545ba01efb0a67b8',1,'bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen): bcp.c'],['../a00550.html#gafec3feb5bac1cb33545ba01efb0a67b8',1,'bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen): bcp.c']]], ['bcp_5fprefix_5flen_76',['bcp_prefix_len',['../a01175.html#a07d747c0592ff37eb467ba14c4dcaeb2',1,'tds_column']]], ['bcp_5freadfmt_77',['bcp_readfmt',['../a00550.html#ga963c5e38bca7668afc57f5cc123d10fb',1,'bcp_readfmt(DBPROCESS *dbproc, const char filename[]): bcp.c'],['../a00550.html#ga963c5e38bca7668afc57f5cc123d10fb',1,'bcp_readfmt(DBPROCESS *dbproc, const char filename[]): bcp.c']]], ['bcp_5fsendrow_78',['bcp_sendrow',['../a00550.html#gaf1130ac97f6af55e86ec70b0aa4f5b40',1,'bcp_sendrow(DBPROCESS *dbproc): bcp.c'],['../a00550.html#gaf1130ac97f6af55e86ec70b0aa4f5b40',1,'bcp_sendrow(DBPROCESS *dbproc): bcp.c']]], ['bcp_5fsetl_79',['BCP_SETL',['../a00547.html#ga5a626d228e82be0af8449d2b8c278241',1,'sybdb.h']]], ['binary_5fto_5fresult_80',['binary_to_result',['../a00560.html#gab09f8279ad6da8a0a6a935e5810d753a',1,'convert.c']]], ['block_5fsize_81',['block_size',['../a01203.html#aaad54522a6e04122eba4c37a200d3f20',1,'tds_env']]], ['buf_82',['buf',['../a01111.html#a1b4967f395da537910ded1b392dd5d9b',1,'tds_dynamic_stream']]], ['buffer_83',['buffer',['../a01091.html#a5ba4ad38fdcb68e7d0c7252be65a4ecc',1,'tds_output_stream']]], ['bug_20list_84',['Bug List',['../a00546.html',1,'']]], ['bulk_2ec_85',['bulk.c',['../a00239.html',1,'']]], ['bulk_5fcopy_86',['bulk_copy',['../a01143.html#ad0d5f6fc4c5a5d64f11efd2e11ecaaa4',1,'tds_login']]], ['bulk_5fquery_87',['bulk_query',['../a01235.html#ac6ed7b8d3a4bd98a03f8ddb43b2e66c2',1,'tds_socket']]], ['bulk_20copy_20functions_88',['Bulk copy functions',['../a00550.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_3.html000644 025423 025423 00000002616 14162303412 022434 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_3.js000644 025423 025423 00000006072 14162303412 022104 0ustar00fredianofrediano000000 000000 var searchData= [ ['cafile_89',['cafile',['../a01143.html#ad12291abe6678aa30b8c43ab8e75429c',1,'tds_login']]], ['canonic_90',['canonic',['../a01163.html#aa9d3f1d6d994fcd5871ca41d7797ae95',1,'tds_encoding']]], ['cb_91',['cb',['../a00715.html#afc81c17990646fe0ed1c9cce5a917487',1,'tds_pbcb']]], ['cb_5ft_92',['cb_t',['../a00967.html',1,'conv_result']]], ['cc_5ft_93',['cc_t',['../a00963.html',1,'conv_result']]], ['char_5fconv_94',['char_conv',['../a01175.html#ab3afb8272401bdb51064cdf910334159',1,'tds_column']]], ['charset_95',['charset',['../a01203.html#a09756f0c4e0d588152c4dc3a8d019bcd',1,'tds_env']]], ['charset_5falias_96',['charset_alias',['../a00951.html',1,'']]], ['col_5ft_97',['col_t',['../a00623.html',1,'']]], ['column_5fcur_5fsize_98',['column_cur_size',['../a01175.html#ada14ba479a67762fc1bef78910ef4beb',1,'tds_column']]], ['column_5fprec_99',['column_prec',['../a01175.html#a7ae346f8b1fdd364749825ca0863d166',1,'tds_column']]], ['column_5fscale_100',['column_scale',['../a01175.html#ab73b012b3a9f08da8661dc230ec17d7f',1,'tds_column']]], ['column_5fsize_101',['column_size',['../a01175.html#a2c2756c00a1099c82d4cfa4da2894672',1,'tds_column']]], ['column_5ftype_102',['column_type',['../a01175.html#a7f08ecedc5835a4e81129c6b2b493947',1,'tds_column']]], ['column_5fvarint_5fsize_103',['column_varint_size',['../a01175.html#a12914f03ee2f24fa3fe577060410770d',1,'tds_column']]], ['conf_5fparams_104',['conf_params',['../a00671.html',1,'']]], ['configuration_105',['Configuration',['../a00559.html',1,'']]], ['connect_5fevent_106',['CONNECT_EVENT',['../a00679.html',1,'']]], ['charset_20conversion_107',['Charset conversion',['../a00561.html',1,'']]], ['conv_5fresult_108',['conv_result',['../a00959.html',1,'']]], ['conversion_109',['Conversion',['../a00560.html',1,'']]], ['crlfile_110',['crlfile',['../a01143.html#a15808ea4c259a779c63732f8c1067c54',1,'tds_login']]], ['cs_5fdiag_5fmsg_111',['cs_diag_msg',['../a00871.html',1,'']]], ['cs_5fdiag_5fmsg_5fclient_112',['cs_diag_msg_client',['../a00863.html',1,'']]], ['cs_5fdiag_5fmsg_5fsvr_113',['cs_diag_msg_svr',['../a00867.html',1,'']]], ['cur_5fcursor_114',['cur_cursor',['../a01235.html#aa708effeb88270302ab5524f0c0366ac',1,'tds_socket']]], ['cur_5fdyn_115',['cur_dyn',['../a01235.html#afb404985164205ebdc9b0c18fabb47e2',1,'tds_socket']]], ['current_5fresults_116',['current_results',['../a01235.html#a4b77fb56b92b93e413fcbb8ba5633ce4',1,'tds_socket']]], ['current_5fstatement_117',['current_statement',['../a01023.html#acaf05aab946ae9dec9e06dd230839675',1,'_hdbc']]], ['cursor_5fid_118',['cursor_id',['../a01199.html#a7b7d4cedf0cc7f890133f021d18af58c',1,'tds_cursor']]], ['cursor_5fname_119',['cursor_name',['../a01199.html#afd459125b5c4d4ccbf77a7d6ca8a4aaa',1,'tds_cursor']]], ['cursor_5frows_120',['cursor_rows',['../a01199.html#a7ec745adff5b2391e609e836c9f010cd',1,'tds_cursor']]], ['cursor_5fsupport_121',['cursor_support',['../a01023.html#ae45d3601984f4773024a81394764d28d',1,'_hdbc']]], ['cursors_122',['cursors',['../a01231.html#a42b972a1cd99c8f2f83b2cf5c635435a',1,'tds_connection']]] ]; freetds-1.3.6/doc/reference/search/all_4.html000644 025423 025423 00000002616 14162303412 022435 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_4.js000644 025423 025423 00000126014 14162303412 022104 0ustar00fredianofrediano000000 000000 var searchData= [ ['data_123',['DATA',['../a00575.html',1,'']]], ['data_2ec_124',['data.c',['../a00248.html',1,'']]], ['data_5flen_125',['data_len',['../a01223.html#aa9a66245e3c629a07111067cd1fdd0d4',1,'tds_packet']]], ['database_126',['database',['../a01203.html#ad05b5a83816aee8ff9858ddb1eb172b8',1,'tds_env']]], ['date_127',['date',['../a01119.html#a4697c11cf7da815856eb96bae4d57bac',1,'TDS_DATETIMEALL::date()'],['../a01323.html#afa93266cde7ab536615bca3d904aabed',1,'DBDATETIMEALL::date()']]], ['day_128',['day',['../a01123.html#a82d0cf263d8d4a3abcf84b9a146ddf83',1,'tdsdaterec']]], ['dayofyear_129',['dayofyear',['../a01123.html#a3f7925156708744d28016aacb90b6093',1,'tdsdaterec']]], ['db_5ffilename_130',['db_filename',['../a01143.html#a425f8ddd194f897f185d9f4d5e0618c2',1,'tds_login']]], ['dbacolname_131',['dbacolname',['../a00548.html#ga466690ceda8682382223d98a6ffb63bd',1,'dbacolname(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga466690ceda8682382223d98a6ffb63bd',1,'dbacolname(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbadata_132',['dbadata',['../a00548.html#gabcc14a1ca58b65bc46cce6c81c45218c',1,'dbadata(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gabcc14a1ca58b65bc46cce6c81c45218c',1,'dbadata(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbadlen_133',['dbadlen',['../a00548.html#ga3340e21db274b272ec11c037cb147222',1,'dbadlen(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga3340e21db274b272ec11c037cb147222',1,'dbadlen(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltbind_134',['dbaltbind',['../a00548.html#gafefd17e15b22adda84366c817178dd7d',1,'dbaltbind(DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c'],['../a00548.html#gafefd17e15b22adda84366c817178dd7d',1,'dbaltbind(DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c']]], ['dbaltcolid_135',['dbaltcolid',['../a00548.html#gad10c9fd75a86c7a0ac375937df0e90a6',1,'dbaltcolid(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gad10c9fd75a86c7a0ac375937df0e90a6',1,'dbaltcolid(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltlen_136',['dbaltlen',['../a00548.html#ga9a35c8d3cd0e35c10555baf8f6a01e93',1,'dbaltlen(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga9a35c8d3cd0e35c10555baf8f6a01e93',1,'dbaltlen(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltop_137',['dbaltop',['../a00548.html#ga947837a5c8fd99898c043435945b668c',1,'dbaltop(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga947837a5c8fd99898c043435945b668c',1,'dbaltop(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbalttype_138',['dbalttype',['../a00548.html#gaa85171e020dc606f2bd3395ad1d3ab4f',1,'dbalttype(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gaa85171e020dc606f2bd3395ad1d3ab4f',1,'dbalttype(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltutype_139',['dbaltutype',['../a00548.html#gaf1c00d83dfa88dc99a3fb449c49660ea',1,'dbaltutype(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gaf1c00d83dfa88dc99a3fb449c49660ea',1,'dbaltutype(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbanullbind_140',['dbanullbind',['../a00548.html#ga939c2a2e67b9992c787e2cec5b6cc1a7',1,'dbanullbind(DBPROCESS *dbproc, int computeid, int column, DBINT *indicator): dblib.c'],['../a00548.html#ga939c2a2e67b9992c787e2cec5b6cc1a7',1,'dbanullbind(DBPROCESS *dbprocess, int computeid, int column, DBINT *indicator): dblib.c']]], ['dbanydatecrack_141',['dbanydatecrack',['../a00548.html#gad57aa777300cf7f62077478ec6000d00',1,'dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data): dblib.c'],['../a00548.html#gad57aa777300cf7f62077478ec6000d00',1,'dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data): dblib.c']]], ['dbbind_142',['dbbind',['../a00548.html#ga873bc0f4663165e711655ade1dfae795',1,'dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c'],['../a00548.html#ga873bc0f4663165e711655ade1dfae795',1,'dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c']]], ['dbbylist_143',['dbbylist',['../a00548.html#gae658a0cd5270f3bd6f22de17b2cb2e64',1,'dbbylist(DBPROCESS *dbproc, int computeid, int *size): dblib.c'],['../a00548.html#gae658a0cd5270f3bd6f22de17b2cb2e64',1,'dbbylist(DBPROCESS *dbproc, int computeid, int *size): dblib.c']]], ['dbcancel_144',['dbcancel',['../a00548.html#ga5ea23272124fff03b8d87538c1ec3ee5',1,'dbcancel(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga5ea23272124fff03b8d87538c1ec3ee5',1,'dbcancel(DBPROCESS *dbproc): dblib.c']]], ['dbcanquery_145',['dbcanquery',['../a00548.html#ga559e24ba70d0d96c3469eb6ab8f74e05',1,'dbcanquery(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga559e24ba70d0d96c3469eb6ab8f74e05',1,'dbcanquery(DBPROCESS *dbproc): dblib.c']]], ['dbchange_146',['dbchange',['../a00548.html#ga8cbc761b1266bd947783d843aeeec264',1,'dbchange(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga8cbc761b1266bd947783d843aeeec264',1,'dbchange(DBPROCESS *dbprocess): dblib.c']]], ['dbclose_147',['dbclose',['../a00548.html#gaef740b394b44eb33925c2718f7b30d69',1,'dbclose(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaef740b394b44eb33925c2718f7b30d69',1,'dbclose(DBPROCESS *dbproc): dblib.c']]], ['dbclrbuf_148',['dbclrbuf',['../a00548.html#ga01404b179a251c249aecfdae72ec6ca4',1,'dbclrbuf(DBPROCESS *dbproc, DBINT n): dblib.c'],['../a00548.html#ga01404b179a251c249aecfdae72ec6ca4',1,'dbclrbuf(DBPROCESS *dbproc, DBINT n): dblib.c']]], ['dbclropt_149',['dbclropt',['../a00548.html#ga93ee3c8ca34a08588f88784898fd69e0',1,'dbclropt(DBPROCESS *dbproc, int option, const char param[]): dblib.c'],['../a00548.html#ga93ee3c8ca34a08588f88784898fd69e0',1,'dbclropt(DBPROCESS *dbproc, int option, const char param[]): dblib.c']]], ['dbcmd_150',['dbcmd',['../a00548.html#ga87b39d9863316b4ba85654b0885d53a0',1,'dbcmd(DBPROCESS *dbproc, const char cmdstring[]): dblib.c'],['../a00548.html#ga87b39d9863316b4ba85654b0885d53a0',1,'dbcmd(DBPROCESS *dbproc, const char cmdstring[]): dblib.c']]], ['dbcmdrow_151',['dbcmdrow',['../a00554.html#ga196f6d67de47f34a32fcc2103ab0f416',1,'dbcmdrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga196f6d67de47f34a32fcc2103ab0f416',1,'dbcmdrow(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga8b263669ce0312e52b5ea42a57a56838',1,'DBCMDROW(): sybdb.h']]], ['dbcol_152',['DBCOL',['../a01335.html',1,'']]], ['dbcol2_153',['DBCOL2',['../a01339.html',1,'']]], ['dbcolinfo_154',['dbcolinfo',['../a00080.html#a9b73fd1afa2c3ccfca481635212d2e43',1,'dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol): dblib.c'],['../a00506.html#a9b73fd1afa2c3ccfca481635212d2e43',1,'dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol): dblib.c']]], ['dbcollen_155',['dbcollen',['../a00548.html#ga89fc5589b4bf41932324d2cfc6ad6433',1,'dbcollen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga89fc5589b4bf41932324d2cfc6ad6433',1,'dbcollen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcolname_156',['dbcolname',['../a00548.html#gad06f5deddac18604dfa858b2580e232f',1,'dbcolname(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gad06f5deddac18604dfa858b2580e232f',1,'dbcolname(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcolptr_157',['dbcolptr',['../a00554.html#ga0fc84c7073ed4876d9596c3eccac3609',1,'dblib.c']]], ['dbcolsource_158',['dbcolsource',['../a00548.html#ga3a96d0188e5e0eb9eea661b3685fdcc3',1,'dbcolsource(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga3a96d0188e5e0eb9eea661b3685fdcc3',1,'dbcolsource(DBPROCESS *dbproc, int colnum): dblib.c']]], ['dbcoltype_159',['dbcoltype',['../a00548.html#ga636e6f1b64743f3cf22158a56eef371f',1,'dbcoltype(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga636e6f1b64743f3cf22158a56eef371f',1,'dbcoltype(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcoltypeinfo_160',['dbcoltypeinfo',['../a00548.html#ga3c33e72c41b40e08dbcfdfa0d16bc399',1,'dbcoltypeinfo(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga3c33e72c41b40e08dbcfdfa0d16bc399',1,'dbcoltypeinfo(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcolutype_161',['dbcolutype',['../a00548.html#gab33d2f4fd44f50e55b6c71902db4fdae',1,'dbcolutype(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gab33d2f4fd44f50e55b6c71902db4fdae',1,'dbcolutype(DBPROCESS *dbprocess, int column): dblib.c']]], ['dbconvert_162',['dbconvert',['../a00548.html#ga32eb72f6fb3edb130e59fb3dd0766e7e',1,'dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen): dblib.c'],['../a00548.html#ga32eb72f6fb3edb130e59fb3dd0766e7e',1,'dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen): dblib.c']]], ['dbconvert_5fps_163',['dbconvert_ps',['../a00548.html#ga8b00d5cdcaa20cba13fa2e03d52a443e',1,'dbconvert_ps(DBPROCESS *dbproc, int db_srctype, const BYTE *src, DBINT srclen, int db_desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo): dblib.c'],['../a00548.html#ga8b00d5cdcaa20cba13fa2e03d52a443e',1,'dbconvert_ps(DBPROCESS *dbprocess, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo): dblib.c']]], ['dbcount_164',['DBCOUNT',['../a00548.html#ga0ac1828f731a21c591c8d6330cbba3a9',1,'DBCOUNT(): sybdb.h'],['../a00548.html#ga9433bc200c0978569964354451d9b64e',1,'dbcount(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga9433bc200c0978569964354451d9b64e',1,'dbcount(DBPROCESS *dbproc): dblib.c']]], ['dbcurcmd_165',['DBCURCMD',['../a00548.html#gae375344b1ec50c1f756e3b69f3cef715',1,'DBCURCMD(): sybdb.h'],['../a00554.html#ga01e7fb38bece3bb07526532fa6be50e5',1,'dbcurcmd(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga01e7fb38bece3bb07526532fa6be50e5',1,'dbcurcmd(DBPROCESS *dbproc): dblib.c']]], ['dbcurrow_166',['dbcurrow',['../a00554.html#ga9e23a95d84192b4fc83db7544d772d16',1,'dbcurrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga9e23a95d84192b4fc83db7544d772d16',1,'dbcurrow(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaf49e4b58918bfa4d4adaa14ee5bb375c',1,'DBCURROW(): sybdb.h']]], ['dbdata_167',['dbdata',['../a00548.html#gaee60c306a22383805a4b9caa647a1e16',1,'dbdata(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gaee60c306a22383805a4b9caa647a1e16',1,'dbdata(DBPROCESS *dbproc, int column): dblib.c']]], ['dbdatecmp_168',['dbdatecmp',['../a00553.html#ga129d2922d347121a6b312dd8e75ed6d2',1,'dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2): dblib.c'],['../a00553.html#ga129d2922d347121a6b312dd8e75ed6d2',1,'dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2): dblib.c']]], ['dbdatecrack_169',['dbdatecrack',['../a00548.html#ga46f3641b79a2e90371a66950b6db2c4d',1,'dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime): dblib.c'],['../a00548.html#ga46f3641b79a2e90371a66950b6db2c4d',1,'dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *dt): dblib.c']]], ['dbdatetime_170',['DBDATETIME',['../a01315.html',1,'']]], ['dbdatetime4_171',['DBDATETIME4',['../a01319.html',1,'']]], ['dbdatetimeall_172',['DBDATETIMEALL',['../a01323.html',1,'']]], ['dbdatlen_173',['dbdatlen',['../a00548.html#gae666d141533126babb0235af21bdca0f',1,'dbdatlen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gae666d141533126babb0235af21bdca0f',1,'dbdatlen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbdead_174',['dbdead',['../a00554.html#gaed43cb21ed54dc1a6340075d6290e4b0',1,'dbdead(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gaed43cb21ed54dc1a6340075d6290e4b0',1,'dbdead(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga2c7b5eec4843ea326b21f2db2ded2754',1,'DBDEAD(): sybdb.h']]], ['dberrhandle_175',['dberrhandle',['../a00548.html#gab8209543de865f359bdb32829fa8b757',1,'dberrhandle(EHANDLEFUNC handler): dblib.c'],['../a00548.html#gab8209543de865f359bdb32829fa8b757',1,'dberrhandle(EHANDLEFUNC handler): dblib.c']]], ['dbexit_176',['dbexit',['../a00548.html#gad0044401c8c83205583f93a4764f2d8b',1,'dbexit(): dblib.c'],['../a00548.html#gad0044401c8c83205583f93a4764f2d8b',1,'dbexit(void): dblib.c']]], ['dbfcmd_177',['dbfcmd',['../a00548.html#ga43727b10d4cbb7708b374811abe6eadb',1,'dbfcmd(DBPROCESS *dbproc, const char *fmt,...): dblib.c'],['../a00548.html#ga43727b10d4cbb7708b374811abe6eadb',1,'dbfcmd(DBPROCESS *dbproc, const char *fmt,...): dblib.c']]], ['dbfirstrow_178',['DBFIRSTROW',['../a00548.html#ga97a6493786124215ec9fe4b4bd2d7cbb',1,'DBFIRSTROW(): sybdb.h'],['../a00554.html#gaf40b925f3b3ba43804720dd4ae584935',1,'dbfirstrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gaf40b925f3b3ba43804720dd4ae584935',1,'dbfirstrow(DBPROCESS *dbproc): dblib.c']]], ['dbfreebuf_179',['dbfreebuf',['../a00548.html#ga0fcfcf6846442dac9dd5584d270ec72a',1,'dbfreebuf(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga0fcfcf6846442dac9dd5584d270ec72a',1,'dbfreebuf(DBPROCESS *dbproc): dblib.c']]], ['dbgetchar_180',['dbgetchar',['../a00548.html#gaf917cf746c954a5d1b718afe3c4d1940',1,'dbgetchar(DBPROCESS *dbproc, int pos): dblib.c'],['../a00548.html#gaf917cf746c954a5d1b718afe3c4d1940',1,'dbgetchar(DBPROCESS *dbprocess, int n): dblib.c']]], ['dbgetmaxprocs_181',['dbgetmaxprocs',['../a00548.html#gadb34c5c2aae50ac9f2a26d8984136997',1,'dbgetmaxprocs(void): dblib.c'],['../a00548.html#gadb34c5c2aae50ac9f2a26d8984136997',1,'dbgetmaxprocs(void): dblib.c']]], ['dbgetnull_182',['dbgetnull',['../a00080.html#aea6a865806d454280126de940478c214',1,'dblib.c']]], ['dbgetpacket_183',['dbgetpacket',['../a00548.html#gabaf9aa756f7cb8bbec80d1c7201c6238',1,'dbgetpacket(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gabaf9aa756f7cb8bbec80d1c7201c6238',1,'dbgetpacket(DBPROCESS *dbproc): dblib.c']]], ['dbgetrow_184',['dbgetrow',['../a00548.html#ga60fe544491c760f8bc6c37bc7f777d70',1,'dbgetrow(DBPROCESS *dbproc, DBINT row): dblib.c'],['../a00548.html#ga60fe544491c760f8bc6c37bc7f777d70',1,'dbgetrow(DBPROCESS *dbproc, DBINT row): dblib.c']]], ['dbgettime_185',['dbgettime',['../a00548.html#ga6ccffbb3f0cfb10883ad349f1e47c50e',1,'dbgettime(void): dblib.c'],['../a00548.html#ga6ccffbb3f0cfb10883ad349f1e47c50e',1,'dbgettime(void): dblib.c']]], ['dbgetuserdata_186',['dbgetuserdata',['../a00548.html#gaa5714a91d7c14365fa1e5b164bb2b0b6',1,'dbgetuserdata(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaa5714a91d7c14365fa1e5b164bb2b0b6',1,'dbgetuserdata(DBPROCESS *dbproc): dblib.c']]], ['dbhasretstat_187',['dbhasretstat',['../a00549.html#ga7a5062dac92ccedc8459f6d4a530ffb7',1,'dbhasretstat(DBPROCESS *dbproc): dblib.c'],['../a00549.html#ga7a5062dac92ccedc8459f6d4a530ffb7',1,'dbhasretstat(DBPROCESS *dbproc): dblib.c']]], ['dbinit_188',['dbinit',['../a00548.html#ga564dd3a1bb0425a8957f1714d8b2a7c0',1,'dbinit(void): dblib.c'],['../a00548.html#ga564dd3a1bb0425a8957f1714d8b2a7c0',1,'dbinit(void): dblib.c']]], ['dbiordesc_189',['DBIORDESC',['../a00548.html#ga74ac942f9b7baa49e1d7d18628321297',1,'DBIORDESC(): sybdb.h'],['../a00554.html#gab842baac0ec420b265d8c199cc45059d',1,'dbiordesc(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gab842baac0ec420b265d8c199cc45059d',1,'dbiordesc(DBPROCESS *dbproc): dblib.c']]], ['dbiowdesc_190',['DBIOWDESC',['../a00548.html#ga5afb13924cda059d30be36a70dcf2cd9',1,'DBIOWDESC(): sybdb.h'],['../a00554.html#ga666a4d0609ee7f241deb0a62893d2cfa',1,'dbiowdesc(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga666a4d0609ee7f241deb0a62893d2cfa',1,'dbiowdesc(DBPROCESS *dbproc): dblib.c']]], ['dbisavail_191',['DBISAVAIL',['../a00548.html#ga40f6c951a851744e58ee715c652a8ac8',1,'sybdb.h']]], ['dbiscount_192',['dbiscount',['../a00548.html#ga6ba2a7f18cb76d24776e45fd71141494',1,'dbiscount(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga6ba2a7f18cb76d24776e45fd71141494',1,'dbiscount(DBPROCESS *dbproc): dblib.c']]], ['dbisopt_193',['dbisopt',['../a00548.html#gac3eb8cb53f50998403ea9aebc6263df9',1,'dbisopt(DBPROCESS *dbproc, int option, const char param[]): dblib.c'],['../a00548.html#gac3eb8cb53f50998403ea9aebc6263df9',1,'dbisopt(DBPROCESS *dbproc, int option, const char param[]): dblib.c']]], ['dblastrow_194',['DBLASTROW',['../a00548.html#ga10b9b26cf9a901146e9675a9e678632b',1,'DBLASTROW(): sybdb.h'],['../a00554.html#ga13ead146339b43b3a4d9049eb124ef4b',1,'dblastrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga13ead146339b43b3a4d9049eb124ef4b',1,'dblastrow(DBPROCESS *dbproc): dblib.c']]], ['dblib_2ec_195',['dblib.c',['../a00080.html',1,'']]], ['dblib_5fbuffer_5frow_196',['dblib_buffer_row',['../a00611.html',1,'']]], ['dblib_5fcontext_197',['dblib_context',['../a00615.html',1,'']]], ['datetime_20functions_198',['Datetime functions',['../a00553.html',1,'']]], ['dblib_5ferror_5fmessage_199',['DBLIB_ERROR_MESSAGE',['../a00554.html#ga8f2b5c6bcfed3eb54e97b42a6f8930f8',1,'dblib.c']]], ['dblibcontext_200',['DBLIBCONTEXT',['../a00080.html#a8ff1bdcccb992dd688bc35d178c4bf3b',1,'dblib.c']]], ['dblogin_201',['dblogin',['../a00548.html#ga0984798bb806f7451a53bffa7e2c430f',1,'dblogin(void): dblib.c'],['../a00548.html#ga0984798bb806f7451a53bffa7e2c430f',1,'dblogin(void): dblib.c']]], ['dbloginfree_202',['dbloginfree',['../a00548.html#gac1bdb1766b791153f37dceae8ff64ad6',1,'dbloginfree(LOGINREC *login): dblib.c'],['../a00548.html#gac1bdb1766b791153f37dceae8ff64ad6',1,'dbloginfree(LOGINREC *login): dblib.c']]], ['dbmny4add_203',['dbmny4add',['../a00552.html#ga0a384938a6586b7411fc42420ffad6ed',1,'dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum): dblib.c'],['../a00552.html#ga0a384938a6586b7411fc42420ffad6ed',1,'dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum): dblib.c']]], ['dbmny4cmp_204',['dbmny4cmp',['../a00552.html#ga109d4868baccb08fad3b26b6f031dc78',1,'dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2): dblib.c'],['../a00552.html#ga109d4868baccb08fad3b26b6f031dc78',1,'dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2): dblib.c']]], ['dbmny4copy_205',['dbmny4copy',['../a00552.html#gaa6d4c700b628f6a18a9d1ed9f8e2ba62',1,'dbmny4copy(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest): dblib.c'],['../a00552.html#gaa6d4c700b628f6a18a9d1ed9f8e2ba62',1,'dbmny4copy(DBPROCESS *dbprocess, DBMONEY4 *m1, DBMONEY4 *m2): dblib.c']]], ['dbmny4minus_206',['dbmny4minus',['../a00552.html#ga76177eb61a67dd52424236aba1b16bc9',1,'dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest): dblib.c'],['../a00552.html#ga76177eb61a67dd52424236aba1b16bc9',1,'dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest): dblib.c']]], ['dbmny4sub_207',['dbmny4sub',['../a00552.html#ga856143f4f9c7a5c15fb15633af81487d',1,'dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff): dblib.c'],['../a00552.html#ga856143f4f9c7a5c15fb15633af81487d',1,'dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff): dblib.c']]], ['dbmny4zero_208',['dbmny4zero',['../a00552.html#ga070e94f72f12c138a16a7bcdf732fa8b',1,'dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest): dblib.c'],['../a00552.html#ga070e94f72f12c138a16a7bcdf732fa8b',1,'dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest): dblib.c']]], ['dbmnycmp_209',['dbmnycmp',['../a00552.html#gadddacad5c3028aa8d3726246c3825651',1,'dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2): dblib.c'],['../a00552.html#gadddacad5c3028aa8d3726246c3825651',1,'dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2): dblib.c']]], ['dbmnycopy_210',['dbmnycopy',['../a00552.html#ga8f1e9aa0280c1cb46c10e5c90b8faced',1,'dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c'],['../a00552.html#ga8f1e9aa0280c1cb46c10e5c90b8faced',1,'dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c']]], ['dbmnydec_211',['dbmnydec',['../a00552.html#gabedce74748a31ea8a6e4068a5d44d8e4',1,'dbmnydec(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#gabedce74748a31ea8a6e4068a5d44d8e4',1,'dbmnydec(DBPROCESS *dbproc, DBMONEY *mnyptr): dblib.c']]], ['dbmnyinc_212',['dbmnyinc',['../a00552.html#gabf5216aaaa59ea7e7f07899f82a27faf',1,'dbmnyinc(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#gabf5216aaaa59ea7e7f07899f82a27faf',1,'dbmnyinc(DBPROCESS *dbproc, DBMONEY *mnyptr): dblib.c']]], ['dbmnymaxneg_213',['dbmnymaxneg',['../a00552.html#gabc3cb44d33bf1b9b18fd59f23e4da722',1,'dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#gabc3cb44d33bf1b9b18fd59f23e4da722',1,'dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *dest): dblib.c']]], ['dbmnymaxpos_214',['dbmnymaxpos',['../a00552.html#ga70ca2474f6c93acd6e3b842330b712c7',1,'dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#ga70ca2474f6c93acd6e3b842330b712c7',1,'dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *dest): dblib.c']]], ['dbmnyminus_215',['dbmnyminus',['../a00552.html#ga826bca98da4fd1c3188da45c383c3a68',1,'dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c'],['../a00552.html#ga826bca98da4fd1c3188da45c383c3a68',1,'dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c']]], ['dbmnyzero_216',['dbmnyzero',['../a00552.html#ga8eab0959d5a3cd534487b350258c939e',1,'dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest): dblib.c'],['../a00552.html#ga8eab0959d5a3cd534487b350258c939e',1,'dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest): dblib.c']]], ['dbmoney_217',['DBMONEY',['../a01307.html',1,'']]], ['dbmoney4_218',['DBMONEY4',['../a01311.html',1,'']]], ['dbmonthname_219',['dbmonthname',['../a00553.html#ga38ecd55ae5827bfa0fd12e2baf0950dd',1,'dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform): dblib.c'],['../a00553.html#ga38ecd55ae5827bfa0fd12e2baf0950dd',1,'dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform): dblib.c']]], ['dbmorecmds_220',['dbmorecmds',['../a00548.html#gac3ba9f53cc77e4dde8f48335ed94ac19',1,'dbmorecmds(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gac3ba9f53cc77e4dde8f48335ed94ac19',1,'dbmorecmds(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gad887bdce8cb0d3b8c6aaf659eb477b48',1,'DBMORECMDS(): sybdb.h']]], ['dbmoretext_221',['dbmoretext',['../a00548.html#ga6f13381522a1fa0b6ce2c15378088cdd',1,'dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[]): dblib.c'],['../a00548.html#ga6f13381522a1fa0b6ce2c15378088cdd',1,'dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[]): dblib.c']]], ['dbmsghandle_222',['dbmsghandle',['../a00548.html#gadc8af9a65f3719804c2537fd737298ca',1,'dbmsghandle(MHANDLEFUNC handler): dblib.c'],['../a00548.html#gadc8af9a65f3719804c2537fd737298ca',1,'dbmsghandle(MHANDLEFUNC handler): dblib.c']]], ['dbname_223',['dbname',['../a00548.html#gab185982ffe0b85b8fd19747bd1f433fe',1,'dbname(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gab185982ffe0b85b8fd19747bd1f433fe',1,'dbname(DBPROCESS *dbproc): dblib.c']]], ['dbnullbind_224',['dbnullbind',['../a00548.html#ga85dcc40c3615f94be96b09b2ec043533',1,'dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator): dblib.c'],['../a00548.html#ga85dcc40c3615f94be96b09b2ec043533',1,'dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator): dblib.c']]], ['dbnumalts_225',['dbnumalts',['../a00548.html#ga67934deac3bebbf8238eff8c0559389a',1,'dbnumalts(DBPROCESS *dbproc, int computeid): dblib.c'],['../a00548.html#ga67934deac3bebbf8238eff8c0559389a',1,'dbnumalts(DBPROCESS *dbproc, int computeid): dblib.c']]], ['dbnumcols_226',['dbnumcols',['../a00548.html#gadaa9482a082aa3fe52231e17749c2993',1,'dbnumcols(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gadaa9482a082aa3fe52231e17749c2993',1,'dbnumcols(DBPROCESS *dbproc): dblib.c']]], ['dbnumcompute_227',['dbnumcompute',['../a00548.html#gac554d2cb2da0c9f9fd3d4867998edcc4',1,'dbnumcompute(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gac554d2cb2da0c9f9fd3d4867998edcc4',1,'dbnumcompute(DBPROCESS *dbprocess): dblib.c']]], ['dbnumeric_228',['DBNUMERIC',['../a01303.html',1,'']]], ['dbnumrets_229',['dbnumrets',['../a00549.html#gaff09873008411a0573f6d1a9e6c7cf4b',1,'dbnumrets(DBPROCESS *dbproc): dblib.c'],['../a00549.html#gaff09873008411a0573f6d1a9e6c7cf4b',1,'dbnumrets(DBPROCESS *dbproc): dblib.c']]], ['dbopen_230',['dbopen',['../a00506.html#ae408d8e1c2ab0767d8bfd26d00d1ff6a',1,'dbopen.c']]], ['dboption_231',['dboption',['../a00935.html',1,'']]], ['dbperror_232',['dbperror',['../a00554.html#ga302a4ce6559b81808e3be51615cd1b67',1,'dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...): dblib.c'],['../a00554.html#ga302a4ce6559b81808e3be51615cd1b67',1,'dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...): dblib.c']]], ['dbpivot_233',['dbpivot',['../a00506.html#af8ada101cd189eff87b3533cbeaaa23b',1,'dbpivot.c']]], ['dbprcollen_234',['dbprcollen',['../a00548.html#gac0cb0584f6500d61a2ac95a891da73eb',1,'dbprcollen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gac0cb0584f6500d61a2ac95a891da73eb',1,'dbprcollen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbprhead_235',['dbprhead',['../a00548.html#ga9dfc2ee533e5e48a7aa8ca22f8d9ed79',1,'dbprhead(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga9dfc2ee533e5e48a7aa8ca22f8d9ed79',1,'dbprhead(DBPROCESS *dbproc): dblib.c']]], ['dbproc_5frowbuf_236',['DBPROC_ROWBUF',['../a00915.html',1,'']]], ['dbprrow_237',['dbprrow',['../a00548.html#gaa30be3414a97aac6139af2e928db91ca',1,'dbprrow(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaa30be3414a97aac6139af2e928db91ca',1,'dbprrow(DBPROCESS *dbproc): dblib.c']]], ['dbprtype_238',['dbprtype',['../a00548.html#gac25ae21ca19777ffab1c013bd6049ebf',1,'dbprtype(int token): dblib.c'],['../a00548.html#gac25ae21ca19777ffab1c013bd6049ebf',1,'dbprtype(int token): dblib.c']]], ['dbreadtext_239',['dbreadtext',['../a00548.html#gadd5685565c8c6c86079e17b8a73b324c',1,'dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize): dblib.c'],['../a00548.html#gadd5685565c8c6c86079e17b8a73b324c',1,'dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize): dblib.c']]], ['dbrecftos_240',['dbrecftos',['../a00548.html#gabb14ad9f268b92a8d63fa506098b24dd',1,'dbrecftos(const char filename[]): dblib.c'],['../a00548.html#gabb14ad9f268b92a8d63fa506098b24dd',1,'dbrecftos(const char filename[]): dblib.c']]], ['dbremote_5fproc_241',['DBREMOTE_PROC',['../a00931.html',1,'']]], ['dbremote_5fproc_5fparam_242',['DBREMOTE_PROC_PARAM',['../a00927.html',1,'']]], ['dbresults_243',['dbresults',['../a00548.html#ga4e26d949be2c3bf71b1a33c75b11d931',1,'dbresults(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga4e26d949be2c3bf71b1a33c75b11d931',1,'dbresults(DBPROCESS *dbproc): dblib.c']]], ['dbretdata_244',['dbretdata',['../a00549.html#ga42e187003b74fec6e9ca92d410bfb9c0',1,'dbretdata(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#ga42e187003b74fec6e9ca92d410bfb9c0',1,'dbretdata(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbretlen_245',['dbretlen',['../a00549.html#gab705bf94be535e9d8fc4edc0f48c98b0',1,'dbretlen(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#gab705bf94be535e9d8fc4edc0f48c98b0',1,'dbretlen(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbretname_246',['dbretname',['../a00549.html#ga0311328d63bae5d9bd5aea5ea4914223',1,'dbretname(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#ga0311328d63bae5d9bd5aea5ea4914223',1,'dbretname(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbretstatus_247',['dbretstatus',['../a00549.html#ga2306039d73fbc7045f257b0e750c37b4',1,'dbretstatus(DBPROCESS *dbproc): dblib.c'],['../a00549.html#ga2306039d73fbc7045f257b0e750c37b4',1,'dbretstatus(DBPROCESS *dbproc): dblib.c']]], ['dbrettype_248',['dbrettype',['../a00549.html#gaa478c8b96923bca02d158d966172ec1b',1,'dbrettype(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#gaa478c8b96923bca02d158d966172ec1b',1,'dbrettype(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbrows_249',['DBROWS',['../a00548.html#ga48d71b32c26703c810191ef916c5448c',1,'DBROWS(): sybdb.h'],['../a00554.html#ga4be2ab59dc7161d6b93c17202e7ae9b1',1,'dbrows(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga4be2ab59dc7161d6b93c17202e7ae9b1',1,'dbrows(DBPROCESS *dbproc): dblib.c']]], ['dbrowtype_250',['dbrowtype',['../a00554.html#gaa2dc8c062342f76adffe53ee280b7fb4',1,'dbrowtype(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gaa2dc8c062342f76adffe53ee280b7fb4',1,'dbrowtype(DBPROCESS *dbprocess): dblib.c'],['../a00548.html#ga6fda3f4982dda5825d13fee392e89fd9',1,'DBROWTYPE(): sybdb.h']]], ['dbrpcinit_251',['dbrpcinit',['../a00549.html#ga5b4374c13c7a83cd4345b0bfa3e787bd',1,'dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options): rpc.c'],['../a00549.html#ga5b4374c13c7a83cd4345b0bfa3e787bd',1,'dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options): rpc.c']]], ['dbrpcparam_252',['dbrpcparam',['../a00549.html#gaf6b6b0a641180a5c28382df39cd7d346',1,'dbrpcparam(DBPROCESS *dbproc, const char paramname[], BYTE status, int db_type, DBINT maxlen, DBINT datalen, BYTE *value): rpc.c'],['../a00549.html#gaf6b6b0a641180a5c28382df39cd7d346',1,'dbrpcparam(DBPROCESS *dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE *value): rpc.c']]], ['dbrpcsend_253',['dbrpcsend',['../a00549.html#gafa4dfd181be21e49c397f7daaa9cf96c',1,'dbrpcsend(DBPROCESS *dbproc): rpc.c'],['../a00549.html#gafa4dfd181be21e49c397f7daaa9cf96c',1,'dbrpcsend(DBPROCESS *dbproc): rpc.c']]], ['dbsafestr_254',['dbsafestr',['../a00548.html#gad0ccc03b94ba2515fd1f5d35559fcb41',1,'dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype): dblib.c'],['../a00548.html#gad0ccc03b94ba2515fd1f5d35559fcb41',1,'dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype): dblib.c']]], ['dbservcharset_255',['dbservcharset',['../a00548.html#ga39302e8efbb476ba01cff109ffb3661e',1,'dbservcharset(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga39302e8efbb476ba01cff109ffb3661e',1,'dbservcharset(DBPROCESS *dbprocess): dblib.c']]], ['dbsetavail_256',['dbsetavail',['../a00554.html#ga5ce245ff327a3d333280fe7b43d69ded',1,'dbsetavail(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga5ce245ff327a3d333280fe7b43d69ded',1,'dbsetavail(DBPROCESS *dbprocess): dblib.c']]], ['dbsetifile_257',['dbsetifile',['../a00548.html#ga663350909fec3a1d152316c45a65e708',1,'dbsetifile(char *filename): dblib.c'],['../a00548.html#ga663350909fec3a1d152316c45a65e708',1,'dbsetifile(char *filename): dblib.c']]], ['dbsetinterrupt_258',['dbsetinterrupt',['../a00548.html#ga335fcbe476ad0f897e4e2ce377f0a8cc',1,'dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr): dblib.c'],['../a00548.html#ga335fcbe476ad0f897e4e2ce377f0a8cc',1,'dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr): dblib.c']]], ['dbsetlapp_259',['DBSETLAPP',['../a00547.html#gab6c2da7fd615cf7462d555e5387a5580',1,'sybdb.h']]], ['dbsetlbool_260',['dbsetlbool',['../a00554.html#ga03e850369aca6fba074da5e9da4effd7',1,'dbsetlbool(LOGINREC *login, int value, int which): dblib.c'],['../a00554.html#ga03e850369aca6fba074da5e9da4effd7',1,'dbsetlbool(LOGINREC *login, int value, int which): dblib.c']]], ['dbsetlcharset_261',['DBSETLCHARSET',['../a00548.html#ga316c0fd24b8dc1259ce9eb4d25016400',1,'sybdb.h']]], ['dbsetlencrypt_262',['DBSETLENCRYPT',['../a00548.html#gac51e3075197963557a8d2a37d82df921',1,'sybdb.h']]], ['dbsetlhost_263',['DBSETLHOST',['../a00547.html#gaef0e7a5fcf2d8c8f795b2b06ce4de8b1',1,'sybdb.h']]], ['dbsetllabeled_264',['DBSETLLABELED',['../a00554.html#gae52fc525116a3491c7e1092ad8257767',1,'sybdb.h']]], ['dbsetllong_265',['dbsetllong',['../a00554.html#gabdcccf4e0d093ff48c0e7048a4bfaf84',1,'dbsetllong(LOGINREC *login, long value, int which): dblib.c'],['../a00554.html#gabdcccf4e0d093ff48c0e7048a4bfaf84',1,'dbsetllong(LOGINREC *login, long value, int which): dblib.c']]], ['dbsetlname_266',['dbsetlname',['../a00554.html#gae1fc46447c4f8a9ff7f66607b8cd23b6',1,'dbsetlname(LOGINREC *login, const char *value, int which): dblib.c'],['../a00554.html#gae1fc46447c4f8a9ff7f66607b8cd23b6',1,'dbsetlname(LOGINREC *login, const char *value, int which): dblib.c']]], ['dbsetlnatlang_267',['DBSETLNATLANG',['../a00548.html#gadada0e76c811a6fb84ce6759bcf116b5',1,'DBSETLNATLANG(): sybdb.h'],['../a00548.html#ga30e0028e6208414c2245e5fcd6740d9d',1,'dbsetlnatlang(): sybdb.h']]], ['dbsetlogintime_268',['dbsetlogintime',['../a00548.html#ga5f1281c07dde5a6d28e60ef62c501d1d',1,'dbsetlogintime(int seconds): dblib.c'],['../a00548.html#ga5f1281c07dde5a6d28e60ef62c501d1d',1,'dbsetlogintime(int seconds): dblib.c']]], ['dbsetlpacket_269',['dbsetlpacket',['../a00548.html#ga0d0acc4ce2243e48023e022b50e2ac45',1,'dbsetlpacket(): sybdb.h'],['../a00548.html#gae7e59f9c3cc0ec5916c06977ff7d8565',1,'DBSETLPACKET(): sybdb.h']]], ['dbsetlpwd_270',['DBSETLPWD',['../a00547.html#ga61e04e8e2f0d7f1740d40634041f98eb',1,'sybdb.h']]], ['dbsetluser_271',['DBSETLUSER',['../a00547.html#gafbe7e48171d2f9b1d4f99e0bfdd98f5e',1,'sybdb.h']]], ['dbsetlversion_272',['DBSETLVERSION',['../a00554.html#ga7306859300823c120d807108a061c45a',1,'DBSETLVERSION(): sybdb.h'],['../a00548.html#gaa22dce1ee0eb83059699c34c47d07c14',1,'dbsetlversion(LOGINREC *login, BYTE version): dblib.c'],['../a00548.html#gaa22dce1ee0eb83059699c34c47d07c14',1,'dbsetlversion(LOGINREC *login, BYTE version): dblib.c']]], ['dbsetmaxprocs_273',['dbsetmaxprocs',['../a00548.html#gaf2ca0e63f800b3839684c894ff651dd4',1,'dbsetmaxprocs(int maxprocs): dblib.c'],['../a00548.html#gaf2ca0e63f800b3839684c894ff651dd4',1,'dbsetmaxprocs(int maxprocs): dblib.c']]], ['dbsetnull_274',['dbsetnull',['../a00548.html#ga399512ec78c15ce3db79ea88ef3b1293',1,'dbsetnull(DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval): dblib.c'],['../a00548.html#ga399512ec78c15ce3db79ea88ef3b1293',1,'dbsetnull(DBPROCESS *dbprocess, int bindtype, int bindlen, BYTE *bindval): dblib.c']]], ['dbsetopt_275',['dbsetopt',['../a00548.html#ga9d660d278f3f58871b4086c0e175f4c6',1,'dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param): dblib.c'],['../a00548.html#ga9d660d278f3f58871b4086c0e175f4c6',1,'dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param): dblib.c']]], ['dbsetrow_276',['dbsetrow',['../a00548.html#gaeb3d621e4f6846bb228b0a596d8758c0',1,'dbsetrow(DBPROCESS *dbproc, DBINT row): dblib.c'],['../a00548.html#gaeb3d621e4f6846bb228b0a596d8758c0',1,'dbsetrow(DBPROCESS *dbprocess, DBINT row): dblib.c']]], ['dbsettime_277',['dbsettime',['../a00548.html#gada4b41f34542a87f0cd87e78e56d18bb',1,'dbsettime(int seconds): dblib.c'],['../a00548.html#gada4b41f34542a87f0cd87e78e56d18bb',1,'dbsettime(int seconds): dblib.c']]], ['dbsetuserdata_278',['dbsetuserdata',['../a00548.html#gabea9c70d02bf3e46bbb1d759915cb91e',1,'dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr): dblib.c'],['../a00548.html#gabea9c70d02bf3e46bbb1d759915cb91e',1,'dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr): dblib.c']]], ['dbsetversion_279',['dbsetversion',['../a00548.html#gab9aa181fb3081ffb314340cbd71e434d',1,'dbsetversion(DBINT version): dblib.c'],['../a00548.html#gab9aa181fb3081ffb314340cbd71e434d',1,'dbsetversion(DBINT version): dblib.c']]], ['dbspid_280',['dbspid',['../a00548.html#ga223a6d333f95e726b0b42ec19a076731',1,'dbspid(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga223a6d333f95e726b0b42ec19a076731',1,'dbspid(DBPROCESS *dbproc): dblib.c']]], ['dbspr1row_281',['dbspr1row',['../a00548.html#gaf641c8e3d34607ca8b7ac2afed3e6d67',1,'dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c'],['../a00548.html#gaf641c8e3d34607ca8b7ac2afed3e6d67',1,'dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c']]], ['dbspr1rowlen_282',['dbspr1rowlen',['../a00548.html#ga308918c13a5b1644269c1654fbea96ac',1,'dbspr1rowlen(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga308918c13a5b1644269c1654fbea96ac',1,'dbspr1rowlen(DBPROCESS *dbproc): dblib.c']]], ['dbsprhead_283',['dbsprhead',['../a00548.html#gaaa4839a9c88e5b90f33bd2407fcbc43e',1,'dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c'],['../a00548.html#gaaa4839a9c88e5b90f33bd2407fcbc43e',1,'dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c']]], ['dbsprline_284',['dbsprline',['../a00548.html#gacfaf9feb29c87cfb660886162f643152',1,'dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char): dblib.c'],['../a00548.html#gacfaf9feb29c87cfb660886162f643152',1,'dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char): dblib.c']]], ['dbsqlexec_285',['dbsqlexec',['../a00548.html#gaae889abeb145ec41f7361aa8f597fe46',1,'dbsqlexec(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaae889abeb145ec41f7361aa8f597fe46',1,'dbsqlexec(DBPROCESS *dbproc): dblib.c']]], ['dbsqlok_286',['dbsqlok',['../a00548.html#gae1f50a6a2c31fda57cb481922b06841e',1,'dbsqlok(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gae1f50a6a2c31fda57cb481922b06841e',1,'dbsqlok(DBPROCESS *dbproc): dblib.c']]], ['dbsqlsend_287',['dbsqlsend',['../a00548.html#gac980139b9cea03cf93e373d425991481',1,'dbsqlsend(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gac980139b9cea03cf93e373d425991481',1,'dbsqlsend(DBPROCESS *dbproc): dblib.c']]], ['dbstrbuild_288',['dbstrbuild',['../a00548.html#gab5fe0cd5f24d4fd33670111035a4fbed',1,'dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...): dblib.c'],['../a00548.html#gab5fe0cd5f24d4fd33670111035a4fbed',1,'dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...): dblib.c']]], ['dbstrcpy_289',['dbstrcpy',['../a00548.html#gaf130b12e9e58b1bfd4a6685e33f5b3cd',1,'dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest): dblib.c'],['../a00548.html#gaf130b12e9e58b1bfd4a6685e33f5b3cd',1,'dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest): dblib.c']]], ['dbstring_290',['dbstring',['../a01331.html',1,'']]], ['dbstrlen_291',['dbstrlen',['../a00548.html#ga13caa07ec45cd6f64e9197d29e3cfe5e',1,'dbstrlen(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga13caa07ec45cd6f64e9197d29e3cfe5e',1,'dbstrlen(DBPROCESS *dbproc): dblib.c']]], ['dbtablecolinfo_292',['dbtablecolinfo',['../a00548.html#ga9804fc70ae6ed35c92cd75d410dad570',1,'dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol): dblib.c'],['../a00548.html#ga9804fc70ae6ed35c92cd75d410dad570',1,'dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol): dblib.c']]], ['dbtds_293',['dbtds',['../a00554.html#ga8d765d810a40dfa01b39995a8e7406f0',1,'dbtds(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga8d765d810a40dfa01b39995a8e7406f0',1,'dbtds(DBPROCESS *dbprocess): dblib.c'],['../a00548.html#ga1644cf55d37435711df65c12a3f7b785',1,'DBTDS(): sybdb.h']]], ['dbtds_5funknown_294',['DBTDS_UNKNOWN',['../a00506.html#a4e19c79341755a7c6666197d381e1ac6',1,'sybdb.h']]], ['dbtxptr_295',['dbtxptr',['../a00548.html#ga57e4098b153a030f0be02bcd98e08ba2',1,'dbtxptr(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga57e4098b153a030f0be02bcd98e08ba2',1,'dbtxptr(DBPROCESS *dbproc, int column): dblib.c']]], ['dbtxtimestamp_296',['dbtxtimestamp',['../a00548.html#gac3f11142ec7ff25b1f8972af10fe9454',1,'dbtxtimestamp(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gac3f11142ec7ff25b1f8972af10fe9454',1,'dbtxtimestamp(DBPROCESS *dbproc, int column): dblib.c']]], ['dbtypeinfo_297',['dbtypeinfo',['../a01327.html',1,'']]], ['dbuse_298',['dbuse',['../a00548.html#ga66ea891910f0a357cc78107d6ab7d962',1,'dbuse(DBPROCESS *dbproc, const char *name): dblib.c'],['../a00548.html#ga66ea891910f0a357cc78107d6ab7d962',1,'dbuse(DBPROCESS *dbproc, const char *name): dblib.c']]], ['dbvarybin_299',['DBVARYBIN',['../a01299.html',1,'']]], ['dbvarychar_300',['DBVARYCHAR',['../a01295.html',1,'']]], ['dbvarylen_301',['dbvarylen',['../a00548.html#ga57c856964a9a0b4cc43f5192647c51e7',1,'dbvarylen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga57c856964a9a0b4cc43f5192647c51e7',1,'dbvarylen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbversion_302',['dbversion',['../a00548.html#ga666726c86108342b1c1f27eecf68e13c',1,'dbversion(): dblib.c'],['../a00548.html#ga666726c86108342b1c1f27eecf68e13c',1,'dbversion(void): dblib.c']]], ['dbversion_5funknown_303',['DBVERSION_UNKNOWN',['../a00506.html#adbc038c5d57c0ab4c1c9e081a664dc0f',1,'sybdb.h']]], ['dbwillconvert_304',['dbwillconvert',['../a00548.html#gaaf8349999c16b3c36caf5947747a2915',1,'dbwillconvert(int srctype, int desttype): dblib.c'],['../a00548.html#gaaf8349999c16b3c36caf5947747a2915',1,'dbwillconvert(int srctype, int desttype): dblib.c']]], ['dbwritetext_305',['dbwritetext',['../a00548.html#ga548153eb2eae76c48aa9d4b72258dc1c',1,'dbwritetext(DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text): dblib.c'],['../a00548.html#ga548153eb2eae76c48aa9d4b72258dc1c',1,'dbwritetext(DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text): dblib.c']]], ['decimicrosecond_306',['decimicrosecond',['../a01123.html#a838e73fd12eec9e3b5368316198f4762',1,'tdsdaterec']]], ['default_5ferr_5fhandler_307',['default_err_handler',['../a00554.html#gaccbc6d98d9528c48cf0254d809ca73ff',1,'dblib.c']]], ['defer_5fclose_308',['defer_close',['../a01199.html#a411e76370c635dfabe9b5941cdd3180f',1,'tds_cursor::defer_close()'],['../a01207.html#a744986c76b9b09f29325a1e0664b0e9a',1,'tds_dynamic::defer_close()']]], ['des_5fkey_309',['des_key',['../a01263.html',1,'']]], ['determine_5fadjusted_5fsize_310',['determine_adjusted_size',['../a00565.html#gaacb26868882440aa08de9fb952628eaf',1,'token.c']]], ['dlist_5flist_5ftype_311',['DLIST_LIST_TYPE',['../a01271.html',1,'']]], ['dlist_5fring_312',['dlist_ring',['../a01267.html',1,'']]], ['dsn_313',['dsn',['../a00667.html#acd76726add649629f26f1f1754fe48cf',1,'DSNINFO']]], ['dsninfo_314',['DSNINFO',['../a00667.html',1,'']]], ['dstr_315',['DSTR',['../a00566.html#gafddddf5bd7ad223cadee3d3bdc899954',1,'string.h']]], ['dstr_5finitializer_316',['DSTR_INITIALIZER',['../a00566.html#ga581a03a4de6c926c57b4a75a11214df4',1,'string.h']]], ['dynamic_20string_20functions_317',['Dynamic string functions',['../a00566.html',1,'']]], ['dyns_318',['dyns',['../a01231.html#a7dc98cfe507c626073b6e76985a06a8a',1,'tds_connection']]] ]; freetds-1.3.6/doc/reference/search/all_5.html000644 025423 025423 00000002616 14162303412 022436 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_5.js000644 025423 025423 00000000444 14162303412 022103 0ustar00fredianofrediano000000 000000 var searchData= [ ['emulated_319',['emulated',['../a01207.html#ad3fedfbec2ba0db4a64b82779d95a0c5',1,'tds_dynamic']]], ['end_5flogin_5fevent_320',['END_LOGIN_EVENT',['../a00711.html',1,'']]], ['env_321',['env',['../a01231.html#a17b3352a5f14239b2eecc4fc272bfe2a',1,'tds_connection']]] ]; freetds-1.3.6/doc/reference/search/all_6.html000644 025423 025423 00000002616 14162303412 022437 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_6.js000644 025423 025423 00000000747 14162303412 022112 0ustar00fredianofrediano000000 000000 var searchData= [ ['f_322',['f',['../a00719.html#a460a14dac0d298ff184e3cc67aafe91b',1,'tds_file_stream']]], ['from_5fmalloc_323',['from_malloc',['../a00715.html#ad483e0559eaa78104c4978667a0b739c',1,'tds_pbcb']]], ['frozen_5fpackets_324',['frozen_packets',['../a01235.html#a0df77e05bf01c5e4c79a2b3c99b40666',1,'tds_socket']]], ['func_5finfo_325',['func_info',['../a00659.html',1,'']]], ['freetds_20reference_20manual_326',['FreeTDS Reference Manual',['../index.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_7.html000644 025423 025423 00000002616 14162303412 022440 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_7.js000644 025423 025423 00000000471 14162303412 022105 0ustar00fredianofrediano000000 000000 var searchData= [ ['has_5fstatus_327',['has_status',['../a01235.html#acd5eeef948380cd1b8abb132a417b2bf',1,'tds_socket']]], ['hour_328',['hour',['../a01123.html#ae9f0348efe607ac7333eac841be46333',1,'tdsdaterec']]], ['how_20to_20add_20a_20new_20type_329',['How to add a new type',['../a01356.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_8.html000644 025423 025423 00000002616 14162303412 022441 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_8.js000644 025423 025423 00000002253 14162303412 022106 0ustar00fredianofrediano000000 000000 var searchData= [ ['internal_20bcp_20functions_330',['Internal bcp functions',['../a00551.html',1,'']]], ['internals_331',['Internals',['../a00554.html',1,'']]], ['iconv_2ec_332',['iconv.c',['../a01424.html',1,'(Global Namespace)'],['../a01427.html',1,'(Global Namespace)']]], ['id_333',['id',['../a01207.html#a72332750aee80a0a94c92b35d7263d76',1,'tds_dynamic']]], ['in_5fbuf_334',['in_buf',['../a01235.html#a24c1995f6e8d0f9a5990998524b00b6b',1,'tds_socket']]], ['in_5fcancel_335',['in_cancel',['../a01235.html#ae67d850cfbedf6b1e6b02111d4388d42',1,'tds_socket']]], ['in_5fflag_336',['in_flag',['../a01235.html#a765e007b69a2e188c989f05a689f6a11',1,'tds_socket']]], ['in_5flen_337',['in_len',['../a01235.html#a0b6e65b9d00b3a4efbf78b2d866cca20',1,'tds_socket']]], ['in_5fpos_338',['in_pos',['../a01235.html#a9d1b4fc8e1e801fdc703ee7bb68d9838',1,'tds_socket']]], ['in_5frow_339',['in_row',['../a01235.html#ab6a91be7f3b9966216e621c60e8151f2',1,'tds_socket']]], ['ip_5faddrs_340',['ip_addrs',['../a01143.html#a6e04f60eb1fae0e632ab6cddbb804a55',1,'tds_login']]], ['is_5fdatetime_5ftype_341',['is_datetime_type',['../a00449.html#a4a70a4d36139165f8be99ea6fffb57ce',1,'tds.h']]] ]; freetds-1.3.6/doc/reference/search/all_9.html000644 025423 025423 00000002616 14162303412 022442 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_9.js000644 025423 025423 00000000111 14162303412 022076 0ustar00fredianofrediano000000 000000 var searchData= [ ['key_5ft_342',['KEY_T',['../a00583.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_a.html000644 025423 025423 00000002616 14162303412 022512 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_a.js000644 025423 025423 00000001274 14162303412 022161 0ustar00fredianofrediano000000 000000 var searchData= [ ['left_343',['left',['../a00719.html#a3a7b329811d3ba3154aefa3b60ae1770',1,'tds_file_stream']]], ['libtds_20api_344',['LibTDS API',['../a00567.html',1,'']]], ['login_345',['login',['../a00667.html#ad7ff73ac9d36bdb6dc6d6c8f8c6847bb',1,'DSNINFO::login()'],['../a01235.html#a00c22eeebbdb781ab7b9d5e8403e451e',1,'tds_socket::login()']]], ['login_5fevent_346',['LOGIN_EVENT',['../a00707.html',1,'']]], ['login_5ftimeout_347',['login_timeout',['../a00615.html#a2da93c0f3681f87f94ad169deb09dc64',1,'dblib_context::login_timeout()'],['../a00875.html#a1c6ce7f3fd8d21c59840bba9faa5d0c6',1,'_cs_context::login_timeout()']]], ['loginrec_348',['LOGINREC',['../a00595.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_b.html000644 025423 025423 00000002616 14162303412 022513 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_b.js000644 025423 025423 00000001466 14162303412 022165 0ustar00fredianofrediano000000 000000 var searchData= [ ['money_20functions_349',['Money functions',['../a00552.html',1,'']]], ['md4context_350',['MD4Context',['../a01275.html',1,'']]], ['md5context_351',['MD5Context',['../a01279.html',1,'']]], ['memory_20allocation_352',['Memory allocation',['../a00562.html',1,'']]], ['metacomp_353',['METACOMP',['../a00579.html',1,'']]], ['metadata_354',['METADATA',['../a00571.html',1,'']]], ['metadata_5ft_355',['metadata_t',['../a00635.html',1,'']]], ['minute_356',['minute',['../a01123.html#a81d1931139497023deb1bb75dc0aae7a',1,'tdsdaterec']]], ['month_357',['month',['../a01123.html#af1542b5698f668f7df650b20fa27c177',1,'tdsdaterec']]], ['mpz_5ft_358',['mpz_t',['../a00775.html',1,'']]], ['msdblib_359',['msdblib',['../a00943.html#af3aab1ff30d324143f440bcd9f60d1c3',1,'tds_dblib_dbprocess']]] ]; freetds-1.3.6/doc/reference/search/all_c.html000644 025423 025423 00000002616 14162303412 022514 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_c.js000644 025423 025423 00000002502 14162303412 022156 0ustar00fredianofrediano000000 000000 var searchData= [ ['name_360',['name',['../a00787.html#aabc5f36785b65913edd51be1fd8ea1e3',1,'namelist::name()'],['../a01163.html#aa7152f00b01261e88db974cac1348c74',1,'tds_encoding::name()']]], ['name_5ft_361',['name_t',['../a00643.html',1,'']]], ['namelist_362',['namelist',['../a00787.html',1,'']]], ['names_5fblob_5fprefix_5ft_363',['names_blob_prefix_t',['../a00727.html',1,'']]], ['native_5finfo_364',['native_info',['../a00663.html',1,'']]], ['need_5freprepare_365',['need_reprepare',['../a01031.html#ac21b1c6a900bcb8dcb57bdeedcad8a72',1,'_hstmt']]], ['network_20functions_366',['Network functions',['../a00564.html',1,'']]], ['new_5fpassword_367',['new_password',['../a01143.html#a90cffdbb528cddb0cf30d1f9de7c3e9c',1,'tds_login']]], ['next_368',['next',['../a00787.html#a3aaf5848cba17d39d5ea5bd180590bb3',1,'namelist::next()'],['../a01031.html#ad2152f527dcdd108165e7e03fe476b8f',1,'_hstmt::next()'],['../a01199.html#a8743877d9147d83ef0ae64e04c8a46fb',1,'tds_cursor::next()'],['../a01207.html#adc93b94b6b4caf15dcf45297d928a8da',1,'tds_dynamic::next()']]], ['nullrep_369',['NULLREP',['../a00939.html',1,'']]], ['nullreps_370',['nullreps',['../a00943.html#a2baeb464798b61d8da14887eb35d63e7',1,'tds_dblib_dbprocess']]], ['num_5fid_371',['num_id',['../a01207.html#af6fd2355838cce1689fb0e04724b7b6a',1,'tds_dynamic']]] ]; freetds-1.3.6/doc/reference/search/all_d.html000644 025423 025423 00000002616 14162303412 022515 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_d.js000644 025423 025423 00000006462 14162303412 022170 0ustar00fredianofrediano000000 000000 var searchData= [ ['objectinfo_372',['OBJECTINFO',['../a00599.html',1,'']]], ['odbc_20api_373',['ODBC API',['../a00556.html',1,'']]], ['odbc_5fc_5fto_5fserver_5ftype_374',['odbc_c_to_server_type',['../a00557.html#ga3f0a413cea480a38d3d9b90c95515f6b',1,'odbc_c_to_server_type(int c_type): odbc_util.c'],['../a00557.html#ga3f0a413cea480a38d3d9b90c95515f6b',1,'odbc_c_to_server_type(int c_type): odbc_util.c']]], ['odbc_5fget_5fparam_5flen_375',['odbc_get_param_len',['../a00557.html#ga35028e8de1d50dc51ccef1d645c55e2a',1,'odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row): odbc_util.c'],['../a00557.html#ga35028e8de1d50dc51ccef1d645c55e2a',1,'odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row): odbc_util.c']]], ['odbc_5frdbms_5fversion_376',['odbc_rdbms_version',['../a00557.html#gae85ff7fb2002b5a7abc04fbee79e5525',1,'odbc_rdbms_version(TDSSOCKET *tds, char *pversion_string): odbc_util.c'],['../a00557.html#gae85ff7fb2002b5a7abc04fbee79e5525',1,'odbc_rdbms_version(TDSSOCKET *tds_socket, char *pversion_string): odbc_util.c']]], ['odbc_5fset_5fconcise_5fc_5ftype_377',['odbc_set_concise_c_type',['../a00557.html#ga128f6b09cde0af252370ba89cfa1fb78',1,'odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c'],['../a00557.html#ga128f6b09cde0af252370ba89cfa1fb78',1,'odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c']]], ['odbc_5fset_5fconcise_5fsql_5ftype_378',['odbc_set_concise_sql_type',['../a00557.html#ga125574bd2de677438909612db80041ea',1,'odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c'],['../a00557.html#ga125574bd2de677438909612db80041ea',1,'odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c']]], ['odbc_5fset_5fstring_5fflag_379',['odbc_set_string_flag',['../a00557.html#gadba4490bf3183799a70c9e2f44fab331',1,'odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR *pcbBuffer, const char *s, int len, int flag): odbc_util.c'],['../a00557.html#gadba4490bf3183799a70c9e2f44fab331',1,'odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR *pcbBuffer, const char *s, int len, int flag): odbc_util.c']]], ['odbc_20utility_380',['ODBC utility',['../a00557.html',1,'']]], ['offset_381',['offset',['../a01119.html#a76f4cbcb3bc7c10b3616579ec7861f58',1,'TDS_DATETIMEALL::offset()'],['../a01323.html#a13159d738e1d0b582a3a731123feb5f3',1,'DBDATETIMEALL::offset()']]], ['options_382',['options',['../a01199.html#a1be9f69f84a6d83ce86380c33a2bf9f8',1,'tds_cursor']]], ['origdsn_383',['origdsn',['../a00667.html#a8127a82b8c4130820a4c44f88eda8bcf',1,'DSNINFO']]], ['out_5fbuf_384',['out_buf',['../a01235.html#ad6b5121e435d22d640a645b98833cb9d',1,'tds_socket']]], ['out_5fbuf_5fmax_385',['out_buf_max',['../a01235.html#ae6fc66be718f3211fac3b835557e330e',1,'tds_socket']]], ['out_5fflag_386',['out_flag',['../a01235.html#a9bb663ee7c71f56f1602cbfcd993018c',1,'tds_socket']]], ['out_5fpos_387',['out_pos',['../a01235.html#a426adbd80f29f477377e42e8f78d3ff0',1,'tds_socket']]] ]; freetds-1.3.6/doc/reference/search/all_e.html000644 025423 025423 00000002616 14162303412 022516 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_e.js000644 025423 025423 00000004512 14162303412 022163 0ustar00fredianofrediano000000 000000 var searchData= [ ['primary_20functions_388',['Primary functions',['../a00548.html',1,'']]], ['param_5fcount_389',['param_count',['../a01031.html#a36e6cb901103834b074bf5a00fe7afbe',1,'_hstmt']]], ['param_5fnum_390',['param_num',['../a01031.html#a9b8cb8cb0826323811192adbed126348',1,'_hstmt']]], ['params_391',['params',['../a01031.html#aebe221315ae3dfd4850c399ad204ca4f',1,'_hstmt::params()'],['../a01207.html#adba427a655336d0b128cdec36544464b',1,'tds_dynamic::params()']]], ['parse_5fint8_392',['parse_int8',['../a00560.html#gace939c1fa676d172cb0cae94848b7fac',1,'convert.c']]], ['parse_5fnumeric_393',['parse_numeric',['../a00560.html#ga53a19b5da172ff364d01e8f04b97015a',1,'convert.c']]], ['parse_5fserver_5fname_5ffor_5fport_394',['parse_server_name_for_port',['../a00559.html#ga82ac44924fb1ae41042c233573a4ac8d',1,'config.c']]], ['password_395',['password',['../a01143.html#a411a965cbfdb05e69b6da62a30531bb2',1,'tds_login']]], ['pb_396',['pb',['../a00715.html#a616193286e91acc0a5dbe8942550e11e',1,'tds_pbcb']]], ['pd_397',['pd',['../a00603.html',1,'']]], ['pending_5fclose_398',['pending_close',['../a01231.html#a824fd854618d7d2005f2bec452247be7',1,'tds_connection']]], ['pivot_5ft_399',['pivot_t',['../a00639.html',1,'pivot_t'],['../a00591.html',1,'_options::pivot_t']]], ['pkt_400',['pkt',['../a01243.html#af900a7df4b6adae34d37233c3fb4cc99',1,'tds_freeze']]], ['pkt_5fpos_401',['pkt_pos',['../a01243.html#a99de10b997fb8a417d1ba7123957a720',1,'tds_freeze']]], ['poll_2eh_402',['poll.h',['../a00431.html',1,'']]], ['pollfd_403',['pollfd',['../a01079.html',1,'']]], ['port_404',['port',['../a01143.html#aec3fe0f3f17448018ae5c92cff3abb6d',1,'tds_login']]], ['prepared_5fpos_405',['prepared_pos',['../a01031.html#a45c0b5a3624186c84441d2e0f8a59c64',1,'_hstmt']]], ['prev_406',['prev',['../a01031.html#ad36ac281bcfcc5a6b6af0c1428b41d5f',1,'_hstmt']]], ['product_5fversion_407',['product_version',['../a01231.html#a7473cd879ba62019eb9d3bbb153832a1',1,'tds_connection']]], ['profileparam_408',['ProfileParam',['../a00647.html',1,'']]], ['ptw32_5fmcs_5fnode_5ft_5f_409',['ptw32_mcs_node_t_',['../a00799.html',1,'']]], ['put_5fdata_410',['put_data',['../a01171.html#a09912b32c805bec7ab47080b42bf93a1',1,'tds_column_funcs']]], ['put_5finfo_411',['put_info',['../a01171.html#afed4993bb75cb37dfc7a6bcdb74820e2',1,'tds_column_funcs']]] ]; freetds-1.3.6/doc/reference/search/all_f.html000644 025423 025423 00000002616 14162303412 022517 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_f.js000644 025423 025423 00000001173 14162303412 022164 0ustar00fredianofrediano000000 000000 var searchData= [ ['quarter_412',['quarter',['../a01123.html#aa0efc92bb0079287e043bb2c46c4603d',1,'tdsdaterec']]], ['query_413',['query',['../a01031.html#aaf4c8eb3163d2261ce6ce90118a70aec',1,'_hstmt::query()'],['../a01199.html#aeec2a01af48693b8b22449f15725d502',1,'tds_cursor::query()'],['../a01207.html#a1cee141e5f7045e691eec830cec1c158',1,'tds_dynamic::query()'],['../a00563.html',1,'(Global Namespace)']]], ['query_5ftimeout_414',['query_timeout',['../a00615.html#abf71abb24c7afea7dd7ef440048ea4c9',1,'dblib_context::query_timeout()'],['../a00875.html#a995ba257ef303066a726160decd7729c',1,'_cs_context::query_timeout()']]] ]; freetds-1.3.6/doc/reference/search/all_10.html000644 025423 025423 00000002617 14162303412 022513 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_10.js000644 025423 025423 00000003432 14162303412 022157 0ustar00fredianofrediano000000 000000 var searchData= [ ['remote_20procedure_20functions_415',['Remote Procedure functions',['../a00549.html',1,'']]], ['read_416',['read',['../a01087.html#a2f0be7677a1bf9c730e3c697bfba21c9',1,'tds_input_stream']]], ['read_2ec_417',['read.c',['../a00281.html',1,'']]], ['read_5fand_5fconvert_418',['read_and_convert',['../a00564.html#ga676c4dee6522815b16fdc8e448e43590',1,'read.c']]], ['ref_5fcount_419',['ref_count',['../a00615.html#a812580afdfca53b6d54a7d09938c65c2',1,'dblib_context::ref_count()'],['../a01199.html#a692ccceff71d836df0d084ec26123c2d',1,'tds_cursor::ref_count()'],['../a01207.html#a2798c66fb3c8637c7fb29c6d1efebfa4',1,'tds_dynamic::ref_count()']]], ['res_5finfo_420',['res_info',['../a01207.html#ac736e163c0d4cdbca980a861214d99e7',1,'tds_dynamic']]], ['resinfo_421',['resinfo',['../a00611.html#ad49b82677ae277e5d5b0038f522da293',1,'dblib_buffer_row']]], ['ret_5fstatus_422',['ret_status',['../a01235.html#a355e0b8c6219908747f82cd7482c6efb',1,'tds_socket']]], ['retry_5faddr_423',['retry_addr',['../a00767.html',1,'']]], ['row_424',['row',['../a00611.html#a015599345b266045d8bd3fac731e4675',1,'dblib_buffer_row']]], ['row_5fcount_425',['row_count',['../a01031.html#a8fd44f3c44ae4c83a1bdda0b73776ecd',1,'_hstmt']]], ['row_5fdata_426',['row_data',['../a00611.html#a5a057d6bbecfac1a85a9fbcd09eaf3a0',1,'dblib_buffer_row']]], ['row_5fstatus_427',['row_status',['../a01031.html#a41dd89b2dc41fe0e747580f6ea807063',1,'_hstmt']]], ['rows_5faffected_428',['rows_affected',['../a01235.html#a803e29dabc76d35227f5de2488f29877',1,'tds_socket']]], ['rsa_5fpublic_5fkey_429',['rsa_public_key',['../a00783.html',1,'']]], ['rtrim_430',['rtrim',['../a00551.html#ga4d5be57b25a0654e2170fd656dc35489',1,'bcp.c']]], ['results_20processing_431',['Results processing',['../a00565.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_11.html000644 025423 025423 00000002617 14162303412 022514 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_11.js000644 025423 025423 00000005562 14162303412 022166 0ustar00fredianofrediano000000 000000 var searchData= [ ['s_432',['s',['../a01231.html#a4853be2466fd81c9463ac88f8da8b9c2',1,'tds_connection']]], ['s_5fsqlmsgmap_433',['s_SqlMsgMap',['../a00651.html',1,'']]], ['s_5fv3to2map_434',['s_v3to2map',['../a00655.html',1,'']]], ['search_5finterface_5ffile_435',['search_interface_file',['../a00559.html#gaca20b6e5f5a5ac1727126712dd39564b',1,'config.c']]], ['second_436',['second',['../a01123.html#a8560717700de586f279af702bac86ad6',1,'tdsdaterec']]], ['select_5finfo_437',['select_info',['../a00675.html',1,'']]], ['send_5fpacket_438',['send_packet',['../a01235.html#a1c7c38af79f5845b90f19aaf5f63ce18',1,'tds_socket']]], ['server_5fcharset_439',['server_charset',['../a01143.html#a80dae8a766655c5c7365ba42d4d4d62c',1,'tds_login']]], ['server_5fname_440',['server_name',['../a01143.html#a69ed4cfded269727901bed2f95f1652e',1,'tds_login']]], ['server_5frealm_5fname_441',['server_realm_name',['../a01143.html#a1e5a5a13fa3cb0c5168d44187b52c814',1,'tds_login']]], ['server_5fspn_442',['server_spn',['../a01143.html#ad8d335a04cf09453a87a8e0b9118eaeb',1,'tds_login']]], ['size_443',['size',['../a01111.html#a9d221dd860f67d97daa71e107dce3470',1,'tds_dynamic_stream']]], ['size_5flen_444',['size_len',['../a01243.html#ae857ba89e4d2b249da64e0e7287da962',1,'tds_freeze']]], ['sizes_445',['sizes',['../a00611.html#abe1aa9f8ea96dda1400654813e68130a',1,'dblib_buffer_row']]], ['skip_5fone_5finput_5fsequence_446',['skip_one_input_sequence',['../a00561.html#ga3380140fc6eb9f2090c430f40e846876',1,'iconv.c']]], ['status_447',['status',['../a01199.html#ab5d6a587ac5780f001d383d4b874852f',1,'tds_cursor']]], ['stmt_5flist_448',['stmt_list',['../a01023.html#a4a9f3e8f1eba573df79a1ed300d8fc91',1,'_hdbc']]], ['store_5fmonthname_449',['store_monthname',['../a00560.html#ga17a0597ec3522c7f1ddb54956226dbfc',1,'convert.c']]], ['stream_450',['stream',['../a00719.html#abb6db59e849d11de92f4c55c61d51744',1,'tds_file_stream']]], ['stream_2ec_451',['stream.c',['../a01415.html',1,'']]], ['string_5flinked_5flist_452',['string_linked_list',['../a00795.html',1,'']]], ['string_5fto_5fint_453',['string_to_int',['../a00560.html#ga0176fafd412b5b8005bf1202fbc13b00',1,'convert.c']]], ['string_5fto_5fint8_454',['string_to_int8',['../a00560.html#ga933f87cca76156648e91f472650b98f3',1,'convert.c']]], ['string_5fto_5fnumeric_455',['string_to_numeric',['../a00560.html#ga28c75aff2615032005257af7455ed70d',1,'convert.c']]], ['string_5fto_5fresult_456',['string_to_result',['../a00560.html#ga46a5a00dfa70cad4a02d7cc73b314c31',1,'convert.c']]], ['string_5fto_5fuint8_457',['string_to_uint8',['../a00560.html#gae8e173a9f8d2e3f152ada9f48d3d5f28',1,'convert.c']]], ['stringpool_5ft_458',['stringpool_t',['../a00955.html',1,'']]], ['stringz_5fto_5fnumeric_459',['stringz_to_numeric',['../a00560.html#ga467401163bf05ed167f7b2b7e8bd875a',1,'convert.c']]], ['sybdb_2eh_460',['sybdb.h',['../a00506.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/all_12.html000644 025423 025423 00000002617 14162303412 022515 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_12.js000644 025423 025423 00000171332 14162303412 022166 0ustar00fredianofrediano000000 000000 var searchData= [ ['the_20db_2dlib_20api_461',['The db-lib API',['../a00547.html',1,'']]], ['tagss_5ftime2_5fstruct_462',['tagSS_TIME2_STRUCT',['../a01287.html',1,'']]], ['tagss_5ftimestampoffset_5fstruct_463',['tagSS_TIMESTAMPOFFSET_STRUCT',['../a01291.html',1,'']]], ['tds_464',['tds',['../a01031.html#ad357e33164f46fce2bc70267d71a1959',1,'_hstmt::tds()'],['../a01243.html#a182ed346382edef2962aca11c7cabc22',1,'tds_freeze::tds()']]], ['tds_2eh_465',['tds.h',['../a00449.html',1,'']]], ['tds4_5fsend_5femulated_5frpc_466',['tds4_send_emulated_rpc',['../a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080',1,'query.c']]], ['tds5_5fbcp_5fadd_5ffixed_5fcolumns_467',['tds5_bcp_add_fixed_columns',['../a00239.html#a91cf6a009e823417d6c8849256cb211c',1,'bulk.c']]], ['tds5_5fbcp_5fadd_5fvariable_5fcolumns_468',['tds5_bcp_add_variable_columns',['../a00239.html#a5c906a8b65694148ad530a22ce019f06',1,'bulk.c']]], ['tds5_5ffix_5fdot_5fquery_469',['tds5_fix_dot_query',['../a00563.html#ga3a5d1771cacc947521c4077551f0d3a4',1,'query.c']]], ['tds5_5fprocess_5fdyn_5fresult2_470',['tds5_process_dyn_result2',['../a00565.html#gae688b515631141acfbc41bbb91c8b921',1,'token.c']]], ['tds5_5fprocess_5foptioncmd_471',['tds5_process_optioncmd',['../a00565.html#gaa6a7e5aeb10a1322911c47be9c43e2d2',1,'token.c']]], ['tds5_5fprocess_5fresult_472',['tds5_process_result',['../a00565.html#ga547b2f48659f77a69aa802d861ac827d',1,'token.c']]], ['tds5_5fprocess_5fresult2_473',['tds5_process_result2',['../a00565.html#gabe2bdd5a41ce067cb31aef18ff81cb1c',1,'token.c']]], ['tds5_5fput_5fparams_474',['tds5_put_params',['../a00563.html#ga4f1f0a4f77bc4ea1440dfdebc19a157c',1,'query.c']]], ['tds71_5fcollation_475',['TDS71_COLLATION',['../a01071.html',1,'']]], ['tds71_5fread_5ftable_5fnames_476',['tds71_read_table_names',['../a00565.html#ga7482b5730d880fcedbe9fcd609a550ce',1,'token.c']]], ['tds71_5fsubmit_5fprepexec_477',['tds71_submit_prepexec',['../a00563.html#ga08877c101704bebe4fa57e0849dc272d',1,'tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c'],['../a00563.html#ga08877c101704bebe4fa57e0849dc272d',1,'tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c']]], ['tds72_5fsmp_5fheader_478',['TDS72_SMP_HEADER',['../a01075.html',1,'']]], ['tds7_5fbcp_5fsend_5fcolmetadata_479',['tds7_bcp_send_colmetadata',['../a00239.html#a4daaa551e54dbd978650e2eef89e09ff',1,'bulk.c']]], ['tds7_5fbuild_5fbulk_5finsert_5fstmt_480',['tds7_build_bulk_insert_stmt',['../a00239.html#a3118c7232bc9c3e47f8ba872bb39e967',1,'bulk.c']]], ['tds7_5fget_5fdata_5finfo_481',['tds7_get_data_info',['../a00565.html#ga07cee55fd522cca16fb59b7a8f0b1376',1,'token.c']]], ['tds7_5fget_5finstance_5fport_482',['tds7_get_instance_port',['../a00564.html#gac23c12ccb3e8599f10f305e993e216f6',1,'tds7_get_instance_port(struct addrinfo *addr, const char *instance): net.c'],['../a00564.html#gac23c12ccb3e8599f10f305e993e216f6',1,'tds7_get_instance_port(struct addrinfo *addr, const char *instance): net.c']]], ['tds7_5fget_5finstance_5fports_483',['tds7_get_instance_ports',['../a00564.html#ga954dcc3b0332fa9448d9edf59c0fe439',1,'tds7_get_instance_ports(FILE *output, struct addrinfo *addr): net.c'],['../a00564.html#ga954dcc3b0332fa9448d9edf59c0fe439',1,'tds7_get_instance_ports(FILE *output, struct addrinfo *addr): net.c']]], ['tds7_5fprocess_5fcompute_5fresult_484',['tds7_process_compute_result',['../a00565.html#ga6728e344caa20aea1def85f58dea138b',1,'token.c']]], ['tds7_5fprocess_5fresult_485',['tds7_process_result',['../a00565.html#gaca56fc22d65a24a96d1bef310ade73aa',1,'token.c']]], ['tds7_5fput_5fquery_5fparams_486',['tds7_put_query_params',['../a00563.html#ga6e42b4a1d1d3898229ea2fe4afc2ecec',1,'query.c']]], ['tds7_5fsend_5fexecute_487',['tds7_send_execute',['../a00563.html#ga9f6f25dd405f45e75420e6e084bf2d85',1,'query.c']]], ['tds7_5fwrite_5fparam_5fdef_5ffrom_5fparams_488',['tds7_write_param_def_from_params',['../a00563.html#ga6513afd79629f7a928e1d3da9f56dee1',1,'query.c']]], ['tds7_5fwrite_5fparam_5fdef_5ffrom_5fquery_489',['tds7_write_param_def_from_query',['../a00563.html#ga24345856c16b15aa3e84459c2f551320',1,'query.c']]], ['tds_5faddrinfo_490',['tds_addrinfo',['../a01083.html',1,'']]], ['tds_5falign_5fstruct_491',['tds_align_struct',['../a01131.html',1,'']]], ['tds_5falloc_5fcompute_5fresult_492',['tds_alloc_compute_result',['../a00562.html#gae042c280bdf5ecdd530a6e5cc2cf83f5',1,'mem.c']]], ['tds_5falloc_5fdynamic_493',['tds_alloc_dynamic',['../a00562.html#ga69559de43b47f4a9e2eecc7a56527444',1,'tds_alloc_dynamic(TDSCONNECTION *conn, const char *id): mem.c'],['../a00562.html#ga69559de43b47f4a9e2eecc7a56527444',1,'tds_alloc_dynamic(TDSCONNECTION *conn, const char *id): mem.c']]], ['tds_5falloc_5fget_5fstring_494',['tds_alloc_get_string',['../a00565.html#gafb26aba5d935e40b87b95e21a5185848',1,'token.c']]], ['tds_5falloc_5fparam_5fdata_495',['tds_alloc_param_data',['../a00562.html#ga282d67682d293810625d87d566443c2d',1,'tds_alloc_param_data(TDSCOLUMN *curparam): mem.c'],['../a00562.html#ga282d67682d293810625d87d566443c2d',1,'tds_alloc_param_data(TDSCOLUMN *curparam): mem.c']]], ['tds_5falloc_5fparam_5fresult_496',['tds_alloc_param_result',['../a00562.html#ga314c65c067570dc1ef3e58bbfc4eb763',1,'tds_alloc_param_result(TDSPARAMINFO *old_param): mem.c'],['../a00562.html#ga314c65c067570dc1ef3e58bbfc4eb763',1,'tds_alloc_param_result(TDSPARAMINFO *old_param): mem.c']]], ['tds_5falloc_5frow_497',['tds_alloc_row',['../a00562.html#ga1224fb9277112dc2ce12531d2b73b145',1,'tds_alloc_row(TDSRESULTINFO *res_info): mem.c'],['../a00562.html#ga1224fb9277112dc2ce12531d2b73b145',1,'tds_alloc_row(TDSRESULTINFO *res_info): mem.c']]], ['tds_5fanswer_498',['tds_answer',['../a00723.html',1,'']]], ['tds_5fanswer_5fchallenge_499',['tds_answer_challenge',['../a00558.html#ga8adf4e719762fef6fdb091d15d4d5d7f',1,'challenge.c']]], ['tds_5fascii_5fto_5fucs2_500',['tds_ascii_to_ucs2',['../a00563.html#gad05fc65e1d505c68d14c82b99a00e4eb',1,'query.c']]], ['tds_5fauthentication_501',['tds_authentication',['../a01219.html',1,'']]], ['tds_5fbcp_5fdirections_502',['tds_bcp_directions',['../a00449.html#ad5c5c8cb776334af4b0ebf7a0d740cb2',1,'tds.h']]], ['tds_5fbcp_5fdone_503',['tds_bcp_done',['../a00239.html#ade7df2db455b61edc83819ad60edb339',1,'tds_bcp_done(TDSSOCKET *tds, int *rows_copied): bulk.c'],['../a00449.html#ade7df2db455b61edc83819ad60edb339',1,'tds_bcp_done(TDSSOCKET *tds, int *rows_copied): bulk.c']]], ['tds_5fbcp_5ffread_504',['tds_bcp_fread',['../a00239.html#a86ac92bd8a3c61a413d27150ec9bc202',1,'tds_bcp_fread(TDSSOCKET *tds, TDSICONV *char_conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes): bulk.c'],['../a00449.html#a8184311543c685f2ee0bcccfb725ca02',1,'tds_bcp_fread(TDSSOCKET *tds, TDSICONV *conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes): bulk.c']]], ['tds_5fbcp_5finit_505',['tds_bcp_init',['../a00239.html#ac6610c72bd31bad5378f760fa9b12d66',1,'tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c'],['../a00449.html#ac6610c72bd31bad5378f760fa9b12d66',1,'tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c']]], ['tds_5fbcp_5frow_5ffree_506',['tds_bcp_row_free',['../a00239.html#a7c4f2b050cd1a747604aa305d6877de7',1,'bulk.c']]], ['tds_5fbcp_5fsend_5frecord_507',['tds_bcp_send_record',['../a00239.html#ad9e44450025cbcee1ad81d7e5a2cc099',1,'tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset): bulk.c'],['../a00449.html#ad9e44450025cbcee1ad81d7e5a2cc099',1,'tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset): bulk.c']]], ['tds_5fbcp_5fstart_508',['tds_bcp_start',['../a00239.html#a8208eef2a3974ae1f0cf3c8c8ab011ce',1,'tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c'],['../a00449.html#a8208eef2a3974ae1f0cf3c8c8ab011ce',1,'tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c']]], ['tds_5fbcp_5fstart_5fcopy_5fin_509',['tds_bcp_start_copy_in',['../a00239.html#a5eec23828b0610c58de248c4edb53879',1,'tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c'],['../a00449.html#a5eec23828b0610c58de248c4edb53879',1,'tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c']]], ['tds_5fbcp_5fstart_5finsert_5fstmt_510',['tds_bcp_start_insert_stmt',['../a00239.html#ab4d7e5309152f54613d52c8469a07fd8',1,'bulk.c']]], ['tds_5fbcpcoldata_511',['tds_bcpcoldata',['../a01167.html',1,'']]], ['tds_5fbcpinfo_512',['tds_bcpinfo',['../a01247.html',1,'']]], ['tds_5fblob_513',['tds_blob',['../a01155.html',1,'']]], ['tds_5fcanonical_5fcharset_514',['tds_canonical_charset',['../a00561.html#gac01180352db7052e786463e3b07a8a9e',1,'tds_canonical_charset(const char *charset_name): iconv.c'],['../a00561.html#gac01180352db7052e786463e3b07a8a9e',1,'tds_canonical_charset(const char *charset_name): iconv.c']]], ['tds_5fcanonical_5fcharset_5fname_515',['tds_canonical_charset_name',['../a00561.html#ga6561d1dba1a04c168431b16ec17d7e4c',1,'tds_canonical_charset_name(const char *charset_name): iconv.c'],['../a00561.html#ga6561d1dba1a04c168431b16ec17d7e4c',1,'tds_canonical_charset_name(const char *charset_name): iconv.c']]], ['tds_5fcapabilities_516',['tds_capabilities',['../a01139.html',1,'']]], ['tds_5fcapability_5ftype_517',['tds_capability_type',['../a01135.html',1,'']]], ['tds_5fclose_5fsocket_518',['tds_close_socket',['../a00564.html#ga3e3f76009fce5ceedb2f42bb2c9aed2e',1,'tds_close_socket(TDSSOCKET *tds): net.c'],['../a00564.html#ga3e3f76009fce5ceedb2f42bb2c9aed2e',1,'tds_close_socket(TDSSOCKET *tds): net.c']]], ['tds_5fcolumn_519',['tds_column',['../a01175.html',1,'']]], ['tds_5fcolumn_5ffuncs_520',['tds_column_funcs',['../a01171.html',1,'']]], ['tds_5fcompiletime_5fsettings_521',['tds_compiletime_settings',['../a01115.html',1,'tds_compiletime_settings'],['../a00449.html#a1de034b895312fc0cfae0e28f8921a47',1,'TDS_COMPILETIME_SETTINGS(): tds.h']]], ['tds_5fcondition_522',['tds_condition',['../a01255.html',1,'']]], ['tds_5fconfig_5fverstr_523',['tds_config_verstr',['../a00559.html#gade94d7e89ba1f668c82be0b00a7f5cd7',1,'tds_config_verstr(const char *tdsver, TDSLOGIN *login): config.c'],['../a00559.html#gade94d7e89ba1f668c82be0b00a7f5cd7',1,'tds_config_verstr(const char *tdsver, TDSLOGIN *login): config.c']]], ['tds_5fconnection_524',['tds_connection',['../a01231.html',1,'']]], ['tds_5fcontext_525',['tds_context',['../a01215.html',1,'']]], ['tds_5fconvert_526',['tds_convert',['../a00560.html#gad83c146aa5ba3f1515557d6b5248494a',1,'tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr): convert.c'],['../a00560.html#gad83c146aa5ba3f1515557d6b5248494a',1,'tds_convert(const TDSCONTEXT *context, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr): convert.c']]], ['tds_5fconvert_5fstream_527',['tds_convert_stream',['../a01415.html#a9d8eb43a81ff58ab423dce0ce95b9564',1,'stream.c']]], ['tds_5fconvert_5fstring_528',['tds_convert_string',['../a00563.html#ga024bc5482366735070befd6f4af59f71',1,'tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len): query.c'],['../a00563.html#ga024bc5482366735070befd6f4af59f71',1,'tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len): query.c']]], ['tds_5fcopy_5fstream_529',['tds_copy_stream',['../a01415.html#a50bc3749988d1c3c441044fc07ab44e4',1,'stream.c']]], ['tds_5fcount_5fplaceholders_530',['tds_count_placeholders',['../a00563.html#gaaa7b4d37bf796019e72f25c6e7fe7bea',1,'tds_count_placeholders(const char *query): query.c'],['../a00563.html#gaaa7b4d37bf796019e72f25c6e7fe7bea',1,'tds_count_placeholders(const char *query): query.c']]], ['tds_5fcount_5fplaceholders_5fucs2le_531',['tds_count_placeholders_ucs2le',['../a00563.html#ga0cd19215e9169ea299a6c9cbf5b2fb60',1,'query.c']]], ['tds_5fctx_532',['tds_ctx',['../a00615.html#afb3fb2d591c0f75b9412f8ca77e2629d',1,'dblib_context']]], ['tds_5fctx_5fref_5fcount_533',['tds_ctx_ref_count',['../a00615.html#ad01d901acbc92e8c369e6a6c784d7446',1,'dblib_context']]], ['tds_5fcursor_534',['tds_cursor',['../a01199.html',1,'']]], ['tds_5fcursor_5fcheck_5fallocated_535',['tds_cursor_check_allocated',['../a00563.html#ga2a64baaf4aa50ef601a49b801dfdaaf6',1,'query.c']]], ['tds_5fcursor_5fdealloc_536',['tds_cursor_dealloc',['../a00563.html#gab25de0567ac096e8f8e88490eeddf562',1,'tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor): query.c'],['../a00563.html#gab25de0567ac096e8f8e88490eeddf562',1,'tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor): query.c']]], ['tds_5fcursor_5fstatus_537',['tds_cursor_status',['../a01195.html',1,'']]], ['tds_5fdatain_5fstream_538',['tds_datain_stream',['../a01095.html',1,'']]], ['tds_5fdatain_5fstream_5finit_539',['tds_datain_stream_init',['../a01415.html#abc3a77c8aa28842e7f28583cbabc1415',1,'stream.c']]], ['tds_5fdatain_5fstream_5fread_540',['tds_datain_stream_read',['../a01415.html#a04b537d889f7d4c9b9701eb81baf7efd',1,'stream.c']]], ['tds_5fdataout_5fstream_541',['tds_dataout_stream',['../a01099.html',1,'']]], ['tds_5fdataout_5fstream_5finit_542',['tds_dataout_stream_init',['../a01415.html#aa038a9125979f8f0915dbd53cbf27e5a',1,'stream.c']]], ['tds_5fdataout_5fstream_5fwrite_543',['tds_dataout_stream_write',['../a01415.html#ae38a590ee08cf398e7adef536ac94538',1,'stream.c']]], ['tds_5fdatecrack_544',['tds_datecrack',['../a00560.html#ga883855e6e3793de6684b21db39c756c4',1,'tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr): convert.c'],['../a00560.html#ga883855e6e3793de6684b21db39c756c4',1,'tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr): convert.c']]], ['tds_5fdatetimeall_545',['TDS_DATETIMEALL',['../a01119.html',1,'']]], ['tds_5fdblib_5fdbprocess_546',['tds_dblib_dbprocess',['../a00943.html',1,'']]], ['tds_5fdblib_5floginrec_547',['tds_dblib_loginrec',['../a00911.html',1,'']]], ['tds_5fdead_548',['TDS_DEAD',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33af087b64970a1fb35bbcf1bc6ea7a643d',1,'tds.h']]], ['tds_5fdeferred_5fcursor_5fdealloc_549',['tds_deferred_cursor_dealloc',['../a00563.html#ga57bd0fabe5bcdeb3ef091259b3a7c1fc',1,'tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor): query.c'],['../a00563.html#ga57bd0fabe5bcdeb3ef091259b3a7c1fc',1,'tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor): query.c']]], ['tds_5fdeferred_5funprepare_550',['tds_deferred_unprepare',['../a00563.html#ga9f80fdf732b084aef7de7a323261aa61',1,'tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c'],['../a00563.html#ga9f80fdf732b084aef7de7a323261aa61',1,'tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c']]], ['tds_5fdetach_5fresults_551',['tds_detach_results',['../a00562.html#ga1d60bf443e274797b1d1a9e7418ab962',1,'tds_detach_results(TDSRESULTINFO *info): mem.c'],['../a00562.html#ga1d60bf443e274797b1d1a9e7418ab962',1,'tds_detach_results(TDSRESULTINFO *info): mem.c']]], ['tds_5fdone_5fcancelled_552',['TDS_DONE_CANCELLED',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca202254cfd6784404cf1aa22bc7147c86',1,'tds.h']]], ['tds_5fdone_5fcount_553',['TDS_DONE_COUNT',['../a00449.html#aa8d8044be84bcde003f28ec25a77519caf17d0c6591e318014c806a10c2f0270b',1,'tds.h']]], ['tds_5fdone_5ferror_554',['TDS_DONE_ERROR',['../a00449.html#aa8d8044be84bcde003f28ec25a77519caa9d79a3b62e3321332223ac3d1a5b18d',1,'tds.h']]], ['tds_5fdone_5ffinal_555',['TDS_DONE_FINAL',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca7ed9046db24ad78bb94c2b12d6e11f46',1,'tds.h']]], ['tds_5fdone_5finxact_556',['TDS_DONE_INXACT',['../a00449.html#aa8d8044be84bcde003f28ec25a77519cac79a30d1a0bac125e77d87f5d87bc2b2',1,'tds.h']]], ['tds_5fdone_5fmore_5fresults_557',['TDS_DONE_MORE_RESULTS',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca688b8bf555ce6ae72f3e047177bfc966',1,'tds.h']]], ['tds_5fdone_5fproc_558',['TDS_DONE_PROC',['../a00449.html#aa8d8044be84bcde003f28ec25a77519cae170f368306f421d507c6f08e4d48d9a',1,'tds.h']]], ['tds_5fdone_5fsrverror_559',['TDS_DONE_SRVERROR',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca7bfe89d6f8fc309eae412ad0a503e34c',1,'tds.h']]], ['tds_5fdstr_560',['tds_dstr',['../a01283.html',1,'']]], ['tds_5fdstr_5falloc_561',['tds_dstr_alloc',['../a00566.html#ga6aa14b8b717b51afcfb65bd55143689d',1,'tdsstring.c']]], ['tds_5fdstr_5fbuf_562',['tds_dstr_buf',['../a00566.html#ga8fa35e3ff06ef0b7d0d642cf50282ab8',1,'string.h']]], ['tds_5fdstr_5fcopy_563',['tds_dstr_copy',['../a00566.html#gad96366d9fa93bfc283cef1299fbe97ab',1,'tdsstring.c']]], ['tds_5fdstr_5fcopyn_564',['tds_dstr_copyn',['../a00566.html#ga656718f240d7403f986ae887d84a6ca1',1,'tdsstring.c']]], ['tds_5fdstr_5fcstr_565',['tds_dstr_cstr',['../a00566.html#ga5f351a208e7aa13b4cc2d32cac8fc0fa',1,'string.h']]], ['tds_5fdstr_5fdup_566',['tds_dstr_dup',['../a00566.html#ga4e6d9fa6f9b9551a5a3390e10a5322e6',1,'tdsstring.c']]], ['tds_5fdstr_5fempty_567',['tds_dstr_empty',['../a00566.html#ga42d67780bd4fd442915780d4815fc743',1,'string.h']]], ['tds_5fdstr_5ffree_568',['tds_dstr_free',['../a00566.html#gaccd1c1c8ff938813578123963212388c',1,'tdsstring.c']]], ['tds_5fdstr_5fget_569',['tds_dstr_get',['../a00564.html#gafae08056186b143f3ef1399307dc9be7',1,'tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len): read.c'],['../a00564.html#gafae08056186b143f3ef1399307dc9be7',1,'tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len): read.c']]], ['tds_5fdstr_5finit_570',['tds_dstr_init',['../a00566.html#ga6c0aba5c6da921898768e7f6cf177ca7',1,'string.h']]], ['tds_5fdstr_5fisempty_571',['tds_dstr_isempty',['../a00566.html#ga197c6af67f2e7469d06c2aa055917b1e',1,'string.h']]], ['tds_5fdstr_5flen_572',['tds_dstr_len',['../a00566.html#ga396f139e4f886ac1b224a735138e73dd',1,'string.h']]], ['tds_5fdstr_5fset_573',['tds_dstr_set',['../a00566.html#gab78cc59b110df2817b00f9bed74c6ff1',1,'tdsstring.c']]], ['tds_5fdstr_5fsetlen_574',['tds_dstr_setlen',['../a00566.html#ga0cd7863ba7c2d2da4a193234472a3d14',1,'tdsstring.c']]], ['tds_5fdstr_5fzero_575',['tds_dstr_zero',['../a00566.html#ga339ba30216e2bd5bd076aa9dcd26f3c4',1,'tdsstring.c']]], ['tds_5fdynamic_576',['tds_dynamic',['../a01207.html',1,'']]], ['tds_5fdynamic_5fstream_577',['tds_dynamic_stream',['../a01111.html',1,'']]], ['tds_5fdynamic_5fstream_5finit_578',['tds_dynamic_stream_init',['../a01415.html#a4f9e40da6941cb9407d0da5bc3030517',1,'stream.c']]], ['tds_5fdynamic_5fstream_5fwrite_579',['tds_dynamic_stream_write',['../a01415.html#abaf688c85ea04a2392103d519a55d04e',1,'stream.c']]], ['tds_5fencoding_580',['tds_encoding',['../a01163.html',1,'tds_encoding'],['../a00449.html#ae21e9f12e8ee5219228ee6b6a41dec66',1,'TDS_ENCODING(): tds.h']]], ['tds_5fend_581',['tds_end',['../a00449.html#aa8d8044be84bcde003f28ec25a77519c',1,'tds.h']]], ['tds_5fenv_582',['tds_env',['../a01203.html',1,'']]], ['tds_5ferrno_5fmessage_5fflags_583',['tds_errno_message_flags',['../a00975.html',1,'']]], ['tds_5ferror_5fmessage_584',['tds_error_message',['../a00791.html',1,'']]], ['tds_5ffile_5fstream_585',['tds_file_stream',['../a00719.html',1,'']]], ['tds_5ffile_5fstream_5fread_586',['tds_file_stream_read',['../a00239.html#a1b83c9db016b481aa1fa0352f976d50d',1,'bulk.c']]], ['tds_5ffix_5fcolumn_5fsize_587',['tds_fix_column_size',['../a00563.html#ga440f0f469afad1eac4c008979873ccdd',1,'tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol): query.c'],['../a00563.html#ga440f0f469afad1eac4c008979873ccdd',1,'tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol): query.c']]], ['tds_5ffix_5flogin_588',['tds_fix_login',['../a00559.html#gacee4f06ba749b10ee9f2e5bb1c4a8910',1,'tds_fix_login(TDSLOGIN *login): config.c'],['../a00559.html#gacee4f06ba749b10ee9f2e5bb1c4a8910',1,'tds_fix_login(TDSLOGIN *login): config.c']]], ['tds_5fflush_5fpacket_589',['tds_flush_packet',['../a00564.html#ga5feb53554e8917a81bbbc332163a61fb',1,'tds_flush_packet(TDSSOCKET *tds): write.c'],['../a00564.html#ga5feb53554e8917a81bbbc332163a61fb',1,'tds_flush_packet(TDSSOCKET *tds): write.c']]], ['tds_5ffree_5finput_5fparams_590',['tds_free_input_params',['../a00562.html#gabdc5fee73b22345c02ab894e49ad7f95',1,'tds_free_input_params(TDSDYNAMIC *dyn): mem.c'],['../a00562.html#gabdc5fee73b22345c02ab894e49ad7f95',1,'tds_free_input_params(TDSDYNAMIC *dyn): mem.c']]], ['tds_5ffree_5fnamelist_591',['tds_free_namelist',['../a00565.html#ga21e9de33de9c8c492aa2f96c823596bb',1,'token.c']]], ['tds_5ffree_5fparam_5fresult_592',['tds_free_param_result',['../a00562.html#ga66cd6e3c5089ced9415a8a0e258d205a',1,'tds_free_param_result(TDSPARAMINFO *param_info): mem.c'],['../a00562.html#ga66cd6e3c5089ced9415a8a0e258d205a',1,'tds_free_param_result(TDSPARAMINFO *param_info): mem.c']]], ['tds_5ffreeze_593',['tds_freeze',['../a01243.html',1,'tds_freeze'],['../a00564.html#ga6b2b012b999bd0a4f159fabc8d11a5bf',1,'tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len): packet.c'],['../a00564.html#ga6b2b012b999bd0a4f159fabc8d11a5bf',1,'tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len): packet.c']]], ['tds_5ffreeze_5fabort_594',['tds_freeze_abort',['../a00564.html#ga7274d9c5dc75c58bb7d1f1c29e03a73e',1,'tds_freeze_abort(TDSFREEZE *freeze): packet.c'],['../a00564.html#ga7274d9c5dc75c58bb7d1f1c29e03a73e',1,'tds_freeze_abort(TDSFREEZE *freeze): packet.c']]], ['tds_5ffreeze_5fclose_595',['tds_freeze_close',['../a00564.html#ga633f62fb8e5310abfa42c02fba9c6500',1,'tds_freeze_close(TDSFREEZE *freeze): packet.c'],['../a00564.html#ga633f62fb8e5310abfa42c02fba9c6500',1,'tds_freeze_close(TDSFREEZE *freeze): packet.c']]], ['tds_5ffreeze_5fclose_5flen_596',['tds_freeze_close_len',['../a00564.html#ga2660b893ae2bf36fe1b63b354e748bad',1,'tds_freeze_close_len(TDSFREEZE *freeze, int32_t size): packet.c'],['../a00564.html#ga2660b893ae2bf36fe1b63b354e748bad',1,'tds_freeze_close_len(TDSFREEZE *freeze, int32_t size): packet.c']]], ['tds_5ffreeze_5fwritten_597',['tds_freeze_written',['../a00564.html#ga528cc96da09c11bc2930daae64e33e83',1,'tds_freeze_written(TDSFREEZE *freeze): packet.c'],['../a00564.html#ga528cc96da09c11bc2930daae64e33e83',1,'tds_freeze_written(TDSFREEZE *freeze): packet.c']]], ['tds_5ffuncs_598',['TDS_FUNCS',['../a01035.html',1,'']]], ['tds_5fgeneric_5fget_599',['tds_generic_get',['../a00248.html#abac4d689e0e31e80587f89247c6395a4',1,'data.c']]], ['tds_5fgeneric_5fput_600',['tds_generic_put',['../a00248.html#a84e17808683ba2dd956e811a42e23176',1,'data.c']]], ['tds_5fgeneric_5fput_5finfo_601',['tds_generic_put_info',['../a00248.html#aabd0e5f15615b5c141c525b76e746520',1,'data.c']]], ['tds_5fget_5fbyte_602',['tds_get_byte',['../a00564.html#ga0cb72d3f6943795c39db1fa692be0a58',1,'tds_get_byte(TDSSOCKET *tds): read.c'],['../a00564.html#ga0cb72d3f6943795c39db1fa692be0a58',1,'tds_get_byte(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fchar_5fdata_603',['tds_get_char_data',['../a00564.html#ga8d214089b6e97fc0da5e0be09f216d73',1,'tds_get_char_data(TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol): read.c'],['../a00564.html#ga8d214089b6e97fc0da5e0be09f216d73',1,'tds_get_char_data(TDSSOCKET *tds, char *dest, size_t wire_size, TDSCOLUMN *curcol): read.c']]], ['tds_5fget_5fcolumn_5fdeclaration_604',['tds_get_column_declaration',['../a00563.html#ga50d62edeb2a432e2dc668263f3f958ff',1,'tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out): query.c'],['../a00563.html#ga50d62edeb2a432e2dc668263f3f958ff',1,'tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out): query.c']]], ['tds_5fget_5fcompiletime_5fsettings_605',['tds_get_compiletime_settings',['../a00559.html#ga860690ac47a80f74c83b25cbd8d7703d',1,'tds_get_compiletime_settings(void): config.c'],['../a00559.html#ga860690ac47a80f74c83b25cbd8d7703d',1,'tds_get_compiletime_settings(void): config.c']]], ['tds_5fget_5fconversion_5ftype_606',['tds_get_conversion_type',['../a00449.html#a0383d5dcb629582266a442f0f0dbd13a',1,'tds_types.h']]], ['tds_5fget_5fdata_5finfo_607',['tds_get_data_info',['../a00565.html#gad9b6b86f48be077fb44ac603845a0c27',1,'token.c']]], ['tds_5fget_5fdynid_608',['tds_get_dynid',['../a00562.html#ga501af7e6186e59c257729599a044a30b',1,'mem.c']]], ['tds_5fget_5fhome_5ffile_609',['tds_get_home_file',['../a00559.html#ga606b41d6d4d613d9581c61aa74c8211d',1,'tds_get_home_file(const char *file): config.c'],['../a00559.html#ga606b41d6d4d613d9581c61aa74c8211d',1,'tds_get_home_file(const char *file): config.c']]], ['tds_5fget_5flocale_610',['tds_get_locale',['../a00449.html#af43163dc067b230b2236a619a067c675',1,'locale.c']]], ['tds_5fget_5fn_611',['tds_get_n',['../a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf',1,'tds_get_n(TDSSOCKET *tds, void *dest, size_t need): read.c'],['../a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf',1,'tds_get_n(TDSSOCKET *tds, void *dest, size_t n): read.c']]], ['tds_5fget_5fnull_5ftype_612',['tds_get_null_type',['../a00560.html#ga68e3a76fd7b0a77614765826a8ab5be8',1,'tds_get_null_type(TDS_SERVER_TYPE srctype): convert.c'],['../a00560.html#ga68e3a76fd7b0a77614765826a8ab5be8',1,'tds_get_null_type(TDS_SERVER_TYPE srctype): convert.c']]], ['tds_5fget_5fsize_5fby_5ftype_613',['tds_get_size_by_type',['../a00449.html#a4c070147d189dede5e08a2dc66852678',1,'tds_types.h']]], ['tds_5fget_5fsocket_5ferror_614',['tds_get_socket_error',['../a00564.html#ga4a2418e0a4533d616ef3da526236f2b8',1,'net.c']]], ['tds_5fget_5fstring_615',['tds_get_string',['../a00564.html#ga90f080e6e9448feac15dee1370d66802',1,'tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size): read.c'],['../a00564.html#ga90f080e6e9448feac15dee1370d66802',1,'tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size): read.c']]], ['tds_5fget_5ftoken_5fsize_616',['tds_get_token_size',['../a00565.html#ga995b82e53aeac5bede01ef16e9aeaa65',1,'tds_get_token_size(int marker): token.c'],['../a00565.html#ga995b82e53aeac5bede01ef16e9aeaa65',1,'tds_get_token_size(int marker): token.c']]], ['tds_5fget_5fuint_617',['tds_get_uint',['../a00564.html#ga9ac121c269e203337a48c5bf8afc48c3',1,'tds_get_uint(TDSSOCKET *tds): read.c'],['../a00564.html#ga9ac121c269e203337a48c5bf8afc48c3',1,'tds_get_uint(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fuint8_618',['tds_get_uint8',['../a00564.html#ga8ab6c87318eaf15ea17a9575763f7809',1,'tds_get_uint8(TDSSOCKET *tds): read.c'],['../a00564.html#ga8ab6c87318eaf15ea17a9575763f7809',1,'tds_get_uint8(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fusmallint_619',['tds_get_usmallint',['../a00564.html#gad38aa5b9547817854ccba1fcc7855861',1,'tds_get_usmallint(TDSSOCKET *tds): read.c'],['../a00564.html#gad38aa5b9547817854ccba1fcc7855861',1,'tds_get_usmallint(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fvarint_5fsize_620',['tds_get_varint_size',['../a00449.html#a68855f1251759a6b7338635306ab0041',1,'tds_types.h']]], ['tds_5fgoodread_621',['tds_goodread',['../a00564.html#ga6f2ae00407f59fb1ab280fa44a56295e',1,'tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen): net.c'],['../a00564.html#ga6f2ae00407f59fb1ab280fa44a56295e',1,'tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen): net.c']]], ['tds_5fgoodwrite_622',['tds_goodwrite',['../a00564.html#ga2734407109c834c5dda7ff8a45c71230',1,'tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen): net.c'],['../a00564.html#ga2734407109c834c5dda7ff8a45c71230',1,'tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen): net.c']]], ['tds_5fheaders_623',['tds_headers',['../a01147.html',1,'']]], ['tds_5ficonv_624',['tds_iconv',['../a00561.html#ga87db49044919f1bc84c0ff5e9ab00304',1,'tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft): iconv.c'],['../a00561.html#ga87db49044919f1bc84c0ff5e9ab00304',1,'tds_iconv(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft): iconv.c']]], ['tds_5ficonv_5falloc_625',['tds_iconv_alloc',['../a01427.html#a026957dbbd994b48b571a63405f427cd',1,'tds_iconv_alloc(TDSCONNECTION *conn): iconv.c'],['../a00449.html#a026957dbbd994b48b571a63405f427cd',1,'tds_iconv_alloc(TDSCONNECTION *conn): iconv.c']]], ['tds_5ficonv_5ffrom_5fcollate_626',['tds_iconv_from_collate',['../a00561.html#gaed775f7fcca42b5c2a53f9508c140259',1,'tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5]): iconv.c'],['../a00561.html#gaed775f7fcca42b5c2a53f9508c140259',1,'tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5]): iconv.c']]], ['tds_5ficonv_5fget_5finfo_627',['tds_iconv_get_info',['../a00561.html#gab95825efc9a876b0a7ce77f126cf3fc1',1,'tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server): iconv.c'],['../a00561.html#gab95825efc9a876b0a7ce77f126cf3fc1',1,'tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server): iconv.c']]], ['tds_5ficonv_5finfo_5finit_628',['tds_iconv_info_init',['../a00561.html#ga3a7a7b4d6ed344127e164dd0b443d790',1,'iconv.c']]], ['tds_5ficonv_5finit_629',['tds_iconv_init',['../a01427.html#a89de4d12be43b135ad355236717e9cbb',1,'iconv.c']]], ['tds_5fidle_630',['TDS_IDLE',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33ad1586abc1f75b7f3d640b994afe310e9',1,'tds.h']]], ['tds_5finit_5flogin_631',['tds_init_login',['../a00562.html#ga2ef389ac3b0cddec76bf8f1c0951bc9c',1,'tds_init_login(TDSLOGIN *login, TDSLOCALE *locale): mem.c'],['../a00562.html#ga2ef389ac3b0cddec76bf8f1c0951bc9c',1,'tds_init_login(TDSLOGIN *login, TDSLOCALE *locale): mem.c']]], ['tds_5finput_5fstream_632',['tds_input_stream',['../a01087.html',1,'']]], ['tds_5fis_5fmssql_633',['TDS_IS_MSSQL',['../a00449.html#a07e9371c3e72b9e319f4c14e6fc2c20f',1,'tds.h']]], ['tds_5fis_5fsybase_634',['TDS_IS_SYBASE',['../a00449.html#a4840433488d0c66601ff4002a54b41d7',1,'tds.h']]], ['tds_5flocale_635',['tds_locale',['../a01151.html',1,'']]], ['tds_5flogin_636',['tds_login',['../a01143.html',1,'']]], ['tds_5flookup_5fdynamic_637',['tds_lookup_dynamic',['../a00565.html#ga595fe391e60a71bd98ffd53b4c015e44',1,'tds_lookup_dynamic(TDSCONNECTION *conn, const char *id): token.c'],['../a00565.html#ga595fe391e60a71bd98ffd53b4c015e44',1,'tds_lookup_dynamic(TDSCONNECTION *conn, const char *id): token.c']]], ['tds_5flookup_5fhost_638',['tds_lookup_host',['../a00559.html#gaa17936ef93e1c68833c4aab769bd90d9',1,'tds_lookup_host(const char *servername): config.c'],['../a00559.html#gaa17936ef93e1c68833c4aab769bd90d9',1,'tds_lookup_host(const char *servername): config.c']]], ['tds_5flookup_5fport_639',['tds_lookup_port',['../a00559.html#ga45281d1cb2ac649db65d80bb3ff06b66',1,'config.c']]], ['tds_5fmay_5falias_640',['TDS_MAY_ALIAS',['../a00947.html',1,'']]], ['tds_5fmessage_641',['tds_message',['../a01187.html',1,'']]], ['tds_5fmicrosoft_5fdbdaterec_642',['tds_microsoft_dbdaterec',['../a01343.html',1,'']]], ['tds_5fmicrosoft_5fdbdaterec2_643',['tds_microsoft_dbdaterec2',['../a01351.html',1,'']]], ['tds_5fms_5fver_644',['TDS_MS_VER',['../a00449.html#a1f5fb9d2184949ed566c8ce308a4e91e',1,'tds.h']]], ['tds_5fmultiple_645',['tds_multiple',['../a01211.html',1,'']]], ['tds_5fneeds_5funprepare_646',['tds_needs_unprepare',['../a00563.html#ga05ac7bab753d19b6ba1ffc7505d8fcd0',1,'tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c'],['../a00563.html#ga05ac7bab753d19b6ba1ffc7505d8fcd0',1,'tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c']]], ['tds_5fnext_5fplaceholder_647',['tds_next_placeholder',['../a00563.html#ga6455b2991afbf7da90270787f2059d31',1,'tds_next_placeholder(const char *start): query.c'],['../a00563.html#ga6455b2991afbf7da90270787f2059d31',1,'tds_next_placeholder(const char *start): query.c']]], ['tds_5fnext_5fplaceholder_5fucs2le_648',['tds_next_placeholder_ucs2le',['../a00563.html#gaa823973b74efdf1ff00f340496bff614',1,'query.c']]], ['tds_5fntlm_5fauth_649',['tds_ntlm_auth',['../a00731.html',1,'']]], ['tds_5fntlm_5fget_5fauth_650',['tds_ntlm_get_auth',['../a00558.html#ga679f2d22b4a4bdefe0fa475d63503778',1,'tds_ntlm_get_auth(TDSSOCKET *tds): challenge.c'],['../a00558.html#ga679f2d22b4a4bdefe0fa475d63503778',1,'tds_ntlm_get_auth(TDSSOCKET *tds): challenge.c']]], ['tds_5fnumeric_5fbytes_5fper_5fprec_651',['tds_numeric_bytes_per_prec',['../a00449.html#a4da9eedb6322f7dfca89d5d89be7b374',1,'numeric.c']]], ['tds_5fnumeric_5fto_5fstring_652',['tds_numeric_to_string',['../a00449.html#a622da936832b0337742da956be123719',1,'numeric.c']]], ['tds_5foption_5farg_653',['tds_option_arg',['../a01127.html',1,'']]], ['tds_5foutput_5fstream_654',['tds_output_stream',['../a01091.html',1,'']]], ['tds_5fpacket_655',['tds_packet',['../a01223.html',1,'']]], ['tds_5fparsed_5fparam_656',['TDS_PARSED_PARAM',['../a01039.html',1,'']]], ['tds_5fpbcb_657',['tds_pbcb',['../a00715.html',1,'']]], ['tds_5fpeek_658',['tds_peek',['../a00564.html#ga221e98a9c8be96ec6c8547891e1b53af',1,'tds_peek(TDSSOCKET *tds): read.c'],['../a00564.html#ga221e98a9c8be96ec6c8547891e1b53af',1,'tds_peek(TDSSOCKET *tds): read.c']]], ['tds_5fpending_659',['TDS_PENDING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a00f6d5ac5560f2f44661e599241849a8',1,'tds.h']]], ['tds_5fpoll_5fwakeup_660',['tds_poll_wakeup',['../a01227.html',1,'']]], ['tds_5fpool_661',['tds_pool',['../a00699.html',1,'']]], ['tds_5fpool_5fevent_662',['tds_pool_event',['../a00683.html',1,'']]], ['tds_5fpool_5fmember_663',['tds_pool_member',['../a00695.html',1,'']]], ['tds_5fpool_5fsocket_664',['tds_pool_socket',['../a00687.html',1,'']]], ['tds_5fpool_5fuser_665',['tds_pool_user',['../a00691.html',1,'']]], ['tds_5fpr_5fop_666',['tds_pr_op',['../a00565.html#ga62dc14d21453e88e24880ee0acaca73a',1,'token.c']]], ['tds_5fprdatatype_667',['tds_prdatatype',['../a00080.html#ac7a199aaeb82935f6d1dda2be551a089',1,'dblib.c']]], ['tds_5fprocess_5fauth_668',['tds_process_auth',['../a00565.html#ga4e1e52e09b0c27a9b9f53eb6b539afce',1,'token.c']]], ['tds_5fprocess_5fcancel_669',['tds_process_cancel',['../a00565.html#gaf233e79967f82f4e0dd4d11524917a34',1,'tds_process_cancel(TDSSOCKET *tds): token.c'],['../a00565.html#gaf233e79967f82f4e0dd4d11524917a34',1,'tds_process_cancel(TDSSOCKET *tds): token.c']]], ['tds_5fprocess_5fcol_5ffmt_670',['tds_process_col_fmt',['../a00565.html#ga4e3dd9d3614f5f0433b78b761dd68741',1,'token.c']]], ['tds_5fprocess_5fcol_5fname_671',['tds_process_col_name',['../a00565.html#ga905d2fa5e1b602817bd16bb0fcf9eadb',1,'token.c']]], ['tds_5fprocess_5fcolinfo_672',['tds_process_colinfo',['../a00565.html#ga22c7f413d43fc0d511e122a3de389166',1,'token.c']]], ['tds_5fprocess_5fcompute_673',['tds_process_compute',['../a00565.html#ga6fcb37d5addebdc1af9f34ebc59fd7a8',1,'token.c']]], ['tds_5fprocess_5fcompute_5fnames_674',['tds_process_compute_names',['../a00565.html#gae5b3e01f3d665f9e377de091f46f1ab9',1,'token.c']]], ['tds_5fprocess_5fcompute_5fresult_675',['tds_process_compute_result',['../a00565.html#gae3368ea80d0d8b13791ceb13ee5f19c9',1,'token.c']]], ['tds_5fprocess_5fcursor_5ftokens_676',['tds_process_cursor_tokens',['../a00565.html#ga315d875d90c64d12d61fc9e33b4dee96',1,'token.c']]], ['tds_5fprocess_5fdefault_5ftokens_677',['tds_process_default_tokens',['../a00565.html#ga39453d084f3f780ac4602d4abf2839f7',1,'token.c']]], ['tds_5fprocess_5fdyn_5fresult_678',['tds_process_dyn_result',['../a00565.html#ga416cf119c1d4a0fca27dc5b50c261358',1,'token.c']]], ['tds_5fprocess_5fdynamic_679',['tds_process_dynamic',['../a00565.html#ga5cfc0340d8d717e67f60037e029b2142',1,'token.c']]], ['tds_5fprocess_5fend_680',['tds_process_end',['../a00565.html#ga7a081cf9bb8f04ead12f0299fb7c4cd9',1,'token.c']]], ['tds_5fprocess_5fenv_5fchg_681',['tds_process_env_chg',['../a00565.html#ga3e1b4df4410a86a563a8c155e7799720',1,'token.c']]], ['tds_5fprocess_5finfo_682',['tds_process_info',['../a00565.html#ga65a2316369529731732f200c190d05d6',1,'token.c']]], ['tds_5fprocess_5flogin_5ftokens_683',['tds_process_login_tokens',['../a00565.html#ga93945b42d45ee28ae1296b35a1c1e9bb',1,'tds_process_login_tokens(TDSSOCKET *tds): token.c'],['../a00565.html#ga93945b42d45ee28ae1296b35a1c1e9bb',1,'tds_process_login_tokens(TDSSOCKET *tds): token.c']]], ['tds_5fprocess_5fnbcrow_684',['tds_process_nbcrow',['../a00565.html#gaf7264c9eb3aa7a73358a4c65f02d3d3c',1,'token.c']]], ['tds_5fprocess_5fparam_5fresult_685',['tds_process_param_result',['../a00565.html#gacb3354443bcefe7a500a500a4904cc05',1,'token.c']]], ['tds_5fprocess_5fparam_5fresult_5ftokens_686',['tds_process_param_result_tokens',['../a00565.html#ga9fdef8228d29cab7fa9098f07fa73fba',1,'token.c']]], ['tds_5fprocess_5fparams_5fresult_5ftoken_687',['tds_process_params_result_token',['../a00565.html#ga7b18c0911a9dc69939577b39eb64725d',1,'token.c']]], ['tds_5fprocess_5fpending_5fcloses_688',['tds_process_pending_closes',['../a00565.html#ga69902dffb299d62a799888e0fa3ccd68',1,'token.c']]], ['tds_5fprocess_5frow_689',['tds_process_row',['../a00565.html#gaad814dd6e35aee8332035d06dc8b5d65',1,'token.c']]], ['tds_5fprocess_5fsimple_5fquery_690',['tds_process_simple_query',['../a00565.html#gaeeb1562044786ea17bea361ed83e6946',1,'tds_process_simple_query(TDSSOCKET *tds): token.c'],['../a00565.html#gaeeb1562044786ea17bea361ed83e6946',1,'tds_process_simple_query(TDSSOCKET *tds): token.c']]], ['tds_5fprocess_5ftabname_691',['tds_process_tabname',['../a00565.html#gaeec59bca9bd0c5388e245f0d19d9c81a',1,'token.c']]], ['tds_5fprocess_5ftokens_692',['tds_process_tokens',['../a00565.html#gabfc9de1d1fe718818caf63a4be4035a6',1,'tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag): token.c'],['../a00565.html#gabfc9de1d1fe718818caf63a4be4035a6',1,'tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag): token.c']]], ['tds_5fprtype_693',['tds_prtype',['../a00565.html#ga0cf7e719115b0ae476753442d10505ab',1,'tds_prtype(int type): token.c'],['../a00565.html#ga0cf7e719115b0ae476753442d10505ab',1,'tds_prtype(int token): token.c']]], ['tds_5fput_5fdata_694',['tds_put_data',['../a00563.html#ga9fcc0a3932dcad530511395ef8a767fb',1,'query.c']]], ['tds_5fput_5fdata_5finfo_695',['tds_put_data_info',['../a00563.html#gafd74652c4722ddce4d642cc4209449d4',1,'query.c']]], ['tds_5fput_5fn_5fas_5fucs2_696',['TDS_PUT_N_AS_UCS2',['../a00563.html#ga62c3dc9946acb3ffd1b7ae43424f5b47',1,'query.c']]], ['tds_5fput_5fparam_5fas_5fstring_697',['tds_put_param_as_string',['../a00563.html#ga0e2e7230c425e925402d7856ff5b4b18',1,'query.c']]], ['tds_5fput_5fstring_698',['tds_put_string',['../a00564.html#ga1fcaf8d488cc1390f106ce3ad0bf37b4',1,'tds_put_string(TDSSOCKET *tds, const char *s, int len): write.c'],['../a00564.html#ga1fcaf8d488cc1390f106ce3ad0bf37b4',1,'tds_put_string(TDSSOCKET *tds, const char *buf, int len): write.c']]], ['tds_5fput_5ftinyint_699',['tds_put_tinyint',['../a00449.html#adfc186758f4c1856c01746b5436aff74',1,'tds.h']]], ['tds_5fquery_5fflush_5fpacket_700',['tds_query_flush_packet',['../a00563.html#gada27f4cfce925240ad33b71b63ca692d',1,'query.c']]], ['tds_5fquote_701',['tds_quote',['../a00563.html#ga7efaa23c3b21158ffc963f85fbc3fdf4',1,'query.c']]], ['tds_5fquote_5fand_5fput_702',['tds_quote_and_put',['../a00563.html#ga26b26296d060dca75f6a43e9ac41e58d',1,'query.c']]], ['tds_5fquote_5fid_703',['tds_quote_id',['../a00563.html#ga8d8f2f1c91635ee95f30722208ae3043',1,'tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c'],['../a00563.html#ga8d8f2f1c91635ee95f30722208ae3043',1,'tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c']]], ['tds_5fquote_5fid_5frpc_704',['tds_quote_id_rpc',['../a00563.html#ga691e8752f4f84ed51b7f4d1447cb3d25',1,'tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c'],['../a00563.html#ga691e8752f4f84ed51b7f4d1447cb3d25',1,'tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c']]], ['tds_5fquote_5fstring_705',['tds_quote_string',['../a00563.html#ga737b9fb9971fb425af5c722415ef0eac',1,'tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len): query.c'],['../a00563.html#ga737b9fb9971fb425af5c722415ef0eac',1,'tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len): query.c']]], ['tds_5fquoteout_5fstream_706',['tds_quoteout_stream',['../a00771.html',1,'']]], ['tds_5fraw_5fmutex_707',['tds_raw_mutex',['../a01251.html',1,'']]], ['tds_5fread_5fconf_5ffile_708',['tds_read_conf_file',['../a00559.html#ga4799b423b5d982dbc8f31b7738255eef',1,'tds_read_conf_file(TDSLOGIN *login, const char *server): config.c'],['../a00559.html#ga4799b423b5d982dbc8f31b7738255eef',1,'tds_read_conf_file(TDSLOGIN *login, const char *server): config.c']]], ['tds_5fread_5fconf_5fsection_709',['tds_read_conf_section',['../a00559.html#ga44fdbe16827097d947f900d96003de98',1,'tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param): config.c'],['../a00559.html#ga44fdbe16827097d947f900d96003de98',1,'tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param): config.c']]], ['tds_5fread_5fconfig_5finfo_710',['tds_read_config_info',['../a00559.html#ga9af192306186ddf39e09be0fd4ad8aaf',1,'tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale): config.c'],['../a00559.html#ga9af192306186ddf39e09be0fd4ad8aaf',1,'tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale): config.c']]], ['tds_5fread_5finterfaces_711',['tds_read_interfaces',['../a00559.html#ga6631af35ee817f93827c62bbda41674a',1,'config.c']]], ['tds_5fread_5fnamelist_712',['tds_read_namelist',['../a00565.html#gaeaaed2ea1d8c827da1a0f5b419524ae1',1,'token.c']]], ['tds_5fread_5fpacket_713',['tds_read_packet',['../a00564.html#ga410619783bdf2bb60b0f27a5578e0e07',1,'tds_read_packet(TDSSOCKET *tds): packet.c'],['../a00564.html#ga410619783bdf2bb60b0f27a5578e0e07',1,'tds_read_packet(TDSSOCKET *tds): packet.c']]], ['tds_5freading_714',['TDS_READING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a36ddbc8f326d6b297009a8fafd958529',1,'tds.h']]], ['tds_5frealloc_715',['tds_realloc',['../a00562.html#ga924cb9fb5d19dbd308ba0ce8c1a8a1d5',1,'tds_realloc(void **pp, size_t new_size): mem.c'],['../a00562.html#ga924cb9fb5d19dbd308ba0ce8c1a8a1d5',1,'tds_realloc(void **pp, size_t new_size): mem.c']]], ['tds_5frelease_5fdynamic_716',['tds_release_dynamic',['../a00562.html#gabf2fdb0def5388508602ee7dd2f49506',1,'tds_release_dynamic(TDSDYNAMIC **pdyn): mem.c'],['../a00562.html#gabf2fdb0def5388508602ee7dd2f49506',1,'tds_release_dynamic(TDSDYNAMIC **dyn): mem.c']]], ['tds_5fresult_5finfo_717',['tds_result_info',['../a01183.html',1,'']]], ['tds_5fsave_5fcontext_718',['tds_save_context',['../a00763.html',1,'']]], ['tds_5fsave_5fenv_719',['tds_save_env',['../a00759.html',1,'']]], ['tds_5fsave_5fmsg_720',['tds_save_msg',['../a00755.html',1,'']]], ['tds_5fselect_721',['tds_select',['../a00564.html#gad7aae89e32444ab30852fee056231403',1,'tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds): net.c'],['../a00564.html#gad7aae89e32444ab30852fee056231403',1,'tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds): net.c']]], ['tds_5fsend_5fcancel_722',['tds_send_cancel',['../a00563.html#ga11338742dc30fd0c2711f58eb830316f',1,'tds_send_cancel(TDSSOCKET *tds): query.c'],['../a00563.html#ga11338742dc30fd0c2711f58eb830316f',1,'tds_send_cancel(TDSSOCKET *tds): query.c']]], ['tds_5fsend_5femulated_5fexecute_723',['tds_send_emulated_execute',['../a00563.html#ga02c6ce3ff96369603a6ee4efee64caae',1,'query.c']]], ['tds_5fsending_724',['TDS_SENDING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a2bad5be30bd85edc9495dae3d199d2c1',1,'tds.h']]], ['tds_5fset_5fcolumn_5ftype_725',['tds_set_column_type',['../a00248.html#a31604382d8b77257aad203f409155a29',1,'tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c'],['../a00449.html#a31604382d8b77257aad203f409155a29',1,'tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c']]], ['tds_5fset_5fcur_5fcursor_726',['tds_set_cur_cursor',['../a00563.html#ga34fb1084682cc31fe02a4a7946955a5a',1,'query.c']]], ['tds_5fset_5fcur_5fdyn_727',['tds_set_cur_dyn',['../a00563.html#gae8b7db85af16701fc0604eb117cbd4e4',1,'tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c'],['../a00563.html#gae8b7db85af16701fc0604eb117cbd4e4',1,'tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c']]], ['tds_5fset_5ficonv_5fname_728',['tds_set_iconv_name',['../a01427.html#a010ab1d181c8996f6a5984c9900eca6b',1,'iconv.c']]], ['tds_5fset_5finterfaces_5ffile_5floc_729',['tds_set_interfaces_file_loc',['../a00559.html#ga57cea6e376d7c2d28b811a5b0053210c',1,'tds_set_interfaces_file_loc(const char *interf): config.c'],['../a00559.html#ga57cea6e376d7c2d28b811a5b0053210c',1,'tds_set_interfaces_file_loc(const char *interfloc): config.c']]], ['tds_5fset_5fparam_5ftype_730',['tds_set_param_type',['../a00248.html#a86768d86059c5addf9a3f89edb1ef44e',1,'tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c'],['../a00449.html#a86768d86059c5addf9a3f89edb1ef44e',1,'tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c']]], ['tds_5fset_5fserver_731',['tds_set_server',['../a00449.html#a3ab8874994a0776acdaff797afdb710a',1,'login.c']]], ['tds_5fset_5fstate_732',['tds_set_state',['../a00449.html#a16db200d2281f76fe46fc1cbe37ca9df',1,'util.c']]], ['tds_5fsetup_5fsocket_733',['tds_setup_socket',['../a00564.html#gab604dd1d75afa8f852d1a6ee0b681974',1,'net.c']]], ['tds_5fskip_5fcomment_734',['tds_skip_comment',['../a00563.html#gaac7347ba9380d77d726648b85e9fab8f',1,'tds_skip_comment(const char *s): query.c'],['../a00563.html#gaac7347ba9380d77d726648b85e9fab8f',1,'tds_skip_comment(const char *s): query.c']]], ['tds_5fskip_5fcomment_5fucs2le_735',['tds_skip_comment_ucs2le',['../a00563.html#gab304fda9f325e852ba5c5252079d22e3',1,'query.c']]], ['tds_5fskip_5fquoted_736',['tds_skip_quoted',['../a00563.html#ga5dbe51ce9533218f2da23f69ff63dda4',1,'tds_skip_quoted(const char *s): query.c'],['../a00563.html#ga5dbe51ce9533218f2da23f69ff63dda4',1,'tds_skip_quoted(const char *s): query.c']]], ['tds_5fskip_5fquoted_5fucs2le_737',['tds_skip_quoted_ucs2le',['../a00563.html#ga2361ec4629aa0eac38f1702b03ed8185',1,'query.c']]], ['tds_5fsocket_738',['tds_socket',['../a01235.html',1,'']]], ['tds_5fsocket_5fread_739',['tds_socket_read',['../a00564.html#ga8560e2536fdcf8f1514d4fa14f90876c',1,'net.c']]], ['tds_5fsocket_5fset_5fnonblocking_740',['tds_socket_set_nonblocking',['../a00564.html#ga2a7429ff031f77023d1bf31339a266db',1,'tds_socket_set_nonblocking(TDS_SYS_SOCKET sock): net.c'],['../a00564.html#ga2a7429ff031f77023d1bf31339a266db',1,'tds_socket_set_nonblocking(TDS_SYS_SOCKET sock): net.c']]], ['tds_5fsocket_5fset_5fnosigpipe_741',['tds_socket_set_nosigpipe',['../a00564.html#gae36a2665a4183b4cb211d03e907112ee',1,'tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on): net.c'],['../a00564.html#gae36a2665a4183b4cb211d03e907112ee',1,'tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on): net.c']]], ['tds_5fsocket_5fwrite_742',['tds_socket_write',['../a00564.html#gad6f81b48fbcfc18ce0b213dbbea47e30',1,'net.c']]], ['tds_5fstart_5fquery_743',['tds_start_query',['../a00563.html#ga0da385231bfa3dc49377e1fb2bea2c07',1,'tds_start_query(TDSSOCKET *tds, unsigned char packet_type): query.c'],['../a00563.html#ga0da385231bfa3dc49377e1fb2bea2c07',1,'tds_start_query(TDSSOCKET *tds, unsigned char packet_type): query.c']]], ['tds_5fstart_5fquery_5fhead_744',['tds_start_query_head',['../a00563.html#ga9ad2e6defce530a8778791cce0166ccd',1,'query.c']]], ['tds_5fstate_745',['TDS_STATE',['../a00449.html#ac0d502ab90609c39fe7713fe0dfbefad',1,'tds.h']]], ['tds_5fstates_746',['tds_states',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33',1,'tds.h']]], ['tds_5fstaticin_5fstream_747',['tds_staticin_stream',['../a01103.html',1,'']]], ['tds_5fstaticin_5fstream_5finit_748',['tds_staticin_stream_init',['../a01415.html#aa9e1e45f0305622dd6aed9f8fe158581',1,'stream.c']]], ['tds_5fstaticin_5fstream_5fread_749',['tds_staticin_stream_read',['../a01415.html#a76b02f1fa5b79dc7e1ef2651a9afe3f7',1,'stream.c']]], ['tds_5fstaticout_5fstream_750',['tds_staticout_stream',['../a01107.html',1,'']]], ['tds_5fstaticout_5fstream_5finit_751',['tds_staticout_stream_init',['../a01415.html#a9fe0d3799d2e3bde49b614c9d0c3785d',1,'stream.c']]], ['tds_5fstaticout_5fstream_5fwrite_752',['tds_staticout_stream_write',['../a01415.html#a1d92ebe06f18378ac17ccfd20db05126',1,'stream.c']]], ['tds_5fstr_5fempty_753',['tds_str_empty',['../a00566.html#ga676fd3c5c489584d09c89d66c7a0af2d',1,'tds_str_empty(): tdsstring.c'],['../a00566.html#ga676fd3c5c489584d09c89d66c7a0af2d',1,'tds_str_empty(): tdsstring.c']]], ['tds_5fstrftime_754',['tds_strftime',['../a00560.html#ga8c9652e8b1f3e56a3289fd71b12cee1d',1,'tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec): convert.c'],['../a00560.html#ga8c9652e8b1f3e56a3289fd71b12cee1d',1,'tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *timeptr, int prec): convert.c']]], ['tds_5fstrndup_755',['tds_strndup',['../a00449.html#a1275e23db464803292b4c759c46621a6',1,'util.c']]], ['tds_5fsubmit_5fbegin_5ftran_756',['tds_submit_begin_tran',['../a00563.html#ga7bf3670d3d6dabed469b9eb117298079',1,'tds_submit_begin_tran(TDSSOCKET *tds): query.c'],['../a00563.html#ga7bf3670d3d6dabed469b9eb117298079',1,'tds_submit_begin_tran(TDSSOCKET *tds): query.c']]], ['tds_5fsubmit_5fcommit_757',['tds_submit_commit',['../a00563.html#ga530538c4c975524cf0b771a550fc94a3',1,'tds_submit_commit(TDSSOCKET *tds, int cont): query.c'],['../a00563.html#ga530538c4c975524cf0b771a550fc94a3',1,'tds_submit_commit(TDSSOCKET *tds, int cont): query.c']]], ['tds_5fsubmit_5fexecdirect_758',['tds_submit_execdirect',['../a00563.html#gae603aed795a4c5bb26ab159a11256996',1,'tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c'],['../a00563.html#gae603aed795a4c5bb26ab159a11256996',1,'tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c']]], ['tds_5fsubmit_5fexecute_759',['tds_submit_execute',['../a00563.html#ga3e7b4793c6f799fbc6c174f673bb5b32',1,'tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c'],['../a00563.html#ga3e7b4793c6f799fbc6c174f673bb5b32',1,'tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c']]], ['tds_5fsubmit_5foptioncmd_760',['tds_submit_optioncmd',['../a00563.html#gaf0da49585d39e99780a004ee2ca23479',1,'tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size): query.c'],['../a00563.html#gaf0da49585d39e99780a004ee2ca23479',1,'tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size): query.c']]], ['tds_5fsubmit_5fprepare_761',['tds_submit_prepare',['../a00563.html#ga74eb08c3a1c85be8ac9db428842c8b9d',1,'tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c'],['../a00563.html#ga74eb08c3a1c85be8ac9db428842c8b9d',1,'tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c']]], ['tds_5fsubmit_5fquery_762',['tds_submit_query',['../a00563.html#ga5a29ae7f99d089dc3cea85ec6ee5f3ab',1,'tds_submit_query(TDSSOCKET *tds, const char *query): query.c'],['../a00563.html#ga5a29ae7f99d089dc3cea85ec6ee5f3ab',1,'tds_submit_query(TDSSOCKET *tds, const char *query): query.c']]], ['tds_5fsubmit_5fquery_5fparams_763',['tds_submit_query_params',['../a00563.html#ga95e0fccedc459a4404f496eec74a369a',1,'tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c'],['../a00563.html#ga95e0fccedc459a4404f496eec74a369a',1,'tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c']]], ['tds_5fsubmit_5fqueryf_764',['tds_submit_queryf',['../a00563.html#gad695defcbf663b0023851a198206a772',1,'tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...): query.c'],['../a00563.html#gad695defcbf663b0023851a198206a772',1,'tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...): query.c']]], ['tds_5fsubmit_5frollback_765',['tds_submit_rollback',['../a00563.html#ga9c1cdcc388506a2ca3c0aaee8c461ba6',1,'tds_submit_rollback(TDSSOCKET *tds, int cont): query.c'],['../a00563.html#ga9c1cdcc388506a2ca3c0aaee8c461ba6',1,'tds_submit_rollback(TDSSOCKET *tds, int cont): query.c']]], ['tds_5fsubmit_5frpc_766',['tds_submit_rpc',['../a00563.html#ga5f071b94ad7889690762dc85646c74ab',1,'tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head): query.c'],['../a00563.html#ga5f071b94ad7889690762dc85646c74ab',1,'tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head): query.c']]], ['tds_5fsubmit_5funprepare_767',['tds_submit_unprepare',['../a00563.html#gaf573d8d4d2660c8c27770573fca05ff5',1,'tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c'],['../a00563.html#gaf573d8d4d2660c8c27770573fca05ff5',1,'tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c']]], ['tds_5fswap_5fnumeric_768',['tds_swap_numeric',['../a00248.html#aa818c1cbf4d16e609b7e4895cc7ed74f',1,'data.c']]], ['tds_5fsyb_5fver_769',['TDS_SYB_VER',['../a00449.html#aca53a637849948c4b7a07f69e40c685c',1,'tds.h']]], ['tds_5fsybase_5fdbdaterec_770',['tds_sybase_dbdaterec',['../a01347.html',1,'']]], ['tds_5fsybase_5fdbdaterec2_771',['tds_sybase_dbdaterec2',['../a01355.html',1,'']]], ['tds_5fsys_5ficonv_5fopen_772',['tds_sys_iconv_open',['../a00561.html#ga900b0bce08c6bfc2e7c988f4b5970516',1,'tds_sys_iconv_open(const char *tocode, const char *fromcode): iconv.c'],['../a00561.html#ga900b0bce08c6bfc2e7c988f4b5970516',1,'tds_sys_iconv_open(const char *tocode, const char *fromcode): iconv.c']]], ['tds_5fthread_773',['tds_thread',['../a01259.html',1,'']]], ['tds_5ftime_774',['tds_time',['../a00743.html',1,'']]], ['tds_5ftoken_5fname_775',['tds_token_name',['../a00565.html#ga7f24a7af985cd320788122e98072b7af',1,'token.c']]], ['tds_5funget_5fbyte_776',['tds_unget_byte',['../a00564.html#gad70d59fb317d098b0c9fd29dd77131a8',1,'tds_unget_byte(TDSSOCKET *tds): read.c'],['../a00564.html#gad70d59fb317d098b0c9fd29dd77131a8',1,'tds_unget_byte(TDSSOCKET *tds): read.c']]], ['tds_5fupd_5fcol_777',['tds_upd_col',['../a01191.html',1,'']]], ['tds_5fvariant_778',['tds_variant',['../a01159.html',1,'']]], ['tds_5fvarmax_5fstream_779',['tds_varmax_stream',['../a00747.html',1,'']]], ['tds_5fversion_780',['tds_version',['../a01143.html#a8f9f756b25fd18916a6080f9c22f835d',1,'tds_login']]], ['tds_5fwillconvert_781',['tds_willconvert',['../a00560.html#ga80487b313213f60d8be71a50a002bb2c',1,'tds_willconvert(int srctype, int desttype): convert.c'],['../a00560.html#ga80487b313213f60d8be71a50a002bb2c',1,'tds_willconvert(int srctype, int desttype): convert.c']]], ['tds_5fwrite_5fdump_782',['tds_write_dump',['../a00449.html#a4766b1a553077cb3257d36b9ac28f5b5',1,'log.c']]], ['tds_5fwritetext_5fcontinue_783',['tds_writetext_continue',['../a00239.html#ab68dead99a2ebec55895a10cd3db5202',1,'tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size): bulk.c'],['../a00449.html#ab68dead99a2ebec55895a10cd3db5202',1,'tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size): bulk.c']]], ['tds_5fwritetext_5fend_784',['tds_writetext_end',['../a00239.html#ac1e460551f1188620ea478238864ac4b',1,'tds_writetext_end(TDSSOCKET *tds): bulk.c'],['../a00449.html#ac1e460551f1188620ea478238864ac4b',1,'tds_writetext_end(TDSSOCKET *tds): bulk.c']]], ['tds_5fwritetext_5fstart_785',['tds_writetext_start',['../a00239.html#a7711612cc544a7da2c7aa212b870acb2',1,'tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size): bulk.c'],['../a00449.html#a7711612cc544a7da2c7aa212b870acb2',1,'tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size): bulk.c']]], ['tds_5fwriting_786',['TDS_WRITING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a4a4fcc1840bee1e09521f08a0184d025',1,'tds.h']]], ['tdsblob_787',['TDSBLOB',['../a00449.html#a47b154752431b2379988dbfdff394577',1,'tds.h']]], ['tdscursor_788',['TDSCURSOR',['../a00449.html#afe061eb245f3006d93940a20415692a7',1,'tds.h']]], ['tdsdaterec_789',['tdsdaterec',['../a01123.html',1,'tdsdaterec'],['../a00449.html#a3b40b4faf314267146c2005e56eebe7b',1,'TDSDATEREC(): tds.h']]], ['tdsdatetime_790',['tdsdatetime',['../a01059.html',1,'']]], ['tdsdatetime4_791',['tdsdatetime4',['../a01063.html',1,'']]], ['tdsdbopen_792',['tdsdbopen',['../a00554.html#ga2c99ec565452279e9a382451d89642eb',1,'tdsdbopen(LOGINREC *login, const char *server, int msdblib): dblib.c'],['../a00554.html#ga2c99ec565452279e9a382451d89642eb',1,'tdsdbopen(LOGINREC *login, const char *server, int msdblib): dblib.c']]], ['tdsdump_5fclose_793',['tdsdump_close',['../a00449.html#a2f00fc0907d3bb04ce0eeb9738e08d0c',1,'log.c']]], ['tdsdump_5fcol_794',['tdsdump_col',['../a00449.html#aaee3fe5c514ce5570c9548de9b16e0d9',1,'log.c']]], ['tdsdump_5fdump_5fbuf_795',['tdsdump_dump_buf',['../a00449.html#a79449d2f35a8acc8ed0585044f75524d',1,'log.c']]], ['tdsdump_5flog_796',['tdsdump_log',['../a00449.html#ab45c291105027e69836002e1dd586141',1,'log.c']]], ['tdsdump_5foff_797',['tdsdump_off',['../a00449.html#ae3e5e04822595c54f86db66d9e40b93a',1,'log.c']]], ['tdsdump_5foff_5fitem_798',['tdsdump_off_item',['../a01239.html',1,'']]], ['tdsdump_5fon_799',['tdsdump_on',['../a00449.html#ae5f50062ebebe46b951e5308cb2f5d7e',1,'log.c']]], ['tdsdump_5fopen_800',['tdsdump_open',['../a00449.html#a24471508ddfde7cc0f8577801e70c42f',1,'log.c']]], ['tdsdynamic_801',['TDSDYNAMIC',['../a00449.html#a856d78b7438fef3d6e6c0a8e4566d978',1,'tds.h']]], ['tdsenv_802',['TDSENV',['../a00449.html#a42c559939ed16a39c0318a6f543c576e',1,'tds.h']]], ['tdserror_803',['tdserror',['../a00449.html#abf18b98efef6ce2dc0b97d658a3a1918',1,'util.c']]], ['tdsfilestream_804',['TDSFILESTREAM',['../a00239.html#ac2b7f7b7bb486f90e1053bfb829ca2ba',1,'bulk.c']]], ['tdsiconvdir_805',['tdsiconvdir',['../a00979.html',1,'']]], ['tdsiconvinfo_806',['tdsiconvinfo',['../a00983.html',1,'']]], ['tdsmoney_807',['tdsmoney',['../a01051.html',1,'']]], ['tdsmoney4_808',['tdsmoney4',['../a01055.html',1,'']]], ['tdsnumeric_809',['tdsnumeric',['../a01043.html',1,'']]], ['tdsoldmoney_810',['tdsoldmoney',['../a01047.html',1,'']]], ['tdspbcb_811',['TDSPBCB',['../a00239.html#af31a5af3c7480dc3a16576dfc84f3b06',1,'bulk.c']]], ['tdsresultinfo_812',['TDSRESULTINFO',['../a00449.html#a1efbb2f3844cb2ea89af03721ac67277',1,'tds.h']]], ['tdsunique_813',['tdsunique',['../a01067.html',1,'']]], ['tdsvariant_814',['TDSVARIANT',['../a00449.html#a25488abe3449d4cdaaa97587d34f9174',1,'tds.h']]], ['tdsvername_5ft_815',['tdsvername_t',['../a00739.html',1,'']]], ['term_5flen_816',['term_len',['../a00719.html#aae893302d33ee1e9d83c3d85d7390dca',1,'tds_file_stream']]], ['terminator_817',['terminator',['../a00719.html#a463c28a7d862c0a6d7bf3170dd614dc0',1,'tds_file_stream']]], ['time_818',['time',['../a01119.html#afd6a58ec251f2c08a040917ba5a8cd3f',1,'TDS_DATETIMEALL::time()'],['../a01323.html#a6bb5dcd5b47813b71934546e0c60e035',1,'DBDATETIMEALL::time()']]], ['timezone_819',['timezone',['../a01123.html#a624e21e65d0ae89797b3a7eadc48829f',1,'tdsdaterec']]], ['tm_5fhour_820',['tm_hour',['../a00743.html#a6ece03e77f69035da83d5739e16ef905',1,'tds_time']]], ['tm_5fmday_821',['tm_mday',['../a00743.html#a8dfc26d484c247040f521f20288651f1',1,'tds_time']]], ['tm_5fmin_822',['tm_min',['../a00743.html#ab50f30e05dc6b493d347918ab7ded1e9',1,'tds_time']]], ['tm_5fmon_823',['tm_mon',['../a00743.html#adce28126e9bbd4ef005e3bf181d59745',1,'tds_time']]], ['tm_5fns_824',['tm_ns',['../a00743.html#a386f1cfcabbe3ed86afe72bed75778cf',1,'tds_time']]], ['tm_5fsec_825',['tm_sec',['../a00743.html#adeb5e3f535662c0341d28f8d669cb59b',1,'tds_time']]], ['tm_5fyear_826',['tm_year',['../a00743.html#a3e27d50ebb5196356a6a8a9b495c8758',1,'tds_time']]], ['tmp_5fcol_5fstruct_827',['tmp_col_struct',['../a00703.html',1,'']]], ['todo_20list_828',['Todo List',['../a00545.html',1,'']]], ['token_2ec_829',['token.c',['../a00308.html',1,'']]], ['type_830',['type',['../a01199.html#a889aafdde1d57c9be0585326022831f0',1,'tds_cursor']]] ]; freetds-1.3.6/doc/reference/search/all_13.html000644 025423 025423 00000002617 14162303412 022516 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_13.js000644 025423 025423 00000000620 14162303412 022156 0ustar00fredianofrediano000000 000000 var searchData= [ ['unimplemented_831',['Unimplemented',['../a00555.html',1,'']]], ['uad_832',['uad',['../a01023.html#a93c0c73d7161aa0c8fd59016e66def9e',1,'_hdbc']]], ['unix_5fto_5fnt_5ftime_833',['unix_to_nt_time',['../a00558.html#gad2bec0e5029108ce54436ba806c10c9a',1,'challenge.c']]], ['user_5fname_834',['user_name',['../a01143.html#a2b2de13270472df39952848eb3970d9a',1,'tds_login']]] ]; freetds-1.3.6/doc/reference/search/all_14.html000644 025423 025423 00000002617 14162303412 022517 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_14.js000644 025423 025423 00000000656 14162303412 022170 0ustar00fredianofrediano000000 000000 var searchData= [ ['waiters_835',['waiters',['../a00699.html#a009d30222683a3540fcddbc3e9033828',1,'tds_pool']]], ['weekday_836',['weekday',['../a01123.html#a40de0c7d78e9c1edae4c07435c10192b',1,'tdsdaterec']]], ['wire_5fsize_837',['wire_size',['../a01095.html#a8101abd3e9e8d6f90b2ba2717bf7f926',1,'tds_datain_stream']]], ['write_838',['write',['../a01091.html#a8513fb41c8ba79f22e54266b87278415',1,'tds_output_stream']]] ]; freetds-1.3.6/doc/reference/search/all_15.html000644 025423 025423 00000002617 14162303412 022520 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/all_15.js000644 025423 025423 00000000161 14162303412 022160 0ustar00fredianofrediano000000 000000 var searchData= [ ['year_839',['year',['../a01123.html#a5a6a5b0180c3db53acbda61dd570d70f',1,'tdsdaterec']]] ]; freetds-1.3.6/doc/reference/search/classes_0.html000644 025423 025423 00000002622 14162303412 023313 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_0.js000644 025423 025423 00000005104 14162303412 022761 0ustar00fredianofrediano000000 000000 var searchData= [ ['_5fcharacter_5fset_5falias_840',['_character_set_alias',['../a00971.html',1,'']]], ['_5fcs_5fblkdesc_841',['_cs_blkdesc',['../a00903.html',1,'']]], ['_5fcs_5fclientmsg_842',['_cs_clientmsg',['../a00851.html',1,'']]], ['_5fcs_5fcommand_843',['_cs_command',['../a00899.html',1,'']]], ['_5fcs_5fconfig_844',['_cs_config',['../a00859.html',1,'']]], ['_5fcs_5fconnection_845',['_cs_connection',['../a00883.html',1,'']]], ['_5fcs_5fcontext_846',['_cs_context',['../a00875.html',1,'']]], ['_5fcs_5fdatafmt_847',['_cs_datafmt',['../a00827.html',1,'']]], ['_5fcs_5fdaterec_848',['_cs_daterec',['../a00847.html',1,'']]], ['_5fcs_5fdatetime_849',['_cs_datetime',['../a00839.html',1,'']]], ['_5fcs_5fdatetime4_850',['_cs_datetime4',['../a00843.html',1,'']]], ['_5fcs_5fdynamic_851',['_cs_dynamic',['../a00895.html',1,'']]], ['_5fcs_5fiodesc_852',['_cs_iodesc',['../a00823.html',1,'']]], ['_5fcs_5flocale_853',['_cs_locale',['../a00907.html',1,'']]], ['_5fcs_5fmoney_854',['_cs_money',['../a00831.html',1,'']]], ['_5fcs_5fmoney4_855',['_cs_money4',['../a00835.html',1,'']]], ['_5fcs_5fnumeric_856',['_cs_numeric',['../a00811.html',1,'']]], ['_5fcs_5fobjdata_857',['_cs_objdata',['../a00807.html',1,'']]], ['_5fcs_5fobjname_858',['_cs_objname',['../a00803.html',1,'']]], ['_5fcs_5fparam_859',['_cs_param',['../a00887.html',1,'']]], ['_5fcs_5fservermsg_860',['_cs_servermsg',['../a00855.html',1,'']]], ['_5fcs_5fvarbinary_861',['_cs_varbinary',['../a00815.html',1,'']]], ['_5fcs_5fvarchar_862',['_cs_varchar',['../a00819.html',1,'']]], ['_5fcsremote_5fproc_863',['_csremote_proc',['../a00891.html',1,'']]], ['_5fct_5fcolinfo_864',['_ct_colinfo',['../a00879.html',1,'']]], ['_5fdblib_5ferror_5fmessage_865',['_dblib_error_message',['../a00619.html',1,'']]], ['_5fdheader_866',['_dheader',['../a00995.html',1,'']]], ['_5fdrecord_867',['_drecord',['../a00999.html',1,'']]], ['_5fhcattr_868',['_hcattr',['../a01019.html',1,'']]], ['_5fhchk_869',['_hchk',['../a01011.html',1,'']]], ['_5fhdbc_870',['_hdbc',['../a01023.html',1,'']]], ['_5fhdesc_871',['_hdesc',['../a01003.html',1,'']]], ['_5fheattr_872',['_heattr',['../a01007.html',1,'']]], ['_5fhenv_873',['_henv',['../a01015.html',1,'']]], ['_5fhsattr_874',['_hsattr',['../a01027.html',1,'']]], ['_5fhstmt_875',['_hstmt',['../a01031.html',1,'']]], ['_5foptions_876',['_options',['../a00587.html',1,'']]], ['_5fprocedure_877',['_procedure',['../a00607.html',1,'']]], ['_5fsql_5ferror_878',['_sql_error',['../a00987.html',1,'']]], ['_5fsql_5ferrors_879',['_sql_errors',['../a00991.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_1.html000644 025423 025423 00000002622 14162303412 023314 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_1.js000644 025423 025423 00000000230 14162303412 022755 0ustar00fredianofrediano000000 000000 var searchData= [ ['agg_5ft_880',['agg_t',['../a00631.html',1,'']]], ['asn1_5fder_5fiterator_881',['asn1_der_iterator',['../a00779.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_2.html000644 025423 025423 00000002622 14162303412 023315 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_2.js000644 025423 025423 00000000250 14162303412 022760 0ustar00fredianofrediano000000 000000 var searchData= [ ['bcp_5fhostcolinfo_882',['BCP_HOSTCOLINFO',['../a00919.html',1,'']]], ['bcp_5fhostfileinfo_883',['BCP_HOSTFILEINFO',['../a00923.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_3.html000644 025423 025423 00000002622 14162303412 023316 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_3.js000644 025423 025423 00000001264 14162303412 022767 0ustar00fredianofrediano000000 000000 var searchData= [ ['cb_5ft_884',['cb_t',['../a00967.html',1,'conv_result']]], ['cc_5ft_885',['cc_t',['../a00963.html',1,'conv_result']]], ['charset_5falias_886',['charset_alias',['../a00951.html',1,'']]], ['col_5ft_887',['col_t',['../a00623.html',1,'']]], ['conf_5fparams_888',['conf_params',['../a00671.html',1,'']]], ['connect_5fevent_889',['CONNECT_EVENT',['../a00679.html',1,'']]], ['conv_5fresult_890',['conv_result',['../a00959.html',1,'']]], ['cs_5fdiag_5fmsg_891',['cs_diag_msg',['../a00871.html',1,'']]], ['cs_5fdiag_5fmsg_5fclient_892',['cs_diag_msg_client',['../a00863.html',1,'']]], ['cs_5fdiag_5fmsg_5fsvr_893',['cs_diag_msg_svr',['../a00867.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_4.html000644 025423 025423 00000002622 14162303412 023317 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_4.js000644 025423 025423 00000002647 14162303412 022776 0ustar00fredianofrediano000000 000000 var searchData= [ ['data_894',['DATA',['../a00575.html',1,'']]], ['dbcol_895',['DBCOL',['../a01335.html',1,'']]], ['dbcol2_896',['DBCOL2',['../a01339.html',1,'']]], ['dbdatetime_897',['DBDATETIME',['../a01315.html',1,'']]], ['dbdatetime4_898',['DBDATETIME4',['../a01319.html',1,'']]], ['dbdatetimeall_899',['DBDATETIMEALL',['../a01323.html',1,'']]], ['dblib_5fbuffer_5frow_900',['dblib_buffer_row',['../a00611.html',1,'']]], ['dblib_5fcontext_901',['dblib_context',['../a00615.html',1,'']]], ['dbmoney_902',['DBMONEY',['../a01307.html',1,'']]], ['dbmoney4_903',['DBMONEY4',['../a01311.html',1,'']]], ['dbnumeric_904',['DBNUMERIC',['../a01303.html',1,'']]], ['dboption_905',['dboption',['../a00935.html',1,'']]], ['dbproc_5frowbuf_906',['DBPROC_ROWBUF',['../a00915.html',1,'']]], ['dbremote_5fproc_907',['DBREMOTE_PROC',['../a00931.html',1,'']]], ['dbremote_5fproc_5fparam_908',['DBREMOTE_PROC_PARAM',['../a00927.html',1,'']]], ['dbstring_909',['dbstring',['../a01331.html',1,'']]], ['dbtypeinfo_910',['dbtypeinfo',['../a01327.html',1,'']]], ['dbvarybin_911',['DBVARYBIN',['../a01299.html',1,'']]], ['dbvarychar_912',['DBVARYCHAR',['../a01295.html',1,'']]], ['des_5fkey_913',['des_key',['../a01263.html',1,'']]], ['dlist_5flist_5ftype_914',['DLIST_LIST_TYPE',['../a01271.html',1,'']]], ['dlist_5fring_915',['dlist_ring',['../a01267.html',1,'']]], ['dsninfo_916',['DSNINFO',['../a00667.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_5.html000644 025423 025423 00000002622 14162303412 023320 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_5.js000644 025423 025423 00000000137 14162303412 022767 0ustar00fredianofrediano000000 000000 var searchData= [ ['end_5flogin_5fevent_917',['END_LOGIN_EVENT',['../a00711.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_6.html000644 025423 025423 00000002622 14162303412 023321 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_6.js000644 025423 025423 00000000121 14162303412 022761 0ustar00fredianofrediano000000 000000 var searchData= [ ['func_5finfo_918',['func_info',['../a00659.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_7.html000644 025423 025423 00000002622 14162303412 023322 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_7.js000644 025423 025423 00000000111 14162303412 022761 0ustar00fredianofrediano000000 000000 var searchData= [ ['key_5ft_919',['KEY_T',['../a00583.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_8.html000644 025423 025423 00000002622 14162303412 023323 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_8.js000644 025423 025423 00000000216 14162303412 022770 0ustar00fredianofrediano000000 000000 var searchData= [ ['login_5fevent_920',['LOGIN_EVENT',['../a00707.html',1,'']]], ['loginrec_921',['LOGINREC',['../a00595.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_9.html000644 025423 025423 00000002622 14162303412 023324 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_9.js000644 025423 025423 00000000564 14162303412 022777 0ustar00fredianofrediano000000 000000 var searchData= [ ['md4context_922',['MD4Context',['../a01275.html',1,'']]], ['md5context_923',['MD5Context',['../a01279.html',1,'']]], ['metacomp_924',['METACOMP',['../a00579.html',1,'']]], ['metadata_925',['METADATA',['../a00571.html',1,'']]], ['metadata_5ft_926',['metadata_t',['../a00635.html',1,'']]], ['mpz_5ft_927',['mpz_t',['../a00775.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_a.html000644 025423 025423 00000002622 14162303412 023374 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_a.js000644 025423 025423 00000000521 14162303412 023040 0ustar00fredianofrediano000000 000000 var searchData= [ ['name_5ft_928',['name_t',['../a00643.html',1,'']]], ['namelist_929',['namelist',['../a00787.html',1,'']]], ['names_5fblob_5fprefix_5ft_930',['names_blob_prefix_t',['../a00727.html',1,'']]], ['native_5finfo_931',['native_info',['../a00663.html',1,'']]], ['nullrep_932',['NULLREP',['../a00939.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_b.html000644 025423 025423 00000002622 14162303412 023375 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_b.js000644 025423 025423 00000000121 14162303412 023035 0ustar00fredianofrediano000000 000000 var searchData= [ ['objectinfo_933',['OBJECTINFO',['../a00599.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_c.html000644 025423 025423 00000002622 14162303412 023376 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_c.js000644 025423 025423 00000000563 14162303412 023050 0ustar00fredianofrediano000000 000000 var searchData= [ ['pd_934',['pd',['../a00603.html',1,'']]], ['pivot_5ft_935',['pivot_t',['../a00639.html',1,'pivot_t'],['../a00591.html',1,'_options::pivot_t']]], ['pollfd_936',['pollfd',['../a01079.html',1,'']]], ['profileparam_937',['ProfileParam',['../a00647.html',1,'']]], ['ptw32_5fmcs_5fnode_5ft_5f_938',['ptw32_mcs_node_t_',['../a00799.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_d.html000644 025423 025423 00000002622 14162303412 023377 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_d.js000644 025423 025423 00000000234 14162303412 023044 0ustar00fredianofrediano000000 000000 var searchData= [ ['retry_5faddr_939',['retry_addr',['../a00767.html',1,'']]], ['rsa_5fpublic_5fkey_940',['rsa_public_key',['../a00783.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_e.html000644 025423 025423 00000002622 14162303412 023400 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_e.js000644 025423 025423 00000000551 14162303412 023047 0ustar00fredianofrediano000000 000000 var searchData= [ ['s_5fsqlmsgmap_941',['s_SqlMsgMap',['../a00651.html',1,'']]], ['s_5fv3to2map_942',['s_v3to2map',['../a00655.html',1,'']]], ['select_5finfo_943',['select_info',['../a00675.html',1,'']]], ['string_5flinked_5flist_944',['string_linked_list',['../a00795.html',1,'']]], ['stringpool_5ft_945',['stringpool_t',['../a00955.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/classes_f.html000644 025423 025423 00000002622 14162303412 023401 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/classes_f.js000644 025423 025423 00000014110 14162303412 023044 0ustar00fredianofrediano000000 000000 var searchData= [ ['tagss_5ftime2_5fstruct_946',['tagSS_TIME2_STRUCT',['../a01287.html',1,'']]], ['tagss_5ftimestampoffset_5fstruct_947',['tagSS_TIMESTAMPOFFSET_STRUCT',['../a01291.html',1,'']]], ['tds71_5fcollation_948',['TDS71_COLLATION',['../a01071.html',1,'']]], ['tds72_5fsmp_5fheader_949',['TDS72_SMP_HEADER',['../a01075.html',1,'']]], ['tds_5faddrinfo_950',['tds_addrinfo',['../a01083.html',1,'']]], ['tds_5falign_5fstruct_951',['tds_align_struct',['../a01131.html',1,'']]], ['tds_5fanswer_952',['tds_answer',['../a00723.html',1,'']]], ['tds_5fauthentication_953',['tds_authentication',['../a01219.html',1,'']]], ['tds_5fbcpcoldata_954',['tds_bcpcoldata',['../a01167.html',1,'']]], ['tds_5fbcpinfo_955',['tds_bcpinfo',['../a01247.html',1,'']]], ['tds_5fblob_956',['tds_blob',['../a01155.html',1,'']]], ['tds_5fcapabilities_957',['tds_capabilities',['../a01139.html',1,'']]], ['tds_5fcapability_5ftype_958',['tds_capability_type',['../a01135.html',1,'']]], ['tds_5fcolumn_959',['tds_column',['../a01175.html',1,'']]], ['tds_5fcolumn_5ffuncs_960',['tds_column_funcs',['../a01171.html',1,'']]], ['tds_5fcompiletime_5fsettings_961',['tds_compiletime_settings',['../a01115.html',1,'']]], ['tds_5fcondition_962',['tds_condition',['../a01255.html',1,'']]], ['tds_5fconnection_963',['tds_connection',['../a01231.html',1,'']]], ['tds_5fcontext_964',['tds_context',['../a01215.html',1,'']]], ['tds_5fcursor_965',['tds_cursor',['../a01199.html',1,'']]], ['tds_5fcursor_5fstatus_966',['tds_cursor_status',['../a01195.html',1,'']]], ['tds_5fdatain_5fstream_967',['tds_datain_stream',['../a01095.html',1,'']]], ['tds_5fdataout_5fstream_968',['tds_dataout_stream',['../a01099.html',1,'']]], ['tds_5fdatetimeall_969',['TDS_DATETIMEALL',['../a01119.html',1,'']]], ['tds_5fdblib_5fdbprocess_970',['tds_dblib_dbprocess',['../a00943.html',1,'']]], ['tds_5fdblib_5floginrec_971',['tds_dblib_loginrec',['../a00911.html',1,'']]], ['tds_5fdstr_972',['tds_dstr',['../a01283.html',1,'']]], ['tds_5fdynamic_973',['tds_dynamic',['../a01207.html',1,'']]], ['tds_5fdynamic_5fstream_974',['tds_dynamic_stream',['../a01111.html',1,'']]], ['tds_5fencoding_975',['tds_encoding',['../a01163.html',1,'']]], ['tds_5fenv_976',['tds_env',['../a01203.html',1,'']]], ['tds_5ferrno_5fmessage_5fflags_977',['tds_errno_message_flags',['../a00975.html',1,'']]], ['tds_5ferror_5fmessage_978',['tds_error_message',['../a00791.html',1,'']]], ['tds_5ffile_5fstream_979',['tds_file_stream',['../a00719.html',1,'']]], ['tds_5ffreeze_980',['tds_freeze',['../a01243.html',1,'']]], ['tds_5ffuncs_981',['TDS_FUNCS',['../a01035.html',1,'']]], ['tds_5fheaders_982',['tds_headers',['../a01147.html',1,'']]], ['tds_5finput_5fstream_983',['tds_input_stream',['../a01087.html',1,'']]], ['tds_5flocale_984',['tds_locale',['../a01151.html',1,'']]], ['tds_5flogin_985',['tds_login',['../a01143.html',1,'']]], ['tds_5fmay_5falias_986',['TDS_MAY_ALIAS',['../a00947.html',1,'']]], ['tds_5fmessage_987',['tds_message',['../a01187.html',1,'']]], ['tds_5fmicrosoft_5fdbdaterec_988',['tds_microsoft_dbdaterec',['../a01343.html',1,'']]], ['tds_5fmicrosoft_5fdbdaterec2_989',['tds_microsoft_dbdaterec2',['../a01351.html',1,'']]], ['tds_5fmultiple_990',['tds_multiple',['../a01211.html',1,'']]], ['tds_5fntlm_5fauth_991',['tds_ntlm_auth',['../a00731.html',1,'']]], ['tds_5foption_5farg_992',['tds_option_arg',['../a01127.html',1,'']]], ['tds_5foutput_5fstream_993',['tds_output_stream',['../a01091.html',1,'']]], ['tds_5fpacket_994',['tds_packet',['../a01223.html',1,'']]], ['tds_5fparsed_5fparam_995',['TDS_PARSED_PARAM',['../a01039.html',1,'']]], ['tds_5fpbcb_996',['tds_pbcb',['../a00715.html',1,'']]], ['tds_5fpoll_5fwakeup_997',['tds_poll_wakeup',['../a01227.html',1,'']]], ['tds_5fpool_998',['tds_pool',['../a00699.html',1,'']]], ['tds_5fpool_5fevent_999',['tds_pool_event',['../a00683.html',1,'']]], ['tds_5fpool_5fmember_1000',['tds_pool_member',['../a00695.html',1,'']]], ['tds_5fpool_5fsocket_1001',['tds_pool_socket',['../a00687.html',1,'']]], ['tds_5fpool_5fuser_1002',['tds_pool_user',['../a00691.html',1,'']]], ['tds_5fquoteout_5fstream_1003',['tds_quoteout_stream',['../a00771.html',1,'']]], ['tds_5fraw_5fmutex_1004',['tds_raw_mutex',['../a01251.html',1,'']]], ['tds_5fresult_5finfo_1005',['tds_result_info',['../a01183.html',1,'']]], ['tds_5fsave_5fcontext_1006',['tds_save_context',['../a00763.html',1,'']]], ['tds_5fsave_5fenv_1007',['tds_save_env',['../a00759.html',1,'']]], ['tds_5fsave_5fmsg_1008',['tds_save_msg',['../a00755.html',1,'']]], ['tds_5fsocket_1009',['tds_socket',['../a01235.html',1,'']]], ['tds_5fstaticin_5fstream_1010',['tds_staticin_stream',['../a01103.html',1,'']]], ['tds_5fstaticout_5fstream_1011',['tds_staticout_stream',['../a01107.html',1,'']]], ['tds_5fsybase_5fdbdaterec_1012',['tds_sybase_dbdaterec',['../a01347.html',1,'']]], ['tds_5fsybase_5fdbdaterec2_1013',['tds_sybase_dbdaterec2',['../a01355.html',1,'']]], ['tds_5fthread_1014',['tds_thread',['../a01259.html',1,'']]], ['tds_5ftime_1015',['tds_time',['../a00743.html',1,'']]], ['tds_5fupd_5fcol_1016',['tds_upd_col',['../a01191.html',1,'']]], ['tds_5fvariant_1017',['tds_variant',['../a01159.html',1,'']]], ['tds_5fvarmax_5fstream_1018',['tds_varmax_stream',['../a00747.html',1,'']]], ['tdsdaterec_1019',['tdsdaterec',['../a01123.html',1,'']]], ['tdsdatetime_1020',['tdsdatetime',['../a01059.html',1,'']]], ['tdsdatetime4_1021',['tdsdatetime4',['../a01063.html',1,'']]], ['tdsdump_5foff_5fitem_1022',['tdsdump_off_item',['../a01239.html',1,'']]], ['tdsiconvdir_1023',['tdsiconvdir',['../a00979.html',1,'']]], ['tdsiconvinfo_1024',['tdsiconvinfo',['../a00983.html',1,'']]], ['tdsmoney_1025',['tdsmoney',['../a01051.html',1,'']]], ['tdsmoney4_1026',['tdsmoney4',['../a01055.html',1,'']]], ['tdsnumeric_1027',['tdsnumeric',['../a01043.html',1,'']]], ['tdsoldmoney_1028',['tdsoldmoney',['../a01047.html',1,'']]], ['tdsunique_1029',['tdsunique',['../a01067.html',1,'']]], ['tdsvername_5ft_1030',['tdsvername_t',['../a00739.html',1,'']]], ['tmp_5fcol_5fstruct_1031',['tmp_col_struct',['../a00703.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/files_0.html000644 025423 025423 00000002620 14162303412 022756 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/files_0.js000644 025423 025423 00000000202 14162303412 022420 0ustar00fredianofrediano000000 000000 var searchData= [ ['bcp_2ec_1032',['bcp.c',['../a01400.html',1,'']]], ['bulk_2ec_1033',['bulk.c',['../a00239.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/files_1.html000644 025423 025423 00000002620 14162303412 022757 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/files_1.js000644 025423 025423 00000000206 14162303412 022425 0ustar00fredianofrediano000000 000000 var searchData= [ ['data_2ec_1034',['data.c',['../a00248.html',1,'']]], ['dblib_2ec_1035',['dblib.c',['../a00080.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/files_2.html000644 025423 025423 00000002620 14162303412 022760 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/files_2.js000644 025423 025423 00000000212 14162303412 022423 0ustar00fredianofrediano000000 000000 var searchData= [ ['iconv_2ec_1036',['iconv.c',['../a01424.html',1,'(Global Namespace)'],['../a01427.html',1,'(Global Namespace)']]] ]; freetds-1.3.6/doc/reference/search/files_3.html000644 025423 025423 00000002620 14162303412 022761 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/files_3.js000644 025423 025423 00000000114 14162303412 022425 0ustar00fredianofrediano000000 000000 var searchData= [ ['poll_2eh_1037',['poll.h',['../a00431.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/files_4.html000644 025423 025423 00000002620 14162303412 022762 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/files_4.js000644 025423 025423 00000000114 14162303412 022426 0ustar00fredianofrediano000000 000000 var searchData= [ ['read_2ec_1038',['read.c',['../a00281.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/files_5.html000644 025423 025423 00000002620 14162303412 022763 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/files_5.js000644 025423 025423 00000000212 14162303412 022426 0ustar00fredianofrediano000000 000000 var searchData= [ ['stream_2ec_1039',['stream.c',['../a01415.html',1,'']]], ['sybdb_2eh_1040',['sybdb.h',['../a00506.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/files_6.html000644 025423 025423 00000002620 14162303412 022764 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/files_6.js000644 025423 025423 00000000204 14162303412 022430 0ustar00fredianofrediano000000 000000 var searchData= [ ['tds_2eh_1041',['tds.h',['../a00449.html',1,'']]], ['token_2ec_1042',['token.c',['../a00308.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/functions_0.html000644 025423 025423 00000002624 14162303412 023670 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_0.js000644 025423 025423 00000003735 14162303412 023344 0ustar00fredianofrediano000000 000000 var searchData= [ ['_5fbcp_5fconvert_5fin_1043',['_bcp_convert_in',['../a01400.html#a4e7740b6f755d7d3f2502a47b7d71a85',1,'bcp.c']]], ['_5fbcp_5fconvert_5fout_1044',['_bcp_convert_out',['../a01400.html#a230fa5b56ae4e3509a69bd266495732b',1,'bcp.c']]], ['_5fbcp_5fexec_5fin_1045',['_bcp_exec_in',['../a00551.html#ga7370f1223f13510d6b33e98f2de09fb5',1,'bcp.c']]], ['_5fbcp_5fexec_5fout_1046',['_bcp_exec_out',['../a00551.html#gae67546338cb9542a4902aa914f57f314',1,'bcp.c']]], ['_5fbcp_5ffgets_1047',['_bcp_fgets',['../a00551.html#gaf4e2c59203f2af21bb2803ef4a69bfa8',1,'bcp.c']]], ['_5fbcp_5ffree_5fcolumns_1048',['_bcp_free_columns',['../a00551.html#gacf69ac4cbe8e3c3e6ea665e31e5e85b8',1,'bcp.c']]], ['_5fbcp_5ffree_5fstorage_1049',['_bcp_free_storage',['../a00551.html#gaa134c1c3ccc4326e693adb8357272f1d',1,'bcp.c']]], ['_5fbcp_5fget_5fcol_5fdata_1050',['_bcp_get_col_data',['../a00551.html#ga0f8def4cad04c5c1e27c2b653d482dd8',1,'bcp.c']]], ['_5fbcp_5fget_5fterm_5fvar_1051',['_bcp_get_term_var',['../a00551.html#ga4f936fa1cb8e4373bf7b7f8a6ab96bc7',1,'bcp.c']]], ['_5fbcp_5fno_5fget_5fcol_5fdata_1052',['_bcp_no_get_col_data',['../a01400.html#ad53f508d8f2177a898f8022736834afd',1,'bcp.c']]], ['_5fbcp_5fread_5fhostfile_1053',['_bcp_read_hostfile',['../a00551.html#ga1b57d952a9d72f375c3296124affa908',1,'bcp.c']]], ['_5fbcp_5freadfmt_5fcolinfo_1054',['_bcp_readfmt_colinfo',['../a00551.html#gafc23d62bc86b38fb757e3ac4aadca0a4',1,'bcp.c']]], ['_5fdbcoldata_1055',['_dbcoldata',['../a00554.html#ga3c6f474c0662158f3100fe464bf077d9',1,'dblib.c']]], ['_5fdblib_5fcheck_5fand_5fhandle_5finterrupt_1056',['_dblib_check_and_handle_interrupt',['../a00554.html#gadf15185b0d417edc0bb8a6a4f0bae727',1,'_dblib_check_and_handle_interrupt(void *vdbproc): dbutil.c'],['../a00554.html#gadf15185b0d417edc0bb8a6a4f0bae727',1,'_dblib_check_and_handle_interrupt(void *vdbproc): dbutil.c']]], ['_5fdbresults_1057',['_dbresults',['../a00548.html#gaf1879b85e8238c015b9648d077665285',1,'dblib.c']]] ]; freetds-1.3.6/doc/reference/search/functions_1.html000644 025423 025423 00000002624 14162303412 023671 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_1.js000644 025423 025423 00000000246 14162303412 023337 0ustar00fredianofrediano000000 000000 var searchData= [ ['adjust_5fcharacter_5fcolumn_5fsize_1058',['adjust_character_column_size',['../a00565.html#ga91770634ce8c0d6f1fe007b45da186fd',1,'token.c']]] ]; freetds-1.3.6/doc/reference/search/functions_2.html000644 025423 025423 00000002624 14162303412 023672 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_2.js000644 025423 025423 00000011622 14162303412 023340 0ustar00fredianofrediano000000 000000 var searchData= [ ['bcp_5fbatch_1059',['bcp_batch',['../a00550.html#gaa23f8e5c7f437a94746c90292dd1cb01',1,'bcp_batch(DBPROCESS *dbproc): bcp.c'],['../a00550.html#gaa23f8e5c7f437a94746c90292dd1cb01',1,'bcp_batch(DBPROCESS *dbproc): bcp.c']]], ['bcp_5fbind_1060',['bcp_bind',['../a00550.html#ga6cf03708baaf02eb016b9ee77160d879',1,'bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int db_vartype, int table_column): bcp.c'],['../a00550.html#ga6cf03708baaf02eb016b9ee77160d879',1,'bcp_bind(DBPROCESS *dbproc, BYTE *varaddr, int prefixlen, DBINT varlen, BYTE *terminator, int termlen, int type, int table_column): bcp.c']]], ['bcp_5fcolfmt_1061',['bcp_colfmt',['../a00550.html#ga0ed03c69e698336d015bb315ad755fd5',1,'bcp_colfmt(DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int table_colnum): bcp.c'],['../a00550.html#ga0ed03c69e698336d015bb315ad755fd5',1,'bcp_colfmt(DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, const BYTE *host_term, int host_termlen, int colnum): bcp.c']]], ['bcp_5fcolfmt_5fps_1062',['bcp_colfmt_ps',['../a00550.html#gaf13b2bb12b4200752718f3a3face3870',1,'bcp_colfmt_ps(DBPROCESS *dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int table_colnum, DBTYPEINFO *typeinfo): bcp.c'],['../a00550.html#gaf13b2bb12b4200752718f3a3face3870',1,'bcp_colfmt_ps(DBPROCESS *dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, BYTE *host_term, int host_termlen, int colnum, DBTYPEINFO *typeinfo): bcp.c']]], ['bcp_5fcollen_1063',['bcp_collen',['../a00550.html#gae41d196a22c544d66212dacc5b555791',1,'bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column): bcp.c'],['../a00550.html#gae41d196a22c544d66212dacc5b555791',1,'bcp_collen(DBPROCESS *dbproc, DBINT varlen, int table_column): bcp.c']]], ['bcp_5fcolptr_1064',['bcp_colptr',['../a00550.html#ga6498235e4ef8e41ea43b01494b28998d',1,'bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column): bcp.c'],['../a00550.html#ga6498235e4ef8e41ea43b01494b28998d',1,'bcp_colptr(DBPROCESS *dbproc, BYTE *colptr, int table_column): bcp.c']]], ['bcp_5fcolumns_1065',['bcp_columns',['../a00550.html#ga330b9f1028f856a9eec5115550bcb4f7',1,'bcp_columns(DBPROCESS *dbproc, int host_colcount): bcp.c'],['../a00550.html#ga330b9f1028f856a9eec5115550bcb4f7',1,'bcp_columns(DBPROCESS *dbproc, int host_colcount): bcp.c']]], ['bcp_5fcontrol_1066',['bcp_control',['../a00550.html#ga244547855b41788fa3a67756956fbc81',1,'bcp_control(DBPROCESS *dbproc, int field, DBINT value): bcp.c'],['../a00550.html#ga244547855b41788fa3a67756956fbc81',1,'bcp_control(DBPROCESS *dbproc, int field, DBINT value): bcp.c']]], ['bcp_5fdone_1067',['bcp_done',['../a00550.html#ga8b85f79f53a62ac7a728fe626d609b65',1,'bcp_done(DBPROCESS *dbproc): bcp.c'],['../a00550.html#ga8b85f79f53a62ac7a728fe626d609b65',1,'bcp_done(DBPROCESS *dbproc): bcp.c']]], ['bcp_5fexec_1068',['bcp_exec',['../a00550.html#ga7a184158b27a50f713e9cfae3b746209',1,'bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied): bcp.c'],['../a00550.html#ga7a184158b27a50f713e9cfae3b746209',1,'bcp_exec(DBPROCESS *dbproc, DBINT *rows_copied): bcp.c']]], ['bcp_5fgetl_1069',['bcp_getl',['../a00550.html#ga220f6b043602da1028f98dacb2fd00c0',1,'bcp_getl(LOGINREC *login): bcp.c'],['../a00550.html#ga220f6b043602da1028f98dacb2fd00c0',1,'bcp_getl(LOGINREC *login): bcp.c']]], ['bcp_5finit_1070',['bcp_init',['../a00550.html#gada8e987c4a6225b9276c05ba3a4f47a0',1,'bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction): bcp.c'],['../a00550.html#gada8e987c4a6225b9276c05ba3a4f47a0',1,'bcp_init(DBPROCESS *dbproc, const char *tblname, const char *hfile, const char *errfile, int direction): bcp.c']]], ['bcp_5foptions_1071',['bcp_options',['../a00550.html#gafec3feb5bac1cb33545ba01efb0a67b8',1,'bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen): bcp.c'],['../a00550.html#gafec3feb5bac1cb33545ba01efb0a67b8',1,'bcp_options(DBPROCESS *dbproc, int option, BYTE *value, int valuelen): bcp.c']]], ['bcp_5freadfmt_1072',['bcp_readfmt',['../a00550.html#ga963c5e38bca7668afc57f5cc123d10fb',1,'bcp_readfmt(DBPROCESS *dbproc, const char filename[]): bcp.c'],['../a00550.html#ga963c5e38bca7668afc57f5cc123d10fb',1,'bcp_readfmt(DBPROCESS *dbproc, const char filename[]): bcp.c']]], ['bcp_5fsendrow_1073',['bcp_sendrow',['../a00550.html#gaf1130ac97f6af55e86ec70b0aa4f5b40',1,'bcp_sendrow(DBPROCESS *dbproc): bcp.c'],['../a00550.html#gaf1130ac97f6af55e86ec70b0aa4f5b40',1,'bcp_sendrow(DBPROCESS *dbproc): bcp.c']]], ['binary_5fto_5fresult_1074',['binary_to_result',['../a00560.html#gab09f8279ad6da8a0a6a935e5810d753a',1,'convert.c']]] ]; freetds-1.3.6/doc/reference/search/functions_3.html000644 025423 025423 00000002624 14162303412 023673 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_3.js000644 025423 025423 00000112436 14162303412 023346 0ustar00fredianofrediano000000 000000 var searchData= [ ['dbacolname_1075',['dbacolname',['../a00548.html#ga466690ceda8682382223d98a6ffb63bd',1,'dbacolname(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga466690ceda8682382223d98a6ffb63bd',1,'dbacolname(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbadata_1076',['dbadata',['../a00548.html#gabcc14a1ca58b65bc46cce6c81c45218c',1,'dbadata(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gabcc14a1ca58b65bc46cce6c81c45218c',1,'dbadata(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbadlen_1077',['dbadlen',['../a00548.html#ga3340e21db274b272ec11c037cb147222',1,'dbadlen(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga3340e21db274b272ec11c037cb147222',1,'dbadlen(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltbind_1078',['dbaltbind',['../a00548.html#gafefd17e15b22adda84366c817178dd7d',1,'dbaltbind(DBPROCESS *dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c'],['../a00548.html#gafefd17e15b22adda84366c817178dd7d',1,'dbaltbind(DBPROCESS *dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c']]], ['dbaltcolid_1079',['dbaltcolid',['../a00548.html#gad10c9fd75a86c7a0ac375937df0e90a6',1,'dbaltcolid(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gad10c9fd75a86c7a0ac375937df0e90a6',1,'dbaltcolid(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltlen_1080',['dbaltlen',['../a00548.html#ga9a35c8d3cd0e35c10555baf8f6a01e93',1,'dbaltlen(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga9a35c8d3cd0e35c10555baf8f6a01e93',1,'dbaltlen(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltop_1081',['dbaltop',['../a00548.html#ga947837a5c8fd99898c043435945b668c',1,'dbaltop(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#ga947837a5c8fd99898c043435945b668c',1,'dbaltop(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbalttype_1082',['dbalttype',['../a00548.html#gaa85171e020dc606f2bd3395ad1d3ab4f',1,'dbalttype(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gaa85171e020dc606f2bd3395ad1d3ab4f',1,'dbalttype(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbaltutype_1083',['dbaltutype',['../a00548.html#gaf1c00d83dfa88dc99a3fb449c49660ea',1,'dbaltutype(DBPROCESS *dbproc, int computeid, int column): dblib.c'],['../a00548.html#gaf1c00d83dfa88dc99a3fb449c49660ea',1,'dbaltutype(DBPROCESS *dbproc, int computeid, int column): dblib.c']]], ['dbanullbind_1084',['dbanullbind',['../a00548.html#ga939c2a2e67b9992c787e2cec5b6cc1a7',1,'dbanullbind(DBPROCESS *dbproc, int computeid, int column, DBINT *indicator): dblib.c'],['../a00548.html#ga939c2a2e67b9992c787e2cec5b6cc1a7',1,'dbanullbind(DBPROCESS *dbprocess, int computeid, int column, DBINT *indicator): dblib.c']]], ['dbanydatecrack_1085',['dbanydatecrack',['../a00548.html#gad57aa777300cf7f62077478ec6000d00',1,'dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data): dblib.c'],['../a00548.html#gad57aa777300cf7f62077478ec6000d00',1,'dbanydatecrack(DBPROCESS *dbproc, DBDATEREC2 *di, int type, const void *data): dblib.c']]], ['dbbind_1086',['dbbind',['../a00548.html#ga873bc0f4663165e711655ade1dfae795',1,'dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c'],['../a00548.html#ga873bc0f4663165e711655ade1dfae795',1,'dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr): dblib.c']]], ['dbbylist_1087',['dbbylist',['../a00548.html#gae658a0cd5270f3bd6f22de17b2cb2e64',1,'dbbylist(DBPROCESS *dbproc, int computeid, int *size): dblib.c'],['../a00548.html#gae658a0cd5270f3bd6f22de17b2cb2e64',1,'dbbylist(DBPROCESS *dbproc, int computeid, int *size): dblib.c']]], ['dbcancel_1088',['dbcancel',['../a00548.html#ga5ea23272124fff03b8d87538c1ec3ee5',1,'dbcancel(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga5ea23272124fff03b8d87538c1ec3ee5',1,'dbcancel(DBPROCESS *dbproc): dblib.c']]], ['dbcanquery_1089',['dbcanquery',['../a00548.html#ga559e24ba70d0d96c3469eb6ab8f74e05',1,'dbcanquery(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga559e24ba70d0d96c3469eb6ab8f74e05',1,'dbcanquery(DBPROCESS *dbproc): dblib.c']]], ['dbchange_1090',['dbchange',['../a00548.html#ga8cbc761b1266bd947783d843aeeec264',1,'dbchange(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga8cbc761b1266bd947783d843aeeec264',1,'dbchange(DBPROCESS *dbprocess): dblib.c']]], ['dbclose_1091',['dbclose',['../a00548.html#gaef740b394b44eb33925c2718f7b30d69',1,'dbclose(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaef740b394b44eb33925c2718f7b30d69',1,'dbclose(DBPROCESS *dbproc): dblib.c']]], ['dbclrbuf_1092',['dbclrbuf',['../a00548.html#ga01404b179a251c249aecfdae72ec6ca4',1,'dbclrbuf(DBPROCESS *dbproc, DBINT n): dblib.c'],['../a00548.html#ga01404b179a251c249aecfdae72ec6ca4',1,'dbclrbuf(DBPROCESS *dbproc, DBINT n): dblib.c']]], ['dbclropt_1093',['dbclropt',['../a00548.html#ga93ee3c8ca34a08588f88784898fd69e0',1,'dbclropt(DBPROCESS *dbproc, int option, const char param[]): dblib.c'],['../a00548.html#ga93ee3c8ca34a08588f88784898fd69e0',1,'dbclropt(DBPROCESS *dbproc, int option, const char param[]): dblib.c']]], ['dbcmd_1094',['dbcmd',['../a00548.html#ga87b39d9863316b4ba85654b0885d53a0',1,'dbcmd(DBPROCESS *dbproc, const char cmdstring[]): dblib.c'],['../a00548.html#ga87b39d9863316b4ba85654b0885d53a0',1,'dbcmd(DBPROCESS *dbproc, const char cmdstring[]): dblib.c']]], ['dbcmdrow_1095',['dbcmdrow',['../a00554.html#ga196f6d67de47f34a32fcc2103ab0f416',1,'dbcmdrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga196f6d67de47f34a32fcc2103ab0f416',1,'dbcmdrow(DBPROCESS *dbproc): dblib.c']]], ['dbcolinfo_1096',['dbcolinfo',['../a00080.html#a9b73fd1afa2c3ccfca481635212d2e43',1,'dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol): dblib.c'],['../a00506.html#a9b73fd1afa2c3ccfca481635212d2e43',1,'dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol): dblib.c']]], ['dbcollen_1097',['dbcollen',['../a00548.html#ga89fc5589b4bf41932324d2cfc6ad6433',1,'dbcollen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga89fc5589b4bf41932324d2cfc6ad6433',1,'dbcollen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcolname_1098',['dbcolname',['../a00548.html#gad06f5deddac18604dfa858b2580e232f',1,'dbcolname(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gad06f5deddac18604dfa858b2580e232f',1,'dbcolname(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcolptr_1099',['dbcolptr',['../a00554.html#ga0fc84c7073ed4876d9596c3eccac3609',1,'dblib.c']]], ['dbcolsource_1100',['dbcolsource',['../a00548.html#ga3a96d0188e5e0eb9eea661b3685fdcc3',1,'dbcolsource(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga3a96d0188e5e0eb9eea661b3685fdcc3',1,'dbcolsource(DBPROCESS *dbproc, int colnum): dblib.c']]], ['dbcoltype_1101',['dbcoltype',['../a00548.html#ga636e6f1b64743f3cf22158a56eef371f',1,'dbcoltype(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga636e6f1b64743f3cf22158a56eef371f',1,'dbcoltype(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcoltypeinfo_1102',['dbcoltypeinfo',['../a00548.html#ga3c33e72c41b40e08dbcfdfa0d16bc399',1,'dbcoltypeinfo(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga3c33e72c41b40e08dbcfdfa0d16bc399',1,'dbcoltypeinfo(DBPROCESS *dbproc, int column): dblib.c']]], ['dbcolutype_1103',['dbcolutype',['../a00548.html#gab33d2f4fd44f50e55b6c71902db4fdae',1,'dbcolutype(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gab33d2f4fd44f50e55b6c71902db4fdae',1,'dbcolutype(DBPROCESS *dbprocess, int column): dblib.c']]], ['dbconvert_1104',['dbconvert',['../a00548.html#ga32eb72f6fb3edb130e59fb3dd0766e7e',1,'dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen): dblib.c'],['../a00548.html#ga32eb72f6fb3edb130e59fb3dd0766e7e',1,'dbconvert(DBPROCESS *dbproc, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen): dblib.c']]], ['dbconvert_5fps_1105',['dbconvert_ps',['../a00548.html#ga8b00d5cdcaa20cba13fa2e03d52a443e',1,'dbconvert_ps(DBPROCESS *dbproc, int db_srctype, const BYTE *src, DBINT srclen, int db_desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo): dblib.c'],['../a00548.html#ga8b00d5cdcaa20cba13fa2e03d52a443e',1,'dbconvert_ps(DBPROCESS *dbprocess, int srctype, const BYTE *src, DBINT srclen, int desttype, BYTE *dest, DBINT destlen, DBTYPEINFO *typeinfo): dblib.c']]], ['dbcount_1106',['dbcount',['../a00548.html#ga9433bc200c0978569964354451d9b64e',1,'dbcount(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga9433bc200c0978569964354451d9b64e',1,'dbcount(DBPROCESS *dbproc): dblib.c']]], ['dbcurcmd_1107',['dbcurcmd',['../a00554.html#ga01e7fb38bece3bb07526532fa6be50e5',1,'dbcurcmd(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga01e7fb38bece3bb07526532fa6be50e5',1,'dbcurcmd(DBPROCESS *dbproc): dblib.c']]], ['dbcurrow_1108',['dbcurrow',['../a00554.html#ga9e23a95d84192b4fc83db7544d772d16',1,'dbcurrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga9e23a95d84192b4fc83db7544d772d16',1,'dbcurrow(DBPROCESS *dbproc): dblib.c']]], ['dbdata_1109',['dbdata',['../a00548.html#gaee60c306a22383805a4b9caa647a1e16',1,'dbdata(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gaee60c306a22383805a4b9caa647a1e16',1,'dbdata(DBPROCESS *dbproc, int column): dblib.c']]], ['dbdatecmp_1110',['dbdatecmp',['../a00553.html#ga129d2922d347121a6b312dd8e75ed6d2',1,'dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2): dblib.c'],['../a00553.html#ga129d2922d347121a6b312dd8e75ed6d2',1,'dbdatecmp(DBPROCESS *dbproc, DBDATETIME *d1, DBDATETIME *d2): dblib.c']]], ['dbdatecrack_1111',['dbdatecrack',['../a00548.html#ga46f3641b79a2e90371a66950b6db2c4d',1,'dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *datetime): dblib.c'],['../a00548.html#ga46f3641b79a2e90371a66950b6db2c4d',1,'dbdatecrack(DBPROCESS *dbproc, DBDATEREC *di, DBDATETIME *dt): dblib.c']]], ['dbdatlen_1112',['dbdatlen',['../a00548.html#gae666d141533126babb0235af21bdca0f',1,'dbdatlen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gae666d141533126babb0235af21bdca0f',1,'dbdatlen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbdead_1113',['dbdead',['../a00554.html#gaed43cb21ed54dc1a6340075d6290e4b0',1,'dbdead(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gaed43cb21ed54dc1a6340075d6290e4b0',1,'dbdead(DBPROCESS *dbproc): dblib.c']]], ['dberrhandle_1114',['dberrhandle',['../a00548.html#gab8209543de865f359bdb32829fa8b757',1,'dberrhandle(EHANDLEFUNC handler): dblib.c'],['../a00548.html#gab8209543de865f359bdb32829fa8b757',1,'dberrhandle(EHANDLEFUNC handler): dblib.c']]], ['dbexit_1115',['dbexit',['../a00548.html#gad0044401c8c83205583f93a4764f2d8b',1,'dbexit(): dblib.c'],['../a00548.html#gad0044401c8c83205583f93a4764f2d8b',1,'dbexit(void): dblib.c']]], ['dbfcmd_1116',['dbfcmd',['../a00548.html#ga43727b10d4cbb7708b374811abe6eadb',1,'dbfcmd(DBPROCESS *dbproc, const char *fmt,...): dblib.c'],['../a00548.html#ga43727b10d4cbb7708b374811abe6eadb',1,'dbfcmd(DBPROCESS *dbproc, const char *fmt,...): dblib.c']]], ['dbfirstrow_1117',['dbfirstrow',['../a00554.html#gaf40b925f3b3ba43804720dd4ae584935',1,'dbfirstrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gaf40b925f3b3ba43804720dd4ae584935',1,'dbfirstrow(DBPROCESS *dbproc): dblib.c']]], ['dbfreebuf_1118',['dbfreebuf',['../a00548.html#ga0fcfcf6846442dac9dd5584d270ec72a',1,'dbfreebuf(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga0fcfcf6846442dac9dd5584d270ec72a',1,'dbfreebuf(DBPROCESS *dbproc): dblib.c']]], ['dbgetchar_1119',['dbgetchar',['../a00548.html#gaf917cf746c954a5d1b718afe3c4d1940',1,'dbgetchar(DBPROCESS *dbproc, int pos): dblib.c'],['../a00548.html#gaf917cf746c954a5d1b718afe3c4d1940',1,'dbgetchar(DBPROCESS *dbprocess, int n): dblib.c']]], ['dbgetmaxprocs_1120',['dbgetmaxprocs',['../a00548.html#gadb34c5c2aae50ac9f2a26d8984136997',1,'dbgetmaxprocs(void): dblib.c'],['../a00548.html#gadb34c5c2aae50ac9f2a26d8984136997',1,'dbgetmaxprocs(void): dblib.c']]], ['dbgetnull_1121',['dbgetnull',['../a00080.html#aea6a865806d454280126de940478c214',1,'dblib.c']]], ['dbgetpacket_1122',['dbgetpacket',['../a00548.html#gabaf9aa756f7cb8bbec80d1c7201c6238',1,'dbgetpacket(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gabaf9aa756f7cb8bbec80d1c7201c6238',1,'dbgetpacket(DBPROCESS *dbproc): dblib.c']]], ['dbgetrow_1123',['dbgetrow',['../a00548.html#ga60fe544491c760f8bc6c37bc7f777d70',1,'dbgetrow(DBPROCESS *dbproc, DBINT row): dblib.c'],['../a00548.html#ga60fe544491c760f8bc6c37bc7f777d70',1,'dbgetrow(DBPROCESS *dbproc, DBINT row): dblib.c']]], ['dbgettime_1124',['dbgettime',['../a00548.html#ga6ccffbb3f0cfb10883ad349f1e47c50e',1,'dbgettime(void): dblib.c'],['../a00548.html#ga6ccffbb3f0cfb10883ad349f1e47c50e',1,'dbgettime(void): dblib.c']]], ['dbgetuserdata_1125',['dbgetuserdata',['../a00548.html#gaa5714a91d7c14365fa1e5b164bb2b0b6',1,'dbgetuserdata(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaa5714a91d7c14365fa1e5b164bb2b0b6',1,'dbgetuserdata(DBPROCESS *dbproc): dblib.c']]], ['dbhasretstat_1126',['dbhasretstat',['../a00549.html#ga7a5062dac92ccedc8459f6d4a530ffb7',1,'dbhasretstat(DBPROCESS *dbproc): dblib.c'],['../a00549.html#ga7a5062dac92ccedc8459f6d4a530ffb7',1,'dbhasretstat(DBPROCESS *dbproc): dblib.c']]], ['dbinit_1127',['dbinit',['../a00548.html#ga564dd3a1bb0425a8957f1714d8b2a7c0',1,'dbinit(void): dblib.c'],['../a00548.html#ga564dd3a1bb0425a8957f1714d8b2a7c0',1,'dbinit(void): dblib.c']]], ['dbiordesc_1128',['dbiordesc',['../a00554.html#gab842baac0ec420b265d8c199cc45059d',1,'dbiordesc(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gab842baac0ec420b265d8c199cc45059d',1,'dbiordesc(DBPROCESS *dbproc): dblib.c']]], ['dbiowdesc_1129',['dbiowdesc',['../a00554.html#ga666a4d0609ee7f241deb0a62893d2cfa',1,'dbiowdesc(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga666a4d0609ee7f241deb0a62893d2cfa',1,'dbiowdesc(DBPROCESS *dbproc): dblib.c']]], ['dbiscount_1130',['dbiscount',['../a00548.html#ga6ba2a7f18cb76d24776e45fd71141494',1,'dbiscount(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga6ba2a7f18cb76d24776e45fd71141494',1,'dbiscount(DBPROCESS *dbproc): dblib.c']]], ['dbisopt_1131',['dbisopt',['../a00548.html#gac3eb8cb53f50998403ea9aebc6263df9',1,'dbisopt(DBPROCESS *dbproc, int option, const char param[]): dblib.c'],['../a00548.html#gac3eb8cb53f50998403ea9aebc6263df9',1,'dbisopt(DBPROCESS *dbproc, int option, const char param[]): dblib.c']]], ['dblastrow_1132',['dblastrow',['../a00554.html#ga13ead146339b43b3a4d9049eb124ef4b',1,'dblastrow(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga13ead146339b43b3a4d9049eb124ef4b',1,'dblastrow(DBPROCESS *dbproc): dblib.c']]], ['dblogin_1133',['dblogin',['../a00548.html#ga0984798bb806f7451a53bffa7e2c430f',1,'dblogin(void): dblib.c'],['../a00548.html#ga0984798bb806f7451a53bffa7e2c430f',1,'dblogin(void): dblib.c']]], ['dbloginfree_1134',['dbloginfree',['../a00548.html#gac1bdb1766b791153f37dceae8ff64ad6',1,'dbloginfree(LOGINREC *login): dblib.c'],['../a00548.html#gac1bdb1766b791153f37dceae8ff64ad6',1,'dbloginfree(LOGINREC *login): dblib.c']]], ['dbmny4add_1135',['dbmny4add',['../a00552.html#ga0a384938a6586b7411fc42420ffad6ed',1,'dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum): dblib.c'],['../a00552.html#ga0a384938a6586b7411fc42420ffad6ed',1,'dbmny4add(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *sum): dblib.c']]], ['dbmny4cmp_1136',['dbmny4cmp',['../a00552.html#ga109d4868baccb08fad3b26b6f031dc78',1,'dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2): dblib.c'],['../a00552.html#ga109d4868baccb08fad3b26b6f031dc78',1,'dbmny4cmp(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2): dblib.c']]], ['dbmny4copy_1137',['dbmny4copy',['../a00552.html#gaa6d4c700b628f6a18a9d1ed9f8e2ba62',1,'dbmny4copy(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest): dblib.c'],['../a00552.html#gaa6d4c700b628f6a18a9d1ed9f8e2ba62',1,'dbmny4copy(DBPROCESS *dbprocess, DBMONEY4 *m1, DBMONEY4 *m2): dblib.c']]], ['dbmny4minus_1138',['dbmny4minus',['../a00552.html#ga76177eb61a67dd52424236aba1b16bc9',1,'dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest): dblib.c'],['../a00552.html#ga76177eb61a67dd52424236aba1b16bc9',1,'dbmny4minus(DBPROCESS *dbproc, DBMONEY4 *src, DBMONEY4 *dest): dblib.c']]], ['dbmny4sub_1139',['dbmny4sub',['../a00552.html#ga856143f4f9c7a5c15fb15633af81487d',1,'dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff): dblib.c'],['../a00552.html#ga856143f4f9c7a5c15fb15633af81487d',1,'dbmny4sub(DBPROCESS *dbproc, DBMONEY4 *m1, DBMONEY4 *m2, DBMONEY4 *diff): dblib.c']]], ['dbmny4zero_1140',['dbmny4zero',['../a00552.html#ga070e94f72f12c138a16a7bcdf732fa8b',1,'dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest): dblib.c'],['../a00552.html#ga070e94f72f12c138a16a7bcdf732fa8b',1,'dbmny4zero(DBPROCESS *dbproc, DBMONEY4 *dest): dblib.c']]], ['dbmnycmp_1141',['dbmnycmp',['../a00552.html#gadddacad5c3028aa8d3726246c3825651',1,'dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2): dblib.c'],['../a00552.html#gadddacad5c3028aa8d3726246c3825651',1,'dbmnycmp(DBPROCESS *dbproc, DBMONEY *m1, DBMONEY *m2): dblib.c']]], ['dbmnycopy_1142',['dbmnycopy',['../a00552.html#ga8f1e9aa0280c1cb46c10e5c90b8faced',1,'dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c'],['../a00552.html#ga8f1e9aa0280c1cb46c10e5c90b8faced',1,'dbmnycopy(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c']]], ['dbmnydec_1143',['dbmnydec',['../a00552.html#gabedce74748a31ea8a6e4068a5d44d8e4',1,'dbmnydec(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#gabedce74748a31ea8a6e4068a5d44d8e4',1,'dbmnydec(DBPROCESS *dbproc, DBMONEY *mnyptr): dblib.c']]], ['dbmnyinc_1144',['dbmnyinc',['../a00552.html#gabf5216aaaa59ea7e7f07899f82a27faf',1,'dbmnyinc(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#gabf5216aaaa59ea7e7f07899f82a27faf',1,'dbmnyinc(DBPROCESS *dbproc, DBMONEY *mnyptr): dblib.c']]], ['dbmnymaxneg_1145',['dbmnymaxneg',['../a00552.html#gabc3cb44d33bf1b9b18fd59f23e4da722',1,'dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#gabc3cb44d33bf1b9b18fd59f23e4da722',1,'dbmnymaxneg(DBPROCESS *dbproc, DBMONEY *dest): dblib.c']]], ['dbmnymaxpos_1146',['dbmnymaxpos',['../a00552.html#ga70ca2474f6c93acd6e3b842330b712c7',1,'dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *amount): dblib.c'],['../a00552.html#ga70ca2474f6c93acd6e3b842330b712c7',1,'dbmnymaxpos(DBPROCESS *dbproc, DBMONEY *dest): dblib.c']]], ['dbmnyminus_1147',['dbmnyminus',['../a00552.html#ga826bca98da4fd1c3188da45c383c3a68',1,'dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c'],['../a00552.html#ga826bca98da4fd1c3188da45c383c3a68',1,'dbmnyminus(DBPROCESS *dbproc, DBMONEY *src, DBMONEY *dest): dblib.c']]], ['dbmnyzero_1148',['dbmnyzero',['../a00552.html#ga8eab0959d5a3cd534487b350258c939e',1,'dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest): dblib.c'],['../a00552.html#ga8eab0959d5a3cd534487b350258c939e',1,'dbmnyzero(DBPROCESS *dbproc, DBMONEY *dest): dblib.c']]], ['dbmonthname_1149',['dbmonthname',['../a00553.html#ga38ecd55ae5827bfa0fd12e2baf0950dd',1,'dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform): dblib.c'],['../a00553.html#ga38ecd55ae5827bfa0fd12e2baf0950dd',1,'dbmonthname(DBPROCESS *dbproc, char *language, int monthnum, DBBOOL shortform): dblib.c']]], ['dbmorecmds_1150',['dbmorecmds',['../a00548.html#gac3ba9f53cc77e4dde8f48335ed94ac19',1,'dbmorecmds(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gac3ba9f53cc77e4dde8f48335ed94ac19',1,'dbmorecmds(DBPROCESS *dbproc): dblib.c']]], ['dbmoretext_1151',['dbmoretext',['../a00548.html#ga6f13381522a1fa0b6ce2c15378088cdd',1,'dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[]): dblib.c'],['../a00548.html#ga6f13381522a1fa0b6ce2c15378088cdd',1,'dbmoretext(DBPROCESS *dbproc, DBINT size, const BYTE text[]): dblib.c']]], ['dbmsghandle_1152',['dbmsghandle',['../a00548.html#gadc8af9a65f3719804c2537fd737298ca',1,'dbmsghandle(MHANDLEFUNC handler): dblib.c'],['../a00548.html#gadc8af9a65f3719804c2537fd737298ca',1,'dbmsghandle(MHANDLEFUNC handler): dblib.c']]], ['dbname_1153',['dbname',['../a00548.html#gab185982ffe0b85b8fd19747bd1f433fe',1,'dbname(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gab185982ffe0b85b8fd19747bd1f433fe',1,'dbname(DBPROCESS *dbproc): dblib.c']]], ['dbnullbind_1154',['dbnullbind',['../a00548.html#ga85dcc40c3615f94be96b09b2ec043533',1,'dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator): dblib.c'],['../a00548.html#ga85dcc40c3615f94be96b09b2ec043533',1,'dbnullbind(DBPROCESS *dbproc, int column, DBINT *indicator): dblib.c']]], ['dbnumalts_1155',['dbnumalts',['../a00548.html#ga67934deac3bebbf8238eff8c0559389a',1,'dbnumalts(DBPROCESS *dbproc, int computeid): dblib.c'],['../a00548.html#ga67934deac3bebbf8238eff8c0559389a',1,'dbnumalts(DBPROCESS *dbproc, int computeid): dblib.c']]], ['dbnumcols_1156',['dbnumcols',['../a00548.html#gadaa9482a082aa3fe52231e17749c2993',1,'dbnumcols(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gadaa9482a082aa3fe52231e17749c2993',1,'dbnumcols(DBPROCESS *dbproc): dblib.c']]], ['dbnumcompute_1157',['dbnumcompute',['../a00548.html#gac554d2cb2da0c9f9fd3d4867998edcc4',1,'dbnumcompute(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gac554d2cb2da0c9f9fd3d4867998edcc4',1,'dbnumcompute(DBPROCESS *dbprocess): dblib.c']]], ['dbnumrets_1158',['dbnumrets',['../a00549.html#gaff09873008411a0573f6d1a9e6c7cf4b',1,'dbnumrets(DBPROCESS *dbproc): dblib.c'],['../a00549.html#gaff09873008411a0573f6d1a9e6c7cf4b',1,'dbnumrets(DBPROCESS *dbproc): dblib.c']]], ['dbopen_1159',['dbopen',['../a00506.html#ae408d8e1c2ab0767d8bfd26d00d1ff6a',1,'dbopen.c']]], ['dbperror_1160',['dbperror',['../a00554.html#ga302a4ce6559b81808e3be51615cd1b67',1,'dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...): dblib.c'],['../a00554.html#ga302a4ce6559b81808e3be51615cd1b67',1,'dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum,...): dblib.c']]], ['dbpivot_1161',['dbpivot',['../a00506.html#af8ada101cd189eff87b3533cbeaaa23b',1,'dbpivot.c']]], ['dbprcollen_1162',['dbprcollen',['../a00548.html#gac0cb0584f6500d61a2ac95a891da73eb',1,'dbprcollen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gac0cb0584f6500d61a2ac95a891da73eb',1,'dbprcollen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbprhead_1163',['dbprhead',['../a00548.html#ga9dfc2ee533e5e48a7aa8ca22f8d9ed79',1,'dbprhead(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga9dfc2ee533e5e48a7aa8ca22f8d9ed79',1,'dbprhead(DBPROCESS *dbproc): dblib.c']]], ['dbprrow_1164',['dbprrow',['../a00548.html#gaa30be3414a97aac6139af2e928db91ca',1,'dbprrow(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaa30be3414a97aac6139af2e928db91ca',1,'dbprrow(DBPROCESS *dbproc): dblib.c']]], ['dbprtype_1165',['dbprtype',['../a00548.html#gac25ae21ca19777ffab1c013bd6049ebf',1,'dbprtype(int token): dblib.c'],['../a00548.html#gac25ae21ca19777ffab1c013bd6049ebf',1,'dbprtype(int token): dblib.c']]], ['dbreadtext_1166',['dbreadtext',['../a00548.html#gadd5685565c8c6c86079e17b8a73b324c',1,'dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize): dblib.c'],['../a00548.html#gadd5685565c8c6c86079e17b8a73b324c',1,'dbreadtext(DBPROCESS *dbproc, void *buf, DBINT bufsize): dblib.c']]], ['dbrecftos_1167',['dbrecftos',['../a00548.html#gabb14ad9f268b92a8d63fa506098b24dd',1,'dbrecftos(const char filename[]): dblib.c'],['../a00548.html#gabb14ad9f268b92a8d63fa506098b24dd',1,'dbrecftos(const char filename[]): dblib.c']]], ['dbresults_1168',['dbresults',['../a00548.html#ga4e26d949be2c3bf71b1a33c75b11d931',1,'dbresults(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga4e26d949be2c3bf71b1a33c75b11d931',1,'dbresults(DBPROCESS *dbproc): dblib.c']]], ['dbretdata_1169',['dbretdata',['../a00549.html#ga42e187003b74fec6e9ca92d410bfb9c0',1,'dbretdata(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#ga42e187003b74fec6e9ca92d410bfb9c0',1,'dbretdata(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbretlen_1170',['dbretlen',['../a00549.html#gab705bf94be535e9d8fc4edc0f48c98b0',1,'dbretlen(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#gab705bf94be535e9d8fc4edc0f48c98b0',1,'dbretlen(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbretname_1171',['dbretname',['../a00549.html#ga0311328d63bae5d9bd5aea5ea4914223',1,'dbretname(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#ga0311328d63bae5d9bd5aea5ea4914223',1,'dbretname(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbretstatus_1172',['dbretstatus',['../a00549.html#ga2306039d73fbc7045f257b0e750c37b4',1,'dbretstatus(DBPROCESS *dbproc): dblib.c'],['../a00549.html#ga2306039d73fbc7045f257b0e750c37b4',1,'dbretstatus(DBPROCESS *dbproc): dblib.c']]], ['dbrettype_1173',['dbrettype',['../a00549.html#gaa478c8b96923bca02d158d966172ec1b',1,'dbrettype(DBPROCESS *dbproc, int retnum): dblib.c'],['../a00549.html#gaa478c8b96923bca02d158d966172ec1b',1,'dbrettype(DBPROCESS *dbproc, int retnum): dblib.c']]], ['dbrows_1174',['dbrows',['../a00554.html#ga4be2ab59dc7161d6b93c17202e7ae9b1',1,'dbrows(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga4be2ab59dc7161d6b93c17202e7ae9b1',1,'dbrows(DBPROCESS *dbproc): dblib.c']]], ['dbrowtype_1175',['dbrowtype',['../a00554.html#gaa2dc8c062342f76adffe53ee280b7fb4',1,'dbrowtype(DBPROCESS *dbproc): dblib.c'],['../a00554.html#gaa2dc8c062342f76adffe53ee280b7fb4',1,'dbrowtype(DBPROCESS *dbprocess): dblib.c']]], ['dbrpcinit_1176',['dbrpcinit',['../a00549.html#ga5b4374c13c7a83cd4345b0bfa3e787bd',1,'dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options): rpc.c'],['../a00549.html#ga5b4374c13c7a83cd4345b0bfa3e787bd',1,'dbrpcinit(DBPROCESS *dbproc, const char rpcname[], DBSMALLINT options): rpc.c']]], ['dbrpcparam_1177',['dbrpcparam',['../a00549.html#gaf6b6b0a641180a5c28382df39cd7d346',1,'dbrpcparam(DBPROCESS *dbproc, const char paramname[], BYTE status, int db_type, DBINT maxlen, DBINT datalen, BYTE *value): rpc.c'],['../a00549.html#gaf6b6b0a641180a5c28382df39cd7d346',1,'dbrpcparam(DBPROCESS *dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE *value): rpc.c']]], ['dbrpcsend_1178',['dbrpcsend',['../a00549.html#gafa4dfd181be21e49c397f7daaa9cf96c',1,'dbrpcsend(DBPROCESS *dbproc): rpc.c'],['../a00549.html#gafa4dfd181be21e49c397f7daaa9cf96c',1,'dbrpcsend(DBPROCESS *dbproc): rpc.c']]], ['dbsafestr_1179',['dbsafestr',['../a00548.html#gad0ccc03b94ba2515fd1f5d35559fcb41',1,'dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype): dblib.c'],['../a00548.html#gad0ccc03b94ba2515fd1f5d35559fcb41',1,'dbsafestr(DBPROCESS *dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype): dblib.c']]], ['dbservcharset_1180',['dbservcharset',['../a00548.html#ga39302e8efbb476ba01cff109ffb3661e',1,'dbservcharset(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga39302e8efbb476ba01cff109ffb3661e',1,'dbservcharset(DBPROCESS *dbprocess): dblib.c']]], ['dbsetavail_1181',['dbsetavail',['../a00554.html#ga5ce245ff327a3d333280fe7b43d69ded',1,'dbsetavail(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga5ce245ff327a3d333280fe7b43d69ded',1,'dbsetavail(DBPROCESS *dbprocess): dblib.c']]], ['dbsetifile_1182',['dbsetifile',['../a00548.html#ga663350909fec3a1d152316c45a65e708',1,'dbsetifile(char *filename): dblib.c'],['../a00548.html#ga663350909fec3a1d152316c45a65e708',1,'dbsetifile(char *filename): dblib.c']]], ['dbsetinterrupt_1183',['dbsetinterrupt',['../a00548.html#ga335fcbe476ad0f897e4e2ce377f0a8cc',1,'dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr): dblib.c'],['../a00548.html#ga335fcbe476ad0f897e4e2ce377f0a8cc',1,'dbsetinterrupt(DBPROCESS *dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr): dblib.c']]], ['dbsetlbool_1184',['dbsetlbool',['../a00554.html#ga03e850369aca6fba074da5e9da4effd7',1,'dbsetlbool(LOGINREC *login, int value, int which): dblib.c'],['../a00554.html#ga03e850369aca6fba074da5e9da4effd7',1,'dbsetlbool(LOGINREC *login, int value, int which): dblib.c']]], ['dbsetllong_1185',['dbsetllong',['../a00554.html#gabdcccf4e0d093ff48c0e7048a4bfaf84',1,'dbsetllong(LOGINREC *login, long value, int which): dblib.c'],['../a00554.html#gabdcccf4e0d093ff48c0e7048a4bfaf84',1,'dbsetllong(LOGINREC *login, long value, int which): dblib.c']]], ['dbsetlname_1186',['dbsetlname',['../a00554.html#gae1fc46447c4f8a9ff7f66607b8cd23b6',1,'dbsetlname(LOGINREC *login, const char *value, int which): dblib.c'],['../a00554.html#gae1fc46447c4f8a9ff7f66607b8cd23b6',1,'dbsetlname(LOGINREC *login, const char *value, int which): dblib.c']]], ['dbsetlogintime_1187',['dbsetlogintime',['../a00548.html#ga5f1281c07dde5a6d28e60ef62c501d1d',1,'dbsetlogintime(int seconds): dblib.c'],['../a00548.html#ga5f1281c07dde5a6d28e60ef62c501d1d',1,'dbsetlogintime(int seconds): dblib.c']]], ['dbsetlversion_1188',['dbsetlversion',['../a00548.html#gaa22dce1ee0eb83059699c34c47d07c14',1,'dbsetlversion(LOGINREC *login, BYTE version): dblib.c'],['../a00548.html#gaa22dce1ee0eb83059699c34c47d07c14',1,'dbsetlversion(LOGINREC *login, BYTE version): dblib.c']]], ['dbsetmaxprocs_1189',['dbsetmaxprocs',['../a00548.html#gaf2ca0e63f800b3839684c894ff651dd4',1,'dbsetmaxprocs(int maxprocs): dblib.c'],['../a00548.html#gaf2ca0e63f800b3839684c894ff651dd4',1,'dbsetmaxprocs(int maxprocs): dblib.c']]], ['dbsetnull_1190',['dbsetnull',['../a00548.html#ga399512ec78c15ce3db79ea88ef3b1293',1,'dbsetnull(DBPROCESS *dbproc, int bindtype, int bindlen, BYTE *bindval): dblib.c'],['../a00548.html#ga399512ec78c15ce3db79ea88ef3b1293',1,'dbsetnull(DBPROCESS *dbprocess, int bindtype, int bindlen, BYTE *bindval): dblib.c']]], ['dbsetopt_1191',['dbsetopt',['../a00548.html#ga9d660d278f3f58871b4086c0e175f4c6',1,'dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param): dblib.c'],['../a00548.html#ga9d660d278f3f58871b4086c0e175f4c6',1,'dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param): dblib.c']]], ['dbsetrow_1192',['dbsetrow',['../a00548.html#gaeb3d621e4f6846bb228b0a596d8758c0',1,'dbsetrow(DBPROCESS *dbproc, DBINT row): dblib.c'],['../a00548.html#gaeb3d621e4f6846bb228b0a596d8758c0',1,'dbsetrow(DBPROCESS *dbprocess, DBINT row): dblib.c']]], ['dbsettime_1193',['dbsettime',['../a00548.html#gada4b41f34542a87f0cd87e78e56d18bb',1,'dbsettime(int seconds): dblib.c'],['../a00548.html#gada4b41f34542a87f0cd87e78e56d18bb',1,'dbsettime(int seconds): dblib.c']]], ['dbsetuserdata_1194',['dbsetuserdata',['../a00548.html#gabea9c70d02bf3e46bbb1d759915cb91e',1,'dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr): dblib.c'],['../a00548.html#gabea9c70d02bf3e46bbb1d759915cb91e',1,'dbsetuserdata(DBPROCESS *dbproc, BYTE *ptr): dblib.c']]], ['dbsetversion_1195',['dbsetversion',['../a00548.html#gab9aa181fb3081ffb314340cbd71e434d',1,'dbsetversion(DBINT version): dblib.c'],['../a00548.html#gab9aa181fb3081ffb314340cbd71e434d',1,'dbsetversion(DBINT version): dblib.c']]], ['dbspid_1196',['dbspid',['../a00548.html#ga223a6d333f95e726b0b42ec19a076731',1,'dbspid(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga223a6d333f95e726b0b42ec19a076731',1,'dbspid(DBPROCESS *dbproc): dblib.c']]], ['dbspr1row_1197',['dbspr1row',['../a00548.html#gaf641c8e3d34607ca8b7ac2afed3e6d67',1,'dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c'],['../a00548.html#gaf641c8e3d34607ca8b7ac2afed3e6d67',1,'dbspr1row(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c']]], ['dbspr1rowlen_1198',['dbspr1rowlen',['../a00548.html#ga308918c13a5b1644269c1654fbea96ac',1,'dbspr1rowlen(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga308918c13a5b1644269c1654fbea96ac',1,'dbspr1rowlen(DBPROCESS *dbproc): dblib.c']]], ['dbsprhead_1199',['dbsprhead',['../a00548.html#gaaa4839a9c88e5b90f33bd2407fcbc43e',1,'dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c'],['../a00548.html#gaaa4839a9c88e5b90f33bd2407fcbc43e',1,'dbsprhead(DBPROCESS *dbproc, char *buffer, DBINT buf_len): dblib.c']]], ['dbsprline_1200',['dbsprline',['../a00548.html#gacfaf9feb29c87cfb660886162f643152',1,'dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char): dblib.c'],['../a00548.html#gacfaf9feb29c87cfb660886162f643152',1,'dbsprline(DBPROCESS *dbproc, char *buffer, DBINT buf_len, DBCHAR line_char): dblib.c']]], ['dbsqlexec_1201',['dbsqlexec',['../a00548.html#gaae889abeb145ec41f7361aa8f597fe46',1,'dbsqlexec(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gaae889abeb145ec41f7361aa8f597fe46',1,'dbsqlexec(DBPROCESS *dbproc): dblib.c']]], ['dbsqlok_1202',['dbsqlok',['../a00548.html#gae1f50a6a2c31fda57cb481922b06841e',1,'dbsqlok(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gae1f50a6a2c31fda57cb481922b06841e',1,'dbsqlok(DBPROCESS *dbproc): dblib.c']]], ['dbsqlsend_1203',['dbsqlsend',['../a00548.html#gac980139b9cea03cf93e373d425991481',1,'dbsqlsend(DBPROCESS *dbproc): dblib.c'],['../a00548.html#gac980139b9cea03cf93e373d425991481',1,'dbsqlsend(DBPROCESS *dbproc): dblib.c']]], ['dbstrbuild_1204',['dbstrbuild',['../a00548.html#gab5fe0cd5f24d4fd33670111035a4fbed',1,'dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...): dblib.c'],['../a00548.html#gab5fe0cd5f24d4fd33670111035a4fbed',1,'dbstrbuild(DBPROCESS *dbproc, char *charbuf, int bufsize, char *text, char *formats,...): dblib.c']]], ['dbstrcpy_1205',['dbstrcpy',['../a00548.html#gaf130b12e9e58b1bfd4a6685e33f5b3cd',1,'dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest): dblib.c'],['../a00548.html#gaf130b12e9e58b1bfd4a6685e33f5b3cd',1,'dbstrcpy(DBPROCESS *dbproc, int start, int numbytes, char *dest): dblib.c']]], ['dbstrlen_1206',['dbstrlen',['../a00548.html#ga13caa07ec45cd6f64e9197d29e3cfe5e',1,'dbstrlen(DBPROCESS *dbproc): dblib.c'],['../a00548.html#ga13caa07ec45cd6f64e9197d29e3cfe5e',1,'dbstrlen(DBPROCESS *dbproc): dblib.c']]], ['dbtablecolinfo_1207',['dbtablecolinfo',['../a00548.html#ga9804fc70ae6ed35c92cd75d410dad570',1,'dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol): dblib.c'],['../a00548.html#ga9804fc70ae6ed35c92cd75d410dad570',1,'dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol): dblib.c']]], ['dbtds_1208',['dbtds',['../a00554.html#ga8d765d810a40dfa01b39995a8e7406f0',1,'dbtds(DBPROCESS *dbproc): dblib.c'],['../a00554.html#ga8d765d810a40dfa01b39995a8e7406f0',1,'dbtds(DBPROCESS *dbprocess): dblib.c']]], ['dbtxptr_1209',['dbtxptr',['../a00548.html#ga57e4098b153a030f0be02bcd98e08ba2',1,'dbtxptr(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga57e4098b153a030f0be02bcd98e08ba2',1,'dbtxptr(DBPROCESS *dbproc, int column): dblib.c']]], ['dbtxtimestamp_1210',['dbtxtimestamp',['../a00548.html#gac3f11142ec7ff25b1f8972af10fe9454',1,'dbtxtimestamp(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#gac3f11142ec7ff25b1f8972af10fe9454',1,'dbtxtimestamp(DBPROCESS *dbproc, int column): dblib.c']]], ['dbuse_1211',['dbuse',['../a00548.html#ga66ea891910f0a357cc78107d6ab7d962',1,'dbuse(DBPROCESS *dbproc, const char *name): dblib.c'],['../a00548.html#ga66ea891910f0a357cc78107d6ab7d962',1,'dbuse(DBPROCESS *dbproc, const char *name): dblib.c']]], ['dbvarylen_1212',['dbvarylen',['../a00548.html#ga57c856964a9a0b4cc43f5192647c51e7',1,'dbvarylen(DBPROCESS *dbproc, int column): dblib.c'],['../a00548.html#ga57c856964a9a0b4cc43f5192647c51e7',1,'dbvarylen(DBPROCESS *dbproc, int column): dblib.c']]], ['dbversion_1213',['dbversion',['../a00548.html#ga666726c86108342b1c1f27eecf68e13c',1,'dbversion(): dblib.c'],['../a00548.html#ga666726c86108342b1c1f27eecf68e13c',1,'dbversion(void): dblib.c']]], ['dbwillconvert_1214',['dbwillconvert',['../a00548.html#gaaf8349999c16b3c36caf5947747a2915',1,'dbwillconvert(int srctype, int desttype): dblib.c'],['../a00548.html#gaaf8349999c16b3c36caf5947747a2915',1,'dbwillconvert(int srctype, int desttype): dblib.c']]], ['dbwritetext_1215',['dbwritetext',['../a00548.html#ga548153eb2eae76c48aa9d4b72258dc1c',1,'dbwritetext(DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text): dblib.c'],['../a00548.html#ga548153eb2eae76c48aa9d4b72258dc1c',1,'dbwritetext(DBPROCESS *dbproc, char *objname, DBBINARY *textptr, DBTINYINT textptrlen, DBBINARY *timestamp, DBBOOL log, DBINT size, BYTE *text): dblib.c']]], ['default_5ferr_5fhandler_1216',['default_err_handler',['../a00554.html#gaccbc6d98d9528c48cf0254d809ca73ff',1,'dblib.c']]], ['determine_5fadjusted_5fsize_1217',['determine_adjusted_size',['../a00565.html#gaacb26868882440aa08de9fb952628eaf',1,'token.c']]] ]; freetds-1.3.6/doc/reference/search/functions_4.html000644 025423 025423 00000002624 14162303412 023674 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_4.js000644 025423 025423 00000004531 14162303412 023343 0ustar00fredianofrediano000000 000000 var searchData= [ ['odbc_5fc_5fto_5fserver_5ftype_1218',['odbc_c_to_server_type',['../a00557.html#ga3f0a413cea480a38d3d9b90c95515f6b',1,'odbc_c_to_server_type(int c_type): odbc_util.c'],['../a00557.html#ga3f0a413cea480a38d3d9b90c95515f6b',1,'odbc_c_to_server_type(int c_type): odbc_util.c']]], ['odbc_5fget_5fparam_5flen_1219',['odbc_get_param_len',['../a00557.html#ga35028e8de1d50dc51ccef1d645c55e2a',1,'odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row): odbc_util.c'],['../a00557.html#ga35028e8de1d50dc51ccef1d645c55e2a',1,'odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC *axd, unsigned int n_row): odbc_util.c']]], ['odbc_5frdbms_5fversion_1220',['odbc_rdbms_version',['../a00557.html#gae85ff7fb2002b5a7abc04fbee79e5525',1,'odbc_rdbms_version(TDSSOCKET *tds, char *pversion_string): odbc_util.c'],['../a00557.html#gae85ff7fb2002b5a7abc04fbee79e5525',1,'odbc_rdbms_version(TDSSOCKET *tds_socket, char *pversion_string): odbc_util.c']]], ['odbc_5fset_5fconcise_5fc_5ftype_1221',['odbc_set_concise_c_type',['../a00557.html#ga128f6b09cde0af252370ba89cfa1fb78',1,'odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c'],['../a00557.html#ga128f6b09cde0af252370ba89cfa1fb78',1,'odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c']]], ['odbc_5fset_5fconcise_5fsql_5ftype_1222',['odbc_set_concise_sql_type',['../a00557.html#ga125574bd2de677438909612db80041ea',1,'odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c'],['../a00557.html#ga125574bd2de677438909612db80041ea',1,'odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only): odbc_util.c']]], ['odbc_5fset_5fstring_5fflag_1223',['odbc_set_string_flag',['../a00557.html#gadba4490bf3183799a70c9e2f44fab331',1,'odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR *pcbBuffer, const char *s, int len, int flag): odbc_util.c'],['../a00557.html#gadba4490bf3183799a70c9e2f44fab331',1,'odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR *pcbBuffer, const char *s, int len, int flag): odbc_util.c']]] ]; freetds-1.3.6/doc/reference/search/functions_5.html000644 025423 025423 00000002624 14162303412 023675 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_5.js000644 025423 025423 00000000603 14162303412 023340 0ustar00fredianofrediano000000 000000 var searchData= [ ['parse_5fint8_1224',['parse_int8',['../a00560.html#gace939c1fa676d172cb0cae94848b7fac',1,'convert.c']]], ['parse_5fnumeric_1225',['parse_numeric',['../a00560.html#ga53a19b5da172ff364d01e8f04b97015a',1,'convert.c']]], ['parse_5fserver_5fname_5ffor_5fport_1226',['parse_server_name_for_port',['../a00559.html#ga82ac44924fb1ae41042c233573a4ac8d',1,'config.c']]] ]; freetds-1.3.6/doc/reference/search/functions_6.html000644 025423 025423 00000002624 14162303412 023676 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_6.js000644 025423 025423 00000000347 14162303412 023346 0ustar00fredianofrediano000000 000000 var searchData= [ ['read_5fand_5fconvert_1227',['read_and_convert',['../a00564.html#ga676c4dee6522815b16fdc8e448e43590',1,'read.c']]], ['rtrim_1228',['rtrim',['../a00551.html#ga4d5be57b25a0654e2170fd656dc35489',1,'bcp.c']]] ]; freetds-1.3.6/doc/reference/search/functions_7.html000644 025423 025423 00000002624 14162303412 023677 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_7.js000644 025423 025423 00000002153 14162303412 023344 0ustar00fredianofrediano000000 000000 var searchData= [ ['search_5finterface_5ffile_1229',['search_interface_file',['../a00559.html#gaca20b6e5f5a5ac1727126712dd39564b',1,'config.c']]], ['skip_5fone_5finput_5fsequence_1230',['skip_one_input_sequence',['../a00561.html#ga3380140fc6eb9f2090c430f40e846876',1,'iconv.c']]], ['store_5fmonthname_1231',['store_monthname',['../a00560.html#ga17a0597ec3522c7f1ddb54956226dbfc',1,'convert.c']]], ['string_5fto_5fint_1232',['string_to_int',['../a00560.html#ga0176fafd412b5b8005bf1202fbc13b00',1,'convert.c']]], ['string_5fto_5fint8_1233',['string_to_int8',['../a00560.html#ga933f87cca76156648e91f472650b98f3',1,'convert.c']]], ['string_5fto_5fnumeric_1234',['string_to_numeric',['../a00560.html#ga28c75aff2615032005257af7455ed70d',1,'convert.c']]], ['string_5fto_5fresult_1235',['string_to_result',['../a00560.html#ga46a5a00dfa70cad4a02d7cc73b314c31',1,'convert.c']]], ['string_5fto_5fuint8_1236',['string_to_uint8',['../a00560.html#gae8e173a9f8d2e3f152ada9f48d3d5f28',1,'convert.c']]], ['stringz_5fto_5fnumeric_1237',['stringz_to_numeric',['../a00560.html#ga467401163bf05ed167f7b2b7e8bd875a',1,'convert.c']]] ]; freetds-1.3.6/doc/reference/search/functions_8.html000644 025423 025423 00000002624 14162303412 023700 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_8.js000644 025423 025423 00000140441 14162303412 023350 0ustar00fredianofrediano000000 000000 var searchData= [ ['tds4_5fsend_5femulated_5frpc_1238',['tds4_send_emulated_rpc',['../a00563.html#ga2d0a06c1a30dd2470dc7a788de21b080',1,'query.c']]], ['tds5_5fbcp_5fadd_5ffixed_5fcolumns_1239',['tds5_bcp_add_fixed_columns',['../a00239.html#a91cf6a009e823417d6c8849256cb211c',1,'bulk.c']]], ['tds5_5fbcp_5fadd_5fvariable_5fcolumns_1240',['tds5_bcp_add_variable_columns',['../a00239.html#a5c906a8b65694148ad530a22ce019f06',1,'bulk.c']]], ['tds5_5ffix_5fdot_5fquery_1241',['tds5_fix_dot_query',['../a00563.html#ga3a5d1771cacc947521c4077551f0d3a4',1,'query.c']]], ['tds5_5fprocess_5fdyn_5fresult2_1242',['tds5_process_dyn_result2',['../a00565.html#gae688b515631141acfbc41bbb91c8b921',1,'token.c']]], ['tds5_5fprocess_5foptioncmd_1243',['tds5_process_optioncmd',['../a00565.html#gaa6a7e5aeb10a1322911c47be9c43e2d2',1,'token.c']]], ['tds5_5fprocess_5fresult_1244',['tds5_process_result',['../a00565.html#ga547b2f48659f77a69aa802d861ac827d',1,'token.c']]], ['tds5_5fprocess_5fresult2_1245',['tds5_process_result2',['../a00565.html#gabe2bdd5a41ce067cb31aef18ff81cb1c',1,'token.c']]], ['tds5_5fput_5fparams_1246',['tds5_put_params',['../a00563.html#ga4f1f0a4f77bc4ea1440dfdebc19a157c',1,'query.c']]], ['tds71_5fread_5ftable_5fnames_1247',['tds71_read_table_names',['../a00565.html#ga7482b5730d880fcedbe9fcd609a550ce',1,'token.c']]], ['tds71_5fsubmit_5fprepexec_1248',['tds71_submit_prepexec',['../a00563.html#ga08877c101704bebe4fa57e0849dc272d',1,'tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c'],['../a00563.html#ga08877c101704bebe4fa57e0849dc272d',1,'tds71_submit_prepexec(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c']]], ['tds7_5fbcp_5fsend_5fcolmetadata_1249',['tds7_bcp_send_colmetadata',['../a00239.html#a4daaa551e54dbd978650e2eef89e09ff',1,'bulk.c']]], ['tds7_5fbuild_5fbulk_5finsert_5fstmt_1250',['tds7_build_bulk_insert_stmt',['../a00239.html#a3118c7232bc9c3e47f8ba872bb39e967',1,'bulk.c']]], ['tds7_5fget_5fdata_5finfo_1251',['tds7_get_data_info',['../a00565.html#ga07cee55fd522cca16fb59b7a8f0b1376',1,'token.c']]], ['tds7_5fget_5finstance_5fport_1252',['tds7_get_instance_port',['../a00564.html#gac23c12ccb3e8599f10f305e993e216f6',1,'tds7_get_instance_port(struct addrinfo *addr, const char *instance): net.c'],['../a00564.html#gac23c12ccb3e8599f10f305e993e216f6',1,'tds7_get_instance_port(struct addrinfo *addr, const char *instance): net.c']]], ['tds7_5fget_5finstance_5fports_1253',['tds7_get_instance_ports',['../a00564.html#ga954dcc3b0332fa9448d9edf59c0fe439',1,'tds7_get_instance_ports(FILE *output, struct addrinfo *addr): net.c'],['../a00564.html#ga954dcc3b0332fa9448d9edf59c0fe439',1,'tds7_get_instance_ports(FILE *output, struct addrinfo *addr): net.c']]], ['tds7_5fprocess_5fcompute_5fresult_1254',['tds7_process_compute_result',['../a00565.html#ga6728e344caa20aea1def85f58dea138b',1,'token.c']]], ['tds7_5fprocess_5fresult_1255',['tds7_process_result',['../a00565.html#gaca56fc22d65a24a96d1bef310ade73aa',1,'token.c']]], ['tds7_5fput_5fquery_5fparams_1256',['tds7_put_query_params',['../a00563.html#ga6e42b4a1d1d3898229ea2fe4afc2ecec',1,'query.c']]], ['tds7_5fsend_5fexecute_1257',['tds7_send_execute',['../a00563.html#ga9f6f25dd405f45e75420e6e084bf2d85',1,'query.c']]], ['tds7_5fwrite_5fparam_5fdef_5ffrom_5fparams_1258',['tds7_write_param_def_from_params',['../a00563.html#ga6513afd79629f7a928e1d3da9f56dee1',1,'query.c']]], ['tds7_5fwrite_5fparam_5fdef_5ffrom_5fquery_1259',['tds7_write_param_def_from_query',['../a00563.html#ga24345856c16b15aa3e84459c2f551320',1,'query.c']]], ['tds_5falloc_5fcompute_5fresult_1260',['tds_alloc_compute_result',['../a00562.html#gae042c280bdf5ecdd530a6e5cc2cf83f5',1,'mem.c']]], ['tds_5falloc_5fdynamic_1261',['tds_alloc_dynamic',['../a00562.html#ga69559de43b47f4a9e2eecc7a56527444',1,'tds_alloc_dynamic(TDSCONNECTION *conn, const char *id): mem.c'],['../a00562.html#ga69559de43b47f4a9e2eecc7a56527444',1,'tds_alloc_dynamic(TDSCONNECTION *conn, const char *id): mem.c']]], ['tds_5falloc_5fget_5fstring_1262',['tds_alloc_get_string',['../a00565.html#gafb26aba5d935e40b87b95e21a5185848',1,'token.c']]], ['tds_5falloc_5fparam_5fdata_1263',['tds_alloc_param_data',['../a00562.html#ga282d67682d293810625d87d566443c2d',1,'tds_alloc_param_data(TDSCOLUMN *curparam): mem.c'],['../a00562.html#ga282d67682d293810625d87d566443c2d',1,'tds_alloc_param_data(TDSCOLUMN *curparam): mem.c']]], ['tds_5falloc_5fparam_5fresult_1264',['tds_alloc_param_result',['../a00562.html#ga314c65c067570dc1ef3e58bbfc4eb763',1,'tds_alloc_param_result(TDSPARAMINFO *old_param): mem.c'],['../a00562.html#ga314c65c067570dc1ef3e58bbfc4eb763',1,'tds_alloc_param_result(TDSPARAMINFO *old_param): mem.c']]], ['tds_5falloc_5frow_1265',['tds_alloc_row',['../a00562.html#ga1224fb9277112dc2ce12531d2b73b145',1,'tds_alloc_row(TDSRESULTINFO *res_info): mem.c'],['../a00562.html#ga1224fb9277112dc2ce12531d2b73b145',1,'tds_alloc_row(TDSRESULTINFO *res_info): mem.c']]], ['tds_5fanswer_5fchallenge_1266',['tds_answer_challenge',['../a00558.html#ga8adf4e719762fef6fdb091d15d4d5d7f',1,'challenge.c']]], ['tds_5fascii_5fto_5fucs2_1267',['tds_ascii_to_ucs2',['../a00563.html#gad05fc65e1d505c68d14c82b99a00e4eb',1,'query.c']]], ['tds_5fbcp_5fdone_1268',['tds_bcp_done',['../a00239.html#ade7df2db455b61edc83819ad60edb339',1,'tds_bcp_done(TDSSOCKET *tds, int *rows_copied): bulk.c'],['../a00449.html#ade7df2db455b61edc83819ad60edb339',1,'tds_bcp_done(TDSSOCKET *tds, int *rows_copied): bulk.c']]], ['tds_5fbcp_5ffread_1269',['tds_bcp_fread',['../a00239.html#a86ac92bd8a3c61a413d27150ec9bc202',1,'tds_bcp_fread(TDSSOCKET *tds, TDSICONV *char_conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes): bulk.c'],['../a00449.html#a8184311543c685f2ee0bcccfb725ca02',1,'tds_bcp_fread(TDSSOCKET *tds, TDSICONV *conv, FILE *stream, const char *terminator, size_t term_len, char **outbuf, size_t *outbytes): bulk.c']]], ['tds_5fbcp_5finit_1270',['tds_bcp_init',['../a00239.html#ac6610c72bd31bad5378f760fa9b12d66',1,'tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c'],['../a00449.html#ac6610c72bd31bad5378f760fa9b12d66',1,'tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c']]], ['tds_5fbcp_5frow_5ffree_1271',['tds_bcp_row_free',['../a00239.html#a7c4f2b050cd1a747604aa305d6877de7',1,'bulk.c']]], ['tds_5fbcp_5fsend_5frecord_1272',['tds_bcp_send_record',['../a00239.html#ad9e44450025cbcee1ad81d7e5a2cc099',1,'tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset): bulk.c'],['../a00449.html#ad9e44450025cbcee1ad81d7e5a2cc099',1,'tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset): bulk.c']]], ['tds_5fbcp_5fstart_1273',['tds_bcp_start',['../a00239.html#a8208eef2a3974ae1f0cf3c8c8ab011ce',1,'tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c'],['../a00449.html#a8208eef2a3974ae1f0cf3c8c8ab011ce',1,'tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c']]], ['tds_5fbcp_5fstart_5fcopy_5fin_1274',['tds_bcp_start_copy_in',['../a00239.html#a5eec23828b0610c58de248c4edb53879',1,'tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c'],['../a00449.html#a5eec23828b0610c58de248c4edb53879',1,'tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo): bulk.c']]], ['tds_5fbcp_5fstart_5finsert_5fstmt_1275',['tds_bcp_start_insert_stmt',['../a00239.html#ab4d7e5309152f54613d52c8469a07fd8',1,'bulk.c']]], ['tds_5fcanonical_5fcharset_1276',['tds_canonical_charset',['../a00561.html#gac01180352db7052e786463e3b07a8a9e',1,'tds_canonical_charset(const char *charset_name): iconv.c'],['../a00561.html#gac01180352db7052e786463e3b07a8a9e',1,'tds_canonical_charset(const char *charset_name): iconv.c']]], ['tds_5fcanonical_5fcharset_5fname_1277',['tds_canonical_charset_name',['../a00561.html#ga6561d1dba1a04c168431b16ec17d7e4c',1,'tds_canonical_charset_name(const char *charset_name): iconv.c'],['../a00561.html#ga6561d1dba1a04c168431b16ec17d7e4c',1,'tds_canonical_charset_name(const char *charset_name): iconv.c']]], ['tds_5fclose_5fsocket_1278',['tds_close_socket',['../a00564.html#ga3e3f76009fce5ceedb2f42bb2c9aed2e',1,'tds_close_socket(TDSSOCKET *tds): net.c'],['../a00564.html#ga3e3f76009fce5ceedb2f42bb2c9aed2e',1,'tds_close_socket(TDSSOCKET *tds): net.c']]], ['tds_5fconfig_5fverstr_1279',['tds_config_verstr',['../a00559.html#gade94d7e89ba1f668c82be0b00a7f5cd7',1,'tds_config_verstr(const char *tdsver, TDSLOGIN *login): config.c'],['../a00559.html#gade94d7e89ba1f668c82be0b00a7f5cd7',1,'tds_config_verstr(const char *tdsver, TDSLOGIN *login): config.c']]], ['tds_5fconvert_1280',['tds_convert',['../a00560.html#gad83c146aa5ba3f1515557d6b5248494a',1,'tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr): convert.c'],['../a00560.html#gad83c146aa5ba3f1515557d6b5248494a',1,'tds_convert(const TDSCONTEXT *context, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr): convert.c']]], ['tds_5fconvert_5fstream_1281',['tds_convert_stream',['../a01415.html#a9d8eb43a81ff58ab423dce0ce95b9564',1,'stream.c']]], ['tds_5fconvert_5fstring_1282',['tds_convert_string',['../a00563.html#ga024bc5482366735070befd6f4af59f71',1,'tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len): query.c'],['../a00563.html#ga024bc5482366735070befd6f4af59f71',1,'tds_convert_string(TDSSOCKET *tds, TDSICONV *char_conv, const char *s, int len, size_t *out_len): query.c']]], ['tds_5fcopy_5fstream_1283',['tds_copy_stream',['../a01415.html#a50bc3749988d1c3c441044fc07ab44e4',1,'stream.c']]], ['tds_5fcount_5fplaceholders_1284',['tds_count_placeholders',['../a00563.html#gaaa7b4d37bf796019e72f25c6e7fe7bea',1,'tds_count_placeholders(const char *query): query.c'],['../a00563.html#gaaa7b4d37bf796019e72f25c6e7fe7bea',1,'tds_count_placeholders(const char *query): query.c']]], ['tds_5fcount_5fplaceholders_5fucs2le_1285',['tds_count_placeholders_ucs2le',['../a00563.html#ga0cd19215e9169ea299a6c9cbf5b2fb60',1,'query.c']]], ['tds_5fcursor_5fcheck_5fallocated_1286',['tds_cursor_check_allocated',['../a00563.html#ga2a64baaf4aa50ef601a49b801dfdaaf6',1,'query.c']]], ['tds_5fcursor_5fdealloc_1287',['tds_cursor_dealloc',['../a00563.html#gab25de0567ac096e8f8e88490eeddf562',1,'tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor): query.c'],['../a00563.html#gab25de0567ac096e8f8e88490eeddf562',1,'tds_cursor_dealloc(TDSSOCKET *tds, TDSCURSOR *cursor): query.c']]], ['tds_5fdatain_5fstream_5finit_1288',['tds_datain_stream_init',['../a01415.html#abc3a77c8aa28842e7f28583cbabc1415',1,'stream.c']]], ['tds_5fdatain_5fstream_5fread_1289',['tds_datain_stream_read',['../a01415.html#a04b537d889f7d4c9b9701eb81baf7efd',1,'stream.c']]], ['tds_5fdataout_5fstream_5finit_1290',['tds_dataout_stream_init',['../a01415.html#aa038a9125979f8f0915dbd53cbf27e5a',1,'stream.c']]], ['tds_5fdataout_5fstream_5fwrite_1291',['tds_dataout_stream_write',['../a01415.html#ae38a590ee08cf398e7adef536ac94538',1,'stream.c']]], ['tds_5fdatecrack_1292',['tds_datecrack',['../a00560.html#ga883855e6e3793de6684b21db39c756c4',1,'tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr): convert.c'],['../a00560.html#ga883855e6e3793de6684b21db39c756c4',1,'tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC *dr): convert.c']]], ['tds_5fdeferred_5fcursor_5fdealloc_1293',['tds_deferred_cursor_dealloc',['../a00563.html#ga57bd0fabe5bcdeb3ef091259b3a7c1fc',1,'tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor): query.c'],['../a00563.html#ga57bd0fabe5bcdeb3ef091259b3a7c1fc',1,'tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR *cursor): query.c']]], ['tds_5fdeferred_5funprepare_1294',['tds_deferred_unprepare',['../a00563.html#ga9f80fdf732b084aef7de7a323261aa61',1,'tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c'],['../a00563.html#ga9f80fdf732b084aef7de7a323261aa61',1,'tds_deferred_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c']]], ['tds_5fdetach_5fresults_1295',['tds_detach_results',['../a00562.html#ga1d60bf443e274797b1d1a9e7418ab962',1,'tds_detach_results(TDSRESULTINFO *info): mem.c'],['../a00562.html#ga1d60bf443e274797b1d1a9e7418ab962',1,'tds_detach_results(TDSRESULTINFO *info): mem.c']]], ['tds_5fdstr_5falloc_1296',['tds_dstr_alloc',['../a00566.html#ga6aa14b8b717b51afcfb65bd55143689d',1,'tdsstring.c']]], ['tds_5fdstr_5fbuf_1297',['tds_dstr_buf',['../a00566.html#ga8fa35e3ff06ef0b7d0d642cf50282ab8',1,'string.h']]], ['tds_5fdstr_5fcopy_1298',['tds_dstr_copy',['../a00566.html#gad96366d9fa93bfc283cef1299fbe97ab',1,'tdsstring.c']]], ['tds_5fdstr_5fcopyn_1299',['tds_dstr_copyn',['../a00566.html#ga656718f240d7403f986ae887d84a6ca1',1,'tdsstring.c']]], ['tds_5fdstr_5fcstr_1300',['tds_dstr_cstr',['../a00566.html#ga5f351a208e7aa13b4cc2d32cac8fc0fa',1,'string.h']]], ['tds_5fdstr_5fdup_1301',['tds_dstr_dup',['../a00566.html#ga4e6d9fa6f9b9551a5a3390e10a5322e6',1,'tdsstring.c']]], ['tds_5fdstr_5ffree_1302',['tds_dstr_free',['../a00566.html#gaccd1c1c8ff938813578123963212388c',1,'tdsstring.c']]], ['tds_5fdstr_5fget_1303',['tds_dstr_get',['../a00564.html#gafae08056186b143f3ef1399307dc9be7',1,'tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len): read.c'],['../a00564.html#gafae08056186b143f3ef1399307dc9be7',1,'tds_dstr_get(TDSSOCKET *tds, DSTR *s, size_t len): read.c']]], ['tds_5fdstr_5finit_1304',['tds_dstr_init',['../a00566.html#ga6c0aba5c6da921898768e7f6cf177ca7',1,'string.h']]], ['tds_5fdstr_5fisempty_1305',['tds_dstr_isempty',['../a00566.html#ga197c6af67f2e7469d06c2aa055917b1e',1,'string.h']]], ['tds_5fdstr_5flen_1306',['tds_dstr_len',['../a00566.html#ga396f139e4f886ac1b224a735138e73dd',1,'string.h']]], ['tds_5fdstr_5fset_1307',['tds_dstr_set',['../a00566.html#gab78cc59b110df2817b00f9bed74c6ff1',1,'tdsstring.c']]], ['tds_5fdstr_5fsetlen_1308',['tds_dstr_setlen',['../a00566.html#ga0cd7863ba7c2d2da4a193234472a3d14',1,'tdsstring.c']]], ['tds_5fdstr_5fzero_1309',['tds_dstr_zero',['../a00566.html#ga339ba30216e2bd5bd076aa9dcd26f3c4',1,'tdsstring.c']]], ['tds_5fdynamic_5fstream_5finit_1310',['tds_dynamic_stream_init',['../a01415.html#a4f9e40da6941cb9407d0da5bc3030517',1,'stream.c']]], ['tds_5fdynamic_5fstream_5fwrite_1311',['tds_dynamic_stream_write',['../a01415.html#abaf688c85ea04a2392103d519a55d04e',1,'stream.c']]], ['tds_5ffile_5fstream_5fread_1312',['tds_file_stream_read',['../a00239.html#a1b83c9db016b481aa1fa0352f976d50d',1,'bulk.c']]], ['tds_5ffix_5fcolumn_5fsize_1313',['tds_fix_column_size',['../a00563.html#ga440f0f469afad1eac4c008979873ccdd',1,'tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol): query.c'],['../a00563.html#ga440f0f469afad1eac4c008979873ccdd',1,'tds_fix_column_size(TDSSOCKET *tds, TDSCOLUMN *curcol): query.c']]], ['tds_5ffix_5flogin_1314',['tds_fix_login',['../a00559.html#gacee4f06ba749b10ee9f2e5bb1c4a8910',1,'tds_fix_login(TDSLOGIN *login): config.c'],['../a00559.html#gacee4f06ba749b10ee9f2e5bb1c4a8910',1,'tds_fix_login(TDSLOGIN *login): config.c']]], ['tds_5fflush_5fpacket_1315',['tds_flush_packet',['../a00564.html#ga5feb53554e8917a81bbbc332163a61fb',1,'tds_flush_packet(TDSSOCKET *tds): write.c'],['../a00564.html#ga5feb53554e8917a81bbbc332163a61fb',1,'tds_flush_packet(TDSSOCKET *tds): write.c']]], ['tds_5ffree_5finput_5fparams_1316',['tds_free_input_params',['../a00562.html#gabdc5fee73b22345c02ab894e49ad7f95',1,'tds_free_input_params(TDSDYNAMIC *dyn): mem.c'],['../a00562.html#gabdc5fee73b22345c02ab894e49ad7f95',1,'tds_free_input_params(TDSDYNAMIC *dyn): mem.c']]], ['tds_5ffree_5fnamelist_1317',['tds_free_namelist',['../a00565.html#ga21e9de33de9c8c492aa2f96c823596bb',1,'token.c']]], ['tds_5ffree_5fparam_5fresult_1318',['tds_free_param_result',['../a00562.html#ga66cd6e3c5089ced9415a8a0e258d205a',1,'tds_free_param_result(TDSPARAMINFO *param_info): mem.c'],['../a00562.html#ga66cd6e3c5089ced9415a8a0e258d205a',1,'tds_free_param_result(TDSPARAMINFO *param_info): mem.c']]], ['tds_5ffreeze_1319',['tds_freeze',['../a00564.html#ga6b2b012b999bd0a4f159fabc8d11a5bf',1,'tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len): packet.c'],['../a00564.html#ga6b2b012b999bd0a4f159fabc8d11a5bf',1,'tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len): packet.c']]], ['tds_5ffreeze_5fabort_1320',['tds_freeze_abort',['../a00564.html#ga7274d9c5dc75c58bb7d1f1c29e03a73e',1,'tds_freeze_abort(TDSFREEZE *freeze): packet.c'],['../a00564.html#ga7274d9c5dc75c58bb7d1f1c29e03a73e',1,'tds_freeze_abort(TDSFREEZE *freeze): packet.c']]], ['tds_5ffreeze_5fclose_1321',['tds_freeze_close',['../a00564.html#ga633f62fb8e5310abfa42c02fba9c6500',1,'tds_freeze_close(TDSFREEZE *freeze): packet.c'],['../a00564.html#ga633f62fb8e5310abfa42c02fba9c6500',1,'tds_freeze_close(TDSFREEZE *freeze): packet.c']]], ['tds_5ffreeze_5fclose_5flen_1322',['tds_freeze_close_len',['../a00564.html#ga2660b893ae2bf36fe1b63b354e748bad',1,'tds_freeze_close_len(TDSFREEZE *freeze, int32_t size): packet.c'],['../a00564.html#ga2660b893ae2bf36fe1b63b354e748bad',1,'tds_freeze_close_len(TDSFREEZE *freeze, int32_t size): packet.c']]], ['tds_5ffreeze_5fwritten_1323',['tds_freeze_written',['../a00564.html#ga528cc96da09c11bc2930daae64e33e83',1,'tds_freeze_written(TDSFREEZE *freeze): packet.c'],['../a00564.html#ga528cc96da09c11bc2930daae64e33e83',1,'tds_freeze_written(TDSFREEZE *freeze): packet.c']]], ['tds_5fgeneric_5fget_1324',['tds_generic_get',['../a00248.html#abac4d689e0e31e80587f89247c6395a4',1,'data.c']]], ['tds_5fgeneric_5fput_1325',['tds_generic_put',['../a00248.html#a84e17808683ba2dd956e811a42e23176',1,'data.c']]], ['tds_5fgeneric_5fput_5finfo_1326',['tds_generic_put_info',['../a00248.html#aabd0e5f15615b5c141c525b76e746520',1,'data.c']]], ['tds_5fget_5fbyte_1327',['tds_get_byte',['../a00564.html#ga0cb72d3f6943795c39db1fa692be0a58',1,'tds_get_byte(TDSSOCKET *tds): read.c'],['../a00564.html#ga0cb72d3f6943795c39db1fa692be0a58',1,'tds_get_byte(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fchar_5fdata_1328',['tds_get_char_data',['../a00564.html#ga8d214089b6e97fc0da5e0be09f216d73',1,'tds_get_char_data(TDSSOCKET *tds, char *row_buffer, size_t wire_size, TDSCOLUMN *curcol): read.c'],['../a00564.html#ga8d214089b6e97fc0da5e0be09f216d73',1,'tds_get_char_data(TDSSOCKET *tds, char *dest, size_t wire_size, TDSCOLUMN *curcol): read.c']]], ['tds_5fget_5fcolumn_5fdeclaration_1329',['tds_get_column_declaration',['../a00563.html#ga50d62edeb2a432e2dc668263f3f958ff',1,'tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out): query.c'],['../a00563.html#ga50d62edeb2a432e2dc668263f3f958ff',1,'tds_get_column_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol, char *out): query.c']]], ['tds_5fget_5fcompiletime_5fsettings_1330',['tds_get_compiletime_settings',['../a00559.html#ga860690ac47a80f74c83b25cbd8d7703d',1,'tds_get_compiletime_settings(void): config.c'],['../a00559.html#ga860690ac47a80f74c83b25cbd8d7703d',1,'tds_get_compiletime_settings(void): config.c']]], ['tds_5fget_5fconversion_5ftype_1331',['tds_get_conversion_type',['../a00449.html#a0383d5dcb629582266a442f0f0dbd13a',1,'tds_types.h']]], ['tds_5fget_5fdata_5finfo_1332',['tds_get_data_info',['../a00565.html#gad9b6b86f48be077fb44ac603845a0c27',1,'token.c']]], ['tds_5fget_5fdynid_1333',['tds_get_dynid',['../a00562.html#ga501af7e6186e59c257729599a044a30b',1,'mem.c']]], ['tds_5fget_5fhome_5ffile_1334',['tds_get_home_file',['../a00559.html#ga606b41d6d4d613d9581c61aa74c8211d',1,'tds_get_home_file(const char *file): config.c'],['../a00559.html#ga606b41d6d4d613d9581c61aa74c8211d',1,'tds_get_home_file(const char *file): config.c']]], ['tds_5fget_5flocale_1335',['tds_get_locale',['../a00449.html#af43163dc067b230b2236a619a067c675',1,'locale.c']]], ['tds_5fget_5fn_1336',['tds_get_n',['../a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf',1,'tds_get_n(TDSSOCKET *tds, void *dest, size_t need): read.c'],['../a00564.html#gae777dd57e8d1bb40349d7d7d8434fddf',1,'tds_get_n(TDSSOCKET *tds, void *dest, size_t n): read.c']]], ['tds_5fget_5fnull_5ftype_1337',['tds_get_null_type',['../a00560.html#ga68e3a76fd7b0a77614765826a8ab5be8',1,'tds_get_null_type(TDS_SERVER_TYPE srctype): convert.c'],['../a00560.html#ga68e3a76fd7b0a77614765826a8ab5be8',1,'tds_get_null_type(TDS_SERVER_TYPE srctype): convert.c']]], ['tds_5fget_5fsize_5fby_5ftype_1338',['tds_get_size_by_type',['../a00449.html#a4c070147d189dede5e08a2dc66852678',1,'tds_types.h']]], ['tds_5fget_5fsocket_5ferror_1339',['tds_get_socket_error',['../a00564.html#ga4a2418e0a4533d616ef3da526236f2b8',1,'net.c']]], ['tds_5fget_5fstring_1340',['tds_get_string',['../a00564.html#ga90f080e6e9448feac15dee1370d66802',1,'tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size): read.c'],['../a00564.html#ga90f080e6e9448feac15dee1370d66802',1,'tds_get_string(TDSSOCKET *tds, size_t string_len, char *dest, size_t dest_size): read.c']]], ['tds_5fget_5ftoken_5fsize_1341',['tds_get_token_size',['../a00565.html#ga995b82e53aeac5bede01ef16e9aeaa65',1,'tds_get_token_size(int marker): token.c'],['../a00565.html#ga995b82e53aeac5bede01ef16e9aeaa65',1,'tds_get_token_size(int marker): token.c']]], ['tds_5fget_5fuint_1342',['tds_get_uint',['../a00564.html#ga9ac121c269e203337a48c5bf8afc48c3',1,'tds_get_uint(TDSSOCKET *tds): read.c'],['../a00564.html#ga9ac121c269e203337a48c5bf8afc48c3',1,'tds_get_uint(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fuint8_1343',['tds_get_uint8',['../a00564.html#ga8ab6c87318eaf15ea17a9575763f7809',1,'tds_get_uint8(TDSSOCKET *tds): read.c'],['../a00564.html#ga8ab6c87318eaf15ea17a9575763f7809',1,'tds_get_uint8(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fusmallint_1344',['tds_get_usmallint',['../a00564.html#gad38aa5b9547817854ccba1fcc7855861',1,'tds_get_usmallint(TDSSOCKET *tds): read.c'],['../a00564.html#gad38aa5b9547817854ccba1fcc7855861',1,'tds_get_usmallint(TDSSOCKET *tds): read.c']]], ['tds_5fget_5fvarint_5fsize_1345',['tds_get_varint_size',['../a00449.html#a68855f1251759a6b7338635306ab0041',1,'tds_types.h']]], ['tds_5fgoodread_1346',['tds_goodread',['../a00564.html#ga6f2ae00407f59fb1ab280fa44a56295e',1,'tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen): net.c'],['../a00564.html#ga6f2ae00407f59fb1ab280fa44a56295e',1,'tds_goodread(TDSSOCKET *tds, unsigned char *buf, int buflen): net.c']]], ['tds_5fgoodwrite_1347',['tds_goodwrite',['../a00564.html#ga2734407109c834c5dda7ff8a45c71230',1,'tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen): net.c'],['../a00564.html#ga2734407109c834c5dda7ff8a45c71230',1,'tds_goodwrite(TDSSOCKET *tds, const unsigned char *buffer, size_t buflen): net.c']]], ['tds_5ficonv_1348',['tds_iconv',['../a00561.html#ga87db49044919f1bc84c0ff5e9ab00304',1,'tds_iconv(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft): iconv.c'],['../a00561.html#ga87db49044919f1bc84c0ff5e9ab00304',1,'tds_iconv(TDSSOCKET *tds, TDSICONV *char_conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft): iconv.c']]], ['tds_5ficonv_5falloc_1349',['tds_iconv_alloc',['../a01427.html#a026957dbbd994b48b571a63405f427cd',1,'tds_iconv_alloc(TDSCONNECTION *conn): iconv.c'],['../a00449.html#a026957dbbd994b48b571a63405f427cd',1,'tds_iconv_alloc(TDSCONNECTION *conn): iconv.c']]], ['tds_5ficonv_5ffrom_5fcollate_1350',['tds_iconv_from_collate',['../a00561.html#gaed775f7fcca42b5c2a53f9508c140259',1,'tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5]): iconv.c'],['../a00561.html#gaed775f7fcca42b5c2a53f9508c140259',1,'tds_iconv_from_collate(TDSCONNECTION *conn, TDS_UCHAR collate[5]): iconv.c']]], ['tds_5ficonv_5fget_5finfo_1351',['tds_iconv_get_info',['../a00561.html#gab95825efc9a876b0a7ce77f126cf3fc1',1,'tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server): iconv.c'],['../a00561.html#gab95825efc9a876b0a7ce77f126cf3fc1',1,'tds_iconv_get_info(TDSCONNECTION *conn, int canonic_client, int canonic_server): iconv.c']]], ['tds_5ficonv_5finfo_5finit_1352',['tds_iconv_info_init',['../a00561.html#ga3a7a7b4d6ed344127e164dd0b443d790',1,'iconv.c']]], ['tds_5ficonv_5finit_1353',['tds_iconv_init',['../a01427.html#a89de4d12be43b135ad355236717e9cbb',1,'iconv.c']]], ['tds_5finit_5flogin_1354',['tds_init_login',['../a00562.html#ga2ef389ac3b0cddec76bf8f1c0951bc9c',1,'tds_init_login(TDSLOGIN *login, TDSLOCALE *locale): mem.c'],['../a00562.html#ga2ef389ac3b0cddec76bf8f1c0951bc9c',1,'tds_init_login(TDSLOGIN *login, TDSLOCALE *locale): mem.c']]], ['tds_5flookup_5fdynamic_1355',['tds_lookup_dynamic',['../a00565.html#ga595fe391e60a71bd98ffd53b4c015e44',1,'tds_lookup_dynamic(TDSCONNECTION *conn, const char *id): token.c'],['../a00565.html#ga595fe391e60a71bd98ffd53b4c015e44',1,'tds_lookup_dynamic(TDSCONNECTION *conn, const char *id): token.c']]], ['tds_5flookup_5fhost_1356',['tds_lookup_host',['../a00559.html#gaa17936ef93e1c68833c4aab769bd90d9',1,'tds_lookup_host(const char *servername): config.c'],['../a00559.html#gaa17936ef93e1c68833c4aab769bd90d9',1,'tds_lookup_host(const char *servername): config.c']]], ['tds_5flookup_5fport_1357',['tds_lookup_port',['../a00559.html#ga45281d1cb2ac649db65d80bb3ff06b66',1,'config.c']]], ['tds_5fneeds_5funprepare_1358',['tds_needs_unprepare',['../a00563.html#ga05ac7bab753d19b6ba1ffc7505d8fcd0',1,'tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c'],['../a00563.html#ga05ac7bab753d19b6ba1ffc7505d8fcd0',1,'tds_needs_unprepare(TDSCONNECTION *conn, TDSDYNAMIC *dyn): query.c']]], ['tds_5fnext_5fplaceholder_1359',['tds_next_placeholder',['../a00563.html#ga6455b2991afbf7da90270787f2059d31',1,'tds_next_placeholder(const char *start): query.c'],['../a00563.html#ga6455b2991afbf7da90270787f2059d31',1,'tds_next_placeholder(const char *start): query.c']]], ['tds_5fnext_5fplaceholder_5fucs2le_1360',['tds_next_placeholder_ucs2le',['../a00563.html#gaa823973b74efdf1ff00f340496bff614',1,'query.c']]], ['tds_5fntlm_5fget_5fauth_1361',['tds_ntlm_get_auth',['../a00558.html#ga679f2d22b4a4bdefe0fa475d63503778',1,'tds_ntlm_get_auth(TDSSOCKET *tds): challenge.c'],['../a00558.html#ga679f2d22b4a4bdefe0fa475d63503778',1,'tds_ntlm_get_auth(TDSSOCKET *tds): challenge.c']]], ['tds_5fnumeric_5fto_5fstring_1362',['tds_numeric_to_string',['../a00449.html#a622da936832b0337742da956be123719',1,'numeric.c']]], ['tds_5fpeek_1363',['tds_peek',['../a00564.html#ga221e98a9c8be96ec6c8547891e1b53af',1,'tds_peek(TDSSOCKET *tds): read.c'],['../a00564.html#ga221e98a9c8be96ec6c8547891e1b53af',1,'tds_peek(TDSSOCKET *tds): read.c']]], ['tds_5fpr_5fop_1364',['tds_pr_op',['../a00565.html#ga62dc14d21453e88e24880ee0acaca73a',1,'token.c']]], ['tds_5fprdatatype_1365',['tds_prdatatype',['../a00080.html#ac7a199aaeb82935f6d1dda2be551a089',1,'dblib.c']]], ['tds_5fprocess_5fauth_1366',['tds_process_auth',['../a00565.html#ga4e1e52e09b0c27a9b9f53eb6b539afce',1,'token.c']]], ['tds_5fprocess_5fcancel_1367',['tds_process_cancel',['../a00565.html#gaf233e79967f82f4e0dd4d11524917a34',1,'tds_process_cancel(TDSSOCKET *tds): token.c'],['../a00565.html#gaf233e79967f82f4e0dd4d11524917a34',1,'tds_process_cancel(TDSSOCKET *tds): token.c']]], ['tds_5fprocess_5fcol_5ffmt_1368',['tds_process_col_fmt',['../a00565.html#ga4e3dd9d3614f5f0433b78b761dd68741',1,'token.c']]], ['tds_5fprocess_5fcol_5fname_1369',['tds_process_col_name',['../a00565.html#ga905d2fa5e1b602817bd16bb0fcf9eadb',1,'token.c']]], ['tds_5fprocess_5fcolinfo_1370',['tds_process_colinfo',['../a00565.html#ga22c7f413d43fc0d511e122a3de389166',1,'token.c']]], ['tds_5fprocess_5fcompute_1371',['tds_process_compute',['../a00565.html#ga6fcb37d5addebdc1af9f34ebc59fd7a8',1,'token.c']]], ['tds_5fprocess_5fcompute_5fnames_1372',['tds_process_compute_names',['../a00565.html#gae5b3e01f3d665f9e377de091f46f1ab9',1,'token.c']]], ['tds_5fprocess_5fcompute_5fresult_1373',['tds_process_compute_result',['../a00565.html#gae3368ea80d0d8b13791ceb13ee5f19c9',1,'token.c']]], ['tds_5fprocess_5fcursor_5ftokens_1374',['tds_process_cursor_tokens',['../a00565.html#ga315d875d90c64d12d61fc9e33b4dee96',1,'token.c']]], ['tds_5fprocess_5fdefault_5ftokens_1375',['tds_process_default_tokens',['../a00565.html#ga39453d084f3f780ac4602d4abf2839f7',1,'token.c']]], ['tds_5fprocess_5fdyn_5fresult_1376',['tds_process_dyn_result',['../a00565.html#ga416cf119c1d4a0fca27dc5b50c261358',1,'token.c']]], ['tds_5fprocess_5fdynamic_1377',['tds_process_dynamic',['../a00565.html#ga5cfc0340d8d717e67f60037e029b2142',1,'token.c']]], ['tds_5fprocess_5fend_1378',['tds_process_end',['../a00565.html#ga7a081cf9bb8f04ead12f0299fb7c4cd9',1,'token.c']]], ['tds_5fprocess_5fenv_5fchg_1379',['tds_process_env_chg',['../a00565.html#ga3e1b4df4410a86a563a8c155e7799720',1,'token.c']]], ['tds_5fprocess_5finfo_1380',['tds_process_info',['../a00565.html#ga65a2316369529731732f200c190d05d6',1,'token.c']]], ['tds_5fprocess_5flogin_5ftokens_1381',['tds_process_login_tokens',['../a00565.html#ga93945b42d45ee28ae1296b35a1c1e9bb',1,'tds_process_login_tokens(TDSSOCKET *tds): token.c'],['../a00565.html#ga93945b42d45ee28ae1296b35a1c1e9bb',1,'tds_process_login_tokens(TDSSOCKET *tds): token.c']]], ['tds_5fprocess_5fnbcrow_1382',['tds_process_nbcrow',['../a00565.html#gaf7264c9eb3aa7a73358a4c65f02d3d3c',1,'token.c']]], ['tds_5fprocess_5fparam_5fresult_1383',['tds_process_param_result',['../a00565.html#gacb3354443bcefe7a500a500a4904cc05',1,'token.c']]], ['tds_5fprocess_5fparam_5fresult_5ftokens_1384',['tds_process_param_result_tokens',['../a00565.html#ga9fdef8228d29cab7fa9098f07fa73fba',1,'token.c']]], ['tds_5fprocess_5fparams_5fresult_5ftoken_1385',['tds_process_params_result_token',['../a00565.html#ga7b18c0911a9dc69939577b39eb64725d',1,'token.c']]], ['tds_5fprocess_5fpending_5fcloses_1386',['tds_process_pending_closes',['../a00565.html#ga69902dffb299d62a799888e0fa3ccd68',1,'token.c']]], ['tds_5fprocess_5frow_1387',['tds_process_row',['../a00565.html#gaad814dd6e35aee8332035d06dc8b5d65',1,'token.c']]], ['tds_5fprocess_5fsimple_5fquery_1388',['tds_process_simple_query',['../a00565.html#gaeeb1562044786ea17bea361ed83e6946',1,'tds_process_simple_query(TDSSOCKET *tds): token.c'],['../a00565.html#gaeeb1562044786ea17bea361ed83e6946',1,'tds_process_simple_query(TDSSOCKET *tds): token.c']]], ['tds_5fprocess_5ftabname_1389',['tds_process_tabname',['../a00565.html#gaeec59bca9bd0c5388e245f0d19d9c81a',1,'token.c']]], ['tds_5fprocess_5ftokens_1390',['tds_process_tokens',['../a00565.html#gabfc9de1d1fe718818caf63a4be4035a6',1,'tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag): token.c'],['../a00565.html#gabfc9de1d1fe718818caf63a4be4035a6',1,'tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag): token.c']]], ['tds_5fprtype_1391',['tds_prtype',['../a00565.html#ga0cf7e719115b0ae476753442d10505ab',1,'tds_prtype(int type): token.c'],['../a00565.html#ga0cf7e719115b0ae476753442d10505ab',1,'tds_prtype(int token): token.c']]], ['tds_5fput_5fdata_1392',['tds_put_data',['../a00563.html#ga9fcc0a3932dcad530511395ef8a767fb',1,'query.c']]], ['tds_5fput_5fdata_5finfo_1393',['tds_put_data_info',['../a00563.html#gafd74652c4722ddce4d642cc4209449d4',1,'query.c']]], ['tds_5fput_5fparam_5fas_5fstring_1394',['tds_put_param_as_string',['../a00563.html#ga0e2e7230c425e925402d7856ff5b4b18',1,'query.c']]], ['tds_5fput_5fstring_1395',['tds_put_string',['../a00564.html#ga1fcaf8d488cc1390f106ce3ad0bf37b4',1,'tds_put_string(TDSSOCKET *tds, const char *s, int len): write.c'],['../a00564.html#ga1fcaf8d488cc1390f106ce3ad0bf37b4',1,'tds_put_string(TDSSOCKET *tds, const char *buf, int len): write.c']]], ['tds_5fquery_5fflush_5fpacket_1396',['tds_query_flush_packet',['../a00563.html#gada27f4cfce925240ad33b71b63ca692d',1,'query.c']]], ['tds_5fquote_1397',['tds_quote',['../a00563.html#ga7efaa23c3b21158ffc963f85fbc3fdf4',1,'query.c']]], ['tds_5fquote_5fand_5fput_1398',['tds_quote_and_put',['../a00563.html#ga26b26296d060dca75f6a43e9ac41e58d',1,'query.c']]], ['tds_5fquote_5fid_1399',['tds_quote_id',['../a00563.html#ga8d8f2f1c91635ee95f30722208ae3043',1,'tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c'],['../a00563.html#ga8d8f2f1c91635ee95f30722208ae3043',1,'tds_quote_id(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c']]], ['tds_5fquote_5fid_5frpc_1400',['tds_quote_id_rpc',['../a00563.html#ga691e8752f4f84ed51b7f4d1447cb3d25',1,'tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c'],['../a00563.html#ga691e8752f4f84ed51b7f4d1447cb3d25',1,'tds_quote_id_rpc(TDSSOCKET *tds, char *buffer, const char *id, int idlen): query.c']]], ['tds_5fquote_5fstring_1401',['tds_quote_string',['../a00563.html#ga737b9fb9971fb425af5c722415ef0eac',1,'tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len): query.c'],['../a00563.html#ga737b9fb9971fb425af5c722415ef0eac',1,'tds_quote_string(TDSSOCKET *tds, char *buffer, const char *str, int len): query.c']]], ['tds_5fread_5fconf_5ffile_1402',['tds_read_conf_file',['../a00559.html#ga4799b423b5d982dbc8f31b7738255eef',1,'tds_read_conf_file(TDSLOGIN *login, const char *server): config.c'],['../a00559.html#ga4799b423b5d982dbc8f31b7738255eef',1,'tds_read_conf_file(TDSLOGIN *login, const char *server): config.c']]], ['tds_5fread_5fconf_5fsection_1403',['tds_read_conf_section',['../a00559.html#ga44fdbe16827097d947f900d96003de98',1,'tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param): config.c'],['../a00559.html#ga44fdbe16827097d947f900d96003de98',1,'tds_read_conf_section(FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param): config.c']]], ['tds_5fread_5fconfig_5finfo_1404',['tds_read_config_info',['../a00559.html#ga9af192306186ddf39e09be0fd4ad8aaf',1,'tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale): config.c'],['../a00559.html#ga9af192306186ddf39e09be0fd4ad8aaf',1,'tds_read_config_info(TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale): config.c']]], ['tds_5fread_5finterfaces_1405',['tds_read_interfaces',['../a00559.html#ga6631af35ee817f93827c62bbda41674a',1,'config.c']]], ['tds_5fread_5fnamelist_1406',['tds_read_namelist',['../a00565.html#gaeaaed2ea1d8c827da1a0f5b419524ae1',1,'token.c']]], ['tds_5fread_5fpacket_1407',['tds_read_packet',['../a00564.html#ga410619783bdf2bb60b0f27a5578e0e07',1,'tds_read_packet(TDSSOCKET *tds): packet.c'],['../a00564.html#ga410619783bdf2bb60b0f27a5578e0e07',1,'tds_read_packet(TDSSOCKET *tds): packet.c']]], ['tds_5frealloc_1408',['tds_realloc',['../a00562.html#ga924cb9fb5d19dbd308ba0ce8c1a8a1d5',1,'tds_realloc(void **pp, size_t new_size): mem.c'],['../a00562.html#ga924cb9fb5d19dbd308ba0ce8c1a8a1d5',1,'tds_realloc(void **pp, size_t new_size): mem.c']]], ['tds_5frelease_5fdynamic_1409',['tds_release_dynamic',['../a00562.html#gabf2fdb0def5388508602ee7dd2f49506',1,'tds_release_dynamic(TDSDYNAMIC **pdyn): mem.c'],['../a00562.html#gabf2fdb0def5388508602ee7dd2f49506',1,'tds_release_dynamic(TDSDYNAMIC **dyn): mem.c']]], ['tds_5fselect_1410',['tds_select',['../a00564.html#gad7aae89e32444ab30852fee056231403',1,'tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds): net.c'],['../a00564.html#gad7aae89e32444ab30852fee056231403',1,'tds_select(TDSSOCKET *tds, unsigned tds_sel, int timeout_seconds): net.c']]], ['tds_5fsend_5fcancel_1411',['tds_send_cancel',['../a00563.html#ga11338742dc30fd0c2711f58eb830316f',1,'tds_send_cancel(TDSSOCKET *tds): query.c'],['../a00563.html#ga11338742dc30fd0c2711f58eb830316f',1,'tds_send_cancel(TDSSOCKET *tds): query.c']]], ['tds_5fsend_5femulated_5fexecute_1412',['tds_send_emulated_execute',['../a00563.html#ga02c6ce3ff96369603a6ee4efee64caae',1,'query.c']]], ['tds_5fset_5fcolumn_5ftype_1413',['tds_set_column_type',['../a00248.html#a31604382d8b77257aad203f409155a29',1,'tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c'],['../a00449.html#a31604382d8b77257aad203f409155a29',1,'tds_set_column_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c']]], ['tds_5fset_5fcur_5fcursor_1414',['tds_set_cur_cursor',['../a00563.html#ga34fb1084682cc31fe02a4a7946955a5a',1,'query.c']]], ['tds_5fset_5fcur_5fdyn_1415',['tds_set_cur_dyn',['../a00563.html#gae8b7db85af16701fc0604eb117cbd4e4',1,'tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c'],['../a00563.html#gae8b7db85af16701fc0604eb117cbd4e4',1,'tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c']]], ['tds_5fset_5ficonv_5fname_1416',['tds_set_iconv_name',['../a01427.html#a010ab1d181c8996f6a5984c9900eca6b',1,'iconv.c']]], ['tds_5fset_5finterfaces_5ffile_5floc_1417',['tds_set_interfaces_file_loc',['../a00559.html#ga57cea6e376d7c2d28b811a5b0053210c',1,'tds_set_interfaces_file_loc(const char *interf): config.c'],['../a00559.html#ga57cea6e376d7c2d28b811a5b0053210c',1,'tds_set_interfaces_file_loc(const char *interfloc): config.c']]], ['tds_5fset_5fparam_5ftype_1418',['tds_set_param_type',['../a00248.html#a86768d86059c5addf9a3f89edb1ef44e',1,'tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c'],['../a00449.html#a86768d86059c5addf9a3f89edb1ef44e',1,'tds_set_param_type(TDSCONNECTION *conn, TDSCOLUMN *curcol, TDS_SERVER_TYPE type): data.c']]], ['tds_5fset_5fserver_1419',['tds_set_server',['../a00449.html#a3ab8874994a0776acdaff797afdb710a',1,'login.c']]], ['tds_5fset_5fstate_1420',['tds_set_state',['../a00449.html#a16db200d2281f76fe46fc1cbe37ca9df',1,'util.c']]], ['tds_5fsetup_5fsocket_1421',['tds_setup_socket',['../a00564.html#gab604dd1d75afa8f852d1a6ee0b681974',1,'net.c']]], ['tds_5fskip_5fcomment_1422',['tds_skip_comment',['../a00563.html#gaac7347ba9380d77d726648b85e9fab8f',1,'tds_skip_comment(const char *s): query.c'],['../a00563.html#gaac7347ba9380d77d726648b85e9fab8f',1,'tds_skip_comment(const char *s): query.c']]], ['tds_5fskip_5fcomment_5fucs2le_1423',['tds_skip_comment_ucs2le',['../a00563.html#gab304fda9f325e852ba5c5252079d22e3',1,'query.c']]], ['tds_5fskip_5fquoted_1424',['tds_skip_quoted',['../a00563.html#ga5dbe51ce9533218f2da23f69ff63dda4',1,'tds_skip_quoted(const char *s): query.c'],['../a00563.html#ga5dbe51ce9533218f2da23f69ff63dda4',1,'tds_skip_quoted(const char *s): query.c']]], ['tds_5fskip_5fquoted_5fucs2le_1425',['tds_skip_quoted_ucs2le',['../a00563.html#ga2361ec4629aa0eac38f1702b03ed8185',1,'query.c']]], ['tds_5fsocket_5fread_1426',['tds_socket_read',['../a00564.html#ga8560e2536fdcf8f1514d4fa14f90876c',1,'net.c']]], ['tds_5fsocket_5fset_5fnonblocking_1427',['tds_socket_set_nonblocking',['../a00564.html#ga2a7429ff031f77023d1bf31339a266db',1,'tds_socket_set_nonblocking(TDS_SYS_SOCKET sock): net.c'],['../a00564.html#ga2a7429ff031f77023d1bf31339a266db',1,'tds_socket_set_nonblocking(TDS_SYS_SOCKET sock): net.c']]], ['tds_5fsocket_5fset_5fnosigpipe_1428',['tds_socket_set_nosigpipe',['../a00564.html#gae36a2665a4183b4cb211d03e907112ee',1,'tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on): net.c'],['../a00564.html#gae36a2665a4183b4cb211d03e907112ee',1,'tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on): net.c']]], ['tds_5fsocket_5fwrite_1429',['tds_socket_write',['../a00564.html#gad6f81b48fbcfc18ce0b213dbbea47e30',1,'net.c']]], ['tds_5fstart_5fquery_1430',['tds_start_query',['../a00563.html#ga0da385231bfa3dc49377e1fb2bea2c07',1,'tds_start_query(TDSSOCKET *tds, unsigned char packet_type): query.c'],['../a00563.html#ga0da385231bfa3dc49377e1fb2bea2c07',1,'tds_start_query(TDSSOCKET *tds, unsigned char packet_type): query.c']]], ['tds_5fstart_5fquery_5fhead_1431',['tds_start_query_head',['../a00563.html#ga9ad2e6defce530a8778791cce0166ccd',1,'query.c']]], ['tds_5fstaticin_5fstream_5finit_1432',['tds_staticin_stream_init',['../a01415.html#aa9e1e45f0305622dd6aed9f8fe158581',1,'stream.c']]], ['tds_5fstaticin_5fstream_5fread_1433',['tds_staticin_stream_read',['../a01415.html#a76b02f1fa5b79dc7e1ef2651a9afe3f7',1,'stream.c']]], ['tds_5fstaticout_5fstream_5finit_1434',['tds_staticout_stream_init',['../a01415.html#a9fe0d3799d2e3bde49b614c9d0c3785d',1,'stream.c']]], ['tds_5fstaticout_5fstream_5fwrite_1435',['tds_staticout_stream_write',['../a01415.html#a1d92ebe06f18378ac17ccfd20db05126',1,'stream.c']]], ['tds_5fstrftime_1436',['tds_strftime',['../a00560.html#ga8c9652e8b1f3e56a3289fd71b12cee1d',1,'tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *dr, int prec): convert.c'],['../a00560.html#ga8c9652e8b1f3e56a3289fd71b12cee1d',1,'tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC *timeptr, int prec): convert.c']]], ['tds_5fstrndup_1437',['tds_strndup',['../a00449.html#a1275e23db464803292b4c759c46621a6',1,'util.c']]], ['tds_5fsubmit_5fbegin_5ftran_1438',['tds_submit_begin_tran',['../a00563.html#ga7bf3670d3d6dabed469b9eb117298079',1,'tds_submit_begin_tran(TDSSOCKET *tds): query.c'],['../a00563.html#ga7bf3670d3d6dabed469b9eb117298079',1,'tds_submit_begin_tran(TDSSOCKET *tds): query.c']]], ['tds_5fsubmit_5fcommit_1439',['tds_submit_commit',['../a00563.html#ga530538c4c975524cf0b771a550fc94a3',1,'tds_submit_commit(TDSSOCKET *tds, int cont): query.c'],['../a00563.html#ga530538c4c975524cf0b771a550fc94a3',1,'tds_submit_commit(TDSSOCKET *tds, int cont): query.c']]], ['tds_5fsubmit_5fexecdirect_1440',['tds_submit_execdirect',['../a00563.html#gae603aed795a4c5bb26ab159a11256996',1,'tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c'],['../a00563.html#gae603aed795a4c5bb26ab159a11256996',1,'tds_submit_execdirect(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c']]], ['tds_5fsubmit_5fexecute_1441',['tds_submit_execute',['../a00563.html#ga3e7b4793c6f799fbc6c174f673bb5b32',1,'tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c'],['../a00563.html#ga3e7b4793c6f799fbc6c174f673bb5b32',1,'tds_submit_execute(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c']]], ['tds_5fsubmit_5foptioncmd_1442',['tds_submit_optioncmd',['../a00563.html#gaf0da49585d39e99780a004ee2ca23479',1,'tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size): query.c'],['../a00563.html#gaf0da49585d39e99780a004ee2ca23479',1,'tds_submit_optioncmd(TDSSOCKET *tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size): query.c']]], ['tds_5fsubmit_5fprepare_1443',['tds_submit_prepare',['../a00563.html#ga74eb08c3a1c85be8ac9db428842c8b9d',1,'tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c'],['../a00563.html#ga74eb08c3a1c85be8ac9db428842c8b9d',1,'tds_submit_prepare(TDSSOCKET *tds, const char *query, const char *id, TDSDYNAMIC **dyn_out, TDSPARAMINFO *params): query.c']]], ['tds_5fsubmit_5fquery_1444',['tds_submit_query',['../a00563.html#ga5a29ae7f99d089dc3cea85ec6ee5f3ab',1,'tds_submit_query(TDSSOCKET *tds, const char *query): query.c'],['../a00563.html#ga5a29ae7f99d089dc3cea85ec6ee5f3ab',1,'tds_submit_query(TDSSOCKET *tds, const char *query): query.c']]], ['tds_5fsubmit_5fquery_5fparams_1445',['tds_submit_query_params',['../a00563.html#ga95e0fccedc459a4404f496eec74a369a',1,'tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c'],['../a00563.html#ga95e0fccedc459a4404f496eec74a369a',1,'tds_submit_query_params(TDSSOCKET *tds, const char *query, TDSPARAMINFO *params, TDSHEADERS *head): query.c']]], ['tds_5fsubmit_5fqueryf_1446',['tds_submit_queryf',['../a00563.html#gad695defcbf663b0023851a198206a772',1,'tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...): query.c'],['../a00563.html#gad695defcbf663b0023851a198206a772',1,'tds_submit_queryf(TDSSOCKET *tds, const char *queryf,...): query.c']]], ['tds_5fsubmit_5frollback_1447',['tds_submit_rollback',['../a00563.html#ga9c1cdcc388506a2ca3c0aaee8c461ba6',1,'tds_submit_rollback(TDSSOCKET *tds, int cont): query.c'],['../a00563.html#ga9c1cdcc388506a2ca3c0aaee8c461ba6',1,'tds_submit_rollback(TDSSOCKET *tds, int cont): query.c']]], ['tds_5fsubmit_5frpc_1448',['tds_submit_rpc',['../a00563.html#ga5f071b94ad7889690762dc85646c74ab',1,'tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head): query.c'],['../a00563.html#ga5f071b94ad7889690762dc85646c74ab',1,'tds_submit_rpc(TDSSOCKET *tds, const char *rpc_name, TDSPARAMINFO *params, TDSHEADERS *head): query.c']]], ['tds_5fsubmit_5funprepare_1449',['tds_submit_unprepare',['../a00563.html#gaf573d8d4d2660c8c27770573fca05ff5',1,'tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c'],['../a00563.html#gaf573d8d4d2660c8c27770573fca05ff5',1,'tds_submit_unprepare(TDSSOCKET *tds, TDSDYNAMIC *dyn): query.c']]], ['tds_5fswap_5fnumeric_1450',['tds_swap_numeric',['../a00248.html#aa818c1cbf4d16e609b7e4895cc7ed74f',1,'data.c']]], ['tds_5fsys_5ficonv_5fopen_1451',['tds_sys_iconv_open',['../a00561.html#ga900b0bce08c6bfc2e7c988f4b5970516',1,'tds_sys_iconv_open(const char *tocode, const char *fromcode): iconv.c'],['../a00561.html#ga900b0bce08c6bfc2e7c988f4b5970516',1,'tds_sys_iconv_open(const char *tocode, const char *fromcode): iconv.c']]], ['tds_5ftoken_5fname_1452',['tds_token_name',['../a00565.html#ga7f24a7af985cd320788122e98072b7af',1,'token.c']]], ['tds_5funget_5fbyte_1453',['tds_unget_byte',['../a00564.html#gad70d59fb317d098b0c9fd29dd77131a8',1,'tds_unget_byte(TDSSOCKET *tds): read.c'],['../a00564.html#gad70d59fb317d098b0c9fd29dd77131a8',1,'tds_unget_byte(TDSSOCKET *tds): read.c']]], ['tds_5fwillconvert_1454',['tds_willconvert',['../a00560.html#ga80487b313213f60d8be71a50a002bb2c',1,'tds_willconvert(int srctype, int desttype): convert.c'],['../a00560.html#ga80487b313213f60d8be71a50a002bb2c',1,'tds_willconvert(int srctype, int desttype): convert.c']]], ['tds_5fwritetext_5fcontinue_1455',['tds_writetext_continue',['../a00239.html#ab68dead99a2ebec55895a10cd3db5202',1,'tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size): bulk.c'],['../a00449.html#ab68dead99a2ebec55895a10cd3db5202',1,'tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size): bulk.c']]], ['tds_5fwritetext_5fend_1456',['tds_writetext_end',['../a00239.html#ac1e460551f1188620ea478238864ac4b',1,'tds_writetext_end(TDSSOCKET *tds): bulk.c'],['../a00449.html#ac1e460551f1188620ea478238864ac4b',1,'tds_writetext_end(TDSSOCKET *tds): bulk.c']]], ['tds_5fwritetext_5fstart_1457',['tds_writetext_start',['../a00239.html#a7711612cc544a7da2c7aa212b870acb2',1,'tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size): bulk.c'],['../a00449.html#a7711612cc544a7da2c7aa212b870acb2',1,'tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size): bulk.c']]], ['tdsdbopen_1458',['tdsdbopen',['../a00554.html#ga2c99ec565452279e9a382451d89642eb',1,'tdsdbopen(LOGINREC *login, const char *server, int msdblib): dblib.c'],['../a00554.html#ga2c99ec565452279e9a382451d89642eb',1,'tdsdbopen(LOGINREC *login, const char *server, int msdblib): dblib.c']]], ['tdsdump_5fclose_1459',['tdsdump_close',['../a00449.html#a2f00fc0907d3bb04ce0eeb9738e08d0c',1,'log.c']]], ['tdsdump_5fcol_1460',['tdsdump_col',['../a00449.html#aaee3fe5c514ce5570c9548de9b16e0d9',1,'log.c']]], ['tdsdump_5fdump_5fbuf_1461',['tdsdump_dump_buf',['../a00449.html#a79449d2f35a8acc8ed0585044f75524d',1,'log.c']]], ['tdsdump_5flog_1462',['tdsdump_log',['../a00449.html#ab45c291105027e69836002e1dd586141',1,'log.c']]], ['tdsdump_5foff_1463',['tdsdump_off',['../a00449.html#ae3e5e04822595c54f86db66d9e40b93a',1,'log.c']]], ['tdsdump_5fon_1464',['tdsdump_on',['../a00449.html#ae5f50062ebebe46b951e5308cb2f5d7e',1,'log.c']]], ['tdsdump_5fopen_1465',['tdsdump_open',['../a00449.html#a24471508ddfde7cc0f8577801e70c42f',1,'log.c']]], ['tdserror_1466',['tdserror',['../a00449.html#abf18b98efef6ce2dc0b97d658a3a1918',1,'util.c']]] ]; freetds-1.3.6/doc/reference/search/functions_9.html000644 025423 025423 00000002624 14162303412 023701 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/functions_9.js000644 025423 025423 00000000220 14162303412 023337 0ustar00fredianofrediano000000 000000 var searchData= [ ['unix_5fto_5fnt_5ftime_1467',['unix_to_nt_time',['../a00558.html#gad2bec0e5029108ce54436ba806c10c9a',1,'challenge.c']]] ]; freetds-1.3.6/doc/reference/search/variables_0.html000644 025423 025423 00000002624 14162303412 023630 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_0.js000644 025423 025423 00000000204 14162303412 023270 0ustar00fredianofrediano000000 000000 var searchData= [ ['allocated_1468',['allocated',['../a01111.html#a9f32de09fe01879aeed23e858f3cef79',1,'tds_dynamic_stream']]] ]; freetds-1.3.6/doc/reference/search/variables_1.html000644 025423 025423 00000002624 14162303412 023631 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_1.js000644 025423 025423 00000001225 14162303412 023275 0ustar00fredianofrediano000000 000000 var searchData= [ ['bcp_5fprefix_5flen_1469',['bcp_prefix_len',['../a01175.html#a07d747c0592ff37eb467ba14c4dcaeb2',1,'tds_column']]], ['block_5fsize_1470',['block_size',['../a01203.html#aaad54522a6e04122eba4c37a200d3f20',1,'tds_env']]], ['buf_1471',['buf',['../a01111.html#a1b4967f395da537910ded1b392dd5d9b',1,'tds_dynamic_stream']]], ['buffer_1472',['buffer',['../a01091.html#a5ba4ad38fdcb68e7d0c7252be65a4ecc',1,'tds_output_stream']]], ['bulk_5fcopy_1473',['bulk_copy',['../a01143.html#ad0d5f6fc4c5a5d64f11efd2e11ecaaa4',1,'tds_login']]], ['bulk_5fquery_1474',['bulk_query',['../a01235.html#ac6ed7b8d3a4bd98a03f8ddb43b2e66c2',1,'tds_socket']]] ]; freetds-1.3.6/doc/reference/search/variables_2.html000644 025423 025423 00000002624 14162303412 023632 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_2.js000644 025423 025423 00000004353 14162303412 023303 0ustar00fredianofrediano000000 000000 var searchData= [ ['cafile_1475',['cafile',['../a01143.html#ad12291abe6678aa30b8c43ab8e75429c',1,'tds_login']]], ['canonic_1476',['canonic',['../a01163.html#aa9d3f1d6d994fcd5871ca41d7797ae95',1,'tds_encoding']]], ['cb_1477',['cb',['../a00715.html#afc81c17990646fe0ed1c9cce5a917487',1,'tds_pbcb']]], ['char_5fconv_1478',['char_conv',['../a01175.html#ab3afb8272401bdb51064cdf910334159',1,'tds_column']]], ['charset_1479',['charset',['../a01203.html#a09756f0c4e0d588152c4dc3a8d019bcd',1,'tds_env']]], ['column_5fcur_5fsize_1480',['column_cur_size',['../a01175.html#ada14ba479a67762fc1bef78910ef4beb',1,'tds_column']]], ['column_5fprec_1481',['column_prec',['../a01175.html#a7ae346f8b1fdd364749825ca0863d166',1,'tds_column']]], ['column_5fscale_1482',['column_scale',['../a01175.html#ab73b012b3a9f08da8661dc230ec17d7f',1,'tds_column']]], ['column_5fsize_1483',['column_size',['../a01175.html#a2c2756c00a1099c82d4cfa4da2894672',1,'tds_column']]], ['column_5ftype_1484',['column_type',['../a01175.html#a7f08ecedc5835a4e81129c6b2b493947',1,'tds_column']]], ['column_5fvarint_5fsize_1485',['column_varint_size',['../a01175.html#a12914f03ee2f24fa3fe577060410770d',1,'tds_column']]], ['crlfile_1486',['crlfile',['../a01143.html#a15808ea4c259a779c63732f8c1067c54',1,'tds_login']]], ['cur_5fcursor_1487',['cur_cursor',['../a01235.html#aa708effeb88270302ab5524f0c0366ac',1,'tds_socket']]], ['cur_5fdyn_1488',['cur_dyn',['../a01235.html#afb404985164205ebdc9b0c18fabb47e2',1,'tds_socket']]], ['current_5fresults_1489',['current_results',['../a01235.html#a4b77fb56b92b93e413fcbb8ba5633ce4',1,'tds_socket']]], ['current_5fstatement_1490',['current_statement',['../a01023.html#acaf05aab946ae9dec9e06dd230839675',1,'_hdbc']]], ['cursor_5fid_1491',['cursor_id',['../a01199.html#a7b7d4cedf0cc7f890133f021d18af58c',1,'tds_cursor']]], ['cursor_5fname_1492',['cursor_name',['../a01199.html#afd459125b5c4d4ccbf77a7d6ca8a4aaa',1,'tds_cursor']]], ['cursor_5frows_1493',['cursor_rows',['../a01199.html#a7ec745adff5b2391e609e836c9f010cd',1,'tds_cursor']]], ['cursor_5fsupport_1494',['cursor_support',['../a01023.html#ae45d3601984f4773024a81394764d28d',1,'_hdbc']]], ['cursors_1495',['cursors',['../a01231.html#a42b972a1cd99c8f2f83b2cf5c635435a',1,'tds_connection']]] ]; freetds-1.3.6/doc/reference/search/variables_3.html000644 025423 025423 00000002624 14162303412 023633 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_3.js000644 025423 025423 00000002312 14162303412 023275 0ustar00fredianofrediano000000 000000 var searchData= [ ['data_5flen_1496',['data_len',['../a01223.html#aa9a66245e3c629a07111067cd1fdd0d4',1,'tds_packet']]], ['database_1497',['database',['../a01203.html#ad05b5a83816aee8ff9858ddb1eb172b8',1,'tds_env']]], ['date_1498',['date',['../a01119.html#a4697c11cf7da815856eb96bae4d57bac',1,'TDS_DATETIMEALL::date()'],['../a01323.html#afa93266cde7ab536615bca3d904aabed',1,'DBDATETIMEALL::date()']]], ['day_1499',['day',['../a01123.html#a82d0cf263d8d4a3abcf84b9a146ddf83',1,'tdsdaterec']]], ['dayofyear_1500',['dayofyear',['../a01123.html#a3f7925156708744d28016aacb90b6093',1,'tdsdaterec']]], ['db_5ffilename_1501',['db_filename',['../a01143.html#a425f8ddd194f897f185d9f4d5e0618c2',1,'tds_login']]], ['decimicrosecond_1502',['decimicrosecond',['../a01123.html#a838e73fd12eec9e3b5368316198f4762',1,'tdsdaterec']]], ['defer_5fclose_1503',['defer_close',['../a01199.html#a411e76370c635dfabe9b5941cdd3180f',1,'tds_cursor::defer_close()'],['../a01207.html#a744986c76b9b09f29325a1e0664b0e9a',1,'tds_dynamic::defer_close()']]], ['dsn_1504',['dsn',['../a00667.html#acd76726add649629f26f1f1754fe48cf',1,'DSNINFO']]], ['dyns_1505',['dyns',['../a01231.html#a7dc98cfe507c626073b6e76985a06a8a',1,'tds_connection']]] ]; freetds-1.3.6/doc/reference/search/variables_4.html000644 025423 025423 00000002624 14162303412 023634 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_4.js000644 025423 025423 00000000333 14162303412 023277 0ustar00fredianofrediano000000 000000 var searchData= [ ['emulated_1506',['emulated',['../a01207.html#ad3fedfbec2ba0db4a64b82779d95a0c5',1,'tds_dynamic']]], ['env_1507',['env',['../a01231.html#a17b3352a5f14239b2eecc4fc272bfe2a',1,'tds_connection']]] ]; freetds-1.3.6/doc/reference/search/variables_5.html000644 025423 025423 00000002624 14162303412 023635 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_5.js000644 025423 025423 00000000521 14162303412 023277 0ustar00fredianofrediano000000 000000 var searchData= [ ['f_1508',['f',['../a00719.html#a460a14dac0d298ff184e3cc67aafe91b',1,'tds_file_stream']]], ['from_5fmalloc_1509',['from_malloc',['../a00715.html#ad483e0559eaa78104c4978667a0b739c',1,'tds_pbcb']]], ['frozen_5fpackets_1510',['frozen_packets',['../a01235.html#a0df77e05bf01c5e4c79a2b3c99b40666',1,'tds_socket']]] ]; freetds-1.3.6/doc/reference/search/variables_6.html000644 025423 025423 00000002624 14162303412 023636 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_6.js000644 025423 025423 00000000336 14162303412 023304 0ustar00fredianofrediano000000 000000 var searchData= [ ['has_5fstatus_1511',['has_status',['../a01235.html#acd5eeef948380cd1b8abb132a417b2bf',1,'tds_socket']]], ['hour_1512',['hour',['../a01123.html#ae9f0348efe607ac7333eac841be46333',1,'tdsdaterec']]] ]; freetds-1.3.6/doc/reference/search/enums_0.js000644 025423 025423 00000000525 14162303412 022455 0ustar00fredianofrediano000000 000000 var searchData= [ ['tds_5fbcp_5fdirections_1621',['tds_bcp_directions',['../a00449.html#ad5c5c8cb776334af4b0ebf7a0d740cb2',1,'tds.h']]], ['tds_5fend_1622',['tds_end',['../a00449.html#aa8d8044be84bcde003f28ec25a77519c',1,'tds.h']]], ['tds_5fstates_1623',['tds_states',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33',1,'tds.h']]] ]; freetds-1.3.6/doc/reference/search/variables_7.html000644 025423 025423 00000002624 14162303412 023637 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_7.js000644 025423 025423 00000001466 14162303412 023312 0ustar00fredianofrediano000000 000000 var searchData= [ ['id_1513',['id',['../a01207.html#a72332750aee80a0a94c92b35d7263d76',1,'tds_dynamic']]], ['in_5fbuf_1514',['in_buf',['../a01235.html#a24c1995f6e8d0f9a5990998524b00b6b',1,'tds_socket']]], ['in_5fcancel_1515',['in_cancel',['../a01235.html#ae67d850cfbedf6b1e6b02111d4388d42',1,'tds_socket']]], ['in_5fflag_1516',['in_flag',['../a01235.html#a765e007b69a2e188c989f05a689f6a11',1,'tds_socket']]], ['in_5flen_1517',['in_len',['../a01235.html#a0b6e65b9d00b3a4efbf78b2d866cca20',1,'tds_socket']]], ['in_5fpos_1518',['in_pos',['../a01235.html#a9d1b4fc8e1e801fdc703ee7bb68d9838',1,'tds_socket']]], ['in_5frow_1519',['in_row',['../a01235.html#ab6a91be7f3b9966216e621c60e8151f2',1,'tds_socket']]], ['ip_5faddrs_1520',['ip_addrs',['../a01143.html#a6e04f60eb1fae0e632ab6cddbb804a55',1,'tds_login']]] ]; freetds-1.3.6/doc/reference/search/variables_8.html000644 025423 025423 00000002624 14162303412 023640 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_8.js000644 025423 025423 00000001006 14162303412 023301 0ustar00fredianofrediano000000 000000 var searchData= [ ['left_1521',['left',['../a00719.html#a3a7b329811d3ba3154aefa3b60ae1770',1,'tds_file_stream']]], ['login_1522',['login',['../a00667.html#ad7ff73ac9d36bdb6dc6d6c8f8c6847bb',1,'DSNINFO::login()'],['../a01235.html#a00c22eeebbdb781ab7b9d5e8403e451e',1,'tds_socket::login()']]], ['login_5ftimeout_1523',['login_timeout',['../a00615.html#a2da93c0f3681f87f94ad169deb09dc64',1,'dblib_context::login_timeout()'],['../a00875.html#a1c6ce7f3fd8d21c59840bba9faa5d0c6',1,'_cs_context::login_timeout()']]] ]; freetds-1.3.6/doc/reference/search/variables_9.html000644 025423 025423 00000002624 14162303412 023641 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_9.js000644 025423 025423 00000000503 14162303412 023303 0ustar00fredianofrediano000000 000000 var searchData= [ ['minute_1524',['minute',['../a01123.html#a81d1931139497023deb1bb75dc0aae7a',1,'tdsdaterec']]], ['month_1525',['month',['../a01123.html#af1542b5698f668f7df650b20fa27c177',1,'tdsdaterec']]], ['msdblib_1526',['msdblib',['../a00943.html#af3aab1ff30d324143f440bcd9f60d1c3',1,'tds_dblib_dbprocess']]] ]; freetds-1.3.6/doc/reference/search/variables_a.html000644 025423 025423 00000002624 14162303412 023711 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_a.js000644 025423 025423 00000001676 14162303412 023367 0ustar00fredianofrediano000000 000000 var searchData= [ ['name_1527',['name',['../a00787.html#aabc5f36785b65913edd51be1fd8ea1e3',1,'namelist::name()'],['../a01163.html#aa7152f00b01261e88db974cac1348c74',1,'tds_encoding::name()']]], ['need_5freprepare_1528',['need_reprepare',['../a01031.html#ac21b1c6a900bcb8dcb57bdeedcad8a72',1,'_hstmt']]], ['new_5fpassword_1529',['new_password',['../a01143.html#a90cffdbb528cddb0cf30d1f9de7c3e9c',1,'tds_login']]], ['next_1530',['next',['../a00787.html#a3aaf5848cba17d39d5ea5bd180590bb3',1,'namelist::next()'],['../a01031.html#ad2152f527dcdd108165e7e03fe476b8f',1,'_hstmt::next()'],['../a01199.html#a8743877d9147d83ef0ae64e04c8a46fb',1,'tds_cursor::next()'],['../a01207.html#adc93b94b6b4caf15dcf45297d928a8da',1,'tds_dynamic::next()']]], ['nullreps_1531',['nullreps',['../a00943.html#a2baeb464798b61d8da14887eb35d63e7',1,'tds_dblib_dbprocess']]], ['num_5fid_1532',['num_id',['../a01207.html#af6fd2355838cce1689fb0e04724b7b6a',1,'tds_dynamic']]] ]; freetds-1.3.6/doc/reference/search/variables_b.html000644 025423 025423 00000002624 14162303412 023712 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_b.js000644 025423 025423 00000001477 14162303412 023367 0ustar00fredianofrediano000000 000000 var searchData= [ ['offset_1533',['offset',['../a01119.html#a76f4cbcb3bc7c10b3616579ec7861f58',1,'TDS_DATETIMEALL::offset()'],['../a01323.html#a13159d738e1d0b582a3a731123feb5f3',1,'DBDATETIMEALL::offset()']]], ['options_1534',['options',['../a01199.html#a1be9f69f84a6d83ce86380c33a2bf9f8',1,'tds_cursor']]], ['origdsn_1535',['origdsn',['../a00667.html#a8127a82b8c4130820a4c44f88eda8bcf',1,'DSNINFO']]], ['out_5fbuf_1536',['out_buf',['../a01235.html#ad6b5121e435d22d640a645b98833cb9d',1,'tds_socket']]], ['out_5fbuf_5fmax_1537',['out_buf_max',['../a01235.html#ae6fc66be718f3211fac3b835557e330e',1,'tds_socket']]], ['out_5fflag_1538',['out_flag',['../a01235.html#a9bb663ee7c71f56f1602cbfcd993018c',1,'tds_socket']]], ['out_5fpos_1539',['out_pos',['../a01235.html#a426adbd80f29f477377e42e8f78d3ff0',1,'tds_socket']]] ]; freetds-1.3.6/doc/reference/search/variables_c.html000644 025423 025423 00000002624 14162303412 023713 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_c.js000644 025423 025423 00000003011 14162303412 023352 0ustar00fredianofrediano000000 000000 var searchData= [ ['param_5fcount_1540',['param_count',['../a01031.html#a36e6cb901103834b074bf5a00fe7afbe',1,'_hstmt']]], ['param_5fnum_1541',['param_num',['../a01031.html#a9b8cb8cb0826323811192adbed126348',1,'_hstmt']]], ['params_1542',['params',['../a01031.html#aebe221315ae3dfd4850c399ad204ca4f',1,'_hstmt::params()'],['../a01207.html#adba427a655336d0b128cdec36544464b',1,'tds_dynamic::params()']]], ['password_1543',['password',['../a01143.html#a411a965cbfdb05e69b6da62a30531bb2',1,'tds_login']]], ['pb_1544',['pb',['../a00715.html#a616193286e91acc0a5dbe8942550e11e',1,'tds_pbcb']]], ['pending_5fclose_1545',['pending_close',['../a01231.html#a824fd854618d7d2005f2bec452247be7',1,'tds_connection']]], ['pkt_1546',['pkt',['../a01243.html#af900a7df4b6adae34d37233c3fb4cc99',1,'tds_freeze']]], ['pkt_5fpos_1547',['pkt_pos',['../a01243.html#a99de10b997fb8a417d1ba7123957a720',1,'tds_freeze']]], ['port_1548',['port',['../a01143.html#aec3fe0f3f17448018ae5c92cff3abb6d',1,'tds_login']]], ['prepared_5fpos_1549',['prepared_pos',['../a01031.html#a45c0b5a3624186c84441d2e0f8a59c64',1,'_hstmt']]], ['prev_1550',['prev',['../a01031.html#ad36ac281bcfcc5a6b6af0c1428b41d5f',1,'_hstmt']]], ['product_5fversion_1551',['product_version',['../a01231.html#a7473cd879ba62019eb9d3bbb153832a1',1,'tds_connection']]], ['put_5fdata_1552',['put_data',['../a01171.html#a09912b32c805bec7ab47080b42bf93a1',1,'tds_column_funcs']]], ['put_5finfo_1553',['put_info',['../a01171.html#afed4993bb75cb37dfc7a6bcdb74820e2',1,'tds_column_funcs']]] ]; freetds-1.3.6/doc/reference/search/variables_d.html000644 025423 025423 00000002624 14162303412 023714 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_d.js000644 025423 025423 00000001124 14162303412 023356 0ustar00fredianofrediano000000 000000 var searchData= [ ['quarter_1554',['quarter',['../a01123.html#aa0efc92bb0079287e043bb2c46c4603d',1,'tdsdaterec']]], ['query_1555',['query',['../a01031.html#aaf4c8eb3163d2261ce6ce90118a70aec',1,'_hstmt::query()'],['../a01199.html#aeec2a01af48693b8b22449f15725d502',1,'tds_cursor::query()'],['../a01207.html#a1cee141e5f7045e691eec830cec1c158',1,'tds_dynamic::query()']]], ['query_5ftimeout_1556',['query_timeout',['../a00615.html#abf71abb24c7afea7dd7ef440048ea4c9',1,'dblib_context::query_timeout()'],['../a00875.html#a995ba257ef303066a726160decd7729c',1,'_cs_context::query_timeout()']]] ]; freetds-1.3.6/doc/reference/search/variables_e.html000644 025423 025423 00000002624 14162303412 023715 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_e.js000644 025423 025423 00000002344 14162303412 023364 0ustar00fredianofrediano000000 000000 var searchData= [ ['read_1557',['read',['../a01087.html#a2f0be7677a1bf9c730e3c697bfba21c9',1,'tds_input_stream']]], ['ref_5fcount_1558',['ref_count',['../a00615.html#a812580afdfca53b6d54a7d09938c65c2',1,'dblib_context::ref_count()'],['../a01199.html#a692ccceff71d836df0d084ec26123c2d',1,'tds_cursor::ref_count()'],['../a01207.html#a2798c66fb3c8637c7fb29c6d1efebfa4',1,'tds_dynamic::ref_count()']]], ['res_5finfo_1559',['res_info',['../a01207.html#ac736e163c0d4cdbca980a861214d99e7',1,'tds_dynamic']]], ['resinfo_1560',['resinfo',['../a00611.html#ad49b82677ae277e5d5b0038f522da293',1,'dblib_buffer_row']]], ['ret_5fstatus_1561',['ret_status',['../a01235.html#a355e0b8c6219908747f82cd7482c6efb',1,'tds_socket']]], ['row_1562',['row',['../a00611.html#a015599345b266045d8bd3fac731e4675',1,'dblib_buffer_row']]], ['row_5fcount_1563',['row_count',['../a01031.html#a8fd44f3c44ae4c83a1bdda0b73776ecd',1,'_hstmt']]], ['row_5fdata_1564',['row_data',['../a00611.html#a5a057d6bbecfac1a85a9fbcd09eaf3a0',1,'dblib_buffer_row']]], ['row_5fstatus_1565',['row_status',['../a01031.html#a41dd89b2dc41fe0e747580f6ea807063',1,'_hstmt']]], ['rows_5faffected_1566',['rows_affected',['../a01235.html#a803e29dabc76d35227f5de2488f29877',1,'tds_socket']]] ]; freetds-1.3.6/doc/reference/search/variables_f.html000644 025423 025423 00000002624 14162303412 023716 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_f.js000644 025423 025423 00000002550 14162303412 023364 0ustar00fredianofrediano000000 000000 var searchData= [ ['s_1567',['s',['../a01231.html#a4853be2466fd81c9463ac88f8da8b9c2',1,'tds_connection']]], ['second_1568',['second',['../a01123.html#a8560717700de586f279af702bac86ad6',1,'tdsdaterec']]], ['send_5fpacket_1569',['send_packet',['../a01235.html#a1c7c38af79f5845b90f19aaf5f63ce18',1,'tds_socket']]], ['server_5fcharset_1570',['server_charset',['../a01143.html#a80dae8a766655c5c7365ba42d4d4d62c',1,'tds_login']]], ['server_5fname_1571',['server_name',['../a01143.html#a69ed4cfded269727901bed2f95f1652e',1,'tds_login']]], ['server_5frealm_5fname_1572',['server_realm_name',['../a01143.html#a1e5a5a13fa3cb0c5168d44187b52c814',1,'tds_login']]], ['server_5fspn_1573',['server_spn',['../a01143.html#ad8d335a04cf09453a87a8e0b9118eaeb',1,'tds_login']]], ['size_1574',['size',['../a01111.html#a9d221dd860f67d97daa71e107dce3470',1,'tds_dynamic_stream']]], ['size_5flen_1575',['size_len',['../a01243.html#ae857ba89e4d2b249da64e0e7287da962',1,'tds_freeze']]], ['sizes_1576',['sizes',['../a00611.html#abe1aa9f8ea96dda1400654813e68130a',1,'dblib_buffer_row']]], ['status_1577',['status',['../a01199.html#ab5d6a587ac5780f001d383d4b874852f',1,'tds_cursor']]], ['stmt_5flist_1578',['stmt_list',['../a01023.html#a4a9f3e8f1eba573df79a1ed300d8fc91',1,'_hdbc']]], ['stream_1579',['stream',['../a00719.html#abb6db59e849d11de92f4c55c61d51744',1,'tds_file_stream']]] ]; freetds-1.3.6/doc/reference/search/variables_10.html000644 025423 025423 00000002625 14162303412 023712 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_10.js000644 025423 025423 00000004413 14162303412 023357 0ustar00fredianofrediano000000 000000 var searchData= [ ['tds_1580',['tds',['../a01031.html#ad357e33164f46fce2bc70267d71a1959',1,'_hstmt::tds()'],['../a01243.html#a182ed346382edef2962aca11c7cabc22',1,'tds_freeze::tds()']]], ['tds_5fctx_1581',['tds_ctx',['../a00615.html#afb3fb2d591c0f75b9412f8ca77e2629d',1,'dblib_context']]], ['tds_5fctx_5fref_5fcount_1582',['tds_ctx_ref_count',['../a00615.html#ad01d901acbc92e8c369e6a6c784d7446',1,'dblib_context']]], ['tds_5fnumeric_5fbytes_5fper_5fprec_1583',['tds_numeric_bytes_per_prec',['../a00449.html#a4da9eedb6322f7dfca89d5d89be7b374',1,'numeric.c']]], ['tds_5fstr_5fempty_1584',['tds_str_empty',['../a00566.html#ga676fd3c5c489584d09c89d66c7a0af2d',1,'tds_str_empty(): tdsstring.c'],['../a00566.html#ga676fd3c5c489584d09c89d66c7a0af2d',1,'tds_str_empty(): tdsstring.c']]], ['tds_5fversion_1585',['tds_version',['../a01143.html#a8f9f756b25fd18916a6080f9c22f835d',1,'tds_login']]], ['tds_5fwrite_5fdump_1586',['tds_write_dump',['../a00449.html#a4766b1a553077cb3257d36b9ac28f5b5',1,'log.c']]], ['term_5flen_1587',['term_len',['../a00719.html#aae893302d33ee1e9d83c3d85d7390dca',1,'tds_file_stream']]], ['terminator_1588',['terminator',['../a00719.html#a463c28a7d862c0a6d7bf3170dd614dc0',1,'tds_file_stream']]], ['time_1589',['time',['../a01119.html#afd6a58ec251f2c08a040917ba5a8cd3f',1,'TDS_DATETIMEALL::time()'],['../a01323.html#a6bb5dcd5b47813b71934546e0c60e035',1,'DBDATETIMEALL::time()']]], ['timezone_1590',['timezone',['../a01123.html#a624e21e65d0ae89797b3a7eadc48829f',1,'tdsdaterec']]], ['tm_5fhour_1591',['tm_hour',['../a00743.html#a6ece03e77f69035da83d5739e16ef905',1,'tds_time']]], ['tm_5fmday_1592',['tm_mday',['../a00743.html#a8dfc26d484c247040f521f20288651f1',1,'tds_time']]], ['tm_5fmin_1593',['tm_min',['../a00743.html#ab50f30e05dc6b493d347918ab7ded1e9',1,'tds_time']]], ['tm_5fmon_1594',['tm_mon',['../a00743.html#adce28126e9bbd4ef005e3bf181d59745',1,'tds_time']]], ['tm_5fns_1595',['tm_ns',['../a00743.html#a386f1cfcabbe3ed86afe72bed75778cf',1,'tds_time']]], ['tm_5fsec_1596',['tm_sec',['../a00743.html#adeb5e3f535662c0341d28f8d669cb59b',1,'tds_time']]], ['tm_5fyear_1597',['tm_year',['../a00743.html#a3e27d50ebb5196356a6a8a9b495c8758',1,'tds_time']]], ['type_1598',['type',['../a01199.html#a889aafdde1d57c9be0585326022831f0',1,'tds_cursor']]] ]; freetds-1.3.6/doc/reference/search/variables_11.html000644 025423 025423 00000002625 14162303412 023713 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_11.js000644 025423 025423 00000000324 14162303412 023355 0ustar00fredianofrediano000000 000000 var searchData= [ ['uad_1599',['uad',['../a01023.html#a93c0c73d7161aa0c8fd59016e66def9e',1,'_hdbc']]], ['user_5fname_1600',['user_name',['../a01143.html#a2b2de13270472df39952848eb3970d9a',1,'tds_login']]] ]; freetds-1.3.6/doc/reference/search/variables_12.html000644 025423 025423 00000002625 14162303412 023714 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_12.js000644 025423 025423 00000000662 14162303412 023363 0ustar00fredianofrediano000000 000000 var searchData= [ ['waiters_1601',['waiters',['../a00699.html#a009d30222683a3540fcddbc3e9033828',1,'tds_pool']]], ['weekday_1602',['weekday',['../a01123.html#a40de0c7d78e9c1edae4c07435c10192b',1,'tdsdaterec']]], ['wire_5fsize_1603',['wire_size',['../a01095.html#a8101abd3e9e8d6f90b2ba2717bf7f926',1,'tds_datain_stream']]], ['write_1604',['write',['../a01091.html#a8513fb41c8ba79f22e54266b87278415',1,'tds_output_stream']]] ]; freetds-1.3.6/doc/reference/search/variables_13.html000644 025423 025423 00000002625 14162303412 023715 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/variables_13.js000644 025423 025423 00000000162 14162303412 023357 0ustar00fredianofrediano000000 000000 var searchData= [ ['year_1605',['year',['../a01123.html#a5a6a5b0180c3db53acbda61dd570d70f',1,'tdsdaterec']]] ]; freetds-1.3.6/doc/reference/search/typedefs_0.html000644 025423 025423 00000002623 14162303412 023502 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/typedefs_0.js000644 025423 025423 00000000532 14162303412 023147 0ustar00fredianofrediano000000 000000 var searchData= [ ['dblib_5ferror_5fmessage_1606',['DBLIB_ERROR_MESSAGE',['../a00554.html#ga8f2b5c6bcfed3eb54e97b42a6f8930f8',1,'dblib.c']]], ['dblibcontext_1607',['DBLIBCONTEXT',['../a00080.html#a8ff1bdcccb992dd688bc35d178c4bf3b',1,'dblib.c']]], ['dstr_1608',['DSTR',['../a00566.html#gafddddf5bd7ad223cadee3d3bdc899954',1,'string.h']]] ]; freetds-1.3.6/doc/reference/search/typedefs_1.html000644 025423 025423 00000002623 14162303412 023503 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/typedefs_1.js000644 025423 025423 00000002356 14162303412 023156 0ustar00fredianofrediano000000 000000 var searchData= [ ['tds_5fcompiletime_5fsettings_1609',['TDS_COMPILETIME_SETTINGS',['../a00449.html#a1de034b895312fc0cfae0e28f8921a47',1,'tds.h']]], ['tds_5fencoding_1610',['TDS_ENCODING',['../a00449.html#ae21e9f12e8ee5219228ee6b6a41dec66',1,'tds.h']]], ['tds_5fstate_1611',['TDS_STATE',['../a00449.html#ac0d502ab90609c39fe7713fe0dfbefad',1,'tds.h']]], ['tdsblob_1612',['TDSBLOB',['../a00449.html#a47b154752431b2379988dbfdff394577',1,'tds.h']]], ['tdscursor_1613',['TDSCURSOR',['../a00449.html#afe061eb245f3006d93940a20415692a7',1,'tds.h']]], ['tdsdaterec_1614',['TDSDATEREC',['../a00449.html#a3b40b4faf314267146c2005e56eebe7b',1,'tds.h']]], ['tdsdynamic_1615',['TDSDYNAMIC',['../a00449.html#a856d78b7438fef3d6e6c0a8e4566d978',1,'tds.h']]], ['tdsenv_1616',['TDSENV',['../a00449.html#a42c559939ed16a39c0318a6f543c576e',1,'tds.h']]], ['tdsfilestream_1617',['TDSFILESTREAM',['../a00239.html#ac2b7f7b7bb486f90e1053bfb829ca2ba',1,'bulk.c']]], ['tdspbcb_1618',['TDSPBCB',['../a00239.html#af31a5af3c7480dc3a16576dfc84f3b06',1,'bulk.c']]], ['tdsresultinfo_1619',['TDSRESULTINFO',['../a00449.html#a1efbb2f3844cb2ea89af03721ac67277',1,'tds.h']]], ['tdsvariant_1620',['TDSVARIANT',['../a00449.html#a25488abe3449d4cdaaa97587d34f9174',1,'tds.h']]] ]; freetds-1.3.6/doc/reference/search/enums_0.html000644 025423 025423 00000002620 14162303412 023003 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/enumvalues_0.html000644 025423 025423 00000002625 14162303412 024045 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/enumvalues_0.js000644 025423 025423 00000003762 14162303412 023520 0ustar00fredianofrediano000000 000000 var searchData= [ ['tds_5fdead_1624',['TDS_DEAD',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33af087b64970a1fb35bbcf1bc6ea7a643d',1,'tds.h']]], ['tds_5fdone_5fcancelled_1625',['TDS_DONE_CANCELLED',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca202254cfd6784404cf1aa22bc7147c86',1,'tds.h']]], ['tds_5fdone_5fcount_1626',['TDS_DONE_COUNT',['../a00449.html#aa8d8044be84bcde003f28ec25a77519caf17d0c6591e318014c806a10c2f0270b',1,'tds.h']]], ['tds_5fdone_5ferror_1627',['TDS_DONE_ERROR',['../a00449.html#aa8d8044be84bcde003f28ec25a77519caa9d79a3b62e3321332223ac3d1a5b18d',1,'tds.h']]], ['tds_5fdone_5ffinal_1628',['TDS_DONE_FINAL',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca7ed9046db24ad78bb94c2b12d6e11f46',1,'tds.h']]], ['tds_5fdone_5finxact_1629',['TDS_DONE_INXACT',['../a00449.html#aa8d8044be84bcde003f28ec25a77519cac79a30d1a0bac125e77d87f5d87bc2b2',1,'tds.h']]], ['tds_5fdone_5fmore_5fresults_1630',['TDS_DONE_MORE_RESULTS',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca688b8bf555ce6ae72f3e047177bfc966',1,'tds.h']]], ['tds_5fdone_5fproc_1631',['TDS_DONE_PROC',['../a00449.html#aa8d8044be84bcde003f28ec25a77519cae170f368306f421d507c6f08e4d48d9a',1,'tds.h']]], ['tds_5fdone_5fsrverror_1632',['TDS_DONE_SRVERROR',['../a00449.html#aa8d8044be84bcde003f28ec25a77519ca7bfe89d6f8fc309eae412ad0a503e34c',1,'tds.h']]], ['tds_5fidle_1633',['TDS_IDLE',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33ad1586abc1f75b7f3d640b994afe310e9',1,'tds.h']]], ['tds_5fpending_1634',['TDS_PENDING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a00f6d5ac5560f2f44661e599241849a8',1,'tds.h']]], ['tds_5freading_1635',['TDS_READING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a36ddbc8f326d6b297009a8fafd958529',1,'tds.h']]], ['tds_5fsending_1636',['TDS_SENDING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a2bad5be30bd85edc9495dae3d199d2c1',1,'tds.h']]], ['tds_5fwriting_1637',['TDS_WRITING',['../a00449.html#a87cdae58f91ebe9229206bf0628f8e33a4a4fcc1840bee1e09521f08a0184d025',1,'tds.h']]] ]; freetds-1.3.6/doc/reference/search/defines_0.html000644 025423 025423 00000002622 14162303412 023273 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/defines_0.js000644 025423 025423 00000000372 14162303412 022743 0ustar00fredianofrediano000000 000000 var searchData= [ ['dbtds_5funknown_1638',['DBTDS_UNKNOWN',['../a00506.html#a4e19c79341755a7c6666197d381e1ac6',1,'sybdb.h']]], ['dbversion_5funknown_1639',['DBVERSION_UNKNOWN',['../a00506.html#adbc038c5d57c0ab4c1c9e081a664dc0f',1,'sybdb.h']]] ]; freetds-1.3.6/doc/reference/search/defines_1.html000644 025423 025423 00000002622 14162303412 023274 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/defines_1.js000644 025423 025423 00000000211 14162303412 022734 0ustar00fredianofrediano000000 000000 var searchData= [ ['is_5fdatetime_5ftype_1640',['is_datetime_type',['../a00449.html#a4a70a4d36139165f8be99ea6fffb57ce',1,'tds.h']]] ]; freetds-1.3.6/doc/reference/search/defines_2.html000644 025423 025423 00000002622 14162303412 023275 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/defines_2.js000644 025423 025423 00000001067 14162303412 022747 0ustar00fredianofrediano000000 000000 var searchData= [ ['tds_5fis_5fmssql_1641',['TDS_IS_MSSQL',['../a00449.html#a07e9371c3e72b9e319f4c14e6fc2c20f',1,'tds.h']]], ['tds_5fis_5fsybase_1642',['TDS_IS_SYBASE',['../a00449.html#a4840433488d0c66601ff4002a54b41d7',1,'tds.h']]], ['tds_5fms_5fver_1643',['TDS_MS_VER',['../a00449.html#a1f5fb9d2184949ed566c8ce308a4e91e',1,'tds.h']]], ['tds_5fput_5ftinyint_1644',['tds_put_tinyint',['../a00449.html#adfc186758f4c1856c01746b5436aff74',1,'tds.h']]], ['tds_5fsyb_5fver_1645',['TDS_SYB_VER',['../a00449.html#aca53a637849948c4b7a07f69e40c685c',1,'tds.h']]] ]; freetds-1.3.6/doc/reference/search/groups_0.html000644 025423 025423 00000002621 14162303412 023174 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_0.js000644 025423 025423 00000000132 14162303412 022637 0ustar00fredianofrediano000000 000000 var searchData= [ ['authentication_1646',['Authentication',['../a00558.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_1.html000644 025423 025423 00000002621 14162303412 023175 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_1.js000644 025423 025423 00000000150 14162303412 022640 0ustar00fredianofrediano000000 000000 var searchData= [ ['bulk_20copy_20functions_1647',['Bulk copy functions',['../a00550.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_2.html000644 025423 025423 00000002621 14162303412 023176 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_2.js000644 025423 025423 00000000346 14162303412 022650 0ustar00fredianofrediano000000 000000 var searchData= [ ['configuration_1648',['Configuration',['../a00559.html',1,'']]], ['charset_20conversion_1649',['Charset conversion',['../a00561.html',1,'']]], ['conversion_1650',['Conversion',['../a00560.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_3.html000644 025423 025423 00000002621 14162303412 023177 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_3.js000644 025423 025423 00000000302 14162303412 022641 0ustar00fredianofrediano000000 000000 var searchData= [ ['datetime_20functions_1651',['Datetime functions',['../a00553.html',1,'']]], ['dynamic_20string_20functions_1652',['Dynamic string functions',['../a00566.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_4.html000644 025423 025423 00000002621 14162303412 023200 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_4.js000644 025423 025423 00000000252 14162303412 022646 0ustar00fredianofrediano000000 000000 var searchData= [ ['internal_20bcp_20functions_1653',['Internal bcp functions',['../a00551.html',1,'']]], ['internals_1654',['Internals',['../a00554.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_5.html000644 025423 025423 00000002621 14162303412 023201 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_5.js000644 025423 025423 00000000124 14162303412 022645 0ustar00fredianofrediano000000 000000 var searchData= [ ['libtds_20api_1655',['LibTDS API',['../a00567.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_6.html000644 025423 025423 00000002621 14162303412 023202 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_6.js000644 025423 025423 00000000254 14162303412 022652 0ustar00fredianofrediano000000 000000 var searchData= [ ['money_20functions_1656',['Money functions',['../a00552.html',1,'']]], ['memory_20allocation_1657',['Memory allocation',['../a00562.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_7.html000644 025423 025423 00000002621 14162303412 023203 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_7.js000644 025423 025423 00000000142 14162303412 022647 0ustar00fredianofrediano000000 000000 var searchData= [ ['network_20functions_1658',['Network functions',['../a00564.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_8.html000644 025423 025423 00000002621 14162303412 023204 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_8.js000644 025423 025423 00000000224 14162303412 022651 0ustar00fredianofrediano000000 000000 var searchData= [ ['odbc_20api_1659',['ODBC API',['../a00556.html',1,'']]], ['odbc_20utility_1660',['ODBC utility',['../a00557.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_9.html000644 025423 025423 00000002621 14162303412 023205 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_9.js000644 025423 025423 00000000142 14162303412 022651 0ustar00fredianofrediano000000 000000 var searchData= [ ['primary_20functions_1661',['Primary functions',['../a00548.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_a.html000644 025423 025423 00000002621 14162303412 023255 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_a.js000644 025423 025423 00000000110 14162303412 022714 0ustar00fredianofrediano000000 000000 var searchData= [ ['query_1662',['Query',['../a00563.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_b.html000644 025423 025423 00000002621 14162303412 023256 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_b.js000644 025423 025423 00000000306 14162303412 022724 0ustar00fredianofrediano000000 000000 var searchData= [ ['remote_20procedure_20functions_1663',['Remote Procedure functions',['../a00549.html',1,'']]], ['results_20processing_1664',['Results processing',['../a00565.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_c.html000644 025423 025423 00000002621 14162303412 023257 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_c.js000644 025423 025423 00000000140 14162303412 022721 0ustar00fredianofrediano000000 000000 var searchData= [ ['the_20db_2dlib_20api_1665',['The db-lib API',['../a00547.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/groups_d.html000644 025423 025423 00000002621 14162303412 023260 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/groups_d.js000644 025423 025423 00000000130 14162303412 022721 0ustar00fredianofrediano000000 000000 var searchData= [ ['unimplemented_1666',['Unimplemented',['../a00555.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/pages_0.html000644 025423 025423 00000002620 14162303412 022753 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/pages_0.js000644 025423 025423 00000000120 14162303412 022414 0ustar00fredianofrediano000000 000000 var searchData= [ ['bug_20list_1667',['Bug List',['../a00546.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/pages_1.html000644 025423 025423 00000002620 14162303412 022754 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/pages_1.js000644 025423 025423 00000000161 14162303412 022422 0ustar00fredianofrediano000000 000000 var searchData= [ ['freetds_20reference_20manual_1668',['FreeTDS Reference Manual',['../index.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/pages_2.html000644 025423 025423 00000002620 14162303412 022755 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/pages_2.js000644 025423 025423 00000000162 14162303412 022424 0ustar00fredianofrediano000000 000000 var searchData= [ ['how_20to_20add_20a_20new_20type_1669',['How to add a new type',['../a01356.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/pages_3.html000644 025423 025423 00000002620 14162303412 022756 0ustar00fredianofrediano000000 000000
    Loading...
    Searching...
    No Matches
    freetds-1.3.6/doc/reference/search/pages_3.js000644 025423 025423 00000000122 14162303412 022421 0ustar00fredianofrediano000000 000000 var searchData= [ ['todo_20list_1670',['Todo List',['../a00545.html',1,'']]] ]; freetds-1.3.6/doc/reference/search/searchdata.js000644 025423 025423 00000001212 14162303412 023200 0ustar00fredianofrediano000000 000000 var indexSectionsWithContent = { 0: "_abcdefhiklmnopqrstuwy", 1: "_abcdefklmnoprst", 2: "bdiprst", 3: "_abdoprstu", 4: "abcdefhilmnopqrstuwy", 5: "dt", 6: "t", 7: "t", 8: "dit", 9: "abcdilmnopqrtu", 10: "bfht" }; var indexSectionNames = { 0: "all", 1: "classes", 2: "files", 3: "functions", 4: "variables", 5: "typedefs", 6: "enums", 7: "enumvalues", 8: "defines", 9: "groups", 10: "pages" }; var indexSectionLabels = { 0: "All", 1: "Classes", 2: "Files", 3: "Functions", 4: "Variables", 5: "Typedefs", 6: "Enumerations", 7: "Enumerator", 8: "Macros", 9: "Modules", 10: "Pages" }; freetds-1.3.6/doc/reference/search/search.js000644 025423 025423 00000055477 14162303412 022374 0ustar00fredianofrediano000000 000000 /* @licstart The following is the entire license notice for the JavaScript code in this file. The MIT License (MIT) Copyright (C) 1997-2020 by Dimitri van Heesch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @licend The above is the entire license notice for the JavaScript code in this file */ function convertToId(search) { var result = ''; for (i=0;i do a search { this.Search(); } } this.OnSearchSelectKey = function(evt) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==40 && this.searchIndex0) // Up { this.searchIndex--; this.OnSelectItem(this.searchIndex); } else if (e.keyCode==13 || e.keyCode==27) { this.OnSelectItem(this.searchIndex); this.CloseSelectionWindow(); this.DOMSearchField().focus(); } return false; } // --------- Actions // Closes the results window. this.CloseResultsWindow = function() { this.DOMPopupSearchResultsWindow().style.display = 'none'; this.DOMSearchClose().style.display = 'none'; this.Activate(false); } this.CloseSelectionWindow = function() { this.DOMSearchSelectWindow().style.display = 'none'; } // Performs a search. this.Search = function() { this.keyTimeout = 0; // strip leading whitespace var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); var code = searchValue.toLowerCase().charCodeAt(0); var idxChar = searchValue.substr(0, 1).toLowerCase(); if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair { idxChar = searchValue.substr(0, 2); } var resultsPage; var resultsPageWithSearch; var hasResultsPage; var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); if (idx!=-1) { var hexCode=idx.toString(16); resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; resultsPageWithSearch = resultsPage+'?'+escape(searchValue); hasResultsPage = true; } else // nothing available for this search term { resultsPage = this.resultsPath + '/nomatches.html'; resultsPageWithSearch = resultsPage; hasResultsPage = false; } window.frames.MSearchResults.location = resultsPageWithSearch; var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); if (domPopupSearchResultsWindow.style.display!='block') { var domSearchBox = this.DOMSearchBox(); this.DOMSearchClose().style.display = 'inline-block'; if (this.insideFrame) { var domPopupSearchResults = this.DOMPopupSearchResults(); domPopupSearchResultsWindow.style.position = 'relative'; domPopupSearchResultsWindow.style.display = 'block'; var width = document.body.clientWidth - 8; // the -8 is for IE :-( domPopupSearchResultsWindow.style.width = width + 'px'; domPopupSearchResults.style.width = width + 'px'; } else { var domPopupSearchResults = this.DOMPopupSearchResults(); var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; domPopupSearchResultsWindow.style.display = 'block'; left -= domPopupSearchResults.offsetWidth; domPopupSearchResultsWindow.style.top = top + 'px'; domPopupSearchResultsWindow.style.left = left + 'px'; } } this.lastSearchValue = searchValue; this.lastResultsPage = resultsPage; } // -------- Activation Functions // Activates or deactivates the search panel, resetting things to // their default values if necessary. this.Activate = function(isActive) { if (isActive || // open it this.DOMPopupSearchResultsWindow().style.display == 'block' ) { this.DOMSearchBox().className = 'MSearchBoxActive'; var searchField = this.DOMSearchField(); if (searchField.value == this.searchLabel) // clear "Search" term upon entry { searchField.value = ''; this.searchActive = true; } } else if (!isActive) // directly remove the panel { this.DOMSearchBox().className = 'MSearchBoxInactive'; this.DOMSearchField().value = this.searchLabel; this.searchActive = false; this.lastSearchValue = '' this.lastResultsPage = ''; } } } // ----------------------------------------------------------------------- // The class that handles everything on the search results page. function SearchResults(name) { // The number of matches from the last run of . this.lastMatchCount = 0; this.lastKey = 0; this.repeatOn = false; // Toggles the visibility of the passed element ID. this.FindChildElement = function(id) { var parentElement = document.getElementById(id); var element = parentElement.firstChild; while (element && element!=parentElement) { if (element.nodeName == 'DIV' && element.className == 'SRChildren') { return element; } if (element.nodeName == 'DIV' && element.hasChildNodes()) { element = element.firstChild; } else if (element.nextSibling) { element = element.nextSibling; } else { do { element = element.parentNode; } while (element && element!=parentElement && !element.nextSibling); if (element && element!=parentElement) { element = element.nextSibling; } } } } this.Toggle = function(id) { var element = this.FindChildElement(id); if (element) { if (element.style.display == 'block') { element.style.display = 'none'; } else { element.style.display = 'block'; } } } // Searches for the passed string. If there is no parameter, // it takes it from the URL query. // // Always returns true, since other documents may try to call it // and that may or may not be possible. this.Search = function(search) { if (!search) // get search word from URL { search = window.location.search; search = search.substring(1); // Remove the leading '?' search = unescape(search); } search = search.replace(/^ +/, ""); // strip leading spaces search = search.replace(/ +$/, ""); // strip trailing spaces search = search.toLowerCase(); search = convertToId(search); var resultRows = document.getElementsByTagName("div"); var matches = 0; var i = 0; while (i < resultRows.length) { var row = resultRows.item(i); if (row.className == "SRResult") { var rowMatchName = row.id.toLowerCase(); rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' if (search.length<=rowMatchName.length && rowMatchName.substr(0, search.length)==search) { row.style.display = 'block'; matches++; } else { row.style.display = 'none'; } } i++; } document.getElementById("Searching").style.display='none'; if (matches == 0) // no results { document.getElementById("NoMatches").style.display='block'; } else // at least one result { document.getElementById("NoMatches").style.display='none'; } this.lastMatchCount = matches; return true; } // return the first item with index index or higher that is visible this.NavNext = function(index) { var focusItem; while (1) { var focusName = 'Item'+index; focusItem = document.getElementById(focusName); if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { break; } else if (!focusItem) // last element { break; } focusItem=null; index++; } return focusItem; } this.NavPrev = function(index) { var focusItem; while (1) { var focusName = 'Item'+index; focusItem = document.getElementById(focusName); if (focusItem && focusItem.parentNode.parentNode.style.display=='block') { break; } else if (!focusItem) // last element { break; } focusItem=null; index--; } return focusItem; } this.ProcessKeys = function(e) { if (e.type == "keydown") { this.repeatOn = false; this.lastKey = e.keyCode; } else if (e.type == "keypress") { if (!this.repeatOn) { if (this.lastKey) this.repeatOn = true; return false; // ignore first keypress after keydown } } else if (e.type == "keyup") { this.lastKey = 0; this.repeatOn = false; } return this.lastKey!=0; } this.Nav = function(evt,itemIndex) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==13) return true; if (!this.ProcessKeys(e)) return false; if (this.lastKey==38) // Up { var newIndex = itemIndex-1; var focusItem = this.NavPrev(newIndex); if (focusItem) { var child = this.FindChildElement(focusItem.parentNode.parentNode.id); if (child && child.style.display == 'block') // children visible { var n=0; var tmpElem; while (1) // search for last child { tmpElem = document.getElementById('Item'+newIndex+'_c'+n); if (tmpElem) { focusItem = tmpElem; } else // found it! { break; } n++; } } } if (focusItem) { focusItem.focus(); } else // return focus to search field { parent.document.getElementById("MSearchField").focus(); } } else if (this.lastKey==40) // Down { var newIndex = itemIndex+1; var focusItem; var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem && elem.style.display == 'block') // children visible { focusItem = document.getElementById('Item'+itemIndex+'_c0'); } if (!focusItem) focusItem = this.NavNext(newIndex); if (focusItem) focusItem.focus(); } else if (this.lastKey==39) // Right { var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem) elem.style.display = 'block'; } else if (this.lastKey==37) // Left { var item = document.getElementById('Item'+itemIndex); var elem = this.FindChildElement(item.parentNode.parentNode.id); if (elem) elem.style.display = 'none'; } else if (this.lastKey==27) // Escape { parent.searchBox.CloseResultsWindow(); parent.document.getElementById("MSearchField").focus(); } else if (this.lastKey==13) // Enter { return true; } return false; } this.NavChild = function(evt,itemIndex,childIndex) { var e = (evt) ? evt : window.event; // for IE if (e.keyCode==13) return true; if (!this.ProcessKeys(e)) return false; if (this.lastKey==38) // Up { if (childIndex>0) { var newIndex = childIndex-1; document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); } else // already at first child, jump to parent { document.getElementById('Item'+itemIndex).focus(); } } else if (this.lastKey==40) // Down { var newIndex = childIndex+1; var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); if (!elem) // last child, jump to parent next parent { elem = this.NavNext(itemIndex+1); } if (elem) { elem.focus(); } } else if (this.lastKey==27) // Escape { parent.searchBox.CloseResultsWindow(); parent.document.getElementById("MSearchField").focus(); } else if (this.lastKey==13) // Enter { return true; } return false; } } function setKeyActions(elem,action) { elem.setAttribute('onkeydown',action); elem.setAttribute('onkeypress',action); elem.setAttribute('onkeyup',action); } function setClassAttr(elem,attr) { elem.setAttribute('class',attr); elem.setAttribute('className',attr); } function createResults() { var results = document.getElementById("SRResults"); for (var e=0; e
    No Matches
    freetds-1.3.6/doc/userguide/AboutUnicode.html000644 025423 025423 00000015335 14162303411 022615 0ustar00fredianofrediano000000 000000 Appendix C. About Unicode, UCS-2, and UTF-8

    Appendix C. About Unicode, UCS-2, and UTF-8

    For better or worse, FreeTDS brings the otherwise innocent programmer into contact with the arcane business of how data are stored and transported. FreeTDS is a data communications library that of course connects to databases, which are charged with storing information in a way that is neutral to all architectures and languages. On the surface, that might not seem very complex, even worth discussing. Under the surface, things are not so simple.

    ASCII: What everyone knows

    The world we are all familiar with, programmingwise, is ASCII. Our email (mostly), our “text†files, our web pages (mostly), all use ASCII to represent English (or English-like) text. Perhaps because ASCII was standardized back in 1972 by the ISO, it seems like the “natural†way to store information. But let's look under the hood a little bit, and examine our assumptions.

    Our so-called “text†files are nothing special, nothing but a little agreement we enter into with our operating system. The only reason we can “read†them with cat or vi is that the operating system and its tools are in on the agreement. A file is only a stream of bytes, after all, no more “text†than an executable. The only thing distinguishing a “text†file from any other, is our understanding to treat it like one. We agree that the number 65 will represent the letter A, 66, B, and so on, 127 values in all. See man ascii for further details.

    The important thing to understand is that the designation of 65 for A and so on is a choice. It's an encoding standard, made necessary by the old simple fact that computers store numbers, not letters. ASCII is so ubiquitous these days that it's hard sometimes to remember there was a time when it was but one of a set of competing encoding standards. Others you probably have heard of include EBCDIC and the Baudot systems, but they are by no means the only historical alternatives, nor the only modern ones.

    The ASCII Compact

    UNIX® and unix-like systems bought into ASCII big time. Program code, filenames, string constants (and variables), configuration files, everything but everything is encoded in ASCII. Practically every utility, command, and library assumes the “text†data will be ASCII. At the dawn of the 21st century, there is widespread recognition that ASCII will no longer suffice, but the art of upgrading all the computers and computer programmers is, well, an unfinished work.

    freetds-1.3.6/doc/userguide/Advocacy.html000644 025423 025423 00000007120 14162303410 021755 0ustar00fredianofrediano000000 000000 Advocacy

    Advocacy

    Out of ten people you know, it's a fair bet 10 never heard of FreeTDS and nine don't understand the problem it solves. Lots of places have begun to use Microsoft SQL Servers in all sorts of ways, and if you adhere to the Microsoft line, there's only one way to connect to them: from a Microsoft OS.

    What can FreeTDS do that can't be done any other way? Glad you asked. FreeTDS can

    • Connect to every version of either vendor's server, using the same binaries.

    • Provide a CT-Library for Microsoft SQL Server. This feature alone allows DBD::Sybase and sqsh, among others, to connect to Microsoft's product.

    • Provide a modern DB-Library for Microsoft SQL Server: Win32/64, and TDS 7+.

    • Provide a bcp-capable interface and command-line utility on unix-like operating systems for Microsoft SQL Server.

    • Run on many more operating systems than either vendor's libraries do.

    • Get fixed, instead of telling you to get stuffed.

    • Amuse and inform. Also frustrate and infuriate, but we don't put that under “Advocacyâ€.

    If more people knew, fewer would be stuck.

    freetds-1.3.6/doc/userguide/Ambition.html000644 025423 025423 00000006522 14162303410 021773 0ustar00fredianofrediano000000 000000 Ambitious ideas

    Ambitious ideas

    If you want to get your hands really dirty, here are some big ideas to contemplate.

    libtds2

    After many years developing FreeTDS, we've learned quite a bit about the protocol and how to write database libraries. Unfortunately, though, one of the things holding us back — and, obviously hampering the project — is the underlying utility library.

    This wouldn't be a from-scratch effort; most of the code is already written. What's needed is a more uniform API that better reflects the TDS protocol, and that does not attempt character set conversions immediately on receipt of the data.

    libstddb

    This would be a new client library modelled after stdio, a project to demonstrate what database programming should be like.

    Server code

    FreeTDS includes a little stub of a server, but it could be much more useful. One idea would be to make it a front-end to SQLite, thereby creating for the first time a TDS client & server pair composed entirely of free software.

    freetds-1.3.6/doc/userguide/ChoosingTdsProtocol.html000644 025423 025423 00000024604 14162303407 024206 0ustar00fredianofrediano000000 000000 Choosing a TDS protocol version

    Choosing a TDS protocol version

    The TDS protocol version is probably something you'd rather not know even existed, much less something you'd have to choose. But there's not that much to it, really. Unless you run into an incompatibility, you're best off running with the highest protocol version supported by your server. That's what the vendors' own products do, which is why when you read the Sybase or Microsoft documentation you find no mention of TDS versions.

    Table 3.1. Versions of the TDS Protocol, by Product

    ProductTDS VersionComment
    Sybase before System 10, Microsoft SQL Server 6.x4.2Still works with all products, subject to its limitations.
    Sybase System 10 and above5.0Still the most current protocol used by Sybase.
    Sybase System SQL Anywhere5.0 only Originally Watcom SQL Server, a completely separate codebase. Our best information is that SQL Anywhere first supported TDS in version 5.5.03 using the OpenServer Gateway (OSG), and native TDS 5.0 support arrived with version 6.0.
    Microsoft SQL Server 7.07.0Includes support for the extended datatypes in SQL Server 7.0 (such as char/varchar fields of more than 255 characters), and support for Unicode.
    Microsoft SQL Server 20007.1Include support for bigint (64 bit integers), variant and collation on all fields. Collation is not widely used.
    Microsoft SQL Server 20057.2Includes support for varchar(max), varbinary(max), xml datatypes and MARS[a].
    Microsoft SQL Server 20087.3Includes support for time, date, datetime2, datetimeoffset.
    Microsoft SQL Server 2012 or 20147.4Includes support for session recovery.

    [a] Multiple Active Result Sets.


    Choosing protocol version since FreeTDS 1.1

    Version 1.1 improved the discovery of the protocol version. If you are using Microsoft SQL Server is recommended to leave the version to auto (the default). If you are using any Sybase product you could set version to 5.0 to get faster connections (although auto will work too).

    Choosing protocol version before FreeTDS 1.1

    Choosing the correct TDS protocol version for use with SQL Server can be confusing. Hopefully, these steps will lead you to the correct version. If you have a Sybase server, you should be able to use version 5.0, otherwise, if you have Microsoft SQL Server refer to the following section.

    • Step 1: Find out which FreeTDS version you are running. You can use the command: `tsql -C`

    • Step 2: Find out what version of Microsoft SQL Server you are running.

    • Step 3: Pick the lower TDS Version number out of what matches steps 1 and 2 from the table below.

    Table 3.2. What Version of the TDS Protocol Should I use with Microsoft SQL Server?

    FreeTDS VersionMicrosoft SQL Server Version SupportedHighest TDS Version SupportedMicrosoft Extended Support End Date
    1.0020167.4July 9th, 2024
    1.0020147.4July 9th, 2024
    1.0020127.4July 12th, 2022
    0.9520087.3July 9th, 2019
    0.9120057.2April 12th, 2016
    0.8220007.1April 9th, 2013
    0.6420007.1April 9th, 2013


    NOTE FOR USERS WHO NEED SQL SERVER 2000 SUPPORT (VERY RARE; SQL SERVER HAS BEEN OUT OF EXTENDED SUPPORT SINCE 2013 AND SHOULD *NEVER* BE USED IN PRODUCTION): Years ago, Microsoft didn't officially create a TDS version number until after FreeTDS was released, and it was assumed 8.0 would be the next version; it turned out to be 7.1. Because of this:

    • If you are running FreeTDS Version 0.64 or 0.82 with Microsoft SQL Server 2000, use TDS Version 8.0 instead of 7.1.

    • If you are running FreeTDS Version 0.91 or greater with Microsoft SQL Server 2000, use TDS Version 7.1.

    • Please note, this is ONLY if you need Microsoft SQL Server 2000 support.

    For best results, use the highest version of the protocol supported by your server. If you encounter problems, try a lower version. If that works, though, please report it to the mailing list!

    Regarding obsolete versions

    In the earlier days of FreeTDS, Microsoft did not release official specs for the TDS protocol. When MSSQL 2000 (product 8.0) was released, there was semi-official indications from the Microsoft community that the TDS protocol would be version 8.0. So the FreeTDS developers adopted that version for FreeTDS. Years later, when Microsoft started releasing official specs of the protocol, it became obvious that the TDS versions that FreeTDS had labeled 8.0 and 9.0 were actually versions 7.1 and 7.2 respectively.

    Version 8.0 cannot be used from FreeTDS version 1.3.

    TDS 4.2 has limitations

    • ASCII only, of course.

    • RPC is not supported.

    • BCP is not supported.

    • varchar fields are limited to 255 characters. If your table defines longer fields, they'll be truncated.

    • dynamic queries (also called prepared statements) are not supported.

    The protocol version may also affect how database servers interpret commands. For example, Microsoft SQL Server 2000 is known to behave differently with versions 4.2 and 7.0. Version 7.0 is recommended for compatibility with Microsoft SQL Server tools.

    freetds-1.3.6/doc/userguide/ConfirmInstall.html000644 025423 025423 00000044624 14162303407 023170 0ustar00fredianofrediano000000 000000 Confirm the installation

    Confirm the installation

    We want to make sure that when your application requests a connection to your server, it actually works. In detail, we want to know:

    • FreeTDS can find and read freetds.conf

    • servername exists in freetds.conf

    • a host property exists for servername

    • host can be resolved to a network address

    • the server is listening to the port or named instance

    • the user can log in to the server

    Each of the above can be confirmed independently with tsql. Once you're sure you can connect and log in, you can run the unit tests to see if the software works as promised.

    tsql

    The tsql utility is provided as part of FreeTDS expressly for troubleshooting. tsql is superficially similar to an isql, but uses libtds directly, bypassing the client libraries (e.g., DB-Library). It can also report where it looks for freetds.conf and other compile-time settings (with tsql -C).

    Example 3.2. Show compile-time settings with tsql

    	$ tsql -C 
    	Password: 
    	Compile-time settings (established with the "configure" script)
                            	    Version: freetds v1.3
            	     freetds.conf directory: /usr/local/etc
    	     MS db-lib source compatibility: no
            	Sybase binary compatibility: no
                    	      Thread safety: yes
                    	      iconv library: yes
                            	TDS version: auto
                            	      iODBC: no
                            	   unixodbc: no
            	      SSPI "trusted" logins: no
                            	    Keberos: no
                                        OpenSSL: yes
                                         GnuTLS: no
                                           MARS: yes 

    For details on the use of tsql, consult its man page.

    servername Lookup

    If all goes well, the first time you fire up tsql it connects and you can issue your first query. More often, though, the result is less joyous. Listed below for your troubleshooting pleasure are a variety of servername lookup failures and their corresponding messages.

    When servername cannot be converted to an address, up to two messages may result. Successful conversion (by any means) never produces an error message.

    Example 3.3. Failure to find servername in freetds.conf

    	$ tsql -S nobox -U sa 
    	Password: 
    	locale is "C"
    	locale charset is "646"
    	Password:
    	Error 20012 (severity 2):
    	Server name not found in configuration files.
    	Error 20013 (severity 2):
    	Unknown host machine name.
    	There was a problem connecting to the server
    	
    	$ host nobox
    	Host not found.


    In the above case message 20012 indicates nobox was not found in freetds.conf. The library then treated nobox as a network hostname but found it also not to be valid per DNS, leading to message 20013.

    If servername is found in the configuration files, but refers to an invalid hostname, only message 20013 is returned.

    Example 3.4. Failure to resolve hostname for servername

    	$ tsql -S nonesuch -U sa   
    	Password: 
    	locale is "C"
    	locale charset is "646"
    	Error 20013 (severity 2):
    	Unknown host machine name.
    	There was a problem connecting to the server


    Unfortunately, the “host machine name†(the right side of the host line in freetds.conf) isn't mentioned in the error message. Fortunately, this kind of setup problem is rarely encountered by users.

    Connecting to the Server

    If name lookup succeeds, FreeTDS next attempts to connect to the server. To connect means to form at TCP connection by calling connect(2). A valid connection must exist before any information can be exchanged with the server. Specifically, we need a connection before we can log in.

    A few things can go wrong at this point. The address returned by DNS may not be that of the machine hosting the server, or indeed of any machine! The machine may be down. The server may not be running. The server may be running but not listening to the port FreeTDS is attempting to connect to. In rare cases, both ends are correctly configured, but a firewall stands in the way.

    If no server accepts the connection, no connection can be established. It's difficult to know why, and the message is consequently vague.

    Example 3.5. Failing to connect with tsql

    	$ tsql -S emforester -U sa   #only connect?
    	Password: 
    	Msg 20009, Level 9, State -1, Server OpenClient, Line -1
    	Unable to connect: Adaptive Server is unavailable or does not exist
    	There was a problem connecting to the server


    If you get message 20009, remember you haven't connected to the machine. It's a configuration or network issue, not a protocol failure. Verify the server is up, has the name and IP address FreeTDS is using, and is listening to the configured port.

    Named instances provide another way for connections to fail. You can verify the instance name and the port the server is using with tsql -L.

    Example 3.6. Getting instance information with tsql

    	$ tsql -LH servername 
    	locale is "C"
    	locale charset is "646"
    	ServerName TITAN
    	InstanceName MSSQLSERVER
    	IsClustered No
    	Version 8.00.194
    	tcp 1433
    	np \\TITAN\pipe\sql\query


    servername could be configured to use instance MSSQLSERVER or port 1433.

    After a valid connection is formed, FreeTDS sends a login packet. The TDS protocol provides no way to interrogate the server for its TDS version. If you specify the wrong one, you'll get an error.

    Example 3.7. Using the wrong protocol for the server

    	$ tsql -S servername 
    	Password: 
    	Msg 20017, Level 9, State -1, Server OpenClient, Line -1
    	Unexpected EOF from the server
    	Msg 20002, Level 9, State -1, Server OpenClient, Line -1
    	Adaptive Server connection failed
    	There was a problem connecting to the server


    “Unexpected EOF from the server†seems to be a fairly common message when the wrong TDS version is used. Note that there's no complaint about the login.

    If the right TDS version is used, the server will accept the login packet and examine its contents to authenticate the user. If there's a problem, the server will say so. This is the first time we're receiving a message from the server. [8]

    Example 3.8. Login failure

    	$ tsql -S servername -U notme 
    	Password: 
    	Msg 18456, Level 14, State 1, Server [servername], Line 0
    	Login failed for user 'notme'.
    	Msg 20002, Level 9, State -1, Server OpenClient, Line -1
    	Adaptive Server connection failed
    	There was a problem connecting to the server


    Bypassing freetds.conf:

    tsql {-H hostname} {-p port} {-U username} [-Ppassword] [-C]

    Keep in mind that the TDS protocol version normally comes from freetds.conf. When using tsql this way, the library uses the compiled-in default (set by the configure script). If that's not what you want, override it using the TDSVER environment variable.

    Example 3.9. Connect with tsql using a hostname and port number

    	$ TDSVER=auto tsql -H hillary -p 4100 -U sa
    	Password: 
    	1>

    For details on tsql, see the its man page.

    Unit Tests

    The source code directory of each FreeTDS library includes a unittests directory. Although the directories are named unittests they are not unit tests, most of them require a configured database to work.

    	$ ls -d -1 src/*/unittests
    	src/ctlib/unittests
    	src/dblib/unittests
    	src/odbc/unittests
    	src/replacements/unittests
    	src/tds/unittests
    	src/utils/unittests

    The tests rely on the PWD file in root of the FreeTDS source tree. PWD holds a username, password, servername, and database to be used for the unit tests. We try to make sure to leave nothing behind: any data and objects created are either temporary or removed at the end of the test. The tests should all work, subject to disclaimers in the directory's README.md.

    To invoke the tests, edit the PWD file (you can copy from PWD.in which is a template) and issue the command make check. In order to execute all tests successfully, you must indicate a working, available servername in PWD. Some tests require permission to create stored procedures on server. In addition, some may require that a database named freetds_test exists on the server, and the user whose credentials are used during the testing process has sufficient permissions to create and manipulate tables in this database.

    To complete successfully, the ODBC tests require some additional setup. In your PWD file, add a SRV entry specifying the DSN entry for your odbc.ini. The ODBC tests all build their own odbc.ini and try to redirect the Driver Manager to it, however this functionality is very DM dependent and may well fail unless you have either iODBC or unixODBC.

    [Tip]Tip

    The PWD provided by FreeTDS includes usernames and passwords that probably don't exist on your server.



    [8] If you'd like to help the project and want to so something fairly easy but still useful, modify tsql to distinguish clearly between errors returned by the library, and those returned by the server. Errors should be marked “error†and don't return state or a line number, but can contain an error code (and message) from the operating system.

    freetds-1.3.6/doc/userguide/Contributors.html000644 025423 025423 00000004314 14162303410 022723 0ustar00fredianofrediano000000 000000 Contributors

    Contributors

    This user guide owes at least 100 words each to the following people.

    Brian Bruns
    James Cameron
    Allen Grace
    James K. Lowden
    Bill Thompson
    Frediano Ziglio

    freetds-1.3.6/doc/userguide/FreeTDShistory.html000644 025423 025423 00000010204 14162303407 023105 0ustar00fredianofrediano000000 000000 History of FreeTDS

    History of FreeTDS

    FreeTDS was and is developed by observation and experimentation, which is to say, by trial and error.

    In early 1997, the only option for connecting to a Sybase server from Linux or other free systems was an aging Sybase-released version of OpenClient. Unfortunately it had a few problems. The original release was a.out-based, although Greg Thain did a great service in converting the library to ELF. Secondly, it included only the newer CT-Library API. The older DB-Library API was missing.

    Brian Bruns, a Sybase DBA and originator of the FreeTDS project, had some DB-Library programs he wanted to run under Linux, and thus began the FreeTDS project. The original work focused on DB-Library and version 5.0 of the protocol, but quickly expanded to include a CT-Library compatible layer and TDS version 4.2. Later support for ODBC and TDS 7.0 and 7.1 was added. Craig Spannring wrote a Java JDBC driver which became FreeTDS/JDBC.

    As the project matured, it gained new participants. Frediano Ziglio greatly expanded the ODBC driver, and continues to improve both it and the underlying TDS library. Bill Thompson wrote most of the present BCP system and added cursors to our CT-Library. James K. Lowden joined the project to add documentation, and in 2002 became its maintainer. Such are the rewards for doing a good deed.

    There have been many other contributions. Please see the AUTHORS.md in the distribution for a (we hope) complete list.

    freetds-1.3.6/doc/userguide/ISO8859.html000644 025423 025423 00000012244 14162303411 021220 0ustar00fredianofrediano000000 000000 ISO 8859: What everyone would like to forget

    ISO 8859: What everyone would like to forget

    ASCII won, it would seem, but the race goes not to the swift. ASCII has many limitations, the most egregious of which is, it's not much good for anything besides English. It encodes all the letters and punctuation (almost) of the English alphabet, but is useless for German, Russian, and Greek, to say nothing of Chinese.

    ASCII assigns one byte to every character, but deals with only 7 of the 8 available bits, the range 0-127 (with the “high bit†always zero). Demand for computers that could display and print languages besides English — even English with em dashes and cent (¢) signs — arrived soon enough, with the Marketing Department way out in front of the propeller heads. The predictable result was an array of “8-bit ASCII†encoding standards for a wide variety of alphabets. Eventually, they were standardized (or at least enumerated and documented) by the ISO. These are what our friendly database vendors are referring to when they talk about character sets. More information on this subject can be found at webreference.com.

    The upshot is, there is no uniform standard, no agreement on the meaning of a byte, particularly if that byte's value is greater than 127. Let's say your client machine sends HELLO and your database stores it as 72 69 76 76 79. When another client retrieves that value, it will convert it into human-readable form by applying an encoding standard. If everything's tightly wrapped, it will use the very same encoding that your database used (and the same one you had in mind when you sent it), and that client will also see HELLO. If things are not so tightly wrapped but that client is fortunate enough to be using a similar standard to what you were using, say, ISO 8859-1, he'll still see HELLO. Most languages based on the Roman alphabet can be represented by ISO 8859-1, and are thus interchangeable. Beyond that, things get quickly messy. Greek clients, for one, are not so lucky: there are three ISO 8859 standards for Greek, all mutually incompatible. For more information, see ISO 8859 Alphabet Soup. Roman Czyborra's site is very informative; take your time there if you don't want your head to spin.

    Database servers need to know what encoding standard to employ, too. It's not obvious at first, but notions like “uppercase†and “lowercaseâ€, trailing blanks, and collation rules all depend on what letter is meant by what number. (Collation even depends on what culture is interpreting the letters.)

    freetds-1.3.6/doc/userguide/IsolateCause.html000644 025423 025423 00000010527 14162303410 022612 0ustar00fredianofrediano000000 000000 Isolate the cause

    Isolate the cause

    Successful problem isolation will yield earliest resolution. You (believe it or not) have more information about your environment than anyone else does, and have the greatest motivation to solve your problem. The resources at your disposal will be much more useful if the problem is specific. (Sorry if this is obvious. If it is, you might be surprised how often it's not.)

    If you can demonstrate the problem with tsql or sqsh, you can expect a quick answer to your question, possibly even a fairly quick fix. (It has happened several times in the last few years that bug reports to small problems were fixed the same day. On a few occasions, new functions were added in a few days. Making FreeTDS useful and bugless is the goal of the project, after all.)

    FreeTDS being what it is, problems frequently arise amidst complex environments. It can be hard for both you and the list participants — who are your allies and best resource — to determine what's going wrong. If you can submit a script that they can use to try to reproduce your results, you have a much better chance of happy resolution.

    On the plus side, the list includes people with a variety of backgrounds, who frequently answer questions that aren't really about FreeTDS per se. Clear questions have sometimes even led to submitting patches to other projects.

    Try a different client

    FreeTDS comes with its own utilities that use the various libraries. It's a good idea to run your query through one of them — the one that uses the same API you're using — to see if it produces the same behavior you're seeing. That helps eliminate your application (and the rest of the calling hierarchy) as a source of the problem.

    Check permissions

    If your query works in tsql but not with Apache, make sure the account running Apache can find and read freetds.conf. Also consider security settings like firewalls, SELinux/AppArmor or similars.

    freetds-1.3.6/doc/userguide/Light.taper.html000644 025423 025423 00000005460 14162303410 022412 0ustar00fredianofrediano000000 000000 Light another's taper

    Light another's taper

    Every question you answer on the mailing list will save someone time and, if done well, will actually improve your own knowledge. The project's developers will often answer technical questions that require substantial understanding of the code or suggest a possible bug. Setup issues, though — connecting and logging in to the server, getting Apache going — are questions many experienced users can and do answer, thereby fostering the community on which the project depends.

    Your experience may well be more closely aligned with the question posed than that of anyone else reading the list that day. You may use that framework or language or OS, or have that particular server. No one, no matter how expert in the code, has used every configuration, version, OS, compiler, etc. Whether you simply confirm there's a problem in some particular arrangement, or say, “dunno, works for meâ€, you're adding information.

    freetds-1.3.6/doc/userguide/Localization.html000644 025423 025423 00000026202 14162303407 022664 0ustar00fredianofrediano000000 000000 Localization and TDS 7.0

    Localization and TDS 7.0

    TDS 7.0 uses 2-byte Unicode (technically, UCS-2, recently UTF-16) to transfer character data between servers and clients. Included in “character data†are query text (i.e., SQL), metadata (table names and such), and bona fide data of datatypes nchar, nvarchar, and ntext. (Background information on Unicode and how it affects FreeTDS can be found in the appendix.)

    Because most Unix tools and environments do not support UCS-2, FreeTDS provides for conversion by the client to other character sets. The mechanism used is determined by the configure script, which looks for a iconv(3) function, an implementation of the iconv standard. If no iconv library is found, or if it is explicitly disabled, FreeTDS will use its built-in iconv substitute, and will be capable of converting among only ISO 8859-1, UTF-8, UCS-2, UTF-16 and UTF-16.

    To learn what character set the client wants, FreeTDS prefers the applicable freetds.conf client charset property. If that is not set, it parses the LANG environment variable. In either case, the found string is passed to iconv(3) (or its built-in replacement). [17]. If neither is found, UCS-2 data are converted to ISO 8859-1.

    To list all supported iconv character sets try iconv(1). GNU's does:

    	$ iconv --list

    For other systems, consult your documentation (most likely man iconv will give you some hints).

    In this example a server named mssql will return data encoded in the GREEK character set.

    Example 5.2. Configuring for GREEK freetds.conf setting

    	[mssql]
    	host = ntbox.mydomain.com
    	port = 1433
    	client charset = GREEK
    	

    If FreeTDS runs into a character it can not convert, its behavior varies according to the severity of the problem. On retrieving data from the server, FreeTDS substitutes an ASCII '?' in the character's place, and emits a warning message stating that some characters could not be converted. On sending data to the server, FreeTDS aborts the query and emits an error message. It is well to ensure that the data contained in the database is representable in the client's character set.

    If you have a mix of character data that can not be contained in a single-byte character set, you may wish to use UTF-8. UTF-8 is a variable length unicode encoding that is compatible with ASCII in the range 0 to 127. With UTF-8, you are guaranteed to never have an unconvertible character.

    [Important]Important

    FreeTDS is not fully compatible with multi-byte character sets such as UCS-2. You must use an ASCII-extension charset (e.g., UTF-8, ISO-8859-*)[18]. Great care should be taken testing applications using these encodings. Specifically, many applications do not expect the number of characters returned to exceed the column size (in bytes).

    In the following example, a server named mssql will return data encoded in the UTF-8 character set.

    Example 5.3. Configuring for UTF-8 freetds.conf setting

    	[mssql]
    	host = ntbox.mydomain.com
    	port = 1433
    	client charset = UTF-8
    	

    It is also worth clarifying that TDS 7.0 and above do not accept any specified character set during login, as 4.2 does. A TDS 7.0 login packet uses UCS-2.

    Microsoft Server Note

    String literals in SQL must be prefixed with 'N' unless the enclosed string can be represented in the server's single-byte character set, irrespective of the column's datatype. For example, in the SQL statement

    	INSERT INTO tablename (greeting) VALUES ('Hallå')

    the string is subject to somewhat surprising treatment by the server.

    When the server parses the SQL, it extracts the data values for insertion (or update, or comparison, etc.) Unprefixed strings are converted to the single-byte character set of the server/database.[19] Inserted data are then of course stored in the column. In the case of UCS-2 columns — nchar, nvarchar, and ntext — the value stored is that which results from a second conversion: from the single-byte form to the UCS-2 form.

    The only safe way to enclose strings in SQL text is with an 'N' prefix:

    	INSERT INTO tablename (greeting) VALUES (N'Hallå')

    Commentary

    What's surprising about this? Versions 7.0 and later of the TDS protocol use UCS-2 to send SQL text. No matter how your local client is configured — with UCS-2 or ISO 8859-1 or anything else — it's converted to UCS-2 before it's sent to the server. And obviously arrives at the server as UCS-2. If the column into which it's being inserted is also UCS-2, there's no need of any conversion, much less two, and certainly no need to lose information.

    Why this happens is anyone's guess. Here's one: it makes the datatype of the column unimportant. Regardless of whether you use char/varchar/text or nchar/nvarchar/ntext or a mixture of the two, the arriving SQL (if naïvely written) will store exactly the same characters.



    [17] The built-in replacement expects GNU iconv names: ISO-8859-1, US-ASCII, or UTF-8.

    [18] not EBCDIC or other weird charsets

    [19] The precise rules are unknown to the author.

    freetds-1.3.6/doc/userguide/OdbcConnAttr.html000644 025423 025423 00000022250 14162303407 022553 0ustar00fredianofrediano000000 000000 Connection attributes

    Connection attributes

    The following tables define all possible ODBC connection attributes for the FreeTDS ODBC driver. Which ones you'll need depends on how you set yourself up. They may appear in your connection string, or in odbc.ini.

    Table 4.1. Connection attributes used only in connection strings

    NamePossible ValuesDefaultMeaning
    DSNA valid DSN entrynoneThe DSN to which FreeTDS should connect. FreeTDS will search odbc.ini for entry. It lets you specify a connection as for SQLConnect, but using SQLDriverConnect. Do not use Servername and DSN together.
    UIDAny valid usernamenoneThe username to be used when connecting. To use domain authentication, specify the domain using the format domain\username.
    PWDAnyemptyThe password to be used when connecting.
    WSIDAnyComputer nameThe name of the local computer, sent to server. Can be specified only for a DSN-less connection.


    Table 4.2. Connection attributes that may appear in odbc.ini

    NamePossible ValuesDefaultMeaning
    ServernameA valid freetds.conf server sectionnoneA freetds.conf servername, not a hostname as known to DNS. If you want to use ODBC-only configuration, use Server instead.
    ServerA server name or (ip) addressnoneHostname of a server. Used in an ODBC-only configuration. To specify a Microsoft SQL Server instance, use the form server\instance.
    PortAny TCP portDepends on the TDS version specified with configureThe TCP port where the servername is listening.
    TDS_VersionAny valid protocol versionDepends on the TDS version specified with configureTDS protocol version to use (e.g., 5.0, 7.0).
    ClientCharset or Client_CharsetA name recognized by the iconv library linked to FreeTDS. Corresponds to client charset in freetds.conf. Client_Charset is for compatibility with NCBI C++ ToolKit.ISO 8859-1Character set (encoding) used by the client.
    APPFree form text, up to 30 characters. noneApplication name. Identifies the connecting application to the server.
    LanguageAnyus_english(Human) language the server should use for error messages.
    AddressAnynoneIP address of the servername. Useful if you want to specify a server by address, rather than by name. The format is ip,port or simply ip in standard dotted-decimal notation.
    DatabaseAnynoneSpecify which database you want to access. If the database does not exist or the user lacks permission to access it, the connection will fail.
    TextSizeAnyServer-dependentMaximum size returned from server for blobs.
    PacketSizeAnyServer-dependentSize of packets to server. Some users saw some performance gain by increasing this value. Normally you shouldn't set it.
    Trusted_ConnectionYes/NoNoUse your current account instead of UID/PWD attributes. This option require SSPI or Kerberos and supersedes any UID/PWD attributes passed from the application.
    Encryptionoff/request/requireoffSpecify encryption. See encryption on freetds.conf
    MARS_ConnectionYes/NoNoEnable MARS for this connection.
    UseNTLMv2Yes/NoNoUse NTLMv2 instead of normal NTLM. Use this option if your Windows domain have this setting.
    REALMMachine domainnoneKerberos REALM.
    ServerSPNAny valid SPNMSSQLSvc/server FQDN:portFull server Kerberos SPN.
    AttachDbFilenameserver filename (mdf/sdf)noneMSSQL allow to attach a database while connecting to a server. This setting allow to do it. You should specify Database attribute to set the name of the database that will be used.
    DumpFileAny File name where to dump logs.
    DumpFileAppendYes/NoNo 
    DumpFlagsAny Debug flags. See freetds.conf entries.
    ApplicationIntentReadWrite/ReadOnlyReadWriteTell application intent. See read-only intent on freetds.conf.
    TimeoutInteger number Query timeout in seconds.


    freetds-1.3.6/doc/userguide/PortOverride.html000644 025423 025423 00000007155 14162303407 022666 0ustar00fredianofrediano000000 000000 Port/instance override syntax

    Port/instance override syntax

    The port to which to connect can be overridden using a FreeTDS extended syntax.

    A port may be appended to the servername in the form servername:port. FreeTDS will attempt to connect to specified port. Please note port must be a number; a service name is not supported.

    If you specify servername\instance as servername during login, FreeTDS will attempt to connect to specified instance. Only Microsoft SQL Server instances are supported. (This server feature was introduced with Microsoft SQL Server 2000.)

    Note that other freetds.conf properties still apply.

    For the technically curious: each Microsoft SQL Server instance appears on the network as a server listening at a port. The old way — and it still works — is to designate each instance in freetds.conf as a separate server. The new “named instance†notation, if we can call it that, instead uses the server to discover the port. The library sends a UDP packet containing the instance name to the server at a well known port, port 1434. The server responds with a port number. FreeTDS then uses that number to connect in the usual way.

    freetds-1.3.6/doc/userguide/Python.html000644 025423 025423 00000011632 14162303410 021510 0ustar00fredianofrediano000000 000000 Python

    Python

    pymssql

    The pymssql module is a simple database interface to Microsoft SQL Server for Python that builds on top of FreeTDS to provide a Python DB-API v2 (PEP-249) interface to Microsoft SQL Server.

    The 2.x branch of pymssql take advantage of recent releases (0.91 and newer) of FreeTDS and by doing that removes many of the limitations previously found with older FreeTDS versions and the 1.x branch.

    pymssql features include:

    • Unicode friendly

    • Python 3 friendly

    • Works on most popular operating systems

    • Written in Cython for performance

    • Includes a supported and documented low-level module (_mssql) that you can use instead of the DB-API

    • Supports stored procedures with both return values and output parameters

    • A comprehensive test suite

    Please refer to the pymssql home page where you'll find complete documentation on how to obtain, install and use it.

    Sybase module

    You can obtain the Python Sybase module here. This example uses version 0.37, the most current at the time of this writing, please adjust accordingly if using a different version.

    	$ tar xvfz sybase-0.37.tgz
    	$ cd sybase-0.37
    	$ export SYBASE=/usr/local/freetds
    	$ export CFLAGS="-DHAVE_FREETDS"
    	$ export LD_LIBRARY_PATH=/usr/local/freetds/lib:${LD_LIBRARY_PATH}
    	$ python setup.py install

    Edit the example.py and fix the bottom stuff, FreeTDS lacks the 110 symbols for version use 100

    	$ python example.py
    freetds-1.3.6/doc/userguide/Unicode.html000644 025423 025423 00000007631 14162303411 021622 0ustar00fredianofrediano000000 000000 Unicode: East meets West

    Unicode: East meets West

    ASCII and its 8-bit cousins are on the way out, and with them the assumption that a character can be represented by a single byte. The new kid on the block is Unicode, similar to but not precisely the same as ISO 10646. Unicode (despite its name) is a set of standards. The most widely implemented is the 16-bit form, called UCS-2. As you might guess, UCS-2 uses two bytes per character, allowing it to encode most characters of most languages. Because “most†is far from all, there are nascent 32-bit forms, too, but they are neither complete nor in common use.

    In the same sense that 7-bit ASCII was extended to 8 bits, Unicode extends the most prevalent “8-bit ASCIIâ€, ISO 8859-1, to 16 and 32 bits. The first 256 values remain in Unicode as in ISO 8859-1: 65 is still A, except instead of being 8 bits (0x40), it's 16 bits (0x0040). Unlike the 8-bit extensions, Unicode has a unique 1:1 map of numbers to characters, so no language context or “character set†name is needed to decode a Unicode string.

    UCS-2 was the initial system employed by Microsoft NT-based systems while recent versions moved to UTF-16. Microsoft database servers store UCS-2/UTF-16 strings in nchar and nvarchar datatypes. Microsoft also designed version 7.0 (and up) of the TDS protocol around UCS-2/UTF-16: all metadata (table names and such) are encoded according to these encoding on the wire.

    freetds-1.3.6/doc/userguide/UnicodeFreeTDS.html000644 025423 025423 00000011537 14162303411 022777 0ustar00fredianofrediano000000 000000 Unicode and FreeTDS

    Unicode and FreeTDS

    Microsoft servers using TDS 7.0 and above (anything since Microsoft SQL Server 6.5) transmit their data in UCS-2 format (16-bit integers). Because most applications linked to FreeTDS are not prepared to deal with UCS-2 data, FreeTDS can convert the data to something more acceptable, including ASCII. To do so, it employs an iconv library. FreeTDS determines the server's encoding from the TDS protocol and information reported by the server (generally per connection, but in the case of TDS 7.1, per result set column). It discovers the client's encoding in freetds.conf. FreeTDS will happily convert and convey your data in any single-byte format that iconv can provide. In practice, this normally means some form of ISO 8859-x or UTF-8.

    At some future time, FreeTDS aims to support Unicode and other multi-byte character sets. It does not do so at the current time, beside using wide functions in ODBC.

    Sybase servers, by the way, adhere to a “server makes right†policy: they transmit their data in whatever character set the client requested at login time. The list of available character sets is fairly short, but includes UTF-8. While FreeTDS could convert Sybase data streams as easily as it does Microsoft data streams, to our knowledge no one is doing so. The Sybase server can perform the conversion itself, making FreeTDS's capability in this regard largely redundant and irrelevant.

    For further information

    UTF-8 and Unicode FAQ for Unix/Linux, by Markus Kuhn. As the man says, very comprehensive.
    ASCII: American Standard Code for Information Infiltration, by Tom Jennings. Everything you ever wanted know about ASCII, but didn't know whom to ask.
    A Brief History of Character Codes, by Steven J. Searle. Includes useful references.
    Unicode Home Page.
    freetds-1.3.6/doc/userguide/UnicodeUtf.html000644 025423 025423 00000012334 14162303411 022275 0ustar00fredianofrediano000000 000000 Unicode Transformation Format: UTF-8

    Unicode Transformation Format: UTF-8

    The presence of nulls embedded in character data and of byte order issues make straight Unicode i.e., UCS-2 or UCS-4 hard to work with in a heterogeneous environment. Too many opportunities arise for the data to be truncated or misinterpreted, and too many systems would fail even to transmit such data. In short, when 16-bit data are thrust into a multi-architecture 8-bit world, it frequently bodes ill for the data.

    To answer that problem, to make Unicode transmissible and unambiguous to most machines, several “transformation formats†were adopted. Their goals were generally similar: to create a generally recognized format that would unambiguously and safely convey Unicode information between machines and across the Internet. To do that, they sought to remove nulls and endianism from the data stream. The most popular one — practically the only one used — is known as UTF-8.

    UTF-8 found wide acceptance for many reasons. UTF-8 represents any Unicode character as a combination of 1-4 bytes. The number of bytes required depends on the integer value of the Unicode character, and only one byte is used to represent the old ASCII range (0-127). UTF-8 does not use zero to represent any part of any character (except for the ASCII NUL). In consequence, UTF-8 is efficient with respect to space, has no endianism issues, and embeds no nulls. UTF-8 strings can be treated as plain old ASCII strings. These properties make UTF-8 data relatively easy for systems accustomed to processing ASCII data.

    Here's a small example showing the difference between UCS-2 and UTF-8.

    Example C.1. “HELLO†in UCS-2 and UTF-8

    	$ echo HELLO | iconv -f ascii -t UCS-2 | hexdump -C
    	00000000  00 48 00 45 00 4c 00 4c  00 4f 00 0a              |.H.E.L.L.O..|
    	0000000c
    	$ echo HELLO | iconv -f ascii -t utf-8 | hexdump -C
    	00000000  48 45 4c 4c 4f 0a                                 |HELLO.|
    	00000006
    	$ echo HELLO | hexdump -C
    	00000000  48 45 4c 4c 4f 0a                                 |HELLO.|
    	00000006


    It is the similarity of the last two outputs that makes UTF-8 so attractive. It behaves like ASCII when ASCII's all that's needed. But it lacks ASCII's limitations.

    While UTF-8 solves many technical problems, it doesn't magically transform every ASCII-assuming system into a Unicode system. For example, to display Unicode data correctly — even Unicode data in UTF-8 format — the system still needs a suitable font. And it must distinguish the buffer size (and byte count) from the character count.

    freetds-1.3.6/doc/userguide/Unicodegoodbad.html000644 025423 025423 00000011366 14162303411 023142 0ustar00fredianofrediano000000 000000 Unicode's Pluses and Minuses

    Unicode's Pluses and Minuses

    You will read from time to time that Unicode is not perfect. Surprise, surprise: it's true. From a linguistic point of view, Unicode is incomplete; in particular, UCS-2 is demonstrably too small (!) to hold all the forms of Chinese ideographs used over the centuries. (It is, however, quite useful and widely employed in representing modern Chinese.) Of more common concern to programmers are Unicode's technical problems, or rather, Unix's technical shortcomings vis-a-vis any encoding more complex than ISO 8859-x.

    The basic problem, from a programmer's perspective, is the ancient agreement Unix entered into 30 years ago, the “ASCII Compact,†alluded to earlier. Assumptions about ASCII are littered throughout Unix-like systems, beginning with C's convention of representing strings as arrays of characters ending in a zero. Returning to our HELLO example earlier, C will store HELLO as 72 69 76 76 79 0, in very nice ASCII. Many many parts of the operating system and its associated tools and applications will recognize that as a 5-letter word because it's terminated by a null (zero). In UCS-2 Unicode, though, that same HELLO uses 2 bytes for every character and becomes 72 0 69 0 76 0 76 0 79 0 0 0. Practically the whole OS will think that's a 1-letter word, “Hâ€. Not a good thing.

    Even if every OS were magically rid of all ASCII assumptions and C strings, there would still be the problem of Endianism. Technical explanations on the subject are not hard to find. The long and short of it is, given a 16-bit integer (2 bytes), different hardware architectures will store the value differently. Asked to store our friend “Aâ€, (0x41), for instance, a Sparc processor will put the least significant byte at the higher address (00 41) whereas an Intel processor will put it in the lower address (41 00). Put aside the questions of left, right, and wrong; architectures are a fact of life. Endianism shows up wherever integers are stored and retrieved in heterogeneous environments.

    The Unicode folks knew about Endianism, of course, and had to address it. A Unicode bytestream is supposed to begin with a byte-order mark. Needless to say, perhaps, many don't.

    freetds-1.3.6/doc/userguide/about.html000644 025423 025423 00000011541 14162303407 021346 0ustar00fredianofrediano000000 000000 About this User Guide

    About this User Guide

    This User Guide describes FreeTDS 1.3. It is the product of (lots of) happy collaborative effort. Although Brian's name and mine are at the top of it, behind it are many others, who contributed thoughtful suggestions, bamboozled questions, stellar prose, and terse instructions. I don't mention this for the usual reasons (the enumeration of which I leave to you) but rather to emphasize that the purpose of our effort is to help you and those who come after you to have the easiest and most enjoyable time with FreeTDS.

    It is surprisingly hard, after a while, to remember how it can be for someone newly approaching a project to use it. What seems as obvious as a fog horn to an old hand may be much more like the fog itself to the newcomer. That can make installing and setting up new software a puzzling or frustrating experience. You may have heard, “It's easy if you know how.†Indeed it is, and that's our purpose here: to make it easy, by letting you know how.

    This guide is here for you, and we hope that you will be here for it, that others might benefit from your experience or inexperience. The most recent version [1] can be found on the FreeTDS web site, where you will also find the most up to date FAQ, as well as links to the anonymous and browseable git repository. If you find something wrong, unclear, badly put, misleading, or incorrigible, I hope you will let us know. Post your musings or rants to the mailing list (see Helping). Patches to doc/userguide.xml are especially welcome, of course. By taking the time let us know what you think, perhaps the path to enlightenment will be made a little smoother for the fellow behind you.

    A few technical notes. This guide is written in XML DocBook format, specifications for which are found in the DocBook book. It was converted to HTML with xmlto. The XML text is distributed with the rest of the source code, and may be edited with your favorite or least favorite text editor.

    Enough. Let's begin.

    --jkl



    [1] The version you're reading is:

    Date: 2021-12-26 20:20:05 +0000
    Git Id: 9082a31490f46070244a814189b0bd5ee419655c
    freetds-1.3.6/doc/userguide/acknowledgments.html000644 025423 025423 00000010522 14162303410 023411 0ustar00fredianofrediano000000 000000 Chapter 12. Acknowledgments

    Chapter 12. Acknowledgments

    Table of Contents

    Codesmyths
    Contributors

    Codesmyths

    Many people, too many to mention, have contributed patches and located bugs. The primary names are:

    Brian Bruns (brian@bruns.org) Arno Pedusaar (psaar@fenar.ee)
    Started this crazy thingDonated his TDS4.2 code to the cause
    Mihai Ibanescu (misa@dntis.ro) Mark Schaal (mark@champ.tstonramp.com)
    GNUified the packetCleaned up message handling, more datatype support, bug fixes
    Gregg Jensen (greggj@savvis.com) Craig Spannring (cts@internetcds.com)
    Message handlers and extra datatype support and some sybperl stuffWrote the JDBC and DBI drivers
    James K. Lowden (jklowden@schemamania.org) Bill Thompson (thompbil@exchange.uk.ml.com)
    Wrote most of the documentation. Helped out here and there. Completer of the DB-Library bcp API and author of freebcp.
    Steve Murphree (smurph@smcomp.com) Frediano Ziglio (freddy77@gmail.com)
    Added more ODBC functionality. Extended the ODBC library, and added many, many fixes and enhancements to libtds.

    freetds-1.3.6/doc/userguide/apireference.html000644 025423 025423 00000010776 14162303410 022667 0ustar00fredianofrediano000000 000000 API Reference Manual

    API Reference Manual

    The reference manual is installed as part of FreeTDS. It can be regenerated at any time using Doxygen with cd doc; make doc.

    The reference manual is a work in progress: only DB-Library is completely documented, and quite minimally at that. Should you find it inadequate, you may be interested to learn it's not hard to add to, technically. Doxygen generates a manual from encoded comments in the source code. Its markup syntax is not hard to learn. You can read more about it at the Doxygen website.

    Basic API coverage information for the db-lib, ct-lib, and ODBC client libraries is maintained in doc/api_status.txt, included in the source distribution. For your convenience and enjoyment, we include that file in the following sections. In each table, we note for the function [25] the extent to which it is implemented. The Status field may be:

    DB-Library API function status domain

    (blank)

    Function is not implemented.

    stub

    Function is implemented as a stub. Some such functions return SUCCEED even though they have no effect, to satisfy upper layers.

    Partial

    Function is partly implemented. We haven't dealt with every possible option, for instance.

    OK

    Function is implemented. Completely, we claim.



    [25] Sybase and Microsoft sometimes use slightly different names for the same function. It is the intention of the --enable-msdblib option to align FreeTDS with one or the other's convention.

    freetds-1.3.6/doc/userguide/appendmode.html000644 025423 025423 00000007707 14162303407 022361 0ustar00fredianofrediano000000 000000 Appending Dump Files

    Appending Dump Files

    When running FreeTDS with applications such as Apache/PHP it is often difficult to get a usable log file. Since each of the many httpd children opens the file at the beginning of its connection and closes it on connection close, they tend to stomp all over each other. In append mode, the log file is opened for append each time it is written to and then immediately closed. If you are experiencing problems when running under Apache (or similar application) use append mode to generate useful logs.

    Example 5.7. Turning on Dump File Append mode in freetds.conf

    				[mssql]
    				host = ntbox.mydomain.com
    				port = 1433
    				dump file = /tmp/freetds.log
    				dump file append = yes
    				

    In this example, the /tmp/freetds.log file will contain log entries for all processes using the Microsoft SQL Server server, identified by pid.

    [Important]Important

    Because there will be one log file being opened and closed more or less continuously, there is going to be a negative impact on performance. Also, be advised that the log file will grow quite large.

    As an alternative to FreeTDS logging, you might also consider using tcpdump or wireshark to log network packets. While not as useful as a TDS log, it can also help to identify problems.

    freetds-1.3.6/doc/userguide/askingforhelp.html000644 025423 025423 00000012473 14162303410 023067 0ustar00fredianofrediano000000 000000 What to include when asking for help

    What to include when asking for help

    Waddya got?

    It's important to convey your setup and configuration.

    SQL Server version
    FreeTDS version (or snapshot date, if not a release)
    any options used with configure
    which client library you are using
    what language or Perl module, as appropriate, you're using
    your client OS and hardware architecture

    Attach a logfile

    If you're puzzled by some interaction with the server (often the case), it's a very good idea to set TDSDUMP and attach the log to your message. Messages are currently limited to 75 KB attachments, and the logs are quite detailed, so make your query as short as possible. If necessary, trim the log; gzip is also your friend here. It's always a good idea to post it on a website where people can fetch it if they're so inclined.

    Log files are especially important if you're not programming at the C level. Sometimes there are problems — an impedance mismatch, to coin a phrase — between FreeTDS and the calling framework/language. But if you write to the list and say “Why does my PHP foo() returns an empty string?â€, please keep in mind that your question might as well be in Urdu to someone familiar with the C library. Without knowing which C function was called, and with what data, it's impossible to even begin to try to answer the question.

    Think about it this way: If you attach a log no one reads, you wasted some bandwidth. If you don't attach one and someone asks you for it, you wasted a day. Like that.

    Show your work

    Great questions make the problem crystal clear to a tired developer after supper.

    Show what you did, and show what happened. Throughout this User Guide, you've seen examples of screenshots; in each case the first line was the command entered, followed by the machine's response. By showing verbatim what you did and saw, you give someone who knows what to do a chance to look over your shoulder. Across the Internet! How cool is that?

    Whether you're having a problem with your own application or with something at a higher level, you're well advised to try to reproduce it using one of the FreeTDS utilities, preferably one that used the same client library you're using. If, say, bsqldb works and your program doesn't, that's a clue. By the same token, if bsqldb exhibits problems, too, chances are you found a bug. Or — how to say it? — a missing feature. It's always good to know about those.

    freetds-1.3.6/doc/userguide/build.html000644 025423 025423 00000012340 14162303407 021331 0ustar00fredianofrediano000000 000000 Chapter 2. Build FreeTDS

    Chapter 2. Build FreeTDS

    If you build it they will come.

    The GNU World

    FreeTDS uses GNU Autoconf, Automake, and libtool[4] to increase portability.

    For many people, the preceding sentence says it all (good or bad). If you're familiar with the GNU system, you can probably just download the tarball and get away with scanning the README.md impatiently and then following your instincts. Because everyone is a beginner once and no one is an expert at everything, we'll try to explain things in plain English where possible, and to define our terms as we go along.

    If the following nevertheless reads like gibberish, you might very well want to use something prepackaged (see Alternatives). If it reads like a vaguely intelligible alien script that might yield to intensive research, we've included links to some of the usual suspects at the end of this chapter. If it reads like a bad explanation of something you could explain better, please send us your version!



    [4] Versions used for this release

    • autoconf (GNU Autoconf) 2.69

    • automake (GNU automake) 1.15

    • ltmain.sh (GNU libtool) 2.4.6

    freetds-1.3.6/doc/userguide/config.html000644 025423 025423 00000047432 14162303407 021511 0ustar00fredianofrediano000000 000000 How to build: Configure and make

    How to build: Configure and make

    If you've built other GNU projects, building FreeTDS is a fairly straightforward process. We have a terse and verbose description.

    [Note]Note

    FreeTDS is known to build with GNU and BSD make. If you encounter a large number of build errors, and your operating system's make is not GNU make (as is the case on most non-GNU/Linux systems), you may wish to install GNU make from ftp.gnu.org.

    For Experts

    	$ ./configure --prefix=/usr/local
    	$ make
    	$ su root
    	Password: 
    	$ make install

    Building from git is described in the file INSTALL.GIT.md.

    For Everyone Else

    The GNU development system can generate code for a wide variety of hardware architectures and operating systems, virtually all of which can run FreeTDS in consequence. The work of building and installing the FreeTDS libraries begins with the command configure, which generates the Makefile that governs how the code is compiled, linked, and installed. Once you've “configured†the project, make will manage the rest of the build.

    The simplest form of running configure is:

    	$ ./configure

    and sometimes that's enough. configure accepts command-line arguments, too, and you may need to provide some, depending on your environment.

    There are a few optional arguments to configure that may be important to you. For a complete list, see configure --help.

    configure options

    Directories and TDS version

    --prefix=PREFIX

    install architecture-independent files in PREFIX. When you run make install, libraries will be placed in PREFIX/lib, executables in PREFIX/bin, and so on.

    The default is /usr/local if this argument is not passed to configure.

    --sysconfdir=DIR

    read-only single-machine data in DIR

    The default is PREFIX/etc (PREFIX being the value of --prefix=PREFIX, above) if this argument is not passed to configure.

    --with-libiconv-prefix=DIR

    Specifies the location of the iconv library to use. configure will search for libiconv in the usual places; use --with-libiconv-prefix if it's unsuccessful (assuming you want to use iconv, of course). Overridden by --disable-libiconv, below.

    Version 0.95 removed support for iconv which cannot convert from any encoding to any encoding. This affect potentially systems like Tru64 and HP-UX were iconv mainly convert from/to ucs2. It's recommended to use GNU libiconv in this case.

    --with-tdsver=VER

    Specifies the default TDS version. (There are a couple of ways to set the TDS version at run-time. This parameter takes effect if no run-time settings are provided.) Acceptable values of VER are 5.0, 7.1, 7.2, 7.3 and 7.4.

    The default is auto if this argument is not passed to configure.

    ODBC Driver Managers

    --with-iodbc , --with-iodbc=DIR , --with-unixodbc=DIR

    Specify a particular ODBC driver manager and the directory in which it is installed. The --with-iodbc form chooses iODBC as the driver manager, and --with-unixodbc specifies unixODBC as the driver manager. The directory argument is required for --with-unixodbc, but may be omitted for --with-iodbc; pkg-config will be used to find your iODBC installation if the directory is omitted. Typical directory arguments are /usr and /usr/local.

    So long as either iODBC or unixODBC are installed, the build system will detect your driver manager by default. As a result, these options are only needed if you wish to override the default behavior.

    It is an error to specify both --with-iodbc and --with-unixodbc.

    --with-odbc-nodm=DIR

    If you're building the ODBC driver and not using a Driver Manager, use this option to indicate the location of the .h files. configure will not cause the ODBC driver to be built unless this option is used or a DM is detected/specified.

    Things you can turn off

    --disable-odbc

    Do not attempt to detect ODBC, and do not build the ODBC driver. In case you don't care about ODBC.

    --disable-apps

    Do not attempt to build applications like tsql.

    --disable-server

    Do not attempt to build server stuff.

    --disable-pool

    Do not attempt to build pool stuff.

    --disable-libiconv

    By default, configure will search your system for an iconv library for use with Microsoft servers (because TDS 7.0 employs Unicode). This switch prevents that search. If no iconv library is used, FreeTDS relies on its built-in iconv emulation, which is capable of converting ISO-8859-1 to UCS-2, sufficient for many applications.

    --disable-threadsafe

    Force FreeTDS not to use threadsafe versions of functions such as gethostbyname_r() where available. Rely instead on the older and non-threadsafe ones such as gethostbyname(). configure tests some of these functions. If the tests are successful, FreeTDS will use threadsafe functions throughout.

    Threadsafe operation has been tested on Linux, FreeBSD, HP-UX and Windows. It should work on Solaris, Tru64, and (reportedly) IRIX. Not expected to work on non-unixy systems. Should not be used if your system supports threads. Pool server and MARS won't work if disabled.

    --disable-debug

    Debug-mode compiles are enabled by default, and will remain so at least until version 1.0. You can speed things up ever so slightly by disabling it.

    --disable-odbc-wide

    Disable support for wide characaters in ODBC.

    --disable-sspi

    Disable SSPI support. SSPI is a Micrsoft library that allows you to use your current logged-in account for authentication. With this option enabled (the default), FreeTDS supports "trusted logins" for Win32/64, just as Microsoft's own implementations do.

    Things you can turn on

    --enable-msdblib

    Enable Microsoft behavior in the DB-Library API where it diverges from Sybase's. Use this option if you are replacing Microsoft's libraries with FreeTDS

    This option specifies default behavior. Programs can change the default at compile time by defining MSDBLIB or SYBDBLIB (for Microsoft or Sybase behavior, respectively).

    --enable-sybase-compat

    Enable close compatibility with Sybase's ABI, at the expense of other features. Currently, this enables the generation of a dbopen() entry point in DB-Library, which may clash with the DBM function with the same name. Absolutely not required for use with other free software.

    --enable-krb5

    Enable Kerberos support. With Kerberos you can connect to server using your stored Kerberos ticket. Obviously requires Kerberos be configured on the machine.

    --enable-extra-checks

    Intended for debugging purposes, enables certain internal consistency checks against problems like memory corruption and buffer exhaustion.

    --enable-developing

    Enable some code still in development. Should be used only by a developer or a brave user :)

    --enable-odbc-wide-tests

    Compile ODBC tests to use wide characters. Test will use wide versions.

    SSL support

    --with-gnutls

    Enable SSL using GnuTLS.

    --with-openssl=DIR

    Enable SSL using OpenSSL. Unlike FreeTDS, OpenSSL does not use the LGPL. Please read the OpenSSL license before distributing binaries compiled with this option.

    Make

    Now you're ready to build. Follow these easy steps.

    1. Download the tarball and unpack it.

      Alternatively, get the latest build from git [5] .

    2. Change to the freetds directory.

    3. run ./configure with any options you need.

    4. make; make install; make clean

    You normally need to be root to make install, unless you used the --prefix option during configuration to install into your own directory.

    With any luck, you've built and installed the FreeTDS libraries.

    [Tip]Two bits of advice, if you like to keep things tidy and keep track of what you did.

    Create a file to hold your configure options called, say, .build_options.

    Create a build directory for the binaries, and invoke ../configure $(cat ../.build_options).

    This approach lets you remove the binaries at any time and rebuild from scratch using the same options.



    [5] git users will need the GNU autotools: Autoconf, Automake, and libtool.

    freetds-1.3.6/doc/userguide/configs.html000644 025423 025423 00000012432 14162303407 021664 0ustar00fredianofrediano000000 000000 Chapter 5. Advanced Configurations

    Chapter 5. Advanced Configurations

    This chapter details some advanced configurations that need expanded explanation.

    Big Endian Clients with Buggy Microsoft SQL Servers

    Several version of Microsoft SQL server have a bug that affects big endian clients. This includes 7.0 GA and 7.0 SP1. Furthermore, TDS Protocol version 7.0 is natively little endian. Microsoft SQL Server 2000 is also reported not to work from big endian clients without little endian emulation turned on.

    [Note]Note

    The terms big endian and little endian come originally from Gulliver's Travels. In computer science they refer to the the integer byte-order for a processor. Big endian processors, such as Sparc and PowerPC store the most significant byte in the first memory location of a multi-byte integer. Little endian processors, such as Intel and Alpha do it the other way around. So the 16-bit number 258 would be 0x0102 on big endian and 0x0201 on little endian machines.

    In this example we want to force connections to a server named mssql to emulate a little endian client. We are using protocol version 4.2 here, version 7.0 or above will automatically emulate little endian mode regardless of the freetds.conf setting. You shouldn't use this option, set another protocol version instead (7.0, 7.1, 7.2, 7.3 or 7.4).

    Example 5.1. Emulate Little Endian freetds.conf setting

    	[mssql]
    	host = ntbox.mydomain.com
    	port = 1433
    	tds version = 4.2
    	emulate little endian = yes
    	

    freetds-1.3.6/doc/userguide/contrib.html000644 025423 025423 00000015310 14162303410 021664 0ustar00fredianofrediano000000 000000 Chapter 10. Helping

    Chapter 10. Helping

    The time you enjoy wasting is not wasted time.

    —Bertrand Russell

    FreeTDS is a cooperative, volunteer effort. Flame wars on the list are unknown and the signal to noise ratio is pretty high for its venue. Many people have contributed patches, and few have been turned away.

    Pick a weak spot and fix it.

    • We don't have enough non-English speakers to test our character set conversion features. Anyone willing to participate in that way would be most welcome.

    • Canonical examples of using the each library would be very helpful to newcomers.

    • An isql Perl and PHP would all make debugging and testing easier for everyone.

    Send a patch

    Good patches are nearly always applied in short order. Patches uploaded to SourceForge trigger automatic notification to the FreeTDS mailing list.

    Correct this User Guide

    Any corrections or suggestions, be they typographical, grammatical, structural, factual, or mineral are most welcome. Please send it to the FreeTDS mailing list.

    The User Guide is maintained in XML DocBook format; the file in your distibution is doc/userguide.xml. It is a flat ASCII file that you can edit with any text editor. You don't have to know XML to correct or add to the User Guide, however. Just open it up, find the place you're interested in, and type away. Do a diff -u old_version your_version and post your patch to the SourceForge site. Any errors or lackings in your markup will be graciously emended by yours truly.

    Document an API

    We have just begun an independent reference manual to FreeTDS; the main API documents are the work of the server vendors. We're using Doxygen, which extracts documentation directly from comments in the source code, and we're maybe 25% done.

    The TDS protocol is partly documented, as are the APIs to libtds and DB-Library, but much remains.

    Be the Webmaster

    The FAQ and in particular the news don't get updated often enough. If that's your thing, drop a line to the FreeTDS mailing list.

    freetds-1.3.6/doc/userguide/ctlib.api.summary.html000644 025423 025423 00000034346 14162303410 023577 0ustar00fredianofrediano000000 000000 ct-lib API Implementation Summary

    ct-lib API Implementation Summary

    Sybase ct-lib documentation can be found online and in PDF form. [27]

    Table 11.2. CT-Library API Implementation Summary

    CategoryFunctionStatusComments
    (all)ct_bindOKBind server results to program variables.
    (all)ct_br_columnRetrieve information about a column generated by a browse mode select. 
    (all)ct_br_tableReturn information about browse mode tables. 
    (all)ct_callbackOKInstall or retrieve a Client-Library callback routine.
    (all)ct_cancelOKCancel a command or the results of a command.
    (all)ct_capabilityOKSet or retrieve a client/server capability.
    (all)ct_closeOKClose a server connection.
    (all)ct_cmd_allocOKAllocate a CS_COMMAND structure.
    (all)ct_cmd_dropOKDeallocate a CS_COMMAND structure.
    (all)ct_cmd_propsOKSet or retrieve command structure properties. For use by applications that resend commands.
    (all)ct_commandOKInitiate a language, package, RPC, message, or send-data command.
    (all)ct_compute_infoOKRetrieve compute result information.
    (all)ct_con_allocOKAllocate a CS_CONNECTION structure.
    (all)ct_con_dropOKDeallocate a CS_CONNECTION structure.
    (all)ct_con_propsOKSet or retrieve connection structure properties.
    (all)ct_configOKSet or retrieve context properties.
    (all)ct_connectOKConnect to a server.
    (all)ct_cursorOKInitiate a Client-Library cursor command.
    (all)ct_data_infoOKDefine or retrieve a data I/O descriptor structure.
    (all)ct_debugManage debug library operations. 
    (all)ct_describeOKReturn a description of result data.
    (all)ct_diagOKManage inline error handling.
    (all)ct_ds_dropobjRelease the memory associated with a directory object. 
    (all)ct_ds_lookupInitiate or cancel a directory lookup operation. 
    (all)ct_ds_objinfoRetrieve information associated with a directory object. 
    (all)ct_dynamicOKInitiate a dynamic SQL command.
    (all)ct_dyndescPerform operations on a dynamic SQL descriptor area. 
    (all)ct_dynsqldaOperate on a SQLDA structure. 
    (all)ct_exitOKExit Client-Library.
    (all)ct_fetchOKFetch result data.
    (all)ct_get_dataOKRead a chunk of data from the server.
    (all)ct_getformatReturn the server user-defined format string associated with a result column. 
    (all)ct_getloginfoTransfer TDS login response information from a CS_CONNECTION structure to a newly allocated CS_LOGINFO structure. 
    (all)ct_initOKInitialize Client-Library for an application context.
    (all)ct_keydataSpecify or extract the contents of a key column. 
    (all)ct_labelsDefine a security label or clear security labels for a connection. 
    (all)ct_optionsOKSet, retrieve, or clear the values of server query-processing options.
    (all)ct_paramOKSupply values for a server command's input parameters.
    (all)ct_pollstubPoll connections for asynchronous operation completions and registered procedure notifications.
    (all)ct_recvpassthruReceive a TDS (Tabular Data Stream) packet from a server. 
    (all)ct_remote_pwdDefine or clear passwords to be used for server-to-server connections. 
    (all)ct_res_infoOKRetrieve current result set or command information.
    (all)ct_resultsOKSet up result data to be processed.
    (all)ct_sendOKSend a command to the server.
    (all)ct_send_dataOKSend a chunk of text or image data to the server.
    (all)ct_sendpassthruSend a Tabular Data Stream (TDS) packet to a server. 
    (all)ct_setloginfoTransfer TDS login response information from a CS_LOGINFO structure to a CS_CONNECTION structure. 
    (all)ct_setparamOKSpecify source variables from which ct_send reads input parameter values for a server command.
    (all)ct_wakeupCall a connection's completion callback. 
    (all)cs_calcPerform an arithmetic operation on two operands. 
    (all)cs_cmpCompare two data values. 
    (all)cs_configpartialSet or retrieve CS-Library properties.
    (all)cs_conv_multstubRetrieve the conversion multiplier for converting character data from one character set to another.
    (all)cs_convertOKConvert a data value from one datatype, locale, or format to another datatype, locale, or format.
    (all)cs_ctx_allocOKAllocate a CS_CONTEXT structure.
    (all)cs_ctx_dropOKDeallocate a CS_CONTEXT structure.
    (all)cs_ctx_globalOKAllocate or return a CS_CONTEXT structure.
    (all)cs_diagOKManage inline error handling.
    (all)cs_dt_crackOKConvert a machine-readable datetime value into a user-accessible format.
    (all)cs_dt_infostubSet or retrieve language-specific datetime information.
    (all)cs_loc_allocOKAllocate a CS_LOCALE structure.
    (all)cs_loc_dropOKDeallocate a CS_LOCALE structure.
    (all)cs_localepartialLoad a CS_LOCALE structure with localization values or retrieve the locale name previously used to load a CS_LOCALE structure.
    (all)cs_manage_convertstubInstall or retrieve a user-defined character set conversion routine.
    (all)cs_objectsstubSave, retrieve, or clear objects and data associated with them.
    (all)cs_set_convertstubInstall or retrieve a user-defined conversion routine.
    (all)cs_setnullstubDefine a null substitution value to be used when binding or converting NULL data.
    (all)cs_strbuildOKConstruct native language message strings.
    (all)cs_strcmpstubCompare two strings using a specified sort order.
    (all)cs_timestubRetrieve the current date and time.
    (all)cs_will_convertOKIndicate whether a specific datatype conversion is available in the Client/Server libraries.
    (all)blk_allocOKAllocate a CS_BLKDESC structure.
    (all)blk_bindOKBind a program variable and a database column.
    (all)blk_colvalstubServer-side routine to obtain the column value from a formatted bulk copy row.
    (all)blk_defaultstubRetrieve a column's default value.
    (all)blk_describeOKRetrieve a description of a database column.
    (all)blk_doneOKMark a complete bulk copy operation or a complete bulk copy batch.
    (all)blk_dropOKDeallocate a CS_BLKDESC structure.
    (all)blk_getrowstubServer-side routine to retrieve and store a formatted bulk copy row.
    (all)blk_gettextstubServer-side routine to retrieve the text, image, sensitivity, or boundary portion of an incoming bulk copy formatted row.
    (all)blk_initOKInitiate a bulk copy operation.
    (all)blk_propsOKSet or retrieve bulk descriptor structure properties.
    (all)blk_rowallocstubServer-side routine to allocate space for a formatted bulk copy row.
    (all)blk_rowdropstubServer-side routine to free space previously allocated for a formatted bulk copy row.
    (all)blk_rowxferOKTransfer one or more rows during a bulk copy operation without specifying or receiving a row count.
    (all)blk_rowxfer_multOKTransfer one or more rows during a bulk copy operation.
    (all)blk_sendrowstubServer-side routine to send a formatted bulk copy row obtained from blk_getrow.
    (all)blk_sendtextstubServer-side routine to send text, image, sensitivity, or boundary data in a formatted bulk copy row obtained from blk_sendtext.
    (all)blk_srvinitstubServer-side routine to copy descriptions of server table columns to the client, if required.
    (all)blk_textxferstubTransfer a column's data in chunks during a bulk copy operation.



    [27] Links such as these are quite perishable. Should you find them broken, please check the FreeTDS User Guide posted on our website. If it's out of date, please let us know, so we can correct it. Thanks.

    freetds-1.3.6/doc/userguide/dblib.api.summary.html000644 025423 025423 00000053072 14162303410 023553 0ustar00fredianofrediano000000 000000 DB-Library API Implementation Summary

    DB-Library API Implementation Summary

    Microsoft's version of DB-Library is online. Sybase's is both online and can be downloaded as a PDF file. [26]

    Table 11.1. DB-Library API Implementation Summary

    CategoryMicrosoft nameSybase nameStatusComments
    (none) n/adb12hour 
    (none) n/adbaltbind_ps 
    (none) n/adbbind_ps 
    (none) n/adbbufsize 
    (none) n/adbcharsetconv 
    (none) n/adbcoltypeinfoOK 
    (none) n/adbconvert_psOK 
    (none) n/adbfreesortnever
    (none) n/adbfree_xlatenever
    (none) n/adbgetcharset 
    (none) n/adbgetloginfonever
    (none) n/adbgetlusername 
    (none) n/adbgetnatlang 
    (none) n/aDBIORDESCOK 
    (none) n/aDBIOWDESCOK 
    (none) n/adbloadsortnever
    (none) n/adbload_xlatenever
    (none) n/adbnpcreatenever
    (none) n/adbnpdefinenever
    (none) n/adbpoll 
    (none) n/aDBRBUFnever
    (none) n/adbreadpagenever
    (none) n/adbrecftosOK 
    (none) n/adbrecvpassthrunever
    (none) n/adbregdropnever
    (none) n/adbregexecnever
    (none) n/adbreghandlenever
    (none) n/adbreginitnever
    (none) n/adbreglistnever
    (none) n/adbregnowatchnever
    (none) n/adbregparamnever
    (none) n/adbregwatchnever
    (none) n/adbregwatchlistnever
    (none) n/adbrpwclrnever
    (none) n/adbrpwsetnever
    (none) n/adbsafestrOK 
    (none) n/adbsechandle 
    (none) n/adbsendpassthrunever
    (none) n/adbsetbusy 
    (none) n/adbsetdefcharset 
    (none) n/adbsetdeflang 
    (none) n/adbsetidle 
    (none) n/adbsetifileOK 
    (none) n/adbsetinterruptOK 
    (none) n/aDBSETLCHARSET 
    (none) n/aDBSETLENCRYPT 
    (none) n/adbsetloginfonever
    (none) n/adbsetrowOK
    (none) n/adbsetversionOK 
    (none) n/adbspr1rowOK 
    (none) n/adbspr1rowlenOK 
    (none) n/adbsprheadOK 
    (none) n/adbsprlineOK 
    (none) n/adbstrcmpnever
    (none) n/adbstrsortnever
    (none) n/adbtextsize 
    (none) n/adbwritepagenever
    (none) n/adbxlatenever
    bcp bcp_batch(same)OK
    bcp bcp_bind(same)OK
    bcp bcp_colfmt(same)OK
    bcp n/abcp_colfmt_ps 
    bcp bcp_collen(same)OK
    bcp bcp_colptr(same)OK
    bcp bcp_columns(same)OK
    bcp bcp_control(same)OK
    bcp bcp_done(same)OK
    bcp bcp_exec(same)OK
    bcp n/abcp_getlOK
    bcp bcp_init(same)OK
    bcp bcp_moretext(same)stub
    bcp n/abcp_optionspartial
    bcp bcp_readfmt(same)OK
    bcp bcp_sendrow(same)OK
    bcp BCP_SETL(same)OK
    bcp bcp_writefmt(same) 
    browse dbcolbrowsen/anever
    browse dbcolsourcen/anever
    browse dbfreequaln/anever
    browse dbqualn/anever
    browse dbtabbrowsen/anever
    browse dbtabcountn/anever
    browse dbtabnamen/anever
    browse dbtabsourcen/anever
    browse dbtsnewlenn/anever
    browse dbtsnewvaln/anever
    browse dbtsputn/anever
    core dbadata(same)OK
    core dbadlen(same)OK
    core dbaltbind(same)OK
    core dbaltcolid(same)OK
    core dbaltlen(same)OK
    core dbaltop(same)OK
    core dbalttype(same)OK
    core dbaltutype(same)OK
    core dbanullbind(same)OK
    core dbbind(same)OK
    core dbbylist(same)OK
    core dbcancel(same)OK
    core dbcanquery(same)OK
    core dbchange(same)OK
    core dbclose(same)OK
    core dbclrbuf(same)OK
    core dbclropt(same)partial
    core dbcmd(same)OK
    core dbcmdrowDBCMDROWOK
    core dbcolinfon/aOK
    core dbcollen(same)OK
    core dbcolname(same)OK
    core dbcoltype(same)OK
    core dbcolutype(same)OK
    core dbconvert(same)OK
    core dbcountDBCOUNTOK
    core dbcurcmdDBCURCMDstub
    core dbcurrowDBCURROWstub
    core dbdata(same)OK
    core dbdatareadyn/a 
    core dbdatecrack(same)OK
    core dbdatlen(same)OK
    core dbdeadDBDEADOK
    core dbenlisttransn/anever
    core dbenlistxatransn/anever
    core dberrhandle(same)OK
    core dbexit(same)OK
    core dbfcmd(same)OK
    core dbfirstrowDBFIRSTROWOK
    core dbfreebuf(same)OK
    core dbgetchar(same)OK
    core dbgetmaxprocs(same)OK
    core dbgetoff(same)never
    core dbgetpacket(same)OK
    core dbgetrow(same)OK
    core dbgettimeDBGETTIMEOK
    core dbgetuserdata(same)OK
    core dbinit(same)OK
    core dbisavailDBISAVAILOK
    core dbiscountn/aOK
    core dbisopt(same)partial
    core dblastrowDBLASTROWOK
    core dblogin(same)OK
    core dbfreelogindbloginfreeOK
    moneyn/adbmny4addOK
    moneyn/adbmny4cmpOK
    moneyn/adbmny4copyOK
    moneyn/adbmny4dividestub
    moneyn/adbmny4minusOK
    moneyn/adbmny4mulstub
    moneyn/adbmny4subOK
    moneyn/adbmny4zeroOK
    moneyn/adbmnyaddstub
    moneyn/adbmnycmpOK
    moneyn/adbmnycopyOK
    moneyn/adbmnydecOK
    moneyn/adbmnydividestub
    moneyn/adbmnydownstub
    moneyn/adbmnyincOK
    moneyn/adbmnyinitstub
    moneyn/adbmnymaxnegOK
    moneyn/adbmnymaxposOK
    moneyn/adbmnyminusOK
    moneyn/adbmnymulstub
    moneyn/adbmnyndigitstub
    moneyn/adbmnyscalestub
    moneyn/adbmnysubstub
    moneyn/adbmnyzeroOK
    core dbmorecmdsDBMORECMDSOK
    core dbmsghandle(same)OK
    core dbname(same)OK
    core dbnextrow(same)OK
    core dbnullbind(same)OK
    core dbnumalts(same)OK
    core dbnumcols(same)OK
    core dbnumcompute(same)OK
    core dbnumordersDBNUMORDERSnever
    core dbopen(same)OK
    core dbordercol(same)never
    core dbprhead(same)OK
    core dbprocerrhandlen/aaliases dberrhandle
    core dbprocinfon/anever
    core dbprocmsghandlen/aaliases dbmsghandle
    core dbprrow(same)OK
    core dbprtype(same)OK
    core dbresults(same)OK
    core dbrowsDBROWSOK
    core dbrowtypeDBROWTYPEOK
    core n/adbservcharsetOK
    core dbserverenumn/anever
    core dbsetavail(same)OK
    core dbsetlappDBSETLAPPOK
    core dbsetlfallbackn/anever
    core dbsetlhostDBSETLHOSTOK
    core dbsetlnatlangDBSETLNATLANGOK
    core dbsetlogintime(same)OK
    core dbsetlpacketDBSETLPACKETOK
    core dbsetlpwdDBSETLPWDOK
    core dbsetlsecuren/a 
    core dbsetltimen/a 
    core dbsetluserDBSETLUSEROK
    core dbsetlversionn/aOK
    core dbsetmaxprocs(same)OK
    core dbsetnull(same)OK
    core dbsetopt(same)partial
    core dbsettime(same)OK
    core dbsetuserdata(same)OK
    core n/adbspidOK
    core dbsqlexec(same)OK
    core dbsqlok(same)OK
    core dbsqlsend(same)OK
    core n/adbstrbuildOK
    core dbstrcpy(same)OK
    core dbstrlen(same)OK
    core n/aDBTDSOK
    core dbuse(same)OK
    core dbvarylen(same)OK
    core n/adbversionOK
    core dbwillconvert(same)OK
    core dbwinexit (Windows only)n/ano-op macro
    cursor dbcursor(same)never
    cursor dbcursorbind(same)never
    cursor dbcursorclose(same)never
    cursor dbcursorcolinfo(same)never
    cursor dbcursorfetch(same)never
    cursor dbcursorfetchexn/anever
    cursor dbcursorinfo(same)never
    cursor dbcursorinfoexn/anever
    cursor dbcursoropen(same)never
    datetime n/adbdate4cmpnever
    datetime n/adbdate4zeronever
    datetime n/adbdatecharnever
    datetime n/adbdatecmpOK 
    datetime n/adbdatenamenever
    datetime n/adbdateordernever
    datetime n/adbdatepartnever
    datetime n/adbdatezeronever
    datetime n/adbdaynamenever
    datetime n/adbmonthnameOK
    proceduredbhasretstat(same)OK
    proceduredbnumrets(same)OK
    proceduredbretdata(same)OK
    proceduredbretlen(same)OK
    proceduredbretname(same)OK
    proceduredbretstatus(same)OK
    proceduredbrettype(same)OK
    proceduredbrpcexecn/a 
    proceduredbrpcinit(same)OK
    proceduredbrpcparam(same)OK
    proceduredbrpcsend(same)OK
    text dbmoretext(same)OK
    text dbreadtext(same)OK
    text dbtxptr(same)OK
    text dbtxtimestamp(same)OK
    text dbtxtsnewval(same) 
    text dbtxtsput(same) 
    text dbupdatetextn/a 
    text dbwritetext(same)OK



    [26] Links such as these are quite perishable. Should you find them broken, please check the FreeTDS User Guide posted on our website. If it's out of date, please let us know, so we can correct it. Thanks.

    freetds-1.3.6/doc/userguide/domains.html000644 025423 025423 00000014067 14162303407 021674 0ustar00fredianofrediano000000 000000 Domain Logins

    Domain Logins

    [Note]Note

    Domain logins can be used only with TDS protocol versions 7.0 or above.

    As mentioned in the installation chapter, Microsoft SQL Server includes the ability to use domain [20] logins instead of standard server logins. Passwords are encrypted on the wire using a challenge-response protocol. FreeTDS plays nice with such logins.

    FreeTDS supports single sign-on (connecting without prompting for a username & password) or not, depending on how it was configured. For Windows hosts (both 32- and 64-bit), if SSPI is enabled, FreeTDS will log in using so-called “trusted authenticationâ€. For non-Windows hosts, enabling Kerberos provides similar functionality.

    When neither option is enabled, FreeTDS can still log in using the domain account, but the user must supply the username & password.

    To use domain logins without SSPI or Kerberos, use the 'DOMAIN\username' syntax for the username and use the domain password.

    Example 5.4. Logging in with a domain login

    	$ tsql -S camelot -U 'NOTTINGHAM\lancelot' -P roundtable
    	locale is "C"
    	locale charset is "646"
    	Msg 5703, Level 0, State 1, Server CPRO200, Line 0
    	Changed language setting to middle_english.
    	1>

    When FreeTDS sees the “\†character, it automatically chooses a domain login.

    Implementation details

    Support for domain logins in FreeTDS is limited to the TCP/IP network protocol stack. FreeTDS does not currently implement support for Named Pipe-based SQL connections — that is, connections transported over the DCE/RPC interface, which uses TCP port 139, 445, or 135 on Win32 machines depending on the type of encapsulation used for DCE/RPC itself. Supporting this would require a fairly extensive DCE/RPC library for Unix. Samba has one that is licensed under the GPL and therefore not usable by LGPL-licensed projects such as FreeTDS .

    For a technical description of the protocol used for domain logins, see http://davenport.sourceforge.net/ntlm.html



    [20] The term domain in this context is a Microsoft term. It refers to what's sometimes called an NT domain. It's unrelated to the DNS domain. DNS domains are used for name resolution. NT domains are used for authentication. Authentication is done by the domain controller, often the Primary Domain Controller (PDC).

    The Microsoft SQL Server machine may belong to an NT domain. FreeTDS provides an encrypted password — a domain password, known to the domain controller — that the server will ask the domain controller to verify.

    freetds-1.3.6/doc/userguide/dsnless.html000644 025423 025423 00000012744 14162303407 021715 0ustar00fredianofrediano000000 000000 DSN-less configuration

    DSN-less configuration

    In a DSN-less configuration, the odbc.ini file is not consulted for server connection properties. To connect to a servername, your application may refer to a servername entry in freetds.conf, or explicitly specify the servername's hostname (bypassing freetds.conf).

    Example 4.1. Sample files for a DSN-less configuration

    The odbcinst.ini is quite brief:

    	;
    	; odbcinst.ini
    	;
    	[FreeTDS]
    	Driver = /usr/local/freetds/lib/libtdsodbc.so
    	

    The freetds.conf might look something like:

    	;
    	; freetds.conf
    	;
    	[JDBC]
    	host = jdbc.sybase.com
    	port = 4444
    	tds version = 5.0
    	


    Example 4.2. Connecting with a DSN-less configuration

    	/*
    	 * application call
    	 */
    	const char servername[] = "JDBC"; [9]
    	sprintf(tmp, "DRIVER=FreeTDS[10];SERVERNAME=%s;UID=%s;PWD=%s;DATABASE=%s;",
    		servername, username, password, dbname);
    	res = SQLDriverConnect(Connection, NULL, (SQLCHAR *) tmp, SQL_NTS,
    				(SQLCHAR *) tmp, sizeof(tmp), &len, SQL_DRIVER_NOPROMPT);
    	if (!SQL_SUCCEEDED(res)) {
    		printf("Unable to open data source (ret=%d)\n", res);
    		exit(1);
    	}
    	


    You can even establish a connection without reference to either odbc.ini or freetd.conf.

    Example 4.3. Connecting with a DSN-less configuration that does not use freetds.conf

    	/*
    	 * application call
    	 */
    	const char servername[] = "jdbc.sybase.com"; [11]
    	sprintf(tmp, "DRIVER=FreeTDS[10];SERVER=%s;UID=%s;PWD=%s;DATABASE=%s;TDS_Version=5.0;Port=4444;",
    		servername, username, password, dbname);
    	res = SQLDriverConnect(Connection, NULL, (SQLCHAR *) tmp, SQL_NTS,
    				(SQLCHAR *) tmp, sizeof(tmp), &len, SQL_DRIVER_NOPROMPT);
    	if (!SQL_SUCCEEDED(res)) {
    		printf("Unable to open data source (ret=%d)\n", res);
    		exit(1);
    	}
    	




    [9] refers to the [JDBC] entry in freetds.conf.

    [10] refers to the [FreeTDS] entry in odbcinst.ini.

    [11] refers to the real server name.

    freetds-1.3.6/doc/userguide/envvar.html000644 025423 025423 00000016756 14162303407 021552 0ustar00fredianofrediano000000 000000 Environment variables

    Environment variables

    What they're for

    You can use environment variables to

    • Override some of the settings in FreeTDS's configuration file.

    • Advertise the location of the FreeTDS libraries to programs that want them.

    • Control how logging is done.

    This section covers the first two items. For information about environment variables that control logging, see Logging

    In a typical system, no environment variables need be used. They're sometimes handy for testing, for instance setting TDSVER to check if a connection problem is due to using the wrong protocol version. And they have other uses, described below. But they're just knobs, so don't feel you have to turn every one, unless you're the sort that likes turning knobs.

    Environment Variables

    FREETDS

    may be used to specify the name and location of the freetds.conf file. In prior versions of FreeTDS this variable was known as FREETDSCONF.

    TDSVER

    governs the version of the TDS protocol used to connect to your server. For a given server, FreeTDS inspects four sources in the following order to determine which TDS protocol version to use, using the first one it finds.

    1. The value specified in TDSVER

    2. A freetds.conf file entry (see below)

    3. The interfaces file entry (see below)

    4. The --with-tdsver option passed to configure

    TDSPORT

    specifies a TCP port number at which the servername is listening. It overrides the default port (1433 for TDS 4.2/7.0/7.1/7.2/7.3/7.4, 4000 for TDS 5.0) as well as any port specified in the freetds.conf file.

    SYBASE

    points to the FreeTDS run-time directory. Use of this variable originated with Sybase (the company), and many programs still rely on SYBASE to discover the location of the “SYBASE†libraries.

    The primary use of SYBASE is to advertise the location of the FreeTDS libraries. A secondary use is to point to the location of the interfaces file (if used, see the Appendix), which some programs examine directly.

    TDSQUERY , DSQUERY

    provides a server name to connect to if none is specified by the application. DSQUERY is the historical Sybase name for this variable.

    TDSHOST

    overrides the host specified in the freetds.conf.

    Setting environment variables

    Of course, each shell is a little different. In the Bourne shell and variants such as ksh and bash, to set SYBASE and TDSVER do:

    	$ export SYBASE=/usr/local/freetds  # (or your favorite directory)
    	$ export TDSVER=7.4

    In csh:

    	$ setenv SYBASE /usr/local/freetds
    	$ setenv TDSVER 7.4

    Checking your work

    When you're done, you should see something very like this:

    	$ ls $SYBASE
    	etc include interfaces lib
    freetds-1.3.6/doc/userguide/freetdsconf.html000644 025423 025423 00000055356 14162303407 022552 0ustar00fredianofrediano000000 000000 The freetds.conf file

    The freetds.conf file

    What it does

    Just as DNS defines hostnames for network addresses, freetds.conf uses a servername to define the properties of your server. [7] In particular, FreeTDS needs to know:

    Primary Server Properties

    • Hostname or IP address of the server

    • Port number or Instance name (not both)

    • TDS protocol version

    [Note]Note

    FreeTDS also supports an older configuration file format, known as the interfaces file. Use freetds.conf unless interfaces is needed for your situation. It is easier to read, and it is where all the new options are being added. FreeTDS looks for freetds.conf first, falling back on interfaces only if freetds.conf is not found.

    Should you need it, more information about interfaces can be found in the Appendix.

    Where it goes

    The default location of freetds.conf is determined by the --sysconfdir option of configure. If you don't specify anything, configure's default sysconfdir is /usr/local/etc. tsql -C reports the sysconfdir to let you confirm it.

    In addition, FreeTDS will look for a file .freetds.conf in the user's home directory (${HOME}/.freetds.conf).

    The actual name and location of freetds.conf may be specified by the environment variable FREETDS (or FREETDSCONF, same effect). See Environment Variables, below.

    FreeTDS reads the user's ${HOME}/.freetds.conf before resorting to the system-wide sysconfdir/freetds.conf. The file used is the first one that is readable and contains a section for the server.

    What it looks like

    [Tip]Tip

    The following information is also provided in the freetds.conf manual page, cf. man freetds.conf.

    The freetds.conf file format is similar to that of Samba's modified “win.iniâ€. It is composed of two types of sections: one [global] section, and a [servername] section for each servername. Settings in the [global] section affect all servernames, but can be overridden in a [servername] section. For example

    Example 3.1. A freetds.conf file example

    					[global]
    					tds version = auto
    					
    					[myserver]
    					host = ntbox.mydomain.com
    					port = 1433
    					
    					[myserver2]
    					host = unixbox.mydomain.com
    					port = 4000
    					tds version = 5.0
    					
    					[myserver3]
    					host = instancebox.mydomain.com
    					instance = foo
    					

    In this example, the default TDS version for all servernames is set to auto. It is then overridden for myserver2 (a Sybase server) which uses 5.0.

    Usually, it is sufficient to state just the server's hostname and TDS protocol version. Everything else can be inferred, unless your setup (or your server's) strays from the defaults.

    [Tip]Tip

    Some people seem to feel safer using the IP address for the server, rather than its name. We don't recommend you do that. Use the name, and benefit from the inherent advantages. That's why DNS was invented in the first place, you know.

    It bears mentioning here that prior versions of FreeTDS were quite fussy about domain logins, forcing users to make explicit per-server entries in freetds.conf. That is no longer the case. If the username has the form DOMAIN\username, FreeTDS will automatically use a domain login.

    Table 3.3. freetds.conf settings

    NamePossible ValuesDefaultMeaning
    tds version4.2, 5.0, 7.0, 7.1, 7.2, 7.3, 7.4, auto--with-tdsver value (auto if unspecified) Overridden by TDSVER.The TDS protocol version to use when connecting. “auto†tells FreeTDS to use an autodetection (trial-and-error) algorithm to choose the protocol version.
    hosthost name or IP addressnoneThe host that the servername is running on.
    portany valid port
    ProductVersionDefault Port
    Sybase SQL Serverprior to System 101433
    Sybase SQL Server10 and up5000
    Sybase SQL Anywhere72638
    Microsoft SQL Serverall1433
    The port number that the servername is listening to. Please note: The "defaults" to the left are the server's default settings. FreeTDS chooses its default port based on the TDS protocol version: 5000 for TDS 5.0, and 1433 for everything else. Mutually exclusive with instance, below. Overridden by TDSPORT.
    instanceinstance namenone

    Name of Microsoft SQL Server instance to connect to. The port will be detected automatically. Mutually exclusive with port, above. Requires UDP connection to port 1434 on the server.

    ASA databasevalid database nameservername [section] nameSpecifies the name of the default database when connecting to an ASA server. A TDS 5.0 login packet has a field called lservname. For most TDS servers, lservname is a user-defined string with no inherent meaning. ASA servers, however, requires that lservname contain a valid database name, and sets that as the default database for the connection. FreeTDS normally fills lservname with the [section] text.. This entry instead sets the database name independently of the [section] name.
    databasevalid database namenoneSpecifies the name of the default database. This is the name of the database container in the server you are connecting to.
    initial block sizemultiple of 512512Specifies the maximum size of a protocol block. Don't mess with unless you know what you are doing.
    dump fileany valid file namenone Overridden by TDSDUMP. Specifies the location of a tds dump file and turns on logging
    dump file appendyes/nonoAppends dump file instead of overwriting it. Useful for debugging when many processes are active.
    timeout0-noneSets period to wait for response of query before timing out.
    connect timeout0-noneSets period to wait for response from connect before timing out.
    emulate little endianyes/noyesForces big endian machines (Sparc, PPC, PARISC, MIPS) to act as little endian to communicate with server. Ignored, always use little endian at protocol level.
    client charsetany valid iconv character setISO-8859-1[a]Makes FreeTDS use iconv to convert to and from the specified character set from UCS-2 in TDS 7.0 or above. FreeTDS uses iconv to convert all character data, so there's no need to match the server's charset to insert any characters the server supports.
    text size0 to 4,294,967,2954,294,967,295default value of TEXTSIZE, in bytes. For text and image datatypes, sets the maximum width of any returned column. Cf. set TEXTSIZE in the T-SQL documentation for your server.
    debug flagsAny number even in hex or octal notation0x4fffSets granularity of logging. A bitmask. See table below for specification.
    encryptionoff/request/requirerequest (if tds version > 7.1 otherwise off)Specify if encryption is desired. Supported for Microsoft servers. off disables encryption; request means use if available; require means create and allow encrypted connections only.
    enable gssapi delegationon/offoffEnable delegation flag using Kerberos.
    realmanydefault Kerberos realmSpecify Kerberos realm.
    SPNanyMSSQLSvc/fqdn:portSpecify Kerberos SPN.
    mutual authenticationon/offoffEnable mutual authentication flag using Kerberos. Always enabled for TDS 7.0 or above.
    use ntlmv2yes/noyesUse NTLMv2. An alternative to the UseNTLMv2 option in odbc.ini.
    use lanmanyes/nonoUse LAN MANAGER for NTLM. This is a very old encryption. Should not be enabled unless you have a really old server.
    use utf-16yes/nonoInstead of using UCS-2 for database wide character encoding use UTF-16. Newer Windows versions use this encoding instead of UCS-2. This could result in some issues if clients assume that a character is always 2 bytes.
    ca fileany filename or systemnoneFile that hold root certificates (in PEM format) to verify server certificate, used during an encrypted connection. If not specify or empty any certificate will be accepted from server. If you specify system FreeTDS will use system wide certificate list. If a certiticate is not installed server can generate a self signed certificate, in this case is useful to disable certificate validation (which is the default). Note that is not possible to specify a directory as usually database servers does not use a certificate signed by a public global certification authority.
    crl fileany filenamenoneFile that hold certificate revocation list. Only used if ca file is also specified.
    check certificate hostnameyes/noyesCheck is the hostname is valid in the certificate. Only used if ca file is also specified.
    read-only intentyes/nonoTell server we only intent to do read-only queries. This is supported from MSSQL 2012.
    enable tls v1yes/noyesEnable or disable TLS version 1.0. Useful to increase security. Not too recent Windows version (like Windows 2008) does not enable higher versions by default so be aware.

    [a] Valid for ISO 8859-1 character set. See Localization and TDS 7.0 for more information.


    Overrides

    Many settings in freetds.conf can be overridden by environment variables.

    The servername can also be decorated adding the port or instance name using port override syntax.

    Controlling log details

    Abstract

    The logging capability has helped solve innumerable cases, some trivial and some very low-level bugs. Sometimes a developer needs very detailed information about one function, whereas someone else may interested only in whether or not a particular function is called, or even want to see only the SQL that was transmitted to the server.

    The log's granularity can be controlled with the debug flags entry. The default value (4FFF hex) gives a level of detail that is useful for resolving problems via the mailing list.

    Table 3.4. Valid bitmask values for debug flags entry in freetds.conf

    ValueMeaning
    0x80function trace and info
    0x40information level 2
    0x20information level 1
    0x10network
    0x08warning
    0x04error
    0x02severe error
    0x1000show pid
    0x2000show time
    0x4000show source level info (source file and line)
    0x8000thread id (not implemented)

    For more about the wonderful world of FreeTDS logs, see Logging.

    Deprecated options

    The following options have long been deprecated.

    Deprecated freetds.conf settings

    • try server login

    • try domain login

    • nt domain

    • cross domain login

    • debug level



    [7] In general, the servername is arbitrary and local; it's used only by your client programs to tell FreeTDS which server to connect to. You can choose any name you like.

    Sybase SQL Anywhere (a/k/a Sybase ASA), however, is fussy. Unless you use the ASA Database property, you must use the database's name as your servername. Otherwise, the server will refuse your connection.

    freetds-1.3.6/doc/userguide/gfdl-1.html000644 025423 025423 00000012226 14162303411 021302 0ustar00fredianofrediano000000 000000 APPLICABILITY AND DEFINITIONS

    APPLICABILITY AND DEFINITIONS

    This License applies to any manual or other work that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you".

    A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

    A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (For example, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

    The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License.

    The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License.

    A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, whose contents can be viewed and edited directly and straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup has been designed to thwart or discourage subsequent modification by readers is not Transparent. A copy that is not "Transparent" is called "Opaque".

    Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML designed for human modification. Opaque formats include PostScript, PDF, proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML produced by some word processors for output purposes only.

    The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

    freetds-1.3.6/doc/userguide/gfdl-10.html000644 025423 025423 00000005526 14162303411 021367 0ustar00fredianofrediano000000 000000 FUTURE REVISIONS OF THIS LICENSE

    FUTURE REVISIONS OF THIS LICENSE

    The Free Software Foundation may publish new, revised versions of the GNU Free Documentation 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. See http://www.gnu.org/copyleft/.

    Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

    freetds-1.3.6/doc/userguide/gfdl-11.html000644 025423 025423 00000006063 14162303411 021365 0ustar00fredianofrediano000000 000000 How to use this License for your documents

    How to use this License for your documents

    To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

    Copyright (c) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. A copy of the license is included in the section entitled "GNU Free Documentation License".

    If you have no Invariant Sections, write "with no Invariant Sections" instead of saying which ones are invariant. If you have no Front-Cover Texts, write "no Front-Cover Texts" instead of "Front-Cover Texts being LIST"; likewise for Back-Cover Texts.

    If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.

    freetds-1.3.6/doc/userguide/gfdl-2.html000644 025423 025423 00000005140 14162303411 021300 0ustar00fredianofrediano000000 000000 VERBATIM COPYING

    VERBATIM COPYING

    You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

    You may also lend copies, under the same conditions stated above, and you may publicly display copies.

    freetds-1.3.6/doc/userguide/gfdl-3.html000644 025423 025423 00000007576 14162303411 021320 0ustar00fredianofrediano000000 000000 COPYING IN QUANTITY

    COPYING IN QUANTITY

    If you publish printed copies of the Document numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

    If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

    If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a publicly-accessible computer-network location containing a complete Transparent copy of the Document, free of added material, which the general network-using public has access to download anonymously at no charge using public-standard network protocols. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

    It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

    freetds-1.3.6/doc/userguide/gfdl-4.html000644 025423 025423 00000016244 14162303411 021311 0ustar00fredianofrediano000000 000000 MODIFICATIONS

    MODIFICATIONS

    You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

    1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.

    2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has less than five).

    3. State on the Title page the name of the publisher of the Modified Version, as the publisher.

    4. Preserve all the copyright notices of the Document.

    5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.

    6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.

    7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.

    8. Include an unaltered copy of this License.

    9. Preserve the section entitled "History", and its title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.

    10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.

    11. In any section entitled "Acknowledgements" or "Dedications", preserve the section's title, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.

    12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.

    13. Delete any section entitled "Endorsements". Such a section may not be included in the Modified Version.

    14. Do not retitle any existing section as "Endorsements" or to conflict in title with any Invariant Section.

    If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

    You may add a section entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

    You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

    The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

    freetds-1.3.6/doc/userguide/gfdl-5.html000644 025423 025423 00000006106 14162303411 021306 0ustar00fredianofrediano000000 000000 COMBINING DOCUMENTS

    COMBINING DOCUMENTS

    You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice.

    The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

    In the combination, you must combine any sections entitled "History" in the various original documents, forming one section entitled "History"; likewise combine any sections entitled "Acknowledgements", and any sections entitled "Dedications". You must delete all sections entitled "Endorsements."

    freetds-1.3.6/doc/userguide/gfdl-6.html000644 025423 025423 00000005047 14162303411 021312 0ustar00fredianofrediano000000 000000 COLLECTIONS OF DOCUMENTS

    COLLECTIONS OF DOCUMENTS

    You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

    You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

    freetds-1.3.6/doc/userguide/gfdl-7.html000644 025423 025423 00000005443 14162303411 021313 0ustar00fredianofrediano000000 000000 AGGREGATION WITH INDEPENDENT WORKS

    AGGREGATION WITH INDEPENDENT WORKS

    A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, does not as a whole count as a Modified Version of the Document, provided no compilation copyright is claimed for the compilation. Such a compilation is called an "aggregate", and this License does not apply to the other self-contained works thus compiled with the Document, on account of their being thus compiled, if they are not themselves derivative works of the Document.

    If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one quarter of the entire aggregate, the Document's Cover Texts may be placed on covers that surround only the Document within the aggregate. Otherwise they must appear on covers around the whole aggregate.

    freetds-1.3.6/doc/userguide/gfdl-8.html000644 025423 025423 00000004773 14162303411 021321 0ustar00fredianofrediano000000 000000 TRANSLATION

    TRANSLATION

    Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License provided that you also include the original English version of this License. In case of a disagreement between the translation and the original English version of this License, the original English version will prevail.

    freetds-1.3.6/doc/userguide/gfdl-9.html000644 025423 025423 00000004453 14162303411 021315 0ustar00fredianofrediano000000 000000 TERMINATION

    TERMINATION

    You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document 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.

    freetds-1.3.6/doc/userguide/gfdl.html000644 025423 025423 00000011210 14162303411 021134 0ustar00fredianofrediano000000 000000 Appendix D. GNU Free Documentation License

    Appendix D. GNU Free Documentation License

    Version 1.1, March 2000

    Copyright (C) 2000 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

    PREAMBLE

    The purpose of this License is to make a manual, textbook, or other written document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

    This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

    We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

    freetds-1.3.6/doc/userguide/help.html000644 025423 025423 00000013425 14162303410 021161 0ustar00fredianofrediano000000 000000 Chapter 9. Getting Help

    Chapter 9. Getting Help


    Help me if you can, I'm feeling down
    And I do appreciate you being 'round.
    Help me get my feet back on the ground,
    Won't you please, please help me?

    —Beatles

    In the battle against frustration and wasted motion, this manual is our first defense. Our documentation is intended to make it possible for a knowledgeable user to, well, use FreeTDS without further assistance. We strive to include all known features and behaviors here, so you can work quickly and anonymously, and go home before 5:00. Would that it were always thus.

    Reconfirm the installation

    For initial setup and login problems, review Confirm the installation. Distinguish between network and server issues, between finding the server and logging into it. The TDSDUMPCONFIG log will show how the servername is being looked up, what address & port is being used, what TDS version is being used. The TDSDUMP log will show quite clearly whether or not the server accepted the connection, and whether or not the login succeeded.

    Remember compiled-in defaults can be displayed with tsql:

    $ tsql -C
    
    Compile-time settings (established with the "configure" script)
                                Version: freetds v1.3
                 freetds.conf directory: /usr/local/etc
         MS db-lib source compatibility: no
            Sybase binary compatibility: no
                          Thread safety: yes
                          iconv library: yes
                            TDS version: auto
                                  iODBC: no
                               unixodbc: no
                  SSPI "trusted" logins: no
                                Keberos: no
                                OpenSSL: yes
                                 GnuTLS: no
                                   MARS: yes 

    For ODBC setup issues, the osql script is intended to confirm the configuration files are all sane. If it fails to report a problem, please post a message describing the problem to the mailing list. Thanks.

    freetds-1.3.6/doc/userguide/index.html000644 025423 025423 00000072500 14162303411 021340 0ustar00fredianofrediano000000 000000 FreeTDS User Guide

    FreeTDS
    User Guide

    A Guide to Installing, Configuring, and Running FreeTDS

    Brian Bruns

    James K. Lowden

    Frediano Ziglio

    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.


    Table of Contents

    About this User Guide
    1. What is FreeTDS?
    Background: The TDS Protocol and related APIs
    History of TDS Versions
    History of FreeTDS
    Current Projects, Language Bindings, and Alternatives
    Current Projects
    Status
    Languages besides C
    Alternatives
    2. Build FreeTDS
    The GNU World
    What to build: Packages, Tarballs, and the git repository
    How to build: Configure and make
    For Experts
    (FreeTDS for Dummies?)
    OS-specific Issues
    Win32 and Win64
    VMS®
    OS X®
    AIX®
    GNU/Linux distributions that use RPMs
    3. Install FreeTDS
    The local environment
    Choosing a TDS protocol version
    Choosing protocol version since FreeTDS 1.1
    Choosing protocol version before FreeTDS 1.1
    Regarding obsolete versions
    servername Lookup
    The freetds.conf file
    What it does
    Where it goes
    What it looks like
    The locales.conf file
    What it does
    Where it goes
    What it looks like
    Environment variables
    What they're for
    Setting environment variables
    Checking your work
    Port/instance override syntax
    Confirm the installation
    tsql
    Unit Tests
    4. Preparing ODBC
    Background and Terminology
    Connection attributes
    DSN-less configuration
    ODBC-only configuration
    ODBC-combined configuration
    Troubleshooting ODBC connections
    With iODBC
    With unixODBC
    5. Advanced Configurations
    Big Endian Clients with Buggy Microsoft SQL Servers
    Localization and TDS 7.0
    Microsoft Server Note
    Domain Logins
    Implementation details
    Kerberos Support
    Threading in unixODBC
    Appending Dump Files
    TDS Connection Pooling
    stunnel HOWTO
    6. Use FreeTDS
    FreeTDS Utilities
    7. How to get what works with it working
    SQSH
    Perl
    DBD::ODBC
    DBD::Sybase
    Sybperl
    Building and using the Perl modules
    PHP
    DB-Library
    CT-Library
    ODBC
    Python
    pymssql
    Sybase module
    Qt
    ODBC on Unix
    ODBC and 64-bit
    sizeof(SQLWCHAR)
    Default charset
    8. Troubleshooting
    Known Issues
    Porting Issues
    Text Fields
    Endianism
    Datetime and Money
    Microsoft's “Integrated Securityâ€
    Is the server there?
    Start with ping
    Test with telnet
    Test with tsql
    Logging
    Environment Variables that Control Logging
    freetds.conf variables that Control Logging
    Logging in ODBC land
    "Page contains no data"
    Slow connection or data retrieval
    9. Getting Help
    Reconfirm the installation
    Isolate the cause
    Try a different client
    Check permissions
    The Mailing List
    The Archive
    Ask the list
    What to include when asking for help
    Waddya got?
    Attach a logfile
    Show your work
    10. Helping
    Pick a weak spot and fix it.
    Send a patch
    Correct this User Guide
    Document an API
    Be the Webmaster
    Light another's taper
    Ambitious ideas
    libtds2
    libstddb
    Server code
    Advocacy
    11. Programming
    TDS protocol reference
    API Reference Manual
    DB-Library API Implementation Summary
    ct-lib API Implementation Summary
    ODBC API Implementation Summary
    DB-Library for the Tenderfoot
    Header files
    Prolog
    Initialize
    Connect to the server
    Send a query
    Fetch Results
    Messages and Errors
    Last Remarks
    12. Acknowledgments
    Codesmyths
    Contributors
    A. On Linkers
    What is a C function?
    What is a C library?
    Static libraries
    Dynamic libraries
    Checking if a Library Provides a Function
    How Dost Thy Linker Link?
    Static Linker
    Dynamic Linker
    Keep in Mind
    B. The interfaces File
    Where it came from
    Where it goes
    What it does
    What it looks like
    C. About Unicode, UCS-2, and UTF-8
    ASCII: What everyone knows
    The ASCII Compact
    ISO 8859: What everyone would like to forget
    Unicode: East meets West
    Unicode's Pluses and Minuses
    Unicode Transformation Format: UTF-8
    Unicode and FreeTDS
    For further information
    D. GNU Free Documentation License
    PREAMBLE
    APPLICABILITY AND DEFINITIONS
    VERBATIM COPYING
    COPYING IN QUANTITY
    MODIFICATIONS
    COMBINING DOCUMENTS
    COLLECTIONS OF DOCUMENTS
    AGGREGATION WITH INDEPENDENT WORKS
    TRANSLATION
    TERMINATION
    FUTURE REVISIONS OF THIS LICENSE
    How to use this License for your documents

    List of Examples

    3.1. A freetds.conf file example
    3.2. Show compile-time settings with tsql
    3.3. Failure to find servername in freetds.conf
    3.4. Failure to resolve hostname for servername
    3.5. Failing to connect with tsql
    3.6. Getting instance information with tsql
    3.7. Using the wrong protocol for the server
    3.8. Login failure
    3.9. Connect with tsql using a hostname and port number
    4.1. Sample files for a DSN-less configuration
    4.2. Connecting with a DSN-less configuration
    4.3. Connecting with a DSN-less configuration that does not use freetds.conf
    4.4. Sample ODBC-only odbc.ini file
    4.5. Sample ODBC-combined odbc.ini file
    4.6. Sample ODBC-combined freetds.conf file
    4.7. Compile odbctest without a driver manager.
    4.8. Use osql to test the ODBC setup.
    5.1. Emulate Little Endian freetds.conf setting
    5.2. Configuring for GREEK freetds.conf setting
    5.3. Configuring for UTF-8 freetds.conf setting
    5.4. Logging in with a domain login
    5.5. Sample odbcinst.ini for threading model
    5.6. Sample odbc.ini for threading model
    5.7. Turning on Dump File Append mode in freetds.conf
    5.8. pool.conf
    5.9. Unencrypted entry in freetds.conf
    5.10. Encrypted entry in freetds.conf
    7.1. The SQSH Makefile
    7.2. Building DBD::ODBC
    7.3. Connect to a server with DBD::ODBC
    7.4. Building DBD::Sybase
    7.5. Connect to a server with DBD::Sybase
    7.6. PHP and DB-Library for “Sybaseâ€
    8.1. Finding the server's host
    8.2. Finding the server
    8.3. Connecting to the server, bypassing freetds.conf
    8.4. Connecting to the server using freetds.conf
    11.1. Building the Sample Code
    11.2. Sample Code: DB-Library header files
    11.3. Sample Code: DB-Library prolog
    11.4. Sample Code: DB-Library Initialize
    11.5. Sample Code: DB-Library Connect to the server
    11.6. Sample Code: DB-Library Send a query
    11.7. Sample Code: DB-Library Fetch Results
    11.8. Sample Code: DB-Library Error and Message handlers
    A.1. Missing library name
    A.2. Library not found
    B.1. An interfaces file example
    C.1. “HELLO†in UCS-2 and UTF-8
    freetds-1.3.6/doc/userguide/install.html000644 025423 025423 00000016141 14162303407 021703 0ustar00fredianofrediano000000 000000 Chapter 3. Install FreeTDS

    Chapter 3. Install FreeTDS

    If you install it they will stay?

    [Note]Confusing terminology

    “Configuring†and “installing†don't have absolute, context-free definitions. In some circles, we install a product and then configure it. In the GNU world, we configure the package (generate the Makefiles), then we make install the package. In the case of a library package such as FreeTDS To install the package is to copy the files the application developer will use to their canonical locations: header files to include, libraries to the lib, documentation and man pages share. Install targets were specified during the build process as arguments to configure, covered in the last chapter.

    For lack of a better term, this chapter describes installing the product. Put more specifically, once we're done with the package manager, we still have to tell FreeTDS about your database servers, and we still have to tell your client programs about FreeTDS.

    The local environment

    After FreeTDS has been built and installed, it still doesn't know where your servers are or what particular version of Sybase or Microsoft software each one is using.

    The purpose of this section is to explain how to describe your servernames to FreeTDS. FreeTDS looks up your server's attributes in freetds.conf. Some of the attributes can be overridden by environment variables.

    One of the more important (and arcane) settings is the TDS protocol version, described next.

    freetds-1.3.6/doc/userguide/interfacesfile.html000644 025423 025423 00000007176 14162303411 023223 0ustar00fredianofrediano000000 000000 Appendix B. The interfaces File

    Appendix B. The interfaces File

    Abstract

    The interfaces file is retained for compatibility with Sybase environments. It is recommended that new users use the freetds.conf format instead.

    Where it came from

    Under Sybase OpenClient there is a file called interfaces that defines servers available to the software. FreeTDS inherited this file structure with minor alterations. The interfaces remains supported for backward compatibility, and for those running in a mixed FreeTDS/Sybase environment.

    The interfaces is not read by FreeTDS unless it does not find freetds.conf. Note also that make install will install a skeleton freetds.conf, which you'll have to remove if you want to use interfaces instead.

    freetds-1.3.6/doc/userguide/interfacesformat.html000644 025423 025423 00000011100 14162303411 023552 0ustar00fredianofrediano000000 000000 What it looks like

    What it looks like

    The format of the interfaces file is borrowed directly from that used by Sybase on Unix platforms (Windows has a different format). Additionally, we have overloaded one of the fields to add the ability to set the protocol version. An example interfaces file looks like this.

    Example B.1. An interfaces file example

    					myserver
    					query tcp 4.2 127.0.0.1 4000
    					master tcp ether 127.0.0.1 4000
    					


    The entry starts with the servername beginning in the first column (no whitespace preceding it). Following the servername are one or more services lines which must be indented with whitespace. FreeTDS uses only the query line, although others may be present to retain compatibility with Sybase.

    The fields in the services lines are as follows.

    Table B.1. Services Line

    NameExampleMeaning
    servicequeryThe only supported service
    transporttcpThe transport protocol to use. Only tcp is supported by FreeTDS.
    physical4.2Historically this field referred the physical/datalink layer, however it appears to simply a comment field. Therefore, FreeTDS optionally uses it to specify the protocol version to connect with.
    hostname/IP127.0.0.1The hostname or IP address where the SQL Server resides.
    port4000The TCP port where the SQL Server is listening.


    In the example above, the hostname was entered as an IP address. It needn't be; it could just as well be a name. FreeTDS can use a name rather than an address; it will just let the network (specifically, the resolver get the address.

    freetds-1.3.6/doc/userguide/interfaceslocation.html000644 025423 025423 00000004761 14162303411 024111 0ustar00fredianofrediano000000 000000 Where it goes

    Where it goes

    Anywhere. The SYBASE environment variable must contain the location of interfaces; that is how FreeTDS will find it. By the way before looking for $SYBASE/interfaces file FreeTDS try to open file specified programmatically (for instance by dbsetifile() using DB-Library) and .interfaces in your home directory.

    freetds-1.3.6/doc/userguide/interfacespurpose.html000644 025423 025423 00000011216 14162303411 023767 0ustar00fredianofrediano000000 000000 What it does

    What it does

    The interfaces file aliases a servername to the hostname and port number of the servername's machine. When FreeTDS receives a request to connect to a database server, it looks up the servername in interfaces. There, it finds the machine name (or address) and port number to connect to, that is, the port where the database server is listening.

    [Tip]Tip
    freetds-1.3.6/doc/userguide/kerberos.html000644 025423 025423 00000007127 14162303407 022055 0ustar00fredianofrediano000000 000000 Kerberos Support

    Kerberos Support

    Perhaps surprisingly, Kerberos can be used to authenticate to Microsoft SQL Servers. [21] This affords single-signon (or, at most, “double-signonâ€) capability in non-Windows environment.

    To take advantage of Kerberos you have to set up your machine with keytab [22] from your Active Directory. You could use Samba or configure Kerberos directly (/etc/krb5.conf). configure includes options to define the location of your Kerberos installation (cf. Options to configure).

    By default UNIX does not initialize a Kerberos ticket with your login account. You must use kinit to initialize a ticket. You could also configure Kerberos in PAM to initialize a Kerberos ticket at login time.



    [21] It works because much of Active Directory is based on Kerberos. From each according to his ability; to each according to his needs.

    [22] No, the author does not really know what he's talking about.

    freetds-1.3.6/doc/userguide/linker.conclusion.html000644 025423 025423 00000004716 14162303410 023673 0ustar00fredianofrediano000000 000000 Keep in Mind

    Keep in Mind

    The compiler's job ends on the last line of each source code file. A header file describes a function for the compiler, not the linker.

    The linker, static or runtime, uses only the function's name to resolve references. Function parameters and semantics are invisible to it.

    The programmer and, to a lesser degree, the sysadmin direct the choice of which library to link to an executable. A missing function will prevent execution. A wrong function will promote wrong execution. Don't do that.

    freetds-1.3.6/doc/userguide/linker.how.html000644 025423 025423 00000034507 14162303410 022315 0ustar00fredianofrediano000000 000000 How Dost Thy Linker Link?

    How Dost Thy Linker Link?

    Now at last we come to how the linker performs its magic. Once again the discussion divides between static and dynamic linking.

    Static Linker

    Static linking happens at build time. Object files are collected together; a distinct list of all function names is created, and the linker is tasked with finding a definition for each one.

    Different linkers have different command-line options to support OS-specific features. This document isn't intended to teach how to use any particular linker. Our task here is to understand the principles involved, so that you can apply them to your particular situation.

    The static linker needs three kinds of information:

    Static linker inputs

    1. Object modules to be linked, including libraries

    2. Locations of libraries

    3. Search order

    Knitting together the object modules

    The static linker merges your object files into one executable. Your project's object files may refer freely (usually) to each other's functions, and the linker will match them up. It will catenate them together, compute every function's offset from the start of the executable, and replace every function reference with the actual address needed for the executable it's constructing. For library functions, definitions are copied from the library and appended to the output file (executable). The placeholder addresses left by the compiler are similarly replaced by offsets.

    Specifying libraries

    An application programmer using FreeTDS will need to mention the name fo the FreeTDS library being used. Failure to do so will provoke the dread undefined reference linker error:

    Example A.1. Missing library name

    $ gcc -o bsqldb bsqldb.o  
    bsqldb.o: In function `get_login':
    ../../../src/apps/bsqldb.c:816: undefined reference to `dblogin'
    ../../../src/apps/bsqldb.c:823: undefined reference to `dbsetlname'
    ../../../src/apps/bsqldb.c:874: undefined reference to `dbsetlname'
    ../../../src/apps/bsqldb.c:884: undefined reference to `dbsetlname'
    ../../../src/apps/bsqldb.c:889: undefined reference to `dbsetlname'
    …
    


    Finding libraries

    Specifying the library is necessary but may be insufficient. The linker may need to be told where to look for the library. This is often the case for the application programmer using FreeTDS because the FreeTDS libraries may be installed in a location not on the linker's default search path. Linkers are usually pretty blunt about missing libraries:

    Example A.2. Library not found

    $ gcc -o bsqldb bsqldb.o  -l sybdb
    ld: cannot find -lsybdb
    


    Order matters. Linkers tend to be fussy about library search order, some more than others. It's good practice to tell the linker to search project libraries first, third-party libraries (e.g. iconv or kerberos) next, and finally system libraries.

    Dynamic Linker

    The dynamic linker — also known as the runtime linker — is, like the rest of dynamic linking, more complicated than its static counterpart. Whereas it's impossible even to generate an executable with missing static function references, an executable that uses dynamic libraries depends on the runtime environment to have its references satisfied.

    When a dynamically linked application is launched, the OS invokes the runtime linker to resolve any undefined references. Much as the static linker does, the runtime linker consults a list of dynamic libraries along its configured search path. The names of the libraries to search for are embedded in the executable. Sometimes, not always, the search path is found in the executable too. Usually any embedded path can be overridden.

    Information in the executable

    Exactly what information is in the executable and how to display it depends on the format of the executable. Different OSes use different formats and most Unix derivatives actually support at least two. The most commonly encountered format for the FreeTDS programmer is the ELF format. In the interest of your time and mine, that's the one we'll examine here.

    The GNU bintool utility readelf displays the information in the executable that is input to the runtime linker:

    $ readelf -d src/apps/.libs/bsqldb
    Dynamic section at offset 0x6028 contains 20 entries:
      Tag        Type                         Name/Value
     0x0000000000000001 (NEEDED)             Shared library: [libsybdb.so.5]
     0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
     0x0000000000000001 (NEEDED)             Shared library: [libc.so.12]
     0x000000000000000f (RPATH)              Library rpath: [/usr/pkg/lib:/usr/local/lib]
    …
    

    What is this telling us? First, the bsqldb executable uses three shared libraries, namely sybdb for DB-Library, pthread for POSIX threads, and c, the C standard library. The runtime linker is going to have to find those somewhere, and it's going to use only those libraries to resolve unresolved references in the executable.

    Second, readelf displays the RPATH. The runtime linker searches for the required dynamic libraries in the directories listed in the RPATH, if extant.

    The RPATH is placed in the executable by the static linker. It can be thought of as a hint from the application builder to the system administrator. If an executable is built with an appropriate RPATH, the runtine linker will have all the information it needs to find the required libraries.

    Information outside the executable

    [Note]Note

    Runtime linkers differ. The advice and observations that follow apply in many situations, but not all. The best way to know how yours works is to consult your system's documentation. RTFM!

    The NetBSD and GNU linkers both (as of this writing on machines used by the author) honor a configuration file and environment variables. They also have compiled-in default search locations. At a minimum, the default is /usr/lib. Sometimes a configuration file extends this to /usr/local/lib.

    The primary environment variable is LD_LIBRARY_PATH. On some systems this overrides the RPATH in the executable. In others it doesn't. Where ineffective, specific libraries (not their paths) can be forceably used with LD_PRELOAD.

    Displaying what the Runtime linker will do

    The ldd(1) shows which dynamic libraries an executable requires and where, if at all, they'll be found:

    $ ldd $(command -v bsqldb)
    /usr/local/bin/bsqldb:
            -lc.12 => /usr/lib/libc.so.12
            -lpthread.0 => /usr/lib/libpthread.so.0
            -lsybdb.5 => /usr/local/lib/libsybdb.so.5
    

    Important to understand: ldd is not figuring out this information by itself. It just reports the results of its interrogation of the runtime linker. As the configuration of the runtime linker is changed, so changes the output of ldd.

    A Word about Windows®

    Windows executables use PE format (derived from the older COFF format), which has no provision for an RPATH. The runtime linker searches the PATH instead, after some built-in locations that usually include the current working directory. Neither ldd nor any similar utility is included in the basic product.

    It has been said that Unix is for programmers and Windows is for users, and perhaps that roughly describes the intention. But the Unix features listed above — RPATH and ldd — as well as a canonical filesystem hierarchy and dynamic library versioning, all promote a better user experience. Because of them, the problem of DLL conflicts in Windows hardly exists in Unix. Yet they are neither new nor secrect nor patented nor complicated; Microsoft could have adopted them years ago (as Apple finally did). We therefore know that the 20-year old phenomemon known as “DLL hell†is not inevitable, but a choice signifying nothing so much as Microsoft's indifference to its customers. Recently Microsoft added support to configure different search paths and other attributes based on Application Manifests and Application Configuration Files.

    Advice for the lazy

    To avoid tinkering with your runtime linker, embed an RPATH in your executable commensurate with its intended runtime environment. If ldd doesn't show the libraries you want, or some are not found, use readelf to see which libraries are used and the RPATH. Relink with a better RPATH if needed.

    When testing with new libraries, use LD_PRELOAD to override the default, taking care that the semantics haven't changed.

    freetds-1.3.6/doc/userguide/linker.library.check.html000644 025423 025423 00000012425 14162303410 024233 0ustar00fredianofrediano000000 000000 Checking if a Library Provides a Function

    Checking if a Library Provides a Function

    A linker, any linker, knits together object files (some of which may be in libraries) such that every function needed by the program has a definition. If the linker fails to locate a definition for even one function, it will fail and the program will not run.

    Returning to bsqldb.o, we can use nm to see which functions are unresolved, and determine whether or not a particular library contains them. We'll ignore the symbols that start with an underscore, marking them per the C standard as being provided by the implementation[36], and focus on the last five in this abbreviated list.

    Some unresolved functions in bsqldb.o

    asprintf, basename

    Normally provided by the standard C library, but if not by FreeTDS's replacements library:

    $ nm /usr/lib/libc.a | grep -w T | grep -E 'asprintf|basename'
    
    0000000000000000 T _basename
    0000000000000000 T _asprintf
    

    calloc

    Provided by the standard C library:

    $ nm /usr/lib/libc.a | grep -w T | grep calloc 
    0000000000004240 T calloc
    

    dbaltbind, dbaltcolid

    Provided by DB-Library:

    $ nm libsybdb.a | grep -Ew 'dbaltbind|dbaltcolid'
    0000000000007140 T dbaltbind
    0000000000003590 T dbaltcolid
    

    Although these examples refer to static libraries, nm works just as well with dynamic libraries, too.

    There are other tools besides nm. Windows®, for instance, has dumpbin, and the GNU bintools include objdump.



    [36] Why and how leading underscores enter into this discussion is just one more example of arcane historical practices one needs to know to master the subject. For our purposes, though, it's enough to know that “implementation-provided†functions like these — functions provided by the C standard library — often have an underscored prepended.

    freetds-1.3.6/doc/userguide/locales.html000644 025423 025423 00000016217 14162303407 021663 0ustar00fredianofrediano000000 000000 The locales.conf file

    The locales.conf file

    What it does

    For an English-speaking American, not much. FreeTDS originated in the United States, and uses U.S. conventions if no locales.conf is present. The locales.conf provided with the installation also reflects these conventions.

    [Important]Important

    locales.conf will probably be dropped from FreeTDS one day. Its only real purpose now is to control the format of date strings. The Right Wayâ„¢ to deduce the appropriate default date format is from the application's locale settings, while allowing an override in freetds.conf. That's the direction we're headed.

    If your purpose is to affect the client charset description, use freetds.conf instead.

    Information on locales and locale strings is easily (even too easily!) found on the Internet, or see man locale for your system. FreeTDS will examine its environment for a LOCALE string. If it finds one, it will look it up in locales.conf to find your preferred settings. If it fails to find one, it will use its defaults.

    Where it goes

    Like freetds.conf, the location of locales.conf is determined by the value of --sysconfdir to configure. The default is PREFIX/etc.

    What it looks like

    The format of locales.conf is similar to that of freetds.conf. There is a [default] section, and a section for each locale. locales.conf controls three settings

    date format

    This entry will be passed (almost) literally to strftime(3) to convert dates to strings.

    For the most part, see you system documentation for strftime(3) (man 3 strftime). You will see there though that strftime(3) has no provision for milliseconds. The locales.conf format string uses %z for milliseconds.

    [Note]Note

    If your system's strftime(3) does employ %z for its own use, it will not be given that chance by FreeTDS. FreeTDS will consume the %z for its milliseconds needs, and will not pass it on to strftime(3).

    language

    The language that will be used for error/status messages from the server. A SQL Server client can specify a language for such messages at login time.

    [Note]Note

    FreeTDS issues a few messages of its own. Messages from the server are called “messagesâ€; those from the client library (i.e., from FreeTDS) are called “error messagesâ€. FreeTDS-issued messages are not affected by locales.conf.

    charset

    Indicates to the server what character set should be used for communicating with the client.

    freetds-1.3.6/doc/userguide/logging.html000644 025423 025423 00000017063 14162303410 021661 0ustar00fredianofrediano000000 000000 Logging

    Logging

    FreeTDS has quite extensive logging capabilities. These are often invaluable in setting up new configurations, when it's hard to be sure precisely what configuration information is being used, and what communication is (not) working. Often such questions can be quickly resolved by turning on logging and examining the logs.

    Environment Variables that Control Logging

    TDSDUMP

    Log files can be turned on using the TDSDUMP environment variable. For instance, setting the location of a dumpfile

    	$ export TDSDUMP=/tmp/freetds.log

    Will generate a log file named freetds.log in the /tmp directory.

    [Tip]Tip

    The filenames stdout and stderr are also supported. They can be handy if you want to intersperse the log output with your application's output, or if your application opens more than one connection. (The logfile is otherwise normally truncated each time the library connects to the server.)

    TDSDUMPCONFIG

    Set TDSDUMPCONFIG to a file to write information to on how the configuration information is being obtained, e.g. from environment variables, a freetds.conf file, or interfaces file. Sometimes it's unclear what source of information FreeTDS is using to connect to a given servername. This variable can make that bright and clear.

    [Tip]Tip

    What if you were running Apache/PHP? Apache has many children. Setting the TDSDUMP (and/or TDSDUMPCONFIG) variable to a null string will cause FreeTDS to open a log under every PID.

    	$ export TDSDUMP=""

    The log files will be named /tmp/freetds.log.9999, where 9999 is the pid number of the process generating the log.

    A couple of important notes about using the logs with FreeTDS. First, the logs tend to grow large, so trim or archive them often. Secondly, FreeTDS will record certain network packets to the log, this includes login packets which can contain clear text or clear text equivalent passwords. So, if this is a concern (most likely is) make sure that the files are not world readable, and avoid posting them to mailing lists.

    Once in a while, someone writes to the mailing list, asking why FreeTDS is so slow. It sometimes turns out that logging was left turned on. Don't you be the next victim! FreeTDS logs are meant for development and debugging, not as a system monitoring tool.

    freetds.conf variables that Control Logging

    See Valid bitmask values for debug flags entry in freetds.conf

    The logfile is normally truncated each time FreeTDS connects to the server.

    Logging in ODBC land

    (Tree-huggers need not worry)

    Many ODBC Driver Managers have their own support for logging. How logging is controlled, however, varies widely by implementation. The ODBC log is often very helpful because it provides a log of all calls made directly by the application.

    unixODBC

    unixODBC supports logging via some entries in odbcinst.ini. For example:

    	[ODBC]
    	Trace        = Yes
    	TraceFile    = /tmp/sql.log
    	ForceTrace   = Yes

    Will generate a log file named sql.log in the /tmp directory.

    freetds-1.3.6/doc/userguide/mailinglist.html000644 025423 025423 00000007165 14162303410 022551 0ustar00fredianofrediano000000 000000 The Mailing List

    The Mailing List


    In them I trust; for they are [hackers]
    Witty, courteous, liberal, full of spirit.

    —3 Henry VI, I, ii, approximately

    The Archive

    The FreeTDS mailing list archive is a good place to start. It is searchable. It should be considered the most up to date (and least edited) source of information.

    New developments between releases tend not to be announced on the website. The website is updated only intermittently, when we post a new release or FreeTDS is somehow in the news, say. If you found a bug or need a feature, you may find it was announced/discussed/fixed by perusing the archive.

    Ask the list

    Many of the original authors and anyone maintaining or extending the code reads the list. The traffic tends to be bursty. It usually focuses on build problems and troubleshooting. Again, the more specific your question, the sooner you'll get a useful reply (if it comes).

    Please, do not email the authors directly. You may well be ignored because they're they type that gets a ton of mail. Anyone willing to address your question reads the list, and you don't want to offend anyone willing to help you by going about it the wrong way.

    freetds-1.3.6/doc/userguide/name.lookup.html000644 025423 025423 00000007643 14162303407 022474 0ustar00fredianofrediano000000 000000 servername Lookup

    servername Lookup

    FreeTDS converts the servername to an IP address by following the steps below, stopping when it succeeds.

    Name lookup sequence [6]

    1. Find servername in freetds.conf. If a section with that name exists, use the hostname, port, and TDS version specified therein.

    2. Attempt to convert servername to an IP address with inet_addr(3).

    3. Request name-lookup from the operating system via gethostbyname(3) or similar.

    If the TDS version and port are not read from freetds.conf, they are derived from the compiled-in defaults and overridden by applicable environment variables.

    As you can see, if most of your servers use the same TDS version and answer to the default port, then you don't need to list them all in freetds.conf. You can simply compile in the right defaults — or set the TDSPORT and TDSVER environment variables — and rely on DNS for name resolution.



    [6] This description applies to DB-Library and CT-Library. ODBC lookup is different.

    freetds-1.3.6/doc/userguide/odbc.api.summary.html000644 025423 025423 00000023502 14162303410 023401 0ustar00fredianofrediano000000 000000 ODBC API Implementation Summary

    ODBC API Implementation Summary

    Microsoft's ODBC documentation is online.

    The functions are linked to the reference page on Microsoft's website. [28]

    Table 11.3. ODBC API Implementation Summary

    CategoryFunctionStatusComments
    (all)SQLAllocConnectOK 
    (all)SQLAllocEnvOK 
    (all)SQLAllocHandleOK 
    (all)SQLAllocStmtOK 
    (all)SQLBindColOK 
    (all)SQLBindParamOK 
    (all)SQLBindParameterOK 
    (all)SQLBrowseConnect  
    (all)SQLCancelOK 
    (all)SQLCloseCursorOK 
    (all)SQLColAttributeOK 
    (all)SQLColAttributesOK 
    (all)SQLColumnPrivilegesOK 
    (all)SQLColumnsOK 
    (all)SQLConnectOK 
    (all)SQLCopyDescOK 
    (all)SQLDescribeColOK 
    (all)SQLDescribeParamunimplemented 
    (all)SQLDisconnectOK 
    (all)SQLDriverConnectOK 
    (all)SQLEndTranOK 
    (all)SQLErrorOK 
    (all)SQLExecDirectOK 
    (all)SQLExecuteOK 
    (all)SQLExtendedFetchOK 
    (all)SQLFetchOK 
    (all)SQLFetchScrollOK 
    (all)SQLForeignKeysOK 
    (all)SQLFreeConnectOK 
    (all)SQLFreeEnvOK 
    (all)SQLFreeHandleOK 
    (all)SQLFreeStmtOK 
    (all)SQLGetConnectAttrOK 
    (all)SQLGetConnectOptionOK 
    (all)SQLGetCursorNameOK 
    (all)SQLGetDataOK 
    (all)SQLGetDescFieldOK 
    (all)SQLGetDescRecOK 
    (all)SQLGetDiagFieldOK 
    (all)SQLGetDiagRecOK 
    (all)SQLGetEnvAttrOK 
    (all)SQLGetFunctionsOK 
    (all)SQLGetInfoOK 
    (all)SQLGetStmtAttrOK 
    (all)SQLGetStmtOptionOK 
    (all)SQLGetTypeInfoOK 
    (all)SQLMoreResultsOK 
    (all)SQLNativeSqlpartial 
    (all)SQLNumParamsOK 
    (all)SQLNumResultColsOK 
    (all)SQLParamDataOK 
    (all)SQLParamOptionsOK 
    (all)SQLPrepareOK 
    (all)SQLPrimaryKeysOK 
    (all)SQLProcedureColumnsOK 
    (all)SQLProceduresOK 
    (all)SQLPutDataOK 
    (all)SQLRowCountOK 
    (all)SQLSetConnectAttrOK 
    (all)SQLSetConnectOptionOK 
    (all)SQLSetCursorNameOK 
    (all)SQLSetDescFieldOK 
    (all)SQLSetDescRecOK 
    (all)SQLSetEnvAttrpartial 
    (all)SQLSetPosOK 
    (all)SQLSetParamOK 
    (all)SQLSetScrollOptionOK 
    (all)SQLSetStmtAttrOK 
    (all)SQLSetStmtOptionOK 
    (all)SQLSpecialColumnsOK 
    (all)SQLStatisticsOK 
    (all)SQLTablePrivilegesOK 
    (all)SQLTablesOK 
    (all)SQLTransactOK 



    [28] Links such as these are quite perishable. Should you find them broken, please check the FreeTDS User Guide posted on our website. If it's out of date, please let us know, so we can correct it. Thanks.

    freetds-1.3.6/doc/userguide/odbcdiagnose.html000644 025423 025423 00000022177 14162303407 022664 0ustar00fredianofrediano000000 000000 Troubleshooting ODBC connections

    Troubleshooting ODBC connections

    Supposing everything compiles and installs without trouble, how do you know if your ODBC setup works? Or, if you know it doesn't, what then?

    First, try to connect with tsql. If you're intending to use freetds.conf, exercise it with tsql -S servername. If not, use TDSVER=auto tsql -H hostname -p port

    If tsql works and isql doesn't, you've isolated the problem to the ODBC setup. FreeTDS might have some interoperability problems, but mere connection to the database isn't one of them! If tsql doesn't work, turn on logging with TDSDUMP. The log will tell you what TCP/IP name (and address) FreeTDS is attempting to connect to, and what version of the TDS protocol it's using.

    With iODBC

    iODBC comes with a sample command line query program called odbctest, located in the iodbc/samples directory. Using this program you can get a listing of DSNs, connect, and issue queries.

    [Tip]Tip

    For debugging purposes, you may wish to link a program such as odbctest directly to FreeTDS instead of to the driver manager. [15] To do so, compile and install the ODBC driver with iODBC as normal [16], then compile and link the program:

    Example 4.7. Compile odbctest without a driver manager.

    	$ make odbctest.o
    	$ gcc -g -o odbctest odbctest.o /usr/local/freetds/lib/libtdsodbc.a


    Now you can run gdb or another debugger and set breakpoints on functions in the library without the driver manager getting in the way.

    With unixODBC

    Try isql -v dsn username password, and have a look at the log. See if the right address and TDS version are being used. Adjust to taste.

    Use osql

    The osql utility is a Bourne shell script that checks your ODBC configuration. If it approves, it invokes the unixODBC isql utility. Cf. man osql for details on its use.

    Example 4.8. Use osql to test the ODBC setup.

    	$ osql -S machine -U mr_ed -P hayseed
    	looking for odbc.ini and odbcinst.ini in /usr/local/etc
    	reading "/usr/home/mr_ed/.odbc.ini"
    	[machine] found in "/usr/home/mr_ed/.odbc.ini"
    	found this section:
    	[machine]
    	Database = testdb
    	Servername = machine
    	Trace           = Yes
    	TraceFile       = /tmp/unixodbc.trace
    
    	looking for driver for DSN [machine]
    	no driver mentioned for [machine] in .odbc.ini
    	looking for driver for DSN [default]
    	driver "FreeTDS" found for [default] in .odbc.ini
    	found driver named "FreeTDS"
    	FreeTDS is not a readable file
    	looking for entry named [FreeTDS] in /usr/local/etc/odbcinst.ini
    	driver "/usr/local/lib/libtdsodbc.so" found for [FreeTDS] in odbcinst.ini
    	/usr/local/lib/libtdsodbc.so is a readable file
    	Using ODBC-Combined strategy
    	FreeTDS servername is "machine" (from /usr/home/mr_ed/.odbc.ini)
    	looking for [machine] in /usr/home/mr_ed/.freetds.conf
    	"/usr/home/mr_ed/.freetds.conf" is a readable file
    	found this section:
    	[machine]
    	host = machine.example.com
    	port = 2500
    	tds version = 7.1
    
    	machine.example.com has address 10.82.32.177
    
    	DSN: machine
    	Driver: /usr/local/lib/libtdsodbc.so
    	Server's hostname: machine.example.com
    	Address: 10.82.32.177
    
    	Attempting connection as mr_ed ...
    	+ exec isql machine mr_ed hayseed -v
    	+---------------------------------------+
    	| Connected!                            |
    	|                                       |
    	| sql-statement                         |
    	| help [tablename]                      |
    	| quit                                  |
    	|                                       |
    	+---------------------------------------+
    	SQL>


    The reader is here advised that the isql that comes with many versions of unixODBC will truncate text and surprise in other ways without warning. If it behaves strangely, try FreeTDS's bsqlodbc before you decide you've found a FreeTDS bug.



    [15] Why? Once the program is started in the debugger, the driver entry points become viable breakpoints. Because the DM loads the driver dynamically with dlopen(3), no driver addresses even exist until the runtime linker loads it.

    [16] When linking directly to FreeTDS you still need the Driver Manager's header files.

    freetds-1.3.6/doc/userguide/odbcinionly.html000644 025423 025423 00000006346 14162303407 022554 0ustar00fredianofrediano000000 000000 ODBC-only configuration

    ODBC-only configuration

    An ODBC-only configuration relies solely on odbc.ini for server properties. Other FreeTDS libraries don't know about odbc.ini.

    Example 4.4. Sample ODBC-only odbc.ini file

    	[ODBC Data Sources][12]
    	JDBC = Sybase JDBC Server
    	
    	[JDBC]
    	Driver          = /usr/local/freetds/lib/libtdsodbc.so
    	Description     = Sybase JDBC Server
    	Trace           = No
    	Server          = jdbc.sybase.com
    	Database        = pubs2
    	Port            = 4444
    	TDS_Version     = 5.0
    	
    	[Default]
    	Driver          = /usr/local/freetds/lib/libtdsodbc.so
    	




    [12] Several DSNs might be listed here. In this example, we have only one, “JDBCâ€. It matches the [JDBC] entry later in the file.

    freetds-1.3.6/doc/userguide/odbcombo.html000644 025423 025423 00000010354 14162303407 022021 0ustar00fredianofrediano000000 000000 ODBC-combined configuration

    ODBC-combined configuration

    Like the DSN-less configuration, ODBC-combined keeps server properties in freetds.conf. The difference is that your applications can refer to the server by its DSN. To make that possible, the DSN entry in odbc.ini refers to the servername entry in freetds.conf.

    Example 4.5. Sample ODBC-combined odbc.ini file

    	[ODBC Data Sources][13]
    	JDBCdsn = Sybase JDBC Server
    	
    	[JDBCdsn]
    	Driver          = /usr/local/freetds/lib/libtdsodbc.so
    	Description     = Sybase JDBC Server
    	Trace           = No
    	Servername      = JDBC[14]
    	Database        = pubs2
    	
    	[Default]
    	Driver          = /usr/local/freetds/lib/libtdsodbc.so
    	


    Example 4.6. Sample ODBC-combined freetds.conf file

    	;
    	; freetds.conf
    	;
    	[JDBC]
    	host = jdbc.sybase.com
    	port = 4444
    	tds version = 5.0
    	


    With this arrangement, an application can connect to the server in two ways, via its DSN (JDBCdsn), or its servername (JDBC).



    [13] Several DSNs might be listed here. In this example, we have only one, “JDBCdsnâ€. It matches the [JDBCdsn] entry later in the file.

    [14] Refers to the [JDBC] entry in freetds.conf.

    freetds-1.3.6/doc/userguide/osissues.html000644 025423 025423 00000022071 14162303407 022111 0ustar00fredianofrediano000000 000000 OS-specific Issues

    OS-specific Issues

    Win32 and Win64

    Officially FreeTDS for Windows should be compiled using CMake. CMake is able to create project files for different development systems (like Visual C++). Install CMake on your box and point to the source directory to generate wanted files. Refer to CMake documentation on how to do it (I personally use CMake GUI passing source directory and a newly create build directory). Once project files are created you can open them with your environment.

    Other ways to build under Windows®

    • MingW

    Download Windows® binaries

    You can download FreeTDS binaries for Windows from AppVeyor (the hosted CI platform used).

    There is a .zip file available as artifact of every sucessful build. The list of builds is at https://ci.appveyor.com/project/FreeTDS/freetds/history. You can find there builds of code in the master banch and (from time to time) builds from the post-1.0 release fixes-only Branch-1_00 branch. Every build matrix element generates its artifact.

    Ramiro Morales also maintains similar builds of the Branch-0_95 branch at https://github.com/ramiro/freetds/releases.

    ODBC driver registration

    If compiled correctly FreeTDS ODBC driver supports component registration. Although an ODBC driver is not a Windows component you can register the driver with regsvr32 utility or you can use this feature with some installer and register the driver as a standard component.

    Once the ODBC driver is registered in the system you can configure it from Control Panel.

    VMS®

    FreeTDS will probably build and run on most versions of OpenVMS Alpha 7.0 and later with DEC/Compaq C 6.0 or later. Other prerequisites:

    gunzip
    vmstar
    MMS or MMK

    Build Instructions

    Decompress and unpack the source archive using gunzip and vmstar. If you are untarring on an ODS-5 disk, you should use the /ODS2 or -o option to create universally VMS-friendly filenames; otherwise the build will fail to locate some files.

    Set default to the top-level source directory and run the configuration script:

    	$ @[.vms]configure

    This creates a descrip.mms in the top-level source directory which you may execute by simply running MMS (if you have the Module Management System that is part of DECset) or MMK (a freeware MMS alternative available from www.madgoat.com).

    Further information can be found in the vms/README.vms in the source distribution.

    OS X®

    The regular distribution compiles on OS X.

    Possible linker problems

    On 18 April 2016, a problem was reported causing linker issues.

    	Undefined symbols for architecture x86_64:
    
    	  "___strlcpy_chk", referenced from:
    	      _tdsdbopen in libsybdb_64.a(dblib.o)
    	      _db_env_chg in libsybdb_64.a(dblib.o)
    	      _dbcolinfo in libsybdb_64.a(dblib.o)
    	      _dbtablecolinfo in libsybdb_64.a(dblib.o)
    	      _tds_alloc_dynamic in libsybdb_64.a(mem.o)
    	      _tds7_get_instance_port in libsybdb_64.a(net.o)
    	      _tds_get_locale in libsybdb_64.a(locale.o)
    	      ...
    

    This is due to some mismatch on different project releases. To solve these issue set the target release like

    	CFLAGS="-mmacosx-version-min=10.8" ./configure
    	make

    or

    	export MACOSX_DEPLOYMENT_TARGET=10.8
    	./configure
    	make

    AIX®

    AIX® can induce linker indigestion. libtool doesn't always understand that a .a file can be a shared library. One solution is to build only static libraries with the --disable-shared configure option.

    Another problem seems to be that the linker isn't asked to pull in all the requisite libraries. Cf. this helpful mailing list message.

    GNU/Linux distributions that use RPMs

    You may find it convenient to make an RPM from the source distribution, in which case you'll be glad to know it is easily done:

    	$ rpmbuild -ta freetds-0.95.tar.bz2
    freetds-1.3.6/doc/userguide/packages.html000644 025423 025423 00000010051 14162303407 022005 0ustar00fredianofrediano000000 000000 What to build: Packages, Tarballs, and the git repository

    What to build: Packages, Tarballs, and the git repository

    The latest FreeTDS package is always available from ftp.freetds.org.

    Code changes by the developers are immediately available in the git repository. If you've run into a problem, you may want to check out from git to see if it's fixed there.

    No password is needed to obtain the current git copy of FreeTDS; you need only have a git client installed on your machine. Then:

    	$ git clone https://github.com/FreeTDS/freetds.git
    	$ 

    For those behind firewalls or otherwise unable to access git, nightly snapshots of git are rolled up into tarballs for your convenience. They can be downloaded from ftp.freetds.org.

    In general, the git master branch (the basis of the current nightly snapshot) works better and has more functionality than the release version. Bugs sometimes persist in the release version but are usually fixed in short order (once identified) in git master.

    [Tip]Tip

    As with any project of this sort, if you want to use the git master branch, it's a good idea to join the mailing list.

    freetds-1.3.6/doc/userguide/pagenodata.html000644 025423 025423 00000013501 14162303410 022327 0ustar00fredianofrediano000000 000000 "Page contains no data"

    "Page contains no data"

    Web browsers display this error when the underlying script didn't return any information. The error could be in any of several places, of which FreeTDS is one. To isolate the cause, turn on enough logs to see the query, and execute the query through SQSH. If that works, the problem lies further up the chain. If it doesn't, take a look at the known issues section.

    FreeTDS under PHP executing within an Apache process may abort with a segmentation fault. The evidence of this is the words "Segmentation Fault" or "Bus Error" in the Apache error log, and a "Page contains no data" warning displayed by the web browser. The unexpected termination of the process causes the connection to the client to be closed before any buffered data is sent.

    To diagnose this sort of problem, follow this procedure;

    • Compile PHP as a CGI binary.

      This should have been a side-effect of your build of PHP, look for an executable called php in the PHP build tree. If you are using a packaged binary, look for a php-cgi package.

    • Make a reproducer.

      Make a PHP script that reliably reproduces the segmentation fault via the web server, but with no arguments. This is so that you can execute it using the PHP binary, thus excluding the web server as the cause of the problem.

    • Reproduce on command line.

      Reproduce the segmentation fault using PHP on the command line, by activating PHP with the script as first argument. For example;

      	% php file.php
      	Segmentation fault
      	% 

      If this doesn't reproduce the segmentation fault, then there is something about the environment that differs, so look for the differences and resolve them. Check environment variables, assumptions made by the script, the UID you are executing under, and the current working directory.

    • Reproduce using GDB.

      Now reproduce the segmentation fault using the debugger, GDB. Instead of aborting to the command line, GDB will stop executing the PHP program at the point of failure. Use the bt command to determine the details and context. This is called a backtrace.

      	% gdb php
      	gdb> run file.php
      	gdb> bt
    • Analyze the backtrace.

      Read the backtrace to determine what the cause of the problem is. Examine each line, assigning responsibility by component; some code is PHP, some is FreeTDS, and some may be glibc. You will need the source code for each component, and software engineering debugging skills.

      If you cannot determine the cause yourself, send the backtrace to the mailing list, along with the PHP script. It helps to make the script as small as possible, but still fail. It also helps to report the version numbers of PHP, and FreeTDS.

    freetds-1.3.6/doc/userguide/perl.html000644 025423 025423 00000017375 14162303407 021211 0ustar00fredianofrediano000000 000000 Perl

    Perl

    There are a few ways to use Perl to connect to a SQL Server using FreeTDS.

    DBD::ODBC

    The recommended choice is DBD::ODBC with the FreeTDS ODBC driver.

    DBD::Sybase

    You may also use DBD::Sybase from Michael Peppler. Despite the name it works for any Sybase or Microsoft SQL Server. DBD::Sybase uses the CT-Library API and works well. However the project has not been updated for a while.

    Sybperl

    Finally, you can use Sybperl. Scripts written against Sybperl will not run against other databases the way DBI scripts will. However, it will be familiar ground for those who know DB-Library.

    Building and using the Perl modules

    Example 7.2. Building DBD::ODBC

    	$ cd DBD-ODBC-0.28
    	$ export SYBASE=/usr/local/freetds
    	$ export ODBCHOME=/usr/local
    	$ export DBI_DSN=dbi:ODBC:JDBC
    	$ export DBI_USER=guest
    	$ export DBI_PASS=sybase
    	$ perl Makefile.PL
    	$ make
    	$ su root
    	Password: 
    	$ make install


    [Note]Note

    We used the public JDBC server logins for our configuration here. You'll want to replace these with ones suitable to your environment.

    Example 7.3. Connect to a server with DBD::ODBC

    	#!/usr/local/bin/perl
    	#
    	use DBI;
    	
    	my $dbh = DBI->connect("dbi:ODBC:JDBC", 'guest', 'sybase', {PrintError => 0});
    	
    	die "Unable for connect to server $DBI::errstr"
    		unless $dbh;
    	
    	my $rc;
    	my $sth;
    	
    	$sth = $dbh->prepare("select \@\@servername");
    	if($sth->execute) {
    		while(@dat = $sth->fetchrow) {
    			print "@dat\n";
    		}
    	}
    	


    Example 7.4. Building DBD::Sybase

    	$ cd DBD-Sybase-0.91
    	$ export SYBASE=/usr/local/freetds
    	$ perl Makefile.PL
    	$ make
    	$ su root
    	Password: 
    	$ make install


    There will be some output about missing libraries after perl Makefile.PL. These are normal.

    The following example will attach to Sybase's public JDBC server and run a simple query (it can be found in samples/test.pl):

    Example 7.5. Connect to a server with DBD::Sybase

    	#!/usr/local/bin/perl
    	#
    	use DBI;
    	
    	my $dbh = DBI->connect("dbi:Sybase:server=JDBC", 'guest', 'sybase', {PrintError => 0});
    	
    	die "Unable for connect to server $DBI::errstr"
    		unless $dbh;
    	
    	my $rc;
    	my $sth;
    	
    	$sth = $dbh->prepare("select \@\@servername");
    	if($sth->execute) {
    		while(@dat = $sth->fetchrow) {
    			print "@dat\n";
    		}
    	}
    	


    You'll note this is the same program as for DBD::ODBC with the exception of the connect statement. Welcome to the magic of DBI!

    freetds-1.3.6/doc/userguide/php.html000644 025423 025423 00000020043 14162303407 021020 0ustar00fredianofrediano000000 000000 PHP

    PHP

    There are three options for building PHP with support for FreeTDS corresponding to the three APIs that FreeTDS supports: DB-Library, CT-Library, and ODBC.

    [Note]Note

    All these examples build the CGI version. Consult PHP's documentation for building the Apache module and including other extensions.

    DB-Library

    PHP can be configured with DB-Library access for a "Sybase" server (which also works with Microsoft servers), or with the mssql extension, intended exclusively for Microsoft servers.

    Example 7.6. PHP and DB-Library for “Sybaseâ€

    First build FreeTDS normally.

    	$ ./configure --prefix=/usr/local/freetds
    	$ make
    	$ su root
    	Password: 
    	$ make install

    Then build PHP with support for “Sybaseâ€

    	$ cd php
    	$ ./configure --with-sybase=/usr/local/freetds
    	$ make
    	$ su root
    	Password: 
    	$ make install

    And that's it!


    CT-Library

    Option 2 is to use the CT-Library API. Again here, we run into minor difficulties at build time. Applications linking with Sybase's OpenClient have to link in a handful of libraries and these libraries vary slightly from platform to platform. When creating FreeTDS it was decided that there would be only one library: libct. This saves a great deal of library naming conflicts that Sybase ran into (e.g. libtcl is used both by Sybase and the language TCL), however some applications like PHP assume that all the Sybase libraries will be present. So, some hand editing of the Makefile is necessary to remove these extra libs. Build FreeTDS just as you would for DB-Library in with DB-Library, above. Then configure PHP with CT-Library.

    	$ cd php
    	$ ./configure --with-sybase-ct=/usr/local/freetds

    Now edit the Zend/Makefile looking for the libZend_la_LDFLAGS line and remove -lsybtcl -lintl -lcomn and -lcs, leaving the -lct. Then proceed to make and install PHP.

    	$ make
    	$ su root
    	Password: 
    	$ make install

    We hope an upcoming version of PHP will automatically detect the presence of FreeTDS and include only the -lct library.

    ODBC

    The third and newest option is to use the FreeTDS ODBC driver with PHP. First build the iODBC or unixODBC driver manager and FreeTDS as detailed in Preparing ODBC. Then build PHP with support for ODBC.

    	$ cd php
    	$ ./configure --with-iodbc=/usr/local
    	$ make
    	$ su root
    	Password: 
    	$ make install

    Now everything should run. There is a sample PHP script in the FreeTDS samples directory called odbctest.php.

    freetds-1.3.6/doc/userguide/prepodbc.html000644 025423 025423 00000024362 14162303407 022037 0ustar00fredianofrediano000000 000000 Chapter 4. Preparing ODBC

    Chapter 4. Preparing ODBC

    Background and Terminology

    To connect to a database server, a library such as FreeTDS needs some information about the connection. By server, which IP address and port is do you mean? Which user is requesting the connection, and what authentication does he offer? Every database library needs a way to capture and convey that information.

    ODBC was conceived as a general interface definition, not tied to any particular database or access library. For that reason, ODBC also needs to know which driver to use with a given server.

    The original ODBC solution to this conundrum employed the odbc.ini file. odbc.ini stored information about a server, known generically as a Data Source Name (DSN). ODBC applications connected to the server by calling the function SQLConnect(DSN, UID, PWD), where DSN is the Data Source Name entry in odbc.ini, UID is the username, and PWD the password. Any and all information about the DSN was kept in odbc.ini. And all was right with the world.

    The ODBC 3.0 specification introduced a new function: SQLDriverConnect. The connection attributes are provided as a single argument, a string of concatenated name-value pairs. SQLDriverConnect subsumed the functionality of SQLConnect, in that the name-value pair string allowed the caller to pass — in addition the the original DSN, UID, and PWD — any other parameters the driver could accept. Moreover, the application can specify which driver to use. In effect, it became possible to specify the entire set of DSN properties as parameters to SQLDriverConnect, obviating the need for odbc.ini. This led to the use of the so-called DSN-less configuration, a setup with no odbc.ini.

    But FreeTDS did not start out as an ODBC driver (remember DB-Library and CT-Library), and has always had its own way to store server properties: freetds.conf. When Brian added the FreeTDS ODBC driver, he began by supporting the old SQLConnect, using odbc.ini to describe the DSN. That choice complied with the expectations of the Driver Managers, and minimized the amount of duplicated information in the configuration files. But it can be a little confusing, too, because odbc.ini in effect points to freetds.conf. We call this configuration ODBC-combined, because it supports all three FreeTDS libraries.

    As progress on the the FreeTDS ODBC library progressed, the driver was made able to read the connection attributes directly from odbc.ini, rather than leaning on freetds.conf. For installations that don't need DB-Library and CT-Library, this ODBC-only setup is simpler.

    More recently, SQLDriverConnect was added to FreeTDS. As described above, this function allows the application to specify connection attributes with reference to either, or neither, configuration file. It's your choice. In making that choice, keep the following terms clear in your mind:

    Important FreeTDS ODBC terms

    SERVERNAME

    specifies the [servername] entry in freetds.conf.

    SERVER

    specifies the real server i.e., the TCP/IP name of the machine hosting the database server.

    DSN, Driver

    In your connection string, you can decide to use a DSN entry in odbc.ini using the DSN attribute, or to specify the driver you want with the Driver attribute.

    In sum, FreeTDS supports three ODBC choices:

    ODBC configuration choices

    DSN-less

    No connection information is specified in odbc.ini. Advantageous if you're using more of FreeTDS than just the ODBC driver.

    ODBC-only

    All connection information is specified in odbc.ini, without the need for freetds.conf. This is the “traditional†ODBC setup.

    ODBC-combined

    Connection information maintained in freetds.conf. odbc.ini contains DSN entries that refer to servernames in freetds.conf.

    [Tip]Library or Driver?

    What's a library and what's a driver? Technically, they're the same thing: bodies of subroutines whose names are exported to a linker (static or runtime). By convention, a “library†is used directly by an application, whose programmer will require documentation and header files. A “driverâ€, by contrast, is defined by a binary API and is used in some kind of framework, hence printer driver and video driver.

    An ODBC driver is a hybrid. For the most part, an application relies on a driver manager to define manifest constants, and links to the DM's library. But because the ODBC specification leaves behavior up to the driver, the application is forced to include the driver's header files, too, to exploit driver-specific functions.

    freetds-1.3.6/doc/userguide/programming.html000644 025423 025423 00000007020 14162303410 022545 0ustar00fredianofrediano000000 000000 Chapter 11. Programmingfreetds-1.3.6/doc/userguide/projects.html000644 025423 025423 00000026155 14162303407 022074 0ustar00fredianofrediano000000 000000 Current Projects, Language Bindings, and Alternatives

    Current Projects, Language Bindings, and Alternatives

    Current Projects

    FreeTDS consists of some C libraries.

    The FreeTDS libraries support three separate APIs: DB-Library, CT-Library, and ODBC. Underlying these three is libtds, which handles the low-level details of the TDS protocol, such as sending, receiving, and datatype conversion. This document and the FreeTDS website are dedicated to these libraries.

    Status

    The libraries are portable, mature, and stable. They're expected to compile readily and normally do not crash or corrupt data. Extensive logging aids in diagnosing problems. While they do not include every feature provided by the vendors' libraries, they do faithfully implement a useful — and widely used — subset of their APIs.

    The DB-Library and CT-Library APIs have been usable for several years. They have been successfully substituted for Sybase's own libraries in a variety of venues, including Perl and PHP.

    The ODBC driver should be fully ODBC 3.5 compliant.

    Basic API coverage information for all libraries may be found in this manual. It is maintained in doc/api_status.txt, included in the source distribution.

    [Note]Note

    For Microsoft servers, FreeTDS now offers the best DB-Library for any OS on the planet (including Windows!) thanks not only to the hard work of its contributors, but also to Microsoft's[3] strategy. It is the only Win64 implementation of DB-Library, and the only Win32 implementation to support modern versions of the protocol. (SQL Server 2008 still accepts the TDS 4.2 connections that Microsoft's old library uses, but rejects BCP uploads with a spurious permission-denied message.)

    In addition to the core DB-Library API, FreeTDS includes a full implementation of DB-Library's bcp functions, as well as freebcp, a replacement for Sybase's bcp utility.

    How big is it? FreeTDS has over 100,000 lines of C code, maintained by a handful of developers. Patches arrive irregularly, varying in size from one-liners to thousand-line monsters. Almost all are applied or used in some way. The mailing list has some 700 or so subscribers at this writing. Safe to say, FreeTDS's success so far lies somewhere between the Beetle and the Edsel.

    Who uses it? Oh, pretty much everyone. FreeTDS users number in the tens of thousands. It's used by large corporations, by the U.S. federal government (e.g. Database Access Library at the National Center for Biotechnology Information) and, judging by the mailing list, by many webservers running Apache and PHP. Sybase recommends FreeTDS for their EAServer product. Microsoft recommends FreeTDS to their customers who want access to Microsoft SQL Server from non-Win32 clients. So do we.

    Languages besides C

    You may be wondering how these libraries fit with Perl, PHP, TCL, Python, or other popular scripting languages. Most of these languages have bindings to Sybase that use either the DB-Library or CT-Library API, for which FreeTDS is intended as a drop-in replacement. For instance, Michael Peppler's DBD::Sybase works very well using FreeTDS to access Sybase or Microsoft SQL Servers. PHP has options for sybase (DB-Library) and sybase-ct (CT-Library) APIs.

    Alternatives

    Should FreeTDS not suit your needs, some alternatives

    jTDS

    If Java is your game, we refer you to the jTDS project on SourceForge. It is a fork of the FreeTDS/JDBC project, by Craig Spannring, and is a free, native 100% Java implementation of a Type 4 JDBC driver.

    Sybase OpenClient

    In the time since FreeTDS was started, Sybase (as well as most major DBMS vendors) has released its database for the Intel GNU/Linux platform. The good: it is a solid product and supports TDS 4.2 and TDS 5.0. The bad: it doesn't support TDS 7.0 or Linux/*BSD on non-Intel platforms. The ugly: Microsoft broke date handling for big endian Sybase clients.

    Depending on platform, it may cost something.

    ODBC bridge products

    They use the ODBC driver on the NT box where your SQL Server runs so you'll never have trouble with new protocols and the like. On the downside, they can be costly and may be inefficient. We know of EasySoft ODBC-ODBC Bridge from EasySoft, Universal Data Access Driver from OpenLink Software, SequeLink from Merant, and ODBC Router from August Software Corporation.

    Inline ODBC driver

    Based on libtds, this is a native ODBC driver for i386 *nix. It is free in price, but comes only as a binary at the present time.

    DBD::Proxy

    We have no direct experience with this Perl-only option. It has the same caveats as an ODBC bridge except it's free.



    [3] Microsoft ceased enhancing DB-Library in 2001, advising customers to “avoid using DB-Libraryâ€. For Microsoft's unmaintained product, that's good advice. But if the DB-Library specification meets your needs, FreeTDS permits you to keep using it with little loss (and some gain) of functionality.

    freetds-1.3.6/doc/userguide/qt.html000644 025423 025423 00000004246 14162303410 020656 0ustar00fredianofrediano000000 000000 Qt

    Qt

    To access SQL Server databases using Qt use QODBC.

    There are some problems with wide character support on Qt because Qt assumes sizeof(SQLWCHAR) == 2. On some DMs, though — including iODBC, the default on Ubuntu — sizeof(SQLWCHAR) == 4, which could lead to invalid character conversion.

    freetds-1.3.6/doc/userguide/rtl.define.library.html000644 025423 025423 00000020155 14162303410 023724 0ustar00fredianofrediano000000 000000 What is a C library?

    What is a C library?

    A C library is a set of named functions, for example dbinit() or SQLConnect(). Or, for that matter, fopen(3)[34].

    Libraries come in two flavors: static and dynamic.

    Static libraries

    Static libraries (also known as archives) have been around as long as C itself. Like a .zip file, they're just a bag of object files — containing functions, of course — with a table of contents in front giving the address of each name[35]. Static libraries are created from object files using a librarian utility of some kind. One such programs is ar, for archive.

    Static libraries are part of the build environment. Functions in static libraries are joined to a program's main module by a static linker at build time to produce an executable program. The executable incorporates the libraries' object code into its own body, making it completely self-sufficient.

    Dynamic libraries

    Dynamic libraries are the new kid on the block, as these things go, arriving on the Unix scene circa 1985. Like a static library, a dynamic library is a collection of functions with a table of contents. They are referenced at build time to give the executatble information about how they will eventually be used, but they aren't used until run time.

    Dynamic libraries are part of the run-time environment. When a program is run, the run-time linker finds the dynamic libraries needed by the program, finds the addresses of the required functions, and assembles a runable image in memory. Missing libraries and/or missing functions — or the wrong versions of them — can lead to head-scratching and other amusing behavior.

    In Windows® dynamic libraries are called dynamic link libraries (DLLs). In Unix they're normally called shared objects. But they're roughly the same thing.

    [Note]What about .h files?

    C header files include functional prototypes, declarations (not definitions) of functions. Functional prototypes describe to the compiler each function's parameters, allowing the compiler to confirm that the function is being called correctly.

    Most of the functions declared in header files are implemented in libraries. However, there's no mechanical or automatic relationship between the functional prototypes in the header files and their implementation in a library. The .h file is maintained by hand, by the programmer, and is used to generate a library. The header file and associated library are distributed and installed together (one hopes), but correct installation and subsequent use by the compiler & linker require human beings to keep track of the pair. Failure to do so leads to “interesting†development and even run-time problems, especially with libraries whose functions' parameters change from version to version.

    For example, imagine a function f(int g) defined in library libf.so and declared in f.h. In a later version of libf.so, the function's parameter is changed to use a pointer, f(int *p), and f.h is likewise updated. Possible errors that cannot be prevented by the linker include:

    1. An old program could use the new library. Probably the integer it passes will be interpreted as an out-of-bounds address, resulting in a segmentation violation.

    2. A new program could use the old library, passing an address that the library interprets as an integer. Hillarity ensues.

    3. Existing source code could be compiled using the old header file but linked to the new library. If you've never done that, give it time.

    These errors are possible because C functions are identified to the linker by name only. On the upside, that makes the tools simple and easy to implement and, by the same token, simplifies the use of C libraries by other languages. The downside is that the work of ensuring that the right libraries are used becomes an administrative task instead of a technical one.



    [34] The Unix convention is to put in parentheses behind the name the section of the manual in which the function is documented. FreeTDS functions don't get numbers because they're not in the manual. Yet.

    [35] Or, depending on how you look at it, the name of each address.

    freetds-1.3.6/doc/userguide/rtl.html000644 025423 025423 00000017330 14162303410 021031 0ustar00fredianofrediano000000 000000 Appendix A. On Linkers

    Appendix A. On Linkers

    Abstract

    FreeTDS is a library, obviously, its functions invoked by an application. How the application finds the library can be mysterious. In the interest of making FreeTDS easier to use, this appendix discusses how it all works.

    This appendix focusses on using FreeTDS in your application. It isn't intended to help in building FreeTDS, although the background information it provides might be useful.

    What is a C function?

    A C function is a named bit of code.

    A C compiler recognizes function names in source code by parsing the C language. When it encounters a function name, it looks for a definition for the function — i.e. actual code implementing it — in the current file. If it finds one, it creates machine instructions to push any parameters on the stack, jump to the named address, and clear the stack after the functions returns. If it doesn't find one, it shrugs[33] and adds that name to the list of names to be resolved later. We'll get to what that means in a minute.

    The compiler's job ends where the linker's begins.

    Compiler's job

    • Convert source code into object code

    • Put in jumps to defined functions

    • Create a list of defined functions, and their addresses

    • Create a list of undefined functions

    The nm utility displays function names. Here are the ones defined by bsqldb.c (in bsqsldb.o):

    $ nm bsqldb.o | grep -wi t
    0000000000000000 T err_handler
    0000000000000270 T get_login
    00000000000001d0 t get_printable_size
    0000000000000940 T main
    00000000000000a0 T msg_handler
    00000000000007d0 t next_query
    00000000000006c0 t set_format_string
    0000000000000080 t usage

    GNU nm marks with a lower-case letter functions that are locally defined, not intended to be used outside the file. The C programmer marked those functions static. Note how closely the source code corresponds to the object code:

    $ grep ^static src/bsqldb.c
    static int next_query(DBPROCESS *dbproc);
    static void print_results(DBPROCESS *dbproc);
    static int get_printable_size(int type, int size);
    static void usage(const char invoked_as[]);
    static int set_format_string(struct METADATA * meta, const char separator[]);
    

    (Order doesn't matter. It's a set, not a list.)

    Here are some functions used, but not defined, by bsqldb.o:

    $ nm bsqldb.o | grep -w U | head
                     U __assert_fail
                     U __ctype_b_loc
                     U __errno_location
                     U __strdup
                     U __xpg_basename
                     U asprintf
                     U calloc
                     U dbaltbind
                     U dbaltcolid
                     U dbaltlen

    Two things to note. First, the functions defined by bsqldb.o have addresses, and undefined functions don't. Second, only the name identifies the function. It's been that way since about 1978, and it's one reason C libraries are so useful: to find a function, the tool need only resolve the name, i.e. convert the name into an address. The caller (the programmer, really) has to know the function's inputs and semantics (how it behaves), but the tool's job is bone simple. Which turns out to be quite handy.



    [33] You have to watch carefully. Modern compilers shrug quickly.

    freetds-1.3.6/doc/userguide/samplecode.html000644 025423 025423 00000146420 14162303410 022347 0ustar00fredianofrediano000000 000000 DB-Library for the Tenderfoot

    DB-Library for the Tenderfoot

    Few things are harder to put up with than the annoyance of a good example.

    —Mark Twain

    Abstract

    Below is a complete working DB-Library program, presented as a series of examples.

    Features of sample code

    • Processes command-line options to select the server, database, username, and password

    • Remaining arguments on the command line comprise the SQL query to execute

    • Installs error and message handlers

    • Illustrates correct row-processing

    • Illustrates correct error detection and handling

    Other sample code may be found in the distribution, in the cleverly named samples directory. A complete program, heavily commented for your perusal, is apps/bsqldb.c.

    [Important]Important

    How to Get and Build the sample code

    1. Run doc/grep_sample_code to extract the C code from the User Guide XML source.

    2. Compile

    3. Link

    Files Required to Build the Sample Code

    • sybfront.h

    • sybdb.h

    • libsybdb.a or libsybdb.so

    Your library's extension may vary according to your operating system.

    The source code may be built with commands similar to these. The precise options and paths depend on your particular system. The commands below work with the GNU compiler and linker on an ELF system with dynamic linking, common on Linux and BSD systems.

    Example 11.1. Building the Sample Code

    	$ ../doc/grep_sample_code ../doc/userguide.xml > sample.c
    	$ cc -I /usr/local/include -Wl,-L/usr/local/lib -Wl,-R/usr/local/lib sample.c -lsybdb -o sample


    where /usr/local/include and /usr/local/lib are respectively the locations of your header files and libraries.

    We now proceed to the code proper.

    Header files

    Abstract

    We need two header files to use DB-Library. We need a few others to deal with I/O in C, as you know. Also declare the error and message handler functions, more about which later.

    Example 11.2. Sample Code: DB-Library header files

    
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <assert.h>
    #include <errno.h>
    #include <unistd.h>
    #include <libgen.h>
    						
    						
    #include <sybfront.h>	/* sybfront.h always comes first */
    #include <sybdb.h>	/* sybdb.h is the only other file you need */
    
    int err_handler(DBPROCESS*, int, int, int, char*, char*);
    int msg_handler(DBPROCESS*, DBINT, int, int, char*, char*, char*, int);
    


    Prolog

    Abstract

    Nothing special here. Collect the command line parameters. We do this with the standard getopts(3) function. Cf. man 3 getopts for details.

    Example 11.3. Sample Code: DB-Library prolog

    	extern char *optarg;
    	extern int optind;
    	
    	const static char syntax[] =
    		"syntax: example -S server -D db -U user -P passwd\n";
    	
    	struct {
    		char *appname, *servername, *dbname, *username, *password;
    	} options = {0,0,0,0,0};
    	
    	int
    	main(int argc, char *argv[])
    	{
    		int i, ch;
    		LOGINREC *login;	1
    		DBPROCESS *dbproc;	2
    		RETCODE erc;		3
    
    		options.appname = basename(argv[0]);
    
    		while ((ch = getopt(argc, argv, "U:P:S:D:")) != -1) {
    			switch (ch) {
    			case 'S':
    				options.servername = strdup(optarg);
    				break;
    			case 'D':
    				options.dbname = strdup(optarg);
    				break;
    			case 'U':
    				options.username = strdup(optarg);
    				break;
    			case 'P':
    				options.password = strdup(optarg);
    				break;
    			case '?':
    			default:
    				fprintf(stderr, syntax);
    				exit(1);
    			}
    		}
    
    		argc -= optind;
    		argv += optind;
    
    		if (! (options.servername && options.username  && options.password)) {
    			fprintf(stderr, syntax);
    			exit(1);
    		}
    		


    Prolog Notes

    1

    LOGINREC is a structure that describes the client. It's passed to the server at connect time.

    2

    DBPROCESS is a structure that describes the connection. It is returned by dbopen().

    3

    RETCODE is the most common return code type for DB-Library functions.

    Initialize

    Abstract

    Initialize the library. Create and populate a LOGINREC record.

    Example 11.4. Sample Code: DB-Library Initialize

    
    		1
    		if (dbinit() == FAIL) {
    			fprintf(stderr, "%s:%d: dbinit() failed\n",
    			options.appname, __LINE__);
    			exit(1);
    		}
    
    		2
    		dberrhandle(err_handler);
    		dbmsghandle(msg_handler);
    
    		3
    		if ((login = dblogin()) == NULL) {
    			fprintf(stderr, "%s:%d: unable to allocate login structure\n",
    			options.appname, __LINE__);
    			exit(1);
    		}
    
    		4
    		DBSETLUSER(login, options.username);
    		DBSETLPWD(login, options.password);
    
    		


    Initialization Notes

    1

    Always make dbinit() the first DB-Library call.

    2

    Install the error- and mesage-handlers right away. They're explained in more detail later.

    3

    dblogin() almost never fails. But check! No point in trying to use a null pointer.

    4

    The LOGIN record isn't directly accessible. It's populated via macros like these. There are other fields, but these two are essential. Look for SETLsomething in the documentation.

    Connect to the server

    Abstract

    dbopen() forms a connection with the server. We pass our LOGINREC pointer (which describes the client end), and the name of the server. Then, optionally, we change to our favored database. If that step is skipped, the user lands in his default database.

    Example 11.5. Sample Code: DB-Library Connect to the server

    		if ((dbproc = dbopen(login, options.servername)) == NULL) {
    			fprintf(stderr, "%s:%d: unable to connect to %s as %s\n",
    				options.appname, __LINE__,
    				options.servername, options.username);
    			exit(1);
    		}
    
    		if (options.dbname  && (erc = dbuse(dbproc, options.dbname)) == FAIL) {
    			fprintf(stderr, "%s:%d: unable to use to database %s\n",
    				options.appname, __LINE__, options.dbname);
    			exit(1);
    		}
    
    		


    Send a query

    Abstract

    DB-Library maintains a command buffer to hold the SQL to be sent to the server. Two functions — dbcmd() and dbfcmd() — build up the query from strings of text. The command buffer is reset after the query is sent to the server.

    We left the SQL on the command line. We fetch it now and send it to the server.

    Example 11.6. Sample Code: DB-Library Send a query

    		for (i=0; i < argc; i++) {
    			assert(argv[i]);
    			printf("%s ", argv[i]);
    			if ((erc = dbfcmd(dbproc, "%s ", argv[i])) == FAIL) {
    				fprintf(stderr, "%s:%d: dbcmd() failed\n", options.appname, __LINE__);
    				exit(1);	1
    			}
    		}
    		printf("\n");
    
    		if ((erc = dbsqlexec(dbproc)) == FAIL) {
    			fprintf(stderr, "%s:%d: dbsqlexec() failed\n", options.appname, __LINE__);
    			exit(1);		2
    		}
    		


    Initialization Notes

    1

    Failure at this juncture is rare. The library is merely allocating memory to hold the SQL.

    2

    dbsqlexec() waits for the server to execute the query. Depending on the complexity of the query, that may take a while.

    dbsqlexec() will fail if something is grossly wrong with the query, e.g. incorrect syntax or a reference to nonexistent table. It's only the first of a few places where an error can crop up in processing the query, though. Just because dbsqlexec() succeeded doesn't mean you're in the clear.

    Fetch Results

    Abstract

    A query may produce zero, one, or more results. The application normally provides buffers to DB-Library to fill, and iterates over the results a row (and column) at a time.

    Kinds of Results

    Results is a special term: it means more than rows or no rows. To process the results means to gather the data returned by the server into the application's variables.

    Table 11.4. Kinds of Results

    TypeMetadataRegular RowsCompute RowsReturn StatusExample SQL
    NoneNoneNoneNoneNoneAny INSERT, UPDATE, or DELETE statement
    Empty1 setNone0 or moreNoneSELECT name FROM systypes WHERE 0 = 1
    Simple 1 set 0 or more None None SELECT name FROM sysobjects
    Complex 2 or more 0 or more 1 or more None SELECT name FROM sysobjects COMPUTE COUNT(name)
    Stored Procedure 0 or more 0 or more 0 or more 1 or moreEXEC sp_help sysobjects


    As the above table shows, results can comprise ordinary rows and compute rows (resulting from a COMPUTE clause). Stored procedures may of course contain multiple SQL statements, some of which may be SELECT statements and might include COMPUTE clauses. In addition, they generate a return status (with a RETURN statement or else automatically) and perhaps OUTPUT parameters.

    Data and Metadata

    Observe that a row is set of columns, and each column has attributes such as type and size. The column attributes of a row are collectively known as metadata. The server always returns metadata before any data (even for a SELECT statement that produced no rows).

    Table 11.5. Result-fetching functions

    FunctionFetchesReturnsComment
    dbresults()metadataSUCCEED, FAIL or, NO_MORE_RESULTS. SUCCEED indicates just that: the query executed successfully (whew!). There may be metadata (and perhaps data) and/or stored procedure outputs available.
    dbnextrow()data REG_ROW, compute_id, NO_MORE_ROWS, BUF_FULL, or FAIL. Places fetched data into bound columns, if any.


    Binding

    Each time dbresults() returns SUCCEED, there is something to retrieve. DB-Library has different functions to deal with the different kinds of results. The functions are of two kinds: those that convert the data into a form desired by the application, known as binding, and those that return the data in “native†form.

    To understand binding, it may be easiest to examine two primitive functions, dbdata() and dbconvert(). dbdata() returns a pointer to the column's data. The data to which it points are in “native†form, 4 bytes for an INT, 8 bytes for a DATETIME and so on. dbconvert() converts between datatypes; you can hand it an integer and get back a character array (or a C double. You might think of dbconvert() as atoi(3) on steroids). dbbind() combines these two functions. The application indicates in what form it would like to use each column, and the library converts them on the fly as each row is read.

    To bind a column is to provide a buffer to DB-Library for it to fill, and indicate which datatype the buffer is meant to hold. [29]

    It may be well to pause here to observe the three ways a datatype is described in a DB-Library program.

    DB-Library Datatype Descriptors

    Sever Datatype

    Describes the data as an abstract type, not representing any particular kind of storage. SYBREAL, for example, doesn't imply any particular arrangement of bits; it just means “a floating-point datatype corresponding to the T-SQL REAL type on the server.†These all begin with SYB, e.g. SYBINT4.

    Program Variable Datatype

    Defines a C variable in a machine-independent way. Because a C defines its int type according the CPU architecture, it may have 2, 4, 8, or some other number of bytes. A DBINT on the other hand, is guaranteed to be 4 bytes and, as such, assuredly will hold any value returned by the server from a T-SQL INT column. These all begin with DB, e.g. DBREAL.

    Bind Type

    Prescribes a conversion operation. Indicates to dbbind() the Program Variable Datatype defined by the target buffer. Sybase and Microsoft call this the “vartypeâ€. These all end with BIND, e.g. STRINGBIND.

    Typically it's convenient to have DB-Library convert the data into the desired form. The function that does that is dbind(). So: after fetching the metadata, and before fetching the data, we usually prepare the bound columns.

    Fetching Data

    Table 11.6. Data-fetching functions

    TypeRegular rowsCompute rowsReturn statusOUTPUT parameters
    Meta dbnumcols() dbnumcompute(), dbnumalts(), dbaltop(), dbbylist() dbhasretstatus() dbnumrets()
    Binding dbbind(), dbnullbind() dbaltbind(), dbanullbind() dbretstatus() none
    Native dbdatlen(), dbdata() dbadlen(), dbalttype(), dbaltutype(), dbaltlen(), dbadata() none dbretdata(), dbretlen(), dbretname(), dbrettype()


    The paradigm may now perhaps be clear: Query, fetch results, bind columns, fetch regular rows, fetch compute rows, fetch stored procedure outputs. Repeat as necessary.

    Table 11.7. Putting it all together

    Step Function Once Per Many Times Per
    Query dbsqlexec() QueryProgram
    Fetch metadata dbresults() SQL statement Query
    Prepare variables dbbind() ColumnStatement
    Fetch regular data dbnextrow() Row Statement
    Fetch compute data dbnextrow() Compute column Statement
    Fetch output parameters dbretdata() output parameter Stored procedure
    Fetch return status dbretstatus() Stored procedure Program


    [Important]Fetch All Rows!

    Now, at last, some sample code that fetches data. In the interest of simplicity, we don't bind anything except regular rows.

    Example 11.7. Sample Code: DB-Library Fetch Results

    		while ((erc = dbresults(dbproc)) != NO_MORE_RESULTS) {
    			struct COL 						1
    			{
    				char *name;
    				char *buffer;
    				int type, size, status;
    			} *columns, *pcol;
    			int ncols;
    			int row_code;
    
    			if (erc == FAIL) {
    				fprintf(stderr, "%s:%d: dbresults failed\n",
    				options.appname, __LINE__);
    				exit(1);
    			}
    
    			ncols = dbnumcols(dbproc);
    
    			if ((columns = calloc(ncols, sizeof(struct COL))) == NULL) {
    				perror(NULL);
    				exit(1);
    			}
    
    			/*
    			 * Read metadata and bind.
    			 */
    			for (pcol = columns; pcol - columns < ncols; pcol++) {
    				int c = pcol - columns + 1;
    
    				pcol->name = dbcolname(dbproc, c);		2
    				pcol->type = dbcoltype(dbproc, c);
    				pcol->size = dbcollen(dbproc, c);
    
    				if (SYBCHAR != pcol->type) {			3
    					pcol->size = dbprcollen(dbproc, c);
    					if (pcol->size > 255)
    						pcol->size = 255;
    				}
    
    				printf("%*s ", pcol->size, pcol->name);
    
    				if ((pcol->buffer = calloc(1, pcol->size + 1)) == NULL){
    					perror(NULL);
    					exit(1);
    				}
    
    				erc = dbbind(dbproc, c, NTBSTRINGBIND,	4
    				pcol->size+1, (BYTE*)pcol->buffer);
    				if (erc == FAIL) {
    					fprintf(stderr, "%s:%d: dbbind(%d) failed\n",
    					options.appname, __LINE__, c);
    					exit(1);
    				}
    			
    				erc = dbnullbind(dbproc, c, &pcol->status);	5
    				if (erc == FAIL) {
    					fprintf(stderr, "%s:%d: dbnullbind(%d) failed\n",
    					options.appname, __LINE__, c);
    					exit(1);
    				}
    			}
    			printf("\n");
    
    			/*
    			 * Print the data to stdout.
    			 */
    			while ((row_code = dbnextrow(dbproc)) != NO_MORE_ROWS){	6
    				switch (row_code) {
    				case REG_ROW:
    					for (pcol=columns; pcol - columns < ncols; pcol++) {
    						char *buffer = pcol->status == -1?
    						"NULL" : pcol->buffer;
    						printf("%*s ", pcol->size, buffer);
    					}
    					printf("\n");
    					break;
    
    				case BUF_FULL:
    					assert(row_code != BUF_FULL);
    					break;
    
    				case FAIL:
    					fprintf(stderr, "%s:%d: dbresults failed\n",
    					options.appname, __LINE__);
    					exit(1);
    					break;
    
    				default: 					7
    					printf("Data for computeid %d ignored\n", row_code);
    				}
    
    			}
    
    			/* free metadata and data buffers */
    			for (pcol=columns; pcol - columns < ncols; pcol++) {
    				free(pcol->buffer);
    			}
    			free(columns);
    
    			/*
    			 * Get row count, if available.
    			 */
    			if (DBCOUNT(dbproc) > -1)
    				fprintf(stderr, "%d rows affected\n", DBCOUNT(dbproc));
    
    			/*
    			 * Check return status
    			 */
    			if (dbhasretstat(dbproc) == TRUE) {
    				printf("Procedure returned %d\n", dbretstatus(dbproc));
    			}
    		}
    
    		dbclose(dbproc);
    		dbexit();
    		exit(0);
    	}
    	


    Data-fetching Notes

    1

    As soon as dbresults() reports SUCCESS, the row's metadata are available.

    2

    DB-Library columns start with 1.

    3

    dbcollen() returns the sizeof the native data (e.g. 4 bytes for a T-SQL INT). We'll use dbbind() to convert everything to strings. If the column is [VAR]CHAR, we want the column's defined size, otherwise we want its maximum size when represented as a string.

    4

    NTBSTRINGBIND null-terminates the character array for us. “NTB†might perhaps stand for “null terminating byteâ€.

    5

    A zero-length string is not a NULL! dbnullbind() arranges for the passed buffer to be set to -1 whenever that column is NULL for a particular row.

    6

    Each time dbnextrow() returns REG_ROW, it has filled the bound buffers with the converted values for the row.

    7

    Computed rows are left as an exercise to the reader.

    Messages and Errors

    Abstract

    Errors may originate on the server or in the library itself. The former are known as messages (because they are: they arrive as messages from the server); the latter are termed errors. Their handling is a little intimidating. It requires writing and installing a callback function (whose parameters are predefined by DB-Library), and thinking about how to handle different types of errors.

    Kinds of Errors

    Messages

    Messages arise because the server has something to say. [30]. They usually describe some problem encountered executing the SQL. Perhaps the SQL refers to a nonexistent object or attempted to violate a constraint. But they can also be benign, indicating for instance merely that the default database has changed.

    Errors

    Errors arise either because the application has misused DB-Library in some way — say, passed a NULL DBPROCESS pointer or tried to issue a query while results were pending — or because some trouble cropped up in communicating with the server (couldn't find it, say, or didn't hear back from it).

    Why these two require distinct handling is lost in the mists of time. But it does help to keep them distinct in your mind, especially while reading the documentation.

    To have DB-Library use your handler, pass its name to the appropriate dberrhandle() or dbmsghandle() function immediately after calling dbinit().

    Example 11.8. Sample Code: DB-Library Error and Message handlers

    	int
    	msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity,
    			char *msgtext, char *srvname, char *procname, int line)
    	{									1
    		enum {changed_database = 5701, changed_language = 5703 };	2
    
    		if (msgno == changed_database || msgno == changed_language)
    			return 0;
    
    		if (msgno > 0) {
    			fprintf(stderr, "Msg %ld, Level %d, State %d\n",
    					(long) msgno, severity, msgstate);
    
    			if (strlen(srvname) > 0)
    				fprintf(stderr, "Server '%s', ", srvname);
    			if (strlen(procname) > 0)
    				fprintf(stderr, "Procedure '%s', ", procname);
    			if (line > 0)
    				fprintf(stderr, "Line %d", line);
    
    			fprintf(stderr, "\n\t");
    		}
    		fprintf(stderr, "%s\n", msgtext);
    
    		if (severity > 10) {						3
    			fprintf(stderr, "%s: error: severity %d > 10, exiting\n",
    			options.appname, severity);
    			exit(severity);
    		}
    
    		return 0;							4
    	}
    	
    	int
    	err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr,
    			char *dberrstr, char *oserrstr)
    	{									5
    		if (dberr) {							6
    			fprintf(stderr, "%s: Msg %d, Level %d\n",
    			options.appname, dberr, severity);
    			fprintf(stderr, "%s\n\n", dberrstr);
    		} else {
    			fprintf(stderr, "%s: DB-LIBRARY error:\n\t", options.appname);
    			fprintf(stderr, "%s\n", dberrstr);
    		}
    	
    		return INT_CANCEL;						7
    	}
    	


    [Note]Note

    Handlers are always called before the function that engendered them returns control to the application.

    Error Handling Notes

    1

    When first writing a handler, pay careful attention to the precise type of each parameter. Only by carefully matching them will you convince a modern C compiler that the address of your function is of the type accepted by dbmsghandle(). [31]

    2

    Some messages don't convey much, as though the server gets lonely sometimes. You're not obliged to print every one.

    3

    Severities are defined in the server documentation, and can be set by the T-SQL RAISERROR statement.

    4

    Message handlers always and only ever return zero.

    5

    When first writing the handler, pay careful attention to the precise type of each parameter. Only by carefully matching them will you convince a modern C compiler that the address of your function is of the type accepted by dberrhandle(). [32]

    6

    Some messages are so severe they provoke DB-Library into calling the error handler, too! If you have both installed — and of course you do, right? — then you can skip those lacking an error number.

    7

    While INT_CANCEL is the most common return code, it's not the only one. For one thing, the error handler's return code can control how long DB-Library keeps retrying timeout errors. See the documentation for details.

    [Note]Note

    No matter what the error handler says or does, it can't remedy the error. It's still an error and usually the best that can happen is that the function will return FAIL. The exception is timeout conditions, when the handler can stave off failure by requesting retries.

    You may be asking yourself, “OK, fine, I can print the error message. But what if I want to communicate something back to the line in my program where the error occurred? How to do that?†First of all, remember the calling function — that's your application — will learn of an error from the return code. If it needs more detail, though, there are two ways to pass it.

    1. Set a global variable.

    2. Use setuserdata() and getuserdata().

    [Tip]Tip

    If your application is written in C++, you may be tempted to use throw(). Don't! Your handler is a C function and, more important, it's an extension of DB-Library. You can put a throw() in your handler and it will compile. But when it executes, it's going to rip through DB-Library's stack. Your application will be unuseable at that point, if it doesn't cause a segment fault.

    Last Remarks

    We've reached the end of our DB-Library tour. The almost 300 lines of C above constitute program with these features:

    Sample Code features

    • Accepts command-line parameters and SQL.

    • Checks for errors and server messages.

    • Processes any number of results..

    • Prints results in columns of suitable widths.

    There are things it doesn't do, in the name of simplicity.

    Sample Code nonfeatures

    • No BCP (bulk copy) mode

    • No RPC (remote procedure call) mode, preventing it from retrieving output parameters.

    Your humble author hopes you found it worthwhile. Happy Hacking.



    [29] This is the sort of thing C++'s type system does so much better

    [30] Just one more way in which databases differ from files.

    [31] Back in K&R days, that wasn't such a problem. But there were other problems, some much worse.

    [32] If that advice sounds familiar, it's because it bears repeating.

    freetds-1.3.6/doc/userguide/seemtooslow.html000644 025423 025423 00000007552 14162303410 022615 0ustar00fredianofrediano000000 000000 Slow connection or data retrieval

    Slow connection or data retrieval

    FreeTDS is not slow. We know this because we've tested it. It's measurably slower than the vendors' products for some operations, but it's not noticeably slower and it's certainly no laggard. If your experience is different, if you're waiting 30 seconds for simple operations or minutes instead of seconds for for query results, something is up with your setup. There are two likely culprits.

    • Logging. If everything seems a bit sluggish, check to make sure logging is turned off. TDSDUMP should not be defined, and there should be no dump file mentioned in freetds.conf. You can double-check by setting TDSDUMPCONFIG temporarily, which will log only the startup process.

    • DNS. If connecting to the server takes 30 seconds or 1 minute, you could do worse than to check your resolv.conf. Use host or nslookup to confirm that FreeTDS can actually resolve the name/address you provided in freetds.conf.

    • Packet size. The default packet size setting in freetds.conf (see initial block size) is usually fine. Slowness can potentially be due to multiple packet to use. Under GNU/Linux system we use an optimization to reduce network traffic; you shouldn't see much difference using this system.

    freetds-1.3.6/doc/userguide/serverthere.html000644 025423 025423 00000016212 14162303410 022564 0ustar00fredianofrediano000000 000000 Is the server there?

    Is the server there?

    Start with ping

    First ping the host to make sure you can talk to the machine the server resides on.

    Example 8.1. Finding the server's host

    	$ ping -c1 myhost
    	PING myhost (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data.
    	64 bytes from myhost (127.0.0.1): icmp_seq=0 ttl=255 time=250 usec


    A successful ping shows that your network isn't preventing you from reaching the machine hosting the server.

    Test with telnet

    Attempt to telnet to the port, to verify that the servername is listening.

    Example 8.2. Finding the server

    	$ telnet myhost 1433
    	Trying 127.0.0.1...
    	Connected to myhost.
    	Escape character is '^]'. 


    If you get output as above, the servername is listening. If you get a 'Connection Refused' message, you're talking to the wrong host, wrong port, or the servername is down. [24]

    Test with tsql

    tsql can be run in two ways, one which uses freetds.conf and one which connects directly using the host and port. First attempt a connection using host and port.

    Example 8.3. Connecting to the server, bypassing freetds.conf

    	$ cd src/apps
    	$ TDSVER=auto ./tsql -H myhost -p 1433 -U user


    If you receive a message of 'Login Failed.' then your connectivity is OK, but you have a authentication issue.

    If you receive a message like

    	Msg. No.: 18450 Severity: 14 State: 1 Login failed- User: loginid 
    	Reason: Not defined as a valid user of a trusted Microsoft SQL Server connection 

    Microsoft SQL Server is accepting only “domain†logins. This applies only to Microsoft SQL Server and you'll need to have your DBA verify that “server logins†are allowed, or use a domain login.

    Finally, if you received a prompt, then try tsql using the servername.

    Example 8.4. Connecting to the server using freetds.conf

    	$ ./tsql -S myserver -U user


    If this fails, FreeTDS is either not finding your freetds.conf file, finding the wrong one, or there is an error in the file.



    [24] To exit telnet: When connected, telnet's command mode may be entered by typing the telnet escape character (initially Ctrl-], as above). Once in command mode, telnet may be exited with the command quit.

    freetds-1.3.6/doc/userguide/software.html000644 025423 025423 00000016027 14162303410 022064 0ustar00fredianofrediano000000 000000 Chapter 7. How to get what works with it working

    Chapter 7. How to get what works with it working

    The following programs are known to work to some extent with FreeTDS. Here you will find any special instructions for getting them compiled or running.

    SQSH

    SQSH is a command line based query tool written by Scott Gray to replace the isql utility that ships with Sybase ASE. It makes a great diagnostic tool for FreeTDS as well. If you are having trouble, install SQSH (it's easy) and try getting that to work before more complicated arrangements.

    [Tip]Tip

    SQSH 2.1 includes direct support for FreeTDS, so these instructions may not be necessary, but are still included just in case.

    After running configure in SQSH's directory (make sure you set the Sybase environment variable first), look for the Sybase_LIBS definition in the Makefile. Change the line to match this example.

    Example 7.1. The SQSH Makefile

    	#
    	#  The following set of CT-LIB libraries were determined automatically
    	#  by 'configure'.  For most systems configure looks up the required
    	#  libraries by looking at the name of the OS (although this doesn't
    	#  mean it got them right), however if the line below ends with the
    	#  word "Guess", then 'configure' didn't have an entry for your operating
    	#  system and it took a best guess to figure out which libraries you
    	#  need. In either case, there may be problems, so look this line over
    	#  and if it doesn't work, compare it to the libraries located in
    	#  $SYBASE/samples/ct-library.
    	#
    	#  The listings below show suggested libraries for Operating Systems
    	#  that frequently fail to be recognized by 'configure':
    	#
    	#  SCO:   -lblk -lct -lcs -lcomn -ltcl -ltli -lnsl_s -lintl -m -lsocket
    	#  Dynix: -lblk -lct -lcs -lcomn -ltcl -ltli -lnsl -lintl -lm -lseq
    	#
    	SYBASE_LIBS   = -lct -ldl -lm
    	


    At this point you can also enable readline support if you didn't specify it in the configure arguments.

    After that just type make and you are off and running.

    freetds-1.3.6/doc/userguide/stunnel.html000644 025423 025423 00000010445 14162303407 021726 0ustar00fredianofrediano000000 000000 stunnel HOWTO

    stunnel HOWTO

    Contributed by Bradley Bell.

    To set up FreeTDS over stunnel between a Linux webserver and a W2k SQL server:

    1. Get unencrypted FreeTDS working

    2. Install openssl and stunnel on the Linux box: stunnel.org

    3. Download the stunnel binary and openssl dll's for Windows.

    4. Generate stunnel.pem (complete with Diffie-Hellman parameters) for placement on the W2k box. See instructions in the stunnel FAQ.

    5. Start stunnel on the W2k box:

      	$ stunnel.exe -d 61666 -r localhost:1433

      61666 is just an arbitrary port number.

    6. Start stunnel on the Linux box:

      	$ stunnel -c -d 1433 -r win2kserver:61666

      where win2kserver is the hostname or IP address of the W2k box.

    7. Set up FreeTDS to use the tunnel. If this is your unencrypted entry in freetds.conf:

      Example 5.9. Unencrypted entry in freetds.conf

      	[win2kserver]
      	host = win2kserver
      	port = 1433
      	

      the encrypted equivalent uses:

      Example 5.10. Encrypted entry in freetds.conf

      	[win2kserver]
      	host = localhost
      	port = 1433
      	

    freetds-1.3.6/doc/userguide/tdshistory.html000644 025423 025423 00000012621 14162303407 022450 0ustar00fredianofrediano000000 000000 History of TDS Versions

    History of TDS Versions

    At first, there was One Version of TDS common to both vendors but, in keeping with the broad history of private ventures, they soon diverged. Each vendor has subsequently brought out different versions, and neither supports the other's flavor. That is to say, each vendor's client libraries use the latest version of TDS offered by that vendor. You can't reliably use Microsoft's libraries to connect to Sybase, or Sybase's libraries to connect to Microsoft. In some cases you'll get a connection, but pretty soon you'll bump into some incompatibility.

    Versions of the TDS protocol

    TDS 4.2 Sybase and Microsoft

    The version in use at the time of the Sybase/Microsoft split.

    TDS 5.0 Sybase

    Introduced for Sybase. Because TDS 5.0 includes negotiated capabilities through which protocol features can be expanded, we are unlikely to see a new TDS version from Sybase.

    TDS 7.0 Microsoft

    Introduced for SQL Server 7.0. Includes support for the extended datatypes in SQL Server 7.0 (such as char/varchar fields of more than 255 characters). It also includes support for Unicode.

    TDS 7.1 Microsoft, was 8.0 [2]

    Introduced for SQL Server 2000. Includes support for big integer (64-bit int) and “variant†datatypes.

    TDS 7.2 Microsoft, was 9.0

    Introduced for SQL Server 2005. Includes support for varchar(max), varbinary(max), xml datatypes and MARS.

    TDS 7.3 Microsoft

    Introduced for SQL Server 2008. Includes support for extended date/time, table as parameters.

    TDS 7.4 Microsoft

    Introduced for SQL Server 2012. Includes support for session recovery.



    [2] Earlier FreeTDS documentation referred to versions 7, 8 and 9. Microsoft subsequently published a protocol specification document denoting 7.1 and 7.2, and one finds scattered references using that scheme elsewhere, too. For that reason, FreeTDS switched to Microsoft's nomenclature.

    freetds-1.3.6/doc/userguide/tdspool.html000644 025423 025423 00000017724 14162303407 021731 0ustar00fredianofrediano000000 000000 TDS Connection Pooling

    TDS Connection Pooling

    The Connection Pooling server swims in the src/pool directory.

    The FreeTDS connection pool is a server process; it emulates a SQL Server. Any program that can attach to a real SQL Server may instead elect to attach to the pool server. The pool in turn connects to the SQL Server and database you specify, and attempts to share these connections. See the src/pool/README for a more detailed description of its inner workings.

    To configure the pool server, first make sure FreeTDS has a working entry for the real SQL Server by connecting to it with SQSH or another program.

    [Note]Note

    The FreeTDS connection pool currently does not supports TDS version 5.0 (Sybase) and encrypted connections. This restriction applies to both the client-to-pool and pool-to-server connections!

    After FreeTDS has been installed, you will find an executable named tdspool in the /usr/local/bin directory (or whatever directory was specified with the configure --with-prefix flag option).

    Edit pool.conf in the FreeTDS's etc directory. The pool.conf file is formatted like freetds.conf, with a section name in brackets and options for each section in key/value pairs.

    Just as in freetds.conf there are two types of sections, a [global] section whose options affect all pools, and a section with the name of the pool for pool-specific options. The following options are supported and may appear in either section.

    Table 5.1. pool.conf settings

    NamePossible ValuesDefaultMeaning
    userAny valid usernoneThe username used to connect to the pool server.
    passwordAnynoneThe password of the user at the pool server.
    server userAny valid useruser fieldThe username used to connect to the servername.
    server passwordAnypassword fieldThe password of the user at the servername.
    serverAny entry in the freetds.conf filenoneThe alias from the freetds.conf file representing the servername that will be connected to.
    databaseAny valid databaseUser's default databaseThe database on the servername to use.
    portAny TCP portnonePort on which tdspool will listen.
    min pool conn0 or morenoneMinimum number of open connections to maintain to the servername. 0 will cause pool server to not open any initial connection.
    max pool conn1 or morenoneMaximum number of open connections to open against the servername.
    max member age0 (no limit) or a number of seconds0Maximum age of idle members before connection is closed.


    Now, let's put this into practice.

    Example 5.8. pool.conf

    	[global]
    	min pool conn = 5
    	max pool conn = 10
    	max member age = 120
    	
    	[mypool]
    	user = webuser
    	password = secret
    	database = ebiz
    	server = fooserv
    	max pool conn = 7
    	port = 5000
    	


    The [global] section defines that we will open 5 connections against the server initially, and will increase up to 10 as demand requires. These connections will be closed after being idle for 2 minutes (120 seconds), but only until there are 5 remaining open.

    The [mypool] section defines a pool named mypool that will listen on port 5000. It will login to a SQL Server named fooserv using the user webuser and the ever so clever password of secret. Once logged in, the connections will use the database ebiz instead of webuser's default database. Also, since this SQL Server has a limited number of CALs (Client Access Licenses), we are restricting the maximum number of connections to 7, which overrides the global setting of 10.

    Run tdspool with the name of the pool you are serving.

    	$  tdspool mypool

    Before your clients connect to the pool, you must edit your freetds.conf to include the host and port of the pooling server, and point your clients at it.

    freetds-1.3.6/doc/userguide/troubleshooting.html000644 025423 025423 00000031116 14162303410 023455 0ustar00fredianofrediano000000 000000 Chapter 8. Troubleshooting

    Chapter 8. Troubleshooting

    He's like motherf**king McGuiver, no he's better than McGuiver!

    —Jason Mewes (Mall Rats)

    Known Issues

    Porting Issues

    Date Structures and Offsets

    Microsoft and Sybase use different DB-Library date structures and conventions. Notably months can be in the range [0,11] or [1,12]. Pay careful attention to the results of dbdatecrack().

    Floating Point

    Precision may surprise you if you pay attention. Microsoft's DB-Library promotes single-precision to double in dbbind() by appending zeros; C promotes it to the nearest double. FreeTDS relies on the C compiler.

    Math libraries vary, too. If porting an application whose output uses functions such at log(3), expect differences in different implementations. Perfectly consistent results between OSes will require the use of a single math library.

    Text Fields

    Questions sometimes arise over large varchar types (anything larger than varchar(255)) that became available with Microsoft SQL Server 7.0. When accessing long varchars with TDS protocol version 4.2 or 5.0, these fields will be truncated to 255 characters, due to limitations inherent in the protocol definition. Your best bet in that case is to convert them to text types.

    In Microsoft SQL Server 7.0 and later, varchar types can hold up to 8000 bytes (8000 ASCII characters or 4000 Unicode characters). To move these large varchars through TDS 4.2, convert them with either a CONVERT as in,

    	SELECT mycol = convert(mycol, text) FROM mytable 

    or with the newer SQL92 CAST syntax e.g.,

    	SELECT CAST(mycol as TEXT) FROM mytable

    There is also a bug (“Lions and tigers and bugs! Oh, my!â€) in Microsoft's implementation of text fields. Disregardless [sic] of their documentation, you must explicitly set the value of TEXTSIZE, else the text fields will be represented to have a maximum size of 4 gigabytes or so. If you encounter some spurious “out of memory†error try to set TEXTSIZE to some reasonable value before querying any TEXT fields. For example, in isql:

    	1> set TEXTSIZE 10000
    	2> go

    Another way to handle control the default TEXTSIZE is to use the setting in freetds.conf. As most of the time data contained in BLOBs fields are much smaller than larger supported fields, we try to avoid considering field sizes for BLOBs allocating memory as needed instead, so you should not have to reduce this value unless you really want the server to limit data returned by queries.

    Endianism

    If either your server or your client is a big endian system, pay careful attention to all references to endianism anywhere near FreeTDS. See the section on Little Endian Emulation for details.

    Datetime and Money

    Big endian clients may experience difficulty with Microsoft servers. Some versions of Microsoft SQL Server 7 did not handle these types on these machines correctly, according to the protocol. According to http://support.microsoft.com/support/kb/articles/Q254/1/23.ASP on the Microsoft support site, it's fixed as of service pack 3. Unfortunately, there's no direct way for FreeTDS to know whether or not a service pack has been installed, and how/whether to support the buggy version is an outstanding issue. Your best bet is to apply their patch.

    [Note]Note

    The Knowledge Base article states “The Sybase CT-Lib client is the only known big-endian client that can connect to SQL Server.†Depends on who's doing the knowing, of course.

    Microsoft's “Integrated Securityâ€

    FreeTDS may be unable to connect to the server. The error message will be "Login failed for user 'example'. Reason: Not associated with a trusted SQL Server connection". To solve this, turn on SQL Server authentication:

    • Open the Microsoft SQL Server Enterprise Manager,

    • Select the server,

    • Right mouse click and choose Properties. A properties window will appear.

    • Choose the Security tab. The security properties will be displayed.

    • Change the Authentication field to SQL Server and Windows,

    • Apply the changes and try again.

    These instructions apply to Microsoft SQL Server 7 and SQL Server 2000.

    [Note]Note

    FreeTDS supports integrated security mode, too. If you have Microsoft SQL Server running in integrated (domain) mode along with a Windows PDC, and wish to try it, see Domain Logins in the Advanced Configurations chapter. If you have Active Directory you can also use Kerberos, see Kerberos support.

    freetds-1.3.6/doc/userguide/uodbc.html000644 025423 025423 00000012726 14162303410 021330 0ustar00fredianofrediano000000 000000 ODBC on Unix

    ODBC on Unix

    ODBC has some issues on Unix, mainly due to lack of clean specifications.

    ODBC and 64-bit

    ODBC was originally specified as 32-bit[23]. Its evolution to 64-bit took place in the absence of a good specification which led to conflicting declarations and associated problems. For instance, some parameters are defined as SQLINTEGER but are used for pointer offsets. But SQLINTEGER was (and remains) 32-bit, while pointer offsets must be 64-bit. Also row numbers and some other formerly 32-bit quantities are now 64-bit.

    If you use unixODBC Frediano would recommend at least version 2.2.14. Earlier versions have issues if used on 64-bit environments.

    sizeof(SQLWCHAR)

    Under Windows sizeof(wchar_t) == sizeof(SQLWCHAR) == 2 but on many Unix systems you have sizeof(wchar_t) == 4. And some DMs decided to keep sizeof(SQLWCHAR) == 2 (including unixODBC) while in other DM sizeof(SQLWCHAR) == sizeof(wchar_t) == 4 (namely iODBC). This leads to incompatible ABIs between applications and drivers. If you compile the FreeTDS ODBC driver using iODBC take care to ensure all drivers are compiled with the same header files.

    Alternatively, compile FreeTDS with both includes and rename the library to use two ABIs (for instance having a libtdsiodbc.so and a libtdsuodbc.so).

    At the time of writing Ubuntu compiled Qt using iODBC but most packages use unixODBC. If you plan to use Qt with the FreeTDS ODBC driver, you should have an iODBC-compatible driver. Also be aware that the QODBC Qt driver has problems with iODBC and SQLWCHAR (see Qt). Due to these problems Frediano suggests not using this configuration (Qt database) on Ubuntu at this time.

    Default charset

    Character encoding is yet another trap. ODBC makes no provision for specifying client character encoding. By default many DM converting from multi-byte to wide characters assume the client uses ISO 8859-1. Even the FreeTDS driver assumes ISO 8859-1 by default. Also some DM have problems converting multi-byte encodings (like UTF-8), by assuming a byte can be converted to a single wide character (and vice versa). That creates problems if you use multi-byte encoding for FreeTDS driver.



    [23] In fact, the earliest versions were 16-bit.

    freetds-1.3.6/doc/userguide/uothread.html000644 025423 025423 00000006034 14162303407 022050 0ustar00fredianofrediano000000 000000 Threading in unixODBC

    Threading in unixODBC

    unixODBC uses a strong thread-locking policy that causes big locks with the default configuration for FreeTDS. Performance of multi-threaded applications can be affected because every operation is serialized. To avoid this problem, choose a threading model in odbcinst.ini.

    Example 5.5. Sample odbcinst.ini for threading model

    	[FreeTDS]
    	Driver = /usr/local/freetds/lib/libtdsodbc.so
    	Threading = 1
    	


    Example 5.6. Sample odbc.ini for threading model

    	[Server1]
    	Driver = FreeTDS
    	Server = myServer1
    	Port = 1433
    	


    You can use also a connection string e.g. DRIVER=FreeTDS;SERVER=myServer1;PORT=1433;.

    freetds-1.3.6/doc/userguide/usefreetds.html000644 025423 025423 00000015564 14162303407 022416 0ustar00fredianofrediano000000 000000 Chapter 6. Use FreeTDS

    Chapter 6. Use FreeTDS

    Table of Contents

    FreeTDS Utilities

    Abstract

    FreeTDS includes several utilities. Some are testing tools, some demonstration projects, some intended for day-to-day use. All have man pages.

    FreeTDS Utilities

    (listed alphabetically)

    bsqldb

    A non-interactive equivalent of the isql utility programs distributed by Sybase and Microsoft. Like them, bsqldb uses the command “go†on a line by itself as a separator between batches. The last batch need not be followed by “goâ€.

    bsqldb makes use of the DB-Library API. Intended for production use.

    bsqlodbc

    A non-interactive equivalent of the isql utility programs distributed by Sybase and Microsoft. Like them, bsqlodbc uses the command “go†on a line by itself as a separator between batches. The last batch need not be followed by “goâ€. It uses the ODBC API.

    bsqlodbc is a demonstration project, but can also aid in isolating problems. ODBC applications typically have many layers, and it can be difficult to know if a problem arises in a layer, or in the interface between layers. By executing a query in bsqlodbc, you can see if the functionality of the ODBC driver works when used as the folks who wrote the driver thought it would be used.

    datacopy

    A tool for migrating data between Sybase ASE and Microsoft SQL Server or vice versa.

    datacopy will move table data from one server to another without the need for intermediate files. datacopy is much faster and more efficient than is freebcp out/in.

    datacopy makes use of the DB-Library bcp API.

    defncopy

    Replaces a similar program of the same name distributed by Sybase.

    defncopy reads the text of a stored procedure or view, and writes a script suitable for recreating the procedure or view. For tables, it reads the output of sp_help and constructs a CREATE TABLE statement, complete with CREATE INDEX, too.

    fisql

    A complete replacement of the isql utility programs distributed by Sybase and Microsoft. Like them, fisql uses the command “go†on a line by itself as a separator between batches.

    freebcp

    Replicates the functionality of the bcp utility programs distributed by Sybase and Microsoft.

    freebcp makes use of the DB-Library bcp API.

    The manual pages or online help for Sybase or Microsoft SQL Server can be referenced for more detailed information on bcp functionality.

    osql

    A Bourne shell script that checks and reports on your configuration.

    tsql

    A diagnostic tool that uses uses the lowest level FreeTDS library, libtds, as a way to isolate potential bugs in the protocol implementation.

    tsql is not a replacement for a complete isql.

    freetds-1.3.6/doc/userguide/what.html000644 025423 025423 00000020371 14162303407 021200 0ustar00fredianofrediano000000 000000 Chapter 1. What is FreeTDS?

    Chapter 1. What is FreeTDS?

    FreeTDS is re-implementation of C libraries originally marketed by Sybase and Microsoft SQL Server. It allows many open source applications such as Perl and PHP (or your own C or C++ program) to connect to Sybase or Microsoft SQL Server.

    FreeTDS provides drop-in replacements for

    • Sybase's DB-Library and CT-Library

    • Microsoft's DB-Library (which differs in small details from Sybase's)

    • the ODBC drivers from both vendors

    • interactive SQL and BCP utilities

    The “TDS†part of the name comes from name of the protocol used to communicate with such servers: the Tabular Data Stream.

    FreeTDS is distributed in source code form, and is expected to compile on just about any operating system. That means every form of Unix® and Unix-like™ system (including notable variants such as Interix® and QNX®), as well as Win32®, VMS®, and OS X®. If it doesn't compile on your system — and you're not using MS-DOS® — it's probably considered a bug.

    Background: The TDS Protocol and related APIs

    TDS is a protocol, a set of rules describing how to transmit data between two computers. Like any protocol, it defines the types of messages that can be sent, and the order in which they may be sent. Protocols describe the “bits on the wireâ€, how data flow.

    In reading this manual, it may be helpful to keep in mind that a protocol is not an API, although the two are related. The server recognizes and speaks a protocol; anything that can send it the correct combination of bytes in the right order can communicate with it. But programmers aren't generally in the business of sending bytes; that's the job of a library. Over the years, there have been a few libraries — each with its own API — that do the work of moving SQL through a TDS pipe. ODBC, DB-Library, and CT-Library have very different APIs, but they're all one to the server, because on the wire they speak TDS.

    The TDS protocol was designed and developed by Sybase Inc. for their Sybase SQL Server relational database engine in 1984. The problem Sybase faced then still exists: There was no commonly accepted application-level protocol to transfer data between a database server and its client. To encourage the use of their product, Sybase came up with DB-Library.

    DB-Library provided an API to the client program, and communicated with the server. What it sent to the server took the form of a stream of bytes meant for tables of data, a Tabular Data Stream.

    In 1990 Sybase entered into a technology sharing agreement with Microsoft which resulted in Microsoft marketing its own SQL Server. Microsoft kept the DB-Library API and added ODBC. (Microsoft has since added other APIs, too. It no longer supports its own DB-Library implementation.) At about the same time, Sybase introduced a more powerful “successor†to DB-Library, called CT-Library, and called the pair OpenClient.

    CT-Library, DB-Library, and ODBC are APIs that — however different their programming style may be — all communicate with the server in the same way. The language they use is TDS.

    The TDS protocol comes in several flavors, most of which were not openly documented. If anything, it was considered to be something like a trade secret, or at least proprietary technology. The exception is TDS 5.0, used exclusively by Sybase, for which documentation is available from Sybase.

    freetds-1.3.6/doc/userguide/userguide.css000644 025423 025423 00000000537 14162303411 022052 0ustar00fredianofrediano000000 000000 /* * $Id: userguide.css,v 1.1 2005-10-03 02:52:29 jklowden Exp $ */ /* Set the screen background to gray */ .screen { background-color: #F0F0F0; } /* Render user input as boldface */ .userinput { font-weight: bold; } /* Make filenames green (why not?) */ .filename { color: #007a00; } .epigraph { text-align: center; font-style: italic; } freetds-1.3.6/src/Makefile.am000644 025423 025423 00000000432 14056414221 017424 0ustar00fredianofrediano000000 000000 SUBDIRS = utils replacements tds ctlib dblib DIST_SUBDIRS = utils replacements tds ctlib dblib \ odbc server pool apps if ODBC SUBDIRS += odbc endif if INCPOOL SUBDIRS += server pool else !INCPOOL if INCSERVER SUBDIRS += server endif endif if INCAPPS SUBDIRS += apps endif freetds-1.3.6/src/Makefile.in000644 025423 025423 00000051102 14162303356 017441 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @ODBC_TRUE@am__append_1 = odbc @INCPOOL_TRUE@am__append_2 = server pool @INCPOOL_FALSE@@INCSERVER_TRUE@am__append_3 = server @INCAPPS_TRUE@am__append_4 = apps subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = utils replacements tds ctlib dblib $(am__append_1) \ $(am__append_2) $(am__append_3) $(am__append_4) DIST_SUBDIRS = utils replacements tds ctlib dblib \ odbc server pool apps all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/utils/000755 025423 025423 00000000000 14162303404 016527 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/replacements/000755 025423 025423 00000000000 14162303404 020051 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/tds/000755 025423 025423 00000000000 14162303405 016162 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/ctlib/000755 025423 025423 00000000000 14162303405 016465 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/dblib/000755 025423 025423 00000000000 14162303405 016444 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/odbc/000755 025423 025423 00000000000 14162303406 016300 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/server/000755 025423 025423 00000000000 14162303406 016677 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/pool/000755 025423 025423 00000000000 14162303406 016342 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/apps/000755 025423 025423 00000000000 14162303406 016334 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/apps/Makefile.am000644 025423 025423 00000002034 14056414221 020367 0ustar00fredianofrediano000000 000000 AM_CPPFLAGS = -I$(top_srcdir)/include SUBDIRS = fisql DIST_SUBDIRS = $(SUBDIRS) bin_PROGRAMS = tsql freebcp bsqldb defncopy datacopy # build bsqlodbc only if the ODBC library was to be built if ODBC bin_PROGRAMS += bsqlodbc endif dist_bin_SCRIPTS = osql freebcp_LDADD = ../dblib/libsybdb.la ../replacements/libreplacements.la $(LTLIBICONV) freebcp_SOURCES = freebcp.c freebcp.h tsql_LDADD = ../tds/libtds.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) $(FREETDS_LIBGCC) $(READLINE_LIBS) $(NETWORK_LIBS) bsqldb_LDADD = ../dblib/libsybdb.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) if ODBC bsqlodbc_CPPFLAGS = $(ODBC_INC) $(AM_CPPFLAGS) bsqlodbc_LDFLAGS = $(ODBC_LDFLAGS) \ ../replacements/libreplacements.la $(LTLIBICONV) $(NETWORK_LIBS) endif defncopy_LDADD = ../dblib/libsybdb.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) datacopy_SOURCES= datacopy.c datacopy_LDADD = ../dblib/libsybdb.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) EXTRA_DIST = CMakeLists.txt freetds-1.3.6/src/apps/osql000755 025423 025423 00000022230 14056414221 017237 0ustar00fredianofrediano000000 000000 #! /bin/sh # $Id: osql,v 1.12 2011-05-11 03:08:13 jklowden Exp $ # # Check odbc.ini, odbcinst, and, optionally, freetds.conf, # then execute isql (assume it's unixODBC's isql). # USAGE="Syntax: $(basename $0) -S server -U user -P password" while getopts I:S:U:P: OPTION do case ${OPTION} in I) OVER_DIR=${OPTARG} # override ;; S) DSN=${OPTARG} ;; U) USERNAME=${OPTARG} ;; P) PASSWORD=${OPTARG} ;; \?) echo $USAGE exit 1 ;; esac done #cho ${DSN} ${USERNAME} ${PASSWORD} if [ -z "${DSN}" -o -z "${USERNAME}" -o -z "${PASSWORD}" ] then echo $USAGE exit 1 fi ISQL=$(command -v isql) if [ -z "${ISQL}" ] then echo "$(basename $0): error: no \"isql\" command found. Is unixODBC installed?" exit 1 fi # Establish ODBC prefix directory ISQL_DIR=$(strings ${ISQL} | grep ^/ | grep -v elf | grep -v '\.so\.' | head -1 | sed 's/lib$/etc/' ) INI_DIRNAME="/tmp/$(basename $0).$$" exec 3> ${INI_DIRNAME} # Check the libraries, too. if [ -z "${OVER_DIR}" ] then echo "checking shared odbc libraries linked to isql for default directories..." (echo ${ISQL_DIR}; ldd "${ISQL}" | awk '/libodbc\./ {print $3}') \ | while read L do strings "$L" | grep '^/' | grep -v '/lib' \ | while read D do if [ ! -s "${INI_DIRNAME}" ] then printf " trying $D ... " if [ -d "$D" -a -r "${D}/odbc.ini" ] then printf $D >&3 printf "OK" else printf "no" fi printf "\n" fi done done fi ODBC_DIR=$(cat ${INI_DIRNAME}) && rm ${INI_DIRNAME} if [ -z "${ODBC_DIR}" -a -z "${OVER_DIR}" ] then echo "$(basename $0): problem: no potential directory strings in \"$(command -v isql)\"" echo "$(basename $0): advice: use \"osql -I DIR\" where DIR unixODBC\'s install prefix e.g. /usr/local" echo "isql strings are:" strings ${ISQL} | grep ^/ | sed 's/^/+ /' #xit 1 fi if [ "${OVER_DIR}" ] then if [ -d "${ODBC_DIR}" ] then echo "\"${ODBC_DIR}\" is a directory, overridden by" else echo "\"${ODBC_DIR}\" is NOT a directory, overridden by" fi echo "\"${OVER_DIR}\"." if [ -d "${OVER_DIR}" ] then ODBC_DIR=${OVER_DIR} else echo "$(basename $0): error: \"${OVER_DIR}\" is not a directory" exit 1 fi fi # Look for server entry in odbc.ini echo 'checking odbc.ini files' for F in "${HOME}/.odbc.ini" "${ODBC_DIR}/odbc.ini" do if [ ! -d "$(dirname $F)" ] then echo "warning: $(dirname $F) is not a directory" continue fi if [ -r "$F" ] then echo " reading $F" else echo " cannot read \"$F\"" continue fi grep -F "[${DSN}]" $F > /dev/null if [ $? -eq 0 ] then echo "[${DSN}] found in $F" ODBC_INI=$F break else echo "[${DSN}] not found in $F" fi done if [ -z "${ODBC_INI}" ] then echo "$(basename $0): error: unable to locate ${DSN} in any odbc.ini" exit 1 fi # Report finding of server entry echo found this section: SED_CMD="/^\[${DSN}\]/,/^[[:space:]]*$/ { s/^/ /; p; }" sed -ne "${SED_CMD}" ${ODBC_INI} # # Examine server entry in odbc.ini # # Find the driver in the servername or default section for D in "${DSN}" 'default' do echo "looking for driver for DSN [$D] in ${ODBC_INI}" grep "$D" ${ODBC_INI} > /dev/null if [ $? -eq 0 ] then CMD="/^\[$D\]/,/^[[:space:]]*$/ { s/^/ /; p; }" DRIVER_LINE=$(sed -ne "${CMD}" ${ODBC_INI} \ | grep -Ei '^[[:space:]]*driver[[:space:]]*=') if [ -z "${DRIVER_LINE}" ] then echo " no driver mentioned for [$D] in $(basename ${ODBC_INI})" continue fi echo " found driver line: \"${DRIVER_LINE}\"" DRIVER=$(echo ${DRIVER_LINE} \ | awk -F ' *= *' '{print $2}' \ | sed 's/[[:space:]][[:space:]]*//g') if [ "${DRIVER}" ] then echo " driver \"${DRIVER}\" found for [$D] in $(basename ${ODBC_INI})" break else echo " driver line for [$D] incomplete in $(basename ${ODBC_INI})" continue fi fi done if [ -z "${DRIVER}" ] then echo "$(basename $0): error: no driver found for [${DSN}] in $(basename ${ODBC_INI})" exit 1 fi # get filename of driver echo found driver named \"${DRIVER}\" if [ -d "${DRIVER}" -o ! -x "${DRIVER}" ] then # not a filename, look it up DRIVERNAME=${DRIVER} ODBC_INST="${ODBC_DIR}/odbcinst.ini" echo "\"${DRIVERNAME}\" is not an executable file" echo "looking for entry named [${DRIVERNAME}] in ${ODBC_INST}" grep "${DRIVERNAME}" ${ODBC_INST} > /dev/null if [ $? -ne 0 ] then if [ $? -eq 1 ] then echo "$(basename $0): error: no driver entry [${DRIVERNAME}] in ${ODBC_INST}" fi exit 1; fi CMD="/^\[${DRIVERNAME}\]/,/^[[:space:]]*$/ { s/^/ /; p; }" DRIVER_LINE=$(sed -ne "${CMD}" ${ODBC_INST} \ | grep -Ei '^[[:space:]]*driver[[:space:]]*=') if [ -z "${DRIVER_LINE}" ] then echo "$(basename $0): no driver mentioned for [${DRIVERNAME}] in $(basename ${ODBC_INST})" exit 1 fi echo " found driver line: \"${DRIVER_LINE}\"" DRIVER=$(echo ${DRIVER_LINE} | awk -F ' *= *' '{print $2}') if [ -z "${DRIVER}" ] then echo "$(basename $0): driver line incomplete for [${DRIVERNAME}] in $(basename ${ODBC_INST})" exit 1 fi echo " found driver ${DRIVER} for [${DRIVERNAME}] in $(basename ${ODBC_INST})" fi if [ -z "${DRIVER}" ] then echo $(basename $0): 'error: sorry, failed sanity check: ${DRIVER} is null' exit 1 fi if [ -x "${DRIVER}" ] then echo "${DRIVER} is an executable file" else echo "${DRIVER} is not an executable file" echo "$(basename $0): error: no driver found for ${DSN}" exit 1 fi # find the server/servername SERVER_LINE=$(sed -ne "${SED_CMD}" ${ODBC_INI} \ | grep -Ei '^[[:space:]]*server(name)*[[:space:]]*=') ATTRIBUTE=$(echo ${SERVER_LINE} | awk -F' *= *' '{print $1}') if [ -z "${ATTRIBUTE}" ] then echo "$(basename $0): neither \"Server\" nor \"Servername\" found for [${DSN}] in $(basename ${ODBC_INI})" exit 1 fi echo ${SERVER_LINE} | grep -i servername >/dev/null # # Find the server's hostname # if [ $? -eq 0 ] # ODBC-Combined then TDS_SERVER=$(echo ${SERVER_LINE} | awk -F ' *= *' '{print $2}') echo 'Using ODBC-Combined strategy' echo "DSN [${DSN}] has servername \"${TDS_SERVER}\" (from ${ODBC_INI})" if [ -z "${TDS_SERVER}" ] then exit 1 fi # Look for $TDS_SERVER in freetds.conf FREETDS_DIR=$(tsql -C | grep 'freetds.conf directory' | awk -F: '{print $2}' | sed 's/^ *//') if [ -z "${FREETDS_DIR}" ] then echo "$(basename $0): error: unable to locate directory for freetds.conf using \"$(command -v tsql)\"" exit 1 fi for F in "${HOME}/.freetds.conf" "${FREETDS_DIR}/freetds.conf" do if [ -r "$F" ] then echo $F is a readable file else echo cannot read \"$F\" continue fi echo "looking for [${TDS_SERVER}] in $F" grep -F "[${TDS_SERVER}]" $F > /dev/null if [ $? -eq 0 ] then FREETDS_CONF=$F break else echo "[${TDS_SERVER}]" not found in $F fi done if [ -z "${FREETDS_CONF}" ] then echo "$(basename $0): error: unable to locate ${TDS_SERVER} in any freetds.conf" exit 1 fi # Examine server entry in freetds.conf echo found this section: SED_CMD="/^\[${TDS_SERVER}\]/,/^[[:space:]]*$/ { s/^/ /; p; }" sed -ne "${SED_CMD}" ${FREETDS_CONF} SERVER_LINE=$(sed -ne "${SED_CMD}" ${FREETDS_CONF} \ | grep -Ei '^[[:space:]]*host[[:space:]]*=') # No character class support in mawk, # cf. "Mawk does not support Posix character classes in expressions" # https://bugs.launchpad.net/ubuntu/+source/mawk/+bug/69724 HOST=$(echo ${SERVER_LINE} | awk -F' *= *' '{print $2}') if [ -z "${HOST}" ] then echo "$(basename $0): no \"host\" entry found for [${TDS_SERVER}] in $(basename ${FREETDS_CONF})" exit 1 fi else # odbc.ini contains a "server", a DNS host HOST=$(echo ${SERVER_LINE} | awk -F ' *= *' '{print $2}') echo "\"${ATTRIBUTE}\" found, not using freetds.conf" echo "${ATTRIBUTE} is \"${HOST}\"" if [ -z "${HOST}" ] then echo "$(basename $0): no value found for \"${ATTRIBUTE}\" entry in $(basename ${ODBC_INI})" exit 1 fi fi # If the "host" is an ip address, look up the name, for neatness, e.g. ## $ host 10.81.36.39 ## 39.36.81.10.IN-ADDR.ARPA domain name pointer ntc5003.eg.com if [ "${HOST}" = "$(echo ${HOST} | sed 's/[^.0-9]*//')" ] then ADDRESS=${HOST} echo 'looking up hostname for ip address' ${ADDRESS} HOST=$(host ${HOST} | awk '/domain/ {print $5}' | sed 's/\.$//') if [ -z "${HOST}" ] then echo "$(basename $0): warning: no DNS hostname found for \"${ADDRESS}\"" HOST=${ADDRESS} # restore host address string fi fi # Now we have a DNS hostname for the server in HOST if [ "${HOST}" != "${ADDRESS}" ] then ADDRESS=$(host ${HOST} | awk '/has address/ {print $4}' | head -1) fi if [ -z "${ADDRESS}" ] then echo "$(basename $0): no IP address found for \"${HOST}\"" exit 1 fi #cho ${HOST} has address ${ADDRESS} # Report what we know and exec isql printf "\n" printf "Configuration looks OK. Connection details:\n\n" printf "%22s:\t%-30s\n" DSN ${DSN} printf "%22s:\t%-30s\n" odbc.ini "${ODBC_INI}" printf "%22s:\t%-30s\n" Driver ${DRIVER} printf "%22s:\t%-30s\n" "Server hostname" ${HOST} printf "%22s:\t%-30s\n" Address ${ADDRESS} printf "\n" echo Attempting connection as ${USERNAME} ... if [ -z "${TDSDUMP}" ] then TDSDUMP_AUTO="/tmp/$(basename $0).dump.$$" export TDSDUMP=${TDSDUMP_AUTO} fi ( set -x; isql ${DSN} ${USERNAME} ${PASSWORD} -v ) \ || sed -ne 's/Connecting/FAILED &/p' ${TDSDUMP} test "${TDSDUMP_AUTO}" && rm -f ${TDSDUMP_AUTO} freetds-1.3.6/src/apps/Makefile.in000644 025423 025423 00000104724 14162303356 020415 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = tsql$(EXEEXT) freebcp$(EXEEXT) bsqldb$(EXEEXT) \ defncopy$(EXEEXT) datacopy$(EXEEXT) $(am__EXEEXT_1) # build bsqlodbc only if the ODBC library was to be built @ODBC_TRUE@am__append_1 = bsqlodbc subdir = src/apps ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(dist_bin_SCRIPTS) \ $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @ODBC_TRUE@am__EXEEXT_1 = bsqlodbc$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) bsqldb_SOURCES = bsqldb.c bsqldb_OBJECTS = bsqldb.$(OBJEXT) am__DEPENDENCIES_1 = bsqldb_DEPENDENCIES = ../dblib/libsybdb.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = bsqlodbc_SOURCES = bsqlodbc.c bsqlodbc_OBJECTS = bsqlodbc-bsqlodbc.$(OBJEXT) bsqlodbc_LDADD = $(LDADD) bsqlodbc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(bsqlodbc_LDFLAGS) $(LDFLAGS) -o $@ am_datacopy_OBJECTS = datacopy.$(OBJEXT) datacopy_OBJECTS = $(am_datacopy_OBJECTS) datacopy_DEPENDENCIES = ../dblib/libsybdb.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) defncopy_SOURCES = defncopy.c defncopy_OBJECTS = defncopy.$(OBJEXT) defncopy_DEPENDENCIES = ../dblib/libsybdb.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_freebcp_OBJECTS = freebcp.$(OBJEXT) freebcp_OBJECTS = $(am_freebcp_OBJECTS) freebcp_DEPENDENCIES = ../dblib/libsybdb.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) tsql_SOURCES = tsql.c tsql_OBJECTS = tsql.$(OBJEXT) tsql_DEPENDENCIES = ../tds/libtds.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } SCRIPTS = $(dist_bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bsqldb.Po \ ./$(DEPDIR)/bsqlodbc-bsqlodbc.Po ./$(DEPDIR)/datacopy.Po \ ./$(DEPDIR)/defncopy.Po ./$(DEPDIR)/freebcp.Po \ ./$(DEPDIR)/tsql.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = bsqldb.c bsqlodbc.c $(datacopy_SOURCES) defncopy.c \ $(freebcp_SOURCES) tsql.c DIST_SOURCES = bsqldb.c bsqlodbc.c $(datacopy_SOURCES) defncopy.c \ $(freebcp_SOURCES) tsql.c RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include SUBDIRS = fisql DIST_SUBDIRS = $(SUBDIRS) dist_bin_SCRIPTS = osql freebcp_LDADD = ../dblib/libsybdb.la ../replacements/libreplacements.la $(LTLIBICONV) freebcp_SOURCES = freebcp.c freebcp.h tsql_LDADD = ../tds/libtds.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) $(FREETDS_LIBGCC) $(READLINE_LIBS) $(NETWORK_LIBS) bsqldb_LDADD = ../dblib/libsybdb.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) @ODBC_TRUE@bsqlodbc_CPPFLAGS = $(ODBC_INC) $(AM_CPPFLAGS) @ODBC_TRUE@bsqlodbc_LDFLAGS = $(ODBC_LDFLAGS) \ @ODBC_TRUE@ ../replacements/libreplacements.la $(LTLIBICONV) $(NETWORK_LIBS) defncopy_LDADD = ../dblib/libsybdb.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) datacopy_SOURCES = datacopy.c datacopy_LDADD = ../dblib/libsybdb.la \ ../replacements/libreplacements.la \ $(LTLIBICONV) EXTRA_DIST = CMakeLists.txt all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/apps/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/apps/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list bsqldb$(EXEEXT): $(bsqldb_OBJECTS) $(bsqldb_DEPENDENCIES) $(EXTRA_bsqldb_DEPENDENCIES) @rm -f bsqldb$(EXEEXT) $(AM_V_CCLD)$(LINK) $(bsqldb_OBJECTS) $(bsqldb_LDADD) $(LIBS) bsqlodbc$(EXEEXT): $(bsqlodbc_OBJECTS) $(bsqlodbc_DEPENDENCIES) $(EXTRA_bsqlodbc_DEPENDENCIES) @rm -f bsqlodbc$(EXEEXT) $(AM_V_CCLD)$(bsqlodbc_LINK) $(bsqlodbc_OBJECTS) $(bsqlodbc_LDADD) $(LIBS) datacopy$(EXEEXT): $(datacopy_OBJECTS) $(datacopy_DEPENDENCIES) $(EXTRA_datacopy_DEPENDENCIES) @rm -f datacopy$(EXEEXT) $(AM_V_CCLD)$(LINK) $(datacopy_OBJECTS) $(datacopy_LDADD) $(LIBS) defncopy$(EXEEXT): $(defncopy_OBJECTS) $(defncopy_DEPENDENCIES) $(EXTRA_defncopy_DEPENDENCIES) @rm -f defncopy$(EXEEXT) $(AM_V_CCLD)$(LINK) $(defncopy_OBJECTS) $(defncopy_LDADD) $(LIBS) freebcp$(EXEEXT): $(freebcp_OBJECTS) $(freebcp_DEPENDENCIES) $(EXTRA_freebcp_DEPENDENCIES) @rm -f freebcp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(freebcp_OBJECTS) $(freebcp_LDADD) $(LIBS) tsql$(EXEEXT): $(tsql_OBJECTS) $(tsql_DEPENDENCIES) $(EXTRA_tsql_DEPENDENCIES) @rm -f tsql$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tsql_OBJECTS) $(tsql_LDADD) $(LIBS) install-dist_binSCRIPTS: $(dist_bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-dist_binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsqldb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsqlodbc-bsqlodbc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datacopy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defncopy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freebcp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tsql.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< bsqlodbc-bsqlodbc.o: bsqlodbc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsqlodbc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bsqlodbc-bsqlodbc.o -MD -MP -MF $(DEPDIR)/bsqlodbc-bsqlodbc.Tpo -c -o bsqlodbc-bsqlodbc.o `test -f 'bsqlodbc.c' || echo '$(srcdir)/'`bsqlodbc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bsqlodbc-bsqlodbc.Tpo $(DEPDIR)/bsqlodbc-bsqlodbc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bsqlodbc.c' object='bsqlodbc-bsqlodbc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsqlodbc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bsqlodbc-bsqlodbc.o `test -f 'bsqlodbc.c' || echo '$(srcdir)/'`bsqlodbc.c bsqlodbc-bsqlodbc.obj: bsqlodbc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsqlodbc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT bsqlodbc-bsqlodbc.obj -MD -MP -MF $(DEPDIR)/bsqlodbc-bsqlodbc.Tpo -c -o bsqlodbc-bsqlodbc.obj `if test -f 'bsqlodbc.c'; then $(CYGPATH_W) 'bsqlodbc.c'; else $(CYGPATH_W) '$(srcdir)/bsqlodbc.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bsqlodbc-bsqlodbc.Tpo $(DEPDIR)/bsqlodbc-bsqlodbc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bsqlodbc.c' object='bsqlodbc-bsqlodbc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsqlodbc_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bsqlodbc-bsqlodbc.obj `if test -f 'bsqlodbc.c'; then $(CYGPATH_W) 'bsqlodbc.c'; else $(CYGPATH_W) '$(srcdir)/bsqlodbc.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(PROGRAMS) $(SCRIPTS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/bsqldb.Po -rm -f ./$(DEPDIR)/bsqlodbc-bsqlodbc.Po -rm -f ./$(DEPDIR)/datacopy.Po -rm -f ./$(DEPDIR)/defncopy.Po -rm -f ./$(DEPDIR)/freebcp.Po -rm -f ./$(DEPDIR)/tsql.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-dist_binSCRIPTS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/bsqldb.Po -rm -f ./$(DEPDIR)/bsqlodbc-bsqlodbc.Po -rm -f ./$(DEPDIR)/datacopy.Po -rm -f ./$(DEPDIR)/defncopy.Po -rm -f ./$(DEPDIR)/freebcp.Po -rm -f ./$(DEPDIR)/tsql.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dist_binSCRIPTS \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-dist_binSCRIPTS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/apps/bsqldb.c000644 025423 025423 00000075022 14056414271 017762 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004-2009 James K. Lowden * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #undef NDEBUG #include #include #include #include #if HAVE_ERRNO_H #include #endif #if HAVE_UNISTD_H #include #endif #if HAVE_STDLIB_H #include #endif #if HAVE_STRING_H #include #endif #if HAVE_LIMITS_H #include #endif #if HAVE_LOCALE_H #include #endif #include #include #include #include #include #ifdef _WIN32 #define NULL_DEVICE "NUL:" #else #define NULL_DEVICE "/dev/null" #endif int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); static int next_query(DBPROCESS *dbproc); static void print_results(DBPROCESS *dbproc); static int get_printable_size(int type, int size); static void usage(const char invoked_as[]); struct METADATA { char *name, *format_string; const char *source; int type, size, width; }; struct DATA { char *buffer; int status; }; struct METACOMP { int numalts; struct METADATA *meta; struct DATA *data; }; static int set_format_string(struct METADATA * meta, const char separator[]); typedef struct KEY_T { size_t nkeys; int *keys; } KEY_T; typedef struct _options { int fverbose, fquiet; FILE *headers, *verbose; char *servername, *database, *appname, hostname[128]; const char *colsep; char *input_filename, *output_filename, *error_filename; struct pivot_t { KEY_T row_key, col_key; int val_col; DBPIVOT_FUNC func; } pivot; } OPTIONS; static void parse_pivot_description(OPTIONS *options, const char *optarg); LOGINREC* get_login(int argc, char *argv[], OPTIONS *poptions); /* global variables */ OPTIONS options; static const char default_colsep[] = " "; /* end global variables */ /** * The purpose of this program is threefold: * * 1. To provide a generalized SQL processor suitable for testing db-lib. * 2. To offer a robust batch-oriented SQL processor suitable for use in a production environment. * 3. To serve as a model example of how to use db-lib functions. * * These purposes may be somewhat at odds with one another. For instance, the tutorial aspect calls for * explanatory comments that wouldn't appear in production code. Nevertheless, I hope the experienced * reader will forgive the verbosity and still find the program useful. * * \todo The error/message handlers are not robust enough. They should anticipate certain conditions * and cause the application to retry the operation. */ int main(int argc, char *argv[]) { LOGINREC *login; DBPROCESS *dbproc; RETCODE erc; setlocale(LC_ALL, ""); /* Initialize db-lib */ erc = dbinit(); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbinit() failed\n", options.appname, __LINE__); exit(1); } /* Install our error and message handlers */ dberrhandle(err_handler); dbmsghandle(msg_handler); memset(&options, 0, sizeof(options)); options.headers = stderr; login = get_login(argc, argv, &options); /* get command-line parameters and call dblogin() */ assert(login != NULL); /* * Override stdin, stdout, and stderr, as required */ if (options.input_filename) { if (freopen(options.input_filename, "r", stdin) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.input_filename, strerror(errno)); exit(1); } } if (options.output_filename) { if (freopen(options.output_filename, "w", stdout) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.output_filename, strerror(errno)); exit(1); } } if (options.error_filename) { if (freopen(options.error_filename, "w", stderr) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.error_filename, strerror(errno)); exit(1); } } if (options.fverbose) { options.verbose = stderr; } else { static const char null_device[] = NULL_DEVICE; options.verbose = fopen(null_device, "w"); if (options.verbose == NULL) { fprintf(stderr, "%s:%d unable to open %s for verbose operation: %s\n", options.appname, __LINE__, null_device, strerror(errno)); exit(1); } } fprintf(options.verbose, "%s:%d: Verbose operation enabled\n", options.appname, __LINE__); /* Select the specified database, if any */ if (options.database) DBSETLDBNAME(login, options.database); /* * Connect to the server */ if ((dbproc = dbopen(login, options.servername)) == NULL) return 1; /* * Read the queries and write the results */ while (next_query(dbproc) != -1 ) { /* Send the query to the server (we could use dbsqlexec(), instead) */ erc = dbsqlsend(dbproc); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbsqlsend() failed\n", options.appname, __LINE__); exit(1); } fprintf(options.verbose, "%s:%d: dbsqlsend(): OK\n", options.appname, __LINE__); /* Wait for it to execute */ erc = dbsqlok(dbproc); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbsqlok() failed\n", options.appname, __LINE__); exit(1); } fprintf(options.verbose, "%s:%d: dbsqlok(): OK\n", options.appname, __LINE__); /* Write the output */ print_results(dbproc); } return 0; } static int next_query(DBPROCESS *dbproc) { char query_line[4096]; RETCODE erc; if (feof(stdin)) return -1; fprintf(options.verbose, "%s:%d: Query:\n", options.appname, __LINE__); /* * Normally, a call to dbcmd() clears the buffer the first time it's * invoked after a call to dbsqlexec() or dbsqlsend(). If fgets(3) * returns 0 below, however, we'd indicate "success" without calling * dbcmd(). This would leave the prior query in the buffer, which * our caller would re-send. To avoid such nonsense, we invoke * dbfreebuf() as a precaution. */ dbfreebuf(dbproc); while (fgets(query_line, sizeof(query_line), stdin)) { /* 'go' or 'GO' separates command batches */ const char *p = query_line; /* Skip past leading white spaces */ while (isspace((unsigned char) *p)) p++; if (strncasecmp(p, "go", 2) == 0) { for (p+=2; isspace((unsigned char) *p); p++) { if (*p == '\n') return 1; } } fprintf(options.verbose, "\t%s", query_line); /* Add the query line to the command to be sent to the server */ erc = dbcmd(dbproc, query_line); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbcmd() failed\n", options.appname, __LINE__); return -1; } } if (feof(stdin)) return dbstrlen(dbproc) > 0? 0 : -1; if (ferror(stdin)) { fprintf(stderr, "%s:%d: next_query() failed\n", options.appname, __LINE__); perror(NULL); return -1; } return 1; } static void free_metadata(struct METADATA **pmetadata, int ncols) { int c; struct METADATA *metadata = *pmetadata; if (!metadata) return; for (c=0; c < ncols; c++) { free(metadata[c].format_string); } free(metadata); *pmetadata = NULL; } static void free_data(struct DATA **pdata, int ncols) { int c; struct DATA *data = *pdata; if (!data) return; for (c=0; c < ncols; c++) { free(data[c].buffer); } free(data); *pdata = NULL; } static void free_metacomp(struct METACOMP ***pmetacompute, int ncomputeids) { int i, c; struct METACOMP **metacompute = *pmetacompute; if (!metacompute) return; for (i=0; i < ncomputeids; i++) { for (c=0; c < metacompute[i]->numalts; c++) { free(metacompute[i]->meta[c].name); free(metacompute[i]->meta[c].format_string); } free(metacompute[i]->meta); free(metacompute[i]->data); free(metacompute[i]); } free(metacompute); *pmetacompute = NULL; } static void print_results(DBPROCESS *dbproc) { static const char empty_string[] = ""; static const char dashes[] = "----------------------------------------------------------------" /* each line is 64 */ "----------------------------------------------------------------" "----------------------------------------------------------------" "----------------------------------------------------------------"; struct METADATA *metadata = NULL, return_status; struct DATA *data = NULL; struct METACOMP **metacompute = NULL; RETCODE erc; int row_code; int i, c, ret; int iresultset; int ncomputeids = 0, ncols = 0; /* * If using default column separator, we want columns to line up vertically, * so we use blank padding (STRINGBIND). * For any other separator, we use no padding. */ const int bindtype = (0 == strcmp(options.colsep, default_colsep))? STRINGBIND : NTBSTRINGBIND; /* * Set up each result set with dbresults() * This is more commonly implemented as a while() loop, but we're counting the result sets. */ fprintf(options.verbose, "%s:%d: calling dbresults: OK\n", options.appname, __LINE__); for (iresultset=1; (erc = dbresults(dbproc)) != NO_MORE_RESULTS; iresultset++) { if (erc == FAIL) { fprintf(stderr, "%s:%d: dbresults(), result set %d failed\n", options.appname, __LINE__, iresultset); free_metadata(&metadata, ncols); free_data(&data, ncols); free_metacomp(&metacompute, ncomputeids); return; } if (options.pivot.func) { const KEY_T *rk = &options.pivot.row_key, *ck = &options.pivot.col_key; erc = dbpivot(dbproc, rk->nkeys, rk->keys, ck->nkeys, ck->keys, options.pivot.func, options.pivot.val_col); } fprintf(options.verbose, "Result set %d\n", iresultset); /* Free prior allocations, if any. */ free_metadata(&metadata, ncols); free_data(&data, ncols); ncols = 0; free_metacomp(&metacompute, ncomputeids); ncomputeids = 0; /* * Allocate memory for metadata and bound columns */ fprintf(options.verbose, "Allocating buffers\n"); ncols = dbnumcols(dbproc); metadata = (struct METADATA*) calloc(ncols, sizeof(struct METADATA)); assert(metadata); data = (struct DATA*) calloc(ncols, sizeof(struct DATA)); assert(data); /* metadata is more complicated only because there may be several compute ids for each result set */ fprintf(options.verbose, "Allocating compute buffers\n"); ncomputeids = dbnumcompute(dbproc); if (ncomputeids > 0) { metacompute = (struct METACOMP**) calloc(ncomputeids, sizeof(struct METACOMP*)); assert(metacompute); } for (i=0; i < ncomputeids; i++) { metacompute[i] = (struct METACOMP*) calloc(ncomputeids, sizeof(struct METACOMP)); assert(metacompute[i]); metacompute[i]->numalts = dbnumalts(dbproc, 1+i); fprintf(options.verbose, "%d columns found in computeid %d\n", metacompute[i]->numalts, 1+i); if (metacompute[i]->numalts > 0) { fprintf(options.verbose, "allocating column %d\n", 1+i); metacompute[i]->meta = (struct METADATA*) calloc(metacompute[i]->numalts, sizeof(struct METADATA)); assert(metacompute[i]->meta); metacompute[i]->data = (struct DATA*) calloc(metacompute[i]->numalts, sizeof(struct DATA)); assert(metacompute[i]->data); } } /* * For each column, get its name, type, and size. * Allocate a buffer to hold the data, and bind the buffer to the column. * "bind" here means to give db-lib the address of the buffer we want filled as each row is fetched. * TODO: Implement dbcoltypeinfo() for numeric/decimal datatypes. */ fprintf(options.verbose, "Metadata\n"); fprintf(options.verbose, "%-6s %-30s %-30s %-15s %-6s %-6s \n", "col", "name", "source", "type", "size", "varies"); fprintf(options.verbose, "%.6s %.30s %.30s %.15s %.6s %.6s \n", dashes, dashes, dashes, dashes, dashes, dashes); for (c=0; c < ncols; c++) { /* Get and print the metadata. Optional: get only what you need. */ char *name = dbcolname(dbproc, c+1); metadata[c].name = strdup(name ? (const char *) name : empty_string); name = dbcolsource(dbproc, c+1); metadata[c].source = (name)? name : empty_string; metadata[c].type = dbcoltype(dbproc, c+1); metadata[c].size = dbcollen(dbproc, c+1); assert(metadata[c].size != -1); /* -1 means indicates an out-of-range request*/ fprintf(options.verbose, "%6d %30s %30s %15s %6d %6d \n", c+1, metadata[c].name, metadata[c].source, dbprtype(metadata[c].type), metadata[c].size, dbvarylen(dbproc, c+1)); /* * Build the column header format string, based on the column width. * This is just one solution to the question, "How wide should my columns be when I print them out?" */ metadata[c].width = get_printable_size(metadata[c].type, metadata[c].size); if (metadata[c].width < strlen(metadata[c].name)) metadata[c].width = strlen(metadata[c].name); ret = set_format_string(&metadata[c], (c+1 < ncols)? options.colsep : "\n"); if (ret <= 0) { fprintf(stderr, "%s:%d: asprintf(), column %d failed\n", options.appname, __LINE__, c+1); exit(1); } /* * Bind the column to our variable. * We bind everything to strings, because we want db-lib to convert everything to strings for us. * If you're performing calculations on the data in your application, you'd bind the numeric data * to C integers and floats, etc. instead. * * It is not necessary to bind to every column returned by the query. * Data in unbound columns are simply never copied to the user's buffers and are thus * inaccesible to the application. */ if (metadata[c].width < INT_MAX) { data[c].buffer = (char *) calloc(1, 1 + metadata[c].width); /* allow for null terminator */ assert(data[c].buffer); erc = dbbind(dbproc, c+1, bindtype, 0, (BYTE *) data[c].buffer); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbbind(), column %d failed\n", options.appname, __LINE__, c+1); exit(1); } erc = dbnullbind(dbproc, c+1, &data[c].status); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbnullbind(), column %d failed\n", options.appname, __LINE__, c+1); exit(1); } } else { /* We don't bind text buffers, but use dbreadtext instead. */ data[c].buffer = NULL; } } /* * Get metadata and bind the columns for any compute rows. */ for (i=0; i < ncomputeids; i++) { fprintf(options.verbose, "For computeid %d:\n", 1+i); for (c=0; c < metacompute[i]->numalts; c++) { /* read metadata */ struct METADATA *meta = &metacompute[i]->meta[c]; int nby, iby; BYTE *bylist; char *colname, *bynames; int altcolid = dbaltcolid(dbproc, i+1, c+1); metacompute[i]->meta[c].type = dbalttype(dbproc, i+1, c+1); metacompute[i]->meta[c].size = dbaltlen(dbproc, i+1, c+1); /* * Jump through hoops to determine a useful name for the computed column * If the query says "compute count(c) by a,b", we get a "by list" indicating a & b. */ bylist = dbbylist(dbproc, c+1, &nby); bynames = strdup("by ("); if (!bynames) { fprintf(stderr, "out of memory"); exit(1); } for (iby=0; iby < nby; iby++) { char *s = NULL; int ret = asprintf(&s, "%s%s%s", bynames, dbcolname(dbproc, bylist[iby]), (iby+1 < nby)? ", " : ")"); if (ret < 0) { fprintf(options.verbose, "Insufficient room to create name for column %d:\n", 1+c); exit(1); } free(bynames); bynames = s; } if( altcolid == -1 ) { colname = "*"; } else { assert(0 < altcolid && altcolid <= dbnumcols(dbproc)); colname = metadata[--altcolid].name; } ret = asprintf(&metacompute[i]->meta[c].name, "%s(%s)", dbprtype(dbaltop(dbproc, i+1, c+1)), colname); if (ret < 0) { fprintf(stderr, "%s:%d: asprintf(), column %d failed\n", options.appname, __LINE__, c+1); exit(1); } metacompute[i]->meta[c].width = get_printable_size(metacompute[i]->meta[c].type, metacompute[i]->meta[c].size); if (metacompute[i]->meta[c].width < strlen(metacompute[i]->meta[c].name)) metacompute[i]->meta[c].width = strlen(metacompute[i]->meta[c].name); ret = set_format_string(meta, (c+1 < metacompute[i]->numalts)? options.colsep : "\n"); if (ret <= 0) { free(bynames); fprintf(stderr, "%s:%d: asprintf(), column %d failed\n", options.appname, __LINE__, c+1); exit(1); } fprintf(options.verbose, "\tcolumn %d is %s, type %s, size %d %s\n", c+1, metacompute[i]->meta[c].name, dbprtype(metacompute[i]->meta[c].type), metacompute[i]->meta[c].size, (nby > 0)? bynames : ""); free(bynames); /* allocate buffer */ assert(metacompute[i]->data); metacompute[i]->data[c].buffer = (char *) calloc(1, metacompute[i]->meta[c].width); assert(metacompute[i]->data[c].buffer); /* bind */ erc = dbaltbind(dbproc, i+1, c+1, bindtype, -1, (BYTE*) metacompute[i]->data[c].buffer); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbaltbind(), column %d failed\n", options.appname, __LINE__, c+1); exit(1); } } } fprintf(options.verbose, "\n"); fprintf(options.verbose, "Data\n"); if (!options.fquiet) { /* Print the column headers to stderr to keep them separate from the data. */ for (c=0; c < ncols; c++) { fprintf(options.headers, metadata[c].format_string, metadata[c].name); } /* Underline the column headers. */ for (c=0; c < ncols; c++) { fprintf(options.headers, metadata[c].format_string, dashes); } } /* * Print the data to stdout. */ while ((row_code = dbnextrow(dbproc)) != NO_MORE_ROWS) { switch (row_code) { case REG_ROW: for (c=0; c < ncols; c++) { if (metadata[c].width == INT_MAX) { /* TEXT/IMAGE */ BYTE *p = dbdata(dbproc, c+1); size_t len = dbdatlen(dbproc, c+1); if (len == 0) { fputs("NULL", stdout); } else { BYTE *pend = p + len; switch(dbcoltype(dbproc, c+1)) { case SYBTEXT: if (fwrite(p, len, 1, stdout) != 1) { perror("could not write to output file"); exit(EXIT_FAILURE); } break; default: /* image, binary */ printf("0x"); for (; p < pend; p++) { printf("%02hx", (unsigned short int)*p); } break; } } printf(metadata[c].format_string, ""); /* col/row separator */ continue; } switch (data[c].status) { /* handle nulls */ case -1: /* is null */ /* TODO: FreeTDS 0.62 does not support dbsetnull() */ printf(metadata[c].format_string, "NULL"); break; case 0: /* case >1 is datlen when buffer is too small */ default: printf(metadata[c].format_string, data[c].buffer); break; } } break; case BUF_FULL: assert(row_code != BUF_FULL); break; case FAIL: fprintf(stderr, "bsqldb: fatal error: dbnextrow returned FAIL\n"); assert(row_code != FAIL); exit(EXIT_FAILURE); break; default: /* computeid */ fprintf(options.verbose, "Data for computeid %d\n", row_code); for (c=0; c < metacompute[row_code-1]->numalts; c++) { char fmt[256] = "%-"; struct METADATA *meta = &metacompute[row_code-1]->meta[c]; /* left justify the names */ strlcat(fmt, &meta->format_string[1], sizeof(fmt)); fprintf(options.headers, fmt, meta->name); } /* Underline the column headers. */ for (c=0; c < metacompute[row_code-1]->numalts; c++) { fprintf(options.headers, metacompute[row_code-1]->meta[c].format_string, dashes); } for (c=0; c < metacompute[row_code-1]->numalts; c++) { struct METADATA *meta = &metacompute[row_code-1]->meta[c]; struct DATA *data = &metacompute[row_code-1]->data[c]; switch (data->status) { /* handle nulls */ case -1: /* is null */ /* TODO: FreeTDS 0.62 does not support dbsetnull() */ printf(meta->format_string, "NULL"); break; case 0: /* case >1 is datlen when buffer is too small */ default: printf(meta->format_string, data->buffer); break; } } } } /* Check return status */ if (!options.fquiet) { fprintf(options.verbose, "Retrieving return status... "); if (dbhasretstat(dbproc) == TRUE) { fprintf(stderr, "Procedure returned %d\n", dbretstatus(dbproc)); } else { fprintf(options.verbose, "none\n"); } } /* * Get row count, if available. */ if (!options.fquiet) { if (DBCOUNT(dbproc) > -1) fprintf(stderr, "%d rows affected\n", DBCOUNT(dbproc)); else fprintf(stderr, "@@rowcount not available\n"); } /* * Check return parameter values */ fprintf(options.verbose, "Retrieving output parameters... "); if (dbnumrets(dbproc) > 0) { for (i = 1; i <= dbnumrets(dbproc); i++) { char parameter_string[1024]; return_status.name = dbretname(dbproc, i); fprintf(stderr, "ret name %d is %s\n", i, return_status.name); return_status.type = dbrettype(dbproc, i); fprintf(options.verbose, "\n\tret type %d is %d", i, return_status.type); return_status.size = dbretlen(dbproc, i); fprintf(options.verbose, "\n\tret len %d is %d\n", i, return_status.size); dbconvert(dbproc, return_status.type, dbretdata(dbproc, i), return_status.size, SYBVARCHAR, (BYTE *) parameter_string, -1); fprintf(stderr, "ret data %d is %s\n", i, parameter_string); } } else { fprintf(options.verbose, "none\n"); } } /* wend dbresults */ fprintf(options.verbose, "%s:%d: dbresults() returned NO_MORE_RESULTS (%d):\n", options.appname, __LINE__, erc); free_metadata(&metadata, ncols); free_data(&data, ncols); free_metacomp(&metacompute, ncomputeids); } static int get_printable_size(int type, int size) /* adapted from src/dblib/dblib.c */ { switch (type) { case SYBBITN: case SYBBIT: return 1; case SYBINTN: switch (size) { case 1: return 3; case 2: return 6; case 4: return 11; case 8: return 21; } case SYBINT1: return 3; case SYBINT2: return 6; case SYBINT4: return 11; case SYBDECIMAL: case SYBNUMERIC: case SYBINT8: return 21; case SYBVARCHAR: case SYBCHAR: return size; case SYBNVARCHAR: return size/2; case SYBFLT8: return 11; /* FIX ME -- we do not track precision */ case SYBREAL: return 11; /* FIX ME -- we do not track precision */ case SYBMONEY: return 12; /* FIX ME */ case SYBMONEY4: return 12; /* FIX ME */ case SYBDATETIME: case SYBDATETIME4: case SYBDATETIMN: return 26; /* FIX ME */ #if 0 /* not exported by sybdb.h */ case SYBLONGBINARY: case SYBLONGCHAR: #endif case SYBBINARY: case SYBIMAGE: case SYBTEXT: case SYBNTEXT: case SYBVARBINARY: return INT_MAX; } /* FIX ME -- not all types present */ fprintf(stderr, "type %d not supported, sorry\n", type); exit(EXIT_FAILURE); } /** * Build the column header format string, based on the column width. * This is just one solution to the question, "How wide should my columns be when I print them out?" */ #define is_character_data(x) (x==SYBTEXT || x==SYBCHAR || x==SYBVARCHAR) static int set_format_string(struct METADATA * meta, const char separator[]) { int width; const char *size_and_width; assert(meta); if ((width = get_printable_size(meta->type, meta->size)) == INT_MAX) { /* TEXT/IMAGE: no attempt to format the column; just splat the data */ meta->format_string = strdup(separator); return strlen(meta->format_string); } /* For anything except the default two-space separator, don't justify the strings. */ if(0 != strcmp(options.colsep, default_colsep)) { return asprintf(&meta->format_string, "%%s%s", separator); } /* Set the printing width large enough for the data or its title, whichever is greater. */ if (width < strlen(meta->name)) width = strlen(meta->name); /* right justify numbers, left justify strings */ size_and_width = is_character_data(meta->type)? "%%-%d.%ds%s" : "%%%d.%ds%s"; return asprintf(&meta->format_string, size_and_width, width, width, separator); } static void usage(const char invoked_as[]) { fprintf(stderr, "usage: %s \n" " [-U username] [-P password]\n" " [-S servername] [-D database]\n" " [-i input filename] [-o output filename] [-e error filename]\n" , invoked_as); } static void unescape(char arg[]) { char *p = arg; char escaped = '1'; /* any digit will do for an initial value */ while ((p = strchr(p, '\\')) != NULL) { switch (p[1]) { case '0': /* FIXME we use strlen() of field/row terminators, which obviously won't work here */ fprintf(stderr, "bsqldb, line %d: NULL terminators ('\\0') not yet supported.\n", __LINE__); escaped = '\0'; break; case 't': escaped = '\t'; break; case 'r': escaped = '\r'; break; case 'n': escaped = '\n'; break; case '\\': escaped = '\\'; break; default: break; } /* Overwrite the backslash with the intended character, and shift everything down one */ if (!isdigit((unsigned char) escaped)) { *p++ = escaped; memmove(p, p+1, 1 + strlen(p+1)); escaped = '1'; } } } /* pivot syntax: down cols, across cols, function, value */ static void parse_pivot_description(OPTIONS *options, const char *optarg) { /** KEY_T { size_t nkeys; int *keys; }; struct pivot_t { KEY_T row_key, col_key; int val_col; DBPIVOT_FUNC func; **/ char *p, *pend; KEY_T *keys[2] = { &options->pivot.row_key, &options->pivot.col_key},**pk; int nchars; char ch, *input = strdup(optarg); assert(input); keys[0]->keys = NULL; keys[1]->keys = NULL; keys[0]->nkeys = 0; keys[1]->nkeys = 0; for (p=input, pk=keys; pk < keys + 2; p++, pk++) { if ((pend = strchr(p, ' ')) != NULL) { unsigned col; int ncols; *pend = '\0'; while((ncols = sscanf(p, "%u%c%n", &col, &ch, &nchars)) > 0) { int *pi; assert(ncols <= 2); if ((pi = (int *) realloc((*pk)->keys, sizeof((*pk)->keys[0]) * ++((*pk)->nkeys))) == NULL) { assert(pi); return; } (*pk)->keys = pi; (*pk)->keys[(*pk)->nkeys - 1] = col; if (ncols == 2) { assert(nchars <= pend - p); if (ch != ',') fprintf(stderr, "surprised by %c\n", ch); p += nchars; } else { p = pend; break; } } } } if (options->fverbose) printf("found %lu row and %lu col keys\n", (unsigned long) options->pivot.row_key.nkeys, (unsigned long) options->pivot.col_key.nkeys); if ((pend = strchr(p, ' ')) == NULL) { fprintf(stderr, "bsqldb(): no name in %s\n", p); free(input); return; } *pend = '\0'; if ((options->pivot.func = dbpivot_lookup_name(p)) == NULL) { fprintf(stderr, "bsqldb(): invalid name in %s\n", p); free(input); return; } p = ++pend; if( sscanf(p, "%d%c%n", &options->pivot.val_col, &ch, &nchars) != 1) { fprintf(stderr, "bsqldb(): could not parse value column %s\n", p); free(input); return; } free(input); } LOGINREC * get_login(int argc, char *argv[], OPTIONS *options) { LOGINREC *login; int ch; char *username = NULL, *password = NULL; extern char *optarg; assert(options && argv); options->appname = basename(argv[0]); options->colsep = default_colsep; /* may be overridden by -t */ login = dblogin(); if (!login) { fprintf(stderr, "%s: unable to allocate login structure\n", options->appname); exit(1); } DBSETLAPP(login, options->appname); options->servername = getenv("DSQUERY"); while ((ch = getopt(argc, argv, "U:P:R:S:d:D:i:o:e:t:H:hqv")) != -1) { switch (ch) { case 'U': free(username); username = strdup(optarg); break; case 'R': parse_pivot_description(options, optarg); break; case 'P': free(password); password = tds_getpassarg(optarg); break; case 'S': options->servername = strdup(optarg); break; case 'd': case 'D': options->database = strdup(optarg); break; case 'i': options->input_filename = strdup(optarg); break; case 'o': options->output_filename = strdup(optarg); break; case 'e': options->error_filename = strdup(optarg); break; case 't': unescape(optarg); options->colsep = strdup(optarg); break; case 'h': options->headers = stdout; break; case 'H': strlcpy(options->hostname, optarg, sizeof(options->hostname)); break; case 'q': options->fquiet = 1; break; case 'v': options->fverbose = 1; break; case '?': default: usage(options->appname); exit(1); } } if (username) DBSETLUSER(login, username); if( !options->hostname[0] ) { if (-1 == gethostname(options->hostname, sizeof(options->hostname))) { perror("unable to get hostname"); } } if( options->hostname[0] ) { DBSETLHOST(login, options->hostname); } /* Look for a password if a username was provided, else assume domain login */ if (password) { DBSETLPWD(login, password); memset(password, 0, strlen(password)); } else if (username) { char password[128]; readpassphrase("Password: ", password, sizeof(password), RPP_ECHO_OFF); DBSETLPWD(login, password); } if (!options->servername) { usage(options->appname); exit(1); } return login; } int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { if (dberr) { fprintf(stderr, "%s: Msg %d, Level %d", options.appname, dberr, severity); } else { fprintf(stderr, "%s: DB-LIBRARY error", options.appname); } if (oserr && oserrstr) fprintf(stderr, " (OS error %d: %s)", oserr, oserrstr); printf("\n"); fprintf(stderr, "%s\n\n", dberrstr); return INT_CANCEL; } int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { enum {changed_database = 5701, changed_language = 5703 }; if (msgno == changed_database || msgno == changed_language) return 0; if (msgno > 0) { fprintf(stderr, "Msg %ld, Level %d, State %d\n", (long) msgno, severity, msgstate); if (strlen(srvname) > 0) fprintf(stderr, "Server '%s', ", srvname); if (strlen(procname) > 0) fprintf(stderr, "Procedure '%s', ", procname); if (line > 0) fprintf(stderr, "Line %d", line); fprintf(stderr, "\n\t"); } fprintf(stderr, "%s\n", msgtext); if (severity > 10) { fprintf(stderr, "%s: error: severity %d > 10, exiting\n", options.appname, severity); exit(severity); } return 0; } freetds-1.3.6/src/apps/bsqlodbc.c000644 025423 025423 00000055154 14056414271 020310 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004, 2005 James K. Lowden * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_ERRNO_H #include #endif #if HAVE_UNISTD_H #include #endif #if HAVE_STDLIB_H #include #endif #if HAVE_STRING_H #include #endif #if HAVE_LIBGEN_H #include #endif #if HAVE_LOCALE_H #include #endif #include #include "tds_sysdep_public.h" #include #include #include #include static char * next_query(void); static void print_results(SQLHSTMT hStmt); /* static int get_printable_size(int type, int size); */ static void usage(const char invoked_as[]); static SQLINTEGER print_error_message(SQLSMALLINT hType, SQLHANDLE handle); static SQLRETURN odbc_herror(SQLSMALLINT hType, SQLHANDLE handle, SQLRETURN erc, const char func[], const char msg[]); static SQLRETURN odbc_perror(SQLHSTMT hStmt, SQLRETURN erc, const char func[], const char msg[]); static const char * prret(SQLRETURN erc); struct METADATA { char *name, *format_string; const char *source; SQLSMALLINT type; SQLINTEGER nchars; SQLULEN size, width; }; struct DATA { char *buffer; SQLLEN len; int status; }; static int set_format_string(struct METADATA * meta, const char separator[]); typedef struct _options { int fverbose, fquiet; size_t odbc_version; FILE *headers, *verbose; char *servername, *database, *appname, hostname[128]; const char *colsep; char *input_filename, *output_filename, *error_filename; } OPTIONS; typedef struct { int connect_timeout, query_timeout; char *client_hostname, *username, *password, *client_charset; } LOGINREC; static LOGINREC* get_login(int argc, char *argv[], OPTIONS *poptions); /* global variables */ OPTIONS options; static const char default_colsep[] = " "; /* end global variables */ /** * The purpose of this program is threefold: * * 1. To provide a generalized SQL processor suitable for testing the FreeTDS ODBC driver. * 2. To offer a robust batch-oriented SQL processor suitable for use in a production environment. * 3. To serve as a model example of how to use ODBC functions. * * These purposes may be somewhat impossible. The original author is not an experienced ODBC programmer. * Nevertheless the first objective can be met and is useful by itself. * If others join in, perhaps the others can be met, too. */ /** * When SQLExecute returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, * an associated SQLSTATE value can be obtained by calling SQLGetDiagRec * with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. */ static SQLINTEGER print_error_message(SQLSMALLINT hType, SQLHANDLE handle) { int i; SQLINTEGER ndiag=0; SQLRETURN ret; SQLCHAR state[6]; SQLINTEGER error, maxerror=0; SQLCHAR text[1024]; SQLSMALLINT len; ret = SQLGetDiagField(hType, handle, 0, SQL_DIAG_NUMBER, &ndiag, sizeof(ndiag), NULL); assert(ret == SQL_SUCCESS); for(i=1; i <= ndiag; i++) { memset(text, '\0', sizeof(text)); ret = SQLGetDiagRec(hType, handle, i, state, &error, text, sizeof(text), &len); if (ret == SQL_SUCCESS && error == 0) { printf("\"%s\"\n", text); continue; } fprintf(stderr, "%s: error %d: %s: %s\n", options.appname, (int)error, state, text); assert(ret == SQL_SUCCESS); if (error > maxerror) maxerror = error; } return maxerror; } static const char * prret(SQLRETURN erc) { switch(erc) { case SQL_SUCCESS: return "SQL_SUCCESS"; case SQL_SUCCESS_WITH_INFO: return "SQL_SUCCESS_WITH_INFO"; case SQL_ERROR: return "SQL_ERROR"; case SQL_STILL_EXECUTING: return "SQL_STILL_EXECUTING"; case SQL_INVALID_HANDLE: return "SQL_INVALID_HANDLE"; case SQL_NO_DATA: return "SQL_NO_DATA"; } fprintf(stderr, "error:%d: prret cannot interpret SQLRETURN code %d\n", __LINE__, erc); return "unknown"; } static SQLRETURN odbc_herror(SQLSMALLINT hType, SQLHANDLE handle, SQLRETURN erc, const char func[], const char msg[]) { char * ercstr; assert(func && msg); switch(erc) { case SQL_SUCCESS: return erc; case SQL_SUCCESS_WITH_INFO: ercstr = "SQL_SUCCESS_WITH_INFO"; break; case SQL_ERROR: ercstr = "SQL_ERROR"; break; case SQL_STILL_EXECUTING: ercstr = "SQL_STILL_EXECUTING"; break; case SQL_INVALID_HANDLE: fprintf(stderr, "%s: error %d: %s: invalid handle: %s\n", options.appname, (int)erc, func, msg); exit(EXIT_FAILURE); default: fprintf(stderr, "%s: error: %d is an unknown return code for %s\n", options.appname, (int)erc, func); exit(EXIT_FAILURE); } fprintf(stderr, "%s: error %d: %s: %s: %s\n", options.appname, (int)erc, func, ercstr, msg); print_error_message(hType, handle); return erc; } static SQLRETURN odbc_perror(SQLHSTMT hStmt, SQLRETURN erc, const char func[], const char msg[]) { return odbc_herror(SQL_HANDLE_STMT, hStmt, erc, func, msg); } int main(int argc, char *argv[]) { LOGINREC *login; SQLHENV hEnv = 0; SQLHDBC hDbc = 0; SQLRETURN erc; const char *sql; setlocale(LC_ALL, ""); memset(&options, 0, sizeof(options)); options.headers = stderr; login = get_login(argc, argv, &options); /* get command-line parameters and call dblogin() */ assert(login != NULL); /* * Override stdin, stdout, and stderr, as required */ if (options.input_filename) { if (freopen(options.input_filename, "r", stdin) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.input_filename, strerror(errno)); exit(1); } } if (options.output_filename) { if (freopen(options.output_filename, "w", stdout) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.output_filename, strerror(errno)); exit(1); } } if (options.error_filename) { if (freopen(options.error_filename, "w", stderr) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.error_filename, strerror(errno)); exit(1); } } if (options.fverbose) { options.verbose = stderr; } else { static const char null_device[] = "/dev/null"; options.verbose = fopen(null_device, "w"); if (options.verbose == NULL) { fprintf(stderr, "%s:%d unable to open %s for verbose operation: %s\n", options.appname, __LINE__, null_device, strerror(errno)); exit(1); } } fprintf(options.verbose, "%s:%d: Verbose operation enabled\n", options.appname, __LINE__); /* * Connect to the server */ if ((erc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hEnv)) != SQL_SUCCESS) { odbc_herror(SQL_HANDLE_ENV, hEnv, erc, "SQLAllocHandle", "failed to allocate an environment"); exit(EXIT_FAILURE); } assert(hEnv); if ((erc = SQLSetEnvAttr(hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)options.odbc_version, SQL_IS_UINTEGER)) != SQL_SUCCESS){ odbc_herror(SQL_HANDLE_DBC, hDbc, erc, "SQLSetEnvAttr", "failed to set SQL_OV_ODBC3"); exit(EXIT_FAILURE); } if ((erc = SQLAllocHandle(SQL_HANDLE_DBC, hEnv, &hDbc)) != SQL_SUCCESS) { odbc_herror(SQL_HANDLE_DBC, hDbc, erc, "SQLAllocHandle", "failed to allocate a connection"); exit(EXIT_FAILURE); } assert(hDbc); if ((erc = SQLConnect(hDbc, (SQLCHAR *) options.servername, SQL_NTS, (SQLCHAR *) login->username, SQL_NTS, (SQLCHAR *) login->password, SQL_NTS)) != SQL_SUCCESS) { odbc_herror(SQL_HANDLE_DBC, hDbc, erc, "SQLConnect", "failed"); exit(EXIT_FAILURE); } #if 0 /* Switch to the specified database, if any */ if (options.database) dbuse(dbproc, options.database); #endif /* * Read the queries and write the results */ while ((sql = next_query()) != NULL ) { SQLHSTMT hStmt; if ((erc = SQLAllocHandle(SQL_HANDLE_STMT, hDbc, &hStmt)) != SQL_SUCCESS) { odbc_perror(hStmt, erc, "SQLAllocHandle", "failed to allocate a statement handle"); exit(EXIT_FAILURE); } /* "Prepare" the query and send it to the server */ if ((erc = SQLPrepare(hStmt, (SQLCHAR *) sql, SQL_NTS)) != SQL_SUCCESS) { odbc_perror(hStmt, erc, "SQLPrepare", "failed"); exit(EXIT_FAILURE); } if((erc = SQLExecute(hStmt)) != SQL_SUCCESS) { switch(erc) { case SQL_NEED_DATA: goto FreeStatement; case SQL_SUCCESS_WITH_INFO: if (0 != print_error_message(SQL_HANDLE_STMT, hStmt)) { fprintf(stderr, "SQLExecute: continuing...\n"); } break; default: odbc_perror(hStmt, erc, "SQLExecute", "failed"); exit(EXIT_FAILURE); } } /* Write the output */ print_results(hStmt); FreeStatement: if ((erc = SQLFreeHandle(SQL_HANDLE_STMT, hStmt)) != SQL_SUCCESS){ odbc_perror(hStmt, erc, "SQLFreeHandle", "failed"); exit(EXIT_FAILURE); } } SQLDisconnect(hDbc); SQLFreeHandle(SQL_HANDLE_DBC, hDbc); SQLFreeHandle(SQL_HANDLE_ENV, hEnv); return 0; } static char * next_query() { char query_line[4096]; static char *sql = NULL; if (feof(stdin)) return NULL; fprintf(options.verbose, "%s:%d: Query:\n", options.appname, __LINE__); free(sql); sql = NULL; while (fgets(query_line, sizeof(query_line), stdin)) { /* 'go' or 'GO' separates command batches */ char *p = query_line; if (strncasecmp(p, "go", 2) == 0) { for (p+=2; isspace((unsigned char) *p); p++) { if (*p == '\n') return sql; } } fprintf(options.verbose, "\t%s", query_line); /* Add the query line to the command to be sent to the server */ if (!strlen(query_line)) continue; p = (char *) realloc(sql, 1 + (sql? strlen(sql) : 0) + strlen(query_line)); if (!p) { fprintf(stderr, "%s:%d: could not allocate memory\n", options.appname, __LINE__); return NULL; } if (!sql) { strcpy(p, query_line); } else { strcat(p, query_line); } sql = p; } if (feof(stdin)) return sql; if (ferror(stdin)) { fprintf(stderr, "%s:%d: next_query() failed\n", options.appname, __LINE__); perror(NULL); return NULL; } return sql; } static void free_metadata(struct METADATA *metadata, struct DATA *data, int ncols) { int c; for (c=0; c < ncols; c++) { free(metadata[c].format_string); free(data[c].buffer); } free(metadata); free(data); } static const char * prtype(SQLSMALLINT type) { static char buffer[64]; switch(type) { case SQL_UNKNOWN_TYPE: return "SQL_UNKNOWN_TYPE"; case SQL_CHAR: return "SQL_CHAR"; case SQL_NUMERIC: return "SQL_NUMERIC"; case SQL_DECIMAL: return "SQL_DECIMAL"; case SQL_INTEGER: return "SQL_INTEGER"; case SQL_SMALLINT: return "SQL_SMALLINT"; case SQL_FLOAT: return "SQL_FLOAT"; case SQL_REAL: return "SQL_REAL"; case SQL_DOUBLE: return "SQL_DOUBLE"; #if (ODBCVER >= 0x0300) case SQL_DATETIME: return "SQL_DATETIME"; #else case SQL_DATE: return "SQL_DATE"; #endif case SQL_VARCHAR: return "SQL_VARCHAR"; #if (ODBCVER >= 0x0300) case SQL_TYPE_DATE: return "SQL_TYPE_DATE"; case SQL_TYPE_TIME: return "SQL_TYPE_TIME"; case SQL_TYPE_TIMESTAMP: return "SQL_TYPE_TIMESTAMP"; #endif #if (ODBCVER >= 0x0300) case SQL_INTERVAL: return "SQL_INTERVAL"; #else case SQL_TIME: return "SQL_TIME"; #endif /* ODBCVER >= 0x0300 */ case SQL_TIMESTAMP: return "SQL_TIMESTAMP"; case SQL_LONGVARCHAR: return "SQL_LONGVARCHAR"; case SQL_BINARY: return "SQL_BINARY"; case SQL_VARBINARY: return "SQL_VARBINARY"; case SQL_LONGVARBINARY: return "SQL_LONGVARBINARY"; case SQL_BIGINT: return "SQL_BIGINT"; case SQL_TINYINT: return "SQL_TINYINT"; case SQL_BIT: return "SQL_BIT"; #if (ODBCVER >= 0x0350) case SQL_GUID: return "SQL_GUID"; #endif /* ODBCVER >= 0x0350 */ } sprintf(buffer, "unknown: %d", (int)type); return buffer; } #define is_character_data(x) (x==SQL_CHAR || \ x==SQL_VARCHAR || \ x==SQL_LONGVARCHAR || \ x==SQL_WCHAR || \ x==SQL_WVARCHAR || \ x==SQL_WLONGVARCHAR) static SQLLEN bufsize(const struct METADATA *meta) { assert(meta); return meta->size > meta->width? meta->size : meta->width; } static void print_results(SQLHSTMT hStmt) { static const char dashes[] = "----------------------------------------------------------------" /* each line is 64 */ "----------------------------------------------------------------" "----------------------------------------------------------------" "----------------------------------------------------------------"; struct METADATA *metadata = NULL; struct DATA *data = NULL; SQLSMALLINT ncols = 0; RETCODE erc; int c, ret; /* * Process each resultset */ do { /* free metadata, in case it was previously allocated */ free_metadata(metadata, data, ncols); metadata = NULL; data = NULL; ncols = 0; /* * Allocate memory for metadata and bound columns */ if ((erc = SQLNumResultCols(hStmt, &ncols)) != SQL_SUCCESS){ odbc_perror(hStmt, erc, "SQLNumResultCols", "failed"); exit(EXIT_FAILURE); } metadata = (struct METADATA*) calloc(ncols, sizeof(struct METADATA)); assert(metadata); data = (struct DATA*) calloc(ncols, sizeof(struct DATA)); assert(data); /* * For each column, get its name, type, and size. * Allocate a buffer to hold the data, and bind the buffer to the column. * "bind" here means to give the address of the buffer we want filled as each row is fetched. */ fprintf(options.verbose, "Metadata\n"); fprintf(options.verbose, "%-6s %-30s %-10s %-18s %-6s %-6s \n", "col", "name", "type value", "type name", "size", "varies"); fprintf(options.verbose, "%.6s %.30s %.10s %.18s %.6s %.6s \n", dashes, dashes, dashes, dashes, dashes, dashes); for (c=0; c < ncols; c++) { /* Get and print the metadata. Optional: get only what you need. */ SQLCHAR name[512]; SQLSMALLINT namelen, ndigits, fnullable; if ((erc = SQLDescribeCol(hStmt, c+1, name, sizeof(name), &namelen, &metadata[c].type, &metadata[c].size, &ndigits, &fnullable)) != SQL_SUCCESS) { odbc_perror(hStmt, erc, "SQLDescribeCol", "failed"); exit(EXIT_FAILURE); } assert(namelen < sizeof(name)); name[namelen] = '\0'; metadata[c].name = strdup((char *) name); metadata[c].width = (ndigits >= 0 && (unsigned) ndigits > metadata[c].size)? ndigits : metadata[c].size; if (is_character_data(metadata[c].type)) { SQLHDESC hDesc; SQLINTEGER buflen; metadata[c].nchars = metadata[c].size; if ((erc = SQLGetStmtAttr(hStmt, SQL_ATTR_IMP_ROW_DESC, &hDesc, sizeof(hDesc), NULL)) != SQL_SUCCESS) { odbc_perror(hStmt, erc, "SQLGetStmtAttr", "failed"); exit(EXIT_FAILURE); } if ((erc = SQLGetDescField(hDesc, c+1, SQL_DESC_OCTET_LENGTH, &metadata[c].size, sizeof(metadata[c].size), &buflen)) != SQL_SUCCESS) { odbc_perror(hStmt, erc, "SQLGetDescField", "failed"); exit(EXIT_FAILURE); } metadata[c].size = metadata[c].size * 2 + 1; } fprintf(options.verbose, "%6d %30s %10d %18s %6lu %6d \n", c+1, metadata[c].name, (int)metadata[c].type, prtype(metadata[c].type), (long unsigned int) metadata[c].size, -1); #if 0 fprintf(options.verbose, "%6d %30s %30s %15s %6d %6d \n", c+1, metadata[c].name, metadata[c].source, dbprtype(metadata[c].type), metadata[c].size, dbvarylen(dbproc, c+1)); metadata[c].width = get_printable_size(metadata[c].type, metadata[c].size); if (metadata[c].width < strlen(metadata[c].name)) metadata[c].width = strlen(metadata[c].name); #endif /* * Build the column header format string, based on the column width. * This is just one solution to the question, "How wide should my columns be when I print them out?" */ ret = set_format_string(&metadata[c], (c+1 < ncols)? options.colsep : "\n"); if (ret <= 0) { fprintf(stderr, "%s:%d: asprintf(), column %d failed\n", options.appname, __LINE__, c+1); free_metadata(metadata, data, ncols); return; } /* * Bind the column to our variable. * We bind everything to strings, because we want to convert everything to strings for us. * If you're performing calculations on the data in your application, you'd bind the numeric data * to C integers and floats, etc. instead. * * It is not necessary to bind to every column returned by the query. * Data in unbound columns are simply never copied to the user's buffers and are thus * inaccesible to the application. */ data[c].buffer = (char *) calloc(1, bufsize(&metadata[c])); assert(data[c].buffer); if ((erc = SQLBindCol(hStmt, c+1, SQL_C_CHAR, (SQLPOINTER)data[c].buffer, bufsize(&metadata[c]), &data[c].len)) != SQL_SUCCESS){ odbc_perror(hStmt, erc, "SQLBindCol", "failed"); exit(EXIT_FAILURE); } } if (!options.fquiet) { /* Print the column headers to stderr to keep them separate from the data. */ for (c=0; c < ncols; c++) { fprintf(options.headers, metadata[c].format_string, metadata[c].name); } /* Underline the column headers. */ for (c=0; c < ncols; c++) { fprintf(options.headers, metadata[c].format_string, dashes); } } /* * Print the data to stdout. */ while (ncols > 0 && (erc = SQLFetch(hStmt)) != SQL_NO_DATA) { switch(erc) { case SQL_SUCCESS_WITH_INFO: print_error_message(SQL_HANDLE_STMT, hStmt); case SQL_SUCCESS: break; default: odbc_perror(hStmt, erc, "SQLFetch", "failed"); exit(EXIT_FAILURE); } for (c=0; c < ncols; c++) { switch (data[c].len) { /* handle nulls */ case SQL_NULL_DATA: /* is null */ printf(metadata[c].format_string, "NULL"); break; default: assert(data[c].len >= 0); case SQL_NO_TOTAL: printf(metadata[c].format_string, data[c].buffer); break; } } } if (ncols > 0 && erc == SQL_NO_DATA) print_error_message(SQL_HANDLE_STMT, hStmt); erc = SQLMoreResults(hStmt); fprintf(options.verbose, "SQLMoreResults returned %s\n", prret(erc)); switch (erc) { case SQL_NO_DATA: print_error_message(SQL_HANDLE_STMT, hStmt); break; case SQL_SUCCESS_WITH_INFO: print_error_message(SQL_HANDLE_STMT, hStmt); case SQL_SUCCESS: continue; default: odbc_perror(hStmt, erc, "SQLMoreResults", "failed"); exit(EXIT_FAILURE); } } while (erc != SQL_NO_DATA); if (erc != SQL_NO_DATA) { assert(erc != SQL_STILL_EXECUTING); odbc_perror(hStmt, erc, "SQLMoreResults", "failed"); exit(EXIT_FAILURE); } free_metadata(metadata, data, ncols); } /** * Build the column header format string, based on the column width. * This is just one solution to the question, "How wide should my columns be when I print them out?" */ static int set_format_string(struct METADATA * meta, const char separator[]) { int ret; unsigned width; const char *size_and_width; assert(meta); if(0 == strcmp(options.colsep, default_colsep)) { /* right justify numbers, left justify strings */ size_and_width = is_character_data(meta->type)? "%%-%u.%us%s" : "%%%u.%us%s"; width = meta->width; /* get_printable_size(meta->type, meta->size); */ if (width < strlen(meta->name)) width = strlen(meta->name); ret = asprintf(&meta->format_string, size_and_width, width, width, separator); } else { /* For anything except the default two-space separator, don't justify the strings. */ ret = asprintf(&meta->format_string, "%%s%s", separator); } return ret; } static void usage(const char invoked_as[]) { fprintf(stderr, "usage: %s \n" " [-U username] [-P password]\n" " [-S servername] [-D database]\n" " [-i input filename] [-o output filename] [-e error filename]\n" , invoked_as); } static void unescape(char arg[]) { char *p = arg; char escaped = '1'; /* any digit will do for an initial value */ while ((p = strchr(p, '\\')) != NULL) { switch (p[1]) { case '0': /* FIXME we use strlen() of field/row terminators, which obviously won't work here */ fprintf(stderr, "bsqlodbc, line %d: NULL terminators ('\\0') not yet supported.\n", __LINE__); escaped = '\0'; break; case 't': escaped = '\t'; break; case 'r': escaped = '\r'; break; case 'n': escaped = '\n'; break; case '\\': escaped = '\\'; break; default: break; } /* Overwrite the backslash with the intended character, and shift everything down one */ if (!isdigit((unsigned char) escaped)) { *p++ = escaped; memmove(p, p+1, 1 + strlen(p+1)); escaped = '1'; } } } static LOGINREC * get_login(int argc, char *argv[], OPTIONS *options) { LOGINREC *login; int ch; extern char *optarg; assert(options && argv); options->appname = basename(argv[0]); options->colsep = default_colsep; /* may be overridden by -t */ options->odbc_version = SQL_OV_ODBC3; /* may be overridden by -V */ login = (LOGINREC *) calloc(1, sizeof(LOGINREC)); if (!login) { fprintf(stderr, "%s: unable to allocate login structure\n", options->appname); exit(1); } if (-1 == gethostname(options->hostname, sizeof(options->hostname))) { perror("unable to get hostname"); } while ((ch = getopt(argc, argv, "U:P:S:d:D:i:o:e:t:V:hqv")) != -1) { char *p; switch (ch) { case 'U': login->username = strdup(optarg); break; case 'P': login->password = strdup(optarg); memset(optarg, 0, strlen(optarg)); break; case 'S': options->servername = strdup(optarg); break; case 'd': case 'D': options->database = strdup(optarg); break; case 'i': options->input_filename = strdup(optarg); break; case 'o': options->output_filename = strdup(optarg); break; case 'e': options->error_filename = strdup(optarg); break; case 't': unescape(optarg); options->colsep = strdup(optarg); break; case 'h': options->headers = stdout; break; case 'q': options->fquiet = 1; break; case 'V': switch(strtol(optarg, &p, 10)) { case 3: options->odbc_version = SQL_OV_ODBC3 ; break; case 2: options->odbc_version = SQL_OV_ODBC2; break; default: fprintf(stderr, "warning: -V must be 2 or 3, not %s. Using default of 3\n", optarg); break; } case 'v': options->fverbose = 1; break; case '?': default: usage(options->appname); exit(1); } } if (!options->servername) { usage(options->appname); exit(1); } return login; } freetds-1.3.6/src/apps/datacopy.c000644 025423 025423 00000046244 14056414271 020323 0ustar00fredianofrediano000000 000000 /* datacopy - Program to move database table between servers * Copyright (C) 2004-2005 Bill Thompson * * This program 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 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 * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STRINGS_H #include #endif /* HAVE_STRINGS_H */ #if HAVE_UNISTD_H #include #endif #include #include #if HAVE_LOCALE_H #include #endif #include #include #include typedef struct { char *user; char *pass; char *server; char *db; char *dbobject; } OBJECTINFO; typedef struct pd { int batchsize; int packetsize; OBJECTINFO src, dest; char *owner; int textsize; int tflag; int aflag; int cflag; int Sflag; int Dflag; int bflag; int pflag; int Eflag; int vflag; } BCPPARAMDATA; static void pusage(void); static int process_parameters(int, char **, struct pd *); static int login_to_databases(const BCPPARAMDATA * pdata, DBPROCESS ** dbsrc, DBPROCESS ** dbdest); static int create_target_table(char *sobjname, char *owner, char *dobjname, DBPROCESS * dbsrc, DBPROCESS * dbdest); static int check_table_structures(char *sobjname, char *dobjname, DBPROCESS * dbsrc, DBPROCESS * dbdest); static int transfer_data(const BCPPARAMDATA * params, DBPROCESS * dbsrc, DBPROCESS * dbdest); static RETCODE set_textsize(DBPROCESS *dbproc, int textsize); static int err_handler(DBPROCESS *, int, int, int, char *, char *); static int msg_handler(DBPROCESS *, DBINT, int, int, char *, char *, char *, int); int tdsdump_open(const char *filename); int main(int argc, char **argv) { BCPPARAMDATA params; DBPROCESS *dbsrc; DBPROCESS *dbtarget; setlocale(LC_ALL, ""); memset(¶ms, '\0', sizeof(params)); if (process_parameters(argc, argv, ¶ms) == FALSE) { pusage(); return 1; } if (login_to_databases(¶ms, &dbsrc, &dbtarget) == FALSE) return 1; if (set_textsize(dbtarget, params.textsize) != SUCCEED || set_textsize(dbsrc, params.textsize) != SUCCEED) return 1; if (params.cflag) { if (create_target_table(params.src.dbobject, params.owner, params.dest.dbobject, dbsrc, dbtarget) == FALSE) { printf("datacopy: could not create target table %s.%s . terminating\n", params.owner, params.dest.dbobject); dbclose(dbsrc); dbclose(dbtarget); return 1; } } if (check_table_structures(params.src.dbobject, params.dest.dbobject, dbsrc, dbtarget) == FALSE) { printf("datacopy: table structures do not match. terminating\n"); dbclose(dbsrc); dbclose(dbtarget); return 1; } if (transfer_data(¶ms, dbsrc, dbtarget) == FALSE) { printf("datacopy: table copy failed.\n"); printf(" the data may have been partially copied into the target database \n"); dbclose(dbsrc); dbclose(dbtarget); return 1; } dbclose(dbsrc); dbclose(dbtarget); return 0; } static char * gets_alloc(void) { char reply[256]; char *p = NULL; if (fgets(reply, sizeof(reply), stdin) != NULL) { p = strchr(reply, '\n'); if (p) *p = 0; p = strdup(reply); } memset(reply, 0, sizeof(reply)); return p; } static int process_objectinfo(OBJECTINFO *oi, char *arg, const char *prompt) { char *tok; tok = strsep(&arg, "/"); if (!tok) return FALSE; oi->server = strdup(tok); tok = strsep(&arg, "/"); if (!tok) return FALSE; oi->user = strdup(tok); tok = strsep(&arg, "/"); if (!tok) return FALSE; if (strcmp(tok,"-") == 0) { printf("%s", prompt); oi->pass = gets_alloc(); } else { oi->pass = strdup(tok); memset(tok, '*', strlen(tok)); } tok = strsep(&arg, "/"); if (!tok) return FALSE; oi->db = strdup(tok); tok = strsep(&arg, "/"); if (!tok) return FALSE; oi->dbobject = strdup(tok); return TRUE; } static int process_parameters(int argc, char **argv, BCPPARAMDATA * pdata) { int opt; /* set some defaults */ pdata->textsize = -1; pdata->batchsize = 1000; /* get the rest of the arguments */ while ((opt = getopt(argc, argv, "b:p:tac:dS:D:T:Ev")) != -1) { switch (opt) { case 'b': pdata->bflag++; pdata->batchsize = atoi(optarg); break; case 'p': pdata->pflag++; pdata->packetsize = atoi(optarg); break; case 't': pdata->tflag++; break; case 'a': pdata->aflag++; break; case 'c': pdata->cflag++; if (optarg[0] == '-') { fprintf(stderr, "Invalid owner specified.\n"); return FALSE; } pdata->owner = strdup(optarg); break; case 'd': tdsdump_open("stderr"); break; case 'S': pdata->Sflag++; if (process_objectinfo(&pdata->src, optarg, "Enter Source Password: ") == FALSE) return FALSE; break; case 'D': pdata->Dflag++; if (process_objectinfo(&pdata->dest, optarg, "Enter Destination Password: ") == FALSE) return FALSE; break; case 'T': pdata->textsize = opt = atoi(optarg); if (opt < 0 || opt > 0x7fffffff) { fprintf(stderr, "Invalid textsize specified.\n"); return FALSE; } break; case 'E': pdata->Eflag++; break; case 'v': pdata->vflag++; break; default: return FALSE; } } /* one of these must be specified */ if ((pdata->tflag + pdata->aflag + pdata->cflag) != 1) { fprintf(stderr, "one (and only one) of -t, -a or -c must be specified\n"); return FALSE; } if (!pdata->Sflag) { printf("\nNo [-S]ource information supplied.\n\n"); printf("Enter Server : "); pdata->src.server = gets_alloc(); printf("Enter Login : "); pdata->src.user = gets_alloc(); printf("Enter Password : "); pdata->src.pass = gets_alloc(); printf("Enter Database : "); pdata->src.db = gets_alloc(); printf("Enter Table : "); pdata->src.dbobject = gets_alloc(); } if (!pdata->Dflag) { printf("\nNo [-D]estination information supplied.\n\n"); printf("Enter Server : "); pdata->dest.server = gets_alloc(); printf("Enter Login : "); pdata->dest.user = gets_alloc(); printf("Enter Password : "); pdata->dest.pass = gets_alloc(); printf("Enter Database : "); pdata->dest.db = gets_alloc(); printf("Enter Table : "); pdata->dest.dbobject = gets_alloc(); } return TRUE; } static int login_to_databases(const BCPPARAMDATA * pdata, DBPROCESS ** dbsrc, DBPROCESS ** dbdest) { int result = FALSE; LOGINREC *slogin = NULL; LOGINREC *dlogin = NULL; /* Initialize DB-Library. */ if (dbinit() == FAIL) return FALSE; /* * Install the user-supplied error-handling and message-handling * routines. They are defined at the bottom of this source file. */ dberrhandle(err_handler); dbmsghandle(msg_handler); /* * Allocate and initialize the LOGINREC structure to be used * to open a connection to SQL Server. */ slogin = dblogin(); if (pdata->src.user) DBSETLUSER(slogin, pdata->src.user); if (pdata->src.pass) DBSETLPWD(slogin, pdata->src.pass); if (pdata->src.db) DBSETLDBNAME(slogin, pdata->src.db); DBSETLAPP(slogin, "Migrate Data"); /* if packet size specified, set in login record */ if (pdata->pflag && pdata->packetsize > 0) { DBSETLPACKET(slogin, pdata->packetsize); } /* * Get a connection to the database. */ if ((*dbsrc = dbopen(slogin, pdata->src.server)) == (DBPROCESS *) NULL) { fprintf(stderr, "Can't connect to source server.\n"); goto cleanup; } dlogin = dblogin(); if (pdata->dest.user) DBSETLUSER(dlogin, pdata->dest.user); if (pdata->dest.pass) DBSETLPWD(dlogin, pdata->dest.pass); if (pdata->dest.db) DBSETLDBNAME(dlogin, pdata->dest.db); DBSETLAPP(dlogin, "Migrate Data"); /* Enable bulk copy for this connection. */ BCP_SETL(dlogin, TRUE); /* if packet size specified, set in login record */ if (pdata->pflag && pdata->packetsize > 0) { DBSETLPACKET(dlogin, pdata->packetsize); } /* * Get a connection to the database. */ if ((*dbdest = dbopen(dlogin, pdata->dest.server)) == (DBPROCESS *) NULL) { fprintf(stderr, "Can't connect to destination server.\n"); goto cleanup; } result = TRUE; cleanup: dbloginfree(slogin); dbloginfree(dlogin); return result; } static int create_target_table(char *sobjname, char *owner, char *dobjname, DBPROCESS * dbsrc, DBPROCESS * dbdest) { char ls_command[2048]; int i; const char *sep; DBINT num_cols; DBCOL2 colinfo; sprintf(ls_command, "SET FMTONLY ON select * from %s SET FMTONLY OFF", sobjname); if (dbcmd(dbsrc, ls_command) == FAIL) { printf("dbcmd failed\n"); return FALSE; } if (dbsqlexec(dbsrc) == FAIL) { printf("table %s not found on SOURCE\n", sobjname); return FALSE; } while (dbresults(dbsrc) != NO_MORE_RESULTS) continue; sprintf(ls_command, "CREATE TABLE %s%s%s ", owner, owner[0] ? "." : "", dobjname); num_cols = dbnumcols(dbsrc); sep = "( "; for (i = 1; i <= num_cols; i++) { colinfo.SizeOfStruct = sizeof(colinfo); if (dbtablecolinfo(dbsrc, i, (DBCOL *) &colinfo) != SUCCEED) return FALSE; strlcat(ls_command, sep, sizeof(ls_command)); sep = ", "; strlcat(ls_command, colinfo.Name, sizeof(ls_command)); strlcat(ls_command, " ", sizeof(ls_command)); strlcat(ls_command, colinfo.ServerTypeDeclaration, sizeof(ls_command)); if (colinfo.Null == TRUE) { strlcat(ls_command, " NULL", sizeof(ls_command)); } else { strlcat(ls_command, " NOT NULL", sizeof(ls_command)); } } if (strlcat(ls_command, " )", sizeof(ls_command)) >= sizeof(ls_command)) { fprintf(stderr, "Buffer overflow building command to create table\n"); return FALSE; } if (dbcmd(dbdest, ls_command) == FAIL) { printf("dbcmd failed\n"); return FALSE; } if (dbsqlexec(dbdest) == FAIL) { printf("create table on DESTINATION failed\n"); return FALSE; } while (NO_MORE_RESULTS != dbresults(dbdest)) continue; return TRUE; } static RETCODE set_textsize(DBPROCESS *dbproc, int textsize) { char buf[32]; if (textsize < 0) return SUCCEED; sprintf(buf, "%d", textsize); if (dbsetopt(dbproc, DBTEXTSIZE, buf, -1) == FAIL) { fprintf(stderr, "dbsetopt failed\n"); return FAIL; } return SUCCEED; } static int check_table_structures(char *sobjname, char *dobjname, DBPROCESS * dbsrc, DBPROCESS * dbdest) { char ls_command[256]; int i, ret; DBINT src_numcols = 0; DBINT dest_numcols = 0; DBINT src_coltype, dest_coltype; DBINT src_collen, dest_collen; sprintf(ls_command, "SET FMTONLY ON select * from %s SET FMTONLY OFF", sobjname); if (dbcmd(dbsrc, ls_command) == FAIL) { printf("dbcmd failed\n"); return FALSE; } if (dbsqlexec(dbsrc) == FAIL) { printf("table %s not found on SOURCE\n", sobjname); return FALSE; } while ((ret=dbresults(dbsrc)) == SUCCEED) src_numcols = dbnumcols(dbsrc); if (ret != NO_MORE_RESULTS) { printf("Error in dbresults\n"); return FALSE; } if (0 == src_numcols) { printf("Error in dbnumcols 1\n"); return FALSE; } sprintf(ls_command, "SET FMTONLY ON select * from %s SET FMTONLY OFF", dobjname); if (dbcmd(dbdest, ls_command) == FAIL) { printf("dbcmd failed\n"); return FALSE; } if (dbsqlexec(dbdest) == FAIL) { printf("table %s not found on DEST\n", sobjname); return FALSE; } while ((ret=dbresults(dbdest)) == SUCCEED) dest_numcols = dbnumcols(dbdest); if (ret != NO_MORE_RESULTS) { printf("Error in dbresults\n"); return FALSE; } if (0 == dest_numcols) { printf("Error in dbnumcols 2\n"); return FALSE; } if (src_numcols != dest_numcols) { printf("number of columns do not match. source : %d , dest: %d\n", src_numcols, dest_numcols); return FALSE; } for (i = 1; i <= src_numcols; i++) { src_coltype = dbcoltype(dbsrc, i); src_collen = dbcollen(dbsrc, i); dest_coltype = dbcoltype(dbdest, i); dest_collen = dbcollen(dbdest, i); if ((src_coltype == SYBNUMERIC && dest_coltype == SYBNUMERIC) || (src_coltype == SYBDECIMAL && dest_coltype == SYBDECIMAL) ) { continue; } if (src_coltype != dest_coltype || src_collen != dest_collen) { printf("COLUMN TYPE MISMATCH: column %d\n", i); printf("source: type %d, length %d\n", src_coltype, src_collen); printf("dest : type %d, length %d\n", dest_coltype, dest_collen); return FALSE; } } return TRUE; } static int transfer_data(const BCPPARAMDATA * params, DBPROCESS * dbsrc, DBPROCESS * dbdest) { char ls_command[256]; int col; DBINT src_numcols = 0; typedef struct migcoldata { DBINT coltype; } MIGCOLDATA; MIGCOLDATA *srcdata; DBINT rows_read = 0; DBINT rows_sent = 0; DBINT rows_done = 0; DBINT ret; struct timeval start_time; struct timeval end_time; double elapsed_time; DBCOL2 colinfo; BOOL identity_column_exists = FALSE; if (params->vflag) { printf("\nStarting copy...\n"); } if (params->tflag) { sprintf(ls_command, "truncate table %s", params->dest.dbobject); if (dbcmd(dbdest, ls_command) == FAIL) { printf("dbcmd failed\n"); return FALSE; } if (dbsqlexec(dbdest) == FAIL) { printf("dbsqlexec failed\n"); return FALSE; } if (dbresults(dbdest) == FAIL) { printf("Error in dbresults\n"); return FALSE; } } sprintf(ls_command, "select * from %s", params->src.dbobject); if (dbcmd(dbsrc, ls_command) == FAIL) { printf("dbcmd failed\n"); return FALSE; } if (dbsqlexec(dbsrc) == FAIL) { printf("dbsqlexec failed\n"); return FALSE; } if (NO_MORE_RESULTS != dbresults(dbsrc)) { if (0 == (src_numcols = dbnumcols(dbsrc))) { printf("Error in dbnumcols\n"); return FALSE; } } if (bcp_init(dbdest, params->dest.dbobject, (char *) NULL, (char *) NULL, DB_IN) == FAIL) { printf("Error in bcp_init\n"); return FALSE; } srcdata = (MIGCOLDATA *) calloc(sizeof(MIGCOLDATA), src_numcols); if (!srcdata) { fprintf(stderr, "Could not allocate memory for srcdata\n"); return FALSE; } for (col = 0; col < src_numcols; col++) { /* Find out if there is an identity column. */ colinfo.SizeOfStruct = sizeof(colinfo); if (dbtablecolinfo(dbsrc, col+1, (DBCOL *) &colinfo) != SUCCEED) { free(srcdata); return FALSE; } if (colinfo.Identity) identity_column_exists = TRUE; srcdata[col].coltype = dbcoltype(dbsrc, col + 1); switch (srcdata[col].coltype) { case SYBBIT: case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBREAL: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBTIME: case SYBDATE: case SYBBIGTIME: case SYBBIGDATETIME: case SYBCHAR: case SYBTEXT: case SYBBINARY: case SYBIMAGE: case SYBNUMERIC: case SYBDECIMAL: break; default: fprintf(stderr, "Type %d not handled by datacopy\n", srcdata[col].coltype); exit(1); } } /* Take appropriate action if there's an identity column and we've been asked to preserve identity values. */ if (params->Eflag && identity_column_exists) bcp_control(dbdest, BCPKEEPIDENTITY, 1); gettimeofday(&start_time, 0); while (dbnextrow(dbsrc) != NO_MORE_ROWS) { rows_read++; for (col = 0; col < src_numcols; col++) { BYTE *data = dbdata(dbsrc, col + 1); switch (srcdata[col].coltype) { case SYBBIT: case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBREAL: case SYBDATETIME: case SYBDATETIME4: case SYBTIME: case SYBDATE: case SYBBIGTIME: case SYBBIGDATETIME: case SYBMONEY: case SYBMONEY4: case SYBCHAR: case SYBTEXT: case SYBBINARY: case SYBIMAGE: case SYBNUMERIC: case SYBDECIMAL: bcp_colptr(dbdest, data, col + 1); if (data == NULL) { /* NULL data retrieved from source */ bcp_collen(dbdest, 0, col + 1); } else { bcp_collen(dbdest, dbdatlen(dbsrc, col + 1), col + 1); } break; default: fprintf(stderr, "Type %d not handled by datacopy\n", srcdata[col].coltype); exit(1); } } if (bcp_sendrow(dbdest) == FAIL) { fprintf(stderr, "bcp_sendrow failed. \n"); free(srcdata); return FALSE; } else { rows_sent++; if (rows_sent == params->batchsize) { ret = bcp_batch(dbdest); if (ret == -1) { printf("bcp_batch error\n"); free(srcdata); return FALSE; } else { rows_done += ret; printf("%d rows successfully copied (total %d)\n", ret, rows_done); rows_sent = 0; } } } } if (rows_read) { ret = bcp_done(dbdest); if (ret == -1) { fprintf(stderr, "bcp_done failed. \n"); free(srcdata); return FALSE; } else { rows_done += ret; } } gettimeofday(&end_time, 0); elapsed_time = (double) (end_time.tv_sec - start_time.tv_sec) + ((double) (end_time.tv_usec - start_time.tv_usec) / 1000000.00); if (params->vflag) { printf("\n"); printf("rows read : %d\n", rows_read); printf("rows written : %d\n", rows_done); printf("elapsed time (secs) : %f\n", elapsed_time); printf("rows per second : %f\n", rows_done / elapsed_time); } free(srcdata); return TRUE; } static void pusage(void) { fprintf(stderr, "usage: datacopy [-t | -a | -c owner] [-b batchsize] [-p packetsize] [-T textsize] [-v] [-d] [-E]\n"); fprintf(stderr, " [-S server/username/password/database/table]\n"); fprintf(stderr, " [-D server/username/password/database/table]\n"); fprintf(stderr, " -t : truncate target table before loading data\n"); fprintf(stderr, " -a : append data to target table\n"); fprintf(stderr, " -c : create table owner.table before loading data\n"); fprintf(stderr, " -b : alter the number of records in each bcp batch\n"); fprintf(stderr, " (larger batch size = faster)\n"); fprintf(stderr, " -p : alter the default TDS packet size from the default\n"); fprintf(stderr, " (larger packet size = faster)\n"); fprintf(stderr, " -T : Text and image size\n"); fprintf(stderr, " -E : keep identity values\n"); fprintf(stderr, " -v : produce verbose output (timings etc.)\n"); fprintf(stderr, " -d : produce TDS DUMP log (serious debug only!)\n"); } static int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { if (dberr) { fprintf(stderr, "Msg %d, Level %d\n", dberr, severity); fprintf(stderr, "%s\n\n", dberrstr); } else { fprintf(stderr, "DB-LIBRARY error:\n\t"); fprintf(stderr, "%s\n", dberrstr); } return INT_CANCEL; } static int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { /* * If it's a database change message, we'll ignore it. * Also ignore language change message. */ if (msgno == 5701 || msgno == 5703) return 0; printf("Msg %ld, Level %d, State %d\n", (long int) msgno, severity, msgstate); if (strlen(srvname) > 0) printf("Server '%s', ", srvname); if (strlen(procname) > 0) printf("Procedure '%s', ", procname); if (line > 0) printf("Line %d", line); printf("\n\t%s\n", msgtext); return 0; } freetds-1.3.6/src/apps/defncopy.c000644 025423 025423 00000056024 14155605621 020324 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004-2011 James K. Lowden * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifdef MicrosoftsDbLib #ifdef _WIN32 # pragma warning( disable : 4142 ) # include "win32.microsoft/have.h" # include "../../include/replacements.win32.hacked.h" int getopt(int argc, const char *argv[], char *optstring); # ifndef DBNTWIN32 # define DBNTWIN32 /* * As of Visual Studio .NET 2003, define WIN32_LEAN_AND_MEAN to avoid redefining LPCBYTE in sqlfront.h * Unless it was already defined, undefine it after windows.h has been included. * (windows.h includes a bunch of stuff needed by sqlfront.h. Bleh.) */ # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN_DEFINED_HERE # endif # include # ifdef WIN32_LEAN_AND_MEAN_DEFINED_HERE # undef WIN32_LEAN_AND_MEAN_DEFINED_HERE # undef WIN32_LEAN_AND_MEAN # endif # include # include # include #endif /* DBNTWIN32 */ # include "win32.microsoft/syb2ms.h" #endif #endif /* MicrosoftsDbLib */ #include #include #include #if HAVE_ERRNO_H #include #endif #if HAVE_UNISTD_H #include #endif #if HAVE_STDLIB_H #include #endif #if HAVE_STRING_H #include #endif #if HAVE_LIBGEN_H #include #endif #if HAVE_LOCALE_H #include #endif #include #include #ifndef MicrosoftsDbLib #include #else #ifndef _WIN32 # include #endif #endif /* MicrosoftsDbLib */ #include #include #include #include #ifndef MicrosoftsDbLib static int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); static int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); #else static int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, const char dberrstr[], const char oserrstr[]); static int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, const char msgtext[], const char srvname[], const char procname[], unsigned short int line); #endif /* MicrosoftsDbLib */ typedef struct _options { int optind; char *servername, *database, *appname, hostname[128], *input_filename, *output_filename; } OPTIONS; typedef struct _procedure { char name[512], owner[512]; } PROCEDURE; static int print_ddl(DBPROCESS *dbproc, PROCEDURE *procedure); static int print_results(DBPROCESS *dbproc); static LOGINREC* get_login(int argc, char *argv[], OPTIONS *poptions); static void parse_argument(const char argument[], PROCEDURE* procedure); static void usage(const char invoked_as[]); static char *rtrim(char *s); static char *ltrim(char *s); /* global variables */ static OPTIONS options; static char use_statement[512]; /* end global variables */ /** * The purpose of this program is to load or extract the text of a stored procedure. * This first cut does extract only. * TODO: support loading procedures onto the server. */ int main(int argc, char *argv[]) { LOGINREC *login; DBPROCESS *dbproc; PROCEDURE procedure; RETCODE erc; int i, nrows; setlocale(LC_ALL, ""); #ifdef __VMS /* Convert VMS-style arguments to Unix-style */ parse_vms_args(&argc, &argv); #endif /* Initialize db-lib */ #if _WIN32 && defined(MicrosoftsDbLib) LPCSTR msg = dbinit(); if (msg == NULL) { #else erc = dbinit(); if (erc == FAIL) { #endif /* MicrosoftsDbLib */ fprintf(stderr, "%s:%d: dbinit() failed\n", options.appname, __LINE__); exit(1); } memset(&options, 0, sizeof(options)); login = get_login(argc, argv, &options); /* get command-line parameters and call dblogin() */ assert(login != NULL); /* Install our error and message handlers */ dberrhandle(err_handler); dbmsghandle(msg_handler); /* * Override stdin, stdout, and stderr, as required */ if (options.input_filename) { if (freopen(options.input_filename, "rb", stdin) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.input_filename, strerror(errno)); exit(1); } } if (options.output_filename) { if (freopen(options.output_filename, "wb", stdout) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", options.appname, options.output_filename, strerror(errno)); exit(1); } } /* Select the specified database, if any */ if (options.database) DBSETLDBNAME(login, options.database); /* * Connect to the server */ dbproc = dbopen(login, options.servername); if (!dbproc) { fprintf(stderr, "There was a problem connecting to the server.\n"); exit(1); } /* * Read the procedure names and move their texts. */ for (i=options.optind; i < argc; i++) { #ifndef MicrosoftsDbLib static const char query[] = " select c.text" #else static const char query[] = " select cast(c.text as text)" #endif /* MicrosoftsDbLib */ ", number " " from syscomments c," " sysobjects o" " where o.id = c.id" " and o.name = '%s'" " and o.uid = user_id('%s')" " and o.type not in ('U', 'S')" /* no user or system tables */ " order by c.number, %sc.colid" ; static const char query_table[] = " execute sp_help '%s.%s' "; parse_argument(argv[i], &procedure); erc = dbfcmd(dbproc, query, procedure.name, procedure.owner, (DBTDS(dbproc) == DBTDS_5_0) ? "c.colid2, ":""); /* Send the query to the server (we could use dbsqlexec(), instead) */ erc = dbsqlsend(dbproc); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbsqlsend() failed\n", options.appname, __LINE__); exit(1); } /* Wait for it to execute */ erc = dbsqlok(dbproc); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbsqlok() failed\n", options.appname, __LINE__); exit(1); } /* Write the output */ nrows = print_results(dbproc); if (0 == nrows) { erc = dbfcmd(dbproc, query_table, procedure.owner, procedure.name); assert(SUCCEED == erc); erc = dbsqlexec(dbproc); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbsqlexec() failed\n", options.appname, __LINE__); exit(1); } nrows = print_ddl(dbproc, &procedure); } switch (nrows) { case -1: return 1; case 0: fprintf(stderr, "%s: error: %s.%s.%s.%s not found\n", options.appname, options.servername, options.database, procedure.owner, procedure.name); return 2; default: break; } } return 0; } static void parse_argument(const char argument[], PROCEDURE* procedure) { const char *s = strchr(argument, '.'); if (s) { size_t len = s - argument; if (len > sizeof(procedure->owner) - 1) len = sizeof(procedure->owner) - 1; memcpy(procedure->owner, argument, len); procedure->owner[len] = '\0'; strlcpy(procedure->name, s+1, sizeof(procedure->name)); } else { strcpy(procedure->owner, "dbo"); strlcpy(procedure->name, argument, sizeof(procedure->name)); } } static char * rtrim(char *s) { char *p = strchr(s, '\0'); while (--p >= s && *p == ' ') ; *(p + 1) = '\0'; return s; } static char * ltrim(char *s) { char *p = s; while (*p == ' ') ++p; memmove(s, p, strlen(p) + 1); return s; } static bool is_in(const char *item, const char *list) { const size_t item_len = strlen(item); for (;;) { size_t len = strlen(list); if (len == 0) return false; if (len == item_len && strcasecmp(item, list) == 0) return true; list += len + 1; } } /* * Get the table information from sp_help, because it's easier to get the index information (eventually). * The column descriptions are in resultset #2, which is where we start. * As shown below, sp_help returns different columns for resultset #2, so we build a map. * Sybase Microsoft * ----------------- ---------------- * 1. Column_name Column_name * 2. Type Type * 3. Computed * 4. Length Length * 5. Prec Prec * 6. Scale Scale * 7. Nulls Nullable * 8. Default_name TrimTrail * 9. Rule_name FixedLenNullIn * 10. Access_Rule_name Collation * 11. Identity */ static int print_ddl(DBPROCESS *dbproc, PROCEDURE *procedure) { struct DDL { char *name, *type, *length, *precision, *scale, *nullable; } *ddl = NULL; static const char *const colmap_names[6] = { "column_name\0", "type\0", "length\0", "prec\0", "scale\0", "nulls\0nullable\0", }; int colmap[TDS_VECTOR_SIZE(colmap_names)]; FILE *create_index; RETCODE erc; int row_code, iresultset, i, ret; int maxnamelen = 0, nrows = 0; char **p_str; create_index = tmpfile(); assert(dbproc); assert(procedure); assert(create_index); /* sp_help returns several result sets. We want just the second one, for now */ for (iresultset=1; (erc = dbresults(dbproc)) != NO_MORE_RESULTS; iresultset++) { if (erc == FAIL) { fprintf(stderr, "%s:%d: dbresults(), result set %d failed\n", options.appname, __LINE__, iresultset); goto cleanup; } /* Get the data */ while ((row_code = dbnextrow(dbproc)) != NO_MORE_ROWS) { struct DDL *p; char **coldesc[sizeof(struct DDL)/sizeof(char*)]; /* an array of pointers to the DDL elements */ assert(row_code == REG_ROW); /* Look for index data */ if (0 == strcmp("index_name", dbcolname(dbproc, 1))) { char *index_name, *index_description, *index_keys, *p, fprimary=0; DBINT datlen; assert(dbnumcols(dbproc) >=3 ); /* column had better be in range */ /* name */ datlen = dbdatlen(dbproc, 1); index_name = (char *) calloc(1, 1 + datlen); assert(index_name); memcpy(index_name, dbdata(dbproc, 1), datlen); /* kind */ datlen = dbdatlen(dbproc, 2); index_description = (char *) calloc(1, 1 + datlen); assert(index_description); memcpy(index_description, dbdata(dbproc, 2), datlen); /* columns */ datlen = dbdatlen(dbproc, 3); index_keys = (char *) calloc(1, 1 + datlen); assert(index_keys); memcpy(index_keys, dbdata(dbproc, 3), datlen); /* fix up the index attributes; we're going to use the string verbatim (almost). */ p = strstr(index_description, "located"); if (p) { *p = '\0'; /* we don't care where it's located */ } /* Microsoft version: [non]clustered[, unique][, primary key] located on PRIMARY */ p = strstr(index_description, "primary key"); if (p) { fprimary = 1; *p = '\0'; /* we don't care where it's located */ if ((p = strchr(index_description, ',')) != NULL) *p = '\0'; /* we use only the first term (clustered/nonclustered) */ } else { /* reorder "unique" and "clustered" */ char nonclustered[] = "nonclustered", unique[] = "unique"; char *pclustering = nonclustered; if (NULL == strstr(index_description, pclustering)) { pclustering += 3; if (NULL == strstr(index_description, pclustering)) *pclustering = '\0'; } if (NULL == strstr(index_description, unique)) unique[0] = '\0'; sprintf(index_description, "%s %s", unique, pclustering); } /* Put it to a temporary file; we'll print it after the CREATE TABLE statement. */ if (fprimary) { fprintf(create_index, "ALTER TABLE %s.%s ADD CONSTRAINT %s PRIMARY KEY %s (%s)\nGO\n\n", procedure->owner, procedure->name, index_name, index_description, index_keys); } else { fprintf(create_index, "CREATE %s INDEX %s on %s.%s(%s)\nGO\n\n", index_description, index_name, procedure->owner, procedure->name, index_keys); } free(index_name); free(index_description); free(index_keys); continue; } /* skip other resultsets that don't describe the table's columns */ if (0 != strcasecmp("Column_name", dbcolname(dbproc, 1))) continue; /* Find the columns we need */ for (i = 0; i < TDS_VECTOR_SIZE(colmap); ++i) colmap[i] = -1; for (i = 1; i <= dbnumcols(dbproc); ++i) { const char *name = dbcolname(dbproc, i); int j; for (j = 0; j < TDS_VECTOR_SIZE(colmap); ++j) { if (is_in(name, colmap_names[j])) { colmap[j] = i; break; } } } for (i = 0; i < TDS_VECTOR_SIZE(colmap); ++i) { if (colmap[i] == -1) { fprintf(stderr, "Expected column name %s not found\n", colmap_names[i]); exit(1); } } /* Make room for the next row */ p = (struct DDL *) realloc(ddl, ++nrows * sizeof(struct DDL)); if (p == NULL) { perror("error: insufficient memory for row DDL"); assert(p != NULL); exit(1); } ddl = p; /* take the address of each member, so we can loop through them */ coldesc[0] = &ddl[nrows-1].name; coldesc[1] = &ddl[nrows-1].type; coldesc[2] = &ddl[nrows-1].length; coldesc[3] = &ddl[nrows-1].precision; coldesc[4] = &ddl[nrows-1].scale; coldesc[5] = &ddl[nrows-1].nullable; for( i=0; i < sizeof(struct DDL)/sizeof(char*); i++) { const int col_index = colmap[i]; const DBINT datlen = dbdatlen(dbproc, col_index); const int type = dbcoltype(dbproc, col_index); assert(datlen >= 0); /* column had better be in range */ if (datlen == 0) { *coldesc[i] = NULL; continue; } if (type == SYBCHAR || type == SYBVARCHAR) { *coldesc[i] = (char *) calloc(1, 1 + datlen); /* calloc will null terminate */ if (!*coldesc[i]) { perror("error: insufficient memory for row detail"); exit(1); } memcpy(*coldesc[i], dbdata(dbproc, col_index), datlen); } else { char buf[256]; DBINT len = dbconvert(dbproc, type, dbdata(dbproc, col_index), datlen, SYBVARCHAR, (BYTE *) buf, -1); if (len < 0) { fprintf(stderr, "Error converting column to char"); exit(1); } *coldesc[i] = strdup(buf); if (!*coldesc[i]) { perror("error: insufficient memory for row detail"); exit(1); } } /* * maxnamelen will determine how much room we allow for column names * in the CREATE TABLE statement */ if (i == 0) maxnamelen = (maxnamelen > datlen)? maxnamelen : datlen; } } /* wend */ } /* * We've collected the description for the columns in the 'ddl' array. * Now we'll print the CREATE TABLE statement in jkl's preferred format. */ if (nrows == 0) goto cleanup; printf("%sCREATE TABLE %s.%s\n", use_statement, procedure->owner, procedure->name); for (i=0; i < nrows; i++) { static const char *varytypenames[] = { "char" , "nchar" , "varchar" , "nvarchar" , "unichar" , "univarchar" , "binary" , "varbinary" , NULL }; const char **t; char *type = NULL; int is_null; /* get size of decimal, numeric, char, and image types */ ret = 0; if (0 == strcasecmp("decimal", ddl[i].type) || 0 == strcasecmp("numeric", ddl[i].type)) { if (ddl[i].precision && 0 != strcasecmp("NULL", ddl[i].precision)) { rtrim(ddl[i].precision); rtrim(ddl[i].scale); ret = asprintf(&type, "%s(%s,%s)", ddl[i].type, ddl[i].precision, ddl[i].scale); } } else { for (t = varytypenames; *t; t++) { if (0 == strcasecmp(*t, ddl[i].type)) { ltrim(rtrim(ddl[i].length)); if (strcmp(ddl[i].length, "-1") == 0) ret = asprintf(&type, "%s(max)", ddl[i].type); else ret = asprintf(&type, "%s(%s)", ddl[i].type, ddl[i].length); break; } } } assert(ret >= 0); is_null = is_in(ddl[i].nullable, "1\0yes\0"); /* {(|,} name type [NOT] NULL */ printf("\t%c %-*s %-15s %3s NULL\n", (i==0? '(' : ','), maxnamelen, ddl[i].name, (type? type : ddl[i].type), (is_null? "" : "NOT")); free(type); } printf("\t)\nGO\n\n"); /* print the CREATE INDEX statements */ rewind(create_index); while ((i = fgetc(create_index)) != EOF) { fputc(i, stdout); } cleanup: p_str = (char **) ddl; for (i=0; i < nrows * (sizeof(struct DDL)/sizeof(char*)); ++i) free(p_str[i]); free(ddl); fclose(create_index); return nrows; } static int /* return count of SQL text rows */ print_results(DBPROCESS *dbproc) { RETCODE erc; int row_code; int iresultset; int nrows=0; int prior_procedure_number=1; /* bound variables */ enum column_id { ctext=1, number=2 }; char sql_text[16002]; int sql_text_status; int procedure_number; /* for create proc abc;2 */ int procedure_number_status; /* * Set up each result set with dbresults() */ for (iresultset=1; (erc = dbresults(dbproc)) != NO_MORE_RESULTS; iresultset++) { if (erc == FAIL) { fprintf(stderr, "%s:%d: dbresults(), result set %d failed\n", options.appname, __LINE__, iresultset); return -1; } if (SUCCEED != DBROWS(dbproc)) { return 0; } /* * Bind the columns to our variables. */ if (sizeof(sql_text) <= dbcollen(dbproc, ctext) ) { assert(sizeof(sql_text) > dbcollen(dbproc, ctext)); return 0; } erc = dbbind(dbproc, ctext, STRINGBIND, 0, (BYTE *) sql_text); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbbind(), column %d failed\n", options.appname, __LINE__, ctext); return -1; } erc = dbnullbind(dbproc, ctext, &sql_text_status); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbnullbind(), column %d failed\n", options.appname, __LINE__, ctext); return -1; } erc = dbbind(dbproc, number, INTBIND, -1, (BYTE *) &procedure_number); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbbind(), column %d failed\n", options.appname, __LINE__, number); return -1; } erc = dbnullbind(dbproc, number, &procedure_number_status); if (erc == FAIL) { fprintf(stderr, "%s:%d: dbnullbind(), column %d failed\n", options.appname, __LINE__, number); return -1; } /* * Print the data to stdout. */ printf("%s", use_statement); for (;(row_code = dbnextrow(dbproc)) != NO_MORE_ROWS; nrows++, prior_procedure_number = procedure_number) { switch (row_code) { case REG_ROW: if ( -1 == sql_text_status) { fprintf(stderr, "defncopy: error: unexpected NULL row in SQL text\n"); } else { if (prior_procedure_number != procedure_number) printf("\nGO\n"); printf("%s", sql_text); } break; case BUF_FULL: default: fprintf(stderr, "defncopy: error: expected REG_ROW (%d), got %d instead\n", REG_ROW, row_code); assert(row_code == REG_ROW); break; } /* row_code */ } /* wend dbnextrow */ printf("\nGO\n"); } /* wend dbresults */ return nrows; } static void usage(const char invoked_as[]) { fprintf(stderr, "usage: %s \n" " [-U username] [-P password]\n" " [-S servername] [-D database]\n" " [-i input filename] [-o output filename]\n" " [owner.]object_name [[owner.]object_name...]\n" , invoked_as); /** defncopy Syntax Error Usage: defncopy [-v] [-X] -- [-a ] -- [-I ] -- [-J []] -- [-K ] [-P ] -- [-R ] [-S []] [-U ] -- [-V ] -- [-Z ] -- [-z ] { in | out [.] [[.]...] } **/ } static LOGINREC * get_login(int argc, char *argv[], OPTIONS *options) { LOGINREC *login; char *password; int ch; int fdomain = TRUE; extern char *optarg; extern int optind; assert(options && argv); options->appname = basename(argv[0]); login = dblogin(); if (!login) { fprintf(stderr, "%s: unable to allocate login structure\n", options->appname); exit(1); } DBSETLAPP(login, options->appname); if (-1 != gethostname(options->hostname, sizeof(options->hostname))) { DBSETLHOST(login, options->hostname); } while ((ch = getopt(argc, argv, "U:P:S:d:D:i:o:v")) != -1) { switch (ch) { case 'U': DBSETLUSER(login, optarg); fdomain = FALSE; break; case 'P': password = tds_getpassarg(optarg); DBSETLPWD(login, password); memset(password, 0, strlen(password)); free(password); password = NULL; fdomain = FALSE; break; case 'S': options->servername = strdup(optarg); break; case 'd': case 'D': options->database = strdup(optarg); break; case 'i': options->input_filename = strdup(optarg); break; case 'o': options->output_filename = strdup(optarg); break; case 'v': printf("%s\n\n%s", argv[0], "Copyright (C) 2004 James K. Lowden\n" "This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public\n" "License as published by the Free Software Foundation\n"); exit(1); break; case '?': default: usage(options->appname); exit(1); } } #if defined(MicrosoftsDbLib) && defined(_WIN32) if (fdomain) DBSETLSECURE(login); #else if (fdomain) DBSETLNETWORKAUTH(login, TRUE); #endif /* MicrosoftsDbLib */ if (!options->servername) { usage(options->appname); exit(1); } options->optind = optind; return login; } static int #ifndef MicrosoftsDbLib err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) #else err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, const char dberrstr[], const char oserrstr[]) #endif /* MicrosoftsDbLib */ { if (dberr) { fprintf(stderr, "%s: Msg %d, Level %d\n", options.appname, dberr, severity); fprintf(stderr, "%s\n\n", dberrstr); } else { fprintf(stderr, "%s: DB-LIBRARY error:\n\t", options.appname); fprintf(stderr, "%s\n", dberrstr); } return INT_CANCEL; } static int #ifndef MicrosoftsDbLib msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) #else msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, const char msgtext[], const char srvname[], const char procname[], unsigned short int line) #endif /* MicrosoftsDbLib */ { char *dbname, *endquote; switch (msgno) { case 5701: /* Print "USE dbname" for "Changed database context to 'dbname'" */ dbname = strchr(msgtext, '\''); if (!dbname) break; endquote = strchr(++dbname, '\''); if (!endquote) break; *endquote = '\0'; sprintf(use_statement, "USE %s\nGO\n\n", dbname); return 0; case 0: /* Ignore print messages */ case 5703: /* Ignore "Changed language setting to ". */ return 0; default: break; } #if 0 printf("Msg %ld, Severity %d, State %d\n", (long) msgno, severity, msgstate); if (strlen(srvname) > 0) printf("Server '%s', ", srvname); if (strlen(procname) > 0) printf("Procedure '%s', ", procname); if (line > 0) printf("Line %d", line); #endif printf("\t/* %s */\n", msgtext); return 0; } freetds-1.3.6/src/apps/freebcp.c000644 025423 025423 00000046742 14056414271 020130 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ /* These should be in stdlib */ #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STRINGS_H #include #endif /* HAVE_STRINGS_H */ #if HAVE_UNISTD_H #include #endif #if HAVE_LOCALE_H #include #endif #include #include #include #include #include #include "freebcp.h" void pusage(void); int process_parameters(int, char **, struct pd *); static int unescape(char arg[]); int login_to_database(struct pd *, DBPROCESS **); int file_character(BCPPARAMDATA * pdata, DBPROCESS * dbproc, DBINT dir); int file_native(BCPPARAMDATA * pdata, DBPROCESS * dbproc, DBINT dir); int file_formatted(BCPPARAMDATA * pdata, DBPROCESS * dbproc, DBINT dir); int setoptions (DBPROCESS * dbproc, BCPPARAMDATA * params); int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); static int set_bcp_hints(BCPPARAMDATA *pdata, DBPROCESS *pdbproc); int main(int argc, char **argv) { BCPPARAMDATA params; DBPROCESS *dbproc; int ok = FALSE; setlocale(LC_ALL, ""); #ifdef __VMS /* Convert VMS-style arguments to Unix-style */ parse_vms_args(&argc, &argv); #endif memset(¶ms, '\0', sizeof(params)); params.textsize = 4096; /* our default text size is 4K */ if (process_parameters(argc, argv, ¶ms) == FALSE) { exit(EXIT_FAILURE); } if (getenv("FREEBCP")) { fprintf(stderr, "User name: \"%s\"\n", params.user); } if (login_to_database(¶ms, &dbproc) == FALSE) { exit(EXIT_FAILURE); } if (!setoptions(dbproc, ¶ms)) return FALSE; if (params.cflag) { /* character format file */ ok = file_character(¶ms, dbproc, params.direction); } else if (params.nflag) { /* native format file */ ok = file_native(¶ms, dbproc, params.direction); } else if (params.fflag) { /* formatted file */ ok = file_formatted(¶ms, dbproc, params.direction); } else { ok = FALSE; } exit((ok == TRUE) ? EXIT_SUCCESS : EXIT_FAILURE); return 0; } static int unescape(char arg[]) { char *p = arg, *next; char escaped; while ((next = strchr(p, '\\')) != NULL) { p = next; switch (p[1]) { case '0': escaped = '\0'; break; case 't': escaped = '\t'; break; case 'r': escaped = '\r'; break; case 'n': escaped = '\n'; break; case '\\': escaped = '\\'; break; default: ++p; continue; } /* Overwrite the backslash with the intended character, and shift everything down one */ *p++ = escaped; memmove(p, p+1, 1 + strlen(p+1)); } return strchr(p, 0) - arg; } int process_parameters(int argc, char **argv, BCPPARAMDATA *pdata) { extern char *optarg; extern int optind; extern int optopt; int ch; if (argc < 6) { pusage(); return (FALSE); } /* * Set some defaults and read the table, file, and direction arguments. */ pdata->firstrow = 0; pdata->lastrow = 0; pdata->batchsize = 1000; pdata->maxerrors = 10; /* argument 1 - the database object */ pdata->dbobject = strdup(argv[1]); if (pdata->dbobject == NULL) { fprintf(stderr, "Out of memory!\n"); return FALSE; } /* argument 2 - the direction */ strlcpy(pdata->dbdirection, argv[2], sizeof(pdata->dbdirection)); if (strcasecmp(pdata->dbdirection, "in") == 0) { pdata->direction = DB_IN; } else if (strcasecmp(pdata->dbdirection, "out") == 0) { pdata->direction = DB_OUT; } else if (strcasecmp(pdata->dbdirection, "queryout") == 0) { pdata->direction = DB_QUERYOUT; } else { fprintf(stderr, "Copy direction must be either 'in', 'out' or 'queryout'.\n"); return (FALSE); } /* argument 3 - the datafile name */ free(pdata->hostfilename); pdata->hostfilename = strdup(argv[3]); /* * Get the rest of the arguments */ optind = 4; /* start processing options after table, direction, & filename */ while ((ch = getopt(argc, argv, "m:f:e:F:L:b:t:r:U:P:i:I:S:h:T:A:o:O:0:C:ncEdvVD:")) != -1) { switch (ch) { case 'v': case 'V': printf("freebcp version %s\n", TDS_VERSION_NO); return FALSE; break; case 'm': pdata->mflag++; pdata->maxerrors = atoi(optarg); break; case 'f': pdata->fflag++; free(pdata->formatfile); pdata->formatfile = strdup(optarg); break; case 'e': pdata->eflag++; pdata->errorfile = strdup(optarg); break; case 'F': pdata->Fflag++; pdata->firstrow = atoi(optarg); break; case 'L': pdata->Lflag++; pdata->lastrow = atoi(optarg); break; case 'b': pdata->bflag++; pdata->batchsize = atoi(optarg); break; case 'n': pdata->nflag++; break; case 'c': pdata->cflag++; break; case 'E': pdata->Eflag++; break; case 'd': tdsdump_open("stderr"); break; case 't': pdata->tflag++; pdata->fieldterm = strdup(optarg); pdata->fieldtermlen = unescape(pdata->fieldterm); break; case 'r': pdata->rflag++; pdata->rowterm = strdup(optarg); pdata->rowtermlen = unescape(pdata->rowterm); break; case 'U': pdata->Uflag++; pdata->user = strdup(optarg); break; case 'P': pdata->Pflag++; pdata->pass = tds_getpassarg(optarg); break; case 'i': free(pdata->inputfile); pdata->inputfile = strdup(optarg); break; case 'I': pdata->Iflag++; free(pdata->interfacesfile); pdata->interfacesfile = strdup(optarg); break; case 'S': pdata->Sflag++; pdata->server = strdup(optarg); break; case 'D': pdata->dbname = strdup(optarg); break; case 'h': pdata->hint = strdup(optarg); break; case 'o': free(pdata->outputfile); pdata->outputfile = strdup(optarg); break; case 'O': case '0': pdata->options = strdup(optarg); break; case 'T': pdata->Tflag++; pdata->textsize = atoi(optarg); break; case 'A': pdata->Aflag++; pdata->packetsize = atoi(optarg); break; case 'C': pdata->charset = strdup(optarg); break; case '?': default: pusage(); return (FALSE); } } /* * Check for required/disallowed option combinations * If no username is provided, rely on domain login. */ /* Server */ if (!pdata->Sflag) { if ((pdata->server = getenv("DSQUERY")) != NULL) { pdata->server = strdup(pdata->server); /* can be freed */ pdata->Sflag++; } else { fprintf(stderr, "-S must be supplied.\n"); return (FALSE); } } /* Only one of these can be specified */ if (pdata->cflag + pdata->nflag + pdata->fflag != 1) { fprintf(stderr, "Exactly one of options -c, -n, -f must be supplied.\n"); return (FALSE); } /* Character mode file: fill in default values */ if (pdata->cflag) { if (!pdata->tflag || !pdata->fieldterm) { /* field terminator not specified */ pdata->fieldterm = "\t"; pdata->fieldtermlen = 1; } if (!pdata->rflag || !pdata->rowterm) { /* row terminator not specified */ pdata->rowterm = "\n"; pdata->rowtermlen = 1; } } /* * Override stdin and/or stdout if requested. */ /* FIXME -- Since we don't implement prompting for field data types when neither -c nor -n * is specified, redirecting stdin doesn't do much yet. */ if (pdata->inputfile) { if (freopen(pdata->inputfile, "rb", stdin) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", "freebcp", pdata->inputfile, strerror(errno)); exit(EXIT_FAILURE); } } if (pdata->outputfile) { if (freopen(pdata->outputfile, "wb", stdout) == NULL) { fprintf(stderr, "%s: unable to open %s: %s\n", "freebcp", pdata->outputfile, strerror(errno)); exit(EXIT_FAILURE); } } return (TRUE); } int login_to_database(BCPPARAMDATA * pdata, DBPROCESS ** pdbproc) { LOGINREC *login; /* Initialize DB-Library. */ if (dbinit() == FAIL) return (FALSE); /* * Install the user-supplied error-handling and message-handling * routines. They are defined at the bottom of this source file. */ dberrhandle(err_handler); dbmsghandle(msg_handler); /* If the interfaces file was specified explicitly, set it. */ if (pdata->interfacesfile != NULL) dbsetifile(pdata->interfacesfile); /* * Allocate and initialize the LOGINREC structure to be used * to open a connection to SQL Server. */ login = dblogin(); if (!login) return FALSE; if (pdata->user) DBSETLUSER(login, pdata->user); if (pdata->pass) { DBSETLPWD(login, pdata->pass); memset(pdata->pass, 0, strlen(pdata->pass)); } DBSETLAPP(login, "FreeBCP"); if (pdata->charset) DBSETLCHARSET(login, pdata->charset); if (pdata->Aflag && pdata->packetsize > 0) { DBSETLPACKET(login, pdata->packetsize); } if (pdata->dbname) DBSETLDBNAME(login, pdata->dbname); /* Enable bulk copy for this connection. */ BCP_SETL(login, TRUE); /* * Get a connection to the database. */ if ((*pdbproc = dbopen(login, pdata->server)) == NULL) { fprintf(stderr, "Can't connect to server \"%s\".\n", pdata->server); dbloginfree(login); return (FALSE); } dbloginfree(login); login = NULL; return (TRUE); } int file_character(BCPPARAMDATA * pdata, DBPROCESS * dbproc, DBINT dir) { DBINT li_rowsread = 0; int i; int li_numcols = 0; RETCODE ret_code = 0; if (FAIL == bcp_init(dbproc, pdata->dbobject, pdata->hostfilename, pdata->errorfile, dir)) return FALSE; if (!set_bcp_hints(pdata, dbproc)) return FALSE; if (pdata->Eflag) { bcp_control(dbproc, BCPKEEPIDENTITY, 1); if (dbfcmd(dbproc, "set identity_insert %s on", pdata->dbobject) == FAIL) { fprintf(stderr, "dbfcmd failed\n"); return FALSE; } if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "dbsqlexec failed\n"); return FALSE; } while (NO_MORE_RESULTS != dbresults(dbproc)) continue; } bcp_control(dbproc, BCPFIRST, pdata->firstrow); bcp_control(dbproc, BCPLAST, pdata->lastrow); bcp_control(dbproc, BCPMAXERRS, pdata->maxerrors); if (dir == DB_QUERYOUT) { if (dbfcmd(dbproc, "SET FMTONLY ON %s SET FMTONLY OFF", pdata->dbobject) == FAIL) { fprintf(stderr, "dbfcmd failed\n"); return FALSE; } } else { if (dbfcmd(dbproc, "SET FMTONLY ON select * from %s SET FMTONLY OFF", pdata->dbobject) == FAIL) { fprintf(stderr, "dbfcmd failed\n"); return FALSE; } } if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "dbsqlexec failed\n"); return FALSE; } while (NO_MORE_RESULTS != (ret_code = dbresults(dbproc))) { if (ret_code == SUCCEED && li_numcols == 0) { li_numcols = dbnumcols(dbproc); } } if (0 == li_numcols) { fprintf(stderr, "Error in dbnumcols\n"); return FALSE; } if (bcp_columns(dbproc, li_numcols) == FAIL) { fprintf(stderr, "Error in bcp_columns.\n"); return FALSE; } for (i = 1; i < li_numcols; ++i) { if (bcp_colfmt(dbproc, i, SYBCHAR, 0, -1, (const BYTE *) pdata->fieldterm, pdata->fieldtermlen, i) == FAIL) { fprintf(stderr, "Error in bcp_colfmt col %d\n", i); return FALSE; } } if (bcp_colfmt(dbproc, li_numcols, SYBCHAR, 0, -1, (const BYTE *) pdata->rowterm, pdata->rowtermlen, li_numcols) == FAIL) { fprintf(stderr, "Error in bcp_colfmt col %d\n", li_numcols); return FALSE; } bcp_control(dbproc, BCPBATCH, pdata->batchsize); printf("\nStarting copy...\n"); if (FAIL == bcp_exec(dbproc, &li_rowsread)) { fprintf(stderr, "bcp copy %s failed\n", (dir == DB_IN) ? "in" : "out"); return FALSE; } printf("%d rows copied.\n", li_rowsread); return TRUE; } int file_native(BCPPARAMDATA * pdata, DBPROCESS * dbproc, DBINT dir) { DBINT li_rowsread = 0; int i; int li_numcols = 0; int li_coltype; RETCODE ret_code = 0; if (FAIL == bcp_init(dbproc, pdata->dbobject, pdata->hostfilename, pdata->errorfile, dir)) return FALSE; if (!set_bcp_hints(pdata, dbproc)) return FALSE; if (pdata->Eflag) { bcp_control(dbproc, BCPKEEPIDENTITY, 1); if (dbfcmd(dbproc, "set identity_insert %s on", pdata->dbobject) == FAIL) { fprintf(stderr, "dbfcmd failed\n"); return FALSE; } if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "dbsqlexec failed\n"); return FALSE; } while (NO_MORE_RESULTS != dbresults(dbproc)) continue; } bcp_control(dbproc, BCPFIRST, pdata->firstrow); bcp_control(dbproc, BCPLAST, pdata->lastrow); bcp_control(dbproc, BCPMAXERRS, pdata->maxerrors); if (dir == DB_QUERYOUT) { if (dbfcmd(dbproc, "SET FMTONLY ON %s SET FMTONLY OFF", pdata->dbobject) == FAIL) { fprintf(stderr, "dbfcmd failed\n"); return FALSE; } } else { if (dbfcmd(dbproc, "SET FMTONLY ON select * from %s SET FMTONLY OFF", pdata->dbobject) == FAIL) { fprintf(stderr, "dbfcmd failed\n"); return FALSE; } } if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "dbsqlexec failed\n"); return FALSE; } while (NO_MORE_RESULTS != (ret_code = dbresults(dbproc))) { if (ret_code == SUCCEED && li_numcols == 0) { li_numcols = dbnumcols(dbproc); } } if (0 == li_numcols) { fprintf(stderr, "Error in dbnumcols\n"); return FALSE; } if (bcp_columns(dbproc, li_numcols) == FAIL) { fprintf(stderr, "Error in bcp_columns.\n"); return FALSE; } for (i = 1; i <= li_numcols; i++) { li_coltype = dbcoltype(dbproc, i); if (bcp_colfmt(dbproc, i, li_coltype, -1, -1, NULL, -1, i) == FAIL) { fprintf(stderr, "Error in bcp_colfmt col %d\n", i); return FALSE; } } printf("\nStarting copy...\n\n"); if (FAIL == bcp_exec(dbproc, &li_rowsread)) { fprintf(stderr, "bcp copy %s failed\n", (dir == DB_IN) ? "in" : "out"); return FALSE; } printf("%d rows copied.\n", li_rowsread); return TRUE; } int file_formatted(BCPPARAMDATA * pdata, DBPROCESS * dbproc, DBINT dir) { int li_rowsread; if (FAIL == bcp_init(dbproc, pdata->dbobject, pdata->hostfilename, pdata->errorfile, dir)) return FALSE; if (!set_bcp_hints(pdata, dbproc)) return FALSE; if (pdata->Eflag) { bcp_control(dbproc, BCPKEEPIDENTITY, 1); if (dbfcmd(dbproc, "set identity_insert %s on", pdata->dbobject) == FAIL) { fprintf(stderr, "dbfcmd failed\n"); return FALSE; } if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "dbsqlexec failed\n"); return FALSE; } while (NO_MORE_RESULTS != dbresults(dbproc)) continue; } bcp_control(dbproc, BCPFIRST, pdata->firstrow); bcp_control(dbproc, BCPLAST, pdata->lastrow); bcp_control(dbproc, BCPMAXERRS, pdata->maxerrors); if (FAIL == bcp_readfmt(dbproc, pdata->formatfile)) return FALSE; printf("\nStarting copy...\n\n"); if (FAIL == bcp_exec(dbproc, &li_rowsread)) { fprintf(stderr, "bcp copy %s failed\n", (dir == DB_IN) ? "in" : "out"); return FALSE; } printf("%d rows copied.\n", li_rowsread); return TRUE; } int setoptions(DBPROCESS * dbproc, BCPPARAMDATA * params) { RETCODE fOK; if (dbfcmd(dbproc, "set textsize %d ", params->textsize) == FAIL) { fprintf(stderr, "setoptions() could not set textsize at %s:%d\n", __FILE__, __LINE__); return FALSE; } /* * If the option is a filename, read the SQL text from the file. * Else pass the option verbatim to the server. */ if (params->options) { FILE *optFile; char optBuf[256]; if ((optFile = fopen(params->options, "r")) == NULL) { if (dbcmd(dbproc, params->options) == FAIL) { fprintf(stderr, "setoptions() failed preparing options at %s:%d\n", __FILE__, __LINE__); return FALSE; } } else { while (fgets (optBuf, sizeof(optBuf), optFile) != NULL) { if (dbcmd(dbproc, optBuf) == FAIL) { fprintf(stderr, "setoptions() failed preparing options at %s:%d\n", __FILE__, __LINE__); fclose(optFile); return FALSE; } } if (!feof (optFile)) { perror("freebcp"); fprintf(stderr, "error reading options file \"%s\" at %s:%d\n", params->options, __FILE__, __LINE__); fclose(optFile); return FALSE; } fclose(optFile); } } if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "setoptions() failed sending options at %s:%d\n", __FILE__, __LINE__); return FALSE; } while ((fOK = dbresults(dbproc)) == SUCCEED) { while ((fOK = dbnextrow(dbproc)) == REG_ROW) continue; if (fOK == FAIL) { fprintf(stderr, "setoptions() failed sending options at %s:%d\n", __FILE__, __LINE__); return FALSE; } } if (fOK == FAIL) { fprintf(stderr, "setoptions() failed sending options at %s:%d\n", __FILE__, __LINE__); return FALSE; } return TRUE; } static int set_bcp_hints(BCPPARAMDATA *pdata, DBPROCESS *pdbproc) { /* set hint if any */ if (pdata->hint) { if (bcp_options(pdbproc, BCPHINTS, (BYTE *) pdata->hint, strlen(pdata->hint)) != SUCCEED) { fprintf(stderr, "db-lib: Unable to set hint \"%s\"\n", pdata->hint); return FALSE; } } return TRUE; } void pusage(void) { fprintf(stderr, "usage: freebcp [[database_name.]owner.]table_name|query {in | out | queryout } datafile\n"); fprintf(stderr, " [-m maxerrors] [-f formatfile] [-e errfile]\n"); fprintf(stderr, " [-F firstrow] [-L lastrow] [-b batchsize]\n"); fprintf(stderr, " [-n] [-c] [-t field_terminator] [-r row_terminator]\n"); fprintf(stderr, " [-U username] [-P password] [-I interfaces_file] [-S server] [-D database]\n"); fprintf(stderr, " [-v] [-d] [-h \"hint [,...]\" [-O \"set connection_option on|off, ...]\"\n"); fprintf(stderr, " [-A packet size] [-T text or image size] [-E]\n"); fprintf(stderr, " [-i input_file] [-o output_file]\n"); fprintf(stderr, " \n"); fprintf(stderr, "example: freebcp testdb.dbo.inserttest in inserttest.txt -S mssql -U guest -P password -c\n"); } int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { static int sent = 0; if (dberr == SYBEBBCI) { /* Batch successfully bulk copied to the server */ int batch = bcp_getbatchsize(dbproc); printf("%d rows sent to SQL Server.\n", sent += batch); return INT_CANCEL; } if (dberr) { fprintf(stderr, "Msg %d, Level %d\n", dberr, severity); fprintf(stderr, "%s\n\n", dberrstr); } else { fprintf(stderr, "DB-LIBRARY error:\n\t"); fprintf(stderr, "%s\n", dberrstr); } return INT_CANCEL; } int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { /* * If it's a database change message, we'll ignore it. * Also ignore language change message. */ if (msgno == 5701 || msgno == 5703) return (0); fprintf(stderr, "Msg %ld, Level %d, State %d\n", (long) msgno, severity, msgstate); if (strlen(srvname) > 0) fprintf(stderr, "Server '%s', ", srvname); if (strlen(procname) > 0) fprintf(stderr, "Procedure '%s', ", procname); if (line > 0) fprintf(stderr, "Line %d", line); fprintf(stderr, "\n\t%s\n", msgtext); return (0); } freetds-1.3.6/src/apps/freebcp.h000644 025423 025423 00000002042 14056414221 020111 0ustar00fredianofrediano000000 000000 enum states { GET_NEXTARG, GET_MAXERRORS, GET_FORMATFILE, GET_ERRORFILE, GET_FIRSTROW, GET_LASTROW, GET_BATCHSIZE, GET_FIELDTERM, GET_ROWTERM, GET_USER, GET_PASS, GET_INTERFACESFILE, GET_SERVER, GET_DISPLAYCHARSET, GET_DATAFILECHARSET, GET_LANGUAGE, GET_PACKETSIZE, GET_CLIENTCHARSET, GET_TEXTSIZE, GET_SYBASEDIR, GET_FROMLABEL, GET_TOLABEL, GET_HINT }; typedef struct pd { char *dbobject; char dbdirection[10]; DBINT direction; char *hostfilename; char *formatfile; char *errorfile; char *interfacesfile; int firstrow; int lastrow; int batchsize; int maxerrors; int textsize; char *fieldterm; int fieldtermlen; char *rowterm; int rowtermlen; char *user; char *pass; char *server; char *dbname; char *hint; char *options; char *charset; int packetsize; int mflag; int fflag; int eflag; int Fflag; int Lflag; int bflag; int nflag; int cflag; int tflag; int rflag; int Uflag; int Iflag; int Sflag; int Pflag; int Tflag; int Aflag; int Eflag; char *inputfile; char *outputfile; } BCPPARAMDATA; freetds-1.3.6/src/apps/tsql.c000644 025423 025423 00000055722 14056414271 017503 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2006-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #if HAVE_FORK #include #endif #include #ifdef HAVE_READLINE #include #include #endif /* HAVE_READLINE */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H # include #elif defined(_WIN32) # include # undef isatty # define isatty(fd) _isatty(fd) #endif /* HAVE_UNISTD_H */ /* HP-UX require some constants defined by limits.h */ #ifdef HAVE_LIMITS_H #include #endif /* HAVE_LIMITS_H */ #if defined(__hpux__) && !defined(_POSIX_PATH_MAX) #define _POSIX_PATH_MAX 255 #endif #ifdef HAVE_LOCALE_H #include #endif /* HAVE_LOCALE_H */ #ifdef HAVE_LANGINFO_H #include #endif /* HAVE_LANGINFO_H */ #ifdef HAVE_LOCALCHARSET_H #include #endif /* HAVE_LOCALCHARSET_H */ #include #include #include #include #include #include #include #define TDS_ISSPACE(c) isspace((unsigned char) (c)) enum { OPT_VERSION = 0x01, OPT_TIMER = 0x02, OPT_NOFOOTER = 0x04, OPT_NOHEADER = 0x08, OPT_QUIET = 0x10, OPT_VERBOSE = 0x20, OPT_INSTANCES= 0x40 }; static int istty = 0; static int global_opt_flags = 0; #define QUIET (global_opt_flags & OPT_QUIET) #define VERBOSE (global_opt_flags & OPT_VERBOSE) static const char *opt_col_term = "\t"; static const char *opt_row_term = "\n"; static const char *opt_default_db = NULL; static int do_query(TDSSOCKET * tds, char *buf, int opt_flags); static int get_opt_flags(char *s, int *opt_flags); static void populate_login(TDSLOGIN * login, int argc, char **argv); static int tsql_handle_message(const TDSCONTEXT * context, TDSSOCKET * tds, TDSMESSAGE * msg); static int tsql_handle_error (const TDSCONTEXT * context, TDSSOCKET * tds, TDSMESSAGE * msg); static void slurp_input_file(char *fname, char **mybuf, size_t *bufsz, size_t *buflen, int *line); static char * tsql_readline(char *prompt) { size_t sz, pos; char *line, *p; #ifdef HAVE_READLINE if (istty) return readline(prompt); #endif sz = 1024; pos = 0; line = tds_new(char, sz); if (!line) return NULL; if (prompt && prompt[0]) printf("%s", prompt); for (;;) { /* read a piece */ if (fgets(line + pos, (int)(sz - pos), stdin) == NULL) { if (pos) return line; break; } /* got end-of-line ? */ p = strchr(line + pos, '\n'); if (p) { *p = 0; return line; } /* allocate space if needed */ pos += strlen(line + pos); if (pos + 1024 >= sz) { sz += 1024; if (!TDS_RESIZE(line, sz)) break; } } free(line); return NULL; } static void tsql_add_history(const char *s) { #ifdef HAVE_READLINE if (istty) add_history(s); #endif } /** * Returns the version of the TDS protocol in effect for the link * as a decimal integer. * Typical returned values are 42, 50, 70, 80. * Also fills pversion_string unless it is null. * Typical pversion_string values are "4.2" and "7.0". */ static int tds_version(TDSCONNECTION * conn, char *pversion_string) { int iversion = 0; iversion = 10 * TDS_MAJOR(conn) + TDS_MINOR(conn); sprintf(pversion_string, "%d.%d", TDS_MAJOR(conn), TDS_MINOR(conn)); return iversion; } static int do_query(TDSSOCKET * tds, char *buf, int opt_flags) { int rows = 0; TDSRET rc; int i; TDSCOLUMN *col; int ctype; CONV_RESULT dres; unsigned char *src; TDS_INT srclen; TDS_INT resulttype; struct timeval start, stop; int print_rows = 1; char message[128]; rc = tds_submit_query(tds, buf); if (TDS_FAILED(rc)) { fprintf(stderr, "tds_submit_query() failed\n"); return 1; } while ((rc = tds_process_tokens(tds, &resulttype, NULL, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { const int stop_mask = TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE; if (opt_flags & OPT_TIMER) { gettimeofday(&start, NULL); print_rows = 0; } switch (resulttype) { case TDS_ROWFMT_RESULT: if ((!(opt_flags & OPT_NOHEADER)) && tds->current_results) { for (i = 0; i < tds->current_results->num_cols; i++) { if (i) fputs(opt_col_term, stdout); fputs(tds_dstr_cstr(&tds->current_results->columns[i]->column_name), stdout); } fputs(opt_row_term, stdout); } break; case TDS_COMPUTE_RESULT: case TDS_ROW_RESULT: rows = 0; while ((rc = tds_process_tokens(tds, &resulttype, NULL, stop_mask)) == TDS_SUCCESS) { if (resulttype != TDS_ROW_RESULT && resulttype != TDS_COMPUTE_RESULT) break; rows++; if (!tds->current_results) continue; for (i = 0; i < tds->current_results->num_cols; i++) { col = tds->current_results->columns[i]; if (col->column_cur_size < 0) { if (print_rows) { if (i) fputs(opt_col_term, stdout); fputs("NULL", stdout); } continue; } ctype = tds_get_conversion_type(col->column_type, col->column_size); src = col->column_data; if (is_blob_col(col) && col->column_type != SYBVARIANT) src = (unsigned char *) ((TDSBLOB *) src)->textvalue; srclen = col->column_cur_size; if (tds_convert(tds_get_ctx(tds), ctype, src, srclen, SYBVARCHAR, &dres) < 0) continue; if (print_rows) { if (i) fputs(opt_col_term, stdout); fputs(dres.c, stdout); } free(dres.c); } if (print_rows) fputs(opt_row_term, stdout); } if (!QUIET) printf("(%d row%s affected)\n", rows, rows == 1 ? "" : "s"); break; case TDS_STATUS_RESULT: if (!QUIET) printf("(return status = %d)\n", tds->ret_status); break; default: break; } if (opt_flags & OPT_VERSION) { char version[64]; int line = 0; line = tds_version(tds->conn, version); if (line) { TDSMESSAGE msg; memset(&msg, 0, sizeof(TDSMESSAGE)); msg.server = "tsql"; sprintf(message, "using TDS version %s", version); msg.message = message; tsql_handle_message(tds_get_ctx(tds), tds, &msg); } } if (opt_flags & OPT_TIMER) { TDSMESSAGE msg; gettimeofday(&stop, NULL); sprintf(message, "Total time for processing %d rows: %ld msecs\n", rows, (long) ((stop.tv_sec - start.tv_sec) * 1000) + ((stop.tv_usec - start.tv_usec) / 1000)); memset(&msg, 0, sizeof(TDSMESSAGE)); msg.server = "tsql"; msg.message = message; tsql_handle_message(tds_get_ctx(tds), tds, &msg); } } return 0; } static void tsql_print_usage(const char *progname) { fprintf(stderr, "Usage: %s [-a ] [-S | -H -p ] -U [-P ] [-I ] [-o ] [-t delim] [-r delim] [-D database]\n" " or: %s -C\n" " or: %s -L -H \n" "If -C is specified just print configuration and exit.\n" "If -L is specified with a host name (-H) instances found are printed.\n" " -a specify application name\n" " -S specify server entry in freetds.conf to connect\n" " -H specify hostname to connect\n" " -p specify port to connect to\n" " -U specify username to use\n" " -P specify password to use\n" " -D specify database name to use\n" " -I specify old configuration file (called interface) to use\n" " -J specify character set to use\n" " -v verbose mode\n" "-o options:\n" "\tf\tDo not print footer\n" "\th\tDo not print header\n" "\tt\tPrint time informations\n" "\tv\tPrint TDS version\n" "\tq\tQuiet\n\n" "\tDelimiters can be multi-char strings appropriately escaped for your shell.\n" "\tDefault column delimitor is ; default row delimiter is \n", progname, progname, progname); } static void reset_getopt(void) { #ifdef HAVE_GETOPT_OPTRESET optreset = 1; optind = 1; #else optind = 0; #endif } /* * The 'GO' command may be followed by options that apply to the batch. * If they don't appear to be right, assume the letters "go" are part of the * SQL, not a batch separator. */ static int get_opt_flags(char *s, int *opt_flags) { char **argv; int argc; int opt; /* make sure we have enough elements */ assert(s && opt_flags); argv = tds_new0(char*, strlen(s) + 2); if (!argv) return 0; /* parse the command line and assign to argv */ for (argc=0; (argv[argc] = strtok(s, " ")) != NULL; argc++) s = NULL; *opt_flags = 0; reset_getopt(); opterr = 0; /* suppress error messages */ while ((opt = getopt(argc, argv, "fhLqtv")) != -1) { switch (opt) { case 'f': *opt_flags |= OPT_NOFOOTER; break; case 'h': *opt_flags |= OPT_NOHEADER; break; case 't': *opt_flags |= OPT_TIMER; break; case 'v': *opt_flags |= OPT_VERSION; break; case 'q': *opt_flags |= OPT_QUIET; break; default: fprintf(stderr, "Warning: invalid option '%s' found: \"go\" treated as simple SQL\n", argv[optind-1]); free(argv); return 0; } } free(argv); return 1; } static int get_default_instance_port(const char hostname[]) { int port; struct addrinfo *addr; if ((addr = tds_lookup_host(hostname)) == NULL) return 0; port = tds7_get_instance_port(addr, "MSSQLSERVER"); freeaddrinfo(addr); return port; } #if !defined(LC_ALL) # define LC_ALL 0 #endif static const char * yes_no(bool value) { return value ? "yes" : "no"; } static void populate_login(TDSLOGIN * login, int argc, char **argv) { const TDS_COMPILETIME_SETTINGS *settings; char *hostname = NULL, *servername = NULL; char *username = NULL, *password = NULL; char *confile = NULL; const char *appname = "TSQL"; int opt, port=0, use_domain_login=0; char *charset = NULL; char *opt_flags_str = NULL; while ((opt = getopt(argc, argv, "a:H:S:I:J:P:U:p:Co:t:r:D:Lv")) != -1) { switch (opt) { case 'a': appname = optarg; break; case 't': opt_col_term = optarg; break; case 'r': opt_row_term = optarg; break; case 'D': opt_default_db = optarg; break; case 'o': opt_flags_str = optarg; break; case 'H': free(hostname); hostname = strdup(optarg); break; case 'S': free(servername); servername = strdup(optarg); break; case 'U': free(username); username = strdup(optarg); break; case 'P': free(password); password = tds_getpassarg(optarg); break; case 'I': free(confile); confile = strdup(optarg); break; case 'J': free(charset); charset = strdup(optarg); break; case 'p': port = atoi(optarg); break; case 'L': global_opt_flags |= OPT_INSTANCES; break; case 'v': global_opt_flags |= OPT_VERBOSE; break; case 'C': settings = tds_get_compiletime_settings(); printf("%s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n%35s: %s\n", "Compile-time settings (established with the \"configure\" script)", "Version", settings->freetds_version, "freetds.conf directory", settings->sysconfdir, /* settings->last_update */ "MS db-lib source compatibility", yes_no(settings->msdblib), "Sybase binary compatibility", yes_no(settings->sybase_compat), "Thread safety", yes_no(settings->threadsafe), "iconv library", yes_no(settings->libiconv), "TDS version", settings->tdsver, "iODBC", yes_no(settings->iodbc), "unixodbc", yes_no(settings->unixodbc), "SSPI \"trusted\" logins", yes_no(settings->sspi), "Kerberos", yes_no(settings->kerberos), "OpenSSL", yes_no(settings->openssl), "GnuTLS", yes_no(settings->gnutls), "MARS", yes_no(settings->mars)); exit(0); break; default: tsql_print_usage(basename(argv[0])); exit(1); break; } } if (opt_flags_str != NULL) { char *minus_flags = tds_new(char, strlen(opt_flags_str) + 5); if (minus_flags != NULL) { strcpy(minus_flags, "go -"); strcat(minus_flags, opt_flags_str); get_opt_flags(minus_flags, &global_opt_flags); free(minus_flags); } } if ((global_opt_flags & OPT_INSTANCES) && hostname) { struct addrinfo *addr; char *filename = getenv("TDSDUMP"); if (filename) { if (asprintf(&filename, "%s.instances", filename) < 0) exit(1); tdsdump_open(filename); free(filename); } if ((addr = tds_lookup_host(hostname)) != NULL) { tds7_get_instance_ports(stderr, addr); freeaddrinfo(addr); } tdsdump_close(); exit(0); } /* validate parameters */ if (!servername && !hostname) { fprintf(stderr, "%s: error: Missing argument -S or -H\n", argv[0]); exit(1); } if (hostname && !port) { /* * TODO: It would be convenient to have a function that looks up a reasonable port based on: * - TDSPORT environment variable * - config files * - get_default_instance_port * - TDS version * in that order. */ if (!QUIET) { printf("Missing argument -p, looking for default instance ... "); } if (0 == (port = get_default_instance_port(hostname))) { fprintf(stderr, "%s: no default port provided by host %s\n", argv[0], hostname); exit(1); } if (!QUIET) printf("found default instance, port %d\n", port); } /* A NULL username indicates a domain (trusted) login */ if (!username) { username = tds_new0(char, 1); if (!username) { fprintf(stderr, "Could not allocate memory for username\n"); exit(1); } use_domain_login = 1; } if (!password) { password = tds_new0(char, 128); if (!password) { fprintf(stderr, "Could not allocate memory for password\n"); exit(1); } if (!use_domain_login) readpassphrase("Password: ", password, 128, RPP_ECHO_OFF); } if (!opt_col_term) { fprintf(stderr, "%s: missing delimiter for -t (check escaping)\n", argv[0]); exit(1); } if (!opt_row_term) { fprintf(stderr, "%s: missing delimiter for -r (check escaping)\n", argv[0]); exit(1); } /* all validated, let's do it */ if (!tds_set_user(login, username) || !tds_set_app(login, appname) || !tds_set_library(login, "TDS-Library") || !tds_set_language(login, "us_english") || !tds_set_passwd(login, password)) goto out_of_memory; if (charset && !tds_set_client_charset(login, charset)) goto out_of_memory; /* if it's a servername */ if (servername) { if (!tds_set_server(login, servername)) goto out_of_memory; if (confile) { tds_set_interfaces_file_loc(confile); } /* else we specified hostname/port */ } else { if (!tds_set_server(login, hostname)) goto out_of_memory; tds_set_port(login, port); } memset(password, 0, strlen(password)); /* free up all the memory */ free(confile); free(hostname); free(username); free(password); free(servername); free(charset); return; out_of_memory: fprintf(stderr, "%s: out of memory\n", argv[0]); exit(1); } static int tsql_handle_message(const TDSCONTEXT * context, TDSSOCKET * tds, TDSMESSAGE * msg) { if (msg->msgno == 0) { fprintf(stderr, "%s\n", msg->message); return 0; } switch (msg->msgno) { case 5701: /* changed_database */ case 5703: /* changed_language */ case 20018: /* The @optional_command_line is too long */ if (VERBOSE) fprintf(stderr, "%s\n", msg->message); break; default: fprintf(stderr, "Msg %d (severity %d, state %d) from %s", msg->msgno, msg->severity, msg->state, msg->server); if (msg->proc_name && strlen(msg->proc_name)) fprintf(stderr, ", Procedure %s", msg->proc_name); if (msg->line_number > 0) fprintf(stderr, " Line %d", msg->line_number); fprintf(stderr, ":\n\t\"%s\"\n", msg->message); break; } return 0; } static int /* error from library, not message from server */ tsql_handle_error(const TDSCONTEXT * context, TDSSOCKET * tds, TDSMESSAGE * msg) { fprintf(stderr, "Error %d (severity %d):\n\t%s\n", msg->msgno, msg->severity, msg->message); if (0 != msg->oserr) { fprintf(stderr, "\tOS error %d, \"%s\"\n", msg->oserr, strerror(msg->oserr)); } return TDS_INT_CANCEL; } static void slurp_input_file(char *fname, char **mybuf, size_t *bufsz, size_t *buflen, int *line) { FILE *fp = NULL; register char *n; char linebuf[1024]; char *s = NULL; if ((fp = fopen(fname, "r")) == NULL) { fprintf(stderr, "Unable to open input file '%s': %s\n", fname, strerror(errno)); return; } while ((s = fgets(linebuf, sizeof(linebuf), fp)) != NULL) { while (*buflen + strlen(s) + 2 > *bufsz) { *bufsz *= 2; if (!TDS_RESIZE(*mybuf, *bufsz)) { perror("tsql: "); exit(1); } } strcpy(*mybuf + *buflen, s); *buflen += strlen(*mybuf + *buflen); n = strrchr(s, '\n'); if (n != NULL) *n = '\0'; tsql_add_history(s); (*line)++; } fclose(fp); } static void print_instance_data(TDSLOGIN *login) { if (!login) return; if (!tds_dstr_isempty(&login->instance_name)) printf("connecting to instance %s on port %d\n", tds_dstr_cstr(&login->instance_name), login->port); } #if defined(HAVE_ALARM) && !defined(_WIN32) static void count_alarm(int s) { static int count = 0; char buf[64]; /* print the counter, do not use stderr as may be locked! */ sprintf(buf, "\r%2d", ++count); write(STDERR_FILENO, buf, strlen(buf)); alarm(1); } #endif int main(int argc, char **argv) { char *s = NULL, *s2 = NULL, *cmd = NULL; char prompt[20]; int line = 0; char *mybuf; size_t bufsz = 4096; size_t buflen = 0; TDSSOCKET *tds; TDSLOGIN *login; TDSCONTEXT *context; TDSLOGIN *connection; int opt_flags = 0; const char *locale = NULL; const char *charset = NULL; istty = isatty(0); if (INITSOCKET()) { fprintf(stderr, "Unable to initialize sockets\n"); return 1; } setlocale(LC_ALL, ""); /* grab a login structure */ login = tds_alloc_login(1); if (!login) { fprintf(stderr, "login cannot be null\n"); return 1; } context = tds_alloc_context(NULL); if (!context) { fprintf(stderr, "context cannot be null\n"); return 1; } if (context->locale && !context->locale->date_fmt) { /* set default in case there's no locale file */ context->locale->date_fmt = strdup(STD_DATETIME_FMT); } context->msg_handler = tsql_handle_message; context->err_handler = tsql_handle_error; /* process all the command line args into the login structure */ populate_login(login, argc, argv); /* Try to open a connection */ tds = tds_alloc_socket(context, 512); assert(tds); tds_set_parent(tds, NULL); connection = tds_read_config_info(tds, login, context->locale); if (!connection) return 1; locale = setlocale(LC_ALL, NULL); #if HAVE_LOCALE_CHARSET charset = locale_charset(); #endif #if HAVE_NL_LANGINFO && defined(CODESET) if (!charset) charset = nl_langinfo(CODESET); #endif if (locale) if (!QUIET) printf("locale is \"%s\"\n", locale); if (charset) { if (!QUIET) printf("locale charset is \"%s\"\n", charset); } if (tds_dstr_isempty(&connection->client_charset)) { if (!charset) charset = "ISO-8859-1"; if (!tds_set_client_charset(login, charset)) return 1; if (!tds_dstr_dup(&connection->client_charset, &login->client_charset)) return 1; } if (!QUIET) printf("using default charset \"%s\"\n", tds_dstr_cstr(&connection->client_charset)); if (opt_default_db) { if (!tds_dstr_copy(&connection->database, opt_default_db)) return 1; if (!QUIET) fprintf(stderr, "Setting %s as default database in login packet\n", opt_default_db); } /* * If we're able to establish an ip address for the server, we'll try to connect to it. * If that machine is currently unreachable, show a timer connecting to the server. */ #if defined(HAVE_ALARM) && !defined(_WIN32) if (connection && !QUIET) { signal(SIGALRM, count_alarm); fflush(stderr); alarm(1); } #endif if (!connection || TDS_FAILED(tds_connect_and_login(tds, connection))) { if (VERBOSE) print_instance_data(connection); tds_free_socket(tds); tds_free_login(login); tds_free_context(context); fprintf(stderr, "There was a problem connecting to the server\n"); exit(1); } #if defined(HAVE_ALARM) && !defined(_WIN32) if (!QUIET) { alarm(0); signal(SIGALRM, SIG_DFL); fprintf(stderr, "\r"); } #endif if (VERBOSE) print_instance_data(connection); tds_free_login(connection); /* give the buffer an initial size */ bufsz = 4096; mybuf = tds_new(char, bufsz); if (!mybuf) { fprintf(stderr, "Could not allocate memory for mybuf\n"); return 1; } mybuf[0] = '\0'; buflen = 0; #if defined(HAVE_READLINE) && HAVE_RL_INHIBIT_COMPLETION rl_inhibit_completion = 1; #endif for (s=NULL, s2=NULL; ; free(s), free(s2), s2=NULL) { sprintf(prompt, "%d> ", ++line); s = tsql_readline(QUIET ? NULL : prompt); if (s == NULL) { if (buflen) do_query(tds, mybuf, global_opt_flags); break; } /* * 'GO' is special only at the start of a line * The rest of the line may include options that apply to the batch, * and perhaps whitespace. */ if (0 == strncasecmp(s, "go", 2) && (strlen(s) == 2 || TDS_ISSPACE(s[2]))) { char *go_line = strdup(s); assert(go_line); line = 0; if (get_opt_flags(go_line, &opt_flags)) { free(go_line); opt_flags ^= global_opt_flags; do_query(tds, mybuf, opt_flags); mybuf[0] = '\0'; buflen = 0; continue; } free(go_line); } /* skip leading whitespace */ if ((s2 = strdup(s)) == NULL) { /* copy to mangle with strtok() */ perror("tsql: "); exit(1); } if ((cmd = strtok(s2, " \t")) == NULL) cmd = ""; if (!strcasecmp(cmd, "exit") || !strcasecmp(cmd, "quit") || !strcasecmp(cmd, "bye")) break; if (!strcasecmp(cmd, "version")) { tds_version(tds->conn, mybuf); printf("using TDS version %s\n", mybuf); line = 0; mybuf[0] = '\0'; buflen = 0; continue; } if (!strcasecmp(cmd, "reset")) { line = 0; mybuf[0] = '\0'; buflen = 0; } else if (!strcasecmp(cmd, ":r")) { slurp_input_file(strtok(NULL, " \t"), &mybuf, &bufsz, &buflen, &line); } else { while (buflen + strlen(s) + 2 > bufsz) { bufsz *= 2; if (!TDS_RESIZE(mybuf, bufsz)) { perror("tsql: "); exit(1); } } tsql_add_history(s); strcpy(mybuf + buflen, s); /* preserve line numbering for the parser */ strcat(mybuf + buflen, "\n"); buflen += strlen(mybuf + buflen); } } /* close up shop */ free(mybuf); tds_close_socket(tds); tds_free_socket(tds); tds_free_login(login); tds_free_context(context); DONESOCKET(); return 0; } freetds-1.3.6/src/apps/CMakeLists.txt000644 025423 025423 00000001247 14056414221 021100 0ustar00fredianofrediano000000 000000 set(libs ${lib_NETWORK} ${lib_BASE}) foreach(target freebcp bsqldb defncopy datacopy) add_executable(${target} ${target}.c) target_link_libraries(${target} sybdb replacements tdsutils ${libs}) endforeach(target) add_executable(tsql tsql.c) target_link_libraries(tsql tds replacements tdsutils ${lib_READLINE} ${libs}) if(WIN32) set(libs odbc32 ${lib_NETWORK} ${lib_BASE}) endif(WIN32) add_executable(bsqlodbc bsqlodbc.c) target_link_libraries(bsqlodbc tdsodbc replacements tdsutils ${libs}) INSTALL(TARGETS tsql bsqlodbc defncopy freebcp datacopy bsqldb PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) freetds-1.3.6/src/apps/fisql/000755 025423 025423 00000000000 14162303406 017452 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/apps/fisql/Makefile.am000644 025423 025423 00000000511 14056414221 021503 0ustar00fredianofrediano000000 000000 AM_CPPFLAGS = -I$(top_srcdir)/include if !MINGW32 bin_PROGRAMS = fisql fisql_SOURCES = fisql.c \ terminal.h terminal.c \ edit.h edit.c \ handlers.h handlers.c \ interrupt.h interrupt.c fisql_LDADD = ../../dblib/libsybdb.la \ ../../replacements/libreplacements.la \ $(LTLIBICONV) $(READLINE_LIBS) endif freetds-1.3.6/src/apps/fisql/Makefile.in000644 025423 025423 00000056074 14162303356 021537 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @MINGW32_FALSE@bin_PROGRAMS = fisql$(EXEEXT) subdir = src/apps/fisql ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__fisql_SOURCES_DIST = fisql.c terminal.h terminal.c edit.h edit.c \ handlers.h handlers.c interrupt.h interrupt.c @MINGW32_FALSE@am_fisql_OBJECTS = fisql.$(OBJEXT) terminal.$(OBJEXT) \ @MINGW32_FALSE@ edit.$(OBJEXT) handlers.$(OBJEXT) \ @MINGW32_FALSE@ interrupt.$(OBJEXT) fisql_OBJECTS = $(am_fisql_OBJECTS) am__DEPENDENCIES_1 = @MINGW32_FALSE@fisql_DEPENDENCIES = ../../dblib/libsybdb.la \ @MINGW32_FALSE@ ../../replacements/libreplacements.la \ @MINGW32_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/edit.Po ./$(DEPDIR)/fisql.Po \ ./$(DEPDIR)/handlers.Po ./$(DEPDIR)/interrupt.Po \ ./$(DEPDIR)/terminal.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(fisql_SOURCES) DIST_SOURCES = $(am__fisql_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include @MINGW32_FALSE@fisql_SOURCES = fisql.c \ @MINGW32_FALSE@ terminal.h terminal.c \ @MINGW32_FALSE@ edit.h edit.c \ @MINGW32_FALSE@ handlers.h handlers.c \ @MINGW32_FALSE@ interrupt.h interrupt.c @MINGW32_FALSE@fisql_LDADD = ../../dblib/libsybdb.la \ @MINGW32_FALSE@ ../../replacements/libreplacements.la \ @MINGW32_FALSE@ $(LTLIBICONV) $(READLINE_LIBS) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/apps/fisql/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/apps/fisql/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list fisql$(EXEEXT): $(fisql_OBJECTS) $(fisql_DEPENDENCIES) $(EXTRA_fisql_DEPENDENCIES) @rm -f fisql$(EXEEXT) $(AM_V_CCLD)$(LINK) $(fisql_OBJECTS) $(fisql_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fisql.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/handlers.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interrupt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminal.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/edit.Po -rm -f ./$(DEPDIR)/fisql.Po -rm -f ./$(DEPDIR)/handlers.Po -rm -f ./$(DEPDIR)/interrupt.Po -rm -f ./$(DEPDIR)/terminal.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/edit.Po -rm -f ./$(DEPDIR)/fisql.Po -rm -f ./$(DEPDIR)/handlers.Po -rm -f ./$(DEPDIR)/interrupt.Po -rm -f ./$(DEPDIR)/terminal.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/apps/fisql/fisql.c000644 025423 025423 00000047733 14161556621 020762 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #ifdef HAVE_READLINE #include #include #endif #if HAVE_LOCALE_H #include #endif #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #include #include #include #include #include "terminal.h" #include "edit.h" #include "handlers.h" #include "interrupt.h" #define READPASSPHRASE_MAXLEN 128 #ifndef HAVE_READLINE static FILE *rl_outstream = NULL; static FILE *rl_instream = NULL; static const char *rl_readline_name = NULL; static char * fisql_readline(char *prompt) { size_t sz, pos; char *line, *p; sz = 1024; pos = 0; line = (char*) malloc(sz); if (!line) return NULL; if (prompt && prompt[0]) fprintf(rl_outstream ? rl_outstream : stdout, "%s", prompt); for (;;) { /* read a piece */ if (fgets(line + pos, sz - pos, rl_instream ? rl_instream : stdin) == NULL) { if (pos) return line; break; } /* got end-of-line ? */ p = strchr(line + pos, '\n'); if (p) { *p = 0; return line; } /* allocate space if needed */ pos += strlen(line + pos); if (pos + 1024 >= sz) { sz += 1024; p = (char*) realloc(line, sz); if (!p) break; line = p; } } free(line); return NULL; } static void fisql_add_history(const char *s) { } #define readline fisql_readline #define add_history fisql_add_history #define rl_bind_key(c,f) do {} while(0) #define rl_reset_line_state() do {} while(0) #define rl_on_new_line() do {} while(0) #endif #if !HAVE_RL_ON_NEW_LINE && !defined(rl_on_new_line) #define rl_on_new_line() do {} while(0) #endif #if !HAVE_RL_RESET_LINE_STATE && !defined(rl_reset_line_state) #define rl_reset_line_state() do {} while(0) #endif static void *xmalloc(size_t s); static void *xrealloc(void *p, size_t s); static int get_printable_size(int type, int size); static int get_printable_column_size(DBPROCESS * dbproc, int col); static void * xmalloc(size_t s) { void *p = malloc(s); if (!p) { fprintf(stderr, "Out of memory\n"); exit(EXIT_FAILURE); } return p; } static void * xrealloc(void *p, size_t s) { p = realloc(p, s); if (!p) { fprintf(stderr, "Out of memory\n"); exit(EXIT_FAILURE); } return p; } /* adapted from src/dblib/dblib.c (via src/apps/bsqldb.c) */ static int get_printable_size(int type, int size) { switch (type) { case SYBINTN: switch (size) { case 1: return 3; case 2: return 6; case 4: return 11; case 8: return 21; } case SYBINT1: return 3; case SYBINT2: return 6; case SYBINT4: return 11; case SYBINT8: return 21; case SYBVARCHAR: case SYBCHAR: return size; case SYBFLT8: return 11; /* FIX ME -- we do not track precision */ case SYBREAL: return 11; /* FIX ME -- we do not track precision */ case SYBMONEY: return 12; /* FIX ME */ case SYBMONEY4: return 12; /* FIX ME */ case SYBDATETIME: case SYBDATETIME4: case SYBDATETIMN: return 26; /* FIX ME */ #if 0 /* seems not to be exported to sybdb.h */ case SYBBITN: #endif case SYBBIT: return 1; /* FIX ME -- not all types present */ default: return 0; } } static int get_printable_column_size(DBPROCESS * dbproc, int col) { int collen; collen = get_printable_size(dbcoltype(dbproc, col), dbcollen(dbproc, col)); if (strlen(dbcolname(dbproc, col)) > collen) { collen = strlen(dbcolname(dbproc, col)); } return collen; } static bool update_comment(bool in_comment, const char *line) { const char *p = line; while (*p) { if (in_comment) { p = strstr(p, "*/"); if (!p) break; p += 2; in_comment = false; } /* not comment */ if (p[0] == '/' && p[1] == '*') { in_comment = true; p += 2; } else if (p[0] == '-' && p[1] == '-') { /* comment till the end of line then no comment * on next line */ break; } else if (p[0]) { ++p; } } return in_comment; } static DBPROCESS *dbproc; static const char *editor; static char **ibuf = NULL; static int ibuflines = 0; static int no_prompt = 0; static int default_exit = EXIT_SUCCESS; static const char *cmdend = "go"; static void reset_ibuf(void) { int i; for (i = 0; ibuf && i < ibuflines; i++) { free(ibuf[i]); } ibuflines = 0; free(ibuf); ibuf = NULL; } static void append_line(char *line) { ibuf = (char **) xrealloc(ibuf, (ibuflines + 1) * sizeof(char *)); ibuf[ibuflines++] = line; } static void vi_cmd(const char *command) { char tmpfn[256]; FILE *fp; int i; char *sqlch; FILE *tmpfp; char *line; char foobuf[40]; int tmpfd; mode_t old_mask; strcpy(tmpfn, "/tmp/fisqlXXXXXX"); old_mask = umask(077); tmpfd = mkstemp(tmpfn); umask(old_mask); if (tmpfd < 0 || (fp = fdopen(tmpfd, "w")) == NULL) { perror("fisql"); reset_term(); dbexit(); exit(2); } if (ibuflines) { for (i = 0; i < ibuflines; i++) { fputs(ibuf[i], fp); fputc('\n', fp); free(ibuf[i]); } } else { for (i = 0; ((sqlch = dbgetchar(dbproc, i)) != NULL); i++) { fputc(*sqlch, fp); } } fclose(fp); edit(command, tmpfn); ibuflines = 0; fp = fopen(tmpfn, "r"); if (!fp) { perror("fisql"); reset_term(); dbexit(); exit(2); } tmpfp = rl_instream; rl_instream = fp; strcpy(foobuf, "1>> "); while ((line = readline(foobuf)) != NULL) { append_line(line); sprintf(foobuf, "%d>> ", ibuflines + 1); } rl_instream = tmpfp; fclose(fp); fputc('\r', stdout); fflush(stdout); unlink(tmpfn); } static void system_cmd(const char *cmd) { #if HAVE_SYSTEM int rv; switch (rv = system(cmd)) { case 0: break; case -1: fprintf(stderr, "Failed to execute `%s'\n", cmd); break; default: fprintf(stderr, "Command `%s' exited " "with code %d\n", cmd, rv); break; } #else fprintf(stderr, "Your system cannot execute commands. Tried to execute `%s'\n", cmd); #endif } static void readfile_cmd(char *line) { FILE *fp; FILE *tmpfp; FILE *tmpfp2; char *tfn; char *cp; for (cp = line + 2; *cp && (isspace((unsigned char) *cp)); cp++) continue; tfn = cp; for (; *cp && !(isspace((unsigned char) *cp)); cp++) continue; *cp = '\0'; if ((fp = fopen(tfn, "r")) == NULL) { fprintf(stderr, "Operating system error: Failed to open %s.\n", tfn); return; } tmpfp = rl_instream; tmpfp2 = rl_outstream; rl_instream = fp; rl_outstream = fopen("/dev/null", "w"); while ((line = readline("")) != NULL) { append_line(line); } rl_instream = tmpfp; fclose(rl_outstream); rl_outstream = tmpfp2; fclose(fp); fputc('\r', stdout); fflush(stdout); } static void read_sql_lines(void) { char *cp; char *firstword; char firstword_separator; char *line = NULL; char foobuf[40]; bool in_comment = false; reset_ibuf(); while (1) { if (no_prompt) { foobuf[0] = '\0'; } else { sprintf(foobuf, "%d>> ", ibuflines + 1); } free(line); line = readline(foobuf); if (line == NULL) { reset_term(); dbexit(); exit(default_exit); } for (cp = line; *cp && isspace((unsigned char) *cp); cp++) continue; if (*cp) { add_history(line); } if (in_comment) { goto append_line; } if (!(strncasecmp(line, "!!", 2))) { system_cmd(line + 2); continue; } /* XXX: isql off-by-one line count error for :r not duplicated */ if (!(strncasecmp(line, ":r", 2))) { readfile_cmd(line); continue; } firstword = line; firstword_separator = '\0'; for (cp = firstword; *cp; cp++) { if (isspace((unsigned char) *cp)) { firstword_separator = *cp; *cp = '\0'; break; } } if ((!(strcasecmp(firstword, "exit"))) || (!(strcasecmp(firstword, "quit")))) { reset_term(); dbexit(); exit(default_exit); } if (!(strcasecmp(firstword, "reset"))) { reset_ibuf(); continue; } if (!(strcasecmp(firstword, cmdend))) { if (ibuflines == 0) { continue; } break; } if ((!(strcasecmp(firstword, "vi"))) || (!(strcasecmp(firstword, editor)))) { vi_cmd(firstword); continue; } firstword[strlen(firstword)] = firstword_separator; append_line: in_comment = update_comment(in_comment, line); append_line(line); line = NULL; } } int main(int argc, char *argv[]) { int echo = 0; #ifdef notyet int print_statistics = 0; #endif int fipsflagger = 0; int perfstats = 0; int use_encryption = 0; int chained_transactions = 0; int headers = 0; char *columnwidth = NULL; const char *colseparator = " "; const char *lineseparator = "\n"; int timeout = 0; char *username = NULL; char *password = NULL; char *server = NULL; DBCHAR *char_set = NULL; char *hostname = NULL; char *interfaces_filename = NULL; char *input_filename = NULL; char *output_filename = NULL; int logintime = -1; char *language = NULL; int size = 0; char *sybenv; LOGINREC *login; int printedlines; int i; int dbrc; int c; int errflg = 0; char *prbuf; int prbuflen; int num_cols; int selcol; int col; int collen; DBINT colid; const char *opname; char adbuf[512]; DBINT convlen; int printedcompute = 0; char adash; const char *database_name = NULL; setlocale(LC_ALL, ""); #ifdef __VMS /* Convert VMS-style arguments to Unix-style */ parse_vms_args(&argc, &argv); #endif editor = getenv("EDITOR"); if (!editor) { editor = getenv("VISUAL"); } if (!editor) { editor = "vi"; } opterr = 0; optarg = NULL; while (!errflg && (c = getopt(argc, argv, "eFgpnvXYa:c:D:E:h:H:i:I:J:l:m:o:P:s:S:t:U:w:y:z:A:")) != -1) { switch (c) { case 'e': echo = 1; break; case 'F': fipsflagger = 1; break; case 'g': errflg++; break; case 'p': errflg++; perfstats = 1; break; case 'n': no_prompt = 1; break; case 'v': puts("fisql, a free isql replacement by Nicholas S. Castellano"); return EXIT_SUCCESS; break; case 'X': /* XXX: We get a different error message than isql gives; neither seems * to work */ use_encryption = 1; break; case 'Y': chained_transactions = 1; break; case 'c': cmdend = optarg; break; case 'E': editor = optarg; break; case 'h': headers = atoi(optarg); break; case 'H': hostname = optarg; break; case 'i': input_filename = optarg; break; case 'I': interfaces_filename = optarg; break; case 'J': errflg++; break; case 'l': logintime = atoi(optarg); break; case 'm': global_errorlevel = atoi(optarg); break; case 'o': output_filename = optarg; break; case 'P': password = optarg; break; case 's': colseparator = optarg; break; case 'S': server = optarg; break; case 't': timeout = atoi(optarg); break; case 'U': username = optarg; break; case 'w': columnwidth = optarg; break; case 'y': /* XXX: this doesn't seem to be what isql does with -y...it doesn't * seem to do anything actually */ sybenv = (char *) xmalloc((strlen(optarg) + 8) * sizeof(char)); strcpy(sybenv, "SYBASE="); strcat(sybenv, optarg); putenv(sybenv); break; case 'z': language = optarg; break; case 'A': size = atoi(optarg); break; case 'D': database_name = optarg; break; default: errflg++; break; } } if (errflg) { fprintf(stderr, "usage: fisql [-e] [-F] [-g] [-p] [-n] [-v] [-X] [-Y]\n"); fprintf(stderr, "\t[-c cmdend] [-D database_name] [-E editor]\n"); fprintf(stderr, "\t[-h headers] [-H hostname] [-i inputfile]\n"); fprintf(stderr, "\t[-I interfaces_file] [-J client character set]\n"); fprintf(stderr, "\t[-l login_timeout] [-m errorlevel]\n"); fprintf(stderr, "\t[-o outputfile]\n"); fprintf(stderr, "\t[-P password] [-s colseparator] [-S server]\n"); fprintf(stderr, "\t[-t timeout] [-U username] [-w columnwidth]\n"); fprintf(stderr, "\t[-y sybase_dir] [-z language]\n"); return EXIT_FAILURE; } if (!(isatty(fileno(stdin)))) { no_prompt = 1; rl_outstream = fopen("/dev/null", "rw"); } rl_readline_name = "fisql"; rl_bind_key('\t', rl_insert); if (password == NULL) { password = (char *) xmalloc(READPASSPHRASE_MAXLEN); readpassphrase("Password: ", password, READPASSPHRASE_MAXLEN, RPP_ECHO_OFF); } if (input_filename) { if (freopen(input_filename, "r", stdin) == NULL) { /* XXX: sybase isql generates this error while parsing the options, * but doesn't redirect the input until after the Password: prompt */ /* lack of newline for bug-compatibility with isql */ fprintf(stderr, "Unable to open input file '%s'.", optarg); return EXIT_FAILURE; } } if (output_filename) { if (freopen(output_filename, "w", stdout) == NULL) { /* XXX: sybase isql generates this error while parsing the options, * but doesn't redirect the output until after the Password: prompt */ /* lack of newline for bug-compatibility with isql */ fprintf(stderr, "Unable to open output file '%s'.", output_filename); return EXIT_FAILURE; } } if (isatty(fileno(stdin))) { rl_outstream = stdout; } dbinit(); #if 0 #ifdef DBVERSION_100 dbsetversion(DBVERSION_100); #endif #endif if ((login = dblogin()) == NULL) { reset_term(); return EXIT_FAILURE; } dbmsghandle(msg_handler); dberrhandle(err_handler); DBSETLAPP(login, "fisql"); if (username) { DBSETLUSER(login, username); } DBSETLPWD(login, password); memset(password, 0, strlen(password)); if (char_set) { DBSETLCHARSET(login, char_set); } if (use_encryption) { DBSETLENCRYPT(login, TRUE); } if (hostname) { DBSETLHOST(login, hostname); } if (language) { DBSETLNATLANG(login, language); } if (size) { DBSETLPACKET(login, (short) size); } if (interfaces_filename) { dbsetifile(interfaces_filename); } dbsettime(timeout); if (logintime >= 0) { dbsetlogintime(logintime); } if (database_name) { DBSETLDBNAME(login, database_name); } if ((dbproc = dbopen(login, server)) == NULL) { fprintf(stderr, "fisql: dbopen() failed.\n"); reset_term(); return EXIT_FAILURE; } dbsetopt(dbproc, DBPRLINESEP, lineseparator, strlen(lineseparator)); if (colseparator) { dbsetopt(dbproc, DBPRCOLSEP, colseparator, strlen(colseparator)); } if (columnwidth) { dbsetopt(dbproc, DBPRLINELEN, columnwidth, 0); } if (chained_transactions) { dbsetopt(dbproc, DBCHAINXACTS, NULL, 0); } if (fipsflagger) { dbsetopt(dbproc, DBFIPSFLAG, NULL, 0); } if (perfstats) { dbsetopt(dbproc, DBSTAT, "time", 0); } while (1) { if (sigsetjmp(restart, 1)) { reset_ibuf(); fputc('\n', stdout); rl_on_new_line(); rl_reset_line_state(); } dbcancel(dbproc); signal(SIGINT, inactive_interrupt_handler); read_sql_lines(); dbfreebuf(dbproc); for (i = 0; i < ibuflines; i++) { if (echo) { puts(ibuf[i]); } dbcmd(dbproc, ibuf[i]); dbcmd(dbproc, "\n"); free(ibuf[i]); } free(ibuf); ibuf = NULL; signal(SIGINT, active_interrupt_handler); dbsetinterrupt(dbproc, (void *) active_interrupt_pending, (void *) active_interrupt_servhandler); if (dbsqlexec(dbproc) == SUCCEED) { int status_printed = 0; maybe_handle_active_interrupt(); while ((dbrc = dbresults(dbproc)) != NO_MORE_RESULTS) { printedlines = 0; #define USE_DBPRROW 0 #if USE_DBPRROW dbprhead(dbproc); dbprrow(dbproc); #else if ((dbrc == SUCCEED) && (DBROWS(dbproc) == SUCCEED)) { prbuflen = dbspr1rowlen(dbproc); prbuf = (char *) xmalloc(prbuflen * sizeof(char)); dbsprhead(dbproc, prbuf, prbuflen); fputs(prbuf, stdout); fputc('\n', stdout); dbsprline(dbproc, prbuf, prbuflen, '-'); fputs(prbuf, stdout); fputc('\n', stdout); maybe_handle_active_interrupt(); while ((dbrc = dbnextrow(dbproc)) != NO_MORE_ROWS) { if (dbrc == FAIL) { break; } if (dbrc != REG_ROW) { num_cols = dbnumalts(dbproc, dbrc); for (selcol = col = 1; col <= num_cols; col++) { colid = dbaltcolid(dbproc, dbrc, col); while (selcol < colid) { collen = get_printable_column_size(dbproc, selcol); for (i = 0; i < collen; i++) { putchar(' '); } selcol++; printf("%s", colseparator); } opname = dbprtype(dbaltop(dbproc, dbrc, col)); printf("%s", opname); collen = get_printable_column_size(dbproc, colid); collen -= strlen(opname); while (collen-- > 0) { putchar(' '); } selcol++; printf("%s", colseparator); } printf("%s", lineseparator); for (selcol = col = 1; col <= num_cols; col++) { colid = dbaltcolid(dbproc, dbrc, col); while (selcol < colid) { collen = get_printable_column_size(dbproc, selcol); for (i = 0; i < collen; i++) { putchar(' '); } selcol++; printf("%s", colseparator); } collen = get_printable_column_size(dbproc, colid); adash = '-'; for (i = 0; i < collen; i++) { putchar(adash); } selcol++; printf("%s", colseparator); } printf("%s", lineseparator); for (selcol = col = 1; col <= num_cols; col++) { colid = dbaltcolid(dbproc, dbrc, col); while (selcol < colid) { collen = get_printable_column_size(dbproc, selcol); for (i = 0; i < collen; i++) { putchar(' '); } selcol++; printf("%s", colseparator); } convlen = dbconvert(dbproc, dbalttype(dbproc, dbrc, col), dbadata(dbproc, dbrc, col), dbadlen(dbproc, dbrc, col), SYBCHAR, (BYTE *) adbuf, sizeof(adbuf)); printf("%.*s", (int) convlen, adbuf); collen = get_printable_column_size(dbproc, colid); collen -= convlen; while (collen-- > 0) { putchar(' '); } selcol++; printf("%s", colseparator); } printf("%s", lineseparator); printedcompute = 1; continue; } if (printedcompute || (headers && (printedlines >= headers) && ((printedlines % headers) == 0))) { fputc('\n', stdout); dbsprhead(dbproc, prbuf, prbuflen); fputs(prbuf, stdout); fputc('\n', stdout); dbsprline(dbproc, prbuf, prbuflen, '-'); fputs(prbuf, stdout); fputc('\n', stdout); printedcompute = 0; } printedlines++; dbspr1row(dbproc, prbuf, prbuflen); fputs(prbuf, stdout); fputc('\n', stdout); maybe_handle_active_interrupt(); } fputc('\n', stdout); free(prbuf); maybe_handle_active_interrupt(); } #endif if (dbrc != FAIL) { if ((DBCOUNT(dbproc) >= 0) || dbhasretstat(dbproc)) { if (DBCOUNT(dbproc) >= 0) { printf("(%d rows affected", (int) DBCOUNT(dbproc)); if (dbhasretstat(dbproc)) { status_printed = 1; dbrc = dbretstatus(dbproc); printf(", return status = %d", dbrc); } printf(")\n"); } else { if (dbhasretstat(dbproc)) { status_printed = 1; dbrc = dbretstatus(dbproc); printf("(return status = %d)\n", dbrc); } } } } } if (!status_printed && dbhasretstat(dbproc)) { dbrc = dbretstatus(dbproc); printf("(return status = %d)\n", dbrc); } } else { /* Something failed, so change the default * exit status to reflect that. */ default_exit = EXIT_FAILURE; } } reset_term(); dbexit(); return EXIT_FAILURE; } freetds-1.3.6/src/apps/fisql/terminal.h000644 025423 025423 00000001653 14056414221 021443 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* $Id: terminal.h,v 1.4 2007-01-20 06:32:27 castellano Exp $ */ int save_term(void); int set_term_noecho(void); int reset_term(void); freetds-1.3.6/src/apps/fisql/terminal.c000644 025423 025423 00000003242 14056414221 021432 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include "terminal.h" static struct termios term; static struct termios oterm; static int term_init = 0; int save_term() { int r; if (!isatty(fileno(stdin))) { return 1; } if (term_init) { return 0; } if ((r = tcgetattr(fileno(stdin), &oterm)) != 0) { return r; } term_init = 1; return 0; } int set_term_noecho() { int r; if (!isatty(fileno(stdin))) { return 1; } if ((r = save_term()) != 0) { return r; } if ((r = tcgetattr(fileno(stdin), &term)) != 0) { return r; } term.c_lflag &= ~(ICANON | ECHO); if ((r = tcsetattr(fileno(stdin), TCSANOW, &term)) != 0) { return r; } return 0; } int reset_term() { int r; if (!isatty(fileno(stdin))) { return 1; } if ((r = save_term()) != 0) { return r; } if ((r = tcsetattr(fileno(stdin), TCSANOW, &oterm)) != 0) { return r; } return 0; } freetds-1.3.6/src/apps/fisql/edit.h000644 025423 025423 00000001620 14056414221 020547 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* $Id: edit.h,v 1.3 2007-01-20 06:32:27 castellano Exp $ */ int edit(const char *editor, const char *arg); freetds-1.3.6/src/apps/fisql/edit.c000644 025423 025423 00000002711 14056414221 020544 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #include "edit.h" #include "terminal.h" int edit(const char *editor, const char *arg) { int pid; retry_fork: pid = fork(); switch (pid) { case -1: if (errno == EAGAIN) { sleep(5); goto retry_fork; } perror("fisql"); reset_term(); dbexit(); exit(EXIT_FAILURE); break; case 0: execlp(editor, editor, arg, (char *) 0); fprintf(stderr, "Unable to invoke the '%s' editor.\n", editor); exit(EXIT_FAILURE); break; default: waitpid(pid, (int *) 0, 0); break; } return 0; } freetds-1.3.6/src/apps/fisql/handlers.h000644 025423 025423 00000002166 14056414221 021430 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* $Id: handlers.h,v 1.4 2007-01-20 06:32:27 castellano Exp $ */ extern int global_errorlevel; int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); freetds-1.3.6/src/apps/fisql/handlers.c000644 025423 025423 00000003613 14056414221 021421 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include "handlers.h" int global_errorlevel = -1; int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { if ((dbproc == NULL) || (DBDEAD(dbproc))) { return (INT_EXIT); } if (dberr != SYBESMSG) { printf("DB-LIBRARY error:\n\t%s\n", dberrstr); } if (oserr != DBNOERR) { printf("Operating-system error:\n\t%s\n", oserrstr); } return (INT_CANCEL); } int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { if (severity > 10) { if ((global_errorlevel == -1) || (severity >= global_errorlevel)) { printf("Msg %ld, Level %d, State %d:\n", (long) msgno, severity, msgstate); } if (global_errorlevel == -1) { if (strlen(srvname) > 0) { printf("Server '%s', ", srvname); } if (strlen(procname) > 0) { printf("Procedure '%s', ", procname); } if (line > 0) { printf("Line %d:\n", line); } } } if (global_errorlevel == -1) { printf("%s\n", msgtext); } return (0); } freetds-1.3.6/src/apps/fisql/interrupt.h000644 025423 025423 00000002146 14056414221 021662 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* $Id: interrupt.h,v 1.4 2007-01-20 06:32:27 castellano Exp $ */ extern sigjmp_buf restart; void inactive_interrupt_handler(int sig); void active_interrupt_handler(int sig); void maybe_handle_active_interrupt(void); int active_interrupt_pending(DBPROCESS * dbproc); int active_interrupt_servhandler(DBPROCESS * dbproc); freetds-1.3.6/src/apps/fisql/interrupt.c000644 025423 025423 00000002640 14056414221 021654 0ustar00fredianofrediano000000 000000 /* Free ISQL - An isql for DB-Library (C) 2007 Nicholas S. Castellano * * 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 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 General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include "interrupt.h" sigjmp_buf restart; volatile int os_interrupt = 0; void inactive_interrupt_handler(int sig) { siglongjmp(restart, 1); } void active_interrupt_handler(int sig) { os_interrupt = sig; } void maybe_handle_active_interrupt(void) { int sig; if (os_interrupt) { sig = os_interrupt; os_interrupt = 0; inactive_interrupt_handler(sig); } } int active_interrupt_pending(DBPROCESS * dbproc) { if (os_interrupt) { return TRUE; } return FALSE; } int active_interrupt_servhandler(DBPROCESS * dbproc) { return INT_CANCEL; } freetds-1.3.6/src/pool/Makefile.am000644 025423 025423 00000000664 14056414222 020405 0ustar00fredianofrediano000000 000000 AM_CPPFLAGS = -I$(top_srcdir)/include -I. -I$(SERVERDIR) bin_PROGRAMS = tdspool tdspool_SOURCES = config.c main.c member.c user.c util.c pool.h SERVERDIR = ../server LDADD = ../server/libtdssrv.la $(LTLIBICONV) EXTRA_DIST = BUGS pool.conf CMakeLists.txt ETC = $(DESTDIR)$(sysconfdir) install-data-local: $(mkinstalldirs) $(ETC) if test ! -f $(ETC)/pool.conf; then \ $(INSTALL) -m 644 $(srcdir)/pool.conf $(ETC)/pool.conf; \ fi freetds-1.3.6/src/pool/Makefile.in000644 025423 025423 00000055465 14162303357 020433 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = tdspool$(EXEEXT) subdir = src/pool ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_tdspool_OBJECTS = config.$(OBJEXT) main.$(OBJEXT) member.$(OBJEXT) \ user.$(OBJEXT) util.$(OBJEXT) tdspool_OBJECTS = $(am_tdspool_OBJECTS) tdspool_LDADD = $(LDADD) am__DEPENDENCIES_1 = tdspool_DEPENDENCIES = ../server/libtdssrv.la $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/config.Po ./$(DEPDIR)/main.Po \ ./$(DEPDIR)/member.Po ./$(DEPDIR)/user.Po ./$(DEPDIR)/util.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(tdspool_SOURCES) DIST_SOURCES = $(tdspool_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs README TODO DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include -I. -I$(SERVERDIR) tdspool_SOURCES = config.c main.c member.c user.c util.c pool.h SERVERDIR = ../server LDADD = ../server/libtdssrv.la $(LTLIBICONV) EXTRA_DIST = BUGS pool.conf CMakeLists.txt ETC = $(DESTDIR)$(sysconfdir) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/pool/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/pool/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list tdspool$(EXEEXT): $(tdspool_OBJECTS) $(tdspool_DEPENDENCIES) $(EXTRA_tdspool_DEPENDENCIES) @rm -f tdspool$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tdspool_OBJECTS) $(tdspool_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/member.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/config.Po -rm -f ./$(DEPDIR)/main.Po -rm -f ./$(DEPDIR)/member.Po -rm -f ./$(DEPDIR)/user.Po -rm -f ./$(DEPDIR)/util.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-data-local install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/config.Po -rm -f ./$(DEPDIR)/main.Po -rm -f ./$(DEPDIR)/member.Po -rm -f ./$(DEPDIR)/user.Po -rm -f ./$(DEPDIR)/util.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-data-local install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS .PRECIOUS: Makefile install-data-local: $(mkinstalldirs) $(ETC) if test ! -f $(ETC)/pool.conf; then \ $(INSTALL) -m 644 $(srcdir)/pool.conf $(ETC)/pool.conf; \ fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/pool/README000644 025423 025423 00000006236 14056414222 017232 0ustar00fredianofrediano000000 000000 TDS Connection Pooling v0.01 Introduction ------------ The purpose of the TDS Connection Pool is to share a limited number of actual database connections among a larger group of virtual database clients. The advantages are twofold. First, a dataserver with a limited number of licenses can be used with the tdspool program to support a large number of client connections. For instance if you have a database with a 10 concurrent license limit and 35 Apache/PHP children, which access the database infrequently, you could share those 10 real connections among all the apache children. Secondly, TDS Connection Pool acts as a sort of persistant connect for it's clients. This works because logins to the connection pool are very quick in comparision to logins into the dataserver. Connections to the dataserver are maintained for the life of the tdspool program. Terminology ----------- Pool Server, the tdspool program. Client, the application using TDS (generally through freetds dblib or ctlib) to connect to the Connection Pooling Server. DataServer, the Sybase or MS SQL Server database. Pool User, the connection from the client to the Pool Server. Pool Member, a connection to the dataserver maintained by the tdspool program. How It Works ------------ On start up the Pool Server opens a predefined number of connections (Members) to the DataServer. It then opens a listening socket on the configured port and goes into its main loop. When a Client connects, the Pool Server accepts the connection, creates a User and sets its state to TDS_SRV_LOGIN, and returns to the main loop. When a Client in the TDS_SRV_LOGIN state sends a login packet, the packet is parsed and if the login information matches, a TDS login acknowledgement stream is forged by the Pool Server and sent to the Client. The User structure then goes to the TDS_SRV_IDLE state. The Pool Server then returns to the main loop. When the Client in the TDS_SRV_IDLE state sends a query, the member list is searched for a Member with its TDS socket in the TDS_COMPLETED state. This Member is then allocated to the User. The User is then switched to the TDS_SRV_QUERY state. If no free Member is found, the User is placed in the TDS_SRV_WAIT state and the search will be reattempted the next time the server is woken up by activity (such as a Member completing). When a User is placed in a wait, a message is logged to let the administrator know that the number of Members may need to be adjusted upwards. When results are recieved from the DataServer, they are forwarded to the User that currently has that Member allocated. The Pool Server processes through the results prior to forwarding, looking for the end token. When it is found the Member is deallocated from the User. The Member returns to the idle list and the User is returned to the TDS_SRV_IDLE state. One caveat to this is that querys that contain stateful information, such as the need to query @@identity after inserting, will not work. I am currently, thinking of adding a "lock connection" command that will be intercepted by the Pool Server and will cause it to allocate a Member to that User until an "unlock connection" command is received. freetds-1.3.6/src/pool/TODO000644 025423 025423 00000000553 14056414222 017036 0ustar00fredianofrediano000000 000000 Handle closed connections by the dataserver (done) Timeout open member connections. (done) Open member connections on the fly. (done) Add TDS_SRV_WAIT state when all members are in use. (done) Handle SIGTERM (partial...add timeout to select() call) Error checking is weak in several places. Need to handle larger packet sizes Add blob support Add TDS 5/7 support freetds-1.3.6/src/pool/config.c000644 025423 025423 00000011024 14056414222 017752 0ustar00fredianofrediano000000 000000 /* TDSPool - Connection pooling for TDS based databases * Copyright (C) 2001 Brian Bruns * Copyright (C) 2005 Frediano Ziglio * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #include "pool.h" #include #define POOL_STR_SERVER "server" #define POOL_STR_PORT "port" #define POOL_STR_USER "user" #define POOL_STR_PASSWORD "password" #define POOL_STR_DATABASE "database" #define POOL_STR_SERVER_USER "server user" #define POOL_STR_SERVER_PASSWORD "server password" #define POOL_STR_MAX_MBR_AGE "max member age" #define POOL_STR_MAX_POOL_CONN "max pool conn" #define POOL_STR_MIN_POOL_CONN "min pool conn" #define POOL_STR_MAX_POOL_USERS "max pool users" typedef struct { TDS_POOL *pool; char **err; } conf_params; static void pool_parse(const char *option, const char *value, void *param); static bool pool_read_conf_file(const char *path, const char *poolname, conf_params *params); bool pool_read_conf_files(const char *path, const char *poolname, TDS_POOL * pool, char **err) { bool found = false; conf_params params = { pool, err }; if (path && !found) return pool_read_conf_file(path, poolname, ¶ms); if (!found) { char *path = tds_get_home_file(".pool.conf"); if (path) { found = pool_read_conf_file(path, poolname, ¶ms); free(path); } } if (!found) found = pool_read_conf_file(FREETDS_POOLCONFFILE, poolname, ¶ms); return found; } static bool pool_read_conf_file(const char *path, const char *poolname, conf_params *params) { FILE *in; bool found = false; in = fopen(path, "r"); if (in) { tdsdump_log(TDS_DBG_INFO1, "Found conf file %s reading sections\n", path); tds_read_conf_section(in, "global", pool_parse, params); rewind(in); found = tds_read_conf_section(in, poolname, pool_parse, params); fclose(in); } return found; } /** * Parse an unsigned number, returns -1 on error. * Returns a signed int to make possible to return negative * values for include numbers (we don't need big numbers) */ static int pool_get_uint(const char *value) { char *end; unsigned long int val; errno = 0; val = strtoul(value, &end, 0); if (errno != 0 || end == value || val > INT_MAX) return -1; return (int) val; } static void pool_parse(const char *option, const char *value, void *param) { conf_params *params = (conf_params *) param; TDS_POOL *pool = params->pool; int val = 0; if (!strcmp(option, POOL_STR_PORT)) { val = pool_get_uint(value); if (val < 1 || val >= 65536) val = -1; pool->port = val; } else if (!strcmp(option, POOL_STR_SERVER)) { free(pool->server); pool->server = strdup(value); } else if (!strcmp(option, POOL_STR_USER)) { free(pool->user); pool->user = strdup(value); } else if (!strcmp(option, POOL_STR_DATABASE)) { free(pool->database); pool->database = strdup(value); } else if (!strcmp(option, POOL_STR_PASSWORD)) { free(pool->password); pool->password = strdup(value); } else if (!strcmp(option, POOL_STR_SERVER_USER)) { free(pool->server_user); pool->server_user = strdup(value); } else if (!strcmp(option, POOL_STR_SERVER_PASSWORD)) { free(pool->server_password); pool->server_password = strdup(value); } else if (!strcmp(option, POOL_STR_MAX_MBR_AGE)) { val = pool_get_uint(value); pool->max_member_age = val; } else if (!strcmp(option, POOL_STR_MAX_POOL_CONN)) { val = pool_get_uint(value); pool->max_open_conn = val; } else if (!strcmp(option, POOL_STR_MIN_POOL_CONN)) { val = pool_get_uint(value); pool->min_open_conn = val; } if (val < 0) { free(*params->err); if (asprintf(params->err, "Invalid value '%s' specified for %s", value, option) < 0) *params->err = "Memory error parsing options"; } } freetds-1.3.6/src/pool/main.c000644 025423 025423 00000024006 14056414271 017441 0ustar00fredianofrediano000000 000000 /* TDSPool - Connection pooling for TDS based databases * Copyright (C) 2001 Brian Bruns * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /* * Note on terminology: a pool member is a connection to the database, * a pool user is a client connection that is temporarily assigned to a * pool member. */ #include #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_POLL_H #include #endif /* HAVE_POLL_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #ifdef _WIN32 #include #endif #include "pool.h" #include /* to be set by sig term */ static int got_sigterm = 0; static const char *logfile_name = NULL; static void sigterm_handler(int sig); static void pool_schedule_waiters(TDS_POOL * pool); static TDS_POOL *pool_init(const char *name, const char *config_path); static void pool_socket_init(TDS_POOL * pool); static void pool_main_loop(TDS_POOL * pool); static bool pool_open_logfile(TDS_POOL * pool); static void sigterm_handler(int sig) { got_sigterm = 1; } #ifndef _WIN32 static int got_sighup = 0; static void sighup_handler(int sig) { got_sighup = 1; } #endif static void check_field(const char *pool_name, bool cond, const char *field_name) { if (!cond) { fprintf(stderr, "No %s specified for pool ``%s''.\n", field_name, pool_name); exit(EXIT_FAILURE); } } /* * pool_init creates a named pool and opens connections to the database */ static TDS_POOL * pool_init(const char *name, const char *config_path) { TDS_POOL *pool; char *err = NULL; /* initialize the pool */ pool = tds_new0(TDS_POOL, 1); if (!pool) { fprintf(stderr, "Could not allocate memory for pool\n"); exit(EXIT_FAILURE); } pool->password = strdup(""); pool->event_fd = INVALID_SOCKET; if (tds_mutex_init(&pool->events_mtx)) { fprintf(stderr, "Error initializing pool mutex\n"); exit(EXIT_FAILURE); } /* FIXME -- read this from the conf file */ if (!pool_read_conf_files(config_path, name, pool, &err)) { fprintf(stderr, "Configuration for pool ``%s'' not found.\n", name); exit(EXIT_FAILURE); } if (err) { fprintf(stderr, "%s\n", err); exit(EXIT_FAILURE); } check_field(name, pool->user != NULL, "user"); check_field(name, pool->server != NULL, "server"); check_field(name, pool->port != 0, "port"); if (!pool->server_user) pool->server_user = strdup(pool->user); if (!pool->server_password) pool->server_password = strdup(pool->password); if (pool->max_open_conn < pool->min_open_conn) { fprintf(stderr, "Max connections less than minimum\n"); exit(EXIT_FAILURE); } pool->name = strdup(name); pool_open_logfile(pool); pool_mbr_init(pool); pool_user_init(pool); pool_socket_init(pool); return pool; } static void pool_destroy(TDS_POOL *pool) { pool_mbr_destroy(pool); pool_user_destroy(pool); CLOSESOCKET(pool->wakeup_fd); CLOSESOCKET(pool->listen_fd); CLOSESOCKET(pool->event_fd); tds_mutex_free(&pool->events_mtx); free(pool->user); free(pool->password); free(pool->server); free(pool->database); free(pool->name); free(pool->server_user); free(pool->server_password); free(pool); } static void pool_schedule_waiters(TDS_POOL * pool) { TDS_POOL_USER *puser; /* first see if there are free members to do the request */ if (!dlist_member_first(&pool->idle_members)) return; while ((puser = dlist_user_first(&pool->waiters)) != NULL) { if (puser->user_state == TDS_SRV_WAIT) { /* place back in query state */ puser->user_state = TDS_SRV_QUERY; dlist_user_remove(&pool->waiters, puser); dlist_user_append(&pool->users, puser); /* now try again */ pool_user_query(pool, puser); return; } } } typedef struct select_info { fd_set rfds, wfds; TDS_SYS_SOCKET maxfd; } SELECT_INFO; static void pool_select_add_socket(SELECT_INFO *sel, TDS_POOL_SOCKET *sock) { /* skip dead connections */ if (IS_TDSDEAD(sock->tds)) return; if (!sock->poll_recv && !sock->poll_send) return; if (tds_get_s(sock->tds) > sel->maxfd) sel->maxfd = tds_get_s(sock->tds); if (sock->poll_recv) FD_SET(tds_get_s(sock->tds), &sel->rfds); if (sock->poll_send) FD_SET(tds_get_s(sock->tds), &sel->wfds); } static void pool_process_events(TDS_POOL *pool) { TDS_POOL_EVENT *events, *next; /* detach events from pool */ tds_mutex_lock(&pool->events_mtx); events = pool->events; pool->events = NULL; tds_mutex_unlock(&pool->events_mtx); /* process them */ while (events) { next = events->next; events->next = NULL; events->execute(events); free(events); events = next; } } static bool pool_open_logfile(TDS_POOL *pool) { int fd; tds_g_append_mode = 0; tdsdump_open(getenv("TDSDUMP")); if (!logfile_name) return true; fd = open(logfile_name, O_WRONLY|O_CREAT|O_APPEND, 0644); if (fd < 0) return false; fflush(stdout); fflush(stderr); while (dup2(fd, fileno(stdout)) < 0 && errno == EINTR) continue; while (dup2(fd, fileno(stderr)) < 0 && errno == EINTR) continue; close(fd); fflush(stdout); fflush(stderr); return true; } static void pool_socket_init(TDS_POOL * pool) { struct sockaddr_in sin; TDS_SYS_SOCKET s, event_pair[2]; int socktrue = 1; /* FIXME -- read the interfaces file and bind accordingly */ sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons(pool->port); sin.sin_family = AF_INET; if (TDS_IS_SOCKET_INVALID(s = socket(AF_INET, SOCK_STREAM, 0))) { perror("socket"); exit(1); } tds_socket_set_nonblocking(s); /* don't keep addr in use from s.craig@andronics.com */ setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const void *) &socktrue, sizeof(socktrue)); fprintf(stderr, "Listening on port %d\n", pool->port); if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) { perror("bind"); exit(1); } listen(s, 5); pool->listen_fd = s; if (socketpair(AF_UNIX, SOCK_STREAM, 0, event_pair) < 0) { perror("socketpair"); exit(1); } tds_socket_set_nonblocking(event_pair[0]); tds_socket_set_nonblocking(event_pair[1]); pool->event_fd = event_pair[1]; pool->wakeup_fd = event_pair[0]; } /* * pool_main_loop * Accept new connections from clients, and handle all input from clients and * pool members. */ static void pool_main_loop(TDS_POOL * pool) { TDS_POOL_MEMBER *pmbr; TDS_POOL_USER *puser; TDS_SYS_SOCKET s, wakeup; SELECT_INFO sel; int min_expire_left = -1; struct timeval tv, *p_tv = NULL; s = pool->listen_fd; wakeup = pool->wakeup_fd; while (!got_sigterm) { FD_ZERO(&sel.rfds); FD_ZERO(&sel.wfds); /* add the listening socket to the read list */ FD_SET(s, &sel.rfds); FD_SET(wakeup, &sel.rfds); sel.maxfd = s > wakeup ? s : wakeup; /* add the user sockets to the read list */ DLIST_FOREACH(dlist_user, &pool->users, puser) pool_select_add_socket(&sel, &puser->sock); /* add the pool member sockets to the read list */ DLIST_FOREACH(dlist_member, &pool->active_members, pmbr) pool_select_add_socket(&sel, &pmbr->sock); p_tv = NULL; if (min_expire_left > 0) { tv.tv_sec = min_expire_left; tv.tv_usec = 0; p_tv = &tv; } /* FIXME check return value */ select(sel.maxfd + 1, &sel.rfds, &sel.wfds, NULL, p_tv); if (TDS_UNLIKELY(got_sigterm)) break; #ifndef _WIN32 if (TDS_UNLIKELY(got_sighup)) { got_sighup = 0; pool_open_logfile(pool); } #endif /* process events */ if (FD_ISSET(wakeup, &sel.rfds)) { char buf[32]; READSOCKET(wakeup, buf, sizeof(buf)); pool_process_events(pool); } /* process the sockets */ if (FD_ISSET(s, &sel.rfds)) { pool_user_create(pool, s); } pool_process_users(pool, &sel.rfds, &sel.wfds); min_expire_left = pool_process_members(pool, &sel.rfds, &sel.wfds); /* back from members */ if (dlist_user_first(&pool->waiters)) pool_schedule_waiters(pool); } /* while !got_sigterm */ tdsdump_log(TDS_DBG_INFO2, "Shutdown Requested\n"); } static void print_usage(const char *progname) { fprintf(stderr, "Usage:\t%s [-l ] [-c ] [-d] \n", progname); } int main(int argc, char **argv) { int opt; #ifdef HAVE_FORK bool daemonize = false; # define DAEMON_OPT "d" #else # define DAEMON_OPT "" #endif TDS_POOL *pool; const char *config_path = NULL; signal(SIGTERM, sigterm_handler); signal(SIGINT, sigterm_handler); #ifndef _WIN32 signal(SIGHUP, sighup_handler); signal(SIGPIPE, SIG_IGN); #endif while ((opt = getopt(argc, argv, "l:c:" DAEMON_OPT)) != -1) { switch (opt) { case 'l': logfile_name = optarg; break; #ifdef HAVE_FORK case 'd': daemonize = true; break; #endif case 'c': config_path = optarg; break; default: print_usage(argv[0]); return EXIT_FAILURE; } } if (optind >= argc) { print_usage(argv[0]); return EXIT_FAILURE; } pool = pool_init(argv[optind], config_path); #ifdef HAVE_FORK if (daemonize) { if (daemon(0, 0) < 0) { fprintf(stderr, "Failed to daemonize %s\n", argv[0]); return EXIT_FAILURE; } } #endif pool_main_loop(pool); printf("User logins %lu members logins %lu members at end %d\n", pool->user_logins, pool->member_logins, pool->num_active_members); pool_destroy(pool); printf("tdspool Shutdown\n"); return EXIT_SUCCESS; } freetds-1.3.6/src/pool/member.c000644 025423 025423 00000033235 14056414271 017770 0ustar00fredianofrediano000000 000000 /* TDSPool - Connection pooling for TDS based databases * Copyright (C) 2001, 2002, 2003, 2004, 2005 Brian Bruns * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #include "pool.h" #include #include #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256 #endif /* MAXHOSTNAMELEN */ static void pool_mbr_free_socket(TDSSOCKET *tds) { if (tds) { TDSCONTEXT *ctx = (TDSCONTEXT *) tds->conn->tds_ctx; tds_free_socket(tds); tds_free_context(ctx); } } /* * pool_mbr_login open a single pool login, to be call at init time or * to reconnect. */ static TDSSOCKET * pool_mbr_login(const TDS_POOL * pool, int tds_version) { TDSCONTEXT *context; TDSLOGIN *login; TDSSOCKET *tds; TDSLOGIN *connection; char hostname[MAXHOSTNAMELEN]; login = tds_alloc_login(1); if (!login) { fprintf(stderr, "out of memory"); return NULL; } if (gethostname(hostname, MAXHOSTNAMELEN) < 0) strlcpy(hostname, "tdspool", MAXHOSTNAMELEN); if (!tds_set_passwd(login, pool->server_password) || !tds_set_user(login, pool->server_user) || !tds_set_app(login, "tdspool") || !tds_set_host(login, hostname) || !tds_set_library(login, "TDS-Library") || !tds_set_server(login, pool->server) || !tds_set_client_charset(login, "iso_1") || !tds_set_language(login, "us_english")) { tds_free_login(login); return NULL; } if (tds_version > 0) login->tds_version = tds_version; if (pool->database && strlen(pool->database)) { if (!tds_dstr_copy(&login->database, pool->database)) { tds_free_login(login); return NULL; } } context = tds_alloc_context(NULL); if (!context) { fprintf(stderr, "Context cannot be null\n"); return NULL; } tds = tds_alloc_socket(context, 512); if (!tds) { fprintf(stderr, "tds cannot be null\n"); return NULL; } connection = tds_read_config_info(tds, login, context->locale); tds_free_login(login); if (!connection || TDS_FAILED(tds_connect_and_login(tds, connection))) { pool_mbr_free_socket(tds); tds_free_login(connection); /* what to do? */ fprintf(stderr, "Could not open connection to server %s\n", pool->server); return NULL; } tds_free_login(connection); if (pool->database && strlen(pool->database)) { if (strcasecmp(tds->conn->env.database, pool->database) != 0) { fprintf(stderr, "changing database failed\n"); return NULL; } } return tds; } void pool_assign_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr, TDS_POOL_USER *puser) { assert(pmbr->current_user == NULL); if (pmbr->current_user) { pmbr->current_user->assigned_member = NULL; } else { dlist_member_remove(&pool->idle_members, pmbr); dlist_member_append(&pool->active_members, pmbr); } pmbr->current_user = puser; puser->assigned_member = pmbr; } void pool_deassign_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr) { if (pmbr->current_user) { pmbr->current_user->assigned_member = NULL; pmbr->current_user = NULL; dlist_member_remove(&pool->active_members, pmbr); dlist_member_append(&pool->idle_members, pmbr); } pmbr->sock.poll_send = false; } /* * if a dead connection on the client side left this member in a questionable * state, let's bring in a correct one * We are not sure what the client did so we must try to clean as much as * possible. * Use pool_free_member if the state is really broken. */ void pool_reset_member(TDS_POOL * pool, TDS_POOL_MEMBER * pmbr) { // FIXME not wait for server !!! asyncronous TDSSOCKET *tds = pmbr->sock.tds; TDS_POOL_USER *puser; puser = pmbr->current_user; if (puser) { pool_deassign_member(pool, pmbr); pool_free_user(pool, puser); } /* cancel whatever pending */ tds_init_write_buf(tds); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) goto failure; tds->out_flag = TDS_CANCEL; if (TDS_FAILED(tds_flush_packet(tds))) goto failure; tds_set_state(tds, TDS_PENDING); tds->in_cancel = 2; if (TDS_FAILED(tds_process_cancel(tds))) goto failure; if (IS_TDS71_PLUS(tds->conn)) { /* this 0x9 final reset the state from mssql 2000 */ if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) goto failure; tds_start_query(tds, TDS_QUERY); tds_put_string(tds, "WHILE @@TRANCOUNT > 0 ROLLBACK SET TRANSACTION ISOLATION LEVEL READ COMMITTED", -1); tds_write_packet(tds, 0x9); tds_set_state(tds, TDS_PENDING); if (TDS_FAILED(tds_process_simple_query(tds))) goto failure; } return; failure: pool_free_member(pool, pmbr); } void pool_free_member(TDS_POOL * pool, TDS_POOL_MEMBER * pmbr) { TDSSOCKET *tds; TDS_POOL_USER *puser; tds = pmbr->sock.tds; if (tds) { if (!IS_TDSDEAD(tds)) tds_close_socket(tds); pool_mbr_free_socket(tds); pmbr->sock.tds = NULL; } /* * if he is allocated disconnect the client * otherwise we end up with broken client. */ puser = pmbr->current_user; if (puser) { pool_deassign_member(pool, pmbr); pool_free_user(pool, puser); } if (dlist_member_in_list(&pool->active_members, pmbr)) { pool->num_active_members--; dlist_member_remove(&pool->active_members, pmbr); } free(pmbr); } void pool_mbr_init(TDS_POOL * pool) { TDS_POOL_MEMBER *pmbr; /* allocate room for pool members */ pool->num_active_members = 0; dlist_member_init(&pool->active_members); dlist_member_init(&pool->idle_members); /* open connections for each member */ while (pool->num_active_members < pool->min_open_conn) { pmbr = tds_new0(TDS_POOL_MEMBER, 1); if (!pmbr) { fprintf(stderr, "Out of memory\n"); exit(1); } pmbr->sock.poll_recv = true; pmbr->sock.tds = pool_mbr_login(pool, 0); if (!pmbr->sock.tds) { fprintf(stderr, "Could not open initial connection\n"); exit(1); } pmbr->last_used_tm = time(NULL); pool->num_active_members++; dlist_member_append(&pool->idle_members, pmbr); if (!IS_TDS71_PLUS(pmbr->sock.tds->conn)) { fprintf(stderr, "Current pool implementation does not support protocol versions former than 7.1\n"); exit(1); } pool->member_logins++; } } void pool_mbr_destroy(TDS_POOL * pool) { while (dlist_member_first(&pool->active_members)) pool_free_member(pool, dlist_member_first(&pool->active_members)); while (dlist_member_first(&pool->idle_members)) pool_free_member(pool, dlist_member_first(&pool->idle_members)); assert(pool->num_active_members == 0); pool->num_active_members = 0; } static bool pool_process_data(TDS_POOL *pool, TDS_POOL_MEMBER *pmbr) { TDSSOCKET *tds = pmbr->sock.tds; TDS_POOL_USER *puser = NULL; for (;;) { if (pool_packet_read(tds)) break; /* disconnected */ if (tds->in_len == 0) { tdsdump_log(TDS_DBG_INFO1, "Uh oh! member disconnected\n"); /* mark as dead */ pool_free_member(pool, pmbr); return false; } tdsdump_dump_buf(TDS_DBG_NETWORK, "Got packet from server:", tds->in_buf, tds->in_len); puser = pmbr->current_user; if (!puser) break; tdsdump_log(TDS_DBG_INFO1, "writing it sock %d\n", tds_get_s(puser->sock.tds)); if (!pool_write_data(&pmbr->sock, &puser->sock)) { tdsdump_log(TDS_DBG_ERROR, "member received error while writing\n"); pool_free_user(pool, puser); return false; } if (tds->in_pos < tds->in_len) /* partial write, schedule a future write */ break; } if (puser && !puser->sock.poll_send) tds_socket_flush(tds_get_s(puser->sock.tds)); return true; } /* * pool_process_members * check the fd_set for members returning data to the client, lookup the * client holding this member and forward the results. * @return Timeout you should call this function again or -1 for infinite */ int pool_process_members(TDS_POOL * pool, fd_set * rfds, fd_set * wfds) { TDS_POOL_MEMBER *pmbr, *next; TDSSOCKET *tds; time_t age; time_t time_now; int min_expire_left = -1; for (next = dlist_member_first(&pool->active_members); (pmbr = next) != NULL; ) { bool processed = false; next = dlist_member_next(&pool->active_members, pmbr); if (pmbr->doing_async) continue; tds = pmbr->sock.tds; assert(tds); time_now = time(NULL); if (pmbr->sock.poll_recv && FD_ISSET(tds_get_s(tds), rfds)) { if (!pool_process_data(pool, pmbr)) continue; processed = true; } if (pmbr->sock.poll_send && FD_ISSET(tds_get_s(tds), wfds)) { if (!pool_write_data(&pmbr->current_user->sock, &pmbr->sock)) { pool_free_member(pool, pmbr); continue; } processed = true; } if (processed) pmbr->last_used_tm = time_now; } if (pool->num_active_members <= pool->min_open_conn) return min_expire_left; /* close old connections */ time_now = time(NULL); for (next = dlist_member_first(&pool->idle_members); (pmbr = next) != NULL; ) { next = dlist_member_next(&pool->idle_members, pmbr); assert(pmbr->sock.tds); assert(!pmbr->current_user); age = time_now - pmbr->last_used_tm; if (age >= pool->max_member_age) { tdsdump_log(TDS_DBG_INFO1, "member is %ld seconds old...closing\n", (long int) age); pool_free_member(pool, pmbr); } else { int left = (int) (pool->max_member_age - age); if (min_expire_left < 0 || left < min_expire_left) min_expire_left = left; } } return min_expire_left; } static bool compatible_versions(const TDSSOCKET *tds, const TDS_POOL_USER *user) { if (tds->conn->tds_version != user->login->tds_version) return false; return true; } typedef struct { TDS_POOL_EVENT common; TDS_POOL *pool; TDS_POOL_MEMBER *pmbr; int tds_version; } CONNECT_EVENT; static void connect_execute_ok(TDS_POOL_EVENT *base_event); static void connect_execute_ko(TDS_POOL_EVENT *base_event); static TDS_THREAD_PROC_DECLARE(connect_proc, arg) { CONNECT_EVENT *ev = (CONNECT_EVENT *) arg; TDS_POOL_MEMBER *pmbr = ev->pmbr; TDS_POOL *pool = ev->pool; for (;;) { pmbr->sock.tds = pool_mbr_login(pool, ev->tds_version); if (!pmbr->sock.tds) { tdsdump_log(TDS_DBG_ERROR, "Error opening a new connection to server\n"); break; } if (!IS_TDS71_PLUS(pmbr->sock.tds->conn)) { tdsdump_log(TDS_DBG_ERROR, "Protocol server version not supported\n"); break; } /* if already attached to a user we can send login directly */ if (pmbr->current_user) if (!pool_user_send_login_ack(pool, pmbr->current_user)) break; pool_event_add(pool, &ev->common, connect_execute_ok); return TDS_THREAD_RESULT(0); } /* failure */ pool_event_add(pool, &ev->common, connect_execute_ko); return TDS_THREAD_RESULT(0); } static void connect_execute_ko(TDS_POOL_EVENT *base_event) { CONNECT_EVENT *ev = (CONNECT_EVENT *) base_event; pool_free_member(ev->pool, ev->pmbr); } static void connect_execute_ok(TDS_POOL_EVENT *base_event) { CONNECT_EVENT *ev = (CONNECT_EVENT *) base_event; TDS_POOL_MEMBER *pmbr = ev->pmbr; TDS_POOL_USER *puser = pmbr->current_user; ev->pool->member_logins++; pmbr->doing_async = false; pmbr->last_used_tm = time(NULL); if (puser) { pmbr->sock.poll_recv = true; puser->sock.poll_recv = true; puser->user_state = TDS_SRV_QUERY; } } /* * pool_assign_idle_member * assign a member to the user specified */ TDS_POOL_MEMBER * pool_assign_idle_member(TDS_POOL * pool, TDS_POOL_USER *puser) { TDS_POOL_MEMBER *pmbr; CONNECT_EVENT *ev; puser->sock.poll_recv = false; puser->sock.poll_send = false; DLIST_FOREACH(dlist_member, &pool->idle_members, pmbr) { assert(pmbr->current_user == NULL); assert(!pmbr->doing_async); assert(pmbr->sock.tds); if (!compatible_versions(pmbr->sock.tds, puser)) continue; pool_assign_member(pool, pmbr, puser); /* * make sure member wasn't idle more that the timeout * otherwise it'll send the query and close leaving a * hung client */ pmbr->last_used_tm = time(NULL); pmbr->sock.poll_recv = false; pmbr->sock.poll_send = false; pool_user_finish_login(pool, puser); return pmbr; } /* if we can open a new connection open it */ if (pool->num_active_members >= pool->max_open_conn) { fprintf(stderr, "No idle members left, increase \"max pool conn\"\n"); return NULL; } pmbr = tds_new0(TDS_POOL_MEMBER, 1); if (!pmbr) { fprintf(stderr, "Out of memory\n"); return NULL; } tdsdump_log(TDS_DBG_INFO1, "No open connections left, opening new member\n"); ev = tds_new0(CONNECT_EVENT, 1); if (!ev) { free(pmbr); fprintf(stderr, "Out of memory\n"); return NULL; } ev->pmbr = pmbr; ev->pool = pool; ev->tds_version = puser->login->tds_version; if (tds_thread_create_detached(connect_proc, ev) != 0) { free(pmbr); free(ev); fprintf(stderr, "error creating thread\n"); return NULL; } pmbr->doing_async = true; pool->num_active_members++; dlist_member_append(&pool->idle_members, pmbr); pool_assign_member(pool, pmbr, puser); puser->sock.poll_send = false; puser->sock.poll_recv = false; return pmbr; } freetds-1.3.6/src/pool/user.c000644 025423 025423 00000034471 14056414222 017476 0ustar00fredianofrediano000000 000000 /* TDSPool - Connection pooling for TDS based databases * Copyright (C) 2001, 2002, 2003, 2004, 2005 Brian Bruns * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #include "pool.h" #include #include static TDS_POOL_USER *pool_user_find_new(TDS_POOL * pool); static bool pool_user_login(TDS_POOL * pool, TDS_POOL_USER * puser); static bool pool_user_read(TDS_POOL * pool, TDS_POOL_USER * puser); static void login_execute(TDS_POOL_EVENT *base_event); static void end_login_execute(TDS_POOL_EVENT *base_event); void pool_user_init(TDS_POOL * pool) { dlist_user_init(&pool->users); dlist_user_init(&pool->waiters); pool->ctx = tds_alloc_context(NULL); } void pool_user_destroy(TDS_POOL * pool) { while (dlist_user_first(&pool->users)) pool_free_user(pool, dlist_user_first(&pool->users)); while (dlist_user_first(&pool->waiters)) pool_free_user(pool, dlist_user_first(&pool->waiters)); tds_free_context(pool->ctx); pool->ctx = NULL; } static TDS_POOL_USER * pool_user_find_new(TDS_POOL * pool) { TDS_POOL_USER *puser; /* did we exhaust the number of concurrent users? */ if (pool->num_users >= MAX_POOL_USERS) { fprintf(stderr, "Max concurrent users exceeded, increase in pool.h\n"); return NULL; } puser = tds_new0(TDS_POOL_USER, 1); if (!puser) { fprintf(stderr, "Out of memory\n"); return NULL; } dlist_user_append(&pool->users, puser); pool->num_users++; return puser; } typedef struct { TDS_POOL_EVENT common; TDS_POOL *pool; TDS_POOL_USER *puser; bool success; } LOGIN_EVENT; static TDS_THREAD_PROC_DECLARE(login_proc, arg) { LOGIN_EVENT *ev = (LOGIN_EVENT *) arg; ev->success = pool_user_login(ev->pool, ev->puser); pool_event_add(ev->pool, &ev->common, login_execute); return TDS_THREAD_RESULT(0); } static void login_execute(TDS_POOL_EVENT *base_event) { LOGIN_EVENT *ev = (LOGIN_EVENT *) base_event; TDS_POOL_USER *puser = ev->puser; TDS_POOL *pool = ev->pool; if (!ev->success) { /* login failed...free socket */ pool_free_user(pool, puser); return; } puser->sock.poll_recv = true; /* try to assign a member, connection can have transactions * and so on so deassign only when disconnected */ pool_user_query(pool, puser); tdsdump_log(TDS_DBG_INFO1, "user state %d\n", puser->user_state); assert(puser->login || puser->user_state == TDS_SRV_QUERY); } /* * pool_user_create * accepts a client connection and adds it to the users list and returns it */ TDS_POOL_USER * pool_user_create(TDS_POOL * pool, TDS_SYS_SOCKET s) { TDS_POOL_USER *puser; TDS_SYS_SOCKET fd; TDSSOCKET *tds; LOGIN_EVENT *ev; tdsdump_log(TDS_DBG_NETWORK, "accepting connection\n"); if (TDS_IS_SOCKET_INVALID(fd = tds_accept(s, NULL, NULL))) { char *errstr = sock_strerror(errno); tdsdump_log(TDS_DBG_ERROR, "error calling assert :%s\n", errstr); sock_strerror_free(errstr); return NULL; } if (tds_socket_set_nonblocking(fd) != 0) { CLOSESOCKET(fd); return NULL; } puser = pool_user_find_new(pool); if (!puser) { CLOSESOCKET(fd); return NULL; } tds = tds_alloc_socket(pool->ctx, BLOCKSIZ); if (!tds) { CLOSESOCKET(fd); return NULL; } ev = tds_new0(LOGIN_EVENT, 1); if (!ev || TDS_FAILED(tds_iconv_open(tds->conn, "UTF-8", 0))) { free(ev); tds_free_socket(tds); CLOSESOCKET(fd); return NULL; } tds_set_s(tds, fd); tds->state = TDS_IDLE; tds->out_flag = TDS_LOGIN; puser->sock.tds = tds; puser->user_state = TDS_SRV_QUERY; puser->sock.poll_recv = false; puser->sock.poll_send = false; /* launch login asyncronously */ ev->puser = puser; ev->pool = pool; if (tds_thread_create_detached(login_proc, ev) != 0) { pool_free_user(pool, puser); fprintf(stderr, "error creating thread\n"); return NULL; } return puser; } /* * pool_free_user * close out a disconnected user. */ void pool_free_user(TDS_POOL *pool, TDS_POOL_USER * puser) { TDS_POOL_MEMBER *pmbr = puser->assigned_member; if (pmbr) { assert(pmbr->current_user == puser); pool_deassign_member(pool, pmbr); pool_reset_member(pool, pmbr); } tds_free_socket(puser->sock.tds); tds_free_login(puser->login); /* make sure to decrement the waiters list if he is waiting */ if (puser->user_state == TDS_SRV_WAIT) dlist_user_remove(&pool->waiters, puser); else dlist_user_remove(&pool->users, puser); pool->num_users--; free(puser); } /* * pool_process_users * check the fd_set for user input, allocate a pool member to it, and forward * the query to that member. */ void pool_process_users(TDS_POOL * pool, fd_set * rfds, fd_set * wfds) { TDS_POOL_USER *puser, *next; for (next = dlist_user_first(&pool->users); (puser = next) != NULL; ) { next = dlist_user_next(&pool->users, puser); if (!puser->sock.tds) continue; /* dead connection */ if (puser->sock.poll_recv && FD_ISSET(tds_get_s(puser->sock.tds), rfds)) { assert(puser->user_state == TDS_SRV_QUERY); if (!pool_user_read(pool, puser)) continue; } if (puser->sock.poll_send && FD_ISSET(tds_get_s(puser->sock.tds), wfds)) { if (!pool_write_data(&puser->assigned_member->sock, &puser->sock)) pool_free_member(pool, puser->assigned_member); } } /* for */ } /* * pool_user_login * Reads clients login packet and forges a login acknowledgement sequence */ static bool pool_user_login(TDS_POOL * pool, TDS_POOL_USER * puser) { TDSSOCKET *tds; TDSLOGIN *login; tds = puser->sock.tds; while (tds->in_len <= tds->in_pos) if (tds_read_packet(tds) < 0) return false; tdsdump_log(TDS_DBG_NETWORK, "got packet type %d\n", tds->in_flag); if (tds->in_flag == TDS71_PRELOGIN) { if (!tds->conn->tds_version) tds->conn->tds_version = 0x701; tds->out_flag = TDS_REPLY; // TODO proper one !! // TODO detect TDS version here ?? tds_put_n(tds, "\x00\x00\x1a\x00\x06" /* version */ "\x01\x00\x20\x00\x01" /* encryption */ "\x02\x00\x21\x00\x01" /* instance ?? */ "\x03\x00\x22\x00\x00" /* process id ?? */ "\x04\x00\x22\x00\x01" /* MARS */ "\xff" "\x0a\x00\x06\x40\x00\x00" "\x02" "\x01" "" "\x00", 0x23); tds_flush_packet(tds); /* read another packet */ tds->in_pos = tds->in_len; while (tds->in_len <= tds->in_pos) if (tds_read_packet(tds) < 0) return false; } puser->login = login = tds_alloc_login(1); if (tds->in_flag == TDS_LOGIN) { if (!tds->conn->tds_version) tds->conn->tds_version = 0x500; tds_read_login(tds, login); } else if (tds->in_flag == TDS7_LOGIN) { if (!tds->conn->tds_version) tds->conn->tds_version = 0x700; if (!tds7_read_login(tds, login)) return false; } else { return false; } /* check we support version required */ // TODO function to check it if (!IS_TDS71_PLUS(login)) return false; tds->in_len = tds->in_pos = 0; dump_login(login); if (strcmp(tds_dstr_cstr(&login->user_name), pool->user) != 0 || strcmp(tds_dstr_cstr(&login->password), pool->password) != 0) /* TODO send nack before exiting */ return false; return true; } bool pool_user_send_login_ack(TDS_POOL * pool, TDS_POOL_USER * puser) { char msg[256]; char block[32]; TDSSOCKET *tds = puser->sock.tds, *mtds = puser->assigned_member->sock.tds; TDSLOGIN *login = puser->login; const char *database; const char *server = mtds->conn->server ? mtds->conn->server : "JDBC"; bool dbname_mismatch, odbc_mismatch; pool->user_logins++; /* copy a bit of information, resize socket with block */ tds->conn->tds_version = mtds->conn->tds_version; tds->conn->product_version = mtds->conn->product_version; memcpy(tds->conn->collation, mtds->conn->collation, sizeof(tds->conn->collation)); tds->conn->tds71rev1 = mtds->conn->tds71rev1; free(tds->conn->product_name); tds->conn->product_name = strdup(mtds->conn->product_name); tds_realloc_socket(tds, mtds->conn->env.block_size); tds->conn->env.block_size = mtds->conn->env.block_size; tds->conn->client_spid = mtds->conn->spid; /* if database is different use USE statement */ database = pool->database; dbname_mismatch = !tds_dstr_isempty(&login->database) && strcasecmp(tds_dstr_cstr(&login->database), database) != 0; odbc_mismatch = (login->option_flag2 & TDS_ODBC_ON) == 0; if (dbname_mismatch || odbc_mismatch) { char *str; int len = 128 + tds_quote_id(mtds, NULL, tds_dstr_cstr(&login->database),-1); TDSRET ret; if ((str = tds_new(char, len)) == NULL) return false; str[0] = 0; /* swicth to dblib options */ if (odbc_mismatch) strcat(str, "SET ANSI_DEFAULTS OFF\nSET CONCAT_NULL_YIELDS_NULL OFF\n"); if (dbname_mismatch) { strcat(str, "USE "); tds_quote_id(mtds, strchr(str, 0), tds_dstr_cstr(&login->database), -1); } ret = tds_submit_query(mtds, str); free(str); if (TDS_FAILED(ret) || TDS_FAILED(tds_process_simple_query(mtds))) return false; if (dbname_mismatch) database = tds_dstr_cstr(&login->database); else database = mtds->conn->env.database; } // 7.0 // env database // database change message (with server name correct) // env language // language change message // env 0x3 charset ("iso_1") // env 0x5 lcid ("1033") // env 0x6 ("196609" ?? 0x30001) // loginack // env 0x4 packet size // done // // 7.1/7.2/7.3 // env database // database change message (with server name correct) // env 0x7 collation // env language // language change message // loginack // env 0x4 packet size // done tds->out_flag = TDS_REPLY; tds_env_change(tds, TDS_ENV_DATABASE, "master", database); sprintf(msg, "Changed database context to '%s'.", database); tds_send_msg(tds, 5701, 2, 0, msg, server, NULL, 1); if (!login->suppress_language) { tds_env_change(tds, TDS_ENV_LANG, NULL, "us_english"); tds_send_msg(tds, 5703, 1, 0, "Changed language setting to 'us_english'.", server, NULL, 1); } if (IS_TDS71_PLUS(tds->conn)) { tds_put_byte(tds, TDS_ENVCHANGE_TOKEN); tds_put_smallint(tds, 8); tds_put_byte(tds, TDS_ENV_SQLCOLLATION); tds_put_byte(tds, 5); tds_put_n(tds, tds->conn->collation, 5); tds_put_byte(tds, 0); } tds_send_login_ack(tds, mtds->conn->product_name); sprintf(block, "%d", tds->conn->env.block_size); tds_env_change(tds, TDS_ENV_PACKSIZE, block, block); /* tds_send_capabilities_token(tds); */ tds_send_done_token(tds, 0, 0); /* send it! */ tds_flush_packet(tds); tds_free_login(login); puser->login = NULL; return true; } /* * pool_user_read * checks the packet type of data coming from the client and allocates a * pool member if necessary. */ static bool pool_user_read(TDS_POOL * pool, TDS_POOL_USER * puser) { TDSSOCKET *tds = puser->sock.tds; TDS_POOL_MEMBER *pmbr = NULL; for (;;) { TDS_UCHAR in_flag; if (pool_packet_read(tds)) break; if (tds->in_len == 0) { tdsdump_log(TDS_DBG_INFO1, "user disconnected\n"); pool_free_user(pool, puser); return false; } tdsdump_dump_buf(TDS_DBG_NETWORK, "Got packet from client:", tds->in_buf, tds->in_len); in_flag = tds->in_buf[0]; switch (in_flag) { case TDS_QUERY: case TDS_NORMAL: case TDS_RPC: case TDS_BULK: case TDS_CANCEL: case TDS7_TRANS: if (!pool_write_data(&puser->sock, &puser->assigned_member->sock)) { pool_reset_member(pool, puser->assigned_member); return false; } pmbr = puser->assigned_member; break; default: tdsdump_log(TDS_DBG_ERROR, "Unrecognized packet type, closing user\n"); pool_free_user(pool, puser); return false; } if (tds->in_pos < tds->in_len) /* partial write, schedule a future write */ break; } if (pmbr && !pmbr->sock.poll_send) tds_socket_flush(tds_get_s(pmbr->sock.tds)); return true; } void pool_user_query(TDS_POOL * pool, TDS_POOL_USER * puser) { TDS_POOL_MEMBER *pmbr; tdsdump_log(TDS_DBG_FUNC, "pool_user_query\n"); assert(puser->assigned_member == NULL); assert(puser->login); puser->user_state = TDS_SRV_QUERY; pmbr = pool_assign_idle_member(pool, puser); if (!pmbr) { /* * put into wait state * check when member is deallocated */ tdsdump_log(TDS_DBG_INFO1, "Not enough free members...placing user in WAIT\n"); puser->user_state = TDS_SRV_WAIT; puser->sock.poll_recv = false; puser->sock.poll_send = false; dlist_user_remove(&pool->users, puser); dlist_user_append(&pool->waiters, puser); } } typedef struct { TDS_POOL_EVENT common; TDS_POOL *pool; TDS_POOL_USER *puser; bool success; } END_LOGIN_EVENT; static TDS_THREAD_PROC_DECLARE(end_login_proc, arg) { END_LOGIN_EVENT *ev = (END_LOGIN_EVENT *) arg; TDS_POOL *pool = ev->pool; ev->success = pool_user_send_login_ack(pool, ev->puser); pool_event_add(pool, &ev->common, end_login_execute); return TDS_THREAD_RESULT(0); } static void end_login_execute(TDS_POOL_EVENT *base_event) { END_LOGIN_EVENT *ev = (END_LOGIN_EVENT *) base_event; TDS_POOL *pool = ev->pool; TDS_POOL_USER *puser = ev->puser; TDS_POOL_MEMBER *pmbr = puser->assigned_member; if (!ev->success) { pool_free_member(pool, pmbr); return; } puser->sock.poll_recv = true; puser->sock.poll_send = false; pmbr->sock.poll_recv = true; pmbr->sock.poll_send = false; } /** * Handle async login */ void pool_user_finish_login(TDS_POOL * pool, TDS_POOL_USER * puser) { END_LOGIN_EVENT *ev = tds_new0(END_LOGIN_EVENT, 1); if (!ev) { pool_free_member(pool, puser->assigned_member); return; } ev->pool = pool; ev->puser = puser; if (tds_thread_create_detached(end_login_proc, ev) != 0) { pool_free_member(pool, puser->assigned_member); free(ev); fprintf(stderr, "error creating thread\n"); } } freetds-1.3.6/src/pool/util.c000644 025423 025423 00000012000 14056414271 017461 0ustar00fredianofrediano000000 000000 /* TDSPool - Connection pooling for TDS based databases * Copyright (C) 2001 Brian Bruns * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include #include "pool.h" #include #include #include void dump_login(TDSLOGIN * login) { fprintf(stderr, "host %s\n", tds_dstr_cstr(&login->client_host_name)); fprintf(stderr, "user %s\n", tds_dstr_cstr(&login->user_name)); fprintf(stderr, "pass %s\n", tds_dstr_cstr(&login->password)); fprintf(stderr, "app %s\n", tds_dstr_cstr(&login->app_name)); fprintf(stderr, "srvr %s\n", tds_dstr_cstr(&login->server_name)); fprintf(stderr, "vers %d.%d\n", TDS_MAJOR(login), TDS_MINOR(login)); fprintf(stderr, "lib %s\n", tds_dstr_cstr(&login->library)); fprintf(stderr, "lang %s\n", tds_dstr_cstr(&login->language)); fprintf(stderr, "char %s\n", tds_dstr_cstr(&login->server_charset)); fprintf(stderr, "bsiz %d\n", login->block_size); } /** * Read part of packet. Function does not block. * @return true if packet is not complete and we must call again, * false on full packet or error. */ bool pool_packet_read(TDSSOCKET *tds) { unsigned int packet_len; int readed; tdsdump_log(TDS_DBG_INFO1, "tds in_len %d in_pos %d\n", tds->in_len, tds->in_pos); // TODO MARS /* determine packet size */ packet_len = tds->in_len >= 4 ? TDS_GET_A2BE(&tds->in_buf[2]) : 8; if (TDS_UNLIKELY(packet_len < 8)) { tds->in_len = 0; return false; } /* get another packet */ if (tds->in_len >= packet_len) { /* packet was not fully forwarded */ if (tds->in_pos < tds->in_len) return false; tds->in_pos = 0; tds->in_len = 0; } for (;;) { /* determine packet size */ packet_len = 8; if (tds->in_len >= 4) { packet_len = TDS_GET_A2BE(&tds->in_buf[2]); if (packet_len < 8) break; tdsdump_log(TDS_DBG_INFO1, "packet_len %u in_len %d\n", packet_len, tds->in_len); /* resize packet if not enough */ if (packet_len > tds->recv_packet->capacity) { TDSPACKET *packet; packet = tds_realloc_packet(tds->recv_packet, packet_len); if (!packet) break; tds->in_buf = packet->buf; tds->recv_packet = packet; } CHECK_TDS_EXTRA(tds); if (tds->in_len >= packet_len) return false; } assert(packet_len > tds->in_len); assert(packet_len <= tds->recv_packet->capacity); assert(tds->in_len < tds->recv_packet->capacity); readed = READSOCKET(tds_get_s(tds), &tds->in_buf[tds->in_len], packet_len - tds->in_len); tdsdump_log(TDS_DBG_INFO1, "readed %d\n", readed); /* socket closed */ if (readed == 0) break; /* error */ if (readed < 0) { int err = sock_errno; if (err == EINTR) continue; if (TDSSOCK_WOULDBLOCK(err)) return true; break; } /* got some data */ tds->in_len += readed; } /* failure */ tds->in_len = 0; return false; } int pool_write(TDS_SYS_SOCKET sock, const void *buf, size_t len) { int ret; const unsigned char *p = (const unsigned char *) buf; while (len) { ret = WRITESOCKET(sock, p, len); if (ret <= 0) { int err = errno; if (TDSSOCK_WOULDBLOCK(err) || err == EINTR) break; return -1; } p += ret; len -= ret; } return p - (const unsigned char *) buf; } void pool_event_add(TDS_POOL *pool, TDS_POOL_EVENT *ev, TDS_POOL_EXECUTE execute) { tds_mutex_lock(&pool->events_mtx); ev->execute = execute; ev->next = pool->events; pool->events = ev; tds_mutex_unlock(&pool->events_mtx); WRITESOCKET(pool->event_fd, "x", 1); } bool pool_write_data(TDS_POOL_SOCKET *from, TDS_POOL_SOCKET *to) { int ret; TDSSOCKET *tds; tdsdump_log(TDS_DBG_INFO1, "trying to send\n"); tds = from->tds; tdsdump_log(TDS_DBG_INFO1, "sending %d bytes\n", tds->in_len); /* cf. net.c for better technique. */ ret = pool_write(tds_get_s(to->tds), tds->in_buf + tds->in_pos, tds->in_len - tds->in_pos); /* write failed, cleanup member */ if (ret < 0) return false; tds->in_pos += ret; if (tds->in_pos < tds->in_len) { /* partial write, schedule a future write */ to->poll_send = true; from->poll_recv = false; } else { to->poll_send = false; from->poll_recv = true; } return true; } freetds-1.3.6/src/pool/pool.h000644 025423 025423 00000010664 14056414222 017474 0ustar00fredianofrediano000000 000000 /* TDSPool - Connection pooling for TDS based databases * Copyright (C) 2001 Brian Bruns * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _pool_h_ #define _pool_h_ #include #if HAVE_SYS_TYPES_H #include #endif #if HAVE_NETINET_IN_H #include #endif /* * POSIX says fd_set type may be defined in either sys/select.h or sys/time.h. */ #if HAVE_SYS_TIME_H #include #endif #include #include /* defines */ #define PGSIZ 2048 #define BLOCKSIZ 512 #define MAX_POOL_USERS 1024 /* enums and typedefs */ typedef enum { TDS_SRV_WAIT, /* if no members are free wait */ TDS_SRV_QUERY, } TDS_USER_STATE; /* forward declaration */ typedef struct tds_pool_event TDS_POOL_EVENT; typedef struct tds_pool_socket TDS_POOL_SOCKET; typedef struct tds_pool_member TDS_POOL_MEMBER; typedef struct tds_pool_user TDS_POOL_USER; typedef struct tds_pool TDS_POOL; typedef void (*TDS_POOL_EXECUTE)(TDS_POOL_EVENT *event); struct tds_pool_event { TDS_POOL_EVENT *next; TDS_POOL_EXECUTE execute; }; struct tds_pool_socket { TDSSOCKET *tds; bool poll_recv; bool poll_send; }; struct tds_pool_user { TDS_POOL_SOCKET sock; DLIST_FIELDS(dlist_user_item); TDSLOGIN *login; TDS_USER_STATE user_state; TDS_POOL_MEMBER *assigned_member; }; struct tds_pool_member { TDS_POOL_SOCKET sock; DLIST_FIELDS(dlist_member_item); bool doing_async; time_t last_used_tm; TDS_POOL_USER *current_user; }; #define DLIST_PREFIX dlist_member #define DLIST_LIST_TYPE dlist_members #define DLIST_ITEM_TYPE TDS_POOL_MEMBER #include #define DLIST_PREFIX dlist_user #define DLIST_LIST_TYPE dlist_users #define DLIST_ITEM_TYPE TDS_POOL_USER #include struct tds_pool { char *name; char *user; char *password; char *server; char *database; char *server_user; char *server_password; int port; int max_member_age; /* in seconds */ int min_open_conn; int max_open_conn; tds_mutex events_mtx; TDS_SYS_SOCKET listen_fd; TDS_SYS_SOCKET wakeup_fd; TDS_SYS_SOCKET event_fd; TDS_POOL_EVENT *events; int num_active_members; dlist_members active_members; dlist_members idle_members; /** users in wait state */ dlist_users waiters; int num_users; dlist_users users; TDSCONTEXT *ctx; unsigned long user_logins; unsigned long member_logins; }; /* prototypes */ /* member.c */ int pool_process_members(TDS_POOL * pool, fd_set * rfds, fd_set * wfds); TDS_POOL_MEMBER *pool_assign_idle_member(TDS_POOL * pool, TDS_POOL_USER *user); void pool_mbr_init(TDS_POOL * pool); void pool_mbr_destroy(TDS_POOL * pool); void pool_free_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr); void pool_assign_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr, TDS_POOL_USER *puser); void pool_deassign_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr); void pool_reset_member(TDS_POOL *pool, TDS_POOL_MEMBER * pmbr); bool pool_packet_read(TDSSOCKET * tds); /* user.c */ void pool_process_users(TDS_POOL * pool, fd_set * rfds, fd_set * wfds); void pool_user_init(TDS_POOL * pool); void pool_user_destroy(TDS_POOL * pool); TDS_POOL_USER *pool_user_create(TDS_POOL * pool, TDS_SYS_SOCKET s); void pool_free_user(TDS_POOL * pool, TDS_POOL_USER * puser); void pool_user_query(TDS_POOL * pool, TDS_POOL_USER * puser); bool pool_user_send_login_ack(TDS_POOL * pool, TDS_POOL_USER * puser); void pool_user_finish_login(TDS_POOL * pool, TDS_POOL_USER * puser); /* util.c */ void dump_login(TDSLOGIN * login); void pool_event_add(TDS_POOL *pool, TDS_POOL_EVENT *ev, TDS_POOL_EXECUTE execute); int pool_write(TDS_SYS_SOCKET sock, const void *buf, size_t len); bool pool_write_data(TDS_POOL_SOCKET *from, TDS_POOL_SOCKET *to); /* config.c */ bool pool_read_conf_files(const char *path, const char *poolname, TDS_POOL * pool, char **err); #endif freetds-1.3.6/src/pool/BUGS000644 025423 025423 00000000157 14056414222 017031 0ustar00fredianofrediano000000 000000 Need to handle results larger than 1 packet. fixed 11/18/00 Disconnect doesn't leave the FDSET. fixed 11/18/00 freetds-1.3.6/src/pool/pool.conf000644 025423 025423 00000000333 14056414222 020162 0ustar00fredianofrediano000000 000000 [global] min pool conn = 5 max pool conn = 10 max member age = 120 [mypool] user = guest password = sybase database = tempdb server = JDBC_42 port = 5000 freetds-1.3.6/src/pool/CMakeLists.txt000644 025423 025423 00000000472 14056414222 021106 0ustar00fredianofrediano000000 000000 set(libs ${lib_NETWORK} ${lib_BASE}) add_executable(tdspool main.c config.c member.c user.c util.c) target_link_libraries(tdspool tdssrv tds replacements tdsutils ${libs}) INSTALL(TARGETS tdspool PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) freetds-1.3.6/src/server/Makefile.am000644 025423 025423 00000000534 14056414222 020736 0ustar00fredianofrediano000000 000000 AM_CPPFLAGS = -I$(top_srcdir)/include noinst_LTLIBRARIES = libtdssrv.la libtdssrv_la_SOURCES= query.c server.c login.c libtdssrv_la_LIBADD = ../tds/libtds.la ../replacements/libreplacements.la $(LTLIBICONV) $(FREETDS_LIBGCC) noinst_PROGRAMS = tdssrv tdssrv_LDADD = libtdssrv.la $(LTLIBICONV) tdssrv_SOURCES = unittest.c EXTRA_DIST = CMakeLists.txt freetds-1.3.6/src/server/Makefile.in000644 025423 025423 00000052747 14162303357 020770 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = tdssrv$(EXEEXT) subdir = src/server ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libtdssrv_la_DEPENDENCIES = ../tds/libtds.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_libtdssrv_la_OBJECTS = query.lo server.lo login.lo libtdssrv_la_OBJECTS = $(am_libtdssrv_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_tdssrv_OBJECTS = unittest.$(OBJEXT) tdssrv_OBJECTS = $(am_tdssrv_OBJECTS) tdssrv_DEPENDENCIES = libtdssrv.la $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/login.Plo ./$(DEPDIR)/query.Plo \ ./$(DEPDIR)/server.Plo ./$(DEPDIR)/unittest.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtdssrv_la_SOURCES) $(tdssrv_SOURCES) DIST_SOURCES = $(libtdssrv_la_SOURCES) $(tdssrv_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir)/include noinst_LTLIBRARIES = libtdssrv.la libtdssrv_la_SOURCES = query.c server.c login.c libtdssrv_la_LIBADD = ../tds/libtds.la ../replacements/libreplacements.la $(LTLIBICONV) $(FREETDS_LIBGCC) tdssrv_LDADD = libtdssrv.la $(LTLIBICONV) tdssrv_SOURCES = unittest.c EXTRA_DIST = CMakeLists.txt all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/server/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/server/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtdssrv.la: $(libtdssrv_la_OBJECTS) $(libtdssrv_la_DEPENDENCIES) $(EXTRA_libtdssrv_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libtdssrv_la_OBJECTS) $(libtdssrv_la_LIBADD) $(LIBS) tdssrv$(EXEEXT): $(tdssrv_OBJECTS) $(tdssrv_DEPENDENCIES) $(EXTRA_tdssrv_DEPENDENCIES) @rm -f tdssrv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tdssrv_OBJECTS) $(tdssrv_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/login.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unittest.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/login.Plo -rm -f ./$(DEPDIR)/query.Plo -rm -f ./$(DEPDIR)/server.Plo -rm -f ./$(DEPDIR)/unittest.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/login.Plo -rm -f ./$(DEPDIR)/query.Plo -rm -f ./$(DEPDIR)/server.Plo -rm -f ./$(DEPDIR)/unittest.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/server/query.c000644 025423 025423 00000015666 14056414222 020227 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #include static char *query; static size_t query_buflen = 0; static TDSHEADERS head; /** * Read a TDS5 tokenized query. */ char * tds_get_query(TDSSOCKET * tds) { int len; if (query_buflen == 0) { query_buflen = 1024; query = tds_new(char, query_buflen); } tds_get_byte(tds); /* 33 */ len = tds_get_int(tds); /* query size +1 */ tds_get_byte(tds); /* has args, ignored TODO */ assert(len >= 1); /* TODO handle correctly */ if (len > query_buflen) { query_buflen = len; query = (char *) realloc(query, query_buflen); } --len; tds_get_n(tds, query, len); query[len] = 0; return query; } static int tds_lastpacket(TDSSOCKET * tds) { if (!tds || !tds->in_buf || tds->recv_packet->capacity < 2) return 1; return tds->in_buf[1] != 0; } /** * get query packet of a given type * \tds * \param head extra information to put in a TDS7 header */ static TDSRET tds_get_query_head(TDSSOCKET * tds, TDSHEADERS * head) { int qn_len = 0, more; char *qn_msgtext = NULL; char *qn_options = NULL; size_t qn_msgtext_len = 0; size_t qn_options_len = 0; if (!IS_TDS72_PLUS(tds->conn)) { return TDS_SUCCESS; } qn_len = tds_get_int(tds) - 4 - 18; /* total length */ tds_get_int(tds); /* length: transaction descriptor, ignored */ tds_get_smallint(tds); /* type: transaction descriptor, ignored */ tds_get_n(tds, tds->conn->tds72_transaction, 8); /* transaction */ tds_get_int(tds); /* request count, ignored */ if (qn_len != 0) { qn_len = tds_get_int(tds); /* length: query notification */ tds_get_smallint(tds); /* type: query notification, ignored */ qn_msgtext_len = tds_get_smallint(tds); /* notifyid */ if (qn_msgtext_len > 0) { qn_msgtext = (char *) realloc(qn_msgtext, qn_msgtext_len); tds_get_n(tds, qn_msgtext, qn_msgtext_len); } qn_options_len = tds_get_smallint(tds); /* ssbdeployment */ if (qn_options_len > 0) { qn_options = (char *) realloc(qn_options, qn_options_len); tds_get_n(tds, qn_options, qn_options_len); } more = tds->in_len - tds->in_pos; if (more) head->qn_timeout = tds_get_int(tds); /* timeout */ head->qn_options = qn_options; head->qn_msgtext = qn_msgtext; } return TDS_SUCCESS; } /** * Read a query, and return it as an ASCII string with a \0 terminator. This * should work for TDS4, TDS5, and TDS7+ connections. Also, it converts RPC * calls into stored procedure queries, and it skips CANCEL packets. The query * string is returned in a static buffer which is overwritten each time this * function is called. * \param tds The socket to read from. * \return A query string if successful, or NULL if we either can't read from * the socket or we read something that we can't handle. */ char *tds_get_generic_query(TDSSOCKET * tds) { int token, byte; int len, more, i, j; for (;;) { /* * Read a new packet. We must explicitly read it, * instead of letting functions such as tds_get_byte() * to read it for us, so that we can examine the packet * type via tds->in_flag. */ if (tds_read_packet(tds) < 0) { return NULL; } /* Queries can arrive in a couple different formats. */ switch (tds->in_flag) { case TDS_RPC: /* TODO */ case TDS_NORMAL: /* TDS5 query packet */ /* get the token */ token = tds_get_byte(tds); switch (token) { case TDS_LANGUAGE_TOKEN: /* SQL query */ len = tds_get_int(tds); /* query size +1 */ assert(len >= 1); /* TODO handle */ tds_get_byte(tds); /* has args, ignored TODO */ if (len > query_buflen) { query_buflen = len; query = (char *) realloc(query, query_buflen); } --len; tds_get_n(tds, query, len); query[len] = 0; return query; case TDS_DBRPC_TOKEN: /* RPC call -- make it look like a query */ /* skip the overall length */ (void)tds_get_smallint(tds); /* get the length of the stored procedure's name */ len = tds_get_byte(tds) + 1;/* sproc name size +1 */ if (len > query_buflen) { query_buflen = len; query = (char *) realloc(query, query_buflen); } /* * Read the chars of the name. Skip NUL * bytes, as a cheap way to convert * Unicode to ASCII. (For TDS7+, the * name is sent in Unicode.) */ for (i = j = 0; i < len - 1; i++) { byte = tds_get_byte(tds); if (byte != '\0') query[j++] = byte; } query[j] = '\0'; /* TODO: WE DON'T HANDLE PARAMETERS YET! */ /* eat the rest of the packet */ while (!tds_lastpacket(tds) && tds_read_packet(tds) > 0) { } return query; default: /* unexpected token */ /* eat the rest of the packet */ while (!tds_lastpacket(tds) && tds_read_packet(tds) > 0) { } return NULL; } break; case TDS_QUERY: /* TDS7+ adds a query head */ if (IS_TDS72_PLUS(tds->conn) && tds_get_query_head(tds, &head) != TDS_SUCCESS) return NULL; /* TDS4 and TDS7+ fill the whole packet with a query */ len = 0; for (;;) { const char *src; /* If buffer needs to grow, then grow */ more = tds->in_len - tds->in_pos; src = (char *) (tds->in_buf + tds->in_pos); if ((size_t)(len + more + 1) > query_buflen) { query_buflen = len + more + 1024u; query_buflen -= query_buflen % 1024u; query = (char *) realloc(query, query_buflen); } /* * Pull new data into the query buffer. * Ignore NUL bytes -- this is a cheap way * to convert Unicode to Latin-1/ASCII. */ while (--more >= 0) { query[len] = *src++; if (query[len] != '\0') len++; } /* if more then read it */ if (tds_lastpacket(tds)) break; if (tds_read_packet(tds) < 0) return NULL; } /* add a NUL to mark the end */ query[len] = '\0'; return query; case TDS_CANCEL: /* * ignore cancel requests -- if we're waiting * for the next query then it's obviously too * late to cancel the previous query. */ /* TODO it's not too late -- freddy77 */ break; default: /* not a query packet */ return NULL; } } } freetds-1.3.6/src/server/server.c000644 025423 025423 00000033361 14056414222 020360 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include void tds_env_change(TDSSOCKET * tds, int type, const char *oldvalue, const char *newvalue) { TDS_SMALLINT totsize; /* If oldvalue is NULL, treat it like "" */ if (oldvalue == NULL) oldvalue = ""; /* * NOTE: I don't know why each type of environment value has a different * format. According to the TDS5 specifications, they should all use * the same format. The code for the TDS_ENV_CHARSET case *should* * work for all environment values. -- Steve Kirkendall */ switch (type) { case TDS_ENV_DATABASE: case TDS_ENV_LANG: case TDS_ENV_PACKSIZE: case TDS_ENV_CHARSET: tds_put_byte(tds, TDS_ENVCHANGE_TOKEN); /* totsize = type + newlen + newvalue + oldlen + oldvalue */ /* FIXME ucs2 */ totsize = (IS_TDS7_PLUS(tds->conn) ? 2 : 1) * (strlen(oldvalue) + strlen(newvalue)) + 3; tds_put_smallint(tds, totsize); tds_put_byte(tds, type); tds_put_byte(tds, strlen(newvalue)); /* FIXME this assume singlebyte -> ucs2 for mssql */ tds_put_string(tds, newvalue, strlen(newvalue)); tds_put_byte(tds, strlen(oldvalue)); /* FIXME this assume singlebyte -> ucs2 for mssql */ tds_put_string(tds, oldvalue, strlen(oldvalue)); break; case TDS_ENV_LCID: case TDS_ENV_SQLCOLLATION: #if 1 tds_put_byte(tds, TDS_ENVCHANGE_TOKEN); /* totsize = type + len + oldvalue + len + newvalue */ totsize = 3 + strlen(newvalue) + strlen(oldvalue); tds_put_smallint(tds, totsize); tds_put_byte(tds, type); tds_put_byte(tds, strlen(newvalue)); tds_put_n(tds, newvalue, strlen(newvalue)); tds_put_byte(tds, strlen(oldvalue)); tds_put_n(tds, oldvalue, strlen(oldvalue)); break; #endif default: tdsdump_log(TDS_DBG_WARN, "tds_env_change() ignoring unsupported environment code #%d", type); } } void tds_send_eed(TDSSOCKET * tds, int msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { int totsize; tds_put_byte(tds, TDS_EED_TOKEN); totsize = 7 + strlen(procname) + 5 + strlen(msgtext) + 2 + strlen(srvname) + 3; tds_put_smallint(tds, totsize); tds_put_smallint(tds, msgno); tds_put_smallint(tds, 0); /* unknown */ tds_put_byte(tds, msgstate); tds_put_byte(tds, severity); tds_put_byte(tds, strlen(procname)); tds_put_n(tds, procname, strlen(procname)); tds_put_byte(tds, 0); /* unknown */ tds_put_byte(tds, 1); /* unknown */ tds_put_byte(tds, 0); /* unknown */ tds_put_smallint(tds, strlen(msgtext) + 1); tds_put_n(tds, msgtext, strlen(msgtext)); tds_put_byte(tds, severity); tds_put_byte(tds, strlen(srvname)); tds_put_n(tds, srvname, strlen(srvname)); tds_put_byte(tds, 0); /* unknown */ tds_put_byte(tds, 1); /* unknown */ tds_put_byte(tds, 0); /* unknown */ } void tds_send_msg(TDSSOCKET * tds, int msgno, int msgstate, int severity, const char *msgtext, const char *srvname, const char *procname, int line) { int msgsz; size_t len; tds_put_byte(tds, TDS_INFO_TOKEN); if (!procname) procname = ""; len = strlen(procname); msgsz = 4 /* msg no */ + 1 /* msg state */ + 1 /* severity */ /* FIXME ucs2 */ + 4 + (IS_TDS7_PLUS(tds->conn) ? 2 : 1) * (strlen(msgtext) + strlen(srvname) + len) + (IS_TDS72_PLUS(tds->conn) ? 4 : 2); /* line number */ tds_put_smallint(tds, msgsz); tds_put_int(tds, msgno); tds_put_byte(tds, msgstate); tds_put_byte(tds, severity); tds_put_smallint(tds, strlen(msgtext)); /* FIXME ucs2 */ tds_put_string(tds, msgtext, strlen(msgtext)); tds_put_byte(tds, strlen(srvname)); /* FIXME ucs2 */ tds_put_string(tds, srvname, strlen(srvname)); if (len) { tds_put_byte(tds, len); /* FIXME ucs2 */ tds_put_string(tds, procname, len); } else { tds_put_byte(tds, 0); } if (IS_TDS72_PLUS(tds->conn)) tds_put_int(tds, line); else tds_put_smallint(tds, line); } void tds_send_err(TDSSOCKET * tds, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { tds_put_byte(tds, TDS_ERROR_TOKEN); } void tds_send_login_ack(TDSSOCKET * tds, const char *progname) { TDS_UINT ui, version; tds_put_byte(tds, TDS_LOGINACK_TOKEN); tds_put_smallint(tds, 10 + (IS_TDS7_PLUS(tds->conn)? 2 : 1) * strlen(progname)); /* length of message */ if (IS_TDS50(tds->conn)) { tds_put_byte(tds, 5); version = 0x05000000u; } else { tds_put_byte(tds, 1); /* see src/tds/token.c */ if (IS_TDS73_PLUS(tds->conn)) { version = 0x730B0003u; } else if (IS_TDS72_PLUS(tds->conn)) { version = 0x72090002u; } else if (IS_TDS71_PLUS(tds->conn)) { version = tds->conn->tds71rev1 ? 0x07010000u : 0x71000001u; } else { version = (TDS_MAJOR(tds->conn) << 24) | (TDS_MINOR(tds->conn) << 16); } } TDS_PUT_A4BE(&ui, version); tds_put_n(tds, &ui, 4); tds_put_byte(tds, strlen(progname)); /* FIXME ucs2 */ tds_put_string(tds, progname, strlen(progname)); /* server version, always big endian */ TDS_PUT_A4BE(&ui, tds->conn->product_version & 0x7fffffffu); tds_put_n(tds, &ui, 4); } void tds_send_capabilities_token(TDSSOCKET * tds) { tds_put_byte(tds, TDS_CAPABILITY_TOKEN); tds_put_smallint(tds, 18); tds_put_byte(tds, 1); tds_put_byte(tds, 7); tds_put_byte(tds, 7); tds_put_byte(tds, 97); tds_put_byte(tds, 65); tds_put_byte(tds, 207); tds_put_byte(tds, 255); tds_put_byte(tds, 255); tds_put_byte(tds, 230); tds_put_byte(tds, 2); tds_put_byte(tds, 7); tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, 2); tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, 0); } /** * Send a "done" token, marking the end of a table, stored procedure, or query. * \param tds Where the token will be written to. * \param token The appropriate type of "done" token for this context: * TDS_DONE_TOKEN outside a stored procedure, * TDS_DONEINPROC_TOKEN inside a stored procedure, or * TDS_DONEPROC_TOKEN at the end of a stored procedure. * \param flags Bitwise-OR of flags in the "enum tds_end" data type. * TDS_DONE_FINAL for the last statement in a query, * TDS_DONE_MORE_RESULTS if not the last statement, * TDS_DONE_ERROR if the statement had an error, * TDS_DONE_INXACT if a transaction is pending, * TDS_DONE_PROC inside a stored procedure, * TDS_DONE_COUNT if a table was sent (and rows counted) * TDS_DONE_CANCELLED if the query was canceled, and * TDS_DONE_EVENT if the token marks an event. * \param numrows Number of rows, if flags has TDS_DONE_COUNT. */ void tds_send_done(TDSSOCKET * tds, int token, TDS_SMALLINT flags, TDS_INT numrows) { tds_put_byte(tds, token); tds_put_smallint(tds, flags); tds_put_smallint(tds, 2); /* are these two bytes the transaction status? */ if (IS_TDS72_PLUS(tds->conn)) tds_put_int8(tds, numrows); else tds_put_int(tds, numrows); } void tds_send_done_token(TDSSOCKET * tds, TDS_SMALLINT flags, TDS_INT numrows) { tds_send_done(tds, TDS_DONE_TOKEN, flags, numrows); } void tds_send_control_token(TDSSOCKET * tds, TDS_SMALLINT numcols) { int i; tds_put_byte(tds, TDS_CONTROL_FEATUREEXTACK_TOKEN); tds_put_smallint(tds, numcols); for (i = 0; i < numcols; i++) { tds_put_byte(tds, 0); } } void tds_send_col_name(TDSSOCKET * tds, TDSRESULTINFO * resinfo) { int col, hdrsize = 0; TDSCOLUMN *curcol; tds_put_byte(tds, TDS_COLNAME_TOKEN); for (col = 0; col < resinfo->num_cols; col++) { curcol = resinfo->columns[col]; hdrsize += tds_dstr_len(&curcol->column_name) + 1; } tds_put_smallint(tds, hdrsize); for (col = 0; col < resinfo->num_cols; col++) { curcol = resinfo->columns[col]; tds_put_byte(tds, tds_dstr_len(&curcol->column_name)); /* exclude the null */ tds_put_n(tds, tds_dstr_cstr(&curcol->column_name), tds_dstr_len(&curcol->column_name)); } } void tds_send_col_info(TDSSOCKET * tds, TDSRESULTINFO * resinfo) { int col, hdrsize = 0; TDSCOLUMN *curcol; tds_put_byte(tds, TDS_COLFMT_TOKEN); for (col = 0; col < resinfo->num_cols; col++) { curcol = resinfo->columns[col]; hdrsize += 5; if (!is_fixed_type(curcol->column_type)) { hdrsize++; } } tds_put_smallint(tds, hdrsize); for (col = 0; col < resinfo->num_cols; col++) { curcol = resinfo->columns[col]; tds_put_n(tds, "\0\0\0\0", 4); tds_put_byte(tds, curcol->column_type); if (!is_fixed_type(curcol->column_type)) { tds_put_byte(tds, curcol->column_size); } } } void tds_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo) { TDSCOLUMN *curcol; int i, totlen; size_t len; tds_put_byte(tds, TDS_RESULT_TOKEN); totlen = 2; for (i = 0; i < resinfo->num_cols; i++) { curcol = resinfo->columns[i]; len = tds_dstr_len(&curcol->column_name); totlen += 8; totlen += len; curcol = resinfo->columns[i]; if (!is_fixed_type(curcol->column_type)) { totlen++; } } tds_put_smallint(tds, totlen); tds_put_smallint(tds, resinfo->num_cols); for (i = 0; i < resinfo->num_cols; i++) { curcol = resinfo->columns[i]; len = tds_dstr_len(&curcol->column_name); tds_put_byte(tds, tds_dstr_len(&curcol->column_name)); tds_put_n(tds, tds_dstr_cstr(&curcol->column_name), len); tds_put_byte(tds, '0'); tds_put_int(tds, curcol->column_usertype); tds_put_byte(tds, curcol->column_type); if (!is_fixed_type(curcol->column_type)) { tds_put_byte(tds, curcol->column_size); } tds_put_byte(tds, 0); } } void tds7_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo) { int i, j; TDSCOLUMN *curcol; /* TDS7+ uses TDS7_RESULT_TOKEN to send column names and info */ tds_put_byte(tds, TDS7_RESULT_TOKEN); /* send the number of columns */ tds_put_smallint(tds, resinfo->num_cols); /* send info about each column */ for (i = 0; i < resinfo->num_cols; i++) { /* usertype, flags, and type */ curcol = resinfo->columns[i]; tds_put_smallint(tds, curcol->column_usertype); tds_put_smallint(tds, curcol->column_flags); tds_put_byte(tds, curcol->column_type); /* smallint? */ /* bytes in "size" field varies */ if (is_blob_type(curcol->column_type)) { tds_put_int(tds, curcol->column_size); } else if (curcol->column_type>=128) { /*is_large_type*/ tds_put_smallint(tds, curcol->column_size); } else { tds_put_tinyint(tds, curcol->column_size); } /* some types have extra info */ if (is_numeric_type(curcol->column_type)) { tds_put_tinyint(tds, curcol->column_prec); tds_put_tinyint(tds, curcol->column_scale); } else if (is_blob_type(curcol->column_type)) { size_t len = tds_dstr_len(&curcol->table_name); const char *name = tds_dstr_cstr(&curcol->table_name); tds_put_smallint(tds, 2 * len); for (j = 0; name[j] != '\0'; j++){ tds_put_byte(tds, name[j]); tds_put_byte(tds, 0); } } /* finally the name, in UCS16 format */ tds_put_byte(tds, tds_dstr_len(&curcol->column_name)); for (j = 0; j < tds_dstr_len(&curcol->column_name); j++) { tds_put_byte(tds, tds_dstr_cstr(&curcol->column_name)[j]); tds_put_byte(tds, 0); } } } /** * Send any tokens that mark the start of a table. This automatically chooses * the right tokens for this client's version of the TDS protocol. In other * words, it is a wrapper around tds_send_col_name(), tds_send_col_info(), * tds_send_result(), and tds7_send_result(). * \param tds The socket to which the tokens will be written. Also, * it contains the TDS protocol version number. * \param resinfo Describes the table to be send, especially the number * of columns and the names & data types of each column. */ void tds_send_table_header(TDSSOCKET * tds, TDSRESULTINFO * resinfo) { switch (TDS_MAJOR(tds->conn)) { case 4: /* * TDS4 uses TDS_COLNAME_TOKEN to send column names, and * TDS_COLFMT_TOKEN to send column info. The number of columns * is implied by the number of column names. */ tds_send_col_name(tds, resinfo); tds_send_col_info(tds, resinfo); break; case 5: /* TDS5 uses a TDS_RESULT_TOKEN to send all column information */ tds_send_result(tds, resinfo); break; case 7: /* * TDS7+ uses a TDS7_RESULT_TOKEN to send all column * information. */ tds7_send_result(tds, resinfo); break; } } void tds_send_row(TDSSOCKET * tds, TDSRESULTINFO * resinfo) { TDSCOLUMN *curcol; int colsize, i; tds_put_byte(tds, TDS_ROW_TOKEN); for (i = 0; i < resinfo->num_cols; i++) { curcol = resinfo->columns[i]; if (!is_fixed_type(curcol->column_type)) { /* FIX ME -- I have no way of knowing the actual length of non character variable data (eg nullable int) */ colsize = strlen((char *) curcol->column_data); tds_put_byte(tds, colsize); tds_put_n(tds, curcol->column_data, colsize); } else { tds_put_n(tds, curcol->column_data, tds_get_size_by_type(curcol->column_type)); } } } void tds71_send_prelogin(TDSSOCKET * tds) { static const unsigned char prelogin[] = { 0x00, 0x00, 0x15, 0x00, 0x06, 0x01, 0x00, 0x1b, 0x00, 0x01, 0x02, 0x00, 0x1c, 0x00, 0x01, 0x03, 0x00, 0x1d, 0x00, 0x00, 0xff, 0x08, 0x00, 0x01, 0x55, 0x00, 0x00, 0x02, 0x00 }; tds_put_n(tds, prelogin, sizeof(prelogin)); } freetds-1.3.6/src/server/login.c000644 025423 025423 00000025072 14056414271 020166 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #include #include #include #include unsigned char * tds7_decrypt_pass(const unsigned char *crypt_pass, int len, unsigned char *clear_pass) { int i; const unsigned char xormask = 0x5A; unsigned char hi_nibble, lo_nibble; for (i = 0; i < len; i++) { lo_nibble = (crypt_pass[i] << 4) ^ (xormask & 0xF0); hi_nibble = (crypt_pass[i] >> 4) ^ (xormask & 0x0F); clear_pass[i] = hi_nibble | lo_nibble; } return clear_pass; } TDSSOCKET * tds_listen(TDSCONTEXT * ctx, int ip_port) { TDSSOCKET *tds; TDS_SYS_SOCKET fd, s; socklen_t len; #ifdef AF_INET6 struct sockaddr_in6 sin; memset(&sin, 0, sizeof(sin)); sin.sin6_port = htons((short) ip_port); sin.sin6_family = AF_INET6; s = socket(AF_INET6, SOCK_STREAM, 0); #else struct sockaddr_in sin; sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons((short) ip_port); sin.sin_family = AF_INET; s = socket(AF_INET, SOCK_STREAM, 0); #endif if (TDS_IS_SOCKET_INVALID(s)) { perror("socket"); return NULL; } if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) { CLOSESOCKET(s); perror("bind"); return NULL; } listen(s, 5); len = sizeof(sin); fd = tds_accept(s, (struct sockaddr *) &sin, &len); if (TDS_IS_SOCKET_INVALID(fd)) { CLOSESOCKET(s); perror("accept"); return NULL; } CLOSESOCKET(s); tds = tds_alloc_socket(ctx, 4096); if (!tds) { fprintf(stderr, "out of memory"); return NULL; } tds_set_s(tds, fd); tds->out_flag = TDS_LOGIN; /* TODO proper charset */ tds_iconv_open(tds->conn, "ISO8859-1", 0); /* get_incoming(tds->s); */ tds->state = TDS_IDLE; return tds; } static int tds_read_string(TDSSOCKET * tds, DSTR * s, int size); int tds_read_login(TDSSOCKET * tds, TDSLOGIN * login) { DSTR blockstr = DSTR_INITIALIZER; TDS_USMALLINT major; int res = 1; /* while (len = tds_read_packet(tds)) { for (i=0;iin_buf[i], (tds->in_buf[i]>=' ' && tds->in_buf[i]<='z') ? tds->in_buf[i] : ' '); } */ res = res && tds_read_string(tds, &login->client_host_name, 30); res = res && tds_read_string(tds, &login->user_name, 30); res = res && tds_read_string(tds, &login->password, 30); tds_get_n(tds, NULL, 31); /* host process, junk for now */ tds_get_n(tds, NULL, 16); /* magic */ res = res && tds_read_string(tds, &login->app_name, 30); res = res && tds_read_string(tds, &login->server_name, 30); tds_get_n(tds, NULL, 256); /* secondary passwd...encryption? */ major = tds_get_byte(tds); login->tds_version = (major << 8) | tds_get_byte(tds); tds_get_smallint(tds); /* unused part of protocol field */ res = res && tds_read_string(tds, &login->library, 10); tds_get_byte(tds); /* program version, junk it */ tds_get_byte(tds); tds_get_smallint(tds); tds_get_n(tds, NULL, 3); /* magic */ res = res && tds_read_string(tds, &login->language, 30); tds_get_n(tds, NULL, 14); /* magic */ res = res && tds_read_string(tds, &login->server_charset, 30); tds_get_n(tds, NULL, 1); /* magic */ res = res && tds_read_string(tds, &blockstr, 6); printf("block size %s\n", tds_dstr_cstr(&blockstr)); login->block_size = atoi(tds_dstr_cstr(&blockstr)); tds_dstr_free(&blockstr); tds_get_n(tds, NULL, tds->in_len - tds->in_pos); /* read junk at end */ return res; } int tds7_read_login(TDSSOCKET * tds, TDSLOGIN * login) { int a; unsigned host_name_len, user_name_len, app_name_len, server_name_len; unsigned library_name_len, language_name_len; unsigned auth_len, database_name_len; size_t unicode_len, password_len; char *unicode_string, *psrc; char *pbuf; int res = 1; unsigned packet_start, len, start; TDS_UINT packet_len; packet_len = tds_get_uint(tds); /*total packet size */ a = tds_get_int(tds); /*TDS version */ if ((a & 0xff) == 7) tds_set_version(login, a & 0xff, (a >> 8) & 0xff); else tds_set_version(login, (a >> 28) & 0xf, (a >> 24) & 0xf); tds_get_int(tds); /*desired packet size being requested by client */ /* client prog ver (4 byte) + pid (int) + connection id (4 byte) + flag1 (byte) */ tds_get_n(tds, NULL, 13); login->option_flag2 = tds_get_byte(tds); /* sql type (byte) + flag3 (byte) + timezone (int) + collation (4 byte) */ tds_get_n(tds, NULL, 10); packet_start = IS_TDS72_PLUS(tds->conn) ? 86 + 8 : 86; /* ? */ if (packet_len < packet_start) return 0; #define READ_BUF(len, base_len) do { \ start = tds_get_usmallint(tds); \ len = tds_get_usmallint(tds); \ if (len != 0 && (start < packet_start || start + base_len * len > packet_len)) \ return 0; \ } while(0) /* hostname */ READ_BUF(host_name_len, 2); /* username */ READ_BUF(user_name_len, 2); /* password */ READ_BUF(password_len, 2); /* app name */ READ_BUF(app_name_len, 2); /* server */ READ_BUF(server_name_len, 2); /* unknown */ tds_get_smallint(tds); tds_get_smallint(tds); /* library */ READ_BUF(library_name_len, 2); /* language */ READ_BUF(language_name_len, 2); /* database */ READ_BUF(database_name_len, 2); /* client mac address */ tds_get_n(tds, NULL, 6); /* authentication */ READ_BUF(auth_len, 1); /* db file */ READ_BUF(len, 2); if (IS_TDS72_PLUS(login)) { /* new password */ READ_BUF(len, 2); /* SSPI */ tds_get_int(tds); } res = res && tds_dstr_get(tds, &login->client_host_name, host_name_len); res = res && tds_dstr_get(tds, &login->user_name, user_name_len); unicode_len = password_len * 2; unicode_string = tds_new(char, unicode_len); if (!unicode_string || !tds_dstr_alloc(&login->password, password_len)) { free(unicode_string); return 0; } tds_get_n(tds, unicode_string, unicode_len); tds7_decrypt_pass((unsigned char *) unicode_string, unicode_len, (unsigned char *) unicode_string); pbuf = tds_dstr_buf(&login->password); memset(&tds->conn->char_convs[client2ucs2]->suppress, 0, sizeof(tds->conn->char_convs[client2ucs2]->suppress)); psrc = unicode_string; a = tds_iconv(tds, tds->conn->char_convs[client2ucs2], to_client, (const char **) &psrc, &unicode_len, &pbuf, &password_len); if (a < 0 ) { fprintf(stderr, "error: %s:%d: tds7_read_login: tds_iconv() failed\n", __FILE__, __LINE__); free(unicode_string); return 0; } tds_dstr_setlen(&login->password, pbuf - tds_dstr_buf(&login->password)); free(unicode_string); res = res && tds_dstr_get(tds, &login->app_name, app_name_len); res = res && tds_dstr_get(tds, &login->server_name, server_name_len); res = res && tds_dstr_get(tds, &login->library, library_name_len); res = res && tds_dstr_get(tds, &login->language, language_name_len); res = res && tds_dstr_get(tds, &login->database, database_name_len); tds_get_n(tds, NULL, auth_len); tds_dstr_empty(&login->server_charset); /*empty char_set for TDS 7.0 */ login->block_size = 0; /*0 block size for TDS 7.0 */ login->encryption_level = TDS_ENCRYPTION_OFF; return res; } static int tds_read_string(TDSSOCKET * tds, DSTR * s, int size) { int len; /* FIXME this can fails... */ if (!tds_dstr_alloc(s, size)) return 0; tds_get_n(tds, tds_dstr_buf(s), size); len = tds_get_byte(tds); if (len <= size) tds_dstr_setlen(s, len); return 1; } /** * Allocate a TDSLOGIN structure, read a login packet into it, and return it. * This is smart enough to distinguish between TDS4/5 or TDS7. The calling * function should call tds_free_login() on the returned structure when it is * no longer needed. * \param tds The socket to read from * \return Returns NULL if no login was received. The calling function can * use IS_TDSDEAD(tds) to distinguish between an error/shutdown on the socket, * or the receipt of an unexpected packet type. In the latter case, * tds->in_flag will indicate the return type. * Microsoft products require tds_version TDS72+, and SSMS requires a * product_version. Currently the highest this method will set is TDS71, * override after if necessary. */ TDSLOGIN * tds_alloc_read_login(TDSSOCKET * tds) { TDSLOGIN * login; /* * This should only be done on a server connection, and the server * always sends 0x04 packets. */ tds->out_flag = TDS_REPLY; /* Pre-read the next packet so we know what kind of packet it is */ if (tds_read_packet(tds) < 1) { return NULL; } /* Allocate the login packet */ login = tds_alloc_login(1); if (!login) return NULL; /* Use the packet type to determine which login format to expect */ switch (tds->in_flag) { case TDS_LOGIN: /* TDS4/5 login */ tds->conn->tds_version = 0x402; if (!tds_read_login(tds, login)) { tds_free_login(login); return NULL; } if (login->block_size == 0) { login->block_size = 512; } break; case TDS7_LOGIN: /* TDS7+ login */ tds->conn->tds_version = 0x700; if (!tds7_read_login(tds, login)) { tds_free_login(login); return NULL; } break; case TDS71_PRELOGIN: /* TDS7.1+ prelogin, hopefully followed by a login */ tds->conn->tds_version = 0x701; /* ignore client and just send our reply TODO... finish */ tds71_send_prelogin(tds); tds_flush_packet(tds); if (tds_read_packet(tds) < 0 || tds->in_flag != TDS7_LOGIN) { tds_free_login(login); return NULL; } if (!tds7_read_login(tds, login)) { tds_free_login(login); return NULL; } break; default: /* unexpected packet */ tds_free_login(login); return NULL; } /* Return it */ return login; } freetds-1.3.6/src/server/unittest.c000644 025423 025423 00000007740 14056414271 020737 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #include static void dump_login(TDSLOGIN * login); int main(int argc, char **argv) { TDSCONTEXT *ctx; TDSSOCKET *tds; TDSLOGIN *login; TDSRESULTINFO *resinfo; if (argc < 2 || atoi(argv[1]) <= 0) { fprintf(stderr, "syntax: %s \n", argv[0]); return 1; } ctx = tds_alloc_context(NULL); tds = tds_listen(ctx, atoi(argv[1])); if (!tds) return 1; /* get_incoming(tds->s); */ login = tds_alloc_read_login(tds); if (!login) { fprintf(stderr, "Error reading login\n"); exit(1); } dump_login(login); /* tds->conn->tds_version = 0x702; */ /* tds->conn->product_version = TDS_MS_VER(10, 0, 6000); */ if (!strcmp(tds_dstr_cstr(&login->user_name), "guest") && !strcmp(tds_dstr_cstr(&login->password), "sybase")) { tds->out_flag = TDS_REPLY; tds_env_change(tds, TDS_ENV_DATABASE, "master", "pubs2"); tds_send_msg(tds, 5701, 2, 10, "Changed database context to 'pubs2'.", "JDBC", "ZZZZZ", 1); if (!login->suppress_language) { tds_env_change(tds, TDS_ENV_LANG, NULL, "us_english"); tds_send_msg(tds, 5703, 1, 10, "Changed language setting to 'us_english'.", "JDBC", "ZZZZZ", 1); } tds_env_change(tds, TDS_ENV_PACKSIZE, NULL, "512"); /* TODO set mssql if tds7+ */ tds_send_login_ack(tds, "sql server"); if (IS_TDS50(tds->conn)) tds_send_capabilities_token(tds); tds_send_done_token(tds, 0, 1); } else { /* send nack before exiting */ exit(1); } tds_flush_packet(tds); tds_free_login(login); login = NULL; /* printf("incoming packet %d\n", tds_read_packet(tds)); */ printf("query : %s\n", tds_get_generic_query(tds)); tds->out_flag = TDS_REPLY; resinfo = tds_alloc_results(1); if (!resinfo) { fprintf(stderr, "out of memory"); exit(1); } resinfo->columns[0]->column_type = SYBVARCHAR; resinfo->columns[0]->column_size = 30; if (!tds_dstr_copy(&resinfo->columns[0]->column_name, "name")) exit(1); resinfo->current_row = (TDS_UCHAR*) "pubs2"; resinfo->columns[0]->column_data = resinfo->current_row; tds_send_result(tds, resinfo); tds_send_control_token(tds, 1); tds_send_row(tds, resinfo); tds_send_done_token(tds, 16, 1); tds_flush_packet(tds); tds_sleep_s(30); tds_free_results(resinfo); tds_free_socket(tds); tds_free_context(ctx); return 0; } static void dump_login(TDSLOGIN * login) { printf("host %s\n", tds_dstr_cstr(&login->client_host_name)); printf("user %s\n", tds_dstr_cstr(&login->user_name)); printf("pass %s\n", tds_dstr_cstr(&login->password)); printf("app %s\n", tds_dstr_cstr(&login->app_name)); printf("srvr %s\n", tds_dstr_cstr(&login->server_name)); printf("vers %d.%d\n", TDS_MAJOR(login), TDS_MINOR(login)); printf("lib %s\n", tds_dstr_cstr(&login->library)); printf("lang %s\n", tds_dstr_cstr(&login->language)); printf("char %s\n", tds_dstr_cstr(&login->server_charset)); printf("bsiz %d\n", login->block_size); } freetds-1.3.6/src/server/CMakeLists.txt000644 025423 025423 00000000442 14056414222 021440 0ustar00fredianofrediano000000 000000 add_library(tdssrv STATIC query.c server.c login.c ) if (NOT WIN32) set_target_properties(tdssrv PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() INSTALL(TARGETS tdssrv PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) freetds-1.3.6/src/odbc/Makefile.am000644 025423 025423 00000003115 14056414221 020334 0ustar00fredianofrediano000000 000000 SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) lib_LTLIBRARIES = libtdsodbc.la ##EXTRA_LTLIBRARIES = libtdsodbc.la libtdsodbc_la_SOURCES = odbc.c connectparams.c convert_tds2sql.c \ descriptor.c prepare_query.c odbc_util.c bcp.c \ native.c sql2tds.c error.c odbc_checks.c sqlwchar.c sqlwparams.h \ odbc_export.h error_export.h odbc_data.c # -module is needed by Darwin (Mac OS X) libtdsodbc_la_LDFLAGS = \ $(ODBCINST_LDFLAGS) $(LTLIBICONV) $(FREETDS_LIBGCC) \ $(FREETDS_SYMBOLIC) $(FREETDS_ODBC_MODULE) libtdsodbc_la_LIBADD = ../tds/libtds.la ../replacements/libreplacements.la if MINGW32 libtdsodbc_la_SOURCES += winlogin.c winsetup.c winmain.c endif if MINGW32 libtdsodbc_la_LIBADD += setup.res libtdsodbc_la_LDFLAGS += -Wl,--kill-at -Wl,--enable-stdcall-fixup -Wl,-s -Wl,@srcdir@/odbc_w.def -Wl,setup.res .rc.res: $(RC) -i $< --input-format=rc -o $@ -O coff else if !MACOSX libtdsodbc_la_LDFLAGS += -export-symbols-regex '^(SQL|ODBCINST).*' endif endif EXTRA_DIST = CMakeLists.txt winmain.c winlogin.c winsetup.c \ version.rc version.rc.in setup.rc resource.h \ odbc.def odbc_w.def CLEANFILES = setup.res ## Need blank statement to avoid compiling odbc.c odbc: $(EXTRA_LTLIBRARIES) @echo '' if HAVE_PERL_SOURCES BUILT_SOURCES = odbc_export.h error_export.h clean-local: cd $(srcdir) && rm -f $(BUILT_SOURCES) odbc_export.h: odbc_export.pl Makefile odbc.c perl $(srcdir)/odbc_export.pl $(srcdir)/odbc.c > $@.tmp mv $@.tmp $@ error_export.h: odbc_export.pl Makefile error.c perl $(srcdir)/odbc_export.pl $(srcdir)/error.c > $@.tmp mv $@.tmp $@ endif freetds-1.3.6/src/odbc/Makefile.in000644 025423 025423 00000100216 14162303357 020352 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @MINGW32_TRUE@am__append_1 = winlogin.c winsetup.c winmain.c @MINGW32_TRUE@am__append_2 = setup.res @MINGW32_TRUE@am__append_3 = -Wl,--kill-at -Wl,--enable-stdcall-fixup -Wl,-s -Wl,@srcdir@/odbc_w.def -Wl,setup.res @MACOSX_FALSE@@MINGW32_FALSE@am__append_4 = -export-symbols-regex '^(SQL|ODBCINST).*' subdir = src/odbc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = version.rc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) libtdsodbc_la_DEPENDENCIES = ../tds/libtds.la \ ../replacements/libreplacements.la $(am__append_2) am__libtdsodbc_la_SOURCES_DIST = odbc.c connectparams.c \ convert_tds2sql.c descriptor.c prepare_query.c odbc_util.c \ bcp.c native.c sql2tds.c error.c odbc_checks.c sqlwchar.c \ sqlwparams.h odbc_export.h error_export.h odbc_data.c \ winlogin.c winsetup.c winmain.c @MINGW32_TRUE@am__objects_1 = winlogin.lo winsetup.lo winmain.lo am_libtdsodbc_la_OBJECTS = odbc.lo connectparams.lo convert_tds2sql.lo \ descriptor.lo prepare_query.lo odbc_util.lo bcp.lo native.lo \ sql2tds.lo error.lo odbc_checks.lo sqlwchar.lo odbc_data.lo \ $(am__objects_1) libtdsodbc_la_OBJECTS = $(am_libtdsodbc_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libtdsodbc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libtdsodbc_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bcp.Plo \ ./$(DEPDIR)/connectparams.Plo ./$(DEPDIR)/convert_tds2sql.Plo \ ./$(DEPDIR)/descriptor.Plo ./$(DEPDIR)/error.Plo \ ./$(DEPDIR)/native.Plo ./$(DEPDIR)/odbc.Plo \ ./$(DEPDIR)/odbc_checks.Plo ./$(DEPDIR)/odbc_data.Plo \ ./$(DEPDIR)/odbc_util.Plo ./$(DEPDIR)/prepare_query.Plo \ ./$(DEPDIR)/sql2tds.Plo ./$(DEPDIR)/sqlwchar.Plo \ ./$(DEPDIR)/winlogin.Plo ./$(DEPDIR)/winmain.Plo \ ./$(DEPDIR)/winsetup.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtdsodbc_la_SOURCES) DIST_SOURCES = $(am__libtdsodbc_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/version.rc.in \ $(top_srcdir)/depcomp $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) lib_LTLIBRARIES = libtdsodbc.la libtdsodbc_la_SOURCES = odbc.c connectparams.c convert_tds2sql.c \ descriptor.c prepare_query.c odbc_util.c bcp.c native.c \ sql2tds.c error.c odbc_checks.c sqlwchar.c sqlwparams.h \ odbc_export.h error_export.h odbc_data.c $(am__append_1) # -module is needed by Darwin (Mac OS X) libtdsodbc_la_LDFLAGS = $(ODBCINST_LDFLAGS) $(LTLIBICONV) \ $(FREETDS_LIBGCC) $(FREETDS_SYMBOLIC) $(FREETDS_ODBC_MODULE) \ $(am__append_3) $(am__append_4) libtdsodbc_la_LIBADD = ../tds/libtds.la \ ../replacements/libreplacements.la $(am__append_2) EXTRA_DIST = CMakeLists.txt winmain.c winlogin.c winsetup.c \ version.rc version.rc.in setup.rc resource.h \ odbc.def odbc_w.def CLEANFILES = setup.res @HAVE_PERL_SOURCES_TRUE@BUILT_SOURCES = odbc_export.h error_export.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj .rc .res $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/odbc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/odbc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): version.rc: $(top_builddir)/config.status $(srcdir)/version.rc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtdsodbc.la: $(libtdsodbc_la_OBJECTS) $(libtdsodbc_la_DEPENDENCIES) $(EXTRA_libtdsodbc_la_DEPENDENCIES) $(AM_V_CCLD)$(libtdsodbc_la_LINK) -rpath $(libdir) $(libtdsodbc_la_OBJECTS) $(libtdsodbc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connectparams.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert_tds2sql.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/descriptor.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/native.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odbc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odbc_checks.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odbc_data.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/odbc_util.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prepare_query.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql2tds.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sqlwchar.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winlogin.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmain.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winsetup.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_FALSE@clean-local: clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/bcp.Plo -rm -f ./$(DEPDIR)/connectparams.Plo -rm -f ./$(DEPDIR)/convert_tds2sql.Plo -rm -f ./$(DEPDIR)/descriptor.Plo -rm -f ./$(DEPDIR)/error.Plo -rm -f ./$(DEPDIR)/native.Plo -rm -f ./$(DEPDIR)/odbc.Plo -rm -f ./$(DEPDIR)/odbc_checks.Plo -rm -f ./$(DEPDIR)/odbc_data.Plo -rm -f ./$(DEPDIR)/odbc_util.Plo -rm -f ./$(DEPDIR)/prepare_query.Plo -rm -f ./$(DEPDIR)/sql2tds.Plo -rm -f ./$(DEPDIR)/sqlwchar.Plo -rm -f ./$(DEPDIR)/winlogin.Plo -rm -f ./$(DEPDIR)/winmain.Plo -rm -f ./$(DEPDIR)/winsetup.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/bcp.Plo -rm -f ./$(DEPDIR)/connectparams.Plo -rm -f ./$(DEPDIR)/convert_tds2sql.Plo -rm -f ./$(DEPDIR)/descriptor.Plo -rm -f ./$(DEPDIR)/error.Plo -rm -f ./$(DEPDIR)/native.Plo -rm -f ./$(DEPDIR)/odbc.Plo -rm -f ./$(DEPDIR)/odbc_checks.Plo -rm -f ./$(DEPDIR)/odbc_data.Plo -rm -f ./$(DEPDIR)/odbc_util.Plo -rm -f ./$(DEPDIR)/prepare_query.Plo -rm -f ./$(DEPDIR)/sql2tds.Plo -rm -f ./$(DEPDIR)/sqlwchar.Plo -rm -f ./$(DEPDIR)/winlogin.Plo -rm -f ./$(DEPDIR)/winmain.Plo -rm -f ./$(DEPDIR)/winsetup.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: $(am__recursive_targets) all check install install-am \ install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool clean-local cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-libLTLIBRARIES .PRECIOUS: Makefile @MINGW32_TRUE@.rc.res: @MINGW32_TRUE@ $(RC) -i $< --input-format=rc -o $@ -O coff odbc: $(EXTRA_LTLIBRARIES) @echo '' @HAVE_PERL_SOURCES_TRUE@clean-local: @HAVE_PERL_SOURCES_TRUE@ cd $(srcdir) && rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_TRUE@odbc_export.h: odbc_export.pl Makefile odbc.c @HAVE_PERL_SOURCES_TRUE@ perl $(srcdir)/odbc_export.pl $(srcdir)/odbc.c > $@.tmp @HAVE_PERL_SOURCES_TRUE@ mv $@.tmp $@ @HAVE_PERL_SOURCES_TRUE@error_export.h: odbc_export.pl Makefile error.c @HAVE_PERL_SOURCES_TRUE@ perl $(srcdir)/odbc_export.pl $(srcdir)/error.c > $@.tmp @HAVE_PERL_SOURCES_TRUE@ mv $@.tmp $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/odbc/version.rc.in000644 025423 025423 00000002356 14056414222 020727 0ustar00fredianofrediano000000 000000 #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION @MAJOR@,@MINOR@,@SUBVERSION@,@BUILD_NUMBER@ PRODUCTVERSION @MAJOR@,@MINOR@,@SUBVERSION@,@BUILD_NUMBER@ FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "FreeTDS.org\0" VALUE "FileDescription", "FreeTDS\0" VALUE "FileVersion", "@MAJOR@, @MINOR@, @SUBVERSION@, @BUILD_NUMBER@\0" VALUE "InternalName", "FreeTDS\0" VALUE "LegalCopyright", "Copyright © 2004-2015 under terms of GNU LGPL\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "FreeTDS.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "FreeTDS ODBC Driver\0" VALUE "ProductVersion", "@MAJOR@, @MINOR@, @SUBVERSION@, @BUILD_NUMBER@\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END #endif // !_MAC freetds-1.3.6/src/odbc/odbc.c000644 025423 025423 00000655616 14056414271 017403 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001 Brian Bruns * Copyright (C) 2002-2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include #include #include #include #include "sqlwparams.h" /* Include odbcss.h with all bcp functions */ /* The define trick is to make inline functions calls internal * _SQLSetConnectAttr instead of SQLSetConnectAttr */ ODBC_FUNC(SQLSetConnectAttr, (P(SQLHDBC,hdbc), P(SQLINTEGER,Attribute), P(SQLPOINTER,ValuePtr), P(SQLINTEGER,StringLength) WIDE)); #define TDSODBC_BCP #undef SQLSetConnectAttr #define SQLSetConnectAttr(h, n, p, t) _SQLSetConnectAttr(h, n, p, t _wide0) #include #undef SQLSetConnectAttr static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv, SQLINTEGER odbc_version); static SQLRETURN _SQLAllocStmt(SQLHDBC hdbc, SQLHSTMT FAR * phstmt); static SQLRETURN _SQLAllocDesc(SQLHDBC hdbc, SQLHDESC FAR * phdesc); static SQLRETURN _SQLFreeConnect(SQLHDBC hdbc); static SQLRETURN _SQLFreeEnv(SQLHENV henv); static SQLRETURN _SQLFreeStmt(SQLHSTMT hstmt, SQLUSMALLINT fOption, int force); static SQLRETURN _SQLFreeDesc(SQLHDESC hdesc); static SQLRETURN _SQLExecute(TDS_STMT * stmt); static SQLRETURN _SQLSetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength WIDE); static SQLRETURN _SQLGetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength WIDE); static SQLRETURN _SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, SQLLEN FAR * pfDesc _WIDE); static SQLRETURN _SQLFetch(TDS_STMT * stmt, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset); static SQLRETURN odbc_populate_ird(TDS_STMT * stmt); static int odbc_errmsg_handler(const TDSCONTEXT * ctx, TDSSOCKET * tds, TDSMESSAGE * msg); static void odbc_log_unimplemented_type(const char function_name[], int fType); static void odbc_upper_column_names(TDS_STMT * stmt); static void odbc_col_setname(TDS_STMT * stmt, int colpos, const char *name); static SQLRETURN odbc_stat_execute(TDS_STMT * stmt _WIDE, const char *begin, int nparams, ...); static SQLRETURN odbc_free_dynamic(TDS_STMT * stmt); static SQLRETURN odbc_free_cursor(TDS_STMT * stmt); static SQLRETURN odbc_update_ird(TDS_STMT *stmt, TDS_ERRS *errs); static SQLRETURN odbc_prepare(TDS_STMT *stmt); static SQLSMALLINT odbc_swap_datetime_sql_type(SQLSMALLINT sql_type, int version); static int odbc_process_tokens(TDS_STMT * stmt, unsigned flag); static int odbc_lock_statement(TDS_STMT* stmt); static void odbc_unlock_statement(TDS_STMT* stmt); #if ENABLE_EXTRA_CHECKS static void odbc_ird_check(TDS_STMT * stmt); #define IRD_CHECK odbc_ird_check(stmt) #else #define IRD_CHECK #endif /** * \defgroup odbc_api ODBC API * Functions callable by \c ODBC client programs */ /* utils to check handles */ #define INIT_HANDLE(t, n) \ TDS_##t *n = (TDS_##t*)h##n; \ if (SQL_NULL_H##t == h##n || !IS_H##t(h##n)) return SQL_INVALID_HANDLE; \ tds_mutex_lock(&n->mtx); \ CHECK_##t##_EXTRA(n); \ odbc_errs_reset(&n->errs); #define ODBC_ENTER_HSTMT INIT_HANDLE(STMT, stmt) #define ODBC_ENTER_HDBC INIT_HANDLE(DBC, dbc) #define ODBC_ENTER_HENV INIT_HANDLE(ENV, env) #define ODBC_ENTER_HDESC INIT_HANDLE(DESC, desc) #define IS_VALID_LEN(len) ((len) >= 0 || (len) == SQL_NTS || (len) == SQL_NULL_DATA) #define ODBC_SAFE_ERROR(stmt) \ do { \ if (!stmt->errs.num_errors) \ odbc_errs_add(&stmt->errs, "HY000", "Unknown error"); \ } while(0) #define DEFAULT_QUERY_TIMEOUT (~((SQLUINTEGER) 0)) /* * Note: I *HATE* hungarian notation, it has to be the most idiotic thing * I've ever seen. So, you will note it is avoided other than in the function * declarations. "Gee, let's make our code totally hard to read and they'll * beg for GUI tools" * Bah! */ static const char * odbc_prret(SQLRETURN ret, char *unknown, size_t unknown_size) { switch (ret) { case SQL_ERROR: return "SQL_ERROR"; case SQL_INVALID_HANDLE: return "SQL_INVALID_HANDLE"; case SQL_SUCCESS: return "SQL_SUCCESS"; case SQL_SUCCESS_WITH_INFO: return "SQL_SUCCESS_WITH_INFO"; #if ODBCVER >= 0x0300 case SQL_NO_DATA: return "SQL_NO_DATA"; #endif case SQL_STILL_EXECUTING: return "SQL_STILL_EXECUTING"; case SQL_NEED_DATA: return "SQL_NEED_DATA"; } snprintf(unknown, unknown_size, "unknown: %d", (int)ret); return unknown; } #define ODBC_PRRET_BUF char unknown_prret_buf[24] #define odbc_prret(ret) odbc_prret(ret, unknown_prret_buf, sizeof(unknown_prret_buf)) static void odbc_col_setname(TDS_STMT * stmt, int colpos, const char *name) { #if ENABLE_EXTRA_CHECKS TDSRESULTINFO *resinfo; #endif IRD_CHECK; #if ENABLE_EXTRA_CHECKS if (colpos > 0 && stmt->tds != NULL && (resinfo = stmt->tds->current_results) != NULL) { if (colpos <= resinfo->num_cols) { /* no overflow possible, name is always shorter */ if (!tds_dstr_copy(&resinfo->columns[colpos - 1]->column_name, name)) odbc_errs_add(&stmt->errs, "HY001", NULL); tds_dstr_empty(&resinfo->columns[colpos - 1]->table_column_name); } } #endif if (colpos > 0 && colpos <= stmt->ird->header.sql_desc_count) { --colpos; if (!tds_dstr_copy(&stmt->ird->records[colpos].sql_desc_label, name) || !tds_dstr_copy(&stmt->ird->records[colpos].sql_desc_name, name)) odbc_errs_add(&stmt->errs, "HY001", NULL); } } /* spinellia@acm.org : copied shamelessly from change_database */ static SQLRETURN change_autocommit(TDS_DBC * dbc, int state) { TDSSOCKET *tds = dbc->tds_socket; TDSRET ret; tds_mutex_check_owned(&dbc->mtx); if (dbc->attr.autocommit == state) return SQL_SUCCESS; /* * We may not be connected yet and dbc->tds_socket * may not initialized. */ if (tds) { /* TODO better idle check, not thread safe */ if (tds->state == TDS_IDLE) tds->query_timeout = dbc->default_query_timeout; if (state == SQL_AUTOCOMMIT_ON) ret = tds_submit_rollback(tds, 0); else ret = tds_submit_begin_tran(tds); if (TDS_FAILED(ret)) { odbc_errs_add(&dbc->errs, "HY000", "Could not change transaction status"); return SQL_ERROR; } if (TDS_FAILED(tds_process_simple_query(tds))) { odbc_errs_add(&dbc->errs, "HY000", "Could not change transaction status"); return SQL_ERROR; } dbc->attr.autocommit = state; } else { /* if not connected we will change auto-commit after login */ dbc->attr.autocommit = state; } ODBC_RETURN_(dbc); } static SQLRETURN change_database(TDS_DBC * dbc, const char *database, int database_len) { TDSSOCKET *tds = dbc->tds_socket; tds_mutex_check_owned(&dbc->mtx); /* * We may not be connected yet and dbc->tds_socket * may not initialized. */ if (tds) { /* build query */ char *query = tds_new(char, 6 + tds_quote_id(tds, NULL, database, database_len)); if (!query) { odbc_errs_add(&dbc->errs, "HY001", NULL); return SQL_ERROR; } strcpy(query, "USE "); tds_quote_id(tds, query + 4, database, database_len); tdsdump_log(TDS_DBG_INFO1, "change_database: executing %s\n", query); /* TODO better idle check, not thread safe */ if (tds->state == TDS_IDLE) tds->query_timeout = dbc->default_query_timeout; if (TDS_FAILED(tds_submit_query(tds, query))) { free(query); odbc_errs_add(&dbc->errs, "HY000", "Could not change database"); return SQL_ERROR; } free(query); if (TDS_FAILED(tds_process_simple_query(tds))) { odbc_errs_add(&dbc->errs, "HY000", "Could not change database"); return SQL_ERROR; } } else { if (!tds_dstr_copyn(&dbc->attr.current_catalog, database, database_len)) { odbc_errs_add(&dbc->errs, "HY001", NULL); return SQL_ERROR; } } ODBC_RETURN_(dbc); } static SQLRETURN change_txn(TDS_DBC * dbc, SQLUINTEGER txn_isolation) { char query[64]; const char *level; TDSSOCKET *tds = dbc->tds_socket; tds_mutex_check_owned(&dbc->mtx); switch (txn_isolation) { case SQL_TXN_READ_COMMITTED: level = "READ COMMITTED"; break; case SQL_TXN_READ_UNCOMMITTED: level = "READ UNCOMMITTED"; break; case SQL_TXN_REPEATABLE_READ: level = "REPEATABLE READ"; break; case SQL_TXN_SERIALIZABLE: level = "SERIALIZABLE"; break; default: odbc_errs_add(&dbc->errs, "HY024", NULL); return SQL_ERROR; } /* if not connected return success, will be set after connection */ if (!tds) return SQL_SUCCESS; if (tds->state != TDS_IDLE) { odbc_errs_add(&dbc->errs, "HY011", NULL); return SQL_ERROR; } tds->query_timeout = dbc->default_query_timeout; sprintf(query, "SET TRANSACTION ISOLATION LEVEL %s", level); if (TDS_FAILED(tds_submit_query(tds, query))) { ODBC_SAFE_ERROR(dbc); return SQL_ERROR; } if (TDS_FAILED(tds_process_simple_query(tds))) { ODBC_SAFE_ERROR(dbc); return SQL_ERROR; } return SQL_SUCCESS; } static TDS_DBC* odbc_get_dbc(TDSSOCKET *tds) { TDS_CHK *chk = (TDS_CHK *) tds_get_parent(tds); if (!chk) return NULL; if (chk->htype == SQL_HANDLE_DBC) return (TDS_DBC *) chk; assert(chk->htype == SQL_HANDLE_STMT); return ((TDS_STMT *) chk)->dbc; } static TDS_STMT* odbc_get_stmt(TDSSOCKET *tds) { TDS_CHK *chk = (TDS_CHK *) tds_get_parent(tds); if (!chk || chk->htype != SQL_HANDLE_STMT) return NULL; return (TDS_STMT *) chk; } static void odbc_env_change(TDSSOCKET * tds, int type, char *oldval, char *newval) { TDS_DBC *dbc; assert(tds); dbc = odbc_get_dbc(tds); if (!dbc) return; switch (type) { case TDS_ENV_DATABASE: tds_dstr_copy(&dbc->attr.current_catalog, newval); break; case TDS_ENV_PACKSIZE: dbc->attr.packet_size = atoi(newval); break; } } static SQLRETURN odbc_connect(TDS_DBC * dbc, TDSLOGIN * login) { TDS_ENV *env = dbc->env; tds_mutex_check_owned(&dbc->mtx); #ifdef ENABLE_ODBC_WIDE dbc->mb_conv = NULL; #endif dbc->tds_socket = tds_alloc_socket(env->tds_ctx, 512); if (!dbc->tds_socket) goto memory_error; dbc->tds_socket->conn->use_iconv = 0; tds_set_parent(dbc->tds_socket, (void *) dbc); /* Set up our environment change hook */ dbc->tds_socket->env_chg_func = odbc_env_change; tds_fix_login(login); /* use connection timeout if set */ if (dbc->attr.connection_timeout) login->connect_timeout = dbc->attr.connection_timeout; /* but override with login timeout, if set */ if (dbc->attr.login_timeout) login->connect_timeout = dbc->attr.login_timeout; if (dbc->attr.mars_enabled != SQL_MARS_ENABLED_NO) login->mars = 1; if (dbc->attr.bulk_enabled != SQL_BCP_OFF) tds_set_bulk(login, true); #ifdef ENABLE_ODBC_WIDE /* force utf-8 in order to support wide characters */ dbc->original_charset_num = tds_canonical_charset(tds_dstr_cstr(&login->client_charset)); if (dbc->original_charset_num < 0 || !tds_dstr_copy(&login->client_charset, "UTF-8")) goto memory_error; #endif /* replace password with old one */ if (dbc->use_oldpwd) { if (!tds_dstr_dup(&login->new_password, &login->password) || !tds_dstr_dup(&login->password, &dbc->oldpwd)) goto memory_error; login->use_new_password = 1; } if (TDS_FAILED(tds_connect_and_login(dbc->tds_socket, login))) { tds_free_socket(dbc->tds_socket); dbc->tds_socket = NULL; odbc_errs_add(&dbc->errs, "08001", NULL); return SQL_ERROR; } #ifdef ENABLE_ODBC_WIDE dbc->mb_conv = tds_iconv_get_info(dbc->tds_socket->conn, dbc->original_charset_num, TDS_CHARSET_UTF_8); #endif dbc->default_query_timeout = dbc->tds_socket->query_timeout; if (IS_TDS7_PLUS(dbc->tds_socket->conn)) dbc->cursor_support = 1; #if ENABLE_ODBC_MARS /* check if mars is enabled */ if (!IS_TDS72_PLUS(dbc->tds_socket->conn) || !dbc->tds_socket->conn->mars) dbc->attr.mars_enabled = SQL_MARS_ENABLED_NO; #else dbc->attr.mars_enabled = SQL_MARS_ENABLED_NO; #endif if (dbc->attr.txn_isolation != SQL_TXN_READ_COMMITTED) { if (!SQL_SUCCEEDED(change_txn(dbc, dbc->attr.txn_isolation))) ODBC_RETURN_(dbc); } if (dbc->attr.autocommit != SQL_AUTOCOMMIT_ON) { dbc->attr.autocommit = SQL_AUTOCOMMIT_ON; if (!SQL_SUCCEEDED(change_autocommit(dbc, SQL_AUTOCOMMIT_OFF))) ODBC_RETURN_(dbc); } /* this overwrite any error arrived (wanted behavior, Sybase return error for conversion errors) */ ODBC_RETURN(dbc, SQL_SUCCESS); memory_error: tds_free_socket(dbc->tds_socket); dbc->tds_socket = NULL; odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_RETURN_(dbc); } /** * Update IRD information. * This is needed if the IRD is not updated as requires query to be prepared. * For instance calling SQLNumResultCols after SQLPrepare we need to * know how many rows the query could return. */ static SQLRETURN odbc_update_ird(TDS_STMT *stmt, TDS_ERRS *errs) { SQLRETURN res; if (!stmt->need_reprepare || stmt->prepared_query_is_rpc || !stmt->dbc || !IS_TDS7_PLUS(stmt->dbc->tds_socket->conn)) { stmt->need_reprepare = 0; return SQL_SUCCESS; } /* FIXME where error are put ?? on stmt... */ if (!odbc_lock_statement(stmt)) ODBC_RETURN_(stmt); /* FIXME error */ res = start_parse_prepared_query(stmt, false); if (res != SQL_SUCCESS) { /* prepare with dummy parameters just to fill IRD */ tds_free_param_results(stmt->params); stmt->params = NULL; stmt->param_num = 0; /* * TODO * we need to prepare again with parameters but need_reprepare * flag is reset by odbc_prepare... perhaps should be checked * later, not calling describeCol or similar * we need prepare to get dynamic and cause we change parameters */ } return odbc_prepare(stmt); } static SQLRETURN odbc_prepare(TDS_STMT *stmt) { TDSSOCKET *tds = stmt->tds; int in_row = 0; if (TDS_FAILED(tds_submit_prepare(tds, tds_dstr_cstr(&stmt->query), NULL, &stmt->dyn, stmt->params))) { ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } /* try to go to the next recordset */ /* TODO merge with similar code */ desc_free_records(stmt->ird); stmt->row_status = PRE_NORMAL_ROW; for (;;) { TDS_INT result_type; int done_flags; switch (tds_process_tokens(tds, &result_type, &done_flags, TDS_RETURN_ROWFMT|TDS_RETURN_DONE)) { case TDS_SUCCESS: switch (result_type) { case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: stmt->row_count = tds->rows_affected; if (done_flags & TDS_DONE_ERROR && !stmt->dyn->emulated) stmt->errs.lastrc = SQL_ERROR; /* FIXME this row is used only as a flag for update binding, should be cleared if binding/result changed */ stmt->row = 0; break; case TDS_ROWFMT_RESULT: /* store first row informations */ if (!in_row) odbc_populate_ird(stmt); stmt->row = 0; stmt->row_count = TDS_NO_COUNT; stmt->row_status = PRE_NORMAL_ROW; in_row = 1; break; } continue; case TDS_NO_MORE_RESULTS: break; case TDS_CANCELLED: odbc_errs_add(&stmt->errs, "HY008", NULL); default: stmt->errs.lastrc = SQL_ERROR; break; } break; } if (stmt->errs.lastrc == SQL_ERROR && !stmt->dyn->emulated) { tds_release_dynamic(&stmt->dyn); } odbc_unlock_statement(stmt); stmt->need_reprepare = 0; ODBC_RETURN_(stmt); } ODBC_FUNC(SQLDriverConnect, (P(SQLHDBC,hdbc), P(SQLHWND,hwnd), PCHARIN(ConnStrIn,SQLSMALLINT), PCHAROUT(ConnStrOut,SQLSMALLINT), P(SQLUSMALLINT,fDriverCompletion) WIDE)) { TDSLOGIN *login; TDS_PARSED_PARAM params[ODBC_PARAM_SIZE]; DSTR conn_str = DSTR_INITIALIZER; ODBC_ENTER_HDBC; #ifdef TDS_NO_DM /* Check string length */ if (!IS_VALID_LEN(cbConnStrIn) || cbConnStrIn == 0) { odbc_errs_add(&dbc->errs, "HY090", NULL); ODBC_EXIT_(dbc); } /* Check completion param */ switch (fDriverCompletion) { case SQL_DRIVER_NOPROMPT: case SQL_DRIVER_COMPLETE: case SQL_DRIVER_PROMPT: case SQL_DRIVER_COMPLETE_REQUIRED: break; default: odbc_errs_add(&dbc->errs, "HY110", NULL); ODBC_EXIT_(dbc); } #endif if (!odbc_dstr_copy(dbc, &conn_str, cbConnStrIn, szConnStrIn)) { odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } login = tds_alloc_login(0); if (!login || !tds_init_login(login, dbc->env->tds_ctx->locale)) { tds_free_login(login); tds_dstr_free(&conn_str); odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } if (!tds_dstr_isempty(&dbc->attr.current_catalog)) if (!tds_dstr_dup(&login->database, &dbc->attr.current_catalog)) { tds_free_login(login); tds_dstr_free(&conn_str); odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } /* parse the DSN string */ if (!odbc_parse_connect_string(&dbc->errs, tds_dstr_buf(&conn_str), tds_dstr_buf(&conn_str) + tds_dstr_len(&conn_str), login, params)) { tds_dstr_free(&conn_str); ODBC_EXIT_(dbc); } odbc_set_dstr(dbc, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, &conn_str); tds_dstr_free(&conn_str); /* add login info */ if (hwnd && fDriverCompletion != SQL_DRIVER_NOPROMPT && (fDriverCompletion == SQL_DRIVER_PROMPT || (!params[ODBC_PARAM_UID].p && !params[ODBC_PARAM_Trusted_Connection].p) || tds_dstr_isempty(&login->server_name))) { #ifdef _WIN32 char *out = NULL; /* prompt for login information */ if (!get_login_info(hwnd, login)) { tds_free_login(login); odbc_errs_add(&dbc->errs, "08001", "User canceled login"); ODBC_EXIT_(dbc); } if (tds_dstr_isempty(&login->user_name)) { params[ODBC_PARAM_UID].p = NULL; params[ODBC_PARAM_PWD].p = NULL; params[ODBC_PARAM_Trusted_Connection].p = "Yes"; params[ODBC_PARAM_Trusted_Connection].len = 3; } else { params[ODBC_PARAM_UID].p = tds_dstr_cstr(&login->user_name); params[ODBC_PARAM_UID].len = tds_dstr_len(&login->user_name); params[ODBC_PARAM_PWD].p = tds_dstr_cstr(&login->password); params[ODBC_PARAM_PWD].len = tds_dstr_len(&login->password); params[ODBC_PARAM_Trusted_Connection].p = NULL; } if (!odbc_build_connect_string(&dbc->errs, params, &out)) ODBC_EXIT_(dbc); odbc_set_string(dbc, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, out, -1); tdsdump_log(TDS_DBG_INFO1, "connection string is now: %s\n", out); free(out); #else /* we dont support a dialog box */ odbc_errs_add(&dbc->errs, "HYC00", NULL); #endif } if (tds_dstr_isempty(&login->server_name)) { tds_free_login(login); odbc_errs_add(&dbc->errs, "IM007", "Could not find Servername or server parameter"); ODBC_EXIT_(dbc); } odbc_connect(dbc, login); tds_free_login(login); ODBC_EXIT_(dbc); } #if 0 SQLRETURN ODBC_API SQLBrowseConnect(SQLHDBC hdbc, SQLCHAR FAR * szConnStrIn, SQLSMALLINT cbConnStrIn, SQLCHAR FAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR * pcbConnStrOut) { tdsdump_log(TDS_DBG_FUNC, "SQLBrowseConnect(%p, %s, %d, %p, %d, %p)\n", hdbc, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut); ODBC_ENTER_HDBC; odbc_errs_add(&dbc->errs, "HYC00", "SQLBrowseConnect: function not implemented"); ODBC_EXIT_(dbc); } #endif ODBC_FUNC(SQLColumnPrivileges, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(TableName,SQLSMALLINT), PCHARIN(ColumnName,SQLSMALLINT) WIDE)) { int retcode; ODBC_ENTER_HSTMT; retcode = odbc_stat_execute(stmt _wide, "sp_column_privileges", 4, "O@table_qualifier", szCatalogName, cbCatalogName, "O@table_owner", szSchemaName, cbSchemaName, "O@table_name", szTableName, cbTableName, "P@column_name", szColumnName, cbColumnName); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "TABLE_CAT"); odbc_col_setname(stmt, 2, "TABLE_SCHEM"); } ODBC_EXIT_(stmt); } #if 0 SQLRETURN ODBC_API SQLDescribeParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT FAR * pfSqlType, SQLUINTEGER FAR * pcbParamDef, SQLSMALLINT FAR * pibScale, SQLSMALLINT FAR * pfNullable) { tdsdump_log(TDS_DBG_FUNC, "SQLDescribeParam(%p, %d, %p, %p, %p, %p)\n", hstmt, ipar, pfSqlType, pcbParamDef, pibScale, pfNullable); ODBC_ENTER_HSTMT; odbc_errs_add(&stmt->errs, "HYC00", "SQLDescribeParam: function not implemented"); ODBC_EXIT_(stmt); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLROWOFFSET irow, SQLROWSETSIZE FAR * pcrow, SQLUSMALLINT FAR * rgfRowStatus) { SQLRETURN ret; SQLULEN * tmp_rows; SQLUSMALLINT * tmp_status; SQLULEN tmp_size; SQLLEN * tmp_offset; SQLPOINTER tmp_bookmark; SQLULEN bookmark; SQLULEN out_len = 0; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLExtendedFetch(%p, %d, %d, %p, %p)\n", hstmt, fFetchType, (int)irow, pcrow, rgfRowStatus); if (fFetchType != SQL_FETCH_NEXT && !stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "HY106", NULL); ODBC_EXIT_(stmt); } /* save and change IRD/ARD state */ tmp_rows = stmt->ird->header.sql_desc_rows_processed_ptr; stmt->ird->header.sql_desc_rows_processed_ptr = &out_len; tmp_status = stmt->ird->header.sql_desc_array_status_ptr; stmt->ird->header.sql_desc_array_status_ptr = rgfRowStatus; tmp_size = stmt->ard->header.sql_desc_array_size; stmt->ard->header.sql_desc_array_size = stmt->sql_rowset_size; tmp_offset = stmt->ard->header.sql_desc_bind_offset_ptr; stmt->ard->header.sql_desc_bind_offset_ptr = NULL; tmp_bookmark = stmt->attr.fetch_bookmark_ptr; /* SQL_FETCH_BOOKMARK different */ if (fFetchType == SQL_FETCH_BOOKMARK) { bookmark = irow; irow = 0; stmt->attr.fetch_bookmark_ptr = &bookmark; } /* TODO errors are sligthly different ... perhaps it's better to leave DM do this job ?? */ /* TODO check fFetchType can be converted to USMALLINT */ ret = _SQLFetch(stmt, fFetchType, irow); /* restore IRD/ARD */ stmt->ird->header.sql_desc_rows_processed_ptr = tmp_rows; if (pcrow) *pcrow = out_len; stmt->ird->header.sql_desc_array_status_ptr = tmp_status; stmt->ard->header.sql_desc_array_size = tmp_size; stmt->ard->header.sql_desc_bind_offset_ptr = tmp_offset; stmt->attr.fetch_bookmark_ptr = tmp_bookmark; ODBC_EXIT(stmt, ret); } ODBC_FUNC(SQLForeignKeys, (P(SQLHSTMT,hstmt), PCHARIN(PkCatalogName,SQLSMALLINT), PCHARIN(PkSchemaName,SQLSMALLINT), PCHARIN(PkTableName,SQLSMALLINT), PCHARIN(FkCatalogName,SQLSMALLINT), PCHARIN(FkSchemaName,SQLSMALLINT), PCHARIN(FkTableName,SQLSMALLINT) WIDE)) { int retcode; ODBC_ENTER_HSTMT; retcode = odbc_stat_execute(stmt _wide, "sp_fkeys", 6, "O@pktable_qualifier", szPkCatalogName, cbPkCatalogName, "O@pktable_owner", szPkSchemaName, cbPkSchemaName, "O@pktable_name", szPkTableName, cbPkTableName, "O@fktable_qualifier", szFkCatalogName, cbFkCatalogName, "O@fktable_owner", szFkSchemaName, cbFkSchemaName, "O@fktable_name", szFkTableName, cbFkTableName); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "PKTABLE_CAT"); odbc_col_setname(stmt, 2, "PKTABLE_SCHEM"); odbc_col_setname(stmt, 5, "FKTABLE_CAT"); odbc_col_setname(stmt, 6, "FKTABLE_SCHEM"); } ODBC_EXIT_(stmt); } static int odbc_lock_statement(TDS_STMT* stmt) { #if ENABLE_ODBC_MARS TDSSOCKET *tds = stmt->tds; /* we already own a socket, just use it */ if (!tds) { /* try with one saved into DBC */ TDSSOCKET *dbc_tds = stmt->dbc->tds_socket; tds_mutex_lock(&stmt->dbc->mtx); if (stmt->dbc->current_statement == NULL || stmt->dbc->current_statement == stmt) { tds = dbc_tds; stmt->dbc->current_statement = stmt; } /* try to grab current locked one */ if (!tds && dbc_tds->state == TDS_IDLE) { stmt->dbc->current_statement->tds = NULL; tds = dbc_tds; stmt->dbc->current_statement = stmt; } tds_mutex_unlock(&stmt->dbc->mtx); /* try with MARS */ if (!tds) tds = tds_alloc_additional_socket(dbc_tds->conn); } if (tds) { tds->query_timeout = (stmt->attr.query_timeout != DEFAULT_QUERY_TIMEOUT) ? stmt->attr.query_timeout : stmt->dbc->default_query_timeout; tds_set_parent(tds, stmt); stmt->tds = tds; return 1; } odbc_errs_add(&stmt->errs, "24000", NULL); return 0; #else TDSSOCKET *tds = stmt->dbc->tds_socket; tds_mutex_lock(&stmt->dbc->mtx); if (stmt->dbc->current_statement != NULL && stmt->dbc->current_statement != stmt) { if (!tds || tds->state != TDS_IDLE) { tds_mutex_unlock(&stmt->dbc->mtx); odbc_errs_add(&stmt->errs, "24000", NULL); return 0; } stmt->dbc->current_statement->tds = NULL; } stmt->dbc->current_statement = stmt; if (tds) { tds->query_timeout = (stmt->attr.query_timeout != DEFAULT_QUERY_TIMEOUT) ? stmt->attr.query_timeout : stmt->dbc->default_query_timeout; tds_set_parent(tds, stmt); stmt->tds = tds; } tds_mutex_unlock(&stmt->dbc->mtx); return 1; #endif } static void odbc_unlock_statement(TDS_STMT* stmt) { TDSSOCKET * tds; tds_mutex_lock(&stmt->dbc->mtx); tds = stmt->tds; if (stmt->dbc->current_statement == stmt) { assert(tds == stmt->dbc->tds_socket); if (tds->state == TDS_IDLE || tds->state == TDS_DEAD) { stmt->dbc->current_statement = NULL; tds_set_parent(tds, stmt->dbc); stmt->tds = NULL; } #if ENABLE_ODBC_MARS } else if (tds) { if (tds->state == TDS_IDLE || tds->state == TDS_DEAD) { assert(tds != stmt->dbc->tds_socket); tds_free_socket(tds); stmt->tds = NULL; } #endif } tds_mutex_unlock(&stmt->dbc->mtx); } SQLRETURN ODBC_PUBLIC ODBC_API SQLMoreResults(SQLHSTMT hstmt) { TDSSOCKET *tds; TDS_INT result_type; TDSRET tdsret; int in_row = 0; SQLUSMALLINT param_status; int token_flags; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLMoreResults(%p)\n", hstmt); tds = stmt->tds; /* We already read all results... */ if (!tds) ODBC_EXIT(stmt, SQL_NO_DATA); stmt->row_count = TDS_NO_COUNT; stmt->special_row = ODBC_SPECIAL_NONE; /* TODO this code is TOO similar to _SQLExecute, merge it - freddy77 */ /* try to go to the next recordset */ if (stmt->row_status == IN_COMPUTE_ROW) { /* FIXME doesn't seem so fine ... - freddy77 */ tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_TRAILING); stmt->row_status = IN_COMPUTE_ROW; in_row = 1; } param_status = SQL_PARAM_SUCCESS; token_flags = (TDS_TOKEN_RESULTS & (~TDS_STOPAT_COMPUTE)) | TDS_RETURN_COMPUTE; if (stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) token_flags |= TDS_RETURN_MSG; for (;;) { result_type = odbc_process_tokens(stmt, token_flags); tdsdump_log(TDS_DBG_INFO1, "SQLMoreResults: result_type=%d, row_count=%" PRId64 ", lastrc=%d\n", result_type, stmt->row_count, stmt->errs.lastrc); switch (result_type) { case TDS_CMD_DONE: #if 1 /* !UNIXODBC */ tds_free_all_results(tds); #endif odbc_populate_ird(stmt); odbc_unlock_statement(stmt); if (stmt->row_count == TDS_NO_COUNT && !in_row) { stmt->row_status = NOT_IN_ROW; tdsdump_log(TDS_DBG_INFO1, "SQLMoreResults: row_status=%d\n", stmt->row_status); } tdsdump_log(TDS_DBG_INFO1, "SQLMoreResults: row_count=%" PRId64 ", lastrc=%d\n", stmt->row_count, stmt->errs.lastrc); if (stmt->row_count == TDS_NO_COUNT) { if (stmt->errs.lastrc == SQL_SUCCESS || stmt->errs.lastrc == SQL_SUCCESS_WITH_INFO) ODBC_EXIT(stmt, SQL_NO_DATA); } ODBC_EXIT_(stmt); case TDS_CMD_FAIL: ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); case TDS_COMPUTE_RESULT: switch (stmt->row_status) { /* skip this recordset */ case IN_COMPUTE_ROW: /* TODO here we should set current_results to normal results */ in_row = 1; /* fall through */ /* in normal row, put in compute status */ case AFTER_COMPUTE_ROW: case IN_NORMAL_ROW: case PRE_NORMAL_ROW: stmt->row_status = IN_COMPUTE_ROW; odbc_populate_ird(stmt); ODBC_EXIT_(stmt); case NOT_IN_ROW: /* this should never happen, protocol error */ ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); break; } break; case TDS_ROW_RESULT: if (in_row || (stmt->row_status != IN_NORMAL_ROW && stmt->row_status != PRE_NORMAL_ROW)) { stmt->row_status = PRE_NORMAL_ROW; odbc_populate_ird(stmt); ODBC_EXIT_(stmt); } /* Skipping current result set's rows to access next resultset or proc's retval */ tdsret = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_STOPAT_COMPUTE); /* TODO should we set in_row ?? */ switch (tdsret) { case TDS_CANCELLED: odbc_errs_add(&stmt->errs, "HY008", NULL); default: if (TDS_FAILED(tdsret)) { ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); } } break; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: /* FIXME here ??? */ if (!in_row) tds_free_all_results(tds); switch (stmt->errs.lastrc) { case SQL_ERROR: param_status = SQL_PARAM_ERROR; break; case SQL_SUCCESS_WITH_INFO: param_status = SQL_PARAM_SUCCESS_WITH_INFO; break; } if (stmt->curr_param_row < stmt->num_param_rows) { if (stmt->ipd->header.sql_desc_array_status_ptr) stmt->ipd->header.sql_desc_array_status_ptr[stmt->curr_param_row] = param_status; ++stmt->curr_param_row; if (stmt->ipd->header.sql_desc_rows_processed_ptr) *stmt->ipd->header.sql_desc_rows_processed_ptr = stmt->curr_param_row; } if (stmt->curr_param_row < stmt->num_param_rows) { #if 0 if (stmt->errs.lastrc == SQL_SUCCESS_WITH_INFO) found_info = 1; if (stmt->errs.lastrc == SQL_ERROR) found_error = 1; #endif stmt->errs.lastrc = SQL_SUCCESS; param_status = SQL_PARAM_SUCCESS; break; } odbc_populate_ird(stmt); ODBC_EXIT_(stmt); break; /* * TODO test flags ? check error and change result ? * see also other DONEINPROC handle (below) */ case TDS_DONEINPROC_RESULT: if (in_row) { odbc_populate_ird(stmt); ODBC_EXIT_(stmt); } /* TODO perhaps it can be a problem if SET NOCOUNT ON, test it */ tds_free_all_results(tds); odbc_populate_ird(stmt); break; /* do not stop at metadata, an error can follow... */ case TDS_ROWFMT_RESULT: if (in_row) { odbc_populate_ird(stmt); ODBC_EXIT_(stmt); } stmt->row = 0; stmt->row_count = TDS_NO_COUNT; /* we expect a row */ stmt->row_status = PRE_NORMAL_ROW; in_row = 1; break; case TDS_MSG_RESULT: if (!in_row) { tds_free_all_results(tds); odbc_populate_ird(stmt); } in_row = 1; break; } } ODBC_EXIT(stmt, SQL_ERROR); } ODBC_FUNC(SQLNativeSql, (P(SQLHDBC,hdbc), PCHARIN(SqlStrIn,SQLINTEGER), PCHAROUT(SqlStr,SQLINTEGER) WIDE)) { SQLRETURN ret = SQL_SUCCESS; DSTR query = DSTR_INITIALIZER; ODBC_ENTER_HDBC; #ifdef TDS_NO_DM if (!szSqlStrIn || !IS_VALID_LEN(cbSqlStrIn)) { odbc_errs_add(&dbc->errs, "HY009", NULL); ODBC_EXIT_(dbc); } #endif if (!odbc_dstr_copy(dbc, &query, cbSqlStrIn, szSqlStrIn)) { odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } native_sql(dbc, &query); /* FIXME if error set some kind of error */ ret = odbc_set_dstr(dbc, szSqlStr, cbSqlStrMax, pcbSqlStr, &query); tds_dstr_free(&query); ODBC_EXIT(dbc, ret); } SQLRETURN ODBC_PUBLIC ODBC_API SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT FAR * pcpar) { ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLNumParams(%p, %p)\n", hstmt, pcpar); *pcpar = stmt->param_count; ODBC_EXIT_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN FAR * pirow) { SQLRETURN res; tdsdump_log(TDS_DBG_FUNC, "SQLParamOptions(%p, %lu, %p)\n", hstmt, (unsigned long int)crow, pirow); /* emulate for ODBC 2 DM */ res = _SQLSetStmtAttr(hstmt, SQL_ATTR_PARAMS_PROCESSED_PTR, pirow, 0 _wide0); if (res != SQL_SUCCESS) return res; return _SQLSetStmtAttr(hstmt, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER) (TDS_INTPTR) crow, 0 _wide0); } ODBC_FUNC(SQLPrimaryKeys, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(TableName,SQLSMALLINT) WIDE)) { int retcode; ODBC_ENTER_HSTMT; retcode = odbc_stat_execute(stmt _wide, "sp_pkeys", 3, "O@table_qualifier", szCatalogName, cbCatalogName, "O@table_owner", szSchemaName, cbSchemaName, "O@table_name", szTableName, cbTableName); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "TABLE_CAT"); odbc_col_setname(stmt, 2, "TABLE_SCHEM"); } ODBC_EXIT_(stmt); } ODBC_FUNC(SQLProcedureColumns, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(ProcName,SQLSMALLINT), PCHARIN(ColumnName,SQLSMALLINT) WIDE)) { int retcode; ODBC_ENTER_HSTMT; retcode = odbc_stat_execute(stmt _wide, "sp_sproc_columns", TDS_IS_MSSQL(stmt->dbc->tds_socket) ? 5 : 4, "O@procedure_qualifier", szCatalogName, cbCatalogName, "P@procedure_owner", szSchemaName, cbSchemaName, "P@procedure_name", szProcName, cbProcName, "P@column_name", szColumnName, cbColumnName, "V@ODBCVer", (char*) NULL, 0); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "PROCEDURE_CAT"); odbc_col_setname(stmt, 2, "PROCEDURE_SCHEM"); odbc_col_setname(stmt, 8, "COLUMN_SIZE"); odbc_col_setname(stmt, 9, "BUFFER_LENGTH"); odbc_col_setname(stmt, 10, "DECIMAL_DIGITS"); odbc_col_setname(stmt, 11, "NUM_PREC_RADIX"); if (TDS_IS_SYBASE(stmt->dbc->tds_socket)) stmt->special_row = ODBC_SPECIAL_PROCEDURECOLUMNS; } ODBC_EXIT_(stmt); } ODBC_FUNC(SQLProcedures, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(ProcName,SQLSMALLINT) WIDE)) { int retcode; ODBC_ENTER_HSTMT; retcode = odbc_stat_execute(stmt _wide, "..sp_stored_procedures", 3, "P@sp_name", szProcName, cbProcName, "P@sp_owner", szSchemaName, cbSchemaName, "O@sp_qualifier", szCatalogName, cbCatalogName); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "PROCEDURE_CAT"); odbc_col_setname(stmt, 2, "PROCEDURE_SCHEM"); } ODBC_EXIT_(stmt); } static TDSPARAMINFO* odbc_build_update_params(TDS_STMT * stmt, unsigned int n_row) { unsigned int n; TDSPARAMINFO * params = NULL; struct _drecord *drec_ird; for (n = 0; n < stmt->ird->header.sql_desc_count && n < stmt->ard->header.sql_desc_count; ++n) { TDSPARAMINFO *temp_params; TDSCOLUMN *curcol; drec_ird = &stmt->ird->records[n]; if (drec_ird->sql_desc_updatable == SQL_FALSE) continue; /* we have certainly a parameter */ if (!(temp_params = tds_alloc_param_result(params))) goto memory_error; params = temp_params; curcol = params->columns[params->num_cols - 1]; if (!tds_dstr_dup(&curcol->column_name, &drec_ird->sql_desc_name)) goto memory_error; /* TODO use all infos... */ if (!tds_dstr_dup(&curcol->table_name, &drec_ird->sql_desc_base_table_name)) goto memory_error; switch (odbc_sql2tds(stmt, drec_ird, &stmt->ard->records[n], curcol, true, stmt->ard, n_row)) { case SQL_NEED_DATA: goto memory_error; case SQL_ERROR: tds_free_param_results(params); return NULL; } } return params; memory_error: tds_free_param_results(params); odbc_errs_add(&stmt->errs, "HY001", NULL); return NULL; } SQLRETURN ODBC_PUBLIC ODBC_API SQLSetPos(SQLHSTMT hstmt, SQLSETPOSIROW irow, SQLUSMALLINT fOption, SQLUSMALLINT fLock) { TDSRET ret; TDSSOCKET *tds; TDS_CURSOR_OPERATION op; TDSPARAMINFO *params = NULL; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLSetPos(%p, %ld, %d, %d)\n", hstmt, (long) irow, fOption, fLock); if (!stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "HYC00", "SQLSetPos: function not implemented"); ODBC_EXIT_(stmt); } /* TODO handle irow == 0 (all rows) */ if (!stmt->cursor) { odbc_errs_add(&stmt->errs, "HY109", NULL); ODBC_EXIT_(stmt); } switch (fOption) { case SQL_POSITION: op = TDS_CURSOR_POSITION; break; /* TODO cursor support */ case SQL_REFRESH: default: odbc_errs_add(&stmt->errs, "HY092", NULL); ODBC_EXIT_(stmt); break; case SQL_UPDATE: op = TDS_CURSOR_UPDATE; /* prepare paremeters for update */ /* scan all columns and build parameter list */ params = odbc_build_update_params(stmt, irow >= 1 ? irow - 1 : 0); if (!params) { ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); } break; case SQL_DELETE: op = TDS_CURSOR_DELETE; break; case SQL_ADD: op = TDS_CURSOR_INSERT; break; } if (!odbc_lock_statement(stmt)) { tds_free_param_results(params); ODBC_EXIT_(stmt); } tds = stmt->tds; if (TDS_FAILED(tds_cursor_update(tds, stmt->cursor, op, irow, params))) { tds_free_param_results(params); ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); } tds_free_param_results(params); params = NULL; ret = tds_process_simple_query(tds); odbc_unlock_statement(stmt); if (TDS_FAILED(ret)) { ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); } ODBC_EXIT_(stmt); } ODBC_FUNC(SQLTablePrivileges, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(TableName,SQLSMALLINT) WIDE)) { int retcode; ODBC_ENTER_HSTMT; retcode = odbc_stat_execute(stmt _wide, "sp_table_privileges", 3, "O@table_qualifier", szCatalogName, cbCatalogName, "P@table_owner", szSchemaName, cbSchemaName, "P@table_name", szTableName, cbTableName); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "TABLE_CAT"); odbc_col_setname(stmt, 2, "TABLE_SCHEM"); } ODBC_EXIT_(stmt); } #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLSetEnvAttr(SQLHENV henv, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { SQLINTEGER i_val = (SQLINTEGER) (TDS_INTPTR) Value; ODBC_ENTER_HENV; tdsdump_log(TDS_DBG_FUNC, "SQLSetEnvAttr(%p, %d, %p, %d)\n", henv, (int)Attribute, Value, (int)StringLength); switch (Attribute) { case SQL_ATTR_CONNECTION_POOLING: case SQL_ATTR_CP_MATCH: odbc_errs_add(&env->errs, "HYC00", NULL); break; case SQL_ATTR_ODBC_VERSION: switch (i_val) { case SQL_OV_ODBC3: case SQL_OV_ODBC2: env->attr.odbc_version = i_val; break; default: odbc_errs_add(&env->errs, "HY024", NULL); break; } break; case SQL_ATTR_OUTPUT_NTS: /* TODO - Make this really work */ /* env->attr.output_nts = i_val; */ env->attr.output_nts = SQL_TRUE; break; default: odbc_errs_add(&env->errs, "HY092", NULL); break; } ODBC_EXIT_(env); } SQLRETURN ODBC_PUBLIC ODBC_API SQLGetEnvAttr(SQLHENV henv, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength) { size_t size; void *src; ODBC_ENTER_HENV; tdsdump_log(TDS_DBG_FUNC, "SQLGetEnvAttr(%p, %d, %p, %d, %p)\n", henv, (int)Attribute, Value, (int)BufferLength, StringLength); switch (Attribute) { case SQL_ATTR_CONNECTION_POOLING: src = &env->attr.connection_pooling; size = sizeof(env->attr.connection_pooling); break; case SQL_ATTR_CP_MATCH: src = &env->attr.cp_match; size = sizeof(env->attr.cp_match); break; case SQL_ATTR_ODBC_VERSION: src = &env->attr.odbc_version; size = sizeof(env->attr.odbc_version); break; case SQL_ATTR_OUTPUT_NTS: /* TODO handle output_nts flags */ env->attr.output_nts = SQL_TRUE; src = &env->attr.output_nts; size = sizeof(env->attr.output_nts); break; default: odbc_errs_add(&env->errs, "HY092", NULL); ODBC_EXIT_(env); break; } if (StringLength) { *StringLength = size; } memcpy(Value, src, size); ODBC_EXIT_(env); } #endif #define IRD_UPDATE(desc, errs, exit) \ do { \ if (desc->type == DESC_IRD && ((TDS_STMT*)desc->parent)->need_reprepare && \ odbc_update_ird((TDS_STMT*)desc->parent, errs) != SQL_SUCCESS) \ exit; \ } while(0) static SQLRETURN _SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef, SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax, SQLLEN FAR * pcbValue) { TDS_DESC *apd, *ipd; struct _drecord *drec; SQLSMALLINT orig_apd_size, orig_ipd_size; int is_numeric = 0; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "_SQLBindParameter(%p, %u, %d, %d, %d, %u, %d, %p, %d, %p)\n", hstmt, (unsigned short)ipar, (int)fParamType, (int)fCType, (int)fSqlType, (unsigned int)cbColDef, (int)ibScale, rgbValue, (int)cbValueMax, pcbValue); #ifdef TDS_NO_DM /* TODO - more error checking ... XXX smurph */ /* Check param type */ switch (fParamType) { case SQL_PARAM_INPUT: case SQL_PARAM_INPUT_OUTPUT: case SQL_PARAM_OUTPUT: break; default: odbc_errs_add(&stmt->errs, "HY105", NULL); ODBC_EXIT_(stmt); } /* Check max buffer length */ if (cbValueMax < 0) { odbc_errs_add(&stmt->errs, "HY090", NULL); ODBC_EXIT_(stmt); } #endif /* check cbColDef and ibScale */ if (fSqlType == SQL_DECIMAL || fSqlType == SQL_NUMERIC) { is_numeric = 1; if (cbColDef < 1 || cbColDef > 38) { odbc_errs_add(&stmt->errs, "HY104", "Invalid precision value"); ODBC_EXIT_(stmt); } if (ibScale < 0 || ibScale > cbColDef) { odbc_errs_add(&stmt->errs, "HY104", "Invalid scale value"); ODBC_EXIT_(stmt); } } /* Check parameter number */ if (ipar <= 0 || ipar > 4000) { odbc_errs_add(&stmt->errs, "07009", NULL); ODBC_EXIT_(stmt); } /* fill APD related fields */ apd = stmt->apd; orig_apd_size = apd->header.sql_desc_count; if (ipar > apd->header.sql_desc_count && desc_alloc_records(apd, ipar) != SQL_SUCCESS) { odbc_errs_add(&stmt->errs, "HY001", NULL); ODBC_EXIT_(stmt); } drec = &apd->records[ipar - 1]; if (odbc_set_concise_c_type(fCType, drec, 0) != SQL_SUCCESS) { desc_alloc_records(apd, orig_apd_size); odbc_errs_add(&stmt->errs, "HY004", NULL); ODBC_EXIT_(stmt); } stmt->need_reprepare = 1; /* TODO other types ?? handle SQL_C_DEFAULT */ if (drec->sql_desc_type == SQL_C_CHAR || drec->sql_desc_type == SQL_C_WCHAR || drec->sql_desc_type == SQL_C_BINARY) drec->sql_desc_octet_length = cbValueMax; drec->sql_desc_indicator_ptr = pcbValue; drec->sql_desc_octet_length_ptr = pcbValue; drec->sql_desc_data_ptr = (char *) rgbValue; /* field IPD related fields */ ipd = stmt->ipd; orig_ipd_size = ipd->header.sql_desc_count; if (ipar > ipd->header.sql_desc_count && desc_alloc_records(ipd, ipar) != SQL_SUCCESS) { desc_alloc_records(apd, orig_apd_size); odbc_errs_add(&stmt->errs, "HY001", NULL); ODBC_EXIT_(stmt); } drec = &ipd->records[ipar - 1]; drec->sql_desc_parameter_type = fParamType; if (odbc_set_concise_sql_type(fSqlType, drec, 0) != SQL_SUCCESS) { desc_alloc_records(ipd, orig_ipd_size); desc_alloc_records(apd, orig_apd_size); odbc_errs_add(&stmt->errs, "HY004", NULL); ODBC_EXIT_(stmt); } if (is_numeric) { drec->sql_desc_precision = cbColDef; drec->sql_desc_scale = ibScale; } else { drec->sql_desc_length = cbColDef; } ODBC_EXIT_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLBindParameter(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fParamType, SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef, SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN cbValueMax, SQLLEN FAR * pcbValue) { tdsdump_log(TDS_DBG_FUNC, "SQLBindParameter(%p, %u, %d, %d, %d, %u, %d, %p, %d, %p)\n", hstmt, (unsigned)ipar, fParamType, fCType, (int)fSqlType, (unsigned)cbColDef, ibScale, rgbValue, (int)cbValueMax, pcbValue); return _SQLBindParameter(hstmt, ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, cbValueMax, pcbValue); } /* compatibility with X/Open */ SQLRETURN ODBC_PUBLIC ODBC_API SQLBindParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbColDef, SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN FAR * pcbValue) { tdsdump_log(TDS_DBG_FUNC, "SQLBindParam(%p, %d, %d, %d, %u, %d, %p, %p)\n", hstmt, ipar, fCType, fSqlType, (unsigned)cbColDef, ibScale, rgbValue, pcbValue); return _SQLBindParameter(hstmt, ipar, SQL_PARAM_INPUT, fCType, fSqlType, cbColDef, ibScale, rgbValue, 0, pcbValue); } #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE * OutputHandle) { tdsdump_log(TDS_DBG_FUNC, "SQLAllocHandle(%d, %p, %p)\n", HandleType, InputHandle, OutputHandle); switch (HandleType) { case SQL_HANDLE_STMT: return _SQLAllocStmt(InputHandle, OutputHandle); break; case SQL_HANDLE_DBC: return _SQLAllocConnect(InputHandle, OutputHandle); break; case SQL_HANDLE_ENV: return _SQLAllocEnv(OutputHandle, SQL_OV_ODBC3); break; case SQL_HANDLE_DESC: return _SQLAllocDesc(InputHandle, OutputHandle); break; } /* * As the documentation puts it, * "There is no handle with which to associate additional diagnostic information." * * The DM must catch HY092 because the driver has no valid handle at this early stage in which * to store the error for later retrieval by the application. */ tdsdump_log(TDS_DBG_FUNC, "SQLAllocHandle(): invalid HandleType, error HY092: should be caught by DM\n"); return SQL_ERROR; } #endif static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc) { TDS_DBC *dbc; ODBC_ENTER_HENV; tdsdump_log(TDS_DBG_FUNC, "_SQLAllocConnect(%p, %p)\n", henv, phdbc); dbc = tds_new0(TDS_DBC, 1); if (!dbc) { odbc_errs_add(&env->errs, "HY001", NULL); ODBC_EXIT_(env); } dbc->htype = SQL_HANDLE_DBC; dbc->env = env; tds_dstr_init(&dbc->dsn); dbc->attr.cursor_type = SQL_CURSOR_FORWARD_ONLY; dbc->attr.access_mode = SQL_MODE_READ_WRITE; dbc->attr.async_enable = SQL_ASYNC_ENABLE_OFF; dbc->attr.auto_ipd = SQL_FALSE; /* * spinellia@acm.org * after login is enabled autocommit */ dbc->attr.autocommit = SQL_AUTOCOMMIT_ON; dbc->attr.connection_dead = SQL_CD_TRUE; /* No connection yet */ dbc->attr.connection_timeout = 0; /* This is set in the environment change function */ tds_dstr_init(&dbc->attr.current_catalog); dbc->attr.login_timeout = 0; /* TODO */ dbc->attr.metadata_id = SQL_FALSE; dbc->attr.odbc_cursors = SQL_CUR_USE_IF_NEEDED; dbc->attr.packet_size = 0; dbc->attr.quite_mode = NULL; /* We don't support GUI dialogs yet */ #ifdef TDS_NO_DM dbc->attr.trace = SQL_OPT_TRACE_OFF; tds_dstr_init(&dbc->attr.tracefile); #endif tds_dstr_init(&dbc->attr.translate_lib); #ifdef ENABLE_ODBC_WIDE dbc->original_charset_num = TDS_CHARSET_UTF_8; #endif tds_dstr_init(&dbc->oldpwd); dbc->attr.translate_option = 0; dbc->attr.txn_isolation = SQL_TXN_READ_COMMITTED; dbc->attr.mars_enabled = SQL_MARS_ENABLED_NO; dbc->attr.bulk_enabled = SQL_BCP_OFF; tds_mutex_init(&dbc->mtx); *phdbc = (SQLHDBC) dbc; ODBC_EXIT_(env); } SQLRETURN ODBC_PUBLIC ODBC_API SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc) { tdsdump_log(TDS_DBG_FUNC, "SQLAllocConnect(%p, %p)\n", henv, phdbc); return _SQLAllocConnect(henv, phdbc); } static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv, SQLINTEGER odbc_version) { TDS_ENV *env; TDSCONTEXT *ctx; tdsdump_log(TDS_DBG_FUNC, "_SQLAllocEnv(%p, %d)\n", phenv, (int) odbc_version); env = tds_new0(TDS_ENV, 1); if (!env) return SQL_ERROR; env->htype = SQL_HANDLE_ENV; env->attr.odbc_version = odbc_version; /* TODO use it */ env->attr.output_nts = SQL_TRUE; ctx = tds_alloc_context(env); if (!ctx) { free(env); return SQL_ERROR; } env->tds_ctx = ctx; ctx->msg_handler = odbc_errmsg_handler; ctx->err_handler = odbc_errmsg_handler; /* ODBC has its own format */ free(ctx->locale->date_fmt); ctx->locale->date_fmt = strdup("%Y-%m-%d %H:%M:%S.%z"); tds_mutex_init(&env->mtx); *phenv = (SQLHENV) env; return SQL_SUCCESS; } SQLRETURN ODBC_PUBLIC ODBC_API SQLAllocEnv(SQLHENV FAR * phenv) { tdsdump_log(TDS_DBG_FUNC, "SQLAllocEnv(%p)\n", phenv); return _SQLAllocEnv(phenv, SQL_OV_ODBC2); } static SQLRETURN _SQLAllocDesc(SQLHDBC hdbc, SQLHDESC FAR * phdesc) { int i; ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "_SQLAllocDesc(%p, %p)\n", hdbc, phdesc); for (i = 0; ; ++i) { if (i >= TDS_MAX_APP_DESC) { odbc_errs_add(&dbc->errs, "HY014", NULL); break; } if (dbc->uad[i] == NULL) { TDS_DESC *desc = desc_alloc(dbc, DESC_ARD, SQL_DESC_ALLOC_USER); if (desc == NULL) { odbc_errs_add(&dbc->errs, "HY001", NULL); break; } dbc->uad[i] = desc; *phdesc = (SQLHDESC) desc; break; } } ODBC_EXIT_(dbc); } static SQLRETURN _SQLAllocStmt(SQLHDBC hdbc, SQLHSTMT FAR * phstmt) { TDS_STMT *stmt; char *pstr; ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "_SQLAllocStmt(%p, %p)\n", hdbc, phstmt); stmt = tds_new0(TDS_STMT, 1); if (!stmt) { odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } tds_dstr_init(&stmt->cursor_name); tds_dstr_init(&stmt->query); stmt->htype = SQL_HANDLE_STMT; stmt->dbc = dbc; stmt->num_param_rows = 1; pstr = NULL; /* TODO test initial cursor ... */ if (asprintf(&pstr, "SQL_CUR%lx", (unsigned long) stmt) < 0 || !tds_dstr_set(&stmt->cursor_name, pstr)) { free(stmt); free(pstr); odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } /* do not free pstr tds_dstr_set do it if necessary */ /* allocate descriptors */ stmt->ird = desc_alloc(stmt, DESC_IRD, SQL_DESC_ALLOC_AUTO); stmt->ard = desc_alloc(stmt, DESC_ARD, SQL_DESC_ALLOC_AUTO); stmt->ipd = desc_alloc(stmt, DESC_IPD, SQL_DESC_ALLOC_AUTO); stmt->apd = desc_alloc(stmt, DESC_APD, SQL_DESC_ALLOC_AUTO); if (!stmt->ird || !stmt->ard || !stmt->ipd || !stmt->apd) { tds_dstr_free(&stmt->cursor_name); desc_free(stmt->ird); desc_free(stmt->ard); desc_free(stmt->ipd); desc_free(stmt->apd); free(stmt); odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } /* save original ARD and APD */ stmt->orig_apd = stmt->apd; stmt->orig_ard = stmt->ard; /* set the default statement attributes */ /* stmt->attr.app_param_desc = stmt->apd; */ /* stmt->attr.app_row_desc = stmt->ard; */ stmt->attr.async_enable = SQL_ASYNC_ENABLE_OFF; stmt->attr.concurrency = SQL_CONCUR_READ_ONLY; stmt->attr.cursor_scrollable = SQL_NONSCROLLABLE; stmt->attr.cursor_sensitivity = SQL_INSENSITIVE; stmt->attr.cursor_type = SQL_CURSOR_FORWARD_ONLY; /* TODO ?? why two attributes */ stmt->attr.enable_auto_ipd = dbc->attr.auto_ipd = SQL_FALSE; stmt->attr.fetch_bookmark_ptr = NULL; /* stmt->attr.imp_param_desc = stmt->ipd; */ /* stmt->attr.imp_row_desc = stmt->ird; */ stmt->attr.keyset_size = 0; stmt->attr.max_length = 0; stmt->attr.max_rows = 0; stmt->attr.metadata_id = dbc->attr.metadata_id; /* TODO check this flag in prepare_call */ stmt->attr.noscan = SQL_NOSCAN_OFF; assert(stmt->apd->header.sql_desc_bind_offset_ptr == NULL); assert(stmt->apd->header.sql_desc_bind_type == SQL_PARAM_BIND_BY_COLUMN); assert(stmt->apd->header.sql_desc_array_status_ptr == NULL); assert(stmt->ipd->header.sql_desc_array_status_ptr == NULL); assert(stmt->ipd->header.sql_desc_rows_processed_ptr == NULL); assert(stmt->apd->header.sql_desc_array_size == 1); stmt->attr.query_timeout = DEFAULT_QUERY_TIMEOUT; stmt->attr.retrieve_data = SQL_RD_ON; assert(stmt->ard->header.sql_desc_array_size == 1); assert(stmt->ard->header.sql_desc_bind_offset_ptr == NULL); assert(stmt->ard->header.sql_desc_bind_type == SQL_BIND_BY_COLUMN); stmt->attr.row_number = 0; assert(stmt->ard->header.sql_desc_array_status_ptr == NULL); assert(stmt->ird->header.sql_desc_array_status_ptr == NULL); assert(stmt->ird->header.sql_desc_rows_processed_ptr == NULL); stmt->attr.simulate_cursor = SQL_SC_NON_UNIQUE; stmt->attr.use_bookmarks = SQL_UB_OFF; tds_dstr_init(&stmt->attr.qn_msgtext); tds_dstr_init(&stmt->attr.qn_options); stmt->attr.qn_timeout = 432000; stmt->sql_rowset_size = 1; stmt->row_count = TDS_NO_COUNT; stmt->row_status = NOT_IN_ROW; /* insert into list */ stmt->next = dbc->stmt_list; if (dbc->stmt_list) dbc->stmt_list->prev = stmt; dbc->stmt_list = stmt; tds_mutex_init(&stmt->mtx); *phstmt = (SQLHSTMT) stmt; if (dbc->attr.cursor_type != SQL_CURSOR_FORWARD_ONLY) _SQLSetStmtAttr(stmt, SQL_CURSOR_TYPE, (SQLPOINTER) (TDS_INTPTR) dbc->attr.cursor_type, SQL_IS_INTEGER _wide0); ODBC_EXIT_(dbc); } SQLRETURN ODBC_PUBLIC ODBC_API SQLAllocStmt(SQLHDBC hdbc, SQLHSTMT FAR * phstmt) { tdsdump_log(TDS_DBG_FUNC, "SQLAllocStmt(%p, %p)\n", hdbc, phstmt); return _SQLAllocStmt(hdbc, phstmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLBindCol(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgbValue, SQLLEN cbValueMax, SQLLEN FAR * pcbValue) { TDS_DESC *ard; struct _drecord *drec; SQLSMALLINT orig_ard_size; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLBindCol(%p, %d, %d, %p, %d, %p)\n", hstmt, icol, fCType, rgbValue, (int)cbValueMax, pcbValue); /* TODO - More error checking XXX smurph */ #ifdef TDS_NO_DM /* check conversion type */ switch (fCType) { case SQL_C_CHAR: case SQL_C_WCHAR: case SQL_C_BINARY: case SQL_C_DEFAULT: /* check max buffer length */ if (!IS_VALID_LEN(cbValueMax)) { odbc_errs_add(&stmt->errs, "HY090", NULL); ODBC_EXIT_(stmt); } break; } #endif if (icol <= 0 || icol > 4000) { odbc_errs_add(&stmt->errs, "07009", NULL); ODBC_EXIT_(stmt); } ard = stmt->ard; orig_ard_size = ard->header.sql_desc_count; if (icol > ard->header.sql_desc_count && desc_alloc_records(ard, icol) != SQL_SUCCESS) { odbc_errs_add(&stmt->errs, "HY001", NULL); ODBC_EXIT_(stmt); } drec = &ard->records[icol - 1]; if (odbc_set_concise_c_type(fCType, drec, 0) != SQL_SUCCESS) { desc_alloc_records(ard, orig_ard_size); odbc_errs_add(&stmt->errs, "HY003", NULL); ODBC_EXIT_(stmt); } drec->sql_desc_octet_length = cbValueMax; drec->sql_desc_octet_length_ptr = pcbValue; drec->sql_desc_indicator_ptr = pcbValue; drec->sql_desc_data_ptr = rgbValue; /* force rebind */ stmt->row = 0; ODBC_EXIT_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLCancel(SQLHSTMT hstmt) { TDSSOCKET *tds; /* * FIXME this function can be called from other thread, do not free * errors for this function * If function is called from another thread errors are not touched */ /* TODO some tests required */ TDS_STMT *stmt = (TDS_STMT*)hstmt; if (SQL_NULL_HSTMT == hstmt || !IS_HSTMT(hstmt)) return SQL_INVALID_HANDLE; tdsdump_log(TDS_DBG_FUNC, "SQLCancel(%p)\n", hstmt); tds = stmt->tds; /* cancelling an inactive statement ?? */ if (!tds) { ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); } if (tds_mutex_trylock(&stmt->mtx) == 0) { CHECK_STMT_EXTRA(stmt); odbc_errs_reset(&stmt->errs); /* FIXME test current statement */ /* FIXME here we are unlocked */ if (TDS_FAILED(tds_send_cancel(tds))) { ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); } if (TDS_FAILED(tds_process_cancel(tds))) { ODBC_SAFE_ERROR(stmt); ODBC_EXIT_(stmt); } /* only if we processed cancel reset statement */ if (tds->state == TDS_IDLE) odbc_unlock_statement(stmt); ODBC_EXIT_(stmt); } /* don't access error here, just return error */ if (TDS_FAILED(tds_send_cancel(tds))) return SQL_ERROR; return SQL_SUCCESS; } ODBC_FUNC(SQLConnect, (P(SQLHDBC,hdbc), PCHARIN(DSN,SQLSMALLINT), PCHARIN(UID,SQLSMALLINT), PCHARIN(AuthStr,SQLSMALLINT) WIDE)) { TDSLOGIN *login; DSTR *s; ODBC_ENTER_HDBC; #ifdef TDS_NO_DM if (szDSN && !IS_VALID_LEN(cbDSN)) { odbc_errs_add(&dbc->errs, "HY090", "Invalid DSN buffer length"); ODBC_EXIT_(dbc); } if (szUID && !IS_VALID_LEN(cbUID)) { odbc_errs_add(&dbc->errs, "HY090", "Invalid UID buffer length"); ODBC_EXIT_(dbc); } if (szAuthStr && !IS_VALID_LEN(cbAuthStr)) { odbc_errs_add(&dbc->errs, "HY090", "Invalid PWD buffer length"); ODBC_EXIT_(dbc); } #endif login = tds_alloc_login(0); if (!login || !tds_init_login(login, dbc->env->tds_ctx->locale)) goto memory_error; /* data source name */ if (odbc_get_string_size(cbDSN, szDSN _wide)) s = odbc_dstr_copy(dbc, &dbc->dsn, cbDSN, szDSN); else s = tds_dstr_copy(&dbc->dsn, "DEFAULT"); if (!s) goto memory_error; if (!odbc_get_dsn_info(&dbc->errs, tds_dstr_cstr(&dbc->dsn), login)) { tds_free_login(login); ODBC_EXIT_(dbc); } if (!tds_dstr_isempty(&dbc->attr.current_catalog)) if (!tds_dstr_dup(&login->database, &dbc->attr.current_catalog)) goto memory_error; /* * username/password are never saved to ini file, * so you do not check in ini file */ /* user id */ if (odbc_get_string_size(cbUID, szUID _wide)) { if (!odbc_dstr_copy(dbc, &login->user_name, cbUID, szUID)) goto memory_error; } /* password */ if (szAuthStr && !tds_dstr_isempty(&login->user_name)) { if (!odbc_dstr_copy(dbc, &login->password, cbAuthStr, szAuthStr)) goto memory_error; } /* DO IT */ odbc_connect(dbc, login); tds_free_login(login); ODBC_EXIT_(dbc); memory_error: tds_free_login(login); odbc_errs_add(&dbc->errs, "HY001", NULL); ODBC_EXIT_(dbc); } ODBC_FUNC(SQLDescribeCol, (P(SQLHSTMT,hstmt), P(SQLUSMALLINT,icol), PCHAROUT(ColName,SQLSMALLINT), P(SQLSMALLINT FAR *,pfSqlType), P(SQLULEN FAR *,pcbColDef), P(SQLSMALLINT FAR *,pibScale), P(SQLSMALLINT FAR *,pfNullable) WIDE)) { TDS_DESC *ird; struct _drecord *drec; SQLRETURN result; ODBC_ENTER_HSTMT; ird = stmt->ird; IRD_UPDATE(ird, &stmt->errs, ODBC_EXIT(stmt, SQL_ERROR)); if (icol <= 0 || icol > ird->header.sql_desc_count) { odbc_errs_add(&stmt->errs, "07009", "Column out of range"); ODBC_EXIT_(stmt); } /* check name length */ if (cbColNameMax < 0) { odbc_errs_add(&stmt->errs, "HY090", NULL); ODBC_EXIT_(stmt); } drec = &ird->records[icol - 1]; /* cbColNameMax can be 0 (to retrieve name length) */ if (szColName == NULL) cbColNameMax = 0; /* straight copy column name up to cbColNameMax */ result = odbc_set_dstr(stmt->dbc, szColName, cbColNameMax, pcbColName, &drec->sql_desc_label); if (szColName && result == SQL_SUCCESS_WITH_INFO) odbc_errs_add(&stmt->errs, "01004", NULL); if (pfSqlType) { /* TODO sure ? check documentation for date and intervals */ *pfSqlType = drec->sql_desc_concise_type; } if (pcbColDef) { if (drec->sql_desc_type == SQL_NUMERIC || drec->sql_desc_type == SQL_DECIMAL) { *pcbColDef = drec->sql_desc_precision; } else { *pcbColDef = drec->sql_desc_length; } } if (pibScale) { *pibScale = drec->sql_desc_scale; } if (pfNullable) { *pfNullable = drec->sql_desc_nullable; } ODBC_EXIT_(stmt); } static SQLRETURN _SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, SQLLEN FAR * pfDesc _WIDE) { TDS_DESC *ird; struct _drecord *drec; SQLRETURN result = SQL_SUCCESS; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "_SQLColAttribute(%p, %u, %u, %p, %d, %p, %p)\n", hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); ird = stmt->ird; #define COUT(src) result = odbc_set_string_oct(stmt->dbc, rgbDesc, cbDescMax, pcbDesc, src ? src : "", -1); #define SOUT(src) result = odbc_set_dstr_oct(stmt->dbc, rgbDesc, cbDescMax, pcbDesc, &src); /* SQLColAttribute returns always attributes using SQLINTEGER */ #if ENABLE_EXTRA_CHECKS #define IOUT(type, src) do { \ /* trick warning if type wrong */ \ type *p_test = &src; p_test = p_test; \ *pfDesc = src; } while(0) #else #define IOUT(type, src) *pfDesc = src #endif IRD_UPDATE(ird, &stmt->errs, ODBC_EXIT(stmt, SQL_ERROR)); /* dont check column index for these */ switch (fDescType) { #if SQL_COLUMN_COUNT != SQL_DESC_COUNT case SQL_COLUMN_COUNT: #endif case SQL_DESC_COUNT: IOUT(SQLSMALLINT, ird->header.sql_desc_count); ODBC_EXIT(stmt, SQL_SUCCESS); break; } if (!ird->header.sql_desc_count) { odbc_errs_add(&stmt->errs, "07005", NULL); ODBC_EXIT_(stmt); } if (icol <= 0 || icol > ird->header.sql_desc_count) { odbc_errs_add(&stmt->errs, "07009", "Column out of range"); ODBC_EXIT_(stmt); } drec = &ird->records[icol - 1]; tdsdump_log(TDS_DBG_INFO1, "SQLColAttribute: fDescType is %d\n", fDescType); switch (fDescType) { case SQL_DESC_AUTO_UNIQUE_VALUE: IOUT(SQLUINTEGER, drec->sql_desc_auto_unique_value); break; case SQL_DESC_BASE_COLUMN_NAME: SOUT(drec->sql_desc_base_column_name); break; case SQL_DESC_BASE_TABLE_NAME: SOUT(drec->sql_desc_base_table_name); break; case SQL_DESC_CASE_SENSITIVE: IOUT(SQLINTEGER, drec->sql_desc_case_sensitive); break; case SQL_DESC_CATALOG_NAME: SOUT(drec->sql_desc_catalog_name); break; #if SQL_COLUMN_TYPE != SQL_DESC_CONCISE_TYPE case SQL_COLUMN_TYPE: #endif case SQL_DESC_CONCISE_TYPE: /* special case, get ODBC 2 type, not ODBC 3 SQL_DESC_CONCISE_TYPE (different for datetime) */ if (stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { IOUT(SQLSMALLINT, drec->sql_desc_concise_type); break; } /* get type and convert it to ODBC 2 type */ { SQLSMALLINT type = drec->sql_desc_concise_type; switch (type) { case SQL_TYPE_DATE: type = SQL_DATE; break; case SQL_TYPE_TIME: type = SQL_TIME; break; case SQL_TYPE_TIMESTAMP: type = SQL_TIMESTAMP; break; } IOUT(SQLSMALLINT, type); } break; case SQL_DESC_DISPLAY_SIZE: IOUT(SQLLEN, drec->sql_desc_display_size); break; case SQL_DESC_FIXED_PREC_SCALE: IOUT(SQLSMALLINT, drec->sql_desc_fixed_prec_scale); break; case SQL_DESC_LABEL: SOUT(drec->sql_desc_label); break; /* FIXME special cases for SQL_COLUMN_LENGTH */ case SQL_COLUMN_LENGTH: IOUT(SQLLEN, drec->sql_desc_octet_length); break; case SQL_DESC_LENGTH: IOUT(SQLULEN, drec->sql_desc_length); break; case SQL_DESC_LITERAL_PREFIX: COUT(drec->sql_desc_literal_prefix); break; case SQL_DESC_LITERAL_SUFFIX: COUT(drec->sql_desc_literal_suffix); break; case SQL_DESC_LOCAL_TYPE_NAME: SOUT(drec->sql_desc_local_type_name); break; #if SQL_COLUMN_NAME != SQL_DESC_NAME case SQL_COLUMN_NAME: #endif case SQL_DESC_NAME: SOUT(drec->sql_desc_name); break; #if SQL_COLUMN_NULLABLE != SQL_DESC_NULLABLE case SQL_COLUMN_NULLABLE: #endif case SQL_DESC_NULLABLE: IOUT(SQLSMALLINT, drec->sql_desc_nullable); break; case SQL_DESC_NUM_PREC_RADIX: IOUT(SQLINTEGER, drec->sql_desc_num_prec_radix); break; case SQL_DESC_OCTET_LENGTH: IOUT(SQLLEN, drec->sql_desc_octet_length); break; /* FIXME special cases for SQL_COLUMN_PRECISION */ case SQL_COLUMN_PRECISION: if (drec->sql_desc_concise_type == SQL_REAL) { *pfDesc = 7; break; } if (drec->sql_desc_concise_type == SQL_DOUBLE) { *pfDesc = 15; break; } if (drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP || drec->sql_desc_concise_type == SQL_TIMESTAMP) { *pfDesc = drec->sql_desc_precision ? 23 : 16; break; } case SQL_DESC_PRECISION: /* this section may be wrong */ if (drec->sql_desc_concise_type == SQL_NUMERIC || drec->sql_desc_concise_type == SQL_DECIMAL || drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP || drec->sql_desc_concise_type == SQL_TYPE_DATE || drec->sql_desc_concise_type == SQL_TYPE_TIME || drec->sql_desc_concise_type == SQL_TIMESTAMP || drec->sql_desc_concise_type == SQL_SS_TIME2 || drec->sql_desc_concise_type == SQL_SS_TIMESTAMPOFFSET) IOUT(SQLSMALLINT, drec->sql_desc_precision); else *pfDesc = drec->sql_desc_length; break; /* FIXME special cases for SQL_COLUMN_SCALE */ case SQL_COLUMN_SCALE: case SQL_DESC_SCALE: /* this section may be wrong */ if (drec->sql_desc_concise_type == SQL_NUMERIC || drec->sql_desc_concise_type == SQL_DECIMAL || drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP || drec->sql_desc_concise_type == SQL_TYPE_DATE || drec->sql_desc_concise_type == SQL_TYPE_TIME || drec->sql_desc_concise_type == SQL_TIMESTAMP || drec->sql_desc_concise_type == SQL_FLOAT || drec->sql_desc_concise_type == SQL_SS_TIME2 || drec->sql_desc_concise_type == SQL_SS_TIMESTAMPOFFSET) IOUT(SQLSMALLINT, drec->sql_desc_scale); else *pfDesc = 0; break; case SQL_DESC_SCHEMA_NAME: SOUT(drec->sql_desc_schema_name); break; case SQL_DESC_SEARCHABLE: IOUT(SQLSMALLINT, drec->sql_desc_searchable); break; case SQL_DESC_TABLE_NAME: SOUT(drec->sql_desc_table_name); break; case SQL_DESC_TYPE: IOUT(SQLSMALLINT, drec->sql_desc_type); break; case SQL_DESC_TYPE_NAME: COUT(drec->sql_desc_type_name); break; case SQL_DESC_UNNAMED: IOUT(SQLSMALLINT, drec->sql_desc_unnamed); break; case SQL_DESC_UNSIGNED: IOUT(SQLSMALLINT, drec->sql_desc_unsigned); break; case SQL_DESC_UPDATABLE: IOUT(SQLSMALLINT, drec->sql_desc_updatable); break; default: tdsdump_log(TDS_DBG_INFO2, "SQLColAttribute: fDescType %d not catered for...\n", fDescType); odbc_errs_add(&stmt->errs, "HY091", NULL); ODBC_EXIT_(stmt); break; } if (result == SQL_SUCCESS_WITH_INFO) odbc_errs_add(&stmt->errs, "01004", NULL); ODBC_EXIT(stmt, result); #undef COUT #undef SOUT #undef IOUT } SQLRETURN ODBC_PUBLIC ODBC_API SQLColAttributes(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, SQLLEN FAR * pfDesc) { tdsdump_log(TDS_DBG_FUNC, "SQLColAttributes(%p, %d, %d, %p, %d, %p, %p)\n", hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); return _SQLColAttribute(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc _wide0); } #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, #ifdef TDS_SQLCOLATTRIBUTE_SQLLEN SQLLEN FAR * pfDesc #else SQLPOINTER pfDesc #endif ) { return _SQLColAttribute(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc _wide0); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLColAttributeW(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLPOINTER rgbDesc, SQLSMALLINT cbDescMax, SQLSMALLINT FAR * pcbDesc, #ifdef TDS_SQLCOLATTRIBUTE_SQLLEN SQLLEN FAR * pfDesc #else SQLPOINTER pfDesc #endif ) { tdsdump_log(TDS_DBG_FUNC, "SQLColAttributeW(%p, %u, %u, %p, %d, %p, %p)\n", hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc); return _SQLColAttribute(hstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc, 1); } #endif #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLDisconnect(SQLHDBC hdbc) { int i; ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "SQLDisconnect(%p)\n", hdbc); /* free all associated statements */ while (dbc->stmt_list) { tds_mutex_unlock(&dbc->mtx); _SQLFreeStmt(dbc->stmt_list, SQL_DROP, 1); tds_mutex_lock(&dbc->mtx); } /* free all associated descriptors */ for (i = 0; i < TDS_MAX_APP_DESC; ++i) { if (dbc->uad[i]) { desc_free(dbc->uad[i]); dbc->uad[i] = NULL; } } #ifdef ENABLE_ODBC_WIDE dbc->mb_conv = NULL; #endif tds_close_socket(dbc->tds_socket); tds_free_socket(dbc->tds_socket); dbc->tds_socket = NULL; dbc->cursor_support = 0; ODBC_EXIT_(dbc); } static int odbc_errmsg_handler(const TDSCONTEXT * ctx, TDSSOCKET * tds, TDSMESSAGE * msg) { struct _sql_errors *errs = NULL; TDS_DBC *dbc = NULL; TDS_STMT *stmt = NULL; tdsdump_log(TDS_DBG_INFO1, "msgno %d %d\n", (int) msg->msgno, TDSETIME); if (msg->msgno == TDSETIME) { tdsdump_log(TDS_DBG_INFO1, "in timeout\n"); if (!tds) return TDS_INT_CANCEL; if ((stmt = odbc_get_stmt(tds)) != NULL) { /* first time, try to send a cancel */ if (!tds->in_cancel) { odbc_errs_add(&stmt->errs, "HYT00", "Timeout expired"); tdsdump_log(TDS_DBG_INFO1, "returning from timeout\n"); return TDS_INT_TIMEOUT; } } else if ((dbc = odbc_get_dbc(tds)) != NULL) { odbc_errs_add(&dbc->errs, "HYT00", "Timeout expired"); } tds_close_socket(tds); tdsdump_log(TDS_DBG_INFO1, "returning cancel from timeout\n"); return TDS_INT_CANCEL; } if (tds && (dbc = odbc_get_dbc(tds)) != NULL) { errs = &dbc->errs; stmt = odbc_get_stmt(tds); if (stmt) errs = &stmt->errs; } else if (ctx->parent) { errs = &((TDS_ENV *) ctx->parent)->errs; } if (errs) { int severity = msg->severity; const char * state = msg->sql_state; /* fix severity for Sybase */ if (severity <= 10 && dbc && !TDS_IS_MSSQL(dbc->tds_socket) && msg->sql_state && msg->sql_state[0] && strncmp(msg->sql_state, "00", 2) != 0) { if (strncmp(msg->sql_state, "01", 2) != 0 && strncmp(msg->sql_state, "IM", 2) != 0) severity = 11; } /* compute state if not available */ if (!state) state = severity <= 10 ? "01000" : "42000"; /* add error, do not overwrite connection timeout error */ if (msg->msgno != TDSEFCON || errs->lastrc != SQL_ERROR || errs->num_errors < 1) odbc_errs_add_rdbms(errs, msg->msgno, state, msg->message, msg->line_number, msg->severity, msg->server, stmt ? stmt->curr_param_row + 1 : 0); /* set lastc according */ if (severity <= 10) { if (errs->lastrc == SQL_SUCCESS) errs->lastrc = SQL_SUCCESS_WITH_INFO; } else { errs->lastrc = SQL_ERROR; } } return TDS_INT_CANCEL; } /* TODO optimize, change only if some data change (set same value should not set this flag) */ #define DESC_SET_NEED_REPREPARE \ do {\ if (desc->type == DESC_IPD) {\ assert(IS_HSTMT(desc->parent));\ ((TDS_STMT *) desc->parent)->need_reprepare = 1;\ }\ } while(0) SQLRETURN ODBC_PUBLIC ODBC_API SQLSetDescRec(SQLHDESC hdesc, SQLSMALLINT nRecordNumber, SQLSMALLINT nType, SQLSMALLINT nSubType, SQLLEN nLength, SQLSMALLINT nPrecision, SQLSMALLINT nScale, SQLPOINTER pData, SQLLEN FAR * pnStringLength, SQLLEN FAR * pnIndicator) { struct _drecord *drec; SQLSMALLINT concise_type; ODBC_ENTER_HDESC; tdsdump_log(TDS_DBG_FUNC, "SQLSetDescRec(%p, %d, %d, %d, %d, %d, %d, %p, %p, %p)\n", hdesc, nRecordNumber, nType, nSubType, (int)nLength, nPrecision, nScale, pData, pnStringLength, pnIndicator); if (desc->type == DESC_IRD) { odbc_errs_add(&desc->errs, "HY016", NULL); ODBC_EXIT_(desc); } if (nRecordNumber > desc->header.sql_desc_count || nRecordNumber <= 0) { odbc_errs_add(&desc->errs, "07009", NULL); ODBC_EXIT_(desc); } drec = &desc->records[nRecordNumber - 1]; /* check for valid types and return "HY021" if not */ if (desc->type == DESC_IPD) { DESC_SET_NEED_REPREPARE; concise_type = odbc_get_concise_sql_type(nType, nSubType); } else { concise_type = odbc_get_concise_c_type(nType, nSubType); } if (nType == SQL_INTERVAL || nType == SQL_DATETIME) { if (!concise_type) { odbc_errs_add(&desc->errs, "HY021", NULL); ODBC_EXIT_(desc); } } else { if (concise_type != nType) { odbc_errs_add(&desc->errs, "HY021", NULL); ODBC_EXIT_(desc); } nSubType = 0; } drec->sql_desc_concise_type = concise_type; drec->sql_desc_type = nType; drec->sql_desc_datetime_interval_code = nSubType; drec->sql_desc_octet_length = nLength; drec->sql_desc_precision = nPrecision; drec->sql_desc_scale = nScale; drec->sql_desc_data_ptr = pData; drec->sql_desc_octet_length_ptr = pnStringLength; drec->sql_desc_indicator_ptr = pnIndicator; ODBC_EXIT_(desc); } ODBC_FUNC(SQLGetDescRec, (P(SQLHDESC,hdesc), P(SQLSMALLINT,RecordNumber), PCHAROUT(Name,SQLSMALLINT), P(SQLSMALLINT *,Type), P(SQLSMALLINT *,SubType), P(SQLLEN FAR *,Length), P(SQLSMALLINT *,Precision), P(SQLSMALLINT *,Scale), P(SQLSMALLINT *,Nullable) WIDE)) { struct _drecord *drec = NULL; SQLRETURN rc = SQL_SUCCESS; ODBC_ENTER_HDESC; if (RecordNumber <= 0) { odbc_errs_add(&desc->errs, "07009", NULL); ODBC_EXIT_(desc); } IRD_UPDATE(desc, &desc->errs, ODBC_EXIT(desc, SQL_ERROR)); if (RecordNumber > desc->header.sql_desc_count) ODBC_EXIT(desc, SQL_NO_DATA); if (desc->type == DESC_IRD && !desc->header.sql_desc_count) { odbc_errs_add(&desc->errs, "HY007", NULL); ODBC_EXIT_(desc); } drec = &desc->records[RecordNumber - 1]; if ((rc = odbc_set_dstr(desc_get_dbc(desc), szName, cbNameMax, pcbName, &drec->sql_desc_name)) != SQL_SUCCESS) odbc_errs_add(&desc->errs, "01004", NULL); if (Type) *Type = drec->sql_desc_type; if (Length) *Length = drec->sql_desc_octet_length; if (Precision) *Precision = drec->sql_desc_precision; if (Scale) *Scale = drec->sql_desc_scale; if (SubType) *SubType = drec->sql_desc_datetime_interval_code; if (Nullable) *Nullable = drec->sql_desc_nullable; ODBC_EXIT(desc, rc); } ODBC_FUNC(SQLGetDescField, (P(SQLHDESC,hdesc), P(SQLSMALLINT,icol), P(SQLSMALLINT,fDescType), P(SQLPOINTER,Value), P(SQLINTEGER,BufferLength), P(SQLINTEGER *,StringLength) WIDE)) { struct _drecord *drec; SQLRETURN result = SQL_SUCCESS; ODBC_ENTER_HDESC; #define COUT(src) result = odbc_set_string_oct(desc_get_dbc(desc), Value, BufferLength, StringLength, src, -1); #define SOUT(src) result = odbc_set_dstr_oct(desc_get_dbc(desc), Value, BufferLength, StringLength, &src); #if ENABLE_EXTRA_CHECKS #define IOUT(type, src) do { \ /* trick warning if type wrong */ \ type *p_test = &src; p_test = p_test; \ *((type *)Value) = src; } while(0) #else #define IOUT(type, src) *((type *)Value) = src #endif /* dont check column index for these */ switch (fDescType) { case SQL_DESC_ALLOC_TYPE: IOUT(SQLSMALLINT, desc->header.sql_desc_alloc_type); ODBC_EXIT_(desc); break; case SQL_DESC_ARRAY_SIZE: IOUT(SQLULEN, desc->header.sql_desc_array_size); ODBC_EXIT_(desc); break; case SQL_DESC_ARRAY_STATUS_PTR: IOUT(SQLUSMALLINT *, desc->header.sql_desc_array_status_ptr); ODBC_EXIT_(desc); break; case SQL_DESC_BIND_OFFSET_PTR: IOUT(SQLLEN *, desc->header.sql_desc_bind_offset_ptr); ODBC_EXIT_(desc); break; case SQL_DESC_BIND_TYPE: IOUT(SQLINTEGER, desc->header.sql_desc_bind_type); ODBC_EXIT_(desc); break; case SQL_DESC_COUNT: IRD_UPDATE(desc, &desc->errs, ODBC_EXIT(desc, SQL_ERROR)); IOUT(SQLSMALLINT, desc->header.sql_desc_count); ODBC_EXIT_(desc); break; case SQL_DESC_ROWS_PROCESSED_PTR: IOUT(SQLULEN *, desc->header.sql_desc_rows_processed_ptr); ODBC_EXIT_(desc); break; } IRD_UPDATE(desc, &desc->errs, ODBC_EXIT(desc, SQL_ERROR)); if (!desc->header.sql_desc_count) { odbc_errs_add(&desc->errs, "07005", NULL); ODBC_EXIT_(desc); } if (icol < 1) { odbc_errs_add(&desc->errs, "07009", "Column out of range"); ODBC_EXIT_(desc); } if (icol > desc->header.sql_desc_count) ODBC_EXIT(desc, SQL_NO_DATA); drec = &desc->records[icol - 1]; tdsdump_log(TDS_DBG_INFO1, "SQLGetDescField: fDescType is %d\n", fDescType); switch (fDescType) { case SQL_DESC_AUTO_UNIQUE_VALUE: IOUT(SQLUINTEGER, drec->sql_desc_auto_unique_value); break; case SQL_DESC_BASE_COLUMN_NAME: SOUT(drec->sql_desc_base_column_name); break; case SQL_DESC_BASE_TABLE_NAME: SOUT(drec->sql_desc_base_table_name); break; case SQL_DESC_CASE_SENSITIVE: IOUT(SQLINTEGER, drec->sql_desc_case_sensitive); break; case SQL_DESC_CATALOG_NAME: SOUT(drec->sql_desc_catalog_name); break; case SQL_DESC_CONCISE_TYPE: IOUT(SQLSMALLINT, drec->sql_desc_concise_type); break; case SQL_DESC_DATA_PTR: IOUT(SQLPOINTER, drec->sql_desc_data_ptr); break; case SQL_DESC_DATETIME_INTERVAL_CODE: IOUT(SQLSMALLINT, drec->sql_desc_datetime_interval_code); break; case SQL_DESC_DATETIME_INTERVAL_PRECISION: IOUT(SQLINTEGER, drec->sql_desc_datetime_interval_precision); break; case SQL_DESC_DISPLAY_SIZE: IOUT(SQLLEN, drec->sql_desc_display_size); break; case SQL_DESC_FIXED_PREC_SCALE: IOUT(SQLSMALLINT, drec->sql_desc_fixed_prec_scale); break; case SQL_DESC_INDICATOR_PTR: IOUT(SQLLEN *, drec->sql_desc_indicator_ptr); break; case SQL_DESC_LABEL: SOUT(drec->sql_desc_label); break; case SQL_DESC_LENGTH: IOUT(SQLULEN, drec->sql_desc_length); break; case SQL_DESC_LITERAL_PREFIX: COUT(drec->sql_desc_literal_prefix); break; case SQL_DESC_LITERAL_SUFFIX: COUT(drec->sql_desc_literal_suffix); break; case SQL_DESC_LOCAL_TYPE_NAME: SOUT(drec->sql_desc_local_type_name); break; case SQL_DESC_NAME: SOUT(drec->sql_desc_name); break; case SQL_DESC_NULLABLE: IOUT(SQLSMALLINT, drec->sql_desc_nullable); break; case SQL_DESC_NUM_PREC_RADIX: IOUT(SQLINTEGER, drec->sql_desc_num_prec_radix); break; case SQL_DESC_OCTET_LENGTH: IOUT(SQLLEN, drec->sql_desc_octet_length); break; case SQL_DESC_OCTET_LENGTH_PTR: IOUT(SQLLEN *, drec->sql_desc_octet_length_ptr); break; case SQL_DESC_PARAMETER_TYPE: IOUT(SQLSMALLINT, drec->sql_desc_parameter_type); break; case SQL_DESC_PRECISION: if (drec->sql_desc_concise_type == SQL_NUMERIC || drec->sql_desc_concise_type == SQL_DECIMAL || drec->sql_desc_concise_type == SQL_TIMESTAMP || drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP) IOUT(SQLSMALLINT, drec->sql_desc_precision); else /* TODO support date/time */ *((SQLSMALLINT *) Value) = 0; break; #ifdef SQL_DESC_ROWVER case SQL_DESC_ROWVER: IOUT(SQLSMALLINT, drec->sql_desc_rowver); break; #endif case SQL_DESC_SCALE: if (drec->sql_desc_concise_type == SQL_NUMERIC || drec->sql_desc_concise_type == SQL_DECIMAL || drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP || drec->sql_desc_concise_type == SQL_TIMESTAMP || drec->sql_desc_concise_type == SQL_FLOAT) IOUT(SQLSMALLINT, drec->sql_desc_scale); else *((SQLSMALLINT *) Value) = 0; break; case SQL_DESC_SCHEMA_NAME: SOUT(drec->sql_desc_schema_name); break; case SQL_DESC_SEARCHABLE: IOUT(SQLSMALLINT, drec->sql_desc_searchable); break; case SQL_DESC_TABLE_NAME: SOUT(drec->sql_desc_table_name); break; case SQL_DESC_TYPE: IOUT(SQLSMALLINT, drec->sql_desc_type); break; case SQL_DESC_TYPE_NAME: COUT(drec->sql_desc_type_name); break; case SQL_DESC_UNNAMED: IOUT(SQLSMALLINT, drec->sql_desc_unnamed); break; case SQL_DESC_UNSIGNED: IOUT(SQLSMALLINT, drec->sql_desc_unsigned); break; case SQL_DESC_UPDATABLE: IOUT(SQLSMALLINT, drec->sql_desc_updatable); break; default: odbc_errs_add(&desc->errs, "HY091", NULL); ODBC_EXIT_(desc); break; } if (result == SQL_SUCCESS_WITH_INFO) odbc_errs_add(&desc->errs, "01004", NULL); ODBC_EXIT(desc, result); #undef COUT #undef SOUT #undef IOUT } ODBC_FUNC(SQLSetDescField, (P(SQLHDESC,hdesc), P(SQLSMALLINT,icol), P(SQLSMALLINT,fDescType), P(SQLPOINTER,Value), P(SQLINTEGER,BufferLength) WIDE)) { struct _drecord *drec; SQLRETURN result = SQL_SUCCESS; ODBC_ENTER_HDESC; #if ENABLE_EXTRA_CHECKS #define IIN(type, dest) do { \ /* trick warning if type wrong */ \ type *p_test = &dest; p_test = p_test; \ dest = (type)(TDS_INTPTR)Value; } while(0) #define PIN(type, dest) do { \ /* trick warning if type wrong */ \ type *p_test = &dest; p_test = p_test; \ dest = (type)Value; } while(0) #else #define IIN(type, dest) dest = (type)(TDS_INTPTR)Value #define PIN(type, dest) dest = (type)Value #endif /* special case for IRD */ if (desc->type == DESC_IRD && fDescType != SQL_DESC_ARRAY_STATUS_PTR && fDescType != SQL_DESC_ROWS_PROCESSED_PTR) { odbc_errs_add(&desc->errs, "HY016", NULL); ODBC_EXIT_(desc); } /* dont check column index for these */ switch (fDescType) { case SQL_DESC_ALLOC_TYPE: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); ODBC_EXIT_(desc); break; case SQL_DESC_ARRAY_SIZE: IIN(SQLULEN, desc->header.sql_desc_array_size); ODBC_EXIT_(desc); break; case SQL_DESC_ARRAY_STATUS_PTR: PIN(SQLUSMALLINT *, desc->header.sql_desc_array_status_ptr); ODBC_EXIT_(desc); break; case SQL_DESC_ROWS_PROCESSED_PTR: PIN(SQLULEN *, desc->header.sql_desc_rows_processed_ptr); ODBC_EXIT_(desc); break; case SQL_DESC_BIND_TYPE: IIN(SQLINTEGER, desc->header.sql_desc_bind_type); ODBC_EXIT_(desc); break; case SQL_DESC_COUNT: { int n = (int) (TDS_INTPTR) Value; if (n <= 0 || n > 4000) { odbc_errs_add(&desc->errs, "07009", NULL); ODBC_EXIT_(desc); } result = desc_alloc_records(desc, n); if (result == SQL_ERROR) odbc_errs_add(&desc->errs, "HY001", NULL); ODBC_EXIT(desc, result); } break; } if (!desc->header.sql_desc_count) { odbc_errs_add(&desc->errs, "07005", NULL); ODBC_EXIT_(desc); } if (icol <= 0 || icol > desc->header.sql_desc_count) { odbc_errs_add(&desc->errs, "07009", "Column out of range"); ODBC_EXIT_(desc); } drec = &desc->records[icol - 1]; tdsdump_log(TDS_DBG_INFO1, "SQLSetDescField: fDescType is %d\n", fDescType); switch (fDescType) { case SQL_DESC_AUTO_UNIQUE_VALUE: case SQL_DESC_BASE_COLUMN_NAME: case SQL_DESC_BASE_TABLE_NAME: case SQL_DESC_CASE_SENSITIVE: case SQL_DESC_CATALOG_NAME: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; case SQL_DESC_CONCISE_TYPE: DESC_SET_NEED_REPREPARE; if (desc->type == DESC_IPD) result = odbc_set_concise_sql_type((SQLSMALLINT) (TDS_INTPTR) Value, drec, 0); else result = odbc_set_concise_c_type((SQLSMALLINT) (TDS_INTPTR) Value, drec, 0); if (result != SQL_SUCCESS) odbc_errs_add(&desc->errs, "HY021", NULL); break; case SQL_DESC_DATA_PTR: PIN(SQLPOINTER, drec->sql_desc_data_ptr); break; /* TODO SQL_DESC_DATETIME_INTERVAL_CODE remember to check sql_desc_type */ /* TODO SQL_DESC_DATETIME_INTERVAL_PRECISION */ case SQL_DESC_DISPLAY_SIZE: case SQL_DESC_FIXED_PREC_SCALE: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; case SQL_DESC_INDICATOR_PTR: PIN(SQLLEN *, drec->sql_desc_indicator_ptr); break; case SQL_DESC_LABEL: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; case SQL_DESC_LENGTH: DESC_SET_NEED_REPREPARE; IIN(SQLULEN, drec->sql_desc_length); break; case SQL_DESC_LITERAL_PREFIX: case SQL_DESC_LITERAL_SUFFIX: case SQL_DESC_LOCAL_TYPE_NAME: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; case SQL_DESC_NAME: if (!odbc_dstr_copy_oct(desc_get_dbc(desc), &drec->sql_desc_name, BufferLength, (ODBC_CHAR*) Value)) { odbc_errs_add(&desc->errs, "HY001", NULL); result = SQL_ERROR; } break; case SQL_DESC_NULLABLE: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; case SQL_DESC_NUM_PREC_RADIX: IIN(SQLINTEGER, drec->sql_desc_num_prec_radix); break; case SQL_DESC_OCTET_LENGTH: DESC_SET_NEED_REPREPARE; IIN(SQLLEN, drec->sql_desc_octet_length); break; case SQL_DESC_OCTET_LENGTH_PTR: PIN(SQLLEN *, drec->sql_desc_octet_length_ptr); break; case SQL_DESC_PARAMETER_TYPE: DESC_SET_NEED_REPREPARE; IIN(SQLSMALLINT, drec->sql_desc_parameter_type); break; case SQL_DESC_PRECISION: DESC_SET_NEED_REPREPARE; /* TODO correct ?? */ if (drec->sql_desc_concise_type == SQL_NUMERIC || drec->sql_desc_concise_type == SQL_DECIMAL) IIN(SQLSMALLINT, drec->sql_desc_precision); else IIN(SQLULEN, drec->sql_desc_length); break; #ifdef SQL_DESC_ROWVER case SQL_DESC_ROWVER: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; #endif case SQL_DESC_SCALE: DESC_SET_NEED_REPREPARE; if (drec->sql_desc_concise_type == SQL_NUMERIC || drec->sql_desc_concise_type == SQL_DECIMAL) IIN(SQLSMALLINT, drec->sql_desc_scale); else /* TODO even for datetime/money ?? */ drec->sql_desc_scale = 0; break; case SQL_DESC_SCHEMA_NAME: case SQL_DESC_SEARCHABLE: case SQL_DESC_TABLE_NAME: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; case SQL_DESC_TYPE: DESC_SET_NEED_REPREPARE; IIN(SQLSMALLINT, drec->sql_desc_type); /* FIXME what happen for interval/datetime ?? */ drec->sql_desc_concise_type = drec->sql_desc_type; break; case SQL_DESC_TYPE_NAME: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; case SQL_DESC_UNNAMED: IIN(SQLSMALLINT, drec->sql_desc_unnamed); break; case SQL_DESC_UNSIGNED: case SQL_DESC_UPDATABLE: odbc_errs_add(&desc->errs, "HY091", "Descriptor type read only"); result = SQL_ERROR; break; default: odbc_errs_add(&desc->errs, "HY091", NULL); ODBC_EXIT_(desc); break; } #undef IIN ODBC_EXIT(desc, result); } SQLRETURN ODBC_PUBLIC ODBC_API SQLCopyDesc(SQLHDESC hsrc, SQLHDESC hdesc) { TDS_DESC *src; ODBC_ENTER_HDESC; tdsdump_log(TDS_DBG_FUNC, "SQLCopyDesc(%p, %p)\n", hsrc, hdesc); if (SQL_NULL_HDESC == hsrc || !IS_HDESC(hsrc)) return SQL_INVALID_HANDLE; src = (TDS_DESC *) hsrc; CHECK_DESC_EXTRA(src); /* do not write on IRD */ if (desc->type == DESC_IRD) { odbc_errs_add(&desc->errs, "HY016", NULL); ODBC_EXIT_(desc); } IRD_UPDATE(src, &src->errs, ODBC_EXIT(desc, SQL_ERROR)); ODBC_EXIT(desc, desc_copy(desc, src)); } #if ENABLE_EXTRA_CHECKS static void odbc_ird_check(TDS_STMT * stmt) { #if !ENABLE_ODBC_MARS TDS_DESC *ird = stmt->ird; TDSRESULTINFO *res_info = NULL; int cols = 0, i; if (!stmt->tds) return; if (stmt->tds->current_results) { res_info = stmt->tds->current_results; cols = res_info->num_cols; } if (stmt->cursor != NULL) return; /* check columns number */ assert(ird->header.sql_desc_count <= cols || ird->header.sql_desc_count == 0); /* check all columns */ for (i = 0; i < ird->header.sql_desc_count; ++i) { struct _drecord *drec = &ird->records[i]; TDSCOLUMN *col = res_info->columns[i]; assert(strcmp(tds_dstr_cstr(&drec->sql_desc_label), tds_dstr_cstr(&col->column_name)) == 0); } #endif } #endif static void odbc_unquote(char *buf, size_t buf_len, const char *start, const char *end) { char quote; assert(buf_len > 0); /* empty string */ if (start >= end) { buf[0] = 0; return; } /* not quoted */ if (*start != '[' && *start != '\"') { --buf_len; if (end - start < buf_len) buf_len = end - start; memcpy(buf, start, buf_len); buf[buf_len] = 0; return; } /* quoted... unquote */ quote = (*start == '[') ? ']' : *start; ++start; while (buf_len > 0 && start < end) { if (*start == quote) if (++start >= end) break; *buf++ = *start++; --buf_len; } *buf = 0; } /* FIXME check result !!! */ static SQLRETURN odbc_populate_ird(TDS_STMT * stmt) { TDS_DESC *ird = stmt->ird; struct _drecord *drec; TDSCOLUMN *col; TDSRESULTINFO *res_info; int num_cols; int i; desc_free_records(ird); if (!stmt->tds || !(res_info = stmt->tds->current_results)) return SQL_SUCCESS; if (res_info == stmt->tds->param_info) return SQL_SUCCESS; num_cols = res_info->num_cols; /* ignore hidden columns... TODO correct? */ while (num_cols > 0 && res_info->columns[num_cols - 1]->column_hidden == 1) --num_cols; if (desc_alloc_records(ird, num_cols) != SQL_SUCCESS) goto memory_error; for (i = 0; i < num_cols; i++) { drec = &ird->records[i]; col = res_info->columns[i]; drec->sql_desc_auto_unique_value = col->column_identity ? SQL_TRUE : SQL_FALSE; /* TODO SQL_FALSE ?? */ drec->sql_desc_case_sensitive = SQL_TRUE; /* * TODO how to handle when in datetime we change precision ?? * should we change display size too ?? * is formatting function correct ?? * we should not convert to string with invalid precision! */ odbc_set_sql_type_info(col, drec, stmt->dbc->env->attr.odbc_version); drec->sql_desc_fixed_prec_scale = (col->column_prec && col->column_scale) ? SQL_TRUE : SQL_FALSE; if (!tds_dstr_dup(&drec->sql_desc_label, &col->column_name)) goto memory_error; if (tds_dstr_isempty(&col->table_column_name)) { if (!tds_dstr_dup(&drec->sql_desc_name, &col->column_name)) goto memory_error; } else { if (!tds_dstr_dup(&drec->sql_desc_name, &col->table_column_name)) goto memory_error; if (!tds_dstr_dup(&drec->sql_desc_base_column_name, &col->table_column_name)) goto memory_error; } /* extract sql_desc_(catalog/schema/base_table)_name */ /* TODO extract them dinamically (when needed) ? */ /* TODO store in libTDS in different way (separately) ? */ if (!tds_dstr_isempty(&col->table_name)) { struct { const char *start; const char *end; } partials[4]; const char *p; char buf[256]; int i; p = tds_dstr_cstr(&col->table_name); for (i = 0; ; ++i) { const char *pend; if (*p == '[' || *p == '\"') { pend = tds_skip_quoted(p); } else { pend = strchr(p, '.'); if (!pend) pend = strchr(p, 0); } partials[i].start = p; partials[i].end = pend; p = pend; if (i == 3 || *p != '.') break; ++p; } /* here i points to last element */ odbc_unquote(buf, sizeof(buf), partials[i].start, partials[i].end); if (!tds_dstr_copy(&drec->sql_desc_base_table_name, buf)) goto memory_error; --i; if (i >= 0) { odbc_unquote(buf, sizeof(buf), partials[i].start, partials[i].end); if (!tds_dstr_copy(&drec->sql_desc_schema_name, buf)) goto memory_error; } --i; if (i >= 0) { odbc_unquote(buf, sizeof(buf), partials[i].start, partials[i].end); if (!tds_dstr_copy(&drec->sql_desc_catalog_name, buf)) goto memory_error; } } drec->sql_desc_unnamed = tds_dstr_isempty(&drec->sql_desc_name) ? SQL_UNNAMED : SQL_NAMED; /* TODO use is_nullable_type ?? */ drec->sql_desc_nullable = col->column_nullable ? SQL_TRUE : SQL_FALSE; drec->sql_desc_octet_length_ptr = NULL; /* TODO test timestamp from db, FOR BROWSE query */ drec->sql_desc_rowver = SQL_FALSE; /* TODO seem not correct */ drec->sql_desc_searchable = (drec->sql_desc_unnamed == SQL_NAMED) ? SQL_PRED_SEARCHABLE : SQL_UNSEARCHABLE; drec->sql_desc_updatable = col->column_writeable && !col->column_identity ? SQL_TRUE : SQL_FALSE; } return SQL_SUCCESS; memory_error: odbc_errs_add(&stmt->errs, "HY001", NULL); return SQL_ERROR; } static TDSRET odbc_cursor_execute(TDS_STMT * stmt) { TDSSOCKET *tds = stmt->tds; int send = 0, i; TDSRET ret; TDSCURSOR *cursor; TDSPARAMINFO *params = stmt->params; assert(tds); assert(stmt->attr.cursor_type != SQL_CURSOR_FORWARD_ONLY || stmt->attr.concurrency != SQL_CONCUR_READ_ONLY); tds_release_cursor(&stmt->cursor); cursor = tds_alloc_cursor(tds, tds_dstr_cstr(&stmt->cursor_name), tds_dstr_len(&stmt->cursor_name), tds_dstr_cstr(&stmt->query), tds_dstr_len(&stmt->query)); if (!cursor) { odbc_unlock_statement(stmt); odbc_errs_add(&stmt->errs, "HY001", NULL); return TDS_FAIL; } stmt->cursor = cursor; /* TODO cursor add enums for tds7 */ switch (stmt->attr.cursor_type) { default: case SQL_CURSOR_FORWARD_ONLY: i = TDS_CUR_TYPE_FORWARD; break; case SQL_CURSOR_STATIC: i = TDS_CUR_TYPE_STATIC; break; case SQL_CURSOR_KEYSET_DRIVEN: i = TDS_CUR_TYPE_KEYSET; break; case SQL_CURSOR_DYNAMIC: i = TDS_CUR_TYPE_DYNAMIC; break; } cursor->type = i; switch (stmt->attr.concurrency) { default: case SQL_CONCUR_READ_ONLY: i = TDS_CUR_CONCUR_READ_ONLY; break; case SQL_CONCUR_LOCK: i = TDS_CUR_CONCUR_SCROLL_LOCKS; break; case SQL_CONCUR_ROWVER: i = TDS_CUR_CONCUR_OPTIMISTIC; break; case SQL_CONCUR_VALUES: i = TDS_CUR_CONCUR_OPTIMISTIC_VALUES; break; } cursor->concurrency = 0x2000 | i; ret = tds_cursor_declare(tds, cursor, params, &send); if (TDS_FAILED(ret)) return ret; ret = tds_cursor_open(tds, cursor, params, &send); if (TDS_FAILED(ret)) return ret; /* TODO read results, set row count, check type and scroll returned */ ret = tds_flush_packet(tds); tds_set_state(tds, TDS_PENDING); /* set cursor name for TDS7+ */ if (TDS_SUCCEED(ret) && IS_TDS7_PLUS(tds->conn) && !tds_dstr_isempty(&stmt->cursor_name)) { ret = odbc_process_tokens(stmt, TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE); stmt->row_count = tds->rows_affected; if (ret == TDS_CMD_DONE && cursor->cursor_id != 0) { ret = tds_cursor_setname(tds, cursor); tds_set_state(tds, TDS_PENDING); } else { ret = (ret == TDS_CMD_FAIL) ? TDS_FAIL : TDS_SUCCESS; } if (!cursor->cursor_id) { tds_cursor_dealloc(tds, cursor); tds_release_cursor(&stmt->cursor); } } return ret; } static TDSHEADERS * odbc_init_headers(TDS_STMT * stmt, TDSHEADERS * head) { if (tds_dstr_isempty(&stmt->attr.qn_msgtext) || tds_dstr_isempty(&stmt->attr.qn_options)) return NULL; memset(head, 0, sizeof(*head)); head->qn_timeout = stmt->attr.qn_timeout; head->qn_msgtext = tds_dstr_cstr(&stmt->attr.qn_msgtext); head->qn_options = tds_dstr_cstr(&stmt->attr.qn_options); return head; } static SQLRETURN _SQLExecute(TDS_STMT * stmt) { TDSRET ret; TDSSOCKET *tds; TDS_INT result_type; TDS_INT done = 0; int in_row = 0; SQLUSMALLINT param_status; int found_info = 0, found_error = 0; TDS_INT8 total_rows = TDS_NO_COUNT; TDSHEADERS head; tdsdump_log(TDS_DBG_FUNC, "_SQLExecute(%p)\n", stmt); stmt->row = 0; /* check parameters are all OK */ if (stmt->params && stmt->param_num <= stmt->param_count) { /* TODO what error ?? */ ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } if (!odbc_lock_statement(stmt)) return SQL_ERROR; tds = stmt->tds; tdsdump_log(TDS_DBG_FUNC, "_SQLExecute() starting with state %d\n", tds->state); if (tds->state != TDS_IDLE) { if (tds->state == TDS_DEAD) { odbc_errs_add(&stmt->errs, "08S01", NULL); } else { odbc_errs_add(&stmt->errs, "24000", NULL); } return SQL_ERROR; } stmt->curr_param_row = 0; stmt->num_param_rows = ODBC_MAX(1, stmt->apd->header.sql_desc_array_size); stmt->row_count = TDS_NO_COUNT; if (stmt->prepared_query_is_rpc) { /* TODO support stmt->apd->header.sql_desc_array_size for RPC */ /* get rpc name */ /* TODO change method */ /* TODO cursor change way of calling */ char *name = tds_dstr_buf(&stmt->query); char *end, tmp; end = name; end = (char *) odbc_skip_rpc_name(end); stmt->prepared_pos = end - name; tmp = *end; *end = 0; ret = tds_submit_rpc(tds, name, stmt->params, odbc_init_headers(stmt, &head)); *end = tmp; } else if (stmt->attr.cursor_type != SQL_CURSOR_FORWARD_ONLY || stmt->attr.concurrency != SQL_CONCUR_READ_ONLY) { ret = odbc_cursor_execute(stmt); } else if (!stmt->is_prepared_query) { /* not prepared query */ /* TODO cursor change way of calling */ /* SQLExecDirect */ if (stmt->num_param_rows <= 1) { if (!stmt->params) { ret = tds_submit_query_params(tds, tds_dstr_cstr(&stmt->query), NULL, odbc_init_headers(stmt, &head)); } else { ret = tds_submit_execdirect(tds, tds_dstr_cstr(&stmt->query), stmt->params, odbc_init_headers(stmt, &head)); } } else { /* pack multiple submit using language */ TDSMULTIPLE multiple; ret = tds_multiple_init(tds, &multiple, TDS_MULTIPLE_QUERY, odbc_init_headers(stmt, &head)); for (stmt->curr_param_row = 0; TDS_SUCCEED(ret); ) { /* submit a query */ ret = tds_multiple_query(tds, &multiple, tds_dstr_cstr(&stmt->query), stmt->params); if (++stmt->curr_param_row >= stmt->num_param_rows) break; /* than process others parameters */ /* TODO handle all results*/ if (start_parse_prepared_query(stmt, true) != SQL_SUCCESS) break; } if (TDS_SUCCEED(ret)) ret = tds_multiple_done(tds, &multiple); } } else if (stmt->num_param_rows <= 1 && IS_TDS71_PLUS(tds->conn) && (!stmt->dyn || stmt->need_reprepare)) { if (stmt->dyn) { if (odbc_free_dynamic(stmt) != SQL_SUCCESS) ODBC_RETURN(stmt, SQL_ERROR); } stmt->need_reprepare = 0; ret = tds71_submit_prepexec(tds, tds_dstr_cstr(&stmt->query), NULL, &stmt->dyn, stmt->params); } else { /* TODO cursor change way of calling */ /* SQLPrepare */ TDSDYNAMIC *dyn; /* prepare dynamic query (only for first SQLExecute call) */ if (!stmt->dyn || (stmt->need_reprepare && !stmt->dyn->emulated && IS_TDS7_PLUS(tds->conn))) { /* free previous prepared statement */ if (stmt->dyn) { if (odbc_free_dynamic(stmt) != SQL_SUCCESS) ODBC_RETURN(stmt, SQL_ERROR); } stmt->need_reprepare = 0; tdsdump_log(TDS_DBG_INFO1, "Creating prepared statement\n"); /* TODO use tds_submit_prepexec (mssql2k, tds71) */ if (TDS_FAILED(tds_submit_prepare(tds, tds_dstr_cstr(&stmt->query), NULL, &stmt->dyn, stmt->params))) { /* TODO ?? tds_free_param_results(params); */ ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } if (TDS_FAILED(tds_process_simple_query(tds))) { tds_release_dynamic(&stmt->dyn); /* TODO ?? tds_free_param_results(params); */ ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } } stmt->row_count = TDS_NO_COUNT; if (stmt->num_param_rows <= 1) { dyn = stmt->dyn; tds_free_input_params(dyn); dyn->params = stmt->params; /* prevent double free */ stmt->params = NULL; tdsdump_log(TDS_DBG_INFO1, "End prepare, execute\n"); /* TODO return error to client */ ret = tds_submit_execute(tds, dyn); } else { TDSMULTIPLE multiple; ret = tds_multiple_init(tds, &multiple, TDS_MULTIPLE_EXECUTE, NULL); for (stmt->curr_param_row = 0; TDS_SUCCEED(ret); ) { dyn = stmt->dyn; tds_free_input_params(dyn); dyn->params = stmt->params; /* prevent double free */ stmt->params = NULL; ret = tds_multiple_execute(tds, &multiple, dyn); if (++stmt->curr_param_row >= stmt->num_param_rows) break; /* than process others parameters */ /* TODO handle all results*/ if (start_parse_prepared_query(stmt, true) != SQL_SUCCESS) break; } if (TDS_SUCCEED(ret)) ret = tds_multiple_done(tds, &multiple); } } if (TDS_FAILED(ret)) { ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } /* catch all errors */ if (!odbc_lock_statement(stmt)) ODBC_RETURN_(stmt); stmt->row_status = PRE_NORMAL_ROW; stmt->curr_param_row = 0; param_status = SQL_PARAM_SUCCESS; /* TODO review this, ODBC return parameter in other way, for compute I don't know */ /* TODO perhaps we should return SQL_NO_DATA if no data available... see old SQLExecute code */ for (;;) { result_type = odbc_process_tokens(stmt, TDS_TOKEN_RESULTS); tdsdump_log(TDS_DBG_FUNC, "_SQLExecute: odbc_process_tokens returned result_type %d\n", result_type); switch (result_type) { case TDS_CMD_FAIL: case TDS_CMD_DONE: case TDS_COMPUTE_RESULT: case TDS_ROW_RESULT: done = 1; break; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: switch (stmt->errs.lastrc) { case SQL_ERROR: found_error = 1; param_status = SQL_PARAM_ERROR; break; case SQL_SUCCESS_WITH_INFO: found_info = 1; param_status = SQL_PARAM_SUCCESS_WITH_INFO; break; } if (stmt->curr_param_row < stmt->num_param_rows && stmt->ipd->header.sql_desc_array_status_ptr) stmt->ipd->header.sql_desc_array_status_ptr[stmt->curr_param_row] = param_status; param_status = SQL_PARAM_SUCCESS; ++stmt->curr_param_row; /* actually is quite strange, if prepared always success with info or success * if not prepared return last one */ if (stmt->curr_param_row < stmt->num_param_rows || result_type == TDS_DONEPROC_RESULT) stmt->errs.lastrc = SQL_SUCCESS; if (total_rows == TDS_NO_COUNT) total_rows = stmt->row_count; else if (stmt->row_count != TDS_NO_COUNT) total_rows += stmt->row_count; stmt->row_count = TDS_NO_COUNT; if (stmt->curr_param_row >= stmt->num_param_rows) { done = 1; break; } break; case TDS_DONEINPROC_RESULT: if (in_row) done = 1; break; /* ignore metadata, stop at done or row */ case TDS_ROWFMT_RESULT: if (in_row) { done = 1; break; } stmt->row = 0; stmt->row_count = TDS_NO_COUNT; stmt->row_status = PRE_NORMAL_ROW; in_row = 1; break; } if (done) break; } if ((found_info || found_error) && stmt->errs.lastrc != SQL_ERROR) stmt->errs.lastrc = SQL_SUCCESS_WITH_INFO; if (tds_dstr_isempty(&stmt->attr.qn_msgtext) != tds_dstr_isempty(&stmt->attr.qn_options)) { odbc_errs_add(&stmt->errs, "HY000", "Attribute ignored"); stmt->errs.lastrc = SQL_SUCCESS_WITH_INFO; } if (found_error && stmt->num_param_rows <= 1) stmt->errs.lastrc = SQL_ERROR; if (stmt->curr_param_row < stmt->num_param_rows) { if (stmt->ipd->header.sql_desc_array_status_ptr) stmt->ipd->header.sql_desc_array_status_ptr[stmt->curr_param_row] = param_status; ++stmt->curr_param_row; if (total_rows == TDS_NO_COUNT) total_rows = stmt->row_count; else if (stmt->row_count != TDS_NO_COUNT) total_rows += stmt->row_count; stmt->row_count = TDS_NO_COUNT; } if (stmt->ipd->header.sql_desc_rows_processed_ptr) *stmt->ipd->header.sql_desc_rows_processed_ptr = ODBC_MIN(stmt->curr_param_row, stmt->num_param_rows); if (total_rows != TDS_NO_COUNT) stmt->row_count = total_rows; odbc_populate_ird(stmt); switch (result_type) { case TDS_CMD_DONE: odbc_unlock_statement(stmt); if (stmt->errs.lastrc == SQL_SUCCESS && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3 && stmt->row_count == TDS_NO_COUNT && !stmt->cursor && stmt->ird->header.sql_desc_count <= 0) ODBC_RETURN(stmt, SQL_NO_DATA); break; case TDS_CMD_FAIL: /* TODO test what happened, report correct error to client */ tdsdump_log(TDS_DBG_INFO1, "SQLExecute: bad results\n"); ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } ODBC_RETURN_(stmt); } ODBC_FUNC(SQLExecDirect, (P(SQLHSTMT,hstmt), PCHARIN(SqlStr,SQLINTEGER) WIDE)) { SQLRETURN res; ODBC_ENTER_HSTMT; if (SQL_SUCCESS != odbc_set_stmt_query(stmt, szSqlStr, cbSqlStr _wide)) { odbc_errs_add(&stmt->errs, "HY001", NULL); ODBC_EXIT_(stmt); } /* count placeholders */ /* note: szSqlStr can be no-null terminated, so first we set query and then count placeholders */ stmt->param_count = tds_count_placeholders(tds_dstr_cstr(&stmt->query)); stmt->param_data_called = 0; if (SQL_SUCCESS != prepare_call(stmt)) { /* TODO return another better error, prepare_call should set error ?? */ odbc_errs_add(&stmt->errs, "HY000", "Could not prepare call"); ODBC_EXIT_(stmt); } res = start_parse_prepared_query(stmt, true); if (SQL_SUCCESS != res) ODBC_EXIT(stmt, res); ODBC_EXIT(stmt, _SQLExecute(stmt)); } SQLRETURN ODBC_PUBLIC ODBC_API SQLExecute(SQLHSTMT hstmt) { ODBC_PRRET_BUF; SQLRETURN res; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLExecute(%p)\n", hstmt); if (!stmt->is_prepared_query) { /* TODO error report, only without DM ?? */ tdsdump_log(TDS_DBG_FUNC, "SQLExecute returns SQL_ERROR (not prepared)\n"); ODBC_EXIT(stmt, SQL_ERROR); } /* TODO rebuild should be done for every bindings change, not every time */ /* TODO free previous parameters */ /* build parameters list */ stmt->param_data_called = 0; stmt->curr_param_row = 0; if ((res = start_parse_prepared_query(stmt, true)) != SQL_SUCCESS) { tdsdump_log(TDS_DBG_FUNC, "SQLExecute returns %s (start_parse_prepared_query failed)\n", odbc_prret(res)); ODBC_EXIT(stmt, res); } /* TODO test if two SQLPrepare on a statement */ /* TODO test unprepare on statement free or connection close */ res = _SQLExecute(stmt); tdsdump_log(TDS_DBG_FUNC, "SQLExecute returns %s\n", odbc_prret(res)); ODBC_EXIT(stmt, res); } static int odbc_process_tokens(TDS_STMT * stmt, unsigned flag) { TDS_INT result_type; int done_flags = 0; TDSSOCKET * tds = stmt->tds; flag |= TDS_RETURN_DONE | TDS_RETURN_PROC; for (;;) { TDSRET retcode = tds_process_tokens(tds, &result_type, &done_flags, flag); tdsdump_log(TDS_DBG_FUNC, "odbc_process_tokens: tds_process_tokens returned %d\n", retcode); tdsdump_log(TDS_DBG_FUNC, " result_type=%d, TDS_DONE_COUNT=%x, TDS_DONE_ERROR=%x\n", result_type, (done_flags & TDS_DONE_COUNT), (done_flags & TDS_DONE_ERROR)); switch (retcode) { case TDS_SUCCESS: break; case TDS_NO_MORE_RESULTS: return TDS_CMD_DONE; case TDS_CANCELLED: odbc_errs_add(&stmt->errs, "HY008", NULL); default: return TDS_CMD_FAIL; } switch (result_type) { case TDS_STATUS_RESULT: odbc_set_return_status(stmt, ODBC_MIN(stmt->curr_param_row, stmt->num_param_rows - 1)); break; case TDS_PARAM_RESULT: odbc_set_return_params(stmt, ODBC_MIN(stmt->curr_param_row, stmt->num_param_rows - 1)); break; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: if (stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) flag |= TDS_STOPAT_MSG; if (done_flags & TDS_DONE_COUNT) { /* correct ?? overwrite ?? */ if (stmt->row_count == TDS_NO_COUNT) stmt->row_count = tds->rows_affected; } if (done_flags & TDS_DONE_ERROR) stmt->errs.lastrc = SQL_ERROR; /* test for internal_sp not very fine, used for param set -- freddy77 */ if ((done_flags & (TDS_DONE_COUNT|TDS_DONE_ERROR)) != 0 || (stmt->errs.lastrc == SQL_SUCCESS_WITH_INFO && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) || (result_type == TDS_DONEPROC_RESULT && tds->current_op == TDS_OP_EXECUTE)) { /* FIXME this row is used only as a flag for update binding, should be cleared if binding/result changed */ stmt->row = 0; #if 0 tds_free_all_results(tds); odbc_populate_ird(stmt); #endif tdsdump_log(TDS_DBG_FUNC, "odbc_process_tokens: row_count=%" PRId64 "\n", stmt->row_count); return result_type; } tdsdump_log(TDS_DBG_FUNC, "odbc_process_tokens: processed %s\n", result_type==TDS_DONE_RESULT? "TDS_DONE_RESULT" : "TDS_DONEPROC_RESULT"); break; /* * TODO test flags ? check error and change result ? * see also other DONEINPROC handle (below) */ case TDS_DONEINPROC_RESULT: if (stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) flag |= TDS_STOPAT_MSG; if (done_flags & TDS_DONE_COUNT) { stmt->row_count = tds->rows_affected; } if (done_flags & TDS_DONE_ERROR) stmt->errs.lastrc = SQL_ERROR; /* TODO perhaps it can be a problem if SET NOCOUNT ON, test it */ #if 0 tds_free_all_results(tds); odbc_populate_ird(stmt); #endif tdsdump_log(TDS_DBG_FUNC, "odbc_process_tokens: processed TDS_DONEINPROC_RESULT\n"); if (stmt->row_status == PRE_NORMAL_ROW) return result_type; break; default: tdsdump_log(TDS_DBG_FUNC, "odbc_process_tokens: returning result_type %d\n", result_type); return result_type; } } } static void odbc_fix_data_type_col(TDS_STMT *stmt, int idx) { TDSSOCKET *tds = stmt->tds; TDSRESULTINFO *resinfo; TDSCOLUMN *colinfo; if (!tds) return; resinfo = tds->current_results; if (!resinfo || resinfo->num_cols <= idx) return; colinfo = resinfo->columns[idx]; if (colinfo->column_cur_size < 0) return; switch (tds_get_conversion_type(colinfo->column_type, colinfo->column_size)) { case SYBINT2: { TDS_SMALLINT *data = (TDS_SMALLINT *) colinfo->column_data; *data = odbc_swap_datetime_sql_type(*data, 0); } break; case SYBINT4: { TDS_INT *data = (TDS_INT *) colinfo->column_data; *data = odbc_swap_datetime_sql_type(*data, 0); } break; default: break; } } /* * - handle correctly SQLGetData (for forward cursors accept only row_size == 1 * for other types application must use SQLSetPos) * - handle correctly results (SQL_SUCCESS_WITH_INFO if error on some rows, * SQL_ERROR for all rows, see doc) */ static SQLRETURN _SQLFetch(TDS_STMT * stmt, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset) { TDSSOCKET *tds; TDSRESULTINFO *resinfo; TDSCOLUMN *colinfo; int i; SQLULEN curr_row, num_rows; SQLINTEGER len = 0; struct _drecord *drec_ard; TDS_DESC *ard; SQLULEN dummy, *fetched_ptr; SQLUSMALLINT *status_ptr, row_status; TDS_INT result_type; int truncated = 0; #define AT_ROW(ptr, type) (row_offset ? (type*)(((char*)(ptr)) + row_offset) : &ptr[curr_row]) SQLLEN row_offset = 0; tdsdump_log(TDS_DBG_FUNC, "_SQLFetch(%p, %d, %d)\n", stmt, (int)FetchOrientation, (int)FetchOffset); if (stmt->ard->header.sql_desc_bind_type != SQL_BIND_BY_COLUMN && stmt->ard->header.sql_desc_bind_offset_ptr) row_offset = *stmt->ard->header.sql_desc_bind_offset_ptr; ard = stmt->ard; tds = stmt->tds; num_rows = ard->header.sql_desc_array_size; /* TODO cursor check also type of cursor (scrollable, not forward) */ if (FetchOrientation != SQL_FETCH_NEXT && (!stmt->cursor || !stmt->dbc->cursor_support)) { odbc_errs_add(&stmt->errs, "HY106", NULL); return SQL_ERROR; } /* handle cursors, fetch wanted rows */ if (stmt->cursor && odbc_lock_statement(stmt)) { TDSCURSOR *cursor = stmt->cursor; TDS_CURSOR_FETCH fetch_type = TDS_CURSOR_FETCH_NEXT; tds = stmt->tds; switch (FetchOrientation) { case SQL_FETCH_NEXT: break; case SQL_FETCH_FIRST: fetch_type = TDS_CURSOR_FETCH_FIRST; break; case SQL_FETCH_LAST: fetch_type = TDS_CURSOR_FETCH_LAST; break; case SQL_FETCH_PRIOR: fetch_type = TDS_CURSOR_FETCH_PREV; break; case SQL_FETCH_ABSOLUTE: fetch_type = TDS_CURSOR_FETCH_ABSOLUTE; break; case SQL_FETCH_RELATIVE: fetch_type = TDS_CURSOR_FETCH_RELATIVE; break; /* TODO cursor bookmark */ default: odbc_errs_add(&stmt->errs, "HYC00", NULL); return SQL_ERROR; } if (cursor->cursor_rows != num_rows) { int send = 0; cursor->cursor_rows = num_rows; /* TODO handle change rows (tds5) */ /* * TODO curerntly we support cursors only using tds7+ * so this function can't fail but remember to add error * check when tds5 will be supported */ tds_cursor_setrows(tds, cursor, &send); } if (TDS_FAILED(tds_cursor_fetch(tds, cursor, fetch_type, FetchOffset))) { /* TODO what kind of error ?? */ ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } /* TODO handle errors in a better way */ odbc_process_tokens(stmt, TDS_RETURN_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_ROW); stmt->row_status = PRE_NORMAL_ROW; } if (!tds && stmt->row_status == PRE_NORMAL_ROW && stmt->ird->header.sql_desc_count > 0) ODBC_RETURN(stmt, SQL_NO_DATA); if (!tds || stmt->row_status == NOT_IN_ROW) { odbc_errs_add(&stmt->errs, "24000", NULL); return SQL_ERROR; } IRD_CHECK; if (stmt->ird->header.sql_desc_count <= 0) { odbc_errs_add(&stmt->errs, "24000", NULL); return SQL_ERROR; } stmt->row++; fetched_ptr = &dummy; if (stmt->ird->header.sql_desc_rows_processed_ptr) fetched_ptr = stmt->ird->header.sql_desc_rows_processed_ptr; *fetched_ptr = 0; status_ptr = stmt->ird->header.sql_desc_array_status_ptr; if (status_ptr) { for (i = 0; i < num_rows; ++i) *status_ptr++ = SQL_ROW_NOROW; status_ptr = stmt->ird->header.sql_desc_array_status_ptr; } curr_row = 0; do { row_status = SQL_ROW_SUCCESS; /* do not get compute row if we are not expecting a compute row */ switch (stmt->row_status) { case AFTER_COMPUTE_ROW: /* handle done if needed */ /* FIXME doesn't seem so fine ... - freddy77 */ tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_TRAILING); goto all_done; case IN_COMPUTE_ROW: /* compute recorset contains only a row */ /* we already fetched compute row in SQLMoreResults so do not fetch another one */ num_rows = 1; stmt->row_status = AFTER_COMPUTE_ROW; break; default: /* FIXME stmt->row_count set correctly ?? TDS_DONE_COUNT not checked */ switch (odbc_process_tokens(stmt, TDS_STOPAT_ROWFMT|TDS_RETURN_ROW|TDS_STOPAT_COMPUTE)) { case TDS_ROW_RESULT: break; default: #if 0 stmt->row_count = tds->rows_affected; #endif /* * NOTE do not set row_status to NOT_IN_ROW, * if compute tds_process_tokens above returns TDS_NO_MORE_RESULTS */ stmt->row_status = PRE_NORMAL_ROW; stmt->special_row = ODBC_SPECIAL_NONE; #if 0 odbc_populate_ird(stmt); #endif tdsdump_log(TDS_DBG_INFO1, "SQLFetch: NO_DATA_FOUND\n"); goto all_done; break; case TDS_CMD_FAIL: ODBC_SAFE_ERROR(stmt); return SQL_ERROR; break; } stmt->row_status = IN_NORMAL_ROW; /* handle special row */ switch (stmt->special_row) { case ODBC_SPECIAL_GETTYPEINFO: odbc_fix_data_type_col(stmt, 1); break; case ODBC_SPECIAL_COLUMNS: odbc_fix_data_type_col(stmt, 4); odbc_fix_data_type_col(stmt, 13); /* TODO sure ?? */ break; case ODBC_SPECIAL_PROCEDURECOLUMNS: odbc_fix_data_type_col(stmt, 5); odbc_fix_data_type_col(stmt, 14); /* TODO sure ?? */ break; case ODBC_SPECIAL_SPECIALCOLUMNS: odbc_fix_data_type_col(stmt, 2); break; case ODBC_SPECIAL_NONE: break; } } resinfo = tds->current_results; if (!resinfo) { tdsdump_log(TDS_DBG_INFO1, "SQLFetch: !resinfo\n"); break; } /* we got a row, return a row readed even if error (for ODBC specifications) */ ++(*fetched_ptr); for (i = 0; i < resinfo->num_cols; i++) { colinfo = resinfo->columns[i]; colinfo->column_text_sqlgetdatapos = 0; colinfo->column_iconv_left = 0; drec_ard = (i < ard->header.sql_desc_count) ? &ard->records[i] : NULL; if (!drec_ard) continue; if (colinfo->column_cur_size < 0) { if (drec_ard->sql_desc_indicator_ptr) { *AT_ROW(drec_ard->sql_desc_indicator_ptr, SQLLEN) = SQL_NULL_DATA; } else if (drec_ard->sql_desc_data_ptr) { odbc_errs_add(&stmt->errs, "22002", NULL); row_status = SQL_ROW_ERROR; break; } continue; } /* set indicator to 0 if data is not null */ if (drec_ard->sql_desc_indicator_ptr) *AT_ROW(drec_ard->sql_desc_indicator_ptr, SQLLEN) = 0; /* TODO what happen to length if no data is returned (drec->sql_desc_data_ptr == NULL) ?? */ len = 0; if (drec_ard->sql_desc_data_ptr) { int c_type; TDS_CHAR *data_ptr = (TDS_CHAR *) drec_ard->sql_desc_data_ptr; colinfo->column_text_sqlgetdatapos = 0; colinfo->column_iconv_left = 0; c_type = drec_ard->sql_desc_concise_type; if (c_type == SQL_C_DEFAULT) c_type = odbc_sql_to_c_type_default(stmt->ird->records[i].sql_desc_concise_type); if (row_offset || curr_row == 0) { data_ptr += row_offset; } else { data_ptr += odbc_get_octet_len(c_type, drec_ard) * curr_row; } len = odbc_tds2sql_col(stmt, colinfo, c_type, data_ptr, drec_ard->sql_desc_octet_length, drec_ard); if (len == SQL_NULL_DATA) { row_status = SQL_ROW_ERROR; break; } if ((c_type == SQL_C_CHAR && len >= drec_ard->sql_desc_octet_length) || (c_type == SQL_C_BINARY && len > drec_ard->sql_desc_octet_length)) { truncated = 1; stmt->errs.lastrc = SQL_SUCCESS_WITH_INFO; } } if (drec_ard->sql_desc_octet_length_ptr) *AT_ROW(drec_ard->sql_desc_octet_length_ptr, SQLLEN) = len; } if (status_ptr) *status_ptr++ = truncated ? SQL_ROW_ERROR : row_status; if (row_status == SQL_ROW_ERROR) { stmt->errs.lastrc = SQL_ERROR; break; } #if SQL_BIND_BY_COLUMN != 0 if (stmt->ard->header.sql_desc_bind_type != SQL_BIND_BY_COLUMN) #endif row_offset += stmt->ard->header.sql_desc_bind_type; } while (++curr_row < num_rows); if (truncated) odbc_errs_add(&stmt->errs, "01004", NULL); all_done: /* TODO cursor correct ?? */ if (stmt->cursor) { tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_TRAILING); odbc_unlock_statement(stmt); } if (*fetched_ptr == 0 && (stmt->errs.lastrc == SQL_SUCCESS || stmt->errs.lastrc == SQL_SUCCESS_WITH_INFO)) ODBC_RETURN(stmt, SQL_NO_DATA); if (stmt->errs.lastrc == SQL_ERROR && (*fetched_ptr > 1 || (*fetched_ptr == 1 && row_status != SQL_ROW_ERROR))) ODBC_RETURN(stmt, SQL_SUCCESS_WITH_INFO); ODBC_RETURN_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLFetch(SQLHSTMT hstmt) { SQLRETURN ret; struct { SQLULEN array_size; SQLULEN *rows_processed_ptr; SQLUSMALLINT *array_status_ptr; } keep; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLFetch(%p)\n", hstmt); keep.array_size = stmt->ard->header.sql_desc_array_size; keep.rows_processed_ptr = stmt->ird->header.sql_desc_rows_processed_ptr; keep.array_status_ptr = stmt->ird->header.sql_desc_array_status_ptr; if (stmt->dbc->env->attr.odbc_version != SQL_OV_ODBC3) { stmt->ard->header.sql_desc_array_size = 1; stmt->ird->header.sql_desc_rows_processed_ptr = NULL; stmt->ird->header.sql_desc_array_status_ptr = NULL; } ret = _SQLFetch(stmt, SQL_FETCH_NEXT, 0); if (stmt->dbc->env->attr.odbc_version != SQL_OV_ODBC3) { stmt->ard->header.sql_desc_array_size = keep.array_size; stmt->ird->header.sql_desc_rows_processed_ptr = keep.rows_processed_ptr; stmt->ird->header.sql_desc_array_status_ptr = keep.array_status_ptr; } ODBC_EXIT(stmt, ret); } #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLFetchScroll(SQLHSTMT hstmt, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset) { ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLFetchScroll(%p, %d, %d)\n", hstmt, FetchOrientation, (int)FetchOffset); if (FetchOrientation != SQL_FETCH_NEXT && !stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "HY106", NULL); ODBC_EXIT_(stmt); } ODBC_EXIT(stmt, _SQLFetch(stmt, FetchOrientation, FetchOffset)); } #endif #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle) { tdsdump_log(TDS_DBG_INFO1, "SQLFreeHandle(%d, %p)\n", HandleType, (void *) Handle); switch (HandleType) { case SQL_HANDLE_STMT: return _SQLFreeStmt(Handle, SQL_DROP, 0); break; case SQL_HANDLE_DBC: return _SQLFreeConnect(Handle); break; case SQL_HANDLE_ENV: return _SQLFreeEnv(Handle); break; case SQL_HANDLE_DESC: return _SQLFreeDesc(Handle); break; } return SQL_ERROR; } static SQLRETURN _SQLFreeConnect(SQLHDBC hdbc) { int i; ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "_SQLFreeConnect(%p)\n", hdbc); tds_close_socket(dbc->tds_socket); /* TODO if connected return error */ tds_free_socket(dbc->tds_socket); odbc_bcp_free_storage(dbc); /* free attributes */ #ifdef TDS_NO_DM tds_dstr_free(&dbc->attr.tracefile); #endif tds_dstr_free(&dbc->attr.current_catalog); tds_dstr_free(&dbc->attr.translate_lib); tds_dstr_zero(&dbc->oldpwd); tds_dstr_free(&dbc->oldpwd); tds_dstr_free(&dbc->dsn); for (i = 0; i < TDS_MAX_APP_DESC; i++) { if (dbc->uad[i]) { desc_free(dbc->uad[i]); } } odbc_errs_reset(&dbc->errs); tds_mutex_unlock(&dbc->mtx); tds_mutex_free(&dbc->mtx); free(dbc); return SQL_SUCCESS; } SQLRETURN ODBC_PUBLIC ODBC_API SQLFreeConnect(SQLHDBC hdbc) { tdsdump_log(TDS_DBG_INFO2, "SQLFreeConnect(%p)\n", hdbc); return _SQLFreeConnect(hdbc); } #endif static SQLRETURN _SQLFreeEnv(SQLHENV henv) { ODBC_ENTER_HENV; tdsdump_log(TDS_DBG_FUNC, "_SQLFreeEnv(%p)\n", henv); odbc_errs_reset(&env->errs); tds_free_context(env->tds_ctx); tds_mutex_unlock(&env->mtx); tds_mutex_free(&env->mtx); free(env); return SQL_SUCCESS; } SQLRETURN ODBC_PUBLIC ODBC_API SQLFreeEnv(SQLHENV henv) { tdsdump_log(TDS_DBG_FUNC, "SQLFreeEnv(%p)\n", henv); return _SQLFreeEnv(henv); } static SQLRETURN _SQLFreeStmt(SQLHSTMT hstmt, SQLUSMALLINT fOption, int force) { TDSSOCKET *tds; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "_SQLFreeStmt(%p, %d, %d)\n", hstmt, fOption, force); /* check if option correct */ if (fOption != SQL_DROP && fOption != SQL_CLOSE && fOption != SQL_UNBIND && fOption != SQL_RESET_PARAMS) { tdsdump_log(TDS_DBG_ERROR, "SQLFreeStmt: Unknown option %d\n", fOption); odbc_errs_add(&stmt->errs, "HY092", NULL); ODBC_EXIT_(stmt); } /* if we have bound columns, free the temporary list */ if (fOption == SQL_DROP || fOption == SQL_UNBIND) { desc_free_records(stmt->ard); } /* do the same for bound parameters */ if (fOption == SQL_DROP || fOption == SQL_RESET_PARAMS) { desc_free_records(stmt->apd); desc_free_records(stmt->ipd); } /* close statement */ if (fOption == SQL_DROP || fOption == SQL_CLOSE) { SQLRETURN retcode; tds = stmt->tds; /* * FIXME -- otherwise make sure the current statement is complete */ /* do not close other running query ! */ if (tds && tds->state != TDS_IDLE && tds->state != TDS_DEAD) { if (TDS_SUCCEED(tds_send_cancel(tds))) tds_process_cancel(tds); } /* free cursor */ retcode = odbc_free_cursor(stmt); if (!force && retcode != SQL_SUCCESS) ODBC_EXIT(stmt, retcode); } /* free it */ if (fOption == SQL_DROP) { SQLRETURN retcode; /* close prepared statement or add to connection */ retcode = odbc_free_dynamic(stmt); if (!force && retcode != SQL_SUCCESS) ODBC_EXIT(stmt, retcode); /* detatch from list */ tds_mutex_lock(&stmt->dbc->mtx); if (stmt->next) stmt->next->prev = stmt->prev; if (stmt->prev) stmt->prev->next = stmt->next; if (stmt->dbc->stmt_list == stmt) stmt->dbc->stmt_list = stmt->next; tds_mutex_unlock(&stmt->dbc->mtx); tds_dstr_free(&stmt->query); tds_free_param_results(stmt->params); odbc_errs_reset(&stmt->errs); odbc_unlock_statement(stmt); tds_dstr_free(&stmt->cursor_name); tds_dstr_free(&stmt->attr.qn_msgtext); tds_dstr_free(&stmt->attr.qn_options); desc_free(stmt->ird); desc_free(stmt->ipd); desc_free(stmt->orig_ard); desc_free(stmt->orig_apd); tds_mutex_unlock(&stmt->mtx); tds_mutex_free(&stmt->mtx); free(stmt); /* NOTE we freed stmt, do not use ODBC_EXIT */ return SQL_SUCCESS; } ODBC_EXIT_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLFreeStmt(SQLHSTMT hstmt, SQLUSMALLINT fOption) { tdsdump_log(TDS_DBG_FUNC, "SQLFreeStmt(%p, %d)\n", hstmt, fOption); return _SQLFreeStmt(hstmt, fOption, 0); } SQLRETURN ODBC_PUBLIC ODBC_API SQLCloseCursor(SQLHSTMT hstmt) { /* TODO cursors */ /* * Basic implementation for when no driver manager is present. * - according to ODBC documentation SQLCloseCursor is more or less * equivalent to SQLFreeStmt(..., SQL_CLOSE). * - indeed that is what the DM does if it can't find the function * in the driver, so this is pretty close. */ /* TODO remember to close cursors really when get implemented */ /* TODO read all results and discard them or use cancellation ?? test behaviour */ tdsdump_log(TDS_DBG_FUNC, "SQLCloseCursor(%p)\n", hstmt); return _SQLFreeStmt(hstmt, SQL_CLOSE, 0); } static SQLRETURN _SQLFreeDesc(SQLHDESC hdesc) { ODBC_ENTER_HDESC; tdsdump_log(TDS_DBG_FUNC, "_SQLFreeDesc(%p)\n", hdesc); if (desc->header.sql_desc_alloc_type != SQL_DESC_ALLOC_USER) { odbc_errs_add(&desc->errs, "HY017", NULL); ODBC_EXIT_(desc); } if (IS_HDBC(desc->parent)) { TDS_DBC *dbc = (TDS_DBC *) desc->parent; TDS_STMT *stmt; int i; /* freeing descriptors associated to statements revert state of statements */ tds_mutex_lock(&dbc->mtx); for (stmt = dbc->stmt_list; stmt != NULL; stmt = stmt->next) { if (stmt->ard == desc) stmt->ard = stmt->orig_ard; if (stmt->apd == desc) stmt->apd = stmt->orig_apd; } tds_mutex_unlock(&dbc->mtx); for (i = 0; i < TDS_MAX_APP_DESC; ++i) { if (dbc->uad[i] == desc) { dbc->uad[i] = NULL; tds_mutex_unlock(&desc->mtx); desc_free(desc); break; } } } return SQL_SUCCESS; } static SQLRETURN _SQLGetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength WIDE) { void *src; size_t size; ODBC_ENTER_HSTMT; /* TODO assign directly, use macro for size */ switch (Attribute) { case SQL_ATTR_APP_PARAM_DESC: size = sizeof(stmt->apd); src = &stmt->apd; break; case SQL_ATTR_APP_ROW_DESC: size = sizeof(stmt->ard); src = &stmt->ard; break; case SQL_ATTR_ASYNC_ENABLE: size = sizeof(stmt->attr.async_enable); src = &stmt->attr.async_enable; break; case SQL_ATTR_CONCURRENCY: size = sizeof(stmt->attr.concurrency); src = &stmt->attr.concurrency; break; case SQL_ATTR_CURSOR_TYPE: size = sizeof(stmt->attr.cursor_type); src = &stmt->attr.cursor_type; break; case SQL_ATTR_ENABLE_AUTO_IPD: size = sizeof(stmt->attr.enable_auto_ipd); src = &stmt->attr.enable_auto_ipd; break; case SQL_ATTR_FETCH_BOOKMARK_PTR: size = sizeof(stmt->attr.fetch_bookmark_ptr); src = &stmt->attr.fetch_bookmark_ptr; break; case SQL_ATTR_KEYSET_SIZE: size = sizeof(stmt->attr.keyset_size); src = &stmt->attr.keyset_size; break; case SQL_ATTR_MAX_LENGTH: size = sizeof(stmt->attr.max_length); src = &stmt->attr.max_length; break; case SQL_ATTR_MAX_ROWS: size = sizeof(stmt->attr.max_rows); src = &stmt->attr.max_rows; break; case SQL_ATTR_METADATA_ID: size = sizeof(stmt->attr.metadata_id); src = &stmt->attr.noscan; break; case SQL_ATTR_NOSCAN: size = sizeof(stmt->attr.noscan); src = &stmt->attr.noscan; break; case SQL_ATTR_PARAM_BIND_OFFSET_PTR: size = sizeof(stmt->apd->header.sql_desc_bind_offset_ptr); src = &stmt->apd->header.sql_desc_bind_offset_ptr; break; case SQL_ATTR_PARAM_BIND_TYPE: size = sizeof(stmt->apd->header.sql_desc_bind_type); src = &stmt->apd->header.sql_desc_bind_type; break; case SQL_ATTR_PARAM_OPERATION_PTR: size = sizeof(stmt->apd->header.sql_desc_array_status_ptr); src = &stmt->apd->header.sql_desc_array_status_ptr; break; case SQL_ATTR_PARAM_STATUS_PTR: size = sizeof(stmt->ipd->header.sql_desc_array_status_ptr); src = &stmt->ipd->header.sql_desc_array_status_ptr; break; case SQL_ATTR_PARAMS_PROCESSED_PTR: size = sizeof(stmt->ipd->header.sql_desc_rows_processed_ptr); src = &stmt->ipd->header.sql_desc_rows_processed_ptr; break; case SQL_ATTR_PARAMSET_SIZE: size = sizeof(stmt->apd->header.sql_desc_array_size); src = &stmt->apd->header.sql_desc_array_size; break; case SQL_ATTR_QUERY_TIMEOUT: size = sizeof(stmt->attr.query_timeout); src = &stmt->attr.query_timeout; break; case SQL_ATTR_RETRIEVE_DATA: size = sizeof(stmt->attr.retrieve_data); src = &stmt->attr.retrieve_data; break; case SQL_ATTR_ROW_BIND_OFFSET_PTR: size = sizeof(stmt->ard->header.sql_desc_bind_offset_ptr); src = &stmt->ard->header.sql_desc_bind_offset_ptr; break; #if SQL_BIND_TYPE != SQL_ATTR_ROW_BIND_TYPE case SQL_BIND_TYPE: /* although this is ODBC2 we must support this attribute */ #endif case SQL_ATTR_ROW_BIND_TYPE: size = sizeof(stmt->ard->header.sql_desc_bind_type); src = &stmt->ard->header.sql_desc_bind_type; break; case SQL_ATTR_ROW_NUMBER: /* TODO do not get info every time, cache somewhere */ if (stmt->cursor && odbc_lock_statement(stmt)) { TDS_UINT row_number, row_count; tds_cursor_get_cursor_info(stmt->tds, stmt->cursor, &row_number, &row_count); stmt->attr.row_number = row_number; } size = sizeof(stmt->attr.row_number); src = &stmt->attr.row_number; break; case SQL_ATTR_ROW_OPERATION_PTR: size = sizeof(stmt->ard->header.sql_desc_array_status_ptr); src = &stmt->ard->header.sql_desc_array_status_ptr; break; case SQL_ATTR_ROW_STATUS_PTR: size = sizeof(stmt->ird->header.sql_desc_array_status_ptr); src = &stmt->ird->header.sql_desc_array_status_ptr; break; case SQL_ATTR_ROWS_FETCHED_PTR: size = sizeof(stmt->ird->header.sql_desc_rows_processed_ptr); src = &stmt->ird->header.sql_desc_rows_processed_ptr; break; case SQL_ATTR_ROW_ARRAY_SIZE: size = sizeof(stmt->ard->header.sql_desc_array_size); src = &stmt->ard->header.sql_desc_array_size; break; case SQL_ATTR_SIMULATE_CURSOR: size = sizeof(stmt->attr.simulate_cursor); src = &stmt->attr.simulate_cursor; break; case SQL_ATTR_USE_BOOKMARKS: size = sizeof(stmt->attr.use_bookmarks); src = &stmt->attr.use_bookmarks; break; case SQL_ATTR_CURSOR_SCROLLABLE: size = sizeof(stmt->attr.cursor_scrollable); src = &stmt->attr.cursor_scrollable; break; case SQL_ATTR_CURSOR_SENSITIVITY: size = sizeof(stmt->attr.cursor_sensitivity); src = &stmt->attr.cursor_sensitivity; break; case SQL_ATTR_IMP_ROW_DESC: size = sizeof(stmt->ird); src = &stmt->ird; break; case SQL_ATTR_IMP_PARAM_DESC: size = sizeof(stmt->ipd); src = &stmt->ipd; break; case SQL_ROWSET_SIZE: /* although this is ODBC2 we must support this attribute */ size = sizeof(stmt->sql_rowset_size); src = &stmt->sql_rowset_size; break; case SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT: size = sizeof(stmt->attr.qn_timeout); src = &stmt->attr.qn_timeout; break; case SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT: { SQLRETURN rc = odbc_set_dstr_oct(stmt->dbc, Value, BufferLength, StringLength, &stmt->attr.qn_msgtext); ODBC_EXIT(stmt, rc); } case SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS: { SQLRETURN rc = odbc_set_dstr_oct(stmt->dbc, Value, BufferLength, StringLength, &stmt->attr.qn_options); ODBC_EXIT(stmt, rc); } /* TODO SQL_COLUMN_SEARCHABLE, although ODBC2 */ default: odbc_errs_add(&stmt->errs, "HY092", NULL); ODBC_EXIT_(stmt); } memcpy(Value, src, size); if (StringLength) *StringLength = size; ODBC_EXIT_(stmt); } #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLGetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength) { tdsdump_log(TDS_DBG_FUNC, "SQLGetStmtAttr(%p, %d, %p, %d, %p)\n", hstmt, (int)Attribute, Value, (int)BufferLength, StringLength); return _SQLGetStmtAttr(hstmt, Attribute, Value, BufferLength, StringLength _wide0); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLGetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength) { tdsdump_log(TDS_DBG_FUNC, "SQLGetStmtAttr(%p, %d, %p, %d, %p)\n", hstmt, (int)Attribute, Value, (int)BufferLength, StringLength); return _SQLGetStmtAttr(hstmt, Attribute, Value, BufferLength, StringLength, 1); } #endif #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetStmtOption(SQLHSTMT hstmt, SQLUSMALLINT fOption, SQLPOINTER pvParam) { tdsdump_log(TDS_DBG_FUNC, "SQLGetStmtOption(%p, %d, %p)\n", hstmt, fOption, pvParam); return _SQLGetStmtAttr(hstmt, (SQLINTEGER) fOption, pvParam, SQL_MAX_OPTION_STRING_LENGTH, NULL _wide0); } SQLRETURN ODBC_PUBLIC ODBC_API SQLNumResultCols(SQLHSTMT hstmt, SQLSMALLINT FAR * pccol) { ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLNumResultCols(%p, %p)\n", hstmt, pccol); /* * 3/15/2001 bsb - DBD::ODBC calls SQLNumResultCols on non-result * generating queries such as 'drop table' */ #if 0 if (stmt->row_status == NOT_IN_ROW) { odbc_errs_add(&stmt->errs, "24000", NULL); ODBC_EXIT_(stmt); } #endif IRD_UPDATE(stmt->ird, &stmt->errs, ODBC_EXIT(stmt, SQL_ERROR)); *pccol = stmt->ird->header.sql_desc_count; ODBC_EXIT_(stmt); } ODBC_FUNC(SQLPrepare, (P(SQLHSTMT,hstmt), PCHARIN(SqlStr,SQLINTEGER) WIDE)) { SQLRETURN retcode; ODBC_ENTER_HSTMT; /* try to free dynamic associated */ retcode = odbc_free_dynamic(stmt); if (retcode != SQL_SUCCESS) ODBC_EXIT(stmt, retcode); if (SQL_SUCCESS != odbc_set_stmt_query(stmt, szSqlStr, cbSqlStr _wide)) ODBC_EXIT(stmt, SQL_ERROR); stmt->is_prepared_query = 1; /* count parameters */ stmt->param_count = tds_count_placeholders(tds_dstr_cstr(&stmt->query)); /* trasform to native (one time, not for every SQLExecute) */ if (SQL_SUCCESS != prepare_call(stmt)) ODBC_EXIT(stmt, SQL_ERROR); /* TODO needed ?? */ tds_release_dynamic(&stmt->dyn); /* try to prepare query */ /* TODO support getting info for RPC */ if (!stmt->prepared_query_is_rpc && (stmt->attr.cursor_type == SQL_CURSOR_FORWARD_ONLY && stmt->attr.concurrency == SQL_CONCUR_READ_ONLY)) { tds_free_param_results(stmt->params); stmt->params = NULL; stmt->param_num = 0; stmt->need_reprepare = 0; /* * using TDS7+ we need parameters to prepare a query so try * to get them * TDS5 do not need parameters type and we have always to * prepare sepatately so this is not an issue */ if (IS_TDS7_PLUS(stmt->dbc->tds_socket->conn)) { stmt->need_reprepare = 1; ODBC_EXIT_(stmt); } tdsdump_log(TDS_DBG_INFO1, "Creating prepared statement\n"); if (odbc_lock_statement(stmt)) odbc_prepare(stmt); } ODBC_EXIT_(stmt); } /* TDS_NO_COUNT must be -1 for SQLRowCount to return -1 when there is no rowcount */ #if TDS_NO_COUNT != -1 # error TDS_NO_COUNT != -1 #endif SQLRETURN _SQLRowCount(SQLHSTMT hstmt, SQLLEN FAR * pcrow) { ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "_SQLRowCount(%p, %p), %ld rows \n", hstmt, pcrow, (long)stmt->row_count); *pcrow = stmt->row_count; ODBC_EXIT_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLRowCount(SQLHSTMT hstmt, SQLLEN FAR * pcrow) { SQLRETURN rc = _SQLRowCount(hstmt, pcrow); tdsdump_log(TDS_DBG_INFO1, "SQLRowCount returns %d, row count %ld\n", rc, (long int) *pcrow); return rc; } ODBC_FUNC(SQLSetCursorName, (P(SQLHSTMT,hstmt), PCHARIN(Cursor,SQLSMALLINT) WIDE)) { ODBC_ENTER_HSTMT; /* cursor already present, we cannot set name */ if (stmt->cursor) { odbc_errs_add(&stmt->errs, "24000", NULL); ODBC_EXIT_(stmt); } if (!odbc_dstr_copy(stmt->dbc, &stmt->cursor_name, cbCursor, szCursor)) { odbc_errs_add(&stmt->errs, "HY001", NULL); ODBC_EXIT_(stmt); } ODBC_EXIT_(stmt); } ODBC_FUNC(SQLGetCursorName, (P(SQLHSTMT,hstmt), PCHAROUT(Cursor,SQLSMALLINT) WIDE)) { SQLRETURN rc; ODBC_ENTER_HSTMT; if ((rc = odbc_set_dstr(stmt->dbc, szCursor, cbCursorMax, pcbCursor, &stmt->cursor_name))) odbc_errs_add(&stmt->errs, "01004", NULL); ODBC_EXIT(stmt, rc); } /* * spinellia@acm.org : copied shamelessly from change_database * transaction support * 1 = commit, 0 = rollback */ static SQLRETURN change_transaction(TDS_DBC * dbc, int state) { TDSSOCKET *tds = dbc->tds_socket; int cont; TDSRET ret; tdsdump_log(TDS_DBG_INFO1, "change_transaction(0x%p,%d)\n", dbc, state); tds_mutex_check_owned(&dbc->mtx); if (dbc->attr.autocommit == SQL_AUTOCOMMIT_ON) return SQL_SUCCESS; cont = 1; /* if pending drop all recordset, don't issue cancel */ if (tds->state == TDS_PENDING && dbc->current_statement != NULL) { /* TODO what happen on multiple errors ?? discard all ?? */ if (TDS_FAILED(tds_process_simple_query(tds))) return SQL_ERROR; } /* TODO better idle check, not thread safe */ if (tds->state == TDS_IDLE) tds->query_timeout = dbc->default_query_timeout; /* reset statement so errors will be reported on connection. * Note that we own the connection lock */ if (dbc->current_statement) { dbc->current_statement->tds = NULL; dbc->current_statement = NULL; } tds_set_parent(tds, dbc); if (state) ret = tds_submit_commit(tds, cont); else ret = tds_submit_rollback(tds, cont); if (TDS_FAILED(ret)) { odbc_errs_add(&dbc->errs, "HY000", "Could not perform COMMIT or ROLLBACK"); return SQL_ERROR; } if (TDS_FAILED(tds_process_simple_query(tds))) return SQL_ERROR; /* TODO some query can collect errors so perhaps it's better to return SUCCES_WITH_INFO in such case... */ return SQL_SUCCESS; } static SQLRETURN _SQLTransact(SQLHENV henv, SQLHDBC hdbc, SQLUSMALLINT fType) { int op = (fType == SQL_COMMIT ? 1 : 0); /* I may live without a HENV */ /* CHECK_HENV; */ /* ..but not without a HDBC! */ ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "_SQLTransact(%p, %p, %d)\n", henv, hdbc, fType); ODBC_EXIT(dbc, change_transaction(dbc, op)); } SQLRETURN ODBC_PUBLIC ODBC_API SQLTransact(SQLHENV henv, SQLHDBC hdbc, SQLUSMALLINT fType) { tdsdump_log(TDS_DBG_FUNC, "SQLTransact(%p, %p, %d)\n", henv, hdbc, fType); return _SQLTransact(henv, hdbc, fType); } #if ODBCVER >= 0x300 SQLRETURN ODBC_PUBLIC ODBC_API SQLEndTran(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT completionType) { /* * Do not call the exported SQLTransact(), * because we may wind up calling a function with the same name implemented by the DM. */ tdsdump_log(TDS_DBG_FUNC, "SQLEndTran(%d, %p, %d)\n", handleType, handle, completionType); switch (handleType) { case SQL_HANDLE_ENV: return _SQLTransact(handle, NULL, completionType); case SQL_HANDLE_DBC: return _SQLTransact(NULL, handle, completionType); } return SQL_ERROR; } #endif /* end of transaction support */ SQLRETURN ODBC_PUBLIC ODBC_API SQLSetParam(SQLHSTMT hstmt, SQLUSMALLINT ipar, SQLSMALLINT fCType, SQLSMALLINT fSqlType, SQLULEN cbParamDef, SQLSMALLINT ibScale, SQLPOINTER rgbValue, SQLLEN FAR * pcbValue) { tdsdump_log(TDS_DBG_FUNC, "SQLSetParam(%p, %d, %d, %d, %u, %d, %p, %p)\n", hstmt, ipar, fCType, fSqlType, (unsigned)cbParamDef, ibScale, rgbValue, pcbValue); return _SQLBindParameter(hstmt, ipar, SQL_PARAM_INPUT_OUTPUT, fCType, fSqlType, cbParamDef, ibScale, rgbValue, SQL_SETPARAM_VALUE_MAX, pcbValue); } /** * SQLColumns * * Return column information for a table or view. This is * mapped to a call to sp_columns which - lucky for us - returns * the exact result set we need. * * exec sp_columns [ @table_name = ] object * [ , [ @table_owner = ] owner ] * [ , [ @table_qualifier = ] qualifier ] * [ , [ @column_name = ] column ] * [ , [ @ODBCVer = ] ODBCVer ] * */ ODBC_FUNC(SQLColumns, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), /* object_qualifier */ PCHARIN(SchemaName,SQLSMALLINT), /* object_owner */ PCHARIN(TableName,SQLSMALLINT), /* object_name */ PCHARIN(ColumnName,SQLSMALLINT) /* column_name */ WIDE)) { int retcode; const char *proc = "sp_columns"; ODBC_ENTER_HSTMT; if (odbc_get_string_size(cbCatalogName, szCatalogName _wide)) proc = "..sp_columns"; retcode = odbc_stat_execute(stmt _wide, proc, TDS_IS_MSSQL(stmt->dbc->tds_socket) ? 5 : 4, "P@table_name", szTableName, cbTableName, "P@table_owner", szSchemaName, cbSchemaName, "O@table_qualifier", szCatalogName, cbCatalogName, "P@column_name", szColumnName, cbColumnName, "V@ODBCVer", (char*) NULL, 0); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "TABLE_CAT"); odbc_col_setname(stmt, 2, "TABLE_SCHEM"); odbc_col_setname(stmt, 7, "COLUMN_SIZE"); odbc_col_setname(stmt, 8, "BUFFER_LENGTH"); odbc_col_setname(stmt, 9, "DECIMAL_DIGITS"); odbc_col_setname(stmt, 10, "NUM_PREC_RADIX"); if (TDS_IS_SYBASE(stmt->dbc->tds_socket)) stmt->special_row = ODBC_SPECIAL_COLUMNS; } ODBC_EXIT_(stmt); } ODBC_FUNC(SQLGetConnectAttr, (P(SQLHDBC,hdbc), P(SQLINTEGER,Attribute), P(SQLPOINTER,Value), P(SQLINTEGER,BufferLength), P(SQLINTEGER *,StringLength) WIDE)) { const char *p = NULL; ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "_SQLGetConnectAttr(%p, %d, %p, %d, %p)\n", hdbc, (int)Attribute, Value, (int)BufferLength, StringLength); switch (Attribute) { case SQL_ATTR_AUTOCOMMIT: *((SQLUINTEGER *) Value) = dbc->attr.autocommit; break; #if defined(SQL_ATTR_CONNECTION_DEAD) && defined(SQL_CD_TRUE) case SQL_ATTR_CONNECTION_DEAD: *((SQLUINTEGER *) Value) = IS_TDSDEAD(dbc->tds_socket) ? SQL_CD_TRUE : SQL_CD_FALSE; break; #endif case SQL_ATTR_CONNECTION_TIMEOUT: *((SQLUINTEGER *) Value) = dbc->attr.connection_timeout; break; case SQL_ATTR_ACCESS_MODE: *((SQLUINTEGER *) Value) = dbc->attr.access_mode; break; case SQL_ATTR_CURRENT_CATALOG: p = tds_dstr_cstr(&dbc->attr.current_catalog); break; case SQL_ATTR_LOGIN_TIMEOUT: *((SQLUINTEGER *) Value) = dbc->attr.login_timeout; break; case SQL_ATTR_ODBC_CURSORS: *((SQLUINTEGER *) Value) = dbc->attr.odbc_cursors; break; case SQL_ATTR_PACKET_SIZE: *((SQLUINTEGER *) Value) = dbc->attr.packet_size; break; case SQL_ATTR_QUIET_MODE: *((SQLHWND *) Value) = dbc->attr.quite_mode; break; #ifdef TDS_NO_DM case SQL_ATTR_TRACE: *((SQLUINTEGER *) Value) = dbc->attr.trace; break; case SQL_ATTR_TRACEFILE: p = tds_dstr_cstr(&dbc->attr.tracefile); break; #endif case SQL_ATTR_TXN_ISOLATION: *((SQLUINTEGER *) Value) = dbc->attr.txn_isolation; break; case SQL_COPT_SS_MARS_ENABLED: *((SQLUINTEGER *) Value) = dbc->attr.mars_enabled; break; case SQL_ATTR_TRANSLATE_LIB: case SQL_ATTR_TRANSLATE_OPTION: odbc_errs_add(&dbc->errs, "HYC00", NULL); break; case SQL_COPT_SS_BCP: *((SQLUINTEGER *) Value) = dbc->attr.bulk_enabled; break; default: odbc_errs_add(&dbc->errs, "HY092", NULL); break; } if (p) { SQLRETURN rc = odbc_set_string_oct(dbc, Value, BufferLength, StringLength, p, -1); ODBC_EXIT(dbc, rc); } ODBC_EXIT_(dbc); } SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectOption(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLPOINTER pvParam) { tdsdump_log(TDS_DBG_FUNC, "SQLGetConnectOption(%p, %u, %p)\n", hdbc, fOption, pvParam); return _SQLGetConnectAttr(hdbc, (SQLINTEGER) fOption, pvParam, SQL_MAX_OPTION_STRING_LENGTH, NULL _wide0); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectOptionW(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLPOINTER pvParam) { tdsdump_log(TDS_DBG_FUNC, "SQLGetConnectOptionW(%p, %u, %p)\n", hdbc, fOption, pvParam); return _SQLGetConnectAttr(hdbc, (SQLINTEGER) fOption, pvParam, SQL_MAX_OPTION_STRING_LENGTH, NULL, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgbValue, SQLLEN cbValueMax, SQLLEN FAR * pcbValue) { /* TODO cursors fetch row if needed ?? */ TDSCOLUMN *colinfo; TDSRESULTINFO *resinfo; SQLLEN dummy_cb; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLGetData(%p, %u, %d, %p, %d, %p)\n", hstmt, icol, fCType, rgbValue, (int)cbValueMax, pcbValue); if (cbValueMax < 0) { odbc_errs_add(&stmt->errs, "HY090", NULL); ODBC_EXIT_(stmt); } /* read data from TDS only if current statement */ if ((stmt->cursor == NULL && !stmt->tds) || stmt->row_status == PRE_NORMAL_ROW || stmt->row_status == NOT_IN_ROW) { odbc_errs_add(&stmt->errs, "24000", NULL); ODBC_EXIT_(stmt); } IRD_CHECK; if (!pcbValue) pcbValue = &dummy_cb; resinfo = stmt->cursor ? stmt->cursor->res_info : stmt->tds->current_results; if (!resinfo) { odbc_errs_add(&stmt->errs, "HY010", NULL); ODBC_EXIT_(stmt); } if (icol <= 0 || icol > resinfo->num_cols) { odbc_errs_add(&stmt->errs, "07009", "Column out of range"); ODBC_EXIT_(stmt); } colinfo = resinfo->columns[icol - 1]; if (colinfo->column_cur_size < 0) { /* TODO check what should happen if pcbValue was NULL */ *pcbValue = SQL_NULL_DATA; } else { if (colinfo->column_text_sqlgetdatapos > 0 && colinfo->column_text_sqlgetdatapos >= colinfo->column_cur_size && colinfo->column_iconv_left == 0) /* TODO check if SQL_SUCCESS instead !! */ ODBC_EXIT(stmt, SQL_NO_DATA); if (!is_variable_type(colinfo->column_type)) { colinfo->column_text_sqlgetdatapos = 0; colinfo->column_iconv_left = 0; } if (fCType == SQL_C_DEFAULT) fCType = odbc_sql_to_c_type_default(stmt->ird->records[icol - 1].sql_desc_concise_type); if (fCType == SQL_ARD_TYPE) { if (icol > stmt->ard->header.sql_desc_count) { odbc_errs_add(&stmt->errs, "07009", NULL); ODBC_EXIT_(stmt); } fCType = stmt->ard->records[icol - 1].sql_desc_concise_type; } assert(fCType); *pcbValue = odbc_tds2sql_col(stmt, colinfo, fCType, (TDS_CHAR *) rgbValue, cbValueMax, NULL); if (*pcbValue == SQL_NULL_DATA) ODBC_EXIT(stmt, SQL_ERROR); if (is_variable_type(colinfo->column_type) && (fCType == SQL_C_CHAR || fCType == SQL_C_WCHAR || fCType == SQL_C_BINARY)) { /* avoid infinite SQL_SUCCESS on empty strings */ if (colinfo->column_text_sqlgetdatapos == 0 && cbValueMax > 0) ++colinfo->column_text_sqlgetdatapos; if (colinfo->column_text_sqlgetdatapos < colinfo->column_cur_size || colinfo->column_iconv_left != 0) { /* not all read ?? */ odbc_errs_add(&stmt->errs, "01004", "String data, right truncated"); ODBC_EXIT_(stmt); } } else { int nSybType = tds_get_conversion_type(colinfo->on_server.column_type, colinfo->on_server.column_size); colinfo->column_text_sqlgetdatapos = colinfo->column_cur_size; if (is_fixed_type(nSybType) && (fCType == SQL_C_CHAR || fCType == SQL_C_WCHAR || fCType == SQL_C_BINARY) && cbValueMax < *pcbValue) { odbc_errs_add(&stmt->errs, "22003", NULL); ODBC_EXIT_(stmt); } } } ODBC_EXIT_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLGetFunctions(SQLHDBC hdbc, SQLUSMALLINT fFunction, SQLUSMALLINT FAR * pfExists) { int i; ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "SQLGetFunctions: fFunction is %d\n", fFunction); switch (fFunction) { #if (ODBCVER >= 0x0300) case SQL_API_ODBC3_ALL_FUNCTIONS: for (i = 0; i < SQL_API_ODBC3_ALL_FUNCTIONS_SIZE; ++i) { pfExists[i] = 0; } /* * every api available are contained in a macro * all these macro begin with API followed by 2 letter * first letter mean pre ODBC 3 (_) or ODBC 3 (3) * second letter mean implemented (X) or unimplemented (_) * You should copy these macro 3 times... not very good * but works. Perhaps best method is build the bit array statically * and then use it but I don't know how to build it... */ #undef ODBC_ALL_API #undef ODBC_COLATTRIBUTE #if SQL_API_SQLCOLATTRIBUTE != SQL_API_SQLCOLATTRIBUTES #define ODBC_COLATTRIBUTE(s) s #else #define ODBC_COLATTRIBUTE(s) #endif #define ODBC_ALL_API \ API_X(SQL_API_SQLALLOCCONNECT)\ API_X(SQL_API_SQLALLOCENV)\ API3X(SQL_API_SQLALLOCHANDLE)\ API_X(SQL_API_SQLALLOCSTMT)\ API_X(SQL_API_SQLBINDCOL)\ API_X(SQL_API_SQLBINDPARAM)\ API_X(SQL_API_SQLBINDPARAMETER)\ API__(SQL_API_SQLBROWSECONNECT)\ API3_(SQL_API_SQLBULKOPERATIONS)\ API_X(SQL_API_SQLCANCEL)\ API3X(SQL_API_SQLCLOSECURSOR)\ ODBC_COLATTRIBUTE(API3X(SQL_API_SQLCOLATTRIBUTE))\ API_X(SQL_API_SQLCOLATTRIBUTES)\ API_X(SQL_API_SQLCOLUMNPRIVILEGES)\ API_X(SQL_API_SQLCOLUMNS)\ API_X(SQL_API_SQLCONNECT)\ API3X(SQL_API_SQLCOPYDESC)\ API_X(SQL_API_SQLDESCRIBECOL)\ API__(SQL_API_SQLDESCRIBEPARAM)\ API_X(SQL_API_SQLDISCONNECT)\ API_X(SQL_API_SQLDRIVERCONNECT)\ API3X(SQL_API_SQLENDTRAN)\ API_X(SQL_API_SQLERROR)\ API_X(SQL_API_SQLEXECDIRECT)\ API_X(SQL_API_SQLEXECUTE)\ API_X(SQL_API_SQLEXTENDEDFETCH)\ API_X(SQL_API_SQLFETCH)\ API3X(SQL_API_SQLFETCHSCROLL)\ API_X(SQL_API_SQLFOREIGNKEYS)\ API_X(SQL_API_SQLFREECONNECT)\ API_X(SQL_API_SQLFREEENV)\ API3X(SQL_API_SQLFREEHANDLE)\ API_X(SQL_API_SQLFREESTMT)\ API3X(SQL_API_SQLGETCONNECTATTR)\ API_X(SQL_API_SQLGETCONNECTOPTION)\ API_X(SQL_API_SQLGETCURSORNAME)\ API_X(SQL_API_SQLGETDATA)\ API3X(SQL_API_SQLGETDESCFIELD)\ API3X(SQL_API_SQLGETDESCREC)\ API3X(SQL_API_SQLGETDIAGFIELD)\ API3X(SQL_API_SQLGETDIAGREC)\ API3X(SQL_API_SQLGETENVATTR)\ API_X(SQL_API_SQLGETFUNCTIONS)\ API_X(SQL_API_SQLGETINFO)\ API3X(SQL_API_SQLGETSTMTATTR)\ API_X(SQL_API_SQLGETSTMTOPTION)\ API_X(SQL_API_SQLGETTYPEINFO)\ API_X(SQL_API_SQLMORERESULTS)\ API_X(SQL_API_SQLNATIVESQL)\ API_X(SQL_API_SQLNUMPARAMS)\ API_X(SQL_API_SQLNUMRESULTCOLS)\ API_X(SQL_API_SQLPARAMDATA)\ API_X(SQL_API_SQLPARAMOPTIONS)\ API_X(SQL_API_SQLPREPARE)\ API_X(SQL_API_SQLPRIMARYKEYS)\ API_X(SQL_API_SQLPROCEDURECOLUMNS)\ API_X(SQL_API_SQLPROCEDURES)\ API_X(SQL_API_SQLPUTDATA)\ API_X(SQL_API_SQLROWCOUNT)\ API3X(SQL_API_SQLSETCONNECTATTR)\ API_X(SQL_API_SQLSETCONNECTOPTION)\ API_X(SQL_API_SQLSETCURSORNAME)\ API3X(SQL_API_SQLSETDESCFIELD)\ API3X(SQL_API_SQLSETDESCREC)\ API3X(SQL_API_SQLSETENVATTR)\ API_X(SQL_API_SQLSETPARAM)\ API_X(SQL_API_SQLSETPOS)\ API_X(SQL_API_SQLSETSCROLLOPTIONS)\ API3X(SQL_API_SQLSETSTMTATTR)\ API_X(SQL_API_SQLSETSTMTOPTION)\ API_X(SQL_API_SQLSPECIALCOLUMNS)\ API_X(SQL_API_SQLSTATISTICS)\ API_X(SQL_API_SQLTABLEPRIVILEGES)\ API_X(SQL_API_SQLTABLES)\ API_X(SQL_API_SQLTRANSACT) #define API_X(n) if (n >= 0 && n < (16*SQL_API_ODBC3_ALL_FUNCTIONS_SIZE)) pfExists[n/16] |= (1 << n%16); #define API__(n) #define API3X(n) if (n >= 0 && n < (16*SQL_API_ODBC3_ALL_FUNCTIONS_SIZE)) pfExists[n/16] |= (1 << n%16); #define API3_(n) ODBC_ALL_API #undef API_X #undef API__ #undef API3X #undef API3_ break; #endif case SQL_API_ALL_FUNCTIONS: tdsdump_log(TDS_DBG_FUNC, "SQLGetFunctions: " "fFunction is SQL_API_ALL_FUNCTIONS\n"); for (i = 0; i < 100; ++i) { pfExists[i] = SQL_FALSE; } #define API_X(n) if (n >= 0 && n < 100) pfExists[n] = SQL_TRUE; #define API__(n) #define API3X(n) #define API3_(n) ODBC_ALL_API #undef API_X #undef API__ #undef API3X #undef API3_ break; #define API_X(n) case n: #define API__(n) #if (ODBCVER >= 0x300) #define API3X(n) case n: #else #define API3X(n) #endif #define API3_(n) ODBC_ALL_API #undef API_X #undef API__ #undef API3X #undef API3_ *pfExists = SQL_TRUE; break; default: *pfExists = SQL_FALSE; break; } ODBC_EXIT(dbc, SQL_SUCCESS); #undef ODBC_ALL_API } static SQLRETURN _SQLGetInfo(TDS_DBC * dbc, SQLUSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLSMALLINT cbInfoValueMax, SQLSMALLINT FAR * pcbInfoValue _WIDE) { const char *p = NULL; char buf[32]; TDSSOCKET *tds; int is_ms = -1; unsigned int smajor = 6; SQLUINTEGER mssql7plus_mask = 0; int out_len = -1; tdsdump_log(TDS_DBG_FUNC, "_SQLGetInfo(%p, %u, %p, %d, %p)\n", dbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue); #define SIVAL out_len = sizeof(SQLSMALLINT), *((SQLSMALLINT *) rgbInfoValue) #define USIVAL out_len = sizeof(SQLUSMALLINT), *((SQLUSMALLINT *) rgbInfoValue) #define IVAL out_len = sizeof(SQLINTEGER), *((SQLINTEGER *) rgbInfoValue) #define UIVAL out_len = sizeof(SQLUINTEGER), *((SQLUINTEGER *) rgbInfoValue) #define ULVAL out_len = sizeof(SQLULEN), *((SQLULEN *) rgbInfoValue) if ((tds = dbc->tds_socket) != NULL) { is_ms = TDS_IS_MSSQL(tds); smajor = (tds->conn->product_version >> 24) & 0x7F; if (is_ms && smajor >= 7) mssql7plus_mask = ~((SQLUINTEGER) 0); } switch (fInfoType) { case SQL_ACCESSIBLE_PROCEDURES: case SQL_ACCESSIBLE_TABLES: p = "Y"; break; /* SQL_ACTIVE_CONNECTIONS renamed to SQL_MAX_DRIVER_CONNECTIONS */ #if (ODBCVER >= 0x0300) case SQL_ACTIVE_ENVIRONMENTS: UIVAL = 0; break; #endif /* ODBCVER >= 0x0300 */ #if (ODBCVER >= 0x0300) case SQL_AGGREGATE_FUNCTIONS: UIVAL = SQL_AF_ALL; break; case SQL_ALTER_DOMAIN: UIVAL = 0; break; #endif /* ODBCVER >= 0x0300 */ case SQL_ALTER_TABLE: UIVAL = SQL_AT_ADD_COLUMN | SQL_AT_ADD_COLUMN_DEFAULT | SQL_AT_ADD_COLUMN_SINGLE | SQL_AT_ADD_CONSTRAINT | SQL_AT_ADD_TABLE_CONSTRAINT | SQL_AT_CONSTRAINT_NAME_DEFINITION | SQL_AT_DROP_COLUMN_RESTRICT; break; #if (ODBCVER >= 0x0300) case SQL_ASYNC_MODE: /* TODO we hope so in a not-too-far future */ /* UIVAL = SQL_AM_STATEMENT; */ UIVAL = SQL_AM_NONE; break; case SQL_BATCH_ROW_COUNT: UIVAL = SQL_BRC_EXPLICIT; break; case SQL_BATCH_SUPPORT: UIVAL = SQL_BS_ROW_COUNT_EXPLICIT | SQL_BS_ROW_COUNT_PROC | SQL_BS_SELECT_EXPLICIT | SQL_BS_SELECT_PROC; break; #endif /* ODBCVER >= 0x0300 */ case SQL_BOOKMARK_PERSISTENCE: /* TODO ??? */ UIVAL = SQL_BP_DELETE | SQL_BP_SCROLL | SQL_BP_UPDATE; break; case SQL_CATALOG_LOCATION: SIVAL = SQL_CL_START; break; #if (ODBCVER >= 0x0300) case SQL_CATALOG_NAME: p = "Y"; break; #endif /* ODBCVER >= 0x0300 */ case SQL_CATALOG_NAME_SEPARATOR: p = "."; break; case SQL_CATALOG_TERM: p = "database"; break; case SQL_CATALOG_USAGE: UIVAL = SQL_CU_DML_STATEMENTS | SQL_CU_PROCEDURE_INVOCATION | SQL_CU_TABLE_DEFINITION; break; /* TODO */ #if 0 case SQL_COLLATION_SEQ: break; #endif case SQL_COLUMN_ALIAS: p = "Y"; break; case SQL_CONCAT_NULL_BEHAVIOR: if (is_ms == -1) return SQL_ERROR; /* TODO a bit more complicate for mssql2k.. */ SIVAL = (!is_ms || smajor < 7) ? SQL_CB_NON_NULL : SQL_CB_NULL; break; /* TODO SQL_CONVERT_BIGINT SQL_CONVERT_GUID SQL_CONVERT_DATE SQL_CONVERT_TIME */ /* For Sybase/MSSql6.x we return 0 cause NativeSql is not so implemented */ case SQL_CONVERT_BINARY: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_TINYINT | SQL_CVT_LONGVARBINARY | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_BIT: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_CHAR: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_TIMESTAMP | SQL_CVT_LONGVARBINARY | SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_DECIMAL: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_FLOAT: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_INTEGER: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_LONGVARCHAR: UIVAL = (SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_NUMERIC: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_REAL: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_SMALLINT: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_TIMESTAMP: UIVAL = (SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_TIMESTAMP | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_TINYINT: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_VARBINARY: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_VARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_TINYINT | SQL_CVT_LONGVARBINARY | SQL_CVT_WCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_VARCHAR: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_TIMESTAMP | SQL_CVT_LONGVARBINARY | SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_LONGVARBINARY: UIVAL = (SQL_CVT_BINARY | SQL_CVT_LONGVARBINARY | SQL_CVT_VARBINARY) & mssql7plus_mask; break; case SQL_CONVERT_WLONGVARCHAR: UIVAL = (SQL_CVT_CHAR | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; #if (ODBCVER >= 0x0300) case SQL_CONVERT_WCHAR: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_TIMESTAMP | SQL_CVT_LONGVARBINARY | SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; case SQL_CONVERT_WVARCHAR: UIVAL = (SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL | SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT | SQL_CVT_REAL | SQL_CVT_VARCHAR | SQL_CVT_LONGVARCHAR | SQL_CVT_BINARY | SQL_CVT_VARBINARY | SQL_CVT_BIT | SQL_CVT_TINYINT | SQL_CVT_TIMESTAMP | SQL_CVT_LONGVARBINARY | SQL_CVT_WCHAR | SQL_CVT_WLONGVARCHAR | SQL_CVT_WVARCHAR) & mssql7plus_mask; break; #endif /* ODBCVER >= 0x0300 */ case SQL_CONVERT_FUNCTIONS: /* TODO no CAST for Sybase ?? */ UIVAL = SQL_FN_CVT_CONVERT | SQL_FN_CVT_CAST; break; #if (ODBCVER >= 0x0300) case SQL_CREATE_ASSERTION: case SQL_CREATE_CHARACTER_SET: case SQL_CREATE_COLLATION: case SQL_CREATE_DOMAIN: UIVAL = 0; break; case SQL_CREATE_SCHEMA: UIVAL = SQL_CS_AUTHORIZATION | SQL_CS_CREATE_SCHEMA; break; case SQL_CREATE_TABLE: UIVAL = SQL_CT_CREATE_TABLE; break; case SQL_CREATE_TRANSLATION: UIVAL = 0; break; case SQL_CREATE_VIEW: UIVAL = SQL_CV_CHECK_OPTION | SQL_CV_CREATE_VIEW; break; #endif /* ODBCVER >= 0x0300 */ case SQL_CORRELATION_NAME: USIVAL = SQL_CN_ANY; break; case SQL_CURSOR_COMMIT_BEHAVIOR: /* currently cursors are not supported however sql server close automaticly cursors on commit */ /* TODO cursors test what happen if rollback, cursors get properly deleted ?? */ USIVAL = SQL_CB_CLOSE; break; case SQL_CURSOR_ROLLBACK_BEHAVIOR: USIVAL = SQL_CB_CLOSE; break; case SQL_CURSOR_SENSITIVITY: UIVAL = SQL_SENSITIVE; break; case SQL_DATABASE_NAME: p = tds_dstr_cstr(&dbc->attr.current_catalog); break; case SQL_DATA_SOURCE_NAME: p = tds_dstr_cstr(&dbc->dsn); break; case SQL_DATA_SOURCE_READ_ONLY: /* * TODO: determine the right answer from connection * attribute SQL_ATTR_ACCESS_MODE */ p = "N"; /* false, writable */ break; #if (ODBCVER >= 0x0300) case SQL_DATETIME_LITERALS: /* TODO ok ?? */ UIVAL = 0; break; #endif /* ODBCVER >= 0x0300 */ case SQL_DBMS_NAME: p = tds ? tds->conn->product_name : NULL; break; case SQL_DBMS_VER: if (!dbc->tds_socket) return SQL_ERROR; odbc_rdbms_version(dbc->tds_socket, buf); p = buf; break; #if (ODBCVER >= 0x0300) case SQL_DDL_INDEX: UIVAL = 0; break; #endif /* ODBCVER >= 0x0300 */ case SQL_DEFAULT_TXN_ISOLATION: UIVAL = SQL_TXN_READ_COMMITTED; break; #if (ODBCVER >= 0x0300) case SQL_DESCRIBE_PARAMETER: /* TODO */ p = "N"; break; #endif /* ODBCVER >= 0x0300 */ case SQL_DRIVER_HDBC: ULVAL = (SQLULEN) dbc; break; case SQL_DRIVER_HENV: ULVAL = (SQLULEN) dbc->env; break; case SQL_DRIVER_HSTMT: ULVAL = (SQLULEN) dbc->current_statement; break; case SQL_DRIVER_NAME: /* ODBC 2.0 */ p = "libtdsodbc.so"; break; case SQL_DRIVER_ODBC_VER: p = "03.50"; break; case SQL_DRIVER_VER: sprintf(buf, "%02d.%02d.%04d", TDS_VERSION_MAJOR, TDS_VERSION_MINOR, TDS_VERSION_SUBVERSION); p = buf; break; #if (ODBCVER >= 0x0300) case SQL_DROP_ASSERTION: case SQL_DROP_CHARACTER_SET: case SQL_DROP_COLLATION: case SQL_DROP_DOMAIN: case SQL_DROP_SCHEMA: UIVAL = 0; break; case SQL_DROP_TABLE: UIVAL = SQL_DT_DROP_TABLE; break; case SQL_DROP_TRANSLATION: UIVAL = 0; break; case SQL_DROP_VIEW: UIVAL = SQL_DV_DROP_VIEW; break; case SQL_DYNAMIC_CURSOR_ATTRIBUTES1: if (dbc->cursor_support) /* TODO cursor SQL_CA1_BULK_ADD SQL_CA1_POS_REFRESH SQL_CA1_SELECT_FOR_UPDATE */ UIVAL = SQL_CA1_ABSOLUTE | SQL_CA1_NEXT | SQL_CA1_RELATIVE | SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_DELETE | SQL_CA1_POS_POSITION | SQL_CA1_POS_UPDATE | SQL_CA1_POSITIONED_UPDATE | SQL_CA1_POSITIONED_DELETE; else UIVAL = 0; break; case SQL_DYNAMIC_CURSOR_ATTRIBUTES2: /* TODO cursors */ /* Cursors not supported yet */ /* * Should be SQL_CA2_LOCK_CONCURRENCY SQL_CA2_MAX_ROWS_CATALOG SQL_CA2_MAX_ROWS_DELETE * SQL_CA2_MAX_ROWS_INSERT SQL_CA2_MAX_ROWS_SELECT SQL_CA2_MAX_ROWS_UPDATE SQL_CA2_OPT_ROWVER_CONCURRENCY * SQL_CA2_OPT_VALUES_CONCURRENCY SQL_CA2_READ_ONLY_CONCURRENCY SQL_CA2_SENSITIVITY_ADDITIONS * SQL_CA2_SENSITIVITY_UPDATES SQL_CA2_SIMULATE_UNIQUE */ UIVAL = 0; break; #endif /* ODBCVER >= 0x0300 */ case SQL_EXPRESSIONS_IN_ORDERBY: p = "Y"; break; case SQL_FILE_USAGE: USIVAL = SQL_FILE_NOT_SUPPORTED; break; case SQL_FETCH_DIRECTION: if (dbc->cursor_support) /* TODO cursors SQL_FD_FETCH_BOOKMARK */ UIVAL = SQL_FD_FETCH_ABSOLUTE|SQL_FD_FETCH_FIRST|SQL_FD_FETCH_LAST|SQL_FD_FETCH_NEXT|SQL_FD_FETCH_PRIOR|SQL_FD_FETCH_RELATIVE; else UIVAL = 0; break; #if (ODBCVER >= 0x0300) case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1: if (dbc->cursor_support) /* TODO cursors SQL_CA1_SELECT_FOR_UPDATE */ UIVAL = SQL_CA1_NEXT|SQL_CA1_POSITIONED_DELETE|SQL_CA1_POSITIONED_UPDATE; else UIVAL = 0; break; case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2: /* TODO cursors */ /* Cursors not supported yet */ /* * Should be SQL_CA2_LOCK_CONCURRENCY SQL_CA2_MAX_ROWS_CATALOG SQL_CA2_MAX_ROWS_DELETE * SQL_CA2_MAX_ROWS_INSERT SQL_CA2_MAX_ROWS_SELECT SQL_CA2_MAX_ROWS_UPDATE SQL_CA2_OPT_ROWVER_CONCURRENCY * SQL_CA2_OPT_VALUES_CONCURRENCY SQL_CA2_READ_ONLY_CONCURRENCY */ UIVAL = 0; break; #endif /* ODBCVER >= 0x0300 */ case SQL_GETDATA_EXTENSIONS: /* TODO FreeTDS support more ?? */ UIVAL = SQL_GD_BLOCK; break; case SQL_GROUP_BY: USIVAL = SQL_GB_GROUP_BY_CONTAINS_SELECT; break; case SQL_IDENTIFIER_CASE: /* TODO configuration dependend */ USIVAL = SQL_IC_MIXED; break; case SQL_IDENTIFIER_QUOTE_CHAR: p = "\""; /* TODO workaround for Sybase, use SET QUOTED_IDENTIFIER ON and fix unwanted quote */ if (!is_ms) p = ""; break; #if (ODBCVER >= 0x0300) case SQL_INDEX_KEYWORDS: UIVAL = SQL_IK_ASC | SQL_IK_DESC; break; #endif /* ODBCVER >= 0x0300 */ case SQL_INFO_SCHEMA_VIEWS: /* TODO finish */ UIVAL = 0; break; case SQL_INSERT_STATEMENT: UIVAL = 0; break; /* renamed from SQL_ODBC_SQL_OPT_IEF */ case SQL_INTEGRITY: p = "Y"; break; case SQL_KEYSET_CURSOR_ATTRIBUTES1: case SQL_KEYSET_CURSOR_ATTRIBUTES2: /* TODO cursors */ UIVAL = 0; break; case SQL_KEYWORDS: /* TODO ok for Sybase ? */ p = "BREAK,BROWSE,BULK,CHECKPOINT,CLUSTERED," "COMMITTED,COMPUTE,CONFIRM,CONTROLROW,DATABASE," "DBCC,DISK,DISTRIBUTED,DUMMY,DUMP,ERRLVL," "ERROREXIT,EXIT,FILE,FILLFACTOR,FLOPPY,HOLDLOCK," "IDENTITY_INSERT,IDENTITYCOL,IF,KILL,LINENO," "LOAD,MIRROREXIT,NONCLUSTERED,OFF,OFFSETS,ONCE," "OVER,PERCENT,PERM,PERMANENT,PLAN,PRINT,PROC," "PROCESSEXIT,RAISERROR,READ,READTEXT,RECONFIGURE," "REPEATABLE,RETURN,ROWCOUNT,RULE,SAVE,SERIALIZABLE," "SETUSER,SHUTDOWN,STATISTICS,TAPE,TEMP,TEXTSIZE," "TRAN,TRIGGER,TRUNCATE,TSEQUEL,UNCOMMITTED," "UPDATETEXT,USE,WAITFOR,WHILE,WRITETEXT"; break; case SQL_LIKE_ESCAPE_CLAUSE: p = "Y"; break; case SQL_LOCK_TYPES: if (dbc->cursor_support) IVAL = SQL_LCK_NO_CHANGE; else IVAL = 0; break; #if (ODBCVER >= 0x0300) case SQL_MAX_ASYNC_CONCURRENT_STATEMENTS: UIVAL = 1; break; #endif /* ODBCVER >= 0x0300 */ /* TODO same limits for Sybase ? */ case SQL_MAX_BINARY_LITERAL_LEN: UIVAL = 131072; break; case SQL_MAX_CHAR_LITERAL_LEN: UIVAL = 131072; break; case SQL_MAX_CONCURRENT_ACTIVITIES: USIVAL = 1; break; case SQL_MAX_COLUMNS_IN_GROUP_BY: case SQL_MAX_COLUMNS_IN_INDEX: case SQL_MAX_COLUMNS_IN_ORDER_BY: /* TODO Sybase ? */ USIVAL = 16; break; case SQL_MAX_COLUMNS_IN_SELECT: /* TODO Sybase ? */ USIVAL = 4000; break; case SQL_MAX_COLUMNS_IN_TABLE: /* TODO Sybase ? */ USIVAL = 250; break; case SQL_MAX_DRIVER_CONNECTIONS: USIVAL = 0; break; case SQL_MAX_IDENTIFIER_LEN: if (is_ms == -1) return SQL_ERROR; USIVAL = (!is_ms || smajor < 7) ? 30 : 128; break; case SQL_MAX_INDEX_SIZE: UIVAL = 127; break; case SQL_MAX_PROCEDURE_NAME_LEN: if (is_ms == -1) return SQL_ERROR; /* TODO Sybase ? */ USIVAL = (is_ms && smajor >= 7) ? 134 : 36; break; case SQL_MAX_ROW_SIZE: if (is_ms == -1) return SQL_ERROR; /* TODO Sybase ? */ UIVAL = (is_ms && smajor >= 7) ? 8062 : 1962; break; case SQL_MAX_ROW_SIZE_INCLUDES_LONG: p = "N"; break; case SQL_MAX_STATEMENT_LEN: /* TODO Sybase ? */ UIVAL = 131072; break; case SQL_MAX_TABLES_IN_SELECT: /* TODO Sybase ? */ USIVAL = 16; break; case SQL_MAX_USER_NAME_LEN: /* TODO Sybase ? */ if (is_ms == -1) return SQL_ERROR; USIVAL = (is_ms && smajor >= 7) ? 128 : 30; break; case SQL_MAX_COLUMN_NAME_LEN: case SQL_MAX_CURSOR_NAME_LEN: case SQL_MAX_SCHEMA_NAME_LEN: case SQL_MAX_CATALOG_NAME_LEN: case SQL_MAX_TABLE_NAME_LEN: /* TODO Sybase ? */ if (is_ms == -1) return SQL_ERROR; USIVAL = (is_ms && smajor >= 7) ? 128 : 30; break; case SQL_MULT_RESULT_SETS: p = "Y"; break; case SQL_MULTIPLE_ACTIVE_TXN: p = "Y"; break; case SQL_NEED_LONG_DATA_LEN: /* current implementation do not require length, however future will, so is correct to return yes */ p = "Y"; break; case SQL_NON_NULLABLE_COLUMNS: USIVAL = SQL_NNC_NON_NULL; break; case SQL_NULL_COLLATION: USIVAL = SQL_NC_LOW; break; case SQL_NUMERIC_FUNCTIONS: UIVAL = (SQL_FN_NUM_ABS | SQL_FN_NUM_ACOS | SQL_FN_NUM_ASIN | SQL_FN_NUM_ATAN | SQL_FN_NUM_ATAN2 | SQL_FN_NUM_CEILING | SQL_FN_NUM_COS | SQL_FN_NUM_COT | SQL_FN_NUM_DEGREES | SQL_FN_NUM_EXP | SQL_FN_NUM_FLOOR | SQL_FN_NUM_LOG | SQL_FN_NUM_LOG10 | SQL_FN_NUM_MOD | SQL_FN_NUM_PI | SQL_FN_NUM_POWER | SQL_FN_NUM_RADIANS | SQL_FN_NUM_RAND | SQL_FN_NUM_ROUND | SQL_FN_NUM_SIGN | SQL_FN_NUM_SIN | SQL_FN_NUM_SQRT | SQL_FN_NUM_TAN) & mssql7plus_mask; break; case SQL_ODBC_API_CONFORMANCE: SIVAL = SQL_OAC_LEVEL2; break; #if (ODBCVER >= 0x0300) case SQL_ODBC_INTERFACE_CONFORMANCE: UIVAL = SQL_OAC_LEVEL2; break; #endif /* ODBCVER >= 0x0300 */ case SQL_ODBC_SAG_CLI_CONFORMANCE: SIVAL = SQL_OSCC_NOT_COMPLIANT; break; case SQL_ODBC_SQL_CONFORMANCE: SIVAL = SQL_OSC_CORE; break; #ifdef TDS_NO_DM case SQL_ODBC_VER: /* TODO check format ##.##.0000 */ p = VERSION; break; #endif #if (ODBCVER >= 0x0300) case SQL_OJ_CAPABILITIES: UIVAL = SQL_OJ_ALL_COMPARISON_OPS | SQL_OJ_FULL | SQL_OJ_INNER | SQL_OJ_LEFT | SQL_OJ_NESTED | SQL_OJ_NOT_ORDERED | SQL_OJ_RIGHT; break; #endif /* ODBCVER >= 0x0300 */ case SQL_ORDER_BY_COLUMNS_IN_SELECT: p = "N"; break; case SQL_OUTER_JOINS: p = "Y"; break; #if (ODBCVER >= 0x0300) case SQL_PARAM_ARRAY_ROW_COUNTS: UIVAL = SQL_PARC_BATCH; break; case SQL_PARAM_ARRAY_SELECTS: UIVAL = SQL_PAS_BATCH; break; #endif /* ODBCVER >= 0x0300 */ case SQL_POS_OPERATIONS: if (dbc->cursor_support) /* TODO cursors SQL_POS_ADD SQL_POS_REFRESH */ /* test REFRESH, ADD under mssql, under Sybase I don't know how to do it but dblib do */ IVAL = SQL_POS_DELETE | SQL_POS_POSITION | SQL_POS_UPDATE; else IVAL = 0; break; case SQL_POSITIONED_STATEMENTS: /* TODO cursors SQL_PS_SELECT_FOR_UPDATE */ IVAL = SQL_PS_POSITIONED_DELETE | SQL_PS_POSITIONED_UPDATE; break; case SQL_PROCEDURE_TERM: p = "stored procedure"; break; case SQL_PROCEDURES: p = "Y"; break; case SQL_QUOTED_IDENTIFIER_CASE: /* TODO usually insensitive */ USIVAL = SQL_IC_MIXED; break; case SQL_ROW_UPDATES: p = "N"; break; #if (ODBCVER >= 0x0300) case SQL_SCHEMA_TERM: p = "owner"; break; case SQL_SCHEMA_USAGE: UIVAL = SQL_OU_DML_STATEMENTS | SQL_OU_INDEX_DEFINITION | SQL_OU_PRIVILEGE_DEFINITION | SQL_OU_PROCEDURE_INVOCATION | SQL_OU_TABLE_DEFINITION; break; #endif /* ODBCVER >= 0x0300 */ case SQL_SCROLL_CONCURRENCY: if (dbc->cursor_support) /* TODO cursors test them, Sybase support all ? */ IVAL = SQL_SCCO_LOCK | SQL_SCCO_OPT_ROWVER | SQL_SCCO_OPT_VALUES | SQL_SCCO_READ_ONLY; else IVAL = SQL_SCCO_READ_ONLY; break; case SQL_SCROLL_OPTIONS: if (dbc->cursor_support) /* TODO cursors test them, Sybase support all ?? */ UIVAL = SQL_SO_DYNAMIC | SQL_SO_FORWARD_ONLY | SQL_SO_KEYSET_DRIVEN | SQL_SO_STATIC; else UIVAL = SQL_SO_FORWARD_ONLY | SQL_SO_STATIC; break; case SQL_SEARCH_PATTERN_ESCAPE: p = "\\"; break; case SQL_SERVER_NAME: p = dbc->tds_socket->conn->server; break; case SQL_SPECIAL_CHARACTERS: /* TODO others ?? */ p = "\'\"[]{}"; break; #if (ODBCVER >= 0x0300) case SQL_SQL_CONFORMANCE: UIVAL = SQL_SC_SQL92_ENTRY; break; case SQL_SQL92_DATETIME_FUNCTIONS: case SQL_SQL92_FOREIGN_KEY_DELETE_RULE: case SQL_SQL92_FOREIGN_KEY_UPDATE_RULE: UIVAL = 0; break; case SQL_SQL92_GRANT: UIVAL = SQL_SG_WITH_GRANT_OPTION; break; case SQL_SQL92_NUMERIC_VALUE_FUNCTIONS: UIVAL = 0; break; case SQL_SQL92_PREDICATES: /* TODO Sybase ?? */ UIVAL = SQL_SP_EXISTS | SQL_SP_ISNOTNULL | SQL_SP_ISNULL; break; case SQL_SQL92_RELATIONAL_JOIN_OPERATORS: /* TODO Sybase ?? */ UIVAL = SQL_SRJO_CROSS_JOIN | SQL_SRJO_FULL_OUTER_JOIN | SQL_SRJO_INNER_JOIN | SQL_SRJO_LEFT_OUTER_JOIN | SQL_SRJO_RIGHT_OUTER_JOIN | SQL_SRJO_UNION_JOIN; break; case SQL_SQL92_REVOKE: UIVAL = SQL_SR_GRANT_OPTION_FOR; break; case SQL_SQL92_ROW_VALUE_CONSTRUCTOR: UIVAL = SQL_SRVC_DEFAULT | SQL_SRVC_NULL | SQL_SRVC_ROW_SUBQUERY | SQL_SRVC_VALUE_EXPRESSION; break; case SQL_SQL92_STRING_FUNCTIONS: UIVAL = SQL_SSF_LOWER | SQL_SSF_UPPER; break; case SQL_SQL92_VALUE_EXPRESSIONS: /* TODO Sybase ? CAST supported ? */ UIVAL = SQL_SVE_CASE | SQL_SVE_CAST | SQL_SVE_COALESCE | SQL_SVE_NULLIF; break; case SQL_STANDARD_CLI_CONFORMANCE: UIVAL = SQL_SCC_ISO92_CLI; break; case SQL_STATIC_SENSITIVITY: IVAL = 0; break; case SQL_STATIC_CURSOR_ATTRIBUTES1: if (dbc->cursor_support) /* TODO cursors SQL_CA1_BOOKMARK SQL_CA1_BULK_FETCH_BY_BOOKMARK SQL_CA1_POS_REFRESH */ UIVAL = SQL_CA1_ABSOLUTE | SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_NEXT | SQL_CA1_POS_POSITION | SQL_CA1_RELATIVE; else UIVAL = 0; break; case SQL_STATIC_CURSOR_ATTRIBUTES2: /* TODO cursors */ UIVAL = 0; break; #endif /* ODBCVER >= 0x0300 */ case SQL_STRING_FUNCTIONS: UIVAL = (SQL_FN_STR_ASCII | SQL_FN_STR_BIT_LENGTH | SQL_FN_STR_CHAR | SQL_FN_STR_CONCAT | SQL_FN_STR_DIFFERENCE | SQL_FN_STR_INSERT | SQL_FN_STR_LCASE | SQL_FN_STR_LEFT | SQL_FN_STR_LENGTH | SQL_FN_STR_LOCATE_2 | SQL_FN_STR_LTRIM | SQL_FN_STR_OCTET_LENGTH | SQL_FN_STR_REPEAT | SQL_FN_STR_RIGHT | SQL_FN_STR_RTRIM | SQL_FN_STR_SOUNDEX | SQL_FN_STR_SPACE | SQL_FN_STR_SUBSTRING | SQL_FN_STR_UCASE) & mssql7plus_mask; break; case SQL_SUBQUERIES: UIVAL = SQL_SQ_COMPARISON | SQL_SQ_CORRELATED_SUBQUERIES | SQL_SQ_EXISTS | SQL_SQ_IN | SQL_SQ_QUANTIFIED; break; case SQL_SYSTEM_FUNCTIONS: UIVAL = SQL_FN_SYS_DBNAME | SQL_FN_SYS_IFNULL | SQL_FN_SYS_USERNAME; break; case SQL_TABLE_TERM: p = "table"; break; case SQL_TIMEDATE_ADD_INTERVALS: UIVAL = (SQL_FN_TSI_DAY | SQL_FN_TSI_FRAC_SECOND | SQL_FN_TSI_HOUR | SQL_FN_TSI_MINUTE | SQL_FN_TSI_MONTH | SQL_FN_TSI_QUARTER | SQL_FN_TSI_SECOND | SQL_FN_TSI_WEEK | SQL_FN_TSI_YEAR) & mssql7plus_mask; break; case SQL_TIMEDATE_DIFF_INTERVALS: UIVAL = (SQL_FN_TSI_DAY | SQL_FN_TSI_FRAC_SECOND | SQL_FN_TSI_HOUR | SQL_FN_TSI_MINUTE | SQL_FN_TSI_MONTH | SQL_FN_TSI_QUARTER | SQL_FN_TSI_SECOND | SQL_FN_TSI_WEEK | SQL_FN_TSI_YEAR) & mssql7plus_mask; break; case SQL_TIMEDATE_FUNCTIONS: UIVAL = (SQL_FN_TD_CURDATE | SQL_FN_TD_CURRENT_DATE | SQL_FN_TD_CURRENT_TIME | SQL_FN_TD_CURRENT_TIMESTAMP | SQL_FN_TD_CURTIME | SQL_FN_TD_DAYNAME | SQL_FN_TD_DAYOFMONTH | SQL_FN_TD_DAYOFWEEK | SQL_FN_TD_DAYOFYEAR | SQL_FN_TD_EXTRACT | SQL_FN_TD_HOUR | SQL_FN_TD_MINUTE | SQL_FN_TD_MONTH | SQL_FN_TD_MONTHNAME | SQL_FN_TD_NOW | SQL_FN_TD_QUARTER | SQL_FN_TD_SECOND | SQL_FN_TD_TIMESTAMPADD | SQL_FN_TD_TIMESTAMPDIFF | SQL_FN_TD_WEEK | SQL_FN_TD_YEAR) & mssql7plus_mask; break; case SQL_TXN_CAPABLE: /* transaction for DML and DDL */ SIVAL = SQL_TC_ALL; break; case SQL_TXN_ISOLATION_OPTION: UIVAL = SQL_TXN_READ_COMMITTED | SQL_TXN_READ_UNCOMMITTED | SQL_TXN_REPEATABLE_READ | SQL_TXN_SERIALIZABLE; break; case SQL_UNION: UIVAL = SQL_U_UNION | SQL_U_UNION_ALL; break; /* TODO finish */ case SQL_USER_NAME: /* TODO this is not correct username */ /* p = tds_dstr_cstr(&dbc->tds_login->user_name); */ /* make OpenOffice happy :) */ p = ""; break; case SQL_XOPEN_CLI_YEAR: /* TODO check specifications */ p = "1995"; break; case SQL_INFO_FREETDS_TDS_VERSION: if (!dbc->tds_socket) return SQL_ERROR; UIVAL = TDS_MAJOR(dbc->tds_socket->conn) << 16 | TDS_MINOR(dbc->tds_socket->conn); break; case SQL_INFO_FREETDS_SOCKET: if (IS_TDSDEAD(dbc->tds_socket)) return SQL_ERROR; ULVAL = dbc->tds_socket->conn->s; break; default: odbc_log_unimplemented_type("SQLGetInfo", fInfoType); odbc_errs_add(&dbc->errs, "HY092", "Option not supported"); return SQL_ERROR; } /* char data */ if (p) { return odbc_set_string_oct(dbc, rgbInfoValue, cbInfoValueMax, pcbInfoValue, p, -1); } else { if (out_len > 0 && pcbInfoValue) *pcbInfoValue = out_len; } return SQL_SUCCESS; #undef SIVAL #undef USIVAL #undef IVAL #undef UIVAL } SQLRETURN ODBC_PUBLIC ODBC_API SQLGetInfo(SQLHDBC hdbc, SQLUSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLSMALLINT cbInfoValueMax, SQLSMALLINT FAR * pcbInfoValue) { ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "SQLGetInfo(%p, %d, %p, %d, %p)\n", hdbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue); ODBC_EXIT(dbc, _SQLGetInfo(dbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue _wide0)); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLGetInfoW(SQLHDBC hdbc, SQLUSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLSMALLINT cbInfoValueMax, SQLSMALLINT FAR * pcbInfoValue) { ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "SQLGetInfoW(%p, %d, %p, %d, %p)\n", hdbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue); ODBC_EXIT(dbc, _SQLGetInfo(dbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue, 1)); } #endif static void tds_ascii_strupr(char *s) { for (; *s; ++s) if ('a' <= *s && *s <= 'z') *s = *s & (~0x20); } static void odbc_upper_column_names(TDS_STMT * stmt) { #if ENABLE_EXTRA_CHECKS TDSRESULTINFO *resinfo; TDSSOCKET *tds; #endif int icol; TDS_DESC *ird; IRD_CHECK; #if ENABLE_EXTRA_CHECKS tds = stmt->dbc->tds_socket; if (!tds || !tds->current_results) return; resinfo = tds->current_results; for (icol = 0; icol < resinfo->num_cols; ++icol) { TDSCOLUMN *colinfo = resinfo->columns[icol]; char *p = tds_dstr_buf(&colinfo->column_name); unsigned n, len = tds_dstr_len(&colinfo->column_name); /* upper case */ /* TODO procedure */ for (n = 0; n < len; ++n, ++p) if ('a' <= *p && *p <= 'z') *p = *p & (~0x20); } #endif ird = stmt->ird; for (icol = ird->header.sql_desc_count; --icol >= 0;) { struct _drecord *drec = &ird->records[icol]; /* upper case */ tds_ascii_strupr(tds_dstr_buf(&drec->sql_desc_label)); tds_ascii_strupr(tds_dstr_buf(&drec->sql_desc_name)); } } /** * Change sql datatype to a specific version * \param sql_type sql data type to change (any type) * \param version ODBC version to change to, 2 for ODBC 2, 3 for ODBC 3, 0 swap */ static SQLSMALLINT odbc_swap_datetime_sql_type(SQLSMALLINT sql_type, int version) { switch (sql_type) { case SQL_TYPE_TIMESTAMP: if (version != 3) sql_type = SQL_TIMESTAMP; break; case SQL_TIMESTAMP: if (version != 2) sql_type = SQL_TYPE_TIMESTAMP; break; case SQL_TYPE_DATE: if (version != 3) sql_type = SQL_DATE; break; case SQL_DATE: if (version != 2) sql_type = SQL_TYPE_DATE; break; case SQL_TYPE_TIME: if (version != 3) sql_type = SQL_TIME; break; case SQL_TIME: if (version != 2) sql_type = SQL_TYPE_TIME; break; } return sql_type; } SQLRETURN ODBC_PUBLIC ODBC_API SQLGetTypeInfo(SQLHSTMT hstmt, SQLSMALLINT fSqlType) { SQLRETURN res; TDSSOCKET *tds; TDS_INT result_type; TDS_INT compute_id; int varchar_pos = -1, n; static const char sql_templ_default[] = "sp_datatype_info %d"; const char *sql_templ = sql_templ_default; char sql[sizeof(sql_templ_default) + 36]; int odbc3; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLGetTypeInfo(%p, %d)\n", hstmt, fSqlType); tds = stmt->dbc->tds_socket; odbc3 = (stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3); if (IS_TDS73_PLUS(tds->conn)) sql_templ = "sp_datatype_info_100 %d"; else if (IS_TDS72_PLUS(tds->conn)) sql_templ = "sp_datatype_info_90 %d"; /* For MSSQL6.5 and Sybase 11.9 sp_datatype_info work */ /* TODO what about early Sybase products ? */ /* TODO Does Sybase return all ODBC3 columns? Add them if not */ /* TODO ODBC3 convert type to ODBC version 2 (date) */ if (odbc3) { if (TDS_IS_SYBASE(tds)) { sprintf(sql, sql_templ, odbc_swap_datetime_sql_type(fSqlType, 0)); stmt->special_row = ODBC_SPECIAL_GETTYPEINFO; } else { sprintf(sql, sql_templ, fSqlType); strcat(sql, ",3"); } } else { /* MS ODBC translate SQL_TIMESTAMP to SQL_TYPE_TIMESTAMP even for ODBC 2 apps * other DM just pass value straight. * Convert always to version 2 to make version 2 datatype works with all DMs */ sprintf(sql, sql_templ, odbc_swap_datetime_sql_type(fSqlType, 2)); } if (SQL_SUCCESS != odbc_set_stmt_query(stmt, (ODBC_CHAR*) sql, strlen(sql) _wide0)) ODBC_EXIT(stmt, SQL_ERROR); redo: res = _SQLExecute(stmt); odbc_upper_column_names(stmt); if (odbc3) { odbc_col_setname(stmt, 3, "COLUMN_SIZE"); odbc_col_setname(stmt, 11, "FIXED_PREC_SCALE"); odbc_col_setname(stmt, 12, "AUTO_UNIQUE_VALUE"); } /* workaround for a mispelled column name in Sybase */ if (TDS_IS_SYBASE(stmt->dbc->tds_socket) && !odbc3) odbc_col_setname(stmt, 3, "PRECISION"); if (TDS_IS_MSSQL(stmt->dbc->tds_socket) || fSqlType != SQL_VARCHAR || res != SQL_SUCCESS) ODBC_EXIT(stmt, res); /* * Sybase return first nvarchar for char... and without length !!! * Some program use first entry so we discard all entry before varchar */ n = 0; while (tds->current_results) { TDSRESULTINFO *resinfo; TDSCOLUMN *colinfo; char *name; /* if next is varchar leave next for SQLFetch */ if (n == (varchar_pos - 1)) break; switch (tds_process_tokens(stmt->dbc->tds_socket, &result_type, &compute_id, TDS_STOPAT_ROWFMT|TDS_RETURN_ROW)) { case TDS_SUCCESS: if (result_type == TDS_ROW_RESULT) break; case TDS_NO_MORE_RESULTS: /* discard other tokens */ tds_process_simple_query(tds); if (n >= varchar_pos && varchar_pos > 0) goto redo; break; case TDS_CANCELLED: odbc_errs_add(&stmt->errs, "HY008", NULL); res = SQL_ERROR; break; } if (!tds->current_results) break; ++n; resinfo = tds->current_results; colinfo = resinfo->columns[0]; name = (char *) colinfo->column_data; if (is_blob_col(colinfo)) name = (char*) ((TDSBLOB *) name)->textvalue; /* skip nvarchar and sysname */ if (colinfo->column_cur_size == 7 && memcmp("varchar", name, 7) == 0) { varchar_pos = n; } } ODBC_EXIT(stmt, res); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLGetTypeInfoW(SQLHSTMT hstmt, SQLSMALLINT fSqlType) { return SQLGetTypeInfo(hstmt, fSqlType); } #endif static SQLRETURN _SQLParamData(SQLHSTMT hstmt, SQLPOINTER FAR * prgbValue) { ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLParamData(%p, %p) [param_num %d, param_data_called = %d]\n", hstmt, prgbValue, stmt->param_num, stmt->param_data_called); if (stmt->params && stmt->param_num <= stmt->param_count) { SQLRETURN res; if (stmt->param_num <= 0 || stmt->param_num > stmt->apd->header.sql_desc_count) { tdsdump_log(TDS_DBG_FUNC, "SQLParamData: logic_error: parameter out of bounds: 0 <= %d < %d\n", stmt->param_num, stmt->apd->header.sql_desc_count); ODBC_EXIT(stmt, SQL_ERROR); } /* * TODO compute output value with this formula: * Bound Address + Binding Offset + ((Row Number - 1) x Element Size) * (see SQLParamData documentation) * This is needed for updates using SQLBulkOperation (not currently supported) */ if (!stmt->param_data_called) { stmt->param_data_called = 1; *prgbValue = stmt->apd->records[stmt->param_num - 1].sql_desc_data_ptr; ODBC_EXIT(stmt, SQL_NEED_DATA); } ++stmt->param_num; switch (res = parse_prepared_query(stmt, true)) { case SQL_NEED_DATA: *prgbValue = stmt->apd->records[stmt->param_num - 1].sql_desc_data_ptr; ODBC_EXIT(stmt, SQL_NEED_DATA); case SQL_SUCCESS: ODBC_EXIT(stmt, _SQLExecute(stmt)); } ODBC_EXIT(stmt, res); } odbc_errs_add(&stmt->errs, "HY010", NULL); ODBC_EXIT_(stmt); } SQLRETURN ODBC_PUBLIC ODBC_API SQLParamData(SQLHSTMT hstmt, SQLPOINTER FAR * prgbValue) { ODBC_PRRET_BUF; SQLRETURN ret = _SQLParamData(hstmt, prgbValue); tdsdump_log(TDS_DBG_FUNC, "SQLParamData returns %s\n", odbc_prret(ret)); return ret; } SQLRETURN ODBC_PUBLIC ODBC_API SQLPutData(SQLHSTMT hstmt, SQLPOINTER rgbValue, SQLLEN cbValue) { ODBC_PRRET_BUF; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLPutData(%p, %p, %i)\n", hstmt, rgbValue, (int)cbValue); if (stmt->param_data_called) { SQLRETURN ret; const TDSCOLUMN *curcol = stmt->params->columns[stmt->param_num - (stmt->prepared_query_is_func ? 2 : 1)]; /* TODO do some more tests before setting this flag */ stmt->param_data_called = 1; ret = continue_parse_prepared_query(stmt, rgbValue, cbValue); tdsdump_log(TDS_DBG_FUNC, "SQLPutData returns %s, %d bytes left\n", odbc_prret(ret), curcol->column_size - curcol->column_cur_size); ODBC_EXIT(stmt, ret); } odbc_errs_add(&stmt->errs, "HY010", NULL); ODBC_EXIT_(stmt); } ODBC_FUNC(SQLSetConnectAttr, (P(SQLHDBC,hdbc), P(SQLINTEGER,Attribute), P(SQLPOINTER,ValuePtr), P(SQLINTEGER,StringLength) WIDE)) { SQLULEN u_value = (SQLULEN) (TDS_INTPTR) ValuePtr; ODBC_ENTER_HDBC; tdsdump_log(TDS_DBG_FUNC, "_SQLSetConnectAttr(%p, %d, %p, %d)\n", hdbc, (int)Attribute, ValuePtr, (int)StringLength); switch (Attribute) { case SQL_ATTR_AUTOCOMMIT: /* spinellia@acm.org */ change_autocommit(dbc, u_value); break; case SQL_ATTR_CONNECTION_TIMEOUT: dbc->attr.connection_timeout = u_value; break; case SQL_ATTR_ACCESS_MODE: dbc->attr.access_mode = u_value; break; case SQL_ATTR_CURRENT_CATALOG: if (!IS_VALID_LEN(StringLength)) { odbc_errs_add(&dbc->errs, "HY090", NULL); break; } { DSTR s = DSTR_INITIALIZER; if (!odbc_dstr_copy_oct(dbc, &s, StringLength, (ODBC_CHAR*) ValuePtr)) { odbc_errs_add(&dbc->errs, "HY001", NULL); break; } change_database(dbc, tds_dstr_cstr(&s), tds_dstr_len(&s)); tds_dstr_free(&s); } break; case SQL_ATTR_CURSOR_TYPE: if (dbc->cursor_support) dbc->attr.cursor_type = u_value; break; case SQL_ATTR_LOGIN_TIMEOUT: dbc->attr.login_timeout = u_value; break; case SQL_ATTR_ODBC_CURSORS: /* TODO cursors */ dbc->attr.odbc_cursors = u_value; break; case SQL_ATTR_PACKET_SIZE: dbc->attr.packet_size = u_value; break; case SQL_ATTR_QUIET_MODE: dbc->attr.quite_mode = (SQLHWND) (TDS_INTPTR) ValuePtr; break; #ifdef TDS_NO_DM case SQL_ATTR_TRACE: dbc->attr.trace = u_value; break; case SQL_ATTR_TRACEFILE: if (!IS_VALID_LEN(StringLength)) { odbc_errs_add(&dbc->errs, "HY090", NULL); break; } if (!odbc_dstr_copy(dbc, &dbc->attr.tracefile, StringLength, (ODBC_CHAR *) ValuePtr)) odbc_errs_add(&dbc->errs, "HY001", NULL); break; #endif case SQL_ATTR_TXN_ISOLATION: if (u_value != dbc->attr.txn_isolation) { if (change_txn(dbc, u_value) == SQL_SUCCESS) dbc->attr.txn_isolation = u_value; } break; case SQL_COPT_SS_MARS_ENABLED: dbc->attr.mars_enabled = u_value; break; case SQL_ATTR_TRANSLATE_LIB: case SQL_ATTR_TRANSLATE_OPTION: odbc_errs_add(&dbc->errs, "HYC00", NULL); break; case SQL_COPT_SS_OLDPWD: if (!IS_VALID_LEN(StringLength)) { odbc_errs_add(&dbc->errs, "HY090", NULL); break; } if (!odbc_dstr_copy(dbc, &dbc->oldpwd, StringLength, (ODBC_CHAR *) ValuePtr)) odbc_errs_add(&dbc->errs, "HY001", NULL); else dbc->use_oldpwd = 1; break; case SQL_COPT_SS_BCP: dbc->attr.bulk_enabled = u_value; break; case SQL_COPT_TDSODBC_IMPL_BCP_INITA: if (!ValuePtr) odbc_errs_add(&dbc->errs, "HY009", NULL); else { const struct tdsodbc_impl_bcp_init_params *params = (const struct tdsodbc_impl_bcp_init_params*)ValuePtr; odbc_bcp_init(dbc, (const ODBC_CHAR *) params->tblname, (const ODBC_CHAR *) params->hfile, (const ODBC_CHAR *) params->errfile, params->direction _wide0); } break; #ifdef ENABLE_ODBC_WIDE case SQL_COPT_TDSODBC_IMPL_BCP_INITW: if (!ValuePtr) odbc_errs_add(&dbc->errs, "HY009", NULL); else { const struct tdsodbc_impl_bcp_init_params *params = (const struct tdsodbc_impl_bcp_init_params*)ValuePtr; odbc_bcp_init(dbc, (const ODBC_CHAR *) params->tblname, (const ODBC_CHAR *) params->hfile, (const ODBC_CHAR *) params->errfile, params->direction, 1); } break; #endif case SQL_COPT_TDSODBC_IMPL_BCP_CONTROL: if (!ValuePtr) odbc_errs_add(&dbc->errs, "HY009", NULL); else { const struct tdsodbc_impl_bcp_control_params *params = (const struct tdsodbc_impl_bcp_control_params*)ValuePtr; odbc_bcp_control(dbc, params->field, params->value); } break; case SQL_COPT_TDSODBC_IMPL_BCP_COLPTR: if (!ValuePtr) odbc_errs_add(&dbc->errs, "HY009", NULL); else { const struct tdsodbc_impl_bcp_colptr_params *params = (const struct tdsodbc_impl_bcp_colptr_params*)ValuePtr; odbc_bcp_colptr(dbc, params->colptr, params->table_column); } break; case SQL_COPT_TDSODBC_IMPL_BCP_SENDROW: if (ValuePtr) odbc_errs_add(&dbc->errs, "HY000", NULL); else odbc_bcp_sendrow(dbc); break; case SQL_COPT_TDSODBC_IMPL_BCP_BATCH: if (!ValuePtr) odbc_errs_add(&dbc->errs, "HY009", NULL); else { struct tdsodbc_impl_bcp_batch_params *params = (struct tdsodbc_impl_bcp_batch_params*)ValuePtr; params->rows = odbc_bcp_batch(dbc); } break; case SQL_COPT_TDSODBC_IMPL_BCP_DONE: if (!ValuePtr) odbc_errs_add(&dbc->errs, "HY009", NULL); else { struct tdsodbc_impl_bcp_done_params *params = (struct tdsodbc_impl_bcp_done_params*)ValuePtr; params->rows = odbc_bcp_done(dbc); } break; case SQL_COPT_TDSODBC_IMPL_BCP_BIND: if (!ValuePtr) odbc_errs_add(&dbc->errs, "HY009", NULL); else { const struct tdsodbc_impl_bcp_bind_params *params = (const struct tdsodbc_impl_bcp_bind_params*)ValuePtr; odbc_bcp_bind(dbc, params->varaddr, params->prefixlen, params->varlen, params->terminator, params->termlen, params->vartype, params->table_column); } break; default: odbc_errs_add(&dbc->errs, "HY092", NULL); break; } ODBC_EXIT_(dbc); } SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectOption(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLULEN vParam) { tdsdump_log(TDS_DBG_FUNC, "SQLSetConnectOption(%p, %d, %u)\n", hdbc, fOption, (unsigned)vParam); /* XXX: Lost precision */ return _SQLSetConnectAttr(hdbc, (SQLINTEGER) fOption, (SQLPOINTER) (TDS_INTPTR) vParam, SQL_NTS _wide0); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectOptionW(SQLHDBC hdbc, SQLUSMALLINT fOption, SQLULEN vParam) { tdsdump_log(TDS_DBG_FUNC, "SQLSetConnectOptionW(%p, %d, %u)\n", hdbc, fOption, (unsigned)vParam); /* XXX: Lost precision */ return _SQLSetConnectAttr(hdbc, (SQLINTEGER) fOption, (SQLPOINTER) (TDS_INTPTR) vParam, SQL_NTS, 1); } #endif static SQLRETURN _SQLSetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength WIDE) { SQLULEN ui = (SQLULEN) (TDS_INTPTR) ValuePtr; SQLUSMALLINT *usip = (SQLUSMALLINT *) ValuePtr; SQLLEN *lp = (SQLLEN *) ValuePtr; SQLULEN *ulp = (SQLULEN *) ValuePtr; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "_SQLSetStmtAttr(%p, %d, %p, %d)\n", hstmt, (int)Attribute, ValuePtr, (int)StringLength); /* TODO - error checking and real functionality :-) */ /* TODO some setting set also other attribute, see documentation */ switch (Attribute) { /* TODO check SQLFreeHandle on descriptor. Is possible to free an associated descriptor ? */ case SQL_ATTR_APP_PARAM_DESC: case SQL_ATTR_APP_ROW_DESC: { TDS_DESC *orig; TDS_DESC **curr; TDS_DESC *val = (TDS_DESC *) ValuePtr; if (Attribute == SQL_ATTR_APP_PARAM_DESC) { orig = stmt->orig_apd; curr = &stmt->apd; } else { orig = stmt->orig_ard; curr = &stmt->ard; } /* if ValuePtr is NULL or original descriptor set original */ if (!val || val == orig) { *curr = orig; break; } /* must be allocated by user, not implicit ones */ if (val->header.sql_desc_alloc_type != SQL_DESC_ALLOC_USER) { odbc_errs_add(&stmt->errs, "HY017", NULL); break; } /* TODO check HDESC (not associated, from DBC HY024) */ *curr = val; } break; case SQL_ATTR_ASYNC_ENABLE: if (stmt->attr.async_enable != ui) { odbc_errs_add(&stmt->errs, "HYC00", NULL); break; } stmt->attr.async_enable = ui; break; case SQL_ATTR_CONCURRENCY: if (stmt->attr.concurrency != ui && !stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "01S02", NULL); break; } if (stmt->cursor) { odbc_errs_add(&stmt->errs, "24000", NULL); break; } switch (ui) { case SQL_CONCUR_READ_ONLY: stmt->attr.cursor_sensitivity = SQL_INSENSITIVE; break; case SQL_CONCUR_LOCK: case SQL_CONCUR_ROWVER: case SQL_CONCUR_VALUES: stmt->attr.cursor_sensitivity = SQL_SENSITIVE; break; default: odbc_errs_add(&stmt->errs, "HY092", NULL); ODBC_EXIT_(stmt); } stmt->attr.concurrency = ui; break; case SQL_ATTR_CURSOR_SCROLLABLE: if (stmt->attr.cursor_scrollable != ui && !stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "HYC00", NULL); break; } switch (ui) { case SQL_SCROLLABLE: stmt->attr.cursor_type = SQL_CURSOR_KEYSET_DRIVEN; break; case SQL_NONSCROLLABLE: stmt->attr.cursor_type = SQL_CURSOR_FORWARD_ONLY; break; default: odbc_errs_add(&stmt->errs, "HY092", NULL); ODBC_EXIT_(stmt); } stmt->attr.cursor_scrollable = ui; break; case SQL_ATTR_CURSOR_SENSITIVITY: /* don't change anything */ if (ui == SQL_UNSPECIFIED) break; if (stmt->attr.cursor_sensitivity != ui && !stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "HYC00", NULL); break; } switch (ui) { case SQL_INSENSITIVE: stmt->attr.concurrency = SQL_CONCUR_READ_ONLY; stmt->attr.cursor_type = SQL_CURSOR_STATIC; break; case SQL_SENSITIVE: stmt->attr.concurrency = SQL_CONCUR_ROWVER; break; } stmt->attr.cursor_sensitivity = ui; break; case SQL_ATTR_CURSOR_TYPE: if (stmt->attr.cursor_type != ui && !stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "01S02", NULL); break; } if (stmt->cursor) { odbc_errs_add(&stmt->errs, "24000", NULL); break; } switch (ui) { case SQL_CURSOR_DYNAMIC: case SQL_CURSOR_KEYSET_DRIVEN: if (stmt->attr.concurrency != SQL_CONCUR_READ_ONLY) stmt->attr.cursor_sensitivity = SQL_SENSITIVE; stmt->attr.cursor_scrollable = SQL_SCROLLABLE; break; case SQL_CURSOR_STATIC: if (stmt->attr.concurrency != SQL_CONCUR_READ_ONLY) stmt->attr.cursor_sensitivity = SQL_SENSITIVE; else stmt->attr.cursor_sensitivity = SQL_INSENSITIVE; stmt->attr.cursor_scrollable = SQL_SCROLLABLE; break; case SQL_CURSOR_FORWARD_ONLY: stmt->attr.cursor_scrollable = SQL_NONSCROLLABLE; break; default: odbc_errs_add(&stmt->errs, "HY092", NULL); ODBC_EXIT_(stmt); } stmt->attr.cursor_type = ui; break; case SQL_ATTR_ENABLE_AUTO_IPD: if (stmt->attr.enable_auto_ipd != ui) { odbc_errs_add(&stmt->errs, "HYC00", NULL); break; } stmt->attr.enable_auto_ipd = ui; break; case SQL_ATTR_FETCH_BOOKMARK_PTR: stmt->attr.fetch_bookmark_ptr = ValuePtr; break; case SQL_ATTR_IMP_ROW_DESC: case SQL_ATTR_IMP_PARAM_DESC: odbc_errs_add(&stmt->errs, "HY017", NULL); break; /* TODO what's is this ??? */ case SQL_ATTR_KEYSET_SIZE: stmt->attr.keyset_size = ui; break; /* TODO max length of data returned. Use SQL TEXTSIZE or just truncate ?? */ case SQL_ATTR_MAX_LENGTH: if (stmt->attr.max_length != ui) { odbc_errs_add(&stmt->errs, "01S02", NULL); break; } stmt->attr.max_length = ui; break; /* TODO max row returned. Use SET ROWCOUNT */ case SQL_ATTR_MAX_ROWS: if (stmt->attr.max_rows != ui) { odbc_errs_add(&stmt->errs, "01S02", NULL); break; } stmt->attr.max_rows = ui; break; case SQL_ATTR_METADATA_ID: stmt->attr.metadata_id = ui; break; /* TODO use it !!! */ case SQL_ATTR_NOSCAN: stmt->attr.noscan = ui; break; case SQL_ATTR_PARAM_BIND_OFFSET_PTR: stmt->apd->header.sql_desc_bind_offset_ptr = lp; break; case SQL_ATTR_PARAM_BIND_TYPE: stmt->apd->header.sql_desc_bind_type = ui; break; case SQL_ATTR_PARAM_OPERATION_PTR: stmt->apd->header.sql_desc_array_status_ptr = usip; break; case SQL_ATTR_PARAM_STATUS_PTR: stmt->ipd->header.sql_desc_array_status_ptr = usip; break; case SQL_ATTR_PARAMS_PROCESSED_PTR: stmt->ipd->header.sql_desc_rows_processed_ptr = ulp; break; /* allow to exec procedure multiple time */ case SQL_ATTR_PARAMSET_SIZE: stmt->apd->header.sql_desc_array_size = ui; break; case SQL_ATTR_QUERY_TIMEOUT: stmt->attr.query_timeout = ui; break; /* retrieve data after positioning the cursor */ case SQL_ATTR_RETRIEVE_DATA: /* TODO cursors */ if (stmt->attr.retrieve_data != ui) { odbc_errs_add(&stmt->errs, "01S02", NULL); break; } stmt->attr.retrieve_data = ui; break; case SQL_ATTR_ROW_ARRAY_SIZE: stmt->ard->header.sql_desc_array_size = ui; break; case SQL_ATTR_ROW_BIND_OFFSET_PTR: /* TODO test what happen with column-wise and row-wise bindings and SQLGetData */ stmt->ard->header.sql_desc_bind_offset_ptr = lp; break; #if SQL_BIND_TYPE != SQL_ATTR_ROW_BIND_TYPE case SQL_BIND_TYPE: /* although this is ODBC2 we must support this attribute */ #endif case SQL_ATTR_ROW_BIND_TYPE: stmt->ard->header.sql_desc_bind_type = ui; break; case SQL_ATTR_ROW_NUMBER: odbc_errs_add(&stmt->errs, "HY092", NULL); break; case SQL_ATTR_ROW_OPERATION_PTR: stmt->ard->header.sql_desc_array_status_ptr = usip; break; case SQL_ATTR_ROW_STATUS_PTR: stmt->ird->header.sql_desc_array_status_ptr = usip; break; case SQL_ATTR_ROWS_FETCHED_PTR: stmt->ird->header.sql_desc_rows_processed_ptr = ulp; break; case SQL_ATTR_SIMULATE_CURSOR: /* TODO cursors */ if (stmt->cursor) { odbc_errs_add(&stmt->errs, "24000", NULL); break; } if (stmt->attr.simulate_cursor != ui) { odbc_errs_add(&stmt->errs, "01S02", NULL); break; } stmt->attr.simulate_cursor = ui; break; case SQL_ATTR_USE_BOOKMARKS: if (stmt->cursor) { odbc_errs_add(&stmt->errs, "24000", NULL); break; } stmt->attr.use_bookmarks = ui; break; case SQL_ROWSET_SIZE: /* although this is ODBC2 we must support this attribute */ if (((TDS_INTPTR) ValuePtr) < 1) { odbc_errs_add(&stmt->errs, "HY024", NULL); break; } stmt->sql_rowset_size = ui; break; case SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT: if (ui < 1) { odbc_errs_add(&stmt->errs, "HY024", NULL); break; } stmt->attr.qn_timeout = ui; break; case SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT: if (!IS_VALID_LEN(StringLength)) { odbc_errs_add(&stmt->errs, "HY090", NULL); break; } if (!odbc_dstr_copy_oct(stmt->dbc, &stmt->attr.qn_msgtext, StringLength, (ODBC_CHAR*) ValuePtr)) { odbc_errs_add(&stmt->errs, "HY001", NULL); break; } break; case SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS: if (!IS_VALID_LEN(StringLength)) { odbc_errs_add(&stmt->errs, "HY090", NULL); break; } if (!odbc_dstr_copy_oct(stmt->dbc, &stmt->attr.qn_options, StringLength, (ODBC_CHAR*) ValuePtr)) { odbc_errs_add(&stmt->errs, "HY001", NULL); break; } break; default: odbc_errs_add(&stmt->errs, "HY092", NULL); break; } ODBC_EXIT_(stmt); } #if (ODBCVER >= 0x0300) SQLRETURN ODBC_PUBLIC ODBC_API SQLSetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength) { tdsdump_log(TDS_DBG_FUNC, "SQLSetStmtAttr(%p, %d, %p, %d)\n", hstmt, (int)Attribute, ValuePtr, (int)StringLength); return _SQLSetStmtAttr(hstmt, Attribute, ValuePtr, StringLength _wide0); } #ifdef ENABLE_ODBC_WIDE SQLRETURN ODBC_PUBLIC ODBC_API SQLSetStmtAttrW(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength) { tdsdump_log(TDS_DBG_FUNC, "SQLSetStmtAttr(%p, %d, %p, %d)\n", hstmt, (int)Attribute, ValuePtr, (int)StringLength); return _SQLSetStmtAttr(hstmt, Attribute, ValuePtr, StringLength, 1); } #endif #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLSetStmtOption(SQLHSTMT hstmt, SQLUSMALLINT fOption, SQLULEN vParam) { tdsdump_log(TDS_DBG_FUNC, "SQLSetStmtOption(%p, %u, %u)\n", hstmt, fOption, (unsigned)vParam); /* XXX: Lost precision */ return _SQLSetStmtAttr(hstmt, (SQLINTEGER) fOption, (SQLPOINTER) (TDS_INTPTR) vParam, SQL_NTS _wide0); } ODBC_FUNC(SQLSpecialColumns, (P(SQLHSTMT,hstmt), P(SQLUSMALLINT,fColType), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(TableName,SQLSMALLINT), P(SQLUSMALLINT,fScope), P(SQLUSMALLINT,fNullable) WIDE)) { int retcode; char nullable, scope, col_type; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLSpecialColumns(%p, %d, %p, %d, %p, %d, %p, %d, %d, %d)\n", hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable); #ifdef TDS_NO_DM /* Check column type */ if (fColType != SQL_BEST_ROWID && fColType != SQL_ROWVER) { odbc_errs_add(&stmt->errs, "HY097", NULL); ODBC_EXIT_(stmt); } /* check our buffer lengths */ if (!IS_VALID_LEN(cbCatalogName) || !IS_VALID_LEN(cbSchemaName) || !IS_VALID_LEN(cbTableName)) { odbc_errs_add(&stmt->errs, "HY090", NULL); ODBC_EXIT_(stmt); } /* Check nullable */ if (fNullable != SQL_NO_NULLS && fNullable != SQL_NULLABLE) { odbc_errs_add(&stmt->errs, "HY099", NULL); ODBC_EXIT_(stmt); } if (!odbc_get_string_size(cbTableName, szTableName _wide)) { odbc_errs_add(&stmt->errs, "HY009", "SQLSpecialColumns: The table name parameter is required"); ODBC_EXIT_(stmt); } switch (fScope) { case SQL_SCOPE_CURROW: case SQL_SCOPE_TRANSACTION: case SQL_SCOPE_SESSION: break; default: odbc_errs_add(&stmt->errs, "HY098", NULL); ODBC_EXIT_(stmt); } #endif if (fNullable == SQL_NO_NULLS) nullable = 'O'; else nullable = 'U'; if (fScope == SQL_SCOPE_CURROW) scope = 'C'; else scope = 'T'; if (fColType == SQL_BEST_ROWID) col_type = 'R'; else col_type = 'V'; retcode = odbc_stat_execute(stmt _wide, "sp_special_columns", TDS_IS_MSSQL(stmt->dbc->tds_socket) ? 7 : 4, "O", szTableName, cbTableName, "O", szSchemaName, cbSchemaName, "O@qualifier", szCatalogName, cbCatalogName, "!@col_type", &col_type, 1, "!@scope", &scope, 1, "!@nullable", &nullable, 1, "V@ODBCVer", (char*) NULL, 0); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 5, "COLUMN_SIZE"); odbc_col_setname(stmt, 6, "BUFFER_LENGTH"); odbc_col_setname(stmt, 7, "DECIMAL_DIGITS"); if (TDS_IS_SYBASE(stmt->dbc->tds_socket)) stmt->special_row = ODBC_SPECIAL_SPECIALCOLUMNS; } ODBC_EXIT_(stmt); } ODBC_FUNC(SQLStatistics, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(TableName,SQLSMALLINT), P(SQLUSMALLINT,fUnique), P(SQLUSMALLINT,fAccuracy) WIDE)) { int retcode; char unique, accuracy; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLStatistics(%p, %p, %d, %p, %d, %p, %d, %d, %d)\n", hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fUnique, fAccuracy); #ifdef TDS_NO_DM /* check our buffer lengths */ if (!IS_VALID_LEN(cbCatalogName) || !IS_VALID_LEN(cbSchemaName) || !IS_VALID_LEN(cbTableName)) { odbc_errs_add(&stmt->errs, "HY090", NULL); ODBC_EXIT_(stmt); } /* check our uniqueness value */ if (fUnique != SQL_INDEX_UNIQUE && fUnique != SQL_INDEX_ALL) { odbc_errs_add(&stmt->errs, "HY100", NULL); ODBC_EXIT_(stmt); } /* check our accuracy value */ if (fAccuracy != SQL_QUICK && fAccuracy != SQL_ENSURE) { odbc_errs_add(&stmt->errs, "HY101", NULL); ODBC_EXIT_(stmt); } if (!odbc_get_string_size(cbTableName, szTableName _wide)) { odbc_errs_add(&stmt->errs, "HY009", NULL); ODBC_EXIT_(stmt); } #endif if (fAccuracy == SQL_ENSURE) accuracy = 'E'; else accuracy = 'Q'; if (fUnique == SQL_INDEX_UNIQUE) unique = 'Y'; else unique = 'N'; retcode = odbc_stat_execute(stmt _wide, "sp_statistics", TDS_IS_MSSQL(stmt->dbc->tds_socket) ? 5 : 4, "O@table_qualifier", szCatalogName, cbCatalogName, "O@table_owner", szSchemaName, cbSchemaName, "O@table_name", szTableName, cbTableName, "!@is_unique", &unique, 1, "!@accuracy", &accuracy, 1); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "TABLE_CAT"); odbc_col_setname(stmt, 2, "TABLE_SCHEM"); odbc_col_setname(stmt, 8, "ORDINAL_POSITION"); odbc_col_setname(stmt, 10, "ASC_OR_DESC"); } ODBC_EXIT_(stmt); } ODBC_FUNC(SQLTables, (P(SQLHSTMT,hstmt), PCHARIN(CatalogName,SQLSMALLINT), PCHARIN(SchemaName,SQLSMALLINT), PCHARIN(TableName,SQLSMALLINT), PCHARIN(TableType,SQLSMALLINT) WIDE)) { int retcode; const char *proc = NULL; int wildcards; TDSSOCKET *tds; DSTR schema_name = DSTR_INITIALIZER; DSTR catalog_name = DSTR_INITIALIZER; DSTR table_name = DSTR_INITIALIZER; DSTR table_type = DSTR_INITIALIZER; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLTables(%p, %p, %d, %p, %d, %p, %d, %p, %d)\n", hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, szTableType, cbTableType); tds = stmt->dbc->tds_socket; if (!odbc_dstr_copy(stmt->dbc, &catalog_name, cbCatalogName, szCatalogName) || !odbc_dstr_copy(stmt->dbc, &schema_name, cbSchemaName, szSchemaName) || !odbc_dstr_copy(stmt->dbc, &table_name, cbTableName, szTableName) || !odbc_dstr_copy(stmt->dbc, &table_type, cbTableType, szTableType)) goto memory_error; if (cbTableName == SQL_NTS) cbTableName = tds_dstr_len(&table_name); if (cbSchemaName == SQL_NTS) cbSchemaName = tds_dstr_len(&schema_name); /* support wildcards on catalog (only odbc 3) */ wildcards = 0; if (stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3 && stmt->dbc->attr.metadata_id == SQL_FALSE && (strchr(tds_dstr_cstr(&catalog_name), '%') || strchr(tds_dstr_cstr(&catalog_name), '_'))) wildcards = 1; proc = "sp_tables"; if (!tds_dstr_isempty(&catalog_name)) { if (wildcards) { /* if catalog specified and wildcards use sp_tableswc under mssql2k */ if (TDS_IS_MSSQL(tds) && tds->conn->product_version >= TDS_MS_VER(8,0,0)) { proc = "sp_tableswc"; if (tds_dstr_isempty(&schema_name)) if (!tds_dstr_copy(&schema_name, "%")) goto memory_error; } /* * TODO support wildcards on catalog even for Sybase * first execute a select name from master..sysdatabases where name like catalog quoted * build a db1..sp_tables args db2..sp_tables args ... query * collapse results in a single recordset (how??) */ } else { /* if catalog specified and not wildcards use catatog on name (catalog..sp_tables) */ proc = "..sp_tables"; } } /* fix type if needed quoting it */ if (!tds_dstr_isempty(&table_type)) { int to_fix = 0; int elements = 0; const char *p = tds_dstr_cstr(&table_type); const char *const end = p + tds_dstr_len(&table_type); for (;;) { const char *begin = p; p = (const char*) memchr(p, ',', end - p); if (!p) p = end; ++elements; if ((p - begin) < 2 || begin[0] != '\'' || p[-1] != '\'') to_fix = 1; if (p >= end) break; ++p; } /* fix it */ tdsdump_log(TDS_DBG_INFO1, "to_fix %d elements %d\n", to_fix, elements); if (to_fix) { char *dst, *type; tdsdump_log(TDS_DBG_INFO1, "fixing type elements\n"); type = tds_new(char, tds_dstr_len(&table_type) + elements * 2 + 3); if (!type) goto memory_error; p = tds_dstr_cstr(&table_type); dst = type; for (;;) { const char *begin = p; p = (const char*) memchr(p, ',', end - p); if (!p) p = end; if ((p - begin) < 2 || begin[0] != '\'' || p[-1] != '\'') { *dst++ = '\''; memcpy(dst, begin, p - begin); dst += p - begin; *dst++ = '\''; } else { memcpy(dst, begin, p - begin); dst += p - begin; } if (p >= end) break; *dst++ = *p++; } *dst = 0; if (!tds_dstr_set(&table_type, type)) { free(type); goto memory_error; } } } /* special case for catalog list */ if (strcmp(tds_dstr_cstr(&catalog_name), "%") == 0 && cbTableName <= 0 && cbSchemaName <= 0) { retcode = odbc_stat_execute(stmt _wide, "sp_tables", 3, "$!P@table_name", "", 0, "$!P@table_owner", "", 0, "!P@table_qualifier", "%", 1); } else { retcode = odbc_stat_execute(stmt _wide, proc, 4, "!P@table_name", tds_dstr_cstr(&table_name), tds_dstr_len(&table_name), "!P@table_owner", tds_dstr_cstr(&schema_name), tds_dstr_len(&schema_name), "!P@table_qualifier", tds_dstr_cstr(&catalog_name), tds_dstr_len(&catalog_name), "!@table_type", tds_dstr_cstr(&table_type), tds_dstr_len(&table_type)); } tds_dstr_free(&schema_name); tds_dstr_free(&catalog_name); tds_dstr_free(&table_name); tds_dstr_free(&table_type); if (SQL_SUCCEEDED(retcode) && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) { odbc_col_setname(stmt, 1, "TABLE_CAT"); odbc_col_setname(stmt, 2, "TABLE_SCHEM"); } ODBC_EXIT_(stmt); memory_error: tds_dstr_free(&schema_name); tds_dstr_free(&catalog_name); tds_dstr_free(&table_name); tds_dstr_free(&table_type); odbc_errs_add(&stmt->errs, "HY001", NULL); ODBC_EXIT_(stmt); } /** * Log a useful message about unimplemented options * Defying belief, Microsoft defines mutually exclusive options that * some ODBC implementations #define as duplicate values (meaning, of course, * that they couldn't be implemented in the same function because they're * indistinguishable. * * Those duplicates are commented out below. */ static void odbc_log_unimplemented_type(const char function_name[], int fType) { const char *name, *category; switch (fType) { #ifdef SQL_ALTER_SCHEMA case SQL_ALTER_SCHEMA: name = "SQL_ALTER_SCHEMA"; category = "Supported SQL"; break; #endif #ifdef SQL_ANSI_SQL_DATETIME_LITERALS case SQL_ANSI_SQL_DATETIME_LITERALS: name = "SQL_ANSI_SQL_DATETIME_LITERALS"; category = "Supported SQL"; break; #endif case SQL_COLLATION_SEQ: name = "SQL_COLLATION_SEQ"; category = "Data Source Information"; break; case SQL_CONVERT_BIGINT: name = "SQL_CONVERT_BIGINT"; category = "Conversion Information"; break; case SQL_CONVERT_DATE: name = "SQL_CONVERT_DATE"; category = "Conversion Information"; break; case SQL_CONVERT_DOUBLE: name = "SQL_CONVERT_DOUBLE"; category = "Conversion Information"; break; case SQL_CONVERT_INTERVAL_DAY_TIME: name = "SQL_CONVERT_INTERVAL_DAY_TIME"; category = "Conversion Information"; break; case SQL_CONVERT_INTERVAL_YEAR_MONTH: name = "SQL_CONVERT_INTERVAL_YEAR_MONTH"; category = "Conversion Information"; break; case SQL_DM_VER: name = "SQL_DM_VER"; category = "Added for ODBC 3.x"; break; case SQL_DRIVER_HDESC: name = "SQL_DRIVER_HDESC"; category = "Driver Information"; break; case SQL_DRIVER_HLIB: name = "SQL_DRIVER_HLIB"; category = "Driver Information"; break; #ifdef SQL_ODBC_STANDARD_CLI_CONFORMANCE case SQL_ODBC_STANDARD_CLI_CONFORMANCE: name = "SQL_ODBC_STANDARD_CLI_CONFORMANCE"; category = "Driver Information"; break; #endif case SQL_USER_NAME: name = "SQL_USER_NAME"; category = "Data Source Information"; break; /* TODO extension SQL_INFO_SS_NETLIB_NAME ?? */ default: name = "unknown"; category = "unknown"; break; } tdsdump_log(TDS_DBG_INFO1, "not implemented: %s: option/type %d(%s) [category %s]\n", function_name, fType, name, category); return; } static int odbc_quote_metadata(TDS_DBC * dbc, char type, char *dest, DSTR * dstr) { int unquote = 0; char prev, buf[1200], *dst; const char *s = tds_dstr_cstr(dstr); int len = tds_dstr_len(dstr); /* limit string/id lengths */ if (len > 384) len = 384; if (!type || (type == 'O' && dbc->attr.metadata_id == SQL_FALSE)) { if (dest) memcpy(dest, s, len); return len; } /* where we can have ID or PV */ assert(type == 'P' || (type == 'O' && dbc->attr.metadata_id != SQL_FALSE)); /* ID ? */ if (dbc->attr.metadata_id != SQL_FALSE) { /* strip leading and trailing spaces */ while (len > 0 && *s == ' ') ++s, --len; while (len > 0 && s[len - 1] == ' ') --len; /* unquote if necessary */ if (len > 2 && *s == '\"' && s[len - 1] == '\"') { ++s, len -= 2; unquote = 1; } } if (!dest) dest = buf; dst = dest; /* * handle patterns * "'" -> "''" (normal string quoting) * * if metadata_id is FALSE * "\_" -> "[_]" * "\%" -> "[%]" * "[" -> "[[]" * * if metadata_id is TRUE * "\"\"" -> "\"" (if unquote id) * "_" -> "[_]" * "%" -> "[%]" * "[" -> "[[]" */ prev = 0; for (; --len >= 0; ++s) { switch (*s) { case '\"': if (unquote && prev == '\"') { prev = 0; /* avoid "\"\"\"" -> "\"" */ --dst; continue; } break; case '_': case '%': if (dbc->attr.metadata_id == SQL_FALSE) { if (prev != '\\') break; --dst; } case '[': if (type != 'P') break; /* quote search string */ *dst++ = '['; *dst++ = *s; *dst++ = ']'; prev = 0; continue; } *dst++ = prev = *s; } return dst - dest; } static TDSPARAMINFO* odbc_add_char_param(TDSSOCKET *tds, TDSPARAMINFO *params, const char *name, const char *value, size_t len) { TDSCOLUMN *col; params = tds_alloc_param_result(params); if (!params) return NULL; col = params->columns[params->num_cols-1]; if (!tds_dstr_copy(&col->column_name, name)) return NULL; tds_set_param_type(tds->conn, col, IS_TDS7_PLUS(tds->conn) ? XSYBNVARCHAR : SYBVARCHAR); col->column_size = len; if (!tds_alloc_param_data(col)) return NULL; memcpy(col->column_data, value, len); col->column_cur_size = len; return params; } static TDSPARAMINFO* odbc_add_int_param(TDSSOCKET *tds, TDSPARAMINFO *params, const char *name, int value) { TDSCOLUMN *col; params = tds_alloc_param_result(params); if (!params) return NULL; col = params->columns[params->num_cols-1]; if (!tds_dstr_copy(&col->column_name, name)) return NULL; tds_set_param_type(tds->conn, col, SYBINT4); if (!tds_alloc_param_data(col)) return NULL; *((TDS_INT*) col->column_data) = value; col->column_cur_size = sizeof(TDS_INT); return params; } static SQLRETURN odbc_stat_execute(TDS_STMT * stmt _WIDE, const char *begin, int nparams, ...) { int i, len, param_qualifier = -1; char *proc = NULL, *p; SQLRETURN retcode; va_list marker; DSTR qualifier = DSTR_INITIALIZER, value = DSTR_INITIALIZER; TDSPARAMINFO *params; /* read all params and calc len required */ va_start(marker, nparams); len = strlen(begin) + 3; params = tds_alloc_results(0); if (!params) goto mem_error; for (i = 0; i < nparams; ++i) { int param_len; bool convert = true; bool add_always = false; DSTR *out; const char *name; char type; p = va_arg(marker, char *); for (; ; ++p) { switch (*p) { case '$': add_always = true; continue; case '!': convert = false; continue; case 'V': /* ODBC version */ case 'O': /* ordinary arguments */ case 'P': /* pattern value arguments */ type = *p++; break; default: type = 0; /* ordinary type */ break; } break; } name = p; p = va_arg(marker, char *); param_len = va_arg(marker, int); if (type == 'V') { int ver = (stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3) ? 3: 2; if (!odbc_add_int_param(stmt->dbc->tds_socket, params, name, ver)) goto mem_error; continue; } #ifdef ENABLE_ODBC_WIDE if (!convert) out = tds_dstr_copyn(&value, p, param_len); else out = odbc_dstr_copy(stmt->dbc, &value, param_len, (ODBC_CHAR *) p); #else out = odbc_dstr_copy(stmt->dbc, &value, param_len, (ODBC_CHAR *) p); #endif if (!out) goto mem_error; if (add_always || !tds_dstr_isempty(&value)) { char buf[1200]; int l; l = odbc_quote_metadata(stmt->dbc, type, buf, &value); if (!odbc_add_char_param(stmt->dbc->tds_socket, params, name, buf, l)) goto mem_error; if (begin[0] == '.' && strstr(name, "qualifier")) { if (!tds_dstr_dup(&qualifier, &value)) goto mem_error; len += tds_quote_id_rpc(stmt->dbc->tds_socket, NULL, tds_dstr_cstr(&qualifier), tds_dstr_len(&qualifier)); param_qualifier = i; } } } tds_dstr_free(&value); /* proc is neither mb or wide, is always utf encoded */ retcode = odbc_set_stmt_query(stmt, (ODBC_CHAR *) "-", 1 _wide0); if (retcode != SQL_SUCCESS) goto error; stmt->prepared_query_is_rpc = 1; /* set params */ tds_free_param_results(stmt->params); stmt->param_count = params->num_cols; stmt->param_num = 1 + stmt->param_count; stmt->params = params; params = NULL; /* allocate space for string */ if (!tds_dstr_alloc(&stmt->query, len)) goto mem_error; proc = tds_dstr_buf(&stmt->query); /* build query string */ p = proc; if (param_qualifier >= 0) p += tds_quote_id_rpc(stmt->dbc->tds_socket, p, tds_dstr_cstr(&qualifier), tds_dstr_len(&qualifier)); tds_dstr_free(&qualifier); strcpy(p, begin); p += strlen(begin); tds_dstr_setlen(&stmt->query, p - proc); assert(p - proc + 1 <= len); /* execute it */ retcode = _SQLExecute(stmt); if (SQL_SUCCEEDED(retcode)) odbc_upper_column_names(stmt); va_end(marker); ODBC_RETURN(stmt, retcode); mem_error: odbc_errs_add(&stmt->errs, "HY001", NULL); error: tds_dstr_free(&value); tds_dstr_free(&qualifier); tds_free_results(params); va_end(marker); return SQL_ERROR; } static SQLRETURN odbc_free_dynamic(TDS_STMT * stmt) { TDSSOCKET *tds; if (!stmt->dyn) return TDS_SUCCESS; tds = stmt->dbc->tds_socket; if (!tds_needs_unprepare(tds->conn, stmt->dyn)) { tds_release_dynamic(&stmt->dyn); return SQL_SUCCESS; } if (odbc_lock_statement(stmt)) { if (TDS_SUCCEED(tds_submit_unprepare(stmt->tds, stmt->dyn)) && TDS_SUCCEED(tds_process_simple_query(stmt->tds))) { odbc_unlock_statement(stmt); tds_release_dynamic(&stmt->dyn); return SQL_SUCCESS; } } if (TDS_SUCCEED(tds_deferred_unprepare(tds->conn, stmt->dyn))) { tds_release_dynamic(&stmt->dyn); return SQL_SUCCESS; } ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } /** * Close server cursors */ static SQLRETURN odbc_free_cursor(TDS_STMT * stmt) { TDSCURSOR *cursor = stmt->cursor; TDSSOCKET *tds; if (!cursor) return SQL_SUCCESS; /* if possible deallocate now */ if (odbc_lock_statement(stmt)) { tds = stmt->tds; cursor->status.dealloc = TDS_CURSOR_STATE_REQUESTED; if (TDS_SUCCEED(tds_cursor_close(tds, cursor))) { if (TDS_SUCCEED(tds_process_simple_query(tds))) { /* TODO check error */ tds_cursor_dealloc(tds, cursor); tds_release_cursor(&stmt->cursor); return SQL_SUCCESS; } } } tds = stmt->dbc->tds_socket; if (TDS_SUCCEED(tds_deferred_cursor_dealloc(tds->conn, cursor))) { tds_release_cursor(&stmt->cursor); return SQL_SUCCESS; } ODBC_SAFE_ERROR(stmt); return SQL_ERROR; } SQLRETURN ODBC_PUBLIC ODBC_API SQLSetScrollOptions(SQLHSTMT hstmt, SQLUSMALLINT fConcurrency, SQLLEN crowKeyset, SQLUSMALLINT crowRowset) { SQLUSMALLINT info; SQLUINTEGER value, check; SQLUINTEGER cursor_type; ODBC_ENTER_HSTMT; tdsdump_log(TDS_DBG_FUNC, "SQLSetScrollOptions(%p, %u, %ld, %u)\n", hstmt, fConcurrency, (long int) crowKeyset, crowRowset); if (!stmt->dbc->cursor_support) { odbc_errs_add(&stmt->errs, "HYC00", NULL); ODBC_EXIT_(stmt); } if (stmt->cursor) { odbc_errs_add(&stmt->errs, "24000", NULL); ODBC_EXIT_(stmt); } switch (crowKeyset) { case SQL_SCROLL_FORWARD_ONLY: info = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2; cursor_type = SQL_CURSOR_FORWARD_ONLY; break; case SQL_SCROLL_STATIC: info = SQL_STATIC_CURSOR_ATTRIBUTES2; cursor_type = SQL_CURSOR_STATIC; break; case SQL_SCROLL_KEYSET_DRIVEN: info = SQL_KEYSET_CURSOR_ATTRIBUTES2; cursor_type = SQL_CURSOR_KEYSET_DRIVEN; break; case SQL_SCROLL_DYNAMIC: info = SQL_DYNAMIC_CURSOR_ATTRIBUTES2; cursor_type = SQL_CURSOR_DYNAMIC; break; default: if (crowKeyset > crowRowset) { info = SQL_KEYSET_CURSOR_ATTRIBUTES2; cursor_type = SQL_CURSOR_KEYSET_DRIVEN; break; } odbc_errs_add(&stmt->errs, "HY107", NULL); ODBC_EXIT_(stmt); } switch (fConcurrency) { case SQL_CONCUR_READ_ONLY: check = SQL_CA2_READ_ONLY_CONCURRENCY; break; case SQL_CONCUR_LOCK: check = SQL_CA2_LOCK_CONCURRENCY; break; case SQL_CONCUR_ROWVER: check = SQL_CA2_OPT_ROWVER_CONCURRENCY; break; case SQL_CONCUR_VALUES: check = SQL_CA2_OPT_VALUES_CONCURRENCY; break; default: odbc_errs_add(&stmt->errs, "HY108", NULL); ODBC_EXIT_(stmt); } value = 0; _SQLGetInfo(stmt->dbc, info, &value, sizeof(value), NULL _wide0); if ((value & check) == 0) { odbc_errs_add(&stmt->errs, "HYC00", NULL); ODBC_EXIT_(stmt); } _SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) (TDS_INTPTR) cursor_type, 0 _wide0); _SQLSetStmtAttr(hstmt, SQL_ATTR_CONCURRENCY, (SQLPOINTER) (TDS_INTPTR) fConcurrency, 0 _wide0); _SQLSetStmtAttr(hstmt, SQL_ATTR_KEYSET_SIZE, (SQLPOINTER) (TDS_INTPTR) crowKeyset, 0 _wide0); _SQLSetStmtAttr(hstmt, SQL_ROWSET_SIZE, (SQLPOINTER) (TDS_INTPTR) crowRowset, 0 _wide0); ODBC_EXIT_(stmt); } #include "odbc_export.h" /* Under Windows driver exports functions */ /* The win_ prefix is to avoid clash with inline function. * The prefix is removed from exported functions using definition file. */ #ifdef _WIN32 RETCODE SQL_API win_bcp_initA(HDBC hdbc, const char *tblname, const char *hfile, const char *errfile, int direction); RETCODE SQL_API win_bcp_initW(HDBC hdbc, const SQLWCHAR *tblname, const SQLWCHAR *hfile, const SQLWCHAR *errfile, int direction); RETCODE SQL_API win_bcp_control(HDBC hdbc, int field, void *value); RETCODE SQL_API win_bcp_colptr(HDBC hdbc, const unsigned char * colptr, int table_column); RETCODE SQL_API win_bcp_sendrow(HDBC hdbc); int SQL_API win_bcp_batch(HDBC hdbc); int SQL_API win_bcp_done(HDBC hdbc); RETCODE SQL_API win_bcp_bind(HDBC hdbc, const unsigned char * varaddr, int prefixlen, int varlen, const unsigned char * terminator, int termlen, int vartype, int table_column); RETCODE SQL_API win_bcp_initA(HDBC hdbc, const char *tblname, const char *hfile, const char *errfile, int direction) { return bcp_initA(hdbc, tblname, hfile, errfile, direction); } #ifdef ENABLE_ODBC_WIDE RETCODE SQL_API win_bcp_initW(HDBC hdbc, const SQLWCHAR *tblname, const SQLWCHAR *hfile, const SQLWCHAR *errfile, int direction) { return bcp_initW(hdbc, tblname, hfile, errfile, direction); } #endif RETCODE SQL_API win_bcp_control(HDBC hdbc, int field, void *value) { return bcp_control(hdbc, field, value); } RETCODE SQL_API win_bcp_colptr(HDBC hdbc, const unsigned char * colptr, int table_column) { return bcp_colptr(hdbc, colptr, table_column); } RETCODE SQL_API win_bcp_sendrow(HDBC hdbc) { return bcp_sendrow(hdbc); } int SQL_API win_bcp_batch(HDBC hdbc) { return bcp_batch(hdbc); } int SQL_API win_bcp_done(HDBC hdbc) { return bcp_done(hdbc); } RETCODE SQL_API win_bcp_bind(HDBC hdbc, const unsigned char * varaddr, int prefixlen, int varlen, const unsigned char * terminator, int termlen, int vartype, int table_column) { return bcp_bind(hdbc, varaddr, prefixlen, varlen, terminator, termlen, vartype, table_column); } #endif freetds-1.3.6/src/odbc/connectparams.c000644 025423 025423 00000063207 14056414271 021316 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2005-2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #include #include #include #define ODBC_PARAM(p) static const char odbc_param_##p[] = #p; ODBC_PARAM_LIST #undef ODBC_PARAM #ifdef _WIN32 #define ODBC_PARAM(p) odbc_param_##p, static const char *odbc_param_names[] = { ODBC_PARAM_LIST }; #undef ODBC_PARAM #endif #if !HAVE_SQLGETPRIVATEPROFILESTRING /* * Last resort place to check for INI file. This is usually set at compile time * by build scripts. */ #ifndef SYS_ODBC_INI #define SYS_ODBC_INI "/etc/odbc.ini" #endif /** * Call this to get the INI file containing Data Source Names. * @note rules for determining the location of ODBC config may be different * then what you expect - at this time they differ from unixODBC * * @return file opened or NULL if error * @retval 1 worked */ static FILE *tdoGetIniFileName(void); /* avoid name collision with system headers */ #define SQLGetPrivateProfileString tds_SQLGetPrivateProfileString /** * SQLGetPrivateProfileString * * PURPOSE * * This is an implementation of a common MS API call. This implementation * should only be used if the ODBC sub-system/SDK does not have it. * For example; unixODBC has its own so those using unixODBC should NOT be * using this implementation because unixODBC; * - provides caching of ODBC config data * - provides consistent interpretation of ODBC config data (i.e, location) * * ARGS * * see ODBC documentation * * RETURNS * * see ODBC documentation * * NOTES: * * - the spec is not entirely implemented... consider this a lite version * - rules for determining the location of ODBC config may be different then what you * expect see tdoGetIniFileName(). * */ static int SQLGetPrivateProfileString(LPCSTR pszSection, LPCSTR pszEntry, LPCSTR pszDefault, LPSTR pRetBuffer, int nRetBuffer, LPCSTR pszFileName); #endif #if defined(FILENAME_MAX) && FILENAME_MAX < 512 #undef FILENAME_MAX #define FILENAME_MAX 512 #endif static int parse_server(TDS_ERRS *errs, char *server, TDSLOGIN * login) { char *p = (char *) strchr(server, '\\'); if (p) { if (!tds_dstr_copy(&login->instance_name, p+1)) { odbc_errs_add(errs, "HY001", NULL); return 0; } *p = 0; } else { p = (char *) strchr(server, ','); if (p && atoi(p+1) > 0) { login->port = atoi(p+1); *p = 0; } } if (TDS_SUCCEED(tds_lookup_host_set(server, &login->ip_addrs))) if (!tds_dstr_copy(&login->server_host_name, server)) { odbc_errs_add(errs, "HY001", NULL); return 0; } return 1; } static int myGetPrivateProfileString(const char *DSN, const char *key, char *buf) { buf[0] = '\0'; return SQLGetPrivateProfileString(DSN, key, "", buf, FILENAME_MAX, "odbc.ini"); } /** * Read connection information from given DSN * @param DSN DSN name * @param login where to store connection info * @return 1 if success 0 otherwhise */ int odbc_get_dsn_info(TDS_ERRS *errs, const char *DSN, TDSLOGIN * login) { char tmp[FILENAME_MAX]; int freetds_conf_less = 1; /* use old servername */ if (myGetPrivateProfileString(DSN, odbc_param_Servername, tmp) > 0) { freetds_conf_less = 0; if (!tds_dstr_copy(&login->server_name, tmp)) { odbc_errs_add(errs, "HY001", NULL); return 0; } tds_read_conf_file(login, tmp); if (myGetPrivateProfileString(DSN, odbc_param_Server, tmp) > 0) { odbc_errs_add(errs, "HY000", "You cannot specify both SERVERNAME and SERVER"); return 0; } if (myGetPrivateProfileString(DSN, odbc_param_Address, tmp) > 0) { odbc_errs_add(errs, "HY000", "You cannot specify both SERVERNAME and ADDRESS"); return 0; } } /* search for server (compatible with ms one) */ if (freetds_conf_less) { int address_specified = 0; if (myGetPrivateProfileString(DSN, odbc_param_Address, tmp) > 0) { address_specified = 1; /* TODO parse like MS */ if (TDS_FAILED(tds_lookup_host_set(tmp, &login->ip_addrs))) { odbc_errs_add(errs, "HY000", "Error parsing ADDRESS attribute"); return 0; } } if (myGetPrivateProfileString(DSN, odbc_param_Server, tmp) > 0) { if (!tds_dstr_copy(&login->server_name, tmp)) { odbc_errs_add(errs, "HY001", NULL); return 0; } if (!address_specified) { if (!parse_server(errs, tmp, login)) return 0; } } } if (myGetPrivateProfileString(DSN, odbc_param_Port, tmp) > 0) tds_parse_conf_section(TDS_STR_PORT, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_TDS_Version, tmp) > 0) tds_parse_conf_section(TDS_STR_VERSION, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_Language, tmp) > 0) tds_parse_conf_section(TDS_STR_LANGUAGE, tmp, login); if (tds_dstr_isempty(&login->database) && myGetPrivateProfileString(DSN, odbc_param_Database, tmp) > 0) if (!tds_dstr_copy(&login->database, tmp)) { odbc_errs_add(errs, "HY001", NULL); return 0; } if (myGetPrivateProfileString(DSN, odbc_param_TextSize, tmp) > 0) tds_parse_conf_section(TDS_STR_TEXTSZ, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_PacketSize, tmp) > 0) tds_parse_conf_section(TDS_STR_BLKSZ, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_ClientCharset, tmp) > 0) tds_parse_conf_section(TDS_STR_CLCHARSET, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_DumpFile, tmp) > 0) tds_parse_conf_section(TDS_STR_DUMPFILE, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_DumpFileAppend, tmp) > 0) tds_parse_conf_section(TDS_STR_APPENDMODE, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_DebugFlags, tmp) > 0) tds_parse_conf_section(TDS_STR_DEBUGFLAGS, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_Encryption, tmp) > 0) tds_parse_conf_section(TDS_STR_ENCRYPTION, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_UseNTLMv2, tmp) > 0) tds_parse_conf_section(TDS_STR_USENTLMV2, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_REALM, tmp) > 0) tds_parse_conf_section(TDS_STR_REALM, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_ServerSPN, tmp) > 0) tds_parse_conf_section(TDS_STR_SPN, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_Trusted_Connection, tmp) > 0 && tds_config_boolean(odbc_param_Trusted_Connection, tmp, login)) { tds_dstr_empty(&login->user_name); tds_dstr_empty(&login->password); } if (myGetPrivateProfileString(DSN, odbc_param_MARS_Connection, tmp) > 0 && tds_config_boolean(odbc_param_MARS_Connection, tmp, login)) { login->mars = 1; } if (myGetPrivateProfileString(DSN, odbc_param_AttachDbFilename, tmp) > 0) tds_parse_conf_section(TDS_STR_DBFILENAME, tmp, login); if (myGetPrivateProfileString(DSN, odbc_param_Timeout, tmp) > 0) tds_parse_conf_section(TDS_STR_TIMEOUT, tmp, login); return 1; } /** * Swap two DSTR */ static void odbc_dstr_swap(DSTR *a, DSTR *b) { DSTR tmp = *a; *a = *b; *b = tmp; } /** * Parse connection string and fill login according * @param connect_string connect string * @param connect_string_end connect string end (pointer to char past last) * @param login where to store connection info * @return 1 if success 0 otherwhise */ int odbc_parse_connect_string(TDS_ERRS *errs, const char *connect_string, const char *connect_string_end, TDSLOGIN * login, TDS_PARSED_PARAM *parsed_params) { const char *p, *end; DSTR *dest_s, value = DSTR_INITIALIZER; enum { CFG_DSN = 1, CFG_SERVER = 2, CFG_SERVERNAME = 4 }; unsigned int cfgs = 0; /* flags for indicate second parse of string */ char option[24]; int trusted = 0; if (parsed_params) memset(parsed_params, 0, sizeof(*parsed_params)*ODBC_PARAM_SIZE); for (p = connect_string; p < connect_string_end && *p;) { int num_param = -1; dest_s = NULL; /* handle empty options */ while (p < connect_string_end && *p == ';') ++p; /* parse option */ end = (const char *) memchr(p, '=', connect_string_end - p); if (!end) break; /* account for spaces between ;'s. */ while (p < end && *p == ' ') ++p; if ((end - p) >= (int) sizeof(option)) option[0] = 0; else { memcpy(option, p, end - p); option[end - p] = 0; } /* parse value */ p = end + 1; if (*p == '{') { ++p; /* search "};" */ end = p; while ((end = (const char *) memchr(end, '}', connect_string_end - end)) != NULL) { if ((end + 1) != connect_string_end && end[1] == ';') break; ++end; } } else { end = (const char *) memchr(p, ';', connect_string_end - p); } if (!end) end = connect_string_end; if (!tds_dstr_copyn(&value, p, end - p)) { odbc_errs_add(errs, "HY001", NULL); return 0; } #define CHK_PARAM(p) (strcasecmp(option, odbc_param_##p) == 0 && (num_param=ODBC_PARAM_##p) >= 0) if (CHK_PARAM(Server)) { /* error if servername or DSN specified */ if ((cfgs & (CFG_DSN|CFG_SERVERNAME)) != 0) { tds_dstr_free(&value); odbc_errs_add(errs, "HY000", "Only one between SERVER, SERVERNAME and DSN can be specified"); return 0; } if (!cfgs) { dest_s = &login->server_name; /* not that safe cast but works -- freddy77 */ if (!parse_server(errs, (char *) tds_dstr_cstr(&value), login)) { tds_dstr_free(&value); return 0; } cfgs = CFG_SERVER; } } else if (CHK_PARAM(Servername)) { if ((cfgs & (CFG_DSN|CFG_SERVER)) != 0) { tds_dstr_free(&value); odbc_errs_add(errs, "HY000", "Only one between SERVER, SERVERNAME and DSN can be specified"); return 0; } if (!cfgs) { odbc_dstr_swap(&login->server_name, &value); tds_read_conf_file(login, tds_dstr_cstr(&login->server_name)); cfgs = CFG_SERVERNAME; p = connect_string; continue; } } else if (CHK_PARAM(DSN)) { if ((cfgs & (CFG_SERVER|CFG_SERVERNAME)) != 0) { tds_dstr_free(&value); odbc_errs_add(errs, "HY000", "Only one between SERVER, SERVERNAME and DSN can be specified"); return 0; } if (!cfgs) { if (!odbc_get_dsn_info(errs, tds_dstr_cstr(&value), login)) { tds_dstr_free(&value); return 0; } cfgs = CFG_DSN; p = connect_string; continue; } } else if (CHK_PARAM(Database)) { dest_s = &login->database; } else if (CHK_PARAM(UID)) { dest_s = &login->user_name; } else if (CHK_PARAM(PWD)) { dest_s = &login->password; } else if (CHK_PARAM(APP)) { dest_s = &login->app_name; } else if (CHK_PARAM(WSID)) { dest_s = &login->client_host_name; } else if (CHK_PARAM(Language)) { tds_parse_conf_section(TDS_STR_LANGUAGE, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(Port)) { tds_parse_conf_section(TDS_STR_PORT, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(TDS_Version)) { tds_parse_conf_section(TDS_STR_VERSION, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(TextSize)) { tds_parse_conf_section(TDS_STR_TEXTSZ, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(PacketSize)) { tds_parse_conf_section(TDS_STR_BLKSZ, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(ClientCharset) || strcasecmp(option, "client_charset") == 0) { num_param = ODBC_PARAM_ClientCharset; tds_parse_conf_section(TDS_STR_CLCHARSET, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(DumpFile)) { tds_parse_conf_section(TDS_STR_DUMPFILE, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(DumpFileAppend)) { tds_parse_conf_section(TDS_STR_APPENDMODE, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(DebugFlags)) { tds_parse_conf_section(TDS_STR_DEBUGFLAGS, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(Encryption)) { tds_parse_conf_section(TDS_STR_ENCRYPTION, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(UseNTLMv2)) { tds_parse_conf_section(TDS_STR_USENTLMV2, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(REALM)) { tds_parse_conf_section(TDS_STR_REALM, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(ServerSPN)) { tds_parse_conf_section(TDS_STR_SPN, tds_dstr_cstr(&value), login); } else if (CHK_PARAM(Trusted_Connection)) { trusted = tds_config_boolean(option, tds_dstr_cstr(&value), login); tdsdump_log(TDS_DBG_INFO1, "trusted %s -> %d\n", tds_dstr_cstr(&value), trusted); num_param = -1; /* TODO odbc_param_Address field */ } else if (CHK_PARAM(MARS_Connection)) { if (tds_config_boolean(option, tds_dstr_cstr(&value), login)) login->mars = 1; } else if (CHK_PARAM(AttachDbFilename)) { dest_s = &login->db_filename; } else if (CHK_PARAM(ApplicationIntent)) { const char *readonly_intent; if (strcasecmp(tds_dstr_cstr(&value), "ReadOnly") == 0) { readonly_intent = "yes"; } else if (strcasecmp(tds_dstr_cstr(&value), "ReadWrite") == 0) { readonly_intent = "no"; } else { tdsdump_log(TDS_DBG_ERROR, "Invalid ApplicationIntent %s\n", tds_dstr_cstr(&value)); tds_dstr_free(&value); return 0; } tds_parse_conf_section(TDS_STR_READONLY_INTENT, readonly_intent, login); tdsdump_log(TDS_DBG_INFO1, "Application Intent %s\n", readonly_intent); } else if (CHK_PARAM(Timeout)) { tds_parse_conf_section(TDS_STR_TIMEOUT, tds_dstr_cstr(&value), login); } if (num_param >= 0 && parsed_params) { parsed_params[num_param].p = p; parsed_params[num_param].len = end - p; } /* copy to destination */ if (dest_s) odbc_dstr_swap(dest_s, &value); p = end; /* handle "" ";.." "};.." cases */ if (p >= connect_string_end) break; if (*p == '}') ++p; ++p; } if (trusted) { if (parsed_params) { parsed_params[ODBC_PARAM_Trusted_Connection].p = "Yes"; parsed_params[ODBC_PARAM_Trusted_Connection].len = 3; parsed_params[ODBC_PARAM_UID].p = NULL; parsed_params[ODBC_PARAM_PWD].p = NULL; } tds_dstr_empty(&login->user_name); tds_dstr_empty(&login->password); } tds_dstr_free(&value); return 1; } #ifdef _WIN32 int odbc_build_connect_string(TDS_ERRS *errs, TDS_PARSED_PARAM *params, char **out) { unsigned n; size_t len = 1; char *p; /* compute string size */ for (n = 0; n < ODBC_PARAM_SIZE; ++n) { if (params[n].p) len += strlen(odbc_param_names[n]) + params[n].len + 2; } /* allocate */ p = tds_new(char, len); if (!p) { odbc_errs_add(errs, "HY001", NULL); return 0; } *out = p; /* build it */ for (n = 0; n < ODBC_PARAM_SIZE; ++n) { if (params[n].p) p += sprintf(p, "%s=%.*s;", odbc_param_names[n], (int) params[n].len, params[n].p); } *p = 0; return 1; } #endif #if !HAVE_SQLGETPRIVATEPROFILESTRING #ifdef _WIN32 # error There is something wrong in configuration... #endif typedef struct { LPCSTR entry; LPSTR buffer; int buffer_len; int ret_val; int found; } ProfileParam; static void tdoParseProfile(const char *option, const char *value, void *param) { ProfileParam *p = (ProfileParam *) param; if (strcasecmp(p->entry, option) == 0) { strlcpy(p->buffer, value, p->buffer_len); p->ret_val = strlen(p->buffer); p->found = 1; } } static int SQLGetPrivateProfileString(LPCSTR pszSection, LPCSTR pszEntry, LPCSTR pszDefault, LPSTR pRetBuffer, int nRetBuffer, LPCSTR pszFileName) { FILE *hFile; ProfileParam param; tdsdump_log(TDS_DBG_FUNC, "SQLGetPrivateProfileString(%p, %p, %p, %p, %d, %p)\n", pszSection, pszEntry, pszDefault, pRetBuffer, nRetBuffer, pszFileName); if (!pszSection) { /* spec says return list of all section names - but we will just return nothing */ tdsdump_log(TDS_DBG_WARN, "WARNING: Functionality for NULL pszSection not implemented.\n"); return 0; } if (!pszEntry) { /* spec says return list of all key names in section - but we will just return nothing */ tdsdump_log(TDS_DBG_WARN, "WARNING: Functionality for NULL pszEntry not implemented.\n"); return 0; } if (nRetBuffer < 1) tdsdump_log(TDS_DBG_WARN, "WARNING: No space to return a value because nRetBuffer < 1.\n"); if (pszFileName && *pszFileName == '/') hFile = fopen(pszFileName, "r"); else hFile = tdoGetIniFileName(); if (hFile == NULL) { tdsdump_log(TDS_DBG_ERROR, "ERROR: Could not open configuration file\n"); return 0; } param.entry = pszEntry; param.buffer = pRetBuffer; param.buffer_len = nRetBuffer; param.ret_val = 0; param.found = 0; pRetBuffer[0] = 0; tds_read_conf_section(hFile, pszSection, tdoParseProfile, ¶m); if (pszDefault && !param.found) { strlcpy(pRetBuffer, pszDefault, nRetBuffer); param.ret_val = strlen(pRetBuffer); } fclose(hFile); return param.ret_val; } static FILE * tdoGetIniFileName() { FILE *ret = NULL; char *p; char *fn; /* * First, try the ODBCINI environment variable */ if ((p = getenv("ODBCINI")) != NULL) ret = fopen(p, "r"); /* * Second, try the HOME environment variable */ if (!ret && (p = tds_get_homedir()) != NULL) { fn = NULL; if (asprintf(&fn, "%s/.odbc.ini", p) > 0) { ret = fopen(fn, "r"); free(fn); } free(p); } /* * As a last resort, try SYS_ODBC_INI */ if (!ret) ret = fopen(SYS_ODBC_INI, "r"); return ret; } #endif /* !HAVE_SQLGETPRIVATEPROFILESTRING */ #ifdef UNIXODBC /* * Begin BIG Hack. * * We need these from odbcinstext.h but it wants to * include and , which are not in the * standard include path. XXX smurph * confirmed by unixODBC stuff, odbcinstext.h shouldn't be installed. freddy77 */ #define INI_MAX_LINE 1000 #define INI_MAX_OBJECT_NAME INI_MAX_LINE #define INI_MAX_PROPERTY_NAME INI_MAX_LINE #define INI_MAX_PROPERTY_VALUE INI_MAX_LINE #define ODBCINST_PROMPTTYPE_LABEL 0 /* readonly */ #define ODBCINST_PROMPTTYPE_TEXTEDIT 1 #define ODBCINST_PROMPTTYPE_LISTBOX 2 #define ODBCINST_PROMPTTYPE_COMBOBOX 3 #define ODBCINST_PROMPTTYPE_FILENAME 4 #define ODBCINST_PROMPTTYPE_HIDDEN 5 typedef struct tODBCINSTPROPERTY { struct tODBCINSTPROPERTY *pNext; /* pointer to next property, NULL if last property */ char szName[INI_MAX_PROPERTY_NAME + 1]; /* property name */ char szValue[INI_MAX_PROPERTY_VALUE + 1]; /* property value */ int nPromptType; /* PROMPTTYPE_TEXTEDIT, PROMPTTYPE_LISTBOX, PROMPTTYPE_COMBOBOX, PROMPTTYPE_FILENAME */ char **aPromptData; /* array of pointers terminated with a NULL value in array. */ char *pszHelp; /* help on this property (driver setups should keep it short) */ void *pWidget; /* CALLER CAN STORE A POINTER TO ? HERE */ int bRefresh; /* app should refresh widget ie Driver Setup has changed aPromptData or szValue */ void *hDLL; /* for odbcinst internal use... only first property has valid one */ } ODBCINSTPROPERTY, *HODBCINSTPROPERTY; /* * End BIG Hack. */ int ODBCINSTGetProperties(HODBCINSTPROPERTY hLastProperty); static const char *const aTDSver[] = { "", "4.2", "5.0", "7.0", "7.1", "7.2", "7.3", "7.4", NULL }; static const char *const aLanguage[] = { "us_english", NULL }; static const char *const aEncryption[] = { TDS_STR_ENCRYPTION_OFF, TDS_STR_ENCRYPTION_REQUEST, TDS_STR_ENCRYPTION_REQUIRE, NULL }; static const char *const aBoolean[] = { "Yes", "No", NULL }; /* static const char *aAuth[] = { "Server", "Domain", "Both", NULL }; */ static HODBCINSTPROPERTY addProperty(HODBCINSTPROPERTY hLastProperty) { hLastProperty->pNext = (HODBCINSTPROPERTY) calloc(1, sizeof(ODBCINSTPROPERTY)); hLastProperty = hLastProperty->pNext; return hLastProperty; } static HODBCINSTPROPERTY definePropertyString(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, const char *comment) { hLastProperty = addProperty(hLastProperty); hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); hLastProperty->pszHelp = (char *) strdup(comment); return hLastProperty; } static HODBCINSTPROPERTY definePropertyBoolean(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, const char *comment) { hLastProperty = addProperty(hLastProperty); hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_LISTBOX; hLastProperty->aPromptData = malloc(sizeof(aBoolean)); memcpy(hLastProperty->aPromptData, aBoolean, sizeof(aBoolean)); strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); hLastProperty->pszHelp = (char *) strdup(comment); return hLastProperty; } static HODBCINSTPROPERTY definePropertyHidden(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, const char *comment) { hLastProperty = addProperty(hLastProperty); hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_HIDDEN; strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); hLastProperty->pszHelp = (char *) strdup(comment); return hLastProperty; } static HODBCINSTPROPERTY definePropertyList(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, const void *list, int size, const char *comment) { hLastProperty = addProperty(hLastProperty); hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_LISTBOX; hLastProperty->aPromptData = malloc(size); memcpy(hLastProperty->aPromptData, list, size); strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); hLastProperty->pszHelp = (char *) strdup(comment); return hLastProperty; } int ODBCINSTGetProperties(HODBCINSTPROPERTY hLastProperty) { hLastProperty = definePropertyString(hLastProperty, odbc_param_Servername, "", "Name of FreeTDS connection to connect to.\n" "This server name refer to entry in freetds.conf file, not real server name.\n" "This property cannot be used with Server property."); hLastProperty = definePropertyString(hLastProperty, odbc_param_Server, "", "Name of server to connect to.\n" "This should be the name of real server.\n" "This property cannot be used with Servername property."); hLastProperty = definePropertyString(hLastProperty, odbc_param_Address, "", "The hostname or ip address of the server."); hLastProperty = definePropertyString(hLastProperty, odbc_param_Port, "1433", "TCP/IP Port to connect to."); hLastProperty = definePropertyString(hLastProperty, odbc_param_Database, "", "Default database."); hLastProperty = definePropertyList(hLastProperty, odbc_param_TDS_Version, "4.2", (void*) aTDSver, sizeof(aTDSver), "The TDS protocol version.\n" " 4.2 MSSQL 6.5 or Sybase < 10.x\n" " 5.0 Sybase >= 10.x\n" " 7.0 MSSQL 7\n" " 7.1 MSSQL 2000\n" " 7.2 MSSQL 2005\n" " 7.3 MSSQL 2008\n" " 7.4 MSSQL 2012 or 2014" ); hLastProperty = definePropertyList(hLastProperty, odbc_param_Language, "us_english", (void*) aLanguage, sizeof(aLanguage), "The default language setting."); hLastProperty = definePropertyHidden(hLastProperty, odbc_param_TextSize, "", "Text datatype limit."); /* ??? in odbc.ini ??? */ /* hLastProperty = definePropertyString(hLastProperty, odbc_param_UID, "", "User ID (Beware of security issues)."); hLastProperty = definePropertyString(hLastProperty, odbc_param_PWD, "", "Password (Beware of security issues)."); */ /* hLastProperty = definePropertyList(hLastProperty, odbc_param_Authentication, "Server", aAuth, sizeof(aAuth), "The server authentication mechanism."); hLastProperty = definePropertyString(hLastProperty, odbc_param_Domain, "", "The default domain to use when using Domain Authentication."); */ hLastProperty = definePropertyString(hLastProperty, odbc_param_PacketSize, "", "Size of network packets."); hLastProperty = definePropertyString(hLastProperty, odbc_param_ClientCharset, "", "The client character set name to convert application characters to UCS-2 in TDS 7.0 and higher."); hLastProperty = definePropertyString(hLastProperty, odbc_param_DumpFile, "", "Specifies the location of a tds dump file and turns on logging."); hLastProperty = definePropertyBoolean(hLastProperty, odbc_param_DumpFileAppend, "", "Appends dump file instead of overwriting it. Useful for debugging when many processes are active."); hLastProperty = definePropertyString(hLastProperty, odbc_param_DebugFlags, "", "Sets granularity of logging. A set of bit that specify levels and informations. See table below for bit specification."); hLastProperty = definePropertyList(hLastProperty, odbc_param_Encryption, TDS_STR_ENCRYPTION_OFF, aEncryption, sizeof(aEncryption), "The encryption method."); hLastProperty = definePropertyString(hLastProperty, odbc_param_Timeout, "10", "Connection timeout."); return 1; } #endif freetds-1.3.6/src/odbc/convert_tds2sql.c000644 025423 025423 00000042734 14056414221 021612 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2003-2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include #include #include #define TDS_ISSPACE(c) isspace((unsigned char) (c)) /** * Copy beginning of column_iconv_buf */ static void eat_iconv_left(TDSCOLUMN * curcol, char **pbuf, size_t *plen) { unsigned cp = ODBC_MIN(*plen, curcol->column_iconv_left); memcpy(*pbuf, curcol->column_iconv_buf, cp); if (cp < curcol->column_iconv_left) memmove(curcol->column_iconv_buf, curcol->column_iconv_buf + cp, curcol->column_iconv_left - cp); curcol->column_iconv_left -= cp; *pbuf += cp; *plen -= cp; } /** * Handle conversions from TDS (N)CHAR to ODBC (W)CHAR */ static SQLLEN odbc_convert_char(TDS_STMT * stmt, TDSCOLUMN * curcol, TDS_CHAR * src, TDS_UINT srclen, int desttype, TDS_CHAR * dest, SQLULEN destlen) { const char *ib; char *ob; size_t il, ol, char_size; /* FIXME MARS not correct cause is the global tds but stmt->tds can be NULL on SQLGetData */ TDSSOCKET *tds = stmt->dbc->tds_socket; TDSICONV *conv = curcol->char_conv; if (!conv) conv = tds->conn->char_convs[client2server_chardata]; if (desttype == SQL_C_WCHAR) { int charset = odbc_get_wide_canonic(tds->conn); /* SQL_C_WCHAR, convert to wide encode */ conv = tds_iconv_get_info(tds->conn, charset, conv->to.charset.canonic); if (!conv) conv = tds_iconv_get_info(tds->conn, charset, TDS_CHARSET_ISO_8859_1); #ifdef ENABLE_ODBC_WIDE } else { conv = tds_iconv_get_info(tds->conn, stmt->dbc->original_charset_num, conv->to.charset.canonic); if (!conv) conv = tds_iconv_get_info(tds->conn, stmt->dbc->original_charset_num, TDS_CHARSET_ISO_8859_1); if (!conv) conv = tds_iconv_get_info(tds->conn, TDS_CHARSET_ISO_8859_1, TDS_CHARSET_ISO_8859_1); #endif } ib = src; il = srclen; ob = dest; ol = 0; char_size = desttype == SQL_C_CHAR ? 1 : SIZEOF_SQLWCHAR; if (destlen >= char_size) { ol = destlen - char_size; /* copy left and continue only if possible */ eat_iconv_left(curcol, &ob, &ol); if (ol) { memset(&conv->suppress, 0, sizeof(conv->suppress)); conv->suppress.eilseq = 1; conv->suppress.e2big = 1; /* TODO check return value */ tds_iconv(tds, conv, to_client, &ib, &il, &ob, &ol); } /* if input left try to decode on future left */ if (il && ol < sizeof(curcol->column_iconv_buf) && curcol->column_iconv_left == 0) { char *left_ob = curcol->column_iconv_buf; size_t left_ol = sizeof(curcol->column_iconv_buf); conv->suppress.eilseq = 1; conv->suppress.einval = 1; conv->suppress.e2big = 1; tds_iconv(tds, conv, to_client, &ib, &il, &left_ob, &left_ol); curcol->column_iconv_left = sizeof(curcol->column_iconv_buf) - left_ol; /* copy part to fill buffer */ eat_iconv_left(curcol, &ob, &ol); } ol = ob - dest; /* bytes written */ curcol->column_text_sqlgetdatapos += ib - src; /* terminate string */ memset(ob, 0, char_size); } /* returned size have to take into account buffer left unconverted */ if (il == 0 || (conv->from.charset.min_bytes_per_char == conv->from.charset.max_bytes_per_char && conv->to.charset.min_bytes_per_char == conv->to.charset.max_bytes_per_char)) { ol += il * conv->from.charset.min_bytes_per_char / conv->to.charset.min_bytes_per_char + curcol->column_iconv_left; } else if ((conv->flags & TDS_ENCODING_MEMCPY) != 0) { ol += il + curcol->column_iconv_left; } else { /* TODO convert and discard ?? or return proper SQL_NO_TOTAL values ?? */ return SQL_NO_TOTAL; } return ol; } /** * Handle conversions from TDS NCHAR to ISO8859-1 striping spaces (for fixed types) */ static int odbc_tds_convert_wide_iso(TDSCOLUMN *curcol, TDS_CHAR *src, TDS_UINT srclen, TDS_CHAR *buf, TDS_UINT buf_len) { TDS_CHAR *p; /* * TODO check for endian * This affect for instance Sybase under little endian system */ /* skip white spaces */ while (srclen > 1 && src[1] == 0 && TDS_ISSPACE(src[0])) { srclen -= 2; src += 2; } /* convert */ p = buf; while (buf_len > 1 && srclen > 1 && src[1] == 0) { *p++ = src[0]; --buf_len; srclen -= 2; src += 2; } /* skip white spaces */ while (srclen > 1 && src[1] == 0 && TDS_ISSPACE(src[0])) { srclen -= 2; src += 2; } /* still characters, wrong format */ if (srclen) return -1; *p = 0; return p - buf; } /* The following structure is going to write in these structure not using them * but just knowing the ABI. Check these ABI. Mainly make sure the alignment * is still correct. */ TDS_COMPILE_CHECK(ss_time2, sizeof(SQL_SS_TIME2_STRUCT) == 12 && TDS_OFFSET(SQL_SS_TIME2_STRUCT, fraction) == 8); TDS_COMPILE_CHECK(ss_timestampoffset, sizeof(SQL_SS_TIMESTAMPOFFSET_STRUCT) == 20 && TDS_OFFSET(SQL_SS_TIMESTAMPOFFSET_STRUCT, fraction) == 12); TDS_COMPILE_CHECK(date_struct, sizeof(DATE_STRUCT) == 6 && TDS_OFFSET(DATE_STRUCT, year) == 0 && TDS_OFFSET(DATE_STRUCT, month) == 2 && TDS_OFFSET(DATE_STRUCT, day) == 4); TDS_COMPILE_CHECK(timestamp_struct, sizeof(TIMESTAMP_STRUCT) == 16 && TDS_OFFSET(TIMESTAMP_STRUCT, year) == 0 && TDS_OFFSET(TIMESTAMP_STRUCT, month) == 2 && TDS_OFFSET(TIMESTAMP_STRUCT, day) == 4 && TDS_OFFSET(TIMESTAMP_STRUCT, hour) == 6 && TDS_OFFSET(TIMESTAMP_STRUCT, minute) == 8 && TDS_OFFSET(TIMESTAMP_STRUCT, second) == 10 && TDS_OFFSET(TIMESTAMP_STRUCT, fraction) == 12); /** * Handle conversions from MSSQL 2008 DATE/TIME types to binary. * These types have a different binary representation in libTDS. */ static SQLLEN odbc_convert_datetime_to_binary(TDS_STMT * stmt, TDSCOLUMN *curcol, int srctype, TDS_DATETIMEALL * dta, TDS_CHAR * dest, SQLULEN destlen) { size_t len, cplen; TDS_USMALLINT buf[10]; TDSDATEREC when; tds_datecrack(srctype, dta, &when); len = 0; if (srctype != SYBMSTIME && srctype != SYBTIME && srctype != SYB5BIGTIME) { buf[0] = when.year; buf[1] = when.month + 1; buf[2] = when.day; len = 3; } if (srctype != SYBMSDATE && srctype != SYBDATE) { buf[len++] = when.hour; buf[len++] = when.minute; buf[len++] = when.second; if ((len % 2) != 0) buf[len++] = 0; *((TDS_UINT*) (buf+len)) = when.decimicrosecond * 100u; len += 2; } if (srctype == SYBMSDATETIMEOFFSET) { /* TODO check for negative hour/minutes */ buf[8] = dta->offset / 60; buf[9] = dta->offset % 60; len = 10; } len *= 2; /* just return length */ if (destlen == 0) return len; cplen = ODBC_MIN(destlen, len); memcpy(dest, buf, cplen); if (curcol) curcol->column_text_sqlgetdatapos += cplen; return len; } static SQLLEN odbc_convert_to_binary(TDS_STMT * stmt, TDSCOLUMN *curcol, int srctype, TDS_CHAR * src, TDS_UINT srclen, TDS_CHAR * dest, SQLULEN destlen) { SQLLEN ret = srclen; /* special case for date/time */ switch (srctype) { case SYBMSTIME: case SYBMSDATE: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYBDATE: case SYBTIME: case SYB5BIGTIME: case SYB5BIGDATETIME: return odbc_convert_datetime_to_binary(stmt, curcol, srctype, (TDS_DATETIMEALL *) src, dest, destlen); } /* if destlen == 0 we return only length */ if (destlen > 0) { size_t cplen = ODBC_MIN(destlen, srclen); /* do not NUL terminate binary buffer */ memcpy(dest, src, cplen); if (curcol) curcol->column_text_sqlgetdatapos += cplen; } return ret; } static SQLLEN odbc_tds2sql(TDS_STMT * stmt, TDSCOLUMN *curcol, int srctype, TDS_CHAR * src, TDS_UINT srclen, int desttype, TDS_CHAR * dest, SQLULEN destlen, const struct _drecord *drec_ixd) { TDS_INT nDestSybType; TDS_INT nRetVal = TDS_CONVERT_FAIL; TDSCONTEXT *context = stmt->dbc->env->tds_ctx; CONV_RESULT ores; SQLLEN ret = SQL_NULL_DATA; int i, cplen; int binary_conversion = 0; TDS_CHAR conv_buf[256]; tdsdump_log(TDS_DBG_FUNC, "odbc_tds2sql: src is %d dest = %d\n", srctype, desttype); assert(desttype != SQL_C_DEFAULT); nDestSybType = odbc_c_to_server_type(desttype); if (!nDestSybType) { odbc_errs_add(&stmt->errs, "HY003", NULL); return SQL_NULL_DATA; } /* special case for binary type */ if (desttype == SQL_C_BINARY) { tdsdump_log(TDS_DBG_FUNC, "odbc_tds2sql: outputting binary data destlen = %lu \n", (unsigned long) destlen); if (is_numeric_type(srctype)) { desttype = SQL_C_NUMERIC; nDestSybType = SYBNUMERIC; /* prevent buffer overflow */ if (destlen < sizeof(SQL_NUMERIC_STRUCT)) { odbc_errs_add(&stmt->errs, "07006", NULL); return SQL_NULL_DATA; } ores.n.precision = ((TDS_NUMERIC *) src)->precision; ores.n.scale = ((TDS_NUMERIC *) src)->scale; } else { return odbc_convert_to_binary(stmt, curcol, srctype, src, srclen, dest, destlen); } } else if (is_numeric_type(nDestSybType)) { /* TODO use descriptor information (APD) ?? However APD can contain SQL_C_DEFAULT... */ if (drec_ixd) ores.n.precision = drec_ixd->sql_desc_precision; else ores.n.precision = 38; ores.n.scale = 0; } if (is_char_type(srctype)) { if (desttype == SQL_C_CHAR || desttype == SQL_C_WCHAR) return odbc_convert_char(stmt, curcol, src, srclen, desttype, dest, destlen); if (is_unicode_type(srctype)) { /* * convert to single and then process normally. * Here we processed SQL_C_BINARY and SQL_C_*CHAR so only fixed types are left */ i = odbc_tds_convert_wide_iso(curcol, src, srclen, conv_buf, sizeof(conv_buf)); if (i < 0) return SQL_NULL_DATA; src = conv_buf; srclen = i; srctype = SYBVARCHAR; } } if (desttype == SQL_C_WCHAR) destlen /= sizeof(SQLWCHAR); if (desttype == SQL_C_CHAR || desttype == SQL_C_WCHAR) { if (is_binary_type(srctype)) { binary_conversion = 1; if (destlen && !(destlen % 2)) --destlen; } nDestSybType = TDS_CONVERT_CHAR; ores.cc.len = destlen; ores.cc.c = dest; } if (desttype == SQL_C_CHAR || desttype == SQL_C_WCHAR) { char buf[48]; TDSDATEREC when; int prec; const char *fmt = NULL; const TDS_DATETIMEALL *dta = (const TDS_DATETIMEALL *) src; switch (srctype) { case SYBMSDATETIMEOFFSET: case SYBMSDATETIME2: prec = dta->time_prec; goto datetime; case SYB5BIGDATETIME: prec = 6; goto datetime; case SYBDATETIME: prec = 3; goto datetime; case SYBDATETIME4: prec = 0; datetime: fmt = "%Y-%m-%d %H:%M:%S.%z"; break; case SYBMSTIME: prec = dta->time_prec; goto time; case SYB5BIGTIME: prec = 6; goto time; case SYBTIME: prec = 3; time: fmt = "%H:%M:%S.%z"; break; case SYBMSDATE: case SYBDATE: prec = 0; fmt = "%Y-%m-%d"; break; } if (!fmt) goto normal_conversion; tds_datecrack(srctype, src, &when); tds_strftime(buf, sizeof(buf), fmt, &when, prec); if (srctype == SYBMSDATETIMEOFFSET) { char sign = '+'; int off = dta->offset; if (off < 0) { sign = '-'; off = -off; } sprintf(buf + strlen(buf), " %c%02d:%02d", sign, off / 60, off % 60); } nRetVal = strlen(buf); memcpy(dest, buf, ODBC_MIN(destlen, nRetVal)); } else { normal_conversion: nRetVal = tds_convert(context, srctype, src, srclen, nDestSybType, &ores); } if (nRetVal < 0) { odbc_convert_err_set(&stmt->errs, nRetVal); return SQL_NULL_DATA; } switch (desttype) { case SQL_C_CHAR: tdsdump_log(TDS_DBG_FUNC, "odbc_tds2sql: outputting character data destlen = %lu \n", (unsigned long) destlen); ret = nRetVal; /* TODO handle not terminated configuration */ if (destlen > 0) { cplen = ODBC_MIN(destlen - 1, nRetVal); assert(cplen >= 0); /* * odbc always terminate but do not overwrite * destination buffer more than needed */ /* update datapos only for binary source (char already handled) */ if (curcol && binary_conversion) curcol->column_text_sqlgetdatapos += cplen / 2; dest[cplen] = 0; } else { /* if destlen == 0 we return only length */ } break; case SQL_C_WCHAR: tdsdump_log(TDS_DBG_FUNC, "odbc_tds2sql: outputting character data destlen = %lu \n", (unsigned long) destlen); ret = nRetVal * sizeof(SQLWCHAR); /* TODO handle not terminated configuration */ if (destlen > 0) { SQLWCHAR *wp = (SQLWCHAR *) dest; SQLCHAR *p = (SQLCHAR *) dest; cplen = ODBC_MIN(destlen - 1, nRetVal); assert(cplen >= 0); /* * odbc always terminate but do not overwrite * destination buffer more than needed */ /* update datapos only for binary source (char already handled) */ if (curcol && binary_conversion) curcol->column_text_sqlgetdatapos += cplen / 2; /* convert in place and terminate */ wp[cplen] = 0; while (cplen > 0) { --cplen; wp[cplen] = p[cplen]; } } else { /* if destlen == 0 we return only length */ } break; case SQL_C_TYPE_DATE: case SQL_C_DATE: { TDSDATEREC dr; DATE_STRUCT *dsp = (DATE_STRUCT *) dest; /* * we've already converted the returned value to a SYBMSDATETIME2 * now decompose date into constituent parts... */ tds_datecrack(SYBMSDATETIME2, &(ores.dt), &dr); dsp->year = dr.year; dsp->month = dr.month + 1; dsp->day = dr.day; ret = sizeof(DATE_STRUCT); } break; case SQL_C_TYPE_TIME: case SQL_C_TIME: { TDSDATEREC dr; TIME_STRUCT *tsp = (TIME_STRUCT *) dest; /* * we've already converted the returned value to a SYBMSDATETIME2 * now decompose date into constituent parts... */ tds_datecrack(SYBMSDATETIME2, &(ores.dt), &dr); tsp->hour = dr.hour; tsp->minute = dr.minute; tsp->second = dr.second; ret = sizeof(TIME_STRUCT); } break; case SQL_C_TYPE_TIMESTAMP: case SQL_C_TIMESTAMP: { TDSDATEREC dr; TIMESTAMP_STRUCT *tssp = (TIMESTAMP_STRUCT *) dest; /* * we've already converted the returned value to a SYBMSDATETIME2 * now decompose date into constituent parts... */ tds_datecrack(SYBMSDATETIME2, &(ores.dt), &dr); tssp->year = dr.year; tssp->month = dr.month + 1; tssp->day = dr.day; tssp->hour = dr.hour; tssp->minute = dr.minute; tssp->second = dr.second; tssp->fraction = dr.decimicrosecond * 100u; ret = sizeof(TIMESTAMP_STRUCT); } break; #ifdef SQL_C_SBIGINT case SQL_C_SBIGINT: case SQL_C_UBIGINT: *((TDS_INT8 *) dest) = ores.bi; ret = sizeof(TDS_INT8); break; #endif case SQL_C_LONG: case SQL_C_SLONG: case SQL_C_ULONG: *((TDS_INT *) dest) = ores.i; ret = sizeof(TDS_INT); break; case SQL_C_SHORT: case SQL_C_SSHORT: case SQL_C_USHORT: *((TDS_SMALLINT *) dest) = ores.si; ret = sizeof(TDS_SMALLINT); break; case SQL_C_TINYINT: case SQL_C_STINYINT: case SQL_C_UTINYINT: case SQL_C_BIT: *((TDS_TINYINT *) dest) = ores.ti; ret = sizeof(TDS_TINYINT); break; case SQL_C_DOUBLE: *((TDS_FLOAT *) dest) = ores.f; ret = sizeof(TDS_FLOAT); break; case SQL_C_FLOAT: *((TDS_REAL *) dest) = ores.r; ret = sizeof(TDS_REAL); break; case SQL_C_NUMERIC: { /* ODBC numeric is quite different from TDS one ... */ SQL_NUMERIC_STRUCT *num = (SQL_NUMERIC_STRUCT *) dest; num->precision = ores.n.precision; num->scale = ores.n.scale; num->sign = ores.n.array[0] ^ 1; /* * TODO can be greater than SQL_MAX_NUMERIC_LEN ?? * seeing Sybase manual wire support bigger numeric but currently * DBs so not support such precision */ i = ODBC_MIN(tds_numeric_bytes_per_prec[ores.n.precision] - 1, SQL_MAX_NUMERIC_LEN); memcpy(num->val, ores.n.array + 1, i); tds_swap_bytes(num->val, i); if (i < SQL_MAX_NUMERIC_LEN) memset(num->val + i, 0, SQL_MAX_NUMERIC_LEN - i); ret = sizeof(SQL_NUMERIC_STRUCT); } break; #ifdef SQL_C_GUID case SQL_C_GUID: memcpy(dest, &(ores.u), sizeof(TDS_UNIQUE)); ret = sizeof(TDS_UNIQUE); break; #endif default: break; } return ret; } SQLLEN odbc_tds2sql_col(TDS_STMT * stmt, TDSCOLUMN *curcol, int desttype, TDS_CHAR * dest, SQLULEN destlen, const struct _drecord *drec_ixd) { int srctype = tds_get_conversion_type(curcol->on_server.column_type, curcol->on_server.column_size); TDS_CHAR *src = (TDS_CHAR *) curcol->column_data; TDS_UINT srclen = curcol->column_cur_size; if (is_blob_col(curcol)) { if (srctype == SYBLONGBINARY && ( curcol->column_usertype == USER_UNICHAR_TYPE || curcol->column_usertype == USER_UNIVARCHAR_TYPE)) srctype = SYBNTEXT; if (curcol->column_type == SYBVARIANT) srctype = ((TDSVARIANT *) src)->type; src = ((TDSBLOB *) src)->textvalue; } if (is_variable_type(srctype)) { src += curcol->column_text_sqlgetdatapos; srclen -= curcol->column_text_sqlgetdatapos; } return odbc_tds2sql(stmt, curcol, srctype, src, srclen, desttype, dest, destlen, drec_ixd); } SQLLEN odbc_tds2sql_int4(TDS_STMT * stmt, TDS_INT *src, int desttype, TDS_CHAR * dest, SQLULEN destlen) { return odbc_tds2sql(stmt, NULL, SYBINT4, (TDS_CHAR *) src, sizeof(*src), desttype, dest, destlen, NULL); } freetds-1.3.6/src/odbc/descriptor.c000644 025423 025423 00000011632 14056414221 020625 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2003 Steve Murphree * Copyright (C) 2004, 2005 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include static void desc_free_record(struct _drecord *drec); TDS_DESC * desc_alloc(SQLHANDLE parent, int desc_type, int alloc_type) { TDS_DESC *desc; desc = tds_new0(TDS_DESC, 1); if (!desc || tds_mutex_init(&desc->mtx)) { free(desc); return NULL; } /* set default header values */ desc->htype = SQL_HANDLE_DESC; desc->type = desc_type; desc->parent = parent; desc->header.sql_desc_alloc_type = alloc_type; desc->header.sql_desc_count = 0; desc->records = NULL; switch (desc_type) { case DESC_IRD: case DESC_IPD: break; case DESC_ARD: case DESC_APD: desc->header.sql_desc_bind_type = SQL_BIND_BY_COLUMN; desc->header.sql_desc_array_size = 1; break; default: free(desc); return NULL; } return desc; } #define SQL_DESC_STRINGS \ STR_OP(sql_desc_base_column_name); \ STR_OP(sql_desc_base_table_name); \ STR_OP(sql_desc_catalog_name); \ STR_OP(sql_desc_label); \ STR_OP(sql_desc_local_type_name); \ STR_OP(sql_desc_name); \ STR_OP(sql_desc_schema_name); \ STR_OP(sql_desc_table_name) SQLRETURN desc_alloc_records(TDS_DESC * desc, unsigned count) { struct _drecord *drec; int i; /* shrink records */ if (desc->header.sql_desc_count >= count) { for (i = count; i < desc->header.sql_desc_count; ++i) desc_free_record(&desc->records[i]); desc->header.sql_desc_count = count; return SQL_SUCCESS; } if (!TDS_RESIZE(desc->records, count)) return SQL_ERROR; memset(desc->records + desc->header.sql_desc_count, 0, sizeof(struct _drecord) * (count - desc->header.sql_desc_count)); for (i = desc->header.sql_desc_count; i < count; ++i) { drec = &desc->records[i]; #define STR_OP(name) tds_dstr_init(&drec->name) SQL_DESC_STRINGS; #undef STR_OP switch (desc->type) { case DESC_IRD: case DESC_IPD: drec->sql_desc_parameter_type = SQL_PARAM_INPUT; break; case DESC_ARD: case DESC_APD: drec->sql_desc_concise_type = SQL_C_DEFAULT; drec->sql_desc_type = SQL_C_DEFAULT; break; } } desc->header.sql_desc_count = count; return SQL_SUCCESS; } static void desc_free_record(struct _drecord *drec) { #define STR_OP(name) tds_dstr_free(&drec->name) SQL_DESC_STRINGS; #undef STR_OP } SQLRETURN desc_free_records(TDS_DESC * desc) { int i; if (desc->records) { for (i = 0; i < desc->header.sql_desc_count; i++) desc_free_record(&desc->records[i]); TDS_ZERO_FREE(desc->records); } desc->header.sql_desc_count = 0; return SQL_SUCCESS; } SQLRETURN desc_copy(TDS_DESC * dest, TDS_DESC * src) { int i; TDS_DESC tmp = *dest; /* copy header */ tmp.header = src->header; /* set no records */ tmp.header.sql_desc_count = 0; tmp.records = NULL; tmp.errs.num_errors = 0; tmp.errs.errs = NULL; if (desc_alloc_records(&tmp, src->header.sql_desc_count) != SQL_SUCCESS) return SQL_ERROR; for (i = 0; i < src->header.sql_desc_count; ++i) { struct _drecord *src_rec = &src->records[i]; struct _drecord *dest_rec = &tmp.records[i]; /* copy all integer in one time ! */ memcpy(dest_rec, src_rec, sizeof(struct _drecord)); /* reinitialize string, avoid doubling pointers */ #define STR_OP(name) tds_dstr_init(&dest_rec->name) SQL_DESC_STRINGS; #undef STR_OP /* copy strings */ #define STR_OP(name) if (!tds_dstr_dup(&dest_rec->name, &src_rec->name)) goto Cleanup SQL_DESC_STRINGS; #undef STR_OP } /* success, copy back to our descriptor */ desc_free_records(dest); odbc_errs_reset(&dest->errs); *dest = tmp; return SQL_SUCCESS; Cleanup: desc_free_records(&tmp); odbc_errs_reset(&tmp.errs); return SQL_ERROR; } SQLRETURN desc_free(TDS_DESC * desc) { if (desc) { desc_free_records(desc); odbc_errs_reset(&desc->errs); tds_mutex_free(&desc->mtx); free(desc); } return SQL_SUCCESS; } TDS_DBC * desc_get_dbc(TDS_DESC *desc) { if (IS_HSTMT(desc->parent)) return ((TDS_STMT *) desc->parent)->dbc; return (TDS_DBC *) desc->parent; } freetds-1.3.6/src/odbc/prepare_query.c000644 025423 025423 00000027617 14056414221 021344 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2005-2008 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #define TDS_ISSPACE(c) isspace((unsigned char) (c)) static int prepared_rpc(struct _hstmt *stmt, bool compute_row) { int nparam = stmt->params ? stmt->params->num_cols : 0; const char *p; TDSCONNECTION *conn = stmt->dbc->tds_socket->conn; if (stmt->prepared_pos > tds_dstr_len(&stmt->query)) return SQL_ERROR; p = tds_dstr_cstr(&stmt->query) + stmt->prepared_pos - 1; for (;;) { TDSPARAMINFO *temp_params; TDSCOLUMN *curcol; TDS_SERVER_TYPE type; const char *start; while (TDS_ISSPACE(*++p)) continue; if (!*p) return SQL_SUCCESS; /* we have certainly a parameter */ if (!(temp_params = tds_alloc_param_result(stmt->params))) { odbc_errs_add(&stmt->errs, "HY001", NULL); return SQL_ERROR; } stmt->params = temp_params; curcol = temp_params->columns[nparam]; switch (*p) { case ',': if (IS_TDS7_PLUS(conn)) { tds_set_param_type(conn, curcol, SYBVOID); curcol->column_size = curcol->column_cur_size = 0; } else { /* TODO is there a better type ? */ tds_set_param_type(conn, curcol, SYBINTN); curcol->column_size = curcol->on_server.column_size = 4; curcol->column_cur_size = -1; } if (compute_row) if (!tds_alloc_param_data(curcol)) { tds_free_param_result(temp_params); return SQL_ERROR; } --p; break; default: /* add next parameter to list */ start = p; if (!(p = parse_const_param(p, &type))) { tds_free_param_result(temp_params); return SQL_ERROR; } tds_set_param_type(conn, curcol, type); switch (type) { case SYBVARCHAR: curcol->column_size = p - start; break; case SYBVARBINARY: curcol->column_size = (p - start) / 2 -1; break; default: assert(0); case SYBINT4: case SYBINT8: case SYBFLT8: curcol->column_cur_size = curcol->column_size; break; } curcol->on_server.column_size = curcol->column_size; /* TODO support other type other than VARCHAR, do not strip escape in prepare_call */ if (compute_row) { char *dest; int len; CONV_RESULT cr; if (!tds_alloc_param_data(curcol)) { tds_free_param_result(temp_params); return SQL_ERROR; } dest = (char *) curcol->column_data; switch (type) { case SYBVARCHAR: if (*start != '\'') { memcpy(dest, start, p - start); curcol->column_cur_size = p - start; } else { ++start; for (;;) { if (*start == '\'') ++start; if (start >= p) break; *dest++ = *start++; } curcol->column_cur_size = dest - (char *) curcol->column_data; } break; case SYBVARBINARY: cr.cb.len = curcol->column_size; cr.cb.ib = dest; len = tds_convert(NULL, SYBVARCHAR, start, p - start, TDS_CONVERT_BINARY, &cr); if (len >= 0 && len <= curcol->column_size) curcol->column_cur_size = len; break; case SYBINT4: *((TDS_INT *) dest) = strtol(start, NULL, 10); break; case SYBINT8: *((TDS_INT8 *) dest) = tds_strtoll(start, NULL, 10); break; case SYBFLT8: *((TDS_FLOAT *) dest) = strtod(start, NULL); break; default: break; } } --p; break; case '?': /* find bound parameter */ if (stmt->param_num > stmt->apd->header.sql_desc_count || stmt->param_num > stmt->ipd->header.sql_desc_count) { tds_free_param_result(temp_params); /* TODO set error */ return SQL_ERROR; } switch (odbc_sql2tds (stmt, &stmt->ipd->records[stmt->param_num - 1], &stmt->apd->records[stmt->param_num - 1], curcol, compute_row, stmt->apd, stmt->curr_param_row)) { case SQL_ERROR: return SQL_ERROR; case SQL_NEED_DATA: return SQL_NEED_DATA; } ++stmt->param_num; break; } ++nparam; while (TDS_ISSPACE(*++p)) continue; if (!*p || *p != ',') return SQL_SUCCESS; stmt->prepared_pos = p + 1 - tds_dstr_cstr(&stmt->query); } } int parse_prepared_query(struct _hstmt *stmt, bool compute_row) { /* try setting this parameter */ TDSPARAMINFO *temp_params; int nparam = stmt->params ? stmt->params->num_cols : 0; if (stmt->prepared_pos > 0) return prepared_rpc(stmt, compute_row); tdsdump_log(TDS_DBG_FUNC, "parsing %d parameters\n", nparam); for (; stmt->param_num <= stmt->param_count; ++nparam, ++stmt->param_num) { /* find bound parameter */ if (stmt->param_num > stmt->apd->header.sql_desc_count || stmt->param_num > stmt->ipd->header.sql_desc_count) { tdsdump_log(TDS_DBG_FUNC, "parse_prepared_query: logic_error: parameter out of bounds: " "%d > %d || %d > %d\n", stmt->param_num, stmt->apd->header.sql_desc_count, stmt->param_num, stmt->ipd->header.sql_desc_count); return SQL_ERROR; } /* add a column to parameters */ if (!(temp_params = tds_alloc_param_result(stmt->params))) { odbc_errs_add(&stmt->errs, "HY001", NULL); return SQL_ERROR; } stmt->params = temp_params; switch (odbc_sql2tds (stmt, &stmt->ipd->records[stmt->param_num - 1], &stmt->apd->records[stmt->param_num - 1], stmt->params->columns[nparam], compute_row, stmt->apd, stmt->curr_param_row)) { case SQL_ERROR: return SQL_ERROR; case SQL_NEED_DATA: return SQL_NEED_DATA; } } return SQL_SUCCESS; } int start_parse_prepared_query(struct _hstmt *stmt, bool compute_row) { /* TODO should be NULL already ?? */ tds_free_param_results(stmt->params); stmt->params = NULL; stmt->param_num = 0; stmt->param_num = stmt->prepared_query_is_func ? 2 : 1; return parse_prepared_query(stmt, compute_row); } static TDS_INT odbc_wchar2hex(TDS_CHAR *dest, TDS_UINT destlen, const SQLWCHAR * src, TDS_UINT srclen) { unsigned int i; SQLWCHAR hex1, c = 0; /* if srclen if odd we must add a "0" before ... */ i = 0; /* number where to start converting */ if (srclen & 1) { ++srclen; i = 1; --src; } for (; i < srclen; ++i) { hex1 = src[i]; if ('0' <= hex1 && hex1 <= '9') hex1 &= 0x0f; else { hex1 &= (SQLWCHAR) ~0x20u; /* mask off 0x20 to ensure upper case */ if ('A' <= hex1 && hex1 <= 'F') { hex1 -= ('A' - 10); } else { tdsdump_log(TDS_DBG_INFO1, "error_handler: attempt to convert data stopped by syntax error in source field \n"); return TDS_CONVERT_SYNTAX; } } assert(hex1 < 0x10); if ((i/2u) >= destlen) continue; if (i & 1) dest[i / 2u] = c | hex1; else c = hex1 << 4; } return srclen / 2u; } int continue_parse_prepared_query(struct _hstmt *stmt, SQLPOINTER DataPtr, SQLLEN StrLen_or_Ind) { struct _drecord *drec_apd, *drec_ipd; SQLLEN len; int need_bytes; TDSCOLUMN *curcol; TDSBLOB *blob; int sql_src_type; assert(stmt); tdsdump_log(TDS_DBG_FUNC, "continue_parse_prepared_query with parameter %d\n", stmt->param_num); if (!stmt->params) { tdsdump_log(TDS_DBG_FUNC, "error? continue_parse_prepared_query: no parameters provided"); return SQL_ERROR; } if (stmt->param_num > stmt->apd->header.sql_desc_count || stmt->param_num > stmt->ipd->header.sql_desc_count) return SQL_ERROR; drec_apd = &stmt->apd->records[stmt->param_num - 1]; drec_ipd = &stmt->ipd->records[stmt->param_num - 1]; curcol = stmt->params->columns[stmt->param_num - (stmt->prepared_query_is_func ? 2 : 1)]; blob = NULL; if (is_blob_col(curcol)) blob = (TDSBLOB *) curcol->column_data; assert(curcol->column_cur_size <= curcol->column_size); need_bytes = curcol->column_size - curcol->column_cur_size; if (DataPtr == NULL) { switch(StrLen_or_Ind) { case SQL_NULL_DATA: case SQL_DEFAULT_PARAM: break; /* OK */ default: odbc_errs_add(&stmt->errs, "HY009", NULL); /* Invalid use of null pointer */ return SQL_ERROR; } } /* get C type */ sql_src_type = drec_apd->sql_desc_concise_type; if (sql_src_type == SQL_C_DEFAULT) sql_src_type = odbc_sql_to_c_type_default(drec_ipd->sql_desc_concise_type); switch(StrLen_or_Ind) { case SQL_NTS: if (sql_src_type == SQL_C_WCHAR) len = sqlwcslen((SQLWCHAR *) DataPtr); else len = strlen((char *) DataPtr); break; case SQL_NULL_DATA: len = 0; break; case SQL_DEFAULT_PARAM: /* FIXME: use the default if the parameter has one. */ odbc_errs_add(&stmt->errs, "07S01", NULL); /* Invalid use of default parameter */ return SQL_ERROR; default: if (DataPtr && StrLen_or_Ind < 0) { /* * "The argument DataPtr was not a null pointer, and * the argument StrLen_or_Ind was less than 0 * but not equal to SQL_NTS or SQL_NULL_DATA." */ odbc_errs_add(&stmt->errs, "HY090", NULL); return SQL_ERROR; } len = StrLen_or_Ind; break; } if (!blob && len > need_bytes) len = need_bytes; /* copy to destination */ if (blob) { TDS_CHAR *p; int binary_convert = 0; SQLLEN orig_len = len; if (sql_src_type == SQL_C_CHAR || sql_src_type == SQL_C_WCHAR) { TDS_SERVER_TYPE type = tds_get_conversion_type(curcol->column_type, curcol->column_size); if (is_binary_type(type)) { if (len && sql_src_type == SQL_C_CHAR && !*((char*)DataPtr+len-1)) --len; if (sql_src_type == SQL_C_WCHAR) len /= sizeof(SQLWCHAR); if (!len) return SQL_SUCCESS; binary_convert = 1; orig_len = len; len = len / 2u + 1u; } } if (!len) return SQL_SUCCESS; assert(blob->textvalue || curcol->column_cur_size == 0); p = (TDS_CHAR *) TDS_RESIZE(blob->textvalue, len + curcol->column_cur_size); if (!p) { odbc_errs_add(&stmt->errs, "HY001", NULL); /* Memory allocation error */ return SQL_ERROR; } p += curcol->column_cur_size; if (binary_convert) { int res; len = orig_len; if (curcol->column_cur_size > 0 && curcol->column_text_sqlputdatainfo) { SQLWCHAR data[2]; data[0] = curcol->column_text_sqlputdatainfo; data[1] = (sql_src_type == SQL_C_CHAR) ? *(unsigned char*)DataPtr : *(SQLWCHAR*)DataPtr; res = odbc_wchar2hex(p, 1, data, 2); if (res < 0) { odbc_convert_err_set(&stmt->errs, res); return SQL_ERROR; } p += res; DataPtr = (SQLPOINTER) (((char*)DataPtr) + (sql_src_type == SQL_C_CHAR ? 1 : sizeof(SQLWCHAR))); --len; } if (len&1) { --len; curcol->column_text_sqlputdatainfo = (sql_src_type == SQL_C_CHAR) ? ((char*)DataPtr)[len] : ((SQLWCHAR*)DataPtr)[len]; } res = (sql_src_type == SQL_C_CHAR) ? tds_char2hex(p, len / 2u, (const TDS_CHAR*) DataPtr, len): odbc_wchar2hex(p, len / 2u, (const SQLWCHAR*) DataPtr, len); if (res < 0) { odbc_convert_err_set(&stmt->errs, res); return SQL_ERROR; } p += res; len = p - (blob->textvalue + curcol->column_cur_size); } else { memcpy(blob->textvalue + curcol->column_cur_size, DataPtr, len); } } else { memcpy(curcol->column_data + curcol->column_cur_size, DataPtr, len); } curcol->column_cur_size += len; if (blob && curcol->column_cur_size > curcol->column_size) curcol->column_size = curcol->column_cur_size; return SQL_SUCCESS; } freetds-1.3.6/src/odbc/odbc_util.c000644 025423 025423 00000076035 14056414271 020430 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2005-2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include #include #include /** * \ingroup odbc_api * \defgroup odbc_util ODBC utility * Functions called within \c ODBC driver. */ /** * \addtogroup odbc_util * @{ */ #ifdef ENABLE_ODBC_WIDE static DSTR *odbc_iso2utf(DSTR *res, const char *s, unsigned int len); static DSTR *odbc_mb2utf(TDS_DBC *dbc, DSTR *res, const char *s, unsigned int len); static DSTR *odbc_wide2utf(DSTR *res, const SQLWCHAR *s, unsigned int len); #endif int odbc_set_stmt_query(TDS_STMT * stmt, const ODBC_CHAR *sql, int sql_len _WIDE) { if (sql_len == SQL_NTS) #ifdef ENABLE_ODBC_WIDE sql_len = wide ? sqlwcslen(sql->wide) : strlen(sql->mb); #else sql_len = strlen((const char*) sql); #endif else if (sql_len <= 0) return SQL_ERROR; /* TODO already NULL ?? */ tds_free_param_results(stmt->params); stmt->params = NULL; stmt->param_num = 0; stmt->param_count = 0; stmt->is_prepared_query = 0; stmt->prepared_query_is_func = 0; stmt->prepared_query_is_rpc = 0; stmt->prepared_pos = 0; stmt->curr_param_row = 0; stmt->num_param_rows = 1; stmt->need_reprepare = 0; if (!odbc_dstr_copy(stmt->dbc, &stmt->query, sql_len, sql)) return SQL_ERROR; return SQL_SUCCESS; } unsigned int odbc_get_string_size(int size, const ODBC_CHAR * str _WIDE) { if (str) { if (size == SQL_NTS) #ifdef ENABLE_ODBC_WIDE return wide ? sqlwcslen(str->wide) : strlen(str->mb); #else return strlen((const char*) str); #endif if (size >= 0) return (unsigned int) size; } /* SQL_NULL_DATA or any other strange value */ return 0; } #ifdef ENABLE_ODBC_WIDE static DSTR* odbc_iso2utf(DSTR *res, const char *s, unsigned int len) { unsigned int i, o_len = len + 1; char *out, *p; assert(s); for (i = 0; i < len; ++i) if ((s[i] & 0x80) != 0) ++o_len; if (!tds_dstr_alloc(res, o_len)) return NULL; out = tds_dstr_buf(res); for (p = out; len > 0; --len) { unsigned char u = (unsigned char) *s++; if ((u & 0x80) != 0) { *p++ = 0xc0 | (0x1f & (u >> 6)); *p++ = 0x80 | (0x3f & u); } else { *p++ = u; } } assert(p+1-out <= o_len); return tds_dstr_setlen(res, p - out); } static DSTR* odbc_wide2utf(DSTR *res, const SQLWCHAR *s, unsigned int len) { unsigned int i, o_len = len + 1; char *out, *p; #if SIZEOF_SQLWCHAR > 2 # define MASK(n) ((0xffffffffu << (n)) & 0xffffffffu) #else # define MASK(n) ((0xffffu << (n)) & 0xffffu) #endif assert(s || len == 0); for (i = 0; i < len; ++i) { if ((s[i] & MASK(7)) == 0) continue; ++o_len; if ((s[i] & MASK(11)) == 0) continue; ++o_len; #if SIZEOF_SQLWCHAR > 2 if ((s[i] & MASK(16)) == 0) continue; ++o_len; if ((s[i] & MASK(21)) == 0) continue; ++o_len; if ((s[i] & MASK(26)) == 0) continue; ++o_len; #endif } if (!tds_dstr_alloc(res, o_len)) return NULL; out = tds_dstr_buf(res); #undef MASK #define MASK(n) ((0xffffffffu << (n)) & 0xffffffffu) for (p = out; len > 0; --len) { uint32_t u = *s++; /* easy case, ASCII */ if ((u & MASK(7)) == 0) { *p++ = (char) u; continue; } #if SIZEOF_SQLWCHAR == 2 if ((u & 0xfc00) == 0xd800 && len > 1) { uint32_t c2 = *s; if ((c2 & 0xfc00) == 0xdc00) { u = (u << 10) + c2 - ((0xd800 << 10) + 0xdc00 - 0x10000); ++s; --len; } } #endif if ((u & MASK(11)) == 0) { *p++ = 0xc0 | (u >> 6); } else { if ((u & MASK(16)) == 0) { *p++ = 0xe0 | (u >> 12); } else { if ((SIZEOF_SQLWCHAR == 2) || (u & MASK(21)) == 0) { *p++ = 0xf0 | (u >> 18); } else { if ((u & MASK(26)) == 0) { *p++ = 0xf8 | (u >> 24); } else { *p++ = 0xfc | (0x01 & (u >> 30)); *p++ = 0x80 | (0x3f & (u >> 24)); } *p++ = 0x80 | (0x3f & (u >> 18)); } *p++ = 0x80 | (0x3f & (u >> 12)); } *p++ = 0x80 | (0x3f & (u >> 6)); } *p++ = 0x80 | (0x3f & u); } assert(p+1-out <= o_len); return tds_dstr_setlen(res, p - out); } static DSTR* odbc_mb2utf(TDS_DBC *dbc, DSTR *res, const char *s, unsigned int len) { char *buf; const char *ib; char *ob; size_t il, ol; TDSICONV *char_conv = dbc->mb_conv; if (!char_conv) return odbc_iso2utf(res, s, len); if (char_conv->flags == TDS_ENCODING_MEMCPY) return tds_dstr_copyn(res, s, len); il = len; /* allocate needed buffer (+1 is to exclude 0 case) */ ol = il * char_conv->to.charset.max_bytes_per_char / char_conv->from.charset.min_bytes_per_char + 1; assert(ol > 0); if (!tds_dstr_alloc(res, ol)) return NULL; buf = tds_dstr_buf(res); ib = s; ob = buf; --ol; /* leave space for terminator */ /* char_conv is only mostly const */ memset((TDS_ERRNO_MESSAGE_FLAGS*) &char_conv->suppress, 0, sizeof(char_conv->suppress)); if (tds_iconv(dbc->tds_socket, char_conv, to_server, &ib, &il, &ob, &ol) == (size_t)-1) return NULL; return tds_dstr_setlen(res, ob - buf); } #endif #ifdef ENABLE_ODBC_WIDE /** * Copy a string from client setting according to ODBC convenction * @param dbc database connection. Can't be NULL * @param s output string * @param size size of str, Can be SQL_NTS * @param str string to convert * @param flag set of flags. * 0x01 wide string in buffer * 0x20 size is in bytes, not characters */ DSTR* odbc_dstr_copy_flag(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str, int flag) { int wide = flag&1; unsigned int len; len = odbc_get_string_size((flag&0x21) == 0x21 && size >= 0 ? size/SIZEOF_SQLWCHAR : size, str, wide); if (wide) return odbc_wide2utf(s, str->wide, len); return odbc_mb2utf(dbc, s, str->mb, len); } #else DSTR* odbc_dstr_copy(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str) { return tds_dstr_copyn(s, (const char *) str, odbc_get_string_size(size, str)); } #endif /** * Copy a string to client setting size according to ODBC convenction * @param dbc database connection. Can be NULL * @param buffer client buffer * @param cbBuffer client buffer size (in bytes) * @param pcbBuffer pointer to SQLSMALLINT to hold string size * @param s string to copy * @param len len of string to copy. <0 null terminated * @param flag set of flags. * 0x01 wide string in buffer * 0x10 pcbBuffer is SQLINTEGER otherwise SQLSMALLINT * 0x20 size is in bytes, not characters */ SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR * pcbBuffer, const char *s, int len, int flag) { SQLRETURN result = SQL_SUCCESS; int out_len = 0; #if !defined(NDEBUG) && defined(ENABLE_ODBC_WIDE) size_t initial_size; #endif if (len < 0) len = strlen(s); if (cbBuffer < 0) cbBuffer = 0; #ifdef ENABLE_ODBC_WIDE if ((flag & 1) != 0) { /* wide characters */ const unsigned char *p = (const unsigned char*) s; const unsigned char *const p_end = p + len; SQLWCHAR *dest = (SQLWCHAR*) buffer; if (flag&0x20) cbBuffer /= SIZEOF_SQLWCHAR; #ifndef NDEBUG initial_size = cbBuffer; #endif while (p < p_end) { uint32_t u, state = UTF8_ACCEPT; while (decode_utf8(&state, &u, *p++) > UTF8_REJECT && p < p_end) continue; if (state != UTF8_ACCEPT) break; ++out_len; if (SIZEOF_SQLWCHAR == 2 && u >= 0x10000 && u < 0x110000u) ++out_len; if (!dest) continue; if (SIZEOF_SQLWCHAR == 2 && u >= 0x10000) { if (cbBuffer > 2 && u < 0x110000u) { *dest++ = (SQLWCHAR) (0xd7c0 + (u >> 10)); *dest++ = (SQLWCHAR) (0xdc00 + (u & 0x3ffu)); cbBuffer -= 2; continue; } if (cbBuffer > 1) { *dest++ = (SQLWCHAR) '?'; --cbBuffer; } } else if (cbBuffer > 1) { *dest++ = (SQLWCHAR) u; --cbBuffer; continue; } result = SQL_SUCCESS_WITH_INFO; } /* terminate buffer */ assert(dest == NULL || dest-(SQLWCHAR*) buffer == out_len || (dest-(SQLWCHAR*) buffer <= out_len && cbBuffer <= 1)); if (dest && cbBuffer) { *dest++ = 0; assert(dest-(SQLWCHAR*) buffer <= initial_size); } assert(dest == NULL || dest-(SQLWCHAR*) buffer <= initial_size); if (flag&0x20) out_len *= SIZEOF_SQLWCHAR; } else if (!dbc || !dbc->mb_conv) { /* to ISO-8859-1 */ const unsigned char *p = (const unsigned char*) s; const unsigned char *const p_end = p + len; unsigned char *dest = (unsigned char*) buffer; #ifndef NDEBUG initial_size = cbBuffer; #endif while (p < p_end) { uint32_t u, state = UTF8_ACCEPT; while (decode_utf8(&state, &u, *p++) > UTF8_REJECT && p < p_end) continue; if (state != UTF8_ACCEPT) break; ++out_len; if (!dest) continue; if (cbBuffer > 1) { *dest++ = u > 0x100 ? '?' : u; --cbBuffer; continue; } result = SQL_SUCCESS_WITH_INFO; } assert(dest == NULL || dest-(unsigned char*) buffer == out_len || (dest-(unsigned char*) buffer <= out_len && cbBuffer <= 1)); /* terminate buffer */ if (dest && cbBuffer) { *dest++ = 0; assert(dest-(unsigned char*) buffer <= initial_size); } assert(dest == NULL || dest-(unsigned char*) buffer <= initial_size); } else if (dbc->mb_conv->flags == TDS_ENCODING_MEMCPY) { /* to UTF-8 */ out_len = len; if (len >= cbBuffer) { len = cbBuffer - 1; result = SQL_SUCCESS_WITH_INFO; } if (buffer && len >= 0) { /* buffer can overlap, use memmove, thanks to Valgrind */ memmove((char *) buffer, s, len); ((char *) buffer)[len] = 0; } } else { const char *ib; char *ob; size_t il, ol; TDSICONV *char_conv = dbc->mb_conv; il = len; ib = s; ol = cbBuffer; ob = (char *) buffer; /* char_conv is only mostly const */ memset((TDS_ERRNO_MESSAGE_FLAGS*) &char_conv->suppress, 0, sizeof(char_conv->suppress)); char_conv->suppress.e2big = 1; if (cbBuffer && tds_iconv(dbc->tds_socket, char_conv, to_client, &ib, &il, &ob, &ol) == (size_t)-1 && errno != E2BIG) result = SQL_ERROR; out_len = cbBuffer - ol; while (result != SQL_ERROR && il) { char discard[128]; ol = sizeof(discard); ob = discard; char_conv->suppress.e2big = 1; if (tds_iconv(dbc->tds_socket, char_conv, to_client, &ib, &il, &ob, &ol) == (size_t)-1 && errno != E2BIG) result = SQL_ERROR; ol = sizeof(discard) - ol; /* if there are still left space copy the partial conversion */ if (out_len < cbBuffer) { size_t max_copy = cbBuffer - out_len; if (max_copy > ol) max_copy = ol; memcpy(((char *) buffer) + out_len, discard, max_copy); } out_len += ol; } if (out_len >= cbBuffer && result != SQL_ERROR) result = SQL_SUCCESS_WITH_INFO; if (buffer && cbBuffer > 0) ((char *) buffer)[cbBuffer-1 < out_len ? cbBuffer-1:out_len] = 0; } #else out_len = len; if (len >= cbBuffer) { len = cbBuffer - 1; result = SQL_SUCCESS_WITH_INFO; } if (buffer && len >= 0) { /* buffer can overlap, use memmove, thanks to Valgrind */ memmove((char *) buffer, s, len); ((char *) buffer)[len] = 0; } #endif /* set output length */ if (pcbBuffer) { if (flag & 0x10) *((SQLINTEGER *) pcbBuffer) = out_len; else *((SQLSMALLINT *) pcbBuffer) = out_len; } return result; } void odbc_set_return_status(struct _hstmt *stmt, unsigned int n_row) { TDSSOCKET *tds = stmt->tds; /* TODO handle different type results (functions) on mssql2k */ if (stmt->prepared_query_is_func && tds->has_status) { struct _drecord *drec; int len; const TDS_DESC* axd = stmt->apd; TDS_INTPTR len_offset; char *data_ptr; if (axd->header.sql_desc_count < 1) return; drec = &axd->records[0]; data_ptr = (char*) drec->sql_desc_data_ptr; if (axd->header.sql_desc_bind_type != SQL_BIND_BY_COLUMN) { len_offset = axd->header.sql_desc_bind_type * n_row; if (axd->header.sql_desc_bind_offset_ptr) len_offset += *axd->header.sql_desc_bind_offset_ptr; data_ptr += len_offset; } else { len_offset = sizeof(SQLLEN) * n_row; data_ptr += sizeof(SQLINTEGER) * n_row; } #define LEN(ptr) *((SQLLEN*)(((char*)(ptr)) + len_offset)) len = odbc_tds2sql_int4(stmt, &tds->ret_status, drec->sql_desc_concise_type, (TDS_CHAR *) data_ptr, drec->sql_desc_octet_length); if (len == SQL_NULL_DATA) return /* SQL_ERROR */ ; if (drec->sql_desc_indicator_ptr) LEN(drec->sql_desc_indicator_ptr) = 0; if (drec->sql_desc_octet_length_ptr) LEN(drec->sql_desc_octet_length_ptr) = len; } #undef LEN } void odbc_set_return_params(struct _hstmt *stmt, unsigned int n_row) { TDSSOCKET *tds = stmt->tds; TDSPARAMINFO *info = tds->current_results; int i_begin = stmt->prepared_query_is_func ? 1 : 0; int i; int nparam = i_begin; /* I don't understand why but this happen -- freddy77 */ /* TODO check why, put an assert ? */ if (!info) return; for (i = 0; i < info->num_cols; ++i) { const TDS_DESC* axd = stmt->apd; const struct _drecord *drec_apd, *drec_ipd; TDSCOLUMN *colinfo = info->columns[i]; SQLINTEGER len; int c_type; char *data_ptr; TDS_INTPTR len_offset; /* find next output parameter */ for (;;) { drec_apd = NULL; /* TODO best way to stop */ if (nparam >= axd->header.sql_desc_count || nparam >= stmt->ipd->header.sql_desc_count) return; drec_apd = &axd->records[nparam]; drec_ipd = &stmt->ipd->records[nparam]; if (stmt->ipd->records[nparam++].sql_desc_parameter_type != SQL_PARAM_INPUT) break; } data_ptr = (char*) drec_apd->sql_desc_data_ptr; if (axd->header.sql_desc_bind_type != SQL_BIND_BY_COLUMN) { len_offset = axd->header.sql_desc_bind_type * n_row; if (axd->header.sql_desc_bind_offset_ptr) len_offset += *axd->header.sql_desc_bind_offset_ptr; data_ptr += len_offset; } else { len_offset = sizeof(SQLLEN) * n_row; data_ptr += odbc_get_octet_len(drec_apd->sql_desc_concise_type, drec_apd) * n_row; } #define LEN(ptr) *((SQLLEN*)(((char*)(ptr)) + len_offset)) /* null parameter ? */ if (colinfo->column_cur_size < 0) { /* FIXME error if NULL */ if (drec_apd->sql_desc_indicator_ptr) LEN(drec_apd->sql_desc_indicator_ptr) = SQL_NULL_DATA; continue; } colinfo->column_text_sqlgetdatapos = 0; colinfo->column_iconv_left = 0; c_type = drec_apd->sql_desc_concise_type; if (c_type == SQL_C_DEFAULT) c_type = odbc_sql_to_c_type_default(drec_ipd->sql_desc_concise_type); /* * TODO why IPD ?? perhaps SQLBindParameter it's not correct ?? * Or tests are wrong ?? */ len = odbc_tds2sql_col(stmt, colinfo, c_type, (TDS_CHAR*) data_ptr, drec_apd->sql_desc_octet_length, drec_ipd); if (len == SQL_NULL_DATA) return /* SQL_ERROR */ ; if (drec_apd->sql_desc_indicator_ptr) LEN(drec_apd->sql_desc_indicator_ptr) = 0; if (drec_apd->sql_desc_octet_length_ptr) LEN(drec_apd->sql_desc_octet_length_ptr) = len; #undef LEN } } /** * Pass this an SQL_C_* type and get a SYB* type which most closely corresponds * to the SQL_C_* type. * This function can return XSYBNVARCHAR or SYBUINTx even if server do not support it */ TDS_SERVER_TYPE odbc_c_to_server_type(int c_type) { switch (c_type) { /* FIXME this should be dependent on size of data !!! */ case SQL_C_BINARY: return SYBBINARY; #ifdef SQL_C_WCHAR case SQL_C_WCHAR: return XSYBNVARCHAR; #endif /* TODO what happen if varchar is more than 255 characters long */ case SQL_C_CHAR: return SYBVARCHAR; case SQL_C_FLOAT: return SYBREAL; case SQL_C_DOUBLE: return SYBFLT8; case SQL_C_BIT: return SYBBIT; #if (ODBCVER >= 0x0300) case SQL_C_UBIGINT: return SYBUINT8; case SQL_C_SBIGINT: return SYBINT8; #ifdef SQL_C_GUID case SQL_C_GUID: return SYBUNIQUE; #endif #endif case SQL_C_ULONG: return SYBUINT4; case SQL_C_LONG: case SQL_C_SLONG: return SYBINT4; case SQL_C_USHORT: return SYBUINT2; case SQL_C_SHORT: case SQL_C_SSHORT: return SYBINT2; case SQL_C_STINYINT: case SQL_C_TINYINT: case SQL_C_UTINYINT: return SYBINT1; /* ODBC date formats are completely different from SQL one */ case SQL_C_DATE: case SQL_C_TIME: case SQL_C_TIMESTAMP: case SQL_C_TYPE_DATE: case SQL_C_TYPE_TIME: case SQL_C_TYPE_TIMESTAMP: return SYBMSDATETIME2; /* ODBC numeric/decimal formats are completely differect from tds one */ case SQL_C_NUMERIC: return SYBNUMERIC; /* not supported */ case SQL_C_INTERVAL_YEAR: case SQL_C_INTERVAL_MONTH: case SQL_C_INTERVAL_DAY: case SQL_C_INTERVAL_HOUR: case SQL_C_INTERVAL_MINUTE: case SQL_C_INTERVAL_SECOND: case SQL_C_INTERVAL_YEAR_TO_MONTH: case SQL_C_INTERVAL_DAY_TO_HOUR: case SQL_C_INTERVAL_DAY_TO_MINUTE: case SQL_C_INTERVAL_DAY_TO_SECOND: case SQL_C_INTERVAL_HOUR_TO_MINUTE: case SQL_C_INTERVAL_HOUR_TO_SECOND: case SQL_C_INTERVAL_MINUTE_TO_SECOND: break; } return TDS_INVALID_TYPE; } int odbc_sql_to_c_type_default(int sql_type) { switch (sql_type) { case SQL_CHAR: case SQL_VARCHAR: case SQL_LONGVARCHAR: /* these types map to SQL_C_CHAR for compatibility with old applications */ #ifdef SQL_C_WCHAR case SQL_WCHAR: case SQL_WVARCHAR: case SQL_WLONGVARCHAR: #endif return SQL_C_CHAR; /* for compatibility numeric are converted to CHAR, not to structure */ case SQL_DECIMAL: case SQL_NUMERIC: return SQL_C_CHAR; #ifdef SQL_GUID case SQL_GUID: /* TODO return SQL_C_CHAR for Sybase ?? */ return SQL_C_GUID; #endif case SQL_BIT: return SQL_C_BIT; case SQL_TINYINT: return SQL_C_UTINYINT; case SQL_SMALLINT: return SQL_C_SSHORT; case SQL_INTEGER: return SQL_C_SLONG; case SQL_BIGINT: return SQL_C_SBIGINT; case SQL_REAL: return SQL_C_FLOAT; case SQL_FLOAT: case SQL_DOUBLE: return SQL_C_DOUBLE; case SQL_DATE: case SQL_TYPE_DATE: return SQL_C_TYPE_DATE; case SQL_TIME: case SQL_TYPE_TIME: return SQL_C_TYPE_TIME; case SQL_TIMESTAMP: case SQL_TYPE_TIMESTAMP: return SQL_C_TYPE_TIMESTAMP; case SQL_BINARY: case SQL_VARBINARY: case SQL_LONGVARBINARY: return SQL_C_BINARY; /* TODO interval types */ default: return 0; } } TDS_SERVER_TYPE odbc_sql_to_server_type(TDSCONNECTION * conn, int sql_type, int sql_unsigned) { switch (sql_type) { case SQL_WCHAR: if (IS_TDS7_PLUS(conn)) return XSYBNCHAR; /* fall thought */ case SQL_CHAR: return SYBCHAR; case SQL_WVARCHAR: if (IS_TDS7_PLUS(conn)) return XSYBNVARCHAR; /* fall thought */ case SQL_VARCHAR: return SYBVARCHAR; case SQL_SS_VARIANT: if (IS_TDS71_PLUS(conn)) return SYBVARIANT; if (IS_TDS7_PLUS(conn)) return XSYBNVARCHAR; return SYBVARCHAR; case SQL_SS_XML: if (IS_TDS72_PLUS(conn)) return SYBMSXML; /* fall thought */ case SQL_WLONGVARCHAR: if (IS_TDS7_PLUS(conn)) return SYBNTEXT; /* fall thought */ case SQL_LONGVARCHAR: return SYBTEXT; case SQL_DECIMAL: return SYBDECIMAL; case SQL_NUMERIC: return SYBNUMERIC; #ifdef SQL_GUID case SQL_GUID: if (IS_TDS7_PLUS(conn)) return SYBUNIQUE; return TDS_INVALID_TYPE; #endif case SQL_BIT: /* NOTE: always return not nullable type */ return SYBBIT; case SQL_TINYINT: return SYBINT1; case SQL_SMALLINT: if (sql_unsigned && tds_capability_has_req(conn, TDS_REQ_DATA_UINT2)) return SYBUINT2; return SYBINT2; case SQL_INTEGER: if (sql_unsigned && tds_capability_has_req(conn, TDS_REQ_DATA_UINT4)) return SYBUINT4; return SYBINT4; case SQL_BIGINT: if (sql_unsigned && tds_capability_has_req(conn, TDS_REQ_DATA_UINT8)) return SYBUINT8; return SYBINT8; case SQL_REAL: return SYBREAL; case SQL_FLOAT: case SQL_DOUBLE: return SYBFLT8; /* ODBC version 2 */ case SQL_DATE: case SQL_TIME: case SQL_TIMESTAMP: /* ODBC version 3 */ case SQL_TYPE_DATE: if (IS_TDS50(conn) && tds_capability_has_req(conn, TDS_REQ_DATA_BIGDATETIME)) return SYB5BIGDATETIME; if (IS_TDS50(conn) && tds_capability_has_req(conn, TDS_REQ_DATA_DATE)) return SYBDATE; if (IS_TDS73_PLUS(conn)) return SYBMSDATE; goto type_timestamp; case SQL_TYPE_TIME: if (IS_TDS50(conn) && tds_capability_has_req(conn, TDS_REQ_DATA_BIGTIME)) return SYB5BIGTIME; if (IS_TDS50(conn) && tds_capability_has_req(conn, TDS_REQ_DATA_TIME)) return SYBTIME; if (IS_TDS73_PLUS(conn)) return SYBMSTIME; /* fall thought */ type_timestamp: case SQL_TYPE_TIMESTAMP: if (IS_TDS73_PLUS(conn)) return SYBMSDATETIME2; if (IS_TDS50(conn) && tds_capability_has_req(conn, TDS_REQ_DATA_BIGDATETIME)) return SYB5BIGDATETIME; return SYBDATETIME; case SQL_SS_TIME2: if (IS_TDS73_PLUS(conn)) return SYBMSTIME; if (IS_TDS50(conn) && tds_capability_has_req(conn, TDS_REQ_DATA_BIGDATETIME)) return SYB5BIGDATETIME; return SYBDATETIME; case SQL_SS_TIMESTAMPOFFSET: if (IS_TDS73_PLUS(conn)) return SYBMSDATETIMEOFFSET; if (IS_TDS50(conn) && tds_capability_has_req(conn, TDS_REQ_DATA_BIGDATETIME)) return SYB5BIGDATETIME; return SYBDATETIME; case SQL_BINARY: return SYBBINARY; case SQL_VARBINARY: return SYBVARBINARY; case SQL_LONGVARBINARY: return SYBIMAGE; /* TODO interval types */ default: return TDS_INVALID_TYPE; } } /** Returns the version of the RDBMS in the ODBC format */ void odbc_rdbms_version(TDSSOCKET * tds, char *pversion_string) { TDS_UINT version = tds->conn->product_version; sprintf(pversion_string, "%.02d.%.02d.%.04d", (int) ((version & 0x7F000000) >> 24), (int) ((version & 0x00FF0000) >> 16), (int) (version & 0x0000FFFF)); } /** Return length of parameter from parameter information */ SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC* axd, unsigned int n_row) { SQLINTEGER len; int size; TDS_INTPTR len_offset; if (axd->header.sql_desc_bind_type != SQL_BIND_BY_COLUMN) { len_offset = axd->header.sql_desc_bind_type * n_row; if (axd->header.sql_desc_bind_offset_ptr) len_offset += *axd->header.sql_desc_bind_offset_ptr; } else { len_offset = sizeof(SQLLEN) * n_row; } #define LEN(ptr) *((SQLLEN*)(((char*)(ptr)) + len_offset)) if (drec_axd->sql_desc_indicator_ptr && LEN(drec_axd->sql_desc_indicator_ptr) == SQL_NULL_DATA) len = SQL_NULL_DATA; else if (drec_axd->sql_desc_octet_length_ptr) len = LEN(drec_axd->sql_desc_octet_length_ptr); else { len = 0; /* TODO add XML if defined */ /* FIXME, other types available */ if (drec_axd->sql_desc_concise_type == SQL_C_CHAR || drec_axd->sql_desc_concise_type == SQL_C_WCHAR || drec_axd->sql_desc_concise_type == SQL_C_BINARY) { len = SQL_NTS; } else { int type = drec_axd->sql_desc_concise_type; TDS_SERVER_TYPE server_type; if (type == SQL_C_DEFAULT) type = odbc_sql_to_c_type_default(drec_ixd->sql_desc_concise_type); server_type = odbc_c_to_server_type(type); /* FIXME check what happen to DATE/TIME types */ size = tds_get_size_by_type(server_type); if (size > 0) len = size; } } return len; #undef LEN } #ifdef SQL_GUID # define TYPE_NORMAL_SQL_GUID TYPE_NORMAL(SQL_GUID) #else # define TYPE_NORMAL_SQL_GUID #endif #define SQL_TYPES \ TYPE_NORMAL(SQL_BIT) \ TYPE_NORMAL(SQL_SMALLINT) \ TYPE_NORMAL(SQL_TINYINT) \ TYPE_NORMAL(SQL_INTEGER) \ TYPE_NORMAL(SQL_BIGINT) \ \ TYPE_NORMAL_SQL_GUID \ \ TYPE_NORMAL(SQL_BINARY) \ TYPE_NORMAL(SQL_VARBINARY) \ TYPE_NORMAL(SQL_LONGVARBINARY) \ \ TYPE_NORMAL(SQL_CHAR) \ TYPE_NORMAL(SQL_VARCHAR) \ TYPE_NORMAL(SQL_LONGVARCHAR) \ TYPE_NORMAL(SQL_WCHAR) \ TYPE_NORMAL(SQL_WVARCHAR) \ TYPE_NORMAL(SQL_WLONGVARCHAR) \ \ TYPE_NORMAL(SQL_DECIMAL) \ TYPE_NORMAL(SQL_NUMERIC) \ \ TYPE_NORMAL(SQL_FLOAT) \ TYPE_NORMAL(SQL_REAL) \ TYPE_NORMAL(SQL_DOUBLE)\ \ TYPE_NORMAL(SQL_SS_TIMESTAMPOFFSET) \ TYPE_NORMAL(SQL_SS_TIME2) \ TYPE_NORMAL(SQL_SS_XML) \ TYPE_NORMAL(SQL_SS_VARIANT) \ TYPE_NORMAL(SQL_TYPE_DATE) \ TYPE_NORMAL(SQL_TYPE_TIME) \ \ TYPE_VERBOSE_START(SQL_DATETIME) \ TYPE_VERBOSE_DATE(SQL_DATETIME, SQL_CODE_TIMESTAMP, SQL_TYPE_TIMESTAMP, SQL_TIMESTAMP) \ TYPE_VERBOSE_END(SQL_DATETIME) SQLSMALLINT odbc_get_concise_sql_type(SQLSMALLINT type, SQLSMALLINT interval) { #define TYPE_NORMAL(t) case t: return type; #define TYPE_VERBOSE_START(t) \ case t: switch (interval) { #define TYPE_VERBOSE_DATE(t, interval, concise, old) \ case interval: return concise; #define TYPE_VERBOSE_END(t) \ } switch (type) { SQL_TYPES; } return 0; #undef TYPE_NORMAL #undef TYPE_VERBOSE_START #undef TYPE_VERBOSE_DATE #undef TYPE_VERBOSE_END } /** * Set concise type and all cascading field. * @param concise_type concise type to set * @param drec record to set. NULL to test error without setting * @param check_only it <>0 (true) check only, do not set type */ SQLRETURN odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord * drec, int check_only) { SQLSMALLINT type = concise_type, interval_code = 0; #define TYPE_NORMAL(t) case t: break; #define TYPE_VERBOSE_START(t) #define TYPE_VERBOSE_DATE(t, interval, concise, old) \ case old: concise_type = concise; \ case concise: type = t; interval_code = interval; break; #define TYPE_VERBOSE_END(t) switch (type) { SQL_TYPES; default: return SQL_ERROR; } if (!check_only) { drec->sql_desc_concise_type = concise_type; drec->sql_desc_type = type; drec->sql_desc_datetime_interval_code = interval_code; switch (drec->sql_desc_type) { case SQL_NUMERIC: case SQL_DECIMAL: drec->sql_desc_precision = 38; drec->sql_desc_scale = 0; break; /* TODO finish */ } } return SQL_SUCCESS; #undef TYPE_NORMAL #undef TYPE_VERBOSE_START #undef TYPE_VERBOSE_DATE #undef TYPE_VERBOSE_END } #ifdef SQL_C_GUID # define TYPE_NORMAL_SQL_C_GUID TYPE_NORMAL(SQL_C_GUID) #else # define TYPE_NORMAL_SQL_C_GUID #endif #define C_TYPES \ TYPE_NORMAL(SQL_C_BIT) \ TYPE_NORMAL(SQL_C_SHORT) \ TYPE_NORMAL(SQL_C_TINYINT) \ TYPE_NORMAL(SQL_C_UTINYINT) \ TYPE_NORMAL(SQL_C_STINYINT) \ TYPE_NORMAL(SQL_C_LONG) \ TYPE_NORMAL(SQL_C_SBIGINT) \ TYPE_NORMAL(SQL_C_UBIGINT) \ TYPE_NORMAL(SQL_C_SSHORT) \ TYPE_NORMAL(SQL_C_SLONG) \ TYPE_NORMAL(SQL_C_USHORT) \ TYPE_NORMAL(SQL_C_ULONG) \ \ TYPE_NORMAL_SQL_C_GUID \ TYPE_NORMAL(SQL_C_DEFAULT) \ \ TYPE_NORMAL(SQL_C_BINARY) \ \ TYPE_NORMAL(SQL_C_CHAR) \ TYPE_NORMAL(SQL_C_WCHAR) \ \ TYPE_NORMAL(SQL_C_NUMERIC) \ \ TYPE_NORMAL(SQL_C_FLOAT) \ TYPE_NORMAL(SQL_C_DOUBLE)\ \ TYPE_VERBOSE_START(SQL_DATETIME) \ TYPE_VERBOSE_DATE(SQL_DATETIME, SQL_CODE_DATE, SQL_C_TYPE_DATE, SQL_C_DATE) \ TYPE_VERBOSE_DATE(SQL_DATETIME, SQL_CODE_TIME, SQL_C_TYPE_TIME, SQL_C_TIME) \ TYPE_VERBOSE_DATE(SQL_DATETIME, SQL_CODE_TIMESTAMP, SQL_C_TYPE_TIMESTAMP, SQL_C_TIMESTAMP) \ TYPE_VERBOSE_END(SQL_DATETIME) \ \ TYPE_VERBOSE_START(SQL_INTERVAL) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_DAY, SQL_C_INTERVAL_DAY) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_DAY_TO_HOUR, SQL_C_INTERVAL_DAY_TO_HOUR) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_DAY_TO_MINUTE, SQL_C_INTERVAL_DAY_TO_MINUTE) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_DAY_TO_SECOND, SQL_C_INTERVAL_DAY_TO_SECOND) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_HOUR, SQL_C_INTERVAL_HOUR) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_HOUR_TO_MINUTE, SQL_C_INTERVAL_HOUR_TO_MINUTE) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_HOUR_TO_SECOND, SQL_C_INTERVAL_HOUR_TO_SECOND) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_MINUTE, SQL_C_INTERVAL_MINUTE) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_MINUTE_TO_SECOND, SQL_C_INTERVAL_MINUTE_TO_SECOND) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_MONTH, SQL_C_INTERVAL_MONTH) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_SECOND, SQL_C_INTERVAL_SECOND) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_YEAR, SQL_C_INTERVAL_YEAR) \ TYPE_VERBOSE(SQL_INTERVAL, SQL_CODE_YEAR_TO_MONTH, SQL_C_INTERVAL_YEAR_TO_MONTH) \ TYPE_VERBOSE_END(SQL_INTERVAL) SQLSMALLINT odbc_get_concise_c_type(SQLSMALLINT type, SQLSMALLINT interval) { #define TYPE_NORMAL(t) case t: return type; #define TYPE_VERBOSE_START(t) \ case t: switch (interval) { #define TYPE_VERBOSE(t, interval, concise) \ case interval: return concise; #define TYPE_VERBOSE_DATE(t, interval, concise, old) \ case interval: return concise; #define TYPE_VERBOSE_END(t) \ } switch (type) { C_TYPES; } return 0; #undef TYPE_NORMAL #undef TYPE_VERBOSE_START #undef TYPE_VERBOSE #undef TYPE_VERBOSE_DATE #undef TYPE_VERBOSE_END } /** * Set concise type and all cascading field. * @param concise_type concise type to set * @param drec record to set. NULL to test error without setting * @param check_only it <>0 (true) check only, do not set type */ SQLRETURN odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord * drec, int check_only) { SQLSMALLINT type = concise_type, interval_code = 0; #define TYPE_NORMAL(t) case t: break; #define TYPE_VERBOSE_START(t) #define TYPE_VERBOSE(t, interval, concise) \ case concise: type = t; interval_code = interval; break; #define TYPE_VERBOSE_DATE(t, interval, concise, old) \ case concise: type = t; interval_code = interval; break; \ case old: concise_type = concise; type = t; interval_code = interval; break; #define TYPE_VERBOSE_END(t) switch (type) { C_TYPES; default: return SQL_ERROR; } if (!check_only) { drec->sql_desc_concise_type = concise_type; drec->sql_desc_type = type; drec->sql_desc_datetime_interval_code = interval_code; switch (drec->sql_desc_type) { case SQL_C_NUMERIC: drec->sql_desc_length = 38; drec->sql_desc_precision = 38; drec->sql_desc_scale = 0; break; /* TODO finish */ } } return SQL_SUCCESS; #undef TYPE_NORMAL #undef TYPE_VERBOSE_START #undef TYPE_VERBOSE #undef TYPE_VERBOSE_DATE #undef TYPE_VERBOSE_END } SQLLEN odbc_get_octet_len(int c_type, const struct _drecord *drec) { SQLLEN len; /* this shit is mine -- freddy77 */ switch (c_type) { case SQL_C_CHAR: case SQL_C_WCHAR: case SQL_C_BINARY: len = drec->sql_desc_octet_length; break; case SQL_C_DATE: case SQL_C_TYPE_DATE: len = sizeof(DATE_STRUCT); break; case SQL_C_TIME: case SQL_C_TYPE_TIME: len = sizeof(TIME_STRUCT); break; case SQL_C_TIMESTAMP: case SQL_C_TYPE_TIMESTAMP: len = sizeof(TIMESTAMP_STRUCT); break; case SQL_C_NUMERIC: len = sizeof(SQL_NUMERIC_STRUCT); break; default: len = tds_get_size_by_type(odbc_c_to_server_type(c_type)); break; } return len; } void odbc_convert_err_set(struct _sql_errors *errs, TDS_INT err) { /* * TODO we really need a column offset in the _sql_error structure so that caller can * invoke SQLGetDiagField to learn which column is failing */ switch (err) { case TDS_CONVERT_NOAVAIL: odbc_errs_add(errs, "HY003", NULL); break; case TDS_CONVERT_SYNTAX: odbc_errs_add(errs, "22018", NULL); break; case TDS_CONVERT_OVERFLOW: odbc_errs_add(errs, "22003", NULL); break; case TDS_CONVERT_FAIL: odbc_errs_add(errs, "07006", NULL); break; case TDS_CONVERT_NOMEM: odbc_errs_add(errs, "HY001", NULL); break; } } /** @} */ freetds-1.3.6/src/odbc/bcp.c000644 025423 025423 00000046405 14056414222 017222 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010, 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef _WIN32 #include #endif #include #include #include #include #include #define TDSODBC_BCP #include static TDSRET _bcp_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset); static SQLLEN _bcp_get_term_var(const TDS_CHAR * pdata, const TDS_CHAR * term, int term_len); #define ODBCBCP_ERROR_RETURN(code) \ do {odbc_errs_add(&dbc->errs, code, NULL); return;} while(0) #define ODBCBCP_ERROR_DBINT(code) \ do {odbc_errs_add(&dbc->errs, code, NULL); return -1;} while(0) /** * \ingroup odbc_bcp * \brief Prepare for bulk copy operation on a table * * \param dbc ODBC database connection object * \param tblname the name of the table receiving or providing the data. * \param hfile the data file opposite the table, if any. NB: The current * implementation does not support file I/O so this must be NULL * \param errfile the "error file" captures messages and, if errors are * encountered. NB: The current implementation does not support * file I/O so this must be NULL * \param direction one of * - \b DB_IN writing to the table * - \b DB_OUT writing to the host file (Not currently supported) * . * \remarks bcp_init() sets the host file data format and acquires the table metadata. * It is called before the other bulk copy functions. * * The ODBC BCP functionality should be accessed via the inline functions in * odbcss.h. * * After calling this function, call bcp_bind() to associate your data with * the appropriate table column. * * \sa SQL_COPT_SS_BCP, odbc_bcp_bind(), odbc_bcp_done(), odbc_bcp_exec() */ void odbc_bcp_init(TDS_DBC *dbc, const ODBC_CHAR *tblname, const ODBC_CHAR *hfile, const ODBC_CHAR *errfile, int direction _WIDE) { if (TDS_UNLIKELY(tds_write_dump)) { #ifdef ENABLE_ODBC_WIDE if (wide) { SQLWSTR_BUFS(3); tdsdump_log(TDS_DBG_FUNC, "bcp_initW(%p, %ls, %ls, %ls, %d)\n", dbc, SQLWSTR(tblname->wide), SQLWSTR(hfile->wide), SQLWSTR(errfile->wide), direction); SQLWSTR_FREE(); } else { #else { #endif tdsdump_log(TDS_DBG_FUNC, "bcp_init(%p, %s, %s, %s, %d)\n", dbc, (const char*) tblname, (const char*) hfile, (const char*) errfile, direction); } } if (!tblname) ODBCBCP_ERROR_RETURN("HY009"); /* Free previously allocated storage in dbproc & initialise flags, etc. */ odbc_bcp_free_storage(dbc); /* * Validate other parameters */ if (dbc->tds_socket->conn->tds_version < 0x500) ODBCBCP_ERROR_RETURN("HYC00"); if (direction != BCP_DIRECTION_IN || hfile || errfile) ODBCBCP_ERROR_RETURN("HYC00"); /* Allocate storage */ dbc->bcpinfo = tds_alloc_bcpinfo(); if (dbc->bcpinfo == NULL) ODBCBCP_ERROR_RETURN("HY001"); if (!odbc_dstr_copy(dbc, &dbc->bcpinfo->tablename, SQL_NTS, tblname)) { odbc_bcp_free_storage(dbc); ODBCBCP_ERROR_RETURN("HY001"); } if (tds_dstr_len(&dbc->bcpinfo->tablename) > 92 && !IS_TDS7_PLUS(dbc->tds_socket->conn)) { /* 30.30.30 */ odbc_bcp_free_storage(dbc); ODBCBCP_ERROR_RETURN("HYC00"); } dbc->bcpinfo->direction = direction; dbc->bcpinfo->xfer_init = 0; dbc->bcpinfo->bind_count = 0; if (TDS_FAILED(tds_bcp_init(dbc->tds_socket, dbc->bcpinfo))) { /* TODO return proper error */ /* Attempt to use Bulk Copy with a non-existent Server table (might be why ...) */ ODBCBCP_ERROR_RETURN("HY000"); } } /** * \ingroup odbc_bcp * \brief Set BCP options for data transfer * * \param dbc ODBC database connection object * \param field symbolic constant indicating the option to be set, one of: * - \b BCPKEEPIDENTITY Enable identity insert, as if by executing * 'SET IDENTITY_INSERT \a table ON'. The default is off * - \b BCPHINTS Arbitrary extra text to pass to the server. See the * documentation for the bcp command-line tool which came with your * database server for the correct syntax. * \param value The value for \a field. * * \remarks These options control the behavior of bcp_sendrow(). * * \sa odbc_bcp_batch(), odbc_bcp_init(), odbc_bcp_done() */ void odbc_bcp_control(TDS_DBC *dbc, int field, void *value) { tdsdump_log(TDS_DBG_FUNC, "bcp_control(%p, %d, %p)\n", dbc, field, value); if (dbc->bcpinfo == NULL) ODBCBCP_ERROR_RETURN("HY010"); switch (field) { case BCPKEEPIDENTITY: dbc->bcpinfo->identity_insert_on = (value != NULL); break; case BCPHINTS: if (!value) ODBCBCP_ERROR_RETURN("HY009"); dbc->bcphint = strdup((char*)value); dbc->bcpinfo->hint = dbc->bcphint; break; default: ODBCBCP_ERROR_RETURN("HY009"); } } /** * \ingroup odbc_bcp * \brief Override bcp_bind() by pointing to a different host variable. * * \param dbc ODBC database connection object * \param colptr The pointer, the address of your variable. * \param table_column The 1-based column ordinal in the table. * \remarks Use between calls to bcp_sendrow(). After calling bcp_colptr(), * subsequent calls to bcp_sendrow() will bind to the new address. * \sa odbc_bcp_bind(), odbc_bcp_sendrow() */ void odbc_bcp_colptr(TDS_DBC *dbc, const void * colptr, int table_column) { TDSCOLUMN *curcol; tdsdump_log(TDS_DBG_FUNC, "bcp_colptr(%p, %p, %d)\n", dbc, colptr, table_column); if (dbc->bcpinfo == NULL || dbc->bcpinfo->bindinfo == NULL) ODBCBCP_ERROR_RETURN("HY010"); /* colptr can be NULL */ if (dbc->bcpinfo->direction != BCP_DIRECTION_IN) ODBCBCP_ERROR_RETURN("HY010"); if (table_column <= 0 || table_column > dbc->bcpinfo->bindinfo->num_cols) ODBCBCP_ERROR_RETURN("HY009"); curcol = dbc->bcpinfo->bindinfo->columns[table_column - 1]; curcol->column_varaddr = (TDS_CHAR *)colptr; } /** * \ingroup odbc_bcp * \brief Write data in host variables to the table. * * \param dbc ODBC database connection object * * \remarks Call bcp_bind() first to describe the variables to be used. * Use bcp_batch() to commit sets of rows. * After sending the last row call bcp_done(). * \sa odbc_bcp_batch(), odbc_bcp_bind(), odbc_bcp_colptr(), odbc_bcp_done(), * odbc_bcp_init() */ void odbc_bcp_sendrow(TDS_DBC *dbc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "bcp_sendrow(%p)\n", dbc); if (dbc->bcpinfo == NULL) ODBCBCP_ERROR_RETURN("HY010"); tds = dbc->tds_socket; if (dbc->bcpinfo->direction != BCP_DIRECTION_IN) ODBCBCP_ERROR_RETURN("HY010"); /* * The first time sendrow is called after bcp_init, * there is a certain amount of initialisation to be done. */ if (dbc->bcpinfo->xfer_init == 0) { /* The start_copy function retrieves details of the table's columns */ if (TDS_FAILED(tds_bcp_start_copy_in(tds, dbc->bcpinfo))) ODBCBCP_ERROR_RETURN("HY000"); dbc->bcpinfo->xfer_init = 1; } dbc->bcpinfo->parent = dbc; if (TDS_FAILED(tds_bcp_send_record(dbc->tds_socket, dbc->bcpinfo, _bcp_get_col_data, NULL, 0))) ODBCBCP_ERROR_RETURN("HY000"); } /** * \ingroup odbc_bcp * \brief Commit a set of rows to the table. * * \param dbc ODBC database connection object * \remarks If not called, bcp_done() will cause the rows to be saved. * \return Count of rows saved, or -1 on error. * \sa odbc_bcp_bind(), odbc_bcp_done(), odbc_bcp_sendrow() */ int odbc_bcp_batch(TDS_DBC *dbc) { int rows_copied = 0; tdsdump_log(TDS_DBG_FUNC, "bcp_batch(%p)\n", dbc); if (dbc->bcpinfo == NULL) ODBCBCP_ERROR_DBINT("HY010"); if (TDS_FAILED(tds_bcp_done(dbc->tds_socket, &rows_copied))) ODBCBCP_ERROR_DBINT("HY000"); tds_bcp_start(dbc->tds_socket, dbc->bcpinfo); return rows_copied; } /** * \ingroup odbc_bcp * \brief Conclude the transfer of data from program variables. * * \param dbc ODBC database connection object * \remarks Do not overlook this function. According to Sybase, failure to call bcp_done() * "will result in unpredictable errors". * \return As with bcp_batch(), the count of rows saved, or -1 on error. * \sa bcp_batch(), bcp_bind(), bcp_moretext(), bcp_sendrow() */ int odbc_bcp_done(TDS_DBC *dbc) { int rows_copied; tdsdump_log(TDS_DBG_FUNC, "bcp_done(%p)\n", dbc); if (!(dbc->bcpinfo)) ODBCBCP_ERROR_DBINT("HY010"); if (TDS_FAILED(tds_bcp_done(dbc->tds_socket, &rows_copied))) ODBCBCP_ERROR_DBINT("HY000"); odbc_bcp_free_storage(dbc); return rows_copied; } /** * \ingroup odbc_bcp * \brief Bind a program host variable to a database column * * \param dbc ODBC database connection object * \param varaddr address of host variable * \param prefixlen length of any prefix found at the beginning of \a varaddr, in bytes. * Use zero for fixed-length datatypes. * \param varlen bytes of data in \a varaddr. Zero for NULL, -1 for fixed-length datatypes. * \param terminator byte sequence that marks the end of the data in \a varaddr * \param termlen length of \a terminator * \param vartype datatype of the host variable * \param table_column Nth column, starting at 1, in the table. * * \remarks The order of operation is: * - bcp_init() with \a hfile == NULL and \a direction == DB_IN. * - bcp_bind(), once per column you want to write to * - bcp_batch(), optionally, to commit a set of rows * - bcp_done() * * \sa odbc_bcp_batch(), odbc_bcp_done(), odbc_bcp_sendrow() */ void odbc_bcp_bind(TDS_DBC *dbc, const void * varaddr, int prefixlen, int varlen, const void * terminator, int termlen, int vartype, int table_column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "bcp_bind(%p, %p, %d, %d -- %p, %d, %d, %d)\n", dbc, varaddr, prefixlen, varlen, terminator, termlen, vartype, table_column); if (!dbc->bcpinfo) ODBCBCP_ERROR_RETURN("HY010"); if (dbc->bcpinfo->direction != BCP_DIRECTION_IN) ODBCBCP_ERROR_RETURN("HY010"); if (varlen < -1 && varlen != SQL_VARLEN_DATA) ODBCBCP_ERROR_RETURN("HY009"); if (prefixlen != 0 && prefixlen != 1 && prefixlen != 2 && prefixlen != 4 && prefixlen != 8) ODBCBCP_ERROR_RETURN("HY009"); if (vartype != 0 && !is_tds_type_valid(vartype)) ODBCBCP_ERROR_RETURN("HY004"); if (prefixlen == 0 && varlen == SQL_VARLEN_DATA && termlen == -1 && !is_fixed_type(vartype)) { tdsdump_log(TDS_DBG_FUNC, "bcp_bind(): non-fixed type %d requires prefix or terminator\n", vartype); ODBCBCP_ERROR_RETURN("HY009"); } if (table_column <= 0 || table_column > dbc->bcpinfo->bindinfo->num_cols) ODBCBCP_ERROR_RETURN("HY009"); if (varaddr == NULL && (prefixlen != 0 || termlen != 0)) ODBCBCP_ERROR_RETURN("HY009"); colinfo = dbc->bcpinfo->bindinfo->columns[table_column - 1]; /* If varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY */ if (varaddr == NULL && varlen >= 0) { int fOK = (colinfo->column_type == SYBTEXT || colinfo->column_type == SYBIMAGE) && (vartype == SYBTEXT || vartype == SYBCHAR || vartype == SYBIMAGE || vartype == SYBBINARY ); if( !fOK ) { tdsdump_log(TDS_DBG_FUNC, "bcp_bind: SYBEBCBNTYP: column=%d and vartype=%d (should fail?)\n", colinfo->column_type, vartype); ODBCBCP_ERROR_RETURN("HY009"); } } colinfo->column_varaddr = (char *)varaddr; colinfo->column_bindtype = vartype; colinfo->column_bindlen = varlen; colinfo->bcp_prefix_len = prefixlen; TDS_ZERO_FREE(colinfo->bcp_terminator); colinfo->bcp_term_len = 0; if (termlen > 0) { if ((colinfo->bcp_terminator = tds_new(TDS_CHAR, termlen)) == NULL) ODBCBCP_ERROR_RETURN("HY001"); memcpy(colinfo->bcp_terminator, terminator, termlen); colinfo->bcp_term_len = termlen; } } static SQLLEN _bcp_iconv_helper(const TDS_DBC *dbc, const TDSCOLUMN *bindcol, const TDS_CHAR * src, size_t srclen, char * dest, size_t destlen) { if (bindcol->char_conv) { char *orig_dest = dest; if (tds_iconv(dbc->tds_socket, bindcol->char_conv, to_server, &src, &srclen, &dest, &destlen) == (size_t)-1) return -1; return dest - orig_dest; } if (destlen > srclen) destlen = srclen; memcpy(dest, src, destlen); return destlen; } static SQLLEN _tdsodbc_dbconvert(TDS_DBC *dbc, int srctype, const TDS_CHAR * src, SQLLEN src_len, int desttype, unsigned char * dest, TDSCOLUMN *bindcol) { CONV_RESULT dres; SQLLEN ret; SQLLEN len; SQLLEN destlen = bindcol->column_size; TDS_DATETIMEALL dta; TDS_NUMERIC num; SQL_NUMERIC_STRUCT * sql_num; bool always_convert = false; assert(src_len >= 0); assert(src != NULL); assert(dest != NULL); assert(destlen > 0); tdsdump_log(TDS_DBG_FUNC, "tdsodbc_dbconvert(%p, %d, %p, %d, %d, %p, %d)\n", dbc, srctype, src, (int)src_len, desttype, dest, (int)destlen); switch (srctype) { case SYBMSDATETIME2: convert_datetime2server(SQL_C_TYPE_TIMESTAMP, src, &dta); dta.time_prec = (destlen - 40) / 2; src = (char *) &dta; break; case SYBDECIMAL: case SYBNUMERIC: sql_num = (SQL_NUMERIC_STRUCT *) src; num.precision = sql_num->precision; num.scale = sql_num->scale; num.array[0] = sql_num->sign ^ 1; /* test precision so client do not crash our library */ if (num.precision <= 0 || num.precision > 38 || num.scale > num.precision) /* TODO add proper error */ return -1; len = tds_numeric_bytes_per_prec[num.precision]; memcpy(num.array + 1, sql_num->val, len - 1); tds_swap_bytes(num.array + 1, len - 1); if (len < sizeof(num.array)) memset(num.array + len, 0, sizeof(num.array) - len); src = (char *) # always_convert = num.scale != bindcol->column_scale; break; /* TODO intervals */ } /* oft times we are asked to convert a data type to itself */ if ((srctype == desttype || is_similar_type(srctype, desttype)) && !always_convert) { if (is_char_type(desttype)) { ret = _bcp_iconv_helper(dbc, bindcol, src, src_len, (char *)dest, destlen); } else { ret = destlen < src_len ? destlen : src_len; memcpy(dest, src, ret); } return ret; } tdsdump_log(TDS_DBG_INFO1, "dbconvert() calling tds_convert\n"); if (is_numeric_type(desttype)) { dres.n.precision = bindcol->column_prec; dres.n.scale = bindcol->column_scale; } len = tds_convert(dbc->env->tds_ctx, srctype, src, src_len, desttype, &dres); tdsdump_log(TDS_DBG_INFO1, "dbconvert() called tds_convert returned %d\n", (int)len); if (len < 0) { odbc_convert_err_set(&dbc->errs, len); return -1; } switch (desttype) { case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: ret = destlen < len ? destlen : len; memcpy(dest, dres.ib, ret); free(dres.ib); break; case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBREAL: case SYBBIT: case SYBBITN: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBNUMERIC: case SYBDECIMAL: case SYBUNIQUE: case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: memcpy(dest, &dres, len); ret = len; break; case SYBCHAR: case SYBVARCHAR: case SYBTEXT: ret = _bcp_iconv_helper(dbc, bindcol, dres.c, len, (char *)dest, destlen); free(dres.c); break; default: tdsdump_log(TDS_DBG_INFO1, "error: dbconvert(): unrecognized desttype %d \n", desttype); ret = -1; break; } return (ret); } static TDSRET _bcp_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset) { TDS_TINYINT ti; TDS_SMALLINT si; TDS_INT li; TDS_INT8 lli; TDS_SERVER_TYPE desttype, coltype; SQLLEN col_len; int data_is_null; SQLLEN bytes_read; int converted_data_size; TDS_CHAR *dataptr; TDS_DBC *dbc = (TDS_DBC *) bcpinfo->parent; tdsdump_log(TDS_DBG_FUNC, "_bcp_get_col_data(%p, %p)\n", bcpinfo, bindcol); dataptr = bindcol->column_varaddr; data_is_null = 0; col_len = SQL_NULL_DATA; /* If a prefix length specified, read the correct amount of data. */ if (bindcol->bcp_prefix_len > 0) { switch (bindcol->bcp_prefix_len) { case 1: memcpy(&ti, dataptr, 1); dataptr += 1; col_len = ti; break; case 2: memcpy(&si, dataptr, 2); dataptr += 2; col_len = si; break; case 4: memcpy(&li, dataptr, 4); dataptr += 4; col_len = li; break; case 8: memcpy(&lli, dataptr, 8); dataptr += 8; col_len = lli; if (lli != col_len) return TDS_FAIL; break; } if (col_len == SQL_NULL_DATA) data_is_null = 1; } /* if (Max) column length specified take that into consideration. */ if (bindcol->column_bindlen == SQL_NULL_DATA) data_is_null = 1; else if (!data_is_null && bindcol->column_bindlen != SQL_VARLEN_DATA) { if (col_len != SQL_NULL_DATA) col_len = ((TDS_INT8)bindcol->column_bindlen < col_len) ? bindcol->column_bindlen : col_len; else col_len = bindcol->column_bindlen; } desttype = tds_get_conversion_type(bindcol->column_type, bindcol->column_size); /* Fixed Length data - this overrides anything else specified */ coltype = bindcol->column_bindtype == 0 ? desttype : (TDS_SERVER_TYPE) bindcol->column_bindtype; if (is_fixed_type(coltype)) { col_len = tds_get_size_by_type(coltype); } /* read the data, finally */ if (!data_is_null && bindcol->bcp_term_len > 0) { /* terminated field */ bytes_read = _bcp_get_term_var(dataptr, bindcol->bcp_terminator, bindcol->bcp_term_len); if (col_len != SQL_NULL_DATA) col_len = (bytes_read < col_len) ? bytes_read : col_len; else col_len = bytes_read; } if (data_is_null) { bindcol->bcp_column_data->datalen = 0; bindcol->bcp_column_data->is_null = 1; } else { if ((converted_data_size = _tdsodbc_dbconvert(dbc, coltype, dataptr, col_len, desttype, bindcol->bcp_column_data->data, bindcol)) == -1) { return TDS_FAIL; } bindcol->bcp_column_data->datalen = converted_data_size; bindcol->bcp_column_data->is_null = 0; } return TDS_SUCCESS; } /** * Get the data for bcp-in from program variables, where the program data * have been identified as character terminated, * This is a low-level, internal function. Call it correctly. */ static SQLLEN _bcp_get_term_var(const TDS_CHAR * pdata, const TDS_CHAR * term, int term_len) { SQLLEN bufpos; assert(term_len > 0); if (term_len == 1 && *term == '\0') /* significant optimization for very common case */ return strlen(pdata); /* if bufpos becomes negative, we probably failed to find the terminator */ for (bufpos = 0; bufpos >= 0 && memcmp(pdata, term, term_len) != 0; pdata++) { bufpos++; } assert(bufpos >= 0); return bufpos; } void odbc_bcp_free_storage(TDS_DBC *dbc) { tdsdump_log(TDS_DBG_FUNC, "_bcp_free_storage(%p)\n", dbc); assert(dbc); tds_free_bcpinfo(dbc->bcpinfo); dbc->bcpinfo = NULL; TDS_ZERO_FREE(dbc->bcphint); } freetds-1.3.6/src/odbc/native.c000644 025423 025423 00000023370 14056414221 017737 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-2002 Brian Bruns * Copyright (C) 2004, 2005 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include #include #include #include #define TDS_ISSPACE(c) isspace((unsigned char) (c)) #define TDS_ISALPHA(c) isalpha((unsigned char) (c)) /* * Function transformation (from ODBC to Sybase) * String functions * ASCII(string) -> ASCII(string) * BIT_LENGTH(string) -> 8*OCTET_LENGTH(string) * CHAR_LENGTH(string_exp) -> CHAR_LENGTH(string_exp) * CHARACTER_LENGTH(string_exp) -> CHAR_LENGTH(string_exp) * CONCAT(string_exp1, string_exp2) -> string_exp1 + string_exp2 * DIFFERENCE(string_exp1, string_exp2) -> DIFFERENCE(string_exp1, string_exp2) * INSERT(string_exp1, start, length, string_exp2) -> STUFF(sameparams) * LCASE(string_exp) -> LOWER(string) * LEFT(string_exp, count) -> SUBSTRING(string, 1, count) * LENGTH(string_exp) -> CHAR_LENGTH(RTRIM(string_exp)) * LOCATE(string, string [,start]) -> CHARINDEX(string, string) * (SQLGetInfo should return third parameter not possible) * LTRIM(String) -> LTRIM(String) * OCTET_LENGTH(string_exp) -> OCTET_LENGTH(string_exp) * POSITION(character_exp IN character_exp) ??? * REPEAT(string_exp, count) -> REPLICATE(same) * REPLACE(string_exp1, string_exp2, string_exp3) -> ?? * RIGHT(string_exp, count) -> RIGHT(string_exp, count) * RTRIM(string_exp) -> RTRIM(string_exp) * SOUNDEX(string_exp) -> SOUNDEX(string_exp) * SPACE(count) (ODBC 2.0) -> SPACE(count) (ODBC 2.0) * SUBSTRING(string_exp, start, length) -> SUBSTRING(string_exp, start, length) * UCASE(string_exp) -> UPPER(string) * * Numeric * Nearly all function use same parameters, except: * ATAN2 -> ATN2 * TRUNCATE -> ?? */ static SQLRETURN to_native(struct _hdbc *dbc, struct _hstmt *stmt, DSTR *str) { char *d, *s; int nest_syntax = 0; char *buf = tds_dstr_buf(str); /* list of bit, used as stack, is call ? FIXME limites size... */ unsigned long is_calls = 0; int server_scalar; assert(dbc); server_scalar = TDS_IS_MSSQL(dbc->tds_socket) && dbc->tds_socket->conn->product_version >= TDS_MS_VER(7, 0, 0); /* * we can do it because result string will be * not bigger than source string */ d = s = buf; while (*s) { if (*s == '-' || *s == '/') { size_t len_comment = tds_skip_comment(s) - s; memmove(d, s, len_comment); s += len_comment; d += len_comment; continue; } /* TODO: test syntax like "select 1 as [pi]]p)p{?=call]]]]o], 2" on mssql7+ */ if (*s == '"' || *s == '\'' || *s == '[') { size_t len_quote = tds_skip_quoted(s) - s; memmove(d, s, len_quote); s += len_quote; d += len_quote; continue; } if (*s == '{') { char *pcall; while (TDS_ISSPACE(*++s)) continue; pcall = s; /* FIXME if nest_syntax > 0 problems */ if (server_scalar && strncasecmp(pcall, "fn ", 3) == 0) { *d++ = '{'; continue; } if (*pcall == '?') { /* skip spaces after ? */ while (TDS_ISSPACE(*++pcall)) continue; if (*pcall == '=') { while (TDS_ISSPACE(*++pcall)) continue; } else { /* avoid {?call ... syntax */ pcall = s; } } if (strncasecmp(pcall, "call ", 5) != 0) pcall = NULL; if (stmt) stmt->prepared_query_is_rpc = 1; ++nest_syntax; is_calls <<= 1; if (!pcall) { /* assume syntax in the form {type ...} */ while (TDS_ISALPHA(*s)) ++s; while (TDS_ISSPACE(*s)) ++s; } else { if (*s == '?' && stmt) stmt->prepared_query_is_func = 1; memcpy(d, "exec ", 5); d += 5; s = pcall + 5; is_calls |= 1; } } else if (nest_syntax > 0) { /* do not copy close syntax */ if (*s == '}') { --nest_syntax; is_calls >>= 1; ++s; continue; /* convert parenthesis in call to spaces */ } else if ((is_calls & 1) && (*s == '(' || *s == ')')) { *d++ = ' '; s++; } else { *d++ = *s++; } } else { *d++ = *s++; } } tds_dstr_setlen(str, d - buf); return SQL_SUCCESS; } const char * parse_const_param(const char *s, TDS_SERVER_TYPE *type) { char *end; /* binary */ if (strncasecmp(s, "0x", 2) == 0) { s += 2; while (isxdigit(*s)) ++s; *type = SYBVARBINARY; return s; } /* string */ if (*s == '\'') { *type = SYBVARCHAR; return tds_skip_quoted(s); } /* integer/float */ if (isdigit(*s) || *s == '+' || *s == '-') { long val; errno = 0; strtod(s, &end); if (end != s && strcspn(s, ".eE") < (size_t) (end-s) && errno == 0) { *type = SYBFLT8; return end; } errno = 0; val = strtol(s, &end, 10); if (end != s && errno == 0) { if (val+1 >= -0x7FFFFFFF && val <= 0x7FFFFFFF) *type = SYBINT4; else *type = SYBINT8; return end; } errno = 0; tds_strtoll(s, &end, 10); if (end != s && errno == 0) { *type = SYBINT8; return end; } } /* TODO date, time */ return NULL; } const char * odbc_skip_rpc_name(const char *s) { for (;*s; ++s) { if (*s == '[') { /* handle [dbo].[name] and [master]..[name] syntax */ s = tds_skip_quoted(s); if (*s != '.') break; } else if (TDS_ISSPACE(*s)) { /* FIXME: stop at other characters ??? */ break; } } return s; } SQLRETURN prepare_call(struct _hstmt * stmt) { const char *s, *p, *param_start; char *buf; SQLRETURN rc; TDS_SERVER_TYPE type; if (tds_dstr_isempty(&stmt->query)) return SQL_ERROR; if ((!tds_dstr_isempty(&stmt->attr.qn_msgtext) || !tds_dstr_isempty(&stmt->attr.qn_options)) && !IS_TDS72_PLUS(stmt->dbc->tds_socket->conn)) { odbc_errs_add(&stmt->errs, "HY000", "Feature is not supported by this server"); return SQL_SUCCESS_WITH_INFO; } if ((rc = to_native(stmt->dbc, stmt, &stmt->query)) != SQL_SUCCESS) return rc; /* now detect RPC */ if (stmt->prepared_query_is_rpc == 0) return SQL_SUCCESS; stmt->prepared_query_is_rpc = 0; s = buf = tds_dstr_buf(&stmt->query); while (TDS_ISSPACE(*s)) ++s; if (strncasecmp(s, "exec", 4) == 0) { if (TDS_ISSPACE(s[4])) s += 5; else if (strncasecmp(s, "execute", 7) == 0 && TDS_ISSPACE(s[7])) s += 8; else { stmt->prepared_query_is_func = 0; return SQL_SUCCESS; } } while (TDS_ISSPACE(*s)) ++s; p = s; s = (char *) odbc_skip_rpc_name(s); param_start = s; --s; /* trick, now s point to no blank */ for (;;) { while (TDS_ISSPACE(*++s)) continue; if (!*s) break; switch (*s) { case '?': break; case ',': --s; break; default: if (!(s = parse_const_param(s, &type))) { stmt->prepared_query_is_func = 0; return SQL_SUCCESS; } --s; break; } while (TDS_ISSPACE(*++s)) continue; if (!*s) break; if (*s != ',') { stmt->prepared_query_is_func = 0; return SQL_SUCCESS; } } stmt->prepared_query_is_rpc = 1; /* remove unneeded exec */ s += strlen(s); memmove(buf, p, s - p); tds_dstr_setlen(&stmt->query, s - p); stmt->prepared_pos = param_start - p; return SQL_SUCCESS; } /* TODO handle output parameter and not terminated string */ SQLRETURN native_sql(struct _hdbc * dbc, DSTR *s) { return to_native(dbc, NULL, s); } /* function info */ struct func_info; struct native_info; typedef void (*special_fn) (struct native_info * ni, struct func_info * fi, char **params); struct func_info { const char *name; int num_param; const char *sql_name; special_fn special; }; struct native_info { char *d; int length; }; #if 0 /* developing ... */ #define MAX_PARAMS 4 static const struct func_info funcs[] = { /* string functions */ {"ASCII", 1}, {"BIT_LENGTH", 1, "(8*OCTET_LENGTH", fn_parentheses}, {"CHAR", 1}, {"CHAR_LENGTH", 1}, {"CHARACTER_LENGTH", 1, "CHAR_LENGTH"}, {"CONCAT", 2, NULL, fn_concat}, /* a,b -> a+b */ {"DIFFERENCE", 2}, {"INSERT", 4, "STUFF"}, {"LCASE", 1, "LOWER"}, {"LEFT", 2, "SUBSTRING", fn_left}, {"LENGTH", 1, "CHAR_LENGTH(RTRIM", fn_parentheses}, {"LOCATE", 2, "CHARINDEX"}, /* (SQLGetInfo should return third parameter not possible) */ {"LTRIM", 1}, {"OCTET_LENGTH", 1}, /* POSITION(character_exp IN character_exp) */ {"REPEAT", 2, "REPLICATE"}, /* REPLACE(string_exp1, string_exp2, string_exp3) */ {"RIGHT", 2}, {"RTRIM", 1}, {"SOUNDEX", 1}, {"SPACE", 1}, {"SUBSTRING", 3}, {"UCASE", 1, "UPPER"}, /* numeric functions */ {"ABS", 1}, {"ACOS", 1}, {"ASIN", 1}, {"ATAN", 1}, {"ATAN2", 2, "ATN2"}, {"CEILING", 1}, {"COS", 1}, {"COT", 1}, {"DEGREES", 1}, {"EXP", 1}, {"FLOOR", 1}, {"LOG", 1}, {"LOG10", 1}, {"MOD", 2, NULL, fn_mod}, /* mod(a,b) -> ((a)%(b)) */ {"PI", 0}, {"POWER", 2}, {"RADIANS", 1}, {"RAND", -1, NULL, fn_rand}, /* accept 0 or 1 parameters */ {"ROUND", 2}, {"SIGN", 1}, {"SIN", 1}, {"SQRT", 1}, {"TAN", 1}, /* TRUNCATE(numeric_exp, integer_exp) */ /* system functions */ {"DATABASE", 0, "DB_NAME"}, {"IFNULL", 2, "ISNULL"}, {"USER", 0, "USER_NAME"} }; /** * Parse given sql and return converted sql */ int odbc_native_sql(const char *odbc_sql, char **out) { char *d; } #endif freetds-1.3.6/src/odbc/sql2tds.c000644 025423 025423 00000034274 14056414221 020052 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2005-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include TDS_INT convert_datetime2server(int bindtype, const void *src, TDS_DATETIMEALL * dta) { struct tm src_tm; int tm_dms; unsigned int dt_time; int i; time_t curr_time; const DATE_STRUCT *src_date = (const DATE_STRUCT *) src; const TIME_STRUCT *src_time = (const TIME_STRUCT *) src; const TIMESTAMP_STRUCT *src_timestamp = (const TIMESTAMP_STRUCT *) src; memset(dta, 0, sizeof(*dta)); switch (bindtype) { case SQL_C_DATE: case SQL_C_TYPE_DATE: src_tm.tm_year = src_date->year - 1900; src_tm.tm_mon = src_date->month - 1; src_tm.tm_mday = src_date->day; src_tm.tm_hour = 0; src_tm.tm_min = 0; src_tm.tm_sec = 0; tm_dms = 0; dta->has_date = 1; break; case SQL_C_TIME: case SQL_C_TYPE_TIME: #if HAVE_GETTIMEOFDAY { struct timeval tv; gettimeofday(&tv, NULL); curr_time = tv.tv_sec; } #else curr_time = time(NULL); #endif tds_localtime_r(&curr_time, &src_tm); src_tm.tm_hour = src_time->hour; src_tm.tm_min = src_time->minute; src_tm.tm_sec = src_time->second; tm_dms = 0; dta->has_time = 1; break; case SQL_C_TIMESTAMP: case SQL_C_TYPE_TIMESTAMP: src_tm.tm_year = src_timestamp->year - 1900; src_tm.tm_mon = src_timestamp->month - 1; src_tm.tm_mday = src_timestamp->day; src_tm.tm_hour = src_timestamp->hour; src_tm.tm_min = src_timestamp->minute; src_tm.tm_sec = src_timestamp->second; tm_dms = src_timestamp->fraction / 100lu; dta->has_date = 1; dta->has_time = 1; break; default: return TDS_CONVERT_FAIL; } /* TODO code copied from convert.c, function */ i = (src_tm.tm_mon - 13) / 12; dta->has_date = 1; dta->date = 1461 * (src_tm.tm_year + 300 + i) / 4 + (367 * (src_tm.tm_mon - 1 - 12 * i)) / 12 - (3 * ((src_tm.tm_year + 400 + i) / 100)) / 4 + src_tm.tm_mday - 109544; dta->has_time = 1; dt_time = (src_tm.tm_hour * 60 + src_tm.tm_min) * 60 + src_tm.tm_sec; dta->time = dt_time * ((TDS_UINT8) 10000000u) + tm_dms; return sizeof(TDS_DATETIMEALL); } static char* odbc_wstr2str(TDS_STMT * stmt, const char *src, int* len) { int srclen = (*len) / sizeof(SQLWCHAR); char *out = tds_new(char, srclen + 1), *p; const SQLWCHAR *wp = (const SQLWCHAR *) src; if (!out) { odbc_errs_add(&stmt->errs, "HY001", NULL); return NULL; } /* convert */ p = out; for (; srclen && *wp < 256; --srclen) *p++ = (char) *wp++; /* still characters, wrong format */ if (srclen) { free(out); /* TODO correct error ?? */ odbc_errs_add(&stmt->errs, "07006", NULL); return NULL; } *len = p - out; return out; } static void _odbc_blob_free(TDSCOLUMN *col) { if (!col->column_data) return; TDS_ZERO_FREE(col->column_data); } /** * Convert parameters to libtds format * @param stmt ODBC statement * @param drec_ixd IRD or IPD record of destination * @param drec_ard ARD or APD record of source * @param curcol destination column * @param compute_row true if data needs to be written to column * @param axd ARD or APD of source * @param n_row number of the row to write * @return SQL_SUCCESS, SQL_ERROR or SQL_NEED_DATA */ SQLRETURN odbc_sql2tds(TDS_STMT * stmt, const struct _drecord *drec_ixd, const struct _drecord *drec_axd, TDSCOLUMN *curcol, bool compute_row, const TDS_DESC* axd, unsigned int n_row) { TDS_DBC * dbc = stmt->dbc; TDSCONNECTION * conn = dbc->tds_socket->conn; TDS_SERVER_TYPE dest_type; int src_type, sql_src_type, res; CONV_RESULT ores; TDSBLOB *blob; char *src, *converted_src; unsigned char *dest; int len; TDS_DATETIMEALL dta; TDS_NUMERIC num; SQL_NUMERIC_STRUCT *sql_num; SQLINTEGER sql_len; bool need_data = false; int i; /* TODO handle bindings of char like "{d '2002-11-12'}" */ tdsdump_log(TDS_DBG_INFO2, "type=%d\n", drec_ixd->sql_desc_concise_type); /* what type to convert ? */ dest_type = odbc_sql_to_server_type(conn, drec_ixd->sql_desc_concise_type, drec_ixd->sql_desc_unsigned); if (dest_type == TDS_INVALID_TYPE) { odbc_errs_add(&stmt->errs, "07006", NULL); /* Restricted data type attribute violation */ return SQL_ERROR; } tdsdump_log(TDS_DBG_INFO2, "trace\n"); /* get C type */ sql_src_type = drec_axd->sql_desc_concise_type; if (sql_src_type == SQL_C_DEFAULT) sql_src_type = odbc_sql_to_c_type_default(drec_ixd->sql_desc_concise_type); tds_set_param_type(conn, curcol, dest_type); /* TODO what happen for unicode types ?? */ if (is_char_type(dest_type)) { TDSICONV *conv = conn->char_convs[is_unicode_type(dest_type) ? client2ucs2 : client2server_chardata]; /* use binary format for binary to char */ if (sql_src_type == SQL_C_BINARY) { curcol->char_conv = NULL; } else if (sql_src_type == SQL_C_WCHAR) { curcol->char_conv = tds_iconv_get_info(conn, odbc_get_wide_canonic(conn), conv->to.charset.canonic); memcpy(curcol->column_collation, conn->collation, sizeof(conn->collation)); } else { #ifdef ENABLE_ODBC_WIDE curcol->char_conv = tds_iconv_get_info(conn, dbc->original_charset_num, conv->to.charset.canonic); #else curcol->char_conv = NULL; #endif } } if (is_numeric_type(curcol->column_type)) { curcol->column_prec = drec_ixd->sql_desc_precision; curcol->column_scale = drec_ixd->sql_desc_scale; } if (drec_ixd->sql_desc_parameter_type != SQL_PARAM_INPUT) curcol->column_output = 1; /* compute destination length */ if (curcol->column_varint_size != 0) { /* curcol->column_size = drec_axd->sql_desc_octet_length; */ /* * TODO destination length should come from sql_desc_length, * however there is the encoding problem to take into account * we should fill destination length after conversion keeping * attention to fill correctly blob/fixed type/variable type */ /* TODO location of this test is correct here ?? */ if (dest_type != SYBUNIQUE && !is_fixed_type(dest_type)) { curcol->column_cur_size = 0; curcol->column_size = drec_ixd->sql_desc_length; if (curcol->column_size < 0) { curcol->on_server.column_size = curcol->column_size = 0x7FFFFFFFl; } else { if (is_unicode_type(dest_type)) curcol->on_server.column_size = curcol->column_size * 2; else curcol->on_server.column_size = curcol->column_size; } } } else if (dest_type != SYBBIT) { /* TODO only a trick... */ tds_set_param_type(conn, curcol, tds_get_null_type(dest_type)); } /* test source type */ /* TODO test intervals */ src_type = odbc_c_to_server_type(sql_src_type); if (!src_type) { odbc_errs_add(&stmt->errs, "07006", NULL); /* Restricted data type attribute violation */ return SQL_ERROR; } /* we have no data to convert, just return */ if (!compute_row) return SQL_SUCCESS; src = (char *) drec_axd->sql_desc_data_ptr; if (src && n_row) { SQLLEN len; if (axd->header.sql_desc_bind_type != SQL_BIND_BY_COLUMN) { len = axd->header.sql_desc_bind_type; if (axd->header.sql_desc_bind_offset_ptr) src += *axd->header.sql_desc_bind_offset_ptr; } else { len = odbc_get_octet_len(sql_src_type, drec_axd); if (len < 0) /* TODO sure ? what happen to upper layer ?? */ /* TODO fill error */ return SQL_ERROR; } src += len * n_row; } /* if only output assume input is NULL */ if (drec_ixd->sql_desc_parameter_type == SQL_PARAM_OUTPUT) { sql_len = SQL_NULL_DATA; } else { sql_len = odbc_get_param_len(drec_axd, drec_ixd, axd, n_row); /* special case, MS ODBC handle conversion from "\0" to any to NULL, DBD::ODBC require it */ if (src_type == SYBVARCHAR && sql_len == 1 && drec_ixd->sql_desc_parameter_type == SQL_PARAM_INPUT_OUTPUT && src && *src == 0) { sql_len = SQL_NULL_DATA; } } /* compute source length */ switch (sql_len) { case SQL_NULL_DATA: len = 0; break; case SQL_NTS: /* check that SQLBindParameter::ParameterValuePtr is not zero for input parameters */ if (!src) { odbc_errs_add(&stmt->errs, "HY090", NULL); return SQL_ERROR; } if (sql_src_type == SQL_C_WCHAR) len = sqlwcslen((const SQLWCHAR *) src) * sizeof(SQLWCHAR); else len = strlen(src); break; case SQL_DEFAULT_PARAM: odbc_errs_add(&stmt->errs, "07S01", NULL); /* Invalid use of default parameter */ return SQL_ERROR; break; case SQL_DATA_AT_EXEC: default: len = sql_len; if (sql_len < 0) { /* test for SQL_C_CHAR/SQL_C_BINARY */ switch (sql_src_type) { case SQL_C_CHAR: case SQL_C_WCHAR: case SQL_C_BINARY: break; default: odbc_errs_add(&stmt->errs, "HY090", NULL); return SQL_ERROR; } len = SQL_LEN_DATA_AT_EXEC(sql_len); need_data = true; /* dynamic length allowed only for BLOB fields */ switch (drec_ixd->sql_desc_concise_type) { case SQL_LONGVARCHAR: case SQL_WLONGVARCHAR: case SQL_LONGVARBINARY: break; default: odbc_errs_add(&stmt->errs, "HY090", NULL); return SQL_ERROR; } } } /* set NULL. For NULLs we don't need to allocate row buffer so avoid it */ if (!need_data) { assert(drec_ixd->sql_desc_parameter_type != SQL_PARAM_OUTPUT || sql_len == SQL_NULL_DATA); if (sql_len == SQL_NULL_DATA) { curcol->column_cur_size = -1; return SQL_SUCCESS; } } if (is_char_type(dest_type) && !need_data && (sql_src_type == SQL_C_CHAR || sql_src_type == SQL_C_WCHAR || sql_src_type == SQL_C_BINARY)) { if (curcol->column_data && curcol->column_data_free) curcol->column_data_free(curcol); curcol->column_data_free = NULL; if (is_blob_col(curcol)) { /* trick to set blob without freeing it, _odbc_blob_free does not free TDSBLOB->textvalue */ TDSBLOB *blob = tds_new0(TDSBLOB, 1); if (!blob) { odbc_errs_add(&stmt->errs, "HY001", NULL); return SQL_ERROR; } blob->textvalue = src; curcol->column_data = (TDS_UCHAR*) blob; curcol->column_data_free = _odbc_blob_free; } else { curcol->column_data = (TDS_UCHAR*) src; } curcol->column_size = len; curcol->column_cur_size = len; return SQL_SUCCESS; } /* allocate given space */ if (!tds_alloc_param_data(curcol)) { odbc_errs_add(&stmt->errs, "HY001", NULL); return SQL_ERROR; } /* fill data with SQLPutData */ if (need_data) { curcol->column_cur_size = 0; return SQL_NEED_DATA; } if (!src) { odbc_errs_add(&stmt->errs, "HY090", NULL); return SQL_ERROR; } /* convert special parameters (not libTDS compatible) */ switch (src_type) { case SYBMSDATETIME2: convert_datetime2server(sql_src_type, src, &dta); src = (char *) &dta; break; case SYBDECIMAL: case SYBNUMERIC: sql_num = (SQL_NUMERIC_STRUCT *) src; num.precision = sql_num->precision; num.scale = sql_num->scale; num.array[0] = sql_num->sign ^ 1; /* test precision so client do not crash our library */ if (num.precision <= 0 || num.precision > 38 || num.scale > num.precision) /* TODO add proper error */ return SQL_ERROR; i = tds_numeric_bytes_per_prec[num.precision]; memcpy(num.array + 1, sql_num->val, i - 1); tds_swap_bytes(num.array + 1, i - 1); if (i < sizeof(num.array)) memset(num.array + i, 0, sizeof(num.array) - i); src = (char *) # break; /* TODO intervals */ } converted_src = NULL; if (sql_src_type == SQL_C_WCHAR) { converted_src = src = odbc_wstr2str(stmt, src, &len); if (!src) return SQL_ERROR; src_type = SYBVARCHAR; } dest = curcol->column_data; switch ((TDS_SERVER_TYPE) dest_type) { case SYBCHAR: case SYBVARCHAR: case XSYBCHAR: case XSYBVARCHAR: case XSYBNVARCHAR: case XSYBNCHAR: case SYBNVARCHAR: ores.cc.c = (TDS_CHAR*) dest; ores.cc.len = curcol->column_size; res = tds_convert(dbc->env->tds_ctx, src_type, src, len, TDS_CONVERT_CHAR, &ores); if (res > curcol->column_size) res = curcol->column_size; break; case SYBBINARY: case SYBVARBINARY: case XSYBBINARY: case XSYBVARBINARY: ores.cb.ib = (TDS_CHAR*) dest; ores.cb.len = curcol->column_size; res = tds_convert(dbc->env->tds_ctx, src_type, src, len, TDS_CONVERT_BINARY, &ores); if (res > curcol->column_size) res = curcol->column_size; break; case SYBNTEXT: dest_type = SYBTEXT; case SYBTEXT: case SYBLONGBINARY: case SYBIMAGE: res = tds_convert(dbc->env->tds_ctx, src_type, src, len, dest_type, &ores); if (res >= 0) { blob = (TDSBLOB *) dest; free(blob->textvalue); blob->textvalue = ores.ib; } break; case SYBNUMERIC: case SYBDECIMAL: ((TDS_NUMERIC *) dest)->precision = drec_ixd->sql_desc_precision; ((TDS_NUMERIC *) dest)->scale = drec_ixd->sql_desc_scale; case SYBINTN: case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBDATETIME: case SYBBIT: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBREAL: case SYBBITN: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: case SYBSINT1: case SYBUINT2: case SYBUINT4: case SYBUINT8: case SYBUNIQUE: case SYBMSTIME: case SYBMSDATE: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYB5BIGTIME: case SYB5BIGDATETIME: res = tds_convert(dbc->env->tds_ctx, src_type, src, len, dest_type, (CONV_RESULT*) dest); break; default: case SYBVOID: case SYBVARIANT: /* TODO ODBC 3.5 */ assert(0); res = -1; break; } free(converted_src); if (res < 0) { odbc_convert_err_set(&stmt->errs, res); return SQL_ERROR; } curcol->column_cur_size = res; return SQL_SUCCESS; } freetds-1.3.6/src/odbc/error.c000644 025423 025423 00000052203 14056414271 017604 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2003-2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "odbcss.h" #include #include #include "sqlwparams.h" static void odbc_errs_pop(struct _sql_errors *errs); static const char *odbc_get_msg(const char *sqlstate); static void odbc_get_v2state(const char *sqlstate, char *dest_state); static void sqlstate2to3(char *state); struct s_SqlMsgMap { const char *msg; char sqlstate[6]; }; /* This list contains both v2 and v3 messages */ #define ODBCERR(s3,msg) { msg, s3 } static const struct s_SqlMsgMap SqlMsgMap[] = { ODBCERR("IM007", "No data source or driver specified"), ODBCERR("01000", "Warning"), ODBCERR("01002", "Disconnect error"), ODBCERR("01004", "Data truncated"), ODBCERR("01504", "The UPDATE or DELETE statement does not include a WHERE clause"), ODBCERR("01508", "Statement disqualified for blocking"), ODBCERR("01S00", "Invalid connection string attribute"), ODBCERR("01S01", "Error in row"), ODBCERR("01S02", "Option value changed"), ODBCERR("01S06", "Attempt to fetch before the result set returned the first rowset"), ODBCERR("01S07", "Fractional truncation"), ODBCERR("07001", "Wrong number of parameters"), ODBCERR("07002", "Too many columns"), ODBCERR("07005", "The statement did not return a result set"), ODBCERR("07006", "Invalid conversion"), ODBCERR("07009", "Invalid descriptor index"), ODBCERR("08001", "Unable to connect to data source"), ODBCERR("08002", "Connection in use"), ODBCERR("08003", "Connection is closed"), ODBCERR("08004", "The application server rejected establishment of the connection"), ODBCERR("08007", "Connection failure during transaction"), ODBCERR("08S01", "Communication link failure"), ODBCERR("0F001", "The LOB token variable does not currently represent any value"), ODBCERR("21S01", "Insert value list does not match column list"), ODBCERR("22001", "String data right truncation"), ODBCERR("22002", "Invalid output or indicator buffer specified"), ODBCERR("22003", "Numeric value out of range"), ODBCERR("22005", "Error in assignment"), ODBCERR("22007", "Invalid datetime format"), ODBCERR("22008", "Datetime field overflow"), ODBCERR("22011", "A substring error occurred"), ODBCERR("22012", "Division by zero is invalid"), ODBCERR("22015", "Interval field overflow"), ODBCERR("22018", "Invalid character value for cast specification"), ODBCERR("22019", "Invalid escape character"), ODBCERR("22025", "Invalid escape sequence"), ODBCERR("22026", "String data, length mismatch"), ODBCERR("23000", "Integrity constraint violation"), ODBCERR("24000", "Invalid cursor state"), ODBCERR("24504", "The cursor identified in the UPDATE, DELETE, SET, or GET statement is not positioned on a row"), ODBCERR("25501", "Invalid transaction state"), ODBCERR("28000", "Invalid authorization specification"), ODBCERR("34000", "Invalid cursor name"), ODBCERR("37000", "Invalid SQL syntax"), ODBCERR("40001", "Serialization failure"), ODBCERR("40003", "Statement completion unknown"), ODBCERR("42000", "Syntax error or access violation"), ODBCERR("42601", "PARMLIST syntax error"), ODBCERR("42818", "The operands of an operator or function are not compatible"), ODBCERR("42895", "The value of a host variable in the EXECUTE or OPEN statement cannot be used because of its data type"), ODBCERR("428A1", "Unable to access a file referenced by a host file variable"), ODBCERR("44000", "Integrity constraint violation"), ODBCERR("54028", "The maximum number of concurrent LOB handles has been reached"), ODBCERR("56084", "LOB data is not supported in DRDA"), ODBCERR("58004", "Unexpected system failure"), ODBCERR("HY000", "General driver error"), ODBCERR("HY001", "Memory allocation failure"), ODBCERR("HY002", "Invalid column number"), ODBCERR("HY003", "Program type out of range"), ODBCERR("HY004", "Invalid data type"), ODBCERR("HY007", "Associated statement is not prepared"), ODBCERR("HY008", "Operation was cancelled"), ODBCERR("HY009", "Invalid argument value"), ODBCERR("HY010", "Function sequence error"), ODBCERR("HY011", "Operation invalid at this time"), ODBCERR("HY012", "Invalid transaction code"), ODBCERR("HY013", "Unexpected memory handling error"), ODBCERR("HY014", "No more handles"), ODBCERR("HY016", "Cannot modify an implementation row descriptor"), ODBCERR("HY017", "Invalid use of an automatically allocated descriptor handle"), ODBCERR("HY018", "Server declined cancel request"), ODBCERR("HY021", "Inconsistent descriptor information"), ODBCERR("HY024", "Invalid attribute value"), ODBCERR("HY090", "Invalid string or buffer length"), ODBCERR("HY091", "Descriptor type out of range"), ODBCERR("HY092", "Invalid option"), ODBCERR("HY093", "Invalid parameter number"), ODBCERR("HY094", "Invalid scale value"), ODBCERR("HY096", "Information type out of range"), ODBCERR("HY097", "Column type out of range"), ODBCERR("HY098", "Scope type out of range"), ODBCERR("HY099", "Nullable type out of range"), ODBCERR("HY100", "Uniqueness option type out of range"), ODBCERR("HY101", "Accuracy option type out of range"), ODBCERR("HY103", "Direction option out of range"), ODBCERR("HY104", "Invalid precision value"), ODBCERR("HY105", "Invalid parameter type"), ODBCERR("HY106", "Fetch type out of range"), ODBCERR("HY107", "Row value out of range"), ODBCERR("HY108", "Concurrency option out of range"), ODBCERR("HY109", "Invalid cursor position"), ODBCERR("HY110", "Invalid driver completion"), ODBCERR("HY111", "Invalid bookmark value"), ODBCERR("HY501", "Invalid data source name"), ODBCERR("HY503", "Invalid file name length"), ODBCERR("HY506", "Error closing a file"), ODBCERR("HY509", "Error deleting a file"), ODBCERR("HYC00", "Driver not capable"), ODBCERR("HYT00", "Timeout expired"), ODBCERR("HYT01", "Connection timeout expired"), ODBCERR("S0001", "Database object already exists"), ODBCERR("S0002", "Database object does not exist"), ODBCERR("S0011", "Index already exists"), ODBCERR("S0012", "Index not found"), ODBCERR("S0021", "Column already exists"), ODBCERR("S0022", "Column not found"), ODBCERR("", NULL) }; #undef ODBCERR struct s_v3to2map { char v3[6]; char v2[6]; }; /* Map a v3 SQLSTATE to a v2 */ static const struct s_v3to2map v3to2map[] = { {"01001", "01S03"}, {"01001", "01S04"}, {"HY019", "22003"}, {"22007", "22008"}, {"22018", "22005"}, {"07005", "24000"}, {"42000", "37000"}, {"HY018", "70100"}, {"42S01", "S0001"}, {"42S02", "S0002"}, {"42S11", "S0011"}, {"42S12", "S0012"}, {"42S21", "S0021"}, {"42S22", "S0022"}, {"42S23", "S0023"}, {"HY000", "S1000"}, {"HY001", "S1001"}, {"07009", "S1002"}, {"HY003", "S1003"}, {"HY004", "S1004"}, {"HY008", "S1008"}, {"HY009", "S1009"}, {"HY024", "S1009"}, {"HY007", "S1010"}, {"HY010", "S1010"}, {"HY011", "S1011"}, {"HY012", "S1012"}, {"HY090", "S1090"}, {"HY091", "S1091"}, {"HY092", "S1092"}, /* {"07009", "S1093"}, */ {"HY096", "S1096"}, {"HY097", "S1097"}, {"HY098", "S1098"}, {"HY099", "S1099"}, {"HY100", "S1100"}, {"HY101", "S1101"}, {"HY103", "S1103"}, {"HY104", "S1104"}, {"HY105", "S1105"}, {"HY106", "S1106"}, {"HY107", "S1107"}, {"HY108", "S1108"}, {"HY109", "S1109"}, {"HY110", "S1110"}, {"HY111", "S1111"}, {"HYC00", "S1C00"}, {"HYT00", "S1T00"}, {"08001", "S1000"}, {"IM007", "S1000"}, {"", ""} }; /* * ODBC messages must be sorted by importance * 1. Errors regarding the status of a transaction * 2. Other errors (level ordered) * 3. No-Data messages with a state class of 02 ?? * 4. Warning * 5. Informational */ static void rank_errors(struct _sql_errors *errs) { int settled, current, best; struct _sql_error swapbuf; char istrans; /* already ranked or nothing to rank */ if (errs->ranked != 0 || errs->num_errors <= 1) { errs->ranked = 1; return; } /* Find the highest of all unranked errors until there are none left */ for (settled = 0; settled < errs->num_errors; settled++) { best = settled; for (current = settled; current < errs->num_errors; current++) { /* always sort by rows */ if (errs->errs[best].row < errs->errs[current].row) continue; if (errs->errs[best].row > errs->errs[current].row) { best = current; continue; } istrans = 0; switch (errs->errs[current].native) { case 1205: case 1211: case 2625: case 3309: case 7112: case 266: case 277: case 611: case 628: case 3902: case 3903: case 3906: case 3908: case 6401: istrans = 1; break; } if (istrans == 0) { if (strcmp(errs->errs[current].state3,"25000") == 0) istrans = 1; else if (strcmp(errs->errs[current].state3,"S1012") == 0) istrans = 1; else if (strcmp(errs->errs[current].state3,"08007") == 0) istrans = 1; } /* Transaction errors are always best */ if (istrans == 1 && errs->errs[current].msgstate >= 10) { best = current; break; } /* Non-terminating comparisons only below this point */ if (errs->errs[current].msgstate > errs->errs[best].msgstate) best = current; } /* swap settled position with best */ if (best != settled) { swapbuf = errs->errs[settled]; errs->errs[settled] = errs->errs[best]; errs->errs[best] = swapbuf; } } errs->ranked = 1; } static const char * odbc_get_msg(const char *sqlstate) { const struct s_SqlMsgMap *pmap = SqlMsgMap; /* TODO set flag and use pointers (no strdup) ?? */ while (pmap->msg) { if (!strcasecmp(sqlstate, pmap->sqlstate)) { return strdup(pmap->msg); } ++pmap; } return strdup(""); } static void odbc_get_v2state(const char *sqlstate, char *dest_state) { const struct s_v3to2map *pmap = v3to2map; while (pmap->v3[0]) { if (!strcasecmp(pmap->v3, sqlstate)) { strlcpy(dest_state, pmap->v2, 6); return; } ++pmap; } /* return the original if a v2 state is not found */ strlcpy(dest_state, sqlstate, 6); } void odbc_errs_reset(struct _sql_errors *errs) { int i; if (errs->errs) { for (i = 0; i < errs->num_errors; ++i) { /* TODO see flags */ free((char *) errs->errs[i].msg); free(errs->errs[i].server); } TDS_ZERO_FREE(errs->errs); errs->num_errors = 0; } errs->lastrc = SQL_SUCCESS; errs->ranked = 0; assert(errs->num_errors == 0); } /** Remove first element */ static void odbc_errs_pop(struct _sql_errors *errs) { if (!errs || !errs->errs || errs->num_errors <= 0) return; if (errs->num_errors == 1) { odbc_errs_reset(errs); return; } /* TODO see flags */ free((char *) errs->errs[0].msg); free(errs->errs[0].server); --errs->num_errors; memmove(&(errs->errs[0]), &(errs->errs[1]), errs->num_errors * sizeof(errs->errs[0])); } void odbc_errs_add(struct _sql_errors *errs, const char *sqlstate, const char *msg) { int n; assert(sqlstate); if (!errs) return; n = errs->num_errors; if (!TDS_RESIZE(errs->errs, n + 1)) { errs->lastrc = SQL_ERROR; return; } memset(&errs->errs[n], 0, sizeof(struct _sql_error)); errs->errs[n].native = 0; strlcpy(errs->errs[n].state3, sqlstate, 6); odbc_get_v2state(errs->errs[n].state3, errs->errs[n].state2); /* TODO why driver ?? -- freddy77 */ errs->errs[n].server = strdup("DRIVER"); errs->errs[n].msg = msg ? strdup(msg) : odbc_get_msg(errs->errs[n].state3); ++errs->num_errors; /* updated last error */ if (!strcmp(sqlstate, "01004") || !strcmp(sqlstate, "01S02")) { if (errs->lastrc != SQL_ERROR) errs->lastrc = SQL_SUCCESS_WITH_INFO; } else { errs->lastrc = SQL_ERROR; } tdsdump_log(TDS_DBG_FUNC, "odbc_errs_add: \"%s\"\n", errs->errs[n].msg); } /* TODO check if TDS_UINT is correct for native error */ void odbc_errs_add_rdbms(struct _sql_errors *errs, TDS_UINT native, const char *sqlstate, const char *msg, int linenum, int msgstate, const char *server, int row) { int n = errs->num_errors; if (!TDS_RESIZE(errs->errs, n + 1)) return; memset(&errs->errs[n], 0, sizeof(struct _sql_error)); errs->errs[n].row = row; errs->errs[n].native = native; if (sqlstate) strlcpy(errs->errs[n].state2, sqlstate, 6); else errs->errs[n].state2[0] = '\0'; strcpy(errs->errs[n].state3, errs->errs[n].state2); sqlstate2to3(errs->errs[n].state3); /* TODO why driver ?? -- freddy77 */ errs->errs[n].server = (server) ? strdup(server) : strdup("DRIVER"); errs->errs[n].msg = msg ? strdup(msg) : odbc_get_msg(errs->errs[n].state3); errs->errs[n].linenum = linenum; errs->errs[n].msgstate = msgstate; ++errs->num_errors; } #define SQLS_MAP(v2,v3) if (strcmp(p,v2) == 0) {strcpy(p,v3); return;} static void sqlstate2to3(char *state) { char *p = state; if (p[0] == 'S' && p[1] == '0' && p[2] == '0') { p[0] = '4'; p[1] = '2'; p[2] = 'S'; return; } /* TODO optimize with a switch */ SQLS_MAP("01S03", "01001"); SQLS_MAP("01S04", "01001"); SQLS_MAP("22003", "HY019"); SQLS_MAP("22008", "22007"); SQLS_MAP("22005", "22018"); SQLS_MAP("24000", "07005"); SQLS_MAP("37000", "42000"); SQLS_MAP("70100", "HY018"); SQLS_MAP("S1000", "HY000"); SQLS_MAP("S1001", "HY001"); SQLS_MAP("S1002", "07009"); SQLS_MAP("S1003", "HY003"); SQLS_MAP("S1004", "HY004"); SQLS_MAP("S1008", "HY008"); SQLS_MAP("S1009", "HY009"); SQLS_MAP("S1010", "HY007"); SQLS_MAP("S1011", "HY011"); SQLS_MAP("S1012", "HY012"); SQLS_MAP("S1090", "HY090"); SQLS_MAP("S1091", "HY091"); SQLS_MAP("S1092", "HY092"); SQLS_MAP("S1093", "07009"); SQLS_MAP("S1096", "HY096"); SQLS_MAP("S1097", "HY097"); SQLS_MAP("S1098", "HY098"); SQLS_MAP("S1099", "HY099"); SQLS_MAP("S1100", "HY100"); SQLS_MAP("S1101", "HY101"); SQLS_MAP("S1103", "HY103"); SQLS_MAP("S1104", "HY104"); SQLS_MAP("S1105", "HY105"); SQLS_MAP("S1106", "HY106"); SQLS_MAP("S1107", "HY107"); SQLS_MAP("S1108", "HY108"); SQLS_MAP("S1109", "HY109"); SQLS_MAP("S1110", "HY110"); SQLS_MAP("S1111", "HY111"); SQLS_MAP("S1C00", "HYC00"); SQLS_MAP("S1T00", "HYT00"); } ODBC_FUNC(SQLGetDiagRec, (P(SQLSMALLINT,handleType), P(SQLHANDLE,handle), P(SQLSMALLINT,numRecord), PCHAR(szSqlState), P(SQLINTEGER FAR *,pfNativeError), PCHAROUT(ErrorMsg,SQLSMALLINT) WIDE)) { SQLRETURN result; struct _sql_errors *errs; const char *msg; char *p; TDS_DBC *dbc = NULL; static const char msgprefix[] = "[FreeTDS][SQL Server]"; SQLINTEGER odbc_ver = SQL_OV_ODBC2; if (numRecord <= 0 || cbErrorMsgMax < 0) return SQL_ERROR; if (!handle || ((TDS_CHK *) handle)->htype != handleType) return SQL_INVALID_HANDLE; errs = &((TDS_CHK *) handle)->errs; switch (handleType) { case SQL_HANDLE_STMT: dbc = ((TDS_STMT *) handle)->dbc; odbc_ver = dbc->env->attr.odbc_version; break; case SQL_HANDLE_DBC: dbc = (TDS_DBC *) handle; odbc_ver = dbc->env->attr.odbc_version; break; case SQL_HANDLE_ENV: odbc_ver = ((TDS_ENV *) handle)->attr.odbc_version; break; case SQL_HANDLE_DESC: dbc = desc_get_dbc((TDS_DESC *) handle); odbc_ver = dbc->env->attr.odbc_version; break; default: return SQL_INVALID_HANDLE; } if (numRecord > errs->num_errors) return SQL_NO_DATA_FOUND; --numRecord; rank_errors(errs); if (szSqlState) { const char *state = (odbc_ver == SQL_OV_ODBC3) ? errs->errs[numRecord].state3 : errs->errs[numRecord].state2; odbc_set_string(dbc, szSqlState, 24, (SQLSMALLINT *) NULL, state, -1); } msg = errs->errs[numRecord].msg; if (asprintf(&p, "%s%s", msgprefix, msg) < 0) return SQL_ERROR; tdsdump_log(TDS_DBG_FUNC, "SQLGetDiagRec: \"%s\"\n", p); result = odbc_set_string(dbc, szErrorMsg, cbErrorMsgMax, pcbErrorMsg, p, -1); free(p); if (pfNativeError) *pfNativeError = errs->errs[numRecord].native; return result; } ODBC_FUNC(SQLError, (P(SQLHENV,henv), P(SQLHDBC,hdbc), P(SQLHSTMT,hstmt), PCHAR(szSqlState), P(SQLINTEGER FAR *,pfNativeError), PCHAROUT(ErrorMsg,SQLSMALLINT) WIDE)) { SQLRETURN result; SQLSMALLINT type; SQLHANDLE handle; if (hstmt) { handle = hstmt; type = SQL_HANDLE_STMT; } else if (hdbc) { handle = hdbc; type = SQL_HANDLE_DBC; } else if (henv) { handle = henv; type = SQL_HANDLE_ENV; } else return SQL_INVALID_HANDLE; result = _SQLGetDiagRec(type, handle, 1, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg _wide); if (result == SQL_SUCCESS) { /* remove first error */ odbc_errs_pop(&((TDS_CHK *) handle)->errs); } return result; } ODBC_FUNC(SQLGetDiagField, (P(SQLSMALLINT,handleType), P(SQLHANDLE,handle), P(SQLSMALLINT,numRecord), P(SQLSMALLINT,diagIdentifier), P(SQLPOINTER,buffer), P(SQLSMALLINT,cbBuffer), P(SQLSMALLINT FAR *,pcbBuffer) WIDE)) { SQLRETURN result = SQL_SUCCESS; struct _sql_errors *errs; const char *msg; SQLINTEGER odbc_ver = SQL_OV_ODBC2; int cplen; TDS_STMT *stmt = NULL; TDS_DBC *dbc = NULL; TDS_ENV *env = NULL; char tmp[16]; if (cbBuffer < 0) return SQL_ERROR; if (!handle || ((TDS_CHK *) handle)->htype != handleType) return SQL_INVALID_HANDLE; switch (handleType) { case SQL_HANDLE_STMT: stmt = ((TDS_STMT *) handle); dbc = stmt->dbc; env = dbc->env; break; case SQL_HANDLE_DBC: dbc = ((TDS_DBC *) handle); env = dbc->env; break; case SQL_HANDLE_ENV: env = ((TDS_ENV *) handle); break; case SQL_HANDLE_DESC: dbc = desc_get_dbc((TDS_DESC *) handle); env = dbc->env; break; default: return SQL_INVALID_HANDLE; } errs = &((TDS_CHK *) handle)->errs; odbc_ver = env->attr.odbc_version; /* header (numRecord ignored) */ switch (diagIdentifier) { case SQL_DIAG_DYNAMIC_FUNCTION: if (handleType != SQL_HANDLE_STMT) return SQL_ERROR; /* TODO */ return odbc_set_string_oct(dbc, buffer, cbBuffer, pcbBuffer, "", 0); case SQL_DIAG_DYNAMIC_FUNCTION_CODE: *(SQLINTEGER *) buffer = 0; return SQL_SUCCESS; case SQL_DIAG_NUMBER: *(SQLINTEGER *) buffer = errs->num_errors; return SQL_SUCCESS; case SQL_DIAG_RETURNCODE: *(SQLRETURN *) buffer = errs->lastrc; return SQL_SUCCESS; case SQL_DIAG_CURSOR_ROW_COUNT: if (handleType != SQL_HANDLE_STMT) return SQL_ERROR; /* TODO */ *(SQLINTEGER *) buffer = 0; return SQL_SUCCESS; case SQL_DIAG_ROW_COUNT: if (handleType != SQL_HANDLE_STMT) return SQL_ERROR; return _SQLRowCount((SQLHSTMT) handle, (SQLLEN FAR *) buffer); } if (numRecord > errs->num_errors) return SQL_NO_DATA_FOUND; if (numRecord <= 0) return SQL_ERROR; --numRecord; switch (diagIdentifier) { case SQL_DIAG_ROW_NUMBER: *(SQLINTEGER *) buffer = errs->errs[numRecord].row > 0 ? errs->errs[numRecord].row : SQL_ROW_NUMBER_UNKNOWN; break; case SQL_DIAG_CLASS_ORIGIN: case SQL_DIAG_SUBCLASS_ORIGIN: if (odbc_ver == SQL_OV_ODBC2) result = odbc_set_string_oct(dbc, buffer, cbBuffer, pcbBuffer, "ISO 9075", -1); else result = odbc_set_string_oct(dbc, buffer, cbBuffer, pcbBuffer, "ODBC 3.0", -1); break; case SQL_DIAG_COLUMN_NUMBER: *(SQLINTEGER *) buffer = SQL_COLUMN_NUMBER_UNKNOWN; break; case SQL_DIAG_SS_MSGSTATE: if (errs->errs[numRecord].msgstate == 0) return SQL_ERROR; else *(SQLINTEGER *) buffer = errs->errs[numRecord].msgstate; break; case SQL_DIAG_SS_LINE: if (errs->errs[numRecord].linenum == 0) return SQL_ERROR; else *(SQLUSMALLINT *) buffer = errs->errs[numRecord].linenum; break; case SQL_DIAG_CONNECTION_NAME: if (dbc && dbc->tds_socket && dbc->tds_socket->conn->spid > 0) cplen = sprintf(tmp, "%d", dbc->tds_socket->conn->spid); else cplen = 0; result = odbc_set_string_oct(dbc, buffer, cbBuffer, pcbBuffer, tmp, cplen); break; case SQL_DIAG_MESSAGE_TEXT: msg = errs->errs[numRecord].msg; result = odbc_set_string_oct(dbc, buffer, cbBuffer, pcbBuffer, msg, -1); break; case SQL_DIAG_NATIVE: *(SQLINTEGER *) buffer = errs->errs[numRecord].native; break; case SQL_DIAG_SERVER_NAME: msg = NULL; switch (handleType) { case SQL_HANDLE_ENV: break; case SQL_HANDLE_DBC: if (dbc->tds_socket) msg = dbc->tds_socket->conn->server; break; case SQL_HANDLE_STMT: if (stmt->dbc->tds_socket) msg = stmt->dbc->tds_socket->conn->server; /* * if dbc->server is not initialized, init it * from the errs structure */ if (!msg && errs->errs[numRecord].server) { msg = errs->errs[numRecord].server; } break; } result = odbc_set_string_oct(dbc, buffer, cbBuffer, pcbBuffer, msg ? msg : "", -1); break; case SQL_DIAG_SQLSTATE: if (odbc_ver == SQL_OV_ODBC3) msg = errs->errs[numRecord].state3; else msg = errs->errs[numRecord].state2; result = odbc_set_string_oct(dbc, buffer, cbBuffer, pcbBuffer, msg, 5); break; default: return SQL_ERROR; } return result; } #include "error_export.h" freetds-1.3.6/src/odbc/odbc_checks.c000644 025423 025423 00000007404 14056414221 020700 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2003-2008 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #if ENABLE_EXTRA_CHECKS void odbc_check_env_extra(TDS_ENV * env) { assert(env && env->htype == SQL_HANDLE_ENV); assert(env->attr.odbc_version == SQL_OV_ODBC3 || env->attr.odbc_version == SQL_OV_ODBC2); } void odbc_check_dbc_extra(TDS_DBC * dbc) { assert(dbc && dbc->htype == SQL_HANDLE_DBC); } void odbc_check_stmt_extra(TDS_STMT * stmt) { assert(stmt && stmt->htype == SQL_HANDLE_STMT); /* TODO deep check on connection */ assert(stmt->dbc); odbc_check_desc_extra(stmt->ard); odbc_check_desc_extra(stmt->ird); odbc_check_desc_extra(stmt->apd); odbc_check_desc_extra(stmt->ipd); assert(!stmt->prepared_query_is_func || stmt->prepared_query_is_rpc); assert(stmt->param_num <= stmt->param_count + 1); assert(stmt->num_param_rows >= 1); assert(stmt->curr_param_row >= 0); assert(stmt->curr_param_row <= stmt->num_param_rows); if (stmt->prepared_query_is_rpc) { assert(stmt->prepared_pos == 0 || stmt->prepared_pos <= tds_dstr_len(&stmt->query)); } else { assert(stmt->prepared_pos == 0); } /* TODO assert dbc has this statement in list */ } static void odbc_check_drecord(TDS_DESC * desc, struct _drecord *drec) { assert(drec->sql_desc_concise_type != SQL_INTERVAL && drec->sql_desc_concise_type != SQL_DATETIME); /* unbound columns have type == 0 */ /* TODO test errors on code if type == 0 */ if (desc->type == DESC_IPD || desc->type == DESC_IRD) { assert((drec->sql_desc_type == 0 && drec->sql_desc_concise_type == 0) || odbc_get_concise_sql_type(drec->sql_desc_type, drec->sql_desc_datetime_interval_code) == drec->sql_desc_concise_type); } else { assert((drec->sql_desc_type == 0 && drec->sql_desc_concise_type == 0) || odbc_get_concise_c_type(drec->sql_desc_type, drec->sql_desc_datetime_interval_code) == drec->sql_desc_concise_type); } } void odbc_check_desc_extra(TDS_DESC * desc) { int i; assert(desc && desc->htype == SQL_HANDLE_DESC); assert(desc->header.sql_desc_alloc_type == SQL_DESC_ALLOC_AUTO || desc->header.sql_desc_alloc_type == SQL_DESC_ALLOC_USER); assert((desc->type != DESC_IPD && desc->type != DESC_IRD) || desc->header.sql_desc_alloc_type == SQL_DESC_ALLOC_AUTO); for (i = 0; i < desc->header.sql_desc_count; ++i) { odbc_check_drecord(desc, &desc->records[i]); } } void odbc_check_struct_extra(void *p) { const int invalid_htype = 0; switch (((TDS_CHK *) p)->htype) { case SQL_HANDLE_ENV: odbc_check_env_extra((TDS_ENV *) p); break; case SQL_HANDLE_DBC: odbc_check_dbc_extra((TDS_DBC *) p); break; case SQL_HANDLE_STMT: odbc_check_stmt_extra((TDS_STMT *) p); break; case SQL_HANDLE_DESC: odbc_check_desc_extra((TDS_DESC *) p); break; default: assert(invalid_htype); } } #endif /* ENABLE_EXTRA_CHECKS */ freetds-1.3.6/src/odbc/sqlwchar.c000644 025423 025423 00000005267 14056414221 020302 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #include #include #if SIZEOF_SQLWCHAR != SIZEOF_WCHAR_T size_t sqlwcslen(const SQLWCHAR * s) { const SQLWCHAR *p = s; while (*p) ++p; return p - s; } #ifdef ENABLE_ODBC_WIDE /** * Convert a SQLWCHAR string into a wchar_t * Used only for debugging purpose * \param str string to convert * \param bufs linked list of buffer * \return string converted */ const wchar_t *sqlwstr(const SQLWCHAR *str, SQLWSTRBUF **bufs) { wchar_t *dst, *dst_end; const SQLWCHAR *src = str; SQLWSTRBUF *buf; if (!str) return NULL; /* allocate buffer for string, we do not care for memory errors */ buf = tds_new0(SQLWSTRBUF, 1); if (!buf) return NULL; buf->next = *bufs; *bufs = buf; dst = buf->buf; dst_end = dst + (TDS_VECTOR_SIZE(buf->buf) - 1); for (; *src && dst < dst_end; *dst++ = *src++) continue; *dst = L'\0'; return buf->buf; } void sqlwstr_free(SQLWSTRBUF *bufs) { while (bufs) { SQLWSTRBUF *buf = bufs; bufs = buf->next; free(buf); } } #endif #endif #if SIZEOF_SQLWCHAR == 2 # if WORDS_BIGENDIAN # define ODBC_WIDE_CANONIC TDS_CHARSET_UCS_2BE # define ODBC_WIDE_CANONIC_UTF TDS_CHARSET_UTF_16BE # else # define ODBC_WIDE_CANONIC TDS_CHARSET_UCS_2LE # define ODBC_WIDE_CANONIC_UTF TDS_CHARSET_UTF_16LE # endif #elif SIZEOF_SQLWCHAR == 4 # if WORDS_BIGENDIAN # define ODBC_WIDE_CANONIC TDS_CHARSET_UCS_4BE # else # define ODBC_WIDE_CANONIC TDS_CHARSET_UCS_4LE # endif #else #error SIZEOF_SQLWCHAR not supported !! #endif int odbc_get_wide_canonic(TDSCONNECTION *conn) { #if SIZEOF_SQLWCHAR == 2 if (conn->char_convs[client2ucs2]->to.charset.canonic == TDS_CHARSET_UTF_16LE) return ODBC_WIDE_CANONIC_UTF; #endif return ODBC_WIDE_CANONIC; } freetds-1.3.6/src/odbc/sqlwparams.h000644 025423 025423 00000000763 14056414221 020651 0ustar00fredianofrediano000000 000000 #if 0 # ODBC_FUNC(SQLTest, (P(SQLSMALLINT, x), PCHAR(y) WIDE)) #endif #undef WIDE #undef P #undef PCHAR #undef PCHARIN #undef PCHAROUT #ifdef ENABLE_ODBC_WIDE # define WIDE , int wide # define PCHAR(a) ODBC_CHAR* a #else # define WIDE # define PCHAR(a) SQLCHAR* a #endif #define P(a,b) a b #define PCHARIN(n,t) PCHAR(sz ## n), P(t, cb ## n) #define PCHAROUT(n,t) PCHAR(sz ## n), P(t, cb ## n ## Max), P(t FAR*, pcb ## n) #define ODBC_FUNC(name, params) \ static SQLRETURN _ ## name params freetds-1.3.6/src/odbc/odbc_export.h000644 025423 025423 00000113075 14162303405 020767 0ustar00fredianofrediano000000 000000 #undef tdsdump_log #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd, ODBC_CHAR * szConnStrIn, SQLSMALLINT cbConnStrIn, ODBC_CHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut, SQLUSMALLINT fDriverCompletion, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLDriverConnectW( SQLHDBC hdbc, SQLHWND hwnd, SQLWCHAR * szConnStrIn, SQLSMALLINT cbConnStrIn, SQLWCHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut, SQLUSMALLINT fDriverCompletion) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(1); tdsdump_log(TDS_DBG_FUNC, "SQLDriverConnectW(%p, %p, %ls, %d, %p, %d, %p, %u)\n", hdbc, hwnd, SQLWSTR(szConnStrIn), (int) cbConnStrIn, szConnStrOut, (int) cbConnStrOutMax, pcbConnStrOut, (unsigned int) fDriverCompletion); SQLWSTR_FREE(); } return _SQLDriverConnect(hdbc, hwnd, (ODBC_CHAR*) szConnStrIn, cbConnStrIn, (ODBC_CHAR*) szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLDriverConnect( SQLHDBC hdbc, SQLHWND hwnd, SQLCHAR * szConnStrIn, SQLSMALLINT cbConnStrIn, SQLCHAR * szConnStrOut, SQLSMALLINT cbConnStrOutMax, SQLSMALLINT FAR* pcbConnStrOut, SQLUSMALLINT fDriverCompletion) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDriverConnect(%p, %p, %s, %d, %p, %d, %p, %u)\n", hdbc, hwnd, (const char*) szConnStrIn, (int) cbConnStrIn, szConnStrOut, (int) cbConnStrOutMax, pcbConnStrOut, (unsigned int) fDriverCompletion); #ifdef ENABLE_ODBC_WIDE return _SQLDriverConnect(hdbc, hwnd, (ODBC_CHAR*) szConnStrIn, cbConnStrIn, (ODBC_CHAR*) szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion, 0); #else return _SQLDriverConnect(hdbc, hwnd, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLColumnPrivileges(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnPrivilegesW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szTableName, SQLSMALLINT cbTableName, SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(4); tdsdump_log(TDS_DBG_FUNC, "SQLColumnPrivilegesW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szTableName), (int) cbTableName, SQLWSTR(szColumnName), (int) cbColumnName); SQLWSTR_FREE(); } return _SQLColumnPrivileges(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, (ODBC_CHAR*) szColumnName, cbColumnName, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnPrivileges( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szTableName, SQLSMALLINT cbTableName, SQLCHAR * szColumnName, SQLSMALLINT cbColumnName) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLColumnPrivileges(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szTableName, (int) cbTableName, (const char*) szColumnName, (int) cbColumnName); #ifdef ENABLE_ODBC_WIDE return _SQLColumnPrivileges(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, (ODBC_CHAR*) szColumnName, cbColumnName, 0); #else return _SQLColumnPrivileges(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, szColumnName, cbColumnName); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLForeignKeys(SQLHSTMT hstmt, ODBC_CHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName, ODBC_CHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName, ODBC_CHAR * szPkTableName, SQLSMALLINT cbPkTableName, ODBC_CHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName, ODBC_CHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName, ODBC_CHAR * szFkTableName, SQLSMALLINT cbFkTableName, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLForeignKeysW( SQLHSTMT hstmt, SQLWCHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName, SQLWCHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLWCHAR * szPkTableName, SQLSMALLINT cbPkTableName, SQLWCHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName, SQLWCHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName, SQLWCHAR * szFkTableName, SQLSMALLINT cbFkTableName) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(6); tdsdump_log(TDS_DBG_FUNC, "SQLForeignKeysW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szPkCatalogName), (int) cbPkCatalogName, SQLWSTR(szPkSchemaName), (int) cbPkSchemaName, SQLWSTR(szPkTableName), (int) cbPkTableName, SQLWSTR(szFkCatalogName), (int) cbFkCatalogName, SQLWSTR(szFkSchemaName), (int) cbFkSchemaName, SQLWSTR(szFkTableName), (int) cbFkTableName); SQLWSTR_FREE(); } return _SQLForeignKeys(hstmt, (ODBC_CHAR*) szPkCatalogName, cbPkCatalogName, (ODBC_CHAR*) szPkSchemaName, cbPkSchemaName, (ODBC_CHAR*) szPkTableName, cbPkTableName, (ODBC_CHAR*) szFkCatalogName, cbFkCatalogName, (ODBC_CHAR*) szFkSchemaName, cbFkSchemaName, (ODBC_CHAR*) szFkTableName, cbFkTableName, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLForeignKeys( SQLHSTMT hstmt, SQLCHAR * szPkCatalogName, SQLSMALLINT cbPkCatalogName, SQLCHAR * szPkSchemaName, SQLSMALLINT cbPkSchemaName, SQLCHAR * szPkTableName, SQLSMALLINT cbPkTableName, SQLCHAR * szFkCatalogName, SQLSMALLINT cbFkCatalogName, SQLCHAR * szFkSchemaName, SQLSMALLINT cbFkSchemaName, SQLCHAR * szFkTableName, SQLSMALLINT cbFkTableName) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLForeignKeys(%p, %s, %d, %s, %d, %s, %d, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szPkCatalogName, (int) cbPkCatalogName, (const char*) szPkSchemaName, (int) cbPkSchemaName, (const char*) szPkTableName, (int) cbPkTableName, (const char*) szFkCatalogName, (int) cbFkCatalogName, (const char*) szFkSchemaName, (int) cbFkSchemaName, (const char*) szFkTableName, (int) cbFkTableName); #ifdef ENABLE_ODBC_WIDE return _SQLForeignKeys(hstmt, (ODBC_CHAR*) szPkCatalogName, cbPkCatalogName, (ODBC_CHAR*) szPkSchemaName, cbPkSchemaName, (ODBC_CHAR*) szPkTableName, cbPkTableName, (ODBC_CHAR*) szFkCatalogName, cbFkCatalogName, (ODBC_CHAR*) szFkSchemaName, cbFkSchemaName, (ODBC_CHAR*) szFkTableName, cbFkTableName, 0); #else return _SQLForeignKeys(hstmt, szPkCatalogName, cbPkCatalogName, szPkSchemaName, cbPkSchemaName, szPkTableName, cbPkTableName, szFkCatalogName, cbFkCatalogName, szFkSchemaName, cbFkSchemaName, szFkTableName, cbFkTableName); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLNativeSql(SQLHDBC hdbc, ODBC_CHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn, ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLNativeSqlW( SQLHDBC hdbc, SQLWCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(1); tdsdump_log(TDS_DBG_FUNC, "SQLNativeSqlW(%p, %ls, %d, %p, %d, %p)\n", hdbc, SQLWSTR(szSqlStrIn), (int) cbSqlStrIn, szSqlStr, (int) cbSqlStrMax, pcbSqlStr); SQLWSTR_FREE(); } return _SQLNativeSql(hdbc, (ODBC_CHAR*) szSqlStrIn, cbSqlStrIn, (ODBC_CHAR*) szSqlStr, cbSqlStrMax, pcbSqlStr, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLNativeSql( SQLHDBC hdbc, SQLCHAR * szSqlStrIn, SQLINTEGER cbSqlStrIn, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStrMax, SQLINTEGER FAR* pcbSqlStr) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLNativeSql(%p, %s, %d, %p, %d, %p)\n", hdbc, (const char*) szSqlStrIn, (int) cbSqlStrIn, szSqlStr, (int) cbSqlStrMax, pcbSqlStr); #ifdef ENABLE_ODBC_WIDE return _SQLNativeSql(hdbc, (ODBC_CHAR*) szSqlStrIn, cbSqlStrIn, (ODBC_CHAR*) szSqlStr, cbSqlStrMax, pcbSqlStr, 0); #else return _SQLNativeSql(hdbc, szSqlStrIn, cbSqlStrIn, szSqlStr, cbSqlStrMax, pcbSqlStr); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLPrimaryKeys(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLPrimaryKeysW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szTableName, SQLSMALLINT cbTableName) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(3); tdsdump_log(TDS_DBG_FUNC, "SQLPrimaryKeysW(%p, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szTableName), (int) cbTableName); SQLWSTR_FREE(); } return _SQLPrimaryKeys(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLPrimaryKeys( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szTableName, SQLSMALLINT cbTableName) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLPrimaryKeys(%p, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szTableName, (int) cbTableName); #ifdef ENABLE_ODBC_WIDE return _SQLPrimaryKeys(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, 0); #else return _SQLPrimaryKeys(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLProcedureColumns(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szProcName, SQLSMALLINT cbProcName, ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedureColumnsW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szProcName, SQLSMALLINT cbProcName, SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(4); tdsdump_log(TDS_DBG_FUNC, "SQLProcedureColumnsW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szProcName), (int) cbProcName, SQLWSTR(szColumnName), (int) cbColumnName); SQLWSTR_FREE(); } return _SQLProcedureColumns(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szProcName, cbProcName, (ODBC_CHAR*) szColumnName, cbColumnName, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedureColumns( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szProcName, SQLSMALLINT cbProcName, SQLCHAR * szColumnName, SQLSMALLINT cbColumnName) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLProcedureColumns(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szProcName, (int) cbProcName, (const char*) szColumnName, (int) cbColumnName); #ifdef ENABLE_ODBC_WIDE return _SQLProcedureColumns(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szProcName, cbProcName, (ODBC_CHAR*) szColumnName, cbColumnName, 0); #else return _SQLProcedureColumns(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName, szColumnName, cbColumnName); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLProcedures(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szProcName, SQLSMALLINT cbProcName, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLProceduresW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szProcName, SQLSMALLINT cbProcName) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(3); tdsdump_log(TDS_DBG_FUNC, "SQLProceduresW(%p, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szProcName), (int) cbProcName); SQLWSTR_FREE(); } return _SQLProcedures(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szProcName, cbProcName, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLProcedures( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szProcName, SQLSMALLINT cbProcName) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLProcedures(%p, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szProcName, (int) cbProcName); #ifdef ENABLE_ODBC_WIDE return _SQLProcedures(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szProcName, cbProcName, 0); #else return _SQLProcedures(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szProcName, cbProcName); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLTablePrivileges(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLTablePrivilegesW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szTableName, SQLSMALLINT cbTableName) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(3); tdsdump_log(TDS_DBG_FUNC, "SQLTablePrivilegesW(%p, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szTableName), (int) cbTableName); SQLWSTR_FREE(); } return _SQLTablePrivileges(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLTablePrivileges( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szTableName, SQLSMALLINT cbTableName) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLTablePrivileges(%p, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szTableName, (int) cbTableName); #ifdef ENABLE_ODBC_WIDE return _SQLTablePrivileges(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, 0); #else return _SQLTablePrivileges(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLConnect(SQLHDBC hdbc, ODBC_CHAR * szDSN, SQLSMALLINT cbDSN, ODBC_CHAR * szUID, SQLSMALLINT cbUID, ODBC_CHAR * szAuthStr, SQLSMALLINT cbAuthStr, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLConnectW( SQLHDBC hdbc, SQLWCHAR * szDSN, SQLSMALLINT cbDSN, SQLWCHAR * szUID, SQLSMALLINT cbUID, SQLWCHAR * szAuthStr, SQLSMALLINT cbAuthStr) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(3); tdsdump_log(TDS_DBG_FUNC, "SQLConnectW(%p, %ls, %d, %ls, %d, %ls, %d)\n", hdbc, SQLWSTR(szDSN), (int) cbDSN, SQLWSTR(szUID), (int) cbUID, SQLWSTR(szAuthStr), (int) cbAuthStr); SQLWSTR_FREE(); } return _SQLConnect(hdbc, (ODBC_CHAR*) szDSN, cbDSN, (ODBC_CHAR*) szUID, cbUID, (ODBC_CHAR*) szAuthStr, cbAuthStr, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLConnect( SQLHDBC hdbc, SQLCHAR * szDSN, SQLSMALLINT cbDSN, SQLCHAR * szUID, SQLSMALLINT cbUID, SQLCHAR * szAuthStr, SQLSMALLINT cbAuthStr) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLConnect(%p, %s, %d, %s, %d, %s, %d)\n", hdbc, (const char*) szDSN, (int) cbDSN, (const char*) szUID, (int) cbUID, (const char*) szAuthStr, (int) cbAuthStr); #ifdef ENABLE_ODBC_WIDE return _SQLConnect(hdbc, (ODBC_CHAR*) szDSN, cbDSN, (ODBC_CHAR*) szUID, cbUID, (ODBC_CHAR*) szAuthStr, cbAuthStr, 0); #else return _SQLConnect(hdbc, szDSN, cbDSN, szUID, cbUID, szAuthStr, cbAuthStr); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLDescribeCol(SQLHSTMT hstmt, SQLUSMALLINT icol, ODBC_CHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName, SQLSMALLINT * pfSqlType, SQLULEN * pcbColDef, SQLSMALLINT * pibScale, SQLSMALLINT * pfNullable, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLDescribeColW( SQLHSTMT hstmt, SQLUSMALLINT icol, SQLWCHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName, SQLSMALLINT * pfSqlType, SQLULEN * pcbColDef, SQLSMALLINT * pibScale, SQLSMALLINT * pfNullable) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDescribeColW(%p, %u, %p, %d, %p, %p, %p, %p, %p)\n", hstmt, (unsigned int) icol, szColName, (int) cbColNameMax, pcbColName, pfSqlType, pcbColDef, pibScale, pfNullable); return _SQLDescribeCol(hstmt, icol, (ODBC_CHAR*) szColName, cbColNameMax, pcbColName, pfSqlType, pcbColDef, pibScale, pfNullable, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLDescribeCol( SQLHSTMT hstmt, SQLUSMALLINT icol, SQLCHAR * szColName, SQLSMALLINT cbColNameMax, SQLSMALLINT FAR* pcbColName, SQLSMALLINT * pfSqlType, SQLULEN * pcbColDef, SQLSMALLINT * pibScale, SQLSMALLINT * pfNullable) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLDescribeCol(%p, %u, %p, %d, %p, %p, %p, %p, %p)\n", hstmt, (unsigned int) icol, szColName, (int) cbColNameMax, pcbColName, pfSqlType, pcbColDef, pibScale, pfNullable); #ifdef ENABLE_ODBC_WIDE return _SQLDescribeCol(hstmt, icol, (ODBC_CHAR*) szColName, cbColNameMax, pcbColName, pfSqlType, pcbColDef, pibScale, pfNullable, 0); #else return _SQLDescribeCol(hstmt, icol, szColName, cbColNameMax, pcbColName, pfSqlType, pcbColDef, pibScale, pfNullable); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLGetDescRec(SQLHDESC hdesc, SQLSMALLINT RecordNumber, ODBC_CHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName, SQLSMALLINT * Type, SQLSMALLINT * SubType, SQLLEN * Length, SQLSMALLINT * Precision, SQLSMALLINT * Scale, SQLSMALLINT * Nullable, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescRecW( SQLHDESC hdesc, SQLSMALLINT RecordNumber, SQLWCHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName, SQLSMALLINT * Type, SQLSMALLINT * SubType, SQLLEN * Length, SQLSMALLINT * Precision, SQLSMALLINT * Scale, SQLSMALLINT * Nullable) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescRecW(%p, %d, %p, %d, %p, %p, %p, %p, %p, %p, %p)\n", hdesc, (int) RecordNumber, szName, (int) cbNameMax, pcbName, Type, SubType, Length, Precision, Scale, Nullable); return _SQLGetDescRec(hdesc, RecordNumber, (ODBC_CHAR*) szName, cbNameMax, pcbName, Type, SubType, Length, Precision, Scale, Nullable, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescRec( SQLHDESC hdesc, SQLSMALLINT RecordNumber, SQLCHAR * szName, SQLSMALLINT cbNameMax, SQLSMALLINT FAR* pcbName, SQLSMALLINT * Type, SQLSMALLINT * SubType, SQLLEN * Length, SQLSMALLINT * Precision, SQLSMALLINT * Scale, SQLSMALLINT * Nullable) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescRec(%p, %d, %p, %d, %p, %p, %p, %p, %p, %p, %p)\n", hdesc, (int) RecordNumber, szName, (int) cbNameMax, pcbName, Type, SubType, Length, Precision, Scale, Nullable); #ifdef ENABLE_ODBC_WIDE return _SQLGetDescRec(hdesc, RecordNumber, (ODBC_CHAR*) szName, cbNameMax, pcbName, Type, SubType, Length, Precision, Scale, Nullable, 0); #else return _SQLGetDescRec(hdesc, RecordNumber, szName, cbNameMax, pcbName, Type, SubType, Length, Precision, Scale, Nullable); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLGetDescField(SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescFieldW( SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescFieldW(%p, %d, %d, %p, %d, %p)\n", hdesc, (int) icol, (int) fDescType, Value, (int) BufferLength, StringLength); return _SQLGetDescField(hdesc, icol, fDescType, Value, BufferLength, StringLength, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDescField( SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDescField(%p, %d, %d, %p, %d, %p)\n", hdesc, (int) icol, (int) fDescType, Value, (int) BufferLength, StringLength); #ifdef ENABLE_ODBC_WIDE return _SQLGetDescField(hdesc, icol, fDescType, Value, BufferLength, StringLength, 0); #else return _SQLGetDescField(hdesc, icol, fDescType, Value, BufferLength, StringLength); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLSetDescField(SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOINTER Value, SQLINTEGER BufferLength, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLSetDescFieldW( SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOINTER Value, SQLINTEGER BufferLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetDescFieldW(%p, %d, %d, %p, %d)\n", hdesc, (int) icol, (int) fDescType, Value, (int) BufferLength); return _SQLSetDescField(hdesc, icol, fDescType, Value, BufferLength, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLSetDescField( SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOINTER Value, SQLINTEGER BufferLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetDescField(%p, %d, %d, %p, %d)\n", hdesc, (int) icol, (int) fDescType, Value, (int) BufferLength); #ifdef ENABLE_ODBC_WIDE return _SQLSetDescField(hdesc, icol, fDescType, Value, BufferLength, 0); #else return _SQLSetDescField(hdesc, icol, fDescType, Value, BufferLength); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLExecDirect(SQLHSTMT hstmt, ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStr, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLExecDirectW( SQLHSTMT hstmt, SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStr) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(1); tdsdump_log(TDS_DBG_FUNC, "SQLExecDirectW(%p, %ls, %d)\n", hstmt, SQLWSTR(szSqlStr), (int) cbSqlStr); SQLWSTR_FREE(); } return _SQLExecDirect(hstmt, (ODBC_CHAR*) szSqlStr, cbSqlStr, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLExecDirect( SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLExecDirect(%p, %s, %d)\n", hstmt, (const char*) szSqlStr, (int) cbSqlStr); #ifdef ENABLE_ODBC_WIDE return _SQLExecDirect(hstmt, (ODBC_CHAR*) szSqlStr, cbSqlStr, 0); #else return _SQLExecDirect(hstmt, szSqlStr, cbSqlStr); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLPrepare(SQLHSTMT hstmt, ODBC_CHAR * szSqlStr, SQLINTEGER cbSqlStr, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLPrepareW( SQLHSTMT hstmt, SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStr) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(1); tdsdump_log(TDS_DBG_FUNC, "SQLPrepareW(%p, %ls, %d)\n", hstmt, SQLWSTR(szSqlStr), (int) cbSqlStr); SQLWSTR_FREE(); } return _SQLPrepare(hstmt, (ODBC_CHAR*) szSqlStr, cbSqlStr, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLPrepare( SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLPrepare(%p, %s, %d)\n", hstmt, (const char*) szSqlStr, (int) cbSqlStr); #ifdef ENABLE_ODBC_WIDE return _SQLPrepare(hstmt, (ODBC_CHAR*) szSqlStr, cbSqlStr, 0); #else return _SQLPrepare(hstmt, szSqlStr, cbSqlStr); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLSetCursorName(SQLHSTMT hstmt, ODBC_CHAR * szCursor, SQLSMALLINT cbCursor, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLSetCursorNameW( SQLHSTMT hstmt, SQLWCHAR * szCursor, SQLSMALLINT cbCursor) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(1); tdsdump_log(TDS_DBG_FUNC, "SQLSetCursorNameW(%p, %ls, %d)\n", hstmt, SQLWSTR(szCursor), (int) cbCursor); SQLWSTR_FREE(); } return _SQLSetCursorName(hstmt, (ODBC_CHAR*) szCursor, cbCursor, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLSetCursorName( SQLHSTMT hstmt, SQLCHAR * szCursor, SQLSMALLINT cbCursor) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetCursorName(%p, %s, %d)\n", hstmt, (const char*) szCursor, (int) cbCursor); #ifdef ENABLE_ODBC_WIDE return _SQLSetCursorName(hstmt, (ODBC_CHAR*) szCursor, cbCursor, 0); #else return _SQLSetCursorName(hstmt, szCursor, cbCursor); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLGetCursorName(SQLHSTMT hstmt, ODBC_CHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLGetCursorNameW( SQLHSTMT hstmt, SQLWCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetCursorNameW(%p, %p, %d, %p)\n", hstmt, szCursor, (int) cbCursorMax, pcbCursor); return _SQLGetCursorName(hstmt, (ODBC_CHAR*) szCursor, cbCursorMax, pcbCursor, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetCursorName( SQLHSTMT hstmt, SQLCHAR * szCursor, SQLSMALLINT cbCursorMax, SQLSMALLINT FAR* pcbCursor) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetCursorName(%p, %p, %d, %p)\n", hstmt, szCursor, (int) cbCursorMax, pcbCursor); #ifdef ENABLE_ODBC_WIDE return _SQLGetCursorName(hstmt, (ODBC_CHAR*) szCursor, cbCursorMax, pcbCursor, 0); #else return _SQLGetCursorName(hstmt, szCursor, cbCursorMax, pcbCursor); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLColumns(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, ODBC_CHAR * szColumnName, SQLSMALLINT cbColumnName, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLColumnsW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szTableName, SQLSMALLINT cbTableName, SQLWCHAR * szColumnName, SQLSMALLINT cbColumnName) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(4); tdsdump_log(TDS_DBG_FUNC, "SQLColumnsW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szTableName), (int) cbTableName, SQLWSTR(szColumnName), (int) cbColumnName); SQLWSTR_FREE(); } return _SQLColumns(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, (ODBC_CHAR*) szColumnName, cbColumnName, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLColumns( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szTableName, SQLSMALLINT cbTableName, SQLCHAR * szColumnName, SQLSMALLINT cbColumnName) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLColumns(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szTableName, (int) cbTableName, (const char*) szColumnName, (int) cbColumnName); #ifdef ENABLE_ODBC_WIDE return _SQLColumns(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, (ODBC_CHAR*) szColumnName, cbColumnName, 0); #else return _SQLColumns(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, szColumnName, cbColumnName); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLGetConnectAttr(SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectAttrW( SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetConnectAttrW(%p, %d, %p, %d, %p)\n", hdbc, (int) Attribute, Value, (int) BufferLength, StringLength); return _SQLGetConnectAttr(hdbc, Attribute, Value, BufferLength, StringLength, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetConnectAttr( SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER BufferLength, SQLINTEGER * StringLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetConnectAttr(%p, %d, %p, %d, %p)\n", hdbc, (int) Attribute, Value, (int) BufferLength, StringLength); #ifdef ENABLE_ODBC_WIDE return _SQLGetConnectAttr(hdbc, Attribute, Value, BufferLength, StringLength, 0); #else return _SQLGetConnectAttr(hdbc, Attribute, Value, BufferLength, StringLength); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLSetConnectAttr(SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectAttrW( SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetConnectAttrW(%p, %d, %p, %d)\n", hdbc, (int) Attribute, ValuePtr, (int) StringLength); return _SQLSetConnectAttr(hdbc, Attribute, ValuePtr, StringLength, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLSetConnectAttr( SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLINTEGER StringLength) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSetConnectAttr(%p, %d, %p, %d)\n", hdbc, (int) Attribute, ValuePtr, (int) StringLength); #ifdef ENABLE_ODBC_WIDE return _SQLSetConnectAttr(hdbc, Attribute, ValuePtr, StringLength, 0); #else return _SQLSetConnectAttr(hdbc, Attribute, ValuePtr, StringLength); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLSpecialColumns(SQLHSTMT hstmt, SQLUSMALLINT fColType, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, SQLUSMALLINT fScope, SQLUSMALLINT fNullable, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLSpecialColumnsW( SQLHSTMT hstmt, SQLUSMALLINT fColType, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szTableName, SQLSMALLINT cbTableName, SQLUSMALLINT fScope, SQLUSMALLINT fNullable) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(3); tdsdump_log(TDS_DBG_FUNC, "SQLSpecialColumnsW(%p, %u, %ls, %d, %ls, %d, %ls, %d, %u, %u)\n", hstmt, (unsigned int) fColType, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szTableName), (int) cbTableName, (unsigned int) fScope, (unsigned int) fNullable); SQLWSTR_FREE(); } return _SQLSpecialColumns(hstmt, fColType, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, fScope, fNullable, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLSpecialColumns( SQLHSTMT hstmt, SQLUSMALLINT fColType, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szTableName, SQLSMALLINT cbTableName, SQLUSMALLINT fScope, SQLUSMALLINT fNullable) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLSpecialColumns(%p, %u, %s, %d, %s, %d, %s, %d, %u, %u)\n", hstmt, (unsigned int) fColType, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szTableName, (int) cbTableName, (unsigned int) fScope, (unsigned int) fNullable); #ifdef ENABLE_ODBC_WIDE return _SQLSpecialColumns(hstmt, fColType, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, fScope, fNullable, 0); #else return _SQLSpecialColumns(hstmt, fColType, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fScope, fNullable); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLStatistics(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, SQLUSMALLINT fUnique, SQLUSMALLINT fAccuracy, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLStatisticsW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szTableName, SQLSMALLINT cbTableName, SQLUSMALLINT fUnique, SQLUSMALLINT fAccuracy) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(3); tdsdump_log(TDS_DBG_FUNC, "SQLStatisticsW(%p, %ls, %d, %ls, %d, %ls, %d, %u, %u)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szTableName), (int) cbTableName, (unsigned int) fUnique, (unsigned int) fAccuracy); SQLWSTR_FREE(); } return _SQLStatistics(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, fUnique, fAccuracy, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLStatistics( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szTableName, SQLSMALLINT cbTableName, SQLUSMALLINT fUnique, SQLUSMALLINT fAccuracy) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLStatistics(%p, %s, %d, %s, %d, %s, %d, %u, %u)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szTableName, (int) cbTableName, (unsigned int) fUnique, (unsigned int) fAccuracy); #ifdef ENABLE_ODBC_WIDE return _SQLStatistics(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, fUnique, fAccuracy, 0); #else return _SQLStatistics(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, fUnique, fAccuracy); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLTables(SQLHSTMT hstmt, ODBC_CHAR * szCatalogName, SQLSMALLINT cbCatalogName, ODBC_CHAR * szSchemaName, SQLSMALLINT cbSchemaName, ODBC_CHAR * szTableName, SQLSMALLINT cbTableName, ODBC_CHAR * szTableType, SQLSMALLINT cbTableType, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLTablesW( SQLHSTMT hstmt, SQLWCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLWCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLWCHAR * szTableName, SQLSMALLINT cbTableName, SQLWCHAR * szTableType, SQLSMALLINT cbTableType) { if (TDS_UNLIKELY(tds_write_dump)) { SQLWSTR_BUFS(4); tdsdump_log(TDS_DBG_FUNC, "SQLTablesW(%p, %ls, %d, %ls, %d, %ls, %d, %ls, %d)\n", hstmt, SQLWSTR(szCatalogName), (int) cbCatalogName, SQLWSTR(szSchemaName), (int) cbSchemaName, SQLWSTR(szTableName), (int) cbTableName, SQLWSTR(szTableType), (int) cbTableType); SQLWSTR_FREE(); } return _SQLTables(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, (ODBC_CHAR*) szTableType, cbTableType, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLTables( SQLHSTMT hstmt, SQLCHAR * szCatalogName, SQLSMALLINT cbCatalogName, SQLCHAR * szSchemaName, SQLSMALLINT cbSchemaName, SQLCHAR * szTableName, SQLSMALLINT cbTableName, SQLCHAR * szTableType, SQLSMALLINT cbTableType) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLTables(%p, %s, %d, %s, %d, %s, %d, %s, %d)\n", hstmt, (const char*) szCatalogName, (int) cbCatalogName, (const char*) szSchemaName, (int) cbSchemaName, (const char*) szTableName, (int) cbTableName, (const char*) szTableType, (int) cbTableType); #ifdef ENABLE_ODBC_WIDE return _SQLTables(hstmt, (ODBC_CHAR*) szCatalogName, cbCatalogName, (ODBC_CHAR*) szSchemaName, cbSchemaName, (ODBC_CHAR*) szTableName, cbTableName, (ODBC_CHAR*) szTableType, cbTableType, 0); #else return _SQLTables(hstmt, szCatalogName, cbCatalogName, szSchemaName, cbSchemaName, szTableName, cbTableName, szTableType, cbTableType); #endif } #define tdsdump_log TDSDUMP_LOG_FAST freetds-1.3.6/src/odbc/error_export.h000644 025423 025423 00000011457 14162303405 021212 0ustar00fredianofrediano000000 000000 #undef tdsdump_log #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, ODBC_CHAR * szSqlStat, SQLINTEGER * pfNativeError, ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRecW( SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLWCHAR * szSqlStat, SQLINTEGER * pfNativeError, SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRecW(%d, %p, %d, %p, %p, %p, %d, %p)\n", (int) handleType, handle, (int) numRecord, szSqlStat, pfNativeError, szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg); return _SQLGetDiagRec(handleType, handle, numRecord, (ODBC_CHAR*) szSqlStat, pfNativeError, (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagRec( SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLCHAR * szSqlStat, SQLINTEGER * pfNativeError, SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n", (int) handleType, handle, (int) numRecord, szSqlStat, pfNativeError, szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg); #ifdef ENABLE_ODBC_WIDE return _SQLGetDiagRec(handleType, handle, numRecord, (ODBC_CHAR*) szSqlStat, pfNativeError, (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0); #else return _SQLGetDiagRec(handleType, handle, numRecord, szSqlStat, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLError(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, ODBC_CHAR * szSqlStat, SQLINTEGER * pfNativeError, ODBC_CHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLErrorW( SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLWCHAR * szSqlStat, SQLINTEGER * pfNativeError, SQLWCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLErrorW(%p, %p, %p, %p, %p, %p, %d, %p)\n", henv, hdbc, hstmt, szSqlStat, pfNativeError, szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg); return _SQLError(henv, hdbc, hstmt, (ODBC_CHAR*) szSqlStat, pfNativeError, (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLError( SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLCHAR * szSqlStat, SQLINTEGER * pfNativeError, SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR* pcbErrorMsg) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLError(%p, %p, %p, %p, %p, %p, %d, %p)\n", henv, hdbc, hstmt, szSqlStat, pfNativeError, szErrorMsg, (int) cbErrorMsgMax, pcbErrorMsg); #ifdef ENABLE_ODBC_WIDE return _SQLError(henv, hdbc, hstmt, (ODBC_CHAR*) szSqlStat, pfNativeError, (ODBC_CHAR*) szErrorMsg, cbErrorMsgMax, pcbErrorMsg, 0); #else return _SQLError(henv, hdbc, hstmt, szSqlStat, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg); #endif } #ifdef ENABLE_ODBC_WIDE static SQLRETURN _SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLSMALLINT diagIdentifier, SQLPOINTER buffer, SQLSMALLINT cbBuffer, SQLSMALLINT * pcbBuffer, int wide); SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagFieldW( SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLSMALLINT diagIdentifier, SQLPOINTER buffer, SQLSMALLINT cbBuffer, SQLSMALLINT * pcbBuffer) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagFieldW(%d, %p, %d, %d, %p, %d, %p)\n", (int) handleType, handle, (int) numRecord, (int) diagIdentifier, buffer, (int) cbBuffer, pcbBuffer); return _SQLGetDiagField(handleType, handle, numRecord, diagIdentifier, buffer, cbBuffer, pcbBuffer, 1); } #endif SQLRETURN ODBC_PUBLIC ODBC_API SQLGetDiagField( SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLSMALLINT diagIdentifier, SQLPOINTER buffer, SQLSMALLINT cbBuffer, SQLSMALLINT * pcbBuffer) { TDSDUMP_LOG_FAST(TDS_DBG_FUNC, "SQLGetDiagField(%d, %p, %d, %d, %p, %d, %p)\n", (int) handleType, handle, (int) numRecord, (int) diagIdentifier, buffer, (int) cbBuffer, pcbBuffer); #ifdef ENABLE_ODBC_WIDE return _SQLGetDiagField(handleType, handle, numRecord, diagIdentifier, buffer, cbBuffer, pcbBuffer, 0); #else return _SQLGetDiagField(handleType, handle, numRecord, diagIdentifier, buffer, cbBuffer, pcbBuffer); #endif } #define tdsdump_log TDSDUMP_LOG_FAST freetds-1.3.6/src/odbc/odbc_data.c000644 025423 025423 00000034066 14056414221 020355 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2014 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #define SET_INFO(type, prefix, suffix) do { \ drec->sql_desc_literal_prefix = prefix; \ drec->sql_desc_literal_suffix = suffix; \ drec->sql_desc_type_name = type; \ return; \ } while(0) #define SET_INFO2(type, prefix, suffix, len) do { \ drec->sql_desc_length = (len); \ SET_INFO(type, prefix, suffix); \ } while(0) static void data_msdatetime_set_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { int decimals = col->column_prec ? col->column_prec + 1: 0; switch (col->on_server.column_type) { case SYBMSTIME: drec->sql_desc_octet_length = sizeof(SQL_SS_TIME2_STRUCT); drec->sql_desc_concise_type = SQL_SS_TIME2; /* always hh:mm:ss[.fff] */ drec->sql_desc_display_size = 8 + decimals; SET_INFO2("time", "'", "'", 8 + decimals); case SYBMSDATE: drec->sql_desc_octet_length = sizeof(DATE_STRUCT); drec->sql_desc_concise_type = SQL_TYPE_DATE; /* always yyyy-mm-dd ?? */ drec->sql_desc_display_size = 10; SET_INFO2("date", "'", "'", 10); case SYBMSDATETIMEOFFSET: drec->sql_desc_octet_length = sizeof(SQL_SS_TIMESTAMPOFFSET_STRUCT); drec->sql_desc_concise_type = SQL_SS_TIMESTAMPOFFSET; /* we always format using yyyy-mm-dd hh:mm:ss[.fff] +HH:MM, see convert_tds2sql.c */ drec->sql_desc_display_size = 26 + decimals; SET_INFO2("datetimeoffset", "'", "'", 26 + decimals); case SYBMSDATETIME2: drec->sql_desc_octet_length = sizeof(TIMESTAMP_STRUCT); drec->sql_desc_concise_type = SQL_TYPE_TIMESTAMP; drec->sql_desc_datetime_interval_code = SQL_CODE_TIMESTAMP; /* we always format using yyyy-mm-dd hh:mm:ss[.fff], see convert_tds2sql.c */ drec->sql_desc_display_size = 19 + decimals; SET_INFO2("datetime2", "'", "'", 19 + decimals); default: break; } } static void data_variant_set_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { drec->sql_desc_concise_type = SQL_SS_VARIANT; drec->sql_desc_display_size = 8000; drec->sql_desc_octet_length = 0; SET_INFO2("sql_variant", "", "", 8000); } static void data_numeric_set_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { const char *type_name = col->on_server.column_type == SYBNUMERIC ? "numeric" : "decimal"; drec->sql_desc_concise_type = SQL_NUMERIC; drec->sql_desc_octet_length = col->column_prec + 2; drec->sql_desc_display_size = col->column_prec + 2; drec->sql_desc_num_prec_radix = 10; SET_INFO2(type_name, "", "", col->column_prec); } static void data_clrudt_set_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { drec->sql_desc_concise_type = SQL_LONGVARBINARY; /* TODO ??? */ drec->sql_desc_display_size = col->column_size * 2; } static void data_sybbigtime_set_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { if (col->on_server.column_type == SYB5BIGTIME) { drec->sql_desc_concise_type = SQL_SS_TIME2; /* we always format using hh:mm:ss[.ffffff], see convert_tds2sql.c */ drec->sql_desc_display_size = 15; drec->sql_desc_octet_length = sizeof(SQL_SS_TIME2_STRUCT); drec->sql_desc_precision = 6; drec->sql_desc_scale = 6; drec->sql_desc_datetime_interval_code = SQL_CODE_TIMESTAMP; SET_INFO2("bigtime", "'", "'", 15); } assert(col->on_server.column_type == SYB5BIGDATETIME); drec->sql_desc_concise_type = SQL_TYPE_TIMESTAMP; drec->sql_desc_display_size = 26; drec->sql_desc_octet_length = sizeof(TIMESTAMP_STRUCT); drec->sql_desc_precision = 6; drec->sql_desc_scale = 6; drec->sql_desc_datetime_interval_code = SQL_CODE_TIMESTAMP; SET_INFO2("bigdatetime", "'", "'", 26); } static void data_generic_set_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { TDS_SERVER_TYPE col_type = col->on_server.column_type; int col_size = col->on_server.column_size; switch (tds_get_conversion_type(col_type, col_size)) { case XSYBNCHAR: drec->sql_desc_concise_type = SQL_WCHAR; drec->sql_desc_display_size = col->on_server.column_size / 2; SET_INFO2("nchar", "'", "'", col->on_server.column_size / 2); case XSYBCHAR: case SYBCHAR: drec->sql_desc_concise_type = SQL_CHAR; drec->sql_desc_display_size = col->on_server.column_size; SET_INFO("char", "'", "'"); /* TODO really sure ?? SYBNVARCHAR sybase only ?? */ case SYBNVARCHAR: case XSYBNVARCHAR: drec->sql_desc_concise_type = SQL_WVARCHAR; drec->sql_desc_display_size = col->on_server.column_size / 2; drec->sql_desc_length = col->on_server.column_size / 2u; if (col->char_conv) { unsigned char bytes_per_char = ODBC_CLAMP(col->char_conv->to.charset.max_bytes_per_char, 2, 3); drec->sql_desc_octet_length = (col->on_server.column_size / 2u) * bytes_per_char; } if (is_blob_col(col)) { drec->sql_desc_display_size = SQL_SS_LENGTH_UNLIMITED; drec->sql_desc_octet_length = drec->sql_desc_length = SQL_SS_LENGTH_UNLIMITED; } SET_INFO("nvarchar", "'", "'"); case XSYBVARCHAR: case SYBVARCHAR: drec->sql_desc_concise_type = SQL_VARCHAR; drec->sql_desc_display_size = col->on_server.column_size; if (is_blob_col(col)) { drec->sql_desc_display_size = SQL_SS_LENGTH_UNLIMITED; drec->sql_desc_octet_length = drec->sql_desc_length = SQL_SS_LENGTH_UNLIMITED; } SET_INFO("varchar", "'", "'"); case SYBNTEXT: drec->sql_desc_concise_type = SQL_WLONGVARCHAR; drec->sql_desc_display_size = col->on_server.column_size / 2; SET_INFO2("ntext", "'", "'", col->on_server.column_size / 2); case SYBTEXT: drec->sql_desc_concise_type = SQL_LONGVARCHAR; drec->sql_desc_display_size = col->on_server.column_size; SET_INFO("text", "'", "'"); case SYBBIT: case SYBBITN: drec->sql_desc_concise_type = SQL_BIT; drec->sql_desc_display_size = 1; drec->sql_desc_unsigned = SQL_TRUE; SET_INFO2("bit", "", "", 1); #if (ODBCVER >= 0x0300) case SYB5INT8: case SYBINT8: /* TODO return numeric for odbc2 and convert bigint to numeric */ drec->sql_desc_concise_type = SQL_BIGINT; drec->sql_desc_display_size = 20; SET_INFO2("bigint", "", "", 19); #endif case SYBINT4: drec->sql_desc_concise_type = SQL_INTEGER; drec->sql_desc_display_size = 11; /* -1000000000 */ SET_INFO2("int", "", "", 10); case SYBINT2: drec->sql_desc_concise_type = SQL_SMALLINT; drec->sql_desc_display_size = 6; /* -10000 */ SET_INFO2("smallint", "", "", 5); case SYBUINT1: case SYBINT1: drec->sql_desc_unsigned = SQL_TRUE; case SYBSINT1: /* TODO not another type_name ?? */ drec->sql_desc_concise_type = SQL_TINYINT; drec->sql_desc_display_size = 3; /* 255 */ SET_INFO2("tinyint", "", "", 3); #if (ODBCVER >= 0x0300) case SYBUINT8: drec->sql_desc_unsigned = SQL_TRUE; drec->sql_desc_concise_type = SQL_BIGINT; drec->sql_desc_display_size = 20; /* TODO return numeric for odbc2 and convert bigint to numeric */ SET_INFO2("unsigned bigint", "", "", 20); #endif case SYBUINT4: drec->sql_desc_unsigned = SQL_TRUE; drec->sql_desc_concise_type = SQL_INTEGER; drec->sql_desc_display_size = 10; SET_INFO2("unsigned int", "", "", 10); case SYBUINT2: drec->sql_desc_unsigned = SQL_TRUE; drec->sql_desc_concise_type = SQL_SMALLINT; drec->sql_desc_display_size = 5; /* 65535 */ SET_INFO2("unsigned smallint", "", "", 5); case SYBREAL: drec->sql_desc_concise_type = SQL_REAL; drec->sql_desc_display_size = 14; SET_INFO2("real", "", "", odbc_ver == SQL_OV_ODBC3 ? 24 : 7); case SYBFLT8: drec->sql_desc_concise_type = SQL_DOUBLE; drec->sql_desc_display_size = 24; /* FIXME -- what should the correct size be? */ SET_INFO2("float", "", "", odbc_ver == SQL_OV_ODBC3 ? 53 : 15); case SYBMONEY: /* TODO check money format returned by propretary ODBC, scale == 4 but we use 2 digits */ drec->sql_desc_concise_type = SQL_DECIMAL; drec->sql_desc_octet_length = 21; drec->sql_desc_display_size = 21; drec->sql_desc_precision = 19; drec->sql_desc_scale = 4; SET_INFO2("money", "$", "", 19); case SYBMONEY4: drec->sql_desc_concise_type = SQL_DECIMAL; drec->sql_desc_octet_length = 12; drec->sql_desc_display_size = 12; drec->sql_desc_precision = 10; drec->sql_desc_scale = 4; SET_INFO2("money", "$", "", 10); case SYBDATETIME: drec->sql_desc_concise_type = SQL_TYPE_TIMESTAMP; drec->sql_desc_display_size = 23; drec->sql_desc_octet_length = sizeof(TIMESTAMP_STRUCT); drec->sql_desc_precision = 3; drec->sql_desc_scale = 3; drec->sql_desc_datetime_interval_code = SQL_CODE_TIMESTAMP; SET_INFO2("datetime", "'", "'", 23); case SYBDATETIME4: drec->sql_desc_concise_type = SQL_TYPE_TIMESTAMP; /* TODO dependent on precision (decimal second digits) */ /* we always format using yyyy-mm-dd hh:mm:ss[.fff], see convert_tds2sql.c */ drec->sql_desc_display_size = 19; drec->sql_desc_octet_length = sizeof(TIMESTAMP_STRUCT); drec->sql_desc_datetime_interval_code = SQL_CODE_TIMESTAMP; SET_INFO2("datetime", "'", "'", 16); /* The following two types are just Sybase types but as mainly our ODBC * driver is much more compatible with Windows use attributes similar * to MS one. For instance Sybase ODBC returns TIME into a TIME_STRUCT * however this truncate the precision to 0 as TIME does not have * fraction of seconds. Also Sybase ODBC have different concepts for * PRECISION for many types and making these 2 types compatibles with * Sybase would break this driver compatibility. */ case SYBTIME: drec->sql_desc_concise_type = SQL_SS_TIME2; drec->sql_desc_octet_length = sizeof(SQL_SS_TIME2_STRUCT); /* we always format using hh:mm:ss[.fff], see convert_tds2sql.c */ drec->sql_desc_display_size = 12; drec->sql_desc_precision = 3; drec->sql_desc_scale = 3; SET_INFO2("time", "'", "'", 12); case SYBDATE: drec->sql_desc_octet_length = sizeof(DATE_STRUCT); drec->sql_desc_concise_type = SQL_TYPE_DATE; /* we always format using yyyy-mm-dd, see convert_tds2sql.c */ drec->sql_desc_display_size = 10; SET_INFO2("date", "'", "'", 10); case XSYBBINARY: case SYBBINARY: drec->sql_desc_concise_type = SQL_BINARY; drec->sql_desc_display_size = col->column_size * 2; /* handle TIMESTAMP using usertype */ if (col->column_usertype == 80) SET_INFO("timestamp", "0x", ""); SET_INFO("binary", "0x", ""); case SYBLONGBINARY: if (col->column_usertype == USER_UNICHAR_TYPE) { drec->sql_desc_concise_type = SQL_WCHAR; drec->sql_desc_display_size = col->on_server.column_size / 2; SET_INFO2("unichar", "'", "'", col->on_server.column_size / 2); } if (col->column_usertype == USER_UNIVARCHAR_TYPE) { drec->sql_desc_concise_type = SQL_WVARCHAR; drec->sql_desc_display_size = col->on_server.column_size / 2; SET_INFO2("univarchar", "'", "'", col->on_server.column_size / 2); } case SYBIMAGE: drec->sql_desc_concise_type = SQL_LONGVARBINARY; drec->sql_desc_display_size = col->column_size * 2; SET_INFO("image", "0x", ""); case XSYBVARBINARY: case SYBVARBINARY: drec->sql_desc_concise_type = SQL_VARBINARY; drec->sql_desc_display_size = col->column_size * 2; if (is_blob_col(col)) { drec->sql_desc_display_size = SQL_SS_LENGTH_UNLIMITED; drec->sql_desc_octet_length = drec->sql_desc_length = SQL_SS_LENGTH_UNLIMITED; } SET_INFO("varbinary", "0x", ""); case SYBINTN: case SYBDATETIMN: case SYBFLTN: case SYBMONEYN: case SYBUINTN: case SYBTIMEN: case SYBDATEN: assert(0); case SYBVOID: case SYBINTERVAL: case SYBUNITEXT: case SYBXML: case SYBMSUDT: break; #if (ODBCVER >= 0x0300) case SYBUNIQUE: #ifdef SQL_GUID drec->sql_desc_concise_type = SQL_GUID; #else drec->sql_desc_concise_type = SQL_CHAR; #endif drec->sql_desc_display_size = 36; /* FIXME for Sybase ?? */ SET_INFO2("uniqueidentifier", "'", "'", 36); #endif case SYBMSXML: drec->sql_desc_concise_type = SQL_SS_XML; drec->sql_desc_display_size = SQL_SS_LENGTH_UNLIMITED; drec->sql_desc_octet_length = drec->sql_desc_length = SQL_SS_LENGTH_UNLIMITED; SET_INFO("xml", "'", "'"); /* types already handled in other types, just to silent warnings */ case SYBNUMERIC: case SYBDECIMAL: case SYBVARIANT: case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYB5BIGDATETIME: case SYB5BIGTIME: break; } SET_INFO("", "", ""); } static void data_invalid_set_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { } void odbc_set_sql_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver) { drec->sql_desc_precision = col->column_prec; drec->sql_desc_scale = col->column_scale; drec->sql_desc_unsigned = SQL_FALSE; drec->sql_desc_octet_length = drec->sql_desc_length = col->on_server.column_size; drec->sql_desc_num_prec_radix = 0; drec->sql_desc_datetime_interval_code = 0; ((TDS_FUNCS *) col->funcs)->set_type_info(col, drec, odbc_ver); drec->sql_desc_type = drec->sql_desc_concise_type; if (drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP) drec->sql_desc_type = SQL_DATETIME; } # define TDS_DEFINE_FUNCS(name) \ const TDS_FUNCS tds_ ## name ## _funcs = { \ TDS_COMMON_FUNCS(name), \ data_ ## name ## _set_type_info, \ } TDS_DEFINE_FUNCS(invalid); TDS_DEFINE_FUNCS(generic); TDS_DEFINE_FUNCS(numeric); TDS_DEFINE_FUNCS(variant); TDS_DEFINE_FUNCS(msdatetime); TDS_DEFINE_FUNCS(clrudt); TDS_DEFINE_FUNCS(sybbigtime); freetds-1.3.6/src/odbc/winlogin.c000644 025423 025423 00000012525 14056414271 020304 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * PROGRAMMER NAME CONTACT *============================================================== * SJK Steve Kirkendall kirkenda@cs.pdx.edu * *************************************************************** * DATE PROGRAMMER CHANGE *============================================================== * 29.FEB.04 SJK Original. */ /* This file implements the a login dialog for the FreeTDS ODBC driver. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include "resource.h" #include #include #include #include #include #include /* This is defined in ... */ extern HINSTANCE hinstFreeTDS; static char * get_desktop_file(const char *file) { LPITEMIDLIST pidl; char path[MAX_PATH]; HRESULT hr; LPMALLOC pMalloc = NULL; char * res = NULL; hr = SHGetMalloc(&pMalloc); if (SUCCEEDED(hr)) { hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOPDIRECTORY, &pidl); if (SUCCEEDED(hr)) { if (SHGetPathFromIDList(pidl, path)) asprintf(&res, "%s\\%s", path, file); (*pMalloc->lpVtbl->Free)(pMalloc, pidl); } (*pMalloc->lpVtbl->Release)(pMalloc); } return res; } #ifndef _WIN64 #define GetWindowUserData(wnd) GetWindowLong((wnd), GWL_USERDATA) #define SetWindowUserData(wnd, data) SetWindowLong((wnd), GWL_USERDATA, (data)) #else #define GetWindowUserData(wnd) GetWindowLongPtr((wnd), GWLP_USERDATA) #define SetWindowUserData(wnd, data) SetWindowLongPtr((wnd), GWLP_USERDATA, (data)) #endif /** * Callback function for the DSN Configuration dialog * \param hDlg identifies the dialog * \param message what happened to the dialog * \param wParam varies with message * \param lParam pointer to TDSLOGIN struct */ static BOOL CALLBACK LoginDlgProc(HWND hDlg, UINT message, WPARAM wParam, /* */ LPARAM lParam) { TDSLOGIN *login; char tmp[100]; switch (message) { case WM_INITDIALOG: /* lParam points to the TDSLOGIN */ login = (TDSLOGIN *) lParam; SetWindowUserData(hDlg, lParam); /* copy info from TDSLOGIN to the dialog */ SendDlgItemMessage(hDlg, IDC_LOGINSERVER, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&login->server_name)); SendDlgItemMessage(hDlg, IDC_LOGINUID, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&login->user_name)); SendDlgItemMessage(hDlg, IDC_LOGINUID, EM_LIMITTEXT, sizeof(tmp) - 1, 0); SendDlgItemMessage(hDlg, IDC_LOGINPWD, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&login->password)); SendDlgItemMessage(hDlg, IDC_LOGINPWD, EM_LIMITTEXT, sizeof(tmp) - 1, 0); SendDlgItemMessage(hDlg, IDC_LOGINDUMP, BM_SETCHECK, !tds_dstr_isempty(&login->dump_file), 0L); /* adjust label of logging checkbox */ SendDlgItemMessage(hDlg, IDC_LOGINDUMP, WM_SETTEXT, 0, (LPARAM) "\"FreeTDS.log\" on desktop"); return TRUE; case WM_COMMAND: /* Dialog's user data points to TDSLOGIN */ login = (TDSLOGIN *) GetWindowUserData(hDlg); /* The wParam indicates which button was pressed */ if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, FALSE); return TRUE; } else if (LOWORD(wParam) != IDOK) { /* Anything but IDCANCEL or IDOK is handled elsewhere */ break; } /* If we get here, then the user hit the [OK] button */ /* get values from dialog */ SendDlgItemMessage(hDlg, IDC_LOGINUID, WM_GETTEXT, sizeof tmp, (LPARAM) tmp); tds_dstr_copy(&login->user_name, tmp); SendDlgItemMessage(hDlg, IDC_LOGINPWD, WM_GETTEXT, sizeof tmp, (LPARAM) tmp); tds_dstr_copy(&login->password, tmp); if (SendDlgItemMessage(hDlg, IDC_LOGINDUMP, BM_GETCHECK, 0, 0)) { char * filename = get_desktop_file("FreeTDS.log"); if (filename) { tds_dstr_copy(&login->dump_file, filename); free(filename); } } else { tds_dstr_copy(&login->dump_file, ""); } /* And we're done */ EndDialog(hDlg, TRUE); return TRUE; } return FALSE; } /** * Use a dialog window to prompt for user_name and password. If the user hits * the [OK] button then store the entered values into the given TDSLOGIN * structure and return TRUE. If the user hits [CANCEL] then return FALSE. * \param hwndParent parent for dialog * \param login where to store login info */ bool get_login_info(HWND hwndParent, TDSLOGIN * login) { return !!DialogBoxParam(hinstFreeTDS, MAKEINTRESOURCE(IDD_LOGIN), hwndParent, (DLGPROC) LoginDlgProc, (LPARAM) login); } freetds-1.3.6/src/odbc/winsetup.c000644 025423 025423 00000030552 14056414271 020334 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * PROGRAMMER NAME CONTACT *============================================================== * SJK Steve Kirkendall kirkenda@cs.pdx.edu * *************************************************************** * DATE PROGRAMMER CHANGE *============================================================== * 25.FEB.04 SJK Original. */ /* This file implements the setup API for FreeTDS. Specifically, * this includes the ConfigDSN() and ConfigDriver() functions. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include "resource.h" #include #include #include #include #include #include typedef struct { DSTR origdsn; /**< original name of the data source */ DSTR dsn; /**< edited name of the data source */ TDSLOGIN *login; /**< everything else */ } DSNINFO; /* This is defined in ... */ extern HINSTANCE hinstFreeTDS; /** Create an empty DSNINFO struct */ static DSNINFO * alloc_dsninfo(void) { DSNINFO *di; /* allocate & initialize it */ di = (DSNINFO *) malloc(sizeof(DSNINFO)); tds_dstr_init(&di->origdsn); tds_dstr_init(&di->dsn); di->login = tds_alloc_login(0); tds_init_login(di->login, NULL); return di; } /** Destroy a DSNINFO struct, freeing all memory associated with it */ static void free_dsninfo(DSNINFO * di) { /* the DSNINFO struct to be freed */ tds_free_login(di->login); tds_dstr_free(&di->origdsn); tds_dstr_free(&di->dsn); free(di); } /** * Parse a DSN string which is delimited with NULs instead of semicolons. * This uses odbc_parse_connect_string() internally, and also adds support * for parsing the DSN and driver * \param attribs 0-delimited string, with \0\0 terminator * \param di where to store the results */ static void parse_wacky_dsn_string(LPCSTR attribs, DSNINFO * di) { LPCSTR str; char *build; /* for each field... */ for (str = attribs; *str; str += strlen(str) + 1) { if (!strncasecmp(str, "DSN=", 4)) { tds_dstr_copy(&di->origdsn, str + 4); tds_dstr_copy(&di->dsn, str + 4); } } /* allocate space for a ;-delimited version */ build = (char *) malloc(str - attribs); /* copy the fields into the new buffer with ;'s */ *build = '\0'; for (str = attribs; *str; str += strlen(str) + 1) { if (*build) strcat(build, ";"); strcat(build, str); } /* let odbc_parse_connect_string() parse the ;-delimited version */ odbc_parse_connect_string(NULL, build, build + strlen(build), di->login, NULL); } /** * Update the attributes. Return TRUE if successful, else FALSE. The names * written here correspond to the names read by odbc_get_dsn_info(). */ #define WRITESTR(n,s) if (!SQLWritePrivateProfileString(section, (n), (s), odbcini)) return FALSE #define FIELD_STRING(f) tds_dstr_cstr(&di->login->f) static BOOL write_all_strings(DSNINFO * di) { char odbcini[FILENAME_MAX]; char tmp[100]; const char *section = tds_dstr_cstr(&di->dsn); strcpy(odbcini, "odbc.ini"); WRITESTR("Server", FIELD_STRING(server_name)); WRITESTR("Language", FIELD_STRING(language)); WRITESTR("Database", FIELD_STRING(database)); sprintf(tmp, "%u", di->login->port); WRITESTR("Port", tmp); sprintf(tmp, "%d.%d", TDS_MAJOR(di->login), TDS_MINOR(di->login)); WRITESTR("TDS_Version", tmp); sprintf(tmp, "%u", di->login->text_size); WRITESTR("TextSize", tmp); sprintf(tmp, "%u", di->login->block_size); WRITESTR("PacketSize", tmp); return TRUE; } /** * Go looking for trouble. Return NULL if the info is okay, or an error message * if something needs to change. */ static const char * validate(DSNINFO * di) { if (!SQLValidDSN(tds_dstr_cstr(&di->dsn))) return "Invalid DSN"; if (!IS_TDS42(di->login) && !IS_TDS46(di->login) && !IS_TDS50(di->login) && !IS_TDS7_PLUS(di->login)) return "Bad Protocol version"; if (tds_dstr_isempty(&di->login->server_name)) return "Address is required"; if (di->login->port < 1 || di->login->port > 65535) return "Bad port - Try 1433 or 4000"; return NULL; } #ifndef _WIN64 #define GetWindowUserData(wnd) GetWindowLong((wnd), GWL_USERDATA) #define SetWindowUserData(wnd, data) SetWindowLong((wnd), GWL_USERDATA, (data)) #else #define GetWindowUserData(wnd) GetWindowLongPtr((wnd), GWLP_USERDATA) #define SetWindowUserData(wnd, data) SetWindowLongPtr((wnd), GWLP_USERDATA, (data)) #endif /** * Callback function for the DSN Configuration dialog * \param hDlg identifies the dialog * \param message what happened to the dialog * \param wParam varies with message * \param lParam pointer to DSNINFO struct */ static BOOL CALLBACK DSNDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { DSNINFO *di; char tmp[100]; const char *pstr; int major, minor, i; static const char *protocols[] = { "TDS 4.2", "TDS 4.6", "TDS 5.0", "TDS 7.0", "TDS 7.1", "TDS 7.2", "TDS 7.3", "TDS 7.4", NULL }; switch (message) { case WM_INITDIALOG: /* lParam points to the DSNINFO */ di = (DSNINFO *) lParam; SetWindowUserData(hDlg, lParam); /* Stuff legal protocol names into IDC_PROTOCOL */ for (i = 0; protocols[i]; i++) { SendDlgItemMessage(hDlg, IDC_PROTOCOL, CB_ADDSTRING, 0, (LPARAM) protocols[i]); } /* copy info from DSNINFO to the dialog */ SendDlgItemMessage(hDlg, IDC_DSNNAME, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&di->dsn)); sprintf(tmp, "TDS %d.%d", TDS_MAJOR(di->login), TDS_MINOR(di->login)); SendDlgItemMessage(hDlg, IDC_PROTOCOL, CB_SELECTSTRING, -1, (LPARAM) tmp); SendDlgItemMessage(hDlg, IDC_ADDRESS, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&di->login->server_name)); sprintf(tmp, "%u", di->login->port); SendDlgItemMessage(hDlg, IDC_PORT, WM_SETTEXT, 0, (LPARAM) tmp); SendDlgItemMessage(hDlg, IDC_DATABASE, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&di->login->database)); return TRUE; case WM_COMMAND: /* Dialog's user data points to DSNINFO */ di = (DSNINFO *) GetWindowUserData(hDlg); /* The wParam indicates which button was pressed */ if (LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, FALSE); return TRUE; } else if (LOWORD(wParam) != IDOK) { /* Anything but IDCANCEL or IDOK is handled elsewhere */ break; } /* If we get here, then the user hit the [OK] button */ /* get values from dialog */ SendDlgItemMessage(hDlg, IDC_DSNNAME, WM_GETTEXT, sizeof tmp, (LPARAM) tmp); tds_dstr_copy(&di->dsn, tmp); SendDlgItemMessage(hDlg, IDC_PROTOCOL, WM_GETTEXT, sizeof tmp, (LPARAM) tmp); minor = 0; if (sscanf(tmp, "%*[^0-9]%d.%d", &major, &minor) > 1) { di->login->tds_version = (major << 8) | minor; } SendDlgItemMessage(hDlg, IDC_ADDRESS, WM_GETTEXT, sizeof tmp, (LPARAM) tmp); tds_dstr_copy(&di->login->server_name, tmp); SendDlgItemMessage(hDlg, IDC_PORT, WM_GETTEXT, sizeof tmp, (LPARAM) tmp); di->login->port = atoi(tmp); SendDlgItemMessage(hDlg, IDC_DATABASE, WM_GETTEXT, sizeof tmp, (LPARAM) tmp); tds_dstr_copy(&di->login->database, tmp); /* validate */ SendDlgItemMessage(hDlg, IDC_HINT, WM_SETTEXT, 0, (LPARAM) "VALIDATING... please be patient"); pstr = validate(di); if (pstr != NULL) { SendDlgItemMessage(hDlg, IDC_HINT, WM_SETTEXT, 0, (LPARAM) pstr); return TRUE; } SendDlgItemMessage(hDlg, IDC_HINT, WM_SETTEXT, 0, (LPARAM) ""); /* No problems -- we're done */ EndDialog(hDlg, TRUE); return TRUE; } return FALSE; } /** * Add, remove, or modify a data source * \param hwndParent parent for dialog, NULL for batch ops * \param fRequest request type * \param lpszDriver driver name (for humans, not DLL name) * \param lpszAttributes attribute list */ BOOL INSTAPI ConfigDSN(HWND hwndParent, WORD fRequest, LPCSTR lpszDriver, LPCSTR lpszAttributes) { DSNINFO *di; const char *errmsg; /* * Initialize Windows sockets. This is necessary even though * ConfigDSN() only looks up addresses and names, and never actually * uses any sockets. */ INITSOCKET(); /* Create a blank login struct */ di = alloc_dsninfo(); /* * Parse the attribute string. If this contains a DSN name, then it * also reads the current parameters of that DSN. */ parse_wacky_dsn_string(lpszAttributes, di); /* Maybe allow the user to edit it */ if (hwndParent && fRequest != ODBC_REMOVE_DSN) { INT_PTR result; result = DialogBoxParam(hinstFreeTDS, MAKEINTRESOURCE(IDD_DSN), hwndParent, (DLGPROC) DSNDlgProc, (LPARAM) di); if (result < 0) { DWORD errorcode = GetLastError(); char buf[1000]; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, errorcode, 0, buf, 1000, NULL); } /* if user hit [Cancel] then clean up and return FALSE */ if (result == 0) { goto Fail; } } switch (fRequest) { case ODBC_ADD_DSN: errmsg = validate(di); if (errmsg != NULL) { SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, errmsg); goto Fail; } if (!SQLWriteDSNToIni(tds_dstr_cstr(&di->dsn), lpszDriver)) { goto Fail; } if (!write_all_strings(di)) { goto Fail; } break; case ODBC_CONFIG_DSN: errmsg = validate(di); if (errmsg != NULL) { SQLPostInstallerError(ODBC_ERROR_REQUEST_FAILED, errmsg); goto Fail; } /* * if the DSN name has changed, then delete the old entry and * add the new one. */ if (strcasecmp(tds_dstr_cstr(&di->origdsn), tds_dstr_cstr(&di->dsn))) { if (!SQLRemoveDSNFromIni(tds_dstr_cstr(&di->origdsn)) || !SQLWriteDSNToIni(tds_dstr_cstr(&di->dsn), lpszDriver)) { goto Fail; } } if (!write_all_strings(di)) { goto Fail; } break; case ODBC_REMOVE_DSN: if (!SQLRemoveDSNFromIni(tds_dstr_cstr(&di->dsn))) { goto Fail; } break; } /* Clean up and return TRUE, indicating that the change took place */ free_dsninfo(di); DONESOCKET(); return TRUE; Fail: free_dsninfo(di); DONESOCKET(); return FALSE; } /** Add or remove an ODBC driver */ BOOL INSTAPI ConfigDriver(HWND hwndParent, WORD fRequest, LPCSTR lpszDriver, LPCSTR lpszArgs, LPSTR lpszMsg, WORD cbMsgMax, WORD * pcbMsgOut) { const char *msg = NULL; /* TODO finish ?? */ switch (fRequest) { case ODBC_INSTALL_DRIVER: msg = "Hello"; break; case ODBC_REMOVE_DRIVER: msg = "Goodbye"; break; } if (msg && lpszMsg && cbMsgMax > strlen(msg)) { strcpy(lpszMsg, msg); *pcbMsgOut = (WORD) strlen(msg); } return TRUE; } BOOL INSTAPI ConfigTranslator(HWND hwndParent, DWORD * pvOption) { return TRUE; } /** * Allow install using regsvr32 */ HRESULT WINAPI DllRegisterServer(void) { static const WCHAR desc_fmt[] = L"FreeTDS%c" L"APILevel=2%c" L"ConnectFunctions=YYN%c" L"DriverODBCVer=03.00%c" L"FileUsage=0%c" L"SQLLevel=2%c" L"Setup=%s%c" L"Driver=%s%c"; WCHAR fn[MAX_PATH], full_fn[MAX_PATH]; WCHAR desc[TDS_VECTOR_SIZE(desc_fmt) + TDS_VECTOR_SIZE(full_fn) * 2 + 2]; LPWSTR name; WORD len_out; DWORD cnt; BOOL b_res; if (!GetModuleFileNameW(hinstFreeTDS, fn, TDS_VECTOR_SIZE(fn))) return SELFREG_E_CLASS; if (!GetFullPathNameW(fn, TDS_VECTOR_SIZE(full_fn), full_fn, &name) || !name || full_fn == name) return SELFREG_E_CLASS; wsprintfW(desc, desc_fmt, 0, 0, 0, 0, 0, 0, name, 0, name, 0); name[-1] = 0; b_res = SQLInstallDriverExW(desc, full_fn, fn, TDS_VECTOR_SIZE(fn), &len_out, ODBC_INSTALL_COMPLETE, &cnt); if (!b_res) return SELFREG_E_CLASS; return S_OK; } /** * Allow uninstall using regsvr32 command */ HRESULT WINAPI DllUnregisterServer(void) { DWORD cnt; if (!SQLRemoveDriver("FreeTDS", FALSE, &cnt)) return SELFREG_E_CLASS; return S_OK; } freetds-1.3.6/src/odbc/winmain.c000644 025423 025423 00000000041 14056414222 020102 0ustar00fredianofrediano000000 000000 #include "../../win32/initnet.c" freetds-1.3.6/src/odbc/version.rc000644 025423 025423 00000002146 14162303377 020325 0ustar00fredianofrediano000000 000000 #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // VS_VERSION_INFO VERSIONINFO FILEVERSION 1,3,6,361 PRODUCTVERSION 1,3,6,361 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "FreeTDS.org\0" VALUE "FileDescription", "FreeTDS\0" VALUE "FileVersion", "1, 3, 6, 361\0" VALUE "InternalName", "FreeTDS\0" VALUE "LegalCopyright", "Copyright © 2004-2015 under terms of GNU LGPL\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "FreeTDS.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "FreeTDS ODBC Driver\0" VALUE "ProductVersion", "1, 3, 6, 361\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END #endif // !_MAC freetds-1.3.6/src/odbc/CMakeLists.txt000644 025423 025423 00000004752 14056414221 021050 0ustar00fredianofrediano000000 000000 add_subdirectory(unittests) # TODO checks add_definitions(-DUNIXODBC -DHAVE_SQLGETPRIVATEPROFILESTRING) if(PERL_FOUND AND NOT EXISTS "${CMAKE_SOURCE_DIR}/src/odbc/odbc_export.h") add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/odbc_export.h" COMMAND ${PERL_EXECUTABLE} odbc_export.pl odbc.c > "${CMAKE_CURRENT_BINARY_DIR}/odbc_export.h" MAIN_DEPENDENCY odbc_export.pl DEPENDS odbc.c WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/error_export.h" COMMAND ${PERL_EXECUTABLE} odbc_export.pl error.c > "${CMAKE_CURRENT_BINARY_DIR}/error_export.h" MAIN_DEPENDENCY odbc_export.pl DEPENDS error.c WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) add_custom_target(odbc_exports_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/odbc_export.h" "${CMAKE_CURRENT_BINARY_DIR}/error_export.h") else(PERL_FOUND AND NOT EXISTS "${CMAKE_SOURCE_DIR}/src/odbc/odbc_export.h") add_custom_target(odbc_exports_h DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/odbc_export.h" "${CMAKE_CURRENT_SOURCE_DIR}/error_export.h") endif(PERL_FOUND AND NOT EXISTS "${CMAKE_SOURCE_DIR}/src/odbc/odbc_export.h") if(WIN32) set(win_SRCS winlogin.c winsetup.c winmain.c odbc_w.def setup.rc) endif() set(libs ${lib_ODBCINST}) add_library(tdsodbc SHARED odbc.c connectparams.c convert_tds2sql.c descriptor.c prepare_query.c odbc_util.c bcp.c native.c sql2tds.c error.c odbc_checks.c sqlwchar.c sqlwparams.h odbc_data.c ${win_SRCS} ) target_include_directories(tdsodbc PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") add_dependencies(tdsodbc odbc_exports_h encodings_h) target_compile_definitions(tdsodbc PUBLIC DLL_EXPORT=1) # TODO libiconv, odbcinstlib and other dynamics target_link_libraries(tdsodbc tds replacements tdsutils ${libs} ${lib_NETWORK} ${lib_BASE}) if(MINGW OR CYGWIN) set_target_properties(tdsodbc PROPERTIES LINK_FLAGS "--static -Wl,--kill-at -Wl,--enable-stdcall-fixup") endif(MINGW OR CYGWIN) add_library(tdsodbc_static STATIC odbc.c connectparams.c convert_tds2sql.c descriptor.c prepare_query.c odbc_util.c bcp.c native.c sql2tds.c error.c odbc_checks.c sqlwchar.c sqlwparams.h odbc_data.c ${win_SRCS} ) target_include_directories(tdsodbc_static PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") add_dependencies(tdsodbc_static odbc_exports_h encodings_h) if (NOT WIN32) set_target_properties(tdsodbc_static PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() INSTALL(TARGETS tdsodbc PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) freetds-1.3.6/src/odbc/setup.rc000644 025423 025423 00000010123 14056414222 017764 0ustar00fredianofrediano000000 000000 //Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #ifdef _MSC_VER # include "winres.h" #else # include "windows.h" # ifndef IDC_STATIC # define IDC_STATIC -1 # endif #endif #include "version.rc" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_DSN DIALOG DISCARDABLE 0, 0, 202, 140 STYLE DS_SYSMODAL | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "FreeTDS DSN Configuration" FONT 8, "MS Sans Serif" BEGIN LTEXT "DSN Name",IDC_STATIC,23,16,37,8 EDITTEXT IDC_DSNNAME,74,13,60,14,ES_AUTOHSCROLL LTEXT "Protocol Version",IDC_STATIC,8,34,52,8 COMBOBOX IDC_PROTOCOL,74,32,73,61,CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP LTEXT "Server Address",IDC_STATIC,11,52,49,8 EDITTEXT IDC_ADDRESS,74,49,121,14,ES_AUTOHSCROLL LTEXT "Server Port",IDC_STATIC,24,71,36,8 EDITTEXT IDC_PORT,74,68,60,14,ES_AUTOHSCROLL | ES_NUMBER LTEXT "Database",IDC_STATIC,28,90,32,8 EDITTEXT IDC_DATABASE,74,87,121,14,ES_AUTOHSCROLL LTEXT "www.freetds.org",IDC_STATIC,7,123,52,8 CTEXT "",IDC_HINT,7,105,188,8 PUSHBUTTON "OK",IDOK,92,117,50,14 PUSHBUTTON "Cancel",IDCANCEL,144,117,50,14 END IDD_LOGIN DIALOG DISCARDABLE 0, 0, 164, 117 STYLE DS_MODALFRAME | DS_3DLOOK | WS_CAPTION | WS_VISIBLE CAPTION "FreeTDS Login" FONT 8, "MS Sans Serif" BEGIN LTEXT "Server",IDC_STATIC,23,17,22,8 LTEXT "Server Name",IDC_LOGINSERVER,51,13,106,16, SS_CENTERIMAGE | SS_SUNKEN LTEXT "User Name",IDC_STATIC,9,38,36,8 EDITTEXT IDC_LOGINUID,51,36,106,14,ES_AUTOHSCROLL LTEXT "Password",IDC_STATIC,13,60,32,8 EDITTEXT IDC_LOGINPWD,51,57,106,14,ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,52,96,50,14 PUSHBUTTON "Cancel",IDCANCEL,107,96,50,14 LTEXT "Log File",IDC_STATIC,19,79,26,8 CONTROL """FreeTDS.log"" on desktop",IDC_LOGINDUMP,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,51,78,106,10 END #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#ifdef _MSC_VER\r\n" "# include ""winres.h""\r\n" "#else\r\n" "# include ""windows.h""\r\n" "# ifndef IDC_STATIC\r\n" "# define IDC_STATIC -1\r\n" "# endif\r\n" "#endif\r\n" "\r\n" "#include ""version.rc""\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO // #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO DISCARDABLE BEGIN IDD_DSN, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 195 TOPMARGIN, 7 BOTTOMMARGIN, 131 END IDD_LOGIN, DIALOG BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 157 TOPMARGIN, 7 BOTTOMMARGIN, 110 END END #endif // APSTUDIO_INVOKED #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED freetds-1.3.6/src/odbc/resource.h000644 025423 025423 00000001644 14056414222 020306 0ustar00fredianofrediano000000 000000 //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by setup.rc // #define IDD_LOGIN 102 #define IDD_DSN 106 #define IDC_PROTOCOL 1003 #define IDC_ADDRESS 1004 #define IDC_PORT 1005 #define IDC_DATABASE 1011 #define IDC_DSNNAME 1015 #define IDC_HINT 1017 #define IDC_LOGINSERVER 1020 #define IDC_LOGINUID 1021 #define IDC_LOGINPWD 1022 #define IDC_LOGINDUMP 1023 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1024 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif freetds-1.3.6/src/odbc/odbc.def000644 025423 025423 00000003046 14056414221 017672 0ustar00fredianofrediano000000 000000 EXPORTS SQLAllocConnect SQLAllocEnv SQLAllocHandle SQLAllocStmt SQLBindCol SQLBindParam SQLBindParameter ; SQLBrowseConnect SQLCancel SQLCloseCursor SQLColAttribute SQLColAttributes SQLColumnPrivileges SQLColumns SQLConnect SQLCopyDesc SQLDescribeCol ; SQLDescribeParam SQLDisconnect SQLDriverConnect SQLEndTran SQLError SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLFetchScroll SQLForeignKeys SQLFreeConnect SQLFreeEnv SQLFreeHandle SQLFreeStmt SQLGetConnectAttr SQLGetConnectOption SQLGetCursorName SQLGetData SQLGetDescField SQLGetDescRec SQLGetDiagField SQLGetDiagRec SQLGetEnvAttr SQLGetFunctions SQLGetInfo SQLGetStmtAttr SQLGetStmtOption SQLGetTypeInfo SQLMoreResults SQLNativeSql SQLNumParams SQLNumResultCols SQLParamData SQLParamOptions SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLPutData SQLRowCount SQLSetConnectAttr SQLSetConnectOption SQLSetCursorName SQLSetDescField SQLSetDescRec SQLSetEnvAttr SQLSetParam SQLSetPos SQLSetScrollOptions SQLSetStmtAttr SQLSetStmtOption SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables SQLTransact ConfigDSN ConfigDriver ConfigTranslator bcp_initA = win_bcp_initA bcp_control = win_bcp_control bcp_colptr = win_bcp_colptr bcp_sendrow = win_bcp_sendrow bcp_batch = win_bcp_batch bcp_done = win_bcp_done bcp_bind = win_bcp_bind DllRegisterServer PRIVATE DllUnregisterServer PRIVATE SQLGetTypeInfoW = SQLGetTypeInfo freetds-1.3.6/src/odbc/odbc_w.def000644 025423 025423 00000004021 14056414222 020213 0ustar00fredianofrediano000000 000000 EXPORTS SQLAllocConnect SQLAllocEnv SQLAllocHandle SQLAllocStmt SQLBindCol SQLBindParam SQLBindParameter ; SQLBrowseConnect SQLCancel SQLCloseCursor SQLColAttribute SQLColAttributes SQLColumnPrivileges SQLColumns SQLConnect SQLCopyDesc SQLDescribeCol ; SQLDescribeParam SQLDisconnect SQLDriverConnect SQLEndTran SQLError SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLFetchScroll SQLForeignKeys SQLFreeConnect SQLFreeEnv SQLFreeHandle SQLFreeStmt SQLGetConnectAttr SQLGetConnectOption SQLGetCursorName SQLGetData SQLGetDescField SQLGetDescRec SQLGetDiagField SQLGetDiagRec SQLGetEnvAttr SQLGetFunctions SQLGetInfo SQLGetStmtAttr SQLGetStmtOption SQLGetTypeInfo SQLMoreResults SQLNativeSql SQLNumParams SQLNumResultCols SQLParamData SQLParamOptions SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLPutData SQLRowCount SQLSetConnectAttr SQLSetConnectOption SQLSetCursorName SQLSetDescField SQLSetDescRec SQLSetEnvAttr SQLSetParam SQLSetPos SQLSetScrollOptions SQLSetStmtAttr SQLSetStmtOption SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables SQLTransact ConfigDSN ConfigDriver ConfigTranslator bcp_initA = win_bcp_initA bcp_control = win_bcp_control bcp_colptr = win_bcp_colptr bcp_sendrow = win_bcp_sendrow bcp_batch = win_bcp_batch bcp_done = win_bcp_done bcp_bind = win_bcp_bind DllRegisterServer PRIVATE DllUnregisterServer PRIVATE SQLGetTypeInfoW = SQLGetTypeInfo SQLColAttributeW SQLColumnPrivilegesW SQLColumnsW SQLConnectW SQLDescribeColW SQLDriverConnectW SQLErrorW SQLExecDirectW SQLForeignKeysW SQLGetConnectAttrW SQLGetConnectOptionW SQLGetCursorNameW SQLGetDescFieldW SQLGetDescRecW SQLGetDiagFieldW SQLGetDiagRecW SQLGetInfoW SQLGetStmtAttrW SQLNativeSqlW SQLPrepareW SQLPrimaryKeysW SQLProcedureColumnsW SQLProceduresW SQLSetConnectAttrW SQLSetConnectOptionW SQLSetCursorNameW SQLSetDescFieldW SQLSetStmtAttrW SQLSpecialColumnsW SQLStatisticsW SQLTablePrivilegesW SQLTablesW bcp_initW = win_bcp_initW freetds-1.3.6/src/odbc/unittests/000755 025423 025423 00000000000 14162303406 020342 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/odbc/unittests/Makefile.am000644 025423 025423 00000012442 14107141721 022400 0ustar00fredianofrediano000000 000000 NULL= TESTS = \ t0001$(EXEEXT) \ t0002$(EXEEXT) \ t0003$(EXEEXT) \ moreresults$(EXEEXT) \ connect$(EXEEXT) \ print$(EXEEXT) \ date$(EXEEXT) \ norowset$(EXEEXT) \ funccall$(EXEEXT) \ lang_error$(EXEEXT) \ tables$(EXEEXT) \ binary_test$(EXEEXT) \ moreandcount$(EXEEXT) \ earlybind$(EXEEXT) \ putdata$(EXEEXT) \ params$(EXEEXT) \ raiserror$(EXEEXT) \ getdata$(EXEEXT) \ transaction$(EXEEXT) \ type$(EXEEXT) \ genparams$(EXEEXT) \ preperror$(EXEEXT) \ prepare_results$(EXEEXT) \ testodbc$(EXEEXT) \ data$(EXEEXT) \ error$(EXEEXT) \ rebindpar$(EXEEXT) \ rpc$(EXEEXT) \ convert_error$(EXEEXT) \ typeinfo$(EXEEXT) \ const_params$(EXEEXT) \ insert_speed$(EXEEXT) \ compute$(EXEEXT) \ timeout$(EXEEXT) \ array$(EXEEXT) \ array_out$(EXEEXT) \ cursor1$(EXEEXT) \ scroll$(EXEEXT) \ cursor2$(EXEEXT) \ describecol$(EXEEXT) \ copydesc$(EXEEXT) \ prepclose$(EXEEXT) \ warning$(EXEEXT) \ paramcore$(EXEEXT) \ timeout2$(EXEEXT) \ timeout3$(EXEEXT) \ connect2$(EXEEXT) \ timeout4$(EXEEXT) \ freeclose$(EXEEXT) \ cursor3$(EXEEXT) \ cursor4$(EXEEXT) \ cursor5$(EXEEXT) \ attributes$(EXEEXT) \ hidden$(EXEEXT) \ blob1$(EXEEXT) \ cancel$(EXEEXT) \ wchar$(EXEEXT) \ rowset$(EXEEXT) \ transaction2$(EXEEXT) \ cursor6$(EXEEXT) \ cursor7$(EXEEXT) \ utf8$(EXEEXT) \ utf8_2$(EXEEXT) \ utf8_3$(EXEEXT) \ stats$(EXEEXT) \ descrec$(EXEEXT) \ peter$(EXEEXT) \ test64$(EXEEXT) \ prepare_warn$(EXEEXT) \ long_error$(EXEEXT) \ mars1$(EXEEXT) \ array_error$(EXEEXT) \ describecol2$(EXEEXT) \ closestmt$(EXEEXT) \ bcp$(EXEEXT) \ all_types$(EXEEXT) \ empty_query$(EXEEXT) \ transaction3$(EXEEXT) \ transaction4$(EXEEXT) \ utf8_4$(EXEEXT) \ qn$(EXEEXT) \ $(NULL) check_PROGRAMS = $(TESTS) oldpwd$(EXEEXT) t0001_SOURCES = t0001.c t0002_SOURCES = t0002.c t0003_SOURCES = t0003.c moreresults_SOURCES = moreresults.c connect_SOURCES = connect.c connect_LDFLAGS = $(GLOBAL_LD_ADD) -no-install print_SOURCES = print.c date_SOURCES = date.c norowset_SOURCES = norowset.c funccall_SOURCES = funccall.c lang_error_SOURCES = lang_error.c tables_SOURCES = tables.c binary_test_SOURCES = binary_test.c moreandcount_SOURCES = moreandcount.c earlybind_SOURCES = earlybind.c putdata_SOURCES = putdata.c params_SOURCES = params.c raiserror_SOURCES = raiserror.c getdata_SOURCES = getdata.c type_SOURCES = type.c transaction_SOURCES = transaction.c genparams_SOURCES = genparams.c c2string.c preperror_SOURCES = preperror.c prepare_results_SOURCES = prepare_results.c testodbc_SOURCES = testodbc.c data_SOURCES = data.c data.in c2string.c parser.c parser.h error_SOURCES = error.c rebindpar_SOURCES = rebindpar.c rpc_SOURCES = rpc.c convert_error_SOURCES = convert_error.c typeinfo_SOURCES = typeinfo.c const_params_SOURCES = const_params.c insert_speed_SOURCES = insert_speed.c compute_SOURCES = compute.c timeout_SOURCES = timeout.c array_SOURCES = array.c array_out_SOURCES = array_out.c cursor1_SOURCES = cursor1.c scroll_SOURCES = scroll.c cursor2_SOURCES = cursor2.c describecol_SOURCES = describecol.c describecol.in parser.c parser.h describecol2_SOURCES = describecol2.c copydesc_SOURCES = copydesc.c prepclose_SOURCES = prepclose.c warning_SOURCES = warning.c paramcore_SOURCES = paramcore.c timeout2_SOURCES = timeout2.c timeout3_SOURCES = timeout3.c connect2_SOURCES = connect2.c timeout4_SOURCES = timeout4.c freeclose_SOURCES = freeclose.c cursor3_SOURCES = cursor3.c cursor4_SOURCES = cursor4.c cursor5_SOURCES = cursor5.c attributes_SOURCES = attributes.c attributes.in hidden_SOURCES = hidden.c blob1_SOURCES = blob1.c rowset_SOURCES = rowset.c cancel_SOURCES = cancel.c wchar_SOURCES = wchar.c transaction2_SOURCES = transaction2.c cursor6_SOURCES = cursor6.c cursor7_SOURCES = cursor7.c utf8_SOURCES = utf8.c common.c # this test cannot work using wide characters as use UTF-8 and single byte encoding utf8_CPPFLAGS = $(GLOBAL_CPPFLAGS) utf8_LDADD = $(ODBC_LDFLAGS) $(NETWORK_LIBS) $(ODBCINST_LDFLAGS) utf8_2_SOURCES = utf8_2.c utf8_3_SOURCES = utf8_3.c utf8_4_SOURCES = utf8_4.c utf8_4_LDFLAGS = -static ../libtdsodbc.la ../../tds/unittests/libcommon.a -shared $(GLOBAL_LD_ADD) stats_SOURCES = stats.c descrec_SOURCES = descrec.c peter_SOURCES = peter.c test64_SOURCES = test64.c prepare_warn_SOURCES = prepare_warn.c long_error_SOURCES = long_error.c mars1_SOURCES = mars1.c array_error_SOURCES = array_error.c closestmt_SOURCES = closestmt.c oldpwd_SOURCES = oldpwd.c # this test cannot work using wide characters as use UTF-8 and single byte encoding oldpwd_CPPFLAGS = $(GLOBAL_CPPFLAGS) bcp_SOURCES = bcp.c all_types_SOURCES = all_types.c all_types_LDFLAGS = -static ../libtdsodbc.la ../../tds/unittests/libcommon.a -shared $(GLOBAL_LD_ADD) empty_query_SOURCES = empty_query.c transaction3_SOURCES = transaction3.c transaction4_SOURCES = transaction4.c qn_SOURCES = qn.c noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h GLOBAL_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_TOPDIR=\"$(top_srcdir)\" GLOBAL_LD_ADD = $(NETWORK_LIBS) $(ODBCINST_LDFLAGS) AM_CPPFLAGS = $(GLOBAL_CPPFLAGS) if ODBC_WIDE_TESTS AM_CPPFLAGS += -DUNICODE -D_UNICODE endif if MINGW32 AM_LDFLAGS = -no-fast-install else AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" endif LDADD = libcommon.a $(ODBC_LDFLAGS) ../../replacements/libreplacements.la $(GLOBAL_LD_ADD) DISTCLEANFILES = odbc.ini odbcinst.ini EXTRA_DIST = CMakeLists.txt freetds-1.3.6/src/odbc/unittests/Makefile.in000644 025423 025423 00000360767 14162303357 022437 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ TESTS = t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT) \ moreresults$(EXEEXT) connect$(EXEEXT) print$(EXEEXT) \ date$(EXEEXT) norowset$(EXEEXT) funccall$(EXEEXT) \ lang_error$(EXEEXT) tables$(EXEEXT) binary_test$(EXEEXT) \ moreandcount$(EXEEXT) earlybind$(EXEEXT) putdata$(EXEEXT) \ params$(EXEEXT) raiserror$(EXEEXT) getdata$(EXEEXT) \ transaction$(EXEEXT) type$(EXEEXT) genparams$(EXEEXT) \ preperror$(EXEEXT) prepare_results$(EXEEXT) testodbc$(EXEEXT) \ data$(EXEEXT) error$(EXEEXT) rebindpar$(EXEEXT) rpc$(EXEEXT) \ convert_error$(EXEEXT) typeinfo$(EXEEXT) const_params$(EXEEXT) \ insert_speed$(EXEEXT) compute$(EXEEXT) timeout$(EXEEXT) \ array$(EXEEXT) array_out$(EXEEXT) cursor1$(EXEEXT) \ scroll$(EXEEXT) cursor2$(EXEEXT) describecol$(EXEEXT) \ copydesc$(EXEEXT) prepclose$(EXEEXT) warning$(EXEEXT) \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) \ cancel$(EXEEXT) wchar$(EXEEXT) rowset$(EXEEXT) \ transaction2$(EXEEXT) cursor6$(EXEEXT) cursor7$(EXEEXT) \ utf8$(EXEEXT) utf8_2$(EXEEXT) utf8_3$(EXEEXT) stats$(EXEEXT) \ descrec$(EXEEXT) peter$(EXEEXT) test64$(EXEEXT) \ prepare_warn$(EXEEXT) long_error$(EXEEXT) mars1$(EXEEXT) \ array_error$(EXEEXT) describecol2$(EXEEXT) closestmt$(EXEEXT) \ bcp$(EXEEXT) all_types$(EXEEXT) empty_query$(EXEEXT) \ transaction3$(EXEEXT) transaction4$(EXEEXT) utf8_4$(EXEEXT) \ qn$(EXEEXT) $(am__EXEEXT_1) check_PROGRAMS = $(am__EXEEXT_2) oldpwd$(EXEEXT) @ODBC_WIDE_TESTS_TRUE@am__append_1 = -DUNICODE -D_UNICODE subdir = src/odbc/unittests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = am__EXEEXT_2 = t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT) \ moreresults$(EXEEXT) connect$(EXEEXT) print$(EXEEXT) \ date$(EXEEXT) norowset$(EXEEXT) funccall$(EXEEXT) \ lang_error$(EXEEXT) tables$(EXEEXT) binary_test$(EXEEXT) \ moreandcount$(EXEEXT) earlybind$(EXEEXT) putdata$(EXEEXT) \ params$(EXEEXT) raiserror$(EXEEXT) getdata$(EXEEXT) \ transaction$(EXEEXT) type$(EXEEXT) genparams$(EXEEXT) \ preperror$(EXEEXT) prepare_results$(EXEEXT) testodbc$(EXEEXT) \ data$(EXEEXT) error$(EXEEXT) rebindpar$(EXEEXT) rpc$(EXEEXT) \ convert_error$(EXEEXT) typeinfo$(EXEEXT) const_params$(EXEEXT) \ insert_speed$(EXEEXT) compute$(EXEEXT) timeout$(EXEEXT) \ array$(EXEEXT) array_out$(EXEEXT) cursor1$(EXEEXT) \ scroll$(EXEEXT) cursor2$(EXEEXT) describecol$(EXEEXT) \ copydesc$(EXEEXT) prepclose$(EXEEXT) warning$(EXEEXT) \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) \ cancel$(EXEEXT) wchar$(EXEEXT) rowset$(EXEEXT) \ transaction2$(EXEEXT) cursor6$(EXEEXT) cursor7$(EXEEXT) \ utf8$(EXEEXT) utf8_2$(EXEEXT) utf8_3$(EXEEXT) stats$(EXEEXT) \ descrec$(EXEEXT) peter$(EXEEXT) test64$(EXEEXT) \ prepare_warn$(EXEEXT) long_error$(EXEEXT) mars1$(EXEEXT) \ array_error$(EXEEXT) describecol2$(EXEEXT) closestmt$(EXEEXT) \ bcp$(EXEEXT) all_types$(EXEEXT) empty_query$(EXEEXT) \ transaction3$(EXEEXT) transaction4$(EXEEXT) utf8_4$(EXEEXT) \ qn$(EXEEXT) $(am__EXEEXT_1) LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libcommon_a_AR = $(AR) $(ARFLAGS) libcommon_a_LIBADD = am_libcommon_a_OBJECTS = common.$(OBJEXT) libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) am_all_types_OBJECTS = all_types.$(OBJEXT) all_types_OBJECTS = $(am_all_types_OBJECTS) all_types_LDADD = $(LDADD) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) all_types_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = all_types_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(all_types_LDFLAGS) $(LDFLAGS) -o $@ am_array_OBJECTS = array.$(OBJEXT) array_OBJECTS = $(am_array_OBJECTS) array_LDADD = $(LDADD) array_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_array_error_OBJECTS = array_error.$(OBJEXT) array_error_OBJECTS = $(am_array_error_OBJECTS) array_error_LDADD = $(LDADD) array_error_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_array_out_OBJECTS = array_out.$(OBJEXT) array_out_OBJECTS = $(am_array_out_OBJECTS) array_out_LDADD = $(LDADD) array_out_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_attributes_OBJECTS = attributes.$(OBJEXT) attributes_OBJECTS = $(am_attributes_OBJECTS) attributes_LDADD = $(LDADD) attributes_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_bcp_OBJECTS = bcp.$(OBJEXT) bcp_OBJECTS = $(am_bcp_OBJECTS) bcp_LDADD = $(LDADD) bcp_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_binary_test_OBJECTS = binary_test.$(OBJEXT) binary_test_OBJECTS = $(am_binary_test_OBJECTS) binary_test_LDADD = $(LDADD) binary_test_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_blob1_OBJECTS = blob1.$(OBJEXT) blob1_OBJECTS = $(am_blob1_OBJECTS) blob1_LDADD = $(LDADD) blob1_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cancel_OBJECTS = cancel.$(OBJEXT) cancel_OBJECTS = $(am_cancel_OBJECTS) cancel_LDADD = $(LDADD) cancel_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_closestmt_OBJECTS = closestmt.$(OBJEXT) closestmt_OBJECTS = $(am_closestmt_OBJECTS) closestmt_LDADD = $(LDADD) closestmt_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_compute_OBJECTS = compute.$(OBJEXT) compute_OBJECTS = $(am_compute_OBJECTS) compute_LDADD = $(LDADD) compute_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_connect_OBJECTS = connect.$(OBJEXT) connect_OBJECTS = $(am_connect_OBJECTS) connect_LDADD = $(LDADD) connect_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) connect_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(connect_LDFLAGS) $(LDFLAGS) -o $@ am_connect2_OBJECTS = connect2.$(OBJEXT) connect2_OBJECTS = $(am_connect2_OBJECTS) connect2_LDADD = $(LDADD) connect2_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_const_params_OBJECTS = const_params.$(OBJEXT) const_params_OBJECTS = $(am_const_params_OBJECTS) const_params_LDADD = $(LDADD) const_params_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_convert_error_OBJECTS = convert_error.$(OBJEXT) convert_error_OBJECTS = $(am_convert_error_OBJECTS) convert_error_LDADD = $(LDADD) convert_error_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_copydesc_OBJECTS = copydesc.$(OBJEXT) copydesc_OBJECTS = $(am_copydesc_OBJECTS) copydesc_LDADD = $(LDADD) copydesc_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cursor1_OBJECTS = cursor1.$(OBJEXT) cursor1_OBJECTS = $(am_cursor1_OBJECTS) cursor1_LDADD = $(LDADD) cursor1_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cursor2_OBJECTS = cursor2.$(OBJEXT) cursor2_OBJECTS = $(am_cursor2_OBJECTS) cursor2_LDADD = $(LDADD) cursor2_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cursor3_OBJECTS = cursor3.$(OBJEXT) cursor3_OBJECTS = $(am_cursor3_OBJECTS) cursor3_LDADD = $(LDADD) cursor3_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cursor4_OBJECTS = cursor4.$(OBJEXT) cursor4_OBJECTS = $(am_cursor4_OBJECTS) cursor4_LDADD = $(LDADD) cursor4_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cursor5_OBJECTS = cursor5.$(OBJEXT) cursor5_OBJECTS = $(am_cursor5_OBJECTS) cursor5_LDADD = $(LDADD) cursor5_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cursor6_OBJECTS = cursor6.$(OBJEXT) cursor6_OBJECTS = $(am_cursor6_OBJECTS) cursor6_LDADD = $(LDADD) cursor6_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_cursor7_OBJECTS = cursor7.$(OBJEXT) cursor7_OBJECTS = $(am_cursor7_OBJECTS) cursor7_LDADD = $(LDADD) cursor7_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_data_OBJECTS = data.$(OBJEXT) c2string.$(OBJEXT) parser.$(OBJEXT) data_OBJECTS = $(am_data_OBJECTS) data_LDADD = $(LDADD) data_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_date_OBJECTS = date.$(OBJEXT) date_OBJECTS = $(am_date_OBJECTS) date_LDADD = $(LDADD) date_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_descrec_OBJECTS = descrec.$(OBJEXT) descrec_OBJECTS = $(am_descrec_OBJECTS) descrec_LDADD = $(LDADD) descrec_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_describecol_OBJECTS = describecol.$(OBJEXT) parser.$(OBJEXT) describecol_OBJECTS = $(am_describecol_OBJECTS) describecol_LDADD = $(LDADD) describecol_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_describecol2_OBJECTS = describecol2.$(OBJEXT) describecol2_OBJECTS = $(am_describecol2_OBJECTS) describecol2_LDADD = $(LDADD) describecol2_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_earlybind_OBJECTS = earlybind.$(OBJEXT) earlybind_OBJECTS = $(am_earlybind_OBJECTS) earlybind_LDADD = $(LDADD) earlybind_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_empty_query_OBJECTS = empty_query.$(OBJEXT) empty_query_OBJECTS = $(am_empty_query_OBJECTS) empty_query_LDADD = $(LDADD) empty_query_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_error_OBJECTS = error.$(OBJEXT) error_OBJECTS = $(am_error_OBJECTS) error_LDADD = $(LDADD) error_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_freeclose_OBJECTS = freeclose.$(OBJEXT) freeclose_OBJECTS = $(am_freeclose_OBJECTS) freeclose_LDADD = $(LDADD) freeclose_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_funccall_OBJECTS = funccall.$(OBJEXT) funccall_OBJECTS = $(am_funccall_OBJECTS) funccall_LDADD = $(LDADD) funccall_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_genparams_OBJECTS = genparams.$(OBJEXT) c2string.$(OBJEXT) genparams_OBJECTS = $(am_genparams_OBJECTS) genparams_LDADD = $(LDADD) genparams_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_getdata_OBJECTS = getdata.$(OBJEXT) getdata_OBJECTS = $(am_getdata_OBJECTS) getdata_LDADD = $(LDADD) getdata_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_hidden_OBJECTS = hidden.$(OBJEXT) hidden_OBJECTS = $(am_hidden_OBJECTS) hidden_LDADD = $(LDADD) hidden_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_insert_speed_OBJECTS = insert_speed.$(OBJEXT) insert_speed_OBJECTS = $(am_insert_speed_OBJECTS) insert_speed_LDADD = $(LDADD) insert_speed_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_lang_error_OBJECTS = lang_error.$(OBJEXT) lang_error_OBJECTS = $(am_lang_error_OBJECTS) lang_error_LDADD = $(LDADD) lang_error_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_long_error_OBJECTS = long_error.$(OBJEXT) long_error_OBJECTS = $(am_long_error_OBJECTS) long_error_LDADD = $(LDADD) long_error_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_mars1_OBJECTS = mars1.$(OBJEXT) mars1_OBJECTS = $(am_mars1_OBJECTS) mars1_LDADD = $(LDADD) mars1_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_moreandcount_OBJECTS = moreandcount.$(OBJEXT) moreandcount_OBJECTS = $(am_moreandcount_OBJECTS) moreandcount_LDADD = $(LDADD) moreandcount_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_moreresults_OBJECTS = moreresults.$(OBJEXT) moreresults_OBJECTS = $(am_moreresults_OBJECTS) moreresults_LDADD = $(LDADD) moreresults_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_norowset_OBJECTS = norowset.$(OBJEXT) norowset_OBJECTS = $(am_norowset_OBJECTS) norowset_LDADD = $(LDADD) norowset_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_oldpwd_OBJECTS = oldpwd-oldpwd.$(OBJEXT) oldpwd_OBJECTS = $(am_oldpwd_OBJECTS) oldpwd_LDADD = $(LDADD) oldpwd_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_paramcore_OBJECTS = paramcore.$(OBJEXT) paramcore_OBJECTS = $(am_paramcore_OBJECTS) paramcore_LDADD = $(LDADD) paramcore_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_params_OBJECTS = params.$(OBJEXT) params_OBJECTS = $(am_params_OBJECTS) params_LDADD = $(LDADD) params_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_peter_OBJECTS = peter.$(OBJEXT) peter_OBJECTS = $(am_peter_OBJECTS) peter_LDADD = $(LDADD) peter_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_prepare_results_OBJECTS = prepare_results.$(OBJEXT) prepare_results_OBJECTS = $(am_prepare_results_OBJECTS) prepare_results_LDADD = $(LDADD) prepare_results_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_prepare_warn_OBJECTS = prepare_warn.$(OBJEXT) prepare_warn_OBJECTS = $(am_prepare_warn_OBJECTS) prepare_warn_LDADD = $(LDADD) prepare_warn_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_prepclose_OBJECTS = prepclose.$(OBJEXT) prepclose_OBJECTS = $(am_prepclose_OBJECTS) prepclose_LDADD = $(LDADD) prepclose_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_preperror_OBJECTS = preperror.$(OBJEXT) preperror_OBJECTS = $(am_preperror_OBJECTS) preperror_LDADD = $(LDADD) preperror_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_print_OBJECTS = print.$(OBJEXT) print_OBJECTS = $(am_print_OBJECTS) print_LDADD = $(LDADD) print_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_putdata_OBJECTS = putdata.$(OBJEXT) putdata_OBJECTS = $(am_putdata_OBJECTS) putdata_LDADD = $(LDADD) putdata_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_qn_OBJECTS = qn.$(OBJEXT) qn_OBJECTS = $(am_qn_OBJECTS) qn_LDADD = $(LDADD) qn_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_raiserror_OBJECTS = raiserror.$(OBJEXT) raiserror_OBJECTS = $(am_raiserror_OBJECTS) raiserror_LDADD = $(LDADD) raiserror_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_rebindpar_OBJECTS = rebindpar.$(OBJEXT) rebindpar_OBJECTS = $(am_rebindpar_OBJECTS) rebindpar_LDADD = $(LDADD) rebindpar_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_rowset_OBJECTS = rowset.$(OBJEXT) rowset_OBJECTS = $(am_rowset_OBJECTS) rowset_LDADD = $(LDADD) rowset_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_rpc_OBJECTS = rpc.$(OBJEXT) rpc_OBJECTS = $(am_rpc_OBJECTS) rpc_LDADD = $(LDADD) rpc_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_scroll_OBJECTS = scroll.$(OBJEXT) scroll_OBJECTS = $(am_scroll_OBJECTS) scroll_LDADD = $(LDADD) scroll_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_stats_OBJECTS = stats.$(OBJEXT) stats_OBJECTS = $(am_stats_OBJECTS) stats_LDADD = $(LDADD) stats_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_t0001_OBJECTS = t0001.$(OBJEXT) t0001_OBJECTS = $(am_t0001_OBJECTS) t0001_LDADD = $(LDADD) t0001_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_t0002_OBJECTS = t0002.$(OBJEXT) t0002_OBJECTS = $(am_t0002_OBJECTS) t0002_LDADD = $(LDADD) t0002_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_t0003_OBJECTS = t0003.$(OBJEXT) t0003_OBJECTS = $(am_t0003_OBJECTS) t0003_LDADD = $(LDADD) t0003_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_tables_OBJECTS = tables.$(OBJEXT) tables_OBJECTS = $(am_tables_OBJECTS) tables_LDADD = $(LDADD) tables_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_test64_OBJECTS = test64.$(OBJEXT) test64_OBJECTS = $(am_test64_OBJECTS) test64_LDADD = $(LDADD) test64_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_testodbc_OBJECTS = testodbc.$(OBJEXT) testodbc_OBJECTS = $(am_testodbc_OBJECTS) testodbc_LDADD = $(LDADD) testodbc_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_timeout_OBJECTS = timeout.$(OBJEXT) timeout_OBJECTS = $(am_timeout_OBJECTS) timeout_LDADD = $(LDADD) timeout_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_timeout2_OBJECTS = timeout2.$(OBJEXT) timeout2_OBJECTS = $(am_timeout2_OBJECTS) timeout2_LDADD = $(LDADD) timeout2_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_timeout3_OBJECTS = timeout3.$(OBJEXT) timeout3_OBJECTS = $(am_timeout3_OBJECTS) timeout3_LDADD = $(LDADD) timeout3_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_timeout4_OBJECTS = timeout4.$(OBJEXT) timeout4_OBJECTS = $(am_timeout4_OBJECTS) timeout4_LDADD = $(LDADD) timeout4_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_transaction_OBJECTS = transaction.$(OBJEXT) transaction_OBJECTS = $(am_transaction_OBJECTS) transaction_LDADD = $(LDADD) transaction_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_transaction2_OBJECTS = transaction2.$(OBJEXT) transaction2_OBJECTS = $(am_transaction2_OBJECTS) transaction2_LDADD = $(LDADD) transaction2_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_transaction3_OBJECTS = transaction3.$(OBJEXT) transaction3_OBJECTS = $(am_transaction3_OBJECTS) transaction3_LDADD = $(LDADD) transaction3_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_transaction4_OBJECTS = transaction4.$(OBJEXT) transaction4_OBJECTS = $(am_transaction4_OBJECTS) transaction4_LDADD = $(LDADD) transaction4_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_type_OBJECTS = type.$(OBJEXT) type_OBJECTS = $(am_type_OBJECTS) type_LDADD = $(LDADD) type_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_typeinfo_OBJECTS = typeinfo.$(OBJEXT) typeinfo_OBJECTS = $(am_typeinfo_OBJECTS) typeinfo_LDADD = $(LDADD) typeinfo_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_utf8_OBJECTS = utf8-utf8.$(OBJEXT) utf8-common.$(OBJEXT) utf8_OBJECTS = $(am_utf8_OBJECTS) utf8_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_utf8_2_OBJECTS = utf8_2.$(OBJEXT) utf8_2_OBJECTS = $(am_utf8_2_OBJECTS) utf8_2_LDADD = $(LDADD) utf8_2_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_utf8_3_OBJECTS = utf8_3.$(OBJEXT) utf8_3_OBJECTS = $(am_utf8_3_OBJECTS) utf8_3_LDADD = $(LDADD) utf8_3_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_utf8_4_OBJECTS = utf8_4.$(OBJEXT) utf8_4_OBJECTS = $(am_utf8_4_OBJECTS) utf8_4_LDADD = $(LDADD) utf8_4_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) utf8_4_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(utf8_4_LDFLAGS) $(LDFLAGS) -o $@ am_warning_OBJECTS = warning.$(OBJEXT) warning_OBJECTS = $(am_warning_OBJECTS) warning_LDADD = $(LDADD) warning_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) am_wchar_OBJECTS = wchar.$(OBJEXT) wchar_OBJECTS = $(am_wchar_OBJECTS) wchar_LDADD = $(LDADD) wchar_DEPENDENCIES = libcommon.a $(am__DEPENDENCIES_1) \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_2) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/all_types.Po ./$(DEPDIR)/array.Po \ ./$(DEPDIR)/array_error.Po ./$(DEPDIR)/array_out.Po \ ./$(DEPDIR)/attributes.Po ./$(DEPDIR)/bcp.Po \ ./$(DEPDIR)/binary_test.Po ./$(DEPDIR)/blob1.Po \ ./$(DEPDIR)/c2string.Po ./$(DEPDIR)/cancel.Po \ ./$(DEPDIR)/closestmt.Po ./$(DEPDIR)/common.Po \ ./$(DEPDIR)/compute.Po ./$(DEPDIR)/connect.Po \ ./$(DEPDIR)/connect2.Po ./$(DEPDIR)/const_params.Po \ ./$(DEPDIR)/convert_error.Po ./$(DEPDIR)/copydesc.Po \ ./$(DEPDIR)/cursor1.Po ./$(DEPDIR)/cursor2.Po \ ./$(DEPDIR)/cursor3.Po ./$(DEPDIR)/cursor4.Po \ ./$(DEPDIR)/cursor5.Po ./$(DEPDIR)/cursor6.Po \ ./$(DEPDIR)/cursor7.Po ./$(DEPDIR)/data.Po ./$(DEPDIR)/date.Po \ ./$(DEPDIR)/descrec.Po ./$(DEPDIR)/describecol.Po \ ./$(DEPDIR)/describecol2.Po ./$(DEPDIR)/earlybind.Po \ ./$(DEPDIR)/empty_query.Po ./$(DEPDIR)/error.Po \ ./$(DEPDIR)/freeclose.Po ./$(DEPDIR)/funccall.Po \ ./$(DEPDIR)/genparams.Po ./$(DEPDIR)/getdata.Po \ ./$(DEPDIR)/hidden.Po ./$(DEPDIR)/insert_speed.Po \ ./$(DEPDIR)/lang_error.Po ./$(DEPDIR)/long_error.Po \ ./$(DEPDIR)/mars1.Po ./$(DEPDIR)/moreandcount.Po \ ./$(DEPDIR)/moreresults.Po ./$(DEPDIR)/norowset.Po \ ./$(DEPDIR)/oldpwd-oldpwd.Po ./$(DEPDIR)/paramcore.Po \ ./$(DEPDIR)/params.Po ./$(DEPDIR)/parser.Po \ ./$(DEPDIR)/peter.Po ./$(DEPDIR)/prepare_results.Po \ ./$(DEPDIR)/prepare_warn.Po ./$(DEPDIR)/prepclose.Po \ ./$(DEPDIR)/preperror.Po ./$(DEPDIR)/print.Po \ ./$(DEPDIR)/putdata.Po ./$(DEPDIR)/qn.Po \ ./$(DEPDIR)/raiserror.Po ./$(DEPDIR)/rebindpar.Po \ ./$(DEPDIR)/rowset.Po ./$(DEPDIR)/rpc.Po ./$(DEPDIR)/scroll.Po \ ./$(DEPDIR)/stats.Po ./$(DEPDIR)/t0001.Po ./$(DEPDIR)/t0002.Po \ ./$(DEPDIR)/t0003.Po ./$(DEPDIR)/tables.Po \ ./$(DEPDIR)/test64.Po ./$(DEPDIR)/testodbc.Po \ ./$(DEPDIR)/timeout.Po ./$(DEPDIR)/timeout2.Po \ ./$(DEPDIR)/timeout3.Po ./$(DEPDIR)/timeout4.Po \ ./$(DEPDIR)/transaction.Po ./$(DEPDIR)/transaction2.Po \ ./$(DEPDIR)/transaction3.Po ./$(DEPDIR)/transaction4.Po \ ./$(DEPDIR)/type.Po ./$(DEPDIR)/typeinfo.Po \ ./$(DEPDIR)/utf8-common.Po ./$(DEPDIR)/utf8-utf8.Po \ ./$(DEPDIR)/utf8_2.Po ./$(DEPDIR)/utf8_3.Po \ ./$(DEPDIR)/utf8_4.Po ./$(DEPDIR)/warning.Po \ ./$(DEPDIR)/wchar.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcommon_a_SOURCES) $(all_types_SOURCES) $(array_SOURCES) \ $(array_error_SOURCES) $(array_out_SOURCES) \ $(attributes_SOURCES) $(bcp_SOURCES) $(binary_test_SOURCES) \ $(blob1_SOURCES) $(cancel_SOURCES) $(closestmt_SOURCES) \ $(compute_SOURCES) $(connect_SOURCES) $(connect2_SOURCES) \ $(const_params_SOURCES) $(convert_error_SOURCES) \ $(copydesc_SOURCES) $(cursor1_SOURCES) $(cursor2_SOURCES) \ $(cursor3_SOURCES) $(cursor4_SOURCES) $(cursor5_SOURCES) \ $(cursor6_SOURCES) $(cursor7_SOURCES) $(data_SOURCES) \ $(date_SOURCES) $(descrec_SOURCES) $(describecol_SOURCES) \ $(describecol2_SOURCES) $(earlybind_SOURCES) \ $(empty_query_SOURCES) $(error_SOURCES) $(freeclose_SOURCES) \ $(funccall_SOURCES) $(genparams_SOURCES) $(getdata_SOURCES) \ $(hidden_SOURCES) $(insert_speed_SOURCES) \ $(lang_error_SOURCES) $(long_error_SOURCES) $(mars1_SOURCES) \ $(moreandcount_SOURCES) $(moreresults_SOURCES) \ $(norowset_SOURCES) $(oldpwd_SOURCES) $(paramcore_SOURCES) \ $(params_SOURCES) $(peter_SOURCES) $(prepare_results_SOURCES) \ $(prepare_warn_SOURCES) $(prepclose_SOURCES) \ $(preperror_SOURCES) $(print_SOURCES) $(putdata_SOURCES) \ $(qn_SOURCES) $(raiserror_SOURCES) $(rebindpar_SOURCES) \ $(rowset_SOURCES) $(rpc_SOURCES) $(scroll_SOURCES) \ $(stats_SOURCES) $(t0001_SOURCES) $(t0002_SOURCES) \ $(t0003_SOURCES) $(tables_SOURCES) $(test64_SOURCES) \ $(testodbc_SOURCES) $(timeout_SOURCES) $(timeout2_SOURCES) \ $(timeout3_SOURCES) $(timeout4_SOURCES) $(transaction_SOURCES) \ $(transaction2_SOURCES) $(transaction3_SOURCES) \ $(transaction4_SOURCES) $(type_SOURCES) $(typeinfo_SOURCES) \ $(utf8_SOURCES) $(utf8_2_SOURCES) $(utf8_3_SOURCES) \ $(utf8_4_SOURCES) $(warning_SOURCES) $(wchar_SOURCES) DIST_SOURCES = $(libcommon_a_SOURCES) $(all_types_SOURCES) \ $(array_SOURCES) $(array_error_SOURCES) $(array_out_SOURCES) \ $(attributes_SOURCES) $(bcp_SOURCES) $(binary_test_SOURCES) \ $(blob1_SOURCES) $(cancel_SOURCES) $(closestmt_SOURCES) \ $(compute_SOURCES) $(connect_SOURCES) $(connect2_SOURCES) \ $(const_params_SOURCES) $(convert_error_SOURCES) \ $(copydesc_SOURCES) $(cursor1_SOURCES) $(cursor2_SOURCES) \ $(cursor3_SOURCES) $(cursor4_SOURCES) $(cursor5_SOURCES) \ $(cursor6_SOURCES) $(cursor7_SOURCES) $(data_SOURCES) \ $(date_SOURCES) $(descrec_SOURCES) $(describecol_SOURCES) \ $(describecol2_SOURCES) $(earlybind_SOURCES) \ $(empty_query_SOURCES) $(error_SOURCES) $(freeclose_SOURCES) \ $(funccall_SOURCES) $(genparams_SOURCES) $(getdata_SOURCES) \ $(hidden_SOURCES) $(insert_speed_SOURCES) \ $(lang_error_SOURCES) $(long_error_SOURCES) $(mars1_SOURCES) \ $(moreandcount_SOURCES) $(moreresults_SOURCES) \ $(norowset_SOURCES) $(oldpwd_SOURCES) $(paramcore_SOURCES) \ $(params_SOURCES) $(peter_SOURCES) $(prepare_results_SOURCES) \ $(prepare_warn_SOURCES) $(prepclose_SOURCES) \ $(preperror_SOURCES) $(print_SOURCES) $(putdata_SOURCES) \ $(qn_SOURCES) $(raiserror_SOURCES) $(rebindpar_SOURCES) \ $(rowset_SOURCES) $(rpc_SOURCES) $(scroll_SOURCES) \ $(stats_SOURCES) $(t0001_SOURCES) $(t0002_SOURCES) \ $(t0003_SOURCES) $(tables_SOURCES) $(test64_SOURCES) \ $(testodbc_SOURCES) $(timeout_SOURCES) $(timeout2_SOURCES) \ $(timeout3_SOURCES) $(timeout4_SOURCES) $(transaction_SOURCES) \ $(transaction2_SOURCES) $(transaction3_SOURCES) \ $(transaction4_SOURCES) $(type_SOURCES) $(typeinfo_SOURCES) \ $(utf8_SOURCES) $(utf8_2_SOURCES) $(utf8_3_SOURCES) \ $(utf8_4_SOURCES) $(warning_SOURCES) $(wchar_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = t0001_SOURCES = t0001.c t0002_SOURCES = t0002.c t0003_SOURCES = t0003.c moreresults_SOURCES = moreresults.c connect_SOURCES = connect.c connect_LDFLAGS = $(GLOBAL_LD_ADD) -no-install print_SOURCES = print.c date_SOURCES = date.c norowset_SOURCES = norowset.c funccall_SOURCES = funccall.c lang_error_SOURCES = lang_error.c tables_SOURCES = tables.c binary_test_SOURCES = binary_test.c moreandcount_SOURCES = moreandcount.c earlybind_SOURCES = earlybind.c putdata_SOURCES = putdata.c params_SOURCES = params.c raiserror_SOURCES = raiserror.c getdata_SOURCES = getdata.c type_SOURCES = type.c transaction_SOURCES = transaction.c genparams_SOURCES = genparams.c c2string.c preperror_SOURCES = preperror.c prepare_results_SOURCES = prepare_results.c testodbc_SOURCES = testodbc.c data_SOURCES = data.c data.in c2string.c parser.c parser.h error_SOURCES = error.c rebindpar_SOURCES = rebindpar.c rpc_SOURCES = rpc.c convert_error_SOURCES = convert_error.c typeinfo_SOURCES = typeinfo.c const_params_SOURCES = const_params.c insert_speed_SOURCES = insert_speed.c compute_SOURCES = compute.c timeout_SOURCES = timeout.c array_SOURCES = array.c array_out_SOURCES = array_out.c cursor1_SOURCES = cursor1.c scroll_SOURCES = scroll.c cursor2_SOURCES = cursor2.c describecol_SOURCES = describecol.c describecol.in parser.c parser.h describecol2_SOURCES = describecol2.c copydesc_SOURCES = copydesc.c prepclose_SOURCES = prepclose.c warning_SOURCES = warning.c paramcore_SOURCES = paramcore.c timeout2_SOURCES = timeout2.c timeout3_SOURCES = timeout3.c connect2_SOURCES = connect2.c timeout4_SOURCES = timeout4.c freeclose_SOURCES = freeclose.c cursor3_SOURCES = cursor3.c cursor4_SOURCES = cursor4.c cursor5_SOURCES = cursor5.c attributes_SOURCES = attributes.c attributes.in hidden_SOURCES = hidden.c blob1_SOURCES = blob1.c rowset_SOURCES = rowset.c cancel_SOURCES = cancel.c wchar_SOURCES = wchar.c transaction2_SOURCES = transaction2.c cursor6_SOURCES = cursor6.c cursor7_SOURCES = cursor7.c utf8_SOURCES = utf8.c common.c # this test cannot work using wide characters as use UTF-8 and single byte encoding utf8_CPPFLAGS = $(GLOBAL_CPPFLAGS) utf8_LDADD = $(ODBC_LDFLAGS) $(NETWORK_LIBS) $(ODBCINST_LDFLAGS) utf8_2_SOURCES = utf8_2.c utf8_3_SOURCES = utf8_3.c utf8_4_SOURCES = utf8_4.c utf8_4_LDFLAGS = -static ../libtdsodbc.la ../../tds/unittests/libcommon.a -shared $(GLOBAL_LD_ADD) stats_SOURCES = stats.c descrec_SOURCES = descrec.c peter_SOURCES = peter.c test64_SOURCES = test64.c prepare_warn_SOURCES = prepare_warn.c long_error_SOURCES = long_error.c mars1_SOURCES = mars1.c array_error_SOURCES = array_error.c closestmt_SOURCES = closestmt.c oldpwd_SOURCES = oldpwd.c # this test cannot work using wide characters as use UTF-8 and single byte encoding oldpwd_CPPFLAGS = $(GLOBAL_CPPFLAGS) bcp_SOURCES = bcp.c all_types_SOURCES = all_types.c all_types_LDFLAGS = -static ../libtdsodbc.la ../../tds/unittests/libcommon.a -shared $(GLOBAL_LD_ADD) empty_query_SOURCES = empty_query.c transaction3_SOURCES = transaction3.c transaction4_SOURCES = transaction4.c qn_SOURCES = qn.c noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h GLOBAL_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_TOPDIR=\"$(top_srcdir)\" GLOBAL_LD_ADD = $(NETWORK_LIBS) $(ODBCINST_LDFLAGS) AM_CPPFLAGS = $(GLOBAL_CPPFLAGS) $(am__append_1) @MINGW32_FALSE@AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" @MINGW32_TRUE@AM_LDFLAGS = -no-fast-install LDADD = libcommon.a $(ODBC_LDFLAGS) ../../replacements/libreplacements.la $(GLOBAL_LD_ADD) DISTCLEANFILES = odbc.ini odbcinst.ini EXTRA_DIST = CMakeLists.txt all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/odbc/unittests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/odbc/unittests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) $(EXTRA_libcommon_a_DEPENDENCIES) $(AM_V_at)-rm -f libcommon.a $(AM_V_AR)$(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) $(AM_V_at)$(RANLIB) libcommon.a all_types$(EXEEXT): $(all_types_OBJECTS) $(all_types_DEPENDENCIES) $(EXTRA_all_types_DEPENDENCIES) @rm -f all_types$(EXEEXT) $(AM_V_CCLD)$(all_types_LINK) $(all_types_OBJECTS) $(all_types_LDADD) $(LIBS) array$(EXEEXT): $(array_OBJECTS) $(array_DEPENDENCIES) $(EXTRA_array_DEPENDENCIES) @rm -f array$(EXEEXT) $(AM_V_CCLD)$(LINK) $(array_OBJECTS) $(array_LDADD) $(LIBS) array_error$(EXEEXT): $(array_error_OBJECTS) $(array_error_DEPENDENCIES) $(EXTRA_array_error_DEPENDENCIES) @rm -f array_error$(EXEEXT) $(AM_V_CCLD)$(LINK) $(array_error_OBJECTS) $(array_error_LDADD) $(LIBS) array_out$(EXEEXT): $(array_out_OBJECTS) $(array_out_DEPENDENCIES) $(EXTRA_array_out_DEPENDENCIES) @rm -f array_out$(EXEEXT) $(AM_V_CCLD)$(LINK) $(array_out_OBJECTS) $(array_out_LDADD) $(LIBS) attributes$(EXEEXT): $(attributes_OBJECTS) $(attributes_DEPENDENCIES) $(EXTRA_attributes_DEPENDENCIES) @rm -f attributes$(EXEEXT) $(AM_V_CCLD)$(LINK) $(attributes_OBJECTS) $(attributes_LDADD) $(LIBS) bcp$(EXEEXT): $(bcp_OBJECTS) $(bcp_DEPENDENCIES) $(EXTRA_bcp_DEPENDENCIES) @rm -f bcp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(bcp_OBJECTS) $(bcp_LDADD) $(LIBS) binary_test$(EXEEXT): $(binary_test_OBJECTS) $(binary_test_DEPENDENCIES) $(EXTRA_binary_test_DEPENDENCIES) @rm -f binary_test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(binary_test_OBJECTS) $(binary_test_LDADD) $(LIBS) blob1$(EXEEXT): $(blob1_OBJECTS) $(blob1_DEPENDENCIES) $(EXTRA_blob1_DEPENDENCIES) @rm -f blob1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(blob1_OBJECTS) $(blob1_LDADD) $(LIBS) cancel$(EXEEXT): $(cancel_OBJECTS) $(cancel_DEPENDENCIES) $(EXTRA_cancel_DEPENDENCIES) @rm -f cancel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cancel_OBJECTS) $(cancel_LDADD) $(LIBS) closestmt$(EXEEXT): $(closestmt_OBJECTS) $(closestmt_DEPENDENCIES) $(EXTRA_closestmt_DEPENDENCIES) @rm -f closestmt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(closestmt_OBJECTS) $(closestmt_LDADD) $(LIBS) compute$(EXEEXT): $(compute_OBJECTS) $(compute_DEPENDENCIES) $(EXTRA_compute_DEPENDENCIES) @rm -f compute$(EXEEXT) $(AM_V_CCLD)$(LINK) $(compute_OBJECTS) $(compute_LDADD) $(LIBS) connect$(EXEEXT): $(connect_OBJECTS) $(connect_DEPENDENCIES) $(EXTRA_connect_DEPENDENCIES) @rm -f connect$(EXEEXT) $(AM_V_CCLD)$(connect_LINK) $(connect_OBJECTS) $(connect_LDADD) $(LIBS) connect2$(EXEEXT): $(connect2_OBJECTS) $(connect2_DEPENDENCIES) $(EXTRA_connect2_DEPENDENCIES) @rm -f connect2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(connect2_OBJECTS) $(connect2_LDADD) $(LIBS) const_params$(EXEEXT): $(const_params_OBJECTS) $(const_params_DEPENDENCIES) $(EXTRA_const_params_DEPENDENCIES) @rm -f const_params$(EXEEXT) $(AM_V_CCLD)$(LINK) $(const_params_OBJECTS) $(const_params_LDADD) $(LIBS) convert_error$(EXEEXT): $(convert_error_OBJECTS) $(convert_error_DEPENDENCIES) $(EXTRA_convert_error_DEPENDENCIES) @rm -f convert_error$(EXEEXT) $(AM_V_CCLD)$(LINK) $(convert_error_OBJECTS) $(convert_error_LDADD) $(LIBS) copydesc$(EXEEXT): $(copydesc_OBJECTS) $(copydesc_DEPENDENCIES) $(EXTRA_copydesc_DEPENDENCIES) @rm -f copydesc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(copydesc_OBJECTS) $(copydesc_LDADD) $(LIBS) cursor1$(EXEEXT): $(cursor1_OBJECTS) $(cursor1_DEPENDENCIES) $(EXTRA_cursor1_DEPENDENCIES) @rm -f cursor1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cursor1_OBJECTS) $(cursor1_LDADD) $(LIBS) cursor2$(EXEEXT): $(cursor2_OBJECTS) $(cursor2_DEPENDENCIES) $(EXTRA_cursor2_DEPENDENCIES) @rm -f cursor2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cursor2_OBJECTS) $(cursor2_LDADD) $(LIBS) cursor3$(EXEEXT): $(cursor3_OBJECTS) $(cursor3_DEPENDENCIES) $(EXTRA_cursor3_DEPENDENCIES) @rm -f cursor3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cursor3_OBJECTS) $(cursor3_LDADD) $(LIBS) cursor4$(EXEEXT): $(cursor4_OBJECTS) $(cursor4_DEPENDENCIES) $(EXTRA_cursor4_DEPENDENCIES) @rm -f cursor4$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cursor4_OBJECTS) $(cursor4_LDADD) $(LIBS) cursor5$(EXEEXT): $(cursor5_OBJECTS) $(cursor5_DEPENDENCIES) $(EXTRA_cursor5_DEPENDENCIES) @rm -f cursor5$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cursor5_OBJECTS) $(cursor5_LDADD) $(LIBS) cursor6$(EXEEXT): $(cursor6_OBJECTS) $(cursor6_DEPENDENCIES) $(EXTRA_cursor6_DEPENDENCIES) @rm -f cursor6$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cursor6_OBJECTS) $(cursor6_LDADD) $(LIBS) cursor7$(EXEEXT): $(cursor7_OBJECTS) $(cursor7_DEPENDENCIES) $(EXTRA_cursor7_DEPENDENCIES) @rm -f cursor7$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cursor7_OBJECTS) $(cursor7_LDADD) $(LIBS) data$(EXEEXT): $(data_OBJECTS) $(data_DEPENDENCIES) $(EXTRA_data_DEPENDENCIES) @rm -f data$(EXEEXT) $(AM_V_CCLD)$(LINK) $(data_OBJECTS) $(data_LDADD) $(LIBS) date$(EXEEXT): $(date_OBJECTS) $(date_DEPENDENCIES) $(EXTRA_date_DEPENDENCIES) @rm -f date$(EXEEXT) $(AM_V_CCLD)$(LINK) $(date_OBJECTS) $(date_LDADD) $(LIBS) descrec$(EXEEXT): $(descrec_OBJECTS) $(descrec_DEPENDENCIES) $(EXTRA_descrec_DEPENDENCIES) @rm -f descrec$(EXEEXT) $(AM_V_CCLD)$(LINK) $(descrec_OBJECTS) $(descrec_LDADD) $(LIBS) describecol$(EXEEXT): $(describecol_OBJECTS) $(describecol_DEPENDENCIES) $(EXTRA_describecol_DEPENDENCIES) @rm -f describecol$(EXEEXT) $(AM_V_CCLD)$(LINK) $(describecol_OBJECTS) $(describecol_LDADD) $(LIBS) describecol2$(EXEEXT): $(describecol2_OBJECTS) $(describecol2_DEPENDENCIES) $(EXTRA_describecol2_DEPENDENCIES) @rm -f describecol2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(describecol2_OBJECTS) $(describecol2_LDADD) $(LIBS) earlybind$(EXEEXT): $(earlybind_OBJECTS) $(earlybind_DEPENDENCIES) $(EXTRA_earlybind_DEPENDENCIES) @rm -f earlybind$(EXEEXT) $(AM_V_CCLD)$(LINK) $(earlybind_OBJECTS) $(earlybind_LDADD) $(LIBS) empty_query$(EXEEXT): $(empty_query_OBJECTS) $(empty_query_DEPENDENCIES) $(EXTRA_empty_query_DEPENDENCIES) @rm -f empty_query$(EXEEXT) $(AM_V_CCLD)$(LINK) $(empty_query_OBJECTS) $(empty_query_LDADD) $(LIBS) error$(EXEEXT): $(error_OBJECTS) $(error_DEPENDENCIES) $(EXTRA_error_DEPENDENCIES) @rm -f error$(EXEEXT) $(AM_V_CCLD)$(LINK) $(error_OBJECTS) $(error_LDADD) $(LIBS) freeclose$(EXEEXT): $(freeclose_OBJECTS) $(freeclose_DEPENDENCIES) $(EXTRA_freeclose_DEPENDENCIES) @rm -f freeclose$(EXEEXT) $(AM_V_CCLD)$(LINK) $(freeclose_OBJECTS) $(freeclose_LDADD) $(LIBS) funccall$(EXEEXT): $(funccall_OBJECTS) $(funccall_DEPENDENCIES) $(EXTRA_funccall_DEPENDENCIES) @rm -f funccall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(funccall_OBJECTS) $(funccall_LDADD) $(LIBS) genparams$(EXEEXT): $(genparams_OBJECTS) $(genparams_DEPENDENCIES) $(EXTRA_genparams_DEPENDENCIES) @rm -f genparams$(EXEEXT) $(AM_V_CCLD)$(LINK) $(genparams_OBJECTS) $(genparams_LDADD) $(LIBS) getdata$(EXEEXT): $(getdata_OBJECTS) $(getdata_DEPENDENCIES) $(EXTRA_getdata_DEPENDENCIES) @rm -f getdata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(getdata_OBJECTS) $(getdata_LDADD) $(LIBS) hidden$(EXEEXT): $(hidden_OBJECTS) $(hidden_DEPENDENCIES) $(EXTRA_hidden_DEPENDENCIES) @rm -f hidden$(EXEEXT) $(AM_V_CCLD)$(LINK) $(hidden_OBJECTS) $(hidden_LDADD) $(LIBS) insert_speed$(EXEEXT): $(insert_speed_OBJECTS) $(insert_speed_DEPENDENCIES) $(EXTRA_insert_speed_DEPENDENCIES) @rm -f insert_speed$(EXEEXT) $(AM_V_CCLD)$(LINK) $(insert_speed_OBJECTS) $(insert_speed_LDADD) $(LIBS) lang_error$(EXEEXT): $(lang_error_OBJECTS) $(lang_error_DEPENDENCIES) $(EXTRA_lang_error_DEPENDENCIES) @rm -f lang_error$(EXEEXT) $(AM_V_CCLD)$(LINK) $(lang_error_OBJECTS) $(lang_error_LDADD) $(LIBS) long_error$(EXEEXT): $(long_error_OBJECTS) $(long_error_DEPENDENCIES) $(EXTRA_long_error_DEPENDENCIES) @rm -f long_error$(EXEEXT) $(AM_V_CCLD)$(LINK) $(long_error_OBJECTS) $(long_error_LDADD) $(LIBS) mars1$(EXEEXT): $(mars1_OBJECTS) $(mars1_DEPENDENCIES) $(EXTRA_mars1_DEPENDENCIES) @rm -f mars1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mars1_OBJECTS) $(mars1_LDADD) $(LIBS) moreandcount$(EXEEXT): $(moreandcount_OBJECTS) $(moreandcount_DEPENDENCIES) $(EXTRA_moreandcount_DEPENDENCIES) @rm -f moreandcount$(EXEEXT) $(AM_V_CCLD)$(LINK) $(moreandcount_OBJECTS) $(moreandcount_LDADD) $(LIBS) moreresults$(EXEEXT): $(moreresults_OBJECTS) $(moreresults_DEPENDENCIES) $(EXTRA_moreresults_DEPENDENCIES) @rm -f moreresults$(EXEEXT) $(AM_V_CCLD)$(LINK) $(moreresults_OBJECTS) $(moreresults_LDADD) $(LIBS) norowset$(EXEEXT): $(norowset_OBJECTS) $(norowset_DEPENDENCIES) $(EXTRA_norowset_DEPENDENCIES) @rm -f norowset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(norowset_OBJECTS) $(norowset_LDADD) $(LIBS) oldpwd$(EXEEXT): $(oldpwd_OBJECTS) $(oldpwd_DEPENDENCIES) $(EXTRA_oldpwd_DEPENDENCIES) @rm -f oldpwd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(oldpwd_OBJECTS) $(oldpwd_LDADD) $(LIBS) paramcore$(EXEEXT): $(paramcore_OBJECTS) $(paramcore_DEPENDENCIES) $(EXTRA_paramcore_DEPENDENCIES) @rm -f paramcore$(EXEEXT) $(AM_V_CCLD)$(LINK) $(paramcore_OBJECTS) $(paramcore_LDADD) $(LIBS) params$(EXEEXT): $(params_OBJECTS) $(params_DEPENDENCIES) $(EXTRA_params_DEPENDENCIES) @rm -f params$(EXEEXT) $(AM_V_CCLD)$(LINK) $(params_OBJECTS) $(params_LDADD) $(LIBS) peter$(EXEEXT): $(peter_OBJECTS) $(peter_DEPENDENCIES) $(EXTRA_peter_DEPENDENCIES) @rm -f peter$(EXEEXT) $(AM_V_CCLD)$(LINK) $(peter_OBJECTS) $(peter_LDADD) $(LIBS) prepare_results$(EXEEXT): $(prepare_results_OBJECTS) $(prepare_results_DEPENDENCIES) $(EXTRA_prepare_results_DEPENDENCIES) @rm -f prepare_results$(EXEEXT) $(AM_V_CCLD)$(LINK) $(prepare_results_OBJECTS) $(prepare_results_LDADD) $(LIBS) prepare_warn$(EXEEXT): $(prepare_warn_OBJECTS) $(prepare_warn_DEPENDENCIES) $(EXTRA_prepare_warn_DEPENDENCIES) @rm -f prepare_warn$(EXEEXT) $(AM_V_CCLD)$(LINK) $(prepare_warn_OBJECTS) $(prepare_warn_LDADD) $(LIBS) prepclose$(EXEEXT): $(prepclose_OBJECTS) $(prepclose_DEPENDENCIES) $(EXTRA_prepclose_DEPENDENCIES) @rm -f prepclose$(EXEEXT) $(AM_V_CCLD)$(LINK) $(prepclose_OBJECTS) $(prepclose_LDADD) $(LIBS) preperror$(EXEEXT): $(preperror_OBJECTS) $(preperror_DEPENDENCIES) $(EXTRA_preperror_DEPENDENCIES) @rm -f preperror$(EXEEXT) $(AM_V_CCLD)$(LINK) $(preperror_OBJECTS) $(preperror_LDADD) $(LIBS) print$(EXEEXT): $(print_OBJECTS) $(print_DEPENDENCIES) $(EXTRA_print_DEPENDENCIES) @rm -f print$(EXEEXT) $(AM_V_CCLD)$(LINK) $(print_OBJECTS) $(print_LDADD) $(LIBS) putdata$(EXEEXT): $(putdata_OBJECTS) $(putdata_DEPENDENCIES) $(EXTRA_putdata_DEPENDENCIES) @rm -f putdata$(EXEEXT) $(AM_V_CCLD)$(LINK) $(putdata_OBJECTS) $(putdata_LDADD) $(LIBS) qn$(EXEEXT): $(qn_OBJECTS) $(qn_DEPENDENCIES) $(EXTRA_qn_DEPENDENCIES) @rm -f qn$(EXEEXT) $(AM_V_CCLD)$(LINK) $(qn_OBJECTS) $(qn_LDADD) $(LIBS) raiserror$(EXEEXT): $(raiserror_OBJECTS) $(raiserror_DEPENDENCIES) $(EXTRA_raiserror_DEPENDENCIES) @rm -f raiserror$(EXEEXT) $(AM_V_CCLD)$(LINK) $(raiserror_OBJECTS) $(raiserror_LDADD) $(LIBS) rebindpar$(EXEEXT): $(rebindpar_OBJECTS) $(rebindpar_DEPENDENCIES) $(EXTRA_rebindpar_DEPENDENCIES) @rm -f rebindpar$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rebindpar_OBJECTS) $(rebindpar_LDADD) $(LIBS) rowset$(EXEEXT): $(rowset_OBJECTS) $(rowset_DEPENDENCIES) $(EXTRA_rowset_DEPENDENCIES) @rm -f rowset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rowset_OBJECTS) $(rowset_LDADD) $(LIBS) rpc$(EXEEXT): $(rpc_OBJECTS) $(rpc_DEPENDENCIES) $(EXTRA_rpc_DEPENDENCIES) @rm -f rpc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rpc_OBJECTS) $(rpc_LDADD) $(LIBS) scroll$(EXEEXT): $(scroll_OBJECTS) $(scroll_DEPENDENCIES) $(EXTRA_scroll_DEPENDENCIES) @rm -f scroll$(EXEEXT) $(AM_V_CCLD)$(LINK) $(scroll_OBJECTS) $(scroll_LDADD) $(LIBS) stats$(EXEEXT): $(stats_OBJECTS) $(stats_DEPENDENCIES) $(EXTRA_stats_DEPENDENCIES) @rm -f stats$(EXEEXT) $(AM_V_CCLD)$(LINK) $(stats_OBJECTS) $(stats_LDADD) $(LIBS) t0001$(EXEEXT): $(t0001_OBJECTS) $(t0001_DEPENDENCIES) $(EXTRA_t0001_DEPENDENCIES) @rm -f t0001$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0001_OBJECTS) $(t0001_LDADD) $(LIBS) t0002$(EXEEXT): $(t0002_OBJECTS) $(t0002_DEPENDENCIES) $(EXTRA_t0002_DEPENDENCIES) @rm -f t0002$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0002_OBJECTS) $(t0002_LDADD) $(LIBS) t0003$(EXEEXT): $(t0003_OBJECTS) $(t0003_DEPENDENCIES) $(EXTRA_t0003_DEPENDENCIES) @rm -f t0003$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0003_OBJECTS) $(t0003_LDADD) $(LIBS) tables$(EXEEXT): $(tables_OBJECTS) $(tables_DEPENDENCIES) $(EXTRA_tables_DEPENDENCIES) @rm -f tables$(EXEEXT) $(AM_V_CCLD)$(LINK) $(tables_OBJECTS) $(tables_LDADD) $(LIBS) test64$(EXEEXT): $(test64_OBJECTS) $(test64_DEPENDENCIES) $(EXTRA_test64_DEPENDENCIES) @rm -f test64$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test64_OBJECTS) $(test64_LDADD) $(LIBS) testodbc$(EXEEXT): $(testodbc_OBJECTS) $(testodbc_DEPENDENCIES) $(EXTRA_testodbc_DEPENDENCIES) @rm -f testodbc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(testodbc_OBJECTS) $(testodbc_LDADD) $(LIBS) timeout$(EXEEXT): $(timeout_OBJECTS) $(timeout_DEPENDENCIES) $(EXTRA_timeout_DEPENDENCIES) @rm -f timeout$(EXEEXT) $(AM_V_CCLD)$(LINK) $(timeout_OBJECTS) $(timeout_LDADD) $(LIBS) timeout2$(EXEEXT): $(timeout2_OBJECTS) $(timeout2_DEPENDENCIES) $(EXTRA_timeout2_DEPENDENCIES) @rm -f timeout2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(timeout2_OBJECTS) $(timeout2_LDADD) $(LIBS) timeout3$(EXEEXT): $(timeout3_OBJECTS) $(timeout3_DEPENDENCIES) $(EXTRA_timeout3_DEPENDENCIES) @rm -f timeout3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(timeout3_OBJECTS) $(timeout3_LDADD) $(LIBS) timeout4$(EXEEXT): $(timeout4_OBJECTS) $(timeout4_DEPENDENCIES) $(EXTRA_timeout4_DEPENDENCIES) @rm -f timeout4$(EXEEXT) $(AM_V_CCLD)$(LINK) $(timeout4_OBJECTS) $(timeout4_LDADD) $(LIBS) transaction$(EXEEXT): $(transaction_OBJECTS) $(transaction_DEPENDENCIES) $(EXTRA_transaction_DEPENDENCIES) @rm -f transaction$(EXEEXT) $(AM_V_CCLD)$(LINK) $(transaction_OBJECTS) $(transaction_LDADD) $(LIBS) transaction2$(EXEEXT): $(transaction2_OBJECTS) $(transaction2_DEPENDENCIES) $(EXTRA_transaction2_DEPENDENCIES) @rm -f transaction2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(transaction2_OBJECTS) $(transaction2_LDADD) $(LIBS) transaction3$(EXEEXT): $(transaction3_OBJECTS) $(transaction3_DEPENDENCIES) $(EXTRA_transaction3_DEPENDENCIES) @rm -f transaction3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(transaction3_OBJECTS) $(transaction3_LDADD) $(LIBS) transaction4$(EXEEXT): $(transaction4_OBJECTS) $(transaction4_DEPENDENCIES) $(EXTRA_transaction4_DEPENDENCIES) @rm -f transaction4$(EXEEXT) $(AM_V_CCLD)$(LINK) $(transaction4_OBJECTS) $(transaction4_LDADD) $(LIBS) type$(EXEEXT): $(type_OBJECTS) $(type_DEPENDENCIES) $(EXTRA_type_DEPENDENCIES) @rm -f type$(EXEEXT) $(AM_V_CCLD)$(LINK) $(type_OBJECTS) $(type_LDADD) $(LIBS) typeinfo$(EXEEXT): $(typeinfo_OBJECTS) $(typeinfo_DEPENDENCIES) $(EXTRA_typeinfo_DEPENDENCIES) @rm -f typeinfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(typeinfo_OBJECTS) $(typeinfo_LDADD) $(LIBS) utf8$(EXEEXT): $(utf8_OBJECTS) $(utf8_DEPENDENCIES) $(EXTRA_utf8_DEPENDENCIES) @rm -f utf8$(EXEEXT) $(AM_V_CCLD)$(LINK) $(utf8_OBJECTS) $(utf8_LDADD) $(LIBS) utf8_2$(EXEEXT): $(utf8_2_OBJECTS) $(utf8_2_DEPENDENCIES) $(EXTRA_utf8_2_DEPENDENCIES) @rm -f utf8_2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(utf8_2_OBJECTS) $(utf8_2_LDADD) $(LIBS) utf8_3$(EXEEXT): $(utf8_3_OBJECTS) $(utf8_3_DEPENDENCIES) $(EXTRA_utf8_3_DEPENDENCIES) @rm -f utf8_3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(utf8_3_OBJECTS) $(utf8_3_LDADD) $(LIBS) utf8_4$(EXEEXT): $(utf8_4_OBJECTS) $(utf8_4_DEPENDENCIES) $(EXTRA_utf8_4_DEPENDENCIES) @rm -f utf8_4$(EXEEXT) $(AM_V_CCLD)$(utf8_4_LINK) $(utf8_4_OBJECTS) $(utf8_4_LDADD) $(LIBS) warning$(EXEEXT): $(warning_OBJECTS) $(warning_DEPENDENCIES) $(EXTRA_warning_DEPENDENCIES) @rm -f warning$(EXEEXT) $(AM_V_CCLD)$(LINK) $(warning_OBJECTS) $(warning_LDADD) $(LIBS) wchar$(EXEEXT): $(wchar_OBJECTS) $(wchar_DEPENDENCIES) $(EXTRA_wchar_DEPENDENCIES) @rm -f wchar$(EXEEXT) $(AM_V_CCLD)$(LINK) $(wchar_OBJECTS) $(wchar_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/all_types.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array_error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array_out.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attributes.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binary_test.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blob1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2string.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cancel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/closestmt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compute.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/const_params.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert_error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copydesc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor4.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor5.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor6.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cursor7.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/date.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/descrec.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/describecol.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/describecol2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/earlybind.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empty_query.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freeclose.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funccall.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genparams.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdata.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hidden.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/insert_speed.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lang_error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mars1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moreandcount.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moreresults.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/norowset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oldpwd-oldpwd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paramcore.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/params.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prepare_results.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prepare_warn.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prepclose.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preperror.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/putdata.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qn.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raiserror.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rebindpar.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rowset.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scroll.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stats.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0001.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0002.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0003.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test64.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testodbc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout4.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transaction.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transaction2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transaction3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transaction4.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/type.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/typeinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8-common.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8-utf8.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_3.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_4.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/warning.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wchar.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< oldpwd-oldpwd.o: oldpwd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oldpwd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT oldpwd-oldpwd.o -MD -MP -MF $(DEPDIR)/oldpwd-oldpwd.Tpo -c -o oldpwd-oldpwd.o `test -f 'oldpwd.c' || echo '$(srcdir)/'`oldpwd.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/oldpwd-oldpwd.Tpo $(DEPDIR)/oldpwd-oldpwd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oldpwd.c' object='oldpwd-oldpwd.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oldpwd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o oldpwd-oldpwd.o `test -f 'oldpwd.c' || echo '$(srcdir)/'`oldpwd.c oldpwd-oldpwd.obj: oldpwd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oldpwd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT oldpwd-oldpwd.obj -MD -MP -MF $(DEPDIR)/oldpwd-oldpwd.Tpo -c -o oldpwd-oldpwd.obj `if test -f 'oldpwd.c'; then $(CYGPATH_W) 'oldpwd.c'; else $(CYGPATH_W) '$(srcdir)/oldpwd.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/oldpwd-oldpwd.Tpo $(DEPDIR)/oldpwd-oldpwd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oldpwd.c' object='oldpwd-oldpwd.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(oldpwd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o oldpwd-oldpwd.obj `if test -f 'oldpwd.c'; then $(CYGPATH_W) 'oldpwd.c'; else $(CYGPATH_W) '$(srcdir)/oldpwd.c'; fi` utf8-utf8.o: utf8.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT utf8-utf8.o -MD -MP -MF $(DEPDIR)/utf8-utf8.Tpo -c -o utf8-utf8.o `test -f 'utf8.c' || echo '$(srcdir)/'`utf8.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/utf8-utf8.Tpo $(DEPDIR)/utf8-utf8.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utf8.c' object='utf8-utf8.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o utf8-utf8.o `test -f 'utf8.c' || echo '$(srcdir)/'`utf8.c utf8-utf8.obj: utf8.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT utf8-utf8.obj -MD -MP -MF $(DEPDIR)/utf8-utf8.Tpo -c -o utf8-utf8.obj `if test -f 'utf8.c'; then $(CYGPATH_W) 'utf8.c'; else $(CYGPATH_W) '$(srcdir)/utf8.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/utf8-utf8.Tpo $(DEPDIR)/utf8-utf8.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utf8.c' object='utf8-utf8.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o utf8-utf8.obj `if test -f 'utf8.c'; then $(CYGPATH_W) 'utf8.c'; else $(CYGPATH_W) '$(srcdir)/utf8.c'; fi` utf8-common.o: common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT utf8-common.o -MD -MP -MF $(DEPDIR)/utf8-common.Tpo -c -o utf8-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/utf8-common.Tpo $(DEPDIR)/utf8-common.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='utf8-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o utf8-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c utf8-common.obj: common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT utf8-common.obj -MD -MP -MF $(DEPDIR)/utf8-common.Tpo -c -o utf8-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/utf8-common.Tpo $(DEPDIR)/utf8-common.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='utf8-common.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(utf8_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o utf8-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? t0001.log: t0001$(EXEEXT) @p='t0001$(EXEEXT)'; \ b='t0001'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0002.log: t0002$(EXEEXT) @p='t0002$(EXEEXT)'; \ b='t0002'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0003.log: t0003$(EXEEXT) @p='t0003$(EXEEXT)'; \ b='t0003'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) moreresults.log: moreresults$(EXEEXT) @p='moreresults$(EXEEXT)'; \ b='moreresults'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) connect.log: connect$(EXEEXT) @p='connect$(EXEEXT)'; \ b='connect'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) print.log: print$(EXEEXT) @p='print$(EXEEXT)'; \ b='print'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) date.log: date$(EXEEXT) @p='date$(EXEEXT)'; \ b='date'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) norowset.log: norowset$(EXEEXT) @p='norowset$(EXEEXT)'; \ b='norowset'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) funccall.log: funccall$(EXEEXT) @p='funccall$(EXEEXT)'; \ b='funccall'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) lang_error.log: lang_error$(EXEEXT) @p='lang_error$(EXEEXT)'; \ b='lang_error'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) tables.log: tables$(EXEEXT) @p='tables$(EXEEXT)'; \ b='tables'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) binary_test.log: binary_test$(EXEEXT) @p='binary_test$(EXEEXT)'; \ b='binary_test'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) moreandcount.log: moreandcount$(EXEEXT) @p='moreandcount$(EXEEXT)'; \ b='moreandcount'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) earlybind.log: earlybind$(EXEEXT) @p='earlybind$(EXEEXT)'; \ b='earlybind'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) putdata.log: putdata$(EXEEXT) @p='putdata$(EXEEXT)'; \ b='putdata'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) params.log: params$(EXEEXT) @p='params$(EXEEXT)'; \ b='params'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) raiserror.log: raiserror$(EXEEXT) @p='raiserror$(EXEEXT)'; \ b='raiserror'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) getdata.log: getdata$(EXEEXT) @p='getdata$(EXEEXT)'; \ b='getdata'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) transaction.log: transaction$(EXEEXT) @p='transaction$(EXEEXT)'; \ b='transaction'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) type.log: type$(EXEEXT) @p='type$(EXEEXT)'; \ b='type'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) genparams.log: genparams$(EXEEXT) @p='genparams$(EXEEXT)'; \ b='genparams'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) preperror.log: preperror$(EXEEXT) @p='preperror$(EXEEXT)'; \ b='preperror'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) prepare_results.log: prepare_results$(EXEEXT) @p='prepare_results$(EXEEXT)'; \ b='prepare_results'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) testodbc.log: testodbc$(EXEEXT) @p='testodbc$(EXEEXT)'; \ b='testodbc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) data.log: data$(EXEEXT) @p='data$(EXEEXT)'; \ b='data'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) error.log: error$(EXEEXT) @p='error$(EXEEXT)'; \ b='error'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) rebindpar.log: rebindpar$(EXEEXT) @p='rebindpar$(EXEEXT)'; \ b='rebindpar'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) rpc.log: rpc$(EXEEXT) @p='rpc$(EXEEXT)'; \ b='rpc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) convert_error.log: convert_error$(EXEEXT) @p='convert_error$(EXEEXT)'; \ b='convert_error'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) typeinfo.log: typeinfo$(EXEEXT) @p='typeinfo$(EXEEXT)'; \ b='typeinfo'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) const_params.log: const_params$(EXEEXT) @p='const_params$(EXEEXT)'; \ b='const_params'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) insert_speed.log: insert_speed$(EXEEXT) @p='insert_speed$(EXEEXT)'; \ b='insert_speed'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) compute.log: compute$(EXEEXT) @p='compute$(EXEEXT)'; \ b='compute'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) timeout.log: timeout$(EXEEXT) @p='timeout$(EXEEXT)'; \ b='timeout'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) array.log: array$(EXEEXT) @p='array$(EXEEXT)'; \ b='array'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) array_out.log: array_out$(EXEEXT) @p='array_out$(EXEEXT)'; \ b='array_out'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cursor1.log: cursor1$(EXEEXT) @p='cursor1$(EXEEXT)'; \ b='cursor1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) scroll.log: scroll$(EXEEXT) @p='scroll$(EXEEXT)'; \ b='scroll'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cursor2.log: cursor2$(EXEEXT) @p='cursor2$(EXEEXT)'; \ b='cursor2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) describecol.log: describecol$(EXEEXT) @p='describecol$(EXEEXT)'; \ b='describecol'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) copydesc.log: copydesc$(EXEEXT) @p='copydesc$(EXEEXT)'; \ b='copydesc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) prepclose.log: prepclose$(EXEEXT) @p='prepclose$(EXEEXT)'; \ b='prepclose'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) warning.log: warning$(EXEEXT) @p='warning$(EXEEXT)'; \ b='warning'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) paramcore.log: paramcore$(EXEEXT) @p='paramcore$(EXEEXT)'; \ b='paramcore'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) timeout2.log: timeout2$(EXEEXT) @p='timeout2$(EXEEXT)'; \ b='timeout2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) timeout3.log: timeout3$(EXEEXT) @p='timeout3$(EXEEXT)'; \ b='timeout3'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) connect2.log: connect2$(EXEEXT) @p='connect2$(EXEEXT)'; \ b='connect2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) timeout4.log: timeout4$(EXEEXT) @p='timeout4$(EXEEXT)'; \ b='timeout4'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) freeclose.log: freeclose$(EXEEXT) @p='freeclose$(EXEEXT)'; \ b='freeclose'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cursor3.log: cursor3$(EXEEXT) @p='cursor3$(EXEEXT)'; \ b='cursor3'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cursor4.log: cursor4$(EXEEXT) @p='cursor4$(EXEEXT)'; \ b='cursor4'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cursor5.log: cursor5$(EXEEXT) @p='cursor5$(EXEEXT)'; \ b='cursor5'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) attributes.log: attributes$(EXEEXT) @p='attributes$(EXEEXT)'; \ b='attributes'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) hidden.log: hidden$(EXEEXT) @p='hidden$(EXEEXT)'; \ b='hidden'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) blob1.log: blob1$(EXEEXT) @p='blob1$(EXEEXT)'; \ b='blob1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cancel.log: cancel$(EXEEXT) @p='cancel$(EXEEXT)'; \ b='cancel'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) wchar.log: wchar$(EXEEXT) @p='wchar$(EXEEXT)'; \ b='wchar'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) rowset.log: rowset$(EXEEXT) @p='rowset$(EXEEXT)'; \ b='rowset'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) transaction2.log: transaction2$(EXEEXT) @p='transaction2$(EXEEXT)'; \ b='transaction2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cursor6.log: cursor6$(EXEEXT) @p='cursor6$(EXEEXT)'; \ b='cursor6'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cursor7.log: cursor7$(EXEEXT) @p='cursor7$(EXEEXT)'; \ b='cursor7'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8.log: utf8$(EXEEXT) @p='utf8$(EXEEXT)'; \ b='utf8'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8_2.log: utf8_2$(EXEEXT) @p='utf8_2$(EXEEXT)'; \ b='utf8_2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8_3.log: utf8_3$(EXEEXT) @p='utf8_3$(EXEEXT)'; \ b='utf8_3'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) stats.log: stats$(EXEEXT) @p='stats$(EXEEXT)'; \ b='stats'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) descrec.log: descrec$(EXEEXT) @p='descrec$(EXEEXT)'; \ b='descrec'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) peter.log: peter$(EXEEXT) @p='peter$(EXEEXT)'; \ b='peter'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test64.log: test64$(EXEEXT) @p='test64$(EXEEXT)'; \ b='test64'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) prepare_warn.log: prepare_warn$(EXEEXT) @p='prepare_warn$(EXEEXT)'; \ b='prepare_warn'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) long_error.log: long_error$(EXEEXT) @p='long_error$(EXEEXT)'; \ b='long_error'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) mars1.log: mars1$(EXEEXT) @p='mars1$(EXEEXT)'; \ b='mars1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) array_error.log: array_error$(EXEEXT) @p='array_error$(EXEEXT)'; \ b='array_error'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) describecol2.log: describecol2$(EXEEXT) @p='describecol2$(EXEEXT)'; \ b='describecol2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) closestmt.log: closestmt$(EXEEXT) @p='closestmt$(EXEEXT)'; \ b='closestmt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bcp.log: bcp$(EXEEXT) @p='bcp$(EXEEXT)'; \ b='bcp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) all_types.log: all_types$(EXEEXT) @p='all_types$(EXEEXT)'; \ b='all_types'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) empty_query.log: empty_query$(EXEEXT) @p='empty_query$(EXEEXT)'; \ b='empty_query'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) transaction3.log: transaction3$(EXEEXT) @p='transaction3$(EXEEXT)'; \ b='transaction3'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) transaction4.log: transaction4$(EXEEXT) @p='transaction4$(EXEEXT)'; \ b='transaction4'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8_4.log: utf8_4$(EXEEXT) @p='utf8_4$(EXEEXT)'; \ b='utf8_4'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) qn.log: qn$(EXEEXT) @p='qn$(EXEEXT)'; \ b='qn'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/all_types.Po -rm -f ./$(DEPDIR)/array.Po -rm -f ./$(DEPDIR)/array_error.Po -rm -f ./$(DEPDIR)/array_out.Po -rm -f ./$(DEPDIR)/attributes.Po -rm -f ./$(DEPDIR)/bcp.Po -rm -f ./$(DEPDIR)/binary_test.Po -rm -f ./$(DEPDIR)/blob1.Po -rm -f ./$(DEPDIR)/c2string.Po -rm -f ./$(DEPDIR)/cancel.Po -rm -f ./$(DEPDIR)/closestmt.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/compute.Po -rm -f ./$(DEPDIR)/connect.Po -rm -f ./$(DEPDIR)/connect2.Po -rm -f ./$(DEPDIR)/const_params.Po -rm -f ./$(DEPDIR)/convert_error.Po -rm -f ./$(DEPDIR)/copydesc.Po -rm -f ./$(DEPDIR)/cursor1.Po -rm -f ./$(DEPDIR)/cursor2.Po -rm -f ./$(DEPDIR)/cursor3.Po -rm -f ./$(DEPDIR)/cursor4.Po -rm -f ./$(DEPDIR)/cursor5.Po -rm -f ./$(DEPDIR)/cursor6.Po -rm -f ./$(DEPDIR)/cursor7.Po -rm -f ./$(DEPDIR)/data.Po -rm -f ./$(DEPDIR)/date.Po -rm -f ./$(DEPDIR)/descrec.Po -rm -f ./$(DEPDIR)/describecol.Po -rm -f ./$(DEPDIR)/describecol2.Po -rm -f ./$(DEPDIR)/earlybind.Po -rm -f ./$(DEPDIR)/empty_query.Po -rm -f ./$(DEPDIR)/error.Po -rm -f ./$(DEPDIR)/freeclose.Po -rm -f ./$(DEPDIR)/funccall.Po -rm -f ./$(DEPDIR)/genparams.Po -rm -f ./$(DEPDIR)/getdata.Po -rm -f ./$(DEPDIR)/hidden.Po -rm -f ./$(DEPDIR)/insert_speed.Po -rm -f ./$(DEPDIR)/lang_error.Po -rm -f ./$(DEPDIR)/long_error.Po -rm -f ./$(DEPDIR)/mars1.Po -rm -f ./$(DEPDIR)/moreandcount.Po -rm -f ./$(DEPDIR)/moreresults.Po -rm -f ./$(DEPDIR)/norowset.Po -rm -f ./$(DEPDIR)/oldpwd-oldpwd.Po -rm -f ./$(DEPDIR)/paramcore.Po -rm -f ./$(DEPDIR)/params.Po -rm -f ./$(DEPDIR)/parser.Po -rm -f ./$(DEPDIR)/peter.Po -rm -f ./$(DEPDIR)/prepare_results.Po -rm -f ./$(DEPDIR)/prepare_warn.Po -rm -f ./$(DEPDIR)/prepclose.Po -rm -f ./$(DEPDIR)/preperror.Po -rm -f ./$(DEPDIR)/print.Po -rm -f ./$(DEPDIR)/putdata.Po -rm -f ./$(DEPDIR)/qn.Po -rm -f ./$(DEPDIR)/raiserror.Po -rm -f ./$(DEPDIR)/rebindpar.Po -rm -f ./$(DEPDIR)/rowset.Po -rm -f ./$(DEPDIR)/rpc.Po -rm -f ./$(DEPDIR)/scroll.Po -rm -f ./$(DEPDIR)/stats.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/tables.Po -rm -f ./$(DEPDIR)/test64.Po -rm -f ./$(DEPDIR)/testodbc.Po -rm -f ./$(DEPDIR)/timeout.Po -rm -f ./$(DEPDIR)/timeout2.Po -rm -f ./$(DEPDIR)/timeout3.Po -rm -f ./$(DEPDIR)/timeout4.Po -rm -f ./$(DEPDIR)/transaction.Po -rm -f ./$(DEPDIR)/transaction2.Po -rm -f ./$(DEPDIR)/transaction3.Po -rm -f ./$(DEPDIR)/transaction4.Po -rm -f ./$(DEPDIR)/type.Po -rm -f ./$(DEPDIR)/typeinfo.Po -rm -f ./$(DEPDIR)/utf8-common.Po -rm -f ./$(DEPDIR)/utf8-utf8.Po -rm -f ./$(DEPDIR)/utf8_2.Po -rm -f ./$(DEPDIR)/utf8_3.Po -rm -f ./$(DEPDIR)/utf8_4.Po -rm -f ./$(DEPDIR)/warning.Po -rm -f ./$(DEPDIR)/wchar.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/all_types.Po -rm -f ./$(DEPDIR)/array.Po -rm -f ./$(DEPDIR)/array_error.Po -rm -f ./$(DEPDIR)/array_out.Po -rm -f ./$(DEPDIR)/attributes.Po -rm -f ./$(DEPDIR)/bcp.Po -rm -f ./$(DEPDIR)/binary_test.Po -rm -f ./$(DEPDIR)/blob1.Po -rm -f ./$(DEPDIR)/c2string.Po -rm -f ./$(DEPDIR)/cancel.Po -rm -f ./$(DEPDIR)/closestmt.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/compute.Po -rm -f ./$(DEPDIR)/connect.Po -rm -f ./$(DEPDIR)/connect2.Po -rm -f ./$(DEPDIR)/const_params.Po -rm -f ./$(DEPDIR)/convert_error.Po -rm -f ./$(DEPDIR)/copydesc.Po -rm -f ./$(DEPDIR)/cursor1.Po -rm -f ./$(DEPDIR)/cursor2.Po -rm -f ./$(DEPDIR)/cursor3.Po -rm -f ./$(DEPDIR)/cursor4.Po -rm -f ./$(DEPDIR)/cursor5.Po -rm -f ./$(DEPDIR)/cursor6.Po -rm -f ./$(DEPDIR)/cursor7.Po -rm -f ./$(DEPDIR)/data.Po -rm -f ./$(DEPDIR)/date.Po -rm -f ./$(DEPDIR)/descrec.Po -rm -f ./$(DEPDIR)/describecol.Po -rm -f ./$(DEPDIR)/describecol2.Po -rm -f ./$(DEPDIR)/earlybind.Po -rm -f ./$(DEPDIR)/empty_query.Po -rm -f ./$(DEPDIR)/error.Po -rm -f ./$(DEPDIR)/freeclose.Po -rm -f ./$(DEPDIR)/funccall.Po -rm -f ./$(DEPDIR)/genparams.Po -rm -f ./$(DEPDIR)/getdata.Po -rm -f ./$(DEPDIR)/hidden.Po -rm -f ./$(DEPDIR)/insert_speed.Po -rm -f ./$(DEPDIR)/lang_error.Po -rm -f ./$(DEPDIR)/long_error.Po -rm -f ./$(DEPDIR)/mars1.Po -rm -f ./$(DEPDIR)/moreandcount.Po -rm -f ./$(DEPDIR)/moreresults.Po -rm -f ./$(DEPDIR)/norowset.Po -rm -f ./$(DEPDIR)/oldpwd-oldpwd.Po -rm -f ./$(DEPDIR)/paramcore.Po -rm -f ./$(DEPDIR)/params.Po -rm -f ./$(DEPDIR)/parser.Po -rm -f ./$(DEPDIR)/peter.Po -rm -f ./$(DEPDIR)/prepare_results.Po -rm -f ./$(DEPDIR)/prepare_warn.Po -rm -f ./$(DEPDIR)/prepclose.Po -rm -f ./$(DEPDIR)/preperror.Po -rm -f ./$(DEPDIR)/print.Po -rm -f ./$(DEPDIR)/putdata.Po -rm -f ./$(DEPDIR)/qn.Po -rm -f ./$(DEPDIR)/raiserror.Po -rm -f ./$(DEPDIR)/rebindpar.Po -rm -f ./$(DEPDIR)/rowset.Po -rm -f ./$(DEPDIR)/rpc.Po -rm -f ./$(DEPDIR)/scroll.Po -rm -f ./$(DEPDIR)/stats.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/tables.Po -rm -f ./$(DEPDIR)/test64.Po -rm -f ./$(DEPDIR)/testodbc.Po -rm -f ./$(DEPDIR)/timeout.Po -rm -f ./$(DEPDIR)/timeout2.Po -rm -f ./$(DEPDIR)/timeout3.Po -rm -f ./$(DEPDIR)/timeout4.Po -rm -f ./$(DEPDIR)/transaction.Po -rm -f ./$(DEPDIR)/transaction2.Po -rm -f ./$(DEPDIR)/transaction3.Po -rm -f ./$(DEPDIR)/transaction4.Po -rm -f ./$(DEPDIR)/type.Po -rm -f ./$(DEPDIR)/typeinfo.Po -rm -f ./$(DEPDIR)/utf8-common.Po -rm -f ./$(DEPDIR)/utf8-utf8.Po -rm -f ./$(DEPDIR)/utf8_2.Po -rm -f ./$(DEPDIR)/utf8_3.Po -rm -f ./$(DEPDIR)/utf8_4.Po -rm -f ./$(DEPDIR)/warning.Po -rm -f ./$(DEPDIR)/wchar.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am recheck tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/odbc/unittests/common.c000644 025423 025423 00000053274 14056414271 022016 0ustar00fredianofrediano000000 000000 #include "common.h" #include #include #include #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if defined(UNIXODBC) || defined(_WIN32) #include #endif #ifndef _WIN32 #include #else #define TDS_SDIR_SEPARATOR "\\" #endif #include HENV odbc_env; HDBC odbc_conn; HSTMT odbc_stmt; int odbc_use_version3 = 0; void (*odbc_set_conn_attr)(void) = NULL; const char *odbc_conn_additional_params = NULL; char odbc_user[512]; char odbc_server[512]; char odbc_password[512]; char odbc_database[512]; char odbc_driver[1024]; static int freetds_driver = -1; static int tds_version = -1; static char db_str_version[32]; static int check_lib(char *path, const char *file) { int len = strlen(path); FILE *f; strcat(path, file); f = fopen(path, "rb"); if (f) { fclose(f); return 1; } path[len] = 0; return 0; } /* this should be extended with all possible systems... */ static const char *const search_driver[] = { ".libs/libtdsodbc.so", ".libs/libtdsodbc.sl", ".libs/libtdsodbc.dylib", ".libs/libtdsodbc.dll", "_libs/libtdsodbc.dll", "debug/tdsodbc.dll", "release/tdsodbc.dll", "libtdsodbc.so", "tdsodbc.dll", NULL }; int odbc_read_login_info(void) { static const char *PWD = "../../../PWD"; FILE *in = NULL; char line[512]; char *s1, *s2; const char *const *search_p; char path[1024]; int len; int ini_override = 1; #if defined(_WIN32) && !defined(TDS_NO_DM) UWORD old_config_mode; #endif setbuf(stdout, NULL); setbuf(stderr, NULL); s1 = getenv("TDSPWDFILE"); if (s1 && s1[0]) in = fopen(s1, "r"); if (!in) in = fopen(PWD, "r"); if (!in) in = fopen("PWD", "r"); if (!in) { fprintf(stderr, "Can not open PWD file\n\n"); return 1; } while (fgets(line, 512, in)) { s1 = strtok(line, "="); s2 = strtok(NULL, "\n"); if (!s1 || !s2) continue; if (!strcmp(s1, "UID")) { strcpy(odbc_user, s2); } else if (!strcmp(s1, "SRV")) { strcpy(odbc_server, s2); } else if (!strcmp(s1, "PWD")) { strcpy(odbc_password, s2); } else if (!strcmp(s1, "DB")) { strcpy(odbc_database, s2); } } fclose(in); /* find our driver */ #ifndef _WIN32 if (!getcwd(path, sizeof(path))) #else if (!_getcwd(path, sizeof(path))) #endif return 0; #ifdef __VMS { /* A hard-coded driver path has to be in unix syntax to be recognized as such. */ const char *unixspec = decc$translate_vms(path); if ( (int)unixspec != 0 && (int)unixspec != -1 ) strcpy(path, unixspec); } #endif len = strlen(path); if (len < 10 || (strcasecmp(path + len - 10, "/unittests") != 0 #ifdef _WIN32 && strcasecmp(path + len - 10, "\\unittests") != 0 #endif )) return 0; path[len - 9] = 0; for (search_p = search_driver; *search_p; ++search_p) { if (check_lib(path, *search_p)) break; } if (!*search_p) return 0; strcpy(odbc_driver, path); s1 = getenv("TDSINIOVERRIDE"); if (s1 && atoi(s1) == 0) ini_override = 0; #if !defined(_WIN32) || defined(TDS_NO_DM) /* craft out odbc.ini, avoid to read wrong one */ sprintf(path, "odbc.ini.%d", (int) getpid()); in = fopen(path, "w"); if (in) { fprintf(in, "[%s]\nDriver = %s\nDatabase = %s\nServername = %s\n", odbc_server, odbc_driver, odbc_database, odbc_server); fclose(in); if (ini_override) { setenv("ODBCINI", "./odbc.ini", 1); setenv("SYSODBCINI", "./odbc.ini", 1); rename(path, "odbc.ini"); } unlink(path); } #else if (ini_override && SQLGetConfigMode(&old_config_mode)) { ODBC_BUF *odbc_buf = NULL; SQLSetConfigMode(ODBC_USER_DSN); SQLWritePrivateProfileString(T(odbc_server), T("Driver"), T(odbc_driver), T("odbc.ini")); SQLWritePrivateProfileString(T(odbc_server), T("Database"), T(odbc_database), T("odbc.ini")); SQLWritePrivateProfileString(T(odbc_server), T("Servername"), T(odbc_server), T("odbc.ini")); SQLSetConfigMode(old_config_mode); ODBC_FREE(); } #endif return 0; } void odbc_report_error(const char *errmsg, int line, const char *file) { SQLSMALLINT handletype; SQLHANDLE handle; SQLRETURN ret; SQLTCHAR sqlstate[6]; SQLTCHAR msg[256]; ODBC_BUF *odbc_buf = NULL; if (odbc_stmt) { handletype = SQL_HANDLE_STMT; handle = odbc_stmt; } else if (odbc_conn) { handletype = SQL_HANDLE_DBC; handle = odbc_conn; } else { handletype = SQL_HANDLE_ENV; handle = odbc_env; } if (errmsg[0]) { if (line) fprintf(stderr, "%s:%d %s\n", file, line, errmsg); else fprintf(stderr, "%s\n", errmsg); } ret = SQLGetDiagRec(handletype, handle, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(msg), NULL); if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) fprintf(stderr, "SQL error %s -- %s\n", C(sqlstate), C(msg)); odbc_disconnect(); ODBC_FREE(); exit(1); } static void ReportODBCError(const char *errmsg, SQLSMALLINT handletype, SQLHANDLE handle, SQLRETURN rc, int line, const char *file) { SQLRETURN ret; SQLTCHAR sqlstate[6]; SQLTCHAR msg[256]; ODBC_BUF *odbc_buf = NULL; if (errmsg[0]) { if (line) fprintf(stderr, "%s:%d rc=%d %s\n", file, line, (int) rc, errmsg); else fprintf(stderr, "rc=%d %s\n", (int) rc, errmsg); } ret = SQLGetDiagRec(handletype, handle, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(msg), NULL); if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) fprintf(stderr, "SQL error %s -- %s\n", C(sqlstate), C(msg)); odbc_disconnect(); ODBC_FREE(); exit(1); } int odbc_connect(void) { ODBC_BUF *odbc_buf = NULL; char command[512+10]; const char *p; if (odbc_read_login_info()) exit(1); if (odbc_use_version3) { CHKAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &odbc_env, "S"); SQLSetEnvAttr(odbc_env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (SQL_OV_ODBC3), SQL_IS_UINTEGER); CHKAllocHandle(SQL_HANDLE_DBC, odbc_env, &odbc_conn, "S"); } else { CHKAllocEnv(&odbc_env, "S"); CHKAllocConnect(&odbc_conn, "S"); } printf("odbctest\n--------\n\n"); printf("connection parameters:\nserver: '%s'\nuser: '%s'\npassword: '%s'\ndatabase: '%s'\n", odbc_server, odbc_user, "????" /* odbc_password */ , odbc_database); p = getenv("ODBC_MARS"); if (p && atoi(p) != 0) SQLSetConnectAttr(odbc_conn, 1224 /*SQL_COPT_SS_MARS_ENABLED*/, (SQLPOINTER) 1 /*SQL_MARS_ENABLED_YES*/, SQL_IS_UINTEGER); if (odbc_set_conn_attr) (*odbc_set_conn_attr)(); if (!odbc_conn_additional_params) { CHKConnect(T(odbc_server), SQL_NTS, T(odbc_user), SQL_NTS, T(odbc_password), SQL_NTS, "SI"); } else { char *params; SQLSMALLINT len; asprintf(¶ms, "DSN=%s;UID=%s;PWD=%s;DATABASE=%s;%s", odbc_server, odbc_user, odbc_password, odbc_database, odbc_conn_additional_params); assert(params); CHKDriverConnect(NULL, T(params), SQL_NTS, (SQLTCHAR *) command, sizeof(command)/sizeof(SQLTCHAR), &len, SQL_DRIVER_NOPROMPT, "SI"); free(params); } CHKAllocStmt(&odbc_stmt, "S"); sprintf(command, "use %s", odbc_database); printf("%s\n", command); CHKExecDirect(T(command), SQL_NTS, "SI"); #ifndef TDS_NO_DM /* unixODBC seems to require it */ SQLMoreResults(odbc_stmt); #endif ODBC_FREE(); return 0; } int odbc_disconnect(void) { if (odbc_stmt) { SQLFreeStmt(odbc_stmt, SQL_DROP); odbc_stmt = SQL_NULL_HSTMT; } if (odbc_conn) { SQLDisconnect(odbc_conn); SQLFreeConnect(odbc_conn); odbc_conn = SQL_NULL_HDBC; } if (odbc_env) { SQLFreeEnv(odbc_env); odbc_env = SQL_NULL_HENV; } ODBC_FREE(); freetds_driver = -1; tds_version = -1; db_str_version[0] = 0; return 0; } SQLRETURN odbc_command_with_result(HSTMT stmt, const char *command) { SQLRETURN ret; ODBC_BUF *odbc_buf = NULL; printf("%s\n", command); ret = SQLExecDirect(stmt, T(command), SQL_NTS); ODBC_FREE(); return ret; } static int ms_db = -1; int odbc_db_is_microsoft(void) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR buf[64]; SQLSMALLINT len; int i; if (ms_db < 0) { buf[0] = 0; SQLGetInfo(odbc_conn, SQL_DBMS_NAME, buf, sizeof(buf), &len); for (i = 0; buf[i]; ++i) buf[i] = tolower(buf[i]); ms_db = (strstr(C(buf), "microsoft") != NULL); } ODBC_FREE(); return ms_db; } int odbc_driver_is_freetds(void) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR buf[64]; SQLSMALLINT len; int i; if (freetds_driver < 0) { buf[0] = 0; SQLGetInfo(odbc_conn, SQL_DRIVER_NAME, buf, sizeof(buf), &len); for (i = 0; buf[i]; ++i) buf[i] = tolower(buf[i]); freetds_driver = (strstr(C(buf), "tds") != NULL); } ODBC_FREE(); return freetds_driver; } /* Detect protocol version using queries * This to make possible protocol discovery on drivers like MS */ static int odbc_tds_version_long(void) { SQLRETURN ret; SQLSMALLINT scale, nullable, type; SQLULEN prec; ODBC_BUF *odbc_buf = NULL; /* statement must be in a consistent state to do the check */ CHKExecDirect(T("select 1"), SQL_NTS, "S"); odbc_reset_statement(); /* select cast(123 as sql_variant) -> nvarchar('123') is 7.0 failure query is 5.0 ?? */ ret = CHKExecDirect(T("select cast('123' as sql_variant)"), SQL_NTS, "SNoE"); odbc_reset_statement(); if (ret == SQL_ERROR) { ODBC_FREE(); return 0x500; } /* see how bigint is returned, numeric means 7.0 */ CHKExecDirect(T("select cast('123' as bigint)"), SQL_NTS, "S"); CHKDescribeCol(1, NULL, 0, NULL, &type, &prec, &scale, &nullable, "S"); odbc_reset_statement(); if (type == SQL_NUMERIC || type == SQL_DECIMAL) { ODBC_FREE(); return 0x700; } if (type != SQL_BIGINT) { fprintf(stderr, "Strange type returned trying to detect protocol version\n"); odbc_disconnect(); ODBC_FREE(); exit(1); } /* select cast('123' as varchar(max)) -> ??? SQL_VARCHAR is 7.2 ?? */ ret = CHKExecDirect(T("select cast('123' as varchar(max))"), SQL_NTS, "SE"); if (ret == SQL_ERROR) { odbc_reset_statement(); ODBC_FREE(); return 0x701; } CHKDescribeCol(1, NULL, 0, NULL, &type, &prec, &scale, &nullable, "S"); odbc_reset_statement(); if (type == SQL_LONGVARCHAR) { ODBC_FREE(); return 0x701; } if (type != SQL_VARCHAR) { fprintf(stderr, "Strange type returned trying to detect protocol version\n"); odbc_disconnect(); ODBC_FREE(); exit(1); } /* select cast('12:13:14.1234' as time(4)) -> NVARCHAR('12:13:14.1234') is 7.2 else 7.3 */ ret = CHKExecDirect(T("select cast('12:13:14.1234' as time(4))"), SQL_NTS, "SE"); if (ret == SQL_ERROR) { odbc_reset_statement(); ODBC_FREE(); return 0x702; } CHKDescribeCol(1, NULL, 0, NULL, &type, &prec, &scale, &nullable, "S"); odbc_reset_statement(); if (scale == 4) return 0x703; if (scale != 0 || type != SQL_WVARCHAR) { fprintf(stderr, "Strange type or scale returned trying to detect protocol version\n"); odbc_disconnect(); ODBC_FREE(); exit(1); } ODBC_FREE(); return 0x702; } int odbc_tds_version(void) { ODBC_BUF *odbc_buf = NULL; SQLUINTEGER version; SQLSMALLINT len; if (odbc_driver_is_freetds() && tds_version < 0) { version = 0; len = 0; SQLGetInfo(odbc_conn, 1300 /* SQL_INFO_FREETDS_TDS_VERSION */, &version, sizeof(version), &len); if (len == sizeof(version)) tds_version = (version >> 16) << 8 | (version & 0xff); } if (tds_version < 0) { tds_version = odbc_tds_version_long(); } ODBC_FREE(); return tds_version; } const char *odbc_db_version(void) { if (!db_str_version[0]) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR buf[32]; SQLSMALLINT version_len; CHKR(SQLGetInfo, (odbc_conn, SQL_DBMS_VER, buf, sizeof(buf), &version_len), "S"); strcpy(db_str_version, C(buf)); ODBC_FREE(); } return db_str_version; } unsigned int odbc_db_version_int(void) { unsigned int h, l; if (sscanf(odbc_db_version(), "%u.%u.", &h, &l) != 2) { fprintf(stderr, "Wrong db version: %s\n", odbc_db_version()); odbc_disconnect(); exit(1); } return (h << 24) | ((l & 0xFFu) << 16); } void odbc_check_cols(int n, int line, const char * file) { SQLSMALLINT cols; if (n < 0) { CHKNumResultCols(&cols, "E"); return; } CHKNumResultCols(&cols, "S"); if (cols != n) { fprintf(stderr, "%s:%d: Expected %d columns returned %d\n", file, line, n, (int) cols); odbc_disconnect(); exit(1); } } void odbc_check_rows(int n, int line, const char * file) { SQLLEN rows; if (n < -1) { CHKRowCount(&rows, "E"); return; } CHKRowCount(&rows, "S"); if (rows != n) { fprintf(stderr, "%s:%d: Expected %d rows returned %d\n", file, line, n, (int) rows); odbc_disconnect(); exit(1); } } void odbc_reset_statement_proc(SQLHSTMT *stmt, const char *file, int line) { SQLFreeStmt(*stmt, SQL_DROP); *stmt = SQL_NULL_HSTMT; odbc_check_res(file, line, SQLAllocStmt(odbc_conn, stmt), SQL_HANDLE_DBC, odbc_conn, "SQLAllocStmt", "S"); } void odbc_test_skipped(void) { const char *p = getenv("TDS_SKIP_SUCCESS"); if (p && atoi(p) != 0) exit(0); exit(77); } void odbc_check_cursor(void) { SQLRETURN retcode; ODBC_BUF *odbc_buf = NULL; retcode = SQLSetStmtAttr(odbc_stmt, SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_ROWVER, 0); if (retcode != SQL_SUCCESS) { SQLTCHAR output[256]; SQLTCHAR sqlstate[6]; CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, output, TDS_VECTOR_SIZE(output), NULL, "S"); sqlstate[5] = 0; if (strcmp(C(sqlstate), "01S02") == 0) { printf("Your connection seems to not support cursors, probably you are using wrong protocol version or Sybase\n"); odbc_disconnect(); ODBC_FREE(); odbc_test_skipped(); } ReportODBCError("SQLSetStmtAttr", SQL_HANDLE_STMT, odbc_stmt, retcode, __LINE__, __FILE__); } odbc_reset_statement(); ODBC_FREE(); } SQLRETURN odbc_check_res(const char *file, int line, SQLRETURN rc, SQLSMALLINT handle_type, SQLHANDLE handle, const char *func, const char *res) { const char *p = res; for (;;) { if (*p == 'S') { if (rc == SQL_SUCCESS) return rc; ++p; } else if (*p == 'I') { if (rc == SQL_SUCCESS_WITH_INFO) return rc; ++p; } else if (*p == 'E') { if (rc == SQL_ERROR) return rc; ++p; } else if (strncmp(p, "No", 2) == 0) { if (rc == SQL_NO_DATA) return rc; p += 2; } else if (strncmp(p, "Ne", 2) == 0) { if (rc == SQL_NEED_DATA) return rc; p += 2; } else if (!*p) { break; } else { odbc_report_error("Wrong results specified", line, file); return rc; } } ReportODBCError(func, handle_type, handle, rc, line, file); return rc; } SQLSMALLINT odbc_alloc_handle_err_type(SQLSMALLINT type) { switch (type) { case SQL_HANDLE_DESC: return SQL_HANDLE_STMT; case SQL_HANDLE_STMT: return SQL_HANDLE_DBC; case SQL_HANDLE_DBC: return SQL_HANDLE_ENV; } return 0; } SQLRETURN odbc_command_proc(HSTMT stmt, const char *command, const char *file, int line, const char *res) { SQLRETURN ret; ODBC_BUF *odbc_buf = NULL; printf("%s\n", command); ret = odbc_check_res(file, line, SQLExecDirect(stmt, T(command), SQL_NTS), SQL_HANDLE_STMT, stmt, "odbc_command", res); ODBC_FREE(); return ret; } char odbc_err[512]; char odbc_sqlstate[6]; void odbc_read_error(void) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR *err = (SQLTCHAR *) ODBC_GET(sizeof(odbc_err)*sizeof(SQLTCHAR)); SQLTCHAR *state = (SQLTCHAR *) ODBC_GET(sizeof(odbc_sqlstate)*sizeof(SQLTCHAR)); memset(odbc_err, 0, sizeof(odbc_err)); memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, state, NULL, err, sizeof(odbc_err), NULL, "SI"); strcpy(odbc_err, C(err)); strcpy(odbc_sqlstate, C(state)); ODBC_FREE(); printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); } int odbc_to_sqlwchar(SQLWCHAR *dst, const char *src, int n) { int i = n; while (--i >= 0) dst[i] = (unsigned char) src[i]; return n * sizeof(SQLWCHAR); } int odbc_from_sqlwchar(char *dst, const SQLWCHAR *src, int n) { int i; if (n < 0) { const SQLWCHAR *p = src; for (n=1; *p++ != 0; ++n) continue; } for (i = 0; i < n; ++i) { assert(src[i] < 256); dst[i] = (char) src[i]; } return n; } ODBC_BUF *odbc_buf = NULL; void * odbc_buf_add(ODBC_BUF** buf, void *ptr) { ODBC_BUF *p = (ODBC_BUF*) calloc(1, sizeof(ODBC_BUF)); assert(ptr); assert(p); p->buf = ptr; p->next = *buf; *buf = p; return p->buf; } void * odbc_buf_get(ODBC_BUF** buf, size_t s) { return odbc_buf_add(buf, malloc(s)); } void odbc_buf_free(ODBC_BUF** buf) { ODBC_BUF *cur = *buf; *buf = NULL; while (cur) { ODBC_BUF *next = cur->next; free(cur->buf); free(cur); cur = next; } } SQLWCHAR * odbc_get_sqlwchar(ODBC_BUF** buf, const char *s) { size_t l; SQLWCHAR *buffer; if (!s) return NULL; l = strlen(s) + 1; buffer = (SQLWCHAR*) odbc_buf_get(buf, l * sizeof(SQLWCHAR)); odbc_to_sqlwchar(buffer, s, l); return buffer; } char* odbc_get_sqlchar(ODBC_BUF** buf, SQLWCHAR *s) { int n; const SQLWCHAR *p = s; char *out; for (n=1; *p++ != 0; ++n) continue; out = (char *) odbc_buf_get(buf, n); odbc_from_sqlwchar(out, s, n); return out; } char * odbc_buf_asprintf(ODBC_BUF** buf, const char *fmt, ...) { va_list ap; char *ret = NULL; va_start(ap, fmt); vasprintf(&ret, fmt, ap); va_end(ap); return (char *) odbc_buf_add(buf, ret); } typedef union { struct sockaddr sa; struct sockaddr_in sin; char dummy[256]; } long_sockaddr; static int fd_is_socket(int fd) { long_sockaddr addr; socklen_t addr_len; #ifndef _WIN32 struct stat file_stat; if (fstat(fd, &file_stat)) return 0; if ((file_stat.st_mode & S_IFSOCK) != S_IFSOCK) return 0; #endif addr_len = sizeof(addr); if (tds_getpeername((TDS_SYS_SOCKET) fd, &addr.sa, &addr_len)) return 0; addr_len = sizeof(addr); if (tds_getsockname((TDS_SYS_SOCKET) fd, &addr.sa, &addr_len)) return 0; return 1; } enum {NUM_FDS = 4096*4}; static unsigned char fd_bitmask[NUM_FDS / 8]; static int mark_fd(int fd) { unsigned shift; unsigned char mask; if (fd < 0 || fd >= NUM_FDS) return 0; shift = fd & 7; mask = fd_bitmask[fd >> 3]; fd_bitmask[fd >> 3] = mask | (1 << shift); return (mask >> shift) & 1; } #ifdef _WIN32 #define FOR_ALL_SOCKETS(i) for (i = 4; i <= (4096*4); i += 4) #else #define FOR_ALL_SOCKETS(i) for (i = 3; i < 1024; ++i) #endif void odbc_mark_sockets_opened(void) { int i; memset(fd_bitmask, 0, sizeof(fd_bitmask)); FOR_ALL_SOCKETS(i) { if (fd_is_socket(i)) mark_fd(i); } } TDS_SYS_SOCKET odbc_find_last_socket(void) { typedef struct { TDS_SYS_SOCKET sock; int local_port; int remote_port; } sock_info; sock_info found[8]; unsigned num_found = 0, n; int i; SQLULEN sock = 0; SQLSMALLINT len; if (odbc_driver_is_freetds() && SQLGetInfo(odbc_conn, 1301 /* SQL_INFO_FREETDS_SOCKET */, &sock, sizeof(sock), &len) == SQL_SUCCESS && len == sizeof(sock)) return (TDS_SYS_SOCKET) sock; FOR_ALL_SOCKETS(i) { long_sockaddr remote_addr, local_addr; struct sockaddr_in *in; socklen_t remote_addr_len, local_addr_len; sock_info *info; /* check if is a socket */ if (!fd_is_socket(i)) continue; if (mark_fd(i)) continue; remote_addr_len = sizeof(remote_addr); if (tds_getpeername((TDS_SYS_SOCKET) i, &remote_addr.sa, &remote_addr_len)) continue; if (remote_addr.sa.sa_family != AF_INET #ifdef AF_INET6 && remote_addr.sa.sa_family != AF_INET6 #endif ) continue; local_addr_len = sizeof(local_addr); if (tds_getsockname((TDS_SYS_SOCKET) i, &local_addr.sa, &local_addr_len)) continue; /* save in the array */ if (num_found >= 8) { memmove(found, found+1, sizeof(found) - sizeof(found[0])); num_found = 7; } info = &found[num_found++]; info->sock = (TDS_SYS_SOCKET) i; info->local_port = -1; info->remote_port = -1; /* now check if is a socketpair */ in = &remote_addr.sin; if (in->sin_family != AF_INET) continue; if (in->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) continue; info->remote_port = ntohs(in->sin_port); in = &local_addr.sin; if (in->sin_family != AF_INET) continue; if (in->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) continue; info->local_port = ntohs(in->sin_port); for (n = 0; n < num_found - 1; ++n) { if (found[n].remote_port != info->local_port || found[n].local_port != info->remote_port) continue; --num_found; memmove(found+n, found+n+1, num_found-n-1); --num_found; break; } } /* return last */ if (num_found == 0) return INVALID_SOCKET; return found[num_found-1].sock; } void odbc_check_no_row(const char *query) { SQLRETURN rc; rc = CHKExecDirect(T(query), SQL_NTS, "SINo"); if (rc == SQL_NO_DATA) return; do { SQLSMALLINT cols; CHKNumResultCols(&cols, "S"); if (cols != 0) { fprintf(stderr, "Data not expected here, query:\n\t%s\n", query); odbc_disconnect(); exit(1); } } while (CHKMoreResults("SNo") == SQL_SUCCESS); } int odbc_lookup(const char *name, const struct odbc_lookup_int *table, int def) { for (; table->name; ++table) if (strcmp(table->name, name) == 0) return table->value; return def; } const char* odbc_lookup_value(int value, const struct odbc_lookup_int *table, const char *def) { for (; table->name; ++table) if (table->value == value) return table->name; return def; } struct odbc_lookup_int odbc_sql_c_types[] = { #define TYPE(s) { #s, s } TYPE(SQL_C_NUMERIC), TYPE(SQL_C_BINARY), TYPE(SQL_C_CHAR), TYPE(SQL_C_WCHAR), TYPE(SQL_C_LONG), TYPE(SQL_C_SBIGINT), TYPE(SQL_C_SHORT), TYPE(SQL_C_TIMESTAMP), TYPE(SQL_C_FLOAT), TYPE(SQL_C_DOUBLE), TYPE(SQL_C_DEFAULT), TYPE(SQL_C_DATE), TYPE(SQL_C_TIME), TYPE(SQL_C_TYPE_DATE), TYPE(SQL_C_TYPE_TIME), TYPE(SQL_C_TYPE_TIMESTAMP), TYPE(SQL_C_INTERVAL_YEAR), TYPE(SQL_C_INTERVAL_MONTH), TYPE(SQL_C_INTERVAL_DAY), TYPE(SQL_C_INTERVAL_HOUR), TYPE(SQL_C_INTERVAL_MINUTE), TYPE(SQL_C_INTERVAL_SECOND), TYPE(SQL_C_INTERVAL_YEAR_TO_MONTH), TYPE(SQL_C_INTERVAL_DAY_TO_HOUR), TYPE(SQL_C_INTERVAL_DAY_TO_MINUTE), TYPE(SQL_C_INTERVAL_DAY_TO_SECOND), TYPE(SQL_C_INTERVAL_HOUR_TO_MINUTE), TYPE(SQL_C_INTERVAL_HOUR_TO_SECOND), TYPE(SQL_C_INTERVAL_MINUTE_TO_SECOND), TYPE(SQL_C_BIT), TYPE(SQL_C_UBIGINT), TYPE(SQL_C_TINYINT), TYPE(SQL_C_SLONG), TYPE(SQL_C_SSHORT), TYPE(SQL_C_STINYINT), TYPE(SQL_C_ULONG), TYPE(SQL_C_USHORT), TYPE(SQL_C_UTINYINT), TYPE(SQL_C_GUID), #undef TYPE { NULL, 0 } }; freetds-1.3.6/src/odbc/unittests/common.h000644 025423 025423 00000021067 14056414271 022016 0ustar00fredianofrediano000000 000000 #ifdef _WIN32 #define _CRT_SECURE_NO_WARNINGS 1 #include #include #endif #include #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include #ifndef HAVE_SQLLEN #ifndef SQLULEN #define SQLULEN SQLUINTEGER #endif #ifndef SQLLEN #define SQLLEN SQLINTEGER #endif #endif #define FREETDS_SRCDIR FREETDS_TOPDIR "/src/odbc/unittests" extern HENV odbc_env; extern HDBC odbc_conn; extern HSTMT odbc_stmt; extern int odbc_use_version3; extern void (*odbc_set_conn_attr)(void); extern const char *odbc_conn_additional_params; extern char odbc_err[512]; extern char odbc_sqlstate[6]; extern char odbc_user[512]; extern char odbc_server[512]; extern char odbc_password[512]; extern char odbc_database[512]; extern char odbc_driver[1024]; int odbc_read_login_info(void); void odbc_report_error(const char *msg, int line, const char *file); void odbc_read_error(void); void odbc_check_cols(int n, int line, const char * file); void odbc_check_rows(int n, int line, const char * file); #define ODBC_CHECK_ROWS(n) odbc_check_rows(n, __LINE__, __FILE__) #define ODBC_CHECK_COLS(n) odbc_check_cols(n, __LINE__, __FILE__) void odbc_reset_statement_proc(SQLHSTMT *stmt, const char *file, int line); #define odbc_reset_statement() odbc_reset_statement_proc(&odbc_stmt, __FILE__, __LINE__) void odbc_check_cursor(void); void odbc_check_no_row(const char *query); void odbc_test_skipped(void); #define ODBC_REPORT_ERROR(msg) odbc_report_error(msg, __LINE__, __FILE__) SQLRETURN odbc_check_res(const char *file, int line, SQLRETURN rc, SQLSMALLINT handle_type, SQLHANDLE handle, const char *func, const char *res); #define CHKR(func, params, res) \ odbc_check_res(__FILE__, __LINE__, (func params), 0, 0, #func, res) #define CHKR2(func, params, type, handle, res) \ odbc_check_res(__FILE__, __LINE__, (func params), type, handle, #func, res) SQLSMALLINT odbc_alloc_handle_err_type(SQLSMALLINT type); #define CHKAllocConnect(a,res) \ CHKR2(SQLAllocConnect, (odbc_env,a), SQL_HANDLE_ENV, odbc_env, res) #define CHKAllocEnv(a,res) \ CHKR2(SQLAllocEnv, (a), 0, 0, res) #define CHKAllocStmt(a,res) \ CHKR2(SQLAllocStmt, (odbc_conn,a), SQL_HANDLE_DBC, odbc_conn, res) #define CHKAllocHandle(a,b,c,res) \ CHKR2(SQLAllocHandle, (a,b,c), odbc_alloc_handle_err_type(a), b, res) #define CHKBindCol(a,b,c,d,e,res) \ CHKR2(SQLBindCol, (odbc_stmt,a,b,c,d,e), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKBindParameter(a,b,c,d,e,f,g,h,i,res) \ CHKR2(SQLBindParameter, (odbc_stmt,a,b,c,d,e,f,g,h,i), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKCancel(res) \ CHKR2(SQLCancel, (odbc_stmt), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKCloseCursor(res) \ CHKR2(SQLCloseCursor, (odbc_stmt), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKColAttribute(a,b,c,d,e,f,res) \ CHKR2(SQLColAttribute, (odbc_stmt,a,b,c,d,e,f), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKDescribeCol(a,b,c,d,e,f,g,h,res) \ CHKR2(SQLDescribeCol, (odbc_stmt,a,b,c,d,e,f,g,h), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKConnect(a,b,c,d,e,f,res) \ CHKR2(SQLConnect, (odbc_conn,a,b,c,d,e,f), SQL_HANDLE_DBC, odbc_conn, res) #define CHKDriverConnect(a,b,c,d,e,f,g,res) \ CHKR2(SQLDriverConnect, (odbc_conn,a,b,c,d,e,f,g), SQL_HANDLE_DBC, odbc_conn, res) #define CHKEndTran(a,b,c,res) \ CHKR2(SQLEndTran, (a,b,c), a, b, res) #define CHKExecDirect(a,b,res) \ CHKR2(SQLExecDirect, (odbc_stmt,a,b), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKExecute(res) \ CHKR2(SQLExecute, (odbc_stmt), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKExtendedFetch(a,b,c,d,res) \ CHKR2(SQLExtendedFetch, (odbc_stmt,a,b,c,d), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKFetch(res) \ CHKR2(SQLFetch, (odbc_stmt), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKFetchScroll(a,b,res) \ CHKR2(SQLFetchScroll, (odbc_stmt,a,b), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKFreeHandle(a,b,res) \ CHKR2(SQLFreeHandle, (a,b), a, b, res) #define CHKFreeStmt(a,res) \ CHKR2(SQLFreeStmt, (odbc_stmt,a), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKGetConnectAttr(a,b,c,d,res) \ CHKR2(SQLGetConnectAttr, (odbc_conn,a,b,c,d), SQL_HANDLE_DBC, odbc_conn, res) #define CHKGetDiagRec(a,b,c,d,e,f,g,h,res) \ CHKR2(SQLGetDiagRec, (a,b,c,d,e,f,g,h), a, b, res) #define CHKGetDiagField(a,b,c,d,e,f,g,res) \ CHKR2(SQLGetDiagField, (a,b,c,d,e,f,g), a, b, res) #define CHKGetStmtAttr(a,b,c,d,res) \ CHKR2(SQLGetStmtAttr, (odbc_stmt,a,b,c,d), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKGetTypeInfo(a,res) \ CHKR2(SQLGetTypeInfo, (odbc_stmt,a), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKGetData(a,b,c,d,e,res) \ CHKR2(SQLGetData, (odbc_stmt,a,b,c,d,e), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKMoreResults(res) \ CHKR2(SQLMoreResults, (odbc_stmt), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKNumResultCols(a,res) \ CHKR2(SQLNumResultCols, (odbc_stmt,a), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKParamData(a,res) \ CHKR2(SQLParamData, (odbc_stmt,a), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKParamOptions(a,b,res) \ CHKR2(SQLParamOptions, (odbc_stmt,a,b), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKPrepare(a,b,res) \ CHKR2(SQLPrepare, (odbc_stmt,a,b), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKPutData(a,b,res) \ CHKR2(SQLPutData, (odbc_stmt,a,b), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKRowCount(a,res) \ CHKR2(SQLRowCount, (odbc_stmt,a), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKSetConnectAttr(a,b,c,res) \ CHKR2(SQLSetConnectAttr, (odbc_conn,a,b,c), SQL_HANDLE_DBC, odbc_conn, res) #define CHKSetCursorName(a,b,res) \ CHKR2(SQLSetCursorName, (odbc_stmt,a,b), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKSetPos(a,b,c,res) \ CHKR2(SQLSetPos, (odbc_stmt,a,b,c), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKSetStmtAttr(a,b,c,res) \ CHKR2(SQLSetStmtAttr, (odbc_stmt,a,b,c), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKSetStmtOption(a,b,res) \ CHKR2(SQLSetStmtOption, (odbc_stmt,a,b), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKTables(a,b,c,d,e,f,g,h,res) \ CHKR2(SQLTables, (odbc_stmt,a,b,c,d,e,f,g,h), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKProcedureColumns(a,b,c,d,e,f,g,h,res) \ CHKR2(SQLProcedureColumns, (odbc_stmt,a,b,c,d,e,f,g,h), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKColumns(a,b,c,d,e,f,g,h,res) \ CHKR2(SQLColumns, (odbc_stmt,a,b,c,d,e,f,g,h), SQL_HANDLE_STMT, odbc_stmt, res) #define CHKGetDescRec(a,b,c,d,e,f,g,h,i,j,res) \ CHKR2(SQLGetDescRec, (Descriptor,a,b,c,d,e,f,g,h,i,j), SQL_HANDLE_STMT, Descriptor, res) int odbc_connect(void); int odbc_disconnect(void); SQLRETURN odbc_command_proc(HSTMT stmt, const char *command, const char *file, int line, const char *res); #define odbc_command(cmd) odbc_command_proc(odbc_stmt, cmd, __FILE__, __LINE__, "SNo") #define odbc_command2(cmd, res) odbc_command_proc(odbc_stmt, cmd, __FILE__, __LINE__, res) SQLRETURN odbc_command_with_result(HSTMT stmt, const char *command); int odbc_db_is_microsoft(void); const char *odbc_db_version(void); unsigned int odbc_db_version_int(void); int odbc_driver_is_freetds(void); int odbc_tds_version(void); void odbc_mark_sockets_opened(void); TDS_SYS_SOCKET odbc_find_last_socket(void); /** * Converts an ODBC result into a string. * There is no check on destination length, use a buffer big enough. */ void odbc_c2string(char *out, SQLSMALLINT out_c_type, const void *in, size_t in_len); int odbc_to_sqlwchar(SQLWCHAR *dst, const char *src, int n); int odbc_from_sqlwchar(char *dst, const SQLWCHAR *src, int n); typedef struct odbc_buf{ struct odbc_buf *next; void *buf; } ODBC_BUF; extern ODBC_BUF *odbc_buf; void *odbc_buf_add(ODBC_BUF** buf, void *ptr); void *odbc_buf_get(ODBC_BUF** buf, size_t s); void odbc_buf_free(ODBC_BUF** buf); #define ODBC_GET(s) odbc_buf_get(&odbc_buf, s) #define ODBC_FREE() odbc_buf_free(&odbc_buf) SQLWCHAR *odbc_get_sqlwchar(ODBC_BUF** buf, const char *s); char *odbc_get_sqlchar(ODBC_BUF** buf, SQLWCHAR *s); #undef T #ifdef UNICODE /* char to TCHAR */ #define T(s) odbc_get_sqlwchar(&odbc_buf, (s)) /* TCHAR to char */ #define C(s) odbc_get_sqlchar(&odbc_buf, (s)) #else #define T(s) ((SQLCHAR*)(s)) #define C(s) ((char*)(s)) #endif char *odbc_buf_asprintf(ODBC_BUF** buf, const char *fmt, ...); struct odbc_lookup_int { const char *name; int value; }; int odbc_lookup(const char *name, const struct odbc_lookup_int *table, int def); const char *odbc_lookup_value(int value, const struct odbc_lookup_int *table, const char *def); extern struct odbc_lookup_int odbc_sql_c_types[]; freetds-1.3.6/src/odbc/unittests/all_types.c000644 025423 025423 00000005541 14056414222 022510 0ustar00fredianofrediano000000 000000 #undef NDEBUG #include "common.h" #include #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #include "../../tds/unittests/common.h" #include /* Check we support any possible types from the server */ static int sql_c_types[100]; static const char *sql_c_types_names[100]; static unsigned num_c_types = 0; #ifdef _WIN32 HINSTANCE hinstFreeTDS; #endif static TDS_STMT *stmt; static void test_type(TDSSOCKET *tds, TDSCOLUMN *col) { unsigned n; /* check that we can get type information from column */ struct _drecord drec; memset(&drec, 0, sizeof(drec)); odbc_set_sql_type_info(col, &drec, SQL_OV_ODBC3); assert(drec.sql_desc_literal_prefix); assert(drec.sql_desc_literal_suffix); assert(drec.sql_desc_type_name); assert(drec.sql_desc_type_name[0]); /* check we can attempt to convert from any type to any * SQL C type */ for (n = 0; n < num_c_types; ++n) { TDS_CHAR buffer[256]; SQLLEN len; int sql_c_type = sql_c_types[n]; const char *sql_c_type_name = sql_c_types_names[n]; len = odbc_tds2sql_col(stmt, col, sql_c_type, buffer, sizeof(buffer), NULL); if (len == SQL_NULL_DATA) { printf("error converting to %3d (%s)\n", sql_c_type, sql_c_type_name); } } } int main(int argc, char *argv[]) { TDS_DBC *dbc; TDS_ENV *env; SQLULEN ulen; int i; #ifdef _WIN32 hinstFreeTDS = GetModuleHandle(NULL); #endif /* extract all C types we support */ for (i = -200; i <= 200; ++i) { assert(num_c_types < 100); if (odbc_c_to_server_type(i) != TDS_INVALID_TYPE) { sql_c_types[num_c_types] = i; sql_c_types_names[num_c_types] = odbc_lookup_value(i, odbc_sql_c_types, NULL); assert(sql_c_types_names[num_c_types] != NULL); num_c_types++; } } /* this specific test doesn't need a connection, so fake one */ CHKAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &odbc_env, "S"); SQLSetEnvAttr(odbc_env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER); CHKAllocHandle(SQL_HANDLE_DBC, odbc_env, &odbc_conn, "S"); if (!odbc_driver_is_freetds()) return 0; /* get internal structures */ CHKR(SQLGetInfo, (odbc_conn, SQL_DRIVER_HDBC, &ulen, sizeof(ulen), NULL), "S"); dbc = (TDS_DBC *) (TDS_UINTPTR) ulen; CHKR(SQLGetInfo, (odbc_conn, SQL_DRIVER_HENV, &ulen, sizeof(ulen), NULL), "S"); env = (TDS_ENV *) (TDS_UINTPTR) ulen; assert(dbc && env); assert(env->tds_ctx); assert(!dbc->tds_socket); dbc->tds_socket = tds_alloc_socket(env->tds_ctx, 512); assert(dbc->tds_socket); dbc->tds_socket->conn->use_iconv = 0; tds_set_parent(dbc->tds_socket, dbc); if (TDS_FAILED(tds_iconv_open(dbc->tds_socket->conn, "UTF-8", 1))) { fprintf(stderr, "Failed to initialize iconv\n"); return 1; } /* get one statement to test with */ assert(dbc->stmt_list == NULL); CHKAllocStmt(&odbc_stmt, "S"); assert(dbc->stmt_list); stmt = dbc->stmt_list; tds_all_types(dbc->tds_socket, test_type); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/array.c000644 025423 025423 00000013055 14056414221 021630 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* Test using array binding */ static SQLTCHAR *test_query = NULL; static int multiply = 90; static int failure = 0; #define XMALLOC_N(t, n) (t*) ODBC_GET(n*sizeof(t)) static void query_test(int prepare, SQLRETURN expected, const char *expected_status) { #define DESC_LEN 51 #define ARRAY_SIZE 10 SQLUINTEGER *ids = XMALLOC_N(SQLUINTEGER,ARRAY_SIZE); typedef SQLCHAR desc_t[DESC_LEN]; desc_t *descs = XMALLOC_N(desc_t, ARRAY_SIZE); SQLLEN *id_lens = XMALLOC_N(SQLLEN,ARRAY_SIZE), *desc_lens = XMALLOC_N(SQLLEN,ARRAY_SIZE); SQLUSMALLINT i, *statuses = XMALLOC_N(SQLUSMALLINT,ARRAY_SIZE); unsigned *num_errors = XMALLOC_N(unsigned, ARRAY_SIZE); SQLULEN processed; RETCODE ret; char status[20]; SQLTCHAR *err = (SQLTCHAR *) ODBC_GET(sizeof(odbc_err)*sizeof(SQLTCHAR)); SQLTCHAR *state = (SQLTCHAR *) ODBC_GET(sizeof(odbc_sqlstate)*sizeof(SQLTCHAR)); assert(odbc_stmt != SQL_NULL_HSTMT); odbc_reset_statement(); odbc_command("create table #tmp1 (id tinyint, value char(20))"); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_PARAM_BIND_TYPE, SQL_PARAM_BIND_BY_COLUMN, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_PARAMSET_SIZE, (void *) ARRAY_SIZE, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_PARAM_STATUS_PTR, statuses, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_PARAMS_PROCESSED_PTR, &processed, 0); SQLBindParameter(odbc_stmt, 1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 5, 0, ids, 0, id_lens); SQLBindParameter(odbc_stmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, DESC_LEN - 1, 0, descs, DESC_LEN, desc_lens); processed = ARRAY_SIZE + 1; for (i = 0; i < ARRAY_SIZE; i++) { statuses[i] = SQL_PARAM_DIAG_UNAVAILABLE; ids[i] = (i + 1) * multiply; sprintf((char *) descs[i], "data %d \xf4", i * 7); id_lens[i] = 0; desc_lens[i] = SQL_NTS; num_errors[i] = 0; } multiply = 90; if (!prepare) { ret = SQLExecDirect(odbc_stmt, test_query, SQL_NTS); } else { SQLPrepare(odbc_stmt, test_query, SQL_NTS); ret = SQLExecute(odbc_stmt); } if (processed > ARRAY_SIZE) { char buf[256]; sprintf(buf, "Invalid processed number: %d", (int) processed); ODBC_REPORT_ERROR(buf); } for (i = 1; CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, i, state, NULL, err, sizeof(odbc_err), NULL, "SINo") != SQL_NO_DATA; ++i) { SQLINTEGER row; strcpy(odbc_err, C(err)); strcpy(odbc_sqlstate, C(state)); CHKGetDiagField(SQL_HANDLE_STMT, odbc_stmt, i, SQL_DIAG_ROW_NUMBER, &row, sizeof(row), NULL, "S"); if (row == SQL_ROW_NUMBER_UNKNOWN) continue; if (row < 1 || row > ARRAY_SIZE) { fprintf(stderr, "invalid row %d returned reading error number %d\n", (int) row, i); exit(1); } ++num_errors[row-1]; printf("for row %2d returned '%s' %s\n", (int) row, odbc_sqlstate, odbc_err); } for (i = 0; i < processed; ++i) { int has_diag = 0; switch (statuses[i]) { case SQL_PARAM_SUCCESS_WITH_INFO: has_diag = 1; case SQL_PARAM_SUCCESS: status[i] = 'V'; break; case SQL_PARAM_ERROR: has_diag = 1; status[i] = '!'; break; case SQL_PARAM_UNUSED: status[i] = ' '; break; case SQL_PARAM_DIAG_UNAVAILABLE: status[i] = '?'; break; default: fprintf(stderr, "Invalid status returned %d\n", statuses[i]); exit(1); } if (has_diag) { if (!num_errors[i]) { fprintf(stderr, "Diagnostics not returned for status %d\n", i); failure = 1; } } else { if (num_errors[i]) { fprintf(stderr, "Diagnostics returned for status %d\n", i); failure = 1; } } } status[i] = 0; if (ret != expected || strcmp(expected_status, status) != 0) { fprintf(stderr, "Invalid result: got %d \"%s\" expected %d \"%s\" processed %d\n", ret, status, expected, expected_status, (int) processed); if (ret != SQL_SUCCESS) odbc_read_error(); failure = 1; } odbc_reset_statement(); odbc_command_with_result(odbc_stmt, "drop table #tmp1"); } int main(int argc, char *argv[]) { odbc_use_version3 = 1; odbc_conn_additional_params = "ClientCharset=ISO-8859-1;"; odbc_connect(); if (odbc_db_is_microsoft()) { /* all successes */ test_query = T("INSERT INTO #tmp1 (id, value) VALUES (?, ?)"); multiply = 1; query_test(0, SQL_SUCCESS, "VVVVVVVVVV"); multiply = 1; query_test(1, SQL_SUCCESS, "VVVVVVVVVV"); /* all errors */ test_query = T("INSERT INTO #tmp1 (id, value) VALUES (?, ?)"); multiply = 257; query_test(0, SQL_ERROR, "!!!!!!!!!!"); multiply = 257; query_test(1, SQL_SUCCESS_WITH_INFO, "!!!!!!!!!!"); test_query = T("INSERT INTO #tmp1 (id, value) VALUES (?, ?)"); query_test(0, SQL_ERROR, "VV!!!!!!!!"); query_test(1, SQL_SUCCESS_WITH_INFO, "VV!!!!!!!!"); test_query = T("INSERT INTO #tmp1 (id, value) VALUES (900-?, ?)"); query_test(0, SQL_SUCCESS_WITH_INFO, "!!!!!!!VVV"); query_test(1, SQL_SUCCESS_WITH_INFO, "!!!!!!!VVV"); test_query = T("INSERT INTO #tmp1 (id) VALUES (?) UPDATE #tmp1 SET value = ?"); query_test(0, SQL_SUCCESS_WITH_INFO, "VVVV!V!V!V"); query_test(1, SQL_SUCCESS_WITH_INFO, "VV!!!!!!!!"); #ifdef ENABLE_DEVELOPING /* with result, see how SQLMoreResult work */ test_query = T("INSERT INTO #tmp1 (id) VALUES (?) SELECT * FROM #tmp1 UPDATE #tmp1 SET value = ?"); /* IMHO our driver is better here -- freddy77 */ query_test(0, SQL_SUCCESS, odbc_driver_is_freetds() ? "VVVVV!V!V!" : "VVVVVV!VVV"); query_test(1, SQL_SUCCESS, "VVVVVVVVVV"); #endif } else { /* Sybase test for conversions before executing */ test_query = T("INSERT INTO #tmp1 (id, value) VALUES (?/8, ?)"); query_test(0, SQL_SUCCESS, "VVVVVVVVVV"); } /* TODO record binding, array fetch, sqlputdata */ odbc_disconnect(); printf(failure ? "Failed :(\n" : "Success!\n"); return failure; } freetds-1.3.6/src/odbc/unittests/array_error.c000644 025423 025423 00000002203 14056414221 023032 0ustar00fredianofrediano000000 000000 #undef NDEBUG #include "common.h" #include /* Test for a bug executing after a not successfully execute */ int main(int argc, char *argv[]) { SQLSMALLINT num_params; SQLLEN sql_nts = SQL_NTS; char string[20]; SQLINTEGER id; odbc_use_version3 = 1; odbc_connect(); odbc_command("create table #tester (id int not null primary key, name varchar(20) not null)"); odbc_command("insert into #tester(id, name) values(1, 'abc')"); odbc_command("insert into #tester(id, name) values(2, 'duck')"); odbc_reset_statement(); CHKPrepare(T("insert into #tester(id, name) values(?,?)"), SQL_NTS, "S"); CHKR(SQLNumParams, (odbc_stmt, &num_params), "S"); assert(num_params == 2); /* now this is going to fail as id is duplicated, causing statement to not be prepared */ id = 1; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &id, 0, &sql_nts, "S"); strcpy(string, "test"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(string), 0, string, 0, &sql_nts, "S"); CHKExecute("E"); /* this should success */ id = 4; strcpy(string, "test2"); CHKExecute("S"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/array_out.c000644 025423 025423 00000010223 14056414221 022511 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* Test using array binding */ static const char *test_query = NULL; static int trunc = 0; static int record_bind = 0; typedef struct { SQLUINTEGER id; SQLLEN id_len; SQLLEN desc_len; } Record; static void query_test(const char* expected, const char *expected_status) { #define ARRAY_SIZE 10 ODBC_BUF *odbc_buf = NULL; SQLUINTEGER *ids; SQLCHAR *descs; SQLLEN *id_lens, *desc_lens; SQLULEN processed; SQLUSMALLINT i, statuses[ARRAY_SIZE]; int desc_len = trunc ? 4 : 51; int rec_size = 0; Record *rec = NULL; char status[20]; assert(odbc_stmt != SQL_NULL_HSTMT); odbc_reset_statement(); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_STATUS_PTR, statuses, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_ARRAY_SIZE, (void *) ARRAY_SIZE, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROWS_FETCHED_PTR, &processed, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN, 0); if (!record_bind) { ids = (SQLUINTEGER *) ODBC_GET(sizeof(SQLUINTEGER) * ARRAY_SIZE); descs = (SQLCHAR *) ODBC_GET(sizeof(SQLCHAR) * ARRAY_SIZE * desc_len); desc_lens = (SQLLEN *) ODBC_GET(sizeof(SQLLEN) * ARRAY_SIZE); id_lens = (SQLLEN *) ODBC_GET(sizeof(SQLLEN) * ARRAY_SIZE); assert(descs && ids && desc_lens && id_lens); } else { rec_size = (sizeof(Record) + (sizeof(SQLCHAR) * desc_len + sizeof(SQLLEN) - 1)) & ~(sizeof(SQLLEN) - 1); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_BIND_TYPE, TDS_INT2PTR(rec_size), 0); rec = (Record *) ODBC_GET(rec_size * ARRAY_SIZE); ids = &rec->id; id_lens = &rec->id_len; desc_lens = &rec->desc_len; descs = (SQLCHAR *) (((char *) rec) + sizeof(Record)); } #define REC(f,n) (((char*)f)+rec_size*(n)) #define DESCS(n) (rec ? (SQLCHAR*)REC(descs,n): (descs+(n)*desc_len)) #define IDS(n) *(rec ? (SQLUINTEGER*)REC(ids,n) : &ids[n]) #define ID_LENS(n) *(rec ? (SQLLEN*)REC(id_lens,n) : &id_lens[n]) #define DESC_LENS(n) *(rec ? (SQLLEN*)REC(desc_lens,n) : &desc_lens[n]) processed = ARRAY_SIZE + 1; for (i = 0; i < ARRAY_SIZE; i++) { statuses[i] = SQL_ROW_UPDATED; IDS(i) = i * 132; sprintf((char *) DESCS(i), "aaa"); ID_LENS(i) = 0; DESC_LENS(i) = -i; } SQLBindCol(odbc_stmt, 1, SQL_C_ULONG, &IDS(0), 0, &ID_LENS(0)); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, DESCS(0), desc_len, &DESC_LENS(0)); CHKExecDirect(T(test_query), SQL_NTS, "S"); CHKFetch(expected); assert(processed <= ARRAY_SIZE); for (i = 0; i < processed; ++i) { char buf[128]; sprintf(buf, "%crow number %d", 'a' + i, i * 13); if (trunc) buf[3] = 0; if (IDS(i) != i + 1 || strcmp((char *) DESCS(i), buf) != 0) { fprintf(stderr, "Invalid result\n\tgot '%d|%s'\n\texpected '%d|%s'\n", (int) IDS(i), DESCS(i), i + 1, buf); exit(1); } switch (statuses[i]) { case SQL_ROW_SUCCESS: status[i] = 'V'; break; case SQL_ROW_SUCCESS_WITH_INFO: status[i] = 'v'; break; case SQL_ROW_ERROR: status[i] = '!'; break; case SQL_ROW_NOROW: status[i] = ' '; break; default: fprintf(stderr, "Invalid status returned\n"); exit(1); } } status[i] = 0; if (expected_status && strcmp(expected_status, status) != 0) { fprintf(stderr, "Invalid status\n\tgot '%s'\n\texpected '%s'\n", status, expected_status); exit(1); } ODBC_FREE(); } int main(int argc, char *argv[]) { int i; odbc_use_version3 = 1; odbc_connect(); odbc_command("CREATE TABLE #odbc_test(i INT, t TEXT)"); for (i = 0; i < 10; ++i) { char buf[128]; sprintf(buf, "INSERT INTO #odbc_test(i, t) VALUES(%d, '%crow number %d')", i + 1, 'a' + i, i * 13); odbc_command(buf); } odbc_reset_statement(); test_query = "SELECT * FROM #odbc_test ORDER BY i"; printf("test line %d\n", __LINE__); query_test("S", "VVVVVVVVVV"); test_query = "SELECT * FROM #odbc_test WHERE i < 7 ORDER BY i"; printf("test line %d\n", __LINE__); query_test("S", "VVVVVV"); /* binding row */ test_query = "SELECT * FROM #odbc_test ORDER BY i"; record_bind = 1; printf("test line %d\n", __LINE__); query_test("S", "VVVVVVVVVV"); /* row and truncation */ trunc = 1; printf("test line %d\n", __LINE__); query_test("I", "!!!!!!!!!!"); /* TODO bind offset, SQLGetData, no bind, error */ odbc_disconnect(); printf("Success!.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/attributes.c000644 025423 025423 00000021062 14056414221 022675 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* * SQLSetStmtAttr */ static int g_result = 0; static unsigned int line_num; #ifdef __GNUC__ static void fatal(const char *msg, ...) __attribute__((noreturn)); #endif static void fatal(const char *msg, ...) { va_list ap; va_start(ap, msg); vfprintf(stderr, msg, ap); va_end(ap); exit(1); } static int get_int(const char *s) { char *end; long l; if (!s) fatal("Line %u: NULL int\n", line_num); l = strtol(s, &end, 0); if (end[0]) fatal("Line %u: Invalid int\n", line_num); return (int) l; } struct lookup_int { const char *name; int value; }; static int lookup(const char *name, const struct lookup_int *table) { if (!table) return get_int(name); for (; table->name; ++table) if (strcmp(table->name, name) == 0) return table->value; return get_int(name); } static const char * unlookup(int value, const struct lookup_int *table) { if (!table) return "??"; for (; table->name; ++table) if (table->value == value) return table->name; return "??"; } static struct lookup_int concurrency[] = { #define TYPE(s) { #s, s } TYPE(SQL_CONCUR_READ_ONLY), TYPE(SQL_CONCUR_LOCK), TYPE(SQL_CONCUR_ROWVER), TYPE(SQL_CONCUR_VALUES), #undef TYPE { NULL, 0 } }; static struct lookup_int scrollable[] = { #define TYPE(s) { #s, s } TYPE(SQL_NONSCROLLABLE), TYPE(SQL_SCROLLABLE), #undef TYPE { NULL, 0 } }; static struct lookup_int sensitivity[] = { #define TYPE(s) { #s, s } TYPE(SQL_UNSPECIFIED), TYPE(SQL_INSENSITIVE), TYPE(SQL_SENSITIVE), #undef TYPE { NULL, 0 } }; static struct lookup_int cursor_type[] = { #define TYPE(s) { #s, s } TYPE(SQL_CURSOR_FORWARD_ONLY), TYPE(SQL_CURSOR_STATIC), TYPE(SQL_CURSOR_KEYSET_DRIVEN), TYPE(SQL_CURSOR_DYNAMIC), #undef TYPE { NULL, 0 } }; static struct lookup_int noscan[] = { #define TYPE(s) { #s, s } TYPE(SQL_NOSCAN_OFF), TYPE(SQL_NOSCAN_ON), #undef TYPE { NULL, 0 } }; static struct lookup_int retrieve_data[] = { #define TYPE(s) { #s, s } TYPE(SQL_RD_ON), TYPE(SQL_RD_OFF), #undef TYPE { NULL, 0 } }; static struct lookup_int simulate_cursor[] = { #define TYPE(s) { #s, s } TYPE(SQL_SC_NON_UNIQUE), TYPE(SQL_SC_TRY_UNIQUE), TYPE(SQL_SC_UNIQUE), #undef TYPE { NULL, 0 } }; static struct lookup_int use_bookmarks[] = { #define TYPE(s) { #s, s } TYPE(SQL_UB_OFF), TYPE(SQL_UB_VARIABLE), TYPE(SQL_UB_FIXED), #undef TYPE { NULL, 0 } }; typedef enum { type_INTEGER, type_UINTEGER, type_SMALLINT, type_LEN, type_CHARP, type_DESC, type_VOIDP } test_type_t; struct attribute { const char *name; int value; test_type_t type; const struct lookup_int *lookup; }; static const struct attribute attributes[] = { #define ATTR(s,t) { #s, s, type_##t, NULL } #define ATTR2(s,t,l) { #s, s, type_##t, l } ATTR(SQL_ATTR_APP_PARAM_DESC, DESC), ATTR(SQL_ATTR_APP_ROW_DESC, DESC), ATTR(SQL_ATTR_ASYNC_ENABLE, UINTEGER), ATTR2(SQL_ATTR_CONCURRENCY, UINTEGER, concurrency), ATTR2(SQL_ATTR_CURSOR_SCROLLABLE, UINTEGER, scrollable), ATTR2(SQL_ATTR_CURSOR_SENSITIVITY, UINTEGER, sensitivity), ATTR2(SQL_ATTR_CURSOR_TYPE, UINTEGER, cursor_type), ATTR(SQL_ATTR_ENABLE_AUTO_IPD, UINTEGER), ATTR(SQL_ATTR_FETCH_BOOKMARK_PTR, VOIDP), ATTR(SQL_ATTR_IMP_PARAM_DESC, DESC), ATTR(SQL_ATTR_IMP_ROW_DESC, DESC), ATTR(SQL_ATTR_KEYSET_SIZE, UINTEGER), ATTR(SQL_ATTR_MAX_LENGTH, UINTEGER), ATTR(SQL_ATTR_MAX_ROWS, UINTEGER), ATTR(SQL_ATTR_METADATA_ID, UINTEGER), ATTR2(SQL_ATTR_NOSCAN, UINTEGER, noscan), ATTR(SQL_ATTR_PARAM_BIND_OFFSET_PTR, VOIDP), ATTR(SQL_ATTR_PARAM_BIND_OFFSET_PTR, VOIDP), ATTR(SQL_ATTR_PARAM_BIND_TYPE, UINTEGER), ATTR(SQL_ATTR_PARAM_OPERATION_PTR, VOIDP), ATTR(SQL_ATTR_PARAM_STATUS_PTR, VOIDP), ATTR(SQL_ATTR_PARAMS_PROCESSED_PTR, VOIDP), ATTR(SQL_ATTR_PARAMSET_SIZE, UINTEGER), ATTR(SQL_ATTR_QUERY_TIMEOUT, UINTEGER), ATTR2(SQL_ATTR_RETRIEVE_DATA, UINTEGER, retrieve_data), ATTR(SQL_ATTR_ROW_ARRAY_SIZE, UINTEGER), ATTR(SQL_ATTR_ROW_BIND_OFFSET_PTR, VOIDP), ATTR(SQL_ATTR_ROW_BIND_TYPE, UINTEGER), ATTR(SQL_ATTR_ROW_NUMBER, UINTEGER), ATTR(SQL_ATTR_ROW_OPERATION_PTR, VOIDP), ATTR(SQL_ATTR_ROW_STATUS_PTR, VOIDP), ATTR(SQL_ATTR_ROWS_FETCHED_PTR, VOIDP), ATTR2(SQL_ATTR_SIMULATE_CURSOR, UINTEGER, simulate_cursor), ATTR2(SQL_ATTR_USE_BOOKMARKS, UINTEGER, use_bookmarks), #undef ATTR2 #undef ATTR }; static const struct attribute * lookup_attr(const char *name) { unsigned int i; if (!name) fatal("Line %u: NULL attribute\n", line_num); for (i = 0; i < TDS_VECTOR_SIZE(attributes); ++i) if (strcmp(attributes[i].name, name) == 0 || strcmp(attributes[i].name + 4, name) == 0) return &attributes[i]; fatal("Line %u: attribute %s not found\n", line_num, name); return NULL; } #define SEP " \t\n" #define ATTR_PARAMS const struct attribute *attr, int expected typedef int (*get_attr_t) (ATTR_PARAMS); static int get_attr_stmt(ATTR_PARAMS) { SQLINTEGER i, ind; SQLSMALLINT si; SQLLEN li; SQLRETURN ret; ret = SQL_ERROR; switch (attr->type) { case type_INTEGER: case type_UINTEGER: i = 0xdeadbeef; ret = SQLGetStmtAttr(odbc_stmt, attr->value, (SQLPOINTER) & i, sizeof(SQLINTEGER), &ind); break; case type_SMALLINT: si = 0xbeef; ret = SQLGetStmtAttr(odbc_stmt, attr->value, (SQLPOINTER) & si, sizeof(SQLSMALLINT), &ind); i = si; break; case type_LEN: li = 0xdeadbeef; ret = SQLGetStmtAttr(odbc_stmt, attr->value, (SQLPOINTER) & li, sizeof(SQLLEN), &ind); i = li; break; case type_VOIDP: case type_DESC: case type_CHARP: fatal("Line %u: CHAR* check still not supported\n", line_num); break; } if (!SQL_SUCCEEDED(ret)) fatal("Line %u: failure not expected\n", line_num); return i; } #if 0 /* do not retry any attribute just return expected value so to make caller happy */ static int get_attr_none(ATTR_PARAMS) { return expected; } #endif int main(int argc, char *argv[]) { #define TEST_FILE "attributes.in" const char *in_file = FREETDS_SRCDIR "/" TEST_FILE; FILE *f; char buf[256]; SQLINTEGER i; SQLLEN len; get_attr_t get_attr_p = get_attr_stmt; odbc_connect(); /* TODO find another way */ odbc_check_cursor(); odbc_command("SET TEXTSIZE 4096"); SQLBindCol(odbc_stmt, 1, SQL_C_SLONG, &i, sizeof(i), &len); f = fopen(in_file, "r"); if (!f) f = fopen(TEST_FILE, "r"); if (!f) { fprintf(stderr, "error opening test file\n"); exit(1); } line_num = 0; while (fgets(buf, sizeof(buf), f)) { char *p = buf, *cmd; ++line_num; while (isspace((unsigned char) *p)) ++p; cmd = strtok(p, SEP); /* skip comments */ if (!cmd || cmd[0] == '#' || cmd[0] == 0 || cmd[0] == '\n') continue; if (strcmp(cmd, "odbc") == 0) { int odbc3 = get_int(strtok(NULL, SEP)) == 3 ? 1 : 0; if (odbc_use_version3 != odbc3) { odbc_use_version3 = odbc3; odbc_disconnect(); odbc_connect(); odbc_command("SET TEXTSIZE 4096"); SQLBindCol(odbc_stmt, 1, SQL_C_SLONG, &i, sizeof(i), &len); } continue; } /* set attribute */ if (strcmp(cmd, "set") == 0) { const struct attribute *attr = lookup_attr(strtok(NULL, SEP)); char *value = strtok(NULL, SEP); SQLRETURN ret; if (!value) fatal("Line %u: value not defined\n", line_num); ret = SQL_ERROR; switch (attr->type) { case type_UINTEGER: case type_INTEGER: ret = SQLSetStmtAttr(odbc_stmt, attr->value, TDS_INT2PTR(lookup(value, attr->lookup)), sizeof(SQLINTEGER)); break; case type_SMALLINT: ret = SQLSetStmtAttr(odbc_stmt, attr->value, TDS_INT2PTR(lookup(value, attr->lookup)), sizeof(SQLSMALLINT)); break; case type_LEN: ret = SQLSetStmtAttr(odbc_stmt, attr->value, TDS_INT2PTR(lookup(value, attr->lookup)), sizeof(SQLLEN)); break; case type_CHARP: ret = SQLSetStmtAttr(odbc_stmt, attr->value, (SQLPOINTER) value, SQL_NTS); break; case type_VOIDP: case type_DESC: fatal("Line %u: not implemented\n"); } if (!SQL_SUCCEEDED(ret)) fatal("Line %u: failure not expected setting statement attribute\n", line_num); get_attr_p = get_attr_stmt; continue; } /* test attribute */ if (strcmp(cmd, "attr") == 0) { const struct attribute *attr = lookup_attr(strtok(NULL, SEP)); char *value = strtok(NULL, SEP); int i, expected = lookup(value, attr->lookup); if (!value) fatal("Line %u: value not defined\n", line_num); i = get_attr_p(attr, expected); if (i != expected) { g_result = 1; fprintf(stderr, "Line %u: invalid %s got %d(%s) expected %s\n", line_num, attr->name, i, unlookup(i, attr->lookup), value); } continue; } if (strcmp(cmd, "reset") == 0) { odbc_reset_statement(); continue; } fatal("Line %u: command '%s' not handled\n", line_num, cmd); } fclose(f); odbc_disconnect(); printf("Done.\n"); return g_result; } freetds-1.3.6/src/odbc/unittests/attributes.in000755 025423 025423 00000001002 14056414221 023054 0ustar00fredianofrediano000000 000000 # some cursor attributes odbc 3 reset attr SQL_ATTR_CURSOR_TYPE SQL_CURSOR_FORWARD_ONLY attr SQL_ATTR_CURSOR_SCROLLABLE SQL_NONSCROLLABLE attr SQL_ATTR_CONCURRENCY SQL_CONCUR_READ_ONLY attr SQL_ATTR_CURSOR_SENSITIVITY SQL_INSENSITIVE set SQL_ATTR_CURSOR_SENSITIVITY SQL_SENSITIVE attr SQL_ATTR_CURSOR_TYPE SQL_CURSOR_FORWARD_ONLY attr SQL_ATTR_CURSOR_SCROLLABLE SQL_NONSCROLLABLE attr SQL_ATTR_CONCURRENCY SQL_CONCUR_ROWVER attr SQL_ATTR_CURSOR_SENSITIVITY SQL_SENSITIVE freetds-1.3.6/src/odbc/unittests/bcp.c000644 025423 025423 00000030075 14056414222 021260 0ustar00fredianofrediano000000 000000 #include "common.h" #define TDSODBC_BCP #include #include #ifdef UNICODE typedef SQLWCHAR bcp_init_char_t; #else typedef char bcp_init_char_t; #endif struct prefixed_int { ODBCINT64 prefix; int value; }; struct prefixed_str { ODBCINT64 prefix; char value[64]; }; /* * Static data for insertion */ static struct prefixed_int not_null_bit = {4, 1}; static struct prefixed_str not_null_char = {64, "a char"}; static struct prefixed_str not_null_varchar = {64, "a varchar"}; static struct prefixed_str not_null_datetime = {64, "2003-12-17 15:44:00.000"}; static struct prefixed_str not_null_smalldatetime = {64, "2003-12-17 15:44:00"}; static struct prefixed_str not_null_money = {64, "12.341"}; static struct prefixed_str not_null_smallmoney = {64, "12.34"}; static struct prefixed_str not_null_float = {64, "12.34"}; static struct prefixed_str not_null_real = {64, "12.34"}; static struct prefixed_str not_null_decimal = {64, "12.34"}; static struct prefixed_str not_null_numeric = {64, "12.34"}; static struct prefixed_int not_null_int = {4, 1234}; static struct prefixed_int not_null_smallint = {4, 1234}; static struct prefixed_int not_null_tinyint = {4, 123}; static struct prefixed_str not_null_nvarchar = {64, "a wide var"}; static ODBCINT64 null_prefix = -1; static const char *expected[] = { "1", "a char ","a varchar","2003-12-17 15:44:00.000","2003-12-17 15:44:00", "12.3410","12.3400","12.34","12.3400002","12.34","12.34", "1234","1234","123", "a wide var", }; static const int total_cols = 29; static const char *expected_special[] = { "2015-03-14 15:26:53.000", "2015-03-14 15:26:53.589793", "3.141593000", "3.141593", /* MS driver has "3141593" here. Bug? Should we be bug-compatible? */ "", }; static int tds_version; static void cleanup(void) { odbc_command("if exists (select 1 from sysobjects where type = 'U' and name = 'all_types_bcp_unittest') drop table all_types_bcp_unittest"); odbc_command("if exists (select 1 from sysobjects where type = 'U' and name = 'special_types_bcp_unittest') drop table special_types_bcp_unittest"); } static void init(void) { cleanup(); odbc_command("CREATE TABLE all_types_bcp_unittest (" " not_null_bit bit NOT NULL" "" ", not_null_char char(10) NOT NULL" ", not_null_varchar varchar(10) NOT NULL" "" ", not_null_datetime datetime NOT NULL" ", not_null_smalldatetime smalldatetime NOT NULL" "" ", not_null_money money NOT NULL" ", not_null_smallmoney smallmoney NOT NULL" "" ", not_null_float float NOT NULL" ", not_null_real real NOT NULL" "" ", not_null_decimal decimal(5,2) NOT NULL" ", not_null_numeric numeric(5,2) NOT NULL" "" ", not_null_int int NOT NULL" ", not_null_smallint smallint NOT NULL" ", not_null_tinyint tinyint NOT NULL" ", not_null_nvarchar nvarchar(10) NOT NULL" "" ", nullable_char char(10) NULL" ", nullable_varchar varchar(10) NULL" "" ", nullable_datetime datetime NULL" ", nullable_smalldatetime smalldatetime NULL" "" ", nullable_money money NULL" ", nullable_smallmoney smallmoney NULL" "" ", nullable_float float NULL" ", nullable_real real NULL" "" ", nullable_decimal decimal(5,2) NULL" ", nullable_numeric numeric(5,2) NULL" "" ", nullable_int int NULL" ", nullable_smallint smallint NULL" ", nullable_tinyint tinyint NULL" ", nullable_nvarchar nvarchar(10) NULL" ")"); if (tds_version < 0x703) return; /* Excludes: * binary * image * uniqueidentifier * varbinary * text * timestamp * nchar * ntext * nvarchar */ odbc_command("CREATE TABLE special_types_bcp_unittest (" "dt datetime not null," "dt2 datetime2(6) not null," "num decimal(19,9) not null," "numstr varchar(64) not null," "empty varchar(64) not null," "bitnull bit null" ")"); } #define VARCHAR_BIND(x) \ bcp_bind( odbc_conn, (unsigned char *) (prefixlen == 0 ? (void*)&x.value : &x), prefixlen, strlen(x.value), NULL, termlen, BCP_TYPE_SQLVARCHAR, col++ ) #define INT_BIND(x) \ bcp_bind( odbc_conn, (unsigned char *) (prefixlen == 0 ? (void*)&x.value : &x), prefixlen, SQL_VARLEN_DATA, NULL, termlen, BCP_TYPE_SQLINT4, col++ ) #define NULL_BIND(x, type) \ bcp_bind( odbc_conn, (unsigned char *) (prefixlen == 0 ? (void*)&x.value : &null_prefix), prefixlen, prefixlen == 0 ? SQL_NULL_DATA : SQL_VARLEN_DATA, NULL, termlen, type, col++ ) static void test_bind(int prefixlen) { enum { termlen = 0 }; RETCODE fOK; int col=1; /* non nulls */ fOK = INT_BIND(not_null_bit); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_char); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_varchar); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_datetime); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_smalldatetime); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_money); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_smallmoney); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_float); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_real); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_decimal); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_numeric); assert(fOK == SUCCEED); fOK = INT_BIND(not_null_int); assert(fOK == SUCCEED); fOK = INT_BIND(not_null_smallint); assert(fOK == SUCCEED); fOK = INT_BIND(not_null_tinyint); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_nvarchar); assert(fOK == SUCCEED); /* nulls */ assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_char, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_varchar, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_datetime, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_smalldatetime, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_money, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_smallmoney, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_float, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_real, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_decimal, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_numeric, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_int, BCP_TYPE_SQLINT4); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_smallint, BCP_TYPE_SQLINT4); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_tinyint, BCP_TYPE_SQLINT4); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_nvarchar, BCP_TYPE_SQLVARCHAR); assert(fOK == SUCCEED); } static void set_attr(void) { SQLSetConnectAttr(odbc_conn, SQL_COPT_SS_BCP, (SQLPOINTER)SQL_BCP_ON, 0); } static void report_bcp_error(const char *errmsg, int line, const char *file) { odbc_stmt = NULL; odbc_report_error(errmsg, line, file); } static void normal_inserts(int prefixlen); static void normal_select(void); static void special_inserts(void); static void special_select(void); static const char table_name[] = "all_types_bcp_unittest"; int main(int argc, char *argv[]) { const char *s; odbc_set_conn_attr = set_attr; odbc_connect(); tds_version = odbc_tds_version(); init(); normal_inserts(0); if (tds_version >= 0x703) special_inserts(); normal_select(); if (tds_version >= 0x703) special_select(); odbc_command("delete from all_types_bcp_unittest"); normal_inserts(8); normal_select(); if ((s = getenv("BCP")) != NULL && 0 == strcmp(s, "nodrop")) { printf("BCP=nodrop: '%s' kept\n", table_name); } else { printf("Dropping table %s\n", table_name); odbc_command("drop table all_types_bcp_unittest"); if (tds_version >= 0x703) odbc_command("drop table special_types_bcp_unittest"); } cleanup(); odbc_disconnect(); printf("Done.\n"); return 0; } static void normal_inserts(int prefixlen) { int i; int rows_sent; /* set up and send the bcp */ printf("preparing to insert into %s ... ", table_name); if (bcp_init(odbc_conn, (bcp_init_char_t *) T(table_name), NULL, NULL, BCP_DIRECTION_IN) == FAIL) report_bcp_error("bcp_init", __LINE__, __FILE__); printf("OK\n"); test_bind(prefixlen); printf("Sending same row 10 times... \n"); for (i=0; i<10; i++) if (bcp_sendrow(odbc_conn) == FAIL) report_bcp_error("bcp_sendrow", __LINE__, __FILE__); #if 1 rows_sent = bcp_batch(odbc_conn); if (rows_sent == -1) report_bcp_error("bcp_batch", __LINE__, __FILE__); #endif printf("OK\n"); /* end bcp. */ rows_sent = bcp_done(odbc_conn); if (rows_sent != 0) report_bcp_error("bcp_done", __LINE__, __FILE__); else printf("%d rows copied.\n", rows_sent); printf("done\n"); } static void special_inserts(void) { int rows_sent; SQL_TIMESTAMP_STRUCT timestamp; DBDATETIME datetime; SQL_NUMERIC_STRUCT numeric; printf("sending special types\n"); rows_sent = 0; if (bcp_init(odbc_conn, (bcp_init_char_t *) T("special_types_bcp_unittest"), NULL, NULL, BCP_DIRECTION_IN) == FAIL) report_bcp_error("bcp_init", __LINE__, __FILE__); printf("OK\n"); datetime.dtdays = 42075; datetime.dttime = 16683900; timestamp.year = 2015; timestamp.month = 3; timestamp.day = 14; timestamp.hour = 15; timestamp.minute = 26; timestamp.second = 53; timestamp.fraction = 589793238; memset(&numeric, 0, sizeof(numeric)); numeric.precision = 19; numeric.scale = 6; numeric.sign = 1; numeric.val[0] = 0xd9; numeric.val[1] = 0xef; numeric.val[2] = 0x2f; bcp_bind(odbc_conn, (unsigned char *) &datetime, 0, sizeof(datetime), NULL, 0, BCP_TYPE_SQLDATETIME, 1); bcp_bind(odbc_conn, (unsigned char *) ×tamp, 0, sizeof(timestamp), NULL, 0, BCP_TYPE_SQLDATETIME2, 2); bcp_bind(odbc_conn, (unsigned char *) &numeric, 0, sizeof(numeric), NULL, 0, BCP_TYPE_SQLDECIMAL, 3); bcp_bind(odbc_conn, (unsigned char *) &numeric, 0, sizeof(numeric), NULL, 0, BCP_TYPE_SQLDECIMAL, 4); bcp_bind(odbc_conn, (unsigned char *) "", 0, 0, NULL, 0, BCP_TYPE_SQLVARCHAR, 5); bcp_bind(odbc_conn, (unsigned char *) ¬_null_bit, 0, SQL_NULL_DATA, NULL, 0, BCP_TYPE_SQLINT4, 6); if (bcp_sendrow(odbc_conn) == FAIL) report_bcp_error("bcp_sendrow", __LINE__, __FILE__); rows_sent = bcp_batch(odbc_conn); if (rows_sent != 1) report_bcp_error("bcp_batch", __LINE__, __FILE__); printf("OK\n"); /* end bcp. */ rows_sent = bcp_done(odbc_conn); if (rows_sent != 0) report_bcp_error("bcp_done", __LINE__, __FILE__); else printf("%d rows copied.\n", rows_sent); printf("done\n"); } static void normal_select(void) { int ok = 1, i; odbc_command("select * from all_types_bcp_unittest"); CHKFetch("SI"); /* first columns have values */ for (i = 0; i < TDS_VECTOR_SIZE(expected); ++i) { char output[128]; SQLLEN dataSize; CHKGetData(i + 1, SQL_C_CHAR, output, sizeof(output), &dataSize, "S"); if (strcmp(output, expected[i]) || dataSize <= 0) { fprintf(stderr, "Invalid returned col %d: '%s'!='%s'\n", i, expected[i], output); ok = 0; } } /* others are NULL */ for (; i < total_cols; ++i) { char output[128]; SQLLEN dataSize; CHKGetData(i + 1, SQL_C_CHAR, output, sizeof(output), &dataSize, "S"); if (dataSize != SQL_NULL_DATA) { fprintf(stderr, "Invalid returned col %d: should be NULL'\n", i); ok = 0; } } if (!ok) exit(1); CHKCloseCursor("SI"); } static void special_select(void) { int ok = 1, i; odbc_command("select top 1 * from special_types_bcp_unittest"); CHKFetch("SI"); for (i = 0; i < TDS_VECTOR_SIZE(expected_special); ++i) { char output[128]; SQLLEN dataSize; CHKGetData(i + 1, SQL_C_CHAR, output, sizeof(output), &dataSize, "S"); if (strcmp(output, expected_special[i]) || (dataSize <= 0 && expected_special[i][0] != '\0')) { fprintf(stderr, "Invalid returned col %d: '%s'!='%s'\n", i, expected_special[i], output); ok = 0; } } if (!ok) exit(1); CHKCloseCursor("SI"); } freetds-1.3.6/src/odbc/unittests/binary_test.c000644 025423 025423 00000007006 14056414221 023034 0ustar00fredianofrediano000000 000000 /** * Summary: Freetds binary patch test. * Author: Gerhard Esterhuizen * Date: April 2003 */ #include "common.h" #include #define ERR_BUF_SIZE 256 /* Name of table used by the test. Should contain single column, of IMAGE type and should contain NO rows at time of program invocation. */ #define TEST_TABLE_NAME "#binary_test" /* Size (in bytes) of the test pattern written to and read from the database. */ #define TEST_BUF_LEN (1024*128) static unsigned char *buf; static void show_error(const char *where, const char *what) { printf("ERROR in %s: %s.\n", where, what); } static void clean_up(void) { free(buf); odbc_disconnect(); } static int test_insert(void *buf, SQLLEN buflen) { SQLHSTMT odbc_stmt = SQL_NULL_HSTMT; SQLLEN strlen_or_ind; const char *qstr = "insert into " TEST_TABLE_NAME " values (?)"; assert(odbc_conn); assert(odbc_env); /* allocate new statement handle */ CHKAllocHandle(SQL_HANDLE_STMT, odbc_conn, &odbc_stmt, "SI"); /* execute query */ CHKPrepare(T(qstr), SQL_NTS, "SI"); strlen_or_ind = buflen; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, (SQLUINTEGER) (-1), 0, buf, buflen, &strlen_or_ind, "SI"); CHKExecute("SI"); /* this command shouldn't fail */ odbc_command("DECLARE @i INT"); SQLFreeHandle(SQL_HANDLE_STMT, odbc_stmt); return 0; } static int test_select(void *buf, SQLINTEGER buflen, SQLLEN * bytes_returned) { SQLHSTMT odbc_stmt = SQL_NULL_HSTMT; SQLLEN strlen_or_ind = 0; const char *qstr = "select * from " TEST_TABLE_NAME; assert(odbc_conn); assert(odbc_env); /* allocate new statement handle */ CHKAllocHandle(SQL_HANDLE_STMT, odbc_conn, &odbc_stmt, "SI"); /* execute query */ CHKExecDirect(T(qstr), SQL_NTS, "SINo"); /* fetch first page of first result row of unbound column */ CHKFetch("S"); strlen_or_ind = 0; CHKGetData(1, SQL_C_BINARY, buf, buflen, &strlen_or_ind, "SINo"); *bytes_returned = ((strlen_or_ind > buflen || (strlen_or_ind == SQL_NO_TOTAL)) ? buflen : strlen_or_ind); /* ensure that this was the only row */ CHKFetch("No"); SQLFreeHandle(SQL_HANDLE_STMT, odbc_stmt); ODBC_FREE(); return 0; } #define BYTE_AT(n) (((n) * 123) & 0xff) int main(int argc, char **argv) { int i; SQLLEN bytes_returned; /* do not allocate so big memory in stack */ buf = (unsigned char *) malloc(TEST_BUF_LEN); odbc_connect(); odbc_command("create table " TEST_TABLE_NAME " (im IMAGE)"); odbc_command("SET TEXTSIZE 1000000"); /* populate test buffer with ramp */ for (i = 0; i < TEST_BUF_LEN; i++) { buf[i] = BYTE_AT(i); } /* insert test pattern into database */ if (test_insert(buf, TEST_BUF_LEN) == -1) { clean_up(); return -1; } memset(buf, 0, TEST_BUF_LEN); /* read test pattern from database */ if (test_select(buf, TEST_BUF_LEN, &bytes_returned) == -1) { clean_up(); return -1; } /* compare inserted and read back test patterns */ if (bytes_returned != TEST_BUF_LEN) { show_error("main(): comparing buffers", "Mismatch in input and output pattern sizes."); printf("Expected %lu got %lu\n", (unsigned long) TEST_BUF_LEN, (unsigned long) bytes_returned); clean_up(); return -1; } for (i = 0; i < TEST_BUF_LEN; ++i) { if (buf[i] != BYTE_AT(i)) { printf("mismatch at pos %d %d != %d\n", i, buf[i], BYTE_AT(i)); show_error("main(): comparing buffers", "Mismatch in input and output patterns."); clean_up(); return -1; } } printf("Input and output buffers of length %d match.\nTest passed.\n", TEST_BUF_LEN); clean_up(); return 0; } freetds-1.3.6/src/odbc/unittests/blob1.c000644 025423 025423 00000023027 14056414221 021511 0ustar00fredianofrediano000000 000000 /* Testing large objects */ /* Test from Sebastien Flaesch */ #include "common.h" #include #include #define NBYTES 10000u static int failed = 0; static void fill_chars(char *buf, size_t len, unsigned int start, unsigned int step) { size_t n; for (n = 0; n < len; ++n) buf[n] = 'a' + ((start+n) * step % ('z' - 'a' + 1)); } static void fill_hex(char *buf, size_t len, unsigned int start, unsigned int step) { size_t n; for (n = 0; n < len; ++n) sprintf(buf + 2*n, "%2x", (unsigned int)('a' + ((start+n) * step % ('z' - 'a' + 1)))); } static int check_chars(const char *buf, size_t len, unsigned int start, unsigned int step) { size_t n; for (n = 0; n < len; ++n) if (buf[n] != 'a' + ((start+n) * step % ('z' - 'a' + 1))) return 0; return 1; } static int check_hex(const char *buf, size_t len, unsigned int start, unsigned int step) { size_t n; char symbol[3]; for (n = 0; n < len; ++n) { sprintf(symbol, "%2x", (unsigned int)('a' + ((start+n) / 2 * step % ('z' - 'a' + 1)))); if (tolower((unsigned char) buf[n]) != symbol[(start+n) % 2]) return 0; } return 1; } #define MAX_TESTS 10 typedef struct { unsigned num; SQLSMALLINT c_type, sql_type; const char *db_type; unsigned gen1, gen2; SQLLEN vind; char *buf; } test_info; static test_info test_infos[MAX_TESTS]; static unsigned num_tests = 0; static void dump(FILE* out, const char* start, void* buf, unsigned len) { unsigned n; char s[17]; if (len >= 16) len = 16; fprintf(out, "%s", start); for (n = 0; n < len; ++n) { unsigned char c = ((unsigned char*)buf)[n]; fprintf(out, " %02X", c); s[n] = (c >= 0x20 && c < 127) ? (char) c : '.'; } s[len] = 0; fprintf(out, " - %s\n", s); } static void readBlob(test_info *t) { SQLRETURN rc; char buf[4096]; SQLLEN len, total = 0; int i = 0; int check; printf(">> readBlob field %d\n", t->num); while (1) { i++; rc = CHKGetData(t->num, SQL_C_BINARY, (SQLPOINTER) buf, (SQLINTEGER) sizeof(buf), &len, "SINo"); if (rc == SQL_NO_DATA || len <= 0) break; if (len > (SQLLEN) sizeof(buf)) len = (SQLLEN) sizeof(buf); printf(">> step %d: %d bytes readed\n", i, (int) len); check = check_chars(buf, len, t->gen1 + total, t->gen2); if (!check) { fprintf(stderr, "Wrong buffer content\n"); dump(stderr, " buf ", buf, len); failed = 1; } total += len; } printf(">> total bytes read = %d \n", (int) total); if (total != 10000) { fprintf(stderr, "Wrong buffer length, expected 20000\n"); failed = 1; } } static void readBlobAsChar(test_info *t, int step, int wide) { SQLRETURN rc = SQL_SUCCESS_WITH_INFO; char buf[8192]; SQLLEN len, total = 0, len2; int i = 0; int check; int bufsize; SQLSMALLINT type = SQL_C_CHAR; unsigned int char_len = 1; if (wide) { char_len = sizeof(SQLWCHAR); type = SQL_C_WCHAR; } if (step%2) bufsize = sizeof(buf) - char_len; else bufsize = sizeof(buf); printf(">> readBlobAsChar field %d\n", t->num); while (rc == SQL_SUCCESS_WITH_INFO) { i++; rc = CHKGetData(t->num, type, (SQLPOINTER) buf, (SQLINTEGER) bufsize, &len, "SINo"); if (rc == SQL_SUCCESS_WITH_INFO && len == SQL_NO_TOTAL) { len = bufsize - char_len; rc = SQL_SUCCESS; } if (rc == SQL_NO_DATA || len <= 0) break; rc = CHKGetData(t->num, type, (SQLPOINTER) buf, 0, &len2, "SINo"); if (rc == SQL_SUCCESS_WITH_INFO && len2 != SQL_NO_TOTAL) len = len - len2; #if 0 if (len > (SQLLEN) (bufsize - char_len)) len = (SQLLEN) (bufsize - char_len); len -= len % (2u * char_len); #endif printf(">> step %d: %d bytes readed\n", i, (int) len); if (wide) { len /= sizeof(SQLWCHAR); odbc_from_sqlwchar((char *) buf, (SQLWCHAR *) buf, len + 1); } check = check_hex(buf, len, 2*t->gen1 + total, t->gen2); if (!check) { fprintf(stderr, "Wrong buffer content\n"); dump(stderr, " buf ", buf, len); failed = 1; } total += len; } printf(">> total bytes read = %d \n", (int) total); if (total != 20000) { fprintf(stderr, "Wrong buffer length, expected 20000\n"); failed = 1; } } static void add_test(SQLSMALLINT c_type, SQLSMALLINT sql_type, const char *db_type, unsigned gen1, unsigned gen2) { test_info *t = NULL; size_t buf_len; if (num_tests >= MAX_TESTS) { fprintf(stderr, "too max tests\n"); exit(1); } t = &test_infos[num_tests++]; t->num = num_tests; t->c_type = c_type; t->sql_type = sql_type; t->db_type = db_type; t->gen1 = gen1; t->gen2 = gen2; t->vind = 0; switch (c_type) { case SQL_C_CHAR: buf_len = NBYTES*2+1; break; case SQL_C_WCHAR: buf_len = (NBYTES*2+1) * sizeof(SQLWCHAR); break; default: buf_len = NBYTES; } t->buf = (char*) malloc(buf_len); if (!t->buf) { fprintf(stderr, "memory error\n"); exit(1); } if (c_type != SQL_C_CHAR && c_type != SQL_C_WCHAR) fill_chars(t->buf, NBYTES, t->gen1, t->gen2); else memset(t->buf, 0, buf_len); t->vind = SQL_LEN_DATA_AT_EXEC((SQLLEN) buf_len); } static void free_tests(void) { while (num_tests > 0) { test_info *t = &test_infos[--num_tests]; free(t->buf); t->buf = NULL; } } int main(int argc, char **argv) { SQLRETURN RetCode; SQLHSTMT old_odbc_stmt = SQL_NULL_HSTMT; int i; int key; SQLLEN vind0; int cnt = 2, wide; char sql[256]; test_info *t = NULL; odbc_use_version3 = 1; odbc_connect(); /* tests (W)CHAR/BINARY -> (W)CHAR/BINARY (9 cases) */ add_test(SQL_C_BINARY, SQL_LONGVARCHAR, "TEXT", 123, 1 ); add_test(SQL_C_BINARY, SQL_LONGVARBINARY, "IMAGE", 987, 25); add_test(SQL_C_CHAR, SQL_LONGVARBINARY, "IMAGE", 987, 25); add_test(SQL_C_CHAR, SQL_LONGVARCHAR, "TEXT", 343, 47); add_test(SQL_C_WCHAR, SQL_LONGVARBINARY, "IMAGE", 561, 29); add_test(SQL_C_WCHAR, SQL_LONGVARCHAR, "TEXT", 698, 24); if (odbc_db_is_microsoft()) { add_test(SQL_C_BINARY, SQL_WLONGVARCHAR, "NTEXT", 765, 12); add_test(SQL_C_CHAR, SQL_WLONGVARCHAR, "NTEXT", 237, 71); add_test(SQL_C_WCHAR, SQL_WLONGVARCHAR, "NTEXT", 687, 68); } strcpy(sql, "CREATE TABLE #tt(k INT"); for (t = test_infos; t < test_infos+num_tests; ++t) sprintf(strchr(sql, 0), ",f%u %s", t->num, t->db_type); strcat(sql, ",v INT)"); odbc_command(sql); old_odbc_stmt = odbc_stmt; odbc_stmt = SQL_NULL_HSTMT; /* Insert rows ... */ for (i = 0; i < cnt; i++) { /* MS do not save correctly char -> binary */ if (!odbc_driver_is_freetds() && i) continue; CHKAllocHandle(SQL_HANDLE_STMT, odbc_conn, &odbc_stmt, "S"); strcpy(sql, "INSERT INTO #tt VALUES(?"); for (t = test_infos; t < test_infos+num_tests; ++t) strcat(sql, ",?"); strcat(sql, ",?)"); CHKPrepare(T(sql), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0, "S"); for (t = test_infos; t < test_infos+num_tests; ++t) CHKBindParameter(t->num+1, SQL_PARAM_INPUT, t->c_type, t->sql_type, 0x10000000, 0, t->buf, 0, &t->vind, "S"); CHKBindParameter(num_tests+2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0, "S"); key = i; vind0 = 0; printf(">> insert... %d\n", i); RetCode = CHKExecute("SINe"); while (RetCode == SQL_NEED_DATA) { char *p; RetCode = CHKParamData((SQLPOINTER *) & p, "SINe"); printf(">> SQLParamData: ptr = %p RetCode = %d\n", (void *) p, RetCode); if (RetCode == SQL_NEED_DATA) { for (t = test_infos; t < test_infos+num_tests && t->buf != p; ++t) ; assert(t < test_infos+num_tests); if (t->c_type == SQL_C_CHAR || t->c_type == SQL_C_WCHAR) { unsigned char_len = 1; fill_hex(p, NBYTES, t->gen1, t->gen2); if (t->c_type == SQL_C_WCHAR) { char_len = sizeof(SQLWCHAR); odbc_to_sqlwchar((SQLWCHAR*) p, p, NBYTES * 2); } CHKPutData(p, (NBYTES - (i&1)) * char_len, "S"); printf(">> param %p: total bytes written = %d\n", (void *) p, NBYTES - (i&1)); CHKPutData(p + (NBYTES - (i&1)) * char_len, (NBYTES + (i&1)) * char_len, "S"); printf(">> param %p: total bytes written = %d\n", (void *) p, NBYTES + (i&1)); } else { CHKPutData(p, NBYTES, "S"); printf(">> param %p: total bytes written = %d\n", (void *) p, NBYTES); } } } CHKFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) odbc_stmt, "S"); odbc_stmt = SQL_NULL_HSTMT; } /* Now fetch rows ... */ for (wide = 0; wide < 2; ++wide) for (i = 0; i < cnt; i++) { /* MS do not save correctly char -> binary */ if (!odbc_driver_is_freetds() && i) continue; CHKAllocHandle(SQL_HANDLE_STMT, odbc_conn, &odbc_stmt, "S"); if (odbc_db_is_microsoft()) { CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER, "S"); } strcpy(sql, "SELECT "); for (t = test_infos; t < test_infos+num_tests; ++t) sprintf(strchr(sql, 0), "f%u,", t->num); strcat(sql, "v FROM #tt WHERE k = ?"); CHKPrepare(T(sql), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &i, 0, &vind0, "S"); for (t = test_infos; t < test_infos+num_tests; ++t) { t->vind = SQL_DATA_AT_EXEC; CHKBindCol(t->num, SQL_C_BINARY, NULL, 0, &t->vind, "S"); } CHKBindCol(num_tests+1, SQL_C_LONG, &key, 0, &vind0, "S"); vind0 = 0; CHKExecute("S"); CHKFetchScroll(SQL_FETCH_NEXT, 0, "S"); printf(">> fetch... %d\n", i); for (t = test_infos; t < test_infos+num_tests; ++t) { if (t->c_type == SQL_C_CHAR || t->c_type == SQL_C_WCHAR) readBlobAsChar(t, i, wide); else readBlob(t); } CHKCloseCursor("S"); CHKFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) odbc_stmt, "S"); odbc_stmt = SQL_NULL_HSTMT; } odbc_stmt = old_odbc_stmt; free_tests(); odbc_disconnect(); if (!failed) printf("ok!\n"); return failed ? 1 : 0; } freetds-1.3.6/src/odbc/unittests/cancel.c000644 025423 025423 00000010075 14056414271 021743 0ustar00fredianofrediano000000 000000 /* Testing SQLCancel() */ #include "common.h" #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #if TDS_HAVE_MUTEX #ifdef _WIN32 #undef HAVE_ALARM #endif static SQLTCHAR sqlstate[SQL_SQLSTATE_SIZE + 1]; static tds_mutex mtx; static void getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) { SQLINTEGER naterror = 0; SQLTCHAR msgtext[SQL_MAX_MESSAGE_LENGTH + 1]; SQLSMALLINT msgtextl = 0; msgtext[0] = 0; SQLGetDiagRec(sqlhdltype, (SQLHANDLE) sqlhandle, 1, sqlstate, &naterror, msgtext, (SQLSMALLINT) TDS_VECTOR_SIZE(msgtext), &msgtextl); sqlstate[TDS_VECTOR_SIZE(sqlstate)-1] = 0; fprintf(stderr, "Diagnostic info:\n"); fprintf(stderr, " SQL State: %s\n", C(sqlstate)); fprintf(stderr, " SQL code : %d\n", (int) naterror); fprintf(stderr, " Message : %s\n", C(msgtext)); } static void exit_forced(int s) { exit(1); } #if HAVE_ALARM static void sigalrm_handler(int s) { printf(">>>> SQLCancel() ...\n"); CHKCancel("S"); printf(">>>> ... SQLCancel done\n"); alarm(4); signal(SIGALRM, exit_forced); } #else #define alarm(x) return; #define signal(sig,h) #endif volatile int exit_thread; static TDS_THREAD_PROC_DECLARE(wait_thread_proc, arg) { int n; tds_sleep_s(4); printf(">>>> SQLCancel() ...\n"); CHKCancel("S"); printf(">>>> ... SQLCancel done\n"); for (n = 0; n < 4; ++n) { tds_sleep_s(1); tds_mutex_lock(&mtx); if (exit_thread) { tds_mutex_unlock(&mtx); return TDS_THREAD_RESULT(0); } tds_mutex_unlock(&mtx); } exit_forced(0); return TDS_THREAD_RESULT(0); } static void Test(int use_threads, int return_data) { tds_thread wait_thread; #if !HAVE_ALARM if (!use_threads) return; #endif printf("testing with %s\n", use_threads ? "threads" : "signals"); printf(">> Wait 5 minutes...\n"); if (!use_threads) { alarm(4); signal(SIGALRM, sigalrm_handler); } else { int err; exit_thread = 0; err = tds_thread_create(&wait_thread, wait_thread_proc, NULL); if (err != 0) { perror("tds_thread_create"); exit(1); } } if (!return_data) CHKExecDirect(T("WAITFOR DELAY '000:05:00'"), SQL_NTS, "E"); else odbc_command2("SELECT MAX(p1.k + p2.k * p3.k ^ p4.k) FROM tab1 p1, tab1 p2, tab1 p3, tab1 p4", "E"); tds_mutex_lock(&mtx); exit_thread = 1; tds_mutex_unlock(&mtx); if (!use_threads) { alarm(0); } else { tds_thread_join(wait_thread, NULL); } getErrorInfo(SQL_HANDLE_STMT, odbc_stmt); if (strcmp(C(sqlstate), "HY008") != 0) { fprintf(stderr, "Unexpected sql state returned\n"); odbc_disconnect(); exit(1); } odbc_reset_statement(); odbc_command("SELECT name FROM sysobjects WHERE 0=1"); } int main(int argc, char **argv) { if (tds_mutex_init(&mtx)) return 1; if (odbc_read_login_info()) exit(1); /* * prepare our odbcinst.ini * is better to do it before connect cause uniODBC cache INIs * the name must be odbcinst.ini cause unixODBC accept only this name */ if (odbc_driver[0]) { FILE *f = fopen("odbcinst.ini", "w"); if (f) { fprintf(f, "[FreeTDS]\nDriver = %s\nThreading = 0\n", odbc_driver); fclose(f); /* force iODBC */ setenv("ODBCINSTINI", "./odbcinst.ini", 1); setenv("SYSODBCINSTINI", "./odbcinst.ini", 1); /* force unixODBC (only directory) */ setenv("ODBCSYSINI", ".", 1); } } odbc_use_version3 = 1; odbc_connect(); odbc_command("IF OBJECT_ID('tab1') IS NOT NULL DROP TABLE tab1"); odbc_command("CREATE TABLE tab1 ( k INT, vc VARCHAR(200) )"); printf(">> Creating tab1...\n"); odbc_command("DECLARE @i INT\n" "SET @i = 1\n" "WHILE @i <= 2000 BEGIN\n" "INSERT INTO tab1 VALUES ( @i, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' )\n" "SET @i = @i + 1\n" "END"); while (CHKMoreResults("SNo") == SQL_SUCCESS) continue; printf(">> ...done.\n"); odbc_reset_statement(); Test(0, 0); Test(1, 0); Test(0, 1); Test(1, 1); odbc_command("DROP TABLE tab1"); odbc_disconnect(); return 0; } #else int main(void) { printf("Not possible for this platform.\n"); return 0; } #endif freetds-1.3.6/src/odbc/unittests/closestmt.c000644 025423 025423 00000002520 14056414222 022523 0ustar00fredianofrediano000000 000000 #include "common.h" /* * This test attempt to test if closing a statement with prepared query * success if there are a pending query on the same connection from * another statement. */ #define SWAP_STMT(b) do { SQLHSTMT xyz = odbc_stmt; odbc_stmt = b; b = xyz; } while(0) int main(int argc, char *argv[]) { char sql[128]; int i; SQLHSTMT stmt; SQLINTEGER num; odbc_use_version3 = 1; odbc_connect(); /* create a table with some rows */ odbc_command("create table #tmp (i int, c varchar(100))"); odbc_command("insert into #tmp values(1, 'some data')"); for (i = 0; i < 8; ++i) { sprintf(sql, "insert into #tmp select i+%d, c from #tmp where i <= %d", 1 << i, 1 << i); odbc_command(sql); } /* execute a prepared query on the connection and get all rows */ CHKPrepare(T("select i from #tmp where i < ?"), SQL_NTS, "S"); num = 5; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &num, 0, NULL, "S"); CHKExecute("S"); for (i = 1; i < 5; ++i) CHKFetch("S"); CHKFetch("No"); CHKMoreResults("No"); /* start getting some data from another statement */ CHKAllocStmt(&stmt, "S"); SWAP_STMT(stmt); CHKExecDirect(T("select * from #tmp"), SQL_NTS, "S"); /* close first statement with data pending on second */ SWAP_STMT(stmt); CHKFreeStmt(SQL_DROP, "S"); SWAP_STMT(stmt); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/compute.c000644 025423 025423 00000012161 14056414221 022163 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* Test compute results */ /* * This it's quite important cause it test different result types * mssql odbc have also some extension not supported by FreeTDS * and declared in odbcss.h */ static char col1[256], col2[256]; static SQLLEN ind1, ind2; static int main_line; static void TestName(SQLSMALLINT index, const char *expected_name) { SQLTCHAR name[128]; char buf[256]; SQLSMALLINT len, type; #define NAME_TEST \ do { \ if (strcmp(C(name), expected_name) != 0) \ { \ sprintf(buf, "line %d: wrong name in column %d expected '%s' got '%s'", \ main_line, index, expected_name, C(name)); \ ODBC_REPORT_ERROR(buf); \ } \ } while(0) /* retrieve with SQLDescribeCol */ CHKDescribeCol(index, name, TDS_VECTOR_SIZE(name), &len, &type, NULL, NULL, NULL, "S"); NAME_TEST; /* retrieve with SQLColAttribute */ CHKColAttribute(index, SQL_DESC_NAME, name, TDS_VECTOR_SIZE(name), &len, NULL, "S"); if (odbc_db_is_microsoft()) NAME_TEST; CHKColAttribute(index, SQL_DESC_LABEL, name, TDS_VECTOR_SIZE(name), &len, NULL, "S"); NAME_TEST; } static void CheckFetch(const char *c1name, const char *c1, const char *c2) { int error = 0; TestName(1, c1name); CHKFetch("S"); if (strlen(c1) != ind1 || strcmp(c1, col1) != 0) { fprintf(stderr, "%s:%d: Column 1 error '%s' (%d) expected '%s' (%d)\n", __FILE__, main_line, col1, (int) ind1, c1, (int) strlen(c1)); error = 1; } if (strlen(c2) != ind2 || strcmp(c2, col2) != 0) { fprintf(stderr, "%s:%d: Column 2 error '%s' (%d) expected '%s' (%d)\n", __FILE__, main_line, col2, (int) ind2, c2, (int) strlen(c2)); error = 1; } if (error) exit(1); } #define CheckFetch main_line = __LINE__; CheckFetch int main(int argc, char *argv[]) { odbc_connect(); /* MSSQL 2012+, compute not supported */ if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x0b000000u) { odbc_disconnect(); return 0; } odbc_command("create table #tmp1 (c varchar(20), i int)"); odbc_command("insert into #tmp1 values('pippo', 12)"); odbc_command("insert into #tmp1 values('pippo', 34)"); odbc_command("insert into #tmp1 values('pluto', 1)"); odbc_command("insert into #tmp1 values('pluto', 2)"); odbc_command("insert into #tmp1 values('pluto', 3)"); /* * TODO skip rows/column on compute (compute.c) * TODO check rows/column after moreresults after compute */ /* select * from #tmp1 compute sum(i) */ SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); odbc_command("select * from #tmp1 order by c, i compute sum(i)"); CheckFetch("c", "pippo", "12"); CheckFetch("c", "pippo", "34"); CheckFetch("c", "pluto", "1"); CheckFetch("c", "pluto", "2"); CheckFetch("c", "pluto", "3"); CHKFetch("No"); CHKMoreResults("S"); /* why I need to rebind ?? ms bug of feature ?? */ SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); col2[0] = '@'; CheckFetch("sum", "52", "@"); CHKFetch("No"); CHKMoreResults("No"); /* select * from #tmp1 order by c compute sum(i) by c */ SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); odbc_command("select c as mao, i from #tmp1 order by c, i compute sum(i) by c compute max(i)"); CheckFetch("mao", "pippo", "12"); CheckFetch("mao", "pippo", "34"); CHKFetch("No"); CHKMoreResults("S"); SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); strcpy(col2, "##"); CheckFetch("sum", "46", "##"); CHKFetch("No"); CHKMoreResults("S"); SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); CheckFetch("mao", "pluto", "1"); CheckFetch("mao", "pluto", "2"); CheckFetch("mao", "pluto", "3"); CHKFetch("No"); CHKMoreResults("S"); SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); strcpy(col2, "%"); CheckFetch("sum", "6", "%"); CHKFetch("No"); CHKMoreResults("S"); SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); strcpy(col2, "&"); CheckFetch("max", "34", "&"); CHKFetch("No"); CHKMoreResults("No"); /* test skip recordset with computed rows */ /* select * from #tmp1 where i = 2 compute min(i) */ SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); odbc_command("select * from #tmp1 where i = 2 or i = 34 order by c, i compute min(i) by c"); CheckFetch("c", "pippo", "34"); CHKFetch("No"); CHKMoreResults("S"); /* here just skip results, before a row */ CHKMoreResults("S"); SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); CheckFetch("c", "pluto", "2"); CHKFetch("No"); CHKMoreResults("S"); /* here just skip results, before done */ CHKMoreResults("No"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/connect.c000644 025423 025423 00000010344 14056414221 022141 0ustar00fredianofrediano000000 000000 #include "common.h" static void init_connect(void); static void init_connect(void) { CHKAllocEnv(&odbc_env, "S"); CHKAllocConnect(&odbc_conn, "S"); } #ifdef _WIN32 #include static char *entry = NULL; static char * get_entry(const char *key) { static TCHAR buf[256]; entry = NULL; if (SQLGetPrivateProfileString(T(odbc_server), T(key), TEXT(""), buf, TDS_VECTOR_SIZE(buf), TEXT("odbc.ini")) > 0) entry = C(buf); return entry; } #endif int main(int argc, char *argv[]) { char tmp[1024*4]; SQLSMALLINT len; int succeeded = 0; int is_freetds = 1; int is_ms; SQLRETURN rc; if (odbc_read_login_info()) exit(1); /* * prepare our odbcinst.ini * is better to do it before connect cause uniODBC cache INIs * the name must be odbcinst.ini cause unixODBC accept only this name */ if (odbc_driver[0]) { FILE *f = fopen("odbcinst.ini", "w"); if (f) { fprintf(f, "[FreeTDS]\nDriver = %s\n", odbc_driver); fclose(f); /* force iODBC */ setenv("ODBCINSTINI", "./odbcinst.ini", 1); setenv("SYSODBCINSTINI", "./odbcinst.ini", 1); /* force unixODBC (only directory) */ setenv("ODBCSYSINI", ".", 1); } } printf("SQLConnect connect..\n"); odbc_connect(); if (!odbc_driver_is_freetds()) is_freetds = 0; is_ms = odbc_db_is_microsoft(); odbc_disconnect(); ++succeeded; if (!is_freetds) { printf("Driver is not FreeTDS, exiting\n"); return 0; } /* try connect string with using DSN */ printf("connect string DSN connect..\n"); init_connect(); sprintf(tmp, "DSN=%s;UID=%s;PWD=%s;DATABASE=%s;", odbc_server, odbc_user, odbc_password, odbc_database); CHKDriverConnect(NULL, T(tmp), SQL_NTS, (SQLTCHAR *) tmp, sizeof(tmp)/sizeof(SQLTCHAR), &len, SQL_DRIVER_NOPROMPT, "SI"); odbc_disconnect(); ++succeeded; /* try connect string using old SERVERNAME specification */ printf("connect string SERVERNAME connect..\n"); printf("odbcinst.ini must be configured with FreeTDS driver..\n"); /* this is expected to work with unixODBC */ init_connect(); sprintf(tmp, "DRIVER=FreeTDS;SERVERNAME=%s;UID=%s;PWD=%s;DATABASE=%s;", odbc_server, odbc_user, odbc_password, odbc_database); rc = CHKDriverConnect(NULL, T(tmp), SQL_NTS, (SQLTCHAR *) tmp, sizeof(tmp)/sizeof(SQLTCHAR), &len, SQL_DRIVER_NOPROMPT, "SIE"); if (rc == SQL_ERROR) { printf("Unable to open data source (ret=%d)\n", rc); } else { ++succeeded; } odbc_disconnect(); /* this is expected to work with iODBC * (passing shared object name as driver) */ if (odbc_driver[0]) { init_connect(); sprintf(tmp, "DRIVER=%s;SERVERNAME=%s;UID=%s;PWD=%s;DATABASE=%s;", odbc_driver, odbc_server, odbc_user, odbc_password, odbc_database); rc = CHKDriverConnect(NULL, T(tmp), SQL_NTS, (SQLTCHAR *) tmp, sizeof(tmp)/sizeof(SQLTCHAR), &len, SQL_DRIVER_NOPROMPT, "SIE"); if (rc == SQL_ERROR) { printf("Unable to open data source (ret=%d)\n", rc); } else { ++succeeded; } odbc_disconnect(); } #ifdef _WIN32 if (get_entry("SERVER")) { init_connect(); sprintf(tmp, "DRIVER=FreeTDS;SERVER=%s;UID=%s;PWD=%s;DATABASE=%s;", entry, odbc_user, odbc_password, odbc_database); if (get_entry("TDS_Version")) sprintf(strchr(tmp, 0), "TDS_Version=%s;", entry); if (get_entry("Port")) sprintf(strchr(tmp, 0), "Port=%s;", entry); rc = CHKDriverConnect(NULL, T(tmp), SQL_NTS, (SQLTCHAR *) tmp, sizeof(tmp)/sizeof(SQLTCHAR), &len, SQL_DRIVER_NOPROMPT, "SIE"); if (rc == SQL_ERROR) { printf("Unable to open data source (ret=%d)\n", rc); } else { ++succeeded; } odbc_disconnect(); } #endif if (is_ms) { char app_name[130]; memset(app_name, 'a', sizeof(app_name)); app_name[sizeof(app_name) - 1] = 0; /* Try passing very long APP string. * The server is supposed to fail the connection if * this string is too long, make sure we trucate it. */ printf("connect string DSN connect with a long APP..\n"); init_connect(); sprintf(tmp, "DSN=%s;UID=%s;PWD=%s;DATABASE=%s;APP=%s", odbc_server, odbc_user, odbc_password, odbc_database, app_name); CHKDriverConnect(NULL, T(tmp), SQL_NTS, (SQLTCHAR *) tmp, sizeof(tmp)/sizeof(SQLTCHAR), &len, SQL_DRIVER_NOPROMPT, "SI"); odbc_disconnect(); } /* at least one should success.. */ if (succeeded < 3) { ODBC_REPORT_ERROR("Too few successes"); exit(1); } printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/connect2.c000644 025423 025423 00000005262 14056414221 022226 0ustar00fredianofrediano000000 000000 #include "common.h" /* * Test setting current "catalog" before and after connection using * either SQLConnect and SQLDriverConnect */ static int failed = 0; static void init_connect(void); static void init_connect(void) { CHKAllocEnv(&odbc_env, "S"); CHKAllocConnect(&odbc_conn, "S"); } static void normal_connect(void) { CHKConnect(T(odbc_server), SQL_NTS, T(odbc_user), SQL_NTS, T(odbc_password), SQL_NTS, "SI"); } static void driver_connect(const char *conn_str) { SQLTCHAR tmp[1024]; SQLSMALLINT len; CHKDriverConnect(NULL, T(conn_str), SQL_NTS, tmp, TDS_VECTOR_SIZE(tmp), &len, SQL_DRIVER_NOPROMPT, "SI"); } static void check_dbname(const char *dbname) { SQLINTEGER len; SQLTCHAR out[512]; char sql[1024]; len = sizeof(out); CHKGetConnectAttr(SQL_ATTR_CURRENT_CATALOG, (SQLPOINTER) out, sizeof(out), &len, "SI"); if (strcmp(C(out), dbname) != 0) { fprintf(stderr, "Current database (%s) is not %s\n", C(out), dbname); failed = 1; } sprintf(sql, "IF DB_NAME() <> '%s' SELECT 1", dbname); CHKAllocStmt(&odbc_stmt, "S"); odbc_check_no_row(sql); SQLFreeStmt(odbc_stmt, SQL_DROP); odbc_stmt = SQL_NULL_HSTMT; } static void set_dbname(const char *dbname) { CHKSetConnectAttr(SQL_ATTR_CURRENT_CATALOG, (SQLPOINTER) T(dbname), strlen(dbname)*sizeof(SQLTCHAR), "SI"); } int main(int argc, char *argv[]) { char tmp[1024*3]; if (odbc_read_login_info()) exit(1); /* try setting db name before connect */ printf("SQLConnect before 1..\n"); init_connect(); set_dbname("master"); normal_connect(); check_dbname("master"); /* check change after connection */ printf("SQLConnect after..\n"); set_dbname("tempdb"); check_dbname("tempdb"); printf("SQLConnect after not existing..\n"); strcpy(tmp, "IDontExist"); CHKSetConnectAttr(SQL_ATTR_CURRENT_CATALOG, (SQLPOINTER) tmp, strlen(tmp), "E"); check_dbname("tempdb"); odbc_disconnect(); /* try setting db name before connect */ printf("SQLConnect before 2..\n"); init_connect(); set_dbname("tempdb"); normal_connect(); check_dbname("tempdb"); odbc_disconnect(); /* try connect string with using DSN */ printf("SQLDriverConnect before 1..\n"); sprintf(tmp, "DSN=%s;UID=%s;PWD=%s;DATABASE=%s;", odbc_server, odbc_user, odbc_password, odbc_database); init_connect(); set_dbname("master"); driver_connect(tmp); check_dbname(odbc_database); odbc_disconnect(); /* try connect string with using DSN */ printf("SQLDriverConnect before 2..\n"); sprintf(tmp, "DSN=%s;UID=%s;PWD=%s;", odbc_server, odbc_user, odbc_password); init_connect(); set_dbname("tempdb"); driver_connect(tmp); check_dbname("tempdb"); odbc_disconnect(); if (failed) { printf("Some tests failed\n"); return 1; } printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/const_params.c000644 025423 025423 00000007545 14056414221 023212 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for {?=call store(?,123,'foo')} syntax and run */ int main(int argc, char *argv[]) { SQLINTEGER input, output; SQLINTEGER out1; SQLLEN ind, ind2, ind3; const char *sql; odbc_connect(); if (odbc_command_with_result(odbc_stmt, "drop proc const_param") != SQL_SUCCESS) printf("Unable to execute statement\n"); odbc_command("create proc const_param @in1 int, @in2 int, @in3 datetime, @in4 varchar(10), @out int output as\n" "begin\n" " set nocount on\n" " select @out = 7654321\n" " if (@in1 <> @in2 and @in2 is not null) or @in3 <> convert(datetime, '2004-10-15 12:09:08') or @in4 <> 'foo'\n" " select @out = 1234567\n" " return 24680\n" "end"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind, "S"); CHKBindParameter(2, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind2, "S"); /* TODO use {ts ...} for date */ CHKPrepare(T("{call const_param(?, 13579, '2004-10-15 12:09:08', 'foo', ?)}"), SQL_NTS, "S"); input = 13579; ind = sizeof(input); out1 = output = 0xdeadbeef; CHKExecute("S"); if (out1 != 7654321) { fprintf(stderr, "Invalid output %d (0x%x)\n", (int) out1, (int) out1); return 1; } /* just to reset some possible buffers */ odbc_command("DECLARE @i INT"); /* MS ODBC don't support empty parameters altough documented so avoid this test */ if (odbc_driver_is_freetds()) { CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind, "S"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2, "S"); CHKBindParameter(3, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind3, "S"); /* TODO use {ts ...} for date */ CHKPrepare(T("{?=call const_param(?, , '2004-10-15 12:09:08', 'foo', ?)}"), SQL_NTS, "S"); input = 13579; ind2 = sizeof(input); out1 = output = 0xdeadbeef; CHKExecute("S"); if (out1 != 7654321) { fprintf(stderr, "Invalid output %d (0x%x)\n", (int) out1, (int) out1); return 1; } if (output != 24680) { fprintf(stderr, "Invalid result %d (0x%x) expected 24680\n", (int) output, (int) output); return 1; } } odbc_command("IF OBJECT_ID('const_param') IS NOT NULL DROP PROC const_param"); odbc_command("create proc const_param @in1 float, @in2 varbinary(100) as\n" "begin\n" " if @in1 <> 12.5 or @in2 <> 0x0102030405060708\n" " return 12345\n" " return 54321\n" "end"); CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind, "S"); CHKPrepare(T("{?=call const_param(12.5, 0x0102030405060708)}"), SQL_NTS, "S"); output = 0xdeadbeef; CHKExecute("S"); if (output != 54321) { fprintf(stderr, "Invalid result %d (0x%x) expected 54321\n", (int) output, (int) output); return 1; } odbc_command("drop proc const_param"); odbc_command("create proc const_param @in varchar(20) as\n" "begin\n" " if @in = 'value' select 8421\n" " select 1248\n" "end"); /* catch problem reported by Peter Deacon */ output = 0xdeadbeef; odbc_command("{CALL const_param('value')}"); CHKBindCol(1, SQL_C_SLONG, &output, 0, &ind, "S"); SQLFetch(odbc_stmt); if (output != 8421) { fprintf(stderr, "Invalid result %d (0x%x)\n", (int) output, (int) output); return 1; } odbc_reset_statement(); odbc_command("drop proc const_param"); sql = "create proc const_param @in1 bigint as\n" "begin\n" " if @in1 <> 1000000000000 select 0 else select 1\n" "end"; if (odbc_command_with_result(odbc_stmt, sql) == SQL_SUCCESS) { output = 0xdeadbeef; odbc_command("{CALL const_param(1000000000000)}"); CHKBindCol(1, SQL_C_SLONG, &output, 0, &ind, "S"); SQLFetch(odbc_stmt); if (output != 1) { fprintf(stderr, "Invalid result %d (0x%x)\n", (int) output, (int) output); return 1; } odbc_reset_statement(); odbc_command("drop proc const_param"); } odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/convert_error.c000644 025423 025423 00000003236 14056414221 023403 0ustar00fredianofrediano000000 000000 /* * test SQLBindParameter with text and Sybase * test from Keith Woodard (bug #885122) */ #include "common.h" static char software_version[] = "$Id: convert_error.c,v 1.12 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static int test_num = 0; static void Test(const char *bind1, SQLSMALLINT type1, const char *bind2, SQLSMALLINT type2) { char sql[512]; char *val = "test"; SQLLEN ind = 4; int id = 1; ODBC_BUF *odbc_buf = NULL; SQLFreeStmt(odbc_stmt, SQL_RESET_PARAMS); ++test_num; sprintf(sql, "insert into #test_output values (%s, %s)", bind1, bind2); CHKPrepare(T(sql), strlen(sql), "S"); if (bind1[0] == '?') CHKBindParameter(id++, SQL_PARAM_INPUT, SQL_C_LONG, type1, 3, 0, &test_num, 0, &ind, "S"); if (bind2[0] == '?') CHKBindParameter(id++, SQL_PARAM_INPUT, SQL_C_CHAR, type2, strlen(val) + 1, 0, (SQLCHAR *) val, 0, &ind, "S"); CHKExecute("S"); ODBC_FREE(); } int main(int argc, char **argv) { odbc_use_version3 = 1; odbc_connect(); odbc_command("create table #test_output (id int, msg text)"); Test("?", SQL_INTEGER, "?", SQL_LONGVARCHAR); Test("123", SQL_INTEGER, "?", SQL_LONGVARCHAR); Test("?", SQL_INTEGER, "'foo'", SQL_LONGVARCHAR); Test("?", SQL_INTEGER, "?", SQL_VARCHAR); /* * Sybase cannot pass this test without complicated query parsing. * Query with blob columns cannot be prepared so prepared query must * be emulated loosing column informations from server and Sybase do * not convert implicitly VARCHAR to INT */ if (odbc_db_is_microsoft()) Test("?", SQL_VARCHAR, "?", SQL_LONGVARCHAR); else ++test_num; odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/copydesc.c000644 025423 025423 00000001712 14056414221 022320 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test SQLCopyDesc and SQLAllocHandle(SQL_HANDLE_DESC) */ static char software_version[] = "$Id: copydesc.c,v 1.7 2010-07-05 09:20:32 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char *argv[]) { SQLHDESC ard, ard2, ard3; SQLINTEGER id; SQLLEN ind1, ind2; char name[64]; odbc_connect(); CHKGetStmtAttr(SQL_ATTR_APP_ROW_DESC, &ard, 0, NULL, "S"); CHKBindCol(1, SQL_C_SLONG, &id, sizeof(SQLINTEGER), &ind1, "S"); CHKBindCol(2, SQL_C_CHAR, name, sizeof(name), &ind2, "S"); CHKAllocHandle(SQL_HANDLE_DESC, odbc_conn, &ard2, "S"); /* * this is an additional test to test additional allocation * As of 0.64 for a bug in SQLAllocDesc we only allow to allocate one */ CHKAllocHandle(SQL_HANDLE_DESC, odbc_conn, &ard3, "S"); CHKR(SQLCopyDesc, (ard, ard2), "S"); CHKFreeHandle(SQL_HANDLE_DESC, ard3, "S"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/cursor1.c000644 025423 025423 00000011267 14056414221 022113 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test cursors */ #define SWAP_STMT(b) do { SQLHSTMT xyz = odbc_stmt; odbc_stmt = b; b = xyz; } while(0) static int mssql2005 = 0; static void Test0(int use_sql, const char *create_sql, const char *insert_sql, const char *select_sql) { #define ROWS 4 #define C_LEN 10 SQLUINTEGER n[ROWS]; char c[ROWS][C_LEN]; SQLLEN c_len[ROWS], n_len[ROWS]; SQLUSMALLINT statuses[ROWS]; SQLUSMALLINT i; SQLULEN num_row; SQLHSTMT stmt2; /* create test table */ odbc_command("IF OBJECT_ID('tempdb..#test') IS NOT NULL DROP TABLE #test"); odbc_command(create_sql); for (i = 1; i <= 6; ++i) { char sql_buf[80], data[10]; memset(data, 'a' + (i - 1), sizeof(data)); data[i] = 0; sprintf(sql_buf, insert_sql, data, i); odbc_command(sql_buf); } /* set cursor options */ odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_ROWVER, 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER) ROWS, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_STATUS_PTR, (SQLPOINTER) statuses, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROWS_FETCHED_PTR, &num_row, 0, "S"); CHKSetCursorName(T("C1"), SQL_NTS, "S"); /* */ CHKExecDirect(T(select_sql), SQL_NTS, "S"); /* bind some rows at a time */ CHKBindCol(1, SQL_C_ULONG, n, 0, n_len, "S"); CHKBindCol(2, SQL_C_CHAR, c, C_LEN, c_len, "S"); /* allocate an additional statement */ CHKAllocStmt(&stmt2, "S"); while (CHKFetchScroll(SQL_FETCH_NEXT, 0, "SNo") == SQL_SUCCESS) { /* print, just for debug */ for (i = 0; i < num_row; ++i) printf("row %d i %d c %s\n", (int) (i + 1), (int) n[i], c[i]); printf("---\n"); /* delete a row */ i = 1; if (i > 0 && i <= num_row) { CHKSetPos(i, use_sql ? SQL_POSITION : SQL_DELETE, SQL_LOCK_NO_CHANGE, mssql2005 ? "SI": "S"); if (use_sql) { SWAP_STMT(stmt2); CHKPrepare(T("DELETE FROM #test WHERE CURRENT OF C1"), SQL_NTS, "S"); CHKExecute("S"); SWAP_STMT(stmt2); } } /* update another row */ i = 2; if (i > 0 && i <= num_row) { strcpy(c[i - 1], "foo"); c_len[i - 1] = 3; if (strstr(select_sql, "#a") == NULL || use_sql) { CHKSetPos(i, use_sql ? SQL_POSITION : SQL_UPDATE, SQL_LOCK_NO_CHANGE, "S"); } else { SQLTCHAR sqlstate[6]; SQLTCHAR msg[256]; n[i - 1] = 321; CHKSetPos(i, use_sql ? SQL_POSITION : SQL_UPDATE, SQL_LOCK_NO_CHANGE, "E"); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(msg), NULL, "S"); if (strstr(C(msg), "Invalid column name 'c'") == NULL) { fprintf(stderr, "Expected message not found at line %d\n", __LINE__); exit(1); } } if (use_sql) { SWAP_STMT(stmt2); CHKPrepare(T("UPDATE #test SET c=? WHERE CURRENT OF C1"), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, C_LEN, 0, c[i - 1], 0, NULL, "S"); CHKExecute("S"); /* FIXME this is not necessary for mssql driver */ SQLMoreResults(odbc_stmt); SWAP_STMT(stmt2); } } } SWAP_STMT(stmt2); CHKFreeStmt(SQL_DROP, "S"); SWAP_STMT(stmt2); odbc_reset_statement(); /* test values */ odbc_check_no_row("IF (SELECT COUNT(*) FROM #test) <> 4 SELECT 1"); odbc_check_no_row("IF NOT EXISTS(SELECT * FROM #test WHERE i = 3 AND c = 'ccc') SELECT 1"); odbc_check_no_row("IF NOT EXISTS(SELECT * FROM #test WHERE i = 4 AND c = 'dddd') SELECT 1"); if (strstr(select_sql, "#a") == NULL || use_sql) { odbc_check_no_row("IF NOT EXISTS(SELECT * FROM #test WHERE i = 2 AND c = 'foo') SELECT 1"); odbc_check_no_row("IF NOT EXISTS(SELECT * FROM #test WHERE i = 6 AND c = 'foo') SELECT 1"); } } static void Test(int use_sql) { odbc_command_with_result(odbc_stmt, "DROP TABLE #a"); odbc_command("CREATE TABLE #a(x int)"); odbc_command("INSERT INTO #a VALUES(123)"); Test0(use_sql, "CREATE TABLE #test(i int, c varchar(6))", "INSERT INTO #test(c, i) VALUES('%s', %d)", "SELECT x AS i, c FROM #test, #a"); Test0(use_sql, "CREATE TABLE #test(i int, c varchar(6))", "INSERT INTO #test(c, i) VALUES('%s', %d)", "SELECT i, c FROM #test"); if (odbc_db_is_microsoft()) { Test0(use_sql, "CREATE TABLE #test(i int identity(1,1), c varchar(6))", "INSERT INTO #test(c) VALUES('%s')", "SELECT i, c FROM #test"); Test0(use_sql, "CREATE TABLE #test(i int primary key, c varchar(6))", "INSERT INTO #test(c, i) VALUES('%s', %d)", "SELECT i, c FROM #test"); } Test0(use_sql, "CREATE TABLE #test(i int, c varchar(6))", "INSERT INTO #test(c, i) VALUES('%s', %d)", "SELECT i, c, c + 'xxx' FROM #test"); } int main(int argc, char *argv[]) { odbc_connect(); odbc_check_cursor(); if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x09000000u) mssql2005 = 1; Test(1); Test(0); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/cursor2.c000644 025423 025423 00000002447 14056414221 022114 0ustar00fredianofrediano000000 000000 #include "common.h" /* * 1) Test cursor do not give error for statement that do not return rows * 2) Test cursor returns results on language RPCs */ static char software_version[] = "$Id: cursor2.c,v 1.12 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char *argv[]) { SQLTCHAR sqlstate[6]; SQLTCHAR msg[256]; odbc_connect(); odbc_check_cursor(); odbc_command("CREATE TABLE #cursor2_test (i INT)"); odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, SQL_IS_INTEGER, "S"); /* this should not fail or return warnings */ odbc_command("DROP TABLE #cursor2_test"); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(msg), NULL, "No"); odbc_reset_statement(); odbc_command_with_result(odbc_stmt, "if object_id('sp_test') is not null drop proc sp_test"); odbc_command("create proc sp_test @name varchar(30) as select 0 as pippo select 1 as 'test', @name as 'nome'"); odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_STATIC, SQL_IS_INTEGER, "S"); odbc_command(" exec sp_test 'ciao'"); CHKFetch("S"); odbc_reset_statement(); odbc_command("drop proc sp_test"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/data.c000644 025423 025423 00000010564 14056414271 021432 0ustar00fredianofrediano000000 000000 /* * Test reading data with SQLBindCol */ #include "common.h" #include #include #include "parser.h" /* * This test is useful to test odbc_tds2sql function * odbc_tds2sql have some particular cases: * (1) numeric -> binary numeric is different in ODBC * (2) * -> binary dependent from libTDS representation and ODBC one * (3) binary -> char TODO * (4) date -> char different format * Also we have to check normal char and wide char */ static int result = 0; static int ignore_select_error = 0; static int ignore_result = 0; static void Test(const char *type, const char *value_to_convert, SQLSMALLINT out_c_type, const char *expected) { char sbuf[1024]; unsigned char out_buf[256]; SQLLEN out_len = 0; SQLFreeStmt(odbc_stmt, SQL_UNBIND); SQLFreeStmt(odbc_stmt, SQL_RESET_PARAMS); /* execute a select to get data as wire */ sprintf(sbuf, "SELECT CONVERT(%s, '%s') AS data", type, value_to_convert); if (strncmp(value_to_convert, "0x", 2) == 0) { if (odbc_db_is_microsoft()) sprintf(sbuf, "SELECT CONVERT(%s, %s) COLLATE Latin1_General_CI_AS AS data", type, value_to_convert); else sprintf(sbuf, "SELECT CONVERT(%s, %s)", type, value_to_convert); } else if (strcmp(type, "SQL_VARIANT") == 0) sprintf(sbuf, "SELECT CONVERT(SQL_VARIANT, %s) AS data", value_to_convert); else if (strncmp(value_to_convert, "u&'", 3) == 0) sprintf(sbuf, "SELECT CONVERT(%s, %s) AS data", type, value_to_convert); if (ignore_select_error) { if (odbc_command2(sbuf, "SENo") == SQL_ERROR) { odbc_reset_statement(); ignore_select_error = 0; ignore_result = 0; return; } } else { odbc_command(sbuf); } SQLBindCol(odbc_stmt, 1, out_c_type, out_buf, sizeof(out_buf), &out_len); CHKFetch("S"); CHKFetch("No"); CHKMoreResults("No"); /* test results */ odbc_c2string(sbuf, out_c_type, out_buf, out_len); if (!ignore_result && strcmp(sbuf, expected) != 0) { fprintf(stderr, "Wrong result\n Got: %s\n Expected: %s\n", sbuf, expected); result = 1; } ignore_select_error = 0; ignore_result = 0; } static int get_int(const char *s) { char *end; long l; if (!s) odbc_fatal(": NULL int\n"); l = strtol(s, &end, 0); if (end[0]) odbc_fatal(": Invalid int\n"); return (int) l; } static int lookup(const char *name, const struct odbc_lookup_int *table) { int res; if (!table) return get_int(name); res = odbc_lookup(name, table, SQL_UNKNOWN_TYPE); return res == SQL_UNKNOWN_TYPE ? get_int(name) : res; } int main(int argc, char *argv[]) { int cond = 1; #define TEST_FILE "data.in" const char *in_file = FREETDS_SRCDIR "/" TEST_FILE; FILE *f; odbc_connect(); odbc_init_bools(); f = fopen(in_file, "r"); if (!f) f = fopen(TEST_FILE, "r"); if (!f) { fprintf(stderr, "error opening test file\n"); exit(1); } odbc_init_parser(f); for (;;) { char *p; const char *cmd = odbc_get_cmd_line(&p, &cond); if (!cmd) break; /* select type */ if (!strcmp(cmd, "select")) { const char *type = odbc_get_str(&p); const char *value = odbc_get_str(&p); int c_type = lookup(odbc_get_tok(&p), odbc_sql_c_types); const char *expected = odbc_get_str(&p); if (!cond) continue; ignore_select_error = 1; Test(type, value, c_type, expected); continue; } /* select type setting condition */ if (!strcmp(cmd, "select_cond")) { const char *bool_name = odbc_get_tok(&p); const char *type = odbc_get_tok(&p); const char *value = odbc_get_str(&p); int c_type = lookup(odbc_get_tok(&p), odbc_sql_c_types); const char *expected = odbc_get_str(&p); int save_result = result; if (!bool_name) odbc_fatal(": no condition name\n"); if (!cond) continue; ignore_select_error = 1; ignore_result = 1; result = 0; Test(type, value, c_type, expected); odbc_set_bool(bool_name, result == 0); result = save_result; continue; } /* execute a sql command */ if (!strcmp(cmd, "sql")) { const char *sql = odbc_get_str(&p); if (!cond) continue; odbc_command(sql); continue; } if (!strcmp(cmd, "sql_cond")) { const char *bool_name = odbc_get_tok(&p); const char *sql = odbc_get_str(&p); if (!cond) continue; odbc_set_bool(bool_name, odbc_command2(sql, "SENo") != SQL_ERROR); continue; } odbc_fatal(": unknown command\n"); } odbc_clear_bools(); fclose(f); printf("\n"); odbc_disconnect(); if (!result) printf("Done successfully!\n"); return result; } freetds-1.3.6/src/odbc/unittests/cursor3.c000644 025423 025423 00000006131 14056414221 022107 0ustar00fredianofrediano000000 000000 /* Tests 2 active statements */ #include "common.h" static char software_version[] = "$Id: cursor3.c,v 1.11 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char **argv) { SQLHSTMT stmt1 = SQL_NULL_HSTMT; SQLHSTMT stmt2 = SQL_NULL_HSTMT; SQLHSTMT old_odbc_stmt; char buff[64]; SQLLEN ind; odbc_use_version3 = 1; odbc_connect(); odbc_check_cursor(); odbc_command("CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); odbc_command("INSERT INTO #t1 VALUES (1, 'aaa')"); odbc_command("INSERT INTO #t1 VALUES (2, 'bbbbb')"); odbc_command("INSERT INTO #t1 VALUES (3, 'ccccccccc')"); odbc_command("INSERT INTO #t1 VALUES (4, 'dd')"); old_odbc_stmt = odbc_stmt; CHKAllocHandle(SQL_HANDLE_STMT, odbc_conn, &stmt1, "S"); CHKAllocHandle(SQL_HANDLE_STMT, odbc_conn, &stmt2, "S"); odbc_stmt = stmt1; /* CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER, "S"); */ CHKSetStmtAttr(SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER, "S"); /* CHKSetStmtAttr(SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_LOCK, SQL_IS_UINTEGER, "S"); */ odbc_stmt = stmt2; /* CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER, "S"); */ CHKSetStmtAttr(SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER, "S"); /* CHKSetStmtAttr(SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_LOCK, SQL_IS_UINTEGER, "S"); */ odbc_stmt = stmt1; CHKSetCursorName(T("c1"), SQL_NTS, "S"); odbc_stmt = stmt2; CHKSetCursorName(T("c2"), SQL_NTS, "S"); odbc_stmt = stmt1; CHKPrepare(T("SELECT * FROM #t1 ORDER BY k"), SQL_NTS, "S"); odbc_stmt = stmt2; CHKPrepare(T("SELECT * FROM #t1 ORDER BY k DESC"), SQL_NTS, "S"); odbc_stmt = stmt1; CHKExecute("S"); odbc_stmt = stmt2; CHKExecute("S"); odbc_stmt = stmt1; CHKFetch("S"); CHKGetData(2, SQL_C_CHAR, (SQLPOINTER) buff, sizeof(buff), &ind, "S"); printf(">> Fetch from 1: [%s]\n", buff); odbc_stmt = stmt2; CHKFetch("S"); CHKGetData(2, SQL_C_CHAR, (SQLPOINTER) buff, sizeof(buff), &ind, "S"); printf(">> Fetch from 2: [%s]\n", buff); /* * this should check a problem with SQLGetData * fetch a data on stmt2 than fetch on stmt1 and try to get data on first one */ CHKFetch("S"); /* "ccccccccc" */ odbc_stmt = stmt1; CHKFetch("S"); /* "bbbbb" */ odbc_stmt = stmt2; CHKGetData(2, SQL_C_CHAR, (SQLPOINTER) buff, sizeof(buff), &ind, "S"); printf(">> Fetch from 2: [%s]\n", buff); if (strcmp(buff, "ccccccccc") != 0) ODBC_REPORT_ERROR("Invalid results from SQLGetData"); odbc_stmt = stmt1; CHKGetData(2, SQL_C_CHAR, (SQLPOINTER) buff, sizeof(buff), &ind, "S"); printf(">> Fetch from 1: [%s]\n", buff); if (strcmp(buff, "bbbbb") != 0) ODBC_REPORT_ERROR("Invalid results from SQLGetData"); odbc_stmt = stmt1; CHKCloseCursor("SI"); odbc_stmt = stmt2; CHKCloseCursor("SI"); odbc_stmt = stmt1; CHKFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) stmt1, "S"); odbc_stmt = stmt2; CHKFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) stmt2, "S"); odbc_stmt = old_odbc_stmt; odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/cursor4.c000644 025423 025423 00000003143 14056414221 022110 0ustar00fredianofrediano000000 000000 /* Test sp_cursorprepare / sp_cursorexecute usage to support SELECT FOR UPDATE * This test compiles and works fine with SQL Server Native Client, and uses * the sp_cursor* API Server Cursors ... */ #include "common.h" static void exec_direct(const char *stmt) { SQLHSTMT odbc_stmt = SQL_NULL_HSTMT; CHKAllocHandle(SQL_HANDLE_STMT, (SQLHANDLE) odbc_conn, (SQLHANDLE *) & odbc_stmt, "S"); odbc_command(stmt); CHKFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) odbc_stmt, "S"); } int main(int argc, char **argv) { char buff[64]; SQLLEN ind; odbc_use_version3 = 1; odbc_connect(); odbc_check_cursor(); exec_direct("CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); exec_direct("INSERT INTO #t1 VALUES (1, 'aaa')"); odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_LOCK, SQL_IS_UINTEGER, "S"); CHKSetCursorName(T("c112"), SQL_NTS, "S"); CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, TDS_INT2PTR(SQL_AUTOCOMMIT_OFF), 0, "S"); CHKPrepare(T("SELECT * FROM #t1 FOR UPDATE"), SQL_NTS, "S"); CHKExecute("S"); CHKFetch("S"); exec_direct("UPDATE #t1 SET c = 'xxx' WHERE CURRENT OF c112"); CHKCloseCursor("SI"); CHKEndTran(SQL_HANDLE_DBC, odbc_conn, SQL_COMMIT, "S"); CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, TDS_INT2PTR(SQL_AUTOCOMMIT_ON), 0, "S"); CHKExecDirect(T("SELECT c FROM #t1 WHERE k = 1"), SQL_NTS, "S"); CHKFetch("S"); CHKGetData(1, SQL_C_CHAR, buff, sizeof(buff), &ind, "S"); printf(">> New value after update = [%s] (should be [xxx]) \n", buff); CHKFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) odbc_stmt, "S"); odbc_stmt = SQL_NULL_HSTMT; odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/cursor5.c000644 025423 025423 00000003666 14056414221 022123 0ustar00fredianofrediano000000 000000 #include "common.h" static SQLINTEGER v_int_3; static SQLLEN v_ind_3_1; static char v_char_3[21]; static SQLLEN v_ind_3_2; static int result = 0; static void doFetch(int dir, int pos, int expected) { SQLRETURN RetCode; RetCode = CHKFetchScroll(dir, pos, "SINo"); if (RetCode != SQL_NO_DATA) printf(">> fetch %2d %10d : %d [%s]\n", dir, pos, v_ind_3_1 ? (int) v_int_3 : -1, v_ind_3_2 ? v_char_3 : "null"); else printf(">> fetch %2d %10d : no data found\n", dir, pos); if (expected != (RetCode == SQL_NO_DATA ? -1 : v_int_3)) result = 1; } int main(int argc, char **argv) { odbc_use_version3 = 1; odbc_connect(); odbc_check_cursor(); CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON, SQL_IS_UINTEGER, "S"); odbc_command("create table #mytab1 (k int, c char(30))"); odbc_command("insert into #mytab1 values (1,'aaa')"); odbc_command("insert into #mytab1 values (2,'bbb')"); odbc_command("insert into #mytab1 values (3,'ccc')"); odbc_reset_statement(); /* CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_STATIC, 0, "S"); */ CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, SQL_IS_UINTEGER, "S"); CHKPrepare(T("select k, c from #mytab1 order by k"), SQL_NTS, "SI"); CHKBindCol(1, SQL_C_LONG, &v_int_3, 0, &v_ind_3_1, "S"); CHKBindCol(2, SQL_C_CHAR, v_char_3, sizeof(v_char_3), &v_ind_3_2, "S"); CHKExecute("SI"); doFetch(SQL_FETCH_LAST, 0, 3); doFetch(SQL_FETCH_PRIOR, 0, 2); doFetch(SQL_FETCH_PRIOR, 0, 1); doFetch(SQL_FETCH_PRIOR, 0, -1); doFetch(SQL_FETCH_NEXT, 0, 1); doFetch(SQL_FETCH_NEXT, 0, 2); doFetch(SQL_FETCH_NEXT, 0, 3); doFetch(SQL_FETCH_NEXT, 0, -1); doFetch(SQL_FETCH_FIRST, 0, 1); doFetch(SQL_FETCH_NEXT, 0, 2); doFetch(SQL_FETCH_NEXT, 0, 3); doFetch(SQL_FETCH_ABSOLUTE, 3, 3); doFetch(SQL_FETCH_RELATIVE, -2, 1); doFetch(SQL_FETCH_RELATIVE, -2, -1); doFetch(SQL_FETCH_RELATIVE, 5, -1); CHKCloseCursor("SI"); odbc_disconnect(); return result; } freetds-1.3.6/src/odbc/unittests/cursor6.c000644 025423 025423 00000005203 14056414221 022111 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test SQLFetchScroll with no bound columns */ static int bind_all = 0; static int normal_fetch = 0; static int use_cursors = 1; static void Test(void) { #define ROWS 5 struct data_t { SQLINTEGER i; SQLLEN ind_i; char c[20]; SQLLEN ind_c; } data[ROWS]; SQLUSMALLINT statuses[ROWS]; SQLLEN num_row; odbc_reset_statement(); /* this should not fail or return warnings */ if (use_cursors) { CHKSetStmtAttr(SQL_ATTR_CONCURRENCY, TDS_INT2PTR(SQL_CONCUR_READ_ONLY), 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, TDS_INT2PTR(SQL_CURSOR_STATIC), 0, "S"); } CHKPrepare(T("SELECT c, i FROM #cursor6_test"), SQL_NTS, "S"); CHKExecute("S"); CHKSetStmtAttr(SQL_ATTR_ROW_BIND_TYPE, TDS_INT2PTR(sizeof(data[0])), 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE, TDS_INT2PTR(ROWS), 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_STATUS_PTR, statuses, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROWS_FETCHED_PTR, &num_row, 0, "S"); if (bind_all) CHKBindCol(1, SQL_C_CHAR, &data[0].c, sizeof(data[0].c), &data[0].ind_c, "S"); CHKBindCol(2, SQL_C_LONG, &data[0].i, sizeof(data[0].i), &data[0].ind_i, "S"); #define FILL(s, n) do { \ int _n; for (_n = 0; _n < TDS_VECTOR_SIZE(s); ++_n) s[_n] = n; \ } while(0) FILL(statuses, 9876); num_row = -3; data[0].i = (SQLINTEGER) 0xdeadbeef; data[1].i = (SQLINTEGER) 0xdeadbeef; if (normal_fetch) CHKFetch("S"); else CHKFetchScroll(SQL_FETCH_NEXT, 0, "S"); /* now check row numbers */ printf("num_row %ld statuses[0] %d statuses[1] %d odbc3 %d\n", (long int) num_row, (int) statuses[0], (int) statuses[1], odbc_use_version3); if (odbc_use_version3 || !normal_fetch) { if (num_row != ROWS || statuses[0] != SQL_ROW_SUCCESS || statuses[1] != SQL_ROW_SUCCESS) { fprintf(stderr, "result error 1\n"); exit(1); } } else { if (data[0].i != 1 || data[1].i != 0xdeadbeef) { fprintf(stderr, "result error 2\n"); exit(1); } } FILL(statuses, 8765); num_row = -3; if (normal_fetch) CHKFetch("S"); else CHKFetchScroll(SQL_FETCH_NEXT, 0, "S"); } static void Init(void) { int i; char sql[128]; odbc_command("CREATE TABLE #cursor6_test (i INT, c VARCHAR(20))"); for (i = 1; i <= 10; ++i) { sprintf(sql, "INSERT INTO #cursor6_test(i,c) VALUES(%d, 'a%db%dc%d')", i, i, i, i); odbc_command(sql); } } int main(int argc, char *argv[]) { odbc_use_version3 = 1; odbc_connect(); odbc_check_cursor(); Init(); #define ALL(n) for (n = 0; n < 2; ++n) ALL(use_cursors) ALL(bind_all) ALL(normal_fetch) Test(); odbc_disconnect(); odbc_use_version3 = 0; odbc_connect(); Init(); ALL(use_cursors) ALL(bind_all) ALL(normal_fetch) Test(); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/cursor7.c000644 025423 025423 00000004725 14056414221 022122 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test SQLFetchScroll with a non-unitary rowset, using bottom-up direction */ static char software_version[] = "$Id: cursor7.c,v 1.10 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void Test(void) { enum { ROWS=5 }; struct data_t { SQLINTEGER i; SQLLEN ind_i; char c[20]; SQLLEN ind_c; } data[ROWS]; SQLUSMALLINT statuses[ROWS]; SQLULEN num_row; int i; SQLRETURN RetCode; odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CONCURRENCY, TDS_INT2PTR(SQL_CONCUR_READ_ONLY), 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, TDS_INT2PTR(SQL_CURSOR_STATIC), 0, "S"); CHKPrepare(T("SELECT c, i FROM #cursor7_test"), SQL_NTS, "S"); CHKExecute("S"); CHKSetStmtAttr(SQL_ATTR_ROW_BIND_TYPE, TDS_INT2PTR(sizeof(data[0])), 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE, TDS_INT2PTR(ROWS), 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_STATUS_PTR, statuses, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROWS_FETCHED_PTR, &num_row, 0, "S"); CHKBindCol(1, SQL_C_CHAR, &data[0].c, sizeof(data[0].c), &data[0].ind_c, "S"); CHKBindCol(2, SQL_C_LONG, &data[0].i, sizeof(data[0].i), &data[0].ind_i, "S"); /* Read records from last to first */ printf("\n\nReading records from last to first:\n"); RetCode = CHKFetchScroll(SQL_FETCH_LAST, -ROWS, "SINo"); while (RetCode != SQL_NO_DATA) { SQLULEN RowNumber; /* Print this set of rows */ for (i = ROWS - 1; i >= 0; i--) { if (statuses[i] != SQL_ROW_NOROW) printf("\t %d, %s\n", (int) data[i].i, data[i].c); } printf("\n"); CHKGetStmtAttr(SQL_ROW_NUMBER, (SQLPOINTER)(&RowNumber), sizeof(RowNumber), NULL, "S"); printf("---> We are in record No: %u\n", (unsigned int) RowNumber); /* Read next rowset */ if ( (RowNumber>1) && (RowNumber SQL_C_LONG select NVARCHAR(20) "-24785 " SQL_C_LONG "-24785" endif # check variant existence sql_cond cond1 "SELECT CAST(123 AS SQL_VARIANT) WHERE 0=1" if cond1 select SQL_VARIANT "CAST('123' AS INT)" SQL_C_CHAR "3 123" select SQL_VARIANT "CAST('hello' AS CHAR(6))" SQL_C_CHAR "6 hello " select SQL_VARIANT "CAST('ciao' AS VARCHAR(10))" SQL_C_CHAR "4 ciao" select SQL_VARIANT "CAST('foo' AS NVARCHAR(10))" SQL_C_CHAR "3 foo" select SQL_VARIANT "CAST('Super' AS NCHAR(8))" SQL_C_CHAR "8 Super " # using protocol version 7.0 server returns NVARCHAR instead of NVARBINARY so test it select_cond bug SQL_VARIANT "CAST(0x330032003100 AS VARBINARY(10))" SQL_C_CHAR "3 321" if not bug select SQL_VARIANT "CAST(0x333231 AS VARBINARY(10))" SQL_C_CHAR "6 333231" endif # for some reasons MS ODBC seems to convert -123.4 to -123.40000000000001 select SQL_VARIANT "CAST('-123.5' AS FLOAT)" SQL_C_CHAR "6 -123.5" select SQL_VARIANT "CAST('-123.4' AS NUMERIC(10,2))" SQL_C_CHAR "7 -123.40" select SQL_VARIANT "CAST('0DDF3B64-E692-11D1-AB06-00AA00BDD685' AS UNIQUEIDENTIFIER)" SQL_C_CHAR "36 0DDF3B64-E692-11D1-AB06-00AA00BDD685" endif # mssql2005 varchar(max) sql_cond cond1 "SELECT CAST('test' AS VARCHAR(MAX)) WHERE 0=1" if cond1 select VARCHAR(MAX) "goodbye!" SQL_C_CHAR "8 goodbye!" select NVARCHAR(MAX) "Micio mao" SQL_C_CHAR "9 Micio mao" select VARBINARY(MAX) "ciao" SQL_C_BINARY "6369616F" select XML """ciaohi""" SQL_C_CHAR """28 ciaohi""" # XML with schema sql "IF EXISTS(SELECT * FROM sys.xml_schema_collections WHERE [name] = 'test_schema') DROP XML SCHEMA COLLECTION test_schema" sql """CREATE XML SCHEMA COLLECTION test_schema AS ''""" select XML(test_schema) "ciao" SQL_C_CHAR "17 ciao" sql "DROP XML SCHEMA COLLECTION test_schema" endif # mssql 2008 date/time sql_cond cond1 "SELECT CAST('1923-12-02' AS DATE) WHERE 0=1" if cond1 select DATE "1923-12-02" SQL_C_CHAR "10 1923-12-02" select TIME "12:23:45" SQL_C_CHAR "16 12:23:45.0000000" select TIME(4) "12:23:45.765" SQL_C_CHAR "13 12:23:45.7650" select TIME(0) "12:23:45.765" SQL_C_CHAR "8 12:23:46" select DATETIME2 "2011-08-10 12:23:45" SQL_C_CHAR "27 2011-08-10 12:23:45.0000000" select DATETIME2(4) "12:23:45.345888" SQL_C_CHAR "24 1900-01-01 12:23:45.3459" select DATETIME2(0) "2011-08-10 12:23:45.93" SQL_C_CHAR "19 2011-08-10 12:23:46" select DATETIMEOFFSET "12:23:45 -02:30" SQL_C_CHAR "34 1900-01-01 12:23:45.0000000 -02:30" select DATETIMEOFFSET(4) "12:23:45" SQL_C_CHAR "31 1900-01-01 12:23:45.0000 +00:00" # test we are using mssql2008 protocol (7.3) select_cond cond1 DATE "1923-12-02" SQL_C_BINARY "31003900320033002D00310032002D0030003200" if not cond1 and bigendian select DATE "1923-12-02" SQL_C_BINARY "0783000C0002" select TIME "12:23:45" SQL_C_BINARY "000C0017002D000000000000" select TIME(4) "12:23:45.765" SQL_C_BINARY "000C0017002D00002D98F940" select DATETIME2 "2011-08-10 12:23:45" SQL_C_BINARY "07DB0008000A000C0017002D00000000" select DATETIME2(4) "12:23:45" SQL_C_BINARY "076C00010001000C0017002D00000000" select DATETIMEOFFSET "12:23:45 -08:30" SQL_C_BINARY "076C00010001000C0017002D00000000FFF8FFE2" select DATETIMEOFFSET(4) "12:23:45" SQL_C_BINARY "076C00010001000C0017002D0000000000000000" endif if not cond1 and not bigendian select DATE "1923-12-02" SQL_C_BINARY "83070C000200" select TIME "12:23:45" SQL_C_BINARY "0C0017002D00000000000000" select TIME(4) "12:23:45.765" SQL_C_BINARY "0C0017002D00000040F9982D" select DATETIME2 "2011-08-10 12:23:45" SQL_C_BINARY "DB0708000A000C0017002D0000000000" select DATETIME2(4) "12:23:45" SQL_C_BINARY "6C07010001000C0017002D0000000000" select DATETIMEOFFSET "12:23:45 -08:30" SQL_C_BINARY "6C07010001000C0017002D0000000000F8FFE2FF" select DATETIMEOFFSET(4) "12:23:45" SQL_C_BINARY "6C07010001000C0017002D000000000000000000" endif # new date/time types embedded into variant types tds_version_cmp tds71p >= 7.1 if tds71p select SQL_VARIANT "CAST('2014-04-15 20:23:56' AS DATETIME2)" SQL_C_CHAR "27 2014-04-15 20:23:56.0000000" select SQL_VARIANT "CAST('2014-04-15 20:23:56' AS DATETIME2(3))" SQL_C_CHAR "23 2014-04-15 20:23:56.000" select SQL_VARIANT "CAST('2014-04-15 20:23:56' AS TIME)" SQL_C_CHAR "16 20:23:56.0000000" select SQL_VARIANT "CAST('2014-04-15 20:23:56' AS TIME(3))" SQL_C_CHAR "12 20:23:56.000" select SQL_VARIANT "CAST('2014-04-15' AS DATE)" SQL_C_CHAR "10 2014-04-15" endif endif # mssql 2008 hierarchyid select HIERARCHYID "/" SQL_C_BINARY "" select HIERARCHYID "/1.2/" SQL_C_BINARY "6340" endif # test sybase date/time types if not msdb # FIXME sure ?? with date and time always ?? sql_cond cond1 "SELECT CAST('1923-12-02' AS DATE) WHERE 0=1" if cond1 select DATE "1923-12-02" SQL_C_CHAR "10 1923-12-02" select TIME "12:23:45" SQL_C_CHAR "12 12:23:45.000" select TIME "12:23:45.983" SQL_C_CHAR "12 12:23:45.983" # TODO binary endif endif if bigint and not msdb select "UNSIGNED BIGINT" "11510302200549295463" SQL_C_CHAR "20 11510302200549295463" select "UNSIGNED INT" "3478444555" SQL_C_CHAR "10 3478444555" select "UNSIGNED SMALLINT" "65432" SQL_C_CHAR "5 65432" if not bigendian select "UNSIGNED BIGINT" "11510302200549295463" SQL_C_BINARY "67452301DECEBC9F" select "UNSIGNED INT" "3478444555" SQL_C_BINARY "0BDA54CF" select "UNSIGNED SMALLINT" "65432" SQL_C_BINARY "98FF" endif if bigendian select "UNSIGNED BIGINT" "11510302200549295463" SQL_C_BINARY "9FBCCEDE01234567" select "UNSIGNED INT" "3478444555" SQL_C_BINARY "CF54DA0B" select "UNSIGNED SMALLINT" "65432" SQL_C_BINARY "FF98" endif endif # check for Sybase big(date)time sql_cond cond1 "SELECT CAST('2015-10-10' AS BIGDATETIME) WHERE 0=1" if cond1 if bigendian select BIGTIME "2004-02-24 15:16:17" SQL_C_BINARY "000F00100011000000000000" select BIGDATETIME "2004-02-24 15:16:17" SQL_C_BINARY "07D400020018000F0010001100000000" else select BIGTIME "2004-02-24 15:16:17" SQL_C_BINARY "0F0010001100000000000000" select BIGDATETIME "2004-02-24 15:16:17" SQL_C_BINARY "D407020018000F001000110000000000" endif select BIGTIME "21:51:38.73973" SQL_C_CHAR "15 21:51:38.739730" select BIGDATETIME "1998-02-17 21:54:38.73973" SQL_C_CHAR "26 1998-02-17 21:54:38.739730" select BIGTIME "2006-06-12 22:37:21.372" SQL_C_TIMESTAMP "1900-01-01 22:37:21.372" select BIGDATETIME "2006-06-09 11:22:44" SQL_C_TIMESTAMP "2006-06-09 11:22:44.000" endif sql_cond cond1 "SELECT CAST('test' AS UNIVARCHAR(10)) WHERE 0=1" if cond1 select UNICHAR(7) "daffy" SQL_C_BINARY "6400610066006600790020002000" select UNIVARCHAR(20) "daffy" SQL_C_BINARY "64006100660066007900" select UNIVARCHAR(20) "0x830068006900f200" SQL_C_WCHAR "4 \x83hi\xf2" select UNIVARCHAR(20) "0xA406A5FB" SQL_C_WCHAR """2 \u06a4\ufba5""" select UNIVARCHAR(20) "4567129 " SQL_C_LONG "4567129" endif select VARCHAR(20) " 15.0000 " SQL_C_NUMERIC "38 0 1 0F" select VARCHAR(20) " 15.0000 " SQL_C_LONG "15" if bigint select VARCHAR(20) " 13.0000 " SQL_C_SBIGINT "13" endif # mssql 2008 give a warning for truncation (01004) if freetds select VARCHAR(20) " 15.1245 " SQL_C_NUMERIC "38 0 1 0F" select VARCHAR(20) " 15.1234 " SQL_C_LONG "15" if bigint select VARCHAR(20) " 12.98 " SQL_C_SBIGINT "12" endif endif freetds-1.3.6/src/odbc/unittests/c2string.c000644 025423 025423 00000004431 14056414221 022243 0ustar00fredianofrediano000000 000000 #include "common.h" #include static char * add_char(char *s, SQLWCHAR ch) { if (ch == '\\') s += sprintf(s, "\\\\"); else if (ch == '\t') s += sprintf(s, "\\t"); else if (ch == '\r') s += sprintf(s, "\\r"); else if (ch == '\n') s += sprintf(s, "\\n"); else if ((unsigned int) ch < 32u) s += sprintf(s, "\\x%02x", (unsigned int) ch); else if ((unsigned int) ch < 256u) s += sprintf(s, "%c", (char) ch); else s += sprintf(s, "\\u%04x", (unsigned int) ch); return s; } void odbc_c2string(char *out, SQLSMALLINT out_c_type, const void *in, size_t in_len) { typedef union { unsigned char bin[256]; char s[256]; SQLWCHAR ws[256/sizeof(SQLWCHAR)]; SQLINTEGER i; SQLBIGINT bi; SQLSMALLINT si; SQL_NUMERIC_STRUCT num; SQL_TIMESTAMP_STRUCT ts; } buf_t; #undef IN #define IN (*((const buf_t*) in)) int i; const SQL_NUMERIC_STRUCT *num; char *s; out[0] = 0; s = out; switch (out_c_type) { case SQL_C_NUMERIC: num = &IN.num; s += sprintf(s, "%d %d %d ", num->precision, num->scale, num->sign); i = SQL_MAX_NUMERIC_LEN; for (; i > 0 && !num->val[--i];) continue; for (; i >= 0; --i) s += sprintf(s, "%02X", num->val[i]); break; case SQL_C_BINARY: assert(in_len >= 0); for (i = 0; i < in_len; ++i) s += sprintf(s, "%02X", IN.bin[i]); break; case SQL_C_CHAR: assert(IN.s[in_len] == 0); s += sprintf(s, "%u ", (unsigned int) in_len); for (i = 0; i < in_len; ++i) s = add_char(s, (unsigned char) IN.s[i]); *s = 0; break; case SQL_C_WCHAR: assert(in_len >=0 && (in_len % sizeof(SQLWCHAR)) == 0); s += sprintf(s, "%u ", (unsigned int) (in_len / sizeof(SQLWCHAR))); for (i = 0; i < in_len / sizeof(SQLWCHAR); ++i) s = add_char(s, IN.ws[i]); *s = 0; break; case SQL_C_LONG: assert(in_len == sizeof(SQLINTEGER)); sprintf(s, "%ld", (long int) IN.i); break; case SQL_C_SBIGINT: assert(in_len == sizeof(SQLBIGINT)); sprintf(s, "%" PRId64, IN.bi); break; case SQL_C_SHORT: assert(in_len == sizeof(SQLSMALLINT)); sprintf(s, "%d", (int) IN.si); break; case SQL_C_TIMESTAMP: sprintf(s, "%04d-%02u-%02u %02u:%02u:%02u.%03u", IN.ts.year, IN.ts.month, IN.ts.day, IN.ts.hour, IN.ts.minute, IN.ts.second, (unsigned) (IN.ts.fraction / 1000000u)); break; default: /* not supported */ assert(0); break; } } freetds-1.3.6/src/odbc/unittests/parser.c000644 025423 025423 00000013023 14056414271 022006 0ustar00fredianofrediano000000 000000 /* * Test reading data with SQLBindCol */ #include "common.h" #include #include #include "parser.h" unsigned int odbc_line_num; void odbc_fatal(const char *msg, ...) { va_list ap; va_start(ap, msg); if (msg[0] == ':') fprintf(stderr, "Line %u", odbc_line_num); vfprintf(stderr, msg, ap); va_end(ap); exit(1); } #define SEP " \t\n" const char * odbc_get_tok(char **p) { char *s = *p, *end; s += strspn(s, SEP); if (!*s) return NULL; end = s + strcspn(s, SEP); *end = 0; *p = end+1; return s; } static void parse_cstr(char *s) { char hexbuf[4]; char *d = s; while (*s) { if (*s != '\\') { *d++ = *s++; continue; } switch (*++s) { case '\"': *d++ = *s++; break; case '\\': *d++ = *s++; break; case 'x': if (strlen(s) < 3) odbc_fatal(": wrong string format\n"); memcpy(hexbuf, ++s, 2); hexbuf[2] = 0; *d++ = (char) strtoul(hexbuf, NULL, 16); s += 2; break; default: odbc_fatal(": wrong string format\n"); } } *d = 0; } const char * odbc_get_str(char **p) { char *s = *p, *end; s += strspn(s, SEP); if (!*s) odbc_fatal(": unable to get string\n"); if (strncmp(s, "\"\"\"", 3) == 0) { s += 3; end = strstr(s, "\"\"\""); if (!end) odbc_fatal(": string not terminated\n"); *end = 0; *p = end+3; } else if (s[0] == '\"') { ++s; end = strchr(s, '\"'); if (!end) odbc_fatal(": string not terminated\n"); *end = 0; parse_cstr(s); *p = end+1; } else { return odbc_get_tok(p); } return s; } enum { MAX_BOOLS = 64 }; typedef struct { char *name; int value; } bool_t; static bool_t bools[MAX_BOOLS]; void odbc_set_bool(const char *name, int value) { unsigned n; value = !!value; for (n = 0; n < MAX_BOOLS && bools[n].name; ++n) if (!strcmp(bools[n].name, name)) { bools[n].value = value; return; } if (n == MAX_BOOLS) odbc_fatal(": no more boolean variable free\n"); bools[n].name = strdup(name); if (!bools[n].name) odbc_fatal(": out of memory\n"); bools[n].value = value; } static int get_bool(const char *name) { unsigned n; if (!name) odbc_fatal(": boolean variable not provided\n"); for (n = 0; n < MAX_BOOLS && bools[n].name; ++n) if (!strcmp(bools[n].name, name)) return bools[n].value; odbc_fatal(": boolean variable %s not found\n", name); return 0; } /** initialize booleans, call after connection */ void odbc_init_bools(void) { int big_endian = 1; if (((char *) &big_endian)[0] == 1) big_endian = 0; odbc_set_bool("bigendian", big_endian); odbc_set_bool("msdb", odbc_db_is_microsoft()); odbc_set_bool("freetds", odbc_driver_is_freetds()); } void odbc_clear_bools(void) { unsigned n; for (n = 0; n < MAX_BOOLS && bools[n].name; ++n) { free(bools[n].name); bools[n].name = NULL; } } enum { MAX_CONDITIONS = 32 }; static char conds[MAX_CONDITIONS]; static unsigned cond_level = 0; static int pop_condition(void) { if (cond_level == 0) odbc_fatal(": no related if\n"); return conds[--cond_level]; } static void push_condition(int cond) { if (cond != 0 && cond != 1) odbc_fatal(": invalid cond value %d\n", cond); if (cond_level >= MAX_CONDITIONS) odbc_fatal(": too much nested conditions\n"); conds[cond_level++] = cond; } static int get_not_cond(char **p) { int cond; const char *tok = odbc_get_tok(p); if (!tok) odbc_fatal(": wrong condition syntax\n"); if (!strcmp(tok, "not")) cond = !get_bool(odbc_get_tok(p)); else cond = get_bool(tok); return cond; } static int get_condition(char **p) { int cond1 = get_not_cond(p), cond2; const char *tok; while ((tok=odbc_get_tok(p)) != NULL) { cond2 = get_not_cond(p); if (!strcmp(tok, "or")) cond1 = cond1 || cond2; else if (!strcmp(tok, "and")) cond1 = cond1 && cond2; else odbc_fatal(": wrong condition syntax\n"); } return cond1; } static FILE *parse_file; static char line_buf[1024]; void odbc_init_parser(FILE *f) { if (parse_file) odbc_fatal("parser file already setup\n"); parse_file = f; odbc_line_num = 0; odbc_tds_version(); } const char * odbc_get_cmd_line(char **p_s, int *cond) { while (fgets(line_buf, sizeof(line_buf), parse_file)) { char *p = line_buf; const char *cmd; ++odbc_line_num; cmd = odbc_get_tok(&p); /* skip comments */ if (!cmd || cmd[0] == '#' || cmd[0] == 0 || cmd[0] == '\n') continue; /* conditional statement */ if (!strcmp(cmd, "else")) { int c = pop_condition(); push_condition(c); *cond = c && !*cond; continue; } if (!strcmp(cmd, "endif")) { *cond = pop_condition(); continue; } if (!strcmp(cmd, "if")) { push_condition(*cond); if (*cond) *cond = get_condition(&p); continue; } if (strcmp(cmd, "tds_version_cmp") == 0) { const char *bool_name = odbc_get_tok(&p); const char *cmp = odbc_get_tok(&p); const char *s_ver = odbc_get_tok(&p); int ver = odbc_tds_version(); int expected; int res; unsigned M, m; if (!cmp || !s_ver) odbc_fatal(": missing parameters\n"); if (sscanf(s_ver, "%u.%u", &M, &m) != 2) odbc_fatal(": invalid version %s\n", s_ver); expected = M * 0x100u + m; if (strcmp(cmp, ">") == 0) res = ver > expected; else if (strcmp(cmp, ">=") == 0) res = ver >= expected; else if (strcmp(cmp, "<") == 0) res = ver < expected; else if (strcmp(cmp, "<=") == 0) res = ver <= expected; else if (strcmp(cmp, "==") == 0) res = ver == expected; else if (strcmp(cmp, "!=") == 0) res = ver != expected; else odbc_fatal(": invalid operator %s\n", cmp); if (*cond) odbc_set_bool(bool_name, res); continue; } *p_s = p; return cmd; } return NULL; } freetds-1.3.6/src/odbc/unittests/parser.h000644 025423 025423 00000000703 14056414271 022014 0ustar00fredianofrediano000000 000000 #include extern unsigned int odbc_line_num; void odbc_fatal(const char *msg, ...) #ifdef __GNUC__ __attribute__((noreturn)) #endif ; const char *odbc_get_tok(char **p); const char *odbc_get_str(char **p); void odbc_set_bool(const char *name, int value); void odbc_init_bools(void); void odbc_clear_bools(void); void odbc_init_parser(FILE *f); const char *odbc_get_cmd_line(char **p, int *cond); #include freetds-1.3.6/src/odbc/unittests/date.c000644 025423 025423 00000002317 14056414221 021426 0ustar00fredianofrediano000000 000000 #include "common.h" static char software_version[] = "$Id: date.c,v 1.14 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void DoTest(int n) { SQLCHAR output[256]; SQLSMALLINT colType; SQLULEN colSize; SQLSMALLINT colScale, colNullable; SQLLEN dataSize; TIMESTAMP_STRUCT ts; odbc_command("select convert(datetime, '2002-12-27 18:43:21')"); CHKFetch("SI"); CHKDescribeCol(1, (SQLTCHAR*)output, sizeof(output)/sizeof(SQLWCHAR), NULL, &colType, &colSize, &colScale, &colNullable, "S"); if (n == 0) { memset(&ts, 0, sizeof(ts)); CHKGetData(1, SQL_C_TIMESTAMP, &ts, sizeof(ts), &dataSize, "S"); sprintf((char *) output, "%04d-%02d-%02d %02d:%02d:%02d.000", ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second); } else { CHKGetData(1, SQL_C_CHAR, output, sizeof(output), &dataSize, "S"); } printf("Date returned: %s\n", output); if (strcmp((char *) output, "2002-12-27 18:43:21.000") != 0) { fprintf(stderr, "Invalid returned date\n"); exit(1); } CHKFetch("No"); CHKCloseCursor("SI"); } int main(int argc, char *argv[]) { odbc_connect(); DoTest(0); DoTest(1); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/descrec.c000644 025423 025423 00000002251 14056414222 022117 0ustar00fredianofrediano000000 000000 /* test SQLGetDescRec */ #include "common.h" static char software_version[] = "$Id: descrec.c,v 1.3 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(void) { SQLHDESC Descriptor; SQLINTEGER ind; SQLTCHAR name[128]; SQLSMALLINT si; odbc_use_version3 = 1; odbc_connect(); odbc_command("create table #tmp1 (i int)"); /* get IRD */ CHKGetStmtAttr(SQL_ATTR_IMP_ROW_DESC, &Descriptor, sizeof(Descriptor), &ind, "S"); CHKGetDescRec(-1, name, TDS_VECTOR_SIZE(name), &si, NULL, NULL, NULL, NULL, NULL, NULL, "E"); /* TODO here should be NO_DATA cause we are requesting bookmark */ /* CHKGetDescRec(0, name, sizeof(name), &si, NULL, NULL, NULL, NULL, NULL, NULL, "No"); */ CHKGetDescRec(1, name, TDS_VECTOR_SIZE(name), &si, NULL /*Type*/, NULL /*SubType*/, NULL /*Length*/, NULL/*Precision*/, NULL /*Scale*/, NULL /*Nullable*/, "No"); odbc_command("SELECT name FROM sysobjects"); CHKGetDescRec(1, name, TDS_VECTOR_SIZE(name), &si, NULL /*Type*/, NULL /*SubType*/, NULL /*Length*/, NULL/*Precision*/, NULL /*Scale*/, NULL /*Nullable*/, "S"); odbc_disconnect(); ODBC_FREE(); return 0; } freetds-1.3.6/src/odbc/unittests/describecol.c000644 025423 025423 00000024026 14056414222 022771 0ustar00fredianofrediano000000 000000 #include "common.h" #include #include "parser.h" #include #include /* * SQLDescribeCol test for precision * test what say SQLDescribeCol about precision using some type */ static int g_result = 0; static int get_int(const char *s) { char *end; long l; if (!s) odbc_fatal(": NULL int\n"); l = strtol(s, &end, 0); if (end[0]) odbc_fatal(": Invalid int\n"); return (int) l; } struct lookup_int { const char *name; int value; }; static int lookup(const char *name, const struct lookup_int *table) { if (!table) return get_int(name); for (; table->name; ++table) if (strcmp(table->name, name) == 0) return table->value; return get_int(name); } static const char* unlookup(long int value, const struct lookup_int *table) { static char buf[32]; sprintf(buf, "%ld", value); if (!table) return buf; for (; table->name; ++table) if (table->value == value) return table->name; return buf; } static struct lookup_int sql_types[] = { #define TYPE(s) { #s, s } TYPE(SQL_CHAR), TYPE(SQL_VARCHAR), TYPE(SQL_LONGVARCHAR), TYPE(SQL_WCHAR), TYPE(SQL_WVARCHAR), TYPE(SQL_WLONGVARCHAR), TYPE(SQL_DECIMAL), TYPE(SQL_NUMERIC), TYPE(SQL_SMALLINT), TYPE(SQL_INTEGER), TYPE(SQL_REAL), TYPE(SQL_FLOAT), TYPE(SQL_DOUBLE), TYPE(SQL_BIT), TYPE(SQL_TINYINT), TYPE(SQL_BIGINT), TYPE(SQL_BINARY), TYPE(SQL_VARBINARY), TYPE(SQL_LONGVARBINARY), TYPE(SQL_DATE), TYPE(SQL_TIME), TYPE(SQL_TIMESTAMP), TYPE(SQL_TYPE_DATE), TYPE(SQL_TYPE_TIME), TYPE(SQL_TYPE_TIMESTAMP), TYPE(SQL_DATETIME), TYPE(SQL_SS_VARIANT), TYPE(SQL_SS_UDT), TYPE(SQL_SS_XML), TYPE(SQL_SS_TABLE), TYPE(SQL_SS_TIME2), TYPE(SQL_SS_TIMESTAMPOFFSET), #undef TYPE { NULL, 0 } }; static struct lookup_int sql_bools[] = { { "SQL_TRUE", SQL_TRUE }, { "SQL_FALSE", SQL_FALSE }, { NULL, 0 } }; typedef enum { type_INTEGER, type_SMALLINT, type_LEN, type_CHARP } test_type_t; struct attribute { const char *name; int value; test_type_t type; const struct lookup_int *lookup; }; static const struct attribute attributes[] = { #define ATTR(s,t) { #s, s, type_##t, NULL } #define ATTR2(s,t,l) { #s, s, type_##t, l } ATTR(SQL_COLUMN_LENGTH, INTEGER), ATTR(SQL_COLUMN_PRECISION, INTEGER), ATTR(SQL_COLUMN_SCALE, INTEGER), ATTR(SQL_DESC_LENGTH, LEN), ATTR(SQL_DESC_OCTET_LENGTH, LEN), ATTR(SQL_DESC_PRECISION, SMALLINT), ATTR(SQL_DESC_SCALE, SMALLINT), ATTR(SQL_DESC_DISPLAY_SIZE, INTEGER), ATTR(SQL_DESC_TYPE_NAME, CHARP), ATTR2(SQL_DESC_CONCISE_TYPE, SMALLINT, sql_types), ATTR2(SQL_DESC_TYPE, SMALLINT, sql_types), ATTR2(SQL_DESC_UNSIGNED, SMALLINT, sql_bools) #undef ATTR2 #undef ATTR }; static const struct attribute * lookup_attr(const char *name) { unsigned int i; if (!name) odbc_fatal(": NULL attribute\n"); for (i = 0; i < TDS_VECTOR_SIZE(attributes); ++i) if (strcmp(attributes[i].name, name) == 0 || strcmp(attributes[i].name + 4, name) == 0) return &attributes[i]; odbc_fatal(": attribute %s not found\n", name); return NULL; } #define ATTR_PARAMS const struct attribute *attr, const char *expected_values[] typedef void (*check_attr_t) (ATTR_PARAMS); static bool is_contained(const char *s, const char *list[]) { for (;*list; ++list) { if (strcmp(s, *list) == 0) return true; } return false; } static bool is_contained_lookup(SQLLEN i, const char *list[], const struct lookup_int *table) { for (;*list; ++list) { if (i == lookup(*list, table)) return true; } return false; } static void print_values(FILE* f, const char *list[]) { const char *sep = "["; for (;*list; ++list, sep = ", ") fprintf(f, "%s%s", sep, *list); fprintf(f, "]\n"); } static void check_attr_ird(ATTR_PARAMS) { SQLLEN i; SQLRETURN ret; if (attr->type == type_CHARP) { char buf[256]; SQLSMALLINT len; ret = SQLColAttribute(odbc_stmt, 1, attr->value, buf, sizeof(buf), &len, NULL); if (!SQL_SUCCEEDED(ret)) odbc_fatal(": failure not expected\n"); buf[sizeof(buf)-1] = 0; if (!is_contained(C((SQLTCHAR*) buf), expected_values)) { g_result = 1; fprintf(stderr, "Line %u: invalid %s got %s expected ", odbc_line_num, attr->name, buf); print_values(stderr, expected_values); } return; } i = 0xdeadbeef; ret = SQLColAttribute(odbc_stmt, 1, attr->value, NULL, SQL_IS_INTEGER, NULL, &i); if (!SQL_SUCCEEDED(ret)) odbc_fatal(": failure not expected\n"); /* SQL_DESC_LENGTH is the same of SQLDescribeCol len */ if (attr->value == SQL_DESC_LENGTH) { SQLSMALLINT scale, si; SQLULEN prec; CHKDescribeCol(1, NULL, 0, NULL, &si, &prec, &scale, &si, "S"); if (i != prec) odbc_fatal(": attr %s SQLDescribeCol len %ld != SQLColAttribute len %ld\n", attr->name, (long) prec, (long) i); } if (attr->value == SQL_DESC_SCALE) { SQLSMALLINT scale, si; SQLULEN prec; CHKDescribeCol(1, NULL, 0, NULL, &si, &prec, &scale, &si, "S"); if (i != scale) odbc_fatal(": attr %s SQLDescribeCol scale %ld != SQLColAttribute len %ld\n", attr->name, (long) scale, (long) i); } if (!is_contained_lookup(i, expected_values, attr->lookup)) { g_result = 1; fprintf(stderr, "Line %u: invalid %s got %s expected ", odbc_line_num, attr->name, unlookup(i, attr->lookup)); print_values(stderr, expected_values); } } static void check_attr_ard(ATTR_PARAMS) { SQLINTEGER i, ind; SQLSMALLINT si; SQLLEN li; SQLRETURN ret; SQLHDESC desc = SQL_NULL_HDESC; char buf[256]; /* get ARD */ SQLGetStmtAttr(odbc_stmt, SQL_ATTR_APP_ROW_DESC, &desc, sizeof(desc), &ind); ret = SQL_ERROR; switch (attr->type) { case type_INTEGER: i = 0xdeadbeef; ret = SQLGetDescField(desc, 1, attr->value, (SQLPOINTER) & i, sizeof(SQLINTEGER), &ind); li = i; break; case type_SMALLINT: si = 0xbeef; ret = SQLGetDescField(desc, 1, attr->value, (SQLPOINTER) & si, sizeof(SQLSMALLINT), &ind); li = si; break; case type_LEN: li = 0xdeadbeef; ret = SQLGetDescField(desc, 1, attr->value, (SQLPOINTER) & li, sizeof(SQLLEN), &ind); break; case type_CHARP: ret = SQLGetDescField(desc, 1, attr->value, buf, sizeof(buf), &ind); if (!SQL_SUCCEEDED(ret)) odbc_fatal(": failure not expected\n"); if (!is_contained(C((SQLTCHAR*) buf), expected_values)) { g_result = 1; fprintf(stderr, "Line %u: invalid %s got %s expected ", odbc_line_num, attr->name, buf); print_values(stderr, expected_values); } return; } if (!SQL_SUCCEEDED(ret)) odbc_fatal(": failure not expected\n"); if (!is_contained_lookup(li, expected_values, attr->lookup)) { g_result = 1; fprintf(stderr, "Line %u: invalid %s got %s expected ", odbc_line_num, attr->name, unlookup(li, attr->lookup)); print_values(stderr, expected_values); } } /* do not retry any attribute just return expected value so to make caller happy */ static void check_attr_none(ATTR_PARAMS) { } int main(int argc, char *argv[]) { int cond = 1; #define TEST_FILE "describecol.in" const char *in_file = FREETDS_SRCDIR "/" TEST_FILE; FILE *f; SQLINTEGER i; SQLLEN len; check_attr_t check_attr_p = check_attr_none; odbc_connect(); odbc_init_bools(); odbc_command("SET TEXTSIZE 4096"); SQLBindCol(odbc_stmt, 1, SQL_C_SLONG, &i, sizeof(i), &len); f = fopen(in_file, "r"); if (!f) f = fopen(TEST_FILE, "r"); if (!f) { fprintf(stderr, "error opening test file\n"); exit(1); } odbc_init_parser(f); for (;;) { char *p; const char *cmd; cmd = odbc_get_cmd_line(&p, &cond); if (!cmd) break; ODBC_FREE(); if (strcmp(cmd, "odbc") == 0) { int odbc3 = get_int(odbc_get_tok(&p)) == 3 ? 1 : 0; if (!cond) continue; if (odbc_use_version3 != odbc3) { odbc_use_version3 = odbc3; odbc_disconnect(); odbc_connect(); odbc_command("SET TEXTSIZE 4096"); SQLBindCol(odbc_stmt, 1, SQL_C_SLONG, &i, sizeof(i), &len); } } /* select type */ if (strcmp(cmd, "select") == 0) { const char *type = odbc_get_str(&p); const char *value = odbc_get_str(&p); char sql[1024]; if (!cond) continue; SQLMoreResults(odbc_stmt); odbc_reset_statement(); snprintf(sql, sizeof(sql), "SELECT CONVERT(%s, %s) AS col", type, value); /* ignore error, we only need precision of known types */ check_attr_p = check_attr_none; if (odbc_command_with_result(odbc_stmt, sql) != SQL_SUCCESS) { odbc_reset_statement(); SQLBindCol(odbc_stmt, 1, SQL_C_SLONG, &i, sizeof(i), &len); continue; } CHKFetch("SI"); SQLBindCol(odbc_stmt, 1, SQL_C_SLONG, &i, sizeof(i), &len); check_attr_p = check_attr_ird; } /* set attribute */ if (strcmp(cmd, "set") == 0) { const struct attribute *attr = lookup_attr(odbc_get_tok(&p)); const char *value = odbc_get_str(&p); SQLHDESC desc; SQLRETURN ret; SQLINTEGER ind; if (!value) odbc_fatal(": value not defined\n"); if (!cond) continue; /* get ARD */ SQLGetStmtAttr(odbc_stmt, SQL_ATTR_APP_ROW_DESC, &desc, sizeof(desc), &ind); ret = SQL_ERROR; switch (attr->type) { case type_INTEGER: ret = SQLSetDescField(desc, 1, attr->value, TDS_INT2PTR(lookup(value, attr->lookup)), sizeof(SQLINTEGER)); break; case type_SMALLINT: ret = SQLSetDescField(desc, 1, attr->value, TDS_INT2PTR(lookup(value, attr->lookup)), sizeof(SQLSMALLINT)); break; case type_LEN: ret = SQLSetDescField(desc, 1, attr->value, TDS_INT2PTR(lookup(value, attr->lookup)), sizeof(SQLLEN)); break; case type_CHARP: ret = SQLSetDescField(desc, 1, attr->value, (SQLPOINTER) value, SQL_NTS); break; } if (!SQL_SUCCEEDED(ret)) odbc_fatal(": failure not expected setting ARD attribute\n"); check_attr_p = check_attr_ard; } /* test attribute */ if (strcmp(cmd, "attr") == 0) { const struct attribute *attr = lookup_attr(odbc_get_tok(&p)); const char *expected[10]; int i; expected[0] = odbc_get_str(&p); if (!expected[0]) odbc_fatal(": value not defined\n"); if (!cond) continue; for (i = 1; ;++i) { if (i >= 10) odbc_fatal("Too many values in attribute\n"); p += strspn(p, " \t"); if (!*p) { expected[i] = NULL; break; } expected[i] = odbc_get_str(&p); } check_attr_p(attr, expected); } } fclose(f); odbc_clear_bools(); odbc_disconnect(); printf("Done.\n"); return g_result; } freetds-1.3.6/src/odbc/unittests/describecol.in000644 025423 025423 00000046071 14056414222 023161 0ustar00fredianofrediano000000 000000 # test all types using ODBC 2 select "unsigned smallint" 123 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 5 attr SQL_DESC_UNSIGNED SQL_TRUE select "unsigned int" 12356 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 10 attr SQL_DESC_UNSIGNED SQL_TRUE select "unsigned bigint" 1235678901234 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 20 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 20 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 20 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 attr SQL_DESC_UNSIGNED SQL_TRUE select bit 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 1 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 1 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 1 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 1 attr SQL_DESC_TYPE_NAME bit attr SQL_DESC_UNSIGNED SQL_TRUE select tinyint 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 3 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 3 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 3 attr SQL_DESC_UNSIGNED SQL_TRUE select smallint 0 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 6 attr SQL_DESC_UNSIGNED SQL_FALSE select int 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 attr SQL_DESC_UNSIGNED SQL_FALSE tds_version_cmp tds70 == 7.0 if not tds70 select bigint 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 attr SQL_DESC_UNSIGNED SQL_FALSE endif select real 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 7 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 7 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 7 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 14 attr SQL_DESC_UNSIGNED SQL_FALSE select float 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 15 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 15 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 15 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 24 attr SQL_DESC_UNSIGNED SQL_FALSE select smallmoney 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL attr SQL_DESC_UNSIGNED SQL_FALSE select money 0 attr SQL_COLUMN_LENGTH 21 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 21 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 21 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL attr SQL_DESC_UNSIGNED SQL_FALSE select numeric(10,2) 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 2 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 2 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_UNSIGNED SQL_FALSE select numeric(23,4) 0 attr SQL_COLUMN_LENGTH 25 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 25 attr SQL_DESC_PRECISION 23 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 25 attr SQL_DESC_UNSIGNED SQL_FALSE select datetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 3 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 3 attr SQL_DESC_DISPLAY_SIZE 23 attr SQL_DESC_CONCISE_TYPE SQL_TIMESTAMP select smalldatetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 16 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 16 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 0 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 19 attr SQL_DESC_CONCISE_TYPE SQL_TIMESTAMP select char(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 10 attr SQL_DESC_TYPE_NAME char select varchar(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 attr SQL_DESC_TYPE_NAME varchar select nchar(12) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 24 attr SQL_COLUMN_PRECISION 12 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 12 attr SQL_DESC_OCTET_LENGTH 24 attr SQL_DESC_PRECISION 12 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_TYPE_NAME nchar select nvarchar(13) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 26 39 attr SQL_COLUMN_PRECISION 13 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 13 attr SQL_DESC_OCTET_LENGTH 26 39 attr SQL_DESC_PRECISION 13 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 13 attr SQL_DESC_TYPE_NAME nvarchar select text 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 4096 attr SQL_DESC_TYPE_NAME text select ntext 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 2048 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 2048 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 2048 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 2048 attr SQL_DESC_TYPE_NAME ntext select binary(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 select varbinary(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 22 select image 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8192 # test all types using ODBC 3 odbc 3 select "unsigned smallint" 123 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 5 select bit 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 1 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 1 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 1 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 1 select tinyint 0 attr SQL_COLUMN_LENGTH 1 attr SQL_COLUMN_PRECISION 3 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 3 attr SQL_DESC_OCTET_LENGTH 1 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 3 select smallint 0 attr SQL_COLUMN_LENGTH 2 attr SQL_COLUMN_PRECISION 5 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 5 attr SQL_DESC_OCTET_LENGTH 2 attr SQL_DESC_PRECISION 5 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 6 select int 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 if not tds70 select bigint 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 endif select real 0 attr SQL_COLUMN_LENGTH 4 attr SQL_COLUMN_PRECISION 7 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 24 attr SQL_DESC_OCTET_LENGTH 4 attr SQL_DESC_PRECISION 24 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 14 select float 0 attr SQL_COLUMN_LENGTH 8 attr SQL_COLUMN_PRECISION 15 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 53 attr SQL_DESC_OCTET_LENGTH 8 attr SQL_DESC_PRECISION 53 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 24 select smallmoney 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL select money 0 attr SQL_COLUMN_LENGTH 21 attr SQL_COLUMN_PRECISION 19 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 19 attr SQL_DESC_OCTET_LENGTH 21 attr SQL_DESC_PRECISION 19 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 21 attr SQL_DESC_CONCISE_TYPE SQL_DECIMAL select numeric(10,2) 0 attr SQL_COLUMN_LENGTH 12 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 2 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 2 attr SQL_DESC_DISPLAY_SIZE 12 select numeric(23,4) 0 attr SQL_COLUMN_LENGTH 25 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 4 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 25 attr SQL_DESC_PRECISION 23 attr SQL_DESC_SCALE 4 attr SQL_DESC_DISPLAY_SIZE 25 select datetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 23 attr SQL_COLUMN_SCALE 3 attr SQL_DESC_LENGTH 23 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 3 attr SQL_DESC_SCALE 3 attr SQL_DESC_DISPLAY_SIZE 23 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP select smalldatetime '2006-04-14' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 16 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 16 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 0 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 19 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP select char(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 10 select varchar(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 select nchar(12) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 24 attr SQL_COLUMN_PRECISION 12 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 12 attr SQL_DESC_OCTET_LENGTH 24 attr SQL_DESC_PRECISION 12 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_TYPE_NAME nchar select nvarchar(13) 'hi!'+nchar(10) attr SQL_COLUMN_LENGTH 26 39 attr SQL_COLUMN_PRECISION 13 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 13 attr SQL_DESC_OCTET_LENGTH 26 39 attr SQL_DESC_PRECISION 13 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 13 attr SQL_DESC_TYPE_NAME nvarchar select text 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 4096 select ntext 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 2048 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 2048 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 2048 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 2048 attr SQL_DESC_TYPE_NAME ntext select binary(10) 'hi!' attr SQL_COLUMN_LENGTH 10 attr SQL_COLUMN_PRECISION 10 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_OCTET_LENGTH 10 attr SQL_DESC_PRECISION 10 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 20 select varbinary(11) 'hi!' attr SQL_COLUMN_LENGTH 11 attr SQL_COLUMN_PRECISION 11 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 11 attr SQL_DESC_OCTET_LENGTH 11 attr SQL_DESC_PRECISION 11 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 22 select image 'hi!' attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 4096 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 4096 attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 4096 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8192 select uniqueidentifier 'AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE' attr SQL_COLUMN_LENGTH 16 attr SQL_COLUMN_PRECISION 36 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 36 attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_PRECISION 36 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 36 attr SQL_DESC_TYPE_NAME uniqueidentifier tds_version_cmp tds71p >= 7.1 if tds71p select sql_variant 'hello' attr SQL_DESC_CONCISE_TYPE SQL_SS_VARIANT attr SQL_DESC_TYPE SQL_SS_VARIANT attr SQL_COLUMN_LENGTH 0 attr SQL_COLUMN_PRECISION 8000 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 8000 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 8000 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8000 attr SQL_DESC_TYPE_NAME sql_variant select int 654 select sql_variant 123 attr SQL_DESC_CONCISE_TYPE SQL_SS_VARIANT attr SQL_DESC_TYPE SQL_SS_VARIANT attr SQL_COLUMN_LENGTH 0 attr SQL_COLUMN_PRECISION 8000 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 8000 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 8000 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 8000 attr SQL_DESC_TYPE_NAME sql_variant endif # check for mssql 2008 date/time types tds_version_cmp tds73p >= 7.3 if tds73p set DESC_PRECISION 2 set DESC_SCALE 2 select time(4) '12:34:56' attr SQL_DESC_SCALE 4 attr SQL_DESC_LENGTH 13 attr SQL_DESC_PRECISION 4 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_DISPLAY_SIZE 13 attr SQL_DESC_OCTET_LENGTH 12 set DESC_PRECISION 2 set DESC_SCALE 2 select datetime2(4) '12:34:56' attr SQL_DESC_SCALE 4 attr SQL_DESC_LENGTH 24 attr SQL_DESC_PRECISION 4 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME datetime2 attr SQL_DESC_DISPLAY_SIZE 24 attr SQL_DESC_OCTET_LENGTH 16 set DESC_PRECISION 2 set DESC_SCALE 2 select datetimeoffset(4) '12:34:56' attr SQL_DESC_SCALE 4 attr SQL_DESC_LENGTH 31 attr SQL_DESC_PRECISION 4 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE_NAME datetimeoffset attr SQL_DESC_DISPLAY_SIZE 31 attr SQL_DESC_OCTET_LENGTH 20 set DESC_PRECISION 2 set DESC_SCALE 2 select time(3) '12:34:56' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 12 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_DISPLAY_SIZE 12 attr SQL_DESC_OCTET_LENGTH 12 set DESC_PRECISION 2 set DESC_SCALE 2 select datetime2(3) '12:34:56' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 23 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME datetime2 attr SQL_DESC_DISPLAY_SIZE 23 attr SQL_DESC_OCTET_LENGTH 16 set DESC_PRECISION 2 set DESC_SCALE 2 # select datetime2 '2015-09-09 12:23:34' select datetime2 '12:23:34' attr SQL_DESC_SCALE 7 attr SQL_DESC_LENGTH 27 attr SQL_DESC_PRECISION 7 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME datetime2 attr SQL_DESC_DISPLAY_SIZE 27 attr SQL_DESC_OCTET_LENGTH 16 set DESC_PRECISION 2 set DESC_SCALE 2 select datetimeoffset(3) '12:34:56' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 30 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE SQL_SS_TIMESTAMPOFFSET attr SQL_DESC_TYPE_NAME datetimeoffset attr SQL_DESC_DISPLAY_SIZE 30 attr SQL_DESC_OCTET_LENGTH 20 set DESC_PRECISION 2 set DESC_SCALE 2 select date '2011-08-06' attr SQL_DESC_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE_NAME date attr SQL_DESC_DISPLAY_SIZE 10 attr SQL_DESC_OCTET_LENGTH 6 endif tds_version_cmp tds72p >= 7.2 if tds72p select varchar(max) 'test' attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_VARCHAR select nvarchar(max) 'test' attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_WVARCHAR select varbinary(max) '4142434445' attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_VARBINARY select xml """'ciaohi'""" attr SQL_DESC_CONCISE_TYPE SQL_SS_XML attr SQL_DESC_TYPE SQL_SS_XML attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 0 attr SQL_DESC_LENGTH 0 attr SQL_DESC_OCTET_LENGTH 0 attr SQL_DESC_PRECISION 0 endif tds_version_cmp tds50 == 5.0 if tds50 set DESC_PRECISION 2 set DESC_SCALE 2 select time '12:34:56.543' attr SQL_DESC_SCALE 3 attr SQL_DESC_LENGTH 12 attr SQL_DESC_PRECISION 3 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE_NAME time attr SQL_COLUMN_SCALE 3 attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_DISPLAY_SIZE 12 set DESC_PRECISION 2 set DESC_SCALE 2 select date '2011-08-06' attr SQL_DESC_SCALE 0 attr SQL_DESC_LENGTH 10 attr SQL_DESC_PRECISION 0 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE SQL_TYPE_DATE attr SQL_DESC_TYPE_NAME date attr SQL_COLUMN_SCALE 0 attr SQL_DESC_OCTET_LENGTH 6 attr SQL_DESC_DISPLAY_SIZE 10 set DESC_PRECISION 2 set DESC_SCALE 2 select bigtime '12:34:56.543765' attr SQL_DESC_SCALE 6 attr SQL_DESC_LENGTH 15 attr SQL_DESC_PRECISION 6 attr SQL_DESC_CONCISE_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE SQL_SS_TIME2 attr SQL_DESC_TYPE_NAME bigtime attr SQL_DESC_OCTET_LENGTH 12 attr SQL_DESC_DISPLAY_SIZE 15 set DESC_PRECISION 2 set DESC_SCALE 2 select bigdatetime """'2011-08-06 12:34:56.543'""" attr SQL_DESC_SCALE 6 attr SQL_DESC_LENGTH 26 attr SQL_DESC_PRECISION 6 attr SQL_DESC_CONCISE_TYPE SQL_TYPE_TIMESTAMP attr SQL_DESC_TYPE SQL_DATETIME attr SQL_DESC_TYPE_NAME bigdatetime attr SQL_DESC_OCTET_LENGTH 16 attr SQL_DESC_DISPLAY_SIZE 26 # these types resemble more MS driver than Sybase one # to be coherent with NVARCHAR select univarchar(30) 'test123' attr SQL_DESC_SCALE 0 attr SQL_DESC_PRECISION 30 attr SQL_DESC_LENGTH 30 attr SQL_DESC_CONCISE_TYPE SQL_WVARCHAR attr SQL_DESC_TYPE SQL_WVARCHAR attr SQL_DESC_TYPE_NAME univarchar attr SQL_DESC_OCTET_LENGTH 60 attr SQL_DESC_DISPLAY_SIZE 30 select unichar(30) 'test123' attr SQL_DESC_SCALE 0 attr SQL_DESC_PRECISION 30 attr SQL_DESC_LENGTH 30 attr SQL_DESC_CONCISE_TYPE SQL_WCHAR attr SQL_DESC_TYPE SQL_WCHAR attr SQL_DESC_TYPE_NAME unichar attr SQL_DESC_OCTET_LENGTH 60 attr SQL_DESC_DISPLAY_SIZE 30 endif # some additional tests using ARD set DESC_CONCISE_TYPE SQL_NUMERIC set DESC_PRECISION 4 set DESC_SCALE 2 set DESC_CONCISE_TYPE SQL_INTEGER attr DESC_TYPE SQL_INTEGER # TODO #attr DESC_LENGTH 4 #attr DESC_PRECISION 4 #attr DESC_SCALE 2 freetds-1.3.6/src/odbc/unittests/describecol2.c000644 025423 025423 00000002523 14056414222 023051 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* * SQLDescribeCol test */ static int g_result = 0; static void do_check(int c, const char *test, int line) { if (c) return; fprintf(stderr, "Failed check %s at line %d\n", test, line); g_result = 1; } #define check(s) do_check(s, #s, __LINE__) int main(int argc, char *argv[]) { SQLSMALLINT len, type; SQLTCHAR name[128]; odbc_connect(); odbc_command("create table #dc (col_name int, name2 varchar(100))"); odbc_command("select * from #dc"); len = 0x1234; CHKDescribeCol(1, NULL, 0, &len, &type, NULL, NULL, NULL, "S"); check(len == 8); len = 0x1234; CHKDescribeCol(2, name, 0, &len, &type, NULL, NULL, NULL, "I"); check(len == 5); len = 0x1234; CHKDescribeCol(1, NULL, 2, &len, &type, NULL, NULL, NULL, "S"); check(len == 8); len = 0x1234; strcpy((char *) name, "xxx"); CHKDescribeCol(2, name, 3, &len, &type, NULL, NULL, NULL, "I"); check(len == 5 && strcmp(C(name), "na") == 0); len = 0x1234; strcpy((char *) name, "xxx"); CHKDescribeCol(1, name, 1, &len, &type, NULL, NULL, NULL, "I"); check(len == 8 && strcmp(C(name), "") == 0); len = 0x1234; strcpy((char *) name, "xxx"); CHKDescribeCol(2, name, 6, &len, &type, NULL, NULL, NULL, "S"); check(len == 5 && strcmp(C(name), "name2") == 0); odbc_disconnect(); if (g_result == 0) printf("Done.\n"); return g_result; } freetds-1.3.6/src/odbc/unittests/earlybind.c000644 025423 025423 00000002560 14056414271 022467 0ustar00fredianofrediano000000 000000 #include "common.h" int main(int argc, char *argv[]) { SQLINTEGER id; SQLLEN ind1, ind2; char name[64]; odbc_connect(); odbc_command("CREATE TABLE #test(id INT, name VARCHAR(100))"); odbc_command("INSERT INTO #test(id, name) VALUES(8, 'sysobjects')"); /* bind before select */ SQLBindCol(odbc_stmt, 1, SQL_C_SLONG, &id, sizeof(SQLINTEGER), &ind1); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, name, sizeof(name), &ind2); /* do select */ odbc_command("SELECT id, name FROM #test WHERE name = 'sysobjects' SELECT 123, 'foo'"); /* get results */ id = -1; memset(name, 0, sizeof(name)); CHKFetch("S"); if (id == -1 || strcmp(name, "sysobjects") != 0) { fprintf(stderr, "wrong results\n"); return 1; } /* discard others data */ CHKFetch("No"); SQLMoreResults(odbc_stmt); id = -1; memset(name, 0, sizeof(name)); CHKFetch("S"); if (id != 123 || strcmp(name, "foo") != 0) { fprintf(stderr, "wrong results\n"); return 1; } /* discard others data */ CHKFetch("No"); SQLMoreResults(odbc_stmt); /* other select */ odbc_command("SELECT 321, 'minni'"); /* get results */ id = -1; memset(name, 0, sizeof(name)); CHKFetch("S"); if (id != 321 || strcmp(name, "minni") != 0) { fprintf(stderr, "wrong results\n"); return 1; } /* discard others data */ CHKFetch("No"); SQLMoreResults(odbc_stmt); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/empty_query.c000644 025423 025423 00000000570 14056414222 023074 0ustar00fredianofrediano000000 000000 #include "common.h" /* Check that on queries returning 0 rows and NOCOUNT active SQLExecDirect returns success. * Also SQLFetch should return NO_DATA for these queries. */ int main(void) { odbc_use_version3 = 1; odbc_connect(); odbc_command2("SET NOCOUNT ON\nSELECT 123 AS foo WHERE 0=1", "S"); CHKFetch("No"); CHKMoreResults("No"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/error.c000644 025423 025423 00000002533 14056414222 021643 0ustar00fredianofrediano000000 000000 #include "common.h" /* some tests on error reporting */ int main(int argc, char *argv[]) { SQLRETURN RetCode; HSTMT stmt; odbc_connect(); /* create a test table */ odbc_command("create table #tmp (i int)"); odbc_command("insert into #tmp values(3)"); odbc_command("insert into #tmp values(4)"); odbc_command("insert into #tmp values(5)"); odbc_command("insert into #tmp values(6)"); odbc_command("insert into #tmp values(7)"); /* issue our command */ RetCode = odbc_command2("select 100 / (i - 5) from #tmp order by i", "SE"); /* special case, early Sybase detect error early */ if (RetCode != SQL_ERROR) { /* TODO when multiple row fetch available test for error on some columns */ CHKFetch("S"); CHKFetch("S"); CHKFetch("E"); } odbc_read_error(); if (!strstr(odbc_err, "zero")) { fprintf(stderr, "Message invalid\n"); return 1; } SQLFetch(odbc_stmt); SQLFetch(odbc_stmt); SQLFetch(odbc_stmt); SQLMoreResults(odbc_stmt); CHKAllocStmt(&stmt, "S"); odbc_command("SELECT * FROM sysobjects"); odbc_stmt = stmt; /* a statement is already active so you get error... */ if (odbc_command2("SELECT * FROM sysobjects", "SE") == SQL_SUCCESS) { SQLMoreResults(odbc_stmt); /* ...or we are using MARS! */ odbc_command2("BEGIN TRANSACTION", "E"); } odbc_read_error(); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/freeclose.c000644 025423 025423 00000024343 14056414222 022464 0ustar00fredianofrediano000000 000000 #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_SYS_WAIT_H #include #endif /* HAVE_SYS_WAIT_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if (!defined(TDS_NO_THREADSAFE) && HAVE_ALARM && HAVE_FSTAT && defined(S_IFSOCK)) || defined(_WIN32) #include #include #include /* this crazy test tests that we do not send too much prepare ... */ static tds_mutex mtx; typedef union { struct sockaddr sa; struct sockaddr_in sin; char dummy[256]; } long_sockaddr; static long_sockaddr remote_addr; static socklen_t remote_addr_len; static TDS_SYS_SOCKET fake_sock; static tds_thread fake_thread; #ifdef _WIN32 #define alarm(n) do { ; } while(0) #endif static TDS_THREAD_PROC_DECLARE(fake_thread_proc, arg); static int init_fake_server(int ip_port) { struct sockaddr_in sin; TDS_SYS_SOCKET s; memset(&sin, 0, sizeof(sin)); sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sin.sin_port = htons((short) ip_port); sin.sin_family = AF_INET; if (TDS_IS_SOCKET_INVALID(s = socket(AF_INET, SOCK_STREAM, 0))) { perror("socket"); exit(1); } if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) { perror("bind"); CLOSESOCKET(s); return 1; } if (listen(s, 5) < 0) { perror("listen"); CLOSESOCKET(s); return 1; } if (tds_thread_create(&fake_thread, fake_thread_proc, TDS_INT2PTR(s)) != 0) { perror("tds_thread_create"); exit(1); } return 0; } static void write_all(TDS_SYS_SOCKET s, const void *buf, size_t len) { int res, l; fd_set fds_write; for (; len > 0;) { FD_ZERO(&fds_write); FD_SET(s, &fds_write); res = select(s + 1, NULL, &fds_write, NULL, NULL); if (res <= 0) { if (errno == EINTR) continue; perror("select"); exit(1); } l = WRITESOCKET(s, buf, len); if (l <= 0) { perror("write socket"); exit(1); } buf = ((const char *) buf) + l; len -= l; } } static unsigned int inserts = 0; static char insert_buf[256] = ""; static void count_insert(const char* buf, size_t len) { static const char search[] = "insert into"; static unsigned char prev = 'x'; char *p; unsigned char c; size_t insert_len; /* add to buffer */ for (p = strchr(insert_buf, 0); len > 0; --len, ++buf) { c = (unsigned char) buf[0]; if (prev == 0 || c != 0) *p++ = (c >= ' ' && c < 128) ? tolower(c) : '_'; prev = c; } *p = 0; /* check it */ while ((p=strstr(insert_buf, search)) != NULL) { tds_mutex_lock(&mtx); ++inserts; tds_mutex_unlock(&mtx); /* do not find again */ p[0] = '_'; } /* avoid buffer too long */ insert_len = strlen(insert_buf); if (insert_len > sizeof(search)) { p = insert_buf + insert_len - sizeof(search); memmove(insert_buf, p, strlen(p) + 1); } } static unsigned int round_trips = 0; static enum { sending, receiving } flow = sending; static TDS_THREAD_PROC_DECLARE(fake_thread_proc, arg) { TDS_SYS_SOCKET s = TDS_PTR2INT(arg), server_sock; socklen_t sock_len; int len; char buf[128]; struct sockaddr_in sin; fd_set fds_read, fds_write, fds_error; TDS_SYS_SOCKET max_fd = 0; memset(&sin, 0, sizeof(sin)); sock_len = sizeof(sin); alarm(30); fprintf(stderr, "waiting connect...\n"); if ((fake_sock = tds_accept(s, (struct sockaddr *) &sin, &sock_len)) < 0) { perror("accept"); exit(1); } CLOSESOCKET(s); if (TDS_IS_SOCKET_INVALID(server_sock = socket(remote_addr.sa.sa_family, SOCK_STREAM, 0))) { perror("socket"); exit(1); } fprintf(stderr, "connecting to server...\n"); if (remote_addr.sa.sa_family == AF_INET) { fprintf(stderr, "connecting to %x:%d\n", (unsigned int) remote_addr.sin.sin_addr.s_addr, ntohs(remote_addr.sin.sin_port)); } if (connect(server_sock, &remote_addr.sa, remote_addr_len)) { perror("connect"); exit(1); } alarm(0); if (fake_sock > max_fd) max_fd = fake_sock; if (server_sock > max_fd) max_fd = server_sock; for (;;) { int res; FD_ZERO(&fds_read); FD_SET(fake_sock, &fds_read); FD_SET(server_sock, &fds_read); FD_ZERO(&fds_write); FD_ZERO(&fds_error); FD_SET(fake_sock, &fds_error); FD_SET(server_sock, &fds_error); alarm(30); res = select(max_fd + 1, &fds_read, &fds_write, &fds_error, NULL); alarm(0); if (res < 0) { if (sock_errno == TDSSOCK_EINTR) continue; perror("select"); exit(1); } if (FD_ISSET(fake_sock, &fds_error) || FD_ISSET(server_sock, &fds_error)) { fprintf(stderr, "error in select\n"); exit(1); } /* just read and forward */ if (FD_ISSET(fake_sock, &fds_read)) { if (flow != sending) { tds_mutex_lock(&mtx); ++round_trips; tds_mutex_unlock(&mtx); } flow = sending; len = READSOCKET(fake_sock, buf, sizeof(buf)); if (len == 0) { fprintf(stderr, "client connection closed\n"); break; } if (len < 0 && sock_errno != TDSSOCK_EINPROGRESS) { fprintf(stderr, "read client error %d\n", sock_errno); break; } count_insert(buf, len); write_all(server_sock, buf, len); } if (FD_ISSET(server_sock, &fds_read)) { if (flow != receiving) { tds_mutex_lock(&mtx); ++round_trips; tds_mutex_unlock(&mtx); } flow = receiving; len = READSOCKET(server_sock, buf, sizeof(buf)); if (len == 0) { fprintf(stderr, "server connection closed\n"); break; } if (len < 0 && sock_errno != TDSSOCK_EINPROGRESS) { fprintf(stderr, "read server error %d\n", sock_errno); break; } write_all(fake_sock, buf, len); } } CLOSESOCKET(fake_sock); CLOSESOCKET(server_sock); return TDS_THREAD_RESULT(0); } int main(int argc, char **argv) { SQLLEN sql_nts = SQL_NTS; const char *query; SQLINTEGER id = 0; char string[64]; TDS_SYS_SOCKET last_socket; int port; const int num_inserts = 20; int is_freetds; #ifdef _WIN32 WSADATA wsaData; WSAStartup(MAKEWORD(2, 2), &wsaData); #endif if (tds_mutex_init(&mtx)) return 1; odbc_mark_sockets_opened(); odbc_connect(); /* * this does not work if server is not connected with socket * (ie ms driver connected locally) */ last_socket = odbc_find_last_socket(); if (TDS_IS_SOCKET_INVALID(last_socket)) { fprintf(stderr, "Error finding last socket opened\n"); return 1; } remote_addr_len = sizeof(remote_addr); if (tds_getpeername(last_socket, &remote_addr.sa, &remote_addr_len)) { fprintf(stderr, "Unable to get remote address %d\n", sock_errno); return 1; } is_freetds = odbc_driver_is_freetds(); odbc_disconnect(); /* init fake server, behave like a proxy */ for (port = 12340; port < 12350; ++port) if (!init_fake_server(port)) break; if (port == 12350) { fprintf(stderr, "Cannot bind to a port\n"); return 1; } printf("Fake server bound at port %d\n", port); /* override connections */ if (is_freetds) { setenv("TDSHOST", "127.0.0.1", 1); sprintf(string, "%d", port); setenv("TDSPORT", string, 1); odbc_connect(); } else { char tmp[2048]; SQLSMALLINT len; CHKAllocEnv(&odbc_env, "S"); CHKAllocConnect(&odbc_conn, "S"); sprintf(tmp, "DRIVER={SQL Server};SERVER=127.0.0.1,%d;UID=%s;PWD=%s;DATABASE=%s;Network=DBMSSOCN;", port, odbc_user, odbc_password, odbc_database); printf("connection string: %s\n", tmp); CHKDriverConnect(NULL, T(tmp), SQL_NTS, (SQLTCHAR *) tmp, sizeof(tmp)/sizeof(SQLTCHAR), &len, SQL_DRIVER_NOPROMPT, "SI"); CHKAllocStmt(&odbc_stmt, "S"); } /* real test */ odbc_command("CREATE TABLE #test(i int, c varchar(40))"); odbc_reset_statement(); /* do not take into account connection statistics */ tds_mutex_lock(&mtx); round_trips = 0; inserts = 0; tds_mutex_unlock(&mtx); query = "insert into #test values (?, ?)"; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, sizeof(id), 0, &id, 0, &sql_nts, "SI"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(string), 0, string, 0, &sql_nts, "SI"); CHKPrepare(T(query), SQL_NTS, "SI"); tds_mutex_lock(&mtx); printf("%u round trips %u inserts\n", round_trips, inserts); tds_mutex_unlock(&mtx); for (id = 0; id < num_inserts; id++) { sprintf(string, "This is a test (%d)", (int) id); CHKExecute("SI"); CHKFreeStmt(SQL_CLOSE, "S"); } tds_mutex_lock(&mtx); printf("%u round trips %u inserts\n", round_trips, inserts); tds_mutex_unlock(&mtx); odbc_reset_statement(); tds_mutex_lock(&mtx); if (inserts > 1 || round_trips > (unsigned) (num_inserts * 2 + 6)) { fprintf(stderr, "Too much round trips (%u) or insert (%u) !!!\n", round_trips, inserts); tds_mutex_unlock(&mtx); return 1; } printf("%u round trips %u inserts\n", round_trips, inserts); tds_mutex_unlock(&mtx); #ifdef ENABLE_DEVELOPING /* check for SQL_RESET_PARAMS */ tds_mutex_lock(&mtx); round_trips = 0; inserts = 0; tds_mutex_unlock(&mtx); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, sizeof(id), 0, &id, 0, &sql_nts, "SI"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(string), 0, string, 0, &sql_nts, "SI"); CHKPrepare((SQLCHAR *) query, SQL_NTS, "SI"); tds_mutex_lock(&mtx); printf("%u round trips %u inserts\n", round_trips, inserts); tds_mutex_unlock(&mtx); for (id = 0; id < num_inserts; id++) { CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, sizeof(id), 0, &id, 0, &sql_nts, "SI"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(string), 0, string, 0, &sql_nts, "SI"); sprintf(string, "This is a test (%d)", (int) id); CHKExecute("SI"); CHKFreeStmt(SQL_RESET_PARAMS, "S"); } tds_mutex_lock(&mtx); printf("%u round trips %u inserts\n", round_trips, inserts); tds_mutex_unlock(&mtx); odbc_reset_statement(); tds_mutex_lock(&mtx); if (inserts > 1 || round_trips > num_inserts * 2 + 6) { fprintf(stderr, "Too much round trips (%u) or insert (%u) !!!\n", round_trips, inserts); tds_mutex_unlock(&mtx); return 1; } printf("%u round trips %u inserts\n", round_trips, inserts); tds_mutex_unlock(&mtx); #endif odbc_disconnect(); alarm(10); tds_thread_join(fake_thread, NULL); return 0; } #else int main(void) { printf("Not possible for this platform.\n"); odbc_test_skipped(); return 0; } #endif freetds-1.3.6/src/odbc/unittests/funccall.c000644 025423 025423 00000014760 14056414222 022306 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for {?=call store(?)} syntax and run */ static void test_with_conversions(void); static void test_with_dbname(void); int main(int argc, char *argv[]) { SQLINTEGER input, output; SQLLEN ind, ind2, ind3, ind4; SQLINTEGER out1; char out2[30]; odbc_connect(); odbc_command("IF OBJECT_ID('simpleresult') IS NOT NULL DROP PROC simpleresult"); odbc_command("create proc simpleresult @i int as begin return @i end"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2, "S"); CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind, "S"); CHKPrepare(T("{ \n?\t\r= call simpleresult(?)}"), SQL_NTS, "S"); input = 123; ind2 = sizeof(input); output = 0xdeadbeef; CHKExecute("S"); if (output != 123) { printf("Invalid result\n"); exit(1); } /* should return "Invalid cursor state" */ if (SQLFetch(odbc_stmt) != SQL_ERROR) { printf("Data not expected\n"); exit(1); } ODBC_CHECK_COLS(0); /* just to reset some possible buffers */ odbc_command("DECLARE @i INT"); /* same test but with SQLExecDirect and same bindings */ input = 567; ind2 = sizeof(input); output = 0xdeadbeef; CHKExecDirect(T("{?=call simpleresult(?)}"), SQL_NTS, "S"); if (output != 567) { fprintf(stderr, "Invalid result\n"); exit(1); } /* should return "Invalid cursor state" */ CHKFetch("E"); odbc_command("drop proc simpleresult"); odbc_command("IF OBJECT_ID('simpleresult2') IS NOT NULL DROP PROC simpleresult2"); /* force cursor close */ SQLCloseCursor(odbc_stmt); /* test output parameter */ odbc_command("create proc simpleresult2 @i int, @x int output, @y varchar(20) output as begin select @x = 6789 select @y = 'test foo' return @i end"); CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind, "S"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2, "S"); CHKBindParameter(3, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind3, "S"); CHKBindParameter(4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, 20, 0, out2, sizeof(out2), &ind4, "S"); CHKPrepare(T("{ \n?\t\r= call simpleresult2(?,?,?)}"), SQL_NTS, "S"); input = 987; ind2 = sizeof(input); out1 = 888; output = 0xdeadbeef; ind3 = SQL_DATA_AT_EXEC; ind4 = SQL_DEFAULT_PARAM; strcpy(out2, "bad!"); CHKExecute("S"); if (output != 987 || ind3 <= 0 || ind4 <= 0 || out1 != 6789 || strcmp(out2, "test foo") != 0) { printf("ouput = %d ind3 = %d ind4 = %d out1 = %d out2 = %s\n", (int) output, (int) ind3, (int) ind4, (int) out1, out2); printf("Invalid result\n"); exit(1); } /* should return "Invalid cursor state" */ CHKFetch("E"); ODBC_CHECK_COLS(0); odbc_command("drop proc simpleresult2"); /* * test from shiv kumar * Cfr ML 2006-11-21 "specifying a 0 for the StrLen_or_IndPtr in the * SQLBindParameter call is not working on AIX" */ odbc_command("IF OBJECT_ID('rpc_read') IS NOT NULL DROP PROC rpc_read"); odbc_reset_statement(); odbc_command("create proc rpc_read @i int, @x timestamp as begin select 1 return 1234 end"); SQLCloseCursor(odbc_stmt); CHKPrepare(T("{ ? = CALL rpc_read ( ?, ? ) }"), SQL_NTS, "S"); ind = 0; CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &output, 0, &ind, "S"); ind2 = 0; CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &input, 0, &ind2, "S"); ind3 = 8; CHKBindParameter(3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, 8, 0, out2, 8, &ind3, "S"); CHKExecute("S"); CHKFetch("S"); CHKFetch("No"); odbc_reset_statement(); odbc_command("drop proc rpc_read"); /* * Test from Joao Amaral * This test SQLExecute where a store procedure returns no result * This seems similar to a previous one but use set instead of select * (with is supported only by mssql and do not return all stuff as * select does) */ if (odbc_db_is_microsoft()) { odbc_reset_statement(); odbc_command("IF OBJECT_ID('sp_test') IS NOT NULL DROP PROC sp_test"); odbc_command("create proc sp_test @res int output as set @res = 456"); odbc_reset_statement(); CHKPrepare(T("{ call sp_test(?)}"), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind, "S"); output = 0xdeadbeef; CHKExecute("S"); if (output != 456) { fprintf(stderr, "Invalid result %d(%x)\n", (int) output, (int) output); return 1; } odbc_command("drop proc sp_test"); } odbc_disconnect(); if (odbc_db_is_microsoft()) { odbc_use_version3 = 1; odbc_connect(); test_with_conversions(); test_with_dbname(); odbc_disconnect(); } printf("Done.\n"); return 0; } static void test_with_conversions(void) { SQLLEN ind, ind2, ind3; char out2[30]; /* * test from Bower, Wayne * Cfr ML 2012-03-02 "[freetds] [unixODBC][Driver Manager]Function sequence error (SQL-HY010)" */ odbc_command("IF OBJECT_ID('TMP_SP_Test_ODBC') IS NOT NULL DROP PROC TMP_SP_Test_ODBC"); odbc_command("create proc TMP_SP_Test_ODBC @i int,\n@o int output\nas\nset nocount on\nselect @o = 55\nreturn 9\n"); odbc_reset_statement(); CHKPrepare(T("{ ? = call TMP_SP_Test_ODBC (?, ?) }"), SQL_NTS, "S"); ind2 = 2; CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 80, 0, "10", 2, &ind2, "S"); ind3 = SQL_NULL_DATA; strcpy(out2, " "); CHKBindParameter(3, SQL_PARAM_INPUT_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, 0, 1, out2, 29, &ind3, "S"); ind = 1; CHKBindParameter(1, SQL_PARAM_INPUT_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, 0, 1, out2, 29, &ind, "S"); /* mssql returns SUCCESS */ CHKExecute("No"); ODBC_CHECK_COLS(0); odbc_reset_statement(); odbc_command("drop proc TMP_SP_Test_ODBC"); } static void test_with_dbname(void) { SQLINTEGER len; SQLTCHAR out[512]; char sql[1024]; SQLINTEGER output; SQLLEN ind; ODBC_BUF *odbc_buf = NULL; len = sizeof(out); CHKGetConnectAttr(SQL_ATTR_CURRENT_CATALOG, (SQLPOINTER) out, sizeof(out), &len, "SI"); odbc_command("IF OBJECT_ID('TMP_SP_Test_ODBC') IS NOT NULL DROP PROC TMP_SP_Test_ODBC"); odbc_command("create proc TMP_SP_Test_ODBC @o int output\nas\nset @o=55\nreturn 3\n"); odbc_reset_statement(); sprintf(sql, "{call [%s]..TMP_SP_Test_ODBC(?)}", C(out)); CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind, "S"); CHKPrepare(T(sql), SQL_NTS, "S"); output = 123; ind = sizeof(output); CHKExecute("S"); if (output != 55) { printf("Invalid result\n"); exit(1); } odbc_reset_statement(); odbc_command("drop proc TMP_SP_Test_ODBC"); ODBC_FREE(); } freetds-1.3.6/src/odbc/unittests/genparams.c000644 025423 025423 00000047615 14056414271 022505 0ustar00fredianofrediano000000 000000 #include "common.h" #include #include /* Test various type from odbc and to odbc */ /* * This test is useful to test odbc_sql2tds function using TestInput * odbc_sql2tds have some particular cases: * (1) char -> char handled differently with encoding problems * (2) date -> * different format TODO * (3) numeric -> * different format * (4) * -> numeric take precision and scale from ipd TODO * (5) * -> char test wide * (6) * -> blob test wchar and ntext * (7) * -> binary test also with wchar * (8) binary -> * test also with wchar * Also we have to check normal char and wide char */ #ifdef TDS_NO_DM static const char tds_no_dm = 1; #else static const char tds_no_dm = 0; #endif static char precision = 18; static char exec_direct = 0; static char prepare_before = 0; static char use_cursors = 0; static int only_test = 0; static const char * split_collate(ODBC_BUF** buf, const char **type) { const char *collate = "", *p; if ((p = strstr(*type, " COLLATE ")) != NULL) { if (odbc_db_is_microsoft()) collate = p; *type = odbc_buf_asprintf(buf, "%.*s", (int) (p - *type), *type); } return collate; } static int TestOutput(const char *type, const char *value_to_convert, SQLSMALLINT out_c_type, SQLSMALLINT out_sql_type, const char *expected) { char sbuf[1024]; unsigned char out_buf[256]; SQLLEN out_len = 0; const char *sep; const char *collate; odbc_reset_statement(); /* build store procedure to test */ odbc_command("IF OBJECT_ID('spTestProc') IS NOT NULL DROP PROC spTestProc"); sep = "'"; if (strncmp(value_to_convert, "0x", 2) == 0 || strncmp(value_to_convert, "NCHAR(", 6) == 0) sep = ""; collate = split_collate(&odbc_buf, &type); sprintf(sbuf, "CREATE PROC spTestProc @i %s OUTPUT AS SELECT @i = CONVERT(%s, %s%s%s)%s", type, type, sep, value_to_convert, sep, collate); odbc_command(sbuf); memset(out_buf, 0, sizeof(out_buf)); if (use_cursors) { odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0, "S"); } /* bind parameter */ if (exec_direct) { CHKBindParameter(1, SQL_PARAM_OUTPUT, out_c_type, out_sql_type, precision, 0, out_buf, sizeof(out_buf), &out_len, "S"); /* call store procedure */ CHKExecDirect(T("{call spTestProc(?)}"), SQL_NTS, "S"); } else { if (prepare_before) CHKPrepare(T("{call spTestProc(?)}"), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_OUTPUT, out_c_type, out_sql_type, precision, 0, out_buf, sizeof(out_buf), &out_len, "S"); if (!prepare_before) CHKPrepare(T("{call spTestProc(?)}"), SQL_NTS, "S"); CHKExecute("S"); } /* * MS OBDC requires it cause first recordset is a recordset with a * warning caused by the way it execute RPC (via EXEC statement) */ if (use_cursors && !odbc_driver_is_freetds()) SQLMoreResults(odbc_stmt); /* test results */ odbc_c2string(sbuf, out_c_type, out_buf, out_len); if (strcmp(sbuf, expected) != 0) { if (only_test) { odbc_command("drop proc spTestProc"); ODBC_FREE(); return 1; } fprintf(stderr, "Wrong result\n Got: %s\n Expected: %s\n", sbuf, expected); exit(1); } only_test = 0; odbc_command("drop proc spTestProc"); ODBC_FREE(); return 0; } static char check_truncation = 0; static char use_nts = 0; /** * Test a parameter as input to prepared statement * * "value_to_convert" will be inserted as database type "type" and C type "out_c_type" into a column of * database type "param_type" and SQL type "out_sql_type". Then a select statement check that the column * in the database is the same as "value_to_convert". * "value_to_convert" can also contain a syntax like "input -> output", in this case the initial inserted * value is "input" and the final check will check for "output". */ static void TestInput(SQLSMALLINT out_c_type, const char *type, SQLSMALLINT out_sql_type, const char *param_type, const char *value_to_convert) { char sbuf[1024]; unsigned char out_buf[256]; SQLLEN out_len = 0; const char *expected = value_to_convert; size_t value_len = strlen(value_to_convert); const char *p; const char *sep = "'"; const char *collate; odbc_reset_statement(); /* execute a select to get data as wire */ if ((p = strstr(value_to_convert, " -> ")) != NULL) { value_len = p - value_to_convert; expected = p + 4; } if (value_len >= 2 && strncmp(value_to_convert, "0x", 2) == 0) sep = ""; collate = split_collate(&odbc_buf, &type); sprintf(sbuf, "SELECT CONVERT(%s, %s%.*s%s%s)", type, sep, (int) value_len, value_to_convert, sep, collate); odbc_command(sbuf); SQLBindCol(odbc_stmt, 1, out_c_type, out_buf, sizeof(out_buf), &out_len); CHKFetch("SI"); CHKFetch("No"); CHKMoreResults("No"); if (use_nts) { out_len = SQL_NTS; use_nts = 0; } /* create a table with a column of that type */ odbc_reset_statement(); collate = split_collate(&odbc_buf, ¶m_type); sprintf(sbuf, "CREATE TABLE #tmp_insert (col %s%s)", param_type, collate); odbc_command(sbuf); if (use_cursors) { odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0, "S"); } /* insert data using prepared statements */ sprintf(sbuf, "INSERT INTO #tmp_insert VALUES(?)"); if (exec_direct) { CHKBindParameter(1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, out_buf, sizeof(out_buf), &out_len, "S"); if (check_truncation) CHKExecDirect(T(sbuf), SQL_NTS, "E"); else CHKExecDirect(T(sbuf), SQL_NTS, "SNo"); } else { if (prepare_before) CHKPrepare(T(sbuf), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, out_buf, sizeof(out_buf), &out_len, "S"); if (!prepare_before) CHKPrepare(T(sbuf), SQL_NTS, "S"); if (check_truncation) CHKExecute("E"); else CHKExecute("SNo"); } /* check if row is present */ if (!check_truncation) { char *p; odbc_reset_statement(); sep = "'"; if (strncmp(expected, "0x", 2) == 0) sep = ""; strcpy(sbuf, "SELECT * FROM #tmp_insert WHERE "); p = strchr(sbuf, 0); if (strcmp(param_type, "TEXT") == 0) sprintf(p, "CONVERT(VARCHAR(255), col) = CONVERT(VARCHAR(255), %s%s%s)", sep, expected, sep); else if (strcmp(param_type, "NTEXT") == 0) sprintf(p, "CONVERT(NVARCHAR(2000), col) = CONVERT(NVARCHAR(2000), %s%s%s)", sep, expected, sep); else if (strcmp(param_type, "IMAGE") == 0) sprintf(p, "CONVERT(VARBINARY(255), col) = CONVERT(VARBINARY(255), %s%s%s)", sep, expected, sep); else sprintf(p, "col = CONVERT(%s, %s%s%s)", param_type, sep, expected, sep); odbc_command(sbuf); CHKFetch("S"); CHKFetch("No"); CHKMoreResults("No"); } check_truncation = 0; odbc_command("DROP TABLE #tmp_insert"); ODBC_FREE(); } /* stripped down version of TestInput for NULLs */ static void NullInput(SQLSMALLINT out_c_type, SQLSMALLINT out_sql_type, const char *param_type) { char sbuf[1024]; SQLLEN out_len = SQL_NULL_DATA; odbc_reset_statement(); /* create a table with a column of that type */ odbc_reset_statement(); sprintf(sbuf, "CREATE TABLE #tmp_insert (col %s NULL)", param_type); odbc_command(sbuf); if (use_cursors) { odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0, "S"); } /* insert data using prepared statements */ sprintf(sbuf, "INSERT INTO #tmp_insert VALUES(?)"); if (exec_direct) { CHKBindParameter(1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, NULL, 1, &out_len, "S"); CHKExecDirect(T(sbuf), SQL_NTS, "SNo"); } else { if (prepare_before) CHKPrepare(T(sbuf), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, NULL, 1, &out_len, "S"); if (!prepare_before) CHKPrepare(T(sbuf), SQL_NTS, "S"); CHKExecute("SNo"); } /* check if row is present */ odbc_reset_statement(); if (!odbc_db_is_microsoft() && strcmp(param_type, "TEXT") == 0) odbc_command("SELECT * FROM #tmp_insert WHERE DATALENGTH(col) = 0 OR DATALENGTH(col) IS NULL"); else odbc_command("SELECT * FROM #tmp_insert WHERE col IS NULL"); CHKFetch("S"); CHKFetch("No"); CHKMoreResults("No"); odbc_command("DROP TABLE #tmp_insert"); ODBC_FREE(); } static int big_endian = 1; static const char* pack(const char *fmt, ...) { static char out[80]; char *p = out; va_list v; va_start(v, fmt); for (; *fmt; ++fmt) { unsigned n = va_arg(v, unsigned); int i, l = 2; assert(p - out + 8 < sizeof(out)); switch (*fmt) { case 'l': l += 2; case 's': for (i = 0; i < l; ++i) { sprintf(p, "%02X", (n >> (8*(big_endian ? l-1-i : i))) & 0xffu); p += 2; } break; default: assert(0); } } *p = 0; va_end(v); return out; } static void AllTests(void) { struct tm *ltime; char buf[80]; time_t curr_time; SQLINTEGER y, m, d; char date[128]; printf("use_cursors %d exec_direct %d prepare_before %d\n", use_cursors, exec_direct, prepare_before); /* test some NULLs */ NullInput(SQL_C_CHAR, SQL_VARCHAR, "VARCHAR(100)"); NullInput(SQL_C_CHAR, SQL_LONGVARCHAR, "TEXT"); NullInput(SQL_C_LONG, SQL_INTEGER, "INTEGER"); NullInput(SQL_C_LONG, SQL_LONGVARCHAR, "TEXT"); NullInput(SQL_C_TYPE_TIMESTAMP, SQL_TYPE_TIMESTAMP, "DATETIME"); NullInput(SQL_C_FLOAT, SQL_REAL, "FLOAT"); NullInput(SQL_C_NUMERIC, SQL_LONGVARCHAR, "TEXT"); if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x08000000u) NullInput(SQL_C_BIT, SQL_BIT, "BIT"); NullInput(SQL_C_DOUBLE, SQL_DOUBLE, "MONEY"); /* FIXME why should return 38 0 as precision and scale ?? correct ?? */ precision = 18; TestOutput("NUMERIC(18,2)", "123", SQL_C_NUMERIC, SQL_NUMERIC, "18 0 1 7B"); TestOutput("DECIMAL(18,2)", "123", SQL_C_NUMERIC, SQL_DECIMAL, "18 0 1 7B"); precision = 38; TestOutput("NUMERIC(18,2)", "123", SQL_C_NUMERIC, SQL_NUMERIC, "38 0 1 7B"); TestInput(SQL_C_LONG, "INTEGER", SQL_VARCHAR, "VARCHAR(20)", "12345"); TestInput(SQL_C_LONG, "INTEGER", SQL_LONGVARCHAR, "TEXT", "12345"); /* * MS driver behavior for output parameters is different * former returns "313233" while newer "333133323333" */ if (odbc_driver_is_freetds()) TestOutput("VARCHAR(20)", "313233", SQL_C_BINARY, SQL_VARCHAR, "333133323333"); only_test = 1; precision = 3; if (TestOutput("DATETIME", "2004-02-24 15:16:17", SQL_C_BINARY, SQL_TIMESTAMP, pack("ssssssl", 2004, 2, 24, 15, 16, 17, 0))) { /* FIXME our driver ignore precision for date */ precision = 3; /* Some MS driver incorrectly prepare with smalldatetime*/ if (!use_cursors || odbc_driver_is_freetds()) { TestOutput("DATETIME", "2004-02-24 15:16:17", SQL_C_BINARY, SQL_TIMESTAMP, pack("ll", 0x9497, 0xFBAA2C)); } TestOutput("SMALLDATETIME", "2004-02-24 15:16:17", SQL_C_BINARY, SQL_TIMESTAMP, pack("ll", 0x9497, 0xFB9640)); } else { TestOutput("SMALLDATETIME", "2004-02-24 15:16:17", SQL_C_BINARY, SQL_TIMESTAMP, pack("ssssssl", 2004, 2, 24, 15, 16, 0, 0)); } TestInput(SQL_C_TYPE_TIMESTAMP, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 09:51:34"); /* test timestamp millisecond round off */ TestInput(SQL_C_TYPE_TIMESTAMP, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 09:51:34.001 -> 2005-07-22 09:51:34.000"); TestInput(SQL_C_TYPE_TIMESTAMP, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 09:51:34.002 -> 2005-07-22 09:51:34.003"); TestInput(SQL_C_TYPE_TIMESTAMP, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 09:51:34.003 -> 2005-07-22 09:51:34.003"); TestInput(SQL_C_TYPE_TIMESTAMP, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 09:51:34.004 -> 2005-07-22 09:51:34.003"); TestInput(SQL_C_TYPE_TIMESTAMP, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 09:51:34.005 -> 2005-07-22 09:51:34.007"); TestInput(SQL_C_TYPE_TIMESTAMP, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 09:51:34.006 -> 2005-07-22 09:51:34.007"); /* FIXME on ms driver first SQLFetch return SUCCESS_WITH_INFO for truncation error */ TestInput(SQL_C_TYPE_DATE, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", "2005-07-22 13:02:03 -> 2005-07-22 00:00:00"); /* replace date information with current date */ time(&curr_time); ltime = localtime(&curr_time); y = ltime->tm_year + 1900; m = ltime->tm_mon + 1; d = ltime->tm_mday; /* server concept of data can be different so try ask to server */ odbc_command("SELECT GETDATE()"); SQLBindCol(odbc_stmt, 1, SQL_C_CHAR, date, sizeof(date), NULL); if (SQLFetch(odbc_stmt) == SQL_SUCCESS) { int a, b, c; if (sscanf(date, "%d-%d-%d", &a, &b, &c) == 3) { y = a; m = b; d = c; } } SQLFetch(odbc_stmt); SQLMoreResults(odbc_stmt); SQLFreeStmt(odbc_stmt, SQL_UNBIND); sprintf(buf, "2003-07-22 13:02:03 -> %04d-%02d-%02d 13:02:03", (int) y, (int) m, (int) d); TestInput(SQL_C_TYPE_TIME, "DATETIME", SQL_TYPE_TIMESTAMP, "DATETIME", buf); TestInput(SQL_C_FLOAT, "FLOAT", SQL_REAL, "FLOAT", "1234.25"); TestInput(SQL_C_DOUBLE, "REAL", SQL_REAL, "FLOAT", "-1234.25"); TestInput(SQL_C_FLOAT, "REAL", SQL_REAL, "FLOAT", "1234.25"); TestInput(SQL_C_DOUBLE, "FLOAT", SQL_REAL, "FLOAT", "-1234.25"); TestInput(SQL_C_FLOAT, "FLOAT", SQL_FLOAT, "FLOAT", "1234.25"); TestInput(SQL_C_DOUBLE, "REAL", SQL_FLOAT, "FLOAT", "-1234.25"); TestInput(SQL_C_FLOAT, "FLOAT", SQL_DOUBLE, "FLOAT", "1234.25"); TestInput(SQL_C_DOUBLE, "REAL", SQL_DOUBLE, "FLOAT", "-1234.25"); TestInput(SQL_C_UTINYINT, "TINYINT", SQL_TINYINT, "TINYINT", "231"); TestInput(SQL_C_NUMERIC, "NUMERIC(20,3)", SQL_NUMERIC, "NUMERIC(20,3)", "765432.2 -> 765432"); TestInput(SQL_C_NUMERIC, "NUMERIC(20,3)", SQL_VARCHAR, "VARCHAR(20)", "578246.234 -> 578246"); TestInput(SQL_C_NUMERIC, "NUMERIC(20,3)", SQL_LONGVARCHAR, "TEXT", "578246.234 -> 578246"); TestInput(SQL_C_CHAR, "VARCHAR(100)", SQL_VARBINARY, "VARBINARY(20)", "4145544F -> AETO"); TestInput(SQL_C_CHAR, "TEXT COLLATE Latin1_General_CI_AS", SQL_VARBINARY, "VARBINARY(20)", "4145544F -> AETO"); TestInput(SQL_C_CHAR, "VARCHAR(100)", SQL_LONGVARBINARY, "IMAGE", "4145544F -> AETO"); TestInput(SQL_C_BINARY, "VARBINARY(100)", SQL_VARCHAR, "VARCHAR(20)", "0x4145544F -> AETO"); TestInput(SQL_C_BINARY, "IMAGE", SQL_VARCHAR, "VARCHAR(20)", "0x4145544F -> AETO"); TestInput(SQL_C_BIT, "BIT", SQL_BIT, "BIT", "0"); TestInput(SQL_C_BIT, "BIT", SQL_BIT, "BIT", "1"); TestInput(SQL_C_DOUBLE, "MONEY", SQL_DOUBLE, "MONEY", "123.34"); TestInput(SQL_C_CHAR, "VARCHAR(20)", SQL_VARCHAR, "VARCHAR(20)", "1EasyTest"); TestInput(SQL_C_CHAR, "VARCHAR(20)", SQL_LONGVARCHAR, "TEXT", "1EasyTest"); TestInput(SQL_C_WCHAR, "VARCHAR(10)", SQL_VARCHAR, "VARCHAR(10)", "Test 12345"); TestInput(SQL_C_WCHAR, "VARCHAR(10)", SQL_LONGVARCHAR, "TEXT", "Test 12345"); /* TODO use collate in syntax if available */ TestInput(SQL_C_CHAR, "VARCHAR(20)", SQL_VARCHAR, "VARCHAR(20)", "me\xf4"); TestInput(SQL_C_CHAR, "VARCHAR(20)", SQL_LONGVARCHAR, "TEXT", "me\xf4"); precision = 6; /* output from char with conversions */ TestOutput("VARCHAR(20)", "foo test", SQL_C_CHAR, SQL_VARCHAR, "6 foo te"); /* TODO use collate in syntax if available */ /* while usually on Microsoft database this encoding is valid on Sybase the database * could use UTF-8 encoding where \xf8\xf9 is an invalid encoded string */ if (odbc_db_is_microsoft() && odbc_tds_version() > 0x700) TestOutput("VARCHAR(20) COLLATE Latin1_General_CI_AS", "NCHAR(0xf8) + NCHAR(0xf9)", SQL_C_CHAR, SQL_VARCHAR, "2 \xf8\xf9"); /* MSSQL 2000 using ptotocol 7.1+ */ if ((odbc_db_is_microsoft() && odbc_db_version_int() >= 0x08000000u && odbc_tds_version() > 0x700) || (!odbc_db_is_microsoft() && strncmp(odbc_db_version(), "15.00.", 6) >= 0)) { TestOutput("BIGINT", "-987654321065432", SQL_C_BINARY, SQL_BIGINT, big_endian ? "FFFC7DBBCF083228" : "283208CFBB7DFCFF"); TestInput(SQL_C_SBIGINT, "BIGINT", SQL_BIGINT, "BIGINT", "-12345678901234"); } /* MSSQL 2000 */ if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x08000000u) { TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WCHAR, "NVARCHAR(100)", "test"); TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WLONGVARCHAR, "NTEXT", "test"); /* test for invalid stream due to truncation*/ TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WCHAR, "NVARCHAR(100)", "01234567890"); TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WLONGVARCHAR, "NTEXT", "01234567890"); #ifdef ENABLE_DEVELOPING check_truncation = 1; TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WCHAR, "NVARCHAR(100)", "012345678901234567890"); check_truncation = 1; TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WLONGVARCHAR, "NTEXT", "012345678901234567890"); #endif TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WCHAR, "NVARCHAR(100)", "\xa3h\xf9 -> 0xA3006800f900"); TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WLONGVARCHAR, "NTEXT", "\xa3h\xf9 -> 0xA3006800f900"); TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WCHAR, "NVARCHAR(100)", "0xA3006800f900 -> \xa3h\xf9"); TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_WLONGVARCHAR, "NTEXT", "0xA3006800f900 -> \xa3h\xf9"); TestInput(SQL_C_LONG, "INT", SQL_WVARCHAR, "NVARCHAR(100)", "45236"); TestInput(SQL_C_LONG, "INT", SQL_WLONGVARCHAR, "NTEXT", "45236"); precision = 6; TestOutput("NVARCHAR(20)", "foo test", SQL_C_CHAR, SQL_WVARCHAR, "6 foo te"); precision = 12; TestOutput("NVARCHAR(20)", "foo test", SQL_C_CHAR, SQL_WVARCHAR, "8 foo test"); /* TODO use collate in syntax if available */ TestOutput("NVARCHAR(20)", "0xf800f900", SQL_C_CHAR, SQL_WVARCHAR, "2 \xf8\xf9"); TestInput(SQL_C_WCHAR, "NVARCHAR(10)", SQL_WVARCHAR, "NVARCHAR(10)", "1EasyTest2"); TestInput(SQL_C_WCHAR, "NVARCHAR(10)", SQL_WLONGVARCHAR, "NTEXT", "1EasyTest2"); use_nts = 1; TestInput(SQL_C_WCHAR, "NVARCHAR(10)", SQL_WVARCHAR, "NVARCHAR(10)", "1EasyTest3"); use_nts = 1; TestInput(SQL_C_WCHAR, "NVARCHAR(10)", SQL_WLONGVARCHAR, "NTEXT", "1EasyTest3"); TestInput(SQL_C_WCHAR, "NVARCHAR(3)", SQL_WVARCHAR, "NVARCHAR(3)", "0xf800a300bc06"); TestInput(SQL_C_WCHAR, "NVARCHAR(3)", SQL_WLONGVARCHAR, "NTEXT", "0xf800a300bc06"); TestInput(SQL_C_WCHAR, "NVARCHAR(10)", SQL_INTEGER, "INT", " -423785 -> -423785"); TestInput(SQL_C_CHAR, "NVARCHAR(100)", SQL_VARBINARY, "VARBINARY(20)", "4145544F -> AETO"); TestInput(SQL_C_CHAR, "NTEXT COLLATE Latin1_General_CI_AS", SQL_VARBINARY, "VARBINARY(20)", "4145544F -> AETO"); TestInput(SQL_C_BINARY, "VARBINARY(100)", SQL_WVARCHAR, "NVARCHAR(20)", "0x4100450054004F00 -> AETO"); TestInput(SQL_C_BINARY, "IMAGE", SQL_WVARCHAR, "NVARCHAR(20)", "0x4100450054004F00 -> AETO"); } /* MSSQL 2005 */ if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x09000000u) { TestInput(SQL_C_CHAR, "VARCHAR(20)", SQL_LONGVARCHAR, "VARCHAR(MAX)", "1EasyTest"); TestInput(SQL_C_BINARY, "VARBINARY(20)", SQL_LONGVARBINARY, "VARBINARY(MAX)", "Anything will suite!"); TestInput(SQL_C_CHAR, "MONEY", SQL_VARCHAR, "MONEY", "123.3456"); } /* MSSQL 2008 */ if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x0a000000u) { TestInput(SQL_C_TYPE_DATE, "DATE", SQL_TYPE_DATE, "DATE", "2005-07-22"); TestInput(SQL_C_TYPE_TIME, "TIME", SQL_TYPE_TIME, "TIME", "13:02:03"); } /* Sybase */ if (!odbc_db_is_microsoft()) { TestInput(SQL_C_CHAR, "UNIVARCHAR(100)", SQL_WCHAR, "UNIVARCHAR(100)", "test"); TestInput(SQL_C_WCHAR, "UNIVARCHAR(100)", SQL_WCHAR, "UNIVARCHAR(100)", "test"); TestInput(SQL_C_CHAR, "UNIVARCHAR(100)", SQL_WVARCHAR, "UNIVARCHAR(100)", "test"); TestInput(SQL_C_WCHAR, "UNIVARCHAR(100)", SQL_WVARCHAR, "UNIVARCHAR(100)", "test"); } } int main(int argc, char *argv[]) { odbc_use_version3 = 1; odbc_conn_additional_params = "ClientCharset=ISO-8859-1;"; odbc_connect(); if (((char *) &big_endian)[0] == 1) big_endian = 0; for (use_cursors = 0; use_cursors <= 1; ++use_cursors) { if (use_cursors) { if (!tds_no_dm || !odbc_driver_is_freetds()) odbc_reset_statement(); /* if connection does not support cursors returns success */ setenv("TDS_SKIP_SUCCESS", "1", 1); odbc_check_cursor(); } exec_direct = 1; AllTests(); exec_direct = 0; prepare_before = 1; AllTests(); prepare_before = 0; AllTests(); } odbc_disconnect(); printf("Done successfully!\n"); return 0; } freetds-1.3.6/src/odbc/unittests/getdata.c000644 025423 025423 00000017153 14056414271 022133 0ustar00fredianofrediano000000 000000 /* * Test reading data with SQLGetData */ #include "common.h" #include static void test_err(const char *data, int c_type, const char *state) { char sql[128]; SQLLEN ind; const unsigned int buf_size = 128; char *buf = (char *) malloc(buf_size); sprintf(sql, "SELECT '%s'", data); odbc_command(sql); SQLFetch(odbc_stmt); CHKGetData(1, c_type, buf, buf_size, &ind, "E"); free(buf); odbc_read_error(); if (strcmp(odbc_sqlstate, state) != 0) { fprintf(stderr, "Unexpected sql state returned\n"); odbc_disconnect(); exit(1); } odbc_reset_statement(); } static int lc; static int type; static int mycmp(const char *s1, const char *s2) { SQLWCHAR buf[128], *wp; unsigned l; if (type == SQL_C_CHAR) return strcmp(s1, s2); l = strlen(s2); assert(l < TDS_VECTOR_SIZE(buf)); wp = buf; do { *wp++ = *s2; } while (*s2++); return memcmp(s1, buf, l * lc + lc); } static void test_split(const char *n_flag) { #define CheckLen(x) do { \ if (len != (x)) { \ fprintf(stderr, "Wrong len %ld at line %d expected %d\n", (long int) len, __LINE__, (x)); \ exit(1); \ } \ } while(0) char *sql; char *buf = NULL; const char *collate = ""; SQLLEN len; /* TODO test with VARCHAR too */ if (odbc_db_is_microsoft()) collate = " COLLATE Latin1_General_CI_AS"; sql = odbc_buf_asprintf(&odbc_buf, "SELECT CONVERT(%sTEXT,'Prova'%s + REPLICATE('x',500))%s", n_flag, collate, collate); odbc_command(sql); CHKFetch("S"); /* these 2 tests test an old severe BUG in FreeTDS */ buf = (char *) ODBC_GET(1); CHKGetData(1, type, buf, 0, &len, "I"); if (len != SQL_NO_TOTAL) CheckLen(505*lc); CHKGetData(1, type, buf, 0, &len, "I"); if (len != SQL_NO_TOTAL) CheckLen(505*lc); buf = (char *) ODBC_GET(3*lc); CHKGetData(1, type, buf, 3 * lc, &len, "I"); if (len != SQL_NO_TOTAL) CheckLen(505*lc); if (mycmp(buf, "Pr") != 0) { printf("Wrong data result 1\n"); exit(1); } buf = (char *) ODBC_GET(16*lc); CHKGetData(1, type, buf, 16 * lc, &len, "I"); if (len != SQL_NO_TOTAL) CheckLen(503*lc); if (mycmp(buf, "ovaxxxxxxxxxxxx") != 0) { printf("Wrong data result 2 res = '%s'\n", buf); exit(1); } buf = (char *) ODBC_GET(256*lc); CHKGetData(1, type, buf, 256 * lc, &len, "I"); if (len != SQL_NO_TOTAL) CheckLen(488*lc); CHKGetData(1, type, buf, 256 * lc, &len, "S"); CheckLen(233*lc); CHKGetData(1, type, buf, 256 * lc, &len, "No"); odbc_reset_statement(); /* test with varchar, not blob but variable */ sql = odbc_buf_asprintf(&odbc_buf, "SELECT CONVERT(%sVARCHAR(100), 'Other test')", n_flag); odbc_command(sql); CHKFetch("S"); buf = (char *) ODBC_GET(7*lc); CHKGetData(1, type, buf, 7 * lc, NULL, "I"); if (mycmp(buf, "Other ") != 0) { printf("Wrong data result 1\n"); exit(1); } buf = (char *) ODBC_GET(5*lc); CHKGetData(1, type, buf, 20, NULL, "S"); if (mycmp(buf, "test") != 0) { printf("Wrong data result 2 res = '%s'\n", buf); exit(1); } ODBC_FREE(); odbc_reset_statement(); } int main(int argc, char *argv[]) { char buf[32]; SQLINTEGER int_buf; SQLLEN len; SQLRETURN rc; TIMESTAMP_STRUCT tss; odbc_connect(); lc = 1; type = SQL_C_CHAR; test_split(""); lc = sizeof(SQLWCHAR); type = SQL_C_WCHAR; test_split(""); if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x07000000u) { lc = 1; type = SQL_C_CHAR; test_split("N"); lc = sizeof(SQLWCHAR); type = SQL_C_WCHAR; test_split("N"); } /* test with fixed length */ odbc_command("SELECT CONVERT(INT, 12345)"); CHKFetch("S"); int_buf = 0xdeadbeef; CHKGetData(1, SQL_C_SLONG, &int_buf, 0, NULL, "S"); if (int_buf != 12345) { printf("Wrong data result\n"); exit(1); } CHKGetData(1, SQL_C_SLONG, &int_buf, 0, NULL, "No"); if (int_buf != 12345) { printf("Wrong data result 2 res = %d\n", (int) int_buf); exit(1); } odbc_reset_statement(); /* test with numeric */ odbc_command("SELECT CONVERT(NUMERIC(18,5), 1850000000000)"); CHKFetch("S"); memset(buf, 'x', sizeof(buf)); CHKGetData(1, SQL_C_CHAR, buf, 14, NULL, "S"); buf[sizeof(buf)-1] = 0; if (strcmp(buf, "1850000000000") != 0) { printf("Wrong data result: %s\n", buf); exit(1); } /* should give NO DATA */ CHKGetData(1, SQL_C_CHAR, buf, 14, NULL, "No"); buf[sizeof(buf)-1] = 0; if (strcmp(buf, "1850000000000") != 0) { printf("Wrong data result 3 res = %s\n", buf); exit(1); } odbc_reset_statement(); /* test int to truncated string */ odbc_command("SELECT CONVERT(INTEGER, 12345)"); CHKFetch("S"); /* error 22003 */ memset(buf, 'x', sizeof(buf)); CHKGetData(1, SQL_C_CHAR, buf, 4, NULL, "E"); #ifdef ENABLE_DEVELOPING buf[4] = 0; if (strcmp(buf, "xxxx") != 0) { fprintf(stderr, "Wrong buffer result buf = %s\n", buf); exit(1); } #endif odbc_read_error(); if (strcmp(odbc_sqlstate, "22003") != 0) { fprintf(stderr, "Unexpected sql state %s returned\n", odbc_sqlstate); odbc_disconnect(); exit(1); } CHKGetData(1, SQL_C_CHAR, buf, 2, NULL, "No"); odbc_reset_statement(); /* test unique identifier to truncated string */ rc = odbc_command2("SELECT CONVERT(UNIQUEIDENTIFIER, 'AA7DF450-F119-11CD-8465-00AA00425D90')", "SENo"); if (rc != SQL_ERROR) { CHKFetch("S"); /* error 22003 */ CHKGetData(1, SQL_C_CHAR, buf, 17, NULL, "E"); odbc_read_error(); if (strcmp(odbc_sqlstate, "22003") != 0) { fprintf(stderr, "Unexpected sql state %s returned\n", odbc_sqlstate); odbc_disconnect(); exit(1); } CHKGetData(1, SQL_C_CHAR, buf, 2, NULL, "No"); } odbc_reset_statement(); odbc_disconnect(); odbc_use_version3 = 1; odbc_connect(); /* test error from SQLGetData */ /* wrong constant, SQL_VARCHAR is invalid as C type */ test_err("prova 123", SQL_VARCHAR, "HY003"); /* use ARD but no ARD data column */ test_err("prova 123", SQL_ARD_TYPE, "07009"); /* wrong conversion, int */ test_err("prova 123", SQL_C_LONG, "22018"); /* wrong conversion, date */ test_err("prova 123", SQL_C_TIMESTAMP, "22018"); /* overflow */ test_err("1234567890123456789", SQL_C_LONG, "22003"); /* test datetime precision */ odbc_command("SELECT CONVERT(DATETIME, '2018-08-15 12:34:56.007')"); CHKFetch("S"); memset(&tss, 'x', sizeof(tss)); CHKGetData(1, SQL_C_TYPE_TIMESTAMP, &tss, sizeof(tss), NULL, "S"); if (tss.fraction != 7000000) { printf("Wrong data result: %lu\n", (unsigned long) tss.fraction); exit(1); } odbc_reset_statement(); /* test for empty string from mssql */ if (odbc_db_is_microsoft()) { lc = 1; type = SQL_C_CHAR; for (;;) { void *buf = ODBC_GET(lc); odbc_command("SELECT CONVERT(TEXT,'' COLLATE Latin1_General_CI_AS)"); CHKFetch("S"); len = 1234; CHKGetData(1, type, buf, lc, &len, "S"); if (len != 0) { fprintf(stderr, "Wrong len returned, returned %ld\n", (long) len); return 1; } CHKGetData(1, type, buf, lc, NULL, "No"); odbc_reset_statement(); ODBC_FREE(); buf = ODBC_GET(4096*lc); odbc_command("SELECT CONVERT(TEXT,'' COLLATE Latin1_General_CI_AS)"); CHKFetch("S"); len = 1234; CHKGetData(1, type, buf, lc*4096, &len, "S"); if (len != 0) { fprintf(stderr, "Wrong len returned, returned %ld\n", (long) len); return 1; } CHKGetData(1, type, buf, lc*4096, NULL, "No"); odbc_reset_statement(); ODBC_FREE(); if (type != SQL_C_CHAR) break; lc = sizeof(SQLWCHAR); type = SQL_C_WCHAR; } odbc_command("SELECT CONVERT(TEXT,'' COLLATE Latin1_General_CI_AS)"); CHKFetch("S"); len = 1234; CHKGetData(1, SQL_C_BINARY, buf, 1, &len, "S"); if (len != 0) { fprintf(stderr, "Wrong len returned, returned %ld\n", (long) len); return 1; } CHKGetData(1, SQL_C_BINARY, buf, 1, NULL, "No"); } odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/hidden.c000644 025423 025423 00000002273 14056414222 021746 0ustar00fredianofrediano000000 000000 /* Testing result column numbers having hidden columns */ /* Test from Sebastien Flaesch */ #include "common.h" int main(int argc, char **argv) { SQLSMALLINT cnt = 0; int failed = 0; odbc_use_version3 = 1; odbc_connect(); odbc_command("CREATE TABLE #t1 ( k INT, c CHAR(10), vc VARCHAR(10) )"); odbc_command("CREATE TABLE #tmp1 (i NUMERIC(10,0) IDENTITY PRIMARY KEY, b VARCHAR(20) NULL, c INT NOT NULL)"); /* test hidden column with FOR BROWSE */ odbc_reset_statement(); odbc_command("SELECT c, b FROM #tmp1"); CHKNumResultCols(&cnt, "S"); if (cnt != 2) { fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); failed = 1; } odbc_reset_statement(); /* test hidden column with cursors*/ odbc_check_cursor(); CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER, "S"); CHKPrepare(T("SELECT * FROM #t1"), SQL_NTS, "S"); CHKExecute("S"); CHKNumResultCols(&cnt, "S"); if (cnt != 3) { fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); failed = 1; } odbc_disconnect(); return failed ? 1: 0; } freetds-1.3.6/src/odbc/unittests/insert_speed.c000644 025423 025423 00000004042 14056414222 023173 0ustar00fredianofrediano000000 000000 #include "common.h" #include static char software_version[] = "$Id: insert_speed.c,v 1.10 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define SQL_QUERY_LENGTH 80 /* test correctly inserted data after insert */ /* I don't remember where this test came ... - freddy77 */ static void insert_test_auto(void) { SQLLEN sql_nts = SQL_NTS; SQLINTEGER id = 0; char string[64]; odbc_reset_statement(); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, sizeof(id), 0, &id, 0, &sql_nts, "SI"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(string), 0, string, 0, &sql_nts, "SI"); CHKPrepare(T("insert into test values (?, ?)"), SQL_NTS, "SI"); for (id = 0; id < 20; id++) { sprintf(string, "This is a test (%d)", (int) id); CHKExecute("SI"); } odbc_reset_statement(); } static void insert_test_man(void) { SQLLEN sql_nts = SQL_NTS; SQLINTEGER commit_off = SQL_AUTOCOMMIT_OFF; SQLINTEGER commit_on = SQL_AUTOCOMMIT_ON; SQLINTEGER id = 0; char string[64]; CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, TDS_INT2PTR(commit_off), SQL_IS_INTEGER, "SI"); odbc_reset_statement(); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, sizeof(id), 0, &id, 0, &sql_nts, "SI"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(string), 0, string, 0, &sql_nts, "SI"); CHKPrepare(T("insert into test values (?, ?)"), SQL_NTS, "SI"); for (id = 0; id < 20; id++) { sprintf(string, "This is a test (%d)", (int) id); CHKExecute("SI"); } SQLEndTran(SQL_HANDLE_DBC, odbc_conn, SQL_COMMIT); SQLSetConnectAttr(odbc_conn, SQL_ATTR_AUTOCOMMIT, TDS_INT2PTR(commit_on), SQL_IS_INTEGER); odbc_reset_statement(); } int main(int argc, char **argv) { odbc_connect(); odbc_command_with_result(odbc_stmt, "DROP TABLE test"); odbc_command("CREATE TABLE test(i int, c varchar(40))"); insert_test_man(); odbc_command("DELETE FROM test"); insert_test_auto(); odbc_command("DROP TABLE test"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/lang_error.c000644 025423 025423 00000000753 14056414222 022646 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test if SQLExecDirect return error if a error in row is returned */ static char software_version[] = "$Id: lang_error.c,v 1.6 2010-07-05 09:20:33 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char *argv[]) { odbc_connect(); /* issue print statement and test message returned */ odbc_command2("SELECT DATEADD(dd,-100000,getdate())", "E"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/mars1.c000644 025423 025423 00000005625 14056414271 021546 0ustar00fredianofrediano000000 000000 #include "common.h" /* first MARS test, test 2 concurrent recordset */ #define SET_STMT(n) do { \ if (pcur_stmt != &n) { \ if (pcur_stmt) *pcur_stmt = odbc_stmt; \ pcur_stmt = &n; \ odbc_stmt = *pcur_stmt; \ } \ } while(0) static void AutoCommit(int onoff) { CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, TDS_INT2PTR(onoff), 0, "S"); } static void EndTransaction(SQLSMALLINT type) { CHKEndTran(SQL_HANDLE_DBC, odbc_conn, type, "S"); } static void my_attrs(void) { SQLSetConnectAttr(odbc_conn, 1224 /*SQL_COPT_SS_MARS_ENABLED*/, (SQLPOINTER) 1 /*SQL_MARS_ENABLED_YES*/, SQL_IS_UINTEGER); } int main(int argc, char *argv[]) { SQLINTEGER len, out; int i; SQLHSTMT stmt1, stmt2; SQLHSTMT *pcur_stmt = NULL; odbc_use_version3 = 1; odbc_set_conn_attr = my_attrs; odbc_connect(); stmt1 = odbc_stmt; out = 0; len = sizeof(out); CHKGetConnectAttr(1224, (SQLPOINTER) &out, sizeof(out), &len, "SE"); /* test we really support MARS on this connection */ /* TODO should out be correct ?? */ printf("Following row can contain an error due to MARS detection (is expected)\n"); if (!out || odbc_command2("BEGIN TRANSACTION", "SNoE") != SQL_ERROR) { printf("MARS not supported for this connection\n"); odbc_disconnect(); odbc_test_skipped(); return 0; } odbc_read_error(); if (!strstr(odbc_err, "MARS")) { fprintf(stderr, "Error message invalid \"%s\"\n", odbc_err); return 1; } /* create a test table with some data */ odbc_command("create table #mars1 (n int, v varchar(100))"); for (i = 0; i < 60; ++i) { char cmd[120], buf[80]; memset(buf, 'a' + (i % 26), sizeof(buf)); buf[i * 7 % 73] = 0; sprintf(cmd, "insert into #mars1 values(%d, '%s')", i, buf); odbc_command(cmd); } /* and another to avid locking problems */ odbc_command("create table #mars2 (n int, v varchar(100))"); AutoCommit(SQL_AUTOCOMMIT_OFF); /* try to do a select which return a lot of data (to test server didn't cache everything) */ odbc_command("select a.n, b.n, a.v from #mars1 a, #mars1 b order by a.n, b.n"); CHKFetch("S"); /* try to do other commands */ CHKAllocStmt(&stmt2, "S"); SET_STMT(stmt2); odbc_command("insert into #mars2 values(1, 'foo')"); SET_STMT(stmt1); CHKFetch("S"); /* reset statements */ odbc_reset_statement(); SET_STMT(stmt2); odbc_reset_statement(); /* now to 2 select with prepare/execute */ CHKPrepare(T("select a.n, b.n, a.v from #mars1 a, #mars1 b order by a.n, b.n"), SQL_NTS, "S"); SET_STMT(stmt1); CHKPrepare(T("select a.n, b.n, a.v from #mars1 a, #mars1 b order by a.n desc, b.n"), SQL_NTS, "S"); SET_STMT(stmt2); CHKExecute("S"); SET_STMT(stmt1); CHKExecute("S"); SET_STMT(stmt2); CHKFetch("S"); SET_STMT(stmt1); CHKFetch("S"); SET_STMT(stmt2); CHKFetch("S"); odbc_reset_statement(); SET_STMT(stmt1); CHKFetch("S"); odbc_reset_statement(); EndTransaction(SQL_COMMIT); /* TODO test receiving large data should not take much memory */ odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/long_error.c000644 025423 025423 00000004640 14056414222 022663 0ustar00fredianofrediano000000 000000 #include "common.h" /* Demonstration of triggered assert when invoking this stored procedure using FreeTDS odbc driver: create procedure proc_longerror as begin raiserror('reallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylongreallylong error', 16, 1) end */ static void extract_error(SQLHANDLE handle, SQLSMALLINT type); int main(void) { int i; char cmd[128 + 110*10]; printf("SQLWCHAR size is: %d\n", (int) sizeof(SQLWCHAR)); odbc_use_version3 = 1; odbc_connect(); /* this test do not work with Sybase */ if (!odbc_db_is_microsoft()) { odbc_disconnect(); return 0; } strcpy(cmd, "create procedure #proc_longerror as\nbegin\nraiserror('"); for (i = 0; i < 110; ++i) strcat(cmd, "reallylong"); strcat(cmd, " error', 16, 1)\nend\n"); odbc_command(cmd); CHKExecDirect(T("{CALL #proc_longerror}"), SQL_NTS, "E"); extract_error(odbc_stmt, SQL_HANDLE_STMT); odbc_disconnect(); return 0; } static void extract_error(SQLHANDLE handle, SQLSMALLINT type) { SQLINTEGER i = 0; SQLINTEGER native; SQLTCHAR state[7]; SQLTCHAR text[256]; SQLSMALLINT len; SQLRETURN ret; fprintf(stderr, "\n" "The driver reported the following diagnostics\n"); do { ret = CHKGetDiagRec(type, handle, ++i, state, &native, text, 256, &len, "SINo"); state[5] = 0; if (SQL_SUCCEEDED(ret)) printf("%s:%ld:%ld:%s\n", C(state), (long) i, (long) native, C(text)); } while (ret == SQL_SUCCESS); } freetds-1.3.6/src/odbc/unittests/moreandcount.c000644 025423 025423 00000004671 14056414222 023215 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for SQLMoreResults and SQLRowCount on batch */ static char software_version[] = "$Id: moreandcount.c,v 1.20 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void DoTest(int prepare) { int n = 0; static const char query[] = /* on prepared this recordset should be skipped */ "DECLARE @b INT SELECT @b = 25 " "SELECT * FROM #tmp1 WHERE i <= 3 " /* on prepare we cannot distinguish these recordset */ "INSERT INTO #tmp2 SELECT * FROM #tmp1 WHERE i = 1 " "INSERT INTO #tmp2 SELECT * FROM #tmp1 WHERE i <= 3 " "SELECT * FROM #tmp1 WHERE i = 1 " /* but FreeTDS can detect last recordset */ "UPDATE #tmp1 SET i=i+1 WHERE i >= 2"; if (prepare) { CHKPrepare(T(query), SQL_NTS, "S"); CHKExecute("S"); } else { /* execute a batch command select insert insert select and check rows */ CHKExecDirect(T(query), SQL_NTS, "S"); } if (!prepare) { printf("Result %d\n", ++n); ODBC_CHECK_COLS(0); ODBC_CHECK_ROWS(1); CHKMoreResults("S"); } printf("Result %d\n", ++n); ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(-1); CHKFetch("S"); CHKFetch("S"); ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(-1); CHKFetch("No"); ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(2); CHKMoreResults("S"); if (!prepare) { printf("Result %d\n", ++n); ODBC_CHECK_COLS(0); ODBC_CHECK_ROWS(1); CHKMoreResults("S"); printf("Result %d\n", ++n); ODBC_CHECK_COLS(0); ODBC_CHECK_ROWS(2); CHKMoreResults("S"); } printf("Result %d\n", ++n); ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(-1); CHKFetch("S"); ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(-1); CHKFetch("No"); ODBC_CHECK_COLS(1); if (prepare) { /* collapse 2 recordset... after a lot of testing this is the behavior! */ if (odbc_driver_is_freetds()) ODBC_CHECK_ROWS(2); } else { ODBC_CHECK_ROWS(1); CHKMoreResults("S"); ODBC_CHECK_COLS(0); ODBC_CHECK_ROWS(2); } CHKMoreResults("No"); #ifndef TDS_NO_DM if (!prepare) ODBC_CHECK_COLS(-1); ODBC_CHECK_ROWS(-2); #endif ODBC_FREE(); } int main(int argc, char *argv[]) { odbc_connect(); odbc_command("create table #tmp1 (i int)"); odbc_command("create table #tmp2 (i int)"); odbc_command("insert into #tmp1 values(1)"); odbc_command("insert into #tmp1 values(2)"); odbc_command("insert into #tmp1 values(5)"); printf("Use direct statement\n"); DoTest(0); printf("Use prepared statement\n"); DoTest(1); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/moreresults.c000644 025423 025423 00000001434 14056414271 023101 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* Test for SQLMoreResults */ static void Test(bool use_indicator) { char buf[128]; SQLLEN ind; SQLLEN *pind = use_indicator ? &ind : NULL; strcpy(buf, "I don't exist"); ind = strlen(buf); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 20, 0, buf, 128, pind, "S"); CHKPrepare(T("SELECT id, name FROM master..sysobjects WHERE name = ?"), SQL_NTS, "S"); CHKExecute("S"); CHKFetch("No"); CHKMoreResults("No"); /* use same binding above */ strcpy(buf, "sysobjects"); ind = strlen(buf); CHKExecute("S"); CHKFetch("S"); CHKFetch("No"); CHKMoreResults("No"); ODBC_FREE(); } int main(int argc, char *argv[]) { odbc_connect(); Test(true); Test(false); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/norowset.c000644 025423 025423 00000002001 14056414222 022360 0ustar00fredianofrediano000000 000000 #include "common.h" static char software_version[] = "$Id: norowset.c,v 1.9 2010-07-05 09:20:33 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; /* Test that a select following a store procedure execution return results */ int main(int argc, char *argv[]) { char output[256]; SQLLEN dataSize; odbc_connect(); odbc_command_with_result(odbc_stmt, "drop proc sp_norowset_test"); odbc_command("create proc sp_norowset_test as begin declare @i int end"); odbc_command("exec sp_norowset_test"); /* note, mssql 2005 seems to not return row for tempdb, use always master */ odbc_command("select name from master..sysobjects where name = 'sysobjects'"); CHKFetch("S"); CHKGetData(1, SQL_C_CHAR, output, sizeof(output), &dataSize, "S"); if (strcmp(output, "sysobjects") != 0) { printf("Unexpected result\n"); exit(1); } CHKFetch("No"); CHKMoreResults("No"); odbc_command("drop proc sp_norowset_test"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/oldpwd.c000644 025423 025423 00000000552 14056414222 022002 0ustar00fredianofrediano000000 000000 #include "common.h" /* change password on server */ static void my_attrs(void) { SQLSetConnectAttr(odbc_conn, 1226 /*SQL_COPT_SS_OLDPWD */, (SQLPOINTER) odbc_password, SQL_NTS); strcpy(odbc_password, "testpwd$"); } int main(int argc, char *argv[]) { odbc_use_version3 = 1; odbc_set_conn_attr = my_attrs; odbc_connect(); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/paramcore.c000644 025423 025423 00000003256 14056414222 022466 0ustar00fredianofrediano000000 000000 #include "common.h" /* * Try to make core dump using SQLBindParameter */ static char software_version[] = "$Id: paramcore.c,v 1.9 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define SP_TEXT "{call sp_paramcore_test(?)}" #define OUTSTRING_LEN 20 int main(int argc, char *argv[]) { SQLLEN cb = SQL_NTS; odbc_use_version3 = 1; odbc_connect(); odbc_command_with_result(odbc_stmt, "drop proc sp_paramcore_test"); odbc_command("create proc sp_paramcore_test @s varchar(100) output as select @s = '12345'"); /* here we pass a NULL buffer for input SQL_NTS */ CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, OUTSTRING_LEN, 0, NULL, OUTSTRING_LEN, &cb, "S"); cb = SQL_NTS; CHKExecDirect(T(SP_TEXT), SQL_NTS, "E"); odbc_reset_statement(); /* here we pass a NULL buffer for input */ CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_VARCHAR, 18, 0, NULL, OUTSTRING_LEN, &cb, "S"); cb = 1; CHKExecDirect(T(SP_TEXT), SQL_NTS, "E"); odbc_reset_statement(); odbc_command("drop proc sp_paramcore_test"); odbc_command("create proc sp_paramcore_test @s numeric(10,2) output as select @s = 12345.6"); odbc_reset_statement(); #if 0 /* this fails even on native platforms */ /* here we pass a NULL buffer for output */ cb = sizeof(SQL_NUMERIC_STRUCT); SQLBindParameter(odbc_stmt, 1, SQL_PARAM_OUTPUT, SQL_C_NUMERIC, SQL_NUMERIC, 18, 0, NULL, OUTSTRING_LEN, &cb); odbc_read_error(); cb = 1; odbc_command_with_result(odbc_stmt, SP_TEXT); odbc_read_error(); odbc_reset_statement(); #endif odbc_command("drop proc sp_paramcore_test"); odbc_disconnect(); printf("Done successfully!\n"); return 0; } freetds-1.3.6/src/odbc/unittests/params.c000644 025423 025423 00000004610 14056414222 021773 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for store procedure and params */ /* Test from Tom Rogers */ static char software_version[] = "$Id: params.c,v 1.13 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; /* SP definition */ static const char sp_define[] = "CREATE PROCEDURE spTestProc\n" " @InParam int,\n" " @OutParam int OUTPUT,\n" " @OutString varchar(20) OUTPUT\n" "AS\n" " SELECT @OutParam = @InParam\n" " SELECT @OutString = 'This is cool!'\n" " IF @InParam < 10\n" " RETURN (0)\n" " ELSE\n" " RETURN (1)\n"; #define SP_TEXT "{?=call spTestProc(?,?,?)}" #define OUTSTRING_LEN 20 static int Test(int bind_before) { SQLSMALLINT ReturnCode = 0; SQLSMALLINT InParam = 5; SQLSMALLINT OutParam = 1; char OutString[OUTSTRING_LEN]; SQLLEN cbReturnCode = 0, cbInParam = 0, cbOutParam = 0; SQLLEN cbOutString = SQL_NTS; odbc_connect(); /* drop proc */ odbc_command("IF OBJECT_ID('spTestProc') IS NOT NULL DROP PROC spTestProc"); /* create proc */ odbc_command(sp_define); if (!bind_before) CHKPrepare(T(SP_TEXT), strlen(SP_TEXT), "S"); CHKBindParameter(1, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &ReturnCode, 0, &cbReturnCode, "S"); CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &InParam, 0, &cbInParam, "S"); CHKBindParameter(3, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &OutParam, 0, &cbOutParam, "S"); OutString[0] = '\0'; strcpy(OutString, "Test"); /* Comment this line and we get an error! Why? */ CHKBindParameter(4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, OUTSTRING_LEN, 0, OutString, OUTSTRING_LEN, &cbOutString, "S"); if (bind_before) CHKPrepare(T(SP_TEXT), strlen(SP_TEXT), "S"); CHKExecute("S"); odbc_command("DROP PROC spTestProc"); printf("Output:\n"); printf(" Return Code = %d\n", (int) ReturnCode); printf(" InParam = %d\n", (int) InParam); printf(" OutParam = %d\n", (int) OutParam); printf(" OutString = %s\n", OutString); if (InParam != OutParam) { fprintf(stderr, "InParam != OutParam\n"); return 1; } if (strcmp(OutString, "This is cool!") != 0) { fprintf(stderr, "Bad string returned\n"); return 1; } odbc_disconnect(); ODBC_FREE(); return 0; } int main(int argc, char *argv[]) { if (Test(0)) return 1; if (Test(1)) return 1; printf("Done successfully!\n"); return 0; } freetds-1.3.6/src/odbc/unittests/peter.c000644 025423 025423 00000002116 14056414271 021632 0ustar00fredianofrediano000000 000000 #undef NDEBUG #include "common.h" #include /* Test SQLNumResultCols after SQLFreeStmt This test on Sybase should not raise an error */ static char software_version[] = "$Id: peter.c,v 1.2 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char *argv[]) { SQLSMALLINT num_params, cols; SQLLEN count; SQLINTEGER id; odbc_use_version3 = 1; odbc_connect(); odbc_command("create table #tester (id int not null, name varchar(20) not null)"); odbc_command("insert into #tester(id, name) values(1, 'abc')"); odbc_command("insert into #tester(id, name) values(2, 'duck')"); CHKPrepare(T("SELECT * FROM #tester WHERE id = ?"), SQL_NTS, "S"); CHKR(SQLNumParams, (odbc_stmt, &num_params), "S"); assert(num_params == 1); id = 1; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &id, sizeof(id), NULL, "S"); CHKExecute("S"); CHKFreeStmt(SQL_RESET_PARAMS, "S"); CHKRowCount(&count, "S"); CHKNumResultCols(&cols, "S"); assert(cols == 2); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/prepare_results.c000644 025423 025423 00000007447 14056414222 023742 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for data format returned from SQLPrepare */ static char software_version[] = "$Id: prepare_results.c,v 1.15 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void Test(int use_ird) { SQLSMALLINT count, namelen, type, digits, nullable; SQLULEN size; SQLHDESC desc; SQLINTEGER ind; SQLTCHAR name[128]; char *cname = NULL; /* test query returns column information */ CHKPrepare(T("select * from #odbctestdata select * from #odbctestdata"), SQL_NTS, "S"); SQLNumParams(odbc_stmt, &count); if (count != 0) { fprintf(stderr, "Wrong number of params returned. Got %d expected 0\n", (int) count); exit(1); } if (use_ird) { /* get IRD */ CHKGetStmtAttr(SQL_ATTR_IMP_ROW_DESC, &desc, sizeof(desc), &ind, "S"); CHKR(SQLGetDescField, (desc, 0, SQL_DESC_COUNT, &count, sizeof(count), &ind), "S"); } else { CHKNumResultCols(&count, "S"); } if (count != 3) { fprintf(stderr, "Wrong number of columns returned. Got %d expected 3\n", (int) count); exit(1); } CHKDescribeCol(1, name, TDS_VECTOR_SIZE(name), &namelen, &type, &size, &digits, &nullable, "S"); cname = (char*) C(name); if (type != SQL_INTEGER || strcmp(cname, "i") != 0) { fprintf(stderr, "wrong column 1 informations (type %d name '%s' size %d)\n", (int) type, cname, (int) size); exit(1); } CHKDescribeCol(2, name, TDS_VECTOR_SIZE(name), &namelen, &type, &size, &digits, &nullable, "S"); cname = (char*) C(name); if (type != SQL_CHAR || strcmp(cname, "c") != 0 || (size != 20 && (odbc_db_is_microsoft() || size != 40))) { fprintf(stderr, "wrong column 2 informations (type %d name '%s' size %d)\n", (int) type, cname, (int) size); exit(1); } CHKDescribeCol(3, name, TDS_VECTOR_SIZE(name), &namelen, &type, &size, &digits, &nullable, "S"); cname = (char*) C(name); if (type != SQL_NUMERIC || strcmp(cname, "n") != 0 || size != 34 || digits != 12) { fprintf(stderr, "wrong column 3 informations (type %d name '%s' size %d)\n", (int) type, cname, (int) size); exit(1); } ODBC_FREE(); } int main(int argc, char *argv[]) { SQLSMALLINT count; odbc_connect(); odbc_command("create table #odbctestdata (i int, c char(20), n numeric(34,12) )"); /* reset state */ odbc_command("select * from #odbctestdata"); SQLFetch(odbc_stmt); SQLMoreResults(odbc_stmt); /* test query returns column information for select without param */ odbc_reset_statement(); CHKPrepare(T("select * from #odbctestdata"), SQL_NTS, "S"); count = -1; CHKNumResultCols(&count, "S"); if (count != 3) { fprintf(stderr, "Wrong number of columns returned. Got %d expected 3\n", (int) count); exit(1); } /* test query returns column information for select with param */ odbc_reset_statement(); CHKPrepare(T("select c,n from #odbctestdata where i=?"), SQL_NTS, "S"); count = -1; CHKNumResultCols(&count, "S"); if (count != 2) { fprintf(stderr, "Wrong number of columns returned. Got %d expected 2\n", (int) count); exit(1); } /* test query returns column information for update */ odbc_reset_statement(); CHKPrepare(T("update #odbctestdata set i = 20"), SQL_NTS, "S"); count = -1; CHKNumResultCols(&count, "S"); if (count != 0) { fprintf(stderr, "Wrong number of columns returned. Got %d expected 0\n", (int) count); exit(1); } if (odbc_driver_is_freetds()) { if (odbc_db_is_microsoft() && odbc_tds_version() >= 0x704) { odbc_disconnect(); putenv("TDSVER=7.3"); odbc_connect(); odbc_command("create table #odbctestdata (i int, c char(20), n numeric(34,12) )"); } if (!odbc_db_is_microsoft() || odbc_tds_version() < 0x704) { Test(0); odbc_reset_statement(); Test(1); } } /* TODO test SQLDescribeParam (when implemented) */ odbc_command("drop table #odbctestdata"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/prepare_warn.c000644 025423 025423 00000003313 14056414222 023174 0ustar00fredianofrediano000000 000000 /* * Author : sf@4js.com * FreeTDS version : 0.91RC2 (20110429) * Platform : Linux 32b (Debian Lenny) * Fetching when there is a NULL value in table gives invalid cursor state error. * Is this because of Warning SQLSTATE 01003? */ #include "common.h" int main(int argc, char **argv) { #define ARRAY_SIZE 10 SQLCHAR v_dec[ARRAY_SIZE][21]; SQLLEN v_ind[ARRAY_SIZE]; SQLULEN nrows; odbc_use_version3 = 1; odbc_connect(); odbc_check_cursor(); odbc_command("IF OBJECT_ID('mytab1') IS NOT NULL DROP TABLE mytab1"); odbc_command("CREATE TABLE mytab1 ( k INT, d DECIMAL(10,2))"); odbc_command("INSERT INTO mytab1 VALUES ( 201, 111.11 )"); /*SQLExecDirect(m_hstmt, (SQLCHAR *) "insert into mytab1 values ( 202, 222.22 )", SQL_NTS); */ odbc_command("INSERT INTO mytab1 VALUES ( 202, null )"); odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_BIND_TYPE, (SQLPOINTER) SQL_BIND_BY_COLUMN, SQL_IS_UINTEGER, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER) ARRAY_SIZE, SQL_IS_UINTEGER, "S"); CHKSetStmtAttr(SQL_ATTR_ROWS_FETCHED_PTR, (SQLPOINTER) & (nrows), SQL_IS_UINTEGER, "S"); CHKPrepare(T("SELECT SUM(d) FROM mytab1"), SQL_NTS, "S"); CHKExecute("I"); #if 0 CHKMoreResults("S"); /* skip warning*/ #endif CHKBindCol(1, SQL_C_CHAR, v_dec, 21, v_ind, "S"); CHKFetch("S"); printf("fetch 1: rows fetched = %d\n", (int) nrows); printf("fetch 1: value = [%s]\n", v_dec[0]); CHKFetch("No"); CHKMoreResults("No"); odbc_command("drop table mytab1"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/prepclose.c000644 025423 025423 00000003677 14056414222 022520 0ustar00fredianofrediano000000 000000 #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_SYS_WAIT_H #include #endif /* HAVE_SYS_WAIT_H */ #include /* * test error on connection close * With a trick we simulate a connection close then we try to * prepare or execute a query. This should fail and return an error message. */ #ifdef _WIN32 #define SHUT_RDWR SD_BOTH #endif static int close_last_socket(void) { TDS_SYS_SOCKET max_socket = odbc_find_last_socket(); if (max_socket < 0) { fprintf(stderr, "Error finding last socket\n"); return 0; } /* close connection */ shutdown(max_socket, SHUT_RDWR); return 1; } static int Test(int direct, int long_query) { SQLTCHAR buf[256]; SQLTCHAR sqlstate[6]; char sql[5100]; odbc_mark_sockets_opened(); odbc_connect(); if (!close_last_socket()) { fprintf(stderr, "Error closing connection\n"); return 1; } if (long_query) { memset(sql, '-', sizeof(sql)); strcpy(sql + 5000, "\nSELECT 1"); } else { strcpy(sql, "SELECT 1"); } /* force disconnection closing socket */ if (direct) { CHKExecDirect(T(sql), SQL_NTS, "E"); } else { SQLSMALLINT cols; /* use prepare, force dialog with server */ if (CHKPrepare(T(sql), SQL_NTS, "SE") == SQL_SUCCESS) CHKNumResultCols(&cols, "E"); } CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, buf, TDS_VECTOR_SIZE(buf), NULL, "SI"); sqlstate[5] = 0; printf("state=%s err=%s\n", C(sqlstate), C(buf)); odbc_disconnect(); printf("Done.\n"); return 0; } int main(void) { /* check with short queries */ if (Test(0, 0) || Test(1, 0)) return 1; /* check with large queries, this will trigger different paths */ if (Test(0, 1) || Test(1, 1)) return 1; return 0; } freetds-1.3.6/src/odbc/unittests/preperror.c000644 025423 025423 00000002676 14056414222 022542 0ustar00fredianofrediano000000 000000 #include "common.h" /* test error on prepared statement, from Nathaniel Talbott test */ static char software_version[] = "$Id: preperror.c,v 1.10 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char *argv[]) { SQLLEN cbInString = SQL_NTS; char buf[256]; SQLTCHAR msg[256]; SQLTCHAR sqlstate[6]; odbc_connect(); odbc_command("CREATE TABLE #urls ( recdate DATETIME ) "); /* test implicit conversion error */ CHKExecDirect(T("INSERT INTO #urls ( recdate ) VALUES ( '2003-10-1 10:11:1 0' )"), SQL_NTS, "E"); /* test prepared implicit conversion error */ CHKPrepare(T("INSERT INTO #urls ( recdate ) VALUES ( ? )"), SQL_NTS, "SI"); strcpy(buf, "2003-10-1 10:11:1 0"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 128, 0, buf, sizeof(buf), &cbInString, "SI"); CHKExecute("E"); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(buf), NULL, "SI"); printf("err=%s\n", C(msg)); /* assure initial state */ odbc_reset_statement(); /* try to prepare and execute a statement with error (from DBD::ODBC test) */ if (CHKPrepare(T("SELECT XXNOTCOLUMN FROM sysobjects"), SQL_NTS, "SE") == SQL_SUCCESS) CHKExecute("E"); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, msg, TDS_VECTOR_SIZE(buf), NULL, "SI"); printf("err=%s\n", C(msg)); odbc_disconnect(); printf("Done.\n"); ODBC_FREE(); return 0; } freetds-1.3.6/src/odbc/unittests/print.c000644 025423 025423 00000003575 14056414222 021655 0ustar00fredianofrediano000000 000000 #include "common.h" static SQLCHAR output[256]; #ifdef TDS_NO_DM static const int tds_no_dm = 1; #else static const int tds_no_dm = 0; #endif static int test(int odbc3) { SQLLEN cnamesize; const char *query; odbc_use_version3 = odbc3; odbc_connect(); /* issue print statement and test message returned */ output[0] = 0; query = "print 'START' select count(*) from sysobjects where name='sysobjects' print 'END'"; odbc_command2(query, "I"); odbc_read_error(); if (!strstr(odbc_err, "START")) { printf("Message invalid\n"); return 1; } odbc_err[0] = 0; if (odbc3) { ODBC_CHECK_COLS(0); ODBC_CHECK_ROWS(-1); CHKFetch("E"); CHKMoreResults("S"); } ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(-1); CHKFetch("S"); ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(-1); /* check no data */ CHKFetch("No"); ODBC_CHECK_COLS(1); ODBC_CHECK_ROWS(1); /* SQLMoreResults return NO DATA or SUCCESS WITH INFO ... */ if (tds_no_dm && !odbc3) CHKMoreResults("No"); else if (odbc3) CHKMoreResults("I"); else CHKMoreResults("INo"); /* * ... but read error * (unixODBC till 2.2.11 do not read errors on NO DATA, skip test) */ if (tds_no_dm || odbc3) { odbc_read_error(); if (!strstr(odbc_err, "END")) { printf("Message invalid\n"); return 1; } odbc_err[0] = 0; } if (odbc3) { ODBC_CHECK_COLS(0); ODBC_CHECK_ROWS(-1); CHKMoreResults("No"); } /* issue invalid command and test error */ odbc_command2("SELECT donotexistsfield FROM donotexiststable", "E"); odbc_read_error(); /* test no data returned */ CHKFetch("E"); odbc_read_error(); CHKGetData(1, SQL_C_CHAR, output, sizeof(output), &cnamesize, "E"); odbc_read_error(); odbc_disconnect(); return 0; } int main(int argc, char *argv[]) { int ret; /* ODBC 2 */ ret = test(0); if (ret != 0) return ret; /* ODBC 3 */ ret = test(1); if (ret != 0) return ret; printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/putdata.c000644 025423 025423 00000012455 14056414222 022160 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for SQLPutData */ static const char test_text[] = "Nel mezzo del cammin di nostra vita\n" "mi ritrovai per una selva oscura\n" "che' la diritta via era smarrita."; #define BYTE_AT(n) (((n) * 245 + 123) & 0xff) static int to_sqlwchar(SQLWCHAR *dst, const char *src, int n) { int i; for (i = 0; i < n; ++i) dst[i] = src[i]; return n * sizeof(SQLWCHAR); } static char sql[1024]; static void Test(int direct) { SQLLEN ind; int len = strlen(test_text), n, i; const char *p; char *pp; SQLPOINTER ptr; unsigned char buf[256], *pb; SQLRETURN RetCode; int type, lc, sql_type; /* create table to hold data */ odbc_command_with_result(odbc_stmt, "DROP TABLE #putdata"); odbc_command("CREATE TABLE #putdata (c TEXT NULL, b IMAGE NULL)"); sql_type = SQL_LONGVARCHAR; type = SQL_C_CHAR; lc = 1; for (;;) { CHKBindParameter(1, SQL_PARAM_INPUT, type, sql_type, 0, 0, (SQLPOINTER) 123, 0, &ind, "S"); /* length required */ ind = SQL_LEN_DATA_AT_EXEC(len * lc); /* * test for char */ if (!direct) { CHKPrepare(T("INSERT INTO #putdata(c) VALUES(?)"), SQL_NTS, "S"); CHKExecute("Ne"); } else { CHKExecDirect(T("INSERT INTO #putdata(c) VALUES(?)"), SQL_NTS, "Ne"); } p = test_text; n = 5; ptr = ((char*)0) + 0xdeadbeef; CHKParamData(&ptr, "Ne"); if (ptr != (SQLPOINTER) 123) { fprintf(stderr, "%p\n", ptr); ODBC_REPORT_ERROR("Wrong pointer from SQLParamData"); } while (*p) { int l = strlen(p); if (l < n) n = l; if (type == SQL_C_CHAR) { CHKPutData((char *) p, n, "S"); } else { SQLWCHAR buf[256]; CHKPutData((char *) buf, to_sqlwchar(buf, p, n), "S"); } p += n; n *= 2; } CHKParamData(&ptr, "S"); CHKParamData(&ptr, "E"); /* check state and reset some possible buffers */ odbc_command("DECLARE @i INT"); /* use server ntext if available */ if (sql_type == SQL_LONGVARCHAR && odbc_db_is_microsoft() && odbc_db_version_int() >= 0x08000000u) { sql_type = SQL_WLONGVARCHAR; continue; } if (type != SQL_C_CHAR) break; sql_type = SQL_LONGVARCHAR; type = SQL_C_WCHAR; lc = sizeof(SQLWCHAR); } /* update row setting binary field */ for (i = 0; i < 255; ++i) buf[i] = BYTE_AT(i); /* * test for binary */ CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, 0, 0, (SQLPOINTER) 4567, 0, &ind, "S"); ind = SQL_LEN_DATA_AT_EXEC(254); CHKPrepare(T("UPDATE #putdata SET b = ?"), SQL_NTS, "S"); CHKExecute("Ne"); pb = buf; n = 7; CHKParamData(&ptr, "Ne"); if (ptr != (SQLPOINTER) 4567) ODBC_REPORT_ERROR("Wrong pointer from SQLParamData"); while (pb != (buf + 254)) { int l = buf + 254 - pb; if (l < n) n = l; CHKPutData((char *) pb, n, "S"); pb += n; n *= 2; } CHKParamData(&ptr, "S"); CHKParamData(&ptr, "E"); /* check state and reset some possible buffers */ odbc_command("DECLARE @i2 INT"); CHKFreeStmt(SQL_RESET_PARAMS, "S"); /* check inserts ... there should be all equal rows */ strcpy(sql, "IF EXISTS(SELECT * FROM #putdata WHERE CONVERT(VARBINARY(255),b) <> 0x"); /* append binary */ for (i = 0; i < 254; ++i) sprintf(strchr(sql, 0), "%02x", buf[i]); strcat(sql, " OR CONVERT(VARCHAR(255),c) <> '"); /* append string */ pp = strchr(sql, 0); p = test_text; do { *pp++ = *p; if (*p == '\'') *pp++ = *p; } while(*p++); strcat(sql, "') SELECT 1"); odbc_check_no_row(sql); odbc_command("DELETE FROM #putdata"); /* test len == 0 case from ML */ type = SQL_C_CHAR; for (;;) { if (!direct) CHKPrepare(T("INSERT INTO #putdata(c) VALUES(?)"), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, type, SQL_LONGVARCHAR, 0, 0, (PTR) 2, 0, &ind, "S"); ind = SQL_LEN_DATA_AT_EXEC(0); if (!direct) CHKExecute("Ne"); else CHKExecDirect(T("INSERT INTO #putdata(c) VALUES(?)"), SQL_NTS, "Ne"); RetCode = SQL_NEED_DATA; while (RetCode == SQL_NEED_DATA) { RetCode = SQLParamData(odbc_stmt, &ptr); if (RetCode == SQL_NEED_DATA) { if (type == SQL_C_CHAR) { CHKPutData("abc", 3, "S"); } else { SQLWCHAR buf[10]; CHKPutData(buf, to_sqlwchar(buf, "abc", 3), "S"); } } } if (type != SQL_C_CHAR) break; type = SQL_C_WCHAR; odbc_reset_statement(); } /* check inserts ... */ odbc_check_no_row("IF EXISTS(SELECT * FROM #putdata WHERE c NOT LIKE 'abc') SELECT 1"); odbc_command("DELETE FROM #putdata"); /* test putting 0 bytes from Sebastien Flaesch */ if (odbc_db_is_microsoft()) { type = SQL_C_CHAR; for (;;) { if (!direct) CHKPrepare(T("INSERT INTO #putdata(c) VALUES(?)"), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, type, SQL_LONGVARCHAR, 10, 0, (PTR) 2, 10, &ind, "S"); ind = SQL_DATA_AT_EXEC; if (!direct) CHKExecute("Ne"); else CHKExecDirect(T("INSERT INTO #putdata(c) VALUES(?)"), SQL_NTS, "Ne"); RetCode = SQL_NEED_DATA; while (RetCode == SQL_NEED_DATA) { RetCode = SQLParamData(odbc_stmt, &ptr); if (RetCode == SQL_NEED_DATA) CHKPutData("", 0, "S"); } if (type != SQL_C_CHAR) break; type = SQL_C_WCHAR; odbc_reset_statement(); } /* check inserts ... */ odbc_check_no_row("IF EXISTS(SELECT * FROM #putdata WHERE c NOT LIKE '') SELECT 1"); } /* TODO test cancel inside SQLExecute */ } int main(int argc, char *argv[]) { odbc_connect(); Test(0); Test(1); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/qn.c000644 025423 025423 00000007062 14056414271 021136 0ustar00fredianofrediano000000 000000 #include "common.h" #include #include "odbcss.h" #include #include /* test query notifications */ #define SWAP(t,a,b) do { t xyz = a; a = b; b = xyz; } while(0) #define SWAP_CONN() do { SWAP(HENV,env,odbc_env); SWAP(HDBC,dbc,odbc_conn); SWAP(HSTMT,stmt,odbc_stmt);} while(0) static HENV env = SQL_NULL_HENV; static HDBC dbc = SQL_NULL_HDBC; static HSTMT stmt = SQL_NULL_HSTMT; static TDS_THREAD_PROC_DECLARE(change_thread_proc, arg) { SQLHSTMT odbc_stmt = stmt; odbc_command("UPDATE ftds_test SET v = 'hi!'"); CHKMoreResults("No"); CHKMoreResults("SNo"); return TDS_THREAD_RESULT(0); } int main(int argc, char *argv[]) { char *sql = NULL; tds_thread th; SQLSMALLINT cols, col; char message[1024]; odbc_use_version3 = 1; odbc_connect(); if (!odbc_db_is_microsoft() || odbc_tds_version() < 0x702) { odbc_disconnect(); printf("Query notifications available only using TDS 7.2 or newer\n"); odbc_test_skipped(); return 0; } sql = odbc_buf_asprintf(&odbc_buf, "ALTER DATABASE %s SET ENABLE_BROKER", odbc_database); odbc_command(sql); odbc_command2("DROP SERVICE FTDS_Service", "SENo"); odbc_command2("DROP QUEUE FTDS_Queue", "SENo"); odbc_command2("DROP TABLE ftds_test", "SENo"); odbc_command("CREATE TABLE ftds_test(i int PRIMARY KEY, v varchar(100))"); odbc_command("INSERT INTO ftds_test VALUES(1, 'hello')"); odbc_command("CREATE QUEUE FTDS_Queue\n" "CREATE SERVICE FTDS_Service ON QUEUE FTDS_Queue\n" "([http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification]);"); /* clear queue */ for (;;) { odbc_command("RECEIVE * FROM FTDS_Queue"); if (CHKFetch("SNo") == SQL_NO_DATA) break; CHKMoreResults("SNo"); CHKMoreResults("SNo"); } odbc_reset_statement(); /* connect another time for thread */ SWAP_CONN(); odbc_connect(); SWAP_CONN(); sql = odbc_buf_asprintf(&odbc_buf, "service=FTDS_Service;local database=%s", odbc_database); CHKSetStmtAttr(SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS, T(sql), SQL_NTS, "S"); CHKSetStmtAttr(SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT, T("Table has changed"), SQL_NTS, "S"); CHKSetStmtAttr(SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT, TDS_INT2PTR(60), SQL_IS_UINTEGER, "S"); odbc_command("SELECT v FROM dbo.ftds_test"); odbc_reset_statement(); /* launch another thread to update the table we are looking to */ assert(tds_thread_create(&th, change_thread_proc, NULL) == 0); odbc_command("WAITFOR (RECEIVE * FROM FTDS_Queue)"); memset(message, 0, sizeof(message)); CHKNumResultCols(&cols, "S"); while (CHKFetch("SNo") == SQL_SUCCESS) { for (col = 0; col < cols; ++col) { char buf[1024]; SQLLEN len; SQLTCHAR name[128]; SQLSMALLINT namelen, type, digits, nullable; SQLULEN size; CHKDescribeCol(col + 1, name, TDS_VECTOR_SIZE(name), &namelen, &type, &size, &digits, &nullable, "S"); if (col == 13) { CHKGetData(col + 1, SQL_C_BINARY, buf, sizeof(buf), &len, "S"); } else { CHKGetData(col + 1, SQL_C_CHAR, buf, sizeof(buf), &len, "S"); } if (col == 13) { int i; for (i = 2; i < len; i+= 2) buf[i / 2 - 1] = buf[i]; buf[len / 2 - 1] = 0; strcpy(message, buf); } printf("%s: %s\n", C(name), buf); } } tds_thread_join(th, NULL); SWAP_CONN(); odbc_disconnect(); SWAP_CONN(); /* cleanup */ odbc_command2("DROP SERVICE FTDS_Service", "SENo"); odbc_command2("DROP QUEUE FTDS_Queue", "SENo"); odbc_command2("DROP TABLE ftds_test", "SENo"); odbc_disconnect(); assert(strstr(message, "Table has changed") != NULL); assert(strstr(message, "info=\"update\"") != NULL); return 0; } freetds-1.3.6/src/odbc/unittests/raiserror.c000644 025423 025423 00000017214 14056414222 022524 0ustar00fredianofrediano000000 000000 #include "common.h" /* test RAISERROR in a store procedure, from Tom Rogers tests */ /* TODO add support for Sybase */ #define SP_TEXT "{?=call #tmp1(?,?,?)}" #define OUTSTRING_LEN 20 #define INVALID_RETURN (-12345) static const char create_proc[] = "CREATE PROCEDURE #tmp1\n" " @InParam int,\n" " @OutParam int OUTPUT,\n" " @OutString varchar(20) OUTPUT\n" "AS\n" "%s" " SET @OutParam = @InParam\n" " SET @OutString = 'This is bogus!'\n" " SELECT 'Here is the first row' AS FirstResult\n" " RAISERROR('An error occurred.', @InParam, 1)\n" "%s" " RETURN (0)"; static SQLSMALLINT ReturnCode; static char OutString[OUTSTRING_LEN]; static int g_nocount, g_second_select; #ifdef TDS_NO_DM static const int tds_no_dm = 1; #else static const int tds_no_dm = 0; #endif static void TestResult(SQLRETURN result0, int level, const char *func) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR SqlState[6]; SQLINTEGER NativeError; SQLTCHAR MessageText[1000]; SQLSMALLINT TextLength; SQLRETURN result = result0, rc; if (result == SQL_NO_DATA && strcmp(func, "SQLFetch") == 0) result = SQL_SUCCESS_WITH_INFO; if ((level <= 10 && result != SQL_SUCCESS_WITH_INFO) || (level > 10 && result != SQL_ERROR) || ReturnCode != INVALID_RETURN) { fprintf(stderr, "%s failed!\n", func); exit(1); } /* * unixODBC till 2.2.11 do not support getting error if SQL_NO_DATA */ if (!tds_no_dm && result0 == SQL_NO_DATA && strcmp(func, "SQLFetch") == 0) return; SqlState[0] = 0; MessageText[0] = 0; NativeError = 0; rc = CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, SqlState, &NativeError, MessageText, TDS_VECTOR_SIZE(MessageText), &TextLength, "SI"); printf("Func=%s Result=%d DIAG REC 1: State=%s Error=%d: %s\n", func, (int) rc, C(SqlState), (int) NativeError, C(MessageText)); if (strstr(C(MessageText), "An error occurred") == NULL) { fprintf(stderr, "Wrong error returned!\n"); fprintf(stderr, "Error returned: %s\n", C(MessageText)); exit(1); } ODBC_FREE(); } #define MY_ERROR(msg) odbc_report_error(msg, line, __FILE__) static void CheckData(const char *s, int line) { char buf[80]; SQLLEN ind; SQLRETURN rc; rc = CHKGetData(1, SQL_C_CHAR, buf, sizeof(buf), &ind, "SE"); if (rc == SQL_ERROR) { buf[0] = 0; ind = 0; } if (strlen(s) != ind || strcmp(buf, s) != 0) MY_ERROR("Invalid result"); } #define CheckData(s) CheckData(s, __LINE__) static void CheckReturnCode(SQLRETURN result, SQLSMALLINT expected, int line) { if (ReturnCode == expected && (expected != INVALID_RETURN || strcmp(OutString, "Invalid!") == 0) && (expected == INVALID_RETURN || strcmp(OutString, "This is bogus!") == 0)) return; printf("SpDateTest Output:\n"); printf(" Result = %d\n", (int) result); printf(" Return Code = %d\n", (int) ReturnCode); printf(" OutString = \"%s\"\n", OutString); MY_ERROR("Invalid ReturnCode"); } #define CheckReturnCode(res, exp) CheckReturnCode(res, exp, __LINE__) static void Test(int level) { SQLRETURN result; SQLSMALLINT InParam = level; SQLSMALLINT OutParam = 1; SQLLEN cbReturnCode = 0, cbInParam = 0, cbOutParam = 0; SQLLEN cbOutString = SQL_NTS; char sql[80]; printf("ODBC %d nocount %s select %s level %d\n", odbc_use_version3 ? 3 : 2, g_nocount ? "yes" : "no", g_second_select ? "yes" : "no", level); ReturnCode = INVALID_RETURN; memset(&OutString, 0, sizeof(OutString)); /* test with SQLExecDirect */ sprintf(sql, "RAISERROR('An error occurred.', %d, 1)", level); result = odbc_command_with_result(odbc_stmt, sql); TestResult(result, level, "SQLExecDirect"); /* test with SQLPrepare/SQLExecute */ if (!SQL_SUCCEEDED(SQLPrepare(odbc_stmt, T(SP_TEXT), strlen(SP_TEXT)))) { fprintf(stderr, "SQLPrepare failure!\n"); exit(1); } SQLBindParameter(odbc_stmt, 1, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &ReturnCode, 0, &cbReturnCode); SQLBindParameter(odbc_stmt, 2, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &InParam, 0, &cbInParam); SQLBindParameter(odbc_stmt, 3, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &OutParam, 0, &cbOutParam); strcpy(OutString, "Invalid!"); SQLBindParameter(odbc_stmt, 4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, OUTSTRING_LEN, 0, OutString, OUTSTRING_LEN, &cbOutString); CHKExecute("S"); /* first select, check data are returned. * SET statements before does not affect results */ CheckData(""); CHKFetch("S"); CheckData("Here is the first row"); result = SQLFetch(odbc_stmt); if (odbc_use_version3) { SQLTCHAR SqlState[6]; SQLINTEGER NativeError; SQLTCHAR MessageText[1000]; SQLSMALLINT TextLength; SQLRETURN expected; SQLLEN rows; if (result != SQL_NO_DATA) ODBC_REPORT_ERROR("SQLFetch should return NO DATA"); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, SqlState, &NativeError, MessageText, TDS_VECTOR_SIZE(MessageText), &TextLength, "No"); result = SQLMoreResults(odbc_stmt); expected = level > 10 ? SQL_ERROR : SQL_SUCCESS_WITH_INFO; if (result != expected) ODBC_REPORT_ERROR("SQLMoreResults returned unexpected result"); if (!g_second_select && g_nocount) { if (ReturnCode == INVALID_RETURN) { result = SQLMoreResults(odbc_stmt); } else { CheckReturnCode(result, 0); ReturnCode = INVALID_RETURN; TestResult(result, level, "SQLMoreResults"); ReturnCode = 0; } } else { TestResult(result, level, "SQLMoreResults"); } /* a recordset with only warnings/errors do not contains rows */ if (CHKRowCount(&rows, "SE") == SQL_SUCCESS && rows != -1) ODBC_REPORT_ERROR("SQLRowCount returned some rows"); } else { /* in ODBC 2 errors/warnings are not handled as different recordset */ TestResult(result, level, "SQLFetch"); } if (odbc_driver_is_freetds()) CheckData(""); if (!g_second_select) { SQLLEN rows; if (CHKRowCount(&rows, "SE") == SQL_SUCCESS && rows != -1) ODBC_REPORT_ERROR("SQLRowCount returned some rows"); CheckReturnCode(result, g_nocount ? 0 : INVALID_RETURN); result = SQLMoreResults(odbc_stmt); #ifdef ENABLE_DEVELOPING if (result != SQL_NO_DATA) ODBC_REPORT_ERROR("SQLMoreResults should return NO DATA"); ODBC_CHECK_ROWS(-2); #endif CheckReturnCode(result, 0); return; } if (!odbc_use_version3 || !g_nocount) { /* mssql 2008 return SUCCESS_WITH_INFO with previous error */ CHKMoreResults("S"); result = SQL_SUCCESS; } CheckReturnCode(result, INVALID_RETURN); CheckData(""); if (g_nocount && odbc_use_version3 && g_second_select && level >= 10) { if (CHKFetch("SE") == SQL_ERROR) { SQLMoreResults(odbc_stmt); CHKFetch("S"); } } else { CHKFetch("S"); } CheckData("Here is the last row"); CHKFetch("No"); CheckData(""); if (!odbc_use_version3 || g_nocount) CheckReturnCode(result, 0); #ifdef ENABLE_DEVELOPING else CheckReturnCode(result, INVALID_RETURN); #endif /* FIXME how to handle return in store procedure ?? */ result = SQLMoreResults(odbc_stmt); #ifdef ENABLE_DEVELOPING if (result != SQL_NO_DATA) ODBC_REPORT_ERROR("SQLMoreResults return other data"); #endif CheckReturnCode(result, 0); CheckData(""); ODBC_FREE(); } static void Test2(int nocount, int second_select) { char sql[512]; g_nocount = nocount; g_second_select = second_select; /* this test do not work with Sybase */ if (!odbc_db_is_microsoft()) return; sprintf(sql, create_proc, nocount ? " SET NOCOUNT ON\n" : "", second_select ? " SELECT 'Here is the last row' AS LastResult\n" : ""); odbc_command(sql); Test(5); Test(11); odbc_command("DROP PROC #tmp1"); } int main(int argc, char *argv[]) { odbc_connect(); Test2(0, 1); Test2(1, 1); odbc_disconnect(); odbc_use_version3 = 1; odbc_connect(); Test2(0, 1); Test2(1, 1); Test2(0, 0); Test2(1, 0); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/rebindpar.c000644 025423 025423 00000003366 14056414222 022465 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for executing SQLExecute and rebinding parameters */ static char software_version[] = "$Id: rebindpar.c,v 1.11 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define SWAP_STMT(b) do { SQLHSTMT xyz = odbc_stmt; odbc_stmt = b; b = xyz; } while(0) static HSTMT stmt; static void TestInsert(char *buf) { SQLLEN ind; int l = strlen(buf); char sql[200]; /* insert some data and test success */ CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, l, 0, buf, l, &ind, "S"); ind = l; CHKExecute("S"); SWAP_STMT(stmt); sprintf(sql, "SELECT 1 FROM #tmp1 WHERE c = '%s'", buf); odbc_command(sql); CHKFetch("S"); CHKFetch("No"); CHKMoreResults("No"); SWAP_STMT(stmt); } static void Test(int prebind) { ODBC_BUF *odbc_buf = NULL; SQLLEN ind; int i; char buf[100]; /* build a string longer than 80 character (80 it's the default) */ buf[0] = 0; for (i = 0; i < 21; ++i) strcat(buf, "miao"); odbc_command("DELETE FROM #tmp1"); CHKAllocStmt(&stmt, "S"); SWAP_STMT(stmt); if (prebind) CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 1, 0, buf, 1, &ind, "S"); CHKPrepare(T("INSERT INTO #tmp1(c) VALUES(?)"), SQL_NTS, "S"); /* try to insert an empty string, should not fail */ /* NOTE this is currently the only test for insert a empty string using rpc */ if (odbc_db_is_microsoft()) TestInsert(""); TestInsert("a"); TestInsert("bb"); TestInsert(buf); CHKFreeStmt(SQL_DROP, "S"); odbc_stmt = SQL_NULL_HSTMT; SWAP_STMT(stmt); ODBC_FREE(); } int main(int argc, char *argv[]) { odbc_connect(); odbc_command("CREATE TABLE #tmp1 (c VARCHAR(200))"); Test(1); Test(0); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/rowset.c000644 025423 025423 00000003762 14056414222 022042 0ustar00fredianofrediano000000 000000 #include "common.h" static char software_version[] = "$Id: rowset.c,v 1.8 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void test_err(int n) { CHKSetStmtAttr(SQL_ROWSET_SIZE, (SQLPOINTER) TDS_INT2PTR(n), 0, "E"); odbc_read_error(); if (strcmp(odbc_sqlstate, "HY024") != 0) { fprintf(stderr, "Unexpected sql state returned\n"); odbc_disconnect(); exit(1); } } int main(int argc, char *argv[]) { int i; SQLLEN len; #ifdef HAVE_SQLROWSETSIZE SQLROWSETSIZE row_count; #else SQLULEN row_count; #endif SQLUSMALLINT statuses[10]; char buf[32]; odbc_use_version3 = 1; odbc_connect(); /* initial value should be 1 */ CHKGetStmtAttr(SQL_ROWSET_SIZE, &len, sizeof(len), NULL, "S"); if (len != 1) { fprintf(stderr, "len should be 1\n"); odbc_disconnect(); return 1; } /* check invalid parameter values */ test_err(-123); test_err(-1); test_err(0); odbc_check_cursor(); /* set some correct values */ CHKSetStmtAttr(SQL_ROWSET_SIZE, (SQLPOINTER) TDS_INT2PTR(2), 0, "S"); CHKSetStmtAttr(SQL_ROWSET_SIZE, (SQLPOINTER) TDS_INT2PTR(1), 0, "S"); /* now check that SQLExtendedFetch works as expected */ odbc_command("CREATE TABLE #rowset(n INTEGER, c VARCHAR(20))"); for (i = 0; i < 10; ++i) { char s[10]; char sql[128]; memset(s, 'a' + i, 9); s[9] = 0; sprintf(sql, "INSERT INTO #rowset(n,c) VALUES(%d,'%s')", i+1, s); odbc_command(sql); } odbc_reset_statement(); CHKSetStmtOption(SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_DYNAMIC, "S"); CHKExecDirect(T("SELECT * FROM #rowset ORDER BY n"), SQL_NTS, "SI"); CHKBindCol(2, SQL_C_CHAR, buf, sizeof(buf), &len, "S"); row_count = 0xdeadbeef; memset(statuses, 0x55, sizeof(statuses)); CHKExtendedFetch(SQL_FETCH_NEXT, 1, &row_count, statuses, "S"); if (row_count != 1 || statuses[0] != SQL_ROW_SUCCESS || strcmp(buf, "aaaaaaaaa") != 0) { fprintf(stderr, "Invalid result\n"); odbc_disconnect(); return 1; } odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/rpc.c000644 025423 025423 00000015452 14056414222 021302 0ustar00fredianofrediano000000 000000 /* * Purpose: Test remote procedure calls * Functions: */ #include "common.h" #include static const char procedure_sql[] = "CREATE PROCEDURE %s \n" " @null_input varchar(30) OUTPUT \n" ", @first_type varchar(30) OUTPUT \n" ", @nullout int OUTPUT\n" ", @nrows int OUTPUT \n" ", @c varchar(20)\n" "AS \n" "BEGIN \n" "select @null_input = max(convert(varchar(30), name)) from systypes \n" "select @first_type = min(convert(varchar(30), name)) from systypes \n" /* #1 empty result set: */ "select name from sysobjects where 0=1\n" /* #2 3 rows: */ "select distinct convert(varchar(30), name) as 'type' from systypes \n" "where name in ('int', 'char', 'text') \n" "select @nrows = @@rowcount \n" /* #3 many rows: */ "select distinct convert(varchar(30), name) as name from systypes \n" "return 42 \n" "END \n"; static void init_proc(const char *name) { static char cmd[4096]; if (name[0] != '#') { printf("Dropping procedure %s\n", name); sprintf(cmd, "if exists (select 1 from sysobjects where name = '%s' and type = 'P') " "DROP PROCEDURE %s", name, name); CHKExecDirect(T(cmd), SQL_NTS, "SI"); } printf("Creating procedure %s\n", name); sprintf(cmd, procedure_sql, name); /* create procedure. Fails if wrong permission or not MSSQL */ CHKExecDirect(T(cmd), SQL_NTS, "SI"); } static void Test(const char *name) { int iresults=0, data_errors=0; int ipar=0; HSTMT odbc_stmt = SQL_NULL_HSTMT; char call_cmd[128]; struct Argument { SQLSMALLINT InputOutputType; /* fParamType */ SQLSMALLINT ValueType; /* fCType */ SQLSMALLINT ParameterType; /* fSqlType */ SQLUINTEGER ColumnSize; /* cbColDef */ SQLSMALLINT DecimalDigits; /* ibScale */ SQLPOINTER ParameterValuePtr;/* rgbValue */ SQLINTEGER BufferLength; /* cbValueMax */ SQLLEN ind; /* pcbValue */ }; struct Argument args[] = { /* InputOutputType ValueType ParamType ColumnSize | DecimalDigits | | ParameterValuePtr | | | BufferLength | | | | ind */ { SQL_PARAM_OUTPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, 0, 4, 3 }, /* return status */ { SQL_PARAM_INPUT_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, 30, 0, 0, 30, SQL_NULL_DATA }, /* @null_input varchar(30) OUTPUT */ { SQL_PARAM_INPUT_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, 30, 0, 0, 30, 3 }, /* @first_type varchar(30) OUTPUT */ { SQL_PARAM_INPUT_OUTPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, 0, 4, 4 }, /* @nullout int OUTPUT\ */ { SQL_PARAM_INPUT_OUTPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, 0, 4, 4 }, /* @nrows int OUTPUT */ { SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 20, 0, 0, 20, 3 } /* @c varchar(20) */ }; printf("executing SQLAllocStmt\n"); CHKAllocStmt(&odbc_stmt, "S"); for( ipar=0; ipar < TDS_VECTOR_SIZE(args); ipar++ ) { printf("executing SQLBindParameter for parameter %d\n", 1+ipar); if( args[ipar].BufferLength > 0 ) { args[ipar].ParameterValuePtr = (SQLPOINTER) ODBC_GET(args[ipar].BufferLength); assert(args[ipar].ParameterValuePtr != NULL); memset(args[ipar].ParameterValuePtr, 0, args[ipar].BufferLength); memset(args[ipar].ParameterValuePtr, 'a', args[ipar].BufferLength - 1); } CHKBindParameter ( 1+ipar , args[ipar].InputOutputType , args[ipar].ValueType , args[ipar].ParameterType , args[ipar].ColumnSize , args[ipar].DecimalDigits , args[ipar].ParameterValuePtr , args[ipar].BufferLength , &args[ipar].ind , "S" ); } sprintf(call_cmd, "{?=call %s(?,?,?,?,?)}", name ); printf("executing SQLPrepare: %s\n", call_cmd); CHKPrepare(T(call_cmd), SQL_NTS, "S"); printf("executing SQLExecute\n"); CHKExecute("SI"); do { static const char dashes[] = "------------------------------"; int nrows; SQLSMALLINT icol, ncols; SQLTCHAR name[256] = {0}; SQLSMALLINT namelen; SQLSMALLINT type; SQLSMALLINT scale; SQLSMALLINT nullable; printf("executing SQLNumResultCols for result set %d\n", ++iresults); CHKNumResultCols(&ncols, "S"); printf("executing SQLDescribeCol for %d column%c\n", ncols, (ncols == 1? ' ' : 's')); printf("%-5.5s %-15.15s %5.5s %5.5s %5.5s %8.8s\n", "col", "name", "type", "size", "scale", "nullable"); printf("%-5.5s %-15.15s %5.5s %5.5s %5.5s %8.8s\n", dashes, dashes, dashes, dashes, dashes, dashes); for (icol=ncols; icol > 0; icol--) { SQLULEN size; CHKDescribeCol(icol, name, TDS_VECTOR_SIZE(name), &namelen, &type, &size, &scale, &nullable, "S"); printf("%-5d %-15s %5d %5ld %5d %8c\n", icol, C(name), type, (long int)size, scale, (nullable? 'Y' : 'N')); } printf("executing SQLFetch...\n"); printf("\t%-30s\n\t%s\n", C(name), dashes); for (nrows=0; CHKFetch("SNo") == SQL_SUCCESS; nrows++) { const SQLINTEGER icol = 1; char buf[60]; SQLLEN len; CHKGetData( icol , SQL_C_CHAR /* fCType */ , buf /* rgbValue */ , sizeof(buf) /* cbValueMax */ , &len /* pcbValue */ , "SI" ); printf("\t%-30s\t(%2d bytes)\n", buf, (int) len); } printf("done.\n"); switch (iresults) { case 1: printf("0 rows expected, %d found\n", nrows); data_errors += (nrows == 0)? 0 : 1; break;; case 2: printf("3 rows expected, %d found\n", nrows); data_errors += (nrows == 3)? 0 : 1; break;; case 3: printf("at least 15 rows expected, %d found\n", nrows); data_errors += (nrows > 15)? 0 : 1; break;; } printf("executing SQLMoreResults...\n"); } while (CHKMoreResults("SNo") == SQL_SUCCESS); printf("done.\n"); for( ipar=0; ipar < TDS_VECTOR_SIZE(args); ipar++ ) { if (args[ipar].InputOutputType == SQL_PARAM_INPUT) continue; printf("bound data for parameter %d is %ld bytes: ", 1+ipar, (long int)args[ipar].ind); switch( args[ipar].ValueType ) { case SQL_C_LONG: printf("%d.\n", (int)(*(SQLINTEGER *)args[ipar].ParameterValuePtr)); break; case SQL_C_CHAR: printf("'%s'.\n", (char*)args[ipar].ParameterValuePtr); break; default: printf("type unsupported in this test\n"); assert(0); break; } } printf("executing SQLFreeStmt\n"); CHKFreeStmt(SQL_DROP, "S"); odbc_stmt = SQL_NULL_HSTMT; ODBC_FREE(); if (data_errors) { fprintf(stderr, "%d errors found in expected row count\n", data_errors); exit(1); } } int main(int argc, char *argv[]) { const char proc_name[] = "freetds_odbc_rpc_test"; char drop_proc[256] = "DROP PROCEDURE "; strcat(drop_proc, proc_name); printf("connecting\n"); odbc_connect(); init_proc(proc_name); printf("running test\n"); Test(proc_name); printf("dropping procedure\n"); odbc_command(drop_proc); odbc_disconnect(); printf("Done.\n"); ODBC_FREE(); return 0; } freetds-1.3.6/src/odbc/unittests/scroll.c000644 025423 025423 00000006304 14056414222 022010 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test cursors */ static char software_version[] = "$Id: scroll.c,v 1.11 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char *argv[]) { #define ROWS 3 #define C_LEN 10 SQLUINTEGER n[ROWS]; char c[ROWS][C_LEN]; SQLLEN c_len[ROWS], n_len[ROWS]; SQLUSMALLINT statuses[ROWS]; SQLUSMALLINT i; SQLULEN num_row; int i_test; typedef struct _test { SQLUSMALLINT type; SQLINTEGER irow; int start; int num; } TEST; static const TEST tests[] = { {SQL_FETCH_NEXT, 0, 1, 3}, {SQL_FETCH_NEXT, 0, 4, 2}, {SQL_FETCH_PRIOR, 0, 1, 3}, {SQL_FETCH_NEXT, 0, 4, 2}, {SQL_FETCH_NEXT, 0, -1, -1}, {SQL_FETCH_FIRST, 0, 1, 3}, {SQL_FETCH_ABSOLUTE, 3, 3, 3}, {SQL_FETCH_RELATIVE, 1, 4, 2}, {SQL_FETCH_LAST, 0, 3, 3} }; const int num_tests = TDS_VECTOR_SIZE(tests); odbc_use_version3 = 1; odbc_connect(); odbc_check_cursor(); /* create test table */ odbc_command("IF OBJECT_ID('tempdb..#test') IS NOT NULL DROP TABLE #test"); odbc_command("CREATE TABLE #test(i int, c varchar(6))"); odbc_command("INSERT INTO #test(i, c) VALUES(1, 'a')"); odbc_command("INSERT INTO #test(i, c) VALUES(2, 'bb')"); odbc_command("INSERT INTO #test(i, c) VALUES(3, 'ccc')"); odbc_command("INSERT INTO #test(i, c) VALUES(4, 'dddd')"); odbc_command("INSERT INTO #test(i, c) VALUES(5, 'eeeee')"); /* set cursor options */ odbc_reset_statement(); CHKSetStmtAttr(SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_ROWVER, 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0, "S"); CHKSetStmtAttr(SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER) ROWS, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROW_STATUS_PTR, (SQLPOINTER) statuses, 0, "S"); CHKSetStmtAttr(SQL_ATTR_ROWS_FETCHED_PTR, &num_row, 0, "S"); /* */ CHKExecDirect(T("SELECT i, c FROM #test"), SQL_NTS, "S"); /* bind some rows at a time */ CHKBindCol(1, SQL_C_ULONG, n, 0, n_len, "S"); CHKBindCol(2, SQL_C_CHAR, c, C_LEN, c_len, "S"); for (i_test = 0; i_test < num_tests; ++i_test) { const TEST *t = &tests[i_test]; printf("Test %d\n", i_test + 1); if (t->start == -1) { CHKFetchScroll(t->type, t->irow, "No"); } else { CHKFetchScroll(t->type, t->irow, "S"); if (t->start < 1) { fprintf(stderr, "Rows not expected\n"); exit(1); } /* print, just for debug */ for (i = 0; i < num_row; ++i) printf("row %d i %d c %s\n", (int) (i + 1), (int) n[i], c[i]); printf("---\n"); if (num_row != t->num) { fprintf(stderr, "Expected %d rows, got %d\n", t->num, (int) num_row); exit(1); } for (i = 0; i < num_row; ++i) { char name[10]; memset(name, 0, sizeof(name)); memset(name, 'a' - 1 + i + t->start, i + t->start); if (n[i] != i + t->start || c_len[i] != strlen(name) || strcmp(c[i], name) != 0) { fprintf(stderr, "Wrong row returned\n"); fprintf(stderr, "\tn %d %d\n", (int) n[i], i + t->start); fprintf(stderr, "\tc len %d %d\n", (int) c_len[i], (int) strlen(name)); fprintf(stderr, "\tc %s %s\n", c[i], name); exit(1); } } } } odbc_reset_statement(); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/stats.c000644 025423 025423 00000005302 14056414271 021651 0ustar00fredianofrediano000000 000000 #include "common.h" static char software_version[] = "$Id: stats.c,v 1.4 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static SQLLEN cnamesize; static char output[256]; static void ReadCol(int i) { memset(output, 'x', sizeof(output)); strcpy(output, "NULL"); CHKGetData(i, SQL_C_CHAR, output, sizeof(output), &cnamesize, "S"); } static const char *proc = "stat_proc"; static const char *table = "stat_proc"; static const char *column = "@t"; #define LEN(x) (x) ? strlen(x) : 0 static void TestProc(const char *catalog, const char *type, const char *expected) { char sql[256]; char *schema = NULL; odbc_command("IF OBJECT_ID('stat_proc') IS NOT NULL DROP PROC stat_proc"); sprintf(sql, "CREATE PROC stat_proc(@t %s) AS RETURN 0", type); odbc_command(sql); column = "@t"; CHKProcedureColumns(T(catalog), LEN(catalog), T(schema), LEN(schema), T(proc), LEN(proc), T(column), LEN(column), "SI"); CHKFetch("SI"); ReadCol(6); if (strcmp(output, expected) != 0) { fprintf(stderr, "Got \"%s\" expected \"%s\"\n", output, expected); odbc_disconnect(); exit(1); } CHKCloseCursor("SI"); ODBC_FREE(); } static void TestTable(const char *catalog, const char *type, const char *expected) { char sql[256]; char *schema = NULL; if (catalog) { schema = "dbo"; sprintf(sql, "IF OBJECT_ID('%s.%s.stat_t') IS NOT NULL DROP TABLE %s.%s.stat_t", catalog, schema, catalog, schema); odbc_command(sql); sprintf(sql, "CREATE TABLE %s.%s.stat_t(t %s)", catalog, schema, type); } else { odbc_command("IF OBJECT_ID('stat_t') IS NOT NULL DROP TABLE stat_t"); sprintf(sql, "CREATE TABLE stat_t(t %s)", type); } odbc_command(sql); column = "t"; table = "stat_t"; CHKColumns(T(catalog), LEN(catalog), T(schema), LEN(schema), T(table), LEN(table), T(column), LEN(column), "SI"); CHKFetch("SI"); ReadCol(5); if (strcmp(output, expected) != 0) { fprintf(stderr, "Got \"%s\" expected \"%s\"\n", output, expected); odbc_disconnect(); exit(1); } CHKCloseCursor("SI"); ODBC_FREE(); } #define STR(n) str(int_buf, n) static const char * str(char *buf, int n) { sprintf(buf, "%d", n); return buf; } int main(int argc, char *argv[]) { char int_buf[32]; odbc_use_version3 = 0; odbc_connect(); TestProc(NULL, "DATETIME", STR(SQL_TIMESTAMP)); TestTable(NULL, "DATETIME", STR(SQL_TIMESTAMP)); TestTable("freetds_test", "DATETIME", STR(SQL_TIMESTAMP)); odbc_disconnect(); odbc_use_version3 = 1; odbc_connect(); TestProc(NULL, "DATETIME", STR(SQL_TYPE_TIMESTAMP)); TestTable(NULL, "DATETIME", STR(SQL_TYPE_TIMESTAMP)); TestTable("freetds_test", "DATETIME", STR(SQL_TYPE_TIMESTAMP)); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/t0001.c000644 025423 025423 00000002365 14056414222 021261 0ustar00fredianofrediano000000 000000 #include "common.h" static char software_version[] = "$Id: t0001.c,v 1.19 2010-07-05 09:20:33 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int main(int argc, char *argv[]) { int i; SQLLEN cnamesize; const char *command; SQLCHAR output[256]; odbc_connect(); odbc_command("if object_id('tempdb..#odbctestdata') is not null drop table #odbctestdata"); command = "create table #odbctestdata (" "col1 varchar(30) not null," "col2 int not null," "col3 float not null," "col4 numeric(18,6) not null," "col5 datetime not null," "col6 text not null)"; odbc_command(command); command = "insert #odbctestdata values (" "'ABCDEFGHIJKLMNOP'," "123456," "1234.56," "123456.78," "'Sep 11 2001 10:00AM'," "'just to check returned length...')"; odbc_command(command); odbc_command("select * from #odbctestdata"); CHKFetch("SI"); for (i = 1; i <= 6; i++) { CHKGetData(i, SQL_C_CHAR, output, sizeof(output), &cnamesize, "S"); printf("output data >%s< len_or_ind = %d\n", output, (int) cnamesize); if (cnamesize != strlen((char *) output)) return 1; } CHKFetch("No"); CHKCloseCursor("SI"); odbc_command("drop table #odbctestdata"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/t0002.c000644 025423 025423 00000002160 14056414222 021253 0ustar00fredianofrediano000000 000000 #include "common.h" #define SWAP_STMT() do { SQLHSTMT xyz = odbc_stmt; \ odbc_stmt = old_odbc_stmt; old_odbc_stmt = xyz; } while(0) int main(int argc, char *argv[]) { HSTMT old_odbc_stmt = SQL_NULL_HSTMT; odbc_connect(); odbc_command("if object_id('tempdb..#odbctestdata') is not null drop table #odbctestdata"); odbc_command("create table #odbctestdata (i int)"); odbc_command("insert #odbctestdata values (123)"); /* * now we allocate another statement, select, get all results * then make another query with first select and drop this statement * result should not disappear (required for DBD::ODBC) */ SWAP_STMT(); CHKAllocStmt(&odbc_stmt, "S"); odbc_command("select * from #odbctestdata where 0=1"); CHKFetch("No"); CHKCloseCursor("SI"); SWAP_STMT(); odbc_command("select * from #odbctestdata"); SWAP_STMT(); /* drop first statement .. data should not disappear */ CHKFreeStmt(SQL_DROP, "S"); odbc_stmt = SQL_NULL_HSTMT; SWAP_STMT(); CHKFetch("SI"); CHKFetch("No"); CHKCloseCursor("SI"); odbc_command("drop table #odbctestdata"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/t0003.c000644 025423 025423 00000002515 14056414222 021260 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test for SQLMoreResults */ static char software_version[] = "$Id: t0003.c,v 1.21 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void DoTest(int prepared) { odbc_command("create table #odbctestdata (i int)"); /* test that 2 empty result set are returned correctly */ if (!prepared) { odbc_command("select * from #odbctestdata select * from #odbctestdata"); } else { CHKPrepare(T("select * from #odbctestdata select * from #odbctestdata"), SQL_NTS, "S"); CHKExecute("S"); } CHKFetch("No"); CHKMoreResults("S"); printf("Getting next recordset\n"); CHKFetch("No"); CHKMoreResults("No"); /* test that skipping a no empty result go to other result set */ odbc_command("insert into #odbctestdata values(123)"); if (!prepared) { odbc_command("select * from #odbctestdata select * from #odbctestdata"); } else { CHKPrepare(T("select * from #odbctestdata select * from #odbctestdata"), SQL_NTS, "S"); CHKExecute("S"); } CHKMoreResults("S"); printf("Getting next recordset\n"); CHKFetch("S"); CHKFetch("No"); CHKMoreResults("No"); odbc_command("drop table #odbctestdata"); ODBC_FREE(); } int main(int argc, char *argv[]) { odbc_connect(); DoTest(0); DoTest(1); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/tables.c000644 025423 025423 00000010354 14056414222 021764 0ustar00fredianofrediano000000 000000 #include "common.h" #ifdef _WIN32 #undef strcasecmp #define strcasecmp stricmp #endif static SQLLEN cnamesize; static char output[256]; static void ReadCol(int i) { strcpy(output, "NULL"); CHKGetData(i, SQL_C_CHAR, output, sizeof(output), &cnamesize, "S"); } static void TestName(int index, const char *expected_name) { SQLTCHAR name[128]; char buf[256]; SQLSMALLINT len, type; #define NAME_TEST \ do { \ if (strcmp(C(name), expected_name) != 0) \ { \ sprintf(buf, "wrong name in column %d expected '%s' got '%s'", index, expected_name, C(name)); \ ODBC_REPORT_ERROR(buf); \ } \ } while(0) /* retrieve with SQLDescribeCol */ CHKDescribeCol(index, name, TDS_VECTOR_SIZE(name), &len, &type, NULL, NULL, NULL, "S"); NAME_TEST; /* retrieve with SQLColAttribute */ CHKColAttribute(index, SQL_DESC_NAME, name, TDS_VECTOR_SIZE(name), &len, NULL, "S"); if (odbc_db_is_microsoft()) NAME_TEST; CHKColAttribute(index, SQL_DESC_LABEL, name, TDS_VECTOR_SIZE(name), &len, NULL, "S"); NAME_TEST; } static const char *catalog = NULL; static const char *schema = NULL; static const char *table = "sysobjects"; static const char *expect = NULL; static int expect_col = 3; static char expected_type[20] = "SYSTEM TABLE"; static void DoTest(const char *type, int row_returned, int line) { int table_len = SQL_NULL_DATA; char table_buf[80]; int found = 0; #define LEN(x) (x) ? strlen(x) : SQL_NULL_DATA if (table) { strcpy(table_buf, table); strcat(table_buf, "garbage"); table_len = strlen(table); } printf("Test type '%s' %s row at line %d\n", type ? type : "", row_returned ? "with" : "without", line); CHKTables(T(catalog), LEN(catalog), T(schema), LEN(schema), T(table_buf), table_len, T(type), LEN(type), "SI"); /* test column name (for DBD::ODBC) */ TestName(1, odbc_use_version3 || !odbc_driver_is_freetds() ? "TABLE_CAT" : "TABLE_QUALIFIER"); TestName(2, odbc_use_version3 || !odbc_driver_is_freetds() ? "TABLE_SCHEM" : "TABLE_OWNER"); TestName(3, "TABLE_NAME"); TestName(4, "TABLE_TYPE"); TestName(5, "REMARKS"); if (row_returned) { CHKFetch("SI"); if (!expect) { ReadCol(1); ReadCol(2); ReadCol(3); if (strcasecmp(output, "sysobjects") != 0) { printf("wrong table %s\n", output); exit(1); } ReadCol(4); /* under mssql2k5 is a view */ if (strcmp(output, expected_type) != 0) { printf("wrong table type %s\n", output); exit(1); } ReadCol(5); } } if (expect) { ReadCol(expect_col); if (strcmp(output, expect) == 0) found = 1; } while (CHKFetch("SNo") == SQL_SUCCESS && row_returned > 1) { if (expect) { ReadCol(expect_col); if (strcmp(output, expect) == 0) found = 1; } if (row_returned < 2) break; } if (expect && !found) { printf("expected row not found\n"); exit(1); } CHKCloseCursor("SI"); expect = NULL; expect_col = 3; } #define DoTest(a,b) DoTest(a,b,__LINE__) int main(int argc, char *argv[]) { char type[32]; int mssql2005 = 0; odbc_use_version3 = 0; odbc_connect(); if (odbc_db_is_microsoft() && odbc_db_version_int() >= 0x09000000u) { mssql2005 = 1; strcpy(expected_type, "VIEW"); odbc_command_with_result(odbc_stmt, "USE master"); } DoTest(NULL, 1); sprintf(type, "'%s'", expected_type); DoTest(type, 1); DoTest("'TABLE'", 0); DoTest(type, 1); DoTest("TABLE", 0); DoTest("TABLE,VIEW", mssql2005 ? 1 : 0); DoTest("SYSTEM TABLE,'TABLE'", mssql2005 ? 0 : 1); sprintf(type, "TABLE,'%s'", expected_type); DoTest(type, 1); odbc_disconnect(); odbc_use_version3 = 1; odbc_connect(); if (mssql2005) odbc_command_with_result(odbc_stmt, "USE master"); sprintf(type, "'%s'", expected_type); DoTest(type, 1); /* TODO this should work even for Sybase and mssql 2005 */ if (odbc_db_is_microsoft()) { /* here table is a name of table */ catalog = "%"; schema = NULL; DoTest(NULL, 2); } /* * tests for Jdbc compatibility */ /* enum tables */ catalog = NULL; schema = NULL; table = "%"; expect = "sysobjects"; DoTest(NULL, 2); /* enum catalogs */ catalog = "%"; schema = ""; table = ""; expect = "master"; expect_col = 1; DoTest(NULL, 2); /* enum schemas (owners) */ catalog = ""; schema = "%"; table = ""; expect = "dbo"; expect_col = 2; DoTest(NULL, 2); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/test64.c000644 025423 025423 00000013761 14056414222 021650 0ustar00fredianofrediano000000 000000 /* test win64 consistency */ #include "common.h" /* set ipd processed_ptr with SQLParamOptions/SQLSetDescField/SQL_ATTR_PARAMS_PROCESSED_PTR check always same value IPD->processed_ptr attr */ static void prepare_something(void) { /* Some DM requires something to be prepared, so do it */ #ifndef TDS_NO_DM CHKPrepare(T("select * from #tmp1"), SQL_NTS, "S"); #endif } static void check_ipd_params(void) { void *ptr, *ptr2; SQLHDESC desc; SQLINTEGER ind; CHKGetStmtAttr(SQL_ATTR_PARAMS_PROCESSED_PTR, &ptr, sizeof(ptr), NULL, "S"); /* get IPD */ CHKGetStmtAttr(SQL_ATTR_IMP_PARAM_DESC, &desc, sizeof(desc), &ind, "S"); CHKR2(SQLGetDescField, (desc, 0, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind), SQL_HANDLE_DESC, desc, "S"); if (ptr != ptr2) { fprintf(stderr, "IPD inconsistency ptr %p ptr2 %p\n", ptr, ptr2); exit(1); } } static void set_ipd_params1(SQLULEN *ptr) { CHKSetStmtAttr(SQL_ATTR_PARAMS_PROCESSED_PTR, ptr, 0, "S"); } static void set_ipd_params2(SQLULEN *ptr) { SQLHDESC desc; SQLINTEGER ind; /* get IPD */ CHKGetStmtAttr(SQL_ATTR_IMP_PARAM_DESC, &desc, sizeof(desc), &ind, "S"); CHKR2(SQLSetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, ptr, 0), SQL_HANDLE_DESC, desc, "S"); } static void set_ipd_params3(SQLULEN *ptr) { CHKParamOptions(2, ptr, "S"); } typedef void (*rows_set_t)(SQLULEN*); static const rows_set_t param_set[] = { set_ipd_params1, set_ipd_params2, set_ipd_params3, NULL }; #define MALLOC_N(t, n) (t*) malloc(n*sizeof(t)) static void test_params(void) { #define ARRAY_SIZE 2 const rows_set_t *p; SQLULEN len; SQLUINTEGER *ids = MALLOC_N(SQLUINTEGER,ARRAY_SIZE); SQLLEN *id_lens = MALLOC_N(SQLLEN,ARRAY_SIZE); unsigned long int h, l; unsigned int n; prepare_something(); for (n = 0; n < ARRAY_SIZE; ++n) { ids[n] = n; id_lens[n] = 0; } /* test setting just some test pointers */ set_ipd_params1((SQLULEN *) TDS_INT2PTR(0x01020304)); check_ipd_params(); set_ipd_params2((SQLULEN *) TDS_INT2PTR(0xabcdef12)); check_ipd_params(); set_ipd_params3((SQLULEN *) TDS_INT2PTR(0x87654321)); check_ipd_params(); /* now see results */ for (p = param_set; *p != NULL; ++p) { odbc_reset_statement(); len = 0xdeadbeef; len <<= 16; len <<= 16; len |= 12345678; (*p)(&len); check_ipd_params(); CHKSetStmtAttr(SQL_ATTR_PARAMSET_SIZE, (void *) TDS_INT2PTR(ARRAY_SIZE), 0, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 5, 0, ids, 0, id_lens, "S"); odbc_command("INSERT INTO #tmp1(i) VALUES(?)"); SQLMoreResults(odbc_stmt); for (n = 0; n < ARRAY_SIZE; ++n) SQLMoreResults(odbc_stmt); l = (unsigned long int) (len & 0xfffffffflu); len >>= 16; h = (unsigned long int) (len >> 16); if (h != 0 || l != 2) { fprintf(stderr, "Wrong number returned in param rows high %lu low %lu\n", h, l); exit(1); } } free(ids); free(id_lens); } /* set ird processed_ptr with SQLExtendedFetch/SQLSetDescField/SQL_ATTR_ROWS_FETCHED_PTR check always same value IRD->processed_ptr attr */ static void check_ird_params(void) { void *ptr, *ptr2; SQLHDESC desc; SQLINTEGER ind; CHKGetStmtAttr(SQL_ATTR_ROWS_FETCHED_PTR, &ptr, sizeof(ptr), NULL, "S"); /* get IRD */ CHKGetStmtAttr(SQL_ATTR_IMP_ROW_DESC, &desc, sizeof(desc), &ind, "S"); CHKR2(SQLGetDescField, (desc, 0, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind), SQL_HANDLE_DESC, desc, "S"); if (ptr != ptr2) { fprintf(stderr, "IRD inconsistency ptr %p ptr2 %p\n", ptr, ptr2); exit(1); } } static void set_ird_params1(SQLULEN *ptr) { CHKSetStmtAttr(SQL_ATTR_ROWS_FETCHED_PTR, ptr, 0, "S"); } static void set_ird_params2(SQLULEN *ptr) { SQLHDESC desc; SQLINTEGER ind; /* get IRD */ CHKGetStmtAttr(SQL_ATTR_IMP_ROW_DESC, &desc, sizeof(desc), &ind, "S"); CHKR2(SQLSetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, ptr, 0), SQL_HANDLE_DESC, desc, "S"); } static const rows_set_t row_set[] = { set_ird_params1, set_ird_params2, NULL }; #define MALLOC_N(t, n) (t*) malloc(n*sizeof(t)) static void test_rows(void) { const rows_set_t *p; SQLULEN len; SQLUINTEGER *ids = MALLOC_N(SQLUINTEGER,ARRAY_SIZE); SQLLEN *id_lens = MALLOC_N(SQLLEN,ARRAY_SIZE); unsigned long int h, l; unsigned int n; prepare_something(); for (n = 0; n < ARRAY_SIZE; ++n) { ids[n] = n; id_lens[n] = 0; } /* test setting just some test pointers */ set_ird_params1((SQLULEN *) TDS_INT2PTR(0x01020304)); check_ird_params(); set_ird_params2((SQLULEN *) TDS_INT2PTR(0xabcdef12)); check_ird_params(); /* now see results */ for (p = row_set; ; ++p) { const char *test_name = NULL; odbc_reset_statement(); prepare_something(); len = 0xdeadbeef; len <<= 16; len <<= 16; len |= 12345678; if (*p) (*p)(&len); check_ird_params(); #if 0 CHKSetStmtAttr(SQL_ATTR_PARAMSET_SIZE, (void *) TDS_INT2PTR(ARRAY_SIZE), 0, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 5, 0, ids, 0, id_lens, "S"); #endif CHKBindCol(1, SQL_C_ULONG, ids, 0, id_lens, "S"); if (*p) { CHKSetStmtAttr(SQL_ATTR_ROW_ARRAY_SIZE, (void *) TDS_INT2PTR(ARRAY_SIZE), 0, "S"); odbc_command("SELECT DISTINCT i FROM #tmp1"); SQLFetch(odbc_stmt); test_name = "SQLSetStmtAttr"; } else { CHKSetStmtAttr(SQL_ROWSET_SIZE, (void *) TDS_INT2PTR(ARRAY_SIZE), 0, "S"); odbc_command("SELECT DISTINCT i FROM #tmp1"); CHKExtendedFetch(SQL_FETCH_NEXT, 0, &len, NULL, "S"); test_name = "SQLExtendedFetch"; } SQLMoreResults(odbc_stmt); l = (unsigned long int) (len & 0xfffffffflu); len >>= 16; h = (unsigned long int) (len >> 16); if (h != 0 || l != 2) { fprintf(stderr, "Wrong number returned in rows high %lu(0x%lx) low %lu(0x%lx) test %s\n", h, h, l, l, test_name); exit(1); } if (!*p) break; } free(ids); free(id_lens); } int main(void) { if (sizeof(SQLLEN) != 8) { printf("Not possible for this platform.\n"); odbc_test_skipped(); return 0; } odbc_use_version3 = 1; odbc_connect(); odbc_command("create table #tmp1 (i int)"); test_params(); test_rows(); odbc_disconnect(); printf("Done\n"); return 0; } freetds-1.3.6/src/odbc/unittests/testodbc.c000644 025423 025423 00000030301 14056414222 022313 0ustar00fredianofrediano000000 000000 /* * Code to test ODBC implementation. * - David Fraser, Abelon Systems 2003. */ /* * TODO * remove Northwind dependency */ #include "common.h" #ifdef DEBUG # define AB_FUNCT(x) do { printf x; printf("\n"); } while(0) # define AB_PRINT(x) do { printf x; printf("\n"); } while(0) #else # define AB_FUNCT(x) # define AB_PRINT(x) #endif #define AB_ERROR(x) do { printf("ERROR: "); printf x; printf("\n"); } while(0) #undef TRUE #undef FALSE enum { FALSE, TRUE }; typedef int DbTestFn(void); static int RunTests(void); typedef struct { DbTestFn *testFn; const char *description; } DbTestEntry; /* * Test that makes a parameterized ODBC query using SQLPrepare and SQLExecute */ static int TestRawODBCPreparedQuery(void) { SQLTCHAR *queryString; SQLLEN lenOrInd = 0; SQLSMALLINT supplierId = 4; int count; AB_FUNCT(("TestRawODBCPreparedQuery (in)")); /* INIT */ odbc_connect(); /* MAKE QUERY */ odbc_command("CREATE TABLE #Products (" "ProductID int NOT NULL ," "ProductName varchar (40) ," "SupplierID int NULL ," "CategoryID int NULL ," "QuantityPerUnit varchar (20) ," "UnitPrice money NULL ," "UnitsInStock smallint NULL ," "UnitsOnOrder smallint NULL ," "ReorderLevel smallint NULL ," "Discontinued bit NOT NULL " ") " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(9,'Mishi Kobe Niku',4,6,'18 - 500 g pkgs.',97.00,29,0,0,1) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(10,'Ikura',4,8,'12 - 200 ml jars',31.00,31,0,0,0) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(74,'Longlife Tofu',4,7,'5 kg pkg.',10.00,4,20,5,0) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(11,'Queso Cabrales',5,4,'1 kg pkg.',21.00,22,30,30,0) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(12,'Queso Manchego La Pastora',5,4,'10 - 500 g pkgs.',38.00,86,0,0,0)"); while (SQLMoreResults(odbc_stmt) == SQL_SUCCESS) continue; queryString = T("SELECT * FROM #Products WHERE SupplierID = ?"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd, "S"); CHKPrepare(queryString, SQL_NTS, "S"); CHKExecute("S"); count = 0; while (SQLFetch(odbc_stmt) == SQL_SUCCESS) { count++; } AB_PRINT(("Got %d rows", count)); if (count != 3) { /* * OK - so 3 is a magic number - it's the number of rows matching * this query from the MS sample Northwind database and is a constant. */ AB_ERROR(("Expected %d rows - but got %d rows", 3, count)); AB_FUNCT(("TestRawODBCPreparedQuery (out): error")); return FALSE; } /* CLOSEDOWN */ odbc_disconnect(); AB_FUNCT(("TestRawODBCPreparedQuery (out): ok")); return TRUE; } /* * Test that makes a parameterized ODBC query using SQLExecDirect. */ static int TestRawODBCDirectQuery(void) { SQLLEN lenOrInd = 0; SQLSMALLINT supplierId = 1; int count; AB_FUNCT(("TestRawODBCDirectQuery (in)")); /* INIT */ odbc_connect(); /* MAKE QUERY */ odbc_command("CREATE TABLE #Products (" "ProductID int NOT NULL ," "ProductName varchar (40) ," "SupplierID int NULL ," "CategoryID int NULL ," "QuantityPerUnit varchar (20) ," "UnitPrice money NULL ," "UnitsInStock smallint NULL ," "UnitsOnOrder smallint NULL ," "ReorderLevel smallint NULL ," "Discontinued bit NOT NULL " ") " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(1,'Chai',1,1,'10 boxes x 20 bags',18.00,39,0,10,0) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(2,'Chang',1,1,'24 - 12 oz bottles',19.00,17,40,25,0) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(3,'Aniseed Syrup',1,2,'12 - 550 ml bottles',10.00,13,70,25,0) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(4,'Chef Anton''s Cajun Seasoning',2,2,'48 - 6 oz jars',22.00,53,0,0,0) " "INSERT INTO #Products(ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued) VALUES(5,'Chef Anton''s Gumbo Mix',2,2,'36 boxes',21.35,0,0,0,1) "); while (SQLMoreResults(odbc_stmt) == SQL_SUCCESS) continue; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd, "S"); CHKExecDirect(T("SELECT * FROM #Products WHERE SupplierID = ?"), SQL_NTS, "S"); count = 0; while (SQLFetch(odbc_stmt) == SQL_SUCCESS) { count++; } AB_PRINT(("Got %d rows", count)); if (count != 3) { /* * OK - so 3 is a magic number - it's the number of rows matching * this query from the MS sample Northwind database and is a constant. */ AB_ERROR(("Expected %d rows - but got %d rows", 3, count)); AB_FUNCT(("TestRawODBCDirectQuery (out): error")); return FALSE; } /* CLOSEDOWN */ odbc_disconnect(); AB_FUNCT(("TestRawODBCDirectQuery (out): ok")); return TRUE; } /* * Test that show what works and what doesn't for the poorly * documented GUID. */ static int TestRawODBCGuid(void) { SQLRETURN status; const char *queryString; SQLLEN lenOrInd; SQLSMALLINT age; char guid[40]; SQLCHAR name[20]; SQLGUID sqlguid; int count = 0; AB_FUNCT(("TestRawODBCGuid (in)")); odbc_connect(); if (!odbc_db_is_microsoft()) { odbc_disconnect(); return TRUE; } AB_PRINT(("Creating #pet table")); queryString = "CREATE TABLE #pet (name VARCHAR(20), owner VARCHAR(20), " "species VARCHAR(20), sex CHAR(1), age INTEGER, " "guid UNIQUEIDENTIFIER DEFAULT NEWID() ); "; CHKExecDirect(T(queryString), SQL_NTS, "SNo"); odbc_command_with_result(odbc_stmt, "DROP PROC GetGUIDRows"); AB_PRINT(("Creating stored proc GetGUIDRows")); queryString = "CREATE PROCEDURE GetGUIDRows (@guidpar uniqueidentifier) AS \ SELECT name, guid FROM #pet WHERE guid = @guidpar"; CHKExecDirect(T(queryString), SQL_NTS, "SNo"); AB_PRINT(("Insert row 1")); queryString = "INSERT INTO #pet( name, owner, species, sex, age ) \ VALUES ( 'Fang', 'Mike', 'dog', 'm', 12 );"; CHKExecDirect(T(queryString), SQL_NTS, "S"); AB_PRINT(("Insert row 2")); /* * Ok - new row with explicit GUID, but parameterised age. */ queryString = "INSERT INTO #pet( name, owner, species, sex, age, guid ) \ VALUES ( 'Splash', 'Dan', 'fish', 'm', ?, \ '12345678-1234-1234-1234-123456789012' );"; lenOrInd = 0; age = 3; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &age, 0, &lenOrInd, "S"); CHKExecDirect(T(queryString), SQL_NTS, "S"); CHKFreeStmt(SQL_CLOSE, "S"); AB_PRINT(("Insert row 3")); /* * Ok - new row with parameterised GUID. */ queryString = "INSERT INTO #pet( name, owner, species, sex, age, guid ) \ VALUES ( 'Woof', 'Tom', 'cat', 'f', 2, ? );"; lenOrInd = SQL_NTS; strcpy(guid, "87654321-4321-4321-4321-123456789abc"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_GUID, 0, 0, guid, 0, &lenOrInd, "S"); CHKExecDirect(T(queryString), SQL_NTS, "S"); AB_PRINT(("Insert row 4")); /* * Ok - new row with parameterised GUID. */ queryString = "INSERT INTO #pet( name, owner, species, sex, age, guid ) \ VALUES ( 'Spike', 'Diane', 'pig', 'f', 4, ? );"; lenOrInd = SQL_NTS; strcpy(guid, "1234abcd-abcd-abcd-abcd-123456789abc"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 36, 0, guid, 0, &lenOrInd, "S"); CHKExecDirect(T(queryString), SQL_NTS, "S"); AB_PRINT(("Insert row 5")); /* * Ok - new row with parameterised GUID. */ queryString = "INSERT INTO #pet( name, owner, species, sex, age, guid ) \ VALUES ( 'Fluffy', 'Sam', 'dragon', 'm', 16, ? );"; sqlguid.Data1 = 0xaabbccdd; sqlguid.Data2 = 0xeeff; sqlguid.Data3 = 0x1122; sqlguid.Data4[0] = 0x11; sqlguid.Data4[1] = 0x22; sqlguid.Data4[2] = 0x33; sqlguid.Data4[3] = 0x44; sqlguid.Data4[4] = 0x55; sqlguid.Data4[5] = 0x66; sqlguid.Data4[6] = 0x77; sqlguid.Data4[7] = 0x88; lenOrInd = 16; strcpy(guid, "1234abcd-abcd-abcd-abcd-123456789abc"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_GUID, SQL_GUID, 16, 0, &sqlguid, 16, &lenOrInd, "S"); status = SQLExecDirect(odbc_stmt, T(queryString), SQL_NTS); if (status != SQL_SUCCESS) { AB_ERROR(("Insert row 5 failed")); AB_ERROR(("Sadly this was expected in *nix ODBC. Carry on.")); } /* * Now retrieve rows - especially GUID column values. */ AB_PRINT(("retrieving name and guid")); queryString = "SELECT name, guid FROM #pet"; CHKExecDirect(T(queryString), SQL_NTS, "S"); while (SQLFetch(odbc_stmt) == SQL_SUCCESS) { count++; CHKGetData(1, SQL_CHAR, name, 20, 0, "S"); CHKGetData(2, SQL_CHAR, guid, 37, 0, "S"); AB_PRINT(("name: %-10s guid: %s", name, guid)); } /* * Realloc cursor handle - (Windows ODBC considers it an invalid cursor * state if we try SELECT again). */ odbc_reset_statement(); /* * Now retrieve rows - especially GUID column values. */ AB_PRINT(("retrieving name and guid again")); queryString = "SELECT name, guid FROM #pet"; CHKExecDirect(T(queryString), SQL_NTS, "S"); while (CHKFetch("SNo") == SQL_SUCCESS) { count++; CHKGetData(1, SQL_CHAR, name, 20, 0, "S"); CHKGetData(2, SQL_GUID, &sqlguid, 16, 0, "S"); AB_PRINT(("%-10s %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", name, (int) (sqlguid.Data1), sqlguid.Data2, sqlguid.Data3, sqlguid.Data4[0], sqlguid.Data4[1], sqlguid.Data4[2], sqlguid.Data4[3], sqlguid.Data4[4], sqlguid.Data4[5], sqlguid.Data4[6], sqlguid.Data4[7])); } /* * Realloc cursor handle - (Windows ODBC considers it an invalid cursor * state if we try SELECT again). */ odbc_reset_statement(); /* * Now retrieve rows via stored procedure passing GUID as param. */ AB_PRINT(("retrieving name and guid")); queryString = "{call GetGUIDRows(?)}"; lenOrInd = SQL_NTS; strcpy(guid, "87654321-4321-4321-4321-123456789abc"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_GUID, 0, 0, guid, 0, &lenOrInd, "S"); CHKExecDirect(T(queryString), SQL_NTS, "S"); while (SQLFetch(odbc_stmt) == SQL_SUCCESS) { count++; CHKGetData(1, SQL_CHAR, name, 20, 0, "S"); CHKGetData(2, SQL_CHAR, guid, 37, 0, "S"); AB_PRINT(("%-10s %s", name, guid)); } /* * Realloc cursor handle - (Windows ODBC considers it an invalid cursor * state after a previous SELECT has occurred). */ odbc_reset_statement(); /* cleanup */ odbc_command_with_result(odbc_stmt, "DROP PROC GetGUIDRows"); /* CLOSEDOWN */ odbc_disconnect(); AB_FUNCT(("TestRawODBCGuid (out): ok")); return TRUE; } /** * Array of tests. */ static DbTestEntry _dbTests[] = { /* 1 */ {TestRawODBCDirectQuery, "Raw ODBC direct query"}, /* 2 */ {TestRawODBCPreparedQuery, "Raw ODBC prepared query"}, /* 3 */ {TestRawODBCGuid, "Raw ODBC GUID"}, /* end */ {0, 0} }; static DbTestEntry *tests = _dbTests; /** * Code to iterate through all tests to run. * * \return * TRUE if all tests pass, FALSE if any tests fail. */ static int RunTests(void) { unsigned int i; unsigned int passes = 0; unsigned int fails = 0; i = 0; while (tests[i].testFn) { printf("Running test %2d: %s... ", i + 1, tests[i].description); fflush(stdout); if (tests[i].testFn()) { printf("pass\n"); passes++; } else { printf("fail\n"); fails++; } i++; ODBC_FREE(); } if (fails == 0) { printf("\nAll %d tests passed.\n\n", passes); } else { printf("\nTest passes: %d, test fails: %d\n\n", passes, fails); } /* Return TRUE if there are no failures */ return (!fails); } int main(int argc, char *argv[]) { odbc_use_version3 = 1; if (RunTests()) return 0; /* Success */ return 1; /* Error code */ } freetds-1.3.6/src/odbc/unittests/timeout.c000644 025423 025423 00000003645 14056414222 022205 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* Test timeout of query */ static char software_version[] = "$Id: timeout.c,v 1.14 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void AutoCommit(int onoff) { CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, TDS_INT2PTR(onoff), 0, "S"); } static void EndTransaction(SQLSMALLINT type) { CHKEndTran(SQL_HANDLE_DBC, odbc_conn, type, "S"); } int main(int argc, char *argv[]) { HENV env; HDBC dbc; HSTMT stmt; SQLINTEGER i; odbc_connect(); /* here we can't use temporary table cause we use two connection */ odbc_command_with_result(odbc_stmt, "drop table test_timeout"); odbc_command("create table test_timeout(n numeric(18,0) primary key, t varchar(30))"); AutoCommit(SQL_AUTOCOMMIT_OFF); odbc_command("insert into test_timeout(n, t) values(1, 'initial')"); EndTransaction(SQL_COMMIT); odbc_command("update test_timeout set t = 'second' where n = 1"); /* save this connection and do another */ env = odbc_env; dbc = odbc_conn; stmt = odbc_stmt; odbc_env = SQL_NULL_HENV; odbc_conn = SQL_NULL_HDBC; odbc_stmt = SQL_NULL_HSTMT; odbc_connect(); AutoCommit(SQL_AUTOCOMMIT_OFF); CHKSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0, "S"); i = 1; CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &i, 0, NULL, "S"); CHKPrepare(T("update test_timeout set t = 'bad' where n = ?"), SQL_NTS, "S"); CHKExecute("E"); EndTransaction(SQL_ROLLBACK); /* TODO should return error S1T00 Timeout expired, test error message */ odbc_command2("update test_timeout set t = 'bad' where n = 1", "E"); EndTransaction(SQL_ROLLBACK); odbc_disconnect(); odbc_env = env; odbc_conn = dbc; odbc_stmt = stmt; EndTransaction(SQL_COMMIT); /* Sybase do not accept DROP TABLE during a transaction */ AutoCommit(SQL_AUTOCOMMIT_ON); odbc_command("drop table test_timeout"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/timeout2.c000644 025423 025423 00000002203 14056414271 022260 0ustar00fredianofrediano000000 000000 #include "common.h" #ifdef HAVE_UNISTD_H #include #endif #include #include #include /* * Test timeout on prepare * It execute a query wait for timeout and then try to issue a new prepare/execute * This test a BUG where second prepare timeouts * * Test from Ou Liu, cf "Query Time Out", 2006-08-08 */ int main(int argc, char *argv[]) { int i; odbc_connect(); odbc_command("create table #timeout(i int)"); odbc_command("insert into #timeout values(1)"); for (i = 0; i < 2; ++i) { printf("Loop %d\n", i); CHKSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 10, SQL_IS_UINTEGER, "S"); CHKPrepare(T("select * from #timeout"), SQL_NTS, "S"); CHKExecute("S"); do { while (CHKFetch("SNo") == SQL_SUCCESS) ; } while (CHKMoreResults("SNo") == SQL_SUCCESS); if (i == 0) { printf("Sleep 15 seconds to test if timeout occurs\n"); tds_sleep_s(15); } SQLFreeStmt(odbc_stmt, SQL_CLOSE); SQLFreeStmt(odbc_stmt, SQL_UNBIND); SQLFreeStmt(odbc_stmt, SQL_RESET_PARAMS); SQLCloseCursor(odbc_stmt); } odbc_disconnect(); ODBC_FREE(); return 0; } freetds-1.3.6/src/odbc/unittests/timeout3.c000644 025423 025423 00000012010 14056414271 022256 0ustar00fredianofrediano000000 000000 /* * Test connection timeout */ #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_POLL_H #include #endif /* HAVE_POLL_H */ #include #include #include #if TDS_HAVE_MUTEX static void init_connect(void); static void init_connect(void) { CHKAllocEnv(&odbc_env, "S"); SQLSetEnvAttr(odbc_env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (SQL_OV_ODBC3), SQL_IS_UINTEGER); CHKAllocConnect(&odbc_conn, "S"); } static tds_thread fake_thread; static tds_mutex mtx; static TDS_SYS_SOCKET fake_sock; static TDS_THREAD_PROC_DECLARE(fake_thread_proc, arg); /* build a listening socket to connect to */ static int init_fake_server(int ip_port) { struct sockaddr_in sin; TDS_SYS_SOCKET s; int err; memset(&sin, 0, sizeof(sin)); sin.sin_addr.s_addr = INADDR_ANY; sin.sin_port = htons((short) ip_port); sin.sin_family = AF_INET; if (TDS_IS_SOCKET_INVALID(s = socket(AF_INET, SOCK_STREAM, 0))) { perror("socket"); exit(1); } if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) { perror("bind"); CLOSESOCKET(s); return 1; } listen(s, 5); err = tds_thread_create(&fake_thread, fake_thread_proc, TDS_INT2PTR(s)); if (err != 0) { perror("tds_thread_create"); exit(1); } return 0; } /* accept a socket and read data as much as you can */ static TDS_THREAD_PROC_DECLARE(fake_thread_proc, arg) { TDS_SYS_SOCKET s = TDS_PTR2INT(arg), sock; socklen_t len; char buf[128]; struct sockaddr_in sin; struct pollfd fd; memset(&sin, 0, sizeof(sin)); len = sizeof(sin); fd.fd = s; fd.events = POLLIN; fd.revents = 0; if (poll(&fd, 1, 30000) <= 0) { fprintf(stderr, "poll: %d\n", sock_errno); exit(1); } if (TDS_IS_SOCKET_INVALID(sock = tds_accept(s, (struct sockaddr *) &sin, &len))) { perror("accept"); exit(1); } tds_mutex_lock(&mtx); fake_sock = sock; tds_mutex_unlock(&mtx); CLOSESOCKET(s); for (;;) { int len; fd.fd = sock; fd.events = POLLIN; fd.revents = 0; if (poll(&fd, 1, 30000) <= 0) { fprintf(stderr, "poll: %d\n", sock_errno); exit(1); } /* just read and discard */ len = READSOCKET(sock, buf, sizeof(buf)); if (len == 0) break; if (len < 0 && sock_errno != TDSSOCK_EINPROGRESS) break; } return TDS_THREAD_RESULT(0); } int main(int argc, char *argv[]) { SQLTCHAR tmp[2048]; char conn[128]; SQLTCHAR sqlstate[6]; SQLSMALLINT len; int port; time_t start_time, end_time; #ifdef _WIN32 WSADATA wsaData; WSAStartup(MAKEWORD(2, 2), &wsaData); #endif if (tds_mutex_init(&mtx)) return 1; if (odbc_read_login_info()) exit(1); /* * prepare our odbcinst.ini * it is better to do it before connecting because unixODBC caches INIs * the name must be odbcinst.ini because unixODBC accepts only this name */ if (odbc_driver[0]) { FILE *f = fopen("odbcinst.ini", "w"); if (f) { fprintf(f, "[FreeTDS]\nDriver = %s\n", odbc_driver); fclose(f); /* force iODBC */ setenv("ODBCINSTINI", "./odbcinst.ini", 1); setenv("SYSODBCINSTINI", "./odbcinst.ini", 1); /* force unixODBC (only directory) */ setenv("ODBCSYSINI", ".", 1); } } /* this test requires version 7.0, avoid to override externally */ setenv("TDSVER", "7.0", 1); for (port = 12340; port < 12350; ++port) if (!init_fake_server(port)) break; if (port == 12350) { fprintf(stderr, "Cannot bind to a port\n"); return 1; } printf("Fake server bound at port %d\n", port); init_connect(); CHKSetConnectAttr(SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER) 25, sizeof(SQLINTEGER), "SI"); CHKSetConnectAttr(SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER) 10, SQL_IS_UINTEGER, "SI"); /* this is expected to work with unixODBC */ printf("try to connect to our port just to check connection timeout\n"); sprintf(conn, "DRIVER=FreeTDS;SERVER=127.0.0.1;Port=%d;TDS_Version=7.0;UID=test;PWD=test;DATABASE=tempdb;", port); start_time = time(NULL); CHKDriverConnect(NULL, T(conn), SQL_NTS, tmp, TDS_VECTOR_SIZE(tmp), &len, SQL_DRIVER_NOPROMPT, "E"); end_time = time(NULL); memset(sqlstate, 'X', sizeof(sqlstate)); tmp[0] = 0; CHKGetDiagRec(SQL_HANDLE_DBC, odbc_conn, 1, sqlstate, NULL, tmp, TDS_VECTOR_SIZE(tmp), NULL, "SI"); odbc_disconnect(); tds_mutex_lock(&mtx); CLOSESOCKET(fake_sock); tds_mutex_unlock(&mtx); tds_thread_join(fake_thread, NULL); printf("Message: %s - %s\n", C(sqlstate), C(tmp)); if (strcmp(C(sqlstate), "HYT00") || !strstr(C(tmp), "Timeout")) { fprintf(stderr, "Invalid timeout message\n"); return 1; } if (end_time - start_time < 10 || end_time - start_time > 16) { fprintf(stderr, "Unexpected connect timeout (%d)\n", (int) (end_time - start_time)); return 1; } printf("Done.\n"); ODBC_FREE(); return 0; } #else /* !TDS_HAVE_MUTEX */ int main(void) { printf("Not possible for this platform.\n"); odbc_test_skipped(); return 0; } #endif freetds-1.3.6/src/odbc/unittests/timeout4.c000644 025423 025423 00000005051 14056414222 022262 0ustar00fredianofrediano000000 000000 #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_SYS_WAIT_H #include #endif /* HAVE_SYS_WAIT_H */ #include /* * test error on connection close * With a trick we simulate a connection close then we try to * prepare or execute a query. This should fail and return an error message. */ #if HAVE_FSTAT && defined(S_IFSOCK) static int end_socket = -1; static int shutdown_last_socket(void) { TDS_SYS_SOCKET max_socket = odbc_find_last_socket(); TDS_SYS_SOCKET sockets[2]; if (max_socket < 0) return 0; /* replace socket with a new one */ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) return 0; tds_socket_set_nosigpipe(sockets[0], 1); /* substitute socket */ close(max_socket); dup2(sockets[0], max_socket); /* close connection */ close(sockets[0]); end_socket = sockets[1]; return 1; } static int Test(int direct) { SQLTCHAR buf[256]; SQLTCHAR sqlstate[6]; time_t start_time, end_time; odbc_mark_sockets_opened(); odbc_connect(); if (!shutdown_last_socket()) { fprintf(stderr, "Error shutting down connection\n"); return 1; } CHKSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 10, SQL_IS_UINTEGER, "S"); alarm(30); start_time = time(NULL); if (direct) { CHKExecDirect(T("SELECT 1"), SQL_NTS, "E"); } else { SQLSMALLINT cols; /* force dialog with server */ if (CHKPrepare(T("SELECT 1"), SQL_NTS, "SE") == SQL_SUCCESS) CHKNumResultCols(&cols, "E"); } end_time = time(NULL); alarm(0); memset(sqlstate, 'X', sizeof(sqlstate)); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, buf, TDS_VECTOR_SIZE(buf), NULL, "SI"); sqlstate[5] = 0; printf("Message: %s - %s\n", C(sqlstate), C(buf)); if (strcmp(C(sqlstate), "HYT00") || !strstr(C(buf), "Timeout")) { fprintf(stderr, "Invalid timeout message\n"); return 1; } if (end_time - start_time < 10 || end_time - start_time > 26) { fprintf(stderr, "Unexpected connect timeout (%d)\n", (int) (end_time - start_time)); return 1; } odbc_disconnect(); if (end_socket >= 0) close(end_socket); printf("Done.\n"); return 0; } int main(void) { odbc_use_version3 = 1; if (Test(0) || Test(1)) return 1; return 0; } #else int main(void) { printf("Not possible for this platform.\n"); odbc_test_skipped(); return 0; } #endif freetds-1.3.6/src/odbc/unittests/transaction.c000644 025423 025423 00000005443 14056414222 023042 0ustar00fredianofrediano000000 000000 #include "common.h" #include static int Test(bool discard_test) { ODBC_BUF *odbc_buf = NULL; SQLINTEGER out_buf; SQLLEN out_len; SQLLEN rows; int retcode = 0; SQLTCHAR buf[512]; SQLTCHAR sqlstate[6]; const char *createErrorProcedure = "CREATE PROCEDURE testerror AS\n" "SELECT value FROM TestTransaction\n" "SELECT value / (value-value) FROM TestTransaction\n"; /* select after insert is required to test data discarding */ char createProcedure[512]; sprintf(createProcedure, "CREATE PROCEDURE testinsert @value INT AS\n" "INSERT INTO TestTransaction VALUES ( @value )\n%s", discard_test ? "SELECT * FROM TestTransaction\n" : ""); /* create stored proc */ odbc_command_with_result(odbc_stmt, "DROP PROCEDURE testinsert"); odbc_command(createProcedure); /* create stored proc that generates an error */ odbc_command_with_result(odbc_stmt, "DROP PROCEDURE testerror"); odbc_command(createErrorProcedure); /* Start transaction */ CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_OFF, 0, "S"); /* Insert a value */ odbc_command("EXEC testinsert 1"); /* we should be able to read row count */ CHKRowCount(&rows, "S"); /* Commit transaction */ CHKEndTran(SQL_HANDLE_DBC, odbc_conn, SQL_COMMIT, "S"); SQLCloseCursor(odbc_stmt); /* Start transaction */ CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_OFF, 0, "S"); /* Insert another value */ odbc_command("EXEC testinsert 2"); /* Roll back transaction */ CHKEndTran(SQL_HANDLE_DBC, odbc_conn, SQL_ROLLBACK, "S"); /* TODO test row inserted */ CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_ON, 0, "S"); /* generate an error */ odbc_command("EXEC testerror"); CHKBindCol(1, SQL_C_SLONG, &out_buf, sizeof(out_buf), &out_len, "S"); while (CHKFetch("SNo") == SQL_SUCCESS) { printf("\t%ld\n", (long int) out_buf); if (out_buf != 1) { fprintf(stderr, "error: expected to select 1 got %ld\n", (long int) out_buf); retcode = 1; goto cleanup; } } CHKMoreResults("E"); CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, sqlstate, NULL, buf, TDS_VECTOR_SIZE(buf), NULL, "SI"); printf("err=%s\n", C(buf)); CHKMoreResults("No"); cleanup: /* drop table */ odbc_command_with_result(odbc_stmt, "DROP PROCEDURE testinsert"); odbc_command_with_result(odbc_stmt, "DROP PROCEDURE testerror"); ODBC_FREE(); return retcode; } int main(int argc, char *argv[]) { int retcode = 0; odbc_connect(); /* create table */ odbc_command_with_result(odbc_stmt, "DROP TABLE TestTransaction"); odbc_command("CREATE TABLE TestTransaction ( value INT )"); if (!retcode) retcode = Test(true); if (!retcode) retcode = Test(false); /* drop table */ odbc_command_with_result(odbc_stmt, "DROP TABLE TestTransaction"); odbc_disconnect(); printf("Done.\n"); return retcode; } freetds-1.3.6/src/odbc/unittests/transaction2.c000644 025423 025423 00000016056 14056414222 023126 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* Test transaction types */ static void ReadErrorConn(void) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR *err = (SQLTCHAR *) ODBC_GET(sizeof(odbc_err)*sizeof(SQLTCHAR)); SQLTCHAR *state = (SQLTCHAR *) ODBC_GET(sizeof(odbc_sqlstate)*sizeof(SQLTCHAR)); memset(odbc_err, 0, sizeof(odbc_err)); memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); CHKGetDiagRec(SQL_HANDLE_DBC, odbc_conn, 1, state, NULL, err, sizeof(odbc_err), NULL, "SI"); strcpy(odbc_err, C(err)); strcpy(odbc_sqlstate, C(state)); ODBC_FREE(); printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); } static void AutoCommit(int onoff) { CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, TDS_INT2PTR(onoff), 0, "S"); } static void EndTransaction(SQLSMALLINT type) { CHKEndTran(SQL_HANDLE_DBC, odbc_conn, type, "S"); } #define SWAP(t,a,b) do { t xyz = a; a = b; b = xyz; } while(0) #define SWAP_CONN() do { SWAP(HENV,env,odbc_env); SWAP(HDBC,dbc,odbc_conn); SWAP(HSTMT,stmt,odbc_stmt);} while(0) static HENV env = SQL_NULL_HENV; static HDBC dbc = SQL_NULL_HDBC; static HSTMT stmt = SQL_NULL_HSTMT; static int CheckDirtyRead(void) { SQLRETURN RetCode; /* transaction 1 try to change a row but not commit */ odbc_command("UPDATE test_transaction SET t = 'second' WHERE n = 1"); SWAP_CONN(); /* second transaction try to fetch uncommited row */ RetCode = odbc_command2("SELECT * FROM test_transaction WHERE t = 'second' AND n = 1", "SE"); if (RetCode == SQL_ERROR) { EndTransaction(SQL_ROLLBACK); SWAP_CONN(); EndTransaction(SQL_ROLLBACK); return 0; /* no dirty read */ } CHKFetch("S"); CHKFetch("No"); SQLMoreResults(odbc_stmt); EndTransaction(SQL_ROLLBACK); SWAP_CONN(); EndTransaction(SQL_ROLLBACK); return 1; } static int CheckNonrepeatableRead(void) { SQLRETURN RetCode; /* transaction 2 read a row */ SWAP_CONN(); odbc_command("SELECT * FROM test_transaction WHERE t = 'initial' AND n = 1"); SQLMoreResults(odbc_stmt); /* transaction 1 change a row and commit */ SWAP_CONN(); RetCode = odbc_command2("UPDATE test_transaction SET t = 'second' WHERE n = 1", "SE"); if (RetCode == SQL_ERROR) { EndTransaction(SQL_ROLLBACK); SWAP_CONN(); EndTransaction(SQL_ROLLBACK); SWAP_CONN(); return 0; /* no dirty read */ } EndTransaction(SQL_COMMIT); SWAP_CONN(); /* second transaction try to fetch commited row */ odbc_command("SELECT * FROM test_transaction WHERE t = 'second' AND n = 1"); CHKFetch("S"); CHKFetch("No"); SQLMoreResults(odbc_stmt); EndTransaction(SQL_ROLLBACK); SWAP_CONN(); odbc_command("UPDATE test_transaction SET t = 'initial' WHERE n = 1"); EndTransaction(SQL_COMMIT); return 1; } static int CheckPhantom(void) { SQLRETURN RetCode; /* transaction 2 read a row */ SWAP_CONN(); odbc_command("SELECT * FROM test_transaction WHERE t = 'initial'"); SQLMoreResults(odbc_stmt); /* transaction 1 insert a row that match critera */ SWAP_CONN(); RetCode = odbc_command2("INSERT INTO test_transaction(n, t) VALUES(2, 'initial')", "SE"); if (RetCode == SQL_ERROR) { EndTransaction(SQL_ROLLBACK); SWAP_CONN(); EndTransaction(SQL_ROLLBACK); SWAP_CONN(); return 0; /* no dirty read */ } EndTransaction(SQL_COMMIT); SWAP_CONN(); /* second transaction try to fetch commited row */ odbc_command("SELECT * FROM test_transaction WHERE t = 'initial'"); CHKFetch("S"); CHKFetch("S"); CHKFetch("No"); SQLMoreResults(odbc_stmt); EndTransaction(SQL_ROLLBACK); SWAP_CONN(); odbc_command("DELETE test_transaction WHERE n = 2"); EndTransaction(SQL_COMMIT); return 1; } static int test_with_connect = 0; static int global_txn; static int hide_error; static void my_attrs(void) { CHKSetConnectAttr(SQL_ATTR_TXN_ISOLATION, TDS_INT2PTR(global_txn), 0, "S"); AutoCommit(SQL_AUTOCOMMIT_OFF); } static void ConnectWithTxn(int txn) { global_txn = txn; odbc_set_conn_attr = my_attrs; odbc_connect(); odbc_set_conn_attr = NULL; } static int Test(int txn, const char *expected) { int dirty, repeatable, phantom; char buf[128]; SWAP_CONN(); if (test_with_connect) { odbc_disconnect(); ConnectWithTxn(txn); CHKSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0, "S"); } else { CHKSetConnectAttr(SQL_ATTR_TXN_ISOLATION, TDS_INT2PTR(txn), 0, "S"); } SWAP_CONN(); dirty = CheckDirtyRead(); repeatable = CheckNonrepeatableRead(); phantom = CheckPhantom(); sprintf(buf, "dirty %d non repeatable %d phantom %d", dirty, repeatable, phantom); if (strcmp(buf, expected) != 0) { if (hide_error) { hide_error = 0; return 0; } fprintf(stderr, "detected wrong TXN\nexpected '%s' got '%s'\n", expected, buf); exit(1); } hide_error = 0; return 1; } int main(int argc, char *argv[]) { odbc_use_version3 = 1; odbc_connect(); /* Invalid argument value */ CHKSetConnectAttr(SQL_ATTR_TXN_ISOLATION, TDS_INT2PTR(SQL_TXN_REPEATABLE_READ | SQL_TXN_READ_COMMITTED), 0, "E"); ReadErrorConn(); if (strcmp(odbc_sqlstate, "HY024") != 0) { odbc_disconnect(); fprintf(stderr, "Unexpected success\n"); return 1; } /* here we can't use temporary table cause we use two connection */ odbc_command("IF OBJECT_ID('test_transaction') IS NOT NULL DROP TABLE test_transaction"); odbc_command("CREATE TABLE test_transaction(n NUMERIC(18,0) PRIMARY KEY, t VARCHAR(30))"); CHKSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0, "S"); AutoCommit(SQL_AUTOCOMMIT_OFF); odbc_command("INSERT INTO test_transaction(n, t) VALUES(1, 'initial')"); #ifdef ENABLE_DEVELOPING /* test setting with active transaction "Operation invalid at this time" */ CHKSetConnectAttr(SQL_ATTR_TXN_ISOLATION, TDS_INT2PTR(SQL_TXN_REPEATABLE_READ), 0, "E"); ReadErrorConn(); if (strcmp(odbc_sqlstate, "HY011") != 0) { odbc_disconnect(); fprintf(stderr, "Unexpected success\n"); return 1; } #endif EndTransaction(SQL_COMMIT); odbc_command("SELECT * FROM test_transaction"); /* test setting with pending data */ CHKSetConnectAttr(SQL_ATTR_TXN_ISOLATION, TDS_INT2PTR(SQL_TXN_REPEATABLE_READ), 0, "E"); ReadErrorConn(); if (strcmp(odbc_sqlstate, "HY011") != 0) { odbc_disconnect(); fprintf(stderr, "Unexpected success\n"); return 1; } SQLMoreResults(odbc_stmt); EndTransaction(SQL_COMMIT); /* save this connection and do another */ SWAP_CONN(); odbc_connect(); CHKSetStmtAttr(SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0, "S"); AutoCommit(SQL_AUTOCOMMIT_OFF); SWAP_CONN(); for (test_with_connect = 0; test_with_connect <= 1; ++test_with_connect) { Test(SQL_TXN_READ_UNCOMMITTED, "dirty 1 non repeatable 1 phantom 1"); Test(SQL_TXN_READ_COMMITTED, "dirty 0 non repeatable 1 phantom 1"); if (odbc_db_is_microsoft()) { Test(SQL_TXN_REPEATABLE_READ, "dirty 0 non repeatable 0 phantom 1"); } else { hide_error = 1; if (!Test(SQL_TXN_REPEATABLE_READ, "dirty 0 non repeatable 0 phantom 1")) Test(SQL_TXN_REPEATABLE_READ, "dirty 0 non repeatable 0 phantom 0"); } Test(SQL_TXN_SERIALIZABLE, "dirty 0 non repeatable 0 phantom 0"); } odbc_disconnect(); SWAP_CONN(); EndTransaction(SQL_COMMIT); /* Sybase do not accept DROP TABLE during a transaction */ AutoCommit(SQL_AUTOCOMMIT_ON); odbc_command("DROP TABLE test_transaction"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/transaction3.c000644 025423 025423 00000000500 14056414222 023112 0ustar00fredianofrediano000000 000000 #include "common.h" /* Test commit/rollback with auto commit set to on (the default) */ int main(void) { odbc_use_version3 = 1; odbc_connect(); CHKEndTran(SQL_HANDLE_DBC, odbc_conn, SQL_COMMIT, "S"); CHKEndTran(SQL_HANDLE_DBC, odbc_conn, SQL_ROLLBACK, "S"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/transaction4.c000644 025423 025423 00000003705 14056414222 023125 0ustar00fredianofrediano000000 000000 #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_SYS_WAIT_H #include #endif /* HAVE_SYS_WAIT_H */ #include /* Test for SQLEndTran */ static void ReadErrorConn(void) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR *err = (SQLTCHAR *) ODBC_GET(sizeof(odbc_err)*sizeof(SQLTCHAR)); SQLTCHAR *state = (SQLTCHAR *) ODBC_GET(sizeof(odbc_sqlstate)*sizeof(SQLTCHAR)); memset(odbc_err, 0, sizeof(odbc_err)); memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); CHKGetDiagRec(SQL_HANDLE_DBC, odbc_conn, 1, state, NULL, err, sizeof(odbc_err), NULL, "SI"); strcpy(odbc_err, C(err)); strcpy(odbc_sqlstate, C(state)); ODBC_FREE(); printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); } #ifdef _WIN32 #define SHUT_RDWR SD_BOTH #endif static int close_last_socket(void) { TDS_SYS_SOCKET max_socket = odbc_find_last_socket(); if (max_socket < 0) { fprintf(stderr, "Error finding last socket\n"); return 0; } /* close connection */ shutdown(max_socket, SHUT_RDWR); return 1; } int main(void) { odbc_use_version3 = 1; odbc_mark_sockets_opened(); odbc_connect(); CHKSetConnectAttr(SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_OFF, 0, "S"); odbc_command("SELECT 1"); CHKMoreResults("No"); if (!close_last_socket()) { fprintf(stderr, "Error closing connection\n"); return 1; } CHKEndTran(SQL_HANDLE_DBC, odbc_conn, SQL_ROLLBACK, "E"); /* the error should be written in the connection, not in the statement */ ReadErrorConn(); if (strcmp(odbc_sqlstate, "08S01") != 0 || strstr(odbc_err, "Write to the server") == NULL) { odbc_disconnect(); fprintf(stderr, "Unexpected error message %s %s\n", odbc_sqlstate, odbc_err); return 1; } odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/type.c000644 025423 025423 00000013113 14056414222 021467 0ustar00fredianofrediano000000 000000 #include "common.h" #include struct type { SQLSMALLINT type; const char *name; unsigned flags; }; #define FLAG_C 1 #define FLAG_SQL 2 #define TYPE_C(s) {s, #s, FLAG_C } #define TYPE_SQL(s) {s, #s, FLAG_SQL } #define TYPE_BOTH(s,s2) {s, #s, FLAG_SQL|FLAG_C } /* * Same define with test for constants * #define TYPE_BOTH(s,s2) {s, #s, (FLAG_SQL|FLAG_C)+((1/!(s-s2))-1) } */ static const struct type types[] = { TYPE_BOTH(SQL_C_CHAR, SQL_CHAR), TYPE_BOTH(SQL_C_LONG, SQL_INTEGER), TYPE_BOTH(SQL_C_SHORT, SQL_SMALLINT), TYPE_BOTH(SQL_C_FLOAT, SQL_REAL), TYPE_BOTH(SQL_C_DOUBLE, SQL_DOUBLE), TYPE_BOTH(SQL_C_NUMERIC, SQL_NUMERIC), TYPE_C(SQL_C_DEFAULT), TYPE_C(SQL_C_DATE), TYPE_C(SQL_C_TIME), /* MS ODBC do not support SQL_TIMESTAMP for IPD type while we support it */ /* TYPE_C(SQL_C_TIMESTAMP), */ TYPE_BOTH(SQL_C_TIMESTAMP, SQL_TIMESTAMP), TYPE_BOTH(SQL_C_TYPE_DATE, SQL_TYPE_DATE), TYPE_BOTH(SQL_C_TYPE_TIME, SQL_TYPE_TIME), TYPE_BOTH(SQL_C_TYPE_TIMESTAMP, SQL_TYPE_TIMESTAMP), TYPE_C(SQL_C_INTERVAL_YEAR), TYPE_C(SQL_C_INTERVAL_MONTH), TYPE_C(SQL_C_INTERVAL_DAY), TYPE_C(SQL_C_INTERVAL_HOUR), TYPE_C(SQL_C_INTERVAL_MINUTE), TYPE_C(SQL_C_INTERVAL_SECOND), TYPE_C(SQL_C_INTERVAL_YEAR_TO_MONTH), TYPE_C(SQL_C_INTERVAL_DAY_TO_HOUR), TYPE_C(SQL_C_INTERVAL_DAY_TO_MINUTE), TYPE_C(SQL_C_INTERVAL_DAY_TO_SECOND), TYPE_C(SQL_C_INTERVAL_HOUR_TO_MINUTE), TYPE_C(SQL_C_INTERVAL_HOUR_TO_SECOND), TYPE_C(SQL_C_INTERVAL_MINUTE_TO_SECOND), TYPE_BOTH(SQL_C_BINARY, SQL_BINARY), TYPE_BOTH(SQL_C_BIT, SQL_BIT), TYPE_C(SQL_C_SBIGINT), TYPE_C(SQL_C_UBIGINT), TYPE_BOTH(SQL_C_TINYINT, SQL_TINYINT), TYPE_C(SQL_C_SLONG), TYPE_C(SQL_C_SSHORT), TYPE_C(SQL_C_STINYINT), TYPE_C(SQL_C_ULONG), TYPE_C(SQL_C_USHORT), TYPE_C(SQL_C_UTINYINT), TYPE_BOTH(SQL_C_GUID, SQL_GUID), TYPE_SQL(SQL_BIGINT), TYPE_SQL(SQL_VARBINARY), TYPE_SQL(SQL_LONGVARBINARY), TYPE_SQL(SQL_VARCHAR), TYPE_SQL(SQL_LONGVARCHAR), TYPE_SQL(SQL_DECIMAL), TYPE_SQL(SQL_FLOAT), {0, NULL} }; static const char * get_type_name(SQLSMALLINT type) { const struct type *p = types; for (; p->name; ++p) if (p->type == type) return p->name; return "(unknown)"; } static int result = 0; static void check_msg(int check, const char *msg) { if (check) return; fprintf(stderr, "Check failed: %s\n", msg); result = 1; } int main(int argc, char **argv) { const struct type *p; char buf[16]; SQLINTEGER ind; SQLLEN lind; SQLHDESC desc; odbc_connect(); /* * test setting two time a descriptor * success all user allocated are ARD or APD so type cheching can be done * TODO freeing descriptor dissociate it from statements */ /* test C types */ for (p = types; p->name; ++p) { if (SQL_SUCCEEDED (SQLBindParameter(odbc_stmt, 1, SQL_PARAM_INPUT, p->type, SQL_VARCHAR, (SQLUINTEGER) (-1), 0, buf, 16, &lind))) { SQLSMALLINT concise_type, type, code; SQLHDESC desc; concise_type = type = code = 0; /* get APD */ SQLGetStmtAttr(odbc_stmt, SQL_ATTR_APP_PARAM_DESC, &desc, sizeof(desc), &ind); SQLGetDescField(desc, 1, SQL_DESC_TYPE, &type, sizeof(SQLSMALLINT), &ind); SQLGetDescField(desc, 1, SQL_DESC_CONCISE_TYPE, &concise_type, sizeof(SQLSMALLINT), &ind); SQLGetDescField(desc, 1, SQL_DESC_DATETIME_INTERVAL_CODE, &code, sizeof(SQLSMALLINT), &ind); printf("Setted type %s -> [%d (%s), %d (%s), %d]\n", p->name, (int) concise_type, get_type_name(concise_type), (int) type, get_type_name(type), code); check_msg(p->flags & FLAG_C, "Type not C successed to be set in APD"); } else { SQLSMALLINT concise_type, type, code; SQLHDESC desc; concise_type = type = code = 0; fprintf(stderr, "Error setting type %d (%s)\n", (int) p->type, p->name); concise_type = p->type; SQLGetStmtAttr(odbc_stmt, SQL_ATTR_APP_PARAM_DESC, &desc, sizeof(desc), &ind); if (SQL_SUCCEEDED (SQLSetDescField(desc, 1, SQL_DESC_CONCISE_TYPE, TDS_INT2PTR(concise_type), sizeof(SQLSMALLINT)))) { SQLGetDescField(desc, 1, SQL_DESC_TYPE, &type, sizeof(SQLSMALLINT), &ind); SQLGetDescField(desc, 1, SQL_DESC_CONCISE_TYPE, &concise_type, sizeof(SQLSMALLINT), &ind); SQLGetDescField(desc, 1, SQL_DESC_DATETIME_INTERVAL_CODE, &code, sizeof(SQLSMALLINT), &ind); printf("Setted type %s -> [%d (%s), %d (%s), %d]\n", p->name, (int) concise_type, get_type_name(concise_type), (int) type, get_type_name(type), code); check_msg(p->flags & FLAG_C, "Type not C successed to be set in APD"); } else { check_msg(!(p->flags & FLAG_C), "Type C failed to be set in APD"); } } } printf("\n\n"); /* test SQL types */ SQLGetStmtAttr(odbc_stmt, SQL_ATTR_IMP_PARAM_DESC, &desc, sizeof(desc), &ind); for (p = types; p->name; ++p) { SQLSMALLINT concise_type = p->type; if (SQL_SUCCEEDED (SQLSetDescField(desc, 1, SQL_DESC_CONCISE_TYPE, TDS_INT2PTR(concise_type), sizeof(SQLSMALLINT)))) { SQLSMALLINT concise_type, type, code; concise_type = type = code = 0; SQLGetDescField(desc, 1, SQL_DESC_TYPE, &type, sizeof(SQLSMALLINT), &ind); SQLGetDescField(desc, 1, SQL_DESC_CONCISE_TYPE, &concise_type, sizeof(SQLSMALLINT), &ind); SQLGetDescField(desc, 1, SQL_DESC_DATETIME_INTERVAL_CODE, &code, sizeof(SQLSMALLINT), &ind); printf("Setted type %s -> [%d (%s), %d (%s), %d]\n", p->name, (int) concise_type, get_type_name(concise_type), (int) type, get_type_name(type), code); check_msg(p->flags & FLAG_SQL, "Type not SQL successed to be set in IPD"); } else { fprintf(stderr, "Error setting type %d (%s)\n", (int) p->type, p->name); check_msg(!(p->flags & FLAG_SQL), "Type SQL failed to be set in IPD"); } } odbc_disconnect(); return result; } freetds-1.3.6/src/odbc/unittests/typeinfo.c000644 025423 025423 00000013224 14056414222 022346 0ustar00fredianofrediano000000 000000 #include "common.h" static void TestName(int index, const char *expected_name) { ODBC_BUF *odbc_buf = NULL; SQLTCHAR name[128]; char buf[256]; SQLSMALLINT len, type; #define NAME_TEST \ do { \ if (strcmp(C(name), expected_name) != 0) \ { \ sprintf(buf, "wrong name in column %d expected '%s' got '%s'", index, expected_name, C(name)); \ ODBC_REPORT_ERROR(buf); \ } \ } while(0) /* retrieve with SQLDescribeCol */ CHKDescribeCol(index, name, TDS_VECTOR_SIZE(name), &len, &type, NULL, NULL, NULL, "S"); NAME_TEST; /* retrieve with SQLColAttribute */ CHKColAttribute(index, SQL_DESC_NAME, name, sizeof(name), &len, NULL, "S"); if (odbc_db_is_microsoft()) NAME_TEST; CHKColAttribute(index, SQL_DESC_LABEL, name, sizeof(name), &len, NULL, "S"); NAME_TEST; ODBC_FREE(); } static void Flushodbc_stmt(void) { while (CHKFetch("SNo") == SQL_SUCCESS) ; /* Sybase store procedure seems to return extra empty results */ while (CHKMoreResults("SNo") == SQL_SUCCESS) ; } static void CheckType(SQLSMALLINT type, SQLSMALLINT expected, const char *string_type, int line) { SQLSMALLINT out_type; SQLLEN ind; SQLRETURN RetCode; printf("CheckType %d\n", line); CHKBindCol(2, SQL_C_SSHORT, &out_type, 0, &ind, "SI"); CHKGetTypeInfo(type, "SI"); RetCode = CHKFetch("SNo"); switch (RetCode) { case SQL_SUCCESS: if (expected == SQL_UNKNOWN_TYPE) { fprintf(stderr, "Data not expected (type %d - %s) line %d\n", type, string_type, line); odbc_disconnect(); exit(1); } if (expected != out_type) { fprintf(stderr, "Got type %d expected %d. Input type %d - %s line %d\n", out_type, expected, type, string_type, line); odbc_disconnect(); exit(1); } break; case SQL_NO_DATA: if (expected != SQL_UNKNOWN_TYPE) { fprintf(stderr, "Data expected. Input type %d - %s line %d\n", type, string_type, line); odbc_disconnect(); exit(1); } break; } SQLFreeStmt(odbc_stmt, SQL_UNBIND); Flushodbc_stmt(); } static void DoTest(int version3) { char name[128], params[128]; SQLSMALLINT type, is_unsigned; SQLINTEGER col_size, min_scale; SQLLEN ind1, ind2, ind3, ind4, ind5, ind6; int date_time_supported = 0; int name_version3; int tdsver; odbc_use_version3 = version3; name_version3 = version3; odbc_connect(); printf("Using ODBC version %d\n", version3 ? 3 : 2); tdsver = odbc_tds_version(); /* test column name */ /* MS ODBC use always ODBC 3 names even in ODBC 2 mode */ if (!odbc_driver_is_freetds()) name_version3 = 1; CHKGetTypeInfo(SQL_ALL_TYPES, "SI"); TestName(1, "TYPE_NAME"); TestName(2, "DATA_TYPE"); TestName(3, name_version3 ? "COLUMN_SIZE" : "PRECISION"); TestName(4, "LITERAL_PREFIX"); TestName(5, "LITERAL_SUFFIX"); TestName(6, "CREATE_PARAMS"); TestName(7, "NULLABLE"); TestName(8, "CASE_SENSITIVE"); TestName(9, "SEARCHABLE"); TestName(10, "UNSIGNED_ATTRIBUTE"); TestName(11, name_version3 ? "FIXED_PREC_SCALE" : "MONEY"); TestName(12, name_version3 ? "AUTO_UNIQUE_VALUE" : "AUTO_INCREMENT"); TestName(13, "LOCAL_TYPE_NAME"); TestName(14, "MINIMUM_SCALE"); TestName(15, "MAXIMUM_SCALE"); /* TODO test these column for ODBC 3 */ /* ODBC 3.0 SQL_DATA_TYPE SQL_DATETIME_SUB NUM_PREC_RADIX INTERVAL_PRECISION */ Flushodbc_stmt(); /* TODO test if SQL_ALL_TYPES returns right numeric type for timestamp */ /* numeric type for data */ /* test for date/time support */ if (odbc_command_with_result(odbc_stmt, "select cast(getdate() as date)") == SQL_SUCCESS) date_time_supported = 1; if (odbc_db_is_microsoft() && tdsver < 0x703) date_time_supported = 0; SQLCloseCursor(odbc_stmt); #define CHECK_TYPE(in,out) CheckType(in, out, #in, __LINE__) /* under Sybase this type require extra handling, check it */ CHECK_TYPE(SQL_VARCHAR, SQL_VARCHAR); if (version3) { /* MS ODBC returns S1004 (HY004), TODO support it */ CHECK_TYPE(SQL_TYPE_DATE, date_time_supported ? SQL_TYPE_DATE : SQL_UNKNOWN_TYPE); if (!odbc_db_is_microsoft()) CHECK_TYPE(SQL_TYPE_TIME, date_time_supported ? SQL_TYPE_TIME : SQL_UNKNOWN_TYPE); /* MS ODBC returns S1004 (HY004), TODO support it */ CHECK_TYPE(SQL_TYPE_TIMESTAMP, SQL_TYPE_TIMESTAMP); } else { CHECK_TYPE(SQL_DATE, date_time_supported ? SQL_DATE : SQL_UNKNOWN_TYPE); if (!odbc_db_is_microsoft()) CHECK_TYPE(SQL_TIME, date_time_supported ? SQL_TIME : SQL_UNKNOWN_TYPE); /* TODO MS ODBC handle SQL_TIMESTAMP even for ODBC 3 */ CHECK_TYPE(SQL_TIMESTAMP, SQL_TIMESTAMP); } /* TODO implement this part of test */ /* varchar/nvarchar before sysname */ /* test binding (not all column, required for Oracle) */ CHKGetTypeInfo(SQL_ALL_TYPES, "SI"); CHKBindCol(1, SQL_C_CHAR, name, sizeof(name), &ind1, "SI"); CHKBindCol(2, SQL_C_SSHORT, &type, 0, &ind2, "SI"); CHKBindCol(3, SQL_C_SLONG, &col_size, 0, &ind3, "SI"); CHKBindCol(6, SQL_C_CHAR, params, sizeof(params), &ind4, "SI"); CHKBindCol(10, SQL_C_SSHORT, &is_unsigned, 0, &ind5, "SI"); CHKBindCol(14, SQL_C_SSHORT, &min_scale, 0, &ind6, "SI"); while (CHKFetch("SNo") == SQL_SUCCESS) ; SQLFreeStmt(odbc_stmt, SQL_UNBIND); Flushodbc_stmt(); /* check WVARCHAR for no pending data */ if (odbc_db_is_microsoft() || strncmp(odbc_db_version(), "15.00.", 6) >= 0) { CHKGetTypeInfo(SQL_WVARCHAR, "SI"); CHKFetch("S"); /* mssql returns SYSNAME as NVARCHAR */ if (odbc_db_is_microsoft()) CHKFetch("S"); /* mssql 2008 can return a lot of NVARCHAR as new type (ie DATE) * are converted automatically to NVARCHAR with former protocol */ if (!odbc_db_is_microsoft() || tdsver >= 0x703 || odbc_db_version_int() < 0x0a000000) CHKFetch("No"); CHKMoreResults("No"); CHKGetTypeInfo(SQL_BINARY, "SI"); } odbc_disconnect(); } int main(int argc, char *argv[]) { DoTest(0); DoTest(1); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/utf8.c000644 025423 025423 00000007213 14056414222 021400 0ustar00fredianofrediano000000 000000 #include "common.h" /* test binding with UTF-8 encoding */ #ifndef _WIN32 /* test table name, it contains two japanese characters */ static const char table_name[] = "mytab\xe7\x8e\x8b\xe9\xb4\xbb"; static const char * const strings[] = { /* ascii */ "aaa", "aaa", /* latin 1*/ "abc\xc3\xa9\xc3\xa1\xc3\xb4", "abc\xc3\xa9\xc3\xae\xc3\xb4", /* Japanese... */ "abc\xe7\x8e\x8b\xe9\xb4\xbb", "abc\xe7\x8e\x8b\xe9\xb4\xbb\xe5\x82\x91\xe7\x8e\x8b\xe9\xb4\xbb\xe5\x82\x91", NULL, NULL }; /* same strings in hex */ static const char * const strings_hex[] = { /* ascii */ "0x610061006100", "0x610061006100", /* latin 1*/ "0x610062006300e900e100f400", "0x610062006300e900ee00f400", /* Japanese... */ "0x6100620063008b733b9d", "0x6100620063008b733b9d91508b733b9d9150", NULL, NULL }; static char tmp[1024*3]; static void TestBinding(int minimun) { const char * const*p; SQLINTEGER n; SQLLEN n_len; sprintf(tmp, "DELETE FROM %s", table_name); odbc_command(tmp); /* insert with SQLPrepare/SQLBindParameter/SQLExecute */ sprintf(tmp, "INSERT INTO %s VALUES(?,?,?)", table_name); CHKPrepare(T(tmp), SQL_NTS, "S"); CHKBindParameter(1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &n, 0, &n_len, "S"); n_len = sizeof(n); for (n = 1, p = strings; p[0] && p[1]; p += 2, ++n) { SQLLEN s1_len, s2_len; unsigned int len; len = minimun ? (strlen(strings_hex[p-strings]) - 2) /4 : 40; CHKBindParameter(2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_WCHAR, len, 0, (void *) p[0], 0, &s1_len, "S"); len = minimun ? (strlen(strings_hex[p+1-strings]) - 2) /4 : 40; /* FIXME this with SQL_VARCHAR produce wrong protocol data */ CHKBindParameter(3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_WVARCHAR, len, 0, (void *) p[1], 0, &s2_len, "S"); s1_len = strlen(p[0]); s2_len = strlen(p[1]); printf("insert #%d\n", (int) n); CHKExecute("S"); } /* check rows */ for (n = 1, p = strings_hex; p[0] && p[1]; p += 2, ++n) { sprintf(tmp, "IF NOT EXISTS(SELECT * FROM %s WHERE k = %d AND c = %s AND vc = %s) SELECT 1", table_name, (int) n, p[0], p[1]); odbc_check_no_row(tmp); } odbc_reset_statement(); } int main(int argc, char *argv[]) { const char * const*p; SQLINTEGER n; odbc_use_version3 = 1; odbc_conn_additional_params = "ClientCharset=UTF-8;"; odbc_connect(); if (!odbc_driver_is_freetds()) { odbc_disconnect(); printf("Driver is not FreeTDS, exiting\n"); odbc_test_skipped(); return 0; } if (!odbc_db_is_microsoft() || odbc_db_version_int() < 0x08000000u) { odbc_disconnect(); printf("Test for MSSQL only\n"); odbc_test_skipped(); return 0; } CHKAllocStmt(&odbc_stmt, "S"); /* create test table */ sprintf(tmp, "IF OBJECT_ID(N'%s') IS NOT NULL DROP TABLE %s", table_name, table_name); odbc_command(tmp); sprintf(tmp, "CREATE TABLE %s (k int, c NCHAR(10), vc NVARCHAR(10))", table_name); odbc_command(tmp); /* insert with INSERT statements */ for (n = 1, p = strings; p[0] && p[1]; p += 2, ++n) { sprintf(tmp, "INSERT INTO %s VALUES (%d,N'%s',N'%s')", table_name, (int) n, p[0], p[1]); odbc_command(tmp); } /* check rows */ for (n = 1, p = strings_hex; p[0] && p[1]; p += 2, ++n) { sprintf(tmp, "IF NOT EXISTS(SELECT * FROM %s WHERE k = %d AND c = %s AND vc = %s) SELECT 1", table_name, (int) n, p[0], p[1]); odbc_check_no_row(tmp); } TestBinding(0); TestBinding(1); /* cleanup */ sprintf(tmp, "IF OBJECT_ID(N'%s') IS NOT NULL DROP TABLE %s", table_name, table_name); odbc_command(tmp); odbc_disconnect(); printf("Done.\n"); return 0; } #else int main(void) { /* on Windows SQLExecDirect is always converted to SQLExecDirectW by the DM */ printf("Not possible for this platform.\n"); odbc_test_skipped(); return 0; } #endif freetds-1.3.6/src/odbc/unittests/utf8_2.c000644 025423 025423 00000005045 14056414222 021622 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* test conversion of Hebrew characters (which have shift sequences) */ static const char * const column_names[] = { "hebrew", "cn" }; typedef struct { /* number of column */ int num; /* hex representation, used during insert */ const char *hex; /* output */ const char *out; } column_t; static const column_t columns[] = { { 0, "0xde05d905d305e205", "\xd7\x9e\xd7\x99\xd7\x93\xd7\xa2" }, { 0, "0x69006e0066006f00", "info", }, { 0, "0xd805e705e105d805", "\xd7\x98\xd7\xa7\xd7\xa1\xd7\x98", }, { 0, "0xd005d105db05", "\xd7\x90\xd7\x91\xd7\x9b", }, { 1, "0xf78b7353d153278d3a00228c228c56e02000", "\xe8\xaf\xb7\xe5\x8d\xb3\xe5\x8f\x91\xe8\xb4\xa7\x3a\xe8\xb0\xa2\xe8\xb0\xa2\xee\x81\x96\x20", }, { 0, NULL, NULL }, }; int main(int argc, char *argv[]) { char tmp[1024]; char out[TDS_VECTOR_SIZE(column_names)][32]; SQLLEN n_len[TDS_VECTOR_SIZE(column_names)]; const column_t *p; int n; odbc_use_version3 = 1; odbc_conn_additional_params = "ClientCharset=UTF-8;"; odbc_connect(); if (!odbc_driver_is_freetds()) { odbc_disconnect(); printf("Driver is not FreeTDS, exiting\n"); odbc_test_skipped(); return 0; } if (!odbc_db_is_microsoft() || odbc_db_version_int() < 0x08000000u || odbc_tds_version() < 0x701) { odbc_disconnect(); /* protocol till 7.1 does not support telling encoding so we * cannot understand how the string is encoded */ printf("Test for MSSQL only using protocol 7.1\n"); odbc_test_skipped(); return 0; } CHKAllocStmt(&odbc_stmt, "S"); /* create test table */ odbc_command("CREATE TABLE #tmp (i INT" ", hebrew VARCHAR(20) COLLATE Hebrew_CI_AI NULL" ", cn VARCHAR(20) COLLATE Chinese_PRC_CI_AS NULL" ")"); /* insert with INSERT statements */ for (n = 0, p = columns; p[n].hex; ++n) { sprintf(tmp, "INSERT INTO #tmp(i, %s) VALUES(%d, CAST(%s AS NVARCHAR(20)))", column_names[p[n].num], n+1, p[n].hex); odbc_command(tmp); } /* test conversions in libTDS */ odbc_command("SELECT hebrew, cn FROM #tmp ORDER BY i"); /* insert with SQLPrepare/SQLBindParameter/SQLExecute */ for (n = 0; n < TDS_VECTOR_SIZE(column_names); ++n) CHKBindCol(n+1, SQL_C_CHAR, out[n], sizeof(out[0]), &n_len[n], "S"); for (n = 0, p = columns; p[n].hex; ++n) { memset(out, 0, sizeof(out)); CHKFetch("S"); if (n_len[p[n].num] != strlen(p[n].out) || strcmp(p[n].out, out[p[n].num]) != 0) { fprintf(stderr, "Wrong row %d %s\n", n+1, out[p[n].num]); odbc_disconnect(); return 1; } } odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/utf8_3.c000644 025423 025423 00000004265 14056414222 021626 0ustar00fredianofrediano000000 000000 #include "common.h" #include /* test conversion using SQLGetData */ int main(int argc, char *argv[]) { SQLLEN len; unsigned char buf[30]; static const char expected[] = "\xf0\x9f\x8e\x84"; int i; odbc_use_version3 = 1; odbc_conn_additional_params = "ClientCharset=UTF-8;"; odbc_connect(); if (!odbc_driver_is_freetds()) { odbc_disconnect(); printf("Driver is not FreeTDS, exiting\n"); odbc_test_skipped(); return 0; } if (!odbc_db_is_microsoft() || odbc_tds_version() < 0x700) { odbc_disconnect(); /* we need NVARCHAR */ printf("Test for MSSQL only using protocol 7.0\n"); odbc_test_skipped(); return 0; } CHKAllocStmt(&odbc_stmt, "S"); /* a Christmas tree */ odbc_command("SELECT CONVERT(NVARCHAR(10), CONVERT(VARBINARY(20), 0x3CD884DF))"); CHKFetch("S"); /* read one byte at a time and test it */ for (i = 0; i < 4; ++i) { memset(buf, '-', sizeof(buf)); CHKGetData(1, SQL_C_CHAR, buf, 2, &len, i < 3 ? "I" : "S"); printf("res %ld buf { 0x%02x, 0x%02x }\n", (long int) len, buf[0], buf[1]); assert(len == SQL_NO_TOTAL || len == 4 - i); assert(buf[0] == (unsigned char) expected[i]); assert(buf[1] == 0); } CHKGetData(1, SQL_C_CHAR, buf, 2, &len, "No"); odbc_reset_statement(); #define CN_STRING \ "202020202052656974657261746520486f6c642028324829207261a174696e6720a15820" \ "a14ea16fa172a173a174a161a172a1207265706f72746564206120736574206f6620756e" \ "6578636974696e6720726573756c74732077697468206d6f646573742067726f77746820" \ "696e20726576656e756520616e6420626f74746f6d206c696e652e20457870616e73696f" \ "6e20696e746f2074686520646f6d6573" /* insert does not change as much as CONVERT so insert first into a new table */ odbc_command("CREATE TABLE #tmp1(c VARCHAR(200) COLLATE Chinese_PRC_CI_AS NULL)"); odbc_command("INSERT INTO #tmp1 VALUES(CONVERT(VARBINARY(200), 0x" CN_STRING "))"); odbc_command("SELECT c FROM #tmp1"); CHKFetch("S"); for (i = 0; i < 5; ++i) { memset(buf, 0, sizeof(buf)); CHKGetData(1, SQL_C_CHAR, buf, sizeof(buf), &len, "I"); printf("loop %d output '%s'\n", i, buf); assert(strlen((char *) buf) == sizeof(buf) - 1); } CHKGetData(1, SQL_C_CHAR, buf, sizeof(buf), &len, "S"); odbc_disconnect(); return 0; } freetds-1.3.6/src/odbc/unittests/utf8_4.c000644 025423 025423 00000005312 14056414222 021621 0ustar00fredianofrediano000000 000000 #undef NDEBUG #include "common.h" #include #include #include /* test some internal funcions */ #ifdef _WIN32 HINSTANCE hinstFreeTDS; #endif #ifdef ENABLE_ODBC_WIDE static void wide_test(const WCHAR* input, size_t input_len, const char *exp, int line) { DSTR s = DSTR_INITIALIZER; SQLWCHAR outbuf[16]; SQLINTEGER outlen; odbc_dstr_copy_flag((TDS_DBC *) odbc_conn, &s, (int) input_len, (ODBC_CHAR*) input, 1); if (strlen(exp) != tds_dstr_len(&s) || strcmp(exp, tds_dstr_cstr(&s)) != 0) { fprintf(stderr, "%d: Wrong, len %u: %s\n", line, (unsigned) tds_dstr_len(&s), tds_dstr_cstr(&s)); exit(1); } outlen = -1; odbc_set_string_flag((TDS_DBC *) odbc_conn, outbuf, TDS_VECTOR_SIZE(outbuf), &outlen, tds_dstr_cstr(&s), (int) tds_dstr_len(&s), 0x11); if (outlen < 0 || outlen !=input_len || memcmp(outbuf, input, input_len * sizeof(input[0])) != 0) { fprintf(stderr, "%d: out_len %u %x %x %x\n", line, outlen, outbuf[0], outbuf[1], outbuf[2]); exit(1); } tds_dstr_free(&s); } #endif int main(int argc, char *argv[]) { #ifdef ENABLE_ODBC_WIDE DSTR s = DSTR_INITIALIZER; #ifdef _WIN32 hinstFreeTDS = GetModuleHandle(NULL); #endif /* just allocate handles, we don't need to connect */ CHKAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &odbc_env, "S"); SQLSetEnvAttr(odbc_env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (SQL_OV_ODBC3), SQL_IS_UINTEGER); CHKAllocHandle(SQL_HANDLE_DBC, odbc_env, &odbc_conn, "S"); /* check is FreeTDS, if not just return */ if (!odbc_driver_is_freetds()) { odbc_disconnect(); return 0; } odbc_dstr_copy_flag((TDS_DBC *) odbc_conn, &s, 3, (ODBC_CHAR*) "foo", 0); assert(strcmp("foo", tds_dstr_cstr(&s)) == 0); #define WIDE_TEST(chars, exp) do { \ static const SQLWCHAR input[] = chars; \ wide_test(input, TDS_VECTOR_SIZE(input), exp, __LINE__); \ } while(0) #define SEP , WIDE_TEST({ 'f' SEP 'o' SEP 'o' }, "foo"); WIDE_TEST({ 0x41 }, "A"); WIDE_TEST({ 0xA1 }, "\xc2\xA1"); WIDE_TEST({ 0x81 }, "\xc2\x81"); WIDE_TEST({ 0x101 }, "\xc4\x81"); WIDE_TEST({ 0x201 }, "\xc8\x81"); WIDE_TEST({ 0x401 }, "\xd0\x81"); WIDE_TEST({ 0x801 }, "\xe0\xa0\x81"); WIDE_TEST({ 0x1001 }, "\xe1\x80\x81"); WIDE_TEST({ 0x2001 }, "\xe2\x80\x81"); WIDE_TEST({ 0x4001 }, "\xe4\x80\x81"); WIDE_TEST({ 0x8001 }, "\xe8\x80\x81"); #if SIZEOF_SQLWCHAR == 2 WIDE_TEST({ 0xd800 SEP 0xdc01 }, "\xf0\x90\x80\x81"); WIDE_TEST({ 0xd800 SEP 0xdd01 }, "\xf0\x90\x84\x81"); WIDE_TEST({ 0xd840 SEP 0xdd01 }, "\xf0\xa0\x84\x81"); WIDE_TEST({ 0xd8c0 SEP 0xdd01 }, "\xf1\x80\x84\x81"); WIDE_TEST({ 0xd9c0 SEP 0xdd01 }, "\xf2\x80\x84\x81"); #else WIDE_TEST({ 0x10001 }, "\xf0\x90\x80\x81"); #endif tds_dstr_free(&s); odbc_disconnect(); #endif return 0; } freetds-1.3.6/src/odbc/unittests/warning.c000644 025423 025423 00000003640 14056414222 022157 0ustar00fredianofrediano000000 000000 #include "common.h" /* * Test originally written by John K. Hohm * (cfr "Warning return as copy of last result row (was: Warning: Null value * is eliminated by an aggregate or other SET operation.)" July 15th 2006) * * Contains also similar test by Jeff Dahl * (cfr "Warning: Null value is eliminated by an aggregate or other SET * operation." March 24th 2006 * * This test wrong SQLFetch results with warning inside select * Is different from raiserror test cause in raiserror error is not * inside recordset * Sybase do not return warning but test works the same */ static char software_version[] = "$Id: warning.c,v 1.11 2011-07-12 10:16:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static const char one_null_with_warning[] = "select max(a) as foo from (select convert(int, null) as a) as test"; #ifdef TDS_NO_DM static const int tds_no_dm = 1; #else static const int tds_no_dm = 0; #endif static void Test(const char *query) { CHKPrepare(T(query), SQL_NTS, "S"); CHKExecute("S"); CHKFetch("SI"); CHKFetch("No"); /* * Microsoft SQL Server 2000 provides a diagnostic record * associated with the second SQLFetch (which returns * SQL_NO_DATA) saying "Warning: Null value is eliminated by * an aggregate or other SET operation." * We check for "NO DM" cause unixODBC till 2.2.11 do not read * errors on SQL_NO_DATA */ if (odbc_db_is_microsoft() && tds_no_dm) { SQLTCHAR output[256]; CHKGetDiagRec(SQL_HANDLE_STMT, odbc_stmt, 1, NULL, NULL, output, TDS_VECTOR_SIZE(output), NULL, "SI"); printf("Message: %s\n", C(output)); } odbc_reset_statement(); } int main(void) { odbc_connect(); odbc_command("CREATE TABLE #warning(name varchar(20), value int null)"); odbc_command("INSERT INTO #warning VALUES('a', NULL)"); Test(one_null_with_warning); Test("SELECT SUM(value) FROM #warning"); odbc_disconnect(); printf("Done.\n"); return 0; } freetds-1.3.6/src/odbc/unittests/wchar.c000644 025423 025423 00000001327 14056414222 021616 0ustar00fredianofrediano000000 000000 #include "common.h" /* test SQL_C_DEFAULT with NCHAR type */ int main(int argc, char *argv[]) { char buf[102]; SQLLEN ind; int failed = 0; odbc_use_version3 = 1; odbc_connect(); CHKBindCol(1, SQL_C_DEFAULT, buf, 100, &ind, "S"); odbc_command("SELECT CONVERT(NCHAR(10), 'Pippo 123')"); /* get data */ memset(buf, 0, sizeof(buf)); CHKFetch("S"); SQLMoreResults(odbc_stmt); SQLMoreResults(odbc_stmt); odbc_disconnect(); /* the second string could came from Sybase configured with UTF-8 */ if (strcmp(buf, "Pippo 123 ") != 0 && (odbc_db_is_microsoft() || strcmp(buf, "Pippo 123 ") != 0)) { fprintf(stderr, "Wrong results '%s'\n", buf); failed = 1; } return failed ? 1 : 0; } freetds-1.3.6/src/odbc/unittests/CMakeLists.txt000644 025423 025423 00000003336 14056414271 023114 0ustar00fredianofrediano000000 000000 include_directories(..) set(tests t0001 t0002 t0003 moreresults connect print date norowset funccall lang_error tables binary_test moreandcount earlybind putdata params raiserror getdata transaction type genparams preperror prepare_results testodbc data error rebindpar rpc convert_error typeinfo const_params insert_speed compute timeout array array_out cursor1 scroll cursor2 describecol copydesc prepclose warning paramcore timeout2 timeout3 connect2 timeout4 freeclose cursor3 cursor4 cursor5 attributes hidden blob1 cancel wchar rowset transaction2 cursor6 cursor7 utf8 utf8_2 stats descrec peter test64 prepare_warn long_error mars1 array_error closestmt bcp all_types utf8_3 empty_query transaction3 transaction4 utf8_4 qn ) if(WIN32) set(libs odbc32 ${lib_ODBCINST}) else() set(libs tdsodbc ${lib_ODBCINST}) endif() add_library(o_common STATIC common.c common.h c2string.c parser.c parser.h) set(static_tests all_types utf8_4) set(unicode_tests utf8 oldpwd) foreach(target ${tests}) add_executable(o_${target} EXCLUDE_FROM_ALL ${target}.c) set_target_properties(o_${target} PROPERTIES OUTPUT_NAME ${target}) if (target IN_LIST static_tests) target_link_libraries(o_${target} o_common tdsodbc_static t_common tds replacements tdsutils ${lib_ODBCINST} ${lib_NETWORK} ${lib_BASE}) else() target_link_libraries(o_${target} o_common replacements tdsutils ${libs} ${lib_NETWORK} ${lib_BASE}) endif() if (ENABLE_ODBC_WIDE AND NOT target IN_LIST unicode_tests) set_property(TARGET o_${target} APPEND PROPERTY COMPILE_DEFINITIONS UNICODE=1 _UNICODE=1_) endif() add_test(NAME o_${target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND o_${target}) add_dependencies(check o_${target}) endforeach(target) freetds-1.3.6/src/dblib/Makefile.am000644 025423 025423 00000001237 14056414221 020504 0ustar00fredianofrediano000000 000000 SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include lib_LTLIBRARIES = libsybdb.la libsybdb_la_SOURCES= dblib.c dbutil.c rpc.c bcp.c xact.c dbpivot.c if SYBASE_COMPAT libsybdb_la_SOURCES += dbopen.c endif if MINGW32 libsybdb_la_SOURCES += winmain.c endif EXTRA_DIST = dbopen.c buffering.h CMakeLists.txt winmain.c dblib.def # bumped for dbanydatecrack libsybdb_la_LDFLAGS= -version-info 6:0:1 $(FREETDS_SYMBOLIC) if !MACOSX libsybdb_la_LDFLAGS += -export-symbols-regex '^(db|bcp_|tdsdump_open|tdsdbopen|.*_xact|close_commit|open_commit|.?asprintf).*' endif libsybdb_la_LIBADD= ../tds/libtds.la ../replacements/libreplacements.la $(LTLIBICONV) $(FREETDS_LIBGCC) freetds-1.3.6/src/dblib/Makefile.in000644 025423 025423 00000071464 14162303356 020532 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @SYBASE_COMPAT_TRUE@am__append_1 = dbopen.c @MINGW32_TRUE@am__append_2 = winmain.c @MACOSX_FALSE@am__append_3 = -export-symbols-regex '^(db|bcp_|tdsdump_open|tdsdbopen|.*_xact|close_commit|open_commit|.?asprintf).*' subdir = src/dblib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libsybdb_la_DEPENDENCIES = ../tds/libtds.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__libsybdb_la_SOURCES_DIST = dblib.c dbutil.c rpc.c bcp.c xact.c \ dbpivot.c dbopen.c winmain.c @SYBASE_COMPAT_TRUE@am__objects_1 = dbopen.lo @MINGW32_TRUE@am__objects_2 = winmain.lo am_libsybdb_la_OBJECTS = dblib.lo dbutil.lo rpc.lo bcp.lo xact.lo \ dbpivot.lo $(am__objects_1) $(am__objects_2) libsybdb_la_OBJECTS = $(am_libsybdb_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libsybdb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libsybdb_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bcp.Plo ./$(DEPDIR)/dblib.Plo \ ./$(DEPDIR)/dbopen.Plo ./$(DEPDIR)/dbpivot.Plo \ ./$(DEPDIR)/dbutil.Plo ./$(DEPDIR)/rpc.Plo \ ./$(DEPDIR)/winmain.Plo ./$(DEPDIR)/xact.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libsybdb_la_SOURCES) DIST_SOURCES = $(am__libsybdb_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include lib_LTLIBRARIES = libsybdb.la libsybdb_la_SOURCES = dblib.c dbutil.c rpc.c bcp.c xact.c dbpivot.c \ $(am__append_1) $(am__append_2) EXTRA_DIST = dbopen.c buffering.h CMakeLists.txt winmain.c dblib.def # bumped for dbanydatecrack libsybdb_la_LDFLAGS = -version-info 6:0:1 $(FREETDS_SYMBOLIC) \ $(am__append_3) libsybdb_la_LIBADD = ../tds/libtds.la ../replacements/libreplacements.la $(LTLIBICONV) $(FREETDS_LIBGCC) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/dblib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/dblib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libsybdb.la: $(libsybdb_la_OBJECTS) $(libsybdb_la_DEPENDENCIES) $(EXTRA_libsybdb_la_DEPENDENCIES) $(AM_V_CCLD)$(libsybdb_la_LINK) -rpath $(libdir) $(libsybdb_la_OBJECTS) $(libsybdb_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dblib.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbopen.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbpivot.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbutil.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmain.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xact.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/bcp.Plo -rm -f ./$(DEPDIR)/dblib.Plo -rm -f ./$(DEPDIR)/dbopen.Plo -rm -f ./$(DEPDIR)/dbpivot.Plo -rm -f ./$(DEPDIR)/dbutil.Plo -rm -f ./$(DEPDIR)/rpc.Plo -rm -f ./$(DEPDIR)/winmain.Plo -rm -f ./$(DEPDIR)/xact.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/bcp.Plo -rm -f ./$(DEPDIR)/dblib.Plo -rm -f ./$(DEPDIR)/dbopen.Plo -rm -f ./$(DEPDIR)/dbpivot.Plo -rm -f ./$(DEPDIR)/dbutil.Plo -rm -f ./$(DEPDIR)/rpc.Plo -rm -f ./$(DEPDIR)/winmain.Plo -rm -f ./$(DEPDIR)/xact.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-libLTLIBRARIES .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/dblib/dblib.c000644 025423 025423 00000763211 14056414271 017704 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2006-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_ERRNO_H # include #endif /* HAVE_ERRNO_H */ /** * \ingroup dblib_core * \remarks Either SYBDBLIB or MSDBLIB (not both) must be defined. * This affects how certain application-addressable * strucures are defined. */ #include #include #include #include #include #include #include #include #include #include static RETCODE _dbresults(DBPROCESS * dbproc); static BYTE *_dbcoldata(TDSCOLUMN *colinfo); static int _get_printable_size(TDSCOLUMN * colinfo); static char *_dbprdate(char *timestr); static int _dbnullable(DBPROCESS * dbproc, int column); static const char *tds_prdatatype(int datatype_token); static int default_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); void copy_data_to_host_var(DBPROCESS *, TDS_SERVER_TYPE, const BYTE *, int, BYTE *, DBINT, int, DBINT *); RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE* varaddr); /** * \file dblib.c * Main implementation file for \c db-lib. */ /** * \file bcp.c * Implementation of \c db-lib bulk copy functions. */ /** * \defgroup dblib_api The db-lib API * Functions callable by \c db-lib client programs * * The \c db_lib interface is implemented by both Sybase and Microsoft. FreeTDS seeks to implement * first the intersection of the functions defined by the vendors. */ /** * \ingroup dblib_api * \defgroup dblib_core Primary functions * Core functions needed by most db-lib programs. */ /** * \ingroup dblib_api * \defgroup dblib_rpc Remote Procedure functions * Functions used with stored procedures. * Especially useful for OUTPUT parameters, because modern Microsoft servers do not * return output parameter data to the client unless the procedure was invoked * with dbrpcsend(). */ /** * \ingroup dblib_api * \defgroup dblib_bcp Bulk copy functions * Functions to bulk-copy (a/k/a \em bcp) data to/from the database. */ /** * \ingroup dblib_bcp * \defgroup dblib_bcp_internal Internal bcp functions * Static functions internal to the bcp library. */ /** * \ingroup dblib_api * \defgroup dblib_money Money functions * Functions to manipulate the MONEY datatype. */ /** * \ingroup dblib_api * \defgroup dblib_datetime Datetime functions * Functions to manipulate DBDATETIME structures. Defined by Sybase only. * These are not implemented: * - dbdate4cmp() * - dbdate4zero() * - dbdatechar() * - dbdatename() * - dbdateorder() * - dbdatepart() * - dbdatezero() * - dbdayname() */ /** * \ingroup dblib_api * \defgroup dblib_internal Internals * Functions called within \c db-lib for self-help. * These functions are of interest only to people hacking on the FreeTDS db-lib implementation. */ /** * \ingroup dblib_api * \defgroup dblib_unimplemented Unimplemented * Functions thus far not implemented in the FreeTDS db-lib implementation. * While some of these are simply awaiting someone with time and skill (and inclination) * it might be noted here that the old browse functions (e.g. dbcolbrowse()) * are on the never-to-do list. * They were defined by Sybase and were superseded long ago, although they're still * present in Microsoft's implementation. * They were never popular and today better alternatives are available. * For completeness, they are: * - dbcolbrowse() * - dbcolsource() * - dbfreequal() * - dbqual() * - dbtabbrowse() * - dbtabcount() * - dbtabname() * - dbtabsource() * - dbtsnewlen() * - dbtsnewval() * - dbtsput() */ /* info/err message handler functions (or rather pointers to them) */ MHANDLEFUNC _dblib_msg_handler = NULL; EHANDLEFUNC _dblib_err_handler = default_err_handler; /** \internal * \dblib_internal * \remarks A db-lib connection has an implicit TDS context. */ typedef struct dblib_context { /** reference count, time dbinit called */ int ref_count; /** libTDS context */ TDSCONTEXT *tds_ctx; /** libTDS context reference counter */ int tds_ctx_ref_count; /* save all connection in a list */ TDSSOCKET **connection_list; int connection_list_size; int connection_list_size_represented; char *recftos_filename; int recftos_filenum; int login_timeout; /**< not used unless positive */ int query_timeout; /**< not used unless positive */ } DBLIBCONTEXT; static DBLIBCONTEXT g_dblib_ctx; static tds_mutex dblib_mutex = TDS_MUTEX_INITIALIZER; static int g_dblib_version = #if TDS50 DBVERSION_100; #elif TDS71 DBVERSION_71; #elif TDS72 DBVERSION_72; #elif TDS73 DBVERSION_73; #elif TDS74 DBVERSION_74; #else DBVERSION_UNKNOWN; #endif static int dblib_add_connection(DBLIBCONTEXT * ctx, TDSSOCKET * tds) { int i = 0; const int list_size = ctx->connection_list_size_represented; tdsdump_log(TDS_DBG_FUNC, "dblib_add_connection(%p, %p)\n", ctx, tds); while (i < list_size && ctx->connection_list[i]) i++; if (i == list_size) { fprintf(stderr, "Max connections reached, increase value of TDS_MAX_CONN\n"); return 1; } else { ctx->connection_list[i] = tds; return 0; } } static void dblib_del_connection(DBLIBCONTEXT * ctx, TDSSOCKET * tds) { int i = 0; const int list_size = ctx->connection_list_size; tdsdump_log(TDS_DBG_FUNC, "dblib_del_connection(%p, %p)\n", ctx, tds); while (i < list_size && ctx->connection_list[i] != tds) i++; if (i == list_size) { /* connection wasn't on the free list...now what */ } else { /* remove it */ ctx->connection_list[i] = NULL; } } static TDSCONTEXT* dblib_get_tds_ctx(void) { tdsdump_log(TDS_DBG_FUNC, "dblib_get_tds_ctx(void)\n"); tds_mutex_lock(&dblib_mutex); ++g_dblib_ctx.tds_ctx_ref_count; if (g_dblib_ctx.tds_ctx == NULL) { g_dblib_ctx.tds_ctx = tds_alloc_context(&g_dblib_ctx); /* * Set the functions in the TDS layer to point to the correct handler functions */ g_dblib_ctx.tds_ctx->msg_handler = _dblib_handle_info_message; g_dblib_ctx.tds_ctx->err_handler = _dblib_handle_err_message; g_dblib_ctx.tds_ctx->int_handler = _dblib_check_and_handle_interrupt; if (g_dblib_ctx.tds_ctx->locale && !g_dblib_ctx.tds_ctx->locale->date_fmt) { /* set default in case there's no locale file */ const static char date_format[] = "%b %e %Y %l:%M:%S:%z%p"; g_dblib_ctx.tds_ctx->locale->date_fmt = strdup(date_format); } } tds_mutex_unlock(&dblib_mutex); return g_dblib_ctx.tds_ctx; } static void dblib_release_tds_ctx(int count) { tdsdump_log(TDS_DBG_FUNC, "dblib_release_tds_ctx(%d)\n", count); tds_mutex_lock(&dblib_mutex); g_dblib_ctx.tds_ctx_ref_count -= count; if (g_dblib_ctx.tds_ctx_ref_count <= 0) { tds_free_context(g_dblib_ctx.tds_ctx); g_dblib_ctx.tds_ctx = NULL; } tds_mutex_unlock(&dblib_mutex); } #include "buffering.h" static void db_env_chg(TDSSOCKET * tds, int type, char *oldval, char *newval) { DBPROCESS *dbproc; assert(oldval != NULL && newval != NULL); if (strlen(oldval) == 1 && *oldval == 1) oldval = "(0x1)"; tdsdump_log(TDS_DBG_FUNC, "db_env_chg(%p, %d, %s, %s)\n", tds, type, oldval, newval); if (!tds || !tds_get_parent(tds)) return; dbproc = (DBPROCESS *) tds_get_parent(tds); dbproc->envchange_rcv |= (1 << (type - 1)); switch (type) { case TDS_ENV_DATABASE: strlcpy(dbproc->dbcurdb, newval, sizeof(dbproc->dbcurdb)); break; case TDS_ENV_CHARSET: strlcpy(dbproc->servcharset, newval, sizeof(dbproc->servcharset)); break; default: break; } return; } /** \internal * \ingroup dblib_internal * \brief Sanity checks for column-oriented functions. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param pcolinfo address of pointer to a TDSCOLUMN structure. * \remarks Makes sure dbproc and the requested column are valid. * Calls dbperror() if not. * \returns appropriate error or SUCCEED */ static TDSCOLUMN* dbcolptr(DBPROCESS* dbproc, int column) { if (!dbproc) { dbperror(dbproc, SYBENULL, 0); return NULL; } if (IS_TDSDEAD(dbproc->tds_socket)) { dbperror(dbproc, SYBEDDNE, 0); return NULL; } if (!dbproc->tds_socket->res_info) return NULL; if (column < 1 || column > dbproc->tds_socket->res_info->num_cols) { dbperror(dbproc, SYBECNOR, 0); return NULL; } return dbproc->tds_socket->res_info->columns[column - 1]; } static TDSCOLUMN* dbacolptr(DBPROCESS* dbproc, int computeid, int column, int is_bind) { unsigned int i; TDSSOCKET *tds; TDSCOMPUTEINFO *info; if (!dbproc) { dbperror(dbproc, SYBENULL, 0); return NULL; } tds = dbproc->tds_socket; if (IS_TDSDEAD(tds)) { dbperror(dbproc, SYBEDDNE, 0); return NULL; } for (i = 0;; ++i) { if (i >= tds->num_comp_info) { /* Attempt to bind user variable to a non-existent compute row */ if (is_bind) dbperror(dbproc, SYBEBNCR, 0); return NULL; } info = tds->comp_info[i]; if (info->computeid == computeid) break; } /* Fail if either the compute id or the column number is invalid. */ if (column < 1 || column > info->num_cols) { dbperror(dbproc, is_bind ? SYBEABNC : SYBECNOR, 0); return NULL; } return info->columns[column - 1]; } /* * Default null substitution values * Binding Type Null Substitution Value * TINYBIND 0 * SMALLBIND 0 * INTBIND 0 * CHARBIND Empty string (padded with blanks) * STRINGBIND Empty string (padded with blanks, null-terminated) * NTBSTRINGBIND Empty string (null-terminated) * VARYCHARBIND Empty string * BINARYBIND Empty array (padded with zeros) * VARYBINBIND Empty array * DATETIMEBIND 8 bytes of zeros * SMALLDATETIMEBIND 8 bytes of zeros * MONEYBIND $0.00 * SMALLMONEYBIND $0.00 * FLT8BIND 0.0 * REALBIND 0.0 * DECIMALBIND 0.0 (with default scale and precision) * NUMERICBIND 0.0 (with default scale and precision) * BOUNDARYBIND Empty string (null-terminated) * SENSITIVITYBIND Empty string (null-terminated) */ static const DBBIT null_BIT = 0; static const DBTINYINT null_TINYINT = 0; static const DBSMALLINT null_SMALLINT = 0; static const DBINT null_INT = 0; static const DBBIGINT null_BIGINT = 0; static const DBFLT8 null_FLT8 = 0; static const DBREAL null_REAL = 0; static const DBCHAR null_CHAR = '\0'; static const DBVARYCHAR null_VARYCHAR = { 0, {0} }; static const DBDATETIME null_DATETIME = { 0, 0 }; static const DBDATETIME4 null_SMALLDATETIME = { 0, 0 }; static const DBMONEY null_MONEY = { 0, 0 }; static const DBMONEY4 null_SMALLMONEY = {0}; static const DBNUMERIC null_NUMERIC = { 0, 0, {0} }; static const TDS_DATETIMEALL null_DATETIMEALL = { 0, 0, 0, 0 }; static NULLREP default_null_representations[MAXBINDTYPES] = { /* CHARBIND 0 */ { NULL, 0 } /* STRINGBIND 1 */ , { NULL, 0 } /* NTBSTRINGBIND 2 */ , { (BYTE*) &null_CHAR, sizeof(null_CHAR) } /* VARYCHARBIND 3 */ , { (BYTE*) &null_VARYCHAR, sizeof(null_VARYCHAR) } /* VARYBINBIND 4 */ , { (BYTE*) &null_VARYCHAR, sizeof(null_VARYCHAR) } /* no such bind 5 */ , { NULL, 0 } /* TINYBIND 6 */ , { &null_TINYINT, sizeof(null_TINYINT) } /* SMALLBIND 7 */ , { (BYTE*) &null_SMALLINT, sizeof(null_SMALLINT) } /* INTBIND 8 */ , { (BYTE*) &null_INT, sizeof(null_INT) } /* FLT8BIND 9 */ , { (BYTE*) &null_FLT8, sizeof(null_FLT8) } /* REALBIND 10 */ , { (BYTE*) &null_REAL, sizeof(null_REAL) } /* DATETIMEBIND 11 */ , { (BYTE*) &null_DATETIME, sizeof(null_DATETIME) } /* SMALLDATETIMEBIND 12 */ , { (BYTE*) &null_SMALLDATETIME, sizeof(null_SMALLDATETIME) } /* MONEYBIND 13 */ , { (BYTE*) &null_MONEY, sizeof(null_MONEY) } /* SMALLMONEYBIND 14 */ , { (BYTE*) &null_SMALLMONEY, sizeof(null_SMALLMONEY) } /* BINARYBIND 15 */ , { NULL, 0 } /* BITBIND 16 */ , { &null_BIT, sizeof(null_BIT) } /* NUMERICBIND 17 */ , { (BYTE*) &null_NUMERIC, sizeof(null_NUMERIC) } /* DECIMALBIND 18 */ , { (BYTE*) &null_NUMERIC, sizeof(null_NUMERIC) } /* SRCNUMERICBIND 19 */ , { (BYTE*) &null_NUMERIC, sizeof(null_NUMERIC) } /* SRCDECIMALBIND 20 */ , { (BYTE*) &null_NUMERIC, sizeof(null_NUMERIC) } /* DATEBIND 21 */ , { (BYTE*) &null_INT, sizeof(null_INT) } /* TIMEBIND 22 */ , { (BYTE*) &null_INT, sizeof(null_INT) } /* BIGDATETIMEBIND 23 */ , { (BYTE*) &null_BIGINT, sizeof(null_BIGINT) } /* BIGTIMEBIND 24 */ , { (BYTE*) &null_BIGINT, sizeof(null_BIGINT) } /* 25 */ , { NULL, 0 } /* 26 */ , { NULL, 0 } /* 27 */ , { NULL, 0 } /* 28 */ , { NULL, 0 } /* 29 */ , { NULL, 0 } /* BIGINTBIND 30 */ , { (BYTE*) &null_BIGINT, sizeof(null_BIGINT) } /* DATETIME2BIND 31 */ , { (BYTE*) &null_DATETIMEALL, sizeof(null_DATETIMEALL) } /* MAXBINDTYPES 32 */ }; static int dbbindtype(int datatype) { switch (datatype) { case SYBIMAGE: case SYBVARBINARY: case SYBBINARY: return BINARYBIND; case SYBBIT: return BITBIND; case SYBLONGCHAR: case SYBTEXT: case SYBVARCHAR: case SYBCHAR: return NTBSTRINGBIND; case SYBDATETIME: return DATETIMEBIND; case SYBDATETIME4: return SMALLDATETIMEBIND; case SYBDATE: return DATEBIND; case SYBTIME: return TIMEBIND; case SYB5BIGDATETIME: return BIGDATETIMEBIND; case SYB5BIGTIME: return BIGTIMEBIND; case SYBDECIMAL: return DECIMALBIND; case SYBNUMERIC: return NUMERICBIND; case SYBFLT8: return FLT8BIND; case SYBREAL: return REALBIND; case SYBINT1: return TINYBIND; case SYBINT2: return SMALLBIND; case SYBINT4: return INTBIND; case SYBINT8: return BIGINTBIND; case SYBMONEY: return MONEYBIND; case SYBMONEY4: return SMALLMONEYBIND; case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: return DATETIME2BIND; default: assert(0 == "no such datatype"); } return 0; } /** \internal * dbbind() says: "Note that if varlen is 0, no padding takes place" * dbgetnull() will not pad varaddr unless varlen is positive. * Vartype Program Type Padding Terminator * ------------------- -------------- -------------- ---------- * CHARBIND DBCHAR blanks none * STRINGBIND DBCHAR blanks \0 * NTBSTRINGBIND DBCHAR none \0 * VARYCHARBIND DBVARYCHAR none none * BOUNDARYBIND DBCHAR none \0 * SENSITIVITYBIND DBCHAR none \0 */ RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE* varaddr) { NULLREP *pnullrep = default_null_representations + bindtype; tdsdump_log(TDS_DBG_FUNC, "dbgetnull(%p, %d, %d, %p)\n", dbproc, bindtype, varlen, varaddr); CHECK_PARAMETER(varaddr, SYBENULL, FAIL); CHECK_PARAMETER(0 <= bindtype && bindtype < MAXBINDTYPES, SYBEBTYP, FAIL); /* dbproc can be NULL */ if (NULL != dbproc) { assert(dbproc->nullreps); pnullrep = dbproc->nullreps + bindtype; } /* * Fixed types: ignore varlen * Other types: ignore varlen if <= 0, else varlen must be >= pnullrep->len. */ switch (bindtype) { case DATETIMEBIND: case DATETIME2BIND: case DECIMALBIND: case SRCDECIMALBIND: case FLT8BIND: case INTBIND: case MONEYBIND: case NUMERICBIND: case SRCNUMERICBIND: case REALBIND: case SMALLBIND: case SMALLDATETIMEBIND: case SMALLMONEYBIND: case TINYBIND: case BIGINTBIND: case BITBIND: case TIMEBIND: case DATEBIND: case BIGDATETIMEBIND: case BIGTIMEBIND: memcpy(varaddr, pnullrep->bindval, pnullrep->len); return SUCCEED; case CHARBIND: case STRINGBIND: case NTBSTRINGBIND: case BINARYBIND: case VARYCHARBIND: case VARYBINBIND: if (pnullrep->bindval && (varlen <= 0 || (size_t)varlen >= pnullrep->len)) { memcpy(varaddr, pnullrep->bindval, pnullrep->len); } break; default: dbperror(dbproc, SYBEBTYP, 0); return FAIL; } /* * For variable-length types, nonpositive varlen indicates * buffer is "big enough" but also not to pad. * Apply terminator (if applicable) and go home. */ if (varlen <= 0) { varlen = pnullrep->len; switch (bindtype) { case STRINGBIND: case NTBSTRINGBIND: ++varlen; break; #if 0 case BOUNDARYBIND: case SENSITIVITYBIND: #endif } } if (varlen < (long)pnullrep->len) { tdsdump_log(TDS_DBG_FUNC, "dbgetnull: error: not setting varaddr(%p) because %d < %lu\n", varaddr, varlen, (unsigned long int) pnullrep->len); return FAIL; } tdsdump_log(TDS_DBG_FUNC, "varaddr(%p) varlen %d < %lu?\n", varaddr, varlen, (unsigned long int) pnullrep->len); assert(varlen >= 0); /* * CHARBIND Empty string (padded with blanks) * STRINGBIND Empty string (padded with blanks, null-terminated) * NTBSTRINGBIND Empty string (unpadded, null-terminated) * BINARYBIND Empty array (padded with zeros) */ varaddr += pnullrep->len; varlen -= (int)pnullrep->len; if (varlen > 0) { switch (bindtype) { case CHARBIND: memset(varaddr, ' ', varlen); break; case STRINGBIND: memset(varaddr, ' ', varlen); varaddr[varlen-1] = '\0'; break; case NTBSTRINGBIND: varaddr[0] = '\0'; break; case BINARYBIND: memset(varaddr, 0, varlen); break; case VARYCHARBIND: case VARYBINBIND: break; default: assert(!"unknown bindtype"); } } return SUCCEED; } /** * \ingroup dblib_core * \brief Initialize db-lib. * * \remarks Call this function before trying to use db-lib in any way. * Allocates various internal structures and reads \c locales.conf (if any) to determine the default * date format. * \retval SUCCEED normal. * \retval FAIL cannot allocate an array of \c TDS_MAX_CONN \c TDSSOCKET pointers. */ RETCODE dbinit(void) { _dblib_err_handler = default_err_handler; tds_mutex_lock(&dblib_mutex); tdsdump_log(TDS_DBG_FUNC, "dbinit(void)\n"); if (++g_dblib_ctx.ref_count != 1) { tds_mutex_unlock(&dblib_mutex); return SUCCEED; } /* * DBLIBCONTEXT stores a list of current connections so they may be closed with dbexit() */ g_dblib_ctx.connection_list = tds_new0(TDSSOCKET *, TDS_MAX_CONN); if (g_dblib_ctx.connection_list == NULL) { tdsdump_log(TDS_DBG_FUNC, "dbinit: out of memory\n"); tds_mutex_unlock(&dblib_mutex); return FAIL; } g_dblib_ctx.connection_list_size = TDS_MAX_CONN; g_dblib_ctx.connection_list_size_represented = TDS_MAX_CONN; g_dblib_ctx.login_timeout = -1; g_dblib_ctx.query_timeout = -1; tds_mutex_unlock(&dblib_mutex); dblib_get_tds_ctx(); return SUCCEED; } /** * \ingroup dblib_core * \brief Allocate a \c LOGINREC structure. * * \remarks A \c LOGINREC structure is passed to \c dbopen() to create a connection to the database. * Does not communicate to the server; interacts strictly with library. * \retval NULL the \c LOGINREC cannot be allocated. * \retval LOGINREC* to valid memory, otherwise. */ LOGINREC * dblogin(void) { LOGINREC *loginrec; tdsdump_log(TDS_DBG_FUNC, "dblogin(void)\n"); if ((loginrec = tds_new0(LOGINREC, 1)) == NULL) { dbperror(NULL, SYBEMEM, errno); return NULL; } if ((loginrec->tds_login = tds_alloc_login(1)) == NULL) { dbperror(NULL, SYBEMEM, errno); free(loginrec); return NULL; } /* set default values for loginrec */ if (!tds_set_library(loginrec->tds_login, "DB-Library")) { dbperror(NULL, SYBEMEM, errno); free(loginrec); return NULL; } return loginrec; } /** * \ingroup dblib_core * \brief free the \c LOGINREC * */ void dbloginfree(LOGINREC * login) { tdsdump_log(TDS_DBG_FUNC, "dbloginfree(%p)\n", login); if (login) { tds_free_login(login->tds_login); TDS_ZERO_FREE(login); } } /** \internal * \ingroup dblib_internal * \brief Set the value of a string in a \c LOGINREC structure. * * Called by various macros to populate \a login. * \param login the \c LOGINREC* to modify. * \param value the value to set it to. * \param which the field to set. * \retval SUCCEED the value was set. * \retval FAIL \c DBSETHID or other invalid \a which was tried. */ RETCODE dbsetlname(LOGINREC * login, const char *value, int which) { bool copy_ret; const char *value_nonull = value ? value : ""; tdsdump_log(TDS_DBG_FUNC, "dbsetlname(%p, %s, %d)\n", login, value, which); if (login == NULL) { dbperror(NULL, SYBEASNL, 0); return FAIL; } if (TDS_MAX_LOGIN_STR_SZ < strlen(value_nonull)) { dbperror(NULL, SYBENTLL, 0); return FAIL; } switch (which) { case DBSETHOST: copy_ret = tds_set_host(login->tds_login, value_nonull); break; case DBSETUSER: copy_ret = tds_set_user(login->tds_login, value_nonull); break; case DBSETPWD: copy_ret = tds_set_passwd(login->tds_login, value_nonull); break; case DBSETAPP: copy_ret = tds_set_app(login->tds_login, value_nonull); break; case DBSETCHARSET: /* TODO NULL == no conversion desired */ copy_ret = tds_set_client_charset(login->tds_login, value_nonull); break; case DBSETNATLANG: copy_ret = tds_set_language(login->tds_login, value_nonull); break; case DBSETDBNAME: copy_ret = !!tds_dstr_copy(&login->tds_login->database, value_nonull); break; case DBSETSERVERPRINCIPAL: copy_ret = !!tds_dstr_copy(&login->tds_login->server_spn, value_nonull); break; default: dbperror(NULL, SYBEASUL, 0); /* Attempt to set unknown LOGINREC field */ return FAIL; break; } if (!copy_ret) return FAIL; return SUCCEED; } /** \internal * \ingroup dblib_internal * \brief Set an integer value in a \c LOGINREC structure. * * Called by various macros to populate \a login. * \param login the \c LOGINREC* to modify. * \param value the value to set it to. * \param which the field to set. * \retval SUCCEED the value was set. * \retval FAIL anything other than \c DBSETPACKET was passed for \a which. */ RETCODE dbsetllong(LOGINREC * login, long value, int which) { tdsdump_log(TDS_DBG_FUNC, "dbsetllong(%p, %ld, %d)\n", login, value, which); if( login == NULL ) { dbperror(NULL, SYBEASNL, 0); return FAIL; } switch (which) { case DBSETPACKET: if (0 <= value && value <= 999999) { tds_set_packet(login->tds_login, value); return SUCCEED; } dbperror(0, SYBEBADPK, 0, (int) value, (int) login->tds_login->block_size); return FAIL; break; default: tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbsetllong() which = %d\n", which); return FAIL; break; } } #if defined(DBLIB_UNIMPLEMENTED) /** \internal * \ingroup dblib_internal * \brief Set an integer value in a \c LOGINREC structure. * * Called by various macros to populate \a login. * \param login the \c LOGINREC* to modify. * \param value the value to set it to. * \param which the field to set. * \retval SUCCEED the value was set. * \retval FAIL anything other than \c DBSETHIER was passed for \a which. */ RETCODE dbsetlshort(LOGINREC * login, int value, int which) { tdsdump_log(TDS_DBG_FUNC, "dbsetlshort(%p, %d, %d)\n", login, value, which); if( login == NULL ) { dbperror(NULL, SYBEASNL, 0); return FAIL; } switch (which) { case DBSETHIER: default: tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbsetlshort() which = %d\n", which); return FAIL; break; } } #endif /** \internal * \ingroup dblib_internal * \brief Set a boolean value in a \c LOGINREC structure. * * Called by various macros to populate \a login. * \param login the \c LOGINREC* to modify. * \param value the value to set it to. * \param which the field to set. * \remark Only DBSETBCP is implemented. * \retval SUCCEED the value was set. * \retval FAIL invalid value passed for \a which. * \todo DBSETNOSHORT, DBSETENCRYPT, DBSETLABELED */ RETCODE dbsetlbool(LOGINREC * login, int value, int which) { bool b_value; tdsdump_log(TDS_DBG_FUNC, "dbsetlbool(%p, %d, %d)\n", login, value, which); if (login == NULL) { dbperror(NULL, SYBEASNL, 0); return FAIL; } b_value = (value != 0); switch (which) { case DBSETBCP: tds_set_bulk(login->tds_login, b_value); return SUCCEED; case DBSETUTF16: login->tds_login->use_utf16 = b_value; return SUCCEED; case DBSETNTLMV2: login->tds_login->use_ntlmv2 = b_value; login->tds_login->use_ntlmv2_specified = 1; return SUCCEED; case DBSETREADONLY: login->tds_login->readonly_intent = b_value; return SUCCEED; case DBSETNETWORKAUTH: login->network_auth = b_value; return SUCCEED; case DBSETMUTUALAUTH: login->tds_login->mutual_authentication = b_value; return SUCCEED; case DBSETDELEGATION: login->tds_login->gssapi_use_delegation = b_value; return SUCCEED; case DBSETENCRYPT: case DBSETLABELED: default: tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbsetlbool() which = %d\n", which); return FAIL; break; } } /** * \ingroup dblib_core * \brief Set TDS version for future connections * */ RETCODE dbsetlversion(LOGINREC * login, BYTE version) { tdsdump_log(TDS_DBG_FUNC, "dbsetlversion(%p, %x)\n", login, version); if( login == NULL ) { dbperror(NULL, SYBEASNL, 0); return FAIL; } assert(login->tds_login != NULL); switch (version) { case DBVERSION_UNKNOWN: tds_set_version(login->tds_login, 0, 0); return SUCCEED; case DBVERSION_42: tds_set_version(login->tds_login, 4, 2); return SUCCEED; case DBVERSION_100: tds_set_version(login->tds_login, 5, 0); return SUCCEED; case DBVERSION_70: tds_set_version(login->tds_login, 7, 0); return SUCCEED; case DBVERSION_71: tds_set_version(login->tds_login, 7, 1); return SUCCEED; case DBVERSION_72: tds_set_version(login->tds_login, 7, 2); return SUCCEED; case DBVERSION_73: tds_set_version(login->tds_login, 7, 3); return SUCCEED; case DBVERSION_74: tds_set_version(login->tds_login, 7, 4); return SUCCEED; } return FAIL; } static void dbstring_free(DBSTRING ** dbstrp) { DBSTRING *curr, *next; /* tdsdump_log(TDS_DBG_FUNC, "dbstring_free(%p)\n", dbstrp); */ if (!dbstrp) return; curr = *dbstrp; *dbstrp = NULL; for (; curr; ) { next = curr->strnext; free(curr->strtext); free(curr); curr = next; } } static RETCODE dbstring_concat(DBSTRING ** dbstrp, const char *p) { DBSTRING **strp = dbstrp; /* tdsdump_log(TDS_DBG_FUNC, "dbstring_concat(%p, %s)\n", *dbstrp, p); */ while (*strp != NULL) { strp = &((*strp)->strnext); } if ((*strp = tds_new(DBSTRING, 1)) == NULL) { dbperror(NULL, SYBEMEM, errno); return FAIL; } (*strp)->strtotlen = (DBINT)strlen(p); if (((*strp)->strtext = tds_new(BYTE, (*strp)->strtotlen)) == NULL) { TDS_ZERO_FREE(*strp); dbperror(NULL, SYBEMEM, errno); return FAIL; } memcpy((*strp)->strtext, p, (*strp)->strtotlen); (*strp)->strnext = NULL; return SUCCEED; } static RETCODE dbstring_assign(DBSTRING ** dbstrp, const char *p) { /* tdsdump_log(TDS_DBG_FUNC, "dbstring_assign(%p, %s)\n", *dbstrp, p); */ dbstring_free(dbstrp); return dbstring_concat(dbstrp, p); } static DBINT dbstring_length(DBSTRING * dbstr) { DBINT len = 0; DBSTRING *next; /* tdsdump_log(TDS_DBG_FUNC, "dbstring_length(%p)\n", dbstr); */ for (next = dbstr; next != NULL; next = next->strnext) { len += next->strtotlen; } return len; } static int dbstring_getchar(DBSTRING * dbstr, int i) { /* tdsdump_log(TDS_DBG_FUNC, "dbstring_getchar(%p, %d)\n", dbstr, i); */ if (dbstr == NULL) { return -1; } if (i < 0) { return -1; } if (i < dbstr->strtotlen) { return dbstr->strtext[i]; } return dbstring_getchar(dbstr->strnext, i - dbstr->strtotlen); } static char * dbstring_get(DBSTRING * dbstr) { DBSTRING *next; int len; char *ret; char *cp; /* tdsdump_log(TDS_DBG_FUNC, "dbstring_get(%p)\n", dbstr); */ if (dbstr == NULL) { return NULL; } len = dbstring_length(dbstr); if ((ret = tds_new(char, len + 1)) == NULL) { dbperror(NULL, SYBEMEM, errno); return NULL; } cp = ret; for (next = dbstr; next != NULL; next = next->strnext) { memcpy(cp, next->strtext, next->strtotlen); cp += next->strtotlen; } *cp = '\0'; return ret; } static const char *const opttext[DBNUMOPTIONS] = { "parseonly", "estimate", "showplan", "noexec", "arithignore", "nocount", "arithabort", "textlimit", "browse", "offsets", "statistics", "errlvl", "confirm", "spid", "buffer", "noautofree", "rowcount", "textsize", "language", "dateformat", "prpad", "prcolsep", "prlinelen", "prlinesep", "lfconvert", "datefirst", "chained", "fipsflagger", "transaction isolation level", "auth", "identity_insert", "no_identity_column", "cnv_date2char_short", "client cursors", "set time", "quoted_identifier" }; static DBOPTION * init_dboptions(void) { DBOPTION *dbopts; int i; if ((dbopts = tds_new0(DBOPTION, DBNUMOPTIONS)) == NULL) { dbperror(NULL, SYBEMEM, errno); return NULL; } for (i = 0; i < DBNUMOPTIONS; i++) { dbopts[i].text = opttext[i]; dbopts[i].param = NULL; dbopts[i].factive = FALSE; } dbstring_assign(&(dbopts[DBPRPAD].param), " "); dbstring_assign(&(dbopts[DBPRCOLSEP].param), " "); dbstring_assign(&(dbopts[DBPRLINELEN].param), "80"); dbstring_assign(&(dbopts[DBPRLINESEP].param), "\n"); dbstring_assign(&(dbopts[DBCLIENTCURSORS].param), " "); dbstring_assign(&(dbopts[DBSETTIME].param), " "); return dbopts; } /** \internal * \ingroup dblib_internal * \brief Form a connection with the server. * * Called by the \c dbopen() macro, normally. If FreeTDS was configured with \c --enable-msdblib, this * function is called by (exported) \c dbopen() function. \c tdsdbopen is so-named to avoid * namespace conflicts with other database libraries that use the same function name. * \param login \c LOGINREC* carrying the account information. * \param server name of the dataserver to connect to. * \return valid pointer on successful login. * \retval NULL insufficient memory, unable to connect for any reason. * \sa dbopen() * \todo use \c asprintf() to avoid buffer overflow. * \todo separate error messages for \em no-such-server and \em no-such-user. */ DBPROCESS * tdsdbopen(LOGINREC * login, const char *server, int msdblib) { DBPROCESS *dbproc = NULL; TDSLOGIN *connection; char *tdsdump = getenv("TDSDUMP"); if (tdsdump && *tdsdump) { tdsdump_open(tdsdump); tdsdump_log(TDS_DBG_FUNC, "tdsdbopen(%p, %s, [%s])\n", login, server? server : "0x0", msdblib? "microsoft" : "sybase"); } /* * Sybase supports the DSQUERY environment variable and falls back to "SYBASE" if server is NULL. * Microsoft uses a NULL or "" server to indicate a local server. * FIXME: support local server for win32. */ if (!server && !msdblib) { if ((server = getenv("TDSQUERY")) == NULL) if ((server = getenv("DSQUERY")) == NULL) server = "SYBASE"; tdsdump_log(TDS_DBG_FUNC, "tdsdbopen: servername set to %s\n", server); } if ((dbproc = tds_new0(DBPROCESS, 1)) == NULL) { dbperror(NULL, SYBEMEM, errno); return NULL; } dbproc->msdblib = msdblib; dbproc->dbopts = init_dboptions(); if (dbproc->dbopts == NULL) { free(dbproc); return NULL; } tdsdump_log(TDS_DBG_FUNC, "tdsdbopen: dbproc->dbopts = %p\n", dbproc->dbopts); dbproc->dboptcmd = NULL; dbproc->avail_flag = TRUE; dbproc->command_state = DBCMDNONE; if (!tds_set_server(login->tds_login, server)) { dbperror(NULL, SYBEMEM, 0); free(dbproc); return NULL; } tdsdump_log(TDS_DBG_FUNC, "tdsdbopen: tds_set_server(%p, \"%s\")\n", login->tds_login, server); if ((dbproc->tds_socket = tds_alloc_socket(dblib_get_tds_ctx(), 512)) == NULL ){ dbperror(NULL, SYBEMEM, 0); free(dbproc); return NULL; } tds_set_parent(dbproc->tds_socket, dbproc); dbproc->tds_socket->env_chg_func = db_env_chg; dbproc->envchange_rcv = 0; dbproc->dbcurdb[0] = '\0'; dbproc->servcharset[0] = '\0'; tdsdump_log(TDS_DBG_FUNC, "tdsdbopen: About to call tds_read_config_info...\n"); connection = tds_read_config_info(dbproc->tds_socket, login->tds_login, g_dblib_ctx.tds_ctx->locale); if (!connection) { dbclose(dbproc); return NULL; } connection->option_flag2 &= ~TDS_ODBC_ON; /* we're not an ODBC driver */ tds_fix_login(connection); /* initialize from Environment variables */ dbproc->chkintr = NULL; dbproc->hndlintr = NULL; tds_mutex_lock(&dblib_mutex); /* override connection timeout if dbsetlogintime() was called */ if (g_dblib_ctx.login_timeout > 0) { connection->connect_timeout = g_dblib_ctx.login_timeout; } /* override query timeout if dbsettime() was called */ if (g_dblib_ctx.query_timeout > 0) { connection->query_timeout = g_dblib_ctx.query_timeout; } tds_mutex_unlock(&dblib_mutex); tdsdump_log(TDS_DBG_FUNC, "tdsdbopen: Calling tds_connect_and_login(%p, %p)\n", dbproc->tds_socket, connection); if (login->network_auth) { tds_dstr_empty(&connection->user_name); tds_dstr_empty(&connection->password); } if (TDS_FAILED(tds_connect_and_login(dbproc->tds_socket, connection))) { tdsdump_log(TDS_DBG_ERROR, "tdsdbopen: tds_connect_and_login failed for \"%s\"!\n", tds_dstr_cstr(&connection->server_name)); tds_free_login(connection); dbclose(dbproc); return NULL; } tds_free_login(connection); dbproc->dbbuf = NULL; dbproc->dbbufsz = 0; tds_mutex_lock(&dblib_mutex); dblib_add_connection(&g_dblib_ctx, dbproc->tds_socket); tds_mutex_unlock(&dblib_mutex); /* set the DBBUFFER capacity to nil */ buffer_set_capacity(dbproc, 0); memcpy(dbproc->nullreps, default_null_representations, sizeof(default_null_representations)); tds_mutex_lock(&dblib_mutex); if (g_dblib_ctx.recftos_filename != NULL) { char *temp_filename = NULL; const int len = asprintf(&temp_filename, "%s.%d", g_dblib_ctx.recftos_filename, g_dblib_ctx.recftos_filenum); if (len >= 0) { dbproc->ftos = fopen(temp_filename, "w"); free(temp_filename); if (dbproc->ftos != NULL) { char timestr[256]; fprintf(dbproc->ftos, "/* dbopen() at %s */\n", _dbprdate(timestr)); fflush(dbproc->ftos); g_dblib_ctx.recftos_filenum++; } } } tds_mutex_unlock(&dblib_mutex); tdsdump_log(TDS_DBG_FUNC, "tdsdbopen: Returning dbproc = %p\n", dbproc); return dbproc; } /** * \ingroup dblib_core * \brief \c printf-like way to form SQL to send to the server. * * Forms a command string and writes to the command buffer with dbcmd(). * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param fmt man vasprintf for details. * \retval SUCCEED success. * \retval FAIL insufficient memory, or dbcmd() failed. * \sa dbcmd(), dbfreebuf(), dbgetchar(), dbopen(), dbstrcpy(), dbstrlen(). */ RETCODE dbfcmd(DBPROCESS * dbproc, const char *fmt, ...) { va_list ap; char *s; int len; RETCODE ret; tdsdump_log(TDS_DBG_FUNC, "dbfcmd(%p, %s, ...)\n", dbproc, fmt); CHECK_CONN(FAIL); CHECK_NULP(fmt, "dbfcmd", 2, FAIL); va_start(ap, fmt); len = vasprintf(&s, fmt, ap); va_end(ap); if (len < 0) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } ret = dbcmd(dbproc, s); free(s); return ret; } /** * \ingroup dblib_core * \brief \c Append SQL to the command buffer. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param cmdstring SQL to append to the command buffer. * \retval SUCCEED success. * \retval FAIL insufficient memory. * \remarks set command state to \c DBCMDPEND unless the command state is DBCMDSENT, in which case * it frees the command buffer. This latter may or may not be the Right Thing to do. * \sa dbfcmd(), dbfreebuf(), dbgetchar(), dbopen(), dbstrcpy(), dbstrlen(). */ RETCODE dbcmd(DBPROCESS * dbproc, const char cmdstring[]) { size_t cmd_len, buf_len, newsz; tdsdump_log(TDS_DBG_FUNC, "dbcmd(%p, %s)\n", dbproc, cmdstring); CHECK_CONN(FAIL); CHECK_NULP(cmdstring, "dbcmd", 2, FAIL); dbproc->avail_flag = FALSE; tdsdump_log(TDS_DBG_FUNC, "dbcmd() bufsz = %d\n", dbproc->dbbufsz); if (dbproc->command_state == DBCMDSENT) { if (!dbproc->noautofree) { dbfreebuf(dbproc); } } buf_len = (dbproc->dbbufsz == 0) ? 0 : dbproc->dbbufsz - 1; cmd_len = strlen(cmdstring); newsz = buf_len + cmd_len + 1; if (newsz > 0x7fffffffu || !TDS_RESIZE(dbproc->dbbuf, newsz)) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } memcpy(dbproc->dbbuf + buf_len, cmdstring, cmd_len); dbproc->dbbuf[newsz - 1] = 0; dbproc->dbbufsz = (int) newsz; dbproc->command_state = DBCMDPEND; return SUCCEED; } /** * \ingroup dblib_core * \brief send the SQL command to the server and wait for an answer. * * Please be patient. This function waits for the server to respond. \c dbsqlexec is equivalent * to dbsqlsend() followed by dbsqlok(). * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval SUCCEED query was processed without errors. * \retval FAIL was returned by dbsqlsend() or dbsqlok(). * \sa dbcmd(), dbfcmd(), dbnextrow(), dbresults(), dbretstatus(), dbsettime(), dbsqlok(), dbsqlsend() */ RETCODE dbsqlexec(DBPROCESS * dbproc) { RETCODE rc = FAIL; tdsdump_log(TDS_DBG_FUNC, "dbsqlexec(%p)\n", dbproc); CHECK_CONN(FAIL); if (SUCCEED == (rc = dbsqlsend(dbproc))) { rc = dbsqlok(dbproc); } return rc; } /** * \ingroup dblib_core * \brief Change current database. * * Analagous to the unix command \c cd, dbuse() makes \a name the default database. Waits for an answer * from the server. * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param name database to use. * \retval SUCCEED query was processed without errors. * \retval FAIL query was not processed * \sa dbchange(), dbname(). */ RETCODE dbuse(DBPROCESS * dbproc, const char *name) { RETCODE rc; char *query; tdsdump_log(TDS_DBG_FUNC, "dbuse(%p, %s)\n", dbproc, name); CHECK_CONN(FAIL); CHECK_NULP(name, "dbuse", 2, FAIL); /* quote name */ query = tds_new(char, tds_quote_id(dbproc->tds_socket, NULL, name, -1) + 6); if (!query) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } strcpy(query, "use "); /* TODO PHP suggest to quote by yourself with []... what should I do ?? quote or not ?? */ if (name[0] == '[' && name[strlen(name)-1] == ']') strcat(query, name); else tds_quote_id(dbproc->tds_socket, query + 4, name, -1); rc = SUCCEED; if ((dbcmd(dbproc, query) == FAIL) || (dbsqlexec(dbproc) == FAIL) || (dbresults(dbproc) == FAIL) || (dbcanquery(dbproc) == FAIL)) rc = FAIL; free(query); return rc; } /** * \ingroup dblib_core * \brief Close a connection to the server and free associated resources. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbexit(), dbopen(). */ void dbclose(DBPROCESS * dbproc) { TDSSOCKET *tds; int i; char timestr[256]; tdsdump_log(TDS_DBG_FUNC, "dbclose(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, ); tds = dbproc->tds_socket; if (tds) { /* * this MUST be done before socket destruction * it is possible that a TDSSOCKET is allocated on same position */ tds_mutex_lock(&dblib_mutex); dblib_del_connection(&g_dblib_ctx, dbproc->tds_socket); tds_mutex_unlock(&dblib_mutex); tds_close_socket(tds); tds_free_socket(tds); dblib_release_tds_ctx(1); } buffer_free(&(dbproc->row_buf)); if (dbproc->ftos != NULL) { fprintf(dbproc->ftos, "/* dbclose() at %s */\n", _dbprdate(timestr)); fclose(dbproc->ftos); } tds_free_bcpinfo(dbproc->bcpinfo); if (dbproc->hostfileinfo) { free(dbproc->hostfileinfo->hostfile); free(dbproc->hostfileinfo->errorfile); if (dbproc->hostfileinfo->host_columns) { for (i = 0; i < dbproc->hostfileinfo->host_colcount; i++) { free(dbproc->hostfileinfo->host_columns[i]->terminator); free(dbproc->hostfileinfo->host_columns[i]); } free(dbproc->hostfileinfo->host_columns); } } for (i = 0; i < DBNUMOPTIONS; i++) { dbstring_free(&(dbproc->dbopts[i].param)); } free(dbproc->dbopts); dbstring_free(&(dbproc->dboptcmd)); for (i=0; i < MAXBINDTYPES; i++) { if (dbproc->nullreps[i].bindval != default_null_representations[i].bindval) free((BYTE*)dbproc->nullreps[i].bindval); } dbfreebuf(dbproc); free(dbproc); } /** * \ingroup dblib_core * \brief Close server connections and free all related structures. * * \sa dbclose(), dbinit(), dbopen(). * \todo breaks if ctlib/dblib used in same process. */ void dbexit() { TDSSOCKET *tds; DBPROCESS *dbproc; int i, list_size, count = 1; tdsdump_log(TDS_DBG_FUNC, "dbexit(void)\n"); tds_mutex_lock(&dblib_mutex); if (--g_dblib_ctx.ref_count != 0) { tds_mutex_unlock(&dblib_mutex); return; } list_size = g_dblib_ctx.connection_list_size; for (i = 0; i < list_size; i++) { tds = g_dblib_ctx.connection_list[i]; g_dblib_ctx.connection_list[i] = NULL; if (tds) { ++count; dbproc = (DBPROCESS *) tds_get_parent(tds); tds_close_socket(tds); tds_free_socket(tds); if (dbproc) { /* avoid locking in dbclose */ dbproc->tds_socket = NULL; dbclose(dbproc); } } } if (g_dblib_ctx.connection_list) { TDS_ZERO_FREE(g_dblib_ctx.connection_list); g_dblib_ctx.connection_list_size = 0; g_dblib_ctx.connection_list_size_represented = 0; } tds_mutex_unlock(&dblib_mutex); dblib_release_tds_ctx(count); } static const char * prdbresults_state(int retcode) { switch(retcode) { case _DB_RES_INIT: return "_DB_RES_INIT"; case _DB_RES_RESULTSET_EMPTY: return "_DB_RES_RESULTSET_EMPTY"; case _DB_RES_RESULTSET_ROWS: return "_DB_RES_RESULTSET_ROWS"; case _DB_RES_NEXT_RESULT: return "_DB_RES_NEXT_RESULT"; case _DB_RES_NO_MORE_RESULTS: return "_DB_RES_NO_MORE_RESULTS"; case _DB_RES_SUCCEED: return "_DB_RES_SUCCEED"; default: break; } return "??"; } static const char * prdbretcode(RETCODE retcode) { switch(retcode) { case REG_ROW: return "REG_ROW/MORE_ROWS"; case NO_MORE_ROWS: return "NO_MORE_ROWS"; case BUF_FULL: return "BUF_FULL"; case NO_MORE_RESULTS: return "NO_MORE_RESULTS"; case SUCCEED: return "SUCCEED"; case FAIL: return "FAIL"; default: break; } return "??"; } static const char * prretcode(int retcode) { switch(retcode) { case TDS_SUCCESS: return "TDS_SUCCESS"; case TDS_FAIL: return "TDS_FAIL"; case TDS_NO_MORE_RESULTS: return "TDS_NO_MORE_RESULTS"; case TDS_CANCELLED: return "TDS_CANCELLED"; default: break; } return "??"; } static const char * prresult_type(int result_type) { switch(result_type) { case TDS_ROW_RESULT: return "TDS_ROW_RESULT"; case TDS_PARAM_RESULT: return "TDS_PARAM_RESULT"; case TDS_STATUS_RESULT: return "TDS_STATUS_RESULT"; case TDS_MSG_RESULT: return "TDS_MSG_RESULT"; case TDS_COMPUTE_RESULT: return "TDS_COMPUTE_RESULT"; case TDS_CMD_DONE: return "TDS_CMD_DONE"; case TDS_CMD_SUCCEED: return "TDS_CMD_SUCCEED"; case TDS_CMD_FAIL: return "TDS_CMD_FAIL"; case TDS_ROWFMT_RESULT: return "TDS_ROWFMT_RESULT"; case TDS_COMPUTEFMT_RESULT: return "TDS_COMPUTEFMT_RESULT"; case TDS_DESCRIBE_RESULT: return "TDS_DESCRIBE_RESULT"; case TDS_DONE_RESULT: return "TDS_DONE_RESULT"; case TDS_DONEPROC_RESULT: return "TDS_DONEPROC_RESULT"; case TDS_DONEINPROC_RESULT: return "TDS_DONEINPROC_RESULT"; case TDS_OTHERS_RESULT: return "TDS_OTHERS_RESULT"; default: break; } return "??"; } /** * \ingroup dblib_core * \brief Set up query results. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval SUCCEED Some results are available. * \retval FAIL query was not processed successfully by the server * \retval NO_MORE_RESULTS query produced no results. * * \remarks Call dbresults() after calling dbsqlexec() or dbsqlok(), or dbrpcsend() returns SUCCEED. Unless * one of them fails, dbresults will return either SUCCEED or NO_MORE_RESULTS. * * The meaning of \em results is very specific and not very intuitive. Results are created by either * - a SELECT statement * - a stored procedure * * When dbresults returns SUCCEED, therefore, it indicates the server processed the query successfully and * that one or more of these is present: * - metadata -- dbnumcols() returns 1 or more * - data -- dbnextrow() returns SUCCEED * - return status -- dbhasretstat() returns TRUE * - output parameters -- dbnumrets() returns 1 or more * * If none of the above are present, dbresults() returns NO_MORE_RESULTS. * * SUCCEED does not imply that DBROWS() will return TRUE or even that dbnumcols() will return nonzero. * A general algorithm for reading results will call dbresults() until it return NO_MORE_RESULTS (or FAIL). * An application should check for all the above kinds of results within the dbresults() loop. * * \sa dbsqlexec(), dbsqlok(), dbrpcsend(), dbcancel(), DBROWS(), dbnextrow(), dbnumcols(), dbhasretstat(), dbretstatus(), dbnumrets() */ RETCODE dbresults(DBPROCESS * dbproc) { RETCODE erc = _dbresults(dbproc); tdsdump_log(TDS_DBG_FUNC, "dbresults returning %d (%s)\n", erc, prdbretcode(erc)); return erc; } static RETCODE _dbresults(DBPROCESS * dbproc) { TDSSOCKET *tds; int result_type = 0, done_flags; tdsdump_log(TDS_DBG_FUNC, "dbresults(%p)\n", dbproc); CHECK_CONN(FAIL); tds = dbproc->tds_socket; tdsdump_log(TDS_DBG_FUNC, "dbresults: dbresults_state is %d (%s)\n", dbproc->dbresults_state, prdbresults_state(dbproc->dbresults_state)); switch ( dbproc->dbresults_state ) { case _DB_RES_SUCCEED: dbproc->dbresults_state = _DB_RES_NEXT_RESULT; return SUCCEED; break; case _DB_RES_RESULTSET_ROWS: dbperror(dbproc, SYBERPND, 0); /* dbresults called while rows outstanding.... */ return FAIL; break; case _DB_RES_NO_MORE_RESULTS: return NO_MORE_RESULTS; break; default: break; } for (;;) { TDSRET retcode = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS); tdsdump_log(TDS_DBG_FUNC, "dbresults() tds_process_tokens returned %d (%s),\n\t\t\tresult_type %d (%s)\n", retcode, prretcode(retcode), result_type, prresult_type(result_type)); switch (retcode) { case TDS_SUCCESS: switch (result_type) { case TDS_ROWFMT_RESULT: buffer_free(&dbproc->row_buf); buffer_alloc(dbproc); dbproc->dbresults_state = _DB_RES_RESULTSET_EMPTY; break; case TDS_COMPUTEFMT_RESULT: break; case TDS_ROW_RESULT: case TDS_COMPUTE_RESULT: dbproc->dbresults_state = _DB_RES_RESULTSET_ROWS; return SUCCEED; break; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: tdsdump_log(TDS_DBG_FUNC, "dbresults(): dbresults_state is %d (%s)\n", dbproc->dbresults_state, prdbresults_state(dbproc->dbresults_state)); /* A done token signifies the end of a logical command. * There are three possibilities: * 1. Simple command with no result set, i.e. update, delete, insert * 2. Command with result set but no rows * 3. Command with result set and rows */ switch (dbproc->dbresults_state) { case _DB_RES_INIT: case _DB_RES_NEXT_RESULT: dbproc->dbresults_state = _DB_RES_NEXT_RESULT; if (done_flags & TDS_DONE_ERROR) return FAIL; if (result_type == TDS_DONE_RESULT) { tds_free_all_results(tds); return SUCCEED; } break; case _DB_RES_RESULTSET_EMPTY: case _DB_RES_RESULTSET_ROWS: dbproc->dbresults_state = _DB_RES_NEXT_RESULT; return SUCCEED; break; default: assert(0); break; } break; case TDS_DONEINPROC_RESULT: /* * Return SUCCEED on a command within a stored procedure * only if the command returned a result set. */ switch (dbproc->dbresults_state) { case _DB_RES_INIT: case _DB_RES_NEXT_RESULT: dbproc->dbresults_state = _DB_RES_NEXT_RESULT; break; case _DB_RES_RESULTSET_EMPTY : case _DB_RES_RESULTSET_ROWS : dbproc->dbresults_state = _DB_RES_NEXT_RESULT; return SUCCEED; break; case _DB_RES_NO_MORE_RESULTS: case _DB_RES_SUCCEED: break; } break; case TDS_STATUS_RESULT: case TDS_MSG_RESULT: case TDS_DESCRIBE_RESULT: case TDS_PARAM_RESULT: default: break; } break; case TDS_NO_MORE_RESULTS: dbproc->dbresults_state = _DB_RES_NO_MORE_RESULTS; return NO_MORE_RESULTS; break; default: assert(TDS_FAILED(retcode)); dbproc->dbresults_state = _DB_RES_INIT; return FAIL; break; } } } /** * \ingroup dblib_core * \brief Return number of regular columns in a result set. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbcollen(), dbcolname(), dbnumalts(). */ int dbnumcols(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbnumcols(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); if (dbproc && dbproc->tds_socket && dbproc->tds_socket->res_info) return dbproc->tds_socket->res_info->num_cols; return 0; } /** * \ingroup dblib_core * \brief Return name of a regular result column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting with 1. * \return pointer to ASCII null-terminated string, the name of the column. * \retval NULL \a column is not in range. * \sa dbcollen(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(). * \bug Relies on ASCII column names, post iconv conversion. * Will not work as described for UTF-8 or UCS-2 clients. * But maybe it shouldn't. */ char * dbcolname(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbcolname(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return NULL; return tds_dstr_buf(&colinfo->column_name); } /** * \ingroup dblib_core * \brief Return name of a computed result column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid identifies which one of potientially many compute rows is meant. The first compute * clause has \a computeid == 1. * \param column Nth in the result set, starting with 1. * \return pointer to ASCII null-terminated string, the name of the column. * \retval NULL \a column is not in range. * \sa dbcollen(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(). */ const char * dbacolname(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbacolname(%p, %d, %d)\n", dbproc, computeid, column); colinfo = dbacolptr(dbproc, computeid, column, 1); if (!colinfo) return NULL; return tds_dstr_cstr(&colinfo->column_name); } /** * \ingroup dblib_core * \brief Read a row from the row buffer. * * When row buffering is enabled (DBBUFFER option is on), the client can use dbgetrow() to re-read a row previously fetched * with dbnextrow(). The effect is to move the row pointer -- analogous to fseek() -- back to \a row. * Calls to dbnextrow() read from \a row + 1 until the buffer is exhausted, at which point it resumes * its normal behavior, except that as each row is fetched from the server, it is added to the row * buffer (in addition to being returned to the client). When the buffer is filled, dbnextrow() returns * \c FAIL until the buffer is at least partially emptied with dbclrbuf(). * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param row Nth row to read, starting with 1. * \retval REG_ROW returned row is a regular row. * \returns computeid when returned row is a compute row. * \retval NO_MORE_ROWS no such row in the row buffer. Current row is unchanged. * \retval FAIL unsuccessful; row buffer may be full. * \sa dbaltbind(), dbbind(), dbclrbuf(), DBCURROW(), DBFIRSTROW(), DBLASTROW(), dbnextrow(), dbsetrow(). */ RETCODE dbgetrow(DBPROCESS * dbproc, DBINT row) { RETCODE result = FAIL; const int idx = buffer_row2idx(&dbproc->row_buf, row); tdsdump_log(TDS_DBG_FUNC, "dbgetrow(%p, %d)\n", dbproc, row); CHECK_CONN(FAIL); if (-1 == idx) return NO_MORE_ROWS; dbproc->row_buf.current = idx; buffer_transfer_bound_data(&dbproc->row_buf, TDS_ROW_RESULT, 0, dbproc, idx); result = REG_ROW; return result; } /** * \ingroup dblib_core * \brief Define substitution values to be used when binding null values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param bindtype type of binding to which the substitute value will apply. * \param bindlen size of the substitute value you are supplying, in bytes. * Ignored except for CHARBIND and BINARYBIND. * \param bindval pointer to a buffer containing the substitute value. * \retval SUCCEED query was processed without errors. * \retval FAIL query was not processed * \sa dbaltbind(), dbbind(), dbconvert(), dbnullbind(). */ RETCODE dbsetnull(DBPROCESS * dbproc, int bindtype, int bindlen, BYTE *bindval) { BYTE *pval; tdsdump_log(TDS_DBG_FUNC, "dbsetnull(%p, %d, %d, %p)\n", dbproc, bindtype, bindlen, bindval); CHECK_CONN(FAIL); CHECK_PARAMETER(bindval, SYBENBVP, FAIL); switch (bindtype) { case DATETIMEBIND: case DECIMALBIND: case SRCDECIMALBIND: case FLT8BIND: case INTBIND: case MONEYBIND: case NUMERICBIND: case SRCNUMERICBIND: case REALBIND: case SMALLBIND: case SMALLDATETIMEBIND: case SMALLMONEYBIND: case TINYBIND: case BIGINTBIND: case DATEBIND: case TIMEBIND: case BIGDATETIMEBIND: case BIGTIMEBIND: bindlen = (int)default_null_representations[bindtype].len; break; case CHARBIND: case BINARYBIND: CHECK_PARAMETER(bindlen >= 0, SYBEBBL, FAIL); break; case NTBSTRINGBIND: bindlen = (int)strlen((char *) bindval); break; case STRINGBIND: bindlen = (int)strlen((char *) bindval); break; case VARYBINBIND: bindlen = ((DBVARYBIN*) bindval)->len; break; case VARYCHARBIND: bindlen = ((DBVARYCHAR*) bindval)->len; break; #if 0 case SENSITIVITYBIND: case BOUNDARYBIND: #endif default: dbperror(dbproc, SYBEBTYP, 0); return FAIL; } if ((pval = tds_new(BYTE, bindlen)) == NULL) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } /* free any prior allocation */ if (dbproc->nullreps[bindtype].bindval != default_null_representations[bindtype].bindval) free((BYTE*)dbproc->nullreps[bindtype].bindval); memcpy(pval, bindval, bindlen); dbproc->nullreps[bindtype].bindval = pval; dbproc->nullreps[bindtype].len = bindlen; tdsdump_dump_buf(TDS_DBG_NETWORK, "null representation set ", pval, bindlen); return SUCCEED; } /** * \ingroup dblib_core * \brief Make a buffered row "current" without fetching it into bound variables. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval MORE_ROWS row found * \retval NO_MORE_ROWS row not found * \retval FAIL \a dbproc is dead or not enabled * \sa dbaltbind(), dbbind(), dbcanquery(), dbclrbuf(), dbgetrow(), dbnextrow(), dbprrow(). */ STATUS dbsetrow(DBPROCESS * dbproc, DBINT row) { const int idx = buffer_row2idx(&dbproc->row_buf, row); tdsdump_log(TDS_DBG_FUNC, "dbsetrow(%p, %d)\n", dbproc, row); CHECK_CONN(FAIL); if (-1 == idx) return NO_MORE_ROWS; dbproc->row_buf.current = idx; /* FIXME: should determine REG_ROW or compute_id; */ return REG_ROW; } /** * \ingroup dblib_core * \brief Read result row into the row buffer and into any bound host variables. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval REG_ROW regular row has been read. * \returns computeid when a compute row is read. * \retval BUF_FULL reading next row would cause the buffer to be exceeded (and buffering is turned on). * No row was read from the server * \sa dbaltbind(), dbbind(), dbcanquery(), dbclrbuf(), dbgetrow(), dbprrow(), dbsetrow(). */ struct pivot_t; STATUS dbnextrow(DBPROCESS * dbproc) { TDSRESULTINFO *resinfo; TDSSOCKET *tds; STATUS result = FAIL; TDS_INT res_type; TDS_INT computeid; int idx; /* row buffer index. Unless DBUFFER is on, idx will always be 0. */ struct pivot_t *pivot; tdsdump_log(TDS_DBG_FUNC, "dbnextrow(%p)\n", dbproc); CHECK_CONN(FAIL); tds = dbproc->tds_socket; resinfo = tds->res_info; tdsdump_log(TDS_DBG_FUNC, "dbnextrow() dbresults_state = %d (%s)\n", dbproc->dbresults_state, prdbresults_state(dbproc->dbresults_state)); if (!resinfo || dbproc->dbresults_state != _DB_RES_RESULTSET_ROWS) { /* no result set or result set empty (no rows) */ tdsdump_log(TDS_DBG_FUNC, "leaving dbnextrow() returning %d (NO_MORE_ROWS)\n", NO_MORE_ROWS); return dbproc->row_type = NO_MORE_ROWS; } /* * Try to get the dbproc->row_buf.current item from the buffered rows, if any. * Else read from the stream, unless the buffer is exhausted. * If no rows are read, DBROWTYPE() will report NO_MORE_ROWS. */ dbproc->row_type = NO_MORE_ROWS; computeid = REG_ROW; if (-1 != (idx = buffer_current_index(dbproc))) { /* * Cool, the item we want is already there */ result = dbproc->row_type = REG_ROW; res_type = TDS_ROW_RESULT; } else if (buffer_is_full(&dbproc->row_buf)) { result = BUF_FULL; res_type = TDS_ROWFMT_RESULT; } else if ((pivot = dbrows_pivoted(dbproc)) != NULL) { tdsdump_log(TDS_DBG_FUNC, "returning pivoted row\n"); return dbnextrow_pivoted(dbproc, pivot); } else { const int mask = TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE; TDS_INT8 row_count = TDS_NO_COUNT; bool rows_set = false; buffer_save_row(dbproc); /* Get the row from the TDS stream. */ again: switch (tds_process_tokens(tds, &res_type, NULL, mask)) { case TDS_SUCCESS: if (res_type == TDS_ROW_RESULT || res_type == TDS_COMPUTE_RESULT) { if (res_type == TDS_COMPUTE_RESULT) computeid = tds->current_results->computeid; /* Add the row to the row buffer, whose capacity is always at least 1 */ resinfo = tds->current_results; idx = buffer_add_row(dbproc, resinfo); assert(idx != -1); result = dbproc->row_type = (res_type == TDS_ROW_RESULT)? REG_ROW : computeid; #if 0 /* TODO */ tds_process_tokens(tds, &res_type, NULL, TDS_TOKEN_TRAILING); #endif break; } /* allows to process trailing tokens */ if (res_type == TDS_DONEINPROC_RESULT) { if (!rows_set) row_count = tds->rows_affected; rows_set = true; goto again; } /* fall through */ case TDS_NO_MORE_RESULTS: dbproc->dbresults_state = _DB_RES_NEXT_RESULT; result = NO_MORE_ROWS; break; default: tdsdump_log(TDS_DBG_FUNC, "unexpected: leaving dbnextrow() returning FAIL\n"); return FAIL; break; } if (rows_set) tds->rows_affected = row_count; } if (res_type == TDS_ROW_RESULT || res_type == TDS_COMPUTE_RESULT) { /* * Transfer the data from the row buffer to the bound variables. */ buffer_transfer_bound_data(&dbproc->row_buf, res_type, computeid, dbproc, idx); } if (res_type == TDS_COMPUTE_RESULT) { tdsdump_log(TDS_DBG_FUNC, "leaving dbnextrow() returning compute_id %d\n", result); } else { tdsdump_log(TDS_DBG_FUNC, "leaving dbnextrow() returning %d (%s)\n", result, prdbretcode(result)); } return result; } /* dbnextrow() */ static TDS_SERVER_TYPE dblib_bound_type(int bindtype) { switch (bindtype) { case CHARBIND: case STRINGBIND: case NTBSTRINGBIND: return SYBCHAR; break; case FLT8BIND: return SYBFLT8; break; case REALBIND: return SYBREAL; break; case INTBIND: return SYBINT4; break; case SMALLBIND: return SYBINT2; break; case TINYBIND: return SYBINT1; break; case BIGINTBIND: return SYBINT8; break; case DATETIMEBIND: return SYBDATETIME; break; case SMALLDATETIMEBIND: return SYBDATETIME4; break; case DATEBIND: return SYBDATE; break; case TIMEBIND: return SYBTIME; break; case BIGDATETIMEBIND: return SYB5BIGDATETIME; break; case BIGTIMEBIND: return SYB5BIGTIME; break; case MONEYBIND: return SYBMONEY; break; case SMALLMONEYBIND: return SYBMONEY4; break; case BINARYBIND: return SYBBINARY; break; case VARYBINBIND: return SYBVARBINARY; break; case VARYCHARBIND: return SYBVARCHAR; break; case BITBIND: return SYBBIT; break; case NUMERICBIND: case SRCNUMERICBIND: case DECIMALBIND: case SRCDECIMALBIND: return SYBNUMERIC; break; case DATETIME2BIND: return SYBMSDATETIMEOFFSET; break; default: return TDS_INVALID_TYPE; } } /** * \ingroup dblib_core * \brief Convert one datatype to another. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param srctype datatype of the data to convert. * \param src buffer to convert * \param srclen length of \a src * \param desttype target datatype * \param dest output buffer * \param destlen size of \a dest * \returns On success, the count of output bytes in \a dest, else -1. On failure, it will call any user-supplied error handler. * \remarks Causes of failure: * - No such conversion unavailable. * - Character data output was truncated, or numerical data overflowed or lost precision. * - In converting character data to one of the numeric types, the string could not be interpreted as a number. * * Conversion functions are handled in the TDS layer. * * The main reason for this is that \c ct-lib and \c ODBC (and presumably \c DBI) need * to be able to do conversions between datatypes. This is possible because * the format of complex data (dates, money, numeric, decimal) is defined by * its representation on the wire; thus what we call \c DBMONEY is exactly its * format on the wire. CLIs that need a different representation (ODBC?) * need to convert from this format anyway, so the code would already be in * place. * * Each datatype is also defined by its Server-type so all CLIs should be * able to map native types to server types as well. * * tds_convert() copies from src to dest and returns the output data length, * period. All padding and termination is the responsibility of the API library * and is done post-conversion. The peculiar rule in dbconvert() is that * a \a destlen of -1 and a \a desttype of \c SYBCHAR means the output buffer * should be null-terminated. * * \sa dbaltbind(), dbaltbind_ps(), dbbind(), dbbind_ps(), dbconvert_ps(), dberrhandle(), dbsetnull(), dbsetversion(), dbwillconvert(). * \todo What happens if client does not reset values? * \todo Microsoft and Sybase define this function differently. */ DBINT dbconvert_ps(DBPROCESS * dbproc, int db_srctype, const BYTE * src, DBINT srclen, int db_desttype, BYTE * dest, DBINT destlen, DBTYPEINFO * typeinfo) { CONV_RESULT dres; DBINT ret; int i; int len; TDS_SERVER_TYPE srctype, desttype; tdsdump_log(TDS_DBG_FUNC, "dbconvert_ps(%p, %s, %p, %d, %s, %p, %d, %p)\n", dbproc, tds_prdatatype(db_srctype), src, srclen, tds_prdatatype(db_desttype), dest, destlen, typeinfo); /* dbproc and src can be NULLs */ CHECK_PARAMETER(dest, SYBEACNV, -1); DBPERROR_RETURN(!is_tds_type_valid(db_srctype), SYBEUDTY); srctype = (TDS_SERVER_TYPE) db_srctype; DBPERROR_RETURN(!is_tds_type_valid(db_desttype), SYBEUDTY); desttype = (TDS_SERVER_TYPE) db_desttype; if (is_numeric_type(desttype)) { TDS_NUMERIC *d = &dres.n; if (typeinfo == NULL) { if (is_numeric_type(srctype)) { DBNUMERIC *s = (DBNUMERIC *) src; d->precision = s->precision; d->scale = s->scale; } else { d->precision = 18; d->scale = 0; } } else { d->precision = typeinfo->precision; d->scale = typeinfo->scale; } } if (0 == destlen) return 0; if (src == NULL || srclen == 0) { int bind = dbbindtype(desttype); int size = tds_get_size_by_type(desttype); if (bind == NTBSTRINGBIND) { if (destlen > 0) { size = destlen; bind = CHARBIND; } else { size = 1; bind = NTBSTRINGBIND; } } else if (bind == BINARYBIND) { if (destlen > 0) size = destlen; else size = 0; } dbgetnull(dbproc, bind, size, dest); return size; } /* srclen of -1 means the source data is definitely NULL terminated */ if (srclen == -1) srclen = (int)strlen((const char *) src); /* often times we are asked to convert a data type to itself */ if (srctype == desttype && !is_numeric_type(desttype)) { ret = -2; /* to make sure we always set it */ tdsdump_log(TDS_DBG_INFO1, "dbconvert_ps() srctype == desttype\n"); switch (desttype) { case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: if (srclen > destlen && destlen >= 0) { dbperror(dbproc, SYBECOFL, 0); ret = -1; } else { memcpy(dest, src, srclen); if (srclen < destlen) memset(dest + srclen, 0, destlen - srclen); ret = srclen; } break; case SYBCHAR: case SYBVARCHAR: case SYBTEXT: /* srclen of -1 means the source data is definitely NULL terminated */ if (srclen == -1) srclen = (int)strlen((const char *) src); switch (destlen) { case 0: /* nothing to copy */ ret = 0; break; case -1: /* rtrim and null terminate */ while (srclen && src[srclen - 1] == ' ') { --srclen; } /* fall thru */ case -2: /* just null terminate */ memcpy(dest, src, srclen); dest[srclen] = '\0'; ret = srclen; break; default: assert(destlen > 0); if (destlen < 0 || srclen > destlen) { dbperror(dbproc, SYBECOFL, 0); ret = -1; } else { memcpy(dest, src, srclen); if (srclen < destlen) memset(dest + srclen, ' ', destlen - srclen); ret = srclen; } break; } break; case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBREAL: case SYBBIT: case SYBBITN: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBDATE: case SYBTIME: case SYB5BIGDATETIME: case SYB5BIGTIME: case SYBUNIQUE: ret = tds_get_size_by_type(desttype); memcpy(dest, src, ret); break; case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: ret = sizeof(TDS_DATETIMEALL); memcpy(dest, src, ret); break; default: ret = -1; break; } assert(ret > -2); return ret; } /* end srctype == desttype */ /* * Character types need no conversion. Just move the data. */ if (is_similar_type(srctype, desttype)) { if (src && dest && srclen > 0 && destlen >= srclen) { memcpy(dest, src, srclen); return srclen; } } tdsdump_log(TDS_DBG_INFO1, "dbconvert_ps() calling tds_convert\n"); len = tds_convert(g_dblib_ctx.tds_ctx, srctype, src, srclen, desttype, &dres); tdsdump_log(TDS_DBG_INFO1, "dbconvert_ps() called tds_convert returned %d\n", len); if (len < 0) { _dblib_convert_err(dbproc, len); return -1; } switch (desttype) { case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: if (len > destlen && destlen >= 0) { dbperror(dbproc, SYBECOFL, 0); ret = -1; } else { memcpy(dest, dres.ib, len); if (len < destlen) memset(dest + len, 0, destlen - len); ret = len; } free(dres.ib); break; case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBREAL: case SYBBIT: case SYBBITN: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBTIME: case SYBDATE: case SYB5BIGDATETIME: case SYB5BIGTIME: case SYBUNIQUE: case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYBNUMERIC: case SYBDECIMAL: memcpy(dest, &(dres.ti), len); ret = len; break; case SYBCHAR: case SYBVARCHAR: case SYBTEXT: tdsdump_log(TDS_DBG_INFO1, "dbconvert_ps() outputting %d bytes character data destlen = %d \n", len, destlen); if (destlen < -2) destlen = 0; /* failure condition */ switch (destlen) { case 0: ret = -1; break; case -1: /* rtrim and null terminate */ for (i = len - 1; i >= 0 && dres.c[i] == ' '; --i) { len = i; } memcpy(dest, dres.c, len); dest[len] = '\0'; ret = len; break; case -2: /* just null terminate */ memcpy(dest, dres.c, len); dest[len] = 0; ret = len; break; default: assert(destlen > 0); if (destlen < 0 || len > destlen) { dbperror(dbproc, SYBECOFL, 0); ret = -1; tdsdump_log(TDS_DBG_INFO1, "%d bytes type %d -> %d, destlen %d < %d required\n", srclen, srctype, desttype, destlen, len); break; } /* else pad with blanks */ memcpy(dest, dres.c, len); if (len < destlen) memset(dest + len, ' ', destlen - len); ret = len; break; } free(dres.c); break; default: tdsdump_log(TDS_DBG_INFO1, "error: dbconvert_ps(): unrecognized desttype %d \n", desttype); ret = -1; break; } return (ret); } /** * \ingroup dblib_core * \brief cf. dbconvert_ps(), above * * \em Sybase: Convert numeric types. * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param srctype datatype of the data to convert. * \param src buffer to convert * \param srclen length of \a src * \param desttype target datatype * \param dest output buffer * \param destlen size of \a dest * \param typeinfo address of a \c DBTYPEINFO structure that governs the precision & scale of the output, may be \c NULL. * \sa dbaltbind(), dbaltbind_ps(), dbbind(), dbbind_ps(), dbconvert_ps(), dberrhandle(), dbsetnull(), dbsetversion(), dbwillconvert(). */ DBINT dbconvert(DBPROCESS * dbproc, int srctype, const BYTE * src, DBINT srclen, int desttype, BYTE * dest, DBINT destlen) { DBTYPEINFO ti, *pti = NULL; tdsdump_log(TDS_DBG_FUNC, "dbconvert(%p)\n", dbproc); /* dbproc can be NULL*/ DBPERROR_RETURN(!is_tds_type_valid(desttype), SYBEUDTY); if (is_numeric_type(desttype)) { DBNUMERIC *num; /* FIXME what happen if client do not reset values ??? */ if (dbproc->msdblib) { num = (DBNUMERIC *) dest; ti.precision = num->precision; ti.scale = num->scale; pti = &ti; } else { /* for Sybase passing NULL as DBTYPEINFO is fine */ } } return dbconvert_ps(dbproc, srctype, src, srclen, desttype, dest, destlen, pti); } /** * \ingroup dblib_core * \brief Tie a host variable to a resultset column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth column, starting at 1. * \param vartype datatype of the host variable that will receive the data * \param varlen size of host variable pointed to \a varaddr * \param varaddr address of host variable * \retval SUCCEED everything worked. * \retval FAIL no such \a column or no such conversion possible, or target buffer too small. * \sa */ RETCODE dbbind(DBPROCESS * dbproc, int column, int vartype, DBINT varlen, BYTE * varaddr) { TDSCOLUMN *colinfo = NULL; TDSRESULTINFO* results; TDS_SERVER_TYPE srctype, desttype; tdsdump_log(TDS_DBG_FUNC, "dbbind(%p, %d, %d, %d, %p)\n", dbproc, column, vartype, varlen, varaddr); CHECK_CONN(FAIL); CHECK_PARAMETER(varaddr, SYBEABNV, FAIL); results = dbproc->tds_socket->res_info; if (results == NULL || results->num_cols < column || column < 1) { dbperror(dbproc, SYBEABNC, 0); return FAIL; } if (varlen < 0) { switch (vartype) { case CHARBIND: case STRINGBIND: case NTBSTRINGBIND: case VARYCHARBIND: case VARYBINBIND: /* * No message for this error. Documentation doesn't define varlen < 0, but * experimentation with Sybase db-lib shows it's accepted as if zero. */ tdsdump_log(TDS_DBG_FUNC, "dbbind: setting varlen (%d) to 0\n", varlen); varlen = 0; break; } } if (0 == varlen) { /* "Note that if varlen is 0, no padding takes place." */ switch (vartype) { case CHARBIND: case STRINGBIND: case NTBSTRINGBIND: varlen = -1; break; default: break; /* dbconvert: "The destlen is ignored for all fixed-length, non-NULL data types." */ } } dbproc->avail_flag = FALSE; colinfo = dbproc->tds_socket->res_info->columns[column - 1]; srctype = tds_get_conversion_type(colinfo->column_type, colinfo->column_size); desttype = dblib_bound_type(vartype); if (desttype == TDS_INVALID_TYPE) { dbperror(dbproc, SYBEBTYP, 0); return FAIL; } if (!dbwillconvert(srctype, desttype)) { dbperror(dbproc, SYBEABMT, 0); return FAIL; } colinfo->column_varaddr = (char *) varaddr; colinfo->column_bindtype = vartype; colinfo->column_bindlen = varlen; return SUCCEED; } /* dbbind() */ /** * \ingroup dblib_core * \brief set name and location of the \c interfaces file FreeTDS should use to look up a servername. * * Does not affect lookups or location of \c freetds.conf. * \param filename name of \c interfaces * \sa dbopen() */ void dbsetifile(char *filename) { tdsdump_log(TDS_DBG_FUNC, "dbsetifile(%s)\n", filename? filename : "0x00"); if (filename == NULL) { dbperror(NULL, SYBENULP, 0); return; } tds_set_interfaces_file_loc(filename); } /** * \ingroup dblib_core * \brief Tie a null-indicator to a regular result column. * * * When a row is fetched, the indicator variable tells the state of the column's data. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth column in the result set, starting with 1. * \param indicator address of host variable. * \retval SUCCEED variable accepted. * \retval FAIL \a indicator is NULL or \a column is out of range. * \remarks Contents of \a indicator are set with \c dbnextrow(). Possible values are: * - 0 \a column bound successfully * - -1 \a column is NULL. * - >0 true length of data, had \a column not been truncated due to insufficient space in the columns bound host variable . * \sa dbanullbind(), dbbind(), dbdata(), dbdatlen(), dbnextrow(). */ RETCODE dbnullbind(DBPROCESS * dbproc, int column, DBINT * indicator) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbnullbind(%p, %d, %p)\n", dbproc, column, indicator); colinfo = dbcolptr(dbproc, column); if (!colinfo) return FAIL; /* dbcolptr sent SYBECNOR, Column number out of range */ colinfo->column_nullbind = (TDS_SMALLINT *)indicator; return SUCCEED; } /** * \ingroup dblib_core * \brief Tie a null-indicator to a compute result column. * * * When a row is fetched, the indicator variable tells the state of the column's data. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid identifies which one of potientially many compute rows is meant. The first compute * clause has \a computeid == 1. * \param column Nth column in the result set, starting with 1. * \param indicator address of host variable. * \retval SUCCEED variable accepted. * \retval FAIL \a indicator is NULL or \a column is out of range. * \remarks Contents of \a indicator are set with \c dbnextrow(). Possible values are: * - 0 \a column bound successfully * - -1 \a column is NULL. * - >0 true length of data, had \a column not been truncated due to insufficient space in the columns bound host variable . * \sa dbadata(), dbadlen(), dbaltbind(), dbnextrow(), dbnullbind(). * \todo Never fails, but only because failure conditions aren't checked. */ RETCODE dbanullbind(DBPROCESS * dbproc, int computeid, int column, DBINT * indicator) { TDSCOLUMN *curcol; tdsdump_log(TDS_DBG_FUNC, "dbanullbind(%p, %d, %d, %p)\n", dbproc, computeid, column, indicator); curcol = dbacolptr(dbproc, computeid, column, 1); if (!curcol) return FAIL; /* * XXX Need to check for possibly problems before assuming * everything is okay */ curcol->column_nullbind = (TDS_SMALLINT *)indicator; return SUCCEED; } /** * \ingroup dblib_core * \brief Indicates whether or not the count returned by dbcount is real (Microsoft-compatibility feature). * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \returns TRUE if the count returned by dbcount is real or FALSE if the count returned by dbcount is not real. * \sa DBCOUNT(), dbcount(). */ BOOL dbiscount(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbiscount(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, -1); return dbproc->tds_socket && dbproc->tds_socket->rows_affected != TDS_NO_COUNT; } /** * \ingroup dblib_core * \brief Get count of rows processed * * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \returns * - for insert/update/delete, count of rows affected. * - for select, count of rows returned, after all rows have been fetched. * \sa DBCOUNT(), dbnextrow(), dbresults(). */ DBINT dbcount(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbcount(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, -1); if (!dbproc->tds_socket || dbproc->tds_socket->rows_affected == TDS_NO_COUNT) return -1; return (DBINT)dbproc->tds_socket->rows_affected; } /** * \ingroup dblib_core * \brief Clear \a n rows from the row buffer. * * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param n number of rows to remove, >= 0. * \sa dbgetrow(), dbnextrow(), dbsetopt(). */ void dbclrbuf(DBPROCESS * dbproc, DBINT n) { tdsdump_log(TDS_DBG_FUNC, "dbclrbuf(%p, %d)\n", dbproc, n); CHECK_PARAMETER(dbproc, SYBENULL, ); if (n <= 0) return; if (dbproc->dbopts[DBBUFFER].factive) { DBPROC_ROWBUF * buf = &(dbproc->row_buf); int count = buffer_count(buf); if (n >= count) n = count - 1; buffer_delete_rows(&(dbproc->row_buf), n); } } /** * \ingroup dblib_core * \brief Test whether or not a datatype can be converted to another datatype * * \param srctype type converting from * \param desttype type converting to * \remarks dbwillconvert() lies sometimes. Some datatypes \em should be convertible but aren't yet in our implementation. * Legal unimplemented conversions return \em TRUE. * \retval TRUE convertible, or should be. * \retval FAIL not convertible. * \sa dbaltbind(), dbbind(), dbconvert(), dbconvert_ps(), \c src/dblib/unittests/convert().c(). */ DBBOOL dbwillconvert(int srctype, int desttype) { tdsdump_log(TDS_DBG_FUNC, "dbwillconvert(%s, %s)\n", tds_prdatatype(srctype), tds_prdatatype(desttype)); return tds_willconvert(srctype, desttype) ? TRUE : FALSE; } static int dblib_coltype(TDSCOLUMN *colinfo) { switch (colinfo->column_type) { case SYBVARCHAR: return SYBCHAR; case SYBVARBINARY: return SYBBINARY; case SYBLONGCHAR: case SYBUNITEXT: case SYBMSXML: return SYBTEXT; /* these types are handled by tds_get_conversion_type */ case SYBBITN: case SYBDATEN: case SYBDATETIMN: case SYBFLTN: case SYBINTN: case SYBMONEYN: case SYBTIMEN: case SYBUINTN: break; /* these types are supported */ case SYBCHAR: case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBREAL: case SYBBINARY: case SYBVOID: case SYBNUMERIC: case SYBDECIMAL: case SYBNVARCHAR: case SYBDATE: case SYBTIME: case SYB5BIGDATETIME: case SYB5BIGTIME: case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: break; /* exclude cardinal types */ case XSYBVARBINARY: case XSYBBINARY: case XSYBNVARCHAR: case XSYBVARCHAR: case XSYBNCHAR: case SYB5INT8: break; #if !ENABLE_EXTRA_CHECKS /* TODO these should be handled in some ways */ case SYBUNIQUE: /* or SYBBLOB */ case SYBVARIANT: case SYBMSUDT: case SYBLONGBINARY: case SYBUINT1: case SYBUINT2: case SYBUINT4: case SYBUINT8: case SYBINTERVAL: case SYBSINT1: case SYBXML: break; #endif } return tds_get_conversion_type(colinfo->column_type, colinfo->column_size); } /** * \ingroup dblib_core * \brief Get the datatype of a regular result set column. * * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \returns \c SYB* datetype token value, or zero if \a column out of range * \sa dbcollen(), dbcolname(), dbdata(), dbdatlen(), dbnumcols(), dbprtype(), dbvarylen(). */ int dbcoltype(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbcoltype(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return -1; return dblib_coltype(colinfo); } /** * \ingroup dblib_core * \brief Get user-defined datatype of a regular result column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \returns \c SYB* datetype token value, or -1 if \a column out of range * \sa dbaltutype(), dbcoltype(). */ int dbcolutype(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbcolutype(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return -1; return colinfo->column_usertype; } /** * \ingroup dblib_core * \brief Get precision and scale information for a regular result column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \return Pointer to a DBTYPEINFO structure . NULL \a column is out of range. * \sa dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(), dbprtype(), dbvarylen(). */ DBTYPEINFO * dbcoltypeinfo(DBPROCESS * dbproc, int column) { /* moved typeinfo from static into dbproc structure to make thread safe. (mlilback 11/7/01) */ TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbcoltypeinfo(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return NULL; dbproc->typeinfo.precision = colinfo->column_prec; dbproc->typeinfo.scale = colinfo->column_scale; return &dbproc->typeinfo; } /** * \brief Get a bunch of column attributes with a single call (Microsoft-compatibility feature). * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param type must be CI_REGULAR or CI_ALTERNATE (CI_CURSOR is defined by the vendor, but is not yet implemented). * \param column Nth in the result set, starting from 1. * \param computeid (ignored) * \param pdbcol address of structure to be populated by this function. * \return SUCCEED or FAIL. * \sa dbcolbrowse(), dbqual(), dbtabbrowse(), dbtabcount(), dbtabname(), dbtabsource(), dbtsnewlen(), dbtsnewval(), dbtsput(). * \todo Support cursor rows. */ RETCODE dbcolinfo(DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol) { DBTYPEINFO *ps; TDSCOMPUTEINFO *info; TDSCOLUMN *colinfo; unsigned int i; tdsdump_log(TDS_DBG_FUNC, "dbcolinfo(%p, %d, %d, %d, %p)\n", dbproc, type, column, computeid, pdbcol); colinfo = dbcolptr(dbproc, column); if (!colinfo) return FAIL; CHECK_NULP(pdbcol, "dbcolinfo", 5, FAIL); if (type == CI_REGULAR) { strlcpy(pdbcol->Name, dbcolname(dbproc, column), sizeof(pdbcol->Name)); strlcpy(pdbcol->ActualName, dbcolname(dbproc, column), sizeof(pdbcol->ActualName)); strlcpy(pdbcol->TableName, tds_dstr_cstr(&colinfo->table_name), sizeof(pdbcol->TableName)); pdbcol->Type = dbcoltype(dbproc, column); pdbcol->UserType = dbcolutype(dbproc, column); pdbcol->MaxLength = dbcollen(dbproc, column); pdbcol->Null = _dbnullable(dbproc, column); pdbcol->VarLength = dbvarylen(dbproc, column); ps = dbcoltypeinfo(dbproc, column); if( ps ) { pdbcol->Precision = ps->precision; pdbcol->Scale = ps->scale; } pdbcol->Updatable = colinfo->column_writeable ? TRUE : FALSE; pdbcol->Identity = colinfo->column_identity ? TRUE : FALSE; return SUCCEED; } if (type == CI_ALTERNATE) { if (computeid == 0) return FAIL; for (i = 0;; ++i) { if (i >= dbproc->tds_socket->num_comp_info) return FAIL; info = dbproc->tds_socket->comp_info[i]; if (info->computeid == computeid) break; } /* if either the compute id or the column number are invalid, return -1 */ if (column < 1 || column > info->num_cols) return FAIL; colinfo = info->columns[column - 1]; strlcpy(pdbcol->Name, tds_dstr_cstr(&colinfo->column_name), sizeof(pdbcol->Name)); strlcpy(pdbcol->ActualName, tds_dstr_cstr(&colinfo->column_name), sizeof(pdbcol->ActualName)); strlcpy(pdbcol->TableName, tds_dstr_cstr(&colinfo->table_name), sizeof(pdbcol->TableName)); pdbcol->Type = dbalttype(dbproc, computeid, column); pdbcol->UserType = dbaltutype(dbproc, computeid, column); pdbcol->MaxLength = dbaltlen(dbproc, computeid, column); if (colinfo->column_nullable) pdbcol->Null = TRUE; else pdbcol->Null = FALSE; pdbcol->VarLength = FALSE; if (colinfo->column_nullable || is_nullable_type(colinfo->column_type)) pdbcol->VarLength = TRUE; pdbcol->Precision = colinfo->column_prec; pdbcol->Scale = colinfo->column_scale; pdbcol->Updatable = colinfo->column_writeable ? TRUE : FALSE ; pdbcol->Identity = colinfo->column_identity ? TRUE : FALSE ; return SUCCEED; } return FAIL; } /** * \ingroup dblib_core * \brief Get base database column name for a result set column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \return pointer to ASCII null-terminated string, the name of the column. On error, NULL. * \sa dbcolbrowse(), dbqual(), dbtabbrowse(), dbtabcount(), dbtabname(), dbtabsource(), dbtsnewlen(), dbtsnewval(), dbtsput(). */ char * dbcolsource(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbcolsource(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return NULL; return tds_dstr_buf(tds_dstr_isempty(&colinfo->table_column_name) ? &colinfo->column_name : &colinfo->table_column_name); } /** * \ingroup dblib_core * \brief Get size of a regular result column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \return size of the column (not of data in any particular row). On error, -1. * \sa dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(). */ DBINT dbcollen(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbcollen(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return -1; return colinfo->column_size; } /** * \ingroup dblib_core * \brief Get size of a result column needed to print column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \return size of the column in characters (not of data in any particular row). On error, -1. * \sa dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(). */ DBINT dbprcollen(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbprcollen(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return 0; return _get_printable_size(colinfo); } /* dbvarylen(), pkleef@openlinksw.com 01/21/02 */ /** * \ingroup dblib_core * \brief Determine whether a column can vary in size. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \retval TRUE datatype of column can vary in size, or is nullable. * \retval FALSE datatype of column is fixed and is not nullable. * \sa dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbdatlen(), dbnumcols(), dbprtype(). */ DBINT dbvarylen(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbvarylen(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return FALSE; if (colinfo->column_nullable) return TRUE; switch (colinfo->column_type) { /* variable length fields */ case SYBNVARCHAR: case SYBVARBINARY: case SYBVARCHAR: case XSYBVARCHAR: case XSYBNVARCHAR: case XSYBVARBINARY: return TRUE; /* types that can be null */ case SYBBITN: case SYBDATETIMN: case SYBDECIMAL: case SYBFLTN: case SYBINTN: case SYBMONEYN: case SYBNUMERIC: case SYBDATEN: case SYBTIMEN: case SYBUINTN: case SYB5BIGDATETIME: case SYB5BIGTIME: case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYBVARIANT: case SYBUNIQUE: return TRUE; /* blob types */ case SYBIMAGE: case SYBNTEXT: case SYBTEXT: case SYBLONGBINARY: /* case SYBBLOB: */ /* same as SYBUNIQUE */ case SYB5INT8: case SYBUNITEXT: case SYBXML: case SYBMSUDT: case SYBMSXML: return TRUE; case SYBLONGCHAR: /* case XSYBCHAR: */ /* same as SYBLONGCHAR */ if (colinfo->column_varint_size >= 4) return TRUE; break; /* with defined size*/ case SYBCHAR: case SYBBINARY: case XSYBNCHAR: case XSYBBINARY: break; /* fixed */ case SYBINT1: case SYBINT2: case SYBINT4: case SYBFLT8: case SYBDATETIME: case SYBBIT: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBREAL: case SYBINT8: case SYBUINT1: case SYBUINT2: case SYBUINT4: case SYBUINT8: case SYBSINT1: case SYBTIME: case SYBDATE: case SYBVOID: case SYBINTERVAL: break; } return FALSE; } /** * \ingroup dblib_core * \brief Get size of current row's data in a regular result column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \return size of the data, in bytes. * \sa dbcollen(), dbcolname(), dbcoltype(), dbdata(), dbnumcols(). */ DBINT dbdatlen(DBPROCESS * dbproc, int column) { DBINT len; TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbdatlen(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo) return -1; len = (colinfo->column_cur_size < 0)? 0 : colinfo->column_cur_size; tdsdump_log(TDS_DBG_FUNC, "dbdatlen() type = %d, len= %d\n", colinfo->column_type, len); return len; } /** * \ingroup dblib_core * \brief Get address of data in a regular result column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \return pointer the data, or NULL if data are NULL, or if \a column is out of range. * \sa dbbind(), dbcollen(), dbcolname(), dbcoltype(), dbdatlen(), dbnumcols(). */ BYTE * dbdata(DBPROCESS * dbproc, int column) { tdsdump_log(TDS_DBG_FUNC, "dbdata(%p, %d)\n", dbproc, column); return _dbcoldata(dbcolptr(dbproc, column)); } /** \internal * \ingroup dblib_internal * \brief Return data from a column * * \param colinfo contains information on a result column. * \return pointer to the data, or NULL if data are NULL * \sa dbdata(), dbretdata() */ static BYTE * _dbcoldata(TDSCOLUMN *colinfo) { BYTE *res; const static BYTE empty[1] = { 0 }; if (!colinfo || colinfo->column_cur_size < 0) return NULL; res = colinfo->column_data; if (is_blob_col(colinfo)) res = (BYTE *) ((TDSBLOB *) res)->textvalue; if (!res) return (BYTE *) empty; return res; } /** * \ingroup dblib_core * \brief Cancel the current command batch. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval SUCCEED always. * \sa dbcanquery(), dbnextrow(), dbresults(), dbsetinterrupt(), dbsqlexec(), dbsqlok(), dbsqlsend(). * \todo Check for failure and return accordingly. */ RETCODE dbcancel(DBPROCESS * dbproc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "dbcancel(%p)\n", dbproc); CHECK_CONN(FAIL); tds = dbproc->tds_socket; tds_send_cancel(tds); tds_process_cancel(tds); return SUCCEED; } /** * \ingroup dblib_core * \brief Determine size buffer required to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row(). * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return size of buffer requirement, in bytes. * \remarks An esoteric function. * \sa dbprhead(), dbprrow(), dbspr1row(), dbsprhead(), dbsprline(). */ DBINT dbspr1rowlen(DBPROCESS * dbproc) { TDSSOCKET *tds; int col, len = 0; tdsdump_log(TDS_DBG_FUNC, "dbspr1rowlen(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); CHECK_PARAMETER(dbproc->tds_socket, SYBEDDNE, 0); tds = dbproc->tds_socket; for (col = 0; col < tds->res_info->num_cols; col++) { TDSCOLUMN *colinfo = tds->res_info->columns[col]; int collen = _get_printable_size(colinfo); int namlen = tds_dstr_len(&colinfo->column_name); len += collen > namlen ? collen : namlen; if (col > 0) /* allow for the space between columns */ len += dbstring_length(dbproc->dbopts[DBPRCOLSEP].param); } return ++len; /* allow for the nul */ } /** * \ingroup dblib_core * \brief Print a regular result row to a buffer. * * Fills a buffer with one data row, represented as a null-terminated ASCII string. Helpful for debugging. * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param buffer \em output: Address of a buffer to hold ASCII null-terminated string. * \param buf_len size of \a buffer, in bytes. * \retval SUCCEED on success. * \retval FAIL trouble encountered. * \sa dbclropt(), dbisopt(), dbprhead(), dbprrow(), dbspr1rowlen(), dbsprhead(), dbsprline(). */ RETCODE dbspr1row(DBPROCESS * dbproc, char *buffer, DBINT buf_len) { TDSSOCKET *tds; TDSDATEREC when; int i, c, col; DBINT len; tdsdump_log(TDS_DBG_FUNC, "dbspr1row(%p, %s, %d)\n", dbproc, buffer, buf_len); CHECK_CONN(FAIL); CHECK_NULP(buffer, "dbspr1row", 2, FAIL); if (!dbproc->tds_socket) return FAIL; tds = dbproc->tds_socket; for (col = 0; col < tds->res_info->num_cols; col++) { int padlen, collen, namlen; TDSCOLUMN *colinfo = tds->res_info->columns[col]; if (colinfo->column_cur_size < 0) { len = 4; if (buf_len <= len) { return FAIL; } strcpy(buffer, "NULL"); } else { TDS_SERVER_TYPE desttype, srctype; desttype = dblib_bound_type(STRINGBIND); srctype = tds_get_conversion_type(colinfo->column_type, colinfo->column_size); if (is_datetime_type(srctype)) { tds_datecrack(srctype, dbdata(dbproc, col + 1), &when); len = (int)tds_strftime(buffer, buf_len, STD_DATETIME_FMT, &when, 3); } else { len = dbconvert(dbproc, srctype, dbdata(dbproc, col + 1), dbdatlen(dbproc, col + 1), desttype, (BYTE *) buffer, buf_len); } if (len == -1) { return FAIL; } } buffer += len; buf_len -= len; collen = _get_printable_size(colinfo); namlen = tds_dstr_len(&colinfo->column_name); padlen = (collen > namlen ? collen : namlen) - len; if ((c = dbstring_getchar(dbproc->dbopts[DBPRPAD].param, 0)) == -1) { c = ' '; } for (; padlen > 0; padlen--) { if (buf_len < 1) { return FAIL; } *buffer++ = c; buf_len--; } if ((col + 1) < tds->res_info->num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i)) != -1) { if (buf_len < 1) { return FAIL; } *buffer++ = c; buf_len--; i++; } } } if (buf_len < 1) { return FAIL; } *buffer = '\0'; return SUCCEED; } /** * \ingroup dblib_core * \brief Print a result set to stdout. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbbind(), dbnextrow(), dbprhead(), dbresults(), dbspr1row(), dbsprhead(), dbsprline(). */ RETCODE dbprrow(DBPROCESS * dbproc) { TDSCOLUMN *colinfo; TDSRESULTINFO *resinfo; TDSSOCKET *tds; int i, col, collen, namlen, len; char dest[8192]; int desttype, srctype; TDSDATEREC when; STATUS status; int padlen; int c; int selcol; int linechar; int op; const char *opname; /* these are for compute rows */ DBINT computeid, num_cols, colid; TDS_SMALLINT *col_printlens = NULL; tdsdump_log(TDS_DBG_FUNC, "dbprrow(%p)\n", dbproc); CHECK_CONN(FAIL); tds = dbproc->tds_socket; while ((status = dbnextrow(dbproc)) != NO_MORE_ROWS) { if (status == FAIL) { free(col_printlens); return FAIL; } if (status == REG_ROW) { resinfo = tds->res_info; if (col_printlens == NULL) { if ((col_printlens = tds_new0(TDS_SMALLINT, resinfo->num_cols)) == NULL) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } } for (col = 0; col < resinfo->num_cols; col++) { colinfo = resinfo->columns[col]; if (colinfo->column_cur_size < 0) { len = 4; strcpy(dest, "NULL"); } else { desttype = dblib_bound_type(STRINGBIND); srctype = tds_get_conversion_type(colinfo->column_type, colinfo->column_size); if (is_datetime_type(srctype)) { tds_datecrack(srctype, dbdata(dbproc, col + 1), &when); len = (int)tds_strftime(dest, sizeof(dest), STD_DATETIME_FMT, &when, 3); } else { len = dbconvert(dbproc, srctype, dbdata(dbproc, col + 1), dbdatlen(dbproc, col + 1), desttype, (BYTE *) dest, sizeof(dest)); } } printf("%.*s", len, dest); collen = _get_printable_size(colinfo); namlen = tds_dstr_len(&colinfo->column_name); padlen = (collen > namlen ? collen : namlen) - len; c = dbstring_getchar(dbproc->dbopts[DBPRPAD].param, 0); for (; c > -1 && padlen > 0; padlen--) { putchar(c); } if ((col + 1) < resinfo->num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i++)) != -1) { putchar(c); } } col_printlens[col] = collen; } i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRLINESEP].param, i++)) != -1) { putchar(c); } } else { computeid = status; for (i = 0;; ++i) { if (i >= tds->num_comp_info) { free(col_printlens); return FAIL; } resinfo = tds->comp_info[i]; if (resinfo->computeid == computeid) break; } num_cols = dbnumalts(dbproc, computeid); tdsdump_log(TDS_DBG_FUNC, "dbprrow num compute cols = %d\n", num_cols); i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRLINESEP].param, i++)) != -1) { putchar(c); } for (selcol = col = 1; col <= num_cols; col++) { tdsdump_log(TDS_DBG_FUNC, "dbprrow calling dbaltcolid(%d,%d)\n", computeid, col); colid = dbaltcolid(dbproc, computeid, col); /* * The pad character is pointed to by dbopts[DBPRPAD].param. If that pointer * is NULL -- meaning padding is turned off -- dbstring_getchar returns -1. */ while (selcol < colid) { for (i = 0; i < col_printlens[selcol - 1]; i++) { if ((c = dbstring_getchar(dbproc->dbopts[DBPRPAD].param, 0)) >= 0) putchar(c); } selcol++; i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i++)) != -1) { putchar(c); } } op = dbaltop(dbproc, computeid, col); opname = dbprtype(op); printf("%s", opname); for (i = 0; i < ((long) col_printlens[selcol - 1] - (long) strlen(opname)); i++) { if ((c = dbstring_getchar(dbproc->dbopts[DBPRPAD].param, 0)) >= 0) putchar(c); } selcol++; if ((colid + 1) < num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i++)) != -1) { putchar(c); } } } i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRLINESEP].param, i++)) != -1) { putchar(c); } for (selcol = col = 1; col <= num_cols; col++) { tdsdump_log(TDS_DBG_FUNC, "dbprrow calling dbaltcolid(%d,%d)\n", computeid, col); colid = dbaltcolid(dbproc, computeid, col); while (selcol < colid) { for (i = 0; i < col_printlens[selcol - 1]; i++) { putchar(' '); } selcol++; i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i++)) != -1) { putchar(c); } } if (resinfo->by_cols > 0) { linechar = '-'; } else { linechar = '='; } for (i = 0; i < col_printlens[colid - 1]; i++) putchar(linechar); selcol++; if ((colid + 1) < num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i++)) != -1) { putchar(c); } } } i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRLINESEP].param, i++)) != -1) { putchar(c); } for (selcol = col = 1; col <= num_cols; col++) { colinfo = resinfo->columns[col - 1]; desttype = dblib_bound_type(STRINGBIND); srctype = dbalttype(dbproc, computeid, col); if (is_datetime_type(srctype)) { tds_datecrack(srctype, dbadata(dbproc, computeid, col), &when); len = (int)tds_strftime(dest, sizeof(dest), STD_DATETIME_FMT, &when, 3); } else { len = dbconvert(dbproc, srctype, dbadata(dbproc, computeid, col), -1, desttype, (BYTE *) dest, sizeof(dest)); } tdsdump_log(TDS_DBG_FUNC, "dbprrow calling dbaltcolid(%d,%d)\n", computeid, col); colid = dbaltcolid(dbproc, computeid, col); tdsdump_log(TDS_DBG_FUNC, "dbprrow select column = %d\n", colid); while (selcol < colid) { for (i = 0; i < col_printlens[selcol - 1]; i++) { putchar(' '); } selcol++; i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i++)) != -1) { putchar(c); } } printf("%.*s", len, dest); collen = _get_printable_size(colinfo); namlen = tds_dstr_len(&colinfo->column_name); padlen = (collen > namlen ? collen : namlen) - len; if ((c = dbstring_getchar(dbproc->dbopts[DBPRPAD].param, 0)) == -1) { c = ' '; } for (; padlen > 0; padlen--) { putchar(c); } selcol++; if ((colid + 1) < num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i++)) != -1) { putchar(c); } } } i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRLINESEP].param, i++)) != -1) { putchar(c); } } } free(col_printlens); return SUCCEED; } static int _get_printable_size(TDSCOLUMN * colinfo) { switch (tds_get_conversion_type(colinfo->column_type, colinfo->column_size)) { case SYBINT1: return 3; case SYBINT2: return 6; case SYBINT4: return 11; case SYBINT8: return 21; case SYBVARCHAR: case SYBCHAR: case SYBTEXT: case SYBNTEXT: case SYBNVARCHAR: case SYBLONGCHAR: return colinfo->column_size; case SYBBINARY: case SYBIMAGE: case SYBLONGBINARY: case SYBVARBINARY: return colinfo->column_size * 2u; case SYBFLT8: case SYBREAL: return 11; /* FIX ME -- we do not track precision */ case SYBMONEY4: return 12; case SYBMONEY: return 22; case SYB5BIGDATETIME: case SYBDATETIME: case SYBDATETIME4: return 26; case SYBTIME: case SYB5BIGTIME: return 15; case SYBDATE: return 10; case SYBUNIQUE: return 36; case SYBBIT: return 1; /* FIX ME -- not all types present */ default: return 0; } } /** * \ingroup dblib_core * \brief Get formatted string for underlining dbsprhead() column names. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param buffer output buffer * \param buf_len size of \a buffer * \param line_char character to use to represent underlining. * \retval SUCCEED \a buffer filled. * \retval FAIL insufficient space in \a buffer, usually. * \sa dbprhead(), dbprrow(), dbspr1row(), dbspr1rowlen(), dbsprhead(). */ RETCODE dbsprline(DBPROCESS * dbproc, char *buffer, DBINT buf_len, DBCHAR line_char) { TDSCOLUMN *colinfo; TDSRESULTINFO *resinfo; TDSSOCKET *tds; int i, col, len, collen, namlen; int c; tdsdump_log(TDS_DBG_FUNC, "dbsprline(%p, %s, %d, '%c')\n", dbproc, buffer, buf_len, line_char); CHECK_CONN(FAIL); CHECK_NULP(buffer, "dbsprline", 2, FAIL); tds = dbproc->tds_socket; resinfo = tds->res_info; for (col = 0; col < resinfo->num_cols; col++) { colinfo = resinfo->columns[col]; collen = _get_printable_size(colinfo); namlen = tds_dstr_len(&colinfo->column_name); len = collen > namlen ? collen : namlen; for (i = 0; i < len; i++) { if (buf_len < 1) { return FAIL; } *buffer++ = line_char; buf_len--; } if ((col + 1) < resinfo->num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i)) != -1) { if (buf_len < 1) { return FAIL; } *buffer++ = c; buf_len--; i++; } } } if (buf_len < 1) { return FAIL; } *buffer = '\0'; return SUCCEED; } /** * \ingroup dblib_core * \brief Print result set headings to a buffer. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param buffer output buffer * \param buf_len size of \a buffer * \retval SUCCEED \a buffer filled. * \retval FAIL insufficient space in \a buffer, usually. * \sa dbprhead(), dbprrow(), dbsetopt(), dbspr1row(), dbspr1rowlen(), dbsprline(). */ RETCODE dbsprhead(DBPROCESS * dbproc, char *buffer, DBINT buf_len) { TDSCOLUMN *colinfo; TDSRESULTINFO *resinfo; TDSSOCKET *tds; int i, col, collen, namlen; int padlen; int c; tdsdump_log(TDS_DBG_FUNC, "dbsprhead(%p, %p, %d)\n", dbproc, buffer, buf_len); CHECK_CONN(FAIL); CHECK_NULP(buffer, "dbsprhead", 2, FAIL); tds = dbproc->tds_socket; resinfo = tds->res_info; for (col = 0; col < resinfo->num_cols; col++) { colinfo = resinfo->columns[col]; collen = _get_printable_size(colinfo); namlen = tds_dstr_len(&colinfo->column_name); padlen = (collen > namlen ? collen : namlen) - namlen; if (buf_len < namlen) { return FAIL; } memcpy(buffer, tds_dstr_cstr(&colinfo->column_name), namlen); buffer += namlen; buf_len -= namlen; if ((c = dbstring_getchar(dbproc->dbopts[DBPRPAD].param, 0)) == -1) { c = ' '; } for (; padlen > 0; padlen--) { if (buf_len < 1) { return FAIL; } *buffer++ = c; buf_len--; } if ((col + 1) < resinfo->num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i)) != -1) { if (buf_len < 1) { return FAIL; } *buffer++ = c; buf_len--; i++; } } } if (buf_len < 1) { return FAIL; } *buffer = '\0'; return SUCCEED; } /** * \ingroup dblib_core * \brief Print result set headings to stdout. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa */ void dbprhead(DBPROCESS * dbproc) { TDSCOLUMN *colinfo; TDSRESULTINFO *resinfo; TDSSOCKET *tds; int i, col, len, collen, namlen; int padlen; int c; tdsdump_log(TDS_DBG_FUNC, "dbprhead(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, ); tds = dbproc->tds_socket; resinfo = tds->res_info; if (resinfo == NULL) { return; } for (col = 0; col < resinfo->num_cols; col++) { colinfo = resinfo->columns[col]; collen = _get_printable_size(colinfo); namlen = tds_dstr_len(&colinfo->column_name); padlen = (collen > namlen ? collen : namlen) - namlen; printf("%s", tds_dstr_cstr(&colinfo->column_name)); c = dbstring_getchar(dbproc->dbopts[DBPRPAD].param, 0); if (c == -1) { c = ' '; } for (; padlen > 0; padlen--) { putchar(c); } if ((col + 1) < resinfo->num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i)) != -1) { putchar(c); i++; } } } i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRLINESEP].param, i)) != -1) { putchar(c); i++; } for (col = 0; col < resinfo->num_cols; col++) { colinfo = resinfo->columns[col]; collen = _get_printable_size(colinfo); namlen = tds_dstr_len(&colinfo->column_name); len = collen > namlen ? collen : namlen; for (i = 0; i < len; i++) putchar('-'); if ((col + 1) < resinfo->num_cols) { i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRCOLSEP].param, i)) != -1) { putchar(c); i++; } } } i = 0; while ((c = dbstring_getchar(dbproc->dbopts[DBPRLINESEP].param, i)) != -1) { putchar(c); i++; } } /** \internal * \ingroup dblib_internal * \brief Indicate whether a query returned rows. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa DBROWS(), DBCMDROW(), dbnextrow(), dbresults(), DBROWTYPE(). */ RETCODE dbrows(DBPROCESS * dbproc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "dbrows(%p)\n", dbproc); CHECK_CONN(FAIL); if (!(tds=dbproc->tds_socket)) return FAIL; return (tds->res_info && tds->res_info->rows_exist)? SUCCEED : FAIL; } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_core * \brief Set the default character set for an application. * * \param language ASCII null-terminated string. * \sa dbsetdeflang(), dbsetdefcharset(), dblogin(), dbopen(). * \retval SUCCEED Always. * \todo Unimplemented. */ RETCODE dbsetdeflang(char *language) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbsetdeflang(%s)\n", language); CHECK_PARAMETER_NOPROC(language, SYBENULP); return SUCCEED; } #endif /** * \ingroup dblib_core * \brief Get TDS packet size for the connection. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return TDS packet size, in bytes. * \sa DBSETLPACKET() */ int dbgetpacket(DBPROCESS * dbproc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "dbgetpacket(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, TDS_DEF_BLKSZ); tds = dbproc->tds_socket; if (!tds) { return TDS_DEF_BLKSZ; } else { return tds->conn->env.block_size; } } /** * \ingroup dblib_core * \brief Set maximum simultaneous connections db-lib will open to the server. * * \param maxprocs Limit for process. * \retval SUCCEED Always. * \sa dbgetmaxprocs(), dbopen() */ RETCODE dbsetmaxprocs(int maxprocs) { int i, j; TDSSOCKET **old_list; tdsdump_log(TDS_DBG_FUNC, "UNTESTED dbsetmaxprocs(%d)\n", maxprocs); /* not too few elements */ if (maxprocs <= 0) return FAIL; tds_mutex_lock(&dblib_mutex); old_list = g_dblib_ctx.connection_list; /* "compress" array */ for (i = 0, j = 0; i < g_dblib_ctx.connection_list_size; ++i) { if (!old_list[i]) continue; if (i != j) { old_list[j] = old_list[i]; old_list[i] = NULL; } ++j; } /* do not restrict too much, j here contains minimun size */ if (maxprocs < j) maxprocs = j; /* * Don't reallocate less memory. * If maxprocs is less than was initially allocated, just reduce the represented list size. * If larger, reallocate and copy. * We probably should check for valid connections beyond the new max. */ if (maxprocs <= g_dblib_ctx.connection_list_size) { g_dblib_ctx.connection_list_size_represented = maxprocs; tds_mutex_unlock(&dblib_mutex); return SUCCEED; } g_dblib_ctx.connection_list = tds_new0(TDSSOCKET *, maxprocs); if (g_dblib_ctx.connection_list == NULL) { g_dblib_ctx.connection_list = old_list; tds_mutex_unlock(&dblib_mutex); dbperror(NULL, SYBEMEM, errno); return FAIL; } for (i = 0; i < g_dblib_ctx.connection_list_size; i++) { g_dblib_ctx.connection_list[i] = old_list[i]; } g_dblib_ctx.connection_list_size = maxprocs; g_dblib_ctx.connection_list_size_represented = maxprocs; tds_mutex_unlock(&dblib_mutex); free(old_list); return SUCCEED; } /** * \ingroup dblib_core * \brief get maximum simultaneous connections db-lib will open to the server. * * \return Current maximum. * \sa dbsetmaxprocs(), dbopen() */ int dbgetmaxprocs(void) { int r; tdsdump_log(TDS_DBG_FUNC, "dbgetmaxprocs(void)\n"); tds_mutex_lock(&dblib_mutex); r = g_dblib_ctx.connection_list_size_represented; tds_mutex_unlock(&dblib_mutex); return r; } /** * \ingroup dblib_core * \brief Set maximum seconds db-lib waits for a server response to query. * * \param seconds New limit for application. * \retval SUCCEED Always. * \sa dberrhandle(), DBGETTIME(), dbsetlogintime(), dbsqlexec(), dbsqlok(), dbsqlsend(). */ RETCODE dbsettime(int seconds) { TDSSOCKET **tds; int i; DBPROCESS *dbproc; tdsdump_log(TDS_DBG_FUNC, "dbsettime(%d)\n", seconds); tds_mutex_lock(&dblib_mutex); g_dblib_ctx.query_timeout = seconds; tds = g_dblib_ctx.connection_list; for (i = 0; i < TDS_MAX_CONN; i++) { if (tds[i]) { dbproc = (DBPROCESS *) tds_get_parent(tds[i]); if (!dbisopt(dbproc, DBSETTIME, 0)) tds[i]->query_timeout = seconds; } } tds_mutex_unlock(&dblib_mutex); return SUCCEED; } /** * \ingroup dblib_core * \brief Get maximum seconds db-lib waits for a server response to query. * * \retval query timeout limit, in seconds * \sa dberrhandle(), DBSETTIME(), dbsetlogintime(), dbsqlexec(), dbsqlok(), dbsqlsend(). */ int dbgettime(void) { tdsdump_log(TDS_DBG_FUNC, "dbgettime()\n"); return g_dblib_ctx.query_timeout; } /** * \ingroup dblib_core * \brief Set maximum seconds db-lib waits for a server response to a login attempt. * * \param seconds New limit for application. * \retval SUCCEED Always. * \sa dberrhandle(), dbsettime() */ RETCODE dbsetlogintime(int seconds) { tdsdump_log(TDS_DBG_FUNC, "dbsetlogintime(%d)\n", seconds); tds_mutex_lock(&dblib_mutex); g_dblib_ctx.login_timeout = seconds; tds_mutex_unlock(&dblib_mutex); return SUCCEED; } /** \internal * \ingroup dblib_internal * \brief See if the current command can return rows. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval SUCCEED Yes, it can. * \retval FAIL No, it can't. * \remarks Use DBCMDROW() macro instead. * \sa DBCMDROW(), dbnextrow(), dbresults(), DBROWS(), DBROWTYPE(). */ RETCODE dbcmdrow(DBPROCESS * dbproc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "dbcmdrow(%p)\n", dbproc); CHECK_CONN(FAIL); tds = dbproc->tds_socket; if (tds->res_info) return SUCCEED; return FAIL; } /** * \ingroup dblib_core * \brief Get column ID of a compute column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \return Nth column in the base result set, on which \a column was computed. * \sa dbadata(), dbadlen(), dbaltlen(), dbgetrow(), dbnextrow(), dbnumalts(), dbprtype(). */ int dbaltcolid(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *curcol; tdsdump_log(TDS_DBG_FUNC, "dbaltcolid(%p, %d, %d)\n", dbproc, computeid, column); curcol = dbacolptr(dbproc, computeid, column, 0); if (!curcol) return -1; return curcol->column_operand; } /** * \ingroup dblib_core * \brief Get size of data in a compute column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \return size of the data, in bytes. * \retval -1 no such \a column or \a computeid. * \retval 0 data are NULL. * \sa dbadata(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts(). */ DBINT dbadlen(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *colinfo; DBINT len; tdsdump_log(TDS_DBG_FUNC, "dbadlen(%p, %d, %d)\n", dbproc, computeid, column); colinfo = dbacolptr(dbproc, computeid, column, 0); if (!colinfo) return -1; len = colinfo->column_cur_size < 0? 0 : colinfo->column_cur_size; tdsdump_log(TDS_DBG_FUNC, "leaving dbadlen() type = %d, returning %d\n", colinfo->column_type, len); return len; } /** * \ingroup dblib_core * \brief Get datatype for a compute column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \return \c SYB* dataype token. * \retval -1 no such \a column or \a computeid. * \sa dbadata(), dbadlen(), dbaltlen(), dbnextrow(), dbnumalts(), dbprtype(). */ int dbalttype(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbalttype(%p, %d, %d)\n", dbproc, computeid, column); colinfo = dbacolptr(dbproc, computeid, column, 0); if (!colinfo) return -1; return dblib_coltype(colinfo); } /** * \ingroup dblib_core * \brief Bind a compute column to a program variable. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \param vartype datatype of the host variable that will receive the data * \param varlen size of host variable pointed to \a varaddr * \param varaddr address of host variable * \retval SUCCEED everything worked. * \retval FAIL no such \a computeid or \a column, or no such conversion possible, or target buffer too small. * \sa dbadata(), dbaltbind_ps(), dbanullbind(), dbbind(), dbbind_ps(), dbconvert(), * dbconvert_ps(), dbnullbind(), dbsetnull(), dbsetversion(), dbwillconvert(). */ RETCODE dbaltbind(DBPROCESS * dbproc, int computeid, int column, int vartype, DBINT varlen, BYTE * varaddr) { TDS_SERVER_TYPE srctype, desttype; TDSCOLUMN *colinfo = NULL; tdsdump_log(TDS_DBG_FUNC, "dbaltbind(%p, %d, %d, %d, %d, %p)\n", dbproc, computeid, column, vartype, varlen, varaddr); colinfo = dbacolptr(dbproc, computeid, column, 1); if (!colinfo) return FAIL; CHECK_PARAMETER(varaddr, SYBEABNV, FAIL); dbproc->avail_flag = FALSE; srctype = tds_get_conversion_type(colinfo->column_type, colinfo->column_size); desttype = dblib_bound_type(vartype); if (desttype == TDS_INVALID_TYPE) { dbperror(dbproc, SYBEBTYP, 0); return FAIL; } if (!dbwillconvert(srctype, desttype)) { dbperror(dbproc, SYBEAAMT, 0); return FAIL; } colinfo->column_varaddr = (char *) varaddr; colinfo->column_bindtype = vartype; colinfo->column_bindlen = varlen; return SUCCEED; } /** * \ingroup dblib_core * \brief Get address of compute column data. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \return pointer to columns's data buffer. * \retval NULL no such \a computeid or \a column. * \sa dbadlen(), dbaltbind(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts(). */ BYTE * dbadata(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbadata(%p, %d, %d)\n", dbproc, computeid, column); colinfo = dbacolptr(dbproc, computeid, column, 0); if (!colinfo) return NULL; if (is_blob_col(colinfo)) { return (BYTE *) ((TDSBLOB *) colinfo->column_data)->textvalue; } return (BYTE *) colinfo->column_data; } /** * \ingroup dblib_core * \brief Get aggregation operator for a compute column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \return token value for the type of the compute column's aggregation operator. * \retval -1 no such \a computeid or \a column. * \sa dbadata(), dbadlen(), dbaltlen(), dbnextrow(), dbnumalts(), dbprtype(). */ int dbaltop(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *curcol; tdsdump_log(TDS_DBG_FUNC, "dbaltop(%p, %d, %d)\n", dbproc, computeid, column); if ((curcol=dbacolptr(dbproc, computeid, column, 0)) == NULL) return -1; return curcol->column_operator; } /** * \ingroup dblib_core * \brief Set db-lib or server option. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param option option to set. * \param char_param value to set \a option to, if it wants a null-teminated ASCII string. * \param int_param value to set \a option to, if it wants an integer value. * \retval SUCCEED everything worked. * \retval FAIL no such \a option, or insufficient memory, or unimplemented. * \remarks Many are unimplemented. * \sa dbclropt(), dbisopt(). * \todo Implement more options. */ RETCODE dbsetopt(DBPROCESS * dbproc, int option, const char *char_param, int int_param) { char *cmd; RETCODE rc; int i; tdsdump_log(TDS_DBG_FUNC, "dbsetopt(%p, %d, %s, %d)\n", dbproc, option, char_param, int_param); CHECK_CONN(FAIL); CHECK_NULP(char_param, "dbsetopt", 3, FAIL); if ((option < 0) || (option >= DBNUMOPTIONS)) { dbperror(dbproc, SYBEUNOP, 0); return FAIL; } rc = FAIL; switch (option) { case DBARITHABORT: case DBARITHIGNORE: case DBCHAINXACTS: case DBFIPSFLAG: case DBISOLATION: case DBNOCOUNT: case DBNOEXEC: case DBPARSEONLY: case DBSHOWPLAN: case DBSTORPROCID: case DBQUOTEDIDENT: /* server options (on/off) */ if (asprintf(&cmd, "set %s on\n", dbproc->dbopts[option].text) < 0) { return FAIL; } rc = dbstring_concat(&(dbproc->dboptcmd), cmd); free(cmd); break; case DBNATLANG: case DBDATEFIRST: case DBDATEFORMAT: /* server options (char_param) */ if (asprintf(&cmd, "set %s %s\n", dbproc->dbopts[option].text, char_param) < 0) { return FAIL; } rc = dbstring_concat(&(dbproc->dboptcmd), cmd); free(cmd); break; case DBOFFSET: /* server option */ /* requires param * "select", "from", "table", "order", "compute", * "statement", "procedure", "execute", or "param" */ rc = SUCCEED; break; case DBROWCOUNT: /* server option */ /* requires param "0" to "2147483647" */ rc = SUCCEED; break; case DBSTAT: /* server option */ /* requires param "io" or "time" */ rc = SUCCEED; break; case DBTEXTLIMIT: /* dblib option */ /* requires param "0" to "2147483647" */ /* dblib do not return more than this length from text/image */ /* TODO required for PHP */ rc = SUCCEED; break; case DBTEXTSIZE: /* server option */ /* requires param "0" to "2147483647" */ /* limit text/image from network */ if (!char_param) char_param = "0"; i = atoi(char_param); if (i < 0 || i > 2147483647) return FAIL; if (asprintf(&cmd, "set textsize %d\n", i) < 0) return FAIL; rc = dbstring_concat(&(dbproc->dboptcmd), cmd); free(cmd); break; case DBAUTH: /* ??? */ rc = SUCCEED; break; case DBNOAUTOFREE: /* dblib option */ rc = SUCCEED; break; case DBBUFFER: /* * Requires param "2" to "2147483647" * (0 or 1 is an error, < 0 yields the default 100) */ { int nrows; /* 100 is the default, according to Microsoft */ if( !char_param ) char_param = "100"; nrows = atoi(char_param); nrows = (nrows < 0 )? 100 : nrows; if( 1 < nrows && nrows <= 2147483647 ) { buffer_set_capacity(dbproc, nrows); rc = SUCCEED; } } break; case DBPRCOLSEP: case DBPRLINELEN: case DBPRLINESEP: rc = dbstring_assign(&(dbproc->dbopts[option].param), char_param); break; case DBPRPAD: /* * "If the character is not specified, the ASCII space character is used." * A NULL pointer to the pad character signifies that padding is turned off. */ if (int_param) { rc = dbstring_assign(&(dbproc->dbopts[option].param), char_param? char_param : " "); } else { rc = dbstring_assign(&(dbproc->dbopts[option].param), NULL); } break; case DBSETTIME: if (char_param) { i = atoi(char_param); if (0 < i) { rc = dbstring_assign(&(dbproc->dbopts[option].param), char_param); if (rc == SUCCEED) { dbproc->tds_socket->query_timeout = i; } } } break; default: tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbsetopt(option = %d)\n", option); return FAIL; } if (rc == SUCCEED) dbproc->dbopts[option].factive = 1; return rc; } /** * \ingroup dblib_core * \brief Set interrupt handler for db-lib to use while blocked against a read from the server. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param chkintr * \param hndlintr * \sa dbcancel(), dbgetuserdata(), dbsetuserdata(), dbsetbusy(), dbsetidle(). */ void dbsetinterrupt(DBPROCESS * dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr) { tdsdump_log(TDS_DBG_FUNC, "dbsetinterrupt(%p, %p, %p)\n", dbproc, chkintr, hndlintr); CHECK_PARAMETER(dbproc, SYBENULL, ); dbproc->chkintr = chkintr; dbproc->hndlintr = hndlintr; } /** * \ingroup dblib_rpc * \brief Determine if query generated a return status number. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval TRUE fetch return status with dbretstatus(). * \retval FALSE no return status. * \sa dbnextrow(), dbresults(), dbretdata(), dbretstatus(), dbrpcinit(), dbrpcparam(), dbrpcsend(). */ DBBOOL dbhasretstat(DBPROCESS * dbproc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "dbhasretstat(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, FALSE); tds = dbproc->tds_socket; if (tds->has_status) { return TRUE; } else { return FALSE; } } /** * \ingroup dblib_rpc * \brief Fetch status value returned by query or remote procedure call. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return return value * \sa dbhasretstat(), dbnextrow(), dbresults(), dbretdata(), dbrpcinit(), dbrpcparam(), dbrpcsend(). */ DBINT dbretstatus(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbretstatus(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); return dbproc->tds_socket->ret_status; } /** * \ingroup dblib_rpc * \brief Get count of output parameters filled by a stored procedure. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return How many, possibly zero. * \remarks This name sounds funny. * \sa */ int dbnumrets(DBPROCESS * dbproc) { TDSSOCKET *tds; TDS_INT result_type; tdsdump_log(TDS_DBG_FUNC, "dbnumrets(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); tds = dbproc->tds_socket; tdsdump_log(TDS_DBG_FUNC, "dbnumrets() finds %d columns\n", (tds->param_info? tds->param_info->num_cols : 0)); /* try to fetch output parameters and return status, if we have not already done so */ if (!tds->param_info) tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_TRAILING); if (!tds->param_info) return 0; return tds->param_info->num_cols; } /** * \ingroup dblib_rpc * \brief Get name of an output parameter filled by a stored procedure. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param retnum Nth parameter between \c 1 and the return value from \c dbnumrets(). * \returns ASCII null-terminated string, \c NULL if no such \a retnum. * \sa dbnextrow(), dbnumrets(), dbresults(), dbretdata(), dbretlen(), dbrettype(), dbrpcinit(), dbrpcparam(). */ char * dbretname(DBPROCESS * dbproc, int retnum) { TDSPARAMINFO *param_info; tdsdump_log(TDS_DBG_FUNC, "dbretname(%p, %d)\n", dbproc, retnum); CHECK_PARAMETER(dbproc, SYBENULL, NULL); if (!dbproc->tds_socket) return NULL; dbnumrets(dbproc); param_info = dbproc->tds_socket->param_info; if (!param_info || !param_info->columns || retnum < 1 || retnum > param_info->num_cols) return NULL; return tds_dstr_buf(¶m_info->columns[retnum - 1]->column_name); } /** * \ingroup dblib_rpc * \brief Get value of an output parameter filled by a stored procedure. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param retnum Nth parameter between \c 1 and the return value from \c dbnumrets(). * \returns Address of a return parameter value, or \c NULL if no such \a retnum. * \sa dbnextrow(), dbnumrets(), dbresults(), dbretlen(), dbretname(), dbrettype(), dbrpcinit(), dbrpcparam(). * \todo Handle blobs. */ BYTE * dbretdata(DBPROCESS * dbproc, int retnum) { TDSPARAMINFO *param_info; tdsdump_log(TDS_DBG_FUNC, "dbretdata(%p, %d)\n", dbproc, retnum); CHECK_PARAMETER(dbproc, SYBENULL, NULL); dbnumrets(dbproc); param_info = dbproc->tds_socket->param_info; if (!param_info || !param_info->columns || retnum < 1 || retnum > param_info->num_cols) return NULL; return _dbcoldata(param_info->columns[retnum - 1]); } /** * \ingroup dblib_rpc * \brief Get size of an output parameter filled by a stored procedure. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param retnum Nth parameter between \c 1 and the return value from \c dbnumrets(). * \returns Size of a return parameter value, or \c NULL if no such \a retnum. * \sa dbnextrow(), dbnumrets(), dbresults(), dbretdata(), dbretname(), dbrettype(), dbrpcinit(), dbrpcparam(). */ int dbretlen(DBPROCESS * dbproc, int retnum) { TDSCOLUMN *column; TDSPARAMINFO *param_info; TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "dbretlen(%p, %d)\n", dbproc, retnum); CHECK_PARAMETER(dbproc, SYBENULL, -1); dbnumrets(dbproc); tds = dbproc->tds_socket; param_info = tds->param_info; if (!param_info || !param_info->columns || retnum < 1 || retnum > param_info->num_cols) return -1; column = param_info->columns[retnum - 1]; if (column->column_cur_size < 0) return 0; return column->column_cur_size; } /** * \ingroup dblib_core * \brief Wait for results of a query from the server. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval SUCCEED everything worked, fetch results with \c dbnextresults(). * \retval FAIL SQL syntax error, typically. * \sa dbcmd(), dbfcmd(), DBIORDESC(), DBIOWDESC(), dbmoretext(), dbnextrow(), dbpoll(), DBRBUF(), dbresults(), dbretstatus(), dbrpcsend(), dbsettime(), dbsqlexec(), dbsqlsend(), dbwritetext(). */ RETCODE dbsqlok(DBPROCESS * dbproc) { TDSSOCKET *tds; TDS_INT result_type; RETCODE return_code = SUCCEED; tdsdump_log(TDS_DBG_FUNC, "dbsqlok(%p)\n", dbproc); CHECK_CONN(FAIL); tds = dbproc->tds_socket; /* * dbsqlok has been called after dbmoretext() * This is the trigger to send the text data. */ if (dbproc->text_sent) { tds_flush_packet(tds); dbproc->text_sent = 0; } /* * See what the next packet from the server is. * We want to skip any messages which are not processable. * We're looking for a result token or a done token. */ for (;;) { TDSRET tds_code; int done_flags = 0; /* * If we hit an end token -- e.g. if the command * submitted returned no data (like an insert) -- then * we process the end token to extract the status code. */ tdsdump_log(TDS_DBG_FUNC, "dbsqlok() not done, calling tds_process_tokens()\n"); tds_code = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS); /* * The error flag may be set for any intervening DONEINPROC packet, in particular * by a RAISERROR statement. Microsoft db-lib returns FAIL in that case. */ if (done_flags & TDS_DONE_ERROR) { return_code = FAIL; } switch (tds_code) { case TDS_NO_MORE_RESULTS: return SUCCEED; break; case TDS_SUCCESS: switch (result_type) { case TDS_ROWFMT_RESULT: buffer_free(&dbproc->row_buf); buffer_alloc(dbproc); case TDS_COMPUTEFMT_RESULT: dbproc->dbresults_state = _DB_RES_RESULTSET_EMPTY; case TDS_COMPUTE_RESULT: case TDS_ROW_RESULT: tdsdump_log(TDS_DBG_FUNC, "dbsqlok() found result token\n"); return SUCCEED; break; case TDS_DONEINPROC_RESULT: break; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: tdsdump_log(TDS_DBG_FUNC, "dbsqlok() end status is %d (%s)\n", return_code, prdbretcode(return_code)); #if 1 if (done_flags & TDS_DONE_ERROR) { if (done_flags & TDS_DONE_MORE_RESULTS) { dbproc->dbresults_state = _DB_RES_NEXT_RESULT; } else { dbproc->dbresults_state = _DB_RES_NO_MORE_RESULTS; } } else { tdsdump_log(TDS_DBG_FUNC, "dbsqlok() end status was success\n"); dbproc->dbresults_state = _DB_RES_SUCCEED; } return return_code; break; #else int retcode = (done_flags & TDS_DONE_ERROR)? FAIL : SUCCEED; dbproc->dbresults_state = (done_flags & TDS_DONE_MORE_RESULTS)? _DB_RES_NEXT_RESULT : _DB_RES_NO_MORE_RESULTS; tdsdump_log(TDS_DBG_FUNC, "dbsqlok: returning %s with %s (%#x)\n", prdbretcode(retcode), prdbresults_state(dbproc->dbresults_state), done_flags); if (retcode == SUCCEED && (done_flags & TDS_DONE_MORE_RESULTS)) continue; return retcode; #endif default: tdsdump_log(TDS_DBG_FUNC, "%s %d: logic error: tds_process_tokens result_type %d\n", __FILE__, __LINE__, result_type); break; } break; default: assert(TDS_FAILED(tds_code)); return FAIL; break; } } return SUCCEED; } /** * \ingroup dblib_core * \brief Get count of columns in a compute row. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \return number of columns, else -1 if no such \a computeid. * \sa dbadata(), dbadlen(), dbaltlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumcols(). */ int dbnumalts(DBPROCESS * dbproc, int computeid) { TDSSOCKET *tds; TDSCOMPUTEINFO *info; TDS_SMALLINT compute_id; int i; tdsdump_log(TDS_DBG_FUNC, "dbnumalts(%p, %d)\n", dbproc, computeid); CHECK_PARAMETER(dbproc, SYBENULL, -1); tds = dbproc->tds_socket; compute_id = computeid; for (i = 0;; ++i) { if (i >= tds->num_comp_info) return -1; info = tds->comp_info[i]; if (info->computeid == compute_id) break; } return info->num_cols; } /** * \ingroup dblib_core * \brief Get count of \c COMPUTE clauses for a result set. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return number of compute clauses for the current query, possibly zero. * \sa dbnumalts(), dbresults(). */ int dbnumcompute(DBPROCESS * dbproc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "dbnumcompute(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, -1); tds = dbproc->tds_socket; return tds->num_comp_info; } /** * \ingroup dblib_core * \brief Get \c bylist for a compute row. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param size \em output: size of \c bylist buffer whose address is returned, possibly zero. * \return address of \c bylist for \a computeid. * \retval NULL no such \a computeid. * \remarks Do not free returned pointer. * \sa dbadata(), dbadlen(), dbaltlen(), dbalttype(), dbcolname(), dbgetrow(), dbnextrow(). */ BYTE * dbbylist(DBPROCESS * dbproc, int computeid, int *size) { TDSSOCKET *tds; TDSCOMPUTEINFO *info; int i; const TDS_SMALLINT byte_flag = -0x8000; tdsdump_log(TDS_DBG_FUNC, "dbbylist(%p, %d, %p)\n", dbproc, computeid, size); CHECK_PARAMETER(dbproc, SYBENULL, NULL); tds = dbproc->tds_socket; for (i = 0;; ++i) { if (i >= tds->num_comp_info) { if (size) *size = 0; return NULL; } info = tds->comp_info[i]; if (info->computeid == computeid) break; } if (size) *size = info->by_cols; /* * libtds stores this information using TDS_SMALLINT so we * have to convert it. We can do this because libtds just * stores these data. */ if (info->by_cols > 0 && info->bycolumns[0] != byte_flag) { int n; TDS_TINYINT *p = (TDS_TINYINT*) malloc(sizeof(info->bycolumns[0]) + info->by_cols); if (!p) { dbperror(dbproc, SYBEMEM, errno); return NULL; } for (n = 0; n < info->by_cols; ++n) p[sizeof(info->bycolumns[0]) + n] = info->bycolumns[n] > 255 ? 255 : info->bycolumns[n]; *((TDS_SMALLINT *)p) = byte_flag; free(info->bycolumns); info->bycolumns = (TDS_SMALLINT *) p; } return (BYTE *) (&info->bycolumns[1]); } /** \internal * \ingroup dblib_internal * \brief Check if \a dbproc is an ex-parrot. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval TRUE process has been marked \em dead. * \retval FALSE process is OK. * \remarks dbdead() does not communicate with the server. * Unless a previously db-lib marked \a dbproc \em dead, dbdead() returns \c FALSE. * \sa dberrhandle(). */ DBBOOL dbdead(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbdead(%p) [%s]\n", dbproc, dbproc? IS_TDSDEAD(dbproc->tds_socket)? "dead":"alive" : "quite dead"); if( NULL == dbproc ) return TRUE; if (IS_TDSDEAD(dbproc->tds_socket)) return TRUE; return FALSE; } /** \internal * \ingroup dblib_internal * \brief default error handler for db-lib (handles library-generated errors) * * The default error handler doesn't print anything. If you want to see your messages printed, * install an error handler. If you think that should be an optional compile- or run-time default, * submit a patch. It could be done. * * \sa DBDEAD(), dberrhandle(). */ /* Thus saith Sybase: * "If the user does not supply an error handler (or passes a NULL pointer to * dberrhandle), DB-Library will exhibit its default error-handling * behavior: It will abort the program if the error has made the affected * DBPROCESS unusable (the user can call DBDEAD to determine whether * or not a DBPROCESS has become unusable). If the error has not made the * DBPROCESS unusable, DB-Library will simply return an error code to its caller." * * It is not the error handler, however, that aborts anything. It is db-lib, cf. dbperror(). */ static int default_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { tdsdump_log(TDS_DBG_FUNC, "default_err_handler %p, %d, %d, %d, %p, %p", dbproc, severity, dberr, oserr, dberrstr, oserrstr); if (DBDEAD(dbproc) && (!dbproc || !dbproc->msdblib)) { return INT_EXIT; } if (!dbproc || !dbproc->msdblib) { /* i.e. Sybase behavior */ switch(dberr) { case SYBETIME: return INT_EXIT; default: break; } } return INT_CANCEL; } /** * \ingroup dblib_core * \brief Set an error handler, for messages from db-lib. * * \param handler pointer to callback function that will handle errors. * Pass NULL to restore the default handler. * \return address of prior handler, or NULL if none was previously installed. * \sa DBDEAD(), dbmsghandle(). */ EHANDLEFUNC dberrhandle(EHANDLEFUNC handler) { EHANDLEFUNC old_handler = _dblib_err_handler; tdsdump_log(TDS_DBG_FUNC, "dberrhandle(%p)\n", handler); _dblib_err_handler = handler? handler : default_err_handler; return (old_handler == default_err_handler)? NULL : old_handler; } /** * \ingroup dblib_core * \brief Set a message handler, for messages from the server. * * \param handler address of the function that will process the messages. * \sa DBDEAD(), dberrhandle(). */ MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler) { MHANDLEFUNC retFun = _dblib_msg_handler; tdsdump_log(TDS_DBG_FUNC, "dbmsghandle(%p)\n", handler); _dblib_msg_handler = handler; return retFun; } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_money * \brief Add two DBMONEY values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 first operand. * \param m2 other operand. * \param sum \em output: result of computation. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmnyadd(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * sum) { tdsdump_log(TDS_DBG_FUNC, "dbmnyadd(%p, %p, %p, %p)\n", dbproc, m1, m2, sum); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmnyadd", 2, FAIL); CHECK_NULP(m2, "dbmnyadd", 3, FAIL); CHECK_NULP(sum, "dbmnyadd", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnyadd()\n"); return SUCCEED; } /** * \ingroup dblib_money * \brief Subtract two DBMONEY values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 first operand. * \param m2 other operand, subtracted from \a m1. * \param difference \em output: result of computation. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmnysub(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * difference) { tdsdump_log(TDS_DBG_FUNC, "dbmnysub(%p, %p, %p, %p)\n", dbproc, m1, m2, difference); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmnysub", 2, FAIL); CHECK_NULP(m2, "dbmnysub", 3, FAIL); CHECK_NULP(difference, "dbmnysub", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnysyb()\n"); return SUCCEED; } /** * \ingroup dblib_money * \brief Multiply two DBMONEY values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 first operand. * \param m2 other operand. * \param prod \em output: result of computation. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmnymul(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * prod) { tdsdump_log(TDS_DBG_FUNC, "dbmnymul(%p, %p, %p, %p)\n", dbproc, m1, m2, prod); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmnymul", 2, FAIL); CHECK_NULP(m2, "dbmnymul", 3, FAIL); CHECK_NULP(prod, "dbmnymul", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnymul()\n"); return SUCCEED; } /** * \ingroup dblib_money * \brief Divide two DBMONEY values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 dividend. * \param m2 divisor. * \param quotient \em output: result of computation. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmnydivide(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * quotient) { tdsdump_log(TDS_DBG_FUNC, "dbmnydivide(%p, %p, %p, %p)\n", dbproc, m1, m2, quotient); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmnydivide", 2, FAIL); CHECK_NULP(m2, "dbmnydivide", 3, FAIL); CHECK_NULP(quotient, "dbmnydivide", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnydivide()\n"); return SUCCEED; } #endif /** * \ingroup dblib_money * \brief Compare two DBMONEY values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 some money. * \param m2 some other money. * \retval 0 m1 == m2. * \retval -1 m1 < m2. * \retval 1 m1 > m2. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ int dbmnycmp(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2) { tdsdump_log(TDS_DBG_FUNC, "dbmnycmp(%p, %p, %p)\n", dbproc, m1, m2); CHECK_PARAMETER(dbproc, SYBENULL, 0); CHECK_NULP(m1, "dbmnycmp", 2, 0); CHECK_NULP(m2, "dbmnycmp", 3, 0); if (m1->mnyhigh < m2->mnyhigh) { return -1; } if (m1->mnyhigh > m2->mnyhigh) { return 1; } if (m1->mnylow < m2->mnylow) { return -1; } if (m1->mnylow > m2->mnylow) { return 1; } return 0; } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_money * \brief Multiply a DBMONEY value by a positive integer, and add an amount. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param amount starting amount of money, also holds output. * \param multiplier amount to multiply \a amount by. * \param addend amount to add to \a amount, after multiplying by \a multiplier. * \retval SUCCEED Always. * \remarks This function is goofy. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmnyscale(DBPROCESS * dbproc, DBMONEY * amount, int multiplier, int addend) { tdsdump_log(TDS_DBG_FUNC, "dbmnyscale(%p, %p, %d, %d)\n", dbproc, amount, multiplier, addend); CHECK_CONN(FAIL); CHECK_NULP(amount, "dbmnyscale", 2, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnyscale()\n"); return SUCCEED; } #endif /** * \ingroup dblib_money * \brief Set a DBMONEY value to zero. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param dest address of a DBMONEY structure. * \retval SUCCEED unless \a amount is NULL. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmnyzero(DBPROCESS * dbproc, DBMONEY * dest) { tdsdump_log(TDS_DBG_FUNC, "dbmnyzero(%p, %p)\n", dbproc, dest); CHECK_CONN(FAIL); CHECK_NULP(dest, "dbmnyzero", 2, FAIL); dest->mnylow = 0; dest->mnyhigh = 0; return SUCCEED; } /** * \ingroup dblib_money * \brief Get maximum positive DBMONEY value supported. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param amount address of a DBMONEY structure. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmnymaxpos(DBPROCESS * dbproc, DBMONEY * amount) { tdsdump_log(TDS_DBG_FUNC, "dbmnymaxpos(%p, %p)\n", dbproc, amount); CHECK_CONN(FAIL); CHECK_NULP(amount, "dbmnymaxpos", 2, FAIL); amount->mnylow = 0xFFFFFFFFlu; amount->mnyhigh = 0x7FFFFFFFl; return SUCCEED; } /** * \ingroup dblib_money * \brief Get maximum negative DBMONEY value supported. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param amount address of a DBMONEY structure. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmnymaxneg(DBPROCESS * dbproc, DBMONEY * amount) { tdsdump_log(TDS_DBG_FUNC, "dbmnymaxneg(%p, %p)\n", dbproc, amount); CHECK_CONN(FAIL); CHECK_NULP(amount, "dbmnymaxneg", 2, FAIL); amount->mnylow = 0; amount->mnyhigh = -0x7FFFFFFFL - 1; return SUCCEED; } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_money * \brief Get the least significant digit of a DBMONEY value, represented as a character. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param mnyptr \em input the money amount, \em and \em output: \a mnyptr divided by 10. * \param digit the character value (between '0' and '9') of the rightmost digit in \a mnyptr. * \param zero \em output: \c TRUE if \a mnyptr is zero on output, else \c FALSE. * \retval SUCCEED Always. * \sa dbconvert(), dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \remarks Unimplemented and likely to remain so. We'd be amused to learn anyone wants this function. * \todo Unimplemented. */ RETCODE dbmnyndigit(DBPROCESS * dbproc, DBMONEY * mnyptr, DBCHAR * digit, DBBOOL * zero) { tdsdump_log(TDS_DBG_FUNC, "dbmnyndigit(%p, %p, %s, %p)\n", dbproc, mnyptr, digit, zero); CHECK_CONN(FAIL); CHECK_NULP(mnyptr, "dbmnyndigit", 2, FAIL); CHECK_NULP(digit, "dbmnyndigit", 3, FAIL); CHECK_NULP(zero, "dbmnyndigit", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnyndigit()\n"); return SUCCEED; } /** * \ingroup dblib_money * \brief Prepare a DBMONEY value for use with dbmnyndigit(). * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param amount address of a DBMONEY structure. * \param trim number of digits to trim from \a amount. * \param negative \em output: \c TRUE if \a amount < 0. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmnyinit(DBPROCESS * dbproc, DBMONEY * amount, int trim, DBBOOL * negative) { tdsdump_log(TDS_DBG_FUNC, "dbmnyinit(%p, %p, %d, %p)\n", dbproc, amount, trim, negative); CHECK_CONN(FAIL); CHECK_NULP(amount, "dbmnyinit", 2, FAIL); CHECK_NULP(negative, "dbmnyinit", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnyinit()\n"); return SUCCEED; } /** * \ingroup dblib_money * \brief Divide a DBMONEY value by a positive integer. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param amount address of a DBMONEY structure. * \param divisor of \a amount. * \param remainder \em output: modulo of integer division. * \retval SUCCEED Always. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmnydown(DBPROCESS * dbproc, DBMONEY * amount, int divisor, int *remainder) { tdsdump_log(TDS_DBG_FUNC, "dbmnydown(%p, %p, %d, %p)\n", dbproc, amount, divisor, remainder); CHECK_CONN(FAIL); CHECK_NULP(amount, "dbmnydown", 2, FAIL); CHECK_NULP(remainder, "dbmnydown", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmnydown()\n"); return SUCCEED; } #endif /** * \ingroup dblib_money * \brief Add $0.0001 to a DBMONEY value. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param amount address of a DBMONEY structure. * \retval SUCCEED or FAIL if overflow or amount NULL. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmnyinc(DBPROCESS * dbproc, DBMONEY * amount) { tdsdump_log(TDS_DBG_FUNC, "dbmnyinc(%p, %p)\n", dbproc, amount); CHECK_CONN(FAIL); CHECK_NULP(amount, "dbmnyinc", 2, FAIL); if (amount->mnylow != 0xFFFFFFFFlu) { ++amount->mnylow; return SUCCEED; } if (amount->mnyhigh == 0x7FFFFFFFl) return FAIL; amount->mnylow = 0; ++amount->mnyhigh; return SUCCEED; } /** * \ingroup dblib_money * \brief Subtract $0.0001 from a DBMONEY value. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param amount address of a DBMONEY structure. * \retval SUCCEED or FAIL if overflow or amount NULL. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmnydec(DBPROCESS * dbproc, DBMONEY * amount) { tdsdump_log(TDS_DBG_FUNC, "dbmnydec(%p, %p)\n", dbproc, amount); CHECK_CONN(FAIL); CHECK_NULP(amount, "dbmnydec", 2, FAIL); if (amount->mnylow != 0) { --amount->mnylow; return SUCCEED; } if (amount->mnyhigh == -0x7FFFFFFFL - 1) return FAIL; amount->mnylow = 0xFFFFFFFFlu; --amount->mnyhigh; return SUCCEED; } /** * \ingroup dblib_money * \brief Negate a DBMONEY value. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param src address of a DBMONEY structure. * \param dest \em output: result of negation. * \retval SUCCEED or FAIL if overflow or src/dest NULL. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmnyminus(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest) { tdsdump_log(TDS_DBG_FUNC, "dbmnyminus(%p, %p, %p)\n", dbproc, src, dest); CHECK_CONN(FAIL); CHECK_NULP(src, "dbmnyminus", 2, FAIL); CHECK_NULP(dest, "dbmnyminus", 3, FAIL); if (src->mnyhigh == -0x7FFFFFFFL - 1 && src->mnylow == 0) return FAIL; dest->mnyhigh = -src->mnyhigh; dest->mnylow = (~src->mnylow) + 1u; return SUCCEED; } /** * \ingroup dblib_money * \brief Negate a DBMONEY4 value. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param src address of a DBMONEY4 structure. * \param dest \em output: result of negation. * \retval SUCCEED usually. * \retval FAIL on overflow. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmny4minus(DBPROCESS * dbproc, DBMONEY4 * src, DBMONEY4 * dest) { DBMONEY4 zero; tdsdump_log(TDS_DBG_FUNC, "dbmny4minus(%p, %p, %p)\n", dbproc, src, dest); CHECK_CONN(FAIL); CHECK_NULP(src, "dbmny4minus", 2, FAIL); CHECK_NULP(dest, "dbmny4minus", 3, FAIL); dbmny4zero(dbproc, &zero); return (dbmny4sub(dbproc, &zero, src, dest)); } /** * \ingroup dblib_money * \brief Zero a DBMONEY4 value. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param dest address of a DBMONEY structure. * \retval SUCCEED usually. * \retval FAIL \a dest is NULL. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmny4zero(DBPROCESS * dbproc, DBMONEY4 * dest) { tdsdump_log(TDS_DBG_FUNC, "dbmny4zero(%p, %p)\n", dbproc, dest); CHECK_CONN(FAIL); CHECK_NULP(dest, "dbmny4zero", 2, FAIL); dest->mny4 = 0; return SUCCEED; } /** * \ingroup dblib_money * \brief Add two DBMONEY4 values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 first operand. * \param m2 other operand. * \param sum \em output: result of computation. * \retval SUCCEED usually. * \retval FAIL on overflow. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmny4add(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * sum) { tdsdump_log(TDS_DBG_FUNC, "dbmny4add(%p, %p, %p, %p)\n", dbproc, m1, m2, sum); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmny4add", 2, FAIL); CHECK_NULP(m2, "dbmny4add", 3, FAIL); CHECK_NULP(sum, "dbmny4add", 4, FAIL); sum->mny4 = m1->mny4 + m2->mny4; if (((m1->mny4 < 0) && (m2->mny4 < 0) && (sum->mny4 >= 0)) || ((m1->mny4 > 0) && (m2->mny4 > 0) && (sum->mny4 <= 0))) { /* overflow */ sum->mny4 = 0; return FAIL; } return SUCCEED; } /** * \ingroup dblib_money * \brief Subtract two DBMONEY4 values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 first operand. * \param m2 other operand, subtracted from \a m1. * \param diff \em output: result of computation. * \retval SUCCEED usually. * \retval FAIL on overflow. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ RETCODE dbmny4sub(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * diff) { tdsdump_log(TDS_DBG_FUNC, "dbmny4sub(%p, %p, %p, %p)\n", dbproc, m1, m2, diff); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmny4sub", 2, FAIL); CHECK_NULP(m2, "dbmny4sub", 3, FAIL); CHECK_NULP(diff, "dbmny4sub", 4, FAIL); diff->mny4 = m1->mny4 - m2->mny4; if (((m1->mny4 <= 0) && (m2->mny4 > 0) && (diff->mny4 > 0)) || ((m1->mny4 >= 0) && (m2->mny4 < 0) && (diff->mny4 < 0))) { /* overflow */ diff->mny4 = 0; return FAIL; } return SUCCEED; } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_money * \brief Multiply two DBMONEY4 values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 first operand. * \param m2 other operand. * \param prod \em output: result of computation. * \retval SUCCEED usually. * \retval FAIL a parameter is NULL. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmny4mul(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * prod) { tdsdump_log(TDS_DBG_FUNC, "dbmny4mul(%p, %p, %p, %p)\n", dbproc, m1, m2, prod); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmny4mul", 2, FAIL); CHECK_NULP(m2, "dbmny4mul", 3, FAIL); CHECK_NULP(prod, "dbmny4mul", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmny4mul()\n"); return FAIL; } /** * \ingroup dblib_money * \brief Divide two DBMONEY4 values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 dividend. * \param m2 divisor. * \param quotient \em output: result of computation. * \retval SUCCEED usually. * \retval FAIL a parameter is NULL. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). * \todo Unimplemented. */ RETCODE dbmny4divide(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * quotient) { tdsdump_log(TDS_DBG_FUNC, "dbmny4divide(%p, %p, %p, %p)\n", dbproc, m1, m2, quotient); CHECK_CONN(FAIL); CHECK_NULP(m1, "dbmny4divide", 2, FAIL); CHECK_NULP(m2, "dbmny4divide", 3, FAIL); CHECK_NULP(quotient, "dbmny4divide", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbmny4divide()\n"); return FAIL; } #endif /** * \ingroup dblib_money * \brief Compare two DBMONEY4 values. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param m1 some money. * \param m2 some other money. * \retval 0 m1 == m2. * \retval -1 m1 < m2. * \retval 1 m1 > m2. * \sa dbmnyadd(), dbmnysub(), dbmnymul(), dbmnydivide(), dbmnyminus(), dbmny4add(), dbmny4sub(), dbmny4mul(), dbmny4divide(), dbmny4minus(). */ int dbmny4cmp(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2) { tdsdump_log(TDS_DBG_FUNC, "dbmny4cmp(%p, %p, %p)\n", dbproc, m1, m2); CHECK_PARAMETER(dbproc, SYBENULL, 0); CHECK_NULP(m1, "dbmny4cmp", 2, 0); CHECK_NULP(m2, "dbmny4cmp", 3, 0); if (m1->mny4 < m2->mny4) { return -1; } if (m1->mny4 > m2->mny4) { return 1; } return 0; } /** * \ingroup dblib_money * \brief Copy a DBMONEY4 value. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param src address of a DBMONEY4 structure. * \param dest \em output: new money. * \retval SUCCEED or FAIL if src/dest NULL. * \sa dbmnycopy(), dbmnyminus(), dbmny4minus(). */ RETCODE dbmny4copy(DBPROCESS * dbproc, DBMONEY4 * src, DBMONEY4 * dest) { tdsdump_log(TDS_DBG_FUNC, "dbmny4copy(%p, %p, %p)\n", dbproc, src, dest); CHECK_CONN(FAIL); CHECK_NULP(src, "dbmny4copy", 2, FAIL); CHECK_NULP(dest, "dbmny4copy", 3, FAIL); dest->mny4 = src->mny4; return SUCCEED; } /** * \ingroup dblib_datetime * \brief Compare DBDATETIME values, similar to strcmp(3). * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param d1 a \c DBDATETIME structure address * \param d2 another \c DBDATETIME structure address * \retval 0 d1 = d2. * \retval -1 d1 < d2. * \retval 1 d1 > d2. * \sa dbdate4cmp(), dbmnycmp(), dbmny4cmp(). */ int dbdatecmp(DBPROCESS * dbproc, DBDATETIME * d1, DBDATETIME * d2) { tdsdump_log(TDS_DBG_FUNC, "dbdatecmp(%p, %p, %p)\n", dbproc, d1, d2); CHECK_CONN(FAIL); CHECK_NULP(d1, "dbdatecmp", 2, 0); CHECK_NULP(d2, "dbdatecmp", 3, 0); if (d1->dtdays == d2->dtdays) { if (d1->dttime == d2->dttime) return 0; return d1->dttime > d2->dttime ? 1 : -1; } /* date 1 is before 1900 */ if (d1->dtdays > 2958463) { if (d2->dtdays > 2958463) /* date 2 is before 1900 */ return d1->dtdays > d2->dtdays ? 1 : -1; return -1; } /* date 1 is after 1900 */ if (d2->dtdays < 2958463) /* date 2 is after 1900 */ return d1->dtdays > d2->dtdays ? 1 : -1; return 1; } static RETCODE dblib_datecrack(DBPROCESS * dbproc, BOOL nano_precision, DBDATEREC * output, int type, const void * data) { TDSDATEREC dr; struct tds_sybase_dbdaterec *di = (struct tds_sybase_dbdaterec*) output; tdsdump_log(TDS_DBG_FUNC, "dblib_datecrack(%p, %d, %p, %d, %p)\n", dbproc, nano_precision, output, type, data); CHECK_NULP(output, "dbdatecrack", 2, FAIL); CHECK_PARAMETER(data, SYBENDTP, FAIL); if (TDS_FAILED(tds_datecrack(type, data, &dr))) return FAIL; di->dateyear = dr.year; di->quarter = dr.quarter; di->datemonth = dr.month; di->datedmonth = dr.day; di->datedyear = dr.dayofyear; di->datedweek = dr.weekday; di->datehour = dr.hour; di->dateminute = dr.minute; di->datesecond = dr.second; di->datetzone = dr.timezone; if (nano_precision) /* here we are writing to nanosecond field */ di->datemsecond = dr.decimicrosecond * 100u; else di->datemsecond = dr.decimicrosecond / 10000u; /* Revert to compiled-in default if dbproc can't be used to find the runtime override. */ if (dbproc ? dbproc->msdblib : dblib_msdblib) { ++di->quarter; ++di->datemonth; ++di->datedweek; } return SUCCEED; } /** * \ingroup dblib_core * \brief Break a DBDATETIME value into useful pieces. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param di \em output: structure to contain the exploded parts of \a datetime. * \param datetime \em input: \c DBDATETIME to be converted. * \retval SUCCEED always. * \remarks The members of \a di have different names, depending on whether \c --with-msdblib was configured. * * If DBPROCESS is NULL, dbdatecrack() uses the compiled in default * value of MSDBLIB as of when libsybdb was compiled, irrespective of its value when the * application is compiled. This can lead to incorrect results because Sybase and Microsoft use different * ranges -- [0,11] vs. [1,12] -- for the month. * * \sa dbconvert(), dbdata(), dbdatechar(), dbdatename(), dbdatepart(), tdsdbopen(). */ RETCODE dbdatecrack(DBPROCESS * dbproc, DBDATEREC * di, DBDATETIME * datetime) { return dblib_datecrack(dbproc, FALSE, di, SYBDATETIME, datetime); } /** * \ingroup dblib_core * \brief Break any kind of date or time value into useful pieces. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param di \em output: structure to contain the exploded parts of \a datetime. * \param type \em input: \c type of date/time value returned by dbcoltype(). * \param data \em input: \c date/time value to be converted. * \retval SUCCEED always. * \remarks The members of \a di have different names, depending on whether \c --with-msdblib was configured. * * This is an extension to dbdatecrack(), see it for more information. * * \sa dbdatecrack(), dbconvert(), dbdata(), dbdatechar(), dbdatename(), dbdatepart(), tdsdbopen(). */ RETCODE dbanydatecrack(DBPROCESS * dbproc, DBDATEREC2 * di, int type, const void *data) { return dblib_datecrack(dbproc, TRUE, (DBDATEREC *) di, type, data); } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_core * \brief Clear remote passwords from the LOGINREC structure. * * \param login structure to pass to dbopen(). * \sa dblogin(), dbopen(), dbrpwset(), DBSETLAPP(), DBSETLHOST(), DBSETLPWD(), DBSETLUSER(). * \remarks Useful for remote stored procedure calls, but not in high demand from FreeTDS. * \todo Unimplemented. */ void dbrpwclr(LOGINREC * login) { tdsdump_log(TDS_DBG_FUNC, "dbrpwclr(%p)\n", login); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbrpwclr()\n"); } /** * \ingroup dblib_core * \brief Add a remote password to the LOGINREC structure. * * \param login structure to pass to dbopen(). * \param srvname server for which \a password should be used. * \param password you guessed it, let's hope no else does. * \param pwlen count of \a password, in bytes. * \remarks Useful for remote stored procedure calls, but not in high demand from FreeTDS. * \sa dblogin(), dbopen(), dbrpwclr(), DBSETLAPP(), DBSETLHOST(), DBSETLPWD(), DBSETLUSER(). * \todo Unimplemented. */ RETCODE dbrpwset(LOGINREC * login, char *srvname, char *password, int pwlen) { tdsdump_log(TDS_DBG_FUNC, "dbrpwset(%p, %s, %s, %d)\n", login, srvname, password, pwlen); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbrpwset()\n"); return SUCCEED; } #endif /** * \ingroup dblib_core * \brief Get server process ID for a \c DBPROCESS. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return \em "spid", the server's process ID. * \sa dbopen(). */ int dbspid(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbspid(%p)\n", dbproc); CHECK_CONN(-1); return dbproc->tds_socket->conn->spid; } /** * \ingroup dblib_core * \brief Associate client-allocated (and defined) data with a \c DBPROCESS. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param ptr address of client-defined data. * \remarks \a ptr is the location of user data that \c db-lib will associate with \a dbproc. * The client allocates the buffer addressed by \a ptr. \c db-lib never examines or uses the information; * it just stashes the pointer for later retrieval by the application with \c dbgetuserdata(). * \sa dbgetuserdata(). */ void dbsetuserdata(DBPROCESS * dbproc, BYTE * ptr) { tdsdump_log(TDS_DBG_FUNC, "dbsetuserdata(%p, %p)\n", dbproc, ptr); CHECK_PARAMETER(dbproc, SYBENULL, ); dbproc->user_data = ptr; } /** * \ingroup dblib_core * \brief Get address of user-allocated data from a \c DBPROCESS. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return address of user-defined data that \c db-lib associated with \a dbproc when the client called dbsetuserdata(). * \retval undefined (probably \c NULL) dbsetuserdata() was not previously called. * \sa dbsetuserdata(). */ BYTE * dbgetuserdata(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbgetuserdata(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, NULL); return dbproc->user_data; } /** * \ingroup dblib_core * \brief Specify a db-lib version level. * * \param version anything, really. * \retval SUCCEED Always. * \remarks No effect on behavior of \c db-lib in \c FreeTDS. * \sa */ RETCODE dbsetversion(DBINT version) { tdsdump_log(TDS_DBG_FUNC, "dbsetversion(%d)\n", version); switch (version) { case DBVERSION_42: case DBVERSION_46: case DBVERSION_100: case DBVERSION_70: case DBVERSION_71: case DBVERSION_72: case DBVERSION_73: case DBVERSION_74: g_dblib_version = version; return SUCCEED; default: break; } dbperror(NULL, SYBEIVERS, 0); return FAIL; } /** * \ingroup dblib_money * \brief Copy a DBMONEY value. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param src address of a DBMONEY structure. * \param dest \em output: new money. * \retval SUCCEED always, unless \a src or \a dest is \c NULL. * \sa */ RETCODE dbmnycopy(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest) { tdsdump_log(TDS_DBG_FUNC, "dbmnycopy(%p, %p, %p)\n", dbproc, src, dest); CHECK_CONN(FAIL); CHECK_NULP(src, "dbmnycopy", 2, FAIL); CHECK_NULP(dest, "dbmnycopy", 3, FAIL); dest->mnylow = src->mnylow; dest->mnyhigh = src->mnyhigh; return SUCCEED; } /** * \ingroup dblib_core * \brief Cancel the query currently being retrieved, discarding all pending rows. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa */ RETCODE dbcanquery(DBPROCESS * dbproc) { TDSRET rc; TDS_INT result_type; tdsdump_log(TDS_DBG_FUNC, "dbcanquery(%p)\n", dbproc); CHECK_CONN(FAIL); /* Just throw away all pending rows from the last query */ rc = tds_process_tokens(dbproc->tds_socket, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE); if (TDS_FAILED(rc)) return FAIL; dbproc->dbresults_state = _DB_RES_NEXT_RESULT; return SUCCEED; } /** * \ingroup dblib_core * \brief Erase the command buffer, in case \c DBNOAUTOFREE was set with dbsetopt(). * * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbcmd(), dbfcmd(), dbgetchar(), dbsqlexec(), dbsqlsend(), dbsetopt(), dbstrcpy(), dbstrlen(). */ void dbfreebuf(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbfreebuf(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, ); if (dbproc->dbbuf) TDS_ZERO_FREE(dbproc->dbbuf); dbproc->dbbufsz = 0; } /** * \ingroup dblib_core * \brief Reset an option. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param option to be turned off. * \param param clearing some options requires a parameter, believe it or not. * \retval SUCCEED \a option and \a parameter seem sane. * \retval FAIL no such \a option. * \remarks Only the following options are recognized: - DBARITHABORT - DBARITHIGNORE - DBCHAINXACTS - DBFIPSFLAG - DBISOLATION - DBNOCOUNT - DBNOEXEC - DBPARSEONLY - DBSHOWPLAN - DBSTORPROCID - DBQUOTEDIDENT - DBSETTIME * \sa dbisopt(), dbsetopt(). */ RETCODE dbclropt(DBPROCESS * dbproc, int option, const char param[]) { char *cmd; tdsdump_log(TDS_DBG_FUNC, "dbclropt(%p, %d, %s)\n", dbproc, option, param); CHECK_CONN(FAIL); if (option != DBSETTIME) { CHECK_NULP(param, "dbclropt", 3, FAIL); } if ((option < 0) || (option >= DBNUMOPTIONS)) { return FAIL; } dbproc->dbopts[option].factive = 0; switch (option) { case DBARITHABORT: case DBARITHIGNORE: case DBCHAINXACTS: case DBFIPSFLAG: case DBISOLATION: case DBNOCOUNT: case DBNOEXEC: case DBPARSEONLY: case DBSHOWPLAN: case DBSTORPROCID: case DBQUOTEDIDENT: /* server options (on/off) */ if (asprintf(&cmd, "set %s off\n", dbproc->dbopts[option].text) < 0) { return FAIL; } dbstring_concat(&(dbproc->dboptcmd), cmd); free(cmd); break; case DBBUFFER: buffer_set_capacity(dbproc, 1); /* frees row_buf->rows */ return SUCCEED; break; case DBSETTIME: tds_mutex_lock(&dblib_mutex); /* * Use global value of query timeout set by dbsettime() if any, * otherwise set it to zero just like tds_init_socket() does. */ if (g_dblib_ctx.query_timeout > 0) { dbproc->tds_socket->query_timeout = g_dblib_ctx.query_timeout; } else { dbproc->tds_socket->query_timeout = 0; } tds_mutex_unlock(&dblib_mutex); return SUCCEED; break; default: break; } tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbclropt(option = %d)\n", option); return FAIL; } /** * \ingroup dblib_core * \brief Get value of an option * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param option the option * \param param a parameter to \a option. * \sa dbclropt(), dbsetopt(). */ DBBOOL dbisopt(DBPROCESS * dbproc, int option, const char param[]) { tdsdump_log(TDS_DBG_FUNC, "dbisopt(%p, %d, %s)\n", dbproc, option, param); CHECK_PARAMETER(dbproc, SYBENULL, FALSE); /* sometimes param can be NULL */ if ((option < 0) || (option >= DBNUMOPTIONS)) { return FALSE; } return dbproc->dbopts[option].factive; } /** \internal * \ingroup dblib_internal * \brief Get number of the row currently being read. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return ostensibly the row number, or 0 if no rows have been read yet. * \retval 0 Always. * \sa DBCURROW(), dbclrbuf(), DBFIRSTROW(), dbgetrow(), DBLASTROW(), dbnextrow(), dbsetopt(),. * \todo Unimplemented. */ DBINT dbcurrow(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbcurrow(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbcurrow()\n"); return 0; } /** \internal * \ingroup dblib_internal * \brief Get returned row's type. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa DBROWTYPE(). */ STATUS dbrowtype(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbrowtype(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, NO_MORE_ROWS); return dbproc->row_type; } /** \internal * \ingroup dblib_internal * \brief Get number of the row just returned. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa DBCURROW(). * \todo Unimplemented. */ int dbcurcmd(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbcurcmd(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbcurcmd()\n"); return 0; } /** * \ingroup dblib_core * \brief See if more commands are to be processed. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa DBMORECMDS(). DBCMDROW(), dbresults(), DBROWS(), DBROWTYPE(). */ RETCODE dbmorecmds(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbmorecmds(%p)\n", dbproc); CHECK_CONN(FAIL); if (dbproc->tds_socket->res_info == NULL) { return FAIL; } if (!dbproc->tds_socket->res_info->more_results) { tdsdump_log(TDS_DBG_FUNC, "more_results is false; returns FAIL\n"); return FAIL; } tdsdump_log(TDS_DBG_FUNC, "more_results is true; returns SUCCEED\n"); return SUCCEED; } /** * \ingroup dblib_rpc * \brief Get datatype of a stored procedure's return parameter. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param retnum Nth return parameter, between 1 and \c dbnumrets(). * \return SYB* datatype token, or -1 if \a retnum is out of range. * \sa dbnextrow(), dbnumrets(), dbprtype(), dbresults(), dbretdata(), dbretlen(), dbretname(), dbrpcinit(), dbrpcparam(). */ int dbrettype(DBPROCESS * dbproc, int retnum) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbrettype(%p, %d)\n", dbproc, retnum); CHECK_PARAMETER(dbproc, SYBENULL, -1); assert(dbproc->tds_socket); assert(dbproc->tds_socket->param_info); if (retnum < 1 || retnum > dbproc->tds_socket->param_info->num_cols) return -1; colinfo = dbproc->tds_socket->param_info->columns[retnum - 1]; return tds_get_conversion_type(colinfo->column_type, colinfo->column_size); } /** * \ingroup dblib_core * \brief Get size of the command buffer, in bytes. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbcmd(), dbfcmd(), dbfreebuf(), dbgetchar(), dbstrcpy(). */ int dbstrlen(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbstrlen(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); return dbproc->dbbufsz; } /** * \ingroup dblib_core * \brief Get address of a position in the command buffer. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param pos offset within the command buffer, starting at \em 0. * \remarks A bit overspecialized, this one. * \sa dbcmd(), dbfcmd(), dbfreebuf(), dbstrcpy(), dbstrlen(), */ char * dbgetchar(DBPROCESS * dbproc, int pos) { tdsdump_log(TDS_DBG_FUNC, "dbgetchar(%p, %d)\n", dbproc, pos); CHECK_PARAMETER(dbproc, SYBENULL, NULL); tdsdump_log(TDS_DBG_FUNC, "dbgetchar() bufsz = %d, pos = %d\n", dbproc->dbbufsz, pos); if (dbproc->dbbufsz > 0) { if (pos >= 0 && pos < (dbproc->dbbufsz - 1)) return (char *) &dbproc->dbbuf[pos]; return NULL; } return NULL; } /** * \ingroup dblib_core * \brief Get a copy of a chunk of the command buffer. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param start position in the command buffer to start copying from, starting from \em 0. * If start is past the end of the command buffer, dbstrcpy() inserts a null terminator at dest[0]. * \param numbytes number of bytes to copy. - If -1, dbstrcpy() copies the whole command buffer. - If 0 dbstrcpy() writes a \c NULL to dest[0]. - If the command buffer contains fewer than \a numbytes (taking \a start into account) dbstrcpy() copies the rest of it. * \param dest \em output: the buffer to write to. Make sure it's big enough. * \retval SUCCEED the inputs were valid and \a dest was affected. * \retval FAIL \a start < 0 or \a numbytes < -1. * \sa dbcmd(), dbfcmd(), dbfreebuf(), dbgetchar(), dbstrlen(). */ RETCODE dbstrcpy(DBPROCESS * dbproc, int start, int numbytes, char *dest) { tdsdump_log(TDS_DBG_FUNC, "dbstrcpy(%p, %d, %d, %s)\n", dbproc, start, numbytes, dest); CHECK_CONN(FAIL); CHECK_NULP(dest, "dbstrcpy", 4, FAIL); if (start < 0) { dbperror(dbproc, SYBENSIP, 0); return FAIL; } if (numbytes < -1) { dbperror(dbproc, SYBEBNUM, 0); return FAIL; } dest[0] = 0; /* start with empty string being returned */ if (dbproc->dbbufsz > 0 && start < dbproc->dbbufsz) { if (numbytes == -1) numbytes = dbproc->dbbufsz - start; if (start + numbytes > dbproc->dbbufsz) numbytes = dbproc->dbbufsz - start; memcpy(dest, (char *) &dbproc->dbbuf[start], numbytes); dest[numbytes] = '\0'; } return SUCCEED; } /** * \ingroup dblib_core * \brief safely quotes character values in SQL text. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param src input string. * \param srclen length of \a src in bytes, or -1 to indicate it's null-terminated. * \param dest \em output: client-provided output buffer. * \param destlen size of \a dest in bytes, or -1 to indicate it's "big enough" and the data should be null-terminated. * \param quotetype - \c DBSINGLE Doubles all single quotes ('). - \c DBDOUBLE Doubles all double quotes ("). - \c DBBOTH Doubles all single and double quotes. * \retval SUCCEED everything worked. * \retval FAIL no such \a quotetype, or insufficient room in \a dest. * \sa dbcmd(), dbfcmd(). */ RETCODE dbsafestr(DBPROCESS * dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype) { int i, j = 0; int squote = FALSE, dquote = FALSE; tdsdump_log(TDS_DBG_FUNC, "dbsafestr(%p, %s, %d, %s, %d, %d)\n", dbproc, src, srclen, dest, destlen, quotetype); CHECK_NULP(src, "dbsafestr", 2, FAIL); CHECK_NULP(dest, "dbsafestr", 4, FAIL); /* check parameters */ if (srclen < -1 || destlen < -1) return FAIL; if (srclen == -1) srclen = (int)strlen(src); if (quotetype == DBSINGLE || quotetype == DBBOTH) squote = TRUE; if (quotetype == DBDOUBLE || quotetype == DBBOTH) dquote = TRUE; /* return FAIL if invalid quotetype */ if (!dquote && !squote) return FAIL; for (i = 0; i < srclen; i++) { /* dbsafestr returns fail if the deststr is not big enough */ /* need one char + one for terminator */ if (destlen >= 0 && j >= destlen) return FAIL; if (squote && src[i] == '\'') dest[j++] = '\''; else if (dquote && src[i] == '\"') dest[j++] = '\"'; if (destlen >= 0 && j >= destlen) return FAIL; dest[j++] = src[i]; } if (destlen >= 0 && j >= destlen) return FAIL; dest[j] = '\0'; return SUCCEED; } /** * \ingroup dblib_core * \brief Print a token value's name to a buffer * * \param token server SYB* value, e.g. SYBINT. * \return ASCII null-terminated string. * \sa dbaltop(), dbalttype(), dbcoltype(), dbrettype(). */ const char * dbprtype(int token) { tdsdump_log(TDS_DBG_FUNC, "dbprtype(%d)\n", token); return tds_prtype(token); } /** * \ingroup dblib_core * \brief describe table column attributes with a single call (Freetds-only API function modelled on dbcolinfo) * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column Nth in the result set, starting from 1. * \param pdbcol address of structure to be populated by this function. * \return SUCCEED or FAIL. * \sa dbcolinfo(). */ RETCODE dbtablecolinfo(DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbtablecolinfo(%p, %d, %p)\n", dbproc, column, pdbcol); CHECK_CONN(FAIL); CHECK_NULP(pdbcol, "dbtablecolinfo", 3, FAIL); DBPERROR_RETURN(pdbcol->SizeOfStruct != sizeof(DBCOL) && pdbcol->SizeOfStruct != sizeof(DBCOL2), SYBECOLSIZE); colinfo = dbcolptr(dbproc, column); if (!colinfo) return FAIL; strlcpy(pdbcol->Name, tds_dstr_cstr(&colinfo->column_name), sizeof(pdbcol->Name)); strlcpy(pdbcol->ActualName, tds_dstr_cstr(&colinfo->column_name), sizeof(pdbcol->ActualName)); strlcpy(pdbcol->TableName, tds_dstr_cstr(&colinfo->table_name), sizeof(pdbcol->TableName)); pdbcol->Type = tds_get_conversion_type(colinfo->column_type, colinfo->column_size); pdbcol->UserType = colinfo->column_usertype; pdbcol->MaxLength = colinfo->column_size; if (colinfo->column_nullable) pdbcol->Null = TRUE; else pdbcol->Null = FALSE; pdbcol->VarLength = FALSE; if (colinfo->column_nullable || is_nullable_type(colinfo->column_type)) pdbcol->VarLength = TRUE; pdbcol->Precision = colinfo->column_prec; pdbcol->Scale = colinfo->column_scale; pdbcol->Updatable = colinfo->column_writeable ? TRUE : FALSE; pdbcol->Identity = colinfo->column_identity ? TRUE : FALSE; if (pdbcol->SizeOfStruct >= sizeof(DBCOL2)) { DBCOL2 *col = (DBCOL2 *) pdbcol; TDSRET rc; col->ServerType = colinfo->on_server.column_type; col->ServerMaxLength = colinfo->on_server.column_size; rc = tds_get_column_declaration(dbproc->tds_socket, colinfo, col->ServerTypeDeclaration); if (TDS_FAILED(rc)) return FAIL; } return SUCCEED; } /** * \ingroup dblib_core * \brief Get text timestamp for a column in the current row. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column number of the column in the \c SELECT statement, starting at 1. * \return timestamp for \a column, may be NULL. * \sa dbtxptr(), dbwritetext(). */ DBBINARY * dbtxtimestamp(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; TDSBLOB *blob; tdsdump_log(TDS_DBG_FUNC, "dbtxtimestamp(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo || !is_blob_col(colinfo)) return NULL; blob = (TDSBLOB *) colinfo->column_data; /* test if valid */ if (!blob->valid_ptr) return NULL; return (DBBINARY *) blob->timestamp; } /** * \ingroup dblib_core * \brief Get text pointer for a column in the current row. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param column number of the column in the \c SELECT statement, starting at 1. * \return text pointer for \a column, may be NULL. * \sa dbtxtimestamp(), dbwritetext(). */ DBBINARY * dbtxptr(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; TDSBLOB *blob; tdsdump_log(TDS_DBG_FUNC, "dbtxptr(%p, %d)\n", dbproc, column); colinfo = dbcolptr(dbproc, column); if (!colinfo || !is_blob_col(colinfo)) return NULL; blob = (TDSBLOB *) colinfo->column_data; /* test if valid */ if (!blob->valid_ptr) return NULL; return (DBBINARY *) blob->textptr; } /** * \ingroup dblib_core * \brief Send text or image data to the server. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param objname table name * \param textptr text pointer to be modified, obtained from dbtxptr(). * \param textptrlen \em Ignored. Supposed to be \c DBTXPLEN. * \param timestamp text timestamp to be modified, obtained from dbtxtimestamp() or dbtxtsnewval(), may be \c NULL. * \param log \c TRUE if the operation is to be recorded in the transaction log. * \param size overall size of the data (in total, not just for this call), in bytes. A guideline, must not overstate the case. * \param text the chunk of data to write. * \retval SUCCEED everything worked. * \retval FAIL not sent, possibly because \a timestamp is invalid or was changed in the database since it was fetched. * \sa dbmoretext(), dbtxptr(), dbtxtimestamp(), dbwritetext(), dbtxtsput(). */ RETCODE dbwritetext(DBPROCESS * dbproc, char *objname, DBBINARY * textptr, DBTINYINT textptrlen, DBBINARY * timestamp, DBBOOL log, DBINT size, BYTE * text) { char textptr_string[35]; /* 16 * 2 + 2 (0x) + 1 */ char timestamp_string[19]; /* 8 * 2 + 2 (0x) + 1 */ TDS_INT result_type; tdsdump_log(TDS_DBG_FUNC, "dbwritetext(%p, %s, %p, %d, %p, %d)\n", dbproc, objname, textptr, textptrlen, timestamp, log); CHECK_CONN(FAIL); CHECK_NULP(objname, "dbwritetext", 2, FAIL); CHECK_NULP(textptr, "dbwritetext", 3, FAIL); CHECK_NULP(timestamp, "dbwritetext", 5, FAIL); CHECK_PARAMETER(size, SYBEZTXT, FAIL); if (IS_TDSDEAD(dbproc->tds_socket)) return FAIL; if (textptrlen > DBTXPLEN) return FAIL; dbconvert(dbproc, SYBBINARY, (BYTE *) textptr, textptrlen, SYBCHAR, (BYTE *) textptr_string, -1); dbconvert(dbproc, SYBBINARY, (BYTE *) timestamp, 8, SYBCHAR, (BYTE *) timestamp_string, -1); dbproc->dbresults_state = _DB_RES_INIT; if (dbproc->tds_socket->state == TDS_PENDING) { const TDSRET ret = tds_process_tokens(dbproc->tds_socket, &result_type, NULL, TDS_TOKEN_TRAILING); if (ret != TDS_NO_MORE_RESULTS) { dbperror(dbproc, SYBERPND, 0); dbproc->command_state = DBCMDSENT; return FAIL; } } if (TDS_FAILED(tds_writetext_start(dbproc->tds_socket, objname, textptr_string, timestamp_string, (log == TRUE), size))) return FAIL; if (!text) { dbproc->text_size = size; dbproc->text_sent = 0; return SUCCEED; } tds_writetext_continue(dbproc->tds_socket, text, size); tds_writetext_end(dbproc->tds_socket); dbproc->text_sent = 0; if (dbsqlok(dbproc) == SUCCEED && dbresults(dbproc) == SUCCEED) return SUCCEED; return FAIL; } /** * \ingroup dblib_core * \brief Fetch part of a text or image value from the server. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param buf \em output: buffer into which text will be placed. * \param bufsize size of \a buf, in bytes. * \return - \c >0 count of bytes placed in \a buf. - \c 0 end of row. - \c -1 \em error, no result set ready for \a dbproc. - \c NO_MORE_ROWS all rows read, no further data. * \sa dbmoretext(), dbnextrow(), dbwritetext(). */ STATUS dbreadtext(DBPROCESS * dbproc, void *buf, DBINT bufsize) { TDSSOCKET *tds; TDSCOLUMN *curcol; int cpbytes, bytes_avail; TDS_INT result_type; TDSRESULTINFO *resinfo; tdsdump_log(TDS_DBG_FUNC, "dbreadtext(%p, %p, %d)\n", dbproc, buf, bufsize); CHECK_PARAMETER(dbproc, SYBENULL, -1); CHECK_NULP(buf, "dbreadtext", 2, -1); tds = dbproc->tds_socket; if (!tds || !tds->res_info || !tds->res_info->columns[0]) return -1; resinfo = tds->res_info; curcol = resinfo->columns[0]; /* * if the current position is beyond the end of the text * set pos to 0 and return 0 to denote the end of the * text */ if (curcol->column_textpos && curcol->column_textpos >= curcol->column_cur_size) { curcol->column_textpos = 0; return 0; } /* * if pos is 0 (first time through or last call exhausted the text) * then read another row */ if (curcol->column_textpos == 0) { const int mask = TDS_STOPAT_ROWFMT|TDS_STOPAT_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE; buffer_save_row(dbproc); switch (tds_process_tokens(dbproc->tds_socket, &result_type, NULL, mask)) { case TDS_SUCCESS: if (result_type == TDS_ROW_RESULT || result_type == TDS_COMPUTE_RESULT) break; case TDS_NO_MORE_RESULTS: return NO_MORE_ROWS; default: return -1; } } /* find the number of bytes to return */ bytes_avail = curcol->column_cur_size - curcol->column_textpos; cpbytes = bytes_avail > bufsize ? bufsize : bytes_avail; memcpy(buf, &((TDSBLOB *) curcol->column_data)->textvalue[curcol->column_textpos], cpbytes); curcol->column_textpos += cpbytes; return cpbytes; } /** * \ingroup dblib_core * \brief Send chunk of a text/image value to the server. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param size count of bytes to send. * \param text textpointer, obtained from dbtxptr. * \retval SUCCEED always. * \sa dbtxptr(), dbtxtimestamp(), dbwritetext(). * \todo Check return value of called functions and return \c FAIL if appropriate. */ RETCODE dbmoretext(DBPROCESS * dbproc, DBINT size, const BYTE text[]) { tdsdump_log(TDS_DBG_FUNC, "dbmoretext(%p, %d, %p)\n", dbproc, size, text); CHECK_CONN(FAIL); CHECK_NULP(text, "dbmoretext", 3, FAIL); assert(dbproc->text_size >= dbproc->text_sent); /* TODO this test should be inside tds_writetext_continue, currently not */ if (size < 0 || size > dbproc->text_size - dbproc->text_sent) return FAIL; if (size) { if (TDS_FAILED(tds_writetext_continue(dbproc->tds_socket, text, size))) return FAIL; dbproc->text_sent += size; if (dbproc->text_sent == dbproc->text_size) { tds_writetext_end(dbproc->tds_socket); dbproc->text_sent = 0; } } return SUCCEED; } /** * \ingroup dblib_core * \brief Record to a file all SQL commands sent to the server * * \param filename name of file to write to. * \remarks Files are named \em filename.n, where n is an integer, starting with 0, and incremented with each callto dbopen(). * \sa dbopen(), TDSDUMP environment variable(). */ void dbrecftos(const char filename[]) { char *f; tdsdump_log(TDS_DBG_FUNC, "dbrecftos(%s)\n", filename); if (filename == NULL) { dbperror(NULL, SYBENULP, 0); return; } f = strdup(filename); if (!f) { dbperror(NULL, SYBEMEM, 0); return; } tds_mutex_lock(&dblib_mutex); free(g_dblib_ctx.recftos_filename); g_dblib_ctx.recftos_filename = f; g_dblib_ctx.recftos_filenum = 0; tds_mutex_unlock(&dblib_mutex); } /** \internal * \ingroup dblib_internal * \brief Get the TDS version in use for \a dbproc. * * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return a \c DBTDS* token. * \remarks The integer values of the constants are counterintuitive. * \sa DBTDS(). */ int dbtds(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbtds(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, -1); if (dbproc->tds_socket) { switch (dbproc->tds_socket->conn->tds_version) { case 0x402: return DBTDS_4_2; case 0x406: return DBTDS_4_6; case 0x500: return DBTDS_5_0; case 0x700: return DBTDS_7_0; case 0x701: return DBTDS_7_1; case 0x702: return DBTDS_7_2; case 0x703: return DBTDS_7_3; case 0x704: return DBTDS_7_4; default: return DBTDS_UNKNOWN; } } return -1; } /** * \ingroup dblib_core * \brief See which version of db-lib is in use. * * \return null-terminated ASCII string representing the version of db-lib. * \remarks FreeTDS returns the CVS version string of dblib.c. * \sa */ const char * dbversion() { tdsdump_log(TDS_DBG_FUNC, "dbversion(void)\n"); return TDS_VERSION_NO; } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_core * \brief Set the default character set. * * \param charset null-terminated ASCII string, matching a row in master..syscharsets. * \sa dbsetdeflang(), dbsetdefcharset(), dblogin(), dbopen(). * \todo Unimplemented. */ RETCODE dbsetdefcharset(char *charset) { tdsdump_log(TDS_DBG_FUNC, "dbsetdefcharset(%s)\n", charset); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbsetdefcharset()\n"); return SUCCEED; } /** * \ingroup dblib_core * \brief Ready execution of a registered procedure. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param procedure_name to call. * \param namelen size of \a procedure_name, in bytes. * \sa dbregparam(), dbregexec(), dbregwatch(), dbreglist(), dbregwatchlist * \todo Unimplemented. */ RETCODE dbreginit(DBPROCESS * dbproc, DBCHAR * procedure_name, DBSMALLINT namelen) { tdsdump_log(TDS_DBG_FUNC, "dbreginit(%p, %s, %d)\n", dbproc, procedure_name, namelen); CHECK_CONN(FAIL); CHECK_NULP(procedure_name, "dbreginit", 2, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbreginit()\n"); return SUCCEED; } /** * \ingroup dblib_core * \brief Get names of Open Server registered procedures. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbregparam(), dbregexec(), dbregwatch(), dbreglist(), dbregwatchlist(). * \todo Unimplemented. */ RETCODE dbreglist(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbreglist(%p)\n", dbproc); CHECK_CONN(FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbreglist()\n"); return SUCCEED; } /** * \ingroup dblib_core * \brief Describe parameter of registered procedure . * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param param_name * \param type \c SYB* datatype. * \param datalen size of \a data. * \param data address of buffer holding value for the parameter. * \sa dbreginit(), dbregexec(), dbnpdefine(), dbnpcreate(), dbregwatch(). * \todo Unimplemented. */ RETCODE dbregparam(DBPROCESS * dbproc, char *param_name, int type, DBINT datalen, BYTE * data) { tdsdump_log(TDS_DBG_FUNC, "dbregparam(%p, %s, %d, %d, %p)\n", dbproc, param_name, type, datalen, data); CHECK_CONN(FAIL); CHECK_NULP(param_name, "dbregparam", 2, FAIL); CHECK_NULP(data, "dbregparam", 5, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbregparam()\n"); return SUCCEED; } /** * \ingroup dblib_core * \brief Execute a registered procedure. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param options * \sa dbreginit(), dbregparam(), dbregwatch(), dbregnowatch * \todo Unimplemented. */ RETCODE dbregexec(DBPROCESS * dbproc, DBUSMALLINT options) { tdsdump_log(TDS_DBG_FUNC, "dbregexec(%p, %d)\n", dbproc, options); CHECK_CONN(FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbregexec()\n"); return SUCCEED; } #endif /** * \ingroup dblib_datetime * \brief Get name of a month, in some human language. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param language \em ignored. * \param monthnum number of the month, starting with 1. * \param shortform set to \c TRUE for a three letter output ("Jan" - "Dec"), else zero. * \return address of null-terminated ASCII string, or \c NULL on error. * \sa db12hour(), dbdateorder(), dbdayname(), DBSETLNATLANG(), dbsetopt(). */ const char * dbmonthname(DBPROCESS * dbproc, char *language, int monthnum, DBBOOL shortform) { static const char shortmon[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static const char longmon[][12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; tdsdump_log(TDS_DBG_FUNC, "dbmonthname(%p, %s, %d, %d)\n", dbproc, language, monthnum, shortform); CHECK_PARAMETER(dbproc, SYBENULL, NULL); CHECK_NULP(language, "dbmonthname", 2, NULL); if (monthnum < 1 || monthnum > 12) return NULL; return (shortform) ? shortmon[monthnum - 1] : longmon[monthnum - 1]; } /** * \ingroup dblib_core * \brief See if a command caused the current database to change. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return name of new database, if changed, as a null-terminated ASCII string, else \c NULL. * \sa dbname(), dbresults(), dbsqlexec(), dbsqlsend(), dbuse(). */ char * dbchange(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbchange(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, NULL); if (dbproc->envchange_rcv & (1 << (TDS_ENV_DATABASE - 1))) { return dbproc->dbcurdb; } return NULL; } /** * \ingroup dblib_core * \brief Get name of current database. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return current database name, as null-terminated ASCII string. * \sa dbchange(), dbuse(). */ char * dbname(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbname(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, NULL); return dbproc->dbcurdb; } /** * \ingroup dblib_core * \brief Get \c syscharset name of the server character set. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \return name of server's charset, as null-terminated ASCII string. * \sa dbcharsetconv(), dbgetcharset(), DBSETLCHARSET(). */ char * dbservcharset(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbservcharset(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, NULL); return dbproc->servcharset; } /** * \ingroup dblib_core * \brief Transmit the command buffer to the server. \em Non-blocking, does not wait for a response. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval SUCCEED SQL sent. * \retval FAIL protocol problem, unless dbsqlsend() when it's not supposed to be (in which case a db-lib error message will be emitted). * \sa dbcmd(), dbfcmd(), DBIORDESC(), DBIOWDESC(), dbnextrow(), dbpoll(), dbresults(), dbsettime(), dbsqlexec(), dbsqlok(). */ RETCODE dbsqlsend(DBPROCESS * dbproc) { TDSSOCKET *tds; char *cmdstr; TDSRET rc; TDS_INT result_type; char timestr[256]; tdsdump_log(TDS_DBG_FUNC, "dbsqlsend(%p)\n", dbproc); CHECK_CONN(FAIL); tds = dbproc->tds_socket; if (tds->state == TDS_PENDING) { if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_TRAILING) != TDS_NO_MORE_RESULTS) { dbperror(dbproc, SYBERPND, 0); dbproc->command_state = DBCMDSENT; return FAIL; } } if (dbproc->dboptcmd) { if ((cmdstr = dbstring_get(dbproc->dboptcmd)) == NULL) { dbperror(dbproc, SYBEASEC, 0); /* Attempt to send an empty command buffer to the server */ return FAIL; } rc = tds_submit_query(dbproc->tds_socket, cmdstr); free(cmdstr); dbstring_free(&(dbproc->dboptcmd)); if (TDS_FAILED(rc)) { return FAIL; } dbproc->avail_flag = FALSE; dbproc->envchange_rcv = 0; dbproc->dbresults_state = _DB_RES_INIT; while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS)) == TDS_SUCCESS); if (rc != TDS_NO_MORE_RESULTS) { return FAIL; } } dbproc->more_results = TRUE; if (dbproc->ftos != NULL) { fprintf(dbproc->ftos, "%s\n", dbproc->dbbuf); fprintf(dbproc->ftos, "go /* %s */\n", _dbprdate(timestr)); fflush(dbproc->ftos); } if (TDS_FAILED(tds_submit_query(dbproc->tds_socket, (char *) dbproc->dbbuf))) { return FAIL; } dbproc->avail_flag = FALSE; dbproc->envchange_rcv = 0; dbproc->dbresults_state = _DB_RES_INIT; dbproc->command_state = DBCMDSENT; return SUCCEED; } /** * \ingroup dblib_core * \brief Get user-defined datatype of a compute column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \returns user-defined datatype of compute column, else -1. * \sa dbalttype(), dbcolutype(). */ DBINT dbaltutype(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbaltutype(%p, %d, %d)\n", dbproc, computeid, column); colinfo = dbacolptr(dbproc, computeid, column, 0); if (!colinfo) return -1; return colinfo->column_usertype; } /** * \ingroup dblib_core * \brief Get size of data in compute column. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param computeid of \c COMPUTE clause to which we're referring. * \param column Nth column in \a computeid, starting from 1. * \sa dbadata(), dbadlen(), dbalttype(), dbgetrow(), dbnextrow(), dbnumalts(). */ DBINT dbaltlen(DBPROCESS * dbproc, int computeid, int column) { TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "dbaltlen(%p, %d, %d)\n", dbproc, computeid, column); colinfo = dbacolptr(dbproc, computeid, column, 0); if (!colinfo) return -1; return colinfo->column_size; } /** * \ingroup dblib_core * \brief See if a server response has arrived. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param milliseconds how long to wait for the server before returning: - \c 0 return immediately. - \c -1 do not return until the server responds or a system interrupt occurs. * \param ready_dbproc \em output: DBPROCESS for which a response arrived, of \c NULL. * \param return_reason \em output: - \c DBRESULT server responded. - \c DBNOTIFICATION registered procedure notification has arrived. dbpoll() the registered handler, if any, before it returns. - \c DBTIMEOUT \a milliseconds elapsed before the server responded. - \c DBINTERRUPT operating-system interrupt occurred before the server responded. * \retval SUCCEED everything worked. * \retval FAIL a server connection died. * \sa DBIORDESC(), DBRBUF(), dbresults(), dbreghandle(), dbsqlok(). * \todo Unimplemented. */ #if defined(DBLIB_UNIMPLEMENTED) RETCODE dbpoll(DBPROCESS * dbproc, long milliseconds, DBPROCESS ** ready_dbproc, int *return_reason) { tdsdump_log(TDS_DBG_FUNC, "dbpoll(%p, %ld, %p, %p)\n", dbproc, milliseconds, ready_dbproc, return_reason); CHECK_CONN(FAIL); CHECK_NULP(ready_dbproc, "dbpoll", 3, FAIL); CHECK_NULP(return_reason, "dbpoll", 4, FAIL); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED dbpoll()\n"); return SUCCEED; } #endif /** \internal * \ingroup dblib_internal * \brief Get number of the first row in the row buffer. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa DBFIRSTROW(), dbclrbuf(), DBCURROW(), dbgetrow(), DBLASTROW(), dbnextrow(), dbsetopt(). */ DBINT dbfirstrow(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbfirstrow(%p)\n", dbproc); CHECK_CONN(0); return buffer_idx2row(&dbproc->row_buf, dbproc->row_buf.tail); } /** \internal * \ingroup dblib_internal * \brief Get number of the last row in the row buffer. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa DBLASTROW(), dbclrbuf(), DBCURROW(), DBFIRSTROW(), dbgetrow(), dbnextrow(), dbsetopt(). */ DBINT dblastrow(DBPROCESS * dbproc) { int idx; tdsdump_log(TDS_DBG_FUNC, "dblastrow(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, 0); idx = dbproc->row_buf.head; if (dbproc->row_buf.head != dbproc->row_buf.tail) { if (--idx < 0) idx = dbproc->row_buf.capacity - 1; } assert(idx >= 0); return buffer_idx2row(&dbproc->row_buf, idx); } /** \internal * \ingroup dblib_internal * \brief Get file descriptor of the socket used by a \c DBPROCESS to read data coming from the server. (!) * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbcmd(), DBIORDESC(), DBIOWDESC(), dbnextrow(), dbpoll(), DBRBUF(), dbresults(), dbsqlok(), dbsqlsend(). */ int dbiordesc(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbiordesc(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, -1); return (int) tds_get_s(dbproc->tds_socket); } /** \internal * \ingroup dblib_internal * \brief Get file descriptor of the socket used by a \c DBPROCESS to write data coming to the server. (!) * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \sa dbcmd(), DBIORDESC(), DBIOWDESC(), dbnextrow(), dbpoll(), DBRBUF(), dbresults(), dbsqlok(), dbsqlsend(). */ int dbiowdesc(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbiowdesc(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, -1); return (int) tds_get_s(dbproc->tds_socket); } DBBOOL dbisavail(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbisavail(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, FALSE); return dbproc->avail_flag; } /** \internal * \ingroup dblib_internal * \brief Mark a \c DBPROCESS as "available". * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \remarks Basically bogus. \c FreeTDS behaves the way Sybase's implementation does, but so what? Many \c db-lib functions set the \c DBPROCESS to "not available", but only dbsetavail() resets it to "available". * \sa DBISAVAIL(). DBSETAVAIL(). */ void dbsetavail(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "dbsetavail(%p)\n", dbproc); CHECK_PARAMETER(dbproc, SYBENULL, ); dbproc->avail_flag = TRUE; } /** * \ingroup dblib_core * \brief Build a printable string from text containing placeholders for variables. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param charbuf \em output: buffer that will contain the ASCII null-terminated string built by \c dbstrbuild(). * \param bufsize size of \a charbuf, in bytes. * \param text null-terminated ASCII string, with \em placeholders for variables. \em A Placeholder is a * three-byte string, made up of: - '%' a percent sign - 0-9 an integer (designates the argument number to use, starting with 1.) - '!' an exclamation point * \param formats null-terminated ASCII sprintf-style string. Has one format specifier for each placeholder in \a text. * \remarks Following \a formats are the arguments, the values to substitute for the placeholders. * \sa dbconvert(), dbdatename(), dbdatepart(). */ RETCODE dbstrbuild(DBPROCESS * dbproc, char *charbuf, int bufsize, char *text, char *formats, ...) { va_list ap; TDSRET rc; int resultlen; tdsdump_log(TDS_DBG_FUNC, "dbstrbuild(%p, %s, %d, %s, %s, ...)\n", dbproc, charbuf, bufsize, text, formats); CHECK_NULP(charbuf, "dbstrbuild", 2, FAIL); CHECK_NULP(text, "dbstrbuild", 4, FAIL); CHECK_NULP(formats, "dbstrbuild", 5, FAIL); va_start(ap, formats); rc = tds_vstrbuild(charbuf, bufsize, &resultlen, text, TDS_NULLTERM, formats, TDS_NULLTERM, ap); charbuf[resultlen] = '\0'; va_end(ap); return TDS_SUCCEED(rc) ? SUCCEED : FAIL; } static char * _dbprdate(char *timestr) { time_t currtime = time(NULL); assert(timestr); strcpy(timestr, asctime(gmtime(&currtime))); timestr[strlen(timestr) - 1] = '\0'; /* remove newline */ return timestr; } static DBINT _dbnullable(DBPROCESS * dbproc, int column) { TDSCOLUMN *colinfo; TDSRESULTINFO *resinfo; assert(dbproc && dbproc->tds_socket); resinfo = dbproc->tds_socket->res_info; if (!resinfo || column < 1 || column > resinfo->num_cols) return FALSE; colinfo = resinfo->columns[column - 1]; if (colinfo->column_nullable) return TRUE; return FALSE; } /** Returns type in string. Used for debugging purpose */ static const char * tds_prdatatype(int datatype_token) { switch ((TDS_SERVER_TYPE) datatype_token) { case SYBCHAR: return "SYBCHAR"; case SYBVARCHAR: return "SYBVARCHAR"; case SYBINTN: return "SYBINTN"; case SYBINT1: return "SYBINT1"; case SYBINT2: return "SYBINT2"; case SYBINT4: return "SYBINT4"; case SYBINT8: return "SYBINT8"; case SYBFLT8: return "SYBFLT8"; case SYBDATETIME: return "SYBDATETIME"; case SYBBIT: return "SYBBIT"; case SYBTEXT: return "SYBTEXT"; case SYBNTEXT: return "SYBNTEXT"; case SYBIMAGE: return "SYBIMAGE"; case SYBMONEY4: return "SYBMONEY4"; case SYBMONEY: return "SYBMONEY"; case SYBDATETIME4: return "SYBDATETIME4"; case SYBREAL: return "SYBREAL"; case SYBBINARY: return "SYBBINARY"; case SYBVOID: return "SYBVOID"; case SYBVARBINARY: return "SYBVARBINARY"; case SYBNVARCHAR: return "SYBNVARCHAR"; case SYBBITN: return "SYBBITN"; case SYBNUMERIC: return "SYBNUMERIC"; case SYBDECIMAL: return "SYBDECIMAL"; case SYBFLTN: return "SYBFLTN"; case SYBMONEYN: return "SYBMONEYN"; case SYBDATETIMN: return "SYBDATETIMN"; case XSYBCHAR: return "XSYBCHAR"; case XSYBVARCHAR: return "XSYBVARCHAR"; case XSYBNVARCHAR: return "XSYBNVARCHAR"; case XSYBNCHAR: return "XSYBNCHAR"; case XSYBVARBINARY: return "XSYBVARBINARY"; case XSYBBINARY: return "XSYBBINARY"; case SYBLONGBINARY: return "SYBLONGBINARY"; case SYBSINT1: return "SYBSINT1"; case SYBUINT2: return "SYBUINT2"; case SYBUINT4: return "SYBUINT4"; case SYBUINT8: return "SYBUINT8"; case SYBUNIQUE: return "SYBUNIQUE"; case SYBVARIANT: return "SYBVARIANT"; case SYBMSXML: return "SYBMSXML"; case SYBMSDATE: return "SYBMSDATE"; case SYBMSTIME: return "SYBMSTIME"; case SYBMSDATETIME2: return "SYBMSDATETIME2"; case SYBMSDATETIMEOFFSET: return "SYBMSDATETIMEOFFSET"; case SYBDATE: return "SYBDATE"; case SYBTIME: return "SYBTIME"; case SYB5BIGDATETIME: return "SYBBIGDATETIME"; case SYB5BIGTIME: return "SYBBIGTIME"; case SYBMSUDT: return "SYBMSUDT"; case SYBUINT1: return "SYBUINT1"; case SYBDATEN: return "SYBDATEN"; case SYB5INT8: return "SYB5INT8"; case SYBINTERVAL: return "SYBINTERVAL"; case SYBTIMEN: return "SYBTIMEN"; case SYBUINTN: return "SYBUINTN"; case SYBUNITEXT: return "SYBUNITEXT"; case SYBXML: return "SYBXML"; } return "(unknown)"; } #if 1 void copy_data_to_host_var(DBPROCESS * dbproc, TDS_SERVER_TYPE srctype, const BYTE * src, DBINT srclen, BYTE * dest, DBINT destlen, int bindtype, DBINT *indicator) { CONV_RESULT dres; DBINT ret; int len; DBINT indicator_value = 0; bool limited_dest_space = false; TDS_SERVER_TYPE desttype = dblib_bound_type(bindtype); tdsdump_log(TDS_DBG_FUNC, "copy_data_to_host_var(%d [%s] len %d => %d [%s] len %d)\n", srctype, tds_prdatatype(srctype), srclen, desttype, tds_prdatatype(desttype), destlen); CHECK_NULP(src, "copy_data_to_host_var", 3, ); CHECK_NULP(dest, "copy_data_to_host_var", 6, ); if (desttype == TDS_INVALID_TYPE) return; /* indicator can be NULL */ assert(srclen >= 0); if (destlen > 0) { limited_dest_space = true; } /* oft times we are asked to convert a data type to itself */ if (desttype == SYBNUMERIC) { DBNUMERIC *num = NULL; /* num->scale is unsigned */ /* only MS, use always source */ if (bindtype == SRCNUMERICBIND || bindtype == SRCDECIMALBIND) { if (is_numeric_type(srctype)) num = (DBNUMERIC*) src; else num = (DBNUMERIC*) dest; } else if (dbproc->msdblib) { /* MS by default use only destination informations */ num = (DBNUMERIC*) dest; } else { /* Sybase, dbbind means source or default */ /* TODO if dbbind_ps is used is more complicated */ if (is_numeric_type(srctype)) num = (DBNUMERIC*) src; } if (!num) { dres.n.precision = 18; dres.n.scale = 0; } else { dres.n.precision = num->precision; dres.n.scale = num->scale; } } else if ((srctype == desttype) || (is_similar_type(srctype, desttype))) { tdsdump_log(TDS_DBG_INFO1, "copy_data_to_host_var() srctype == desttype\n"); switch (desttype) { case SYBVARBINARY: case SYBBINARY: case SYBIMAGE: if (bindtype == VARYBINBIND) { DBVARYBIN *bin = (DBVARYBIN*) dest; if (limited_dest_space) { if (srclen > sizeof(bin->array)) { dbperror(dbproc, SYBECOFL, 0); indicator_value = srclen; srclen = sizeof(bin->array); } } memcpy(bin->array, src, srclen); bin->len = srclen; break; } if (srclen > destlen && destlen >= 0) { dbperror(dbproc, SYBECOFL, 0); } else { memcpy(dest, src, srclen); if (srclen < destlen) memset(dest + srclen, 0, destlen - srclen); } break; case SYBCHAR: case SYBVARCHAR: case SYBTEXT: switch (bindtype) { case NTBSTRINGBIND: /* strip trailing blanks, null term */ while (srclen && src[srclen - 1] == ' ') { --srclen; } if (limited_dest_space) { if (srclen + 1 > destlen) { dbperror(dbproc, SYBECOFL, 0); indicator_value = srclen + 1; srclen = destlen - 1; } } memcpy(dest, src, srclen); dest[srclen] = '\0'; break; case STRINGBIND: /* pad with blanks, NUL term */ if (limited_dest_space) { if (srclen + 1 > destlen) { dbperror(dbproc, SYBECOFL, 0); indicator_value = srclen + 1; srclen = destlen - 1; } } else { destlen = srclen + 1; } memcpy(dest, src, srclen); if (srclen < destlen) memset(dest + srclen, ' ', destlen - srclen - 1); dest[destlen - 1] = '\0'; break; case CHARBIND: /* pad with blanks, NO NUL term */ if (limited_dest_space) { if (srclen > destlen) { dbperror(dbproc, SYBECOFL, 0); indicator_value = srclen; srclen = destlen; } } else { destlen = srclen; } memcpy(dest, src, srclen); if (srclen < destlen) memset(dest + srclen, ' ', destlen - srclen); break; case VARYCHARBIND: /* strip trailing blanks, NO NUL term */ if (limited_dest_space) { if (srclen > destlen) { dbperror(dbproc, SYBECOFL, 0); indicator_value = srclen; srclen = destlen; } } memcpy(((DBVARYCHAR *)dest)->str, src, srclen); ((DBVARYCHAR *)dest)->len = srclen; break; } break; case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBREAL: case SYBBIT: case SYBBITN: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBDATE: case SYBTIME: case SYB5BIGDATETIME: case SYB5BIGTIME: case SYBUNIQUE: ret = tds_get_size_by_type(desttype); memcpy(dest, src, ret); break; case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: ret = sizeof(TDS_DATETIMEALL); memcpy(dest, src, ret); break; default: break; } if (indicator) *indicator = indicator_value; return; } /* end srctype == desttype */ len = tds_convert(g_dblib_ctx.tds_ctx, srctype, src, srclen, desttype, &dres); tdsdump_log(TDS_DBG_INFO1, "copy_data_to_host_var(): tds_convert returned %d\n", len); if (len < 0) { _dblib_convert_err(dbproc, len); return; } switch (desttype) { case SYBVARBINARY: case SYBBINARY: case SYBIMAGE: if (bindtype == VARYBINBIND) { if (limited_dest_space) { if (len > sizeof(((DBVARYBIN *)dest)->array)) { dbperror(dbproc, SYBECOFL, 0); indicator_value = len; len = sizeof(((DBVARYBIN *)dest)->array); } } memcpy(((DBVARYBIN *)dest)->array, dres.c, len); ((DBVARYBIN *)dest)->len = len; } else { if (len > destlen && destlen >= 0) { dbperror(dbproc, SYBECOFL, 0); } else { memcpy(dest, dres.ib, len); if (len < destlen) memset(dest + len, 0, destlen - len); } } TDS_ZERO_FREE(dres.ib); break; case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBFLT8: case SYBREAL: case SYBBIT: case SYBBITN: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBDATE: case SYBTIME: case SYBNUMERIC: case SYBDECIMAL: case SYBUNIQUE: case SYBMSDATE: case SYBMSTIME: case SYB5BIGDATETIME: case SYB5BIGTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: memcpy(dest, &(dres.ti), len); break; case SYBCHAR: case SYBVARCHAR: case SYBTEXT: tdsdump_log(TDS_DBG_INFO1, "copy_data_to_host_var() outputs %d bytes char data destlen = %d \n", len, destlen); switch (bindtype) { case NTBSTRINGBIND: /* strip trailing blanks, null term */ while (len && dres.c[len - 1] == ' ') { --len; } if (limited_dest_space) { if (len + 1 > destlen) { dbperror(dbproc, SYBECOFL, 0); len = destlen - 1; } } memcpy(dest, dres.c, len); dest[len] = '\0'; break; case STRINGBIND: /* pad with blanks, null term */ if (limited_dest_space) { if (len + 1 > destlen) { dbperror(dbproc, SYBECOFL, 0); len = destlen - 1; } } else { destlen = len + 1; } memcpy(dest, dres.c, len); if (len < destlen) memset(dest + len, ' ', destlen - len - 1); dest[destlen - 1] = '\0'; break; case CHARBIND: /* pad with blanks, NO null term */ if (limited_dest_space) { if (len > destlen) { dbperror(dbproc, SYBECOFL, 0); indicator_value = len; len = destlen; } } else { destlen = len; } memcpy(dest, dres.c, len); if (len < destlen) memset(dest + len, ' ', destlen - len); break; case VARYCHARBIND: /* strip trailing blanks, NO null term */ if (limited_dest_space) { if (len > sizeof(((DBVARYCHAR *)dest)->str)) { dbperror(dbproc, SYBECOFL, 0); indicator_value = len; len = sizeof(((DBVARYCHAR *)dest)->str); } } memcpy(((DBVARYCHAR *)dest)->str, dres.c, len); ((DBVARYCHAR *)dest)->len = len; break; } free(dres.c); break; default: tdsdump_log(TDS_DBG_INFO1, "error: copy_data_to_host_var(): unrecognized desttype %d \n", desttype); break; } if (indicator) *indicator = indicator_value; } #endif /** \internal * \ingroup dblib_internal * \remarks member msgno Vendor-defined message number * \remarks member severity Is passed to the error handler * \remarks member msgtext Text of message */ typedef struct _dblib_error_message { DBINT msgno; int severity; const char *msgtext; } DBLIB_ERROR_MESSAGE; /* * The msgtext member holds up to two strings. The first one is the message text, which may contain placeholders. * The second one, if it exists, is the format string for dbstrbuild(). Messages containing no placeholders still need * an extra NULL to indicate a zero-length format string. */ static const DBLIB_ERROR_MESSAGE dblib_error_messages[] = { { SYBEVERDOWN, EXINFO, "TDS version downgraded to 7.1!\0" } , { SYBEICONVIU, EXCONVERSION, "Some character(s) could not be converted into client's character set\0" } , { SYBEICONVAVAIL, EXCONVERSION, "Character set conversion is not available between client character set '%1!' and " "server character set '%2!'\0%s %s" } , { SYBEICONVO, EXCONVERSION, "Error converting characters into server's character set. Some character(s) could " "not be converted\0" } , { SYBEICONVI, EXCONVERSION, "Some character(s) could not be converted into client's character set. Unconverted " "bytes were changed to question marks ('?')\0" } , { SYBEICONV2BIG, EXCONVERSION, "Buffer overflow converting characters from client into server's character set\0" } , { SYBEPORT, EXUSER, "Both port and instance specified\0" } , { SYBETDSVER, EXUSER, "Cannot bcp with TDSVER < 5.0\0" } , { SYBEAAMT, EXPROGRAM, "User attempted a dbaltbind with mismatched column and variable types\0" } , { SYBEABMT, EXPROGRAM, "User attempted a dbbind with mismatched column and variable types\0" } , { SYBEABNC, EXPROGRAM, "Attempt to bind to a non-existent column\0" } , { SYBEABNP, EXPROGRAM, "Attempt to bind using NULL pointers\0" } , { SYBEABNV, EXPROGRAM, "Attempt to bind to a NULL program variable\0" } , { SYBEACNV, EXCONVERSION, "Attempt to do data-conversion with NULL destination variable.\0" } , { SYBEADST, EXCONSISTENCY, "International Release: Error in attempting to determine the size of a pair of " "translation tables\0" } , { SYBEAICF, EXCONSISTENCY, "International Release: Error in attempting to install custom format\0" } , { SYBEALTT, EXCONSISTENCY, "International Release: Error in attempting to load a pair of translation tables\0" } , { SYBEAOLF, EXRESOURCE, "International Release: Error in attempting to open a localization file\0" } , { SYBEAPCT, EXCONSISTENCY, "International Release: Error in attempting to perform a character set translation\0" } , { SYBEAPUT, EXPROGRAM, "Attempt to print unknown token\0" } , { SYBEARDI, EXRESOURCE, "International Release: Error in attempting to read datetime information from a " "localization file\0" } , { SYBEARDL, EXRESOURCE, "International Release: Error in attempting to read the dblib.loc localization file\0" } , { SYBEASEC, EXPROGRAM, "Attempt to send an empty command buffer to the server\0" } , { SYBEASNL, EXPROGRAM, "Attempt to set fields in a null LOGINREC\0" } , { SYBEASTL, EXPROGRAM, "Synchronous I/O attempted at AST level\0" } , { SYBEASUL, EXPROGRAM, "Attempt to set unknown LOGINREC field\0" } , { SYBEAUTN, EXPROGRAM, "Attempt to update the timestamp of a table that has no timestamp column\0" } , { SYBEBADPK, EXINFO, "Packet size of %1! not supported -- size of %2! used instead!\0%d %d" } , { SYBEBBCI, EXINFO, "Batch successfully bulk copied to the server\0" } , { SYBEBBL, EXPROGRAM, "Bad bindlen parameter passed to dbsetnull\0" } , { SYBEBCBC, EXPROGRAM, "bcp_columns must be called before bcp_colfmt and bcp_colfmt_ps\0" } , { SYBEBCBNPR, EXPROGRAM, "bcp_bind: if varaddr is NULL, prefixlen must be 0 " "and no terminator should be specified\0" } , { SYBEBCBNTYP, EXPROGRAM, "bcp_bind: if varaddr is NULL and varlen greater than 0, the table column type " "must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, " "SYBIMAGE or SYBBINARY\0" } , { SYBEBCBPREF, EXPROGRAM, "Illegal prefix length. Legal values are 0, 1, 2 or 4\0" } , { SYBEBCFO, EXUSER, "bcp host files must contain at least one column\0" } , { SYBEBCHLEN, EXPROGRAM, "host_collen should be greater than or equal to -1\0" } , { SYBEBCIS, EXCONSISTENCY, "Attempt to bulk copy an illegally-sized column value to the server\0" } , { SYBEBCIT, EXPROGRAM, "It is illegal to use BCP terminators with program variables other than SYBCHAR, " "SYBBINARY, SYBTEXT, or SYBIMAGE\0" } , { SYBEBCITBLEN, EXPROGRAM, "bcp_init: tblname parameter is too long\0" } , { SYBEBCITBNM, EXPROGRAM, "bcp_init: tblname parameter cannot be NULL\0" } , { SYBEBCMTXT, EXPROGRAM, "bcp_moretext may be used only when there is at least one text or image column in " "the server table\0" } , { SYBEBCNL, EXNONFATAL, "Negative length-prefix found in BCP data-file\0" } , { SYBEBCNN, EXUSER, "Attempt to bulk copy a NULL value into a Server column " "which does not accept null values\0" } , { SYBEBCNT, EXUSER, "Attempt to use Bulk Copy with a non-existent Server table\0" } , { SYBEBCOR, EXCONSISTENCY, "Attempt to bulk copy an oversized row to the server\0" } , { SYBEBCPB, EXPROGRAM, "bcp_bind, bcp_moretext and bcp_sendrow may not be used after bcp_init has been " "passed a non-NULL input file name\0" } , { SYBEBCPCTYP, EXPROGRAM, "bcp_colfmt: If table_colnum is 0, host_type cannot be 0\0" } , { SYBEBCPI, EXPROGRAM, "bcp_init must be called before any other bcp routines\0" } , { SYBEBCPN, EXPROGRAM, "bcp_bind, bcp_collen, bcp_colptr, bcp_moretext and bcp_sendrow may be used only " "after bcp_init has been called with the copy direction set to DB_IN\0" } , { SYBEBCPREC, EXNONFATAL, "Column %1!: Illegal precision value encountered\0%d" } , { SYBEBCPREF, EXPROGRAM, "Illegal prefix length. Legal values are -1, 0, 1, 2 or 4\0" } , { SYBEBCRE, EXNONFATAL, "I/O error while reading bcp datafile\0" } , { SYBEBCRO, EXINFO, "The BCP hostfile '%1!' contains only %2! rows. It was impossible to read the " "requested %3! rows\0%s %d %d" } , { SYBEBCSA, EXUSER, "The BCP hostfile '%1!' contains only %2! rows. " "Skipping all of these rows is not allowed\0%s %d" } , { SYBEBCSET, EXCONSISTENCY, "Unknown character-set encountered\0" } , { SYBEBCSI, EXPROGRAM, "Host-file columns may be skipped only when copying into the Server\0" } , { SYBEBCSNDROW, EXPROGRAM, "bcp_sendrow may not be called unless all text data for the previous row has been " "sent using bcp_moretext\0" } , { SYBEBCSNTYP, EXPROGRAM, "column number %1!: if varaddr is NULL and varlen greater than 0, the table column " "type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, " "SYBCHAR, SYBIMAGE or SYBBINARY\0%d" } , { SYBEBCUC, EXRESOURCE, "bcp: Unable to close host datafile\0" } , { SYBEBCUO, EXRESOURCE, "bcp: Unable to open host datafile\0" } , { SYBEBCVH, EXPROGRAM, "bcp_exec may be called only after bcp_init has been passed a valid host file\0" } , { SYBEBCVLEN, EXPROGRAM, "varlen should be greater than or equal to -1\0" } , { SYBEBCWE, EXNONFATAL, "I/O error while writing bcp datafile\0" } , { SYBEBDIO, EXPROGRAM, "Bad bulk copy direction. Must be either IN or OUT\0" } , { SYBEBEOF, EXNONFATAL, "Unexpected EOF encountered in bcp datafile\0" } , { SYBEBIHC, EXPROGRAM, "Incorrect host-column number found in bcp format file\0" } , { SYBEBIVI, EXPROGRAM, "bcp_columns, bcp_colfmt and bcp_colfmt_ps may be used only after bcp_init has been " "passed a valid input file\0" } , { SYBEBNCR, EXPROGRAM, "Attempt to bind user variable to a non-existent compute row\0" } , { SYBEBNUM, EXPROGRAM, "Bad numbytes parameter passed to dbstrcpy\0" } , { SYBEBPKS, EXPROGRAM, "In DBSETLPACKET, the packet size parameter must be between 0 and 999999\0" } , { SYBEBPREC, EXPROGRAM, "Illegal precision specified\0" } , { SYBEBPROBADDEF, EXCONSISTENCY, "bcp protocol error: illegal default column id received\0" } , { SYBEBPROCOL, EXCONSISTENCY, "bcp protocol error: returned column count differs from the actual number of " "columns received\0" } , { SYBEBPRODEF, EXCONSISTENCY, "bcp protocol error: expected default information and got none\0" } , { SYBEBPRODEFID, EXCONSISTENCY, "bcp protocol error: default column id and actual column id are not same\0" } , { SYBEBPRODEFTYP, EXCONSISTENCY, "bcp protocol error: default value datatype differs from column datatype\0" } , { SYBEBPROEXTDEF, EXCONSISTENCY, "bcp protocol error: more than one row of default information received\0" } , { SYBEBPROEXTRES, EXCONSISTENCY, "bcp protocol error: unexpected set of results received\0" } , { SYBEBPRONODEF, EXCONSISTENCY, "bcp protocol error: default value received for column that does not have default\0" } , { SYBEBPRONUMDEF, EXCONSISTENCY, "bcp protocol error: expected number of defaults differs from the actual number of " "defaults received\0" } , { SYBEBRFF, EXRESOURCE, "I/O error while reading bcp format file\0" } , { SYBEBSCALE, EXPROGRAM, "Illegal scale specified\0" } , { SYBEBTMT, EXPROGRAM, "Attempt to send too much text data via the bcp_moretext call\0" } , { SYBEBTOK, EXCOMM, "Bad token from the server: Datastream processing out of sync\0" } , { SYBEBTYP, EXPROGRAM, "Unknown bind type passed to DB-Library function\0" } , { SYBEBTYPSRV, EXPROGRAM, "Datatype is not supported by the server\0" } , { SYBEBUCE, EXRESOURCE, "bcp: Unable to close error file\0" } , { SYBEBUCF, EXPROGRAM, "bcp: Unable to close format file\0" } , { SYBEBUDF, EXPROGRAM, "bcp: Unrecognized datatype found in format file\0" } , { SYBEBUFF, EXPROGRAM, "bcp: Unable to create format file\0" } , { SYBEBUFL, EXCONSISTENCY, "DB-Library internal error-send buffer length corrupted\0" } , { SYBEBUOE, EXRESOURCE, "bcp: Unable to open error file\0" } , { SYBEBUOF, EXPROGRAM, "bcp: Unable to open format file\0" } , { SYBEBWEF, EXNONFATAL, "I/O error while writing bcp error file\0" } , { SYBEBWFF, EXRESOURCE, "I/O error while writing bcp format file\0" } , { SYBECAP, EXCOMM, "DB-Library capabilities not accepted by the Server\0" } , { SYBECAPTYP, EXCOMM, "Unexpected capability type in CAPABILITY datastream\0" } , { SYBECDNS, EXCONSISTENCY, "Datastream indicates that a compute column is derived from a non-existent select " "list member\0" } , { SYBECDOMAIN, EXCONVERSION, "Source field value is not within the domain of legal values\0" } , { SYBECINTERNAL, EXCONVERSION, "Internal Conversion error\0" } , { SYBECLOS, EXCOMM, "Error in closing network connection\0" } , { SYBECLPR, EXCONVERSION, "Data conversion resulted in loss of precision\0" } , { SYBECNOR, EXPROGRAM, "Column number out of range\0" } , { SYBECNOV, EXCONVERSION, "Attempt to set variable to NULL resulted in overflow\0" } , { SYBECOFL, EXCONVERSION, "Data conversion resulted in overflow\0" } , { SYBECONN, EXCOMM, "Unable to connect: Adaptive Server is unavailable or does not exist\0" } , { SYBECRNC, EXPROGRAM, "The current row is not a result of compute clause %1!, so it is illegal to attempt " "to extract that data from this row\0%d" } , { SYBECRSAGR, EXPROGRAM, "Aggregate functions are not allowed in a cursor statement\0" } , { SYBECRSBROL, EXPROGRAM, "Backward scrolling cannot be used in a forward scrolling cursor\0" } , { SYBECRSBSKEY, EXPROGRAM, "Keyset cannot be scrolled backward in mixed cursors with a previous fetch type\0" } , { SYBECRSBUFR, EXPROGRAM, "Row buffering should not be turned on when using cursor APIs\0" } , { SYBECRSDIS, EXPROGRAM, "Cursor statement contains one of the disallowed phrases compute, union, for " "browse, or select into\0" } , { SYBECRSFLAST, EXPROGRAM, "Fetch type LAST requires fully keyset driven cursors\0" } , { SYBECRSFRAND, EXPROGRAM, "Fetch types RANDOM and RELATIVE can only be used within the keyset of keyset " "driven cursors\0" } , { SYBECRSFROWN, EXPROGRAM, "Row number to be fetched is outside valid range\0" } , { SYBECRSFTYPE, EXRESOURCE, "Unknown fetch type\0" } , { SYBECRSINV, EXPROGRAM, "Invalid cursor statement\0" } , { SYBECRSINVALID, EXRESOURCE, "The cursor handle is invalid\0" } , { SYBECRSMROWS, EXRESOURCE, "Multiple rows are returned, only one is expected while retrieving dbname\0" } , { SYBECRSNOBIND, EXPROGRAM, "Cursor bind must be called prior to dbcursor invocation\0" } , { SYBECRSNOCOUNT, EXPROGRAM, "The DBNOCOUNT option should not be turned on " "when doing updates or deletes with dbcursor\0" } , { SYBECRSNOFREE, EXPROGRAM, "The DBNOAUTOFREE option should not be turned on when using cursor APIs\0" } , { SYBECRSNOIND, EXPROGRAM, "One of the tables involved in the cursor statement does not have a unique index\0" } , { SYBECRSNOKEYS, EXRESOURCE, "The entire keyset must be defined for KEYSET type cursors\0" } , { SYBECRSNOLEN, EXRESOURCE, "No unique index found\0" } , { SYBECRSNOPTCC, EXRESOURCE, "No OPTCC was found\0" } , { SYBECRSNORDER, EXRESOURCE, "The order of clauses must be from, where, and order by\0" } , { SYBECRSNORES, EXPROGRAM, "Cursor statement generated no results\0" } , { SYBECRSNROWS, EXRESOURCE, "No rows returned, at least one is expected\0" } , { SYBECRSNOTABLE, EXRESOURCE, "Table name is NULL\0" } , { SYBECRSNOUPD, EXPROGRAM, "Update or delete operation did not affect any rows\0" } , { SYBECRSNOWHERE, EXPROGRAM, "A WHERE clause is not allowed in a cursor update or insert\0" } , { SYBECRSNUNIQUE, EXRESOURCE, "No unique keys associated with this view\0" } , { SYBECRSORD, EXPROGRAM, "Only fully keyset driven cursors can have order by, group by, or having phrases\0" } , { SYBECRSRO, EXPROGRAM, "Data locking or modifications cannot be made in a READONLY cursor\0" } , { SYBECRSSET, EXPROGRAM, "A SET clause is required for a cursor update or insert\0" } , { SYBECRSTAB, EXPROGRAM, "Table name must be determined in operations involving data locking or modifications\0" } , { SYBECRSVAR, EXRESOURCE, "There is no valid address associated with this bind\0" } , { SYBECRSVIEW, EXPROGRAM, "A view cannot be joined with another table or a view in a cursor statement\0" } , { SYBECRSVIIND, EXPROGRAM, "The view used in the cursor statement does not include all the unique index " "columns of the underlying tables\0" } , { SYBECRSUPDNB, EXPROGRAM, "Update or insert operations cannot use bind variables when binding type is NOBIND\0" } , { SYBECRSUPDTAB, EXPROGRAM, "Update or insert operations using bind variables require single table cursors\0" } , { SYBECSYN, EXCONVERSION, "Attempt to convert data stopped by syntax error in source field\0" } , { SYBECUFL, EXCONVERSION, "Data conversion resulted in underflow\0" } , { SYBECWLL, EXPROGRAM, "Attempt to set column width less than 1\0" } , { SYBEDBPS, EXRESOURCE, "Maximum number of DBPROCESSes already allocated\0" } , { SYBEDDNE, EXCOMM, "DBPROCESS is dead or not enabled\0" } , { SYBEDIVZ, EXUSER, "Attempt to divide by $0.00 in function %1!\0%s" } , { SYBEDNTI, EXPROGRAM, "Attempt to use dbtxtsput to put a new text timestamp into a column whose datatype " "is neither SYBTEXT nor SYBIMAGE\0" } , { SYBEDPOR, EXPROGRAM, "Out-of-range datepart constant\0" } , { SYBEDVOR, EXPROGRAM, "Day values must be between 1 and 7\0" } , { SYBEECAN, EXINFO, "Attempted to cancel unrequested event notification\0" } , { SYBEEINI, EXINFO, "Must call dbreginit before dbregexec\0" } , { SYBEETD, EXPROGRAM, "Failure to send the expected amount of TEXT or IMAGE data via dbmoretext\0" } , { SYBEEUNR, EXCOMM, "Unsolicited event notification received\0" } , { SYBEEVOP, EXINFO, "Called dbregwatch with a bad options parameter\0" } , { SYBEEVST, EXINFO, "Must initiate a transaction before calling dbregparam\0" } , { SYBEFCON, EXCOMM, "Adaptive Server connection failed\0" } , { SYBEFRES, EXFATAL, "Challenge-Response function failed\0" } , { SYBEFSHD, EXRESOURCE, "Error in attempting to find the Sybase home directory\0" } , { SYBEFUNC, EXPROGRAM, "Functionality not supported at the specified version level\0" } , { SYBEICN, EXPROGRAM, "Invalid computeid or compute column number\0" } , { SYBEIDCL, EXCONSISTENCY, "Illegal datetime column length returned by Adaptive Server. Legal datetime lengths " "are 4 and 8 bytes\0" } , { SYBEIDECCL, EXCONSISTENCY, "Invalid decimal column length returned by the server\0" } , { SYBEIFCL, EXCONSISTENCY, "Illegal floating-point column length returned by Adaptive Server. Legal " "floating-point lengths are 4 and 8 bytes\0" } , { SYBEIFNB, EXPROGRAM, "Illegal field number passed to bcp_control\0" } , { SYBEIICL, EXCONSISTENCY, "Illegal integer column length returned by Adaptive Server. Legal integer lengths " "are 1, 2, and 4 bytes\0" } , { SYBEIMCL, EXCONSISTENCY, "Illegal money column length returned by Adaptive Server. Legal money lengths are 4 " "and 8 bytes\0" } , { SYBEINLN, EXUSER, "Interface file: unexpected end-of-line\0" } , { SYBEINTF, EXUSER, "Server name not found in configuration files\0" } , { SYBEINUMCL, EXCONSISTENCY, "Invalid numeric column length returned by the server\0" } , { SYBEIPV, EXINFO, "%1! is an illegal value for the %2! parameter of %3!\0%d %s %s" } , { SYBEISOI, EXCONSISTENCY, "International Release: Invalid sort-order information found\0" } , { SYBEISRVPREC, EXCONSISTENCY, "Illegal precision value returned by the server\0" } , { SYBEISRVSCL, EXCONSISTENCY, "Illegal scale value returned by the server\0" } , { SYBEITIM, EXPROGRAM, "Illegal timeout value specified\0" } , { SYBEIVERS, EXPROGRAM, "Illegal version level specified\0" } , { SYBEKBCI, EXINFO, "1000 rows sent to the server\0" } , { SYBEKBCO, EXINFO, "1000 rows successfully bulk copied to host file\0" } , { SYBEMEM, EXRESOURCE, "Unable to allocate sufficient memory\0" } , { SYBEMOV, EXUSER, "Money arithmetic resulted in overflow in function %1!\0%s" } , { SYBEMPLL, EXUSER, "Attempt to set maximum number of DBPROCESSes lower than 1\0" } , { SYBEMVOR, EXPROGRAM, "Month values must be between 1 and 12\0" } , { SYBENBUF, EXINFO, "Called dbsendpassthru with a NULL buf parameter\0" } , { SYBENBVP, EXPROGRAM, "Cannot pass dbsetnull a NULL bindval pointer\0" } , { SYBENDC, EXPROGRAM, "Cannot have negative component in date in numeric form\0" } , { SYBENDTP, EXPROGRAM, "Called dbdatecrack with NULL datetime parameter\0" } , { SYBENEG, EXCOMM, "Negotiated login attempt failed\0" } , { SYBENHAN, EXINFO, "Called dbrecvpassthru with a NULL handle parameter\0" } , { SYBENMOB, EXPROGRAM, "No such member of order by clause\0" } , { SYBENOEV, EXINFO, "DBPOLL can not be called when registered procedure notifications have been disabled\0" } , { SYBENPRM, EXPROGRAM, "NULL parameter not allowed for this dboption\0" } , { SYBENSIP, EXPROGRAM, "Negative starting index passed to dbstrcpy\0" } , { SYBENTLL, EXUSER, "Name too long for LOGINREC field\0" } , { SYBENTTN, EXPROGRAM, "Attempt to use dbtxtsput to put a new text timestamp into a non-existent data row\0" } , { SYBENULL, EXINFO, "NULL DBPROCESS pointer passed to DB-Library\0" } , { SYBENULP, EXPROGRAM, "Called %1! with parameter %2! NULL\0%s %d" } , { SYBENXID, EXNONFATAL, "The Server did not grant us a distributed-transaction ID\0" } , { SYBEONCE, EXPROGRAM, "Function can be called only once\0" } , { SYBEOOB, EXCOMM, "Error in sending out-of-band data to the server\0" } , { SYBEOPIN, EXNONFATAL, "Could not open interface file\0" } , { SYBEOPNA, EXNONFATAL, "Option is not available with current server\0" } , { SYBEOREN, EXINFO, "International Release: Warning: an out-of-range error-number was encountered in " "dblib.loc. The maximum permissible error-number is defined as DBERRCOUNT in sybdb.h\0" } , { SYBEORPF, EXUSER, "Attempt to set remote password would overflow " "the login record's remote password field\0" } , { SYBEPOLL, EXINFO, "There is already an active dbpoll\0" } , { SYBEPRTF, EXINFO, "dbtracestring may only be called from a printfunc\0" } , { SYBEPWD, EXUSER, "Login incorrect\0" } , { SYBERDCN, EXCONVERSION, "Requested data conversion does not exist\0" } , { SYBERDNR, EXPROGRAM, "Attempt to retrieve data from a non-existent row\0" } , { SYBEREAD, EXCOMM, "Read from the server failed\0" } , { SYBERESP, EXPROGRAM, "Response function address passed to dbresponse must be non-NULL\0" } , { SYBERPCS, EXINFO, "Must call dbrpcinit before dbrpcparam or dbrpcsend\0" } , { SYBERPIL, EXPROGRAM, "It is illegal to pass -1 to dbrpcparam for the datalen of parameters which are of " "type SYBCHAR, SYBVARCHAR, SYBBINARY, or SYBVARBINARY\0" } , { SYBERPNA, EXNONFATAL, "The RPC facility is available only when using a server whose version number is 4.0 " "or later\0" } , { SYBERPND, EXPROGRAM, "Attempt to initiate a new Adaptive Server operation with results pending\0" } , { SYBERPNULL, EXPROGRAM, "value parameter for dbrpcparam can be NULL, only if the datalen parameter is 0\0" } , { SYBERPTXTIM, EXPROGRAM, "RPC parameters cannot be of type text or image\0" } , { SYBERPUL, EXPROGRAM, "When passing a SYBINTN, SYBDATETIMN, SYBMONEYN, or SYBFLTN parameter via " "dbrpcparam, it is necessary to specify the parameter's maximum or actual length so " "that DB-Library can recognize it as a SYINT1, SYBINT2, SYBINT4, SYBMONEY, SYBMONEY4, " "and so on\0" } , { SYBERTCC, EXPROGRAM, "dbreadtext may not be used to receive the results of a query that contains a " "COMPUTE clause\0" } , { SYBERTSC, EXPROGRAM, "dbreadtext may be used only to receive the results of a query that contains a " "single result column\0" } , { SYBERXID, EXNONFATAL, "The Server did not recognize our distributed-transaction ID\0" } , { SYBESECURE, EXPROGRAM, "Secure SQL Server function not supported in this version\0" } , { SYBESEFA, EXPROGRAM, "DBSETNOTIFS cannot be called if connections are present\0" } , { SYBESEOF, EXCOMM, "Unexpected EOF from the server\0" } , { SYBESFOV, EXPROGRAM, "International Release: dbsafestr overflowed its destination buffer\0" } , { SYBESMSG, EXSERVER, "General Adaptive Server error: Check messages from the server\0" } , { SYBESOCK, EXCOMM, "Unable to open socket\0" } , { SYBESPID, EXPROGRAM, "Called dbspid with a NULL dbproc\0" } , { SYBESYNC, EXCOMM, "Read attempted while out of synchronization with Adaptive Server\0" } , { SYBETEXS, EXINFO, "Called dbmoretext with a bad size parameter\0" } , { SYBETIME, EXTIME, "Adaptive Server connection timed out\0" } , { SYBETMCF, EXPROGRAM, "Attempt to install too many custom formats via dbfmtinstall\0" } , { SYBETMTD, EXPROGRAM, "Attempt to send too much TEXT data via the dbmoretext call\0" } , { SYBETPAR, EXPROGRAM, "No SYBTEXT or SYBIMAGE parameters were defined\0" } , { SYBETPTN, EXUSER, "Syntax error: only two periods are permitted in table names\0" } , { SYBETRAC, EXINFO, "Attempted to turn off a trace flag that was not on\0" } , { SYBETRAN, EXINFO, "DBPROCESS is being used for another transaction\0" } , { SYBETRAS, EXINFO, "DB-Library internal error - trace structure not found\0" } , { SYBETRSN, EXINFO, "Bad numbytes parameter passed to dbtracestring\0" } , { SYBETSIT, EXINFO, "Attempt to call dbtsput with an invalid timestamp\0" } , { SYBETTS, EXUSER, "The table which bulk copy is attempting to copy to a host file is shorter than the " "number of rows which bulk copy was instructed to skip\0" } , { SYBETYPE, EXINFO, "Invalid argument type given to Hyper/DB-Library\0" } , { SYBEUCPT, EXUSER, "Unrecognized custom-format parameter-type encountered in dbstrbuild\0" } , { SYBEUCRR, EXCONSISTENCY, "Internal software error: Unknown connection result reported by dbpasswd\0" } , { SYBEUDTY, EXCONSISTENCY, "Unknown datatype encountered\0" } , { SYBEUFDS, EXUSER, "Unrecognized format encountered in dbstrbuild\0" } , { SYBEUFDT, EXCONSISTENCY, "Unknown fixed-length datatype encountered\0" } , { SYBEUHST, EXUSER, "Unknown host machine name\0" } , { SYBEUMSG, EXCOMM, "Unknown message-id in MSG datastream\0" } , { SYBEUNAM, EXFATAL, "Unable to get current user name from operating system\0" } , { SYBEUNOP, EXNONFATAL, "Unknown option passed to dbsetopt\0" } , { SYBEUNT, EXUSER, "Unknown network type found in interface file\0" } , { SYBEURCI, EXRESOURCE, "International Release: Unable to read copyright information from the DB-Library " "localization file\0" } , { SYBEUREI, EXRESOURCE, "International Release: Unable to read error information from the DB-Library " "localization file\0" } , { SYBEUREM, EXRESOURCE, "International Release: Unable to read error mnemonic from the DB-Library " "localization file\0" } , { SYBEURES, EXRESOURCE, "International Release: Unable to read error string from the DB-Library " "localization file. 401 Error severities\0" } , { SYBEURMI, EXRESOURCE, "International Release: Unable to read money-format information from the DB-Library " "localization file\0" } , { SYBEUSCT, EXCOMM, "Unable to set communications timer\0" } , { SYBEUTDS, EXCOMM, "Unrecognized TDS version received from the server\0" } , { SYBEUVBF, EXPROGRAM, "Attempt to read an unknown version of bcp format file\0" } , { SYBEUVDT, EXCONSISTENCY, "Unknown variable-length datatype encountered\0" } , { SYBEVDPT, EXUSER, "For bulk copy, all variable-length data must have either a length-prefix or a " "terminator specified\0" } , { SYBEWAID, EXCONSISTENCY, "DB-Library internal error: ALTFMT following ALTNAME has wrong id\0" } , { SYBEWRIT, EXCOMM, "Write to the server failed\0" } , { SYBEXOCI, EXNONFATAL, "International Release: A character-set translation overflowed its destination " "buffer while using bcp to copy data from a host-file to the server\0" } , { SYBEXTDN, EXPROGRAM, "Warning: the xlt_todisp parameter to dbfree_xlate was NULL. The space associated " "with the xlt_tosrv parameter has been freed\0" } , { SYBEXTN, EXPROGRAM, "The xlt_tosrv and xlt_todisp parameters to dbfree_xlate were NULL\0" } , { SYBEXTSN, EXPROGRAM, "Warning: the xlt_tosrv parameter to dbfree_xlate was NULL. The space associated " "with the xlt_todisp parameter has been freed\0" } , { SYBEZTXT, EXINFO, "Attempt to send zero length TEXT or IMAGE to dataserver via dbwritetext\0" } , { SYBECOLSIZE, EXINFO, "Invalid column information structure size\0" } }; /** \internal * \ingroup dblib_internal * \brief Call client-installed error handler * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param msgno identifies the error message to be passed to the client's handler. * \param errnum identifies the OS error (errno), if any. Use 0 if not applicable. * \returns the handler's return code, subject to correction and adjustment for vendor style: * - INT_CANCEL The db-lib function that encountered the error will return FAIL. * - INT_TIMEOUT The db-lib function will cancel the operation and return FAIL. \a dbproc remains useable. * - INT_CONTINUE The db-lib function will retry the operation. * \remarks * The client-installed handler may also return INT_EXIT. If Sybase semantics are used, this function notifies * the user and calls exit(3). If Microsoft semantics are used, this function returns INT_CANCEL. * * If the client-installed handler returns something other than these four INT_* values, or returns timeout-related * value for anything but SYBETIME, it's treated here as INT_EXIT (see above). * * Instead of sprinkling error text all over db-lib, we consolidate it here, * where it can be translated (one day), and where it can be mapped to the TDS error number. * The libraries don't use consistent error numbers or messages, so when libtds has to emit * an error message, it can't include the text. It can pass its error number to a client-library * function, which will interpret it, add the text, call the application's installed handler * (if any) and return the handler's return code back to the caller. * * The call stack may look something like this: * * -# application * -# db-lib function (encounters error) * -# dbperror * -# error handler (installed by application) * * The error handling in this case is unambiguous: the caller invokes this function, the client's handler returns its * instruction, which the caller receives. Quite often the caller will get INT_CANCEL, in which case it should put its * house in order and return FAIL. * * The call stack may otherwise look something like this: * * -# application * -# db-lib function * -# libtds function (encounters error) * -# _dblib_handle_err_message * -# dbperror * -# error handler (installed by application) * * Because different client libraries specify their handler semantics differently, * and because libtds doesn't know which client library is in charge of any given connection, it cannot interpret the * raw return code from a db-lib error handler. For these reasons, * libtds calls _dblib_handle_err_message, which translates between libtds and db-lib semantics. * \sa dberrhandle(), _dblib_handle_err_message(). */ int dbperror(DBPROCESS *dbproc, DBINT msgno, long errnum, ...) { static const char int_exit_text[] = "FreeTDS: db-lib: exiting because client error handler returned %s for msgno %d\n"; static const char int_invalid_text[] = "%s (%d) received from client-installed error handler for nontimeout for error %d." " Treating as INT_EXIT\n"; static const DBLIB_ERROR_MESSAGE default_message = { 0, EXCONSISTENCY, "unrecognized msgno" }; DBLIB_ERROR_MESSAGE constructed_message = { 0, EXCONSISTENCY, NULL }; const DBLIB_ERROR_MESSAGE *msg = &default_message; int i, rc = INT_CANCEL; const char *os_msgtext = strerror(errnum), *rc_name = "logic error"; char rc_buf[16]; tdsdump_log(TDS_DBG_FUNC, "dbperror(%p, %d, %ld)\n", dbproc, msgno, errnum); /* dbproc can be NULL */ #ifdef _WIN32 /* * Unfortunately MinGW uses the "old" msvcrt.dll (Visual C++ 2005 uses * a newer version) which does not set errno when allocation functions * cannot allocate memory, so we do it for them. */ if (msgno == SYBEMEM) errnum = ENOMEM; #endif if (os_msgtext == NULL) os_msgtext = "no OS error"; assert(_dblib_err_handler != NULL); /* always installed by dbinit() or dberrhandle() */ /* look up the error message */ for (i=0; i < TDS_VECTOR_SIZE(dblib_error_messages); i++ ) { if (dblib_error_messages[i].msgno == msgno) { /* * See if the message has placeholders. If so, build a message string on the heap. * The presence of placeholders is indicated by the existence of a "string after the string", * i.e., a format string (for dbstrbuild) after a null "terminator" in the message. * On error -- can't allocate, can't build the string -- give up and call the client handler anyway. */ const char * ptext = dblib_error_messages[i].msgtext; const char * pformats = ptext + strlen(ptext) + 1; msg = &dblib_error_messages[i]; assert(*(pformats - 1) == '\0'); if(*pformats != '\0') { va_list ap; int result_len, len = 2 * (int)strlen(ptext); char * buffer = tds_new0(char, len); if (buffer == NULL) break; va_start(ap, errnum); rc = tds_vstrbuild(buffer, len, &result_len, ptext, TDS_NULLTERM, pformats, TDS_NULLTERM, ap); buffer[result_len] = '\0'; va_end(ap); if (TDS_FAILED(rc)) { free(buffer); break; } constructed_message.msgtext = buffer; constructed_message.severity = msg->severity; msg = &constructed_message; } break; } } if (dbproc && dbproc->tds_socket && dbproc->tds_socket->login) { DSTR server_name_dstr = dbproc->tds_socket->login->server_name; if (!tds_dstr_isempty(&server_name_dstr)) { char * buffer = NULL; if (asprintf(&buffer, "%s (%s)", msg->msgtext, tds_dstr_cstr(&server_name_dstr)) >= 0) { free((char*) constructed_message.msgtext); constructed_message.msgtext = buffer; constructed_message.severity = msg->severity; msg = &constructed_message; } } } tdsdump_log(TDS_DBG_FUNC, "dbperror: Calling dblib_err_handler with msgno = %d; msg->msgtext = \"%s\"\n", msgno, msg->msgtext); /* call the error handler */ rc = (*_dblib_err_handler)(dbproc, msg->severity, msgno, errnum, (char*) msg->msgtext, (char*) os_msgtext); switch (rc) { case INT_EXIT: rc_name = "INT_EXIT"; break; case INT_CONTINUE: rc_name = "INT_CONTINUE"; break; case INT_CANCEL: rc_name = "INT_CANCEL"; break; case INT_TIMEOUT: rc_name = "INT_TIMEOUT"; break; default: rc_name = "invalid"; break; } tdsdump_log(TDS_DBG_FUNC, "dbperror: dblib_err_handler for msgno = %d; msg->msgtext = \"%s\" -- returns %d (%s)\n", msgno, msg->msgtext, rc, rc_name); /* we're done with the dynamic string now. */ free((char*) constructed_message.msgtext); /* Timeout return codes are errors for non-timeout conditions. */ if (msgno != SYBETIME) { switch (rc) { case INT_CONTINUE: tdsdump_log(TDS_DBG_SEVERE, int_invalid_text, "INT_CONTINUE", rc, msgno); rc = INT_EXIT; break; case INT_TIMEOUT: tdsdump_log(TDS_DBG_SEVERE, int_invalid_text, "INT_TIMEOUT", rc, msgno); rc = INT_EXIT; break; default: break; } } /* * Sybase exits on INT_EXIT; Microsoft converts to INT_CANCEL. * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dblibc/dbc_pdc04c_6v39.asp */ switch (rc) { case INT_CONTINUE: /* Microsoft does not define INT_TIMEOUT. Instead, two consecutive INT_CONTINUEs yield INT_CANCEL. */ if (dbproc && dbproc->msdblib && ++dbproc->ntimeouts >=2) { dbproc->ntimeouts = 0; rc = INT_CANCEL; } /* fall through */ case INT_CANCEL: case INT_TIMEOUT: return rc; /* normal case */ break; default: sprintf(rc_buf, "%d", rc); rc_name = rc_buf; tdsdump_log(TDS_DBG_SEVERE, int_invalid_text, "Invalid return code", rc, msgno); /* fall through */ case INT_EXIT: if (dbproc && dbproc->msdblib) { /* Microsoft behavior */ return INT_CANCEL; } fprintf(stderr, int_exit_text, rc_name, msgno); tdsdump_log(TDS_DBG_SEVERE, int_exit_text, rc_name, msgno); break; } exit(EXIT_FAILURE); return rc; /* not reached */ } freetds-1.3.6/src/dblib/dbutil.c000644 025423 025423 00000017717 14056414221 020111 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_ERRNO_H # include #endif /* HAVE_ERRNO_H */ #include #include #include #include #include #include /* * test include consistency * I don't think all compiler are able to compile this code... if not comment it */ #if ENABLE_EXTRA_CHECKS /* TODO test SYBxxx consistency */ #define TEST_ATTRIBUTE(t,sa,fa,sb,fb) \ TDS_COMPILE_CHECK(t,sizeof(((sa*)0)->fa) == sizeof(((sb*)0)->fb) && TDS_OFFSET(sa,fa) == TDS_OFFSET(sb,fb)) TEST_ATTRIBUTE(t21,TDS_MONEY4,mny4,DBMONEY4,mny4); TEST_ATTRIBUTE(t22,TDS_OLD_MONEY,mnyhigh,DBMONEY,mnyhigh); TEST_ATTRIBUTE(t23,TDS_OLD_MONEY,mnylow,DBMONEY,mnylow); TEST_ATTRIBUTE(t24,TDS_DATETIME,dtdays,DBDATETIME,dtdays); TEST_ATTRIBUTE(t25,TDS_DATETIME,dttime,DBDATETIME,dttime); TEST_ATTRIBUTE(t26,TDS_DATETIME4,days,DBDATETIME4,days); TEST_ATTRIBUTE(t27,TDS_DATETIME4,minutes,DBDATETIME4,minutes); TEST_ATTRIBUTE(t28,TDS_NUMERIC,precision,DBNUMERIC,precision); TEST_ATTRIBUTE(t29,TDS_NUMERIC,scale,DBNUMERIC,scale); TEST_ATTRIBUTE(t30,TDS_NUMERIC,array,DBNUMERIC,array); #endif /* * The next 2 functions receive the info and error messages that come from the TDS layer. * The address of this function is passed to the TDS layer in dbinit(). * It takes a pointer to a DBPROCESS, it's just that the TDS layer didn't * know what it really was. */ int _dblib_handle_info_message(const TDSCONTEXT * tds_ctx, TDSSOCKET * tds, TDSMESSAGE * msg) { DBPROCESS *dbproc = (tds && tds_get_parent(tds))? (DBPROCESS *) tds_get_parent(tds) : NULL; tdsdump_log(TDS_DBG_FUNC, "_dblib_handle_info_message(%p, %p, %p)\n", tds_ctx, tds, msg); tdsdump_log(TDS_DBG_FUNC, "msgno %d: \"%s\"\n", msg->msgno, msg->message); /* * Check to see if the user supplied a function, else ignore the message. */ if (_dblib_msg_handler) { _dblib_msg_handler(dbproc, msg->msgno, msg->state, msg->severity, msg->message, msg->server, msg->proc_name, msg->line_number); } if (msg->severity > 10 && _dblib_err_handler) { /* call the application's error handler, if installed. */ /* * Sybase docs say SYBESMSG is generated only in specific * cases (severity greater than 16, or deadlock occurred, or * a syntax error occurred.) However, actual observed * behavior is that SYBESMSG is always generated for * server messages with severity greater than 10. */ /* Cannot call dbperror() here because server messsage numbers (and text) are not in its lookup table. */ static const char message[] = "General SQL Server error: Check messages from the SQL Server"; (*_dblib_err_handler)(dbproc, msg->severity, SYBESMSG, DBNOERR, (char *) message, NULL); } return TDS_SUCCESS; } /** \internal * \dblib_internal * \brief handle errors generated by libtds * \param tds_ctx actually a dbproc: contains all information needed by db-lib to manage communications with the server. * \param tds contains all information needed by libtds to manage communications with the server. * \param msg the message to send * \returns * \remarks This function is called by libtds via tds_ctx->err_handler. It exists to convert the db-lib * error handler's return code into one that libtds will know how to handle. * libtds conveniently issues msgno's with the same values and meanings as db-lib and ODBC use. * (N.B. ODBC actually uses db-lib msgno numbers for its driver-specific "server errors". */ /* * Stack: * libtds * tds_ctx->err_handler (pointer to _dblib_handle_err_message) * _dblib_handle_err_message * dbperror * client (or default) error handler * returns db-lib defined return code INT_something. * returns db-lib return code with Sybase semantics (adjusting client's code if need be) * returns libtds return code * decides what to do based on the universal libtds return code, thank you. */ int _dblib_handle_err_message(const TDSCONTEXT * tds_ctx, TDSSOCKET * tds, TDSMESSAGE * msg) { DBPROCESS *dbproc = (tds && tds_get_parent(tds))? (DBPROCESS *) tds_get_parent(tds) : NULL; int rc = INT_CANCEL; assert(_dblib_err_handler); assert(msg); rc = dbperror(dbproc, msg->msgno, msg->oserr, 0, 0, 0, 0); /* * Preprocess the return code to handle INT_TIMEOUT/INT_CONTINUE * for non-SYBETIME errors in the strange and different ways as * specified by Sybase and Microsoft. */ if (msg->msgno != SYBETIME) { switch (rc) { case INT_TIMEOUT: rc = INT_EXIT; break; case INT_CONTINUE: if (!dbproc || !dbproc->msdblib) { /* Sybase behavior */ assert(0); /* dbperror() should prevent */ rc = INT_EXIT; } else { /* Microsoft behavior */ rc = INT_CANCEL; } break; default: break; } } /* * Convert db-lib return code to libtds return code, and return. */ switch (rc) { case INT_CANCEL: return TDS_INT_CANCEL; case INT_TIMEOUT: return TDS_INT_TIMEOUT; case INT_CONTINUE: return TDS_INT_CONTINUE; case INT_EXIT: assert(0); /* dbperror() should prevent */ default: /* unknown return code from error handler */ exit(EXIT_FAILURE); break; } /* not reached */ assert(0); return TDS_INT_CANCEL; } /** * \ingroup dblib_internal * \brief check interrupts for libtds. * * \param vdbproc a DBPROCESS pointer, contains all information needed by db-lib to manage communications with the server. * \sa DBDEAD(), dbsetinterrupt(). */ int _dblib_check_and_handle_interrupt(void * vdbproc) { DBPROCESS * dbproc = (DBPROCESS*) vdbproc; int ret = INT_CONTINUE; assert( dbproc != NULL ); if (dbproc->chkintr == NULL || dbproc->hndlintr == NULL) return INT_CONTINUE; tdsdump_log(TDS_DBG_FUNC, "_dblib_check_and_handle_interrupt %p [%p, %p]\n", dbproc, dbproc->chkintr, dbproc->hndlintr); if (dbproc->chkintr(dbproc)){ switch (ret = dbproc->hndlintr(dbproc)) { case INT_EXIT: tdsdump_log(TDS_DBG_FUNC, "dbproc->hndlintr returned INT_EXIT, goodbye!\n"); exit(1); case INT_CANCEL: tdsdump_log(TDS_DBG_FUNC, "dbproc->hndlintr returned INT_CANCEL\n"); break; case INT_CONTINUE: tdsdump_log(TDS_DBG_FUNC, "dbproc->hndlintr returned INT_CONTINUE\n"); break; default: tdsdump_log(TDS_DBG_FUNC, "dbproc->hndlintr returned an invalid value (%d), returning INT_CONTINUE\n", ret); ret = INT_CONTINUE; break; } } return ret; } void _dblib_setTDS_version(TDSLOGIN * tds_login, DBINT version) { switch (version) { case DBVERSION_42: tds_set_version(tds_login, 4, 2); break; case DBVERSION_46: tds_set_version(tds_login, 4, 6); break; case DBVERSION_100: tds_set_version(tds_login, 5, 0); break; } } void _dblib_convert_err(DBPROCESS * dbproc, TDS_INT len) { switch (len) { case TDS_CONVERT_NOAVAIL: dbperror(dbproc, SYBERDCN, 0); break; case TDS_CONVERT_SYNTAX: dbperror(dbproc, SYBECSYN, 0); break; case TDS_CONVERT_NOMEM: dbperror(dbproc, SYBEMEM, ENOMEM); break; case TDS_CONVERT_OVERFLOW: dbperror(dbproc, SYBECOFL, 0); break; default: case TDS_CONVERT_FAIL: dbperror(dbproc, SYBECINTERNAL, 0); break; } } freetds-1.3.6/src/dblib/rpc.c000644 025423 025423 00000034160 14056414271 017406 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001 Brian Bruns * Copyright (C) 2002, 2003, 2004, 2005 James K. Lowden * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H # include #endif /* HAVE_ERRNO_H */ #include #include #include #include #include #include #include #include static void rpc_clear(DBREMOTE_PROC * rpc); static void param_clear(DBREMOTE_PROC_PARAM * pparam); static TDSPARAMINFO *param_info_alloc(TDSSOCKET * tds, DBREMOTE_PROC * rpc); /** * \ingroup dblib_rpc * \brief Initialize a remote procedure call. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param rpcname name of the stored procedure to be run. * \param options Only supported option would be DBRPCRECOMPILE, * which causes the stored procedure to be recompiled before executing. * \remark The RPC functions are the only way to get back OUTPUT parameter data with db-lib * from modern Microsoft servers. * \retval SUCCEED normal. * \retval FAIL on error * \sa dbrpcparam(), dbrpcsend() */ RETCODE dbrpcinit(DBPROCESS * dbproc, const char rpcname[], DBSMALLINT options) { DBREMOTE_PROC **rpc; tdsdump_log(TDS_DBG_FUNC, "dbrpcinit(%p, %s, %d)\n", dbproc, rpcname, options); CHECK_CONN(FAIL); CHECK_NULP(rpcname, "dbrpcinit", 2, FAIL); /* * TODO: adhere to docs. Only Microsoft supports DBRPCRESET. They say: * "Cancels a single stored procedure or a batch of stored procedures. * If rpcname is specified, that new stored procedure is initialized after the cancellation is complete." */ if (options & DBRPCRESET) { rpc_clear(dbproc->rpc); dbproc->rpc = NULL; return SUCCEED; } /* any bits we want from the options argument */ /* dbrpcrecompile = options & DBRPCRECOMPILE; */ options &= ~DBRPCRECOMPILE; /* turn that one off, now that we've extracted it */ /* all other options except DBRPCRECOMPILE are invalid */ DBPERROR_RETURN3(options, SYBEIPV, (int) options, "options", "dbrpcinit"); /* find a free node */ for (rpc = &dbproc->rpc; *rpc != NULL; rpc = &(*rpc)->next) { /* check existing nodes for name match (there shouldn't be one) */ if ((*rpc)->name == NULL || strcmp((*rpc)->name, rpcname) == 0) { tdsdump_log(TDS_DBG_INFO1, "error: dbrpcinit called twice for procedure \"%s\"\n", rpcname); return FAIL; } } /* rpc now contains the address of the dbproc's first empty (null) DBREMOTE_PROC* */ /* allocate */ if ((*rpc = tds_new0(DBREMOTE_PROC, 1)) == NULL) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } if (((*rpc)->name = strdup(rpcname)) == NULL) { free(*rpc); *rpc = NULL; dbperror(dbproc, SYBEMEM, errno); return FAIL; } /* store */ (*rpc)->options = options & DBRPCRECOMPILE; (*rpc)->param_list = NULL; /* completed */ tdsdump_log(TDS_DBG_INFO1, "dbrpcinit() added rpcname \"%s\"\n", rpcname); return SUCCEED; } /** * \ingroup dblib_rpc * \brief Add a parameter to a remote procedure call. * * Call between dbrpcinit() and dbrpcsend() * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param paramname literal name of the parameter, according to the stored procedure (starts with '@'). Optional. * If not used, parameters will be passed in order instead of by name. * \param status must be DBRPCRETURN, if this parameter is a return parameter, else 0. * \param type datatype of the value parameter e.g., SYBINT4, SYBCHAR. * \param maxlen Maximum output size of the parameter's value to be returned by the stored procedure, * usually the size of your host variable. * Fixed-length datatypes take -1 (NULL or not). * Non-OUTPUT parameters also use -1. * Use 0 to send a NULL value for a variable length datatype. * \param datalen For variable-length datatypes, the byte size of the data to be sent, exclusive of any null terminator. * For fixed-length datatypes use -1. To send a NULL value, use 0. * \param value Address of your host variable. * \retval SUCCEED normal. * \retval FAIL on error * \sa dbrpcinit(), dbrpcsend() */ RETCODE dbrpcparam(DBPROCESS * dbproc, const char paramname[], BYTE status, int db_type, DBINT maxlen, DBINT datalen, BYTE * value) { char *name = NULL; DBREMOTE_PROC *rpc; DBREMOTE_PROC_PARAM **pparam; DBREMOTE_PROC_PARAM *param; TDS_SERVER_TYPE type; tdsdump_log(TDS_DBG_FUNC, "dbrpcparam(%p, %s, 0x%x, %d, %d, %d, %p)\n", dbproc, paramname, status, db_type, maxlen, datalen, value); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->rpc, SYBERPCS, FAIL); DBPERROR_RETURN(!is_tds_type_valid(db_type), SYBEUDTY); type = (TDS_SERVER_TYPE) db_type; /* validate datalen parameter */ if (is_fixed_type(type)) { if (datalen != 0) datalen = -1; } else { /* Sybooks: "Passing datalen as -1 for any of these [non-fixed] datatypes results * in the DBPROCESS referenced by dbproc being marked as "dead," or unusable." */ DBPERROR_RETURN(datalen < 0, SYBERPIL); } /* "value parameter for dbprcparam() can be NULL, only if the datalen parameter is 0." */ DBPERROR_RETURN(value == NULL && datalen != 0, SYBERPNULL); /* nullable types must provide a data length */ DBPERROR_RETURN(is_nullable_type(type) && datalen < 0, SYBERPUL); /* validate maxlen parameter */ if (status & DBRPCRETURN) { if (is_fixed_type(type)) { maxlen = -1; } else { if (maxlen == -1) maxlen = 255; } } else { /* * Well, maxlen should be used only for output parameter however it seems * that ms implementation wrongly require this 0 for NULL variable * input parameters, so fix it */ DBPERROR_RETURN3(maxlen != -1 && maxlen != 0, SYBEIPV, (int) maxlen, "maxlen", "dbrpcparam"); maxlen = -1; } /* end validation */ /* This trick is to allow for client using utf8 to insert any character into a NVARCHAR parameter * The 4000 check is to allow varchar with more then 4000 characters (varchar is limited to 8000 * characters) which can't be converted to nvarchar (which is limited to 4000 character) */ if (type == SYBVARCHAR && IS_TDS7_PLUS(dbproc->tds_socket->conn) && maxlen <= 4000 && datalen <= 4000) type = XSYBNVARCHAR; /* allocate */ param = tds_new(DBREMOTE_PROC_PARAM, 1); if (param == NULL) { dbperror(dbproc, SYBEMEM, 0); return FAIL; } if (paramname) { name = strdup(paramname); if (name == NULL) { free(param); dbperror(dbproc, SYBEMEM, 0); return FAIL; } } /* initialize */ param->next = NULL; /* NULL signifies end of linked list */ param->name = name; param->status = status; param->type = type; param->maxlen = maxlen; param->datalen = datalen; /* * If datalen = 0, value parameter is ignored. * This is one way to specify a NULL input parameter. */ if (datalen == 0) param->value = NULL; else param->value = value; /* * Add a parameter to the current rpc. * * Traverse the dbproc's procedure list to find the current rpc, * then traverse the parameter linked list until its end, * then tack on our parameter's address. */ for (rpc = dbproc->rpc; rpc->next != NULL; rpc = rpc->next) /* find "current" procedure */ continue; for (pparam = &rpc->param_list; *pparam != NULL; pparam = &(*pparam)->next) continue; /* pparam now contains the address of the end of the rpc's parameter list */ *pparam = param; /* add to the end of the list */ tdsdump_log(TDS_DBG_INFO1, "dbrpcparam() added parameter \"%s\"\n", (paramname) ? paramname : ""); return SUCCEED; } /** * \ingroup dblib_rpc * \brief Execute the procedure and free associated memory * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \retval SUCCEED normal. * \retval FAIL on error * \sa dbrpcinit(), dbrpcparam() */ RETCODE dbrpcsend(DBPROCESS * dbproc) { DBREMOTE_PROC *rpc; tdsdump_log(TDS_DBG_FUNC, "dbrpcsend(%p)\n", dbproc); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->rpc, SYBERPCS, FAIL); /* dbrpcinit should allocate pointer */ /* sanity */ if (dbproc->rpc->name == NULL) { /* can't be ready without a name */ tdsdump_log(TDS_DBG_INFO1, "returning FAIL: name is NULL\n"); return FAIL; } dbproc->dbresults_state = _DB_RES_INIT; for (rpc = dbproc->rpc; rpc != NULL; rpc = rpc->next) { TDSRET erc; TDSPARAMINFO *pparam_info = NULL; /* * liam@inodes.org: allow stored procedures to have no paramaters */ if (rpc->param_list != NULL) { pparam_info = param_info_alloc(dbproc->tds_socket, rpc); if (!pparam_info) return FAIL; } erc = tds_submit_rpc(dbproc->tds_socket, dbproc->rpc->name, pparam_info, NULL); tds_free_param_results(pparam_info); if (TDS_FAILED(erc)) { tdsdump_log(TDS_DBG_INFO1, "returning FAIL: tds_submit_rpc() failed\n"); return FAIL; } } /* free up the memory */ rpc_clear(dbproc->rpc); dbproc->rpc = NULL; tdsdump_log(TDS_DBG_FUNC, "dbrpcsend() returning SUCCEED\n"); return SUCCEED; } /** * Tell the TDSPARAMINFO structure where the data go. This is a kind of "bind" operation. */ static const unsigned char * param_row_alloc(TDSPARAMINFO * params, TDSCOLUMN * curcol, int param_num, void *value, int size) { const void *row = tds_alloc_param_data(curcol); tdsdump_log(TDS_DBG_INFO1, "parameter size = %d, data = %p, row_size = %d\n", size, curcol->column_data, params->row_size); if (!row) return NULL; if (size > 0 && value) { tdsdump_log(TDS_DBG_FUNC, "copying %d bytes of data to parameter #%d\n", size, param_num); if (!is_blob_col(curcol)) { if (is_numeric_type(curcol->column_type)) memset(curcol->column_data, 0, sizeof(TDS_NUMERIC)); memcpy(curcol->column_data, value, size); } else { TDSBLOB *blob = (TDSBLOB *) curcol->column_data; blob->textvalue = tds_new(TDS_CHAR, size); tdsdump_log(TDS_DBG_FUNC, "blob parameter supported, size %d textvalue pointer is %p\n", size, blob->textvalue); if (!blob->textvalue) return NULL; memcpy(blob->textvalue, value, size); } } else { tdsdump_log(TDS_DBG_FUNC, "setting parameter #%d to NULL\n", param_num); curcol->column_cur_size = -1; } return (const unsigned char*) row; } /** * Allocate memory and copy the rpc information into a TDSPARAMINFO structure. */ static TDSPARAMINFO * param_info_alloc(TDSSOCKET * tds, DBREMOTE_PROC * rpc) { int i; DBREMOTE_PROC_PARAM *p; TDSCOLUMN *pcol; TDSPARAMINFO *params = NULL, *new_params; BYTE *temp_value; int temp_datalen; TDS_SERVER_TYPE temp_type; int param_is_null; /* sanity */ if (rpc == NULL) return NULL; /* see v 1.10 2002/11/23 for first broken attempt */ for (i = 0, p = rpc->param_list; p != NULL; p = p->next, i++) { const unsigned char *prow; if (!(new_params = tds_alloc_param_result(params))) { tds_free_param_results(params); tdsdump_log(TDS_DBG_ERROR, "out of rpc memory!"); return NULL; } params = new_params; /* * Determine whether an input parameter is NULL or not. */ param_is_null = 0; temp_type = p->type; temp_value = p->value; temp_datalen = p->datalen; if (p->datalen == 0) param_is_null = 1; tdsdump_log(TDS_DBG_INFO1, "parm_info_alloc(): parameter null-ness = %d\n", param_is_null); pcol = params->columns[i]; if (temp_value && is_numeric_type(temp_type)) { DBDECIMAL *dec = (DBDECIMAL*) temp_value; pcol->column_prec = dec->precision; pcol->column_scale = dec->scale; if (dec->precision > 0 && dec->precision <= MAXPRECISION) temp_datalen = tds_numeric_bytes_per_prec[dec->precision] + 2; } if (param_is_null || (p->status & DBRPCRETURN)) { if (param_is_null) { temp_datalen = 0; temp_value = NULL; } else if (is_fixed_type(temp_type)) { temp_datalen = tds_get_size_by_type(temp_type); } temp_type = tds_get_null_type(temp_type); } else if (is_fixed_type(temp_type)) { temp_datalen = tds_get_size_by_type(temp_type); } /* meta data */ if (p->name) if (!tds_dstr_copy(&pcol->column_name, p->name)) { tds_free_param_results(params); tdsdump_log(TDS_DBG_ERROR, "out of rpc memory!"); return NULL; } tds_set_param_type(tds->conn, pcol, temp_type); if (p->maxlen > 0) pcol->column_size = p->maxlen; else { if (is_fixed_type(p->type)) { pcol->column_size = tds_get_size_by_type(p->type); } else { pcol->column_size = p->datalen; } } if (p->type == XSYBNVARCHAR) pcol->column_size *= 2; pcol->on_server.column_size = pcol->column_size; pcol->column_output = p->status; pcol->column_cur_size = temp_datalen; prow = param_row_alloc(params, pcol, i, temp_value, temp_datalen); if (!prow) { tds_free_param_results(params); tdsdump_log(TDS_DBG_ERROR, "out of memory for rpc row!"); return NULL; } } return params; } /** * erase the procedure list */ static void rpc_clear(DBREMOTE_PROC * rpc) { DBREMOTE_PROC * next; while (rpc) { next = rpc->next; param_clear(rpc->param_list); free(rpc->name); free(rpc); rpc = next; } } /** * erase the parameter list */ static void param_clear(DBREMOTE_PROC_PARAM * pparam) { DBREMOTE_PROC_PARAM * next; while (pparam) { next = pparam->next; free(pparam->name); /* free self */ free(pparam); pparam = next; } } freetds-1.3.6/src/dblib/bcp.c000644 025423 025423 00000211445 14056414271 017371 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010, 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef _WIN32 #include #endif #include #include #include #include #include #include #include #include #include #include #include #define HOST_COL_CONV_ERROR 1 #define HOST_COL_NULL_ERROR 2 #ifndef MAX #define MAX(a,b) ( (a) > (b) ? (a) : (b) ) #endif #ifdef HAVE_FSEEKO typedef off_t offset_type; #elif defined(_WIN32) || defined(_WIN64) /* win32 version */ typedef __int64 offset_type; # if defined(HAVE__FSEEKI64) && defined(HAVE__FTELLI64) # define fseeko(f,o,w) _fseeki64((f),o,w) # define ftello(f) _ftelli64((f)) # else # define fseeko(f,o,w) (_lseeki64(fileno(f),o,w) == -1 ? -1 : 0) # define ftello(f) _telli64(fileno(f)) # endif #else /* use old version */ #define fseeko(f,o,w) fseek(f,o,w) #define ftello(f) ftell(f) typedef long offset_type; #endif static void _bcp_free_storage(DBPROCESS * dbproc); static void _bcp_free_columns(DBPROCESS * dbproc); static void _bcp_null_error(TDSBCPINFO *bcpinfo, int index, int offset); static TDSRET _bcp_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset); static TDSRET _bcp_no_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset); static int rtrim(char *, int); static int rtrim_u16(uint16_t *str, int len, uint16_t space); static STATUS _bcp_read_hostfile(DBPROCESS * dbproc, FILE * hostfile, int *row_error, bool skip); static int _bcp_readfmt_colinfo(DBPROCESS * dbproc, char *buf, BCP_HOSTCOLINFO * ci); static int _bcp_get_term_var(const BYTE * pdata, const BYTE * term, int term_len); /* * "If a host file is being used ... the default data formats are as follows: * * > The order, type, length and number of the columns in the host file are * assumed to be identical to the order, type and number of the columns in the database table. * > If a given database column's data is fixed-length, * then the host file's data column will also be fixed-length. * > If a given database column's data is variable-length or may contain null values, * the host file's data column will be prefixed by * a 4-byte length value for SYBTEXT and SYBIMAGE data types, and * a 1-byte length value for all other types. * > There are no terminators of any kind between host file columns." */ static void init_hostfile_columns(DBPROCESS *dbproc) { const int ncols = dbproc->bcpinfo->bindinfo->num_cols; RETCODE erc; int icol; if (ncols == 0) return; if ((erc = bcp_columns(dbproc, ncols)) != SUCCEED) { assert(erc == SUCCEED); return; } for (icol = 0; icol < ncols; icol++) { const TDSCOLUMN *pcol = dbproc->bcpinfo->bindinfo->columns[icol]; int prefixlen = 0, termlen = 0; switch (pcol->column_type) { case SYBTEXT: case SYBIMAGE: prefixlen = 4; break; default: prefixlen = dbvarylen(dbproc, icol+1)? 1 : 0; } erc = bcp_colfmt(dbproc, icol+1, pcol->column_type, prefixlen, pcol->column_size, NULL, termlen, icol+1); assert(erc == SUCCEED); if (erc != SUCCEED) return; } } /** * \ingroup dblib_bcp * \brief Prepare for bulk copy operation on a table * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param tblname the name of the table receiving or providing the data. * \param hfile the data file opposite the table, if any. * \param errfile the "error file" captures messages and, if errors are encountered, * copies of any rows that could not be written to the table. * \param direction one of * - \b DB_IN writing to the table * - \b DB_OUT writing to the host file * . * \remarks bcp_init() sets the host file data format and acquires the table metadata. * It is called before the other bulk copy functions. * * When writing to a table, bcp can use as its data source a data file (\a hfile), * or program data in an application's variables. In the latter case, call bcp_bind() * to associate your data with the appropriate table column. * \return SUCCEED or FAIL. * \sa BCP_SETL(), bcp_bind(), bcp_done(), bcp_exec() */ RETCODE bcp_init(DBPROCESS * dbproc, const char *tblname, const char *hfile, const char *errfile, int direction) { tdsdump_log(TDS_DBG_FUNC, "bcp_init(%p, %s, %s, %s, %d)\n", dbproc, tblname? tblname:"NULL", hfile? hfile:"NULL", errfile? errfile:"NULL", direction); CHECK_CONN(FAIL); /* * Validate other parameters */ if (dbproc->tds_socket->conn->tds_version < 0x500) { dbperror(dbproc, SYBETDSVER, 0); return FAIL; } if (tblname == NULL) { dbperror(dbproc, SYBEBCITBNM, 0); return FAIL; } if (direction != DB_QUERYOUT && !IS_TDS7_PLUS(dbproc->tds_socket->conn) && strlen(tblname) > 92) { /* 30.30.30 for Sybase */ dbperror(dbproc, SYBEBCITBLEN, 0); return FAIL; } if (direction != DB_IN && direction != DB_OUT && direction != DB_QUERYOUT) { dbperror(dbproc, SYBEBDIO, 0); return FAIL; } /* Free previously allocated storage in dbproc & initialise flags, etc. */ _bcp_free_storage(dbproc); /* Allocate storage */ dbproc->bcpinfo = tds_alloc_bcpinfo(); if (dbproc->bcpinfo == NULL) goto memory_error; if (!tds_dstr_copy(&dbproc->bcpinfo->tablename, tblname)) goto memory_error; dbproc->bcpinfo->direction = direction; dbproc->bcpinfo->xfer_init = 0; dbproc->bcpinfo->bind_count = 0; if (TDS_FAILED(tds_bcp_init(dbproc->tds_socket, dbproc->bcpinfo))) { /* TODO return proper error */ /* Attempt to use Bulk Copy with a non-existent Server table (might be why ...) */ dbperror(dbproc, SYBEBCNT, 0); return FAIL; } /* Prepare default hostfile columns */ if (hfile == NULL) { dbproc->hostfileinfo = NULL; return SUCCEED; } dbproc->hostfileinfo = tds_new0(BCP_HOSTFILEINFO, 1); if (dbproc->hostfileinfo == NULL) goto memory_error; dbproc->hostfileinfo->maxerrs = 10; dbproc->hostfileinfo->firstrow = 1; if ((dbproc->hostfileinfo->hostfile = strdup(hfile)) == NULL) goto memory_error; if (errfile != NULL) if ((dbproc->hostfileinfo->errorfile = strdup(errfile)) == NULL) goto memory_error; init_hostfile_columns(dbproc); return SUCCEED; memory_error: _bcp_free_storage(dbproc); dbperror(dbproc, SYBEMEM, ENOMEM); return FAIL; } /** * \ingroup dblib_bcp * \brief Set the length of a host variable to be written to a table. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param varlen size of the variable, in bytes, or * - \b 0 indicating NULL * - \b -1 indicating size is determined by the prefix or terminator. * (If both a prefix and a terminator are present, bcp is supposed to use the smaller of the * two. This feature might or might not actually work.) * \param table_column the number of the column in the table (starting with 1, not zero). * * \return SUCCEED or FAIL. * \sa bcp_bind(), bcp_colptr(), bcp_sendrow() */ RETCODE bcp_collen(DBPROCESS * dbproc, DBINT varlen, int table_column) { TDSCOLUMN *bcpcol; tdsdump_log(TDS_DBG_FUNC, "bcp_collen(%p, %d, %d)\n", dbproc, varlen, table_column); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); /* not initialized */ DBPERROR_RETURN(dbproc->bcpinfo->direction != DB_IN, SYBEBCPN) /* not inbound */ DBPERROR_RETURN(dbproc->hostfileinfo != NULL, SYBEBCPI) /* cannot have data file */ CHECK_PARAMETER(0 < table_column && table_column <= dbproc->bcpinfo->bindinfo->num_cols, SYBECNOR, FAIL); bcpcol = dbproc->bcpinfo->bindinfo->columns[table_column - 1]; /* Sybase library does not check for NULL here, only sending, so don't * check and send SYBEBCNN */ bcpcol->column_bindlen = varlen; return SUCCEED; } /** * \ingroup dblib_bcp * \brief Indicate how many columns are to be found in the datafile. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param host_colcount count of columns in the datafile, irrespective of how many you intend to use. * \remarks This function describes the file as it is, not how it will be used. * * \return SUCCEED or FAIL. It's hard to see how it could fail. * \sa bcp_colfmt() */ RETCODE bcp_columns(DBPROCESS * dbproc, int host_colcount) { int i; tdsdump_log(TDS_DBG_FUNC, "bcp_columns(%p, %d)\n", dbproc, host_colcount); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_PARAMETER(dbproc->hostfileinfo, SYBEBIVI, FAIL); if (host_colcount < 1) { dbperror(dbproc, SYBEBCFO, 0); return FAIL; } _bcp_free_columns(dbproc); dbproc->hostfileinfo->host_columns = tds_new0(BCP_HOSTCOLINFO *, host_colcount); if (dbproc->hostfileinfo->host_columns == NULL) { dbperror(dbproc, SYBEMEM, ENOMEM); return FAIL; } dbproc->hostfileinfo->host_colcount = host_colcount; for (i = 0; i < host_colcount; i++) { dbproc->hostfileinfo->host_columns[i] = tds_new0(BCP_HOSTCOLINFO, 1); if (dbproc->hostfileinfo->host_columns[i] == NULL) { dbproc->hostfileinfo->host_colcount = i; _bcp_free_columns(dbproc); dbperror(dbproc, SYBEMEM, ENOMEM); return FAIL; } } return SUCCEED; } /** * \ingroup dblib_bcp * \brief Specify the format of a datafile prior to writing to a table. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param host_colnum datafile column number (starting with 1, not zero). * \param host_type dataype token describing the data type in \a host_colnum. E.g. SYBCHAR for character data. * \param host_prefixlen size of the prefix in the datafile column, if any. For delimited files: zero. * May be 0, 1, 2, or 4 bytes. The prefix will be read as an integer (not a character string) from the * data file, and will be interpreted the data size of that column, in bytes. * \param host_collen maximum size of datafile column, exclusive of any prefix/terminator. Just the data, ma'am. * Special values: * - \b 0 indicates NULL. * - \b -1 for fixed-length non-null datatypes * - \b -1 for variable-length datatypes (e.g. SYBCHAR) where the length is established * by a prefix/terminator. * \param host_term the sequence of characters that will serve as a column terminator (delimiter) in the datafile. * Often a tab character, but can be any string of any length. Zero indicates no terminator. * Special characters: * - \b '\\0' terminator is an ASCII NUL. * - \b '\\t' terminator is an ASCII TAB. * - \b '\\n' terminator is an ASCII NL. * \param host_termlen the length of \a host_term, in bytes. * \param table_colnum Nth column, starting at 1, in the table that maps to \a host_colnum. * If there is a column in the datafile that does not map to a table column, set \a table_colnum to zero. * *\remarks bcp_colfmt() is called once for each column in the datafile, as specified with bcp_columns(). * In so doing, you describe to FreeTDS how to parse each line of your datafile, and where to send each field. * * When a prefix or terminator is used with variable-length data, \a host_collen may have one of three values: * - \b positive indicating the maximum number of bytes to be used * - \b 0 indicating NULL * - \b -1 indicating no maximum; all data, as described by the prefix/terminator will be used. * . * \return SUCCEED or FAIL. * \sa bcp_batch(), bcp_bind(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), * bcp_control(), bcp_done(), bcp_exec(), bcp_init(), bcp_sendrow */ RETCODE bcp_colfmt(DBPROCESS * dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, const BYTE * host_term, int host_termlen, int table_colnum) { BCP_HOSTCOLINFO *hostcol; BYTE *terminator = NULL; tdsdump_log(TDS_DBG_FUNC, "bcp_colfmt(%p, %d, %d, %d, %d, %p, %d, %d)\n", dbproc, host_colnum, host_type, host_prefixlen, (int) host_collen, host_term, host_termlen, table_colnum); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_PARAMETER(dbproc->hostfileinfo, SYBEBIVI, FAIL); /* Microsoft specifies a "file_termlen" of zero if there's no terminator */ if (dbproc->msdblib && host_termlen == 0) host_termlen = -1; if (host_termlen < 0) host_termlen = -1; if (dbproc->hostfileinfo->host_colcount == 0) { dbperror(dbproc, SYBEBCBC, 0); return FAIL; } if (host_colnum < 1) { dbperror(dbproc, SYBEBCFO, 0); return FAIL; } if (host_colnum > dbproc->hostfileinfo->host_colcount) { dbperror(dbproc, SYBECNOR, 0); return FAIL; } if (host_prefixlen != 0 && host_prefixlen != 1 && host_prefixlen != 2 && host_prefixlen != 4 && host_prefixlen != -1) { dbperror(dbproc, SYBEBCPREF, 0); return FAIL; } /* if column is not copied you cannot specify destination type */ if (table_colnum <= 0 && host_type == 0) { dbperror(dbproc, SYBEBCPCTYP, 0); return FAIL; } if (table_colnum > 0 && !is_tds_type_valid(host_type)) { dbperror(dbproc, SYBEUDTY, 0); return FAIL; } if (host_type && host_prefixlen == 0 && host_collen == -1 && host_termlen == -1 && !is_fixed_type(host_type)) { dbperror(dbproc, SYBEVDPT, 0); return FAIL; } if (host_collen < -1) { dbperror(dbproc, SYBEBCHLEN, 0); return FAIL; } /* No official error message. Fix and warn. */ if (is_fixed_type(host_type) && (host_collen != -1 && host_collen != 0)) { tdsdump_log(TDS_DBG_FUNC, "bcp_colfmt: changing host_collen to -1 from %d for fixed type %d.\n", host_collen, host_type); host_collen = -1; } /* * If there's a positive terminator length, we need a valid terminator pointer. * If the terminator length is 0 or -1, then there's no terminator. */ if (host_term == NULL && host_termlen > 0) { dbperror(dbproc, SYBEVDPT, 0); /* "all variable-length data must have either a length-prefix ..." */ return FAIL; } hostcol = dbproc->hostfileinfo->host_columns[host_colnum - 1]; /* TODO add precision scale and join with bcp_colfmt_ps */ if (host_term && host_termlen > 0) { if ((terminator = tds_new(BYTE, host_termlen)) == NULL) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } memcpy(terminator, host_term, host_termlen); } hostcol->host_column = host_colnum; hostcol->datatype = host_type ? (TDS_SERVER_TYPE) host_type : TDS_INVALID_TYPE; hostcol->prefix_len = host_prefixlen; hostcol->column_len = host_collen; free(hostcol->terminator); hostcol->terminator = terminator; hostcol->term_len = host_termlen; hostcol->tab_colnum = table_colnum; return SUCCEED; } /** * \ingroup dblib_bcp * \brief Specify the format of a host file for bulk copy purposes, * with precision and scale support for numeric and decimal columns. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param host_colnum datafile column number (starting with 1, not zero). * \param host_type dataype token describing the data type in \a host_colnum. E.g. SYBCHAR for character data. * \param host_prefixlen size of the prefix in the datafile column, if any. For delimited files: zero. * May be 0, 1, 2, or 4 bytes. The prefix will be read as an integer (not a character string) from the * data file, and will be interpreted the data size of that column, in bytes. * \param host_collen maximum size of datafile column, exclusive of any prefix/terminator. Just the data, ma'am. * Special values: * - \b 0 indicates NULL. * - \b -1 for fixed-length non-null datatypes * - \b -1 for variable-length datatypes (e.g. SYBCHAR) where the length is established * by a prefix/terminator. * \param host_term the sequence of characters that will serve as a column terminator (delimiter) in the datafile. * Often a tab character, but can be any string of any length. Zero indicates no terminator. * Special characters: * - \b '\\0' terminator is an ASCII NUL. * - \b '\\t' terminator is an ASCII TAB. * - \b '\\n' terminator is an ASCII NL. * \param host_termlen the length of \a host_term, in bytes. * \param table_colnum Nth column, starting at 1, in the table that maps to \a host_colnum. * If there is a column in the datafile that does not map to a table column, set \a table_colnum to zero. * \param typeinfo something * \todo Not implemented. * \return SUCCEED or FAIL. * \sa bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), * bcp_control(), bcp_done(), bcp_exec(), bcp_init(), bcp_sendrow */ RETCODE bcp_colfmt_ps(DBPROCESS * dbproc, int host_colnum, int host_type, int host_prefixlen, DBINT host_collen, BYTE * host_term, int host_termlen, int table_colnum, DBTYPEINFO * typeinfo) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED: bcp_colfmt_ps(%p, %d, %d)\n", dbproc, host_colnum, host_type); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); /* dbperror(dbproc, , 0); Illegal precision specified */ /* TODO see bcp_colfmt */ return FAIL; } /** * \ingroup dblib_bcp * \brief Set BCP options for uploading a datafile * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param field symbolic constant indicating the option to be set, one of: * - \b BCPMAXERRS Maximum errors tolerated before quitting. The default is 10. * - \b BCPFIRST The first row to read in the datafile. The default is 1. * - \b BCPLAST The last row to read in the datafile. The default is to copy all rows. A value of * -1 resets this field to its default? * - \b BCPBATCH The number of rows per batch. Default is 0, meaning a single batch. * \param value The value for \a field. * * \remarks These options control the behavior of bcp_exec(). * When writing to a table from application host memory variables, * program logic controls error tolerance and batch size. * * \return SUCCEED or FAIL. * \sa bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_done(), bcp_exec(), bcp_options() */ RETCODE bcp_control(DBPROCESS * dbproc, int field, DBINT value) { tdsdump_log(TDS_DBG_FUNC, "bcp_control(%p, %d, %d)\n", dbproc, field, value); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); if (field == BCPKEEPIDENTITY) { dbproc->bcpinfo->identity_insert_on = (value != 0); return SUCCEED; } CHECK_PARAMETER(dbproc->hostfileinfo, SYBEBIVI, FAIL); switch (field) { case BCPMAXERRS: if (value < 1) value = 10; dbproc->hostfileinfo->maxerrs = value; break; case BCPFIRST: if (value < 1) value = 1; dbproc->hostfileinfo->firstrow = value; break; case BCPLAST: dbproc->hostfileinfo->lastrow = value; break; case BCPBATCH: dbproc->hostfileinfo->batch = value; break; default: dbperror(dbproc, SYBEIFNB, 0); return FAIL; } return SUCCEED; } /* * \ingroup dblib_bcp * \brief Get BCP batch option * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \remarks This function is specific to FreeTDS. * * \return the value that was set by bcp_control. * \sa bcp_batch(), bcp_control() */ int bcp_getbatchsize(DBPROCESS * dbproc) { return dbproc->hostfileinfo->batch; } /** * \ingroup dblib_bcp * \brief Set "hints" for uploading a file. A FreeTDS-only function. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param option symbolic constant indicating the option to be set, one of: * - \b BCPLABELED Not implemented. * - \b BCPHINTS The hint to be passed when the bulk-copy begins. * \param value The string constant for \a option a/k/a the hint. One of: * - \b ORDER The data are ordered in accordance with the table's clustered index. * - \b ROWS_PER_BATCH The batch size * - \b KILOBYTES_PER_BATCH The approximate number of kilobytes to use for a batch size * - \b TABLOCK Lock the table * - \b CHECK_CONSTRAINTS Apply constraints * - \b FIRE_TRIGGERS Fire any INSERT triggers on the target table * \param valuelen The strlen of \a value. * * \return SUCCEED or FAIL. * \sa bcp_control(), * bcp_exec(), * \todo Simplify. Remove \a valuelen, and dbproc->bcpinfo->hint = strdup(hints[i]) */ RETCODE bcp_options(DBPROCESS * dbproc, int option, BYTE * value, int valuelen) { int i; static const char *const hints[] = { "ORDER", "ROWS_PER_BATCH", "KILOBYTES_PER_BATCH", "TABLOCK", "CHECK_CONSTRAINTS", "FIRE_TRIGGERS", "KEEP_NULLS", NULL }; tdsdump_log(TDS_DBG_FUNC, "bcp_options(%p, %d, %p, %d)\n", dbproc, option, value, valuelen); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_NULP(value, "bcp_options", 3, FAIL); switch (option) { case BCPLABELED: tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED bcp option: BCPLABELED\n"); break; case BCPHINTS: if (!value || valuelen <= 0) break; for (i = 0; hints[i]; i++) { /* look up hint */ if (strncasecmp((char *) value, hints[i], strlen(hints[i])) == 0) { dbproc->bcpinfo->hint = hints[i]; /* safe: hints[i] is static constant, above */ return SUCCEED; } } tdsdump_log(TDS_DBG_FUNC, "failed, no such hint\n"); break; default: tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED bcp option: %u\n", option); break; } return FAIL; } /** * \ingroup dblib_bcp * \brief Override bcp_bind() by pointing to a different host variable. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param colptr The pointer, the address of your variable. * \param table_column The 1-based column ordinal in the table. * \remarks Use between calls to bcp_sendrow(). After calling bcp_colptr(), * subsequent calls to bcp_sendrow() will bind to the new address. * \return SUCCEED or FAIL. * \sa bcp_bind(), bcp_collen(), bcp_sendrow() */ RETCODE bcp_colptr(DBPROCESS * dbproc, BYTE * colptr, int table_column) { TDSCOLUMN *curcol; tdsdump_log(TDS_DBG_FUNC, "bcp_colptr(%p, %p, %d)\n", dbproc, colptr, table_column); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_PARAMETER(dbproc->bcpinfo->bindinfo, SYBEBCPI, FAIL); /* colptr can be NULL */ if (dbproc->bcpinfo->direction != DB_IN) { dbperror(dbproc, SYBEBCPN, 0); return FAIL; } if (table_column <= 0 || table_column > dbproc->bcpinfo->bindinfo->num_cols) { dbperror(dbproc, SYBEBCPN, 0); return FAIL; } curcol = dbproc->bcpinfo->bindinfo->columns[table_column - 1]; curcol->column_varaddr = (TDS_CHAR *)colptr; return SUCCEED; } /** * \ingroup dblib_bcp * \brief See if BCP_SETL() was used to set the LOGINREC for BCP work. * * \param login Address of the LOGINREC variable to be passed to dbopen(). * * \return TRUE or FALSE. * \sa BCP_SETL(), bcp_init(), dblogin(), dbopen() */ DBBOOL bcp_getl(LOGINREC * login) { TDSLOGIN *tdsl = login->tds_login; tdsdump_log(TDS_DBG_FUNC, "bcp_getl(%p)\n", login); return (tdsl->bulk_copy); } /** * Convert column for output (usually to a file) * Conversion is slightly different from input as: * - date is formatted differently; * - you have to set properly numeric while on input the column metadata are * used; * - we need to make sure buffer is always at least a minimum bytes. */ static int _bcp_convert_out(DBPROCESS * dbproc, TDSCOLUMN *curcol, BCP_HOSTCOLINFO *hostcol, TDS_UCHAR **p_data, const char *bcpdatefmt) { BYTE *src; int srclen; int buflen; int srctype = tds_get_conversion_type(curcol->column_type, curcol->column_size); src = curcol->column_data; if (is_blob_col(curcol)) src = (BYTE *) ((TDSBLOB *) src)->textvalue; srclen = curcol->column_cur_size; /* * if we are converting datetime to string, need to override any * date time formats already established */ if (is_datetime_type(srctype) && is_ascii_type(hostcol->datatype)) { TDSDATEREC when; tds_datecrack(srctype, src, &when); buflen = (int)tds_strftime((TDS_CHAR *)(*p_data), 256, bcpdatefmt, &when, 3); } else if (srclen == 0 && is_variable_type(curcol->column_type) && is_ascii_type(hostcol->datatype)) { /* * An empty string is denoted in the output file by a single ASCII NUL * byte that we request by specifying a destination length of -1. (Not * to be confused with a database NULL, which is denoted in the output * file with an empty string!) */ (*p_data)[0] = 0; buflen = 1; } else if (is_numeric_type(hostcol->datatype)) { TDS_NUMERIC *num = (TDS_NUMERIC *) (*p_data); if (is_numeric_type(srctype)) { TDS_NUMERIC *nsrc = (TDS_NUMERIC *) src; num->precision = nsrc->precision; num->scale = nsrc->scale; } else { num->precision = 18; num->scale = 0; } buflen = tds_convert(dbproc->tds_socket->conn->tds_ctx, srctype, src, srclen, hostcol->datatype, (CONV_RESULT *) num); if (buflen > 0) buflen = tds_numeric_bytes_per_prec[num->precision] + 2; } else if (!is_variable_type(hostcol->datatype)) { buflen = tds_convert(dbproc->tds_socket->conn->tds_ctx, srctype, src, srclen, hostcol->datatype, (CONV_RESULT *) (*p_data)); } else { CONV_RESULT cr; /* * For null columns, the above work to determine the output buffer size is moot, * because bcpcol->data_size is zero, so dbconvert() won't write anything, * and returns zero. */ buflen = tds_convert(dbproc->tds_socket->conn->tds_ctx, srctype, src, srclen, hostcol->datatype, (CONV_RESULT *) &cr); if (buflen < 0) return buflen; if (buflen >= 256) { free(*p_data); *p_data = (TDS_UCHAR *) cr.c; } else { memcpy(*p_data, cr.c, buflen); free(cr.c); } /* * Special case: When outputting database varchar data * (either varchar or nullable char) conversion may have * trimmed trailing blanks such that nothing is left. * In this case we need to put a single blank to the output file. */ if (is_char_type(curcol->column_type) && srclen > 0 && buflen == 0) { strcpy ((char *) (*p_data), " "); buflen = 1; } } return buflen; } static int bcp_cache_prefix_len(BCP_HOSTCOLINFO *hostcol, const TDSCOLUMN *curcol) { int plen; if (is_blob_type(hostcol->datatype)) plen = 4; else if (is_numeric_type(hostcol->datatype)) plen = 1; else if (!is_fixed_type(hostcol->datatype)) plen = 2; else if (curcol->column_nullable) plen = 1; else plen = 0; /* cache */ return hostcol->prefix_len = plen; } static RETCODE bcp_write_prefix(FILE *hostfile, BCP_HOSTCOLINFO *hostcol, TDSCOLUMN *curcol, int buflen) { union { TDS_TINYINT ti; TDS_SMALLINT si; TDS_INT li; } u; int plen; /* compute prefix len if needed */ if ((plen = hostcol->prefix_len) == -1) plen = bcp_cache_prefix_len(hostcol, curcol); /* output prefix to file */ switch (plen) { default: return SUCCEED; case 1: u.ti = buflen; break; case 2: u.si = buflen; break; case 4: u.li = buflen; break; } if (fwrite(&u, plen, 1, hostfile) == 1) return SUCCEED; return FAIL; } /** * \ingroup dblib_bcp_internal * \brief * * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param rows_copied * * \return SUCCEED or FAIL. * \sa BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow() */ static RETCODE _bcp_exec_out(DBPROCESS * dbproc, DBINT * rows_copied) { FILE *hostfile = NULL; TDS_UCHAR *data = NULL; int i; TDSSOCKET *tds; TDSRESULTINFO *resinfo; TDSCOLUMN *curcol = NULL; BCP_HOSTCOLINFO *hostcol; int buflen; TDS_INT result_type; int row_of_query; int rows_written; const char *bcpdatefmt; TDSRET tdsret; tdsdump_log(TDS_DBG_FUNC, "_bcp_exec_out(%p, %p)\n", dbproc, rows_copied); assert(dbproc); assert(rows_copied); tds = dbproc->tds_socket; assert(tds); bcpdatefmt = getenv("FREEBCP_DATEFMT"); if (!bcpdatefmt) bcpdatefmt = "%Y-%m-%d %H:%M:%S.%z"; if (dbproc->bcpinfo->direction == DB_QUERYOUT ) { if (TDS_FAILED(tds_submit_query(tds, tds_dstr_cstr(&dbproc->bcpinfo->tablename)))) return FAIL; } else { /* TODO quote if needed */ if (TDS_FAILED(tds_submit_queryf(tds, "select * from %s", tds_dstr_cstr(&dbproc->bcpinfo->tablename)))) return FAIL; } tdsret = tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS); if (TDS_FAILED(tdsret)) return FAIL; if (!tds->res_info) { /* TODO flush/cancel to keep consistent state */ return FAIL; } resinfo = tds->res_info; row_of_query = 0; rows_written = 0; /* allocate at least 256 bytes */ /* allocate data for buffer conversion */ data = tds_new(TDS_UCHAR, 256); if (!data) { dbperror(dbproc, SYBEMEM, errno); goto Cleanup; } /* * TODO above we allocate many buffer just to convert and store * to file.. avoid all that passages... */ if (!(hostfile = fopen(dbproc->hostfileinfo->hostfile, "w"))) { dbperror(dbproc, SYBEBCUO, errno); goto Cleanup; } /* fetch a row of data from the server */ while (tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE) == TDS_SUCCESS) { if (result_type != TDS_ROW_RESULT && result_type != TDS_COMPUTE_RESULT) break; row_of_query++; /* skip rows outside of the firstrow/lastrow range, if specified */ if (dbproc->hostfileinfo->firstrow > row_of_query || row_of_query > MAX(dbproc->hostfileinfo->lastrow, 0x7FFFFFFF)) continue; /* Go through the hostfile columns, finding those that relate to database columns. */ for (i = 0; i < dbproc->hostfileinfo->host_colcount; i++) { hostcol = dbproc->hostfileinfo->host_columns[i]; if (hostcol->tab_colnum < 1 || hostcol->tab_colnum > resinfo->num_cols) continue; curcol = resinfo->columns[hostcol->tab_colnum - 1]; if (curcol->column_cur_size < 0) { buflen = 0; } else { buflen = _bcp_convert_out(dbproc, curcol, hostcol, &data, bcpdatefmt); } if (buflen < 0) { _dblib_convert_err(dbproc, buflen); goto Cleanup; } /* The prefix */ if (bcp_write_prefix(hostfile, hostcol, curcol, buflen) != SUCCEED) goto write_error; /* The data */ if (hostcol->column_len != -1) { buflen = buflen > hostcol->column_len ? hostcol->column_len : buflen; } if (buflen > 0) { if (fwrite(data, buflen, 1, hostfile) != 1) goto write_error; } /* The terminator */ if (hostcol->terminator && hostcol->term_len > 0) { if (fwrite(hostcol->terminator, hostcol->term_len, 1, hostfile) != 1) goto write_error; } } rows_written++; } if (fclose(hostfile) != 0) { dbperror(dbproc, SYBEBCUC, errno); goto Cleanup; } hostfile = NULL; if (row_of_query + 1 < dbproc->hostfileinfo->firstrow) { /* * The table which bulk-copy is attempting to * copy to a host-file is shorter than the * number of rows which bulk-copy was instructed to skip. */ /* TODO reset TDSSOCKET state */ dbperror(dbproc, SYBETTS, 0); goto Cleanup; } *rows_copied = rows_written; free(data); return SUCCEED; write_error: dbperror(dbproc, SYBEBCWE, errno); Cleanup: if (hostfile) fclose(hostfile); free(data); return FAIL; } static STATUS _bcp_check_eof(DBPROCESS * dbproc, FILE *file, int icol) { int errnum = errno; tdsdump_log(TDS_DBG_FUNC, "_bcp_check_eof(%p, %p, %d)\n", dbproc, file, icol); assert(dbproc); assert(file); if (feof(file)) { if (icol == 0) { tdsdump_log(TDS_DBG_FUNC, "Normal end-of-file reached while loading bcp data file.\n"); return NO_MORE_ROWS; } dbperror(dbproc, SYBEBEOF, errnum); return FAIL; } dbperror(dbproc, SYBEBCRE, errnum); return FAIL; } /** * Convert column for input to a table */ static TDSRET _bcp_convert_in(DBPROCESS *dbproc, TDS_SERVER_TYPE srctype, const TDS_CHAR *src, TDS_UINT srclen, TDS_SERVER_TYPE desttype, BCPCOLDATA *coldata) { int variable = 1; CONV_RESULT cr, *p_cr; TDS_INT len; coldata->is_null = false; if (!is_variable_type(desttype)) { variable = 0; p_cr = (CONV_RESULT *) coldata->data; } else { p_cr = &cr; } len = tds_convert(dbproc->tds_socket->conn->tds_ctx, srctype, src, srclen, desttype, p_cr); if (len < 0) { _dblib_convert_err(dbproc, len); return TDS_FAIL; } coldata->datalen = len; if (variable) { free(coldata->data); coldata->data = (TDS_UCHAR *) cr.c; } return TDS_SUCCESS; } static void rtrim_bcpcol(TDSCOLUMN *bcpcol) { /* trim trailing blanks from character data */ if (is_ascii_type(bcpcol->on_server.column_type)) { /* A single NUL byte indicates an empty string. */ if (bcpcol->bcp_column_data->datalen == 1 && bcpcol->bcp_column_data->data[0] == '\0') { bcpcol->bcp_column_data->datalen = 0; return; } bcpcol->bcp_column_data->datalen = rtrim((char *) bcpcol->bcp_column_data->data, bcpcol->bcp_column_data->datalen); return; } /* unicode part */ if (is_unicode_type(bcpcol->on_server.column_type)) { uint16_t *data, space; if (!bcpcol->char_conv || bcpcol->char_conv->to.charset.min_bytes_per_char != 2) return; data = (uint16_t *) bcpcol->bcp_column_data->data; /* A single NUL byte indicates an empty string. */ if (bcpcol->bcp_column_data->datalen == 2 && data[0] == 0) { bcpcol->bcp_column_data->datalen = 0; return; } switch (bcpcol->char_conv->to.charset.canonic) { case TDS_CHARSET_UTF_16BE: case TDS_CHARSET_UCS_2BE: TDS_PUT_A2BE(&space, 0x20); break; case TDS_CHARSET_UTF_16LE: case TDS_CHARSET_UCS_2LE: TDS_PUT_A2LE(&space, 0x20); break; default: return; } bcpcol->bcp_column_data->datalen = rtrim_u16(data, bcpcol->bcp_column_data->datalen, space); } } /** * \ingroup dblib_bcp_internal * \brief * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param hostfile * \param row_error * * \return MORE_ROWS, NO_MORE_ROWS, or FAIL. * \sa BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow() */ static STATUS _bcp_read_hostfile(DBPROCESS * dbproc, FILE * hostfile, int *row_error, bool skip) { int i; tdsdump_log(TDS_DBG_FUNC, "_bcp_read_hostfile(%p, %p, %p, %d)\n", dbproc, hostfile, row_error, skip); assert(dbproc); assert(hostfile); assert(row_error); /* for each host file column defined by calls to bcp_colfmt */ for (i = 0; i < dbproc->hostfileinfo->host_colcount; i++) { TDSCOLUMN *bcpcol = NULL; BCP_HOSTCOLINFO *hostcol; TDS_CHAR *coldata; int collen = 0; bool data_is_null = false; offset_type col_start; tdsdump_log(TDS_DBG_FUNC, "parsing host column %d\n", i + 1); hostcol = dbproc->hostfileinfo->host_columns[i]; hostcol->column_error = 0; /* * If this host file column contains table data, * find the right element in the table/column list. */ if (hostcol->tab_colnum > 0) { if (hostcol->tab_colnum > dbproc->bcpinfo->bindinfo->num_cols) { tdsdump_log(TDS_DBG_FUNC, "error: file wider than table: %d/%d\n", i+1, dbproc->bcpinfo->bindinfo->num_cols); dbperror(dbproc, SYBEBEOF, 0); return FAIL; } tdsdump_log(TDS_DBG_FUNC, "host column %d uses bcpcol %d (%p)\n", i+1, hostcol->tab_colnum, bcpcol); bcpcol = dbproc->bcpinfo->bindinfo->columns[hostcol->tab_colnum - 1]; assert(bcpcol != NULL); } /* detect prefix len */ if (bcpcol && hostcol->prefix_len == -1) bcp_cache_prefix_len(hostcol, bcpcol); /* a prefix length, if extant, specifies how many bytes to read */ if (hostcol->prefix_len > 0) { union { TDS_TINYINT ti; TDS_SMALLINT si; TDS_INT li; } u; switch (hostcol->prefix_len) { case 1: if (fread(&u.ti, 1, 1, hostfile) != 1) return _bcp_check_eof(dbproc, hostfile, i); collen = u.ti ? u.ti : -1; break; case 2: if (fread(&u.si, 2, 1, hostfile) != 1) return _bcp_check_eof(dbproc, hostfile, i); collen = u.si; break; case 4: if (fread(&u.li, 4, 1, hostfile) != 1) return _bcp_check_eof(dbproc, hostfile, i); collen = u.li; break; default: /* FIXME return error, remember that prefix_len can be 3 */ assert(hostcol->prefix_len <= 4); break; } /* TODO test all NULL types */ /* TODO for < -1 error */ if (collen <= -1) { data_is_null = true; collen = 0; } } /* if (Max) column length specified take that into consideration. (Meaning what, exactly?) */ if (!data_is_null && hostcol->column_len >= 0) { if (hostcol->column_len == 0) data_is_null = true; else if (collen) collen = (hostcol->column_len < collen) ? hostcol->column_len : collen; else collen = hostcol->column_len; } tdsdump_log(TDS_DBG_FUNC, "prefix_len = %d collen = %d \n", hostcol->prefix_len, collen); /* Fixed Length data - this overrides anything else specified */ if (is_fixed_type(hostcol->datatype)) collen = tds_get_size_by_type(hostcol->datatype); col_start = ftello(hostfile); /* * The data file either contains prefixes stating the length, or is delimited. * If delimited, we "measure" the field by looking for the terminator, then read it, * and set collen to the field's post-iconv size. */ if (hostcol->term_len > 0) { /* delimited data file */ size_t col_bytes; TDSRET conv_res; /* * Read and convert the data */ coldata = NULL; conv_res = tds_bcp_fread(dbproc->tds_socket, bcpcol ? bcpcol->char_conv : NULL, hostfile, (const char *) hostcol->terminator, hostcol->term_len, &coldata, &col_bytes); if (TDS_FAILED(conv_res)) { tdsdump_log(TDS_DBG_FUNC, "col %d: error converting %ld bytes!\n", (i+1), (long) collen); *row_error = TRUE; free(coldata); dbperror(dbproc, SYBEBCOR, 0); return FAIL; } if (conv_res == TDS_NO_MORE_RESULTS) { free(coldata); return _bcp_check_eof(dbproc, hostfile, i); } if (col_bytes > 0x7fffffffl) { free(coldata); *row_error = TRUE; tdsdump_log(TDS_DBG_FUNC, "data from file is too large!\n"); dbperror(dbproc, SYBEBCOR, 0); return FAIL; } collen = (int)col_bytes; if (collen == 0) data_is_null = true; /* * TODO: * Dates are a problem. In theory, we should be able to read non-English dates, which * would contain non-ASCII characters. One might suppose we should convert date * strings to ISO-8859-1 (or another canonical form) here, because tds_convert() can't be * expected to deal with encodings. But instead date strings are read verbatim and * passed to tds_convert() without even waving to iconv(). For English dates, this works, * because English dates expressed as UTF-8 strings are indistinguishable from the ASCII. */ } else { /* unterminated field */ coldata = tds_new(TDS_CHAR, 1 + collen); if (coldata == NULL) { *row_error = TRUE; dbperror(dbproc, SYBEMEM, errno); return FAIL; } coldata[collen] = 0; if (collen) { /* * Read and convert the data * TODO: Call tds_bcp_fread() instead of fread(3). * The columns should each have their iconv cd set, and noncharacter data * should have -1 as the iconv cd, causing tds_bcp_fread() to not attempt * any conversion. We do not need a datatype switch here to decide what to do. * As of 0.62, this *should* actually work. All that remains is to change the * call and test it. */ tdsdump_log(TDS_DBG_FUNC, "Reading %d bytes from hostfile.\n", collen); if (fread(coldata, collen, 1, hostfile) != 1) { free(coldata); return _bcp_check_eof(dbproc, hostfile, i); } } } /* * At this point, however the field was read, however big it was, its address is coldata and its size is collen. */ tdsdump_log(TDS_DBG_FUNC, "Data read from hostfile: collen is now %d, data_is_null is %d\n", collen, data_is_null); if (!skip && bcpcol) { if (data_is_null) { bcpcol->bcp_column_data->is_null = true; bcpcol->bcp_column_data->datalen = 0; } else { TDSRET rc; TDS_SERVER_TYPE desttype; desttype = tds_get_conversion_type(bcpcol->column_type, bcpcol->column_size); rc = _bcp_convert_in(dbproc, hostcol->datatype, (const TDS_CHAR*) coldata, collen, desttype, bcpcol->bcp_column_data); if (TDS_FAILED(rc)) { hostcol->column_error = HOST_COL_CONV_ERROR; *row_error = 1; tdsdump_log(TDS_DBG_FUNC, "_bcp_read_hostfile failed to convert %d bytes at offset 0x%" PRIx64 " in the data file.\n", collen, (TDS_INT8) col_start); } rtrim_bcpcol(bcpcol); } #if USING_SYBEBCNN if (!hostcol->column_error) { if (bcpcol->bcp_column_data->datalen <= 0) { /* Are we trying to insert a NULL ? */ if (!bcpcol->column_nullable) { /* too bad if the column is not nullable */ hostcol->column_error = HOST_COL_NULL_ERROR; *row_error = 1; dbperror(dbproc, SYBEBCNN, 0); } } } #endif } free(coldata); } return MORE_ROWS; } /** * \ingroup dblib_bcp * \brief Write data in host variables to the table. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * * \remarks Call bcp_bind() first to describe the variables to be used. * Use bcp_batch() to commit sets of rows. * After sending the last row call bcp_done(). * \return SUCCEED or FAIL. * \sa bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), * bcp_control(), bcp_done(), bcp_exec(), bcp_init(), bcp_moretext(), bcp_options() */ RETCODE bcp_sendrow(DBPROCESS * dbproc) { TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "bcp_sendrow(%p)\n", dbproc); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); tds = dbproc->tds_socket; if (dbproc->bcpinfo->direction != DB_IN) { dbperror(dbproc, SYBEBCPN, 0); return FAIL; } if (dbproc->hostfileinfo != NULL) { dbperror(dbproc, SYBEBCPB, 0); return FAIL; } /* * The first time sendrow is called after bcp_init, * there is a certain amount of initialisation to be done. */ if (dbproc->bcpinfo->xfer_init == 0) { /* The start_copy function retrieves details of the table's columns */ if (TDS_FAILED(tds_bcp_start_copy_in(tds, dbproc->bcpinfo))) { dbperror(dbproc, SYBEBULKINSERT, 0); return FAIL; } dbproc->bcpinfo->xfer_init = 1; } dbproc->bcpinfo->parent = dbproc; return TDS_FAILED(tds_bcp_send_record(dbproc->tds_socket, dbproc->bcpinfo, _bcp_get_col_data, _bcp_null_error, 0)) ? FAIL : SUCCEED; } /** * \ingroup dblib_bcp_internal * \brief * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param rows_copied * * \return SUCCEED or FAIL. * \sa BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow() */ static RETCODE _bcp_exec_in(DBPROCESS * dbproc, DBINT * rows_copied) { FILE *hostfile, *errfile = NULL; TDSSOCKET *tds = dbproc->tds_socket; BCP_HOSTCOLINFO *hostcol; STATUS ret; int i, row_of_hostfile, rows_written_so_far; int row_error, row_error_count; offset_type row_start, row_end; offset_type error_row_size; const size_t chunk_size = 0x20000u; tdsdump_log(TDS_DBG_FUNC, "_bcp_exec_in(%p, %p)\n", dbproc, rows_copied); assert(dbproc); assert(rows_copied); *rows_copied = 0; if (!(hostfile = fopen(dbproc->hostfileinfo->hostfile, "r"))) { dbperror(dbproc, SYBEBCUO, 0); return FAIL; } if (TDS_FAILED(tds_bcp_start_copy_in(tds, dbproc->bcpinfo))) { fclose(hostfile); return FAIL; } row_of_hostfile = 0; rows_written_so_far = 0; row_error_count = 0; dbproc->bcpinfo->parent = dbproc; for (;;) { bool skip; row_start = ftello(hostfile); row_error = 0; row_of_hostfile++; if (row_of_hostfile > MAX(dbproc->hostfileinfo->lastrow, 0x7FFFFFFF)) break; skip = dbproc->hostfileinfo->firstrow > row_of_hostfile; ret = _bcp_read_hostfile(dbproc, hostfile, &row_error, skip); if (ret != MORE_ROWS) break; if (row_error) { int count; if (errfile == NULL && dbproc->hostfileinfo->errorfile) { if (!(errfile = fopen(dbproc->hostfileinfo->errorfile, "w"))) { fclose(hostfile); dbperror(dbproc, SYBEBUOE, 0); return FAIL; } } if (errfile != NULL) { char *row_in_error = NULL; for (i = 0; i < dbproc->hostfileinfo->host_colcount; i++) { hostcol = dbproc->hostfileinfo->host_columns[i]; if (hostcol->column_error == HOST_COL_CONV_ERROR) { count = fprintf(errfile, "#@ data conversion error on host data file Row %d Column %d\n", row_of_hostfile, i + 1); if( count < 0 ) { dbperror(dbproc, SYBEBWEF, errno); } } else if (hostcol->column_error == HOST_COL_NULL_ERROR) { count = fprintf(errfile, "#@ Attempt to bulk-copy a NULL value into Server column" " which does not accept NULL values. Row %d, Column %d\n", row_of_hostfile, i + 1); if( count < 0 ) { dbperror(dbproc, SYBEBWEF, errno); } } } row_end = ftello(hostfile); /* error data can be very long so split in chunks */ error_row_size = row_end - row_start; fseeko(hostfile, row_start, SEEK_SET); while (error_row_size > 0) { size_t chunk = error_row_size > chunk_size ? chunk_size : (size_t) error_row_size; if (!row_in_error) { if ((row_in_error = tds_new(char, chunk)) == NULL) { dbperror(dbproc, SYBEMEM, errno); } } if (fread(row_in_error, chunk, 1, hostfile) != 1) { printf("BILL fread failed after fseek\n"); } count = (int)fwrite(row_in_error, chunk, 1, errfile); if( (size_t)count < chunk ) { dbperror(dbproc, SYBEBWEF, errno); } error_row_size -= chunk; } free(row_in_error); fseeko(hostfile, row_end, SEEK_SET); count = fprintf(errfile, "\n"); if( count < 0 ) { dbperror(dbproc, SYBEBWEF, errno); } } row_error_count++; if (row_error_count >= dbproc->hostfileinfo->maxerrs) break; continue; } if (skip) continue; if (TDS_SUCCEED(tds_bcp_send_record(dbproc->tds_socket, dbproc->bcpinfo, _bcp_no_get_col_data, _bcp_null_error, 0))) { rows_written_so_far++; if (dbproc->hostfileinfo->batch > 0 && rows_written_so_far == dbproc->hostfileinfo->batch) { if (TDS_FAILED(tds_bcp_done(tds, &rows_written_so_far))) { if (errfile) fclose(errfile); fclose(hostfile); return FAIL; } *rows_copied += rows_written_so_far; rows_written_so_far = 0; dbperror(dbproc, SYBEBBCI, 0); /* batch copied to server */ tds_bcp_start(tds, dbproc->bcpinfo); } } } if (row_error_count == 0 && row_of_hostfile < dbproc->hostfileinfo->firstrow) { /* "The BCP hostfile '%1!' contains only %2! rows. */ dbperror(dbproc, SYBEBCSA, 0, dbproc->hostfileinfo->hostfile, row_of_hostfile); } if (errfile && 0 != fclose(errfile) ) { dbperror(dbproc, SYBEBUCE, 0); } if (fclose(hostfile) != 0) { dbperror(dbproc, SYBEBCUC, 0); ret = FAIL; } tds_bcp_done(tds, &rows_written_so_far); *rows_copied += rows_written_so_far; return ret == NO_MORE_ROWS? SUCCEED : FAIL; /* (ret is returned from _bcp_read_hostfile) */ } /** * \ingroup dblib_bcp * \brief Write a datafile to a table. * * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param rows_copied bcp_exec will write the count of rows successfully written to this address. * If \a rows_copied is NULL, it will be ignored by db-lib. * * \return SUCCEED or FAIL. * \sa bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), * bcp_control(), bcp_done(), bcp_init(), bcp_sendrow() */ RETCODE bcp_exec(DBPROCESS * dbproc, DBINT *rows_copied) { DBINT dummy_copied; RETCODE ret = FAIL; tdsdump_log(TDS_DBG_FUNC, "bcp_exec(%p, %p)\n", dbproc, rows_copied); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_PARAMETER(dbproc->hostfileinfo, SYBEBCVH, FAIL); if (rows_copied == NULL) /* NULL means we should ignore it */ rows_copied = &dummy_copied; if (dbproc->bcpinfo->direction == DB_OUT || dbproc->bcpinfo->direction == DB_QUERYOUT) { ret = _bcp_exec_out(dbproc, rows_copied); } else if (dbproc->bcpinfo->direction == DB_IN) { ret = _bcp_exec_in(dbproc, rows_copied); } _bcp_free_storage(dbproc); return ret; } /** * \ingroup dblib_bcp_internal * \brief * * \param buffer * \param size * \param f * * \return SUCCEED or FAIL. * \sa BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow() */ static char * _bcp_fgets(char *buffer, int size, FILE *f) { char *p = fgets(buffer, size, f); if (p == NULL) return p; /* discard newline */ p = strchr(buffer, 0) - 1; if (p >= buffer && *p == '\n') *p = 0; return buffer; } /** * \ingroup dblib_bcp * \brief Read a format definition file. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param filename Name that will be passed to fopen(3). * * \remarks Reads a format file and calls bcp_columns() and bcp_colfmt() as needed. * * \return SUCCEED or FAIL. * \sa bcp_colfmt(), bcp_colfmt_ps(), bcp_columns(), bcp_writefmt() */ RETCODE bcp_readfmt(DBPROCESS * dbproc, const char filename[]) { BCP_HOSTCOLINFO hostcol[1]; FILE *ffile; char buffer[1024]; float lf_version = 0.0; int li_numcols = 0; int colinfo_count = 0; tdsdump_log(TDS_DBG_FUNC, "bcp_readfmt(%p, %s)\n", dbproc, filename? filename:"NULL"); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_NULP(filename, "bcp_readfmt", 2, FAIL); memset(hostcol, 0, sizeof(hostcol)); if ((ffile = fopen(filename, "r")) == NULL) { dbperror(dbproc, SYBEBUOF, 0); goto Cleanup; } if ((_bcp_fgets(buffer, sizeof(buffer), ffile)) != NULL) { lf_version = (float)atof(buffer); } else if (ferror(ffile)) { dbperror(dbproc, SYBEBRFF, errno); goto Cleanup; } if ((_bcp_fgets(buffer, sizeof(buffer), ffile)) != NULL) { li_numcols = atoi(buffer); } else if (ferror(ffile)) { dbperror(dbproc, SYBEBRFF, errno); goto Cleanup; } if (li_numcols <= 0) goto Cleanup; if (bcp_columns(dbproc, li_numcols) == FAIL) goto Cleanup; do { memset(hostcol, 0, sizeof(hostcol)); if (_bcp_fgets(buffer, sizeof(buffer), ffile) == NULL) goto Cleanup; if (!_bcp_readfmt_colinfo(dbproc, buffer, hostcol)) goto Cleanup; if (bcp_colfmt(dbproc, hostcol->host_column, hostcol->datatype, hostcol->prefix_len, hostcol->column_len, hostcol->terminator, hostcol->term_len, hostcol->tab_colnum) == FAIL) { goto Cleanup; } TDS_ZERO_FREE(hostcol->terminator); } while (++colinfo_count < li_numcols); if (ferror(ffile)) { dbperror(dbproc, SYBEBRFF, errno); goto Cleanup; } if (fclose(ffile) != 0) { dbperror(dbproc, SYBEBUCF, 0); /* even if failure is returned ffile is no more valid */ ffile = NULL; goto Cleanup; } ffile = NULL; if (colinfo_count != li_numcols) goto Cleanup; return SUCCEED; Cleanup: TDS_ZERO_FREE(hostcol->terminator); _bcp_free_columns(dbproc); if (ffile) fclose(ffile); return FAIL; } /** * \ingroup dblib_bcp_internal * \brief * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param buf * \param ci * * \return SUCCEED or FAIL. * \sa BCP_SETL(), bcp_batch(), bcp_bind(), bcp_colfmt(), bcp_colfmt_ps(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), bcp_done(), bcp_exec(), bcp_getl(), bcp_init(), bcp_moretext(), bcp_options(), bcp_readfmt(), bcp_sendrow() */ static int _bcp_readfmt_colinfo(DBPROCESS * dbproc, char *buf, BCP_HOSTCOLINFO * ci) { char *tok; int whichcol; char term[30]; int i; char *lasts; enum nextcol { HOST_COLUMN, DATATYPE, PREFIX_LEN, COLUMN_LEN, TERMINATOR, TAB_COLNUM, NO_MORE_COLS }; assert(dbproc); assert(buf); assert(ci); tdsdump_log(TDS_DBG_FUNC, "_bcp_readfmt_colinfo(%p, %s, %p)\n", dbproc, buf, ci); tok = strtok_r(buf, " \t", &lasts); whichcol = HOST_COLUMN; /* TODO use a better way to get an int atoi is very error prone */ while (tok != NULL && whichcol != NO_MORE_COLS) { switch (whichcol) { case HOST_COLUMN: ci->host_column = atoi(tok); if (ci->host_column < 1) { dbperror(dbproc, SYBEBIHC, 0); return (FALSE); } whichcol = DATATYPE; break; case DATATYPE: if (strcmp(tok, "SYBCHAR") == 0) ci->datatype = SYBCHAR; else if (strcmp(tok, "SYBTEXT") == 0) ci->datatype = SYBTEXT; else if (strcmp(tok, "SYBBINARY") == 0) ci->datatype = SYBBINARY; else if (strcmp(tok, "SYBIMAGE") == 0) ci->datatype = SYBIMAGE; else if (strcmp(tok, "SYBINT1") == 0) ci->datatype = SYBINT1; else if (strcmp(tok, "SYBINT2") == 0) ci->datatype = SYBINT2; else if (strcmp(tok, "SYBINT4") == 0) ci->datatype = SYBINT4; else if (strcmp(tok, "SYBINT8") == 0) ci->datatype = SYBINT8; else if (strcmp(tok, "SYBFLT8") == 0) ci->datatype = SYBFLT8; else if (strcmp(tok, "SYBREAL") == 0) ci->datatype = SYBREAL; else if (strcmp(tok, "SYBBIT") == 0) ci->datatype = SYBBIT; else if (strcmp(tok, "SYBNUMERIC") == 0) ci->datatype = SYBNUMERIC; else if (strcmp(tok, "SYBDECIMAL") == 0) ci->datatype = SYBDECIMAL; else if (strcmp(tok, "SYBMONEY") == 0) ci->datatype = SYBMONEY; else if (strcmp(tok, "SYBMONEY4") == 0) ci->datatype = SYBMONEY4; else if (strcmp(tok, "SYBDATETIME") == 0) ci->datatype = SYBDATETIME; else if (strcmp(tok, "SYBDATETIME4") == 0) ci->datatype = SYBDATETIME4; /* TODO SQL* for MS SQLNCHAR SQLBIGINT SQLTINYINT SQLSMALLINT SQLUNIQUEID SQLVARIANT SQLUDT */ else { dbperror(dbproc, SYBEBUDF, 0); return (FALSE); } whichcol = PREFIX_LEN; break; case PREFIX_LEN: ci->prefix_len = atoi(tok); whichcol = COLUMN_LEN; break; case COLUMN_LEN: ci->column_len = atoi(tok); whichcol = TERMINATOR; break; case TERMINATOR: if (*tok++ != '\"') return (FALSE); for (i = 0; *tok != '\"' && i < sizeof(term); i++) { if (*tok == '\\') { tok++; switch (*tok) { case 't': term[i] = '\t'; break; case 'n': term[i] = '\n'; break; case 'r': term[i] = '\r'; break; case '\\': term[i] = '\\'; break; case '0': term[i] = '\0'; break; default: return (FALSE); } tok++; } else term[i] = *tok++; } if (*tok != '\"') return (FALSE); ci->term_len = i; TDS_ZERO_FREE(ci->terminator); if (i > 0) { if ((ci->terminator = tds_new(BYTE, i)) == NULL) { dbperror(dbproc, SYBEMEM, errno); return FALSE; } memcpy(ci->terminator, term, i); } whichcol = TAB_COLNUM; break; case TAB_COLNUM: ci->tab_colnum = atoi(tok); whichcol = NO_MORE_COLS; break; } tok = strtok_r(NULL, " \t", &lasts); } if (whichcol == NO_MORE_COLS) return (TRUE); else return (FALSE); } #if defined(DBLIB_UNIMPLEMENTED) /** * \ingroup dblib_bcp * \brief Write a format definition file. Not Implemented. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param filename Name that would be passed to fopen(3). * * \remarks Reads a format file and calls bcp_columns() and bcp_colfmt() as needed. * \a FreeTDS includes freebcp, a utility to copy data to or from a host file. * * \todo For completeness, \a freebcp ought to be able to create format files, but that functionality * is currently lacking, as is bcp_writefmt(). * \todo See the vendors' documentation for the format of these files. * * \return SUCCEED or FAIL. * \sa bcp_colfmt(), bcp_colfmt_ps(), bcp_columns(), bcp_readfmt() */ RETCODE bcp_writefmt(DBPROCESS * dbproc, const char filename[]) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED: bcp_writefmt(%p, %s)\n", dbproc, filename? filename:"NULL"); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_NULP(filename, "bcp_writefmt", 2, FAIL); #if 0 dbperror(dbproc, SYBEBUFF, errno); /* bcp: Unable to create format file */ dbperror(dbproc, SYBEBWFF, errno); /* I/O error while writing bcp format file */ #endif return FAIL; } /** * \ingroup dblib_bcp * \brief Write some text or image data to the server. Not implemented, sadly. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param size How much to write, in bytes. * \param text Address of the data to be written. * \remarks For a SYBTEXT or SYBIMAGE column, bcp_bind() can be called with * a NULL varaddr parameter. If it is, bcp_sendrow() will return control * to the application after the non-text data have been sent. The application then calls * bcp_moretext() -- usually in a loop -- to send the text data in manageable chunks. * \todo implement bcp_moretext(). * \return SUCCEED or FAIL. * \sa bcp_bind(), bcp_sendrow(), dbmoretext(), dbwritetext() */ RETCODE bcp_moretext(DBPROCESS * dbproc, DBINT size, BYTE * text) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED: bcp_moretext(%p, %d, %p)\n", dbproc, size, text); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); CHECK_NULP(text, "bcp_moretext", 3, FAIL); #if 0 dbperror(dbproc, SYBEBCMTXT, 0); /* bcp_moretext may be used only when there is at least one text or image column in the server table */ dbperror(dbproc, SYBEBTMT, 0); /* Attempt to send too much text data via the bcp_moretext call */ #endif return FAIL; } #endif /** * \ingroup dblib_bcp * \brief Commit a set of rows to the table. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \remarks If not called, bcp_done() will cause the rows to be saved. * \return Count of rows saved, or -1 on error. * \sa bcp_bind(), bcp_done(), bcp_sendrow() */ DBINT bcp_batch(DBPROCESS * dbproc) { int rows_copied = 0; tdsdump_log(TDS_DBG_FUNC, "bcp_batch(%p)\n", dbproc); CHECK_CONN(-1); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, -1); if (TDS_FAILED(tds_bcp_done(dbproc->tds_socket, &rows_copied))) return -1; tds_bcp_start(dbproc->tds_socket, dbproc->bcpinfo); return rows_copied; } /** * \ingroup dblib_bcp * \brief Conclude the transfer of data from program variables. * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \remarks Do not overlook this function. According to Sybase, failure to call bcp_done() * "will result in unpredictable errors". * \return As with bcp_batch(), the count of rows saved, or -1 on error. * \sa bcp_batch(), bcp_bind(), bcp_moretext(), bcp_sendrow() */ DBINT bcp_done(DBPROCESS * dbproc) { int rows_copied; tdsdump_log(TDS_DBG_FUNC, "bcp_done(%p)\n", dbproc); CHECK_CONN(-1); if (!(dbproc->bcpinfo)) return -1; if (TDS_FAILED(tds_bcp_done(dbproc->tds_socket, &rows_copied))) return -1; _bcp_free_storage(dbproc); return rows_copied; } /** * \ingroup dblib_bcp * \brief Bind a program host variable to a database column * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param varaddr address of host variable * \param prefixlen length of any prefix found at the beginning of \a varaddr, in bytes. Use zero for fixed-length datatypes. * \param varlen bytes of data in \a varaddr. Zero for NULL, -1 for fixed-length datatypes. * \param terminator byte sequence that marks the end of the data in \a varaddr * \param termlen length of \a terminator * \param vartype datatype of the host variable * \param table_column Nth column, starting at 1, in the table. * * \remarks The order of operation is: * - bcp_init() with \a hfile == NULL and \a direction == DB_IN. * - bcp_bind(), once per column you want to write to * - bcp_batch(), optionally, to commit a set of rows * - bcp_done() * \return SUCCEED or FAIL. * \sa bcp_batch(), bcp_colfmt(), bcp_collen(), bcp_colptr(), bcp_columns(), bcp_control(), * bcp_done(), bcp_exec(), bcp_moretext(), bcp_sendrow() */ RETCODE bcp_bind(DBPROCESS * dbproc, BYTE * varaddr, int prefixlen, DBINT varlen, BYTE * terminator, int termlen, int db_vartype, int table_column) { TDS_SERVER_TYPE vartype; TDSCOLUMN *colinfo; tdsdump_log(TDS_DBG_FUNC, "bcp_bind(%p, %p, %d, %d -- %p, %d, %s, %d)\n", dbproc, varaddr, prefixlen, varlen, terminator, termlen, dbprtype(db_vartype), table_column); CHECK_CONN(FAIL); CHECK_PARAMETER(dbproc->bcpinfo, SYBEBCPI, FAIL); DBPERROR_RETURN(db_vartype != 0 && !is_tds_type_valid(db_vartype), SYBEUDTY); vartype = (TDS_SERVER_TYPE) db_vartype; if (dbproc->hostfileinfo != NULL) { dbperror(dbproc, SYBEBCPB, 0); return FAIL; } if (dbproc->bcpinfo->direction != DB_IN) { dbperror(dbproc, SYBEBCPN, 0); return FAIL; } if (varlen < -1) { dbperror(dbproc, SYBEBCVLEN, 0); return FAIL; } if (prefixlen != 0 && prefixlen != 1 && prefixlen != 2 && prefixlen != 4) { dbperror(dbproc, SYBEBCBPREF, 0); return FAIL; } if (prefixlen == 0 && varlen == -1 && termlen == -1 && !is_fixed_type(vartype)) { tdsdump_log(TDS_DBG_FUNC, "bcp_bind(): non-fixed type %d requires prefix or terminator\n", vartype); return FAIL; } if (is_fixed_type(vartype) && (varlen != -1 && varlen != 0)) { dbperror(dbproc, SYBEBCIT, 0); return FAIL; } if (table_column <= 0 || table_column > dbproc->bcpinfo->bindinfo->num_cols) { dbperror(dbproc, SYBECNOR, 0); return FAIL; } if (varaddr == NULL && (prefixlen != 0 || termlen != 0)) { dbperror(dbproc, SYBEBCBNPR, 0); return FAIL; } colinfo = dbproc->bcpinfo->bindinfo->columns[table_column - 1]; /* If varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY */ if (varaddr == NULL && varlen > 0) { int fOK = (colinfo->column_type == SYBTEXT || colinfo->column_type == SYBIMAGE) && (vartype == SYBTEXT || vartype == SYBCHAR || vartype == SYBIMAGE || vartype == SYBBINARY ); if( !fOK ) { dbperror(dbproc, SYBEBCBNTYP, 0); tdsdump_log(TDS_DBG_FUNC, "bcp_bind: SYBEBCBNTYP: column=%d and vartype=%d (should fail?)\n", colinfo->column_type, vartype); /* return FAIL; */ } } colinfo->column_varaddr = (char *)varaddr; colinfo->column_bindtype = vartype; colinfo->column_bindlen = varlen; colinfo->bcp_prefix_len = prefixlen; TDS_ZERO_FREE(colinfo->bcp_terminator); colinfo->bcp_term_len = 0; if (termlen > 0) { if ((colinfo->bcp_terminator = tds_new(TDS_CHAR, termlen)) == NULL) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } memcpy(colinfo->bcp_terminator, terminator, termlen); colinfo->bcp_term_len = termlen; } return SUCCEED; } static void _bcp_null_error(TDSBCPINFO *bcpinfo, int index, int offset) { DBPROCESS *dbproc = (DBPROCESS *) bcpinfo->parent; dbperror(dbproc, SYBEBCNN, 0); } /** * \ingroup dblib_bcp_internal * \brief For a bcp in from program variables, get the data from the host variable * * \param dbproc contains all information needed by db-lib to manage communications with the server. * \param bindcol * * \return TDS_SUCCESS or TDS_FAIL. * \sa _bcp_add_fixed_columns, _bcp_add_variable_columns, _bcp_send_bcp_record */ static TDSRET _bcp_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset) { TDS_SERVER_TYPE coltype, desttype; int collen; int bytes_read; BYTE *dataptr; DBPROCESS *dbproc = (DBPROCESS *) bcpinfo->parent; TDSRET rc; tdsdump_log(TDS_DBG_FUNC, "_bcp_get_col_data(%p, %p)\n", bcpinfo, bindcol); CHECK_CONN(TDS_FAIL); CHECK_NULP(bindcol, "_bcp_get_col_data", 2, TDS_FAIL); dataptr = (BYTE *) bindcol->column_varaddr; collen = 0; /* If a prefix length specified, read the correct amount of data. */ if (bindcol->bcp_prefix_len > 0) { switch (bindcol->bcp_prefix_len) { case 1: collen = TDS_GET_UA1(dataptr); dataptr += 1; break; case 2: collen = (TDS_SMALLINT) TDS_GET_UA2(dataptr); dataptr += 2; break; case 4: collen = (TDS_INT) TDS_GET_UA4(dataptr); dataptr += 4; break; } if (collen <= 0) goto null_data; } /* if (Max) column length specified take that into consideration. */ if (bindcol->column_bindlen >= 0) { if (bindcol->column_bindlen == 0) goto null_data; if (collen) collen = (int) ((bindcol->column_bindlen < (TDS_UINT)collen) ? bindcol->column_bindlen : (TDS_UINT)collen); else collen = (int) bindcol->column_bindlen; } desttype = tds_get_conversion_type(bindcol->column_type, bindcol->column_size); coltype = bindcol->column_bindtype == 0 ? desttype : (TDS_SERVER_TYPE) bindcol->column_bindtype; /* Fixed Length data - this overrides anything else specified */ if (is_fixed_type(coltype)) collen = tds_get_size_by_type(coltype); /* read the data, finally */ if (bindcol->bcp_term_len > 0) { /* terminated field */ bytes_read = _bcp_get_term_var(dataptr, (BYTE *)bindcol->bcp_terminator, bindcol->bcp_term_len); if (collen <= 0 || bytes_read < collen) collen = bytes_read; if (collen == 0) goto null_data; } if (collen < 0) collen = (int) strlen((char *) dataptr); rc = _bcp_convert_in(dbproc, coltype, (const TDS_CHAR*) dataptr, collen, desttype, bindcol->bcp_column_data); if (TDS_FAILED(rc)) return rc; return TDS_SUCCESS; null_data: bindcol->bcp_column_data->datalen = 0; bindcol->bcp_column_data->is_null = true; return TDS_SUCCESS; } /** * Function to read data from file. I this case is empty as data * are already on bcp_column_data */ static TDSRET _bcp_no_get_col_data(TDSBCPINFO *bcpinfo, TDSCOLUMN *bindcol, int offset) { return TDS_SUCCESS; } /** * Get the data for bcp-in from program variables, where the program data * have been identified as character terminated, * This is a low-level, internal function. Call it correctly. */ /** * \ingroup dblib_bcp_internal * \brief * * \param pdata * \param term * \param term_len * * \return data length. */ static int _bcp_get_term_var(const BYTE * pdata, const BYTE * term, int term_len) { int bufpos; assert(term_len > 0); /* if bufpos becomes negative, we probably failed to find the terminator */ for (bufpos = 0; bufpos >= 0 && memcmp(pdata, term, term_len) != 0; pdata++) { bufpos++; } assert(bufpos >= 0); return bufpos; } /** * \ingroup dblib_bcp_internal * \brief trim a string of trailing blanks * * Replaces spaces at the end of a string with NULs * \param str pointer to a character buffer (not null-terminated) * \param len size of the \a str in bytes * * \return modified length */ static int rtrim(char *str, int len) { char *p = str + len - 1; while (p > str && *p == ' ') { *p-- = '\0'; } return (int)(1 + p - str); } static int rtrim_u16(uint16_t *str, int len, uint16_t space) { uint16_t *p = str + len / 2 - 1; while (p > str && *p == space) { *p-- = '\0'; } return (int)(1 + p - str) * 2; } /** * \ingroup dblib_bcp_internal * \brief * * \param dbproc contains all information needed by db-lib to manage communications with the server. */ static void _bcp_free_columns(DBPROCESS * dbproc) { int i; tdsdump_log(TDS_DBG_FUNC, "_bcp_free_columns(%p)\n", dbproc); assert(dbproc && dbproc->hostfileinfo); if (dbproc->hostfileinfo->host_columns) { for (i = 0; i < dbproc->hostfileinfo->host_colcount; i++) { TDS_ZERO_FREE(dbproc->hostfileinfo->host_columns[i]->terminator); TDS_ZERO_FREE(dbproc->hostfileinfo->host_columns[i]); } TDS_ZERO_FREE(dbproc->hostfileinfo->host_columns); dbproc->hostfileinfo->host_colcount = 0; } } /** * \ingroup dblib_bcp_internal * \brief * * \param dbproc contains all information needed by db-lib to manage communications with the server. * * \sa bcp_done(), bcp_exec(), bcp_init() */ static void _bcp_free_storage(DBPROCESS * dbproc) { tdsdump_log(TDS_DBG_FUNC, "_bcp_free_storage(%p)\n", dbproc); assert(dbproc); if (dbproc->hostfileinfo) { TDS_ZERO_FREE(dbproc->hostfileinfo->hostfile); TDS_ZERO_FREE(dbproc->hostfileinfo->errorfile); _bcp_free_columns(dbproc); TDS_ZERO_FREE(dbproc->hostfileinfo); } tds_free_bcpinfo(dbproc->bcpinfo); dbproc->bcpinfo = NULL; } freetds-1.3.6/src/dblib/xact.c000644 025423 025423 00000004503 14056414221 017552 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #include #if defined(DBLIB_UNIMPLEMENTED) void build_xact_string(char *xact_name, char *service_name, DBINT commid, char *result) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED build_xact_string()\n"); } RETCODE remove_xact(DBPROCESS * connect, DBINT commid, int n) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED remove_xact()\n"); return SUCCEED; } RETCODE abort_xact(DBPROCESS * connect, DBINT commid) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED abort_xact()\n"); return SUCCEED; } void close_commit(DBPROCESS * connect) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED close_commit()\n"); } RETCODE commit_xact(DBPROCESS * connect, DBINT commid) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED commit_xact()\n"); return SUCCEED; } DBPROCESS * open_commit(LOGINREC * login, char *servername) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED open_commit()\n"); return NULL; } RETCODE scan_xact(DBPROCESS * connect, DBINT commid) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED scan_xact()\n"); return SUCCEED; } DBINT start_xact(DBPROCESS * connect, char *application_name, char *xact_name, int site_count) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED start_xact()\n"); return 0; } DBINT stat_xact(DBPROCESS * connect, DBINT commid) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED stat_xact()\n"); return 0; } #endif freetds-1.3.6/src/dblib/dbpivot.c000644 025423 025423 00000070225 14056414271 020273 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2011 James K. Lowden * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_ERRNO_H # include #endif /* HAVE_ERRNO_H */ #include #include #include #include #include #include #include #include #include #define TDS_FIND(k,b,c) tds_find(k, b, TDS_VECTOR_SIZE(b), sizeof(b[0]), c) typedef bool (*compare_func)(const void *, const void *); static void * tds_find(const void *key, const void *base, size_t nelem, size_t width, compare_func compar) { size_t n; char *p = (char *) base; for (n = nelem; n != 0; --n) { if (compar(key, p)) return p; p += width; } return NULL; } struct col_t { size_t len; TDS_SERVER_TYPE type; int null_indicator; char *s; union { DBTINYINT ti; DBSMALLINT si; DBINT i; DBREAL r; DBFLT8 f; } data; }; static TDS_SERVER_TYPE infer_col_type(int sybtype); static struct col_t * col_init(struct col_t *pcol, int sybtype, int collen) { assert(pcol); pcol->type = infer_col_type(sybtype); if (pcol->type == TDS_INVALID_TYPE) return NULL; pcol->len = collen; switch (sybtype) { case 0: pcol->len = 0; return NULL; case SYBDATETIME: case SYBDATETIME4: case SYBDATETIMN: collen = 30; /* fall through */ case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case SYBNTEXT: pcol->len = collen; if ((pcol->s = tds_new(char, 1+collen)) == NULL) { return NULL; } break; } return pcol; } static void col_free(struct col_t *p) { free(p->s); memset(p, 0, sizeof(*p)); } static bool col_equal(const struct col_t *pc1, const struct col_t *pc2) { assert( pc1 && pc2 ); assert( pc1->type == pc2->type ); switch (pc1->type) { case SYBCHAR: case SYBVARCHAR: if( pc1->len != pc2->len) return false; return strncmp(pc1->s, pc2->s, pc1->len) == 0; case SYBINT1: return pc1->data.ti == pc2->data.ti; case SYBINT2: return pc1->data.si == pc2->data.si; case SYBINT4: return pc1->data.i == pc2->data.i; case SYBFLT8: return pc1->data.f == pc2->data.f; case SYBREAL: return pc1->data.r == pc2->data.r; case SYBINTN: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBBINARY: case SYBVOID: case SYBVARBINARY: case SYBBITN: case SYBNUMERIC: case SYBDECIMAL: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: assert( false && pc1->type ); break; } return false; } static void * col_buffer(struct col_t *pcol) { switch (pcol->type) { case SYBCHAR: case SYBVARCHAR: return pcol->s; case SYBINT1: return &pcol->data.ti; case SYBINT2: return &pcol->data.si; case SYBINT4: return &pcol->data.i; case SYBFLT8: return &pcol->data.f; case SYBREAL: return &pcol->data.r; case SYBINTN: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBBINARY: case SYBVOID: case SYBVARBINARY: case SYBBITN: case SYBNUMERIC: case SYBDECIMAL: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: assert( false && pcol->type ); break; } return NULL; } #if 0 static int col_print(FILE* out, const struct col_t *pcol) { char *fmt; switch (pcol->type) { case SYBCHAR: case SYBVARCHAR: return (int) fwrite(pcol->s, pcol->len, 1, out); case SYBINT1: return fprintf(out, "%d", (int)pcol->ti); case SYBINT2: return fprintf(out, "%d", (int)pcol->si); case SYBINT4: return fprintf(out, "%d", (int)pcol->i); case SYBFLT8: return fprintf(out, "%f", pcol->f); case SYBREAL: return fprintf(out, "%f", (double)pcol->r); case SYBINTN: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBBINARY: case SYBVOID: case SYBVARBINARY: case SYBBITN: case SYBNUMERIC: case SYBDECIMAL: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: assert( false && pcol->type ); break; } return false; } #endif static struct col_t * col_cpy(struct col_t *pdest, const struct col_t *psrc) { assert( pdest && psrc ); assert( psrc->len > 0 || psrc->null_indicator == -1); memcpy(pdest, psrc, sizeof(*pdest)); if (psrc->s) { assert(psrc->len >= 0); if ((pdest->s = tds_new(char, psrc->len)) == NULL) return NULL; memcpy(pdest->s, psrc->s, psrc->len); } assert( pdest->len > 0 || pdest->null_indicator == -1); return pdest; } static bool col_null( const struct col_t *pcol ) { assert(pcol); return pcol->null_indicator == -1; } static char * string_value(const struct col_t *pcol) { char *output = NULL; int len = -1; switch (pcol->type) { case SYBCHAR: case SYBVARCHAR: if ((output = tds_new0(char, 1 + pcol->len)) == NULL) return NULL; strncpy(output, pcol->s, pcol->len); return output; break; case SYBINT1: len = asprintf(&output, "%d", (int)pcol->data.ti); break; case SYBINT2: len = asprintf(&output, "%d", (int)pcol->data.si); break; case SYBINT4: len = asprintf(&output, "%d", (int)pcol->data.i); break; case SYBFLT8: len = asprintf(&output, "%f", pcol->data.f); break; case SYBREAL: len = asprintf(&output, "%f", (double)pcol->data.r); break; default: case SYBINTN: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBBINARY: case SYBVOID: case SYBVARBINARY: case SYBBITN: case SYBNUMERIC: case SYBDECIMAL: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: assert( false && pcol->type ); return NULL; break; } return len >= 0? output : NULL; } static char * join(int argc, char *argv[], const char sep[]) { size_t len = 0; char **p, *output; for (p=argv; p < argv + argc; p++) { len += strlen(*p); } len += 1 + argc * strlen(sep); /* allows one too many */ output = tds_new0(char, len); if (!output) return NULL; for (p=argv; p < argv + argc; p++) { if (p != argv) strcat(output, sep); strcat(output, *p); } return output; } static TDS_SERVER_TYPE infer_col_type(int sybtype) { switch (sybtype) { case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case SYBNTEXT: return SYBCHAR; case SYBDATETIME: case SYBDATETIME4: case SYBDATETIMN: return SYBCHAR; case SYBINT1: case SYBBIT: case SYBBITN: return SYBINT1; case SYBINT2: return SYBINT2; case SYBINT4: case SYBINTN: return SYBINT4; case SYBFLT8: case SYBMONEY4: case SYBMONEY: case SYBFLTN: case SYBMONEYN: case SYBNUMERIC: case SYBDECIMAL: return SYBFLT8; case SYBREAL: return SYBREAL; case SYBIMAGE: case SYBBINARY: case SYBVOID: case SYBVARBINARY: assert( false && sybtype ); break; } return TDS_INVALID_TYPE; } static int bind_type(int sybtype) { switch (sybtype) { case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case SYBNTEXT: case SYBDATETIME: case SYBDATETIME4: case SYBDATETIMN: return NTBSTRINGBIND; case SYBINT1: case SYBBIT: case SYBBITN: return TINYBIND; case SYBINT2: return SMALLBIND; case SYBINT4: case SYBINTN: return INTBIND; case SYBFLT8: case SYBMONEY4: case SYBMONEY: case SYBFLTN: case SYBMONEYN: case SYBNUMERIC: case SYBDECIMAL: return FLT8BIND; case SYBREAL: return REALBIND; case SYBIMAGE: case SYBBINARY: case SYBVOID: case SYBVARBINARY: assert( false && sybtype ); break; } return 0; } typedef struct KEY_T { int nkeys; struct col_t *keys; } KEY_T; static bool key_equal(const KEY_T *a, const KEY_T *b) { int i; assert(a && b); assert(a->keys && b->keys); assert(a->nkeys == b->nkeys); for (i=0; i < a->nkeys; i++) { if (! col_equal(a->keys+i, b->keys+i)) return false; } return true; } static void key_free(KEY_T *p) { col_free(p->keys); free(p->keys); memset(p, 0, sizeof(*p)); } static KEY_T * key_cpy(KEY_T *pdest, const KEY_T *psrc) { int i; assert( pdest && psrc ); if ((pdest->keys = tds_new0(struct col_t, psrc->nkeys)) == NULL) return NULL; pdest->nkeys = psrc->nkeys; for( i=0; i < psrc->nkeys; i++) { if (NULL == col_cpy(pdest->keys+i, psrc->keys+i)) return NULL; } return pdest; } static char * make_col_name(DBPROCESS *dbproc, const KEY_T *k) { const struct col_t *pc; char **names, **s, *output; assert(k); assert(k->nkeys); assert(k->keys); s = names = tds_new0(char *, k->nkeys); if (!s) { dbperror(dbproc, SYBEMEM, errno); return NULL; } for(pc=k->keys; pc < k->keys + k->nkeys; pc++) { *s++ = strdup(string_value(pc)); } output = join(k->nkeys, names, "/"); for(s=names; s < names + k->nkeys; s++) { free(*s); } free(names); return output; } typedef struct agg_t { KEY_T row_key, col_key; struct col_t value; } AGG_T; #if 0 static bool agg_key_equal(const void *a, const void *b) { int i; const AGG_T *p1 = a, *p2 = b; assert(p1 && p2); assert(p1->row_key.keys && p2->row_key.keys); assert(p1->row_key.nkeys == p2->row_key.nkeys); for( i=0; i < p1->row_key.nkeys; i++ ) { if (! col_equal(p1->row_key.keys+i, p2->row_key.keys+i)) return false; } return true; } #endif static bool agg_next(const AGG_T *p1, const AGG_T *p2) { int i; assert(p1 && p2); if (p1->row_key.keys == NULL || p2->row_key.keys == NULL) return false; assert(p1->row_key.keys && p2->row_key.keys); assert(p1->row_key.nkeys == p2->row_key.nkeys); assert(p1->col_key.keys && p2->col_key.keys); assert(p1->col_key.nkeys == p2->col_key.nkeys); for( i=0; i < p1->row_key.nkeys; i++ ) { assert(p1->row_key.keys[i].type); assert(p2->row_key.keys[i].type); if (p1->row_key.keys[i].type != p2->row_key.keys[i].type) return false; } for( i=0; i < p1->row_key.nkeys; i++ ) { if (! col_equal(p1->row_key.keys+i, p2->row_key.keys+i)) return false; } for( i=0; i < p1->col_key.nkeys; i++ ) { if (p1->col_key.keys[i].type != p2->col_key.keys[i].type) return false; } for( i=0; i < p1->col_key.nkeys; i++ ) { if (! col_equal(p1->col_key.keys+i, p2->col_key.keys+i)) return false; } return true; } static void agg_free(AGG_T *p) { key_free(&p->row_key); key_free(&p->col_key); col_free(&p->value); } static bool agg_equal(const AGG_T *p1, const AGG_T *p2) { int i; assert(p1 && p2); assert(p1->row_key.keys && p1->col_key.keys); assert(p2->row_key.keys && p2->col_key.keys); assert(p1->row_key.nkeys == p2->row_key.nkeys); assert(p1->col_key.nkeys == p2->col_key.nkeys); /* todo: use key_equal */ for( i=0; i < p1->row_key.nkeys; i++ ) { if (! col_equal(p1->row_key.keys+i, p2->row_key.keys+i)) return false; } for( i=0; i < p1->col_key.nkeys; i++ ) { if (! col_equal(p1->col_key.keys+i, p2->col_key.keys+i)) return false; } return true; } #undef TEST_MALLOC #define TEST_MALLOC(dest,type) \ {if (!(dest = (type*)calloc(1, sizeof(type)))) goto Cleanup;} #undef TEST_CALLOC #define TEST_CALLOC(dest,type,n) \ {if (!(dest = (type*)calloc((n), sizeof(type)))) goto Cleanup;} #define tds_alloc_column() ((TDSCOLUMN*) calloc(1, sizeof(TDSCOLUMN))) static TDSRESULTINFO * alloc_results(size_t num_cols) { TDSRESULTINFO *res_info; TDSCOLUMN **ppcol; TEST_MALLOC(res_info, TDSRESULTINFO); res_info->ref_count = 1; TEST_CALLOC(res_info->columns, TDSCOLUMN *, num_cols); for (ppcol = res_info->columns; ppcol < res_info->columns + num_cols; ppcol++) if ((*ppcol = tds_alloc_column()) == NULL) goto Cleanup; res_info->num_cols = num_cols; res_info->row_size = 0; return res_info; Cleanup: tds_free_results(res_info); return NULL; } static TDSRET set_result_column(TDSSOCKET * tds, TDSCOLUMN * curcol, const char name[], const struct col_t *pvalue) { assert(curcol && pvalue); assert(name); curcol->column_usertype = pvalue->type; curcol->column_nullable = true; curcol->column_writeable = false; curcol->column_identity = false; tds_set_column_type(tds->conn, curcol, pvalue->type); /* sets "cardinal" type */ curcol->column_timestamp = (curcol->column_type == SYBBINARY && curcol->column_usertype == TDS_UT_TIMESTAMP); #if 0 curcol->funcs->get_info(tds, curcol); #endif curcol->on_server.column_size = curcol->column_size; if (!tds_dstr_copy(&curcol->column_name, name)) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds7_get_data_info: \n" "\tcolname = %s\n" "\ttype = %d (%s)\n" "\tserver's type = %d (%s)\n" "\tcolumn_varint_size = %d\n" "\tcolumn_size = %d (%d on server)\n", tds_dstr_cstr(&curcol->column_name), curcol->column_type, tds_prtype(curcol->column_type), curcol->on_server.column_type, tds_prtype(curcol->on_server.column_type), curcol->column_varint_size, curcol->column_size, curcol->on_server.column_size); return TDS_SUCCESS; } struct metadata_t { KEY_T *pacross; char *name; struct col_t col; }; static bool reinit_results(TDSSOCKET * tds, size_t num_cols, const struct metadata_t meta[]) { TDSRESULTINFO *info; int i; assert(tds); assert(num_cols); assert(meta); tds_free_all_results(tds); tds->rows_affected = TDS_NO_COUNT; if ((info = alloc_results(num_cols)) == NULL) return false; tds_set_current_results(tds, info); if (tds->cur_cursor) { tds_free_results(tds->cur_cursor->res_info); tds->cur_cursor->res_info = info; tdsdump_log(TDS_DBG_INFO1, "set current_results to cursor->res_info\n"); } else { tds->res_info = info; tdsdump_log(TDS_DBG_INFO1, "set current_results (%u column%s) to tds->res_info\n", (unsigned) num_cols, (num_cols==1? "":"s")); } tdsdump_log(TDS_DBG_INFO1, "setting up %u columns\n", (unsigned) num_cols); for (i = 0; i < num_cols; i++) { set_result_column(tds, info->columns[i], meta[i].name, &meta[i].col); info->columns[i]->bcp_terminator = (char*) meta[i].pacross; /* overload available pointer */ } if (num_cols > 0) { static const char dashes[31] = "------------------------------"; tdsdump_log(TDS_DBG_INFO1, " %-20s %-15s %-15s %-7s\n", "name", "size/wsize", "type/wtype", "utype"); tdsdump_log(TDS_DBG_INFO1, " %-20s %15s %15s %7s\n", dashes+10, dashes+30-15, dashes+30-15, dashes+30-7); } for (i = 0; i < num_cols; i++) { TDSCOLUMN *curcol = info->columns[i]; tdsdump_log(TDS_DBG_INFO1, " %-20s %7d/%-7d %7d/%-7d %7d\n", tds_dstr_cstr(&curcol->column_name), curcol->column_size, curcol->on_server.column_size, curcol->column_type, curcol->on_server.column_type, curcol->column_usertype); } #if 1 /* all done now allocate a row for tds_process_row to use */ if (TDS_FAILED(tds_alloc_row(info))) return false; #endif return true; } typedef struct pivot_t { DBPROCESS *dbproc; STATUS status; DB_RESULT_STATE dbresults_state; AGG_T *output; KEY_T *across; size_t nout, nacross; } PIVOT_T; static bool pivot_key_equal(const PIVOT_T *a, const PIVOT_T *b) { assert(a && b); return a->dbproc == b->dbproc; } static PIVOT_T *pivots = NULL; static size_t npivots = 0; PIVOT_T * dbrows_pivoted(DBPROCESS *dbproc) { PIVOT_T P; assert(dbproc); P.dbproc = dbproc; return (PIVOT_T *) tds_find(&P, pivots, npivots, sizeof(*pivots), (compare_func) pivot_key_equal); } STATUS dbnextrow_pivoted(DBPROCESS *dbproc, PIVOT_T *pp) { int i; AGG_T candidate, *pout; assert(pp); assert(dbproc && dbproc->tds_socket); assert(dbproc->tds_socket->res_info); assert(dbproc->tds_socket->res_info->columns || 0 == dbproc->tds_socket->res_info->num_cols); for (pout = pp->output; pout < pp->output + pp->nout; pout++) { if (pout->row_key.keys != NULL) break; } if (pout == pp->output + pp->nout) { dbproc->dbresults_state = _DB_RES_NEXT_RESULT; return NO_MORE_ROWS; } memset(&candidate, 0, sizeof(candidate)); key_cpy(&candidate.row_key, &pout->row_key); /* "buffer_transfer_bound_data" */ for (i = 0; i < dbproc->tds_socket->res_info->num_cols; i++) { struct col_t *pval = NULL; TDSCOLUMN *pcol = dbproc->tds_socket->res_info->columns[i]; assert(pcol); if (pcol->column_nullbind) { if (pcol->column_cur_size < 0) { *(DBINT *)(pcol->column_nullbind) = -1; } else { *(DBINT *)(pcol->column_nullbind) = 0; } } if (!pcol->column_varaddr) { fprintf(stderr, "no pcol->column_varaddr in col %d\n", i); continue; } /* find column in output */ if (pcol->bcp_terminator == NULL) { /* not a cross-tab column */ pval = &candidate.row_key.keys[i]; } else { AGG_T *pcan; key_cpy(&candidate.col_key, (KEY_T *) pcol->bcp_terminator); if ((pcan = tds_find(&candidate, pout, pp->output + pp->nout - pout, sizeof(*pp->output), (compare_func) agg_next)) != NULL) { /* flag this output as used */ pout->row_key.keys = NULL; pval = &pcan->value; } } if (!pval || col_null(pval)) { /* nothing in output for this x,y location */ dbgetnull(dbproc, pcol->column_bindtype, pcol->column_bindlen, (BYTE *) pcol->column_varaddr); continue; } assert(pval); #if 0 printf("\ncopying col %d, type %d/%d, len %d to %p ", i, pval->type, pcol->column_type, pval->len, pcol->column_varaddr); switch (pval->type) { case 48: printf("value %d", (int)pval->ti); break; case 56: printf("value %d", (int)pval->si); break; } printf("\n"); #endif pcol->column_size = pval->len; pcol->column_data = col_buffer(pval); copy_data_to_host_var( dbproc, pval->type, col_buffer(pval), pval->len, (BYTE *) pcol->column_varaddr, pcol->column_bindlen, pcol->column_bindtype, (DBINT*) pcol->column_nullbind ); } return REG_ROW; } /** * Pivot the rows, creating a new resultset * * Call dbpivot() immediately after dbresults(). It calls dbnextrow() as long as * it returns REG_ROW, transforming the results into a cross-tab report. * dbpivot() modifies the metadata such that DB-Library can be used tranparently: * retrieve the rows as usual with dbnumcols(), dbnextrow(), etc. * * @dbproc, our old friend * @nkeys the number of left-edge columns to group by * @keys an array of left-edge columns to group by * @ncols the number of top-edge columns to group by * @cols an array of top-edge columns to group by * @func the aggregation function to use * @val the number of the column to which @func is applied * * @returns the return code from the final call to dbnextrow(). * Success is normally indicated by NO_MORE_ROWS. */ RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val) { enum { logalot = 1 }; PIVOT_T P, *pp; AGG_T input, *pout = NULL; struct metadata_t *metadata, *pmeta; size_t i, nmeta = 0; tdsdump_log(TDS_DBG_FUNC, "dbpivot(%p, %d,%p, %d,%p, %p, %d)\n", dbproc, nkeys, keys, ncols, cols, func, val); if (logalot) { char buffer[1024] = {'\0'}, *s = buffer; const static char *const names[2] = { "\tkeys (down)", "\n\tcols (across)" }; int *p = keys, *pend = p + nkeys; for (i=0; i < 2; i++) { const char *sep = ""; s += sprintf(s, "%s: ", names[i]); for ( ; p < pend; p++) { s += sprintf(s, "%s%d", sep, *p); sep = ", "; } p = cols; pend = p + ncols; assert(s < buffer + sizeof(buffer)); } tdsdump_log(TDS_DBG_FUNC, "%s\n", buffer); } memset(&input, 0, sizeof(input)); P.dbproc = dbproc; if ((pp = tds_find(&P, pivots, npivots, sizeof(*pivots), (compare_func) pivot_key_equal)) == NULL ) { pp = TDS_RESIZE(pivots, 1 + npivots); if (!pp) return FAIL; pp += npivots++; } else { agg_free(pp->output); key_free(pp->across); } memset(pp, 0, sizeof(*pp)); if ((input.row_key.keys = tds_new0(struct col_t, nkeys)) == NULL) return FAIL; input.row_key.nkeys = nkeys; for (i=0; i < nkeys; i++) { int type = dbcoltype(dbproc, keys[i]); int len = dbcollen(dbproc, keys[i]); assert(type && len); if (!col_init(input.row_key.keys+i, type, len)) return FAIL; if (FAIL == dbbind(dbproc, keys[i], bind_type(type), input.row_key.keys[i].len, col_buffer(input.row_key.keys+i))) return FAIL; if (FAIL == dbnullbind(dbproc, keys[i], &input.row_key.keys[i].null_indicator)) return FAIL; } if ((input.col_key.keys = tds_new0(struct col_t, ncols)) == NULL) return FAIL; input.col_key.nkeys = ncols; for (i=0; i < ncols; i++) { int type = dbcoltype(dbproc, cols[i]); int len = dbcollen(dbproc, cols[i]); assert(type && len); if (!col_init(input.col_key.keys+i, type, len)) return FAIL; if (FAIL == dbbind(dbproc, cols[i], bind_type(type), input.col_key.keys[i].len, col_buffer(input.col_key.keys+i))) return FAIL; if (FAIL == dbnullbind(dbproc, cols[i], &input.col_key.keys[i].null_indicator)) return FAIL; } /* value */ { int type = dbcoltype(dbproc, val); int len = dbcollen(dbproc, val); assert(type && len); if (!col_init(&input.value, type, len)) return FAIL; if (FAIL == dbbind(dbproc, val, bind_type(type), input.value.len, col_buffer(&input.value))) return FAIL; if (FAIL == dbnullbind(dbproc, val, &input.value.null_indicator)) return FAIL; } while ((pp->status = dbnextrow(dbproc)) == REG_ROW) { /* add to unique list of crosstab columns */ if (tds_find(&input.col_key, pp->across, pp->nacross, sizeof(*pp->across), (compare_func) key_equal) == NULL) { if (!TDS_RESIZE(pp->across, 1 + pp->nacross)) return FAIL; key_cpy(pp->across + pp->nacross, &input.col_key); } assert(pp->across); if ((pout = tds_find(&input, pp->output, pp->nout, sizeof(*pp->output), (compare_func) agg_equal)) == NULL ) { if (!TDS_RESIZE(pp->output, 1 + pp->nout)) return FAIL; pout = pp->output + pp->nout++; if ((pout->row_key.keys = tds_new0(struct col_t, input.row_key.nkeys)) == NULL) return FAIL; key_cpy(&pout->row_key, &input.row_key); if ((pout->col_key.keys = tds_new0(struct col_t, input.col_key.nkeys)) == NULL) return FAIL; key_cpy(&pout->col_key, &input.col_key); if (!col_init(&pout->value, input.value.type, input.value.len)) return FAIL; } func(&pout->value, &input.value); } /* Mark this proc as pivoted, so that dbnextrow() sees it when the application calls it */ pp->dbproc = dbproc; pp->dbresults_state = dbproc->dbresults_state; dbproc->dbresults_state = pp->output < pout? _DB_RES_RESULTSET_ROWS : _DB_RES_RESULTSET_EMPTY; /* * Initialize new metadata */ nmeta = input.row_key.nkeys + pp->nacross; metadata = tds_new0(struct metadata_t, nmeta); if (!metadata) { dbperror(dbproc, SYBEMEM, errno); return FAIL; } assert(pp->across || pp->nacross == 0); /* key columns are passed through as-is, verbatim */ for (i=0; i < input.row_key.nkeys; i++) { assert(i < nkeys); metadata[i].name = strdup(dbcolname(dbproc, keys[i])); metadata[i].pacross = NULL; col_cpy(&metadata[i].col, input.row_key.keys+i); } /* pivoted columms are found in the "across" data */ for (i=0, pmeta = metadata + input.row_key.nkeys; i < pp->nacross; i++) { struct col_t col; if (!col_init(&col, SYBFLT8, sizeof(double))) return FAIL; assert(pmeta + i < metadata + nmeta); pmeta[i].name = make_col_name(dbproc, pp->across+i); if (!pmeta[i].name) return FAIL; assert(pp->across); pmeta[i].pacross = pp->across + i; col_cpy(&pmeta[i].col, pp->nout? &pp->output[0].value : &col); } if (!reinit_results(dbproc->tds_socket, nmeta, metadata)) { return FAIL; } return SUCCEED; #if 0 for (pp->pout=pp->output; pp->pout < pp->output + pp->nout; pp->pout++) { char name[256] = {0}; assert(pp->pout->col_key.keys[0].len < sizeof(name)); memset(name, '\0', sizeof(name)); memcpy(name, pp->pout->col_key.keys[0].s, pp->pout->col_key.keys[0].len), printf("%5d %-30s %5d\n", pp->pout->row_key.keys[0].i, name, pp->pout->value.i ); } exit(1); #endif } /* * Aggregation functions */ void dbpivot_count (struct col_t *tgt, const struct col_t *src) { assert( tgt && src); assert (src->type); tgt->type = SYBINT4; if (! col_null(src)) tgt->data.i++; } void dbpivot_sum (struct col_t *tgt, const struct col_t *src) { assert( tgt && src); assert (src->type); tgt->type = src->type; if (col_null(src)) return; switch (src->type) { case SYBINT1: tgt->data.ti += src->data.ti; break; case SYBINT2: tgt->data.si += src->data.si; break; case SYBINT4: tgt->data.i += src->data.i; break; case SYBFLT8: tgt->data.f += src->data.f; break; case SYBREAL: tgt->data.r += src->data.r; break; case SYBCHAR: case SYBVARCHAR: case SYBINTN: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBBINARY: case SYBVOID: case SYBVARBINARY: case SYBBITN: case SYBNUMERIC: case SYBDECIMAL: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: default: tdsdump_log(TDS_DBG_INFO1, "dbpivot_sum(): invalid operand %d\n", src->type); tgt->type = SYBINT4; tgt->data.i = 0; break; } } void dbpivot_min (struct col_t *tgt, const struct col_t *src) { assert( tgt && src); assert (src->type); tgt->type = src->type; if (col_null(src)) return; switch (src->type) { case SYBINT1: tgt->data.ti = tgt->data.ti < src->data.ti? tgt->data.ti : src->data.ti; break; case SYBINT2: tgt->data.si = tgt->data.si < src->data.si? tgt->data.si : src->data.si; break; case SYBINT4: tgt->data.i = tgt->data.i < src->data.i? tgt->data.i : src->data.i; break; case SYBFLT8: tgt->data.f = tgt->data.f < src->data.f? tgt->data.f : src->data.f; break; case SYBREAL: tgt->data.r = tgt->data.r < src->data.r? tgt->data.r : src->data.r; break; case SYBCHAR: case SYBVARCHAR: case SYBINTN: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBBINARY: case SYBVOID: case SYBVARBINARY: case SYBBITN: case SYBNUMERIC: case SYBDECIMAL: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: default: tdsdump_log(TDS_DBG_INFO1, "dbpivot_sum(): invalid operand %d\n", src->type); tgt->type = SYBINT4; tgt->data.i = 0; break; } } void dbpivot_max (struct col_t *tgt, const struct col_t *src) { assert( tgt && src); assert (src->type); tgt->type = src->type; if (col_null(src)) return; switch (src->type) { case SYBINT1: tgt->data.ti = tgt->data.ti > src->data.ti? tgt->data.ti : src->data.ti; break; case SYBINT2: tgt->data.si = tgt->data.si > src->data.si? tgt->data.si : src->data.si; break; case SYBINT4: tgt->data.i = tgt->data.i > src->data.i? tgt->data.i : src->data.i; break; case SYBFLT8: tgt->data.f = tgt->data.f > src->data.f? tgt->data.f : src->data.f; break; case SYBREAL: tgt->data.r = tgt->data.r > src->data.r? tgt->data.r : src->data.r; break; case SYBCHAR: case SYBVARCHAR: case SYBINTN: case SYBDATETIME: case SYBBIT: case SYBTEXT: case SYBNTEXT: case SYBIMAGE: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBBINARY: case SYBVOID: case SYBVARBINARY: case SYBBITN: case SYBNUMERIC: case SYBDECIMAL: case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: default: tdsdump_log(TDS_DBG_INFO1, "dbpivot_sum(): invalid operand %d\n", src->type); tgt->type = SYBINT4; tgt->data.i = 0; break; } } static const struct name_t { char name[14]; DBPIVOT_FUNC func; } names[] = { { "count", dbpivot_count } , { "sum", dbpivot_sum } , { "min", dbpivot_min } , { "max", dbpivot_max } }; static bool name_equal( const struct name_t *n1, const struct name_t *n2 ) { assert(n1 && n2); return strcmp(n1->name, n2->name) == 0; } DBPIVOT_FUNC dbpivot_lookup_name( const char name[] ) { struct name_t *n = TDS_FIND(name, names, (compare_func) name_equal); return n ? n->func : NULL; } freetds-1.3.6/src/dblib/dbopen.c000644 025423 025423 00000002365 14056414221 020066 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #ifdef dbopen #undef dbopen #endif /** * Normally not used. * The function is linked in only if the --enable-sybase-compat configure option is used. * Cf. sybdb.h dbopen() macros, and dbdatecrack(). */ DBPROCESS * dbopen(LOGINREC * login, const char *server) { return tdsdbopen(login, server, dblib_msdblib); } freetds-1.3.6/src/dblib/winmain.c000644 025423 025423 00000000041 14056414221 020246 0ustar00fredianofrediano000000 000000 #include "../../win32/initnet.c" freetds-1.3.6/src/dblib/buffering.h000644 025423 025423 00000031732 14056414221 020573 0ustar00fredianofrediano000000 000000 typedef struct dblib_buffer_row { /** pointer to result informations */ TDSRESULTINFO *resinfo; /** row data, NULL for resinfo->current_row */ unsigned char *row_data; /** row number */ DBINT row; /** save old sizes */ TDS_INT *sizes; } DBLIB_BUFFER_ROW; static void buffer_struct_print(const DBPROC_ROWBUF *buf); static RETCODE buffer_save_row(DBPROCESS *dbproc); static DBLIB_BUFFER_ROW* buffer_row_address(const DBPROC_ROWBUF * buf, int idx); #if ENABLE_EXTRA_CHECKS static void buffer_check_row_empty(DBLIB_BUFFER_ROW *row) { assert(row->resinfo == NULL); assert(row->row_data == NULL); assert(row->sizes == NULL); assert(row->row == 0); } static void buffer_check(const DBPROC_ROWBUF *buf) { int i; /* no buffering */ if (buf->capacity == 0 || buf->capacity == 1) { assert(buf->head == 0); assert(buf->tail == 0 || buf->tail == 1); assert(buf->capacity == 1 || buf->rows == NULL); return; } assert(buf->capacity > 0); assert(buf->head >= 0); assert(buf->tail >= 0); assert(buf->head < buf->capacity); assert(buf->tail <= buf->capacity); /* check empty */ if (buf->tail == buf->capacity) { assert(buf->head == 0); for (i = 0; buf->rows && i < buf->capacity; ++i) buffer_check_row_empty(&buf->rows[i]); return; } if (buf->rows == NULL) return; /* check filled part */ i = buf->tail; do { assert(i >= 0 && i < buf->capacity); assert(buf->rows[i].resinfo != NULL); assert(buf->rows[i].row > 0); assert(buf->rows[i].row <= buf->received); ++i; if (i == buf->capacity) i = 0; } while (i != buf->head); /* check empty part */ if (buf->head != buf->tail) { i = buf->head; do { assert(i >= 0 && i < buf->capacity); buffer_check_row_empty(&buf->rows[i]); ++i; if (i == buf->capacity) i = 0; } while (i != buf->tail); } } #define BUFFER_CHECK(buf) buffer_check(buf) #else #define BUFFER_CHECK(buf) do {} while(0) #endif /** * A few words on the buffering design. * * DBPROC_ROWBUF::buf is a block of row buffers, * managed as a ring, indexed by head, tail, and current: * * head -- where new elements are inserted. * tail -- oldest element. * current -- active row (read by dbgetrow/dbnextrow) * * capacity is the number of rows that buf can hold. * * Each element in buf is preceded by its row_number: * the result_set row number, determined by counting the rows * as they're received from the server. Applications communicate * to db-lib in row numbers, not buffer indices. * * Semantics: * head == 0 && tail == capacity is the initial condition. * head == tail means the buffer is full, except when capacity is 1. * head < tail means the buffer has wrapped around. * * Whether or not buffering is active is governed by * dbproc->dbopts[DBBUFFER].optactive. */ /** * number of rows in the buffer */ static int buffer_count(const DBPROC_ROWBUF *buf) { BUFFER_CHECK(buf); return (buf->head > buf->tail) ? buf->head - buf->tail : /* |...TddddH....| */ buf->capacity - (buf->tail - buf->head); /* |ddddH....Tddd| */ } /** * Can the buffer be written to? */ static int buffer_is_full(const DBPROC_ROWBUF *buf) { BUFFER_CHECK(buf); return buf->capacity == buffer_count(buf) && buf->capacity > 1; } #ifndef NDEBUG static int buffer_index_valid(const DBPROC_ROWBUF *buf, int idx) { BUFFER_CHECK(buf); if (buf->tail <= buf->head) if (buf->head <= idx && idx <= buf->tail) return 1; if (0 <= idx && idx <= buf->head) return 1; if (buf->tail <= idx && idx < buf->capacity) return 1; #if 0 printf("buffer_index_valid: idx = %d\n", idx); buffer_struct_print(buf); #endif return 0; } #endif static void buffer_free_row(DBLIB_BUFFER_ROW *row) { if (row->sizes) TDS_ZERO_FREE(row->sizes); if (row->row_data) { tds_free_row(row->resinfo, row->row_data); row->row_data = NULL; } tds_free_results(row->resinfo); row->resinfo = NULL; row->row = 0; } /* * Buffer is freed at slightly odd points, whenever * capacity changes: * * 1. When setting capacity, to release prior buffer. * 2. By dbresults. When called the second time, it has to * release prior storage because the new resultset will have * a different width. * 3. By dbclose(), else open/close/open would leak. */ static void buffer_free(DBPROC_ROWBUF *buf) { BUFFER_CHECK(buf); if (buf->rows != NULL) { int i; for (i = 0; i < buf->capacity; ++i) buffer_free_row(&buf->rows[i]); TDS_ZERO_FREE(buf->rows); } BUFFER_CHECK(buf); } /* * When no rows are currently buffered (and the buffer is allocated) * set the indices to their initial positions. */ static void buffer_reset(DBPROC_ROWBUF *buf) { buf->head = 0; buf->current = buf->tail = buf->capacity; BUFFER_CHECK(buf); } static int buffer_idx_increment(const DBPROC_ROWBUF *buf, int idx) { if (++idx >= buf->capacity) { idx = 0; } return idx; } /** * Given an index, return the row storage, including * the DBINT row number prefix. */ static DBLIB_BUFFER_ROW* buffer_row_address(const DBPROC_ROWBUF * buf, int idx) { BUFFER_CHECK(buf); if (idx < 0 || idx >= buf->capacity) { printf("idx is %d:\n", idx); buffer_struct_print(buf); return NULL; } return &(buf->rows[idx]); } /** * Convert an index to a row number. */ static DBINT buffer_idx2row(const DBPROC_ROWBUF *buf, int idx) { BUFFER_CHECK(buf); return buffer_row_address(buf, idx)->row; } /** * Convert a row number to an index. */ static int buffer_row2idx(const DBPROC_ROWBUF *buf, int row_number) { int i = buf->tail; #ifndef NDEBUG int ii = 0; #endif BUFFER_CHECK(buf); if (i == buf->capacity) { assert (buf->head == 0); return -1; /* no rows buffered */ } /* * March through the buffers from tail to head, stop if we find our row. * A full queue is indicated by tail == head (which means we can't write). */ do { if (buffer_idx2row(buf, i) == row_number) return i; assert(ii++ < buf->capacity); /* prevent infinite loop */ i = buffer_idx_increment(buf, i); } while (i != buf->head); return -1; } /** * Deleting a row from the buffer doesn't affect memory allocation. * It just makes the space available for a different row. */ static void buffer_delete_rows(DBPROC_ROWBUF * buf, int count) { int i; BUFFER_CHECK(buf); if (count < 0 || count > buffer_count(buf)) { count = buffer_count(buf); } for (i=0; i < count; i++) { if (buf->tail < buf->capacity) buffer_free_row(&buf->rows[buf->tail]); buf->tail = buffer_idx_increment(buf, buf->tail); /* * If deleting rows from the buffer catches the tail to the head, * return to the initial position. Otherwise, it will look full. */ if (buf->tail == buf->head) { buffer_reset(buf); break; } } #if 0 buffer_struct_print(buf); #endif BUFFER_CHECK(buf); } /** * Transfer data from buffer/tds back to client */ static void buffer_transfer_bound_data(DBPROC_ROWBUF *buf, TDS_INT res_type, TDS_INT compute_id, DBPROCESS * dbproc, int idx) { int i; BYTE *src; const DBLIB_BUFFER_ROW *row; tdsdump_log(TDS_DBG_FUNC, "buffer_transfer_bound_data(%p %d %d %p %d)\n", buf, res_type, compute_id, dbproc, idx); BUFFER_CHECK(buf); assert(buffer_index_valid(buf, idx)); row = buffer_row_address(buf, idx); assert(row->resinfo); for (i = 0; i < row->resinfo->num_cols; i++) { TDS_SERVER_TYPE srctype; DBINT srclen; TDSCOLUMN *curcol = row->resinfo->columns[i]; if (row->sizes) curcol->column_cur_size = row->sizes[i]; srclen = curcol->column_cur_size; if (curcol->column_nullbind) { if (srclen < 0) { *(DBINT *)(curcol->column_nullbind) = -1; } else { *(DBINT *)(curcol->column_nullbind) = 0; } } if (!curcol->column_varaddr) continue; if (srclen <= 0) { if (srclen == 0 || !curcol->column_nullbind) dbgetnull(dbproc, curcol->column_bindtype, curcol->column_bindlen, (BYTE *) curcol->column_varaddr); continue; } srctype = tds_get_conversion_type(curcol->column_type, curcol->column_size); if (row->row_data) src = &row->row_data[curcol->column_data - row->resinfo->current_row]; else src = curcol->column_data; if (is_blob_col(curcol)) src = (BYTE *) ((TDSBLOB *) src)->textvalue; copy_data_to_host_var(dbproc, srctype, src, srclen, (BYTE *) curcol->column_varaddr, curcol->column_bindlen, curcol->column_bindtype, (DBINT*) curcol->column_nullbind); } /* * This function always bumps current. Usually, it's called * by dbnextrow(), so bumping current is a pretty obvious choice. * It can also be called by dbgetrow(), but that function also * causes the bump. If you call dbgetrow() for row N, a subsequent * call to dbnextrow() yields N+1. */ buf->current = buffer_idx_increment(buf, buf->current); } /* end buffer_transfer_bound_data() */ static void buffer_struct_print(const DBPROC_ROWBUF *buf) { assert(buf); printf("\t%d rows in buffer\n", buffer_count(buf)); printf("\thead = %d\t", buf->head); printf("\ttail = %d\t", buf->tail); printf("\tcurrent = %d\n", buf->current); printf("\tcapacity = %d\t", buf->capacity); printf("\thead row number = %d\n", buf->received); } /* * * Functions called only by public db-lib API take DBPROCESS* * */ /** * Return the current row buffer index. * We strive to validate it first. It must be: * between zero and capacity (obviously), and * between the head and the tail, logically. * * If the head has wrapped the tail, it shouldn't be in no man's land. * IOW, if capacity is 9, head is 3 and tail is 7, good rows are 7-8 and 0-2. * (Row 3 is about-to-be-inserted, and 4-6 are not in use.) Here's a diagram: * d d d ! ! ! ! d d * 0 1 2 3 4 5 6 7 8 * ^ ^ * Head Tail * * The special case is capacity == 1, meaning there's no buffering, and head == tail === 0. */ static int buffer_current_index(const DBPROCESS *dbproc) { const DBPROC_ROWBUF *buf = &dbproc->row_buf; #if 0 buffer_struct_print(buf); #endif if (buf->capacity <= 1) /* no buffering */ return -1; if (buf->current == buf->head || buf->current == buf->capacity) return -1; assert(buf->current >= 0); assert(buf->current < buf->capacity); if( buf->tail < buf->head) { assert(buf->tail < buf->current); assert(buf->current < buf->head); } else { if (buf->current > buf->head) assert(buf->current > buf->tail); } return buf->current; } /* * Normally called by dbsetopt() to prepare for buffering * Called with nrows == 0 by dbopen to safely set buf->rows to NULL. */ static void buffer_set_capacity(DBPROCESS *dbproc, int nrows) { DBPROC_ROWBUF *buf = &dbproc->row_buf; buffer_free(buf); memset(buf, 0, sizeof(DBPROC_ROWBUF)); if (0 == nrows) { buf->capacity = 1; BUFFER_CHECK(buf); return; } assert(0 < nrows); buf->capacity = nrows; BUFFER_CHECK(buf); } /* * Called only by dbresults(); capacity must be >= 1. * Sybase's documents say dbresults() cannot return FAIL if the prior calls worked, * which is a little strange, because (for FreeTDS, at least), dbresults * is when we learn about the result set's width. Without that information, we * can't allocate memory for the buffer. But if we *fail* to allocate memory, * we're not to communicate it back to the caller? */ static void buffer_alloc(DBPROCESS *dbproc) { DBPROC_ROWBUF *buf = &dbproc->row_buf; /* Call this function only after setting capacity. */ assert(buf); assert(buf->capacity > 0); assert(buf->rows == NULL); buf->rows = tds_new0(DBLIB_BUFFER_ROW, buf->capacity); assert(buf->rows); buffer_reset(buf); buf->received = 0; } /** * Called by dbnextrow * Returns a row buffer index, or -1 to indicate the buffer is full. */ static int buffer_add_row(DBPROCESS *dbproc, TDSRESULTINFO *resinfo) { DBPROC_ROWBUF *buf = &dbproc->row_buf; DBLIB_BUFFER_ROW *row; int i; assert(buf->capacity >= 0); if (buffer_is_full(buf)) return -1; row = buffer_row_address(buf, buf->head); /* bump the row number, write it, and move the data to head */ if (row->resinfo) { tds_free_row(row->resinfo, row->row_data); tds_free_results(row->resinfo); } row->row = ++buf->received; ++resinfo->ref_count; row->resinfo = resinfo; row->row_data = NULL; if (row->sizes) free(row->sizes); row->sizes = tds_new0(TDS_INT, resinfo->num_cols); for (i = 0; i < resinfo->num_cols; ++i) row->sizes[i] = resinfo->columns[i]->column_cur_size; /* initial condition is head == 0 and tail == capacity */ if (buf->tail == buf->capacity) { /* bumping this tail will set it to zero */ assert(buf->head == 0); buf->tail = 0; } /* update current, bump the head */ buf->current = buf->head; buf->head = buffer_idx_increment(buf, buf->head); return buf->current; } /** * Save current row into row buffer */ static RETCODE buffer_save_row(DBPROCESS *dbproc) { DBPROC_ROWBUF *buf = &dbproc->row_buf; DBLIB_BUFFER_ROW *row; int idx = buf->head - 1; if (buf->capacity <= 1) return SUCCEED; if (idx < 0) idx = buf->capacity - 1; if (idx >= 0 && idx < buf->capacity) { row = &buf->rows[idx]; if (row->resinfo && !row->row_data) { row->row_data = row->resinfo->current_row; tds_alloc_row(row->resinfo); } } return SUCCEED; } freetds-1.3.6/src/dblib/CMakeLists.txt000644 025423 025423 00000001653 14056414221 021212 0ustar00fredianofrediano000000 000000 add_subdirectory(unittests) if(WIN32) set(win_SRCS winmain.c dblib.def dbopen.c) endif() # TODO add dbopen.c if necessary add_library(sybdb SHARED dblib.c dbutil.c rpc.c bcp.c xact.c dbpivot.c buffering.h ${win_SRCS} ) target_compile_definitions(sybdb PUBLIC DLL_EXPORT=1) add_dependencies(sybdb encodings_h) target_link_libraries(sybdb tds replacements tdsutils ${lib_NETWORK} ${lib_BASE}) add_library(db-lib STATIC dblib.c dbutil.c rpc.c bcp.c xact.c dbpivot.c buffering.h ) add_dependencies(db-lib encodings_h) target_link_libraries(db-lib tds replacements tdsutils ${lib_NETWORK} ${lib_BASE}) if(NOT WIN32) set_target_properties(sybdb PROPERTIES SOVERSION "5.1.0") endif() if(MINGW OR CYGWIN) set_target_properties(sybdb PROPERTIES LINK_FLAGS "--static") endif(MINGW OR CYGWIN) INSTALL(TARGETS sybdb db-lib PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) freetds-1.3.6/src/dblib/dblib.def000644 025423 025423 00000004017 14056414221 020203 0ustar00fredianofrediano000000 000000 EXPORTS bcp_batch bcp_bind bcp_colfmt bcp_colfmt_ps bcp_collen bcp_colptr bcp_columns bcp_control bcp_done bcp_exec bcp_getbatchsize bcp_getl bcp_init bcp_options bcp_readfmt bcp_sendrow dbadata dbadlen dbaltbind dbaltcolid dbaltlen dbaltop dbalttype dbaltutype dbanullbind dbbind dbbylist dbcancel dbcanquery dbchange dbclose dbclrbuf dbclropt dbcmd dbcmdrow dbcolinfo dbcollen dbcolname dbcolsource dbcoltype dbcoltypeinfo dbcolutype dbconvert dbconvert_ps dbcount dbcurcmd dbcurrow dbdata dbdatecmp dbdatecrack dbanydatecrack dbdatlen dbdead dberrhandle dbexit dbfcmd dbfirstrow dbfreebuf dbgetchar dbgetmaxprocs dbgetpacket dbgetrow dbgettime dbgetuserdata dbhasretstat dbinit dbiordesc dbiowdesc dbisavail dbiscount dbisopt dblastrow dblogin dbloginfree dbmny4add dbmny4cmp dbmny4copy dbmny4minus dbmny4sub dbmny4zero dbmnycmp dbmnycopy dbmnydec dbmnyinc dbmnymaxneg dbmnymaxpos dbmnyminus dbmnyzero dbmonthname dbmorecmds dbmoretext dbmsghandle dbname dbnextrow dbnextrow_pivoted dbnullbind dbnumalts dbnumcols dbnumcompute dbnumrets dbpivot_count dbpivot_max dbpivot_min dbpivot_sum dbprcollen dbprhead dbprrow dbopen dbpivot dbpivot_lookup_name dbprtype dbreadtext dbrecftos dbresults dbretdata dbretlen dbretname dbretstatus dbrettype dbrows dbrows_pivoted dbrowtype dbrpcinit dbrpcparam dbrpcsend dbsafestr dbservcharset dbsetavail dbsetifile dbsetinterrupt dbsetlbool dbsetllong dbsetlname dbsetlogintime dbsetlversion dbsetmaxprocs dbsetnull dbsetopt dbsetrow dbsettime dbsetuserdata dbsetversion dbspid dbspr1row dbspr1rowlen dbsprhead dbsprline dbsqlexec dbsqlok dbsqlsend dbstrbuild dbstrcpy dbstrlen dbtablecolinfo dbtds dbtxptr dbtxtimestamp dbuse dbvarylen dbversion dbwillconvert dbwritetext tdsdbopen tdsdump_open freetds-1.3.6/src/dblib/unittests/000755 025423 025423 00000000000 14162303405 020506 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/dblib/unittests/Makefile.am000644 025423 025423 00000006471 14107141721 022552 0ustar00fredianofrediano000000 000000 TESTS = \ t0001$(EXEEXT) \ t0002$(EXEEXT) \ t0003$(EXEEXT) \ t0004$(EXEEXT) \ t0005$(EXEEXT) \ t0006$(EXEEXT) \ t0007$(EXEEXT) \ t0008$(EXEEXT) \ t0009$(EXEEXT) \ t0011$(EXEEXT) \ t0012$(EXEEXT) \ t0013$(EXEEXT) \ t0014$(EXEEXT) \ t0015$(EXEEXT) \ t0016$(EXEEXT) \ t0017$(EXEEXT) \ t0018$(EXEEXT) \ t0019$(EXEEXT) \ t0020$(EXEEXT) \ dbsafestr$(EXEEXT) \ t0022$(EXEEXT) \ t0023$(EXEEXT) \ rpc$(EXEEXT) \ dbmorecmds$(EXEEXT) \ bcp$(EXEEXT) \ thread$(EXEEXT) \ text_buffer$(EXEEXT) \ done_handling$(EXEEXT) \ timeout$(EXEEXT) \ hang$(EXEEXT) \ null$(EXEEXT) \ null2$(EXEEXT) \ setnull$(EXEEXT) \ numeric$(EXEEXT) \ pending$(EXEEXT) \ cancel$(EXEEXT) \ spid$(EXEEXT) \ canquery$(EXEEXT) \ batch_stmt_ins_sel$(EXEEXT) \ batch_stmt_ins_upd$(EXEEXT) \ bcp_getl$(EXEEXT) \ empty_rowsets$(EXEEXT) \ string_bind$(EXEEXT) \ colinfo$(EXEEXT) \ bcp2$(EXEEXT) check_PROGRAMS = $(TESTS) t0001_SOURCES = t0001.c t0001.sql t0002_SOURCES = t0002.c t0002.sql t0003_SOURCES = t0003.c t0003.sql t0004_SOURCES = t0004.c t0004.sql t0005_SOURCES = t0005.c t0005.sql t0006_SOURCES = t0006.c t0006.sql t0007_SOURCES = t0007.c t0007.sql t0008_SOURCES = t0008.c t0009_SOURCES = t0009.c t0009.sql t0011_SOURCES = t0011.c t0011.sql t0012_SOURCES = t0012.c t0012.sql t0013_SOURCES = t0013.c t0013.sql data.bin t0014_SOURCES = t0014.c t0014.sql data.bin t0015_SOURCES = t0015.c t0015.sql t0016_SOURCES = t0016.c \ t0016.sql t0016_1.sql t0016_2.sql t0016_3.sql \ t0016_4.sql t0016_5.sql t0016_6.sql t0016_7.sql \ t0016_8.sql t0016_9.sql t0016_10.sql t0016_11.sql \ t0016.in t0016_1.in t0016_2.in t0016_3.in \ t0016_4.in t0016_5.in t0016_6.in t0016_7.in \ t0016_8.in t0016_9.in t0016_10.in t0016_11.in t0017_SOURCES = t0017.c t0017.sql t0017.in t0017.in.be t0018_SOURCES = t0018.c t0018.sql t0019_SOURCES = t0019.c t0020_SOURCES = t0020.c t0020.sql dbsafestr_SOURCES = dbsafestr.c t0022_SOURCES = t0022.c t0022.sql t0023_SOURCES = t0023.c t0023.sql rpc_SOURCES = rpc.c rpc.sql dbmorecmds_SOURCES = dbmorecmds.c dbmorecmds.sql bcp_SOURCES = bcp.c bcp.h bcp.sql thread_SOURCES = thread.c bcp.h text_buffer_SOURCES = text_buffer.c text_buffer.sql done_handling_SOURCES = done_handling.c done_handling.sql timeout_SOURCES = timeout.c timeout.sql hang_SOURCES = hang.c null_SOURCES = null.c null2_SOURCES = null2.c setnull_SOURCES = setnull.c numeric_SOURCES = numeric.c numeric.sql numeric_2.sql pending_SOURCES = pending.c pending.sql cancel_SOURCES = cancel.c cancel.sql spid_SOURCES = spid.c spid.sql canquery_SOURCES= canquery.c canquery.sql batch_stmt_ins_sel_SOURCES = batch_stmt_ins_sel.c batch_stmt_ins_sel.sql batch_stmt_ins_upd_SOURCES = batch_stmt_ins_upd.c batch_stmt_ins_upd.sql bcp_getl_SOURCES= bcp_getl.c empty_rowsets_SOURCES = empty_rowsets.c empty_rowsets.sql string_bind_SOURCES = string_bind.c colinfo_SOURCES = colinfo.c colinfo.sql bcp2_SOURCES = bcp2.c bcp2.sql noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h AM_CPPFLAGS = -DFREETDS_TOPDIR=\"$(top_srcdir)\" -I$(top_srcdir)/include if MINGW32 AM_LDFLAGS = -no-fast-install else AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" endif LDADD = libcommon.a ../libsybdb.la ../../replacements/libreplacements.la $(LTLIBICONV) EXTRA_DIST = CMakeLists.txt CLEANFILES = tdsdump.out t0013.out t0014.out t0016.out \ t0016.err t0017.err t0017.out freetds-1.3.6/src/dblib/unittests/Makefile.in000644 025423 025423 00000230301 14162303356 022557 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/dblib/unittests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libcommon_a_AR = $(AR) $(ARFLAGS) libcommon_a_LIBADD = am_libcommon_a_OBJECTS = common.$(OBJEXT) libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) am_batch_stmt_ins_sel_OBJECTS = batch_stmt_ins_sel.$(OBJEXT) batch_stmt_ins_sel_OBJECTS = $(am_batch_stmt_ins_sel_OBJECTS) batch_stmt_ins_sel_LDADD = $(LDADD) am__DEPENDENCIES_1 = batch_stmt_ins_sel_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_batch_stmt_ins_upd_OBJECTS = batch_stmt_ins_upd.$(OBJEXT) batch_stmt_ins_upd_OBJECTS = $(am_batch_stmt_ins_upd_OBJECTS) batch_stmt_ins_upd_LDADD = $(LDADD) batch_stmt_ins_upd_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_bcp_OBJECTS = bcp.$(OBJEXT) bcp_OBJECTS = $(am_bcp_OBJECTS) bcp_LDADD = $(LDADD) bcp_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_bcp2_OBJECTS = bcp2.$(OBJEXT) bcp2_OBJECTS = $(am_bcp2_OBJECTS) bcp2_LDADD = $(LDADD) bcp2_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_bcp_getl_OBJECTS = bcp_getl.$(OBJEXT) bcp_getl_OBJECTS = $(am_bcp_getl_OBJECTS) bcp_getl_LDADD = $(LDADD) bcp_getl_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_cancel_OBJECTS = cancel.$(OBJEXT) cancel_OBJECTS = $(am_cancel_OBJECTS) cancel_LDADD = $(LDADD) cancel_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_canquery_OBJECTS = canquery.$(OBJEXT) canquery_OBJECTS = $(am_canquery_OBJECTS) canquery_LDADD = $(LDADD) canquery_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_colinfo_OBJECTS = colinfo.$(OBJEXT) colinfo_OBJECTS = $(am_colinfo_OBJECTS) colinfo_LDADD = $(LDADD) colinfo_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_dbmorecmds_OBJECTS = dbmorecmds.$(OBJEXT) dbmorecmds_OBJECTS = $(am_dbmorecmds_OBJECTS) dbmorecmds_LDADD = $(LDADD) dbmorecmds_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_dbsafestr_OBJECTS = dbsafestr.$(OBJEXT) dbsafestr_OBJECTS = $(am_dbsafestr_OBJECTS) dbsafestr_LDADD = $(LDADD) dbsafestr_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_done_handling_OBJECTS = done_handling.$(OBJEXT) done_handling_OBJECTS = $(am_done_handling_OBJECTS) done_handling_LDADD = $(LDADD) done_handling_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_empty_rowsets_OBJECTS = empty_rowsets.$(OBJEXT) empty_rowsets_OBJECTS = $(am_empty_rowsets_OBJECTS) empty_rowsets_LDADD = $(LDADD) empty_rowsets_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_hang_OBJECTS = hang.$(OBJEXT) hang_OBJECTS = $(am_hang_OBJECTS) hang_LDADD = $(LDADD) hang_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_null_OBJECTS = null.$(OBJEXT) null_OBJECTS = $(am_null_OBJECTS) null_LDADD = $(LDADD) null_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_null2_OBJECTS = null2.$(OBJEXT) null2_OBJECTS = $(am_null2_OBJECTS) null2_LDADD = $(LDADD) null2_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_numeric_OBJECTS = numeric.$(OBJEXT) numeric_OBJECTS = $(am_numeric_OBJECTS) numeric_LDADD = $(LDADD) numeric_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_pending_OBJECTS = pending.$(OBJEXT) pending_OBJECTS = $(am_pending_OBJECTS) pending_LDADD = $(LDADD) pending_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_rpc_OBJECTS = rpc.$(OBJEXT) rpc_OBJECTS = $(am_rpc_OBJECTS) rpc_LDADD = $(LDADD) rpc_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_setnull_OBJECTS = setnull.$(OBJEXT) setnull_OBJECTS = $(am_setnull_OBJECTS) setnull_LDADD = $(LDADD) setnull_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_spid_OBJECTS = spid.$(OBJEXT) spid_OBJECTS = $(am_spid_OBJECTS) spid_LDADD = $(LDADD) spid_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_string_bind_OBJECTS = string_bind.$(OBJEXT) string_bind_OBJECTS = $(am_string_bind_OBJECTS) string_bind_LDADD = $(LDADD) string_bind_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0001_OBJECTS = t0001.$(OBJEXT) t0001_OBJECTS = $(am_t0001_OBJECTS) t0001_LDADD = $(LDADD) t0001_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0002_OBJECTS = t0002.$(OBJEXT) t0002_OBJECTS = $(am_t0002_OBJECTS) t0002_LDADD = $(LDADD) t0002_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0003_OBJECTS = t0003.$(OBJEXT) t0003_OBJECTS = $(am_t0003_OBJECTS) t0003_LDADD = $(LDADD) t0003_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0004_OBJECTS = t0004.$(OBJEXT) t0004_OBJECTS = $(am_t0004_OBJECTS) t0004_LDADD = $(LDADD) t0004_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0005_OBJECTS = t0005.$(OBJEXT) t0005_OBJECTS = $(am_t0005_OBJECTS) t0005_LDADD = $(LDADD) t0005_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0006_OBJECTS = t0006.$(OBJEXT) t0006_OBJECTS = $(am_t0006_OBJECTS) t0006_LDADD = $(LDADD) t0006_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0007_OBJECTS = t0007.$(OBJEXT) t0007_OBJECTS = $(am_t0007_OBJECTS) t0007_LDADD = $(LDADD) t0007_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0008_OBJECTS = t0008.$(OBJEXT) t0008_OBJECTS = $(am_t0008_OBJECTS) t0008_LDADD = $(LDADD) t0008_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0009_OBJECTS = t0009.$(OBJEXT) t0009_OBJECTS = $(am_t0009_OBJECTS) t0009_LDADD = $(LDADD) t0009_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0011_OBJECTS = t0011.$(OBJEXT) t0011_OBJECTS = $(am_t0011_OBJECTS) t0011_LDADD = $(LDADD) t0011_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0012_OBJECTS = t0012.$(OBJEXT) t0012_OBJECTS = $(am_t0012_OBJECTS) t0012_LDADD = $(LDADD) t0012_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0013_OBJECTS = t0013.$(OBJEXT) t0013_OBJECTS = $(am_t0013_OBJECTS) t0013_LDADD = $(LDADD) t0013_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0014_OBJECTS = t0014.$(OBJEXT) t0014_OBJECTS = $(am_t0014_OBJECTS) t0014_LDADD = $(LDADD) t0014_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0015_OBJECTS = t0015.$(OBJEXT) t0015_OBJECTS = $(am_t0015_OBJECTS) t0015_LDADD = $(LDADD) t0015_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0016_OBJECTS = t0016.$(OBJEXT) t0016_OBJECTS = $(am_t0016_OBJECTS) t0016_LDADD = $(LDADD) t0016_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0017_OBJECTS = t0017.$(OBJEXT) t0017_OBJECTS = $(am_t0017_OBJECTS) t0017_LDADD = $(LDADD) t0017_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0018_OBJECTS = t0018.$(OBJEXT) t0018_OBJECTS = $(am_t0018_OBJECTS) t0018_LDADD = $(LDADD) t0018_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0019_OBJECTS = t0019.$(OBJEXT) t0019_OBJECTS = $(am_t0019_OBJECTS) t0019_LDADD = $(LDADD) t0019_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0020_OBJECTS = t0020.$(OBJEXT) t0020_OBJECTS = $(am_t0020_OBJECTS) t0020_LDADD = $(LDADD) t0020_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0022_OBJECTS = t0022.$(OBJEXT) t0022_OBJECTS = $(am_t0022_OBJECTS) t0022_LDADD = $(LDADD) t0022_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0023_OBJECTS = t0023.$(OBJEXT) t0023_OBJECTS = $(am_t0023_OBJECTS) t0023_LDADD = $(LDADD) t0023_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_text_buffer_OBJECTS = text_buffer.$(OBJEXT) text_buffer_OBJECTS = $(am_text_buffer_OBJECTS) text_buffer_LDADD = $(LDADD) text_buffer_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_thread_OBJECTS = thread.$(OBJEXT) thread_OBJECTS = $(am_thread_OBJECTS) thread_LDADD = $(LDADD) thread_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_timeout_OBJECTS = timeout.$(OBJEXT) timeout_OBJECTS = $(am_timeout_OBJECTS) timeout_LDADD = $(LDADD) timeout_DEPENDENCIES = libcommon.a ../libsybdb.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/batch_stmt_ins_sel.Po \ ./$(DEPDIR)/batch_stmt_ins_upd.Po ./$(DEPDIR)/bcp.Po \ ./$(DEPDIR)/bcp2.Po ./$(DEPDIR)/bcp_getl.Po \ ./$(DEPDIR)/cancel.Po ./$(DEPDIR)/canquery.Po \ ./$(DEPDIR)/colinfo.Po ./$(DEPDIR)/common.Po \ ./$(DEPDIR)/dbmorecmds.Po ./$(DEPDIR)/dbsafestr.Po \ ./$(DEPDIR)/done_handling.Po ./$(DEPDIR)/empty_rowsets.Po \ ./$(DEPDIR)/hang.Po ./$(DEPDIR)/null.Po ./$(DEPDIR)/null2.Po \ ./$(DEPDIR)/numeric.Po ./$(DEPDIR)/pending.Po \ ./$(DEPDIR)/rpc.Po ./$(DEPDIR)/setnull.Po ./$(DEPDIR)/spid.Po \ ./$(DEPDIR)/string_bind.Po ./$(DEPDIR)/t0001.Po \ ./$(DEPDIR)/t0002.Po ./$(DEPDIR)/t0003.Po ./$(DEPDIR)/t0004.Po \ ./$(DEPDIR)/t0005.Po ./$(DEPDIR)/t0006.Po ./$(DEPDIR)/t0007.Po \ ./$(DEPDIR)/t0008.Po ./$(DEPDIR)/t0009.Po ./$(DEPDIR)/t0011.Po \ ./$(DEPDIR)/t0012.Po ./$(DEPDIR)/t0013.Po ./$(DEPDIR)/t0014.Po \ ./$(DEPDIR)/t0015.Po ./$(DEPDIR)/t0016.Po ./$(DEPDIR)/t0017.Po \ ./$(DEPDIR)/t0018.Po ./$(DEPDIR)/t0019.Po ./$(DEPDIR)/t0020.Po \ ./$(DEPDIR)/t0022.Po ./$(DEPDIR)/t0023.Po \ ./$(DEPDIR)/text_buffer.Po ./$(DEPDIR)/thread.Po \ ./$(DEPDIR)/timeout.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcommon_a_SOURCES) $(batch_stmt_ins_sel_SOURCES) \ $(batch_stmt_ins_upd_SOURCES) $(bcp_SOURCES) $(bcp2_SOURCES) \ $(bcp_getl_SOURCES) $(cancel_SOURCES) $(canquery_SOURCES) \ $(colinfo_SOURCES) $(dbmorecmds_SOURCES) $(dbsafestr_SOURCES) \ $(done_handling_SOURCES) $(empty_rowsets_SOURCES) \ $(hang_SOURCES) $(null_SOURCES) $(null2_SOURCES) \ $(numeric_SOURCES) $(pending_SOURCES) $(rpc_SOURCES) \ $(setnull_SOURCES) $(spid_SOURCES) $(string_bind_SOURCES) \ $(t0001_SOURCES) $(t0002_SOURCES) $(t0003_SOURCES) \ $(t0004_SOURCES) $(t0005_SOURCES) $(t0006_SOURCES) \ $(t0007_SOURCES) $(t0008_SOURCES) $(t0009_SOURCES) \ $(t0011_SOURCES) $(t0012_SOURCES) $(t0013_SOURCES) \ $(t0014_SOURCES) $(t0015_SOURCES) $(t0016_SOURCES) \ $(t0017_SOURCES) $(t0018_SOURCES) $(t0019_SOURCES) \ $(t0020_SOURCES) $(t0022_SOURCES) $(t0023_SOURCES) \ $(text_buffer_SOURCES) $(thread_SOURCES) $(timeout_SOURCES) DIST_SOURCES = $(libcommon_a_SOURCES) $(batch_stmt_ins_sel_SOURCES) \ $(batch_stmt_ins_upd_SOURCES) $(bcp_SOURCES) $(bcp2_SOURCES) \ $(bcp_getl_SOURCES) $(cancel_SOURCES) $(canquery_SOURCES) \ $(colinfo_SOURCES) $(dbmorecmds_SOURCES) $(dbsafestr_SOURCES) \ $(done_handling_SOURCES) $(empty_rowsets_SOURCES) \ $(hang_SOURCES) $(null_SOURCES) $(null2_SOURCES) \ $(numeric_SOURCES) $(pending_SOURCES) $(rpc_SOURCES) \ $(setnull_SOURCES) $(spid_SOURCES) $(string_bind_SOURCES) \ $(t0001_SOURCES) $(t0002_SOURCES) $(t0003_SOURCES) \ $(t0004_SOURCES) $(t0005_SOURCES) $(t0006_SOURCES) \ $(t0007_SOURCES) $(t0008_SOURCES) $(t0009_SOURCES) \ $(t0011_SOURCES) $(t0012_SOURCES) $(t0013_SOURCES) \ $(t0014_SOURCES) $(t0015_SOURCES) $(t0016_SOURCES) \ $(t0017_SOURCES) $(t0018_SOURCES) $(t0019_SOURCES) \ $(t0020_SOURCES) $(t0022_SOURCES) $(t0023_SOURCES) \ $(text_buffer_SOURCES) $(thread_SOURCES) $(timeout_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/test-driver README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TESTS = \ t0001$(EXEEXT) \ t0002$(EXEEXT) \ t0003$(EXEEXT) \ t0004$(EXEEXT) \ t0005$(EXEEXT) \ t0006$(EXEEXT) \ t0007$(EXEEXT) \ t0008$(EXEEXT) \ t0009$(EXEEXT) \ t0011$(EXEEXT) \ t0012$(EXEEXT) \ t0013$(EXEEXT) \ t0014$(EXEEXT) \ t0015$(EXEEXT) \ t0016$(EXEEXT) \ t0017$(EXEEXT) \ t0018$(EXEEXT) \ t0019$(EXEEXT) \ t0020$(EXEEXT) \ dbsafestr$(EXEEXT) \ t0022$(EXEEXT) \ t0023$(EXEEXT) \ rpc$(EXEEXT) \ dbmorecmds$(EXEEXT) \ bcp$(EXEEXT) \ thread$(EXEEXT) \ text_buffer$(EXEEXT) \ done_handling$(EXEEXT) \ timeout$(EXEEXT) \ hang$(EXEEXT) \ null$(EXEEXT) \ null2$(EXEEXT) \ setnull$(EXEEXT) \ numeric$(EXEEXT) \ pending$(EXEEXT) \ cancel$(EXEEXT) \ spid$(EXEEXT) \ canquery$(EXEEXT) \ batch_stmt_ins_sel$(EXEEXT) \ batch_stmt_ins_upd$(EXEEXT) \ bcp_getl$(EXEEXT) \ empty_rowsets$(EXEEXT) \ string_bind$(EXEEXT) \ colinfo$(EXEEXT) \ bcp2$(EXEEXT) check_PROGRAMS = $(TESTS) t0001_SOURCES = t0001.c t0001.sql t0002_SOURCES = t0002.c t0002.sql t0003_SOURCES = t0003.c t0003.sql t0004_SOURCES = t0004.c t0004.sql t0005_SOURCES = t0005.c t0005.sql t0006_SOURCES = t0006.c t0006.sql t0007_SOURCES = t0007.c t0007.sql t0008_SOURCES = t0008.c t0009_SOURCES = t0009.c t0009.sql t0011_SOURCES = t0011.c t0011.sql t0012_SOURCES = t0012.c t0012.sql t0013_SOURCES = t0013.c t0013.sql data.bin t0014_SOURCES = t0014.c t0014.sql data.bin t0015_SOURCES = t0015.c t0015.sql t0016_SOURCES = t0016.c \ t0016.sql t0016_1.sql t0016_2.sql t0016_3.sql \ t0016_4.sql t0016_5.sql t0016_6.sql t0016_7.sql \ t0016_8.sql t0016_9.sql t0016_10.sql t0016_11.sql \ t0016.in t0016_1.in t0016_2.in t0016_3.in \ t0016_4.in t0016_5.in t0016_6.in t0016_7.in \ t0016_8.in t0016_9.in t0016_10.in t0016_11.in t0017_SOURCES = t0017.c t0017.sql t0017.in t0017.in.be t0018_SOURCES = t0018.c t0018.sql t0019_SOURCES = t0019.c t0020_SOURCES = t0020.c t0020.sql dbsafestr_SOURCES = dbsafestr.c t0022_SOURCES = t0022.c t0022.sql t0023_SOURCES = t0023.c t0023.sql rpc_SOURCES = rpc.c rpc.sql dbmorecmds_SOURCES = dbmorecmds.c dbmorecmds.sql bcp_SOURCES = bcp.c bcp.h bcp.sql thread_SOURCES = thread.c bcp.h text_buffer_SOURCES = text_buffer.c text_buffer.sql done_handling_SOURCES = done_handling.c done_handling.sql timeout_SOURCES = timeout.c timeout.sql hang_SOURCES = hang.c null_SOURCES = null.c null2_SOURCES = null2.c setnull_SOURCES = setnull.c numeric_SOURCES = numeric.c numeric.sql numeric_2.sql pending_SOURCES = pending.c pending.sql cancel_SOURCES = cancel.c cancel.sql spid_SOURCES = spid.c spid.sql canquery_SOURCES = canquery.c canquery.sql batch_stmt_ins_sel_SOURCES = batch_stmt_ins_sel.c batch_stmt_ins_sel.sql batch_stmt_ins_upd_SOURCES = batch_stmt_ins_upd.c batch_stmt_ins_upd.sql bcp_getl_SOURCES = bcp_getl.c empty_rowsets_SOURCES = empty_rowsets.c empty_rowsets.sql string_bind_SOURCES = string_bind.c colinfo_SOURCES = colinfo.c colinfo.sql bcp2_SOURCES = bcp2.c bcp2.sql noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h AM_CPPFLAGS = -DFREETDS_TOPDIR=\"$(top_srcdir)\" -I$(top_srcdir)/include @MINGW32_FALSE@AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" @MINGW32_TRUE@AM_LDFLAGS = -no-fast-install LDADD = libcommon.a ../libsybdb.la ../../replacements/libreplacements.la $(LTLIBICONV) EXTRA_DIST = CMakeLists.txt CLEANFILES = tdsdump.out t0013.out t0014.out t0016.out \ t0016.err t0017.err t0017.out all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/dblib/unittests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/dblib/unittests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) $(EXTRA_libcommon_a_DEPENDENCIES) $(AM_V_at)-rm -f libcommon.a $(AM_V_AR)$(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) $(AM_V_at)$(RANLIB) libcommon.a batch_stmt_ins_sel$(EXEEXT): $(batch_stmt_ins_sel_OBJECTS) $(batch_stmt_ins_sel_DEPENDENCIES) $(EXTRA_batch_stmt_ins_sel_DEPENDENCIES) @rm -f batch_stmt_ins_sel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(batch_stmt_ins_sel_OBJECTS) $(batch_stmt_ins_sel_LDADD) $(LIBS) batch_stmt_ins_upd$(EXEEXT): $(batch_stmt_ins_upd_OBJECTS) $(batch_stmt_ins_upd_DEPENDENCIES) $(EXTRA_batch_stmt_ins_upd_DEPENDENCIES) @rm -f batch_stmt_ins_upd$(EXEEXT) $(AM_V_CCLD)$(LINK) $(batch_stmt_ins_upd_OBJECTS) $(batch_stmt_ins_upd_LDADD) $(LIBS) bcp$(EXEEXT): $(bcp_OBJECTS) $(bcp_DEPENDENCIES) $(EXTRA_bcp_DEPENDENCIES) @rm -f bcp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(bcp_OBJECTS) $(bcp_LDADD) $(LIBS) bcp2$(EXEEXT): $(bcp2_OBJECTS) $(bcp2_DEPENDENCIES) $(EXTRA_bcp2_DEPENDENCIES) @rm -f bcp2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(bcp2_OBJECTS) $(bcp2_LDADD) $(LIBS) bcp_getl$(EXEEXT): $(bcp_getl_OBJECTS) $(bcp_getl_DEPENDENCIES) $(EXTRA_bcp_getl_DEPENDENCIES) @rm -f bcp_getl$(EXEEXT) $(AM_V_CCLD)$(LINK) $(bcp_getl_OBJECTS) $(bcp_getl_LDADD) $(LIBS) cancel$(EXEEXT): $(cancel_OBJECTS) $(cancel_DEPENDENCIES) $(EXTRA_cancel_DEPENDENCIES) @rm -f cancel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cancel_OBJECTS) $(cancel_LDADD) $(LIBS) canquery$(EXEEXT): $(canquery_OBJECTS) $(canquery_DEPENDENCIES) $(EXTRA_canquery_DEPENDENCIES) @rm -f canquery$(EXEEXT) $(AM_V_CCLD)$(LINK) $(canquery_OBJECTS) $(canquery_LDADD) $(LIBS) colinfo$(EXEEXT): $(colinfo_OBJECTS) $(colinfo_DEPENDENCIES) $(EXTRA_colinfo_DEPENDENCIES) @rm -f colinfo$(EXEEXT) $(AM_V_CCLD)$(LINK) $(colinfo_OBJECTS) $(colinfo_LDADD) $(LIBS) dbmorecmds$(EXEEXT): $(dbmorecmds_OBJECTS) $(dbmorecmds_DEPENDENCIES) $(EXTRA_dbmorecmds_DEPENDENCIES) @rm -f dbmorecmds$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dbmorecmds_OBJECTS) $(dbmorecmds_LDADD) $(LIBS) dbsafestr$(EXEEXT): $(dbsafestr_OBJECTS) $(dbsafestr_DEPENDENCIES) $(EXTRA_dbsafestr_DEPENDENCIES) @rm -f dbsafestr$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dbsafestr_OBJECTS) $(dbsafestr_LDADD) $(LIBS) done_handling$(EXEEXT): $(done_handling_OBJECTS) $(done_handling_DEPENDENCIES) $(EXTRA_done_handling_DEPENDENCIES) @rm -f done_handling$(EXEEXT) $(AM_V_CCLD)$(LINK) $(done_handling_OBJECTS) $(done_handling_LDADD) $(LIBS) empty_rowsets$(EXEEXT): $(empty_rowsets_OBJECTS) $(empty_rowsets_DEPENDENCIES) $(EXTRA_empty_rowsets_DEPENDENCIES) @rm -f empty_rowsets$(EXEEXT) $(AM_V_CCLD)$(LINK) $(empty_rowsets_OBJECTS) $(empty_rowsets_LDADD) $(LIBS) hang$(EXEEXT): $(hang_OBJECTS) $(hang_DEPENDENCIES) $(EXTRA_hang_DEPENDENCIES) @rm -f hang$(EXEEXT) $(AM_V_CCLD)$(LINK) $(hang_OBJECTS) $(hang_LDADD) $(LIBS) null$(EXEEXT): $(null_OBJECTS) $(null_DEPENDENCIES) $(EXTRA_null_DEPENDENCIES) @rm -f null$(EXEEXT) $(AM_V_CCLD)$(LINK) $(null_OBJECTS) $(null_LDADD) $(LIBS) null2$(EXEEXT): $(null2_OBJECTS) $(null2_DEPENDENCIES) $(EXTRA_null2_DEPENDENCIES) @rm -f null2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(null2_OBJECTS) $(null2_LDADD) $(LIBS) numeric$(EXEEXT): $(numeric_OBJECTS) $(numeric_DEPENDENCIES) $(EXTRA_numeric_DEPENDENCIES) @rm -f numeric$(EXEEXT) $(AM_V_CCLD)$(LINK) $(numeric_OBJECTS) $(numeric_LDADD) $(LIBS) pending$(EXEEXT): $(pending_OBJECTS) $(pending_DEPENDENCIES) $(EXTRA_pending_DEPENDENCIES) @rm -f pending$(EXEEXT) $(AM_V_CCLD)$(LINK) $(pending_OBJECTS) $(pending_LDADD) $(LIBS) rpc$(EXEEXT): $(rpc_OBJECTS) $(rpc_DEPENDENCIES) $(EXTRA_rpc_DEPENDENCIES) @rm -f rpc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rpc_OBJECTS) $(rpc_LDADD) $(LIBS) setnull$(EXEEXT): $(setnull_OBJECTS) $(setnull_DEPENDENCIES) $(EXTRA_setnull_DEPENDENCIES) @rm -f setnull$(EXEEXT) $(AM_V_CCLD)$(LINK) $(setnull_OBJECTS) $(setnull_LDADD) $(LIBS) spid$(EXEEXT): $(spid_OBJECTS) $(spid_DEPENDENCIES) $(EXTRA_spid_DEPENDENCIES) @rm -f spid$(EXEEXT) $(AM_V_CCLD)$(LINK) $(spid_OBJECTS) $(spid_LDADD) $(LIBS) string_bind$(EXEEXT): $(string_bind_OBJECTS) $(string_bind_DEPENDENCIES) $(EXTRA_string_bind_DEPENDENCIES) @rm -f string_bind$(EXEEXT) $(AM_V_CCLD)$(LINK) $(string_bind_OBJECTS) $(string_bind_LDADD) $(LIBS) t0001$(EXEEXT): $(t0001_OBJECTS) $(t0001_DEPENDENCIES) $(EXTRA_t0001_DEPENDENCIES) @rm -f t0001$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0001_OBJECTS) $(t0001_LDADD) $(LIBS) t0002$(EXEEXT): $(t0002_OBJECTS) $(t0002_DEPENDENCIES) $(EXTRA_t0002_DEPENDENCIES) @rm -f t0002$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0002_OBJECTS) $(t0002_LDADD) $(LIBS) t0003$(EXEEXT): $(t0003_OBJECTS) $(t0003_DEPENDENCIES) $(EXTRA_t0003_DEPENDENCIES) @rm -f t0003$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0003_OBJECTS) $(t0003_LDADD) $(LIBS) t0004$(EXEEXT): $(t0004_OBJECTS) $(t0004_DEPENDENCIES) $(EXTRA_t0004_DEPENDENCIES) @rm -f t0004$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0004_OBJECTS) $(t0004_LDADD) $(LIBS) t0005$(EXEEXT): $(t0005_OBJECTS) $(t0005_DEPENDENCIES) $(EXTRA_t0005_DEPENDENCIES) @rm -f t0005$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0005_OBJECTS) $(t0005_LDADD) $(LIBS) t0006$(EXEEXT): $(t0006_OBJECTS) $(t0006_DEPENDENCIES) $(EXTRA_t0006_DEPENDENCIES) @rm -f t0006$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0006_OBJECTS) $(t0006_LDADD) $(LIBS) t0007$(EXEEXT): $(t0007_OBJECTS) $(t0007_DEPENDENCIES) $(EXTRA_t0007_DEPENDENCIES) @rm -f t0007$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0007_OBJECTS) $(t0007_LDADD) $(LIBS) t0008$(EXEEXT): $(t0008_OBJECTS) $(t0008_DEPENDENCIES) $(EXTRA_t0008_DEPENDENCIES) @rm -f t0008$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0008_OBJECTS) $(t0008_LDADD) $(LIBS) t0009$(EXEEXT): $(t0009_OBJECTS) $(t0009_DEPENDENCIES) $(EXTRA_t0009_DEPENDENCIES) @rm -f t0009$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0009_OBJECTS) $(t0009_LDADD) $(LIBS) t0011$(EXEEXT): $(t0011_OBJECTS) $(t0011_DEPENDENCIES) $(EXTRA_t0011_DEPENDENCIES) @rm -f t0011$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0011_OBJECTS) $(t0011_LDADD) $(LIBS) t0012$(EXEEXT): $(t0012_OBJECTS) $(t0012_DEPENDENCIES) $(EXTRA_t0012_DEPENDENCIES) @rm -f t0012$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0012_OBJECTS) $(t0012_LDADD) $(LIBS) t0013$(EXEEXT): $(t0013_OBJECTS) $(t0013_DEPENDENCIES) $(EXTRA_t0013_DEPENDENCIES) @rm -f t0013$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0013_OBJECTS) $(t0013_LDADD) $(LIBS) t0014$(EXEEXT): $(t0014_OBJECTS) $(t0014_DEPENDENCIES) $(EXTRA_t0014_DEPENDENCIES) @rm -f t0014$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0014_OBJECTS) $(t0014_LDADD) $(LIBS) t0015$(EXEEXT): $(t0015_OBJECTS) $(t0015_DEPENDENCIES) $(EXTRA_t0015_DEPENDENCIES) @rm -f t0015$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0015_OBJECTS) $(t0015_LDADD) $(LIBS) t0016$(EXEEXT): $(t0016_OBJECTS) $(t0016_DEPENDENCIES) $(EXTRA_t0016_DEPENDENCIES) @rm -f t0016$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0016_OBJECTS) $(t0016_LDADD) $(LIBS) t0017$(EXEEXT): $(t0017_OBJECTS) $(t0017_DEPENDENCIES) $(EXTRA_t0017_DEPENDENCIES) @rm -f t0017$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0017_OBJECTS) $(t0017_LDADD) $(LIBS) t0018$(EXEEXT): $(t0018_OBJECTS) $(t0018_DEPENDENCIES) $(EXTRA_t0018_DEPENDENCIES) @rm -f t0018$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0018_OBJECTS) $(t0018_LDADD) $(LIBS) t0019$(EXEEXT): $(t0019_OBJECTS) $(t0019_DEPENDENCIES) $(EXTRA_t0019_DEPENDENCIES) @rm -f t0019$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0019_OBJECTS) $(t0019_LDADD) $(LIBS) t0020$(EXEEXT): $(t0020_OBJECTS) $(t0020_DEPENDENCIES) $(EXTRA_t0020_DEPENDENCIES) @rm -f t0020$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0020_OBJECTS) $(t0020_LDADD) $(LIBS) t0022$(EXEEXT): $(t0022_OBJECTS) $(t0022_DEPENDENCIES) $(EXTRA_t0022_DEPENDENCIES) @rm -f t0022$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0022_OBJECTS) $(t0022_LDADD) $(LIBS) t0023$(EXEEXT): $(t0023_OBJECTS) $(t0023_DEPENDENCIES) $(EXTRA_t0023_DEPENDENCIES) @rm -f t0023$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0023_OBJECTS) $(t0023_LDADD) $(LIBS) text_buffer$(EXEEXT): $(text_buffer_OBJECTS) $(text_buffer_DEPENDENCIES) $(EXTRA_text_buffer_DEPENDENCIES) @rm -f text_buffer$(EXEEXT) $(AM_V_CCLD)$(LINK) $(text_buffer_OBJECTS) $(text_buffer_LDADD) $(LIBS) thread$(EXEEXT): $(thread_OBJECTS) $(thread_DEPENDENCIES) $(EXTRA_thread_DEPENDENCIES) @rm -f thread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(thread_OBJECTS) $(thread_LDADD) $(LIBS) timeout$(EXEEXT): $(timeout_OBJECTS) $(timeout_DEPENDENCIES) $(EXTRA_timeout_DEPENDENCIES) @rm -f timeout$(EXEEXT) $(AM_V_CCLD)$(LINK) $(timeout_OBJECTS) $(timeout_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/batch_stmt_ins_sel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/batch_stmt_ins_upd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcp2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcp_getl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cancel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canquery.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/colinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbmorecmds.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbsafestr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/done_handling.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/empty_rowsets.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hang.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/numeric.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pending.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setnull.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string_bind.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0001.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0002.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0003.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0004.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0005.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0006.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0007.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0008.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0009.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0011.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0012.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0013.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0014.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0015.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0016.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0017.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0018.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0019.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0020.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0022.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0023.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/text_buffer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeout.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? t0001.log: t0001$(EXEEXT) @p='t0001$(EXEEXT)'; \ b='t0001'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0002.log: t0002$(EXEEXT) @p='t0002$(EXEEXT)'; \ b='t0002'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0003.log: t0003$(EXEEXT) @p='t0003$(EXEEXT)'; \ b='t0003'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0004.log: t0004$(EXEEXT) @p='t0004$(EXEEXT)'; \ b='t0004'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0005.log: t0005$(EXEEXT) @p='t0005$(EXEEXT)'; \ b='t0005'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0006.log: t0006$(EXEEXT) @p='t0006$(EXEEXT)'; \ b='t0006'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0007.log: t0007$(EXEEXT) @p='t0007$(EXEEXT)'; \ b='t0007'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0008.log: t0008$(EXEEXT) @p='t0008$(EXEEXT)'; \ b='t0008'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0009.log: t0009$(EXEEXT) @p='t0009$(EXEEXT)'; \ b='t0009'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0011.log: t0011$(EXEEXT) @p='t0011$(EXEEXT)'; \ b='t0011'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0012.log: t0012$(EXEEXT) @p='t0012$(EXEEXT)'; \ b='t0012'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0013.log: t0013$(EXEEXT) @p='t0013$(EXEEXT)'; \ b='t0013'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0014.log: t0014$(EXEEXT) @p='t0014$(EXEEXT)'; \ b='t0014'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0015.log: t0015$(EXEEXT) @p='t0015$(EXEEXT)'; \ b='t0015'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0016.log: t0016$(EXEEXT) @p='t0016$(EXEEXT)'; \ b='t0016'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0017.log: t0017$(EXEEXT) @p='t0017$(EXEEXT)'; \ b='t0017'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0018.log: t0018$(EXEEXT) @p='t0018$(EXEEXT)'; \ b='t0018'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0019.log: t0019$(EXEEXT) @p='t0019$(EXEEXT)'; \ b='t0019'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0020.log: t0020$(EXEEXT) @p='t0020$(EXEEXT)'; \ b='t0020'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dbsafestr.log: dbsafestr$(EXEEXT) @p='dbsafestr$(EXEEXT)'; \ b='dbsafestr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0022.log: t0022$(EXEEXT) @p='t0022$(EXEEXT)'; \ b='t0022'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0023.log: t0023$(EXEEXT) @p='t0023$(EXEEXT)'; \ b='t0023'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) rpc.log: rpc$(EXEEXT) @p='rpc$(EXEEXT)'; \ b='rpc'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dbmorecmds.log: dbmorecmds$(EXEEXT) @p='dbmorecmds$(EXEEXT)'; \ b='dbmorecmds'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bcp.log: bcp$(EXEEXT) @p='bcp$(EXEEXT)'; \ b='bcp'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) thread.log: thread$(EXEEXT) @p='thread$(EXEEXT)'; \ b='thread'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) text_buffer.log: text_buffer$(EXEEXT) @p='text_buffer$(EXEEXT)'; \ b='text_buffer'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) done_handling.log: done_handling$(EXEEXT) @p='done_handling$(EXEEXT)'; \ b='done_handling'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) timeout.log: timeout$(EXEEXT) @p='timeout$(EXEEXT)'; \ b='timeout'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) hang.log: hang$(EXEEXT) @p='hang$(EXEEXT)'; \ b='hang'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) null.log: null$(EXEEXT) @p='null$(EXEEXT)'; \ b='null'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) null2.log: null2$(EXEEXT) @p='null2$(EXEEXT)'; \ b='null2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) setnull.log: setnull$(EXEEXT) @p='setnull$(EXEEXT)'; \ b='setnull'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) numeric.log: numeric$(EXEEXT) @p='numeric$(EXEEXT)'; \ b='numeric'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) pending.log: pending$(EXEEXT) @p='pending$(EXEEXT)'; \ b='pending'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cancel.log: cancel$(EXEEXT) @p='cancel$(EXEEXT)'; \ b='cancel'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) spid.log: spid$(EXEEXT) @p='spid$(EXEEXT)'; \ b='spid'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) canquery.log: canquery$(EXEEXT) @p='canquery$(EXEEXT)'; \ b='canquery'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) batch_stmt_ins_sel.log: batch_stmt_ins_sel$(EXEEXT) @p='batch_stmt_ins_sel$(EXEEXT)'; \ b='batch_stmt_ins_sel'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) batch_stmt_ins_upd.log: batch_stmt_ins_upd$(EXEEXT) @p='batch_stmt_ins_upd$(EXEEXT)'; \ b='batch_stmt_ins_upd'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bcp_getl.log: bcp_getl$(EXEEXT) @p='bcp_getl$(EXEEXT)'; \ b='bcp_getl'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) empty_rowsets.log: empty_rowsets$(EXEEXT) @p='empty_rowsets$(EXEEXT)'; \ b='empty_rowsets'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) string_bind.log: string_bind$(EXEEXT) @p='string_bind$(EXEEXT)'; \ b='string_bind'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) colinfo.log: colinfo$(EXEEXT) @p='colinfo$(EXEEXT)'; \ b='colinfo'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bcp2.log: bcp2$(EXEEXT) @p='bcp2$(EXEEXT)'; \ b='bcp2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/batch_stmt_ins_sel.Po -rm -f ./$(DEPDIR)/batch_stmt_ins_upd.Po -rm -f ./$(DEPDIR)/bcp.Po -rm -f ./$(DEPDIR)/bcp2.Po -rm -f ./$(DEPDIR)/bcp_getl.Po -rm -f ./$(DEPDIR)/cancel.Po -rm -f ./$(DEPDIR)/canquery.Po -rm -f ./$(DEPDIR)/colinfo.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/dbmorecmds.Po -rm -f ./$(DEPDIR)/dbsafestr.Po -rm -f ./$(DEPDIR)/done_handling.Po -rm -f ./$(DEPDIR)/empty_rowsets.Po -rm -f ./$(DEPDIR)/hang.Po -rm -f ./$(DEPDIR)/null.Po -rm -f ./$(DEPDIR)/null2.Po -rm -f ./$(DEPDIR)/numeric.Po -rm -f ./$(DEPDIR)/pending.Po -rm -f ./$(DEPDIR)/rpc.Po -rm -f ./$(DEPDIR)/setnull.Po -rm -f ./$(DEPDIR)/spid.Po -rm -f ./$(DEPDIR)/string_bind.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/t0004.Po -rm -f ./$(DEPDIR)/t0005.Po -rm -f ./$(DEPDIR)/t0006.Po -rm -f ./$(DEPDIR)/t0007.Po -rm -f ./$(DEPDIR)/t0008.Po -rm -f ./$(DEPDIR)/t0009.Po -rm -f ./$(DEPDIR)/t0011.Po -rm -f ./$(DEPDIR)/t0012.Po -rm -f ./$(DEPDIR)/t0013.Po -rm -f ./$(DEPDIR)/t0014.Po -rm -f ./$(DEPDIR)/t0015.Po -rm -f ./$(DEPDIR)/t0016.Po -rm -f ./$(DEPDIR)/t0017.Po -rm -f ./$(DEPDIR)/t0018.Po -rm -f ./$(DEPDIR)/t0019.Po -rm -f ./$(DEPDIR)/t0020.Po -rm -f ./$(DEPDIR)/t0022.Po -rm -f ./$(DEPDIR)/t0023.Po -rm -f ./$(DEPDIR)/text_buffer.Po -rm -f ./$(DEPDIR)/thread.Po -rm -f ./$(DEPDIR)/timeout.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/batch_stmt_ins_sel.Po -rm -f ./$(DEPDIR)/batch_stmt_ins_upd.Po -rm -f ./$(DEPDIR)/bcp.Po -rm -f ./$(DEPDIR)/bcp2.Po -rm -f ./$(DEPDIR)/bcp_getl.Po -rm -f ./$(DEPDIR)/cancel.Po -rm -f ./$(DEPDIR)/canquery.Po -rm -f ./$(DEPDIR)/colinfo.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/dbmorecmds.Po -rm -f ./$(DEPDIR)/dbsafestr.Po -rm -f ./$(DEPDIR)/done_handling.Po -rm -f ./$(DEPDIR)/empty_rowsets.Po -rm -f ./$(DEPDIR)/hang.Po -rm -f ./$(DEPDIR)/null.Po -rm -f ./$(DEPDIR)/null2.Po -rm -f ./$(DEPDIR)/numeric.Po -rm -f ./$(DEPDIR)/pending.Po -rm -f ./$(DEPDIR)/rpc.Po -rm -f ./$(DEPDIR)/setnull.Po -rm -f ./$(DEPDIR)/spid.Po -rm -f ./$(DEPDIR)/string_bind.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/t0004.Po -rm -f ./$(DEPDIR)/t0005.Po -rm -f ./$(DEPDIR)/t0006.Po -rm -f ./$(DEPDIR)/t0007.Po -rm -f ./$(DEPDIR)/t0008.Po -rm -f ./$(DEPDIR)/t0009.Po -rm -f ./$(DEPDIR)/t0011.Po -rm -f ./$(DEPDIR)/t0012.Po -rm -f ./$(DEPDIR)/t0013.Po -rm -f ./$(DEPDIR)/t0014.Po -rm -f ./$(DEPDIR)/t0015.Po -rm -f ./$(DEPDIR)/t0016.Po -rm -f ./$(DEPDIR)/t0017.Po -rm -f ./$(DEPDIR)/t0018.Po -rm -f ./$(DEPDIR)/t0019.Po -rm -f ./$(DEPDIR)/t0020.Po -rm -f ./$(DEPDIR)/t0022.Po -rm -f ./$(DEPDIR)/t0023.Po -rm -f ./$(DEPDIR)/text_buffer.Po -rm -f ./$(DEPDIR)/thread.Po -rm -f ./$(DEPDIR)/timeout.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am recheck tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/dblib/unittests/README000644 025423 025423 00000001327 14056414221 021372 0ustar00fredianofrediano000000 000000 The programs in this directory test the db-lib routines. Tests that db-lib passes print "dblib okay for t000X.c" as the last line of output and exit with a status of 0. If the test does not print that message for the last line of output it means that db-lib failed that test. Some of the tests are designed to dump core if an error is detected. This is to assist with post-mortem debugging of the dblib routines. Run all tests with 'make check'. The test programs read the 'PWD' file in the root of the source tree to determine which server to run the tests on and which account to login as. You will want to modify PWD accordingly. All unit tests are expected to pass on all servers and all operating systems. freetds-1.3.6/src/dblib/unittests/common.c000644 025423 025423 00000024652 14056414271 022161 0ustar00fredianofrediano000000 000000 #include "common.h" #if HAVE_UNISTD_H #include #endif #if HAVE_LIBGEN_H #include #endif /* HAVE_LIBGEN_H */ #if HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ #include #include #if HAVE_SYS_RESOURCE_H #include #endif /* HAVE_SYS_RESOURCE_H */ #include #if !defined(PATH_MAX) #define PATH_MAX 256 #endif char USER[512]; char SERVER[512]; char PASSWORD[512]; char DATABASE[512]; static char sql_file[PATH_MAX]; static FILE* input_file = NULL; static char *ARGV0 = NULL; static char *ARGV0B = NULL; static char *DIRNAME = NULL; static const char *BASENAME = NULL; #if HAVE_MALLOC_OPTIONS extern const char *malloc_options; #endif /* HAVE_MALLOC_OPTIONS */ void set_malloc_options(void) { #if HAVE_MALLOC_OPTIONS /* * Options for malloc * A- all warnings are fatal * J- init memory to 0xD0 * R- always move memory block on a realloc */ malloc_options = "AJR"; #endif /* HAVE_MALLOC_OPTIONS */ } #if defined(__MINGW32__) || defined(_MSC_VER) static char * tds_dirname(char* path) { char *p, *p2; for (p = path + strlen(path); --p > path && (*p == '/' || *p == '\\');) *p = '\0'; p = strrchr(path, '/'); if (!p) p = path; p2 = strrchr(p, '\\'); if (p2) p = p2; if (p == path) { if (*p == '/' || *p == '\\') return "\\"; return "."; } *p = 0; return path; } #define dirname tds_dirname #endif static bool free_file_registered = false; static void free_file(void) { if (input_file) { fclose(input_file); input_file = NULL; } if (ARGV0) { DIRNAME = NULL; BASENAME = NULL; free(ARGV0); ARGV0 = NULL; free(ARGV0B); ARGV0B = NULL; } } int read_login_info(int argc, char **argv) { int len; FILE *in = NULL; #if !defined(__MINGW32__) && !defined(_MSC_VER) int ch; #endif char *s1; char filename[PATH_MAX]; static const char *PWD = "../../../PWD"; struct { char *username, *password, *servername, *database; char fverbose; } options; #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) #define MAX_STACK (8*1024*1024) struct rlimit rlim; if (!getrlimit(RLIMIT_STACK, &rlim) && (rlim.rlim_cur == RLIM_INFINITY || rlim.rlim_cur > MAX_STACK)) { rlim.rlim_cur = MAX_STACK; setrlimit(RLIMIT_STACK, &rlim); } #endif setbuf(stdout, NULL); setbuf(stderr, NULL); free(ARGV0); free(ARGV0B); #ifdef __VMS { /* basename expects unix format */ s1 = strrchr(argv[0], ';'); /* trim version; extension trimmed later */ if (s1) *s1 = 0; const char *unixspec = decc$translate_vms(argv[0]); ARGV0 = strdup(unixspec); } #else ARGV0 = strdup(argv[0]); #endif ARGV0B = strdup(ARGV0); BASENAME = basename(ARGV0B); #if defined(_WIN32) || defined(__VMS) s1 = strrchr(BASENAME, '.'); if (s1) *s1 = 0; #endif DIRNAME = dirname(ARGV0); memset(&options, 0, sizeof(options)); #if !defined(__MINGW32__) && !defined(_MSC_VER) /* process command line options (handy for manual testing) */ while ((ch = getopt(argc, (char**)argv, "U:P:S:D:f:v")) != -1) { switch (ch) { case 'U': options.username = strdup(optarg); break; case 'P': options.password = strdup(optarg); break; case 'S': options.servername = strdup(optarg); break; case 'D': options.database = strdup(optarg); break; case 'f': /* override default PWD file */ PWD = strdup(optarg); break; case 'v': options.fverbose = 1; /* doesn't normally do anything */ break; case '?': default: fprintf(stderr, "usage: %s \n" " [-U username] [-P password]\n" " [-S servername] [-D database]\n" " [-i input filename] [-o output filename] " "[-e error filename]\n" , BASENAME); exit(1); } } #endif strlcpy(filename, PWD, sizeof(filename)); s1 = getenv("TDSPWDFILE"); if (s1 && s1[0]) in = fopen(s1, "r"); if (!in) in = fopen(filename, "r"); if (!in) in = fopen("PWD", "r"); if (!in) { sprintf(filename, "%s/%s", (DIRNAME) ? DIRNAME : ".", PWD); in = fopen(filename, "r"); } if (!in) { fprintf(stderr, "Can not open %s file\n\n", filename); } else { char line[512]; while (fgets(line, sizeof(line), in)) { const char *value; s1 = strtok(line, "="); value = strtok(NULL, "\n"); if (!s1 || !value) continue; if (!strcmp(s1, "UID")) { strlcpy(USER, value, sizeof(USER)); } else if (!strcmp(s1, "SRV")) { strlcpy(SERVER, value, sizeof(SERVER)); } else if (!strcmp(s1, "PWD")) { strlcpy(PASSWORD, value, sizeof(PASSWORD)); } else if (!strcmp(s1, "DB")) { strlcpy(DATABASE, value, sizeof(DATABASE)); } } fclose(in); } /* apply command-line overrides */ if (options.username) { strlcpy(USER, options.username, sizeof(USER)); free(options.username); } if (options.password) { strlcpy(PASSWORD, options.password, sizeof(PASSWORD)); free(options.password); } if (options.servername) { strlcpy(SERVER, options.servername, sizeof(SERVER)); free(options.servername); } if (options.database) { strlcpy(DATABASE, options.database, sizeof(DATABASE)); free(options.database); } if (!*SERVER) { fprintf(stderr, "no servername provided, quitting.\n"); exit(1); } printf("found %s.%s for %s in \"%s\"\n", SERVER, DATABASE, USER, filename); #if 0 dbrecftos(BASENAME); #endif len = snprintf(sql_file, sizeof(sql_file), "%s/%s.sql", FREETDS_SRCDIR, BASENAME); assert(len >= 0 && len <= sizeof(sql_file)); if (input_file) fclose(input_file); if ((input_file = fopen(sql_file, "r")) == NULL) { fflush(stdout); fprintf(stderr, "could not open SQL input file \"%s\"\n", sql_file); } if (!free_file_registered) atexit(free_file); free_file_registered = true; printf("SQL text will be read from %s\n", sql_file); return 0; } /* * Fill the command buffer from a file while echoing it to standard output. */ RETCODE sql_cmd(DBPROCESS *dbproc) { char line[2048], *p = line; int i = 0; RETCODE erc=SUCCEED; if (!input_file) { fprintf(stderr, "%s: error: SQL input file \"%s\" not opened\n", BASENAME, sql_file); exit(1); } while ((p = fgets(line, (int)sizeof(line), input_file)) != NULL && strcasecmp("go\n", p) != 0) { printf("\t%3d: %s", ++i, p); if ((erc = dbcmd(dbproc, p)) != SUCCEED) { fprintf(stderr, "%s: error: could write \"%s\" to dbcmd()\n", BASENAME, p); exit(1); } } if (ferror(input_file)) { fprintf(stderr, "%s: error: could not read SQL input file \"%s\"\n", BASENAME, sql_file); exit(1); } return erc; } RETCODE sql_rewind(void) { if (!input_file) return FAIL; rewind(input_file); return SUCCEED; } RETCODE sql_reopen(const char *fn) { int len = snprintf(sql_file, sizeof(sql_file), "%s/%s.sql", FREETDS_SRCDIR, fn); assert(len >= 0 && len <= sizeof(sql_file)); if (input_file) fclose(input_file); if ((input_file = fopen(sql_file, "r")) == NULL) { fflush(stdout); fprintf(stderr, "could not open SQL input file \"%s\"\n", sql_file); sql_file[0] = 0; return FAIL; } return SUCCEED; } int syb_msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { int *pexpected_msgno; /* * Check for "database changed", or "language changed" messages from * the client. If we get one of these, then we need to pull the * name of the database or charset from the message and set the * appropriate variable. */ if (msgno == 5701 || /* database context change */ msgno == 5703 || /* language changed */ msgno == 5704) { /* charset changed */ /* fprintf( stderr, "msgno = %d: %s\n", msgno, msgtext ) ; */ return 0; } /* * If the user data indicates this is an expected error message (because we're testing the * error propogation, say) then indicate this message was anticipated. */ if (dbproc != NULL) { pexpected_msgno = (int *) dbgetuserdata(dbproc); if (pexpected_msgno && *pexpected_msgno == msgno) { printf("OK: anticipated message arrived: %d %s\n", (int) msgno, msgtext); *pexpected_msgno = 0; return 0; } } /* * If the severity is something other than 0 or the msg number is * 0 (user informational messages). */ fflush(stdout); if (severity >= 0 || msgno == 0) { /* * If the message was something other than informational, and * the severity was greater than 0, then print information to * stderr with a little pre-amble information. */ if (msgno > 0 && severity > 0) { fprintf(stderr, "Msg %d, Level %d, State %d\n", (int) msgno, (int) severity, (int) msgstate); fprintf(stderr, "Server '%s'", srvname); if (procname != NULL && *procname != '\0') fprintf(stderr, ", Procedure '%s'", procname); if (line > 0) fprintf(stderr, ", Line %d", line); fprintf(stderr, "\n"); fprintf(stderr, "%s\n", msgtext); fflush(stderr); } else { /* * Otherwise, it is just an informational (e.g. print) message * from the server, so send it to stdout. */ printf("%s\n", msgtext); fflush(stdout); severity = 0; } } if (severity) { fprintf(stderr, "exit: no unanticipated messages allowed in unit tests\n"); exit(EXIT_FAILURE); } return 0; } int syb_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { int *pexpected_dberr; /* * For server messages, cancel the query and rely on the * message handler to spew the appropriate error messages out. */ if (dberr == SYBESMSG) return INT_CANCEL; /* * If the user data indicates this is an expected error message (because we're testing the * error propogation, say) then indicate this message was anticipated. */ if (dbproc != NULL) { pexpected_dberr = (int *) dbgetuserdata(dbproc); if (pexpected_dberr && *pexpected_dberr == dberr) { printf("OK: anticipated error %d (%s) arrived\n", dberr, dberrstr); *pexpected_dberr = 0; return INT_CANCEL; } } fflush(stdout); fprintf(stderr, "DB-LIBRARY error (dberr %d (severity %d): \"%s\"; oserr %d: \"%s\")\n", dberr, severity, dberrstr ? dberrstr : "(null)", oserr, oserrstr ? oserrstr : "(null)"); fflush(stderr); /* * If the dbprocess is dead or the dbproc is a NULL pointer and * we are not in the middle of logging in, then we need to exit. * We can't do anything from here on out anyway. * It's OK to end up here in response to a dbconvert() that * resulted in overflow, so don't exit in that case. */ if ((dbproc == NULL) || DBDEAD(dbproc)) { if (dberr != SYBECOFL) { exit(255); } } if (severity) { fprintf(stderr, "error: no unanticipated errors allowed in unit tests\n"); exit(EXIT_FAILURE); } return INT_CANCEL; } freetds-1.3.6/src/dblib/unittests/common.h000644 025423 025423 00000004172 14056414221 022154 0ustar00fredianofrediano000000 000000 #ifndef COMMON_h #define COMMON_h #undef NDEBUG #include #include #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #ifdef DBNTWIN32 #include /* fix MinGW missing declare */ #ifndef _WINDOWS_ #define _WINDOWS_ 1 #endif #endif #include #include #include #if !defined(EXIT_FAILURE) #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 #endif #define FREETDS_SRCDIR FREETDS_TOPDIR "/src/dblib/unittests" #if defined(HAVE__SNPRINTF) && !defined(HAVE_SNPRINTF) #define snprintf _snprintf #endif #ifdef DBNTWIN32 /* * Define Sybase's symbols in terms of Microsoft's. * This allows these tests to be run using Microsoft's include * files and library (libsybdb.lib). */ #define MSDBLIB 1 #define MICROSOFT_DBLIB 1 #define dbloginfree(l) dbfreelogin(l) #define SYBESMSG SQLESMSG #define SYBECOFL SQLECOFL #define SYBAOPSUM SQLAOPSUM #define SYBAOPMAX SQLAOPMAX #define SYBINT4 SQLINT4 #define SYBDATETIME SQLDATETIME #define SYBCHAR SQLCHAR #define SYBVARCHAR SQLVARCHAR #define SYBTEXT SQLTEXT #define SYBBINARY SQLBINARY #define SYBIMAGE SQLIMAGE #define SYBDECIMAL SQLDECIMAL #define dberrhandle(h) dberrhandle((DBERRHANDLE_PROC) h) #define dbmsghandle(h) dbmsghandle((DBMSGHANDLE_PROC) h) #endif /* cf getopt(3) */ extern char *optarg; extern int optind; extern int optopt; extern int opterr; extern int optreset; extern char PASSWORD[512]; extern char USER[512]; extern char SERVER[512]; extern char DATABASE[512]; void set_malloc_options(void); int read_login_info(int argc, char **argv); int syb_msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); int syb_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); RETCODE sql_cmd(DBPROCESS *dbproc); RETCODE sql_rewind(void); RETCODE sql_reopen(const char *fn); #endif freetds-1.3.6/src/dblib/unittests/batch_stmt_ins_sel.c000644 025423 025423 00000014735 14056414221 024531 0ustar00fredianofrediano000000 000000 /* * Purpose: this will test what is returned from a batch of queries, some that return rows and some that do not * This is related to a bug first identified in PHPs PDO library https://bugs.php.net/bug.php?id=72969 * Functions: dbbind dbcmd dbcolname dberrhandle dbisopt dbmsghandle dbnextrow dbnumcols dbopen dbresults dbsetlogintime dbsqlexec dbuse */ #include "common.h" int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; DBINT erc; RETCODE results_retcode; int rowcount; int colcount; int row_retcode; set_malloc_options(); read_login_info(argc, argv); if (argc > 1) { argc -= optind; argv += optind; } printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon as \"%s\"\n", USER); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "wf_dbresults"); if (argc > 1) { printf("server and login timeout overrides (%s and %s) detected\n", argv[0], argv[1]); strcpy(SERVER, argv[0]); i = atoi(argv[1]); if (i) { i = dbsetlogintime(i); printf("dbsetlogintime returned %s.\n", (i == SUCCEED) ? "SUCCEED" : "FAIL"); } } printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); printf("Using database \"%s\"\n", DATABASE); if (strlen(DATABASE)) { erc = dbuse(dbproc, DATABASE); assert(erc == SUCCEED); } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } /* * This test is written to simulate how dblib is used in PDO * functions are called in the same order they would be if doing * PDO::query followed by some number of PDO::statement->nextRowset */ /* * First, call everything that happens in PDO::query * this will return the results of the CREATE TABLE statement */ dbcancel(dbproc); printf("using sql_cmd\n"); sql_cmd(dbproc); dbsqlexec(dbproc); results_retcode = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("** CREATE TABLE **\n"); printf("RETCODE: %d\n", results_retcode); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); /* check that the results correspond to the create table statement */ assert(results_retcode == SUCCEED); assert(rowcount == -1); assert(colcount == 0); /* now simulate calling nextRowset() for each remaining statement in our batch */ /* * INSERT */ printf("** INSERT **\n"); /* there shouldn't be any rows in this resultset yet, it's still from the CREATE TABLE */ row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", results_retcode); assert(row_retcode == NO_MORE_ROWS); results_retcode = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", results_retcode); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(results_retcode == SUCCEED); assert(rowcount == 3); assert(colcount == 0); /* * SELECT */ printf("** SELECT **\n"); /* the rowset is still from the INSERT and should have no rows */ row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", results_retcode); assert(row_retcode == NO_MORE_ROWS); results_retcode = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", results_retcode); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(results_retcode == SUCCEED); assert(rowcount == -1); assert(colcount == 1); /* now we expect to find three rows in the rowset */ row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == REG_ROW); row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == REG_ROW); row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n\n", row_retcode); assert(row_retcode == REG_ROW); /* * UPDATE */ printf("** UPDATE **\n"); /* check that there are no rows left, then we'll get the results from the UPDATE */ row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == NO_MORE_ROWS); results_retcode = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", results_retcode); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(results_retcode == SUCCEED); assert(rowcount == 3); /*assert(colcount == 0); TODO: why does an update get a column? */ /* * SELECT */ printf("** SELECT **\n"); row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == NO_MORE_ROWS); results_retcode = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", results_retcode); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(results_retcode == SUCCEED); assert(rowcount == -1); assert(colcount == 1); /* now we expect to find three rows in the rowset again */ row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == REG_ROW); row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == REG_ROW); row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n\n", row_retcode); assert(row_retcode == REG_ROW); /* * DROP */ printf("** DROP **\n"); row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == NO_MORE_ROWS); results_retcode = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", results_retcode); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(results_retcode == SUCCEED); assert(rowcount == -1); /* assert(colcount == 0); */ /* Call one more time to be sure we get NO_MORE_RESULTS */ row_retcode = dbnextrow(dbproc); printf("dbnextrow retcode: %d\n", row_retcode); assert(row_retcode == NO_MORE_ROWS); results_retcode = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", results_retcode); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(results_retcode == NO_MORE_RESULTS); assert(rowcount == -1); /* assert(colcount == 0); */ dbexit(); printf("%s OK\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/batch_stmt_ins_sel.sql000644 025423 025423 00000000567 14056414221 025104 0ustar00fredianofrediano000000 000000 create table #batch_stmt(id int) insert into #batch_stmt values(1) insert into #batch_stmt values(2) insert into #batch_stmt values(3) go create table #batch_stmt_ins_sel(id int) insert into #batch_stmt_ins_sel select id from #batch_stmt select * from #batch_stmt_ins_sel update #batch_stmt_ins_sel set id = 4 select * from #batch_stmt_ins_sel drop table #batch_stmt_ins_sel freetds-1.3.6/src/dblib/unittests/batch_stmt_ins_upd.c000644 025423 025423 00000010263 14056414221 024526 0ustar00fredianofrediano000000 000000 /* * Purpose: this will test what is returned from a batch of queries that do not return any rows * This is related to a bug first identified in PHPs PDO library https://bugs.php.net/bug.php?id=72969 * Functions: dbbind dbcmd dbcolname dberrhandle dbisopt dbmsghandle dbnextrow dbnumcols dbopen dbresults dbsetlogintime dbsqlexec dbuse */ #include "common.h" int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; DBINT erc; RETCODE ret; int rowcount; int colcount; set_malloc_options(); read_login_info(argc, argv); if (argc > 1) { argc -= optind; argv += optind; } printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon as \"%s\"\n", USER); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "wf_dbresults"); if (argc > 1) { printf("server and login timeout overrides (%s and %s) detected\n", argv[0], argv[1]); strcpy(SERVER, argv[0]); i = atoi(argv[1]); if (i) { i = dbsetlogintime(i); printf("dbsetlogintime returned %s.\n", (i == SUCCEED) ? "SUCCEED" : "FAIL"); } } printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); printf("Using database \"%s\"\n", DATABASE); if (strlen(DATABASE)) { erc = dbuse(dbproc, DATABASE); assert(erc == SUCCEED); } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } /* * This test is written to simulate how dblib is used in PDO * functions are called in the same order they would be if doing * PDO::query followed by some number of PDO::statement->nextRowset */ /* * First, call everything that happens in PDO::query * this will return the results of the CREATE TABLE statement */ dbcancel(dbproc); printf("using sql_cmd\n"); sql_cmd(dbproc); dbsqlexec(dbproc); ret = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", ret); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); /* check the results of the create table statement */ assert(ret == SUCCEED); assert(rowcount == -1); assert(colcount == 0); /* now simulate calling nextRowset() for each remaining statement in our batch */ /* * INSERT */ ret = dbnextrow(dbproc); assert(ret == NO_MORE_ROWS); ret = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", ret); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(ret == SUCCEED); assert(rowcount == 3); assert(colcount == 0); /* * UPDATE */ ret = dbnextrow(dbproc); assert(ret == NO_MORE_ROWS); ret = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", ret); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(ret == SUCCEED); assert(rowcount == 3); assert(colcount == 0); /* * INSERT */ ret = dbnextrow(dbproc); assert(ret == NO_MORE_ROWS); ret = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", ret); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(ret == SUCCEED); assert(rowcount == 1); assert(colcount == 0); /* * DROP */ ret = dbnextrow(dbproc); assert(ret == NO_MORE_ROWS); ret = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", ret); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(ret == SUCCEED); assert(rowcount == -1); assert(colcount == 0); /* Call one more time to be sure we get NO_MORE_RESULTS */ ret = dbnextrow(dbproc); assert(ret == NO_MORE_ROWS); ret = dbresults(dbproc); rowcount = DBCOUNT(dbproc); colcount = dbnumcols(dbproc); printf("RETCODE: %d\n", ret); printf("ROWCOUNT: %d\n", rowcount); printf("COLCOUNT: %d\n\n", colcount); assert(ret == NO_MORE_RESULTS); assert(rowcount == -1); assert(colcount == 0); dbexit(); printf("%s OK\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/batch_stmt_ins_upd.sql000644 025423 025423 00000000536 14056414221 025105 0ustar00fredianofrediano000000 000000 create table #batch_stmt (id int) insert into #batch_stmt values(1) insert into #batch_stmt values(2) insert into #batch_stmt values(3) go create table #batch_stmt_results(id int) insert into #batch_stmt_results select id from #batch_stmt update #batch_stmt_results set id = 1 insert into #batch_stmt_results values(2) drop table #batch_stmt_results freetds-1.3.6/src/dblib/unittests/bcp.c000644 025423 025423 00000015212 14056414271 021425 0ustar00fredianofrediano000000 000000 /* * Purpose: Test bcp functions * Functions: bcp_batch bcp_bind bcp_done bcp_init bcp_sendrow */ #include "common.h" #include #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #include "bcp.h" static char cmd[1024]; static int init(DBPROCESS * dbproc, const char *name); static void test_bind(DBPROCESS * dbproc); /* * Static data for insertion */ static int not_null_bit = 1; static char not_null_char[] = "a char"; static char not_null_varchar[] = "a varchar"; static char not_null_datetime[] = "Dec 17 2003 3:44PM"; static char not_null_smalldatetime[] = "Dec 17 2003 3:44PM"; static char not_null_money[] = "12.34"; static char not_null_smallmoney[] = "12.34"; static char not_null_float[] = "12.34"; static char not_null_real[] = "12.34"; static char not_null_decimal[] = "12.34"; static char not_null_numeric[] = "12.34"; static int not_null_int = 1234; static int not_null_smallint = 1234; static int not_null_tinyint = 123; static int init(DBPROCESS * dbproc, const char *name) { int res = 0; RETCODE rc; printf("Dropping %s.%s..%s\n", SERVER, DATABASE, name); sql_cmd(dbproc); dbsqlexec(dbproc); while ((rc=dbresults(dbproc)) == SUCCEED) { /* nop */ } if (rc != NO_MORE_RESULTS) return 1; printf("Creating %s.%s..%s\n", SERVER, DATABASE, name); sql_cmd(dbproc); sql_cmd(dbproc); if (dbsqlexec(dbproc) == FAIL) { res = 1; } while ((rc=dbresults(dbproc)) == SUCCEED) { dbprhead(dbproc); dbprrow(dbproc); while ((rc=dbnextrow(dbproc)) == REG_ROW) { dbprrow(dbproc); } } if (rc != NO_MORE_RESULTS) return 1; printf("%s\n", res? "error" : "ok"); return res; } #define VARCHAR_BIND(x) \ bcp_bind( dbproc, (unsigned char *) &x, prefixlen, strlen(x), NULL, termlen, SYBVARCHAR, col++ ) #define INT_BIND(x) \ bcp_bind( dbproc, (unsigned char *) &x, prefixlen, -1, NULL, termlen, SYBINT4, col++ ) #define NULL_BIND(x, type) \ bcp_bind( dbproc, (unsigned char *) &x, prefixlen, 0, NULL, termlen, type, col++ ) static void test_bind(DBPROCESS * dbproc) { enum { prefixlen = 0 }; enum { termlen = 0 }; enum NullValue { IsNull, IsNotNull }; RETCODE fOK; int col=1; /* non nulls */ fOK = INT_BIND(not_null_bit); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_char); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_varchar); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_datetime); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_smalldatetime); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_money); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_smallmoney); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_float); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_real); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_decimal); assert(fOK == SUCCEED); fOK = VARCHAR_BIND(not_null_numeric); assert(fOK == SUCCEED); fOK = INT_BIND(not_null_int); assert(fOK == SUCCEED); fOK = INT_BIND(not_null_smallint); assert(fOK == SUCCEED); fOK = INT_BIND(not_null_tinyint); assert(fOK == SUCCEED); /* nulls */ fOK = NULL_BIND(not_null_char, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_varchar, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_datetime, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_smalldatetime, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_money, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_smallmoney, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_float, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_real, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_decimal, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_numeric, SYBVARCHAR); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_int, SYBINT4); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_smallint, SYBINT4); assert(fOK == SUCCEED); fOK = NULL_BIND(not_null_tinyint, SYBINT4); assert(fOK == SUCCEED); } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i, rows_sent=0; const char *s; const char *table_name = "all_types_bcp_unittest"; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbsetversion(DBVERSION_100); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "bcp.c unit test"); BCP_SETL(login, 1); printf("About to open %s.%s\n", SERVER, DATABASE); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); if (init(dbproc, table_name)) exit(1); /* set up and send the bcp */ sprintf(cmd, "%s..%s", DATABASE, table_name); printf("preparing to insert into %s ... ", cmd); if (bcp_init(dbproc, cmd, NULL, NULL, DB_IN) == FAIL) { fprintf(stderr, "failed\n"); exit(1); } printf("OK\n"); test_bind(dbproc); printf("Sending same row 10 times... \n"); for (i=0; i<10; i++) { if (bcp_sendrow(dbproc) == FAIL) { fprintf(stderr, "send failed\n"); exit(1); } } printf("Sending 5 more rows ... \n"); for (i=15; i <= 27; i++) { int type = dbcoltype(dbproc, i); int len = (type == SYBCHAR || type == SYBVARCHAR)? dbcollen(dbproc, i) : -1; if (bcp_collen(dbproc, len, i) == FAIL) { fprintf(stderr, "bcp_collen failed for column %d\n", i); exit(1); } } for (i=0; i<5; i++) { if (bcp_sendrow(dbproc) == FAIL) { fprintf(stderr, "send failed\n"); exit(1); } } #if 1 rows_sent = bcp_batch(dbproc); if (rows_sent == -1) { fprintf(stderr, "batch failed\n"); exit(1); } #endif printf("OK\n"); /* end bcp. */ if ((rows_sent += bcp_done(dbproc)) == -1) printf("Bulk copy unsuccessful.\n"); else printf("%d rows copied.\n", rows_sent); printf("done\n"); #if 1 sql_cmd(dbproc); dbsqlexec(dbproc); while ((i=dbresults(dbproc)) == SUCCEED) { dbprhead(dbproc); dbprrow(dbproc); while ((i=dbnextrow(dbproc)) == REG_ROW) { dbprrow(dbproc); } } #endif #ifdef DB_QUERYOUT /* test initializing with a very long query and DB_QUERYOUT */ if (bcp_init(dbproc, select_table_sql, NULL, NULL, DB_QUERYOUT) == FAIL) { fprintf(stderr, "failed\n"); exit(1); } bcp_done(dbproc); printf("OK\n"); #endif if ((s = getenv("BCP")) != NULL && 0 == strcmp(s, "nodrop")) { printf("BCP=nodrop: '%s..%s' kept\n", DATABASE, table_name); } else { printf("Dropping table %s\n", table_name); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } dbexit(); printf("%s OK\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/bcp.h000644 025423 025423 00000001413 14056414271 021430 0ustar00fredianofrediano000000 000000 static const char select_table_sql[] = "SELECT\n" " not_null_bit\n" "\n" " , not_null_char\n" " , not_null_varchar\n" "\n" " , not_null_datetime\n" " , not_null_smalldatetime\n" "\n" " , not_null_money\n" " , not_null_smallmoney\n" "\n" " , not_null_float\n" " , not_null_real\n" "\n" " , not_null_decimal\n" " , not_null_numeric\n" "\n" " , not_null_int\n" " , not_null_smallint\n" " , not_null_tinyint\n" "\n" " , nullable_char\n" " , nullable_varchar\n" "\n" " , nullable_datetime\n" " , nullable_smalldatetime\n" "\n" " , nullable_money\n" " , nullable_smallmoney\n" "\n" " , nullable_float\n" " , nullable_real\n" "\n" " , nullable_decimal\n" " , nullable_numeric\n" "\n" " , nullable_int\n" " , nullable_smallint\n" " , nullable_tinyint\n" "FROM all_types_bcp_unittest"; freetds-1.3.6/src/dblib/unittests/bcp.sql000644 025423 025423 00000011351 14056414221 021775 0ustar00fredianofrediano000000 000000 if exists (select 1 from sysobjects where type = 'U' and name = 'all_types_bcp_unittest') drop table all_types_bcp_unittest go CREATE TABLE all_types_bcp_unittest ( not_null_bit bit NOT NULL , not_null_char char(10) NOT NULL , not_null_varchar varchar(10) NOT NULL , not_null_datetime datetime NOT NULL , not_null_smalldatetime smalldatetime NOT NULL , not_null_money money NOT NULL , not_null_smallmoney smallmoney NOT NULL , not_null_float float NOT NULL , not_null_real real NOT NULL , not_null_decimal decimal(5,2) NOT NULL , not_null_numeric numeric(5,2) NOT NULL , not_null_int int NOT NULL , not_null_smallint smallint NOT NULL , not_null_tinyint tinyint NOT NULL , nullable_char char(10) NULL , nullable_varchar varchar(10) NULL , nullable_datetime datetime NULL , nullable_smalldatetime smalldatetime NULL , nullable_money money NULL , nullable_smallmoney smallmoney NULL , nullable_float float NULL , nullable_real real NULL , nullable_decimal decimal(5,2) NULL , nullable_numeric numeric(5,2) NULL , nullable_int int NULL , nullable_smallint smallint NULL , nullable_tinyint tinyint NULL /* Excludes: * binary * image * uniqueidentifier * varbinary * text * timestamp * nchar * ntext * nvarchar */ ) INSERT all_types_bcp_unittest VALUES ( 1 -- not_null_bit , 'a char' -- not_null_char , 'a varchar' -- not_null_varchar , 'Dec 17 2003 3:44PM' -- not_null_datetime , 'Dec 17 2003 3:44PM' -- not_null_smalldatetime , 12.34 -- not_null_money , 12.34 -- not_null_smallmoney , 12.34 -- not_null_float , 12.34 -- not_null_real , 12.34 -- not_null_decimal , 12.34 -- not_null_numeric , 1234 -- not_null_int , 1234 -- not_null_smallint , 123 -- not_null_tinyint , 'a char' -- nullable_char , 'a varchar' -- nullable_varchar , 'Dec 17 2003 3:44PM' -- nullable_datetime , 'Dec 17 2003 3:44PM' -- nullable_smalldatetime , 12.34 -- nullable_money , 12.34 -- nullable_smallmoney , 12.34 -- nullable_float , 12.34 -- nullable_real , 12.34 -- nullable_decimal , 12.34 -- nullable_numeric , 1234 -- nullable_int , 1234 -- nullable_smallint , 123 -- nullable_tinyint ) INSERT all_types_bcp_unittest ( not_null_bit , not_null_char , not_null_varchar , not_null_datetime , not_null_smalldatetime , not_null_money , not_null_smallmoney , not_null_float , not_null_real , not_null_decimal , not_null_numeric , not_null_int , not_null_smallint , not_null_tinyint ) VALUES ( 1 -- not_null_bit , 'a char' -- not_null_char , 'a varchar' -- not_null_varchar , 'Dec 17 2003 3:44PM' -- not_null_datetime , 'Dec 17 2003 3:44PM' -- not_null_smalldatetime , 12.34 -- not_null_money , 12.34 -- not_null_smallmoney , 12.34 -- not_null_float , 12.34 -- not_null_real , 12.34 -- not_null_decimal , 12.34 -- not_null_numeric , 1234 -- not_null_int , 1234 -- not_null_smallint , 123 -- not_null_tinyint ) INSERT all_types_bcp_unittest ( not_null_bit , not_null_char , not_null_varchar , not_null_datetime , not_null_smalldatetime , not_null_money , not_null_smallmoney , not_null_float , not_null_real , not_null_decimal , not_null_numeric , not_null_int , not_null_smallint , not_null_tinyint , nullable_char , nullable_varchar ) VALUES ( 1 -- not_null_bit , '' -- not_null_char empty string , '' -- not_null_varchar empty string , 'Dec 17 2003 3:44PM' -- not_null_datetime , 'Dec 17 2003 3:44PM' -- not_null_smalldatetime , 12.34 -- not_null_money , 12.34 -- not_null_smallmoney , 12.34 -- not_null_float , 12.34 -- not_null_real , 12.34 -- not_null_decimal , 12.34 -- not_null_numeric , 1234 -- not_null_int , 1234 -- not_null_smallint , 123 -- not_null_tinyint , '' -- nullable_char empty string , '' -- nullable_varchar empty string ) go select colid, cast(c.name as varchar(30)) as name, c.length , ' '+ substring('NY', convert(bit,(c.status & 8))+1,1) as Nulls from syscolumns as c left join systypes as t on c.usertype = t.usertype where c.id = object_id('all_types_bcp_unittest') order by colid go select 'nullable_char' as col, count(*) nrows, datalength(nullable_char) as len, nullable_char as value from all_types_bcp_unittest group by nullable_char UNION select 'nullable_varchar' as col, count(*) nrows, datalength(nullable_varchar) as len, nullable_varchar as value from all_types_bcp_unittest group by nullable_varchar UNION select 'nullable_int' as col, count(*) nrows, datalength(nullable_int) as len, cast(nullable_int as varchar(6))as value from all_types_bcp_unittest group by nullable_int order by col, len, nrows go drop table all_types_bcp_unittest go freetds-1.3.6/src/dblib/unittests/bcp2.c000644 025423 025423 00000010020 14056414221 021472 0ustar00fredianofrediano000000 000000 /* * Purpose: Test bcp functions, specifically some NULL behaviour * Functions: bcp_bind bcp_done bcp_init bcp_sendrow */ #include "common.h" #include static void doexit(int value) { dbexit(); /* always call dbexit before returning to OS */ exit(value); } static int init(DBPROCESS * dbproc, const char *name) { RETCODE rc; printf("Dropping %s.%s..%s\n", SERVER, DATABASE, name); sql_cmd(dbproc); dbsqlexec(dbproc); while ((rc=dbresults(dbproc)) == SUCCEED) continue; if (rc != NO_MORE_RESULTS) return 1; printf("Creating %s.%s..%s\n", SERVER, DATABASE, name); sql_cmd(dbproc); if (dbsqlexec(dbproc) == FAIL) return 1; while ((rc=dbresults(dbproc)) == SUCCEED) continue; if (rc != NO_MORE_RESULTS) return 1; printf("ok\n"); return 0; } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; DBINT msgno; int num_rows, expected = 2; static const char table_name[] = "bcp_test"; /* Variables for host file data to be copied to database. */ char s1[11]; char s2[11]; char s3[11]; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbsetversion(DBVERSION_100); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "bcp2.c unit test"); BCP_SETL(login, TRUE); printf("About to open %s.%s\n", SERVER, DATABASE); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); if (init(dbproc, table_name)) doexit(1); /* set up and send the bcp */ strcpy(s1, "test short"); strcpy(s2, " "); strcpy(s3, ""); if (bcp_init(dbproc, "bcp_test", NULL, "bcp.errors", DB_IN) != SUCCEED) doexit(1); bcp_bind(dbproc, (BYTE *)s1, 0, -1, (BYTE *)"", 1, SYBCHAR, 1); bcp_bind(dbproc, (BYTE *)s2, 0, -1, (BYTE *)"", 1, SYBCHAR, 2); bcp_bind(dbproc, (BYTE *)s3, 0, -1, (BYTE *)"", 1, SYBCHAR, 3); printf("Sending some rows... \n"); if (bcp_sendrow(dbproc) == FAIL) { fprintf(stderr, "send failed\n"); doexit(1); } strcpy(s2, "x"); strcpy(s3, " "); if (bcp_sendrow(dbproc) == FAIL) { fprintf(stderr, "send failed\n"); doexit(1); } /* In MSSQL the error is reported during bcp_done but all inserts are ignored */ if (DBTDS_5_0 == DBTDS(dbproc)) { msgno = 20073; dbsetuserdata(dbproc, (BYTE*) &msgno); strcpy(s2, ""); strcpy(s3, ""); if (bcp_sendrow(dbproc) != FAIL) { fprintf(stderr, "send NULL succeeded\n"); doexit(1); } dbsetuserdata(dbproc, NULL); /* end bcp. */ if (bcp_done(dbproc) != expected) { fprintf(stderr, "Bulk copy unsuccessful.\n"); doexit(1); } } else { /* end bcp. */ if (bcp_done(dbproc) != expected) { fprintf(stderr, "Bulk copy unsuccessful.\n"); doexit(1); } /* another insert with error */ if (bcp_init(dbproc, "bcp_test", NULL, "bcp.errors", DB_IN) != SUCCEED) doexit(1); bcp_bind(dbproc, (BYTE *)s1, 0, -1, (BYTE *)"", 1, SYBCHAR, 1); bcp_bind(dbproc, (BYTE *)s2, 0, -1, (BYTE *)"", 1, SYBCHAR, 2); bcp_bind(dbproc, (BYTE *)s3, 0, -1, (BYTE *)"", 1, SYBCHAR, 3); strcpy(s2, ""); strcpy(s3, ""); if (bcp_sendrow(dbproc) == FAIL) { fprintf(stderr, "send failed\n"); doexit(1); } /* end bcp. */ msgno = 515; dbsetuserdata(dbproc, (BYTE*) &msgno); num_rows = bcp_done(dbproc); if (num_rows != -1) { fprintf(stderr, "Bulk copy successful. %d rows returned\n", num_rows); doexit(1); } dbsetuserdata(dbproc, NULL); } printf("done\n"); /* check we inserted the expected number of rows row */ num_rows = 0; sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { while (dbnextrow(dbproc) == REG_ROW) num_rows++; } if (num_rows != expected) { fprintf(stderr, "Expected %d row(s), got %d\n", expected, num_rows); doexit(1); } printf("Dropping table %s\n", table_name); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } dbexit(); printf("%s OK\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/bcp2.sql000644 025423 025423 00000000533 14056414221 022057 0ustar00fredianofrediano000000 000000 if exists (select 1 from sysobjects where type = 'U' and name = 'bcp_test') drop table bcp_test go CREATE TABLE bcp_test ( s1 char(10) not null, s2 char(10) not null, s3 char(10) null ) go select * from bcp_test where (s1 = 'test short' and s2 = '' and s3 is null) or (s1 = 'test short' and s2 = 'x' and s3 = '') go drop table bcp_test go freetds-1.3.6/src/dblib/unittests/bcp_getl.c000644 025423 025423 00000000211 14056414221 022424 0ustar00fredianofrediano000000 000000 #include "common.h" int main(void) { LOGINREC *c = dblogin(); BCP_SETL(c, TRUE); assert(bcp_getl(c)); dbloginfree(c); return 0; } freetds-1.3.6/src/dblib/unittests/cancel.c000644 025423 025423 00000003437 14056414221 022107 0ustar00fredianofrediano000000 000000 /* * Purpose: Test we can cancel a query inside message handler * Some server some additional tokens which can prevent second query to work * correctly. */ #include "common.h" static int cancel_msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { dbcancel(dbproc); return 0; } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; DBINT testint = -1; read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "cancel"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); /* first query, select with error */ dbmsghandle(cancel_msg_handler); sql_cmd(dbproc); dbsqlexec(dbproc); dbmsghandle(syb_msg_handler); /* second query, select */ printf("second select\n"); if (SUCCEED != sql_cmd(dbproc) || SUCCEED != dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); exit(1); } if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != 1) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); exit(1); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "No other rows expected\n"); } dbexit(); printf("ok\n"); return 0; } freetds-1.3.6/src/dblib/unittests/cancel.sql000644 025423 025423 00000000070 14056414221 022452 0ustar00fredianofrediano000000 000000 select * from I_dont_exists_table go select 1 as one go freetds-1.3.6/src/dblib/unittests/canquery.c000644 025423 025423 00000003337 14056414221 022510 0ustar00fredianofrediano000000 000000 /* * Purpose: Check dbcanquery throw away rows and we can continue after the call * Functions: dbcanquery */ #include "common.h" int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; DBINT data; RETCODE erc; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon as \"%s\"\n", USER); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "spid"); printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); printf("Using database \"%s\"\n", DATABASE); if (strlen(DATABASE)) { erc = dbuse(dbproc, DATABASE); assert(erc == SUCCEED); } sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "error: expected a result set, none returned.\n"); return 1; } if (dbcanquery(dbproc) != SUCCEED) { fprintf(stderr, "error: unexpected error from dbcanquery.\n"); return 1; } if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "error: expected a result set, none returned.\n"); return 1; } if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & data)) { fprintf(stderr, "Had problem with bind\n"); return 1; } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); return 1; } if (data != 2) { fprintf(stderr, "Failed. Expected row data to be 2, was %d\n", data); return 1; } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Was expecting no more rows\n"); return 1; } dbclose(dbproc); dbexit(); return 0; } freetds-1.3.6/src/dblib/unittests/canquery.sql000644 025423 025423 00000000025 14056414221 023054 0ustar00fredianofrediano000000 000000 select 1 select 2 go freetds-1.3.6/src/dblib/unittests/colinfo.c000644 025423 025423 00000004051 14056414221 022304 0ustar00fredianofrediano000000 000000 /* * Purpose: Test check dbcolinfo/dbtableinfo informations * Functions: dbresults dbsqlexec dbtablecolinfo */ #include "common.h" static int failed = 0; static void check_is(const char *value, const char *expected) { if (strcmp(value, expected) == 0) return; failed = 1; fprintf(stderr, "Wrong value, got \"%s\" expected \"%s\"\n", value, expected); } static void check_contains(const char *value, const char *expected) { if (strstr(value, expected) != NULL) return; failed = 1; fprintf(stderr, "Wrong value, got \"%s\" expected to contains \"%s\"\n", value, expected); } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int n_col; DBCOL2 col2; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "colinfo"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("creating tables\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); /* select */ dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (n_col = 1; n_col <= 3; ++n_col) { col2.SizeOfStruct = sizeof(col2); if (dbtablecolinfo(dbproc, n_col, (DBCOL *) &col2) != SUCCEED) { fprintf(stderr, "dbtablecolinfo failed for col %d\n", n_col); failed = 1; continue; } if (n_col == 1) { check_is(col2.Name, "number"); check_contains(col2.TableName, "#colinfo_table"); } else if (n_col == 2) { check_is(col2.Name, "is_a_string"); check_contains(col2.TableName, "#colinfo_table"); } else if (n_col == 3) { check_is(col2.Name, "dollars"); check_contains(col2.TableName, "#test_table"); } } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/colinfo.sql000644 025423 025423 00000000370 14056414221 022661 0ustar00fredianofrediano000000 000000 create table #colinfo_table(is_an_int int not null, is_a_string char(10) not null) create table #test_table(is_a_money money not null) go select is_an_int as number, is_a_string, is_a_money as dollars from #colinfo_table, #test_table for browse go freetds-1.3.6/src/dblib/unittests/dbmorecmds.c000644 025423 025423 00000004133 14056414221 022773 0ustar00fredianofrediano000000 000000 /* * Purpose: Test behaviour of dbmorecmds() * Functions: dbmorecmds */ #include "common.h" int main(int argc, char **argv) { const int rows_to_add = 10; LOGINREC *login; DBPROCESS *dbproc; int i, nresults; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); printf("after dblogin\n"); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0024"); printf("About to open [%s]\n", USER); dbproc = dbopen(login, SERVER); printf("After dbopen [%s]\n", SERVER); if (strlen(DATABASE)) { printf("About to dbuse [%s]\n", DATABASE); dbuse(dbproc, DATABASE); } dbloginfree(login); printf("After dbuse [%s]\n", DATABASE); printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 0; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } printf("select one resultset\n"); sql_cmd(dbproc); dbsqlexec(dbproc); nresults = 0; if (dbresults(dbproc) == SUCCEED) { do { while (dbnextrow(dbproc) != NO_MORE_ROWS) continue; nresults++; } while (dbmorecmds(dbproc) == SUCCEED); } /* dbmorecmds should return success 0 times for select 1 */ if (nresults != 1) { fprintf(stderr, "Was expecting nresults == 1.\n"); exit(1); } dbcancel(dbproc); printf("select two resultsets\n"); sql_cmd(dbproc); dbsqlexec(dbproc); nresults = 0; do { if (dbresults(dbproc) == SUCCEED) { while (dbnextrow(dbproc) != NO_MORE_ROWS) continue; nresults++; } } while (dbmorecmds(dbproc) == SUCCEED); /* dbmorecmds should return success 2 times for select 2 */ if (nresults != 2) { /* two results sets plus a return code */ fprintf(stderr, "nresults was %d; was expecting nresults = 2.\n", nresults); exit(1); } /* end of test processing */ dbexit(); printf("%s OK\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/dbmorecmds.sql000644 025423 025423 00000001217 14056414221 023350 0ustar00fredianofrediano000000 000000 create table #dblib0024 (i int not null, s char(10) not null) go insert into #dblib0024 values (0, 'row 000') go insert into #dblib0024 values (1, 'row 001') go insert into #dblib0024 values (2, 'row 002') go insert into #dblib0024 values (3, 'row 003') go insert into #dblib0024 values (4, 'row 004') go insert into #dblib0024 values (5, 'row 005') go insert into #dblib0024 values (6, 'row 006') go insert into #dblib0024 values (7, 'row 007') go insert into #dblib0024 values (8, 'row 008') go insert into #dblib0024 values (9, 'row 009') go select count(*) from #dblib0024 -- order by i go select count(*) from sysusers select name from sysobjects go freetds-1.3.6/src/dblib/unittests/dbsafestr.c000644 025423 025423 00000002760 14056414221 022635 0ustar00fredianofrediano000000 000000 /* * Purpose: Test dbsafestr() * Functions: dbsafestr */ #include "common.h" #ifndef DBNTWIN32 static int failed = 0; /* unsafestr must contain one quote of each type */ static const char *unsafestr = "This is a string with ' and \" in it."; /* safestr must be at least strlen(unsafestr) + 3 */ static char safestr[100]; int main(int argc, char **argv) { int len; RETCODE ret; set_malloc_options(); printf("Starting %s\n", argv[0]); dbinit(); len = strlen(unsafestr); ret = dbsafestr(NULL, unsafestr, -1, safestr, len, DBSINGLE); if (ret != FAIL) failed++; printf("short buffer, single\n%s\n", safestr); /* plus one for termination and one for the quote */ ret = dbsafestr(NULL, unsafestr, -1, safestr, len + 2, DBSINGLE); if (ret != SUCCEED) failed++; if (strlen(safestr) != len + 1) failed++; printf("single quote\n%s\n", safestr); ret = dbsafestr(NULL, unsafestr, -1, safestr, len + 2, DBDOUBLE); if (ret != SUCCEED) failed++; if (strlen(safestr) != len + 1) failed++; printf("double quote\n%s\n", safestr); ret = dbsafestr(NULL, unsafestr, -1, safestr, len + 2, DBBOTH); if (ret != FAIL) failed++; ret = dbsafestr(NULL, unsafestr, -1, safestr, len + 3, DBBOTH); if (ret != SUCCEED) failed++; if (strlen(safestr) != len + 2) failed++; printf("both quotes\n%s\n", safestr); dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } #else int main(void) { fprintf(stderr, "Not supported by MS DBLib\n"); return 0; } #endif freetds-1.3.6/src/dblib/unittests/done_handling.c000644 025423 025423 00000014021 14056414221 023442 0ustar00fredianofrediano000000 000000 #include "common.h" static char software_version[] = "$Id: done_handling.c,v 1.11 2010-09-22 07:03:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; /* * This test try do discovery how dblib process token looking for state * at every iteration. It issue a query to server and check * - row count (valid number means DONE processed) * - if possible to send another query (means state IDLE) * - if error readed (means ERROR token readed) * - if status present (PARAMRESULT token readed) * - if parameter present (PARAM token readed) * It try these query types: * - normal row * - normal row with no count * - normal row without rows * - error query * - store procedure call with output parameters */ /* Forward declarations of the error handler and message handler. */ static int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); static int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); static DBPROCESS *dbproc; static int silent = 0; static int check_idle = 0; /* print functions adapted from src/dblib/dblib.c */ static const char * prdbretcode(int retcode) { static char unknown[24]; switch(retcode) { case REG_ROW: return "REG_ROW/MORE_ROWS"; case NO_MORE_ROWS: return "NO_MORE_ROWS"; case BUF_FULL: return "BUF_FULL"; case NO_MORE_RESULTS: return "NO_MORE_RESULTS"; case SUCCEED: return "SUCCEED"; case FAIL: return "FAIL"; default: sprintf(unknown, "oops: %u ??", retcode); } return unknown; } static const char * prretcode(int retcode) { static char unknown[24]; switch(retcode) { case SUCCEED: return "SUCCEED"; case FAIL: return "FAIL"; case NO_MORE_RESULTS: return "NO_MORE_RESULTS"; default: sprintf(unknown, "oops: %u ??", retcode); } return unknown; } static void query(const char comment[]) { if (comment) printf("%s\n", comment); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } } typedef const char* (*prfunc)(int); static void check_state(const char name[], prfunc print, int erc) { printf("State %-15s %-20s ", name, print(erc)); if (dbnumcols(dbproc) > 0) printf("COLS(%d) ", dbnumcols(dbproc)); /* row count */ if (dbcount(dbproc) >= 0) printf("ROWS(%d) ", (int) dbcount(dbproc)); silent = 1; if (dbdata(dbproc, 1)) printf("DATA "); silent = 0; /* if status present */ if (dbretstatus(dbproc) == TRUE) printf("STATUS %d ", (int) dbretstatus(dbproc)); /* if parameter present */ if (dbnumrets(dbproc) > 0) printf("PARAMS "); /* * if possible to send another query * NOTE this must be the last */ if (check_idle) { silent = 1; dbcmd(dbproc, "declare @i int "); if (FAIL != dbsqlexec(dbproc)) printf("IDLE "); silent = 0; } printf("\n"); } static void do_test(const char comment[]) { int ret; prfunc print_with = NULL; if (comment) printf("%s\n", comment); sql_cmd(dbproc); check_state("sqlexec ", prretcode, dbsqlexec(dbproc)); check_state("nextrow ", prdbretcode, dbnextrow(dbproc)); check_state("nextrow ", prdbretcode, dbnextrow(dbproc)); check_state("results ", prretcode, dbresults(dbproc)); check_state("nextrow ", prdbretcode, dbnextrow(dbproc)); check_state("nextrow ", prdbretcode, dbnextrow(dbproc)); check_idle = 0; for (;;) { ret = dbresults(dbproc); check_state("results ", prretcode, ret); if (ret != SUCCEED) { print_with = prretcode; break; } do { ret = dbnextrow(dbproc); check_state("nextrow ", prdbretcode, ret); } while (ret == REG_ROW); print_with = prdbretcode; } check_state("more results?", print_with, ret); } int main(int argc, char *argv[]) { const static int invalid_column_name = 207; LOGINREC *login; /* Our login information. */ int i; setbuf(stdout, NULL); read_login_info(argc, argv); if (dbinit() == FAIL) exit(1); dberrhandle(err_handler); dbmsghandle(msg_handler); #if 0 /* * FIXME: Should be able to use the common err/msg handlers, but something about * the IDLE checking causes them to fail. Not sure about purpose of IDLE checking. * -- jkl January 2009 */ dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); #endif login = dblogin(); DBSETLUSER(login, USER); DBSETLPWD(login, PASSWORD); DBSETLAPP(login, __FILE__); dbproc = dbopen(login, SERVER); dbloginfree(login); if (!dbproc) exit(1); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); for (i=0; i < 6; i++) query(NULL); #if 0 check_state("setup done ", prretcode, erc); printf("wasting results\n"); while ((erc = dbresults(dbproc)) == SUCCEED) { while (dbnextrow(dbproc) == REG_ROW); /* no-op */ } #endif check_idle = 1; do_test("normal row with rowcount on"); query("turn rowcount off"); do_test("normal row with rowcount off"); query("turn rowcount back on"); do_test("normal row without rows"); dbsetuserdata(dbproc, (BYTE*) &invalid_column_name); do_test("error query"); do_test("stored procedure call with output parameters"); do_test("execute done2"); query("drop done_test"); query("drop done_test2"); dbexit(); return 0; } static int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { if (silent) return INT_CANCEL; fflush(stdout); fprintf(stderr, "DB-Library error (severity %d):\n\t%s\n", severity, dberrstr); if (oserr != DBNOERR) fprintf(stderr, "Operating-system error:\n\t%s\n", oserrstr ? oserrstr : "(null)"); fflush(stderr); return INT_CANCEL; } static int msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line) { if (silent) return 0; fflush(stdout); fprintf(stderr, "Msg %d, Level %d, State %d\n", (int) msgno, severity, msgstate); if (strlen(srvname) > 0) fprintf(stderr, "Server '%s', ", srvname); if (procname && strlen(procname) > 0) { fprintf(stderr, "Procedure '%s', ", procname); if (line > 0) fprintf(stderr, "Line %d", line); } fprintf(stderr, "\n\t%s\n", msgtext); fflush(stderr); return 0; } freetds-1.3.6/src/dblib/unittests/done_handling.sql000644 025423 025423 00000001413 14056414221 024020 0ustar00fredianofrediano000000 000000 create table #dummy (s char(10)) go insert into #dummy values('xxx') go if object_id('done_test') is not NULL drop proc done_test go create proc done_test @a varchar(10) output as select * from #dummy go if object_id('done_test2') is not NULL drop proc done_test2 go create proc done_test2 as select * from #dummy where s = 'aaa' select * from #dummy go select * from #dummy /* normal row */ go set nocount on go select * from #dummy /* normal row with no count */ go set nocount off go select * from #dummy where 0=1 /* normal row without rows */ go select dklghdlgkh from #dummy /* error query */ go /* stored procedure call with output parameters */ declare @s varchar(10) exec done_test @s output go exec done_test2 go drop proc done_test go drop proc done_test2 go freetds-1.3.6/src/dblib/unittests/empty_rowsets.c000644 025423 025423 00000002473 14056414221 023605 0ustar00fredianofrediano000000 000000 /* * Purpose: Test handling of empty rowsets * Functions: dbcmd dbdata dbdatlen dbnextrow dbresults dbsqlexec */ #include "common.h" static int failed = 0; static void set_failed(int line) { failed = 1; fprintf(stderr, "Failed check at line %d\n", line); } #define set_failed() set_failed(__LINE__) int main(int argc, char *argv[]) { LOGINREC *login; DBPROCESS *dbproc; int ret_code; int num_cols; int num_res; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0012"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); } dbloginfree(login); printf("After logon\n"); /* select */ sql_cmd(dbproc); dbsqlexec(dbproc); num_res = 0; while ((ret_code = dbresults(dbproc)) == SUCCEED) { num_cols = dbnumcols(dbproc); printf("Result %d has %d columns\n", num_res, num_cols); if (!(num_res % 2) && num_cols) set_failed(); while(dbnextrow(dbproc) != NO_MORE_ROWS) {}; num_res++; } if (ret_code == FAIL) set_failed(); dbclose(dbproc); dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/empty_rowsets.sql000644 025423 025423 00000000071 14056414221 024152 0ustar00fredianofrediano000000 000000 set arithabort on select 1 set arithabort on select 2 go freetds-1.3.6/src/dblib/unittests/hang.c000644 025423 025423 00000005521 14056414221 021573 0ustar00fredianofrediano000000 000000 /* * Purpose: Test for dbsqlexec on closed connection */ #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_SYS_WAIT_H #include #endif /* HAVE_SYS_WAIT_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NET_INET_IN_H */ #include char *UNITTEST; #if HAVE_FSTAT && defined(S_IFSOCK) static int end_socket = -1; static int shutdown_socket(DBPROCESS *dbproc) { union { struct sockaddr sa; char data[256]; } u; SOCKLEN_T addrlen; struct stat file_stat; TDS_SYS_SOCKET sockets[2]; TDS_SYS_SOCKET socket = DBIOWDESC(dbproc); if (fstat(socket, &file_stat)) return 0; if ((file_stat.st_mode & S_IFSOCK) != S_IFSOCK) return 0; addrlen = sizeof(u); if (tds_getsockname(socket, &u.sa, &addrlen) < 0 || (u.sa.sa_family != AF_INET && u.sa.sa_family != AF_INET6)) return 0; /* replace socket with a new one */ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) < 0) return 0; tds_socket_set_nosigpipe(sockets[0], 1); /* substitute socket */ close(socket); dup2(sockets[0], socket); /* close connection */ close(sockets[0]); end_socket = sockets[1]; return 1; } static int test(int close_socket) { LOGINREC *login; DBPROCESS *dbproc; RETCODE ret; int expected_error = -1; printf("Starting %s\n", UNITTEST); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0020"); printf("About to open\n"); dbproc = dbopen(login, SERVER); dbsetuserdata(dbproc, (BYTE*) &expected_error); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); dbcmd(dbproc, "select * from sysobjects"); printf("dbsqlexec should not hang.\n"); ret = dbsettime(15); if (ret != SUCCEED) { fprintf(stderr, "Failed. Error setting timeout.\n"); return 1; } if (!shutdown_socket(dbproc)) { fprintf(stderr, "Error shutting down connection\n"); return 1; } if (close_socket) close(end_socket); alarm(20); expected_error = close_socket ? 20006 : 20003; ret = dbsqlexec(dbproc); alarm(0); if (ret != FAIL) { fprintf(stderr, "Failed. Expected FAIL to be returned.\n"); return 1; } dbsetuserdata(dbproc, NULL); if (!close_socket) close(end_socket); dbexit(); printf("dblib okay on %s\n", __FILE__); return 0; } int main(int argc, char **argv) { UNITTEST = argv[0]; read_login_info(argc, argv); if (test(0) || test(1)) return 1; return 0; } #else int main(void) { fprintf(stderr, "Not possible for this platform.\n"); return 0; } #endif freetds-1.3.6/src/dblib/unittests/null.c000644 025423 025423 00000007365 14056414221 021640 0ustar00fredianofrediano000000 000000 /* * Purpose: Test NULL behavior in order to fix problems with PHP and NULLs * PHP use dbdata to get data */ #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifndef DBNTWIN32 static DBPROCESS *dbproc = NULL; static int failed = 0; static int ignore_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line) { return 0; } static int ignore_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { return INT_CANCEL; } static void query(const char *query) { printf("query: %s\n", query); dbcmd(dbproc, (char *) query); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } } static void test0(int n, int expected) { static const char sql[] = "select c from #null where n = %d"; printf(sql, n); printf(" ... "); dbfcmd(dbproc, sql, n); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED || dbnextrow(dbproc) != REG_ROW) { printf("\nExpected a row.\n"); failed = 1; dbcancel(dbproc); return; } printf("got %p and length %d\n", dbdata(dbproc, 1), dbdatlen(dbproc, 1)); if (dbdatlen(dbproc, 1) != (expected < 0? 0 : expected)) { fprintf(stderr, "Error: n=%d: dbdatlen returned %d, expected %d\n", n, dbdatlen(dbproc, 1), expected < 0? 0 : expected); dbcancel(dbproc); failed = 1; } if (dbdata(dbproc, 1) != NULL && expected < 0) { fprintf(stderr, "Error: n=%d: dbdata returned %p, expected NULL and length %d\n", n, dbdata(dbproc, 1), expected); dbcancel(dbproc); failed = 1; } if (dbdata(dbproc, 1) == NULL && expected > 0) { fprintf(stderr, "Error: n=%d: dbdata returned %p, expected non-NULL and length %d\n", n, dbdata(dbproc, 1), expected); dbcancel(dbproc); failed = 1; } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Error: Only one row expected (cancelling remaining results)\n"); dbcancel(dbproc); failed = 1; } while (dbresults(dbproc) == SUCCEED) { /* nop */ } } static void test(const char *type, int give_err) { RETCODE ret; query("if object_id('#null') is not NULL drop table #null"); dberrhandle(ignore_err_handler); dbmsghandle(ignore_msg_handler); printf("create table #null (n int, c %s NULL)\n", type); dbfcmd(dbproc, "create table #null (n int, c %s NULL)", type); dbsqlexec(dbproc); ret = dbresults(dbproc); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); if (ret != SUCCEED) { dbcancel(dbproc); if (!give_err) return; printf("Was expecting a result set.\n"); failed = 1; return; } query("insert into #null values(1, '')"); query("insert into #null values(2, NULL)"); query("insert into #null values(3, ' ')"); query("insert into #null values(4, 'a')"); test0(1, DBTDS_5_0 < DBTDS(dbproc)? 0 : 1); test0(2, DBTDS_5_0 < DBTDS(dbproc)? -1 : 0); test0(3, 1); test0(4, 1); query("drop table #null"); } int main(int argc, char **argv) { LOGINREC *login; read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "thread"); printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); test("VARCHAR(10)", 1); test("TEXT", 1); test("NVARCHAR(10)", 0); if (DBTDS_5_0 < DBTDS(dbproc)) { test("NTEXT", 0); test("VARCHAR(MAX)", 0); test("NVARCHAR(MAX)", 0); } dbexit(); return failed ? 1 : 0; } #else int main(void) { fprintf(stderr, "Not supported by MS DBLib\n"); return 0; } #endif freetds-1.3.6/src/dblib/unittests/null2.c000644 025423 025423 00000007331 14056414221 021713 0ustar00fredianofrediano000000 000000 /* * Purpose: Test NULL behavior using dbbind */ #include "common.h" #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ static DBPROCESS *dbproc = NULL; static int failed = 0; static int ignore_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line) { return 0; } static int ignore_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { return INT_CANCEL; } static void query(const char *query) { printf("query: %s\n", query); dbcmd(dbproc, (char *) query); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } } static int use_nullbind = 0; static void test0(int n, const char * expected) { DBINT ind, expected_ind; char text_buf[16]; dbfcmd(dbproc, "select c from #null where n = %d", n); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); return; } dbbind(dbproc, 1, NTBSTRINGBIND, 0, (BYTE *)text_buf); if (use_nullbind) dbnullbind(dbproc, 1, &ind); memset(text_buf, 'a', sizeof(text_buf)); ind = -5; if (dbnextrow(dbproc) != REG_ROW) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); return; } text_buf[sizeof(text_buf) - 1] = 0; printf("ind %d text_buf -%s-\n", (int) ind, text_buf); expected_ind = 0; if (strcmp(expected, "aaaaaaaaaaaaaaa") == 0) expected_ind = -1; /* do not check indicator if not bound */ if (!use_nullbind) ind = expected_ind; if (ind != expected_ind || strcmp(expected, text_buf) != 0) { fprintf(stderr, "expected_ind %d expected -%s-\n", (int) expected_ind, expected); failed = 1; dbcancel(dbproc); return; } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Only one row expected\n"); dbcancel(dbproc); failed = 1; } while (dbresults(dbproc) == SUCCEED) { /* nop */ } } static void test(const char *type, int give_err) { RETCODE ret; query("if object_id('#null') is not NULL drop table #null"); dberrhandle(ignore_err_handler); dbmsghandle(ignore_msg_handler); printf("create table #null (n int, c %s NULL)\n", type); dbfcmd(dbproc, "create table #null (n int, c %s NULL)", type); dbsqlexec(dbproc); ret = dbresults(dbproc); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); if (ret != SUCCEED) { dbcancel(dbproc); if (!give_err) return; printf("Was expecting a result set.\n"); failed = 1; return; } query("insert into #null values(1, '')"); query("insert into #null values(2, NULL)"); query("insert into #null values(3, ' ')"); query("insert into #null values(4, 'foo')"); use_nullbind = 1; test0(1, ""); test0(2, "aaaaaaaaaaaaaaa"); test0(3, ""); test0(4, "foo"); use_nullbind = 0; test0(1, ""); test0(2, ""); test0(3, ""); test0(4, "foo"); query("drop table #null"); } int main(int argc, char **argv) { LOGINREC *login; read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "thread"); printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); test("VARCHAR(10)", 1); test("CHAR(10)", 1); test("TEXT", 1); test("NVARCHAR(10)", 0); #ifndef DBNTWIN32 if (dbtds(dbproc) >= DBTDS_7_0) test("NTEXT", 0); #endif test("VARCHAR(MAX)", 0); #ifndef DBNTWIN32 if (dbtds(dbproc) >= DBTDS_7_0) test("NVARCHAR(MAX)", 0); #endif dbexit(); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/numeric.c000644 025423 025423 00000013176 14056414221 022325 0ustar00fredianofrediano000000 000000 #define MSDBLIB 1 #include "common.h" static void dump_addr(FILE *out, const char *msg, const void *p, size_t len) { size_t n; if (msg) fprintf(out, "%s", msg); for (n = 0; n < len; ++n) fprintf(out, " %02X", ((unsigned char*) p)[n]); fprintf(out, "\n"); } static void chk(RETCODE ret, const char *msg) { printf("%s: res %d\n", msg, ret); if (ret == SUCCEED) return; fprintf(stderr, "error: %s\n", msg); exit(1); } static void zero_end(DBNUMERIC *num) { /* 27213 == math.floor(math.log(10,256)*65536) */ unsigned len = 4u+num->precision*27213u/65536u; if (num->precision < 1 || num->precision > 77) return; assert(len >= 4 && len <= sizeof(*num)); memset(((char*) num) + len, 0, sizeof(*num) - len); } static int msdblib; static void test(int bind_type, const char *bind_name, int override_prec, int override_scale, int out_prec, int out_scale, int line) { LOGINREC *login; DBPROCESS *dbproc; DBNUMERIC *num = NULL, *num2 = NULL; RETCODE ret; DBTYPEINFO ti; int i; printf("*** Starting test msdblib %d bind %s prec %d scale %d out prec %d out scale %d line %d\n", msdblib, bind_name, override_prec, override_scale, out_prec, out_scale, line); chk(sql_rewind(), "sql_rewind"); login = dblogin(); DBSETLUSER(login, USER); DBSETLPWD(login, PASSWORD); DBSETLAPP(login, "numeric"); dbsetmaxprocs(25); DBSETLHOST(login, SERVER); dbproc = tdsdbopen(login, SERVER, msdblib); dbloginfree(login); login = NULL; if (strlen(DATABASE)) dbuse(dbproc, DATABASE); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } if (DBTDS_5_0 < DBTDS(dbproc)) { ret = dbcmd(dbproc, "SET ARITHABORT ON;" "SET CONCAT_NULL_YIELDS_NULL ON;" "SET ANSI_NULLS ON;" "SET ANSI_NULL_DFLT_ON ON;" "SET ANSI_PADDING ON;" "SET ANSI_WARNINGS ON;" "SET ANSI_NULL_DFLT_ON ON;" "SET CURSOR_CLOSE_ON_COMMIT ON;" "SET QUOTED_IDENTIFIER ON"); chk(ret, "dbcmd"); ret = dbsqlexec(dbproc); chk(ret, "dbsqlexec"); ret = dbcancel(dbproc); chk(ret, "dbcancel"); } ret = dbrpcinit(dbproc, "testDecimal", 0); chk(ret, "dbrpcinit"); num = (DBDECIMAL *) calloc(1, sizeof(DBDECIMAL)); ti.scale = 5; ti.precision = 16; ret = dbconvert_ps(dbproc, SYBVARCHAR, (const BYTE *) "123.45", -1, SYBDECIMAL, (BYTE *) num, sizeof(*num), &ti); chk(ret > 0, "dbconvert_ps"); ret = dbrpcparam(dbproc, "@idecimal", 0, SYBDECIMAL, -1, sizeof(DBDECIMAL), (BYTE *) num); chk(ret, "dbrpcparam"); ret = dbrpcsend(dbproc); chk(ret, "dbrpcsend"); ret = dbsqlok(dbproc); chk(ret, "dbsqlok"); /* TODO check MS/Sybase format */ num2 = (DBDECIMAL *) calloc(1, sizeof(DBDECIMAL)); ti.precision = override_prec; ti.scale = override_scale; ret = dbconvert_ps(dbproc, SYBVARCHAR, (const BYTE *) "246.9", -1, SYBDECIMAL, (BYTE *) num2, sizeof(*num2), &ti); chk(ret > 0, "dbconvert_ps"); for (i=0; (ret = dbresults(dbproc)) != NO_MORE_RESULTS; ++i) { RETCODE row_code; switch (ret) { case SUCCEED: if (DBROWS(dbproc) == FAIL) continue; assert(DBROWS(dbproc) == SUCCEED); printf("dbrows() returned SUCCEED, processing rows\n"); memset(num, 0, sizeof(*num)); num->precision = out_prec ? out_prec : num2->precision; num->scale = out_scale ? out_scale : num2->scale; dbbind(dbproc, 1, bind_type, 0, (BYTE *) num); while ((row_code = dbnextrow(dbproc)) != NO_MORE_ROWS) { if (row_code == REG_ROW) { zero_end(num); zero_end(num2); if (memcmp(num, num2, sizeof(*num)) != 0) { fprintf(stderr, "Failed. Output results does not match\n"); dump_addr(stderr, "got: ", num, sizeof(*num)); dump_addr(stderr, "expected: ", num2, sizeof(*num2)); exit(1); } } else { /* not supporting computed rows in this unit test */ fprintf(stderr, "Failed. Expected a row\n"); exit(1); } } break; case FAIL: fprintf(stderr, "dbresults returned FAIL\n"); exit(1); default: fprintf(stderr, "unexpected return code %d from dbresults\n", ret); exit(1); } } /* while dbresults */ sql_cmd(dbproc); free(num2); free(num); dbclose(dbproc); } #define test(a,b,c,d,e) test(a, #a, b, c, d, e, __LINE__) int main(int argc, char **argv) { read_login_info(argc, argv); dbsetversion(DBVERSION_100); dbinit(); /* tests with MS behaviour */ msdblib = 1; test(DECIMALBIND, 20, 10, 0, 0); test(NUMERICBIND, 20, 10, 0, 0); test(SRCDECIMALBIND, 20, 10, 0, 0); test(SRCNUMERICBIND, 20, 10, 0, 0); /* in these 2 case MS override what server returns */ test(DECIMALBIND, 10, 4, 10, 4); test(NUMERICBIND, 10, 4, 10, 4); test(SRCDECIMALBIND, 20, 10, 10, 4); test(SRCNUMERICBIND, 20, 10, 10, 4); /* tests with Sybase behaviour */ msdblib = 0; test(DECIMALBIND, 20, 10, 0, 0); test(NUMERICBIND, 20, 10, 0, 0); test(SRCDECIMALBIND, 20, 10, 0, 0); test(SRCNUMERICBIND, 20, 10, 0, 0); /* no matter what Sybase return always according to source */ test(DECIMALBIND, 20, 10, 10, 4); test(NUMERICBIND, 20, 10, 10, 4); test(SRCDECIMALBIND, 20, 10, 10, 4); test(SRCNUMERICBIND, 20, 10, 10, 4); chk(sql_reopen("numeric_2"), "sql_reopen"); msdblib = 1; /* on MS use always output */ test(DECIMALBIND, 20, 0, 20, 0); test(NUMERICBIND, 19, 0, 19, 0); test(SRCDECIMALBIND, 18, 0, 18, 0); test(SRCNUMERICBIND, 17, 0, 17, 0); msdblib = 0; test(DECIMALBIND, 18, 0, 20, 0); test(NUMERICBIND, 18, 0, 19, 0); /* this is MS only and behave like MS */ test(SRCDECIMALBIND, 18, 0, 18, 0); test(SRCNUMERICBIND, 17, 0, 17, 0); dbexit(); printf("Succeed\n"); return 0; } freetds-1.3.6/src/dblib/unittests/numeric.sql000644 025423 025423 00000000367 14056414221 022700 0ustar00fredianofrediano000000 000000 IF OBJECT_ID('testDecimal') IS NOT NULL DROP PROC testDecimal go CREATE PROCEDURE testDecimal @idecimal NUMERIC(20,10) AS BEGIN SELECT CAST(@idecimal*2 AS NUMERIC(20,10)) END go IF OBJECT_ID('testDecimal') IS NOT NULL DROP PROC testDecimal go freetds-1.3.6/src/dblib/unittests/numeric_2.sql000644 025423 025423 00000000350 14056414221 023111 0ustar00fredianofrediano000000 000000 IF OBJECT_ID('testDecimal') IS NOT NULL DROP PROC testDecimal go CREATE PROCEDURE testDecimal @idecimal NUMERIC(20,10) AS BEGIN SELECT CAST(246 AS INTEGER) END go IF OBJECT_ID('testDecimal') IS NOT NULL DROP PROC testDecimal go freetds-1.3.6/src/dblib/unittests/pending.c000644 025423 025423 00000003374 14056414221 022306 0ustar00fredianofrediano000000 000000 /* * Purpose: Test we can send another query after beginning transaction * Some server some additional tokens which can prevent second query to work * correctly. */ #include "common.h" int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; DBINT testint = -1; read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "pending"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); /* first query, start transactions */ sql_cmd(dbproc); dbsqlexec(dbproc); /* second query, select */ printf("second select\n"); if (SUCCEED != sql_cmd(dbproc) || SUCCEED != dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); exit(1); } if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != 634) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); exit(1); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "No other rows expected\n"); } /* third query, commit */ if (SUCCEED != sql_cmd(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); exit(1); } while (dbresults(dbproc) != NO_MORE_RESULTS) continue; dbexit(); printf("ok\n"); return 0; } freetds-1.3.6/src/dblib/unittests/pending.sql000644 025423 025423 00000000204 14056414221 022650 0ustar00fredianofrediano000000 000000 declare @a int select @a = 123 begin transaction go /* The following statement should success */ select 634 as number go commit go freetds-1.3.6/src/dblib/unittests/rpc.c000644 025423 025423 00000037401 14056414271 021451 0ustar00fredianofrediano000000 000000 /* * Purpose: Test remote procedure calls * Functions: dbretdata dbretlen dbretname dbretstatus dbrettype dbrpcinit dbrpcparam dbrpcsend */ #include "common.h" static RETCODE init_proc(DBPROCESS * dbproc, const char *name); int ignore_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); int ignore_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line); typedef struct { char *name, *value; int type, len; } RETPARAM; static RETPARAM* save_retparam(RETPARAM *param, char *name, char *value, int type, int len); static RETCODE init_proc(DBPROCESS * dbproc, const char *name) { RETCODE ret = FAIL; if (name[0] != '#') { printf("Dropping procedure %s\n", name); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } printf("Creating procedure %s\n", name); sql_cmd(dbproc); if ((ret = dbsqlexec(dbproc)) == FAIL) { if (name[0] == '#') printf("Failed to create procedure %s. Wrong permission or not MSSQL.\n", name); else printf("Failed to create procedure %s. Wrong permission.\n", name); } while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } return ret; } static RETPARAM* save_retparam(RETPARAM *param, char *name, char *value, int type, int len) { free(param->name); free(param->value); param->name = strdup(name); param->value = strdup(value); param->type = type; param->len = len; return param; } static void free_retparam(RETPARAM *param) { free(param->name); free(param->value); param->name = param->value = NULL; } static int failed = 0; int ignore_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line) { int ret; dbsetuserdata(dbproc, (BYTE*) &msgno); /* printf("(ignoring message %d)\n", msgno); */ ret = syb_msg_handler(dbproc, msgno, state, severity, text, server, proc, line); dbsetuserdata(dbproc, NULL); return ret; } /* * The bad procedure name message has severity 15, causing db-lib to call the error handler after calling the message handler. * This wrapper anticipates that behavior, and again sets the userdata, telling the handler this error is expected. */ int ignore_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { int erc; static int recursion_depth = 0; if (dbproc == NULL) { printf("expected error %d: \"%s\"\n", dberr, dberrstr? dberrstr : ""); return INT_CANCEL; } if (recursion_depth++) { printf("error %d: \"%s\"\n", dberr, dberrstr? dberrstr : ""); printf("logic error: recursive call to ignore_err_handler\n"); exit(1); } dbsetuserdata(dbproc, (BYTE*) &dberr); /* printf("(ignoring error %d)\n", dberr); */ erc = syb_err_handler(dbproc, severity, dberr, oserr, dberrstr, oserrstr); dbsetuserdata(dbproc, NULL); recursion_depth--; return erc; } static int colwidth( DBPROCESS * dbproc, int icol ) { int width = dbwillconvert(dbcoltype(dbproc, icol), SYBCHAR); return 255 == width? dbcollen(dbproc, icol) : width; } char param_data1[64], param_data3[8000+1], param_data4[2 * 4000 + 1]; int param_data2, param_data5; struct parameters_t { const char *name; BYTE status; int type; DBINT maxlen; DBINT datalen; BYTE *value; }; static struct parameters_t bindings[] = { { "@null_input", DBRPCRETURN, SYBCHAR, -1, 0, NULL } , { "@first_type", DBRPCRETURN, SYBCHAR, sizeof(param_data1), 0, (BYTE *) ¶m_data1 } , { "@nullout", DBRPCRETURN, SYBINT4, -1, 0, (BYTE *) ¶m_data2 } , { "@varchar_tds7_out", DBRPCRETURN, SYBVARCHAR, sizeof(param_data3), 0, (BYTE *) ¶m_data3 } , { "@nvarchar_tds7_out", DBRPCRETURN, 231, sizeof(param_data4), 0, (BYTE *) ¶m_data4 } , { "@nrows", DBRPCRETURN, SYBINT4, -1, -1, (BYTE *) ¶m_data5 } , { "@c_this_name_is_way_more_than_thirty_characters_charlie", 0, SYBVARCHAR, 0, 0, NULL } , { "@nv", 0, SYBVARCHAR, -1, 2, (BYTE *) "OK:" } , { NULL, 0, 0, 0, 0, NULL } }; #define PARAM_STR(s) sizeof(s)-1, (BYTE*) s static struct parameters_t bindings_mssql1[] = { { "", 0, SYBVARCHAR, -1, PARAM_STR("set @a='test123'") } , { "", 0, SYBVARCHAR, -1, PARAM_STR("@a varchar(max) out") } , { "", DBRPCRETURN, SYBTEXT, sizeof(param_data3), 0, (BYTE *) ¶m_data3 } , { NULL, 0, 0, 0, 0, NULL } }; static struct parameters_t bindings_mssql2[] = { { "", 0, SYBVARCHAR, -1, PARAM_STR("set @a=null") } , { "", 0, SYBVARCHAR, -1, PARAM_STR("@a bit out") } , { "", DBRPCRETURN, SYBBIT, sizeof(param_data3), 0, (BYTE *) ¶m_data3 } , { NULL, 0, 0, 0, 0, NULL } }; static void bind_param(DBPROCESS *dbproc, struct parameters_t *pb) { RETCODE erc; const char *name = pb->name[0] ? pb->name : NULL; if ((erc = dbrpcparam(dbproc, name, pb->status, pb->type, pb->maxlen, pb->datalen, pb->value)) == FAIL) { fprintf(stderr, "Failed line %d: dbrpcparam\n", __LINE__); failed++; } } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; RETPARAM save_param, save_varchar_tds7_param, save_nvarchar_tds7_param; char teststr[8000+1], abbrev_data[10+3+1], *output; char *retname = NULL; int i; int rettype = 0, retlen = 0, return_status = 0; char proc[] = "#t0022"; char *proc_name = proc; int num_resultset = 0, num_empty_resultset = 0; int num_params = 6; struct parameters_t *pb; static const char dashes30[] = "------------------------------"; static const char *dashes5 = dashes30 + (sizeof(dashes30) - 5), *dashes20 = dashes30 + (sizeof(dashes30) - 20); RETCODE erc, row_code; set_malloc_options(); memset(&save_param, 0, sizeof(save_param)); memset(&save_varchar_tds7_param, 0, sizeof(save_varchar_tds7_param)); memset(&save_nvarchar_tds7_param, 0, sizeof(save_nvarchar_tds7_param)); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "rpc"); dberrhandle(ignore_err_handler); DBSETLPACKET(login, -1); dberrhandle(syb_err_handler); printf("About to open %s.%s\n", SERVER, DATABASE); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("Check if server support long identifiers\n"); sql_cmd(dbproc); i = 103; dbsetuserdata(dbproc, (BYTE*) &i); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) while (dbnextrow(dbproc) != NO_MORE_ROWS) continue; dbsetuserdata(dbproc, NULL); if (i == 0) { fprintf(stderr, "This server does not support long identifiers\n"); dbexit(); return 0; } dberrhandle(ignore_err_handler); dbmsghandle(ignore_msg_handler); printf("trying to create a temporary stored procedure\n"); if (FAIL == init_proc(dbproc, proc_name)) { num_params = 4; printf("trying to create a permanent stored procedure\n"); if (FAIL == init_proc(dbproc, ++proc_name)) exit(EXIT_FAILURE); } dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("Created procedure %s\n", proc_name); /* set up and send the rpc */ printf("executing dbrpcinit\n"); erc = dbrpcinit(dbproc, proc_name, 0); /* no options */ if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbrpcinit\n", __LINE__); failed = 1; } for (pb = bindings, i = 0; pb->name != NULL; pb++, i++) { printf("executing dbrpcparam for %s\n", pb->name); if (num_params == 4 && (i == 3 || i == 4)) continue; bind_param(dbproc, pb); } printf("executing dbrpcsend\n"); param_data5 = 0x11223344; erc = dbrpcsend(dbproc); if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbrpcsend\n", __LINE__); exit(1); } /* wait for it to execute */ printf("executing dbsqlok\n"); erc = dbsqlok(dbproc); if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbsqlok\n", __LINE__); exit(1); } /* retrieve outputs per usual */ printf("fetching results\n"); while ((erc = dbresults(dbproc)) != NO_MORE_RESULTS) { printf("fetched resultset %d %s:\n", 1+num_resultset, erc==SUCCEED? "successfully":"unsuccessfully"); if (erc == SUCCEED) { const int ncol = dbnumcols(dbproc); int empty_resultset = 1, c; enum {buflen=1024, nbuf=5}; char bound_buffers[nbuf][buflen] = { "one", "two", "three", "four", "five" }; ++num_resultset; for( c=0; c < ncol && c < nbuf; c++ ) { printf("column %d (%s) is %d wide, ", c+1, dbcolname(dbproc, c+1), colwidth(dbproc, c+1)); printf("buffer initialized to '%s'\n", bound_buffers[c]); } for( c=0; c < ncol && c < nbuf; c++ ) { erc = dbbind(dbproc, c+1, STRINGBIND, 0, (BYTE *) bound_buffers[c]); if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbbind\n", __LINE__); exit(1); } printf("%-*s ", colwidth(dbproc, c+1), dbcolname(dbproc, c+1)); } printf("\n"); while ((row_code = dbnextrow(dbproc)) != NO_MORE_ROWS) { empty_resultset = 0; if (row_code == REG_ROW) { int c; for( c=0; c < ncol && c < nbuf; c++ ) { printf("%-*s ", colwidth(dbproc, c+1), bound_buffers[c]); } printf("\n"); } else { /* not supporting computed rows in this unit test */ failed = 1; fprintf(stderr, "Failed. Expected a row\n"); exit(1); } } printf("row count %d\n", (int) dbcount(dbproc)); printf("hasretstatus %d\n", dbhasretstat(dbproc)); if (num_resultset == 4 && !dbhasretstat(dbproc)) { fprintf(stderr, "dbnextrow should have set hasretstatus after last recordset\n"); exit(1); } if (empty_resultset) ++num_empty_resultset; } else { fprintf(stderr, "Expected a result set.\n"); exit(1); } } /* while dbresults */ /* check return status */ printf("retrieving return status...\n"); if (dbhasretstat(dbproc) == TRUE) { printf("%d\n", return_status = dbretstatus(dbproc)); } else { printf("none\n"); } /* * Check output parameter values */ if (dbnumrets(dbproc) != num_params) { /* dbnumrets missed something */ fprintf(stderr, "Expected %d output parameters.\n", num_params); exit(1); } printf("retrieving output parameters...\n"); printf("%-5s %-20s %5s %6s %-30s\n", "param", "name", "type", "length", "data"); printf("%-5s %-20s %5s %5s- %-30s\n", dashes5, dashes20, dashes5, dashes5, dashes30); for (i = 1; i <= dbnumrets(dbproc); i++) { retname = dbretname(dbproc, i); rettype = dbrettype(dbproc, i); retlen = dbretlen(dbproc, i); dbconvert(dbproc, rettype, dbretdata(dbproc, i), retlen, SYBVARCHAR, (BYTE*) teststr, -1); if(retlen <= 10) { output = teststr; } else { memcpy(abbrev_data, teststr, 10); sprintf(&abbrev_data[10], "..."); output = abbrev_data; } printf("%-5d %-20s %5d %6d %-30s\n", i, retname, rettype, retlen, output); save_retparam(&save_param, retname, teststr, rettype, retlen); if (i == 4) { save_retparam(&save_varchar_tds7_param, retname, teststr, rettype, retlen); } if (i == 5) { save_retparam(&save_nvarchar_tds7_param, retname, teststr, rettype, retlen); } } /* * Test the last parameter for expected outcome */ if ((save_param.name == NULL) || strcmp(save_param.name, bindings[5].name)) { fprintf(stderr, "Expected retname to be '%s', got ", bindings[5].name); if (save_param.name == NULL) fprintf(stderr, " instead.\n"); else fprintf(stderr, "'%s' instead.\n", save_param.name); exit(1); } if (strcmp(save_param.value, "3")) { fprintf(stderr, "Expected retdata to be 3.\n"); exit(1); } if (save_param.type != SYBINT4) { fprintf(stderr, "Expected rettype to be SYBINT4 was %d.\n", save_param.type); exit(1); } if (save_param.len != 4) { fprintf(stderr, "Expected retlen to be 4.\n"); exit(1); } if (num_params == 6) { /* * Test name, size, contents of the VARCHAR(8000) output parameter */ if ((save_varchar_tds7_param.name == NULL) || strcmp(save_varchar_tds7_param.name, bindings[3].name)) { fprintf(stderr, "Expected retname to be '%s', got ", bindings[3].name); if (save_varchar_tds7_param.name == NULL) fprintf(stderr, " instead.\n"); else fprintf(stderr, "'%s' instead.\n", save_varchar_tds7_param.name); exit(1); } if (save_varchar_tds7_param.type != SYBVARCHAR) { fprintf(stderr, "Expected rettype to be SYBVARCHAR was %d.\n", save_varchar_tds7_param.type); exit(1); } if (save_varchar_tds7_param.len != 8000) { fprintf(stderr, "Expected retlen to be 8000 was %d.\n", save_varchar_tds7_param.len); exit(1); } /* * Test name, size, contents of the NVARCHAR(4000) output parameter */ if ((save_nvarchar_tds7_param.name == NULL) || strcmp(save_nvarchar_tds7_param.name, bindings[4].name)) { fprintf(stderr, "Expected retname to be '%s', got ", bindings[4].name); if (save_varchar_tds7_param.name == NULL) fprintf(stderr, " instead.\n"); else fprintf(stderr, "'%s' instead.\n", save_nvarchar_tds7_param.name); exit(1); } if (save_nvarchar_tds7_param.len != 4000) { fprintf(stderr, "Expected retlen to be 4000 was %d.\n", save_nvarchar_tds7_param.len); exit(1); } } if(42 != return_status) { fprintf(stderr, "Expected status to be 42.\n"); exit(1); } printf("Good: Got 6 output parameters and 1 return status of %d.\n", return_status); /* Test number of result sets */ if (num_resultset != 4) { fprintf(stderr, "Expected 4 resultset got %d.\n", num_resultset); exit(1); } if (num_empty_resultset != 1) { fprintf(stderr, "Expected an empty resultset got %d.\n", num_empty_resultset); exit(1); } printf("Good: Got %d resultsets and %d empty resultset.\n", num_resultset, num_empty_resultset); printf("Dropping procedure\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } /* additional tests for mssql */ #if defined(DBTDS_7_2) if (num_params == 6 && dbtds(dbproc) >= DBTDS_7_2) { erc = dbrpcinit(dbproc, "sp_executesql", 0); /* no options */ if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbrpcinit\n", __LINE__); failed = 1; } for (pb = bindings_mssql1; pb->name != NULL; pb++) bind_param(dbproc, pb); erc = dbrpcsend(dbproc); if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbrpcsend\n", __LINE__); exit(1); } while (dbresults(dbproc) != NO_MORE_RESULTS) continue; if (dbnumrets(dbproc) != 1) { /* dbnumrets missed something */ fprintf(stderr, "Expected 1 output parameters.\n"); exit(1); } i = 1; retname = dbretname(dbproc, i); rettype = dbrettype(dbproc, i); retlen = dbretlen(dbproc, i); dbconvert(dbproc, rettype, dbretdata(dbproc, i), retlen, SYBVARCHAR, (BYTE*) teststr, -1); if (strcmp(teststr, "test123") != 0) { fprintf(stderr, "Unexpected '%s' results.\n", teststr); exit(1); } erc = dbrpcinit(dbproc, "sp_executesql", 0); /* no options */ if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbrpcinit\n", __LINE__); failed = 1; } for (pb = bindings_mssql2; pb->name != NULL; pb++) bind_param(dbproc, pb); erc = dbrpcsend(dbproc); if (erc == FAIL) { fprintf(stderr, "Failed line %d: dbrpcsend\n", __LINE__); exit(1); } while (dbresults(dbproc) != NO_MORE_RESULTS) continue; if (dbnumrets(dbproc) != 1) { /* dbnumrets missed something */ fprintf(stderr, "Expected 1 output parameters.\n"); exit(1); } i = 1; retname = dbretname(dbproc, i); rettype = dbrettype(dbproc, i); retlen = dbretlen(dbproc, i); dbconvert(dbproc, rettype, dbretdata(dbproc, i), retlen, SYBVARCHAR, (BYTE*) teststr, -1); if (dbretdata(dbproc, i) != NULL || rettype != SYBBIT || retlen != 0) { fprintf(stderr, "Unexpected '%s' results.\n", teststr); exit(1); } } #endif dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); free_retparam(&save_param); free_retparam(&save_varchar_tds7_param); free_retparam(&save_nvarchar_tds7_param); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/rpc.sql000644 025423 025423 00000006201 14056414271 022020 0ustar00fredianofrediano000000 000000 SELECT 'x' AS this_is_a_really_really_long_identifier go CREATE PROCEDURE #t0022 @null_input varchar(30) OUTPUT , @first_type varchar(30) OUTPUT , @nullout int OUTPUT , @varchar_tds7_out varchar(8000) OUTPUT , @nvarchar_tds7_out nvarchar(4000) OUTPUT , @nrows int OUTPUT , @c_this_name_is_way_more_than_thirty_characters_charlie varchar(20) , @nv nvarchar(20) = N'hello' AS BEGIN if @null_input is not NULL begin select 'error: should be NULL' as status, @null_input as 'null_input' return -42 end else begin print 'Good: @null_input is NULL' end if @c_this_name_is_way_more_than_thirty_characters_charlie is not NULL begin select 'error: should be NULL' as status, @c_this_name_is_way_more_than_thirty_characters_charlie as '@c_this_name_is_way_more_than_thirty_characters_charlie' return -42 end else begin print 'Good: @c_this_name_is_way_more_than_thirty_characters_charlie is NULL' end select @null_input = max(convert(varchar(30), name)) from systypes select @first_type = min(convert(varchar(30), name)) from systypes select name from sysobjects where 0=1 select distinct convert(varchar(30), name) as 'type' from systypes where name in ('int', 'char', 'text') select @nrows = @@rowcount set @varchar_tds7_out = replicate(char(123), 8000) set @nvarchar_tds7_out = replicate(nchar(246), 4000) select distinct @nv as '@nv', convert(varchar(30), name) as name from systypes select @null_input as 'null_input' , @first_type as 'first_type' , @nullout as 'nullout' , @nrows as 'nrows' , @c_this_name_is_way_more_than_thirty_characters_charlie as 'c' , @nv as 'nv' into #parameters select * from #parameters return 42 END go IF OBJECT_ID('t0022') IS NOT NULL DROP PROC t0022 go CREATE PROCEDURE t0022 @null_input varchar(30) OUTPUT , @first_type varchar(30) OUTPUT , @nullout int OUTPUT , @nrows int OUTPUT , @c_this_name_is_way_more_than_thirty_characters_charlie varchar(20) , @nv nvarchar(20) = N'hello' AS BEGIN if @null_input is not NULL begin select 'error: should be NULL' as status, @null_input as 'null_input' return -42 end else begin print 'Good: @null_input is NULL' end if @c_this_name_is_way_more_than_thirty_characters_charlie is not NULL begin select 'error: should be NULL' as status, @c_this_name_is_way_more_than_thirty_characters_charlie as '@c_this_name_is_way_more_than_thirty_characters_charlie' return -42 end else begin print 'Good: @c_this_name_is_way_more_than_thirty_characters_charlie is NULL' end select @null_input = max(convert(varchar(30), name)) from systypes select @first_type = min(convert(varchar(30), name)) from systypes select name from sysobjects where 0=1 select distinct convert(varchar(30), name) as 'type' from systypes where name in ('int', 'char', 'text') select @nrows = @@rowcount select distinct @nv as '@nv', convert(varchar(30), name) as name from sysobjects where type = 'S' select @null_input as 'null_input' , @first_type as 'first_type' , @nullout as 'nullout' , @nrows as 'nrows' , @c_this_name_is_way_more_than_thirty_characters_charlie as 'c' , @nv as 'nv' into #parameters select * from #parameters return 42 END go IF OBJECT_ID('t0022') IS NOT NULL DROP PROC t0022 go freetds-1.3.6/src/dblib/unittests/setnull.c000644 025423 025423 00000007701 14056414271 022353 0ustar00fredianofrediano000000 000000 /* * Purpose: dbnull behavior */ #include "common.h" #include static int failed = 0; static DBPROCESS *dbproc = NULL; static void char_test(const char *null, int bindlen, const char *expected) { char db_c[16]; RETCODE ret; if (null) { fprintf(stderr, "\tdbsetnull(CHARBIND, %u, '%s').\n", (unsigned int) strlen(null), null); ret = dbsetnull(dbproc, CHARBIND, strlen(null), (BYTE *) null); if (ret != SUCCEED) { fprintf(stderr, "dbsetnull returned error %d\n", (int) ret); failed = 1; } } memset(db_c, '_', sizeof(db_c)); strcpy(db_c, "123456"); dbcmd(dbproc, "select convert(char(20), null)"); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); } fprintf(stderr, "dbbind(CHARBIND, bindlen= %d).\n", bindlen); dbbind(dbproc, 1, CHARBIND, bindlen, (BYTE *) &db_c); db_c[sizeof(db_c)-1] = 0; printf("buffer before/after dbnextrow: '%s'/", db_c); if (dbnextrow(dbproc) != REG_ROW) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); } db_c[sizeof(db_c)-1] = 0; printf("'%s'\n", db_c); if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Only one row expected\n"); dbcancel(dbproc); failed = 1; } while (dbresults(dbproc) == SUCCEED) { /* nop */ } if (strcmp(db_c, expected) != 0) { fprintf(stderr, "Invalid NULL '%s' returned expected '%s' (%s:%d)\n", db_c, expected, basename(__FILE__), __LINE__); failed = 1; } } int main(int argc, char **argv) { LOGINREC *login; DBINT db_i; RETCODE ret; read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "setnull"); printf("About to open %s.%s\n", SERVER, DATABASE); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); /* try to set an int */ db_i = 0xdeadbeef; ret = dbsetnull(dbproc, INTBIND, 0, (BYTE *) &db_i); if (ret != SUCCEED) { fprintf(stderr, "dbsetnull returned error %d\n", (int) ret); failed = 1; } ret = dbsetnull(dbproc, INTBIND, 1, (BYTE *) &db_i); if (ret != SUCCEED) { fprintf(stderr, "dbsetnull returned error %d\n", (int) ret); failed = 1; } /* check result */ db_i = 0; dbcmd(dbproc, "select convert(int, null)"); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); } dbbind(dbproc, 1, INTBIND, 0, (BYTE *) &db_i); printf("db_i = %ld\n", (long int) db_i); if (dbnextrow(dbproc) != REG_ROW) { fprintf(stderr, "Was expecting a row.\n"); failed = 1; dbcancel(dbproc); } printf("db_i = %ld\n", (long int) db_i); if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Only one row expected\n"); dbcancel(dbproc); failed = 1; } while (dbresults(dbproc) == SUCCEED) { /* nop */ } if (db_i != 0xdeadbeef) { fprintf(stderr, "Invalid NULL %ld returned (%s:%d)\n", (long int) db_i, basename(__FILE__), __LINE__); failed = 1; } /* try if dbset null consider length */ for (db_i = 1; db_i > 0; db_i <<= 1) { printf("db_i = %ld\n", (long int) db_i); ret = dbsetnull(dbproc, INTBIND, db_i, (BYTE *) &db_i); if (ret != SUCCEED) { fprintf(stderr, "dbsetnull returned error %d for bindlen %ld\n", (int) ret, (long int) db_i); failed = 1; break; } } char_test(NULL, -1, "123456"); char_test(NULL, 0, "123456"); char_test(NULL, 2, " 3456"); char_test("foo", -1, "foo456"); char_test("foo", 0, "foo456"); /* char_test("foo", 2, ""); */ char_test("foo", 5, "foo 6"); char_test("foo ", -1, "foo 56"); char_test("foo ", 0, "foo 56"); /* char_test("foo ", 2, ""); */ char_test("foo ", 5, "foo 6"); char_test("foo ", 10, "foo _____"); printf("dblib %s on %s\n", (failed ? "failed!" : "okay"), __FILE__); dbexit(); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/spid.c000644 025423 025423 00000003272 14056414221 021616 0ustar00fredianofrediano000000 000000 /* * Purpose: Retrieve the connection SPID. * Functions: dbspid */ #include "common.h" int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; DBINT expected_spid, actual_spid; RETCODE erc; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon as \"%s\"\n", USER); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "spid"); printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); printf("Using database \"%s\"\n", DATABASE); if (strlen(DATABASE)) { erc = dbuse(dbproc, DATABASE); assert(erc == SUCCEED); } #ifdef DBQUOTEDIDENT printf("QUOTED_IDENTIFIER is %s\n", (dbisopt(dbproc, DBQUOTEDIDENT, NULL))? "ON":"OFF"); #endif sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "error: expected a result set, none returned.\n"); return 1; } if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & expected_spid)) { fprintf(stderr, "Had problem with bind\n"); return 1; } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); return 1; } assert(expected_spid > 0); actual_spid = dbspid(dbproc); if (expected_spid != actual_spid) { fprintf(stderr, "Failed. Expected spid to be %d, was %d\n", expected_spid, actual_spid); return 1; } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Was expecting no more rows\n"); return 1; } dbclose(dbproc); dbexit(); return 0; } freetds-1.3.6/src/dblib/unittests/spid.sql000644 025423 025423 00000000021 14056414221 022160 0ustar00fredianofrediano000000 000000 select @@SPID go freetds-1.3.6/src/dblib/unittests/string_bind.c000644 025423 025423 00000006374 14056414221 023167 0ustar00fredianofrediano000000 000000 /* * Purpose: Test different string binding combinations. * Functions: dbbind */ #include "common.h" static DBPROCESS *dbproc = NULL; static int bind_len = -1; static int expected_error = 0; static const char *select_cmd = "select 'foo '"; static void test_row(int vartype, const char *vartype_name, const char *expected, int line) { char str[11]; int i; printf("%d: row type %s bind len %d\n", line, vartype_name, bind_len); if (dbcmd(dbproc, select_cmd) != SUCCEED) { fprintf(stderr, "error: dbcmd\n"); exit(1); } dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "error: expected a result set, none returned.\n"); exit(1); } memset(str, '$', sizeof(str)); str[sizeof(str) - 1] = 0; if (dbbind(dbproc, 1, vartype, bind_len, (BYTE *) str) != SUCCEED) { fprintf(stderr, "Had problem with bind\n"); exit(1); } if (dbnextrow(dbproc) != REG_ROW) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } assert(str[sizeof(str) - 1] == 0); if (vartype == CHARBIND) { /* not terminated space padded */ char *p = strchr(str, '$'); i = p ? p - str : sizeof(str); } else { /* terminated */ char *p = strchr(str, 0); i = p - str + 1; } for (; i < sizeof(str)-1; ++i) { assert(str[i] == '$'); str[i] = 0; } printf("str '%s'\n", str); if (strcmp(str, expected) != 0) { fprintf(stderr, "Expected '%s' string\n", expected); exit(1); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Was expecting no more rows\n"); exit(1); } assert(expected_error == 0); } #define row(bind, expected) test_row(bind, #bind, expected, __LINE__) int main(int argc, char **argv) { LOGINREC *login; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon as \"%s\"\n", USER); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "spid"); printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); dbsetuserdata(dbproc, (BYTE*) &expected_error); row(NTBSTRINGBIND, "foo"); row(STRINGBIND, "foo "); row(CHARBIND, "foo "); bind_len = 4; row(NTBSTRINGBIND, "foo"); expected_error = SYBECOFL; row(STRINGBIND, "foo"); expected_error = SYBECOFL; row(CHARBIND, "foo "); bind_len = 5; row(NTBSTRINGBIND, "foo"); expected_error = SYBECOFL; row(STRINGBIND, "foo "); row(CHARBIND, "foo "); bind_len = 8; row(NTBSTRINGBIND, "foo"); row(STRINGBIND, "foo "); row(CHARBIND, "foo "); bind_len = 3; expected_error = SYBECOFL; row(NTBSTRINGBIND, "fo"); select_cmd = "select 123"; bind_len = -1; row(NTBSTRINGBIND, "123"); row(STRINGBIND, "123"); row(CHARBIND, "123"); bind_len = 4; row(NTBSTRINGBIND, "123"); row(STRINGBIND, "123"); row(CHARBIND, "123 "); bind_len = 6; row(NTBSTRINGBIND, "123"); row(STRINGBIND, "123 "); row(CHARBIND, "123 "); bind_len = 3; expected_error = SYBECOFL; row(NTBSTRINGBIND, "12"); expected_error = SYBECOFL; row(STRINGBIND, "12"); row(CHARBIND, "123"); bind_len = 2; expected_error = SYBECOFL; row(CHARBIND, "12"); dbclose(dbproc); dbexit(); return 0; } freetds-1.3.6/src/dblib/unittests/t0001.c000644 025423 025423 00000006256 14056414221 021430 0ustar00fredianofrediano000000 000000 /* * Purpose: Log in, create a table, insert a few rows, select them, and log out. * Functions: dbbind dbcmd dbcolname dberrhandle dbisopt dbmsghandle dbnextrow dbnumcols dbopen dbresults dbsetlogintime dbsqlexec dbuse */ #include "common.h" int failed = 0; int main(int argc, char **argv) { const int rows_to_add = 50; LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint, erc; set_malloc_options(); read_login_info(argc, argv); if (argc > 1) { argc -= optind; argv += optind; } printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon as \"%s\"\n", USER); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0001"); if (argc > 1) { printf("server and login timeout overrides (%s and %s) detected\n", argv[0], argv[1]); strcpy(SERVER, argv[0]); i = atoi(argv[1]); if (i) { i = dbsetlogintime(i); printf("dbsetlogintime returned %s.\n", (i == SUCCEED)? "SUCCEED" : "FAIL"); } } printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); printf("Using database \"%s\"\n", DATABASE); if (strlen(DATABASE)) { erc = dbuse(dbproc, DATABASE); assert(erc == SUCCEED); } #ifdef DBQUOTEDIDENT printf("QUOTED_IDENTIFIER is %s\n", (dbisopt(dbproc, DBQUOTEDIDENT, NULL))? "ON":"OFF"); #endif sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } for (i = 0; i < rows_to_add && sql_cmd(dbproc) == SUCCEED; i++) { dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } } sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { failed = 1; fprintf(stderr, "error: expected a result set, none returned.\n"); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & testint)) { failed = 1; fprintf(stderr, "Had problem with bind\n"); abort(); } if (SUCCEED != dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr)) { failed = 1; fprintf(stderr, "Had problem with bind\n"); abort(); } for (i = 0; i < rows_to_add; i++) { char expected[1024]; sprintf(expected, "row %03d", i); memset(teststr, 'x', sizeof(teststr)); teststr[0] = 0; teststr[sizeof(teststr) - 1] = 0; if (REG_ROW != dbnextrow(dbproc)) { failed = 1; fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { failed = 1; fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { failed = 1; printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d |%s|\n", (int) testint, teststr); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { failed = 1; fprintf(stderr, "Was expecting no more rows\n"); exit(1); } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0001.sql000644 025423 025423 00000005034 14056414221 021776 0ustar00fredianofrediano000000 000000 create table #dblib0001 (i int not null, s char(10) not null) go insert into #dblib0001 values (0, "row 000") go insert into #dblib0001 values (1, "row 001") go insert into #dblib0001 values (2, "row 002") go insert into #dblib0001 values (3, "row 003") go insert into #dblib0001 values (4, "row 004") go insert into #dblib0001 values (5, "row 005") go insert into #dblib0001 values (6, "row 006") go insert into #dblib0001 values (7, "row 007") go insert into #dblib0001 values (8, "row 008") go insert into #dblib0001 values (9, "row 009") go insert into #dblib0001 values (10, "row 010") go insert into #dblib0001 values (11, "row 011") go insert into #dblib0001 values (12, "row 012") go insert into #dblib0001 values (13, "row 013") go insert into #dblib0001 values (14, "row 014") go insert into #dblib0001 values (15, "row 015") go insert into #dblib0001 values (16, "row 016") go insert into #dblib0001 values (17, "row 017") go insert into #dblib0001 values (18, "row 018") go insert into #dblib0001 values (19, "row 019") go insert into #dblib0001 values (20, "row 020") go insert into #dblib0001 values (21, "row 021") go insert into #dblib0001 values (22, "row 022") go insert into #dblib0001 values (23, "row 023") go insert into #dblib0001 values (24, "row 024") go insert into #dblib0001 values (25, "row 025") go insert into #dblib0001 values (26, "row 026") go insert into #dblib0001 values (27, "row 027") go insert into #dblib0001 values (28, "row 028") go insert into #dblib0001 values (29, "row 029") go insert into #dblib0001 values (30, "row 030") go insert into #dblib0001 values (31, "row 031") go insert into #dblib0001 values (32, "row 032") go insert into #dblib0001 values (33, "row 033") go insert into #dblib0001 values (34, "row 034") go insert into #dblib0001 values (35, "row 035") go insert into #dblib0001 values (36, "row 036") go insert into #dblib0001 values (37, "row 037") go insert into #dblib0001 values (38, "row 038") go insert into #dblib0001 values (39, "row 039") go insert into #dblib0001 values (40, "row 040") go insert into #dblib0001 values (41, "row 041") go insert into #dblib0001 values (42, "row 042") go insert into #dblib0001 values (43, "row 043") go insert into #dblib0001 values (44, "row 044") go insert into #dblib0001 values (45, "row 045") go insert into #dblib0001 values (46, "row 046") go insert into #dblib0001 values (47, "row 047") go insert into #dblib0001 values (48, "row 048") go insert into #dblib0001 values (49, "row 049") go select * from #dblib0001 order by i go /* dbclose() at Sat Jan 31 21:36:54 2009 */ freetds-1.3.6/src/dblib/unittests/t0002.c000644 025423 025423 00000013071 14056414221 021422 0ustar00fredianofrediano000000 000000 /* * Purpose: Test buffering * Functions: dbclrbuf dbgetrow dbsetopt */ #if 0 # Find functions with: sed -ne'/db/ s/.*\(db[[:alnum:]_]*\)(.*/\1/gp' src/dblib/unittests/t0002.c |sort -u |fmt #endif #include "common.h" #include int failed = 0; static void verify(int i, int testint, char *teststr) { char expected[1024]; sprintf(expected, "row %03d", i); if (testint != i) { failed = 1; fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { failed = 1; fprintf(stderr, "Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", testint, teststr); } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; DBINT testint; STATUS rc; int i, iresults; char teststr[1024]; int rows_in_buffer, limit_rows; const int buffer_count = 10; const int rows_to_add = 50; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0002"); printf("About to open %s..%s\n", SERVER, DATABASE); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("Setting row buffer to 10 rows\n"); #ifdef MICROSOFT_DBLIB dbsetopt(dbproc, DBBUFFER, "10"); #else dbsetopt(dbproc, DBBUFFER, "10", 0); #endif sql_cmd(dbproc); /* drop table if exists */ dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } if (dbresults(dbproc) != NO_MORE_RESULTS) { printf("Failed: dbresults call after NO_MORE_RESULTS should return NO_MORE_RESULTS.\n"); failed = 1; } sql_cmd(dbproc); /* create table */ dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } for (i = 1; i <= rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } sql_cmd(dbproc); /* two result sets */ dbsqlexec(dbproc); for (iresults=1; iresults <= 2; iresults++ ) { printf("fetching resultset %i\n", iresults); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a result set %d.\n", iresults); if( iresults == 2 ) fprintf(stderr, "Buffering with multiple resultsets is broken.\n"); exit(1); } rows_in_buffer = 0; for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is [%s]\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); /* Fetch a result set */ /* Second resultset stops at row 46 */ limit_rows = rows_to_add - (iresults == 2 ? 4 : 0); for (i=0; i < limit_rows;) { printf("clearing %d rows from buffer\n", rows_in_buffer ? buffer_count - 1 : buffer_count); #ifdef MICROSOFT_DBLIB if (i == 0) { rc = dbnextrow(dbproc); assert(rc == REG_ROW); ++i; rows_in_buffer = 1; } #endif dbclrbuf(dbproc, buffer_count); rows_in_buffer = rows_in_buffer ? 1 : 0; do { int rc; i++; if (REG_ROW != (rc = dbnextrow(dbproc))) { failed = 1; fprintf(stderr, "Failed: Expected a row (%s:%d)\n", __FILE__, __LINE__); if (rc == BUF_FULL) fprintf(stderr, "Failed: dbnextrow returned BUF_FULL (%d). Fix dbclrbuf.\n", rc); exit(1); } ++rows_in_buffer; verify(i, testint, teststr); } while (rows_in_buffer < buffer_count && i < limit_rows); if (rows_in_buffer == buffer_count) { /* The buffer should be full */ assert(BUF_FULL == dbnextrow(dbproc)); } } if (iresults == 1) { printf("clearing %d rows from buffer\n", buffer_count); dbclrbuf(dbproc, buffer_count); while (dbnextrow(dbproc) != NO_MORE_ROWS) { abort(); /* All rows were read: should not enter loop */ } } } printf("\n"); /* * Now test the buffered rows. * Should be operating on rows 37-46 of 2nd resultset */ rc = dbgetrow(dbproc, 1); if(rc != NO_MORE_ROWS) /* row 1 is not among the 31-40 in the buffer */ fprintf(stderr, "Failed: dbgetrow returned %d.\n", rc); assert(rc == NO_MORE_ROWS); rc = dbgetrow(dbproc, 37); if(rc != REG_ROW) fprintf(stderr, "Failed: dbgetrow returned %d.\n", rc); assert(rc == REG_ROW); verify(37, testint, teststr); /* first buffered row should be 37 */ rc = dbnextrow(dbproc); if(rc != REG_ROW) fprintf(stderr, "Failed: dbgetrow returned %d.\n", rc); assert(rc == REG_ROW); verify(38, testint, teststr); /* next buffered row should be 38 */ rc = dbgetrow(dbproc, 11); assert(rc == NO_MORE_ROWS); /* only 10 (not 11) rows buffered */ rc = dbgetrow(dbproc, 46); assert(rc == REG_ROW); verify(46, testint, teststr); /* last buffered row should be 46 */ /* Attempt dbnextrow when buffer has no space (10 out of 10 in use). */ rc = dbnextrow(dbproc); assert(rc == BUF_FULL); dbclrbuf(dbproc, 3); /* remove rows 37, 38, and 39 */ rc = dbnextrow(dbproc); assert(rc == REG_ROW); verify(47, testint, teststr); /* fetch row from database, should be 47 */ rc = dbnextrow(dbproc); assert(rc == REG_ROW); verify(48, testint, teststr); /* fetch row from database, should be 48 */ /* buffer contains 8 rows (40-47) try removing 10 rows */ dbclrbuf(dbproc, buffer_count); while (dbnextrow(dbproc) != NO_MORE_ROWS) { /* waste rows 49-50 */ } dbclose(dbproc); /* close while buffer not cleared: OK */ dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0002.sql000644 025423 025423 00000005212 14056414221 021775 0ustar00fredianofrediano000000 000000 if exists ( select 1 from tempdb..sysobjects where id = object_id('tempdb..#dblib0002') ) drop table #dblib0002 go create table #dblib0002 (i int not null, s char(10) not null) go insert into #dblib0002 values (1, 'row 001') go insert into #dblib0002 values (2, 'row 002') go insert into #dblib0002 values (3, 'row 003') go insert into #dblib0002 values (4, 'row 004') go insert into #dblib0002 values (5, 'row 005') go insert into #dblib0002 values (6, 'row 006') go insert into #dblib0002 values (7, 'row 007') go insert into #dblib0002 values (8, 'row 008') go insert into #dblib0002 values (9, 'row 009') go insert into #dblib0002 values (10, 'row 010') go insert into #dblib0002 values (11, 'row 011') go insert into #dblib0002 values (12, 'row 012') go insert into #dblib0002 values (13, 'row 013') go insert into #dblib0002 values (14, 'row 014') go insert into #dblib0002 values (15, 'row 015') go insert into #dblib0002 values (16, 'row 016') go insert into #dblib0002 values (17, 'row 017') go insert into #dblib0002 values (18, 'row 018') go insert into #dblib0002 values (19, 'row 019') go insert into #dblib0002 values (20, 'row 020') go insert into #dblib0002 values (21, 'row 021') go insert into #dblib0002 values (22, 'row 022') go insert into #dblib0002 values (23, 'row 023') go insert into #dblib0002 values (24, 'row 024') go insert into #dblib0002 values (25, 'row 025') go insert into #dblib0002 values (26, 'row 026') go insert into #dblib0002 values (27, 'row 027') go insert into #dblib0002 values (28, 'row 028') go insert into #dblib0002 values (29, 'row 029') go insert into #dblib0002 values (30, 'row 030') go insert into #dblib0002 values (31, 'row 031') go insert into #dblib0002 values (32, 'row 032') go insert into #dblib0002 values (33, 'row 033') go insert into #dblib0002 values (34, 'row 034') go insert into #dblib0002 values (35, 'row 035') go insert into #dblib0002 values (36, 'row 036') go insert into #dblib0002 values (37, 'row 037') go insert into #dblib0002 values (38, 'row 038') go insert into #dblib0002 values (39, 'row 039') go insert into #dblib0002 values (40, 'row 040') go insert into #dblib0002 values (41, 'row 041') go insert into #dblib0002 values (42, 'row 042') go insert into #dblib0002 values (43, 'row 043') go insert into #dblib0002 values (44, 'row 044') go insert into #dblib0002 values (45, 'row 045') go insert into #dblib0002 values (46, 'row 046') go insert into #dblib0002 values (47, 'row 047') go insert into #dblib0002 values (48, 'row 048') go insert into #dblib0002 values (49, 'row 049') go insert into #dblib0002 values (50, 'row 050') go select * from #dblib0002 order by i select * from #dblib0002 order by i go freetds-1.3.6/src/dblib/unittests/t0003.c000644 025423 025423 00000004635 14056414221 021431 0ustar00fredianofrediano000000 000000 /* * Purpose: Test buffering * Functions: dbclrbuf dbgetrow dbsetopt */ #include "common.h" int failed = 0; int main(int argc, char **argv) { RETCODE rc; const int rows_to_add = 50; LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0003"); DBSETLHOST(login, "ntbox.dntis.ro"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); #ifdef MICROSOFT_DBLIB dbsetopt(dbproc, DBBUFFER, "100"); #else dbsetopt(dbproc, DBBUFFER, "100", 0); #endif printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 1; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { failed = 1; printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); for (i = 1; i < rows_to_add; i++) { char expected[1024]; sprintf(expected, "row %03d", i); if (i % 100 == 0) { dbclrbuf(dbproc, 100); } if (REG_ROW != dbnextrow(dbproc)) { failed = 1; fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { failed = 1; fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { failed = 1; printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } dbclrbuf(dbproc, 1); rc = dbnextrow(dbproc); if (rc != NO_MORE_ROWS) { failed = 1; fprintf(stderr, "Was expecting no more rows. (rc=%d)\n", rc); exit(1); } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0003.sql000644 025423 025423 00000004700 14056414221 021777 0ustar00fredianofrediano000000 000000 create table #dblib0003 (i int not null, s char(10) not null) go insert into #dblib0003 values (1, 'row 001') go insert into #dblib0003 values (2, 'row 002') go insert into #dblib0003 values (3, 'row 003') go insert into #dblib0003 values (4, 'row 004') go insert into #dblib0003 values (5, 'row 005') go insert into #dblib0003 values (6, 'row 006') go insert into #dblib0003 values (7, 'row 007') go insert into #dblib0003 values (8, 'row 008') go insert into #dblib0003 values (9, 'row 009') go insert into #dblib0003 values (10, 'row 010') go insert into #dblib0003 values (11, 'row 011') go insert into #dblib0003 values (12, 'row 012') go insert into #dblib0003 values (13, 'row 013') go insert into #dblib0003 values (14, 'row 014') go insert into #dblib0003 values (15, 'row 015') go insert into #dblib0003 values (16, 'row 016') go insert into #dblib0003 values (17, 'row 017') go insert into #dblib0003 values (18, 'row 018') go insert into #dblib0003 values (19, 'row 019') go insert into #dblib0003 values (20, 'row 020') go insert into #dblib0003 values (21, 'row 021') go insert into #dblib0003 values (22, 'row 022') go insert into #dblib0003 values (23, 'row 023') go insert into #dblib0003 values (24, 'row 024') go insert into #dblib0003 values (25, 'row 025') go insert into #dblib0003 values (26, 'row 026') go insert into #dblib0003 values (27, 'row 027') go insert into #dblib0003 values (28, 'row 028') go insert into #dblib0003 values (29, 'row 029') go insert into #dblib0003 values (30, 'row 030') go insert into #dblib0003 values (31, 'row 031') go insert into #dblib0003 values (32, 'row 032') go insert into #dblib0003 values (33, 'row 033') go insert into #dblib0003 values (34, 'row 034') go insert into #dblib0003 values (35, 'row 035') go insert into #dblib0003 values (36, 'row 036') go insert into #dblib0003 values (37, 'row 037') go insert into #dblib0003 values (38, 'row 038') go insert into #dblib0003 values (39, 'row 039') go insert into #dblib0003 values (40, 'row 040') go insert into #dblib0003 values (41, 'row 041') go insert into #dblib0003 values (42, 'row 042') go insert into #dblib0003 values (43, 'row 043') go insert into #dblib0003 values (44, 'row 044') go insert into #dblib0003 values (45, 'row 045') go insert into #dblib0003 values (46, 'row 046') go insert into #dblib0003 values (47, 'row 047') go insert into #dblib0003 values (48, 'row 048') go insert into #dblib0003 values (49, 'row 049') go select * from #dblib0003 order by i go freetds-1.3.6/src/dblib/unittests/t0004.c000644 025423 025423 00000005612 14056414221 021426 0ustar00fredianofrediano000000 000000 /* * Purpose: Test retrieving data and attempting to initiate a new query with results pending * Functions: dbnextrow dbresults dbsqlexec dbgetchar */ #include "common.h" #include int main(int argc, char **argv) { const int rows_to_add = 50; LOGINREC *login; DBPROCESS *dbproc; int i, expected_error; char *s, teststr[1024]; DBINT testint; int failed = 0; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0004"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 1; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } sql_cmd(dbproc); /* select */ dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); for (i = 1; i <= 24; i++) { char expected[1024]; sprintf(expected, "row %04d", i); if (i % 5 == 0) { dbclrbuf(dbproc, 5); } testint = -1; strcpy(teststr, "bogus"); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } printf("second select\n"); printf("testing dbgetchar...\n"); for (i=0; (s = dbgetchar(dbproc, i)) != NULL; i++) { putchar(*s); if (!(isprint((unsigned char)*s) || iscntrl((unsigned char)*s))) { fprintf(stderr, "%s:%d: dbgetchar failed with %x at position %d\n", __FILE__, __LINE__, *s, i); failed = 1; break; } } printf("<== end of command buffer\n"); if (SUCCEED != sql_cmd(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); failed = 1; } printf("About to exec for the second time. Should fail\n"); expected_error = 20019; dbsetuserdata(dbproc, (BYTE*) &expected_error); if (FAIL != dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbsqlexec should have failed but didn't\n", __FILE__, __LINE__); failed = 1; } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0004.sql000644 025423 025423 00000005313 14056414221 022001 0ustar00fredianofrediano000000 000000 create table #dblib0004 (i int not null, s char(10) not null) go insert into #dblib0004 values (1, 'row 0001') go insert into #dblib0004 values (2, 'row 0002') go insert into #dblib0004 values (3, 'row 0003') go insert into #dblib0004 values (4, 'row 0004') go insert into #dblib0004 values (5, 'row 0005') go insert into #dblib0004 values (6, 'row 0006') go insert into #dblib0004 values (7, 'row 0007') go insert into #dblib0004 values (8, 'row 0008') go insert into #dblib0004 values (9, 'row 0009') go insert into #dblib0004 values (10, 'row 0010') go insert into #dblib0004 values (11, 'row 0011') go insert into #dblib0004 values (12, 'row 0012') go insert into #dblib0004 values (13, 'row 0013') go insert into #dblib0004 values (14, 'row 0014') go insert into #dblib0004 values (15, 'row 0015') go insert into #dblib0004 values (16, 'row 0016') go insert into #dblib0004 values (17, 'row 0017') go insert into #dblib0004 values (18, 'row 0018') go insert into #dblib0004 values (19, 'row 0019') go insert into #dblib0004 values (20, 'row 0020') go insert into #dblib0004 values (21, 'row 0021') go insert into #dblib0004 values (22, 'row 0022') go insert into #dblib0004 values (23, 'row 0023') go insert into #dblib0004 values (24, 'row 0024') go insert into #dblib0004 values (25, 'row 0025') go insert into #dblib0004 values (26, 'row 0026') go insert into #dblib0004 values (27, 'row 0027') go insert into #dblib0004 values (28, 'row 0028') go insert into #dblib0004 values (29, 'row 0029') go insert into #dblib0004 values (30, 'row 0030') go insert into #dblib0004 values (31, 'row 0031') go insert into #dblib0004 values (32, 'row 0032') go insert into #dblib0004 values (33, 'row 0033') go insert into #dblib0004 values (34, 'row 0034') go insert into #dblib0004 values (35, 'row 0035') go insert into #dblib0004 values (36, 'row 0036') go insert into #dblib0004 values (37, 'row 0037') go insert into #dblib0004 values (38, 'row 0038') go insert into #dblib0004 values (39, 'row 0039') go insert into #dblib0004 values (40, 'row 0040') go insert into #dblib0004 values (41, 'row 0041') go insert into #dblib0004 values (42, 'row 0042') go insert into #dblib0004 values (43, 'row 0043') go insert into #dblib0004 values (44, 'row 0044') go insert into #dblib0004 values (45, 'row 0045') go insert into #dblib0004 values (46, 'row 0046') go insert into #dblib0004 values (47, 'row 0047') go insert into #dblib0004 values (48, 'row 0048') go insert into #dblib0004 values (49, 'row 0049') go select * from #dblib0004 where i<=25 order by i go /* The following statement fails intentionally: * the unit test is checking that db-lib returns FAIL * when results have not been fully processed. */ select * from #dblib0004 where i<=25 order by i go freetds-1.3.6/src/dblib/unittests/t0005.c000644 025423 025423 00000013617 14056414221 021433 0ustar00fredianofrediano000000 000000 /* * Purpose: Test data retrieval accuracy and cancelling results * Functions: dbbind dbcancel dbcmd dbcolname dbnextrow dbnumcols dbresults dbsqlexec */ #include "common.h" int main(int argc, char **argv) { const int rows_to_add = 50; LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint; int failed = 0; int expected_error; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0005"); DBSETLHOST(login, "ntbox.dntis.ro"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("creating table\n"); if (SUCCEED != sql_cmd(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); failed = 1; } if (SUCCEED != dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); failed = 1; } while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 1; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); for (i = 1; i < 5; i++) { char expected[1024]; sprintf(expected, "row %04d", i); testint = -1; strcpy(teststr, "bogus"); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } printf("This query should succeeded as we have fetched the exact\n" "number of rows in the result set\n"); expected_error = 20019; dbsetuserdata(dbproc, (BYTE*) &expected_error); if (SUCCEED != sql_cmd(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); failed = 1; } if (SUCCEED != dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbsqlexec should have succeeded but didn't\n", __FILE__, __LINE__); failed = 1; } if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); for (i = 1; i < 5; i++) { char expected[1024]; sprintf(expected, "row %04d", i); testint = -1; strcpy(teststr, "bogus"); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } printf("Testing anticipated failure\n"); if (SUCCEED != sql_cmd(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); failed = 1; } if (SUCCEED == dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbsqlexec should have failed but didn't\n", __FILE__, __LINE__); failed = 1; } printf("calling dbcancel to flush results\n"); dbcancel(dbproc); printf("Dropping proc\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("creating proc\n"); sql_cmd(dbproc); if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "%s:%d: failed to create procedure\n", __FILE__, __LINE__); failed = 1; } while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("calling proc\n"); sql_cmd(dbproc); if (dbsqlexec(dbproc) == FAIL) { fprintf(stderr, "%s:%d: failed to call procedure\n", __FILE__, __LINE__); failed = 1; } if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); for (i = 1; i < 6; i++) { char expected[1024]; sprintf(expected, "row %04d", i); testint = -1; strcpy(teststr, "bogus"); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } printf("Calling dbsqlexec before dbnextrow returns NO_MORE_ROWS\n"); printf("The following command should succeed because\n" "we have fetched the exact number of rows in the result set\n"); if (SUCCEED != sql_cmd(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); failed = 1; } if (SUCCEED != dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbsqlexec should have succeeded but didn't\n", __FILE__, __LINE__); failed = 1; } dbcancel(dbproc); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0005.sql000644 025423 025423 00000005766 14056414221 022016 0ustar00fredianofrediano000000 000000 create table #dblib0005 (i int not null, s char(10) not null) go insert into #dblib0005 values (1, 'row 0001') go insert into #dblib0005 values (2, 'row 0002') go insert into #dblib0005 values (3, 'row 0003') go insert into #dblib0005 values (4, 'row 0004') go insert into #dblib0005 values (5, 'row 0005') go insert into #dblib0005 values (6, 'row 0006') go insert into #dblib0005 values (7, 'row 0007') go insert into #dblib0005 values (8, 'row 0008') go insert into #dblib0005 values (9, 'row 0009') go insert into #dblib0005 values (10, 'row 0010') go insert into #dblib0005 values (11, 'row 0011') go insert into #dblib0005 values (12, 'row 0012') go insert into #dblib0005 values (13, 'row 0013') go insert into #dblib0005 values (14, 'row 0014') go insert into #dblib0005 values (15, 'row 0015') go insert into #dblib0005 values (16, 'row 0016') go insert into #dblib0005 values (17, 'row 0017') go insert into #dblib0005 values (18, 'row 0018') go insert into #dblib0005 values (19, 'row 0019') go insert into #dblib0005 values (20, 'row 0020') go insert into #dblib0005 values (21, 'row 0021') go insert into #dblib0005 values (22, 'row 0022') go insert into #dblib0005 values (23, 'row 0023') go insert into #dblib0005 values (24, 'row 0024') go insert into #dblib0005 values (25, 'row 0025') go insert into #dblib0005 values (26, 'row 0026') go insert into #dblib0005 values (27, 'row 0027') go insert into #dblib0005 values (28, 'row 0028') go insert into #dblib0005 values (29, 'row 0029') go insert into #dblib0005 values (30, 'row 0030') go insert into #dblib0005 values (31, 'row 0031') go insert into #dblib0005 values (32, 'row 0032') go insert into #dblib0005 values (33, 'row 0033') go insert into #dblib0005 values (34, 'row 0034') go insert into #dblib0005 values (35, 'row 0035') go insert into #dblib0005 values (36, 'row 0036') go insert into #dblib0005 values (37, 'row 0037') go insert into #dblib0005 values (38, 'row 0038') go insert into #dblib0005 values (39, 'row 0039') go insert into #dblib0005 values (40, 'row 0040') go insert into #dblib0005 values (41, 'row 0041') go insert into #dblib0005 values (42, 'row 0042') go insert into #dblib0005 values (43, 'row 0043') go insert into #dblib0005 values (44, 'row 0044') go insert into #dblib0005 values (45, 'row 0045') go insert into #dblib0005 values (46, 'row 0046') go insert into #dblib0005 values (47, 'row 0047') go insert into #dblib0005 values (48, 'row 0048') go insert into #dblib0005 values (49, 'row 0049') go select * from #dblib0005 where i < 5 order by i go select * from #dblib0005 where i < 6 order by i go /* * The following query should fail because the test * has not fetched all the rows in the result set. */ select * from #dblib0005 where i > 950 order by i go if object_id('t0005_proc') is not null drop procedure t0005_proc go create proc t0005_proc (@b int out) as begin select * from #dblib0005 where i < 6 order by i select @b = 42 end go declare @myout int exec t0005_proc @b = @myout output go select getdate() go drop procedure t0005_proc go freetds-1.3.6/src/dblib/unittests/t0006.c000644 025423 025423 00000005651 14056414221 021433 0ustar00fredianofrediano000000 000000 /* * Purpose: Test fetching 50 rows in two result sets with a 5000-row buffer. * Functions: dbbind dbcmd dbnextrow dbnumcols dbresults dbsetopt dbsqlexec */ #include "common.h" static char teststr[1024]; static DBINT testint; static int failed = 0; static void get_results(DBPROCESS * dbproc, int start) { int current = start - 1; while (REG_ROW == dbnextrow(dbproc)) { char expected[1024]; current++; sprintf(expected, "row %04d", current); if (testint != current) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", current, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } } int main(int argc, char **argv) { RETCODE rc; const int rows_to_add = 50; LOGINREC *login; DBPROCESS *dbproc; int i; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0006"); DBSETLHOST(login, "ntbox.dntis.ro"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); #ifdef MICROSOFT_DBLIB dbsetopt(dbproc, DBBUFFER, "5000"); #else dbsetopt(dbproc, DBBUFFER, "5000", 0); #endif printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 1; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } printf("first select\n"); if (SUCCEED != sql_cmd(dbproc)) { fprintf(stderr, "%s:%d: dbcmd failed\n", __FILE__, __LINE__); failed = 1; } if (SUCCEED != dbsqlexec(dbproc)) { fprintf(stderr, "%s:%d: dbsqlexec failed\n", __FILE__, __LINE__); failed = 1; } if (dbresults(dbproc) != SUCCEED) { printf("%s:%d: Was expecting a result set.", __FILE__, __LINE__); failed = 1; exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); get_results(dbproc, 1); testint = -1; strcpy(teststr, "bogus"); printf("second select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if ((rc = dbresults(dbproc)) != SUCCEED) { printf("%s:%d: Was expecting a result set. (rc=%d)\n", __FILE__, __LINE__, rc); failed = 1; } if (!failed) { dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); get_results(dbproc, 25); } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0006.sql000644 025423 025423 00000005057 14056414221 022010 0ustar00fredianofrediano000000 000000 create table #dblib0006 (i int not null, s char(10) not null) go insert into #dblib0006 values (1, 'row 0001') go insert into #dblib0006 values (2, 'row 0002') go insert into #dblib0006 values (3, 'row 0003') go insert into #dblib0006 values (4, 'row 0004') go insert into #dblib0006 values (5, 'row 0005') go insert into #dblib0006 values (6, 'row 0006') go insert into #dblib0006 values (7, 'row 0007') go insert into #dblib0006 values (8, 'row 0008') go insert into #dblib0006 values (9, 'row 0009') go insert into #dblib0006 values (10, 'row 0010') go insert into #dblib0006 values (11, 'row 0011') go insert into #dblib0006 values (12, 'row 0012') go insert into #dblib0006 values (13, 'row 0013') go insert into #dblib0006 values (14, 'row 0014') go insert into #dblib0006 values (15, 'row 0015') go insert into #dblib0006 values (16, 'row 0016') go insert into #dblib0006 values (17, 'row 0017') go insert into #dblib0006 values (18, 'row 0018') go insert into #dblib0006 values (19, 'row 0019') go insert into #dblib0006 values (20, 'row 0020') go insert into #dblib0006 values (21, 'row 0021') go insert into #dblib0006 values (22, 'row 0022') go insert into #dblib0006 values (23, 'row 0023') go insert into #dblib0006 values (24, 'row 0024') go insert into #dblib0006 values (25, 'row 0025') go insert into #dblib0006 values (26, 'row 0026') go insert into #dblib0006 values (27, 'row 0027') go insert into #dblib0006 values (28, 'row 0028') go insert into #dblib0006 values (29, 'row 0029') go insert into #dblib0006 values (30, 'row 0030') go insert into #dblib0006 values (31, 'row 0031') go insert into #dblib0006 values (32, 'row 0032') go insert into #dblib0006 values (33, 'row 0033') go insert into #dblib0006 values (34, 'row 0034') go insert into #dblib0006 values (35, 'row 0035') go insert into #dblib0006 values (36, 'row 0036') go insert into #dblib0006 values (37, 'row 0037') go insert into #dblib0006 values (38, 'row 0038') go insert into #dblib0006 values (39, 'row 0039') go insert into #dblib0006 values (40, 'row 0040') go insert into #dblib0006 values (41, 'row 0041') go insert into #dblib0006 values (42, 'row 0042') go insert into #dblib0006 values (43, 'row 0043') go insert into #dblib0006 values (44, 'row 0044') go insert into #dblib0006 values (45, 'row 0045') go insert into #dblib0006 values (46, 'row 0046') go insert into #dblib0006 values (47, 'row 0047') go insert into #dblib0006 values (48, 'row 0048') go insert into #dblib0006 values (49, 'row 0049') go select * from #dblib0006 where i<50 order by i go select * from #dblib0006 where i>=25 order by i go freetds-1.3.6/src/dblib/unittests/t0007.c000644 025423 025423 00000015334 14056414221 021433 0ustar00fredianofrediano000000 000000 /* * Purpose: Test binding strings and ints, attempt 2nd query with results pending. * Functions: dbbind dbcmd dbnextrow dbopen dbresults dbsqlexec */ #include "common.h" static void create_tables(DBPROCESS * dbproc, int rows_to_add) { int i; printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 1; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } } static int start_query(DBPROCESS * dbproc) { int i; if (SUCCEED != sql_cmd(dbproc)) { return 0; } if (SUCCEED != dbsqlexec(dbproc)) { return 0; } if (dbresults(dbproc) != SUCCEED) return 0; for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is named \"%s\"\n", i, dbcolname(dbproc, i)); return 1; } static const char * hex_buffer(BYTE *binarybuffer, int size, char *textbuf) { int i; strcpy(textbuf, "0x"); /* must be large enough */ for (i = 0; i < size; i++) { sprintf(textbuf + 2 + i * 2, "%02X", binarybuffer[i]); } return textbuf; /* convenience */ } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024], teststr2[1024]; DBINT testint, binvaluelength; DBVARYBIN testvbin, testvbin2; DBVARYCHAR testvstr; BYTE testbin[10]; int failed = 0; int expected_error; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0007"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); create_tables(dbproc, 10); if (!start_query(dbproc)) { fprintf(stderr, "%s:%d: start_query failed\n", __FILE__, __LINE__); failed = 1; } dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); for (i = 1; i <= 2; i++) { char expected[1024]; sprintf(expected, "row %07d", i); if (i % 5 == 0) { dbclrbuf(dbproc, 5); } testint = -1; strcpy(teststr, "bogus"); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); abort(); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } printf("second select. Should fail.\n"); expected_error = 20019; dbsetuserdata(dbproc, (BYTE*) &expected_error); if (start_query(dbproc)) { fprintf(stderr, "%s:%d: start_query should have failed but didn't\n", __FILE__, __LINE__); failed = 1; } dbcancel(dbproc); /* * Test Binary binding */ if (!start_query(dbproc)) { fprintf(stderr, "%s:%d: start_query failed\n", __FILE__, __LINE__); failed = 1; } dbbind(dbproc, 1, VARYBINBIND, sizeof(testvbin), (BYTE *) &testvbin); dbbind(dbproc, 2, VARYCHARBIND, sizeof(testvstr), (BYTE *) &testvstr); dbbind(dbproc, 3, BINARYBIND, sizeof(testint), (BYTE *) &testint); for (i = 1; i <= 2; i++) { char expected[1024]; sprintf(expected, "row %07d ", i); testint = -1; memset(&testvbin, '*', sizeof(testvbin)); memset(&testvstr, '*', sizeof(testvstr)); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); abort(); } if (testint != i) { fprintf(stderr, "Failed, line %d. Expected i to be %d, was %d (0x%x)\n", __LINE__, i, (int) testint, (int) testint); abort(); } if (testvbin.len != sizeof(testint)) { fprintf(stderr, "Failed, line %d. Expected bin length to be %d, was %d\n", __LINE__, (int) sizeof(testint), (int) testvbin.len); abort(); } memcpy(&testint, testvbin.array, sizeof(testint)); if (testint != i) { fprintf(stderr, "Failed, line %d. Expected i to be %d, was %d (0x%x)\n", __LINE__, i, (int) testint, (int) testint); abort(); } if (testvstr.len != strlen(expected) || 0 != strncmp(testvstr.str, expected, strlen(expected))) { printf("Failed, line %d. Expected s to be |%s|, was |%s|\n", __LINE__, expected, testvstr.str); abort(); } testvstr.str[testvstr.len] = 0; printf("Read a row of data -> %d %s\n", (int) testint, testvstr.str); } dbcancel(dbproc); /* * Test var binary bindings of binary values */ if (!start_query(dbproc)) { fprintf(stderr, "%s:%d: start_query failed\n", __FILE__, __LINE__); failed = 1; } dbbind(dbproc, 1, INTBIND, 0, (BYTE *) &binvaluelength); /* returned binary string length (all columns) */ dbbind(dbproc, 2, VARYBINBIND, sizeof(testvbin), (BYTE *) &testvbin); /* returned as varbinary, bound varbinary */ dbbind(dbproc, 3, VARYBINBIND, sizeof(testvbin2), (BYTE *) &testvbin2); /* returned as binary, bound varbinary */ dbbind(dbproc, 4, BINARYBIND, sizeof(testbin), (BYTE *) &testbin); /* returned as varbinary, bound binary */ memset(&testvbin, '*', sizeof(testvbin)); memset(&testvbin2, '*', sizeof(testvbin2)); memset(&testbin, '@', sizeof(testbin)); /* different. After fetch all buffers should have same value */ if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); abort(); } if (testvbin.len != binvaluelength) { fprintf(stderr, "Failed, line %d. Expected bin length to be %d, was %d\n", __LINE__, (int) binvaluelength, (int) testvbin.len); abort(); } if (testvbin2.len != binvaluelength) { fprintf(stderr, "Failed, line %d. Expected bin length to be %d, was %d\n", __LINE__, (int) binvaluelength, (int) testvbin.len); abort(); } if (memcmp(testvbin.array, testbin, binvaluelength) != 0) { fprintf(stderr, "Failed, line %d. Expected buffer to be %s, was %s\n", __LINE__, hex_buffer(testbin, binvaluelength, teststr), hex_buffer(testvbin.array, binvaluelength, teststr2)); abort(); } if (memcmp(testvbin2.array, testbin, binvaluelength) != 0) { fprintf(stderr, "Failed, line %d. Expected buffer to be %s, was %s\n", __LINE__, hex_buffer(testbin, binvaluelength, teststr), hex_buffer(testvbin2.array, binvaluelength, teststr2)); abort(); } memset(teststr2, 0, sizeof(teststr2)); /* finally, test binary padding is all zeroes */ if (memcmp(testbin + binvaluelength, teststr2, sizeof(testbin) - binvaluelength) != 0) { fprintf(stderr, "Failed, line %d. Expected binary padding to be zeroes, was %s\n", __LINE__, hex_buffer(testbin + binvaluelength, sizeof(testbin) - binvaluelength, teststr)); abort(); } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0007.sql000644 025423 025423 00000002013 14056414221 021776 0ustar00fredianofrediano000000 000000 create table #dblib0007 (i int not null, s char(12) not null) go insert into #dblib0007 values (1, 'row 0000001') go insert into #dblib0007 values (2, 'row 0000002') go insert into #dblib0007 values (3, 'row 0000003') go insert into #dblib0007 values (4, 'row 0000004') go insert into #dblib0007 values (5, 'row 0000005') go insert into #dblib0007 values (6, 'row 0000006') go insert into #dblib0007 values (7, 'row 0000007') go insert into #dblib0007 values (8, 'row 0000008') go insert into #dblib0007 values (9, 'row 0000009') go select * from #dblib0007 where i<=5 order by i go /* * Second select, should fail: expected_error = 20019 */ select * from #dblib0007 where i>=5 order by i go /* * Third select for binary bindings */ select i, s, i from #dblib0007 x where x.i<=5 order by x.i go /* * Fourth select for var binary bindings of binary values */ select 7 as 'size', convert(varbinary(10), 0x01020304050607) as 'vb', convert(binary(7), 0x01020304050607) as 'bin1', convert(varbinary(7), 0x01020304050607) as 'bin2' go freetds-1.3.6/src/dblib/unittests/t0008.c000644 025423 025423 00000005462 14056414221 021435 0ustar00fredianofrediano000000 000000 /* * Purpose: Test buffering. As of April 2005, jkl believes this test is broken. * Functions: dbclrbuf dbsetopt */ #include "common.h" int main(int argc, char **argv) { const int rows_to_add = 48; LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint; DBINT last_read = -1; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0008"); DBSETLHOST(login, "ntbox.dntis.ro"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); #ifdef MICROSOFT_DBLIB dbsetopt(dbproc, DBBUFFER, "25"); #else dbsetopt(dbproc, DBBUFFER, "25", 0); #endif printf("creating table\n"); dbcmd(dbproc, "create table #dblib0008 (i int not null, s char(10) not null)"); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 1; i <= rows_to_add; i++) { char cmd[1024]; sprintf(cmd, "insert into #dblib0008 values (%d, 'row %03d')", i, i); dbcmd(dbproc, cmd); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } printf("select\n"); dbcmd(dbproc, "select * from #dblib0008 order by i"); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); for (i = 1; i <= rows_to_add; i++) { char expected[1024]; sprintf(expected, "row %03d", i); if (i % 25 == 0) { dbclrbuf(dbproc, 25); } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "dblib failed for %s, dbnextrow1\n", __FILE__); dbexit(); return 1; } last_read = testint; if (testint < 1 || testint > rows_to_add) { fprintf(stderr, "dblib failed for %s testint = %d\n", __FILE__, (int) testint); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } if (REG_ROW == dbnextrow(dbproc)) { fprintf(stderr, "dblib failed for %s, dbnextrow2\n", __FILE__); dbexit(); return 1; } dbexit(); printf("%s %s (last_read: %d)\n", __FILE__, ((last_read != rows_to_add)? "failed!" : "OK"), (int) last_read); return (last_read == rows_to_add) ? 0 : 1; } freetds-1.3.6/src/dblib/unittests/t0009.c000644 025423 025423 00000004377 14056414221 021442 0ustar00fredianofrediano000000 000000 /* * Purpose: Test if dbbind can handle a varlen of 0 with a column bound as STRINGBIND and a database column of CHAR. * Functions: dbbind dbcmd dbnextrow dbnumcols dbopen dbresults dbsqlexec */ #include "common.h" int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0009"); DBSETLHOST(login, "ntbox.dntis.ro"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); #ifdef MICROSOFT_DBLIB dbsetopt(dbproc, DBBUFFER, "100"); #else dbsetopt(dbproc, DBBUFFER, "100", 0); #endif printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "dblib failed for %s\n", __FILE__); exit(1); } if (0 != strcmp("abcdef ", teststr)) { fprintf(stderr, "Expected |%s|, found |%s|\n", "abcdef", teststr); fprintf(stderr, "dblib failed for %s\n", __FILE__); exit(1); } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "dblib failed for %s\n", __FILE__); exit(1); } if (0 != strcmp("abc ", teststr)) { fprintf(stderr, "Expected |%s|, found |%s|\n", "abc", teststr); fprintf(stderr, "dblib failed for %s\n", __FILE__); exit(1); } dbexit(); printf("dblib passed for %s\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/t0009.sql000644 025423 025423 00000000303 14056414221 022000 0ustar00fredianofrediano000000 000000 create table #dblib0009 (i int not null, s char(10) not null) go insert into #dblib0009 values (1, 'abcdef') go insert into #dblib0009 values (2, 'abc') go select * from #dblib0009 order by i go freetds-1.3.6/src/dblib/unittests/t0011.c000644 025423 025423 00000005065 14056414221 021426 0ustar00fredianofrediano000000 000000 /* * Purpose: Test binding of string types * Functions: dbbind dbcmd dbcolname dbnextrow dbnumcols dbopen dbresults dbsqlexec */ #include "common.h" static int failed = 0; static void insert_row(DBPROCESS * dbproc); static int select_rows(DBPROCESS * dbproc, int bind_type); int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0011"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("Dropping table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); insert_row(dbproc); insert_row(dbproc); insert_row(dbproc); failed = select_rows(dbproc, STRINGBIND); dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } static int select_rows(DBPROCESS * dbproc, int bind_type) { char teststr[1024]; char teststr2[1024]; char testvstr[1024]; DBINT testint; DBINT i; printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { failed = 1; printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) { printf("col %d is %s\n", i, dbcolname(dbproc, i)); } if (SUCCEED != dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); return 1; } if (SUCCEED != dbbind(dbproc, 2, bind_type, 0, (BYTE *) teststr)) { fprintf(stderr, "Had problem with bind\n"); return 1; } if (SUCCEED != dbbind(dbproc, 3, bind_type, 0, (BYTE *) teststr2)) { fprintf(stderr, "Had problem with bind\n"); return 1; } if (SUCCEED != dbbind(dbproc, 4, bind_type, 0, (BYTE *) testvstr)) { fprintf(stderr, "Had problem with bind\n"); return 1; } i = 0; while (dbnextrow(dbproc) == REG_ROW) { i++; if (testint != i) { printf("Failed. Expected i to be |%d|, was |%d|\n", testint, i); return 1; } printf("c: %s$\n", teststr); printf("c2: %s$\n", teststr2); printf("vc: %s$\n", testvstr); if (bind_type == STRINGBIND) { } else { } } return 0; } static void insert_row(DBPROCESS * dbproc) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } freetds-1.3.6/src/dblib/unittests/t0011.sql000644 025423 025423 00000001102 14056414221 021767 0ustar00fredianofrediano000000 000000 drop table #dblib0011 go create table #dblib0011 (i int not null, c1 char(200) not null, c2 char(200) null, vc varchar(200) null) go insert into #dblib0011 values (1, 'This is a really long column to ensure that the next row ends properly.','This is a really long column to ensure that the next row ends properly.','This is a really long column to ensure that the next row ends properly.') go insert into #dblib0011 values (2, 'Short column','Short column','Short column') go insert into #dblib0011 values (3, 'Short column',NULL,NULL) go select * from #dblib0011 order by i go freetds-1.3.6/src/dblib/unittests/t0012.c000644 025423 025423 00000010710 14056414221 021420 0ustar00fredianofrediano000000 000000 /* * Purpose: Test datetime conversion as well as dbdata() & dbdatlen() * Functions: dbcmd dbdata dbdatecrack dbdatlen dbnextrow dbresults dbsqlexec */ #include "common.h" static int failed = 0; static void set_failed(int line) { failed = 1; fprintf(stderr, "Failed check at line %d\n", line); } #define set_failed() set_failed(__LINE__) #ifdef MSDBLIB #define dateyear year #define datemonth month #define datedmonth day #define datedyear dayofyear #define datedweek weekday #define datehour hour #define dateminute minute #define datesecond second #define datemsecond millisecond #define datensecond nanosecond #endif static int ignore_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line) { return 0; } int main(int argc, char *argv[]) { LOGINREC *login; DBPROCESS *dbproc; char datestring[256]; DBDATEREC dateinfo; #ifdef SYBMSDATETIME2 DBDATEREC2 dateinfo2; #endif DBDATETIME mydatetime; int output_count = 0; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0012"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); } dbloginfree(login); printf("After logon\n"); printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } /* insert */ sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } /* insert */ sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } /* select */ sql_cmd(dbproc); dbsqlexec(dbproc); dbresults(dbproc); while (dbnextrow(dbproc) != NO_MORE_ROWS) { ++output_count; /* Print the date info */ dbconvert(dbproc, dbcoltype(dbproc, 1), dbdata(dbproc, 1), dbdatlen(dbproc, 1), SYBCHAR, (BYTE*) datestring, -1); printf("%s\n", datestring); /* Break up the creation date into its constituent parts */ memcpy(&mydatetime, (DBDATETIME *) (dbdata(dbproc, 1)), sizeof(DBDATETIME)); dbdatecrack(dbproc, &dateinfo, &mydatetime); /* Print the parts of the creation date */ printf("\tYear = %d.\n", dateinfo.dateyear); printf("\tMonth = %d.\n", dateinfo.datemonth); printf("\tDay of month = %d.\n", dateinfo.datedmonth); printf("\tDay of year = %d.\n", dateinfo.datedyear); printf("\tDay of week = %d.\n", dateinfo.datedweek); printf("\tHour = %d.\n", dateinfo.datehour); printf("\tMinute = %d.\n", dateinfo.dateminute); printf("\tSecond = %d.\n", dateinfo.datesecond); printf("\tMillisecond = %d.\n", dateinfo.datemsecond); if (dateinfo.dateyear != 1898 && dateinfo.dateyear != 2001) set_failed(); if (dateinfo.dateminute != 24 && dateinfo.dateminute != 30) set_failed(); if (dateinfo.datehour != 19 && dateinfo.datehour != 10) set_failed(); } dbresults(dbproc); if (output_count != 2) set_failed(); #ifdef SYBMSDATETIME2 dbmsghandle(ignore_msg_handler); /* select */ sql_cmd(dbproc); dbsqlexec(dbproc); dbresults(dbproc); while (dbnextrow(dbproc) != NO_MORE_ROWS) { int type = dbcoltype(dbproc, 1); ++output_count; /* Print the date info */ dbconvert(dbproc, type, dbdata(dbproc, 1), dbdatlen(dbproc, 1), SYBCHAR, (BYTE*) datestring, -1); printf("%s\n", datestring); /* network not high enough for this type ! */ if (type == SYBCHAR || type == SYBVARCHAR) break; /* Break up the creation date into its constituent parts */ if (dbanydatecrack(dbproc, &dateinfo2, dbcoltype(dbproc, 1), dbdata(dbproc, 1)) != SUCCEED) set_failed(); /* Print the parts of the creation date */ printf("\tYear = %d.\n", dateinfo2.dateyear); printf("\tMonth = %d.\n", dateinfo2.datemonth); printf("\tDay of month = %d.\n", dateinfo2.datedmonth); printf("\tDay of year = %d.\n", dateinfo2.datedyear); printf("\tDay of week = %d.\n", dateinfo2.datedweek); printf("\tHour = %d.\n", dateinfo2.datehour); printf("\tMinute = %d.\n", dateinfo2.dateminute); printf("\tSecond = %d.\n", dateinfo2.datesecond); printf("\tNanosecond = %d.\n", dateinfo2.datensecond); if (dateinfo2.dateyear != 1898 || dateinfo2.datensecond != 567000000) set_failed(); } #endif dbclose(dbproc); dbexit(); if (output_count < 2 || output_count > 3) set_failed(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0012.sql000644 025423 025423 00000000422 14056414221 021774 0ustar00fredianofrediano000000 000000 create table #dblib0012 (dt datetime not null) go insert into #dblib0012 values ('Feb 27 2001 10:24:35:056AM') go insert into #dblib0012 values ('Dec 25 1898 07:30:00:567PM') go SELECT dt FROM #dblib0012 go SELECT CAST('1898-12-25 16:00:00.567 -08:00' AS DATETIMEOFFSET) go freetds-1.3.6/src/dblib/unittests/t0013.c000644 025423 025423 00000014505 14056414221 021427 0ustar00fredianofrediano000000 000000 /* * Purpose: Test sending and receiving TEXT datatype * Functions: dbmoretext dbreadtext dbtxptr dbtxtimestamp dbwritetext */ #include "common.h" #define BLOB_BLOCK_SIZE 4096 int failed = 0; #define TABLE_NAME "freetds_dblib_t0013" char *testargs[] = { "", FREETDS_SRCDIR "/data.bin", "t0013.out" }; DBPROCESS *dbproc, *dbprocw; static void drop_table(void) { if (!dbproc) return; dbcancel(dbproc); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } static int test(int argc, char **argv, int over4k) { LOGINREC *login; int i; DBINT testint; FILE *fp; long result, isiz; char *blob, *rblob; DBBINARY *textPtr = NULL, *timeStamp = NULL; char objname[256]; char rbuf[BLOB_BLOCK_SIZE]; long numread; int data_ok; int numtowrite, numwritten; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0013"); printf("About to open, PASSWORD: %s, USER: %s, SERVER: %s\n", "", "", ""); /* PASSWORD, USER, SERVER); */ dbproc = dbopen(login, SERVER); dbprocw = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); dbuse(dbprocw, DATABASE); } dbloginfree(login); printf("logged in\n"); if (argc == 1) { argv = testargs; argc = 3; } if (argc < 3) { fprintf(stderr, "Usage: %s infile outfile\n", argv[0]); return 1; } if ((fp = fopen(argv[1], "rb")) == NULL) { fprintf(stderr, "Cannot open input file: %s\n", argv[1]); return 2; } printf("Reading binary input file\n"); fseek(fp, 0, SEEK_END); isiz = ftell(fp); fseek(fp, 0, SEEK_SET); blob = (char *) malloc(isiz); assert(blob); result = fread((void *) blob, isiz, 1, fp); assert(result == 1); fclose(fp); drop_table(); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error inserting blob\n"); return 4; } for (i=0; (result = dbnextrow(dbproc)) != NO_MORE_ROWS; i++) { assert(REG_ROW == result); printf("fetching row %d\n", i+1); strcpy(objname, TABLE_NAME ".PigTure"); textPtr = dbtxptr(dbproc, 1); timeStamp = dbtxtimestamp(dbproc, 1); break; /* can't proceed until no more rows */ } assert(REG_ROW == result || 0 < i); if (!textPtr && !timeStamp && dbtds(dbproc) >= DBTDS_7_2) { printf("Protocol 7.2+ detected, test not supported\n"); free(blob); dbclose(dbproc); dbproc = NULL; dbexit(); exit(0); } if (!textPtr) { fprintf(stderr, "Error getting textPtr\n"); exit(1); } /* * Use #ifdef if you want to test dbmoretext mode (needed for 16-bit apps) * Use #ifndef for big buffer version (32-bit) */ printf("writing text ... "); if (over4k) { if (dbwritetext(dbprocw, objname, textPtr, DBTXPLEN, timeStamp, FALSE, isiz, (BYTE*) blob) != SUCCEED) return 5; printf("done (in one shot)\n"); for (; (result = dbnextrow(dbproc)) != NO_MORE_ROWS; i++) { assert(REG_ROW == result); printf("fetching row %d?\n", i+1); } } else { if (dbwritetext(dbprocw, objname, textPtr, DBTXPLEN, timeStamp, FALSE, isiz, NULL) != SUCCEED) return 15; printf("done\n"); printf("dbsqlok\n"); dbsqlok(dbprocw); printf("dbresults\n"); dbresults(dbprocw); numtowrite = 0; /* Send the update value in chunks. */ for (numwritten = 0; numwritten < isiz; numwritten += numtowrite) { printf("dbmoretext %d\n", 1 + numwritten); numtowrite = (isiz - numwritten); if (numtowrite > BLOB_BLOCK_SIZE) numtowrite = BLOB_BLOCK_SIZE; dbmoretext(dbprocw, (DBINT) numtowrite, (BYTE *) (blob + numwritten)); } dbsqlok(dbprocw); while (dbresults(dbprocw) != NO_MORE_RESULTS){ printf("suprise!\n"); } } #if 0 if (SUCCEED != dbclose(dbproc)){ printf("dbclose failed"); exit(1); } dbproc = dbopen(login, SERVER); assert(dbproc); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); } #endif sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { failed = 1; printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) { printf("col %d, \"%s\", is type %s\n", i, dbcolname(dbproc, i), dbprtype(dbcoltype(dbproc, i))); } if (2 != dbnumcols(dbproc)) { fprintf(stderr, "Failed. Expected 2 columns\n"); exit(1); } if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); exit(1); } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != 1) { failed = 1; fprintf(stderr, "Failed. Expected i to be %d, was %d\n", 1, (int) testint); exit(1); } dbnextrow(dbproc); /* get the image */ sql_cmd(dbproc); dbsqlexec(dbproc); dbresults(dbproc); printf("select 2\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error extracting blob\n"); return 6; } numread = 0; rblob = NULL; while ((result = dbreadtext(dbproc, rbuf, BLOB_BLOCK_SIZE)) != NO_MORE_ROWS) { if (result != 0) { /* this indicates not end of row */ rblob = (char*) realloc(rblob, result + numread); memcpy((void *) (rblob + numread), (void *) rbuf, result); numread += result; } } data_ok = 1; if (memcmp(blob, rblob, numread) != 0) { printf("Saving first blob data row to file: %s\n", argv[2]); if ((fp = fopen(argv[2], "wb")) == NULL) { fprintf(stderr, "Unable to open output file: %s\n", argv[2]); return 3; } fwrite((void *) rblob, numread, 1, fp); fclose(fp); failed = 1; data_ok = 0; } printf("Read blob data row %d --> %s %ld byte comparison\n", (int) testint, data_ok ? "PASSED" : "failed", numread); free(rblob); if (dbnextrow(dbproc) != NO_MORE_ROWS) { failed = 1; fprintf(stderr, "Was expecting no more rows\n"); exit(1); } free(blob); drop_table(); dbclose(dbproc); dbproc = NULL; dbexit(); return 0; } int main(int argc, char **argv) { int res = test(argc, argv, 0); if (!res) res = test(argc, argv, 1); if (res) return res; printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0013.sql000644 025423 025423 00000000665 14056414221 022006 0ustar00fredianofrediano000000 000000 if object_id('freetds_dblib_t0013') is not null drop table freetds_dblib_t0013 go create table freetds_dblib_t0013 (i int not null, PigTure image not null) go insert into freetds_dblib_t0013 values (1, '') go SELECT PigTure FROM freetds_dblib_t0013 WHERE i = 1 go select i, PigTure from freetds_dblib_t0013 order by i go SET TEXTSIZE 2147483647 go SELECT PigTure FROM freetds_dblib_t0013 WHERE i = 1 go drop table freetds_dblib_t0013 go freetds-1.3.6/src/dblib/unittests/data.bin000644 025423 025423 00000164644 14056414221 022131 0ustar00fredianofrediano000000 000000 ELFdÕ4( U‰åWVSìHjèüÿÿÿèüÿÿÿ[^hÿ5èüÿÿÿèüÿÿÿÇ$èüÿÿÿÇ$èüÿÿÿZYhÿ5èüÿÿÿèüÿÿÿƒÄ j‰ÃhSèüÿÿÿƒÄ jhSèüÿÿÿƒÄ jhSèüÿÿÿÇ$hhhÿ5èüÿÿÿƒÄhSèüÿÿÿº‰Ó‰…Äåÿÿü1À¹ÿÿÿÿ‰ßò®ƒÄƒùþtƒìRÿµÄåÿÿèüÿÿÿƒÄƒìhÿ5èüÿÿÿ_Xhÿ5èüÿÿÿƒÄƒ} V‹E ÿ0hÿ5èüÿÿÿ¸éWƒìh‹} ÿwèüÿÿÿ‰ÃƒÄ…Ûu Sÿwhÿ5èüÿÿÿ¸é‰öQjjSèüÿÿÿ‰$èüÿÿÿƒÄ jjS‰…àåÿÿèüÿÿÿZÿµàåÿÿèüÿÿÿSjÿµàåÿÿP‰…ÜåÿÿèüÿÿÿƒÄSèüÿÿÿ_Xhÿ5èüÿÿÿ[^hÿµÄåÿÿèüÿÿÿYÿµÄåÿÿèüÿÿÿƒÄƒì ÿµÄåÿÿèüÿÿÿƒÄƒøuêƒìhÿ5èüÿÿÿXZhÿµÄåÿÿèüÿÿÿ_ÿµÄåÿÿèüÿÿÿƒÄ‰öƒì ÿµÄåÿÿèüÿÿÿƒÄƒøuêƒìhÿ5èüÿÿÿ[^hèåÿÿSèüÿÿÿƒÄ Shÿ5èüÿÿÿZYSÿµÄåÿÿèüÿÿÿXÿµÄåÿÿèüÿÿÿƒÄvƒì ÿµÄåÿÿèüÿÿÿƒÄƒøuêƒìhèùÿÿSèüÿÿÿ^_SÿµÄåÿÿèüÿÿÿYÿµÄåÿÿèüÿÿÿZÿµÄåÿÿèüÿÿÿƒÄHtƒìhÿ5èüÿÿÿ¸éhèúÿÿë;PjhSèüÿÿÿ^_jÿµÄåÿÿèüÿÿÿZYjÿµÄåÿÿ‰…Ôåÿÿèüÿÿÿ‰…ÐåÿÿƒÄƒì ÿµÄåÿÿèüÿÿÿ‰ÆƒÄƒþþu­ÿµÜåÿÿÿµàåÿÿjÿµÐåÿÿjÿµÔåÿÿ…èúÿÿPÿµÄåÿÿèüÿÿÿƒÄ Ht ¸éÎvƒìhÿ5èüÿÿÿ_XhÿµÄåÿÿèüÿÿÿ^ÿµÄåÿÿèüÿÿÿ[ÿµÄåÿÿèüÿÿÿƒÄHt)ƒìhÿ5ÇèüÿÿÿÇ$èüÿÿÿ»ë#ƒìSÿµÄåÿÿèüÿÿÿƒÄ PShèüÿÿÿƒÄCƒì ÿµÄåÿÿèüÿÿÿƒÄ9Ã~Éƒì …äåÿÿPjÿjjÿµÄåÿÿèüÿÿÿƒÄ Ht$ƒìhÿ5Çèüÿÿÿèüÿÿÿ‰öƒì ÿµÄåÿÿèüÿÿÿƒÄ@t,ƒìhÿ5ÇèüÿÿÿÇ$èüÿÿÿv‹…äåÿÿƒøt!PShÿ5Çèüÿÿÿèüÿÿÿƒì ÿµÄåÿÿèüÿÿÿƒÄ jèùÿÿhSèüÿÿÿZYSÿµÄåÿÿèüÿÿÿXÿµÄåÿÿèüÿÿÿ_ÿµÄåÿÿèüÿÿÿY^hÿ5èüÿÿÿXZhSèüÿÿÿ^_SÿµÄåÿÿèüÿÿÿ[ÿµÄåÿÿèüÿÿÿYÿµÄåÿÿèüÿÿÿƒÄHtƒìhÿ5èüÿÿÿ¸é½‰ö…èéÿÿÇ…ÌåÿÿÇ…Øåÿÿ‰…Èåÿÿë?‰ö…öt9‹½Ìåÿÿƒì7SÿµØåÿÿèüÿÿÿƒÄ VÿµÈåÿÿ‰…ØåÿÿøPèüÿÿÿƒÄ‰ÌåÿÿRhÿµÈåÿÿÿµÄåÿÿèüÿÿÿ‰ÆƒÄƒþþu¢ƒì‹E ÿphèüÿÿÿ_Xh‹} ÿwèüÿÿÿ‰ÃƒÄ…Ûu Vÿwhÿ5èüÿÿÿ¸éí‰öSjÿµÌåÿÿÿµØåÿÿèüÿÿÿ‰$èüÿÿÿ‹Ìåÿÿ‹…Øåÿÿ9ɉÇÿµÌåÿÿ‹µÜåÿÿüó¦—Â’À8¹u¹QÿµäåÿÿhèüÿÿÿƒÄÿµØåÿÿèüÿÿÿ[ÿµÄåÿÿèüÿÿÿƒÄƒøþt*ƒìhÿ5ÇèüÿÿÿÇ$èüÿÿÿèüÿÿÿ‹ …Éh¸u¸Phÿ5èüÿÿÿ‹1ÀƒÄ…Ò•Àeô[^_]Ã$Id: tds.h.in,v 1.39 2002/08/30 20:23:00 freddy77 Exp $8$Id: tds_configs.h.in,v 1.3 2002/02/17 20:23:37 brianb Exp $@€$Header: /cvsroot/freetds/freetds/include/tdsver.h.in,v 1.2 2002/05/25 00:33:49 brianb Exp $ $Id: sybdb.h,v 1.14 2002/08/30 21:09:22 castellano Exp $ \$Id: sybfront.h,v 1.1.1.1 2001/10/12 23:28:55 brianb Exp $€¼$Id: sqlfront.h,v 1.1.1.1 2001/10/12 23:28:56 brianb Exp $à$Id: sqldb.h,v 1.1.1.1 2001/10/12 23:28:56 brianb Exp $@x$Id: common.h,v 1.1.1.1 2001/10/12 23:29:13 brianb Exp $€¼$Id: t0013.c,v 1.3 2002/08/29 09:54:54 freddy77 Exp $à01.01—š d?dG<V€€€š€É€€>€€à€ €:€d€€§€Â€ã€€?€d€Ž€·‚̂䂢ý‚¢¢‚O€Ç¢c‚}‚¢•‚¢Î€ å€!ü€"€#'€%?€&U€1l€2„€3›€4´€5Ì€6å€8ý€9€;6€=L€>b€?x€@Ž€A¥€B½€CÓ€Dê€E€F€G/€HH€I]€NÀQÛ€Rû€S€T-€UI€Va€Xy€[“€^«€eÁ€hÛ€lõ€q €r) €uD €va €y| €z™ €}± €€Ê €ƒå €„ €‡ €Š4 ‚U ‚o €¢¥ €í €#) €, €4H €<• €CÍ €Fé €S| €Zº €^× €Œ¢¢ï €- €7!‚6‚O‚¢i‚¢€¸€8¢Í‚â‚¢‚¢5€K¢¸€ý€#D‚Y‚¢q‚†‚¢¿‚¢¢Ù‚¢€ñ€(€HR€K€L²€Uå€Z €^Y€a‘€bÉ€v€€€Œ€­¢°€5&€7?€8X€9s€:¢Ž‚Ç€+¢å€ªÿ€\€À€€A˜€X¾€aå€i €l¢0€PE‚¢c‚¢¢}‚“‚¢«‚¢ä€b€jW‚p‚¢ˆ‚¢¢€"·€#Í€$á€%ö€& €'"€(8€-N€1c€=y€B€G¦€L¾€QÔ€Wê€c €h €m- €sE €t] €zs ‚‡ ‚¢¡ €F· ‚¢Ñ €Rê ‚¢!€^¢!‚¢T!€–i!€—!€˜“!€¾ª!€¿Á!€ÀØ!€Áï!€Ä"€Å!"€Æ:"€ÇS"€Ém"‚ƒ"‚¢›"‚¢¢¶"‚Ð"‚¢è"‚¢#‚¢#‚8#€U#€¢#€&µ#‚É#€¢$‚$‚¢8$€¢t$€1$€7§$€Jñ$€Q¢%‚¢%%€æ>%€êY%€î¢t%€$&€«&‚Á&‚¢Ù&‚¢¢'€¨¢@'‚V'‚¢¢n'‚¢ƒ'‚Ÿ'‚»'‚Ô'‚ë'&(&8D(‚c(&@“(&€¢Ì(‚¢å(‚ÿ(‚¢)‚.)‚¢F)‚¢_)‚w)‚¢)€¢¢Ë)‚¢*‚*‚¢X*‚‘*‚Í*‚+‚+‚¢4+‚S+‚q+‚¢¢¢+‚¢¢¢¢¢¬+‚¢Å+€$Þ+€H,‚e,€¢,€Õ,€R-€B.€/€‹/€È/€0‚+0‚¢¢F0€¢‚0€Ù0€¢1‚ 1‚¢81‚N1‚¢f1‚¢€1‚¢1€1´1€2Ë1€4â1€;ù1€B2€C12€DM2€Ii2€M†2€N¤2€OÂ2€Tà2€[ü2€a3€b43€dP3€hm3€nŠ3€o§3€qÄ3€~Ü3€õ3€‹ 4€¢&4‚¢@4€ù5€Y6€þ7€…8€>8€î8‚¢ 9€‘9€*:€~:‚•:€ç:€0;€‘;€¢ð;‚¢<‚¢#<€¢n<‚‡<‚¢Ÿ<‚¢¢¹<‚Î<‚¢æ<‚¢=‚¢=‚/=‚¢G=‚¢€=€¢Ý=‚÷=€¢a>€è>€P?€¥?€¢…@‚Ÿ@‚µ@‚¢Í@‚¢è@€(A‚¢A‚¢:A€GkA€¼‚A‚¢–A‚²A‚¢ÏA€B€%(B€ŠD€k¦D€E€E€F€2F€hF€‘F€óF€CG€WH€!uH€¢¯H‚ÍH€¢©I€ÿI‚J‚Y\€¡\€ç\€x¢]‚]‚¢5]‚¢S]‚¢m]‚¢¦]‚Ã]€A_€ñm€¢)n‚¢¢?n‚Yn& …n&¢ºn€SÑn€Tên€Uo€V o€W;D@GDBYDC^DBcDCeDDpDE€DGDJ±DK¿DJÆDKÌDLàDMïDNòDPDRDS DT6DW@DX\DYpD[|D\‡D]D\—D]D_¢D`®D_¸D`¾DaÃDcÌDdÞDeðDfüDkDl)Dn;DoGDubDwuDxˆDyœDzªD{¶D€ÒDæD‚ôDƒD„D…%Dˆ0D‹8DŒHDUDŒ_DeDŽpD“‹D”¿D¨ÌDªßD«ñD­ýD°D¯D°'D±,D´8D¶@D´^D¹wD¼˜D»¦D¼°D½µDÀ¼DÃÐDÂÞDÃèDÄíDÆüDÉDÈDÉDË#DÍ(DÐ6DÑNDÒZDÓfDÕrDׄDØ‘DÙŸDÚ«DÛ½DÜÐDÝÚDâÜDßâDàìDâöDäDèDéDè&Dé,Dë4Dê7Dì=Dî^DïqDðŒDñ Dó¬DôÀDöÈDù DûDþ.Dý<DþFDÿKDXD]D‡D—Û˜@ò˜€Äåÿÿ ™@™€èûÿÿ7™€ äåÿÿG™@!Y™@"g™€"àåÿÿr™€#Üåÿÿ~™€#Øåÿÿ‹™€$Ôåÿÿ›™€$Ðåÿÿ­™€%èúÿÿ½™€&èùÿÿÌ™€'èéÿÿ(Ìåÿÿü™€*èåÿÿÀà—$ŸdŸt0013.c/home/freddy/cpp/freetds/freetds/src/dblib/unittests/t0013.cgcc2_compiled.int:t(0,1)=r(0,1);-2147483648;2147483647;char:t(0,2)=r(0,2);0;127;long int:t(0,3)=r(0,3);-2147483648;2147483647;unsigned int:t(0,4)=r(0,4);0000000000000;0037777777777;long unsigned int:t(0,5)=r(0,5);0000000000000;0037777777777;long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;long long unsigned int:t(0,7)=@s64;r(0,7);0000000000000;01777777777777777777777;short int:t(0,8)=@s16;r(0,8);-32768;32767;short unsigned int:t(0,9)=@s16;r(0,9);0;65535;signed char:t(0,10)=@s8;r(0,10);-128;127;unsigned char:t(0,11)=@s8;r(0,11);0;255;float:t(0,12)=r(0,1);4;0;double:t(0,13)=r(0,1);8;0;long double:t(0,14)=r(0,1);12;0;complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;complex float:t(0,16)=r(0,16);8;0;complex double:t(0,17)=r(0,17);16;0;complex long double:t(0,18)=r(0,18);24;0;__builtin_va_list:t(0,19)=*(0,20)=(0,20)/usr/include/stdio.h/usr/include/features.h/usr/include/sys/cdefs.h/usr/include/gnu/stubs.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.hsize_t:t(5,1)=(0,4)/usr/include/bits/types.h/usr/include/features.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h__u_char:t(6,1)=(0,11)__u_short:t(6,2)=(0,9)__u_int:t(6,3)=(0,4)__u_long:t(6,4)=(0,5)__u_quad_t:t(6,5)=(0,7)__quad_t:t(6,6)=(0,6)__int8_t:t(6,7)=(0,10)__uint8_t:t(6,8)=(0,11)__int16_t:t(6,9)=(0,8)__uint16_t:t(6,10)=(0,9)__int32_t:t(6,11)=(0,1)__uint32_t:t(6,12)=(0,4)__int64_t:t(6,13)=(0,6)__uint64_t:t(6,14)=(0,7)__qaddr_t:t(6,15)=(6,16)=*(6,6)__dev_t:t(6,17)=(6,5)__uid_t:t(6,18)=(6,3)__gid_t:t(6,19)=(6,3)__ino_t:t(6,20)=(6,4)__mode_t:t(6,21)=(6,3)__nlink_t:t(6,22)=(6,3)__off_t:t(6,23)=(0,3)__loff_t:t(6,24)=(6,6)__pid_t:t(6,25)=(0,1)__ssize_t:t(6,26)=(0,1)__rlim_t:t(6,27)=(6,4)__rlim64_t:t(6,28)=(6,5)__id_t:t(6,29)=(6,3)__fsid_t:t(6,30)=(6,31)=s8__val:(6,32)=ar(6,33)=r(6,33);0000000000000;0037777777777;;0;1;(0,1),0,64;;__daddr_t:t(6,34)=(0,1)__caddr_t:t(6,35)=(6,36)=*(0,2)__time_t:t(6,37)=(0,3)__useconds_t:t(6,38)=(0,4)__suseconds_t:t(6,39)=(0,3)__swblk_t:t(6,40)=(0,3)__clock_t:t(6,41)=(0,3)__clockid_t:t(6,42)=(0,1)__timer_t:t(6,43)=(0,1)__key_t:t(6,44)=(0,1)__ipc_pid_t:t(6,45)=(0,9)__blksize_t:t(6,46)=(0,3)__blkcnt_t:t(6,47)=(0,3)__blkcnt64_t:t(6,48)=(6,6)__fsblkcnt_t:t(6,49)=(6,4)__fsblkcnt64_t:t(6,50)=(6,5)__fsfilcnt_t:t(6,51)=(6,4)__fsfilcnt64_t:t(6,52)=(6,5)__ino64_t:t(6,53)=(6,5)__off64_t:t(6,54)=(6,24)__t_scalar_t:t(6,55)=(0,3)__t_uscalar_t:t(6,56)=(0,5)__intptr_t:t(6,57)=(0,1)__socklen_t:t(6,58)=(0,4)/usr/include/bits/pthreadtypes.h/usr/include/bits/sched.h__sched_param:T(10,1)=s4__sched_priority:(0,1),0,32;;_pthread_fastlock:T(9,1)=s8__status:(0,3),0,32;__spinlock:(0,1),32,32;;_pthread_descr:t(9,2)=(9,3)=*(9,4)=xs_pthread_descr_struct:__pthread_attr_s:T(9,5)=s36__detachstate:(0,1),0,32;__schedpolicy:(0,1),32,32;__schedparam:(10,1),64,32;__inheritsched:(0,1),96,32;__scope:(0,1),128,32;__guardsize:(5,1),160,32;__stackaddr_set:(0,1),192,32;__stackaddr:(0,19),224,32;__stacksize:(5,1),256,32;;pthread_attr_t:t(9,6)=(9,5)pthread_cond_t:t(9,7)=(9,8)=s12__c_lock:(9,1),0,64;__c_waiting:(9,2),64,32;;pthread_condattr_t:t(9,9)=(9,10)=s4__dummy:(0,1),0,32;;pthread_key_t:t(9,11)=(0,4)pthread_mutex_t:t(9,12)=(9,13)=s24__m_reserved:(0,1),0,32;__m_count:(0,1),32,32;__m_owner:(9,2),64,32;__m_kind:(0,1),96,32;__m_lock:(9,1),128,64;;pthread_mutexattr_t:t(9,14)=(9,15)=s4__mutexkind:(0,1),0,32;;pthread_once_t:t(9,16)=(0,1)pthread_t:t(9,17)=(0,5)FILE:t(1,1)=(1,2)=xs_IO_FILE:__FILE:t(1,3)=(1,2)/usr/include/libio.h/usr/include/_G_config.h/usr/include/bits/types.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.hwchar_t:t(14,1)=(0,3)wint_t:t(14,2)=(0,4)/usr/include/wchar.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h/usr/include/bits/wchar.h__mbstate_t:t(15,1)=(15,2)=s8__count:(0,1),0,32;__value:(15,3)=u4__wch:(14,2),0,32;__wchb:(15,4)=ar(6,33);0;3;(0,2),0,32;;,32,32;;_G_fpos_t:t(12,1)=(12,2)=s12__pos:(6,23),0,32;__state:(15,1),32,64;;_G_fpos64_t:t(12,3)=(12,4)=s16__pos:(6,54),0,64;__state:(15,1),64,64;;/usr/include/gconv.h/usr/include/features.h/usr/include/wchar.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h/usr/include/bits/wchar.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h :T(18,1)=e__GCONV_OK:0,__GCONV_NOCONV:1,__GCONV_NODB:2,__GCONV_NOMEM:3,__GCONV_EMPTY_INPUT:4,__GCONV_FULL_OUTPUT:5,__GCONV_ILLEGAL_INPUT:6,__GCONV_INCOMPLETE_INPUT:7,__GCONV_ILLEGAL_DESCRIPTOR:8,__GCONV_INTERNAL_ERROR:9,; :T(18,2)=e__GCONV_IS_LAST:1,__GCONV_IGNORE_ERRORS:2,;__gconv_fct:t(18,3)=(18,4)=*(18,5)=f(0,1)__gconv_init_fct:t(18,6)=(18,7)=*(18,8)=f(0,1)__gconv_end_fct:t(18,9)=(18,10)=*(18,11)=f(0,20)__gconv_trans_fct:t(18,12)=(18,13)=*(18,14)=f(0,1)__gconv_trans_context_fct:t(18,15)=(18,16)=*(18,17)=f(0,1)__gconv_trans_query_fct:t(18,18)=(18,19)=*(18,20)=f(0,1)__gconv_trans_init_fct:t(18,21)=(18,22)=*(18,23)=f(0,1)__gconv_trans_end_fct:t(18,24)=(18,25)=*(18,26)=f(0,20)__gconv_trans_data:T(18,27)=s20__trans_fct:(18,12),0,32;__trans_context_fct:(18,15),32,32;__trans_end_fct:(18,24),64,32;__data:(0,19),96,32;__next:(18,28)=*(18,27),128,32;;__gconv_step:T(18,29)=s56__shlib_handle:(18,30)=*(18,31)=xs__gconv_loaded_object:,0,32;__modname:(18,32)=*(0,2),32,32;__counter:(0,1),64,32;__from_name:(6,36),96,32;__to_name:(6,36),128,32;__fct:(18,3),160,32;__init_fct:(18,6),192,32;__end_fct:(18,9),224,32;__min_needed_from:(0,1),256,32;__max_needed_from:(0,1),288,32;__min_needed_to:(0,1),320,32;__max_needed_to:(0,1),352,32;__stateful:(0,1),384,32;__data:(0,19),416,32;;__gconv_step_data:T(18,33)=s36__outbuf:(18,34)=*(0,11),0,32;__outbufend:(18,34),32,32;__flags:(0,1),64,32;__invocation_counter:(0,1),96,32;__internal_use:(0,1),128,32;__statep:(18,35)=*(15,1),160,32;__state:(15,1),192,64;__trans:(18,28),256,32;;__gconv_info:T(18,36)=s8__nsteps:(5,1),0,32;__steps:(18,37)=*(18,29),32,32;__data:(18,38)=ar(6,33);0;-1;(18,33),64,0;;__gconv_t:t(18,39)=(18,40)=*(18,36)_G_iconv_t:t(12,5)=(12,6)=u44__cd:(18,36),0,64;__combined:(12,7)=s44__cd:(18,36),0,64;__data:(18,33),64,288;;,0,352;;_G_int16_t:t(12,8)=(0,8)_G_int32_t:t(12,9)=(0,1)_G_uint16_t:t(12,10)=(0,9)_G_uint32_t:t(12,11)=(0,4)/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdarg.h__gnuc_va_list:t(24,1)=(0,19)_IO_lock_t:t(11,1)=(0,20)_IO_marker:T(11,2)=s12_next:(11,3)=*(11,2),0,32;_sbuf:(11,4)=*(1,2),32,32;_pos:(0,1),64,32;;__codecvt_result:T(11,5)=e__codecvt_ok:0,__codecvt_partial:1,__codecvt_error:2,__codecvt_noconv:3,;_IO_FILE:T(1,2)=s148_flags:(0,1),0,32;_IO_read_ptr:(6,36),32,32;_IO_read_end:(6,36),64,32;_IO_read_base:(6,36),96,32;_IO_write_base:(6,36),128,32;_IO_write_ptr:(6,36),160,32;_IO_write_end:(6,36),192,32;_IO_buf_base:(6,36),224,32;_IO_buf_end:(6,36),256,32;_IO_save_base:(6,36),288,32;_IO_backup_base:(6,36),320,32;_IO_save_end:(6,36),352,32;_markers:(11,3),384,32;_chain:(11,4),416,32;_fileno:(0,1),448,32;_blksize:(0,1),480,32;_old_offset:(6,23),512,32;_cur_column:(0,9),544,16;_vtable_offset:(0,10),560,8;_shortbuf:(11,6)=ar(6,33);0;0;(0,2),568,8;_lock:(11,7)=*(11,1),576,32;_offset:(6,54),608,64;__pad1:(0,19),672,32;__pad2:(0,19),704,32;_mode:(0,1),736,32;_unused2:(11,8)=ar(6,33);0;51;(0,2),768,416;;_IO_FILE:t(11,9)=(1,2)__io_read_fn:t(11,10)=(11,11)=f(6,26)__io_write_fn:t(11,12)=(11,13)=f(6,26)__io_seek_fn:t(11,14)=(11,15)=f(0,1)__io_close_fn:t(11,16)=(11,17)=f(0,1)fpos_t:t(1,4)=(12,1)/usr/include/bits/stdio_lim.h/usr/include/bits/stdio.h/usr/include/stdlib.h/usr/include/features.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.hdiv_t:t(27,1)=(27,2)=s8quot:(0,1),0,32;rem:(0,1),32,32;;ldiv_t:t(27,3)=(27,4)=s8quot:(0,3),0,32;rem:(0,3),32,32;;/usr/include/sys/types.h/usr/include/features.h/usr/include/bits/types.hu_char:t(30,1)=(6,1)u_short:t(30,2)=(6,2)u_int:t(30,3)=(6,3)u_long:t(30,4)=(6,4)quad_t:t(30,5)=(6,6)u_quad_t:t(30,6)=(6,5)fsid_t:t(30,7)=(6,30)loff_t:t(30,8)=(6,24)ino_t:t(30,9)=(6,20)dev_t:t(30,10)=(6,17)gid_t:t(30,11)=(6,19)mode_t:t(30,12)=(6,21)nlink_t:t(30,13)=(6,22)uid_t:t(30,14)=(6,18)off_t:t(30,15)=(6,23)pid_t:t(30,16)=(6,25)id_t:t(30,17)=(6,29)ssize_t:t(30,18)=(6,26)daddr_t:t(30,19)=(6,34)caddr_t:t(30,20)=(6,35)key_t:t(30,21)=(6,44)/usr/include/time.h/usr/include/bits/types.htime_t:t(33,1)=(6,37)/usr/include/bits/types.hclockid_t:t(33,2)=(6,42)/usr/include/bits/types.htimer_t:t(33,3)=(6,43)/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.hulong:t(30,22)=(0,5)ushort:t(30,23)=(0,9)uint:t(30,24)=(0,4)int8_t:t(30,25)=(0,10)int16_t:t(30,26)=(0,8)int32_t:t(30,27)=(0,1)int64_t:t(30,28)=(0,6)u_int8_t:t(30,29)=(0,11)u_int16_t:t(30,30)=(0,9)u_int32_t:t(30,31)=(0,4)u_int64_t:t(30,32)=(0,7)register_t:t(30,33)=(0,1)/usr/include/endian.h/usr/include/features.h/usr/include/bits/endian.h/usr/include/sys/select.h/usr/include/features.h/usr/include/bits/types.h/usr/include/bits/select.h/usr/include/bits/sigset.h__sig_atomic_t:t(45,1)=(0,1)__sigset_t:t(45,2)=(45,3)=s128__val:(45,4)=ar(6,33);0;31;(0,5),0,1024;;sigset_t:t(41,1)=(45,2)/usr/include/time.htimespec:T(46,1)=s8tv_sec:(6,37),0,32;tv_nsec:(0,3),32,32;;/usr/include/bits/time.h/usr/include/bits/types.htimeval:T(47,1)=s8tv_sec:(6,37),0,32;tv_usec:(6,39),32,32;;suseconds_t:t(41,2)=(6,39)__fd_mask:t(41,3)=(0,3)fd_set:t(41,4)=(41,5)=s128__fds_bits:(41,6)=ar(6,33);0;31;(41,3),0,1024;;fd_mask:t(41,7)=(41,3)/usr/include/sys/sysmacros.hblkcnt_t:t(30,34)=(6,47)fsblkcnt_t:t(30,35)=(6,49)fsfilcnt_t:t(30,36)=(6,51)random_data:T(27,5)=s28fptr:(27,6)=*(30,27),0,32;rptr:(27,6),32,32;state:(27,6),64,32;rand_type:(0,1),96,32;rand_deg:(0,1),128,32;rand_sep:(0,1),160,32;end_ptr:(27,6),192,32;;drand48_data:T(27,7)=s24__x:(27,8)=ar(6,33);0;2;(0,9),0,48;__old_x:(27,8),48,48;__c:(0,9),96,16;__init:(0,9),112,16;__a:(0,7),128,64;;/usr/include/alloca.h/usr/include/features.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h__compar_fn_t:t(27,9)=(27,10)=*(27,11)=f(0,1)/usr/include/assert.h/usr/include/features.h/usr/include/stdio.h../../../include/sqlfront.h../../../include/sybfront.h../../../include/sybdb.h../../../include/tds.hrcsid_tds_h:S(59,1)=ar(6,33);0;55;(0,2)no_unused_tds_h_warn:S(59,2)=ar(0,1);0;-1;(0,19)../../../include/tds_configs.hrcsid_tds_configs_h:S(60,1)=ar(6,33);0;60;(0,2)no_unused_tds_configs_h_warn:S(60,2)=ar(0,1);0;-1;(0,19)/usr/include/sys/types.h/usr/include/sys/socket.h/usr/include/features.h/usr/include/sys/uio.h/usr/include/features.h/usr/include/sys/types.h/usr/include/bits/uio.h/usr/include/sys/types.hiovec:T(67,1)=s8iov_base:(0,19),0,32;iov_len:(5,1),32,32;;/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h/usr/include/bits/socket.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/syslimits.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/limits.h/usr/include/limits.h/usr/include/features.h/usr/include/bits/posix1_lim.h/usr/include/bits/local_lim.h/usr/include/linux/limits.h/usr/include/bits/posix2_lim.h/usr/include/sys/types.hsocklen_t:t(70,1)=(6,58)__socket_type:T(70,2)=eSOCK_STREAM:1,SOCK_DGRAM:2,SOCK_RAW:3,SOCK_RDM:4,SOCK_SEQPACKET:5,SOCK_PACKET:10,;/usr/include/bits/sockaddr.hsa_family_t:t(82,1)=(0,9)sockaddr:T(70,3)=s16sa_family:(82,1),0,16;sa_data:(70,4)=ar(6,33);0;13;(0,2),16,112;;sockaddr_storage:T(70,5)=s128ss_family:(82,1),0,16;__ss_align:(6,12),32,32;__ss_padding:(70,6)=ar(6,33);0;119;(0,2),64,960;; :T(70,7)=eMSG_OOB:1,MSG_PEEK:2,MSG_DONTROUTE:4,MSG_CTRUNC:8,MSG_PROXY:16,MSG_TRUNC:32,MSG_DONTWAIT:64,MSG_EOR:128,MSG_WAITALL:256,MSG_FIN:512,MSG_SYN:1024,MSG_CONFIRM:2048,MSG_RST:4096,MSG_ERRQUEUE:8192,MSG_NOSIGNAL:16384,MSG_MORE:32768,;msghdr:T(70,8)=s28msg_name:(0,19),0,32;msg_namelen:(70,1),32,32;msg_iov:(70,9)=*(67,1),64,32;msg_iovlen:(0,1),96,32;msg_control:(0,19),128,32;msg_controllen:(70,1),160,32;msg_flags:(0,1),192,32;;cmsghdr:T(70,10)=s12cmsg_len:(5,1),0,32;cmsg_level:(0,1),32,32;cmsg_type:(0,1),64,32;__cmsg_data:(70,11)=ar(6,33);0;-1;(0,11),96,0;; :T(70,12)=eSCM_RIGHTS:1,SCM_CREDENTIALS:2,__SCM_CONNECT:3,;ucred:T(70,13)=s12pid:(30,16),0,32;uid:(30,14),32,32;gid:(30,11),64,32;;/usr/include/asm/socket.h/usr/include/asm/sockios.hlinger:T(70,14)=s8l_onoff:(0,1),0,32;l_linger:(0,1),32,32;;osockaddr:T(62,1)=s16sa_family:(0,9),0,16;sa_data:(62,2)=ar(6,33);0;13;(0,11),16,112;; :T(62,3)=eSHUT_RD:0,SHUT_WR:1,SHUT_RDWR:2,;/usr/include/netinet/in.h/usr/include/features.h/usr/include/stdint.h/usr/include/features.h/usr/include/bits/wchar.h/usr/include/bits/wordsize.huint8_t:t(87,1)=(0,11)uint16_t:t(87,2)=(0,9)uint32_t:t(87,3)=(0,4)uint64_t:t(87,4)=(0,7)int_least8_t:t(87,5)=(0,10)int_least16_t:t(87,6)=(0,8)int_least32_t:t(87,7)=(0,1)int_least64_t:t(87,8)=(0,6)uint_least8_t:t(87,9)=(0,11)uint_least16_t:t(87,10)=(0,9)uint_least32_t:t(87,11)=(0,4)uint_least64_t:t(87,12)=(0,7)int_fast8_t:t(87,13)=(0,10)int_fast16_t:t(87,14)=(0,1)int_fast32_t:t(87,15)=(0,1)int_fast64_t:t(87,16)=(0,6)uint_fast8_t:t(87,17)=(0,11)uint_fast16_t:t(87,18)=(0,4)uint_fast32_t:t(87,19)=(0,4)uint_fast64_t:t(87,20)=(0,7)intptr_t:t(87,21)=(0,1)uintptr_t:t(87,22)=(0,4)intmax_t:t(87,23)=(0,6)uintmax_t:t(87,24)=(0,7)/usr/include/bits/types.h :T(85,1)=eIPPROTO_IP:0,IPPROTO_HOPOPTS:0,IPPROTO_ICMP:1,IPPROTO_IGMP:2,IPPROTO_IPIP:4,IPPROTO_TCP:6,IPPROTO_EGP:8,IPPROTO_PUP:12,IPPROTO_UDP:17,IPPROTO_IDP:22,IPPROTO_TP:29,IPPROTO_IPV6:41,IPPROTO_ROUTING:43,IPPROTO_FRAGMENT:44,IPPROTO_RSVP:46,IPPROTO_GRE:47,IPPROTO_ESP:50,IPPROTO_AH:51,IPPROTO_ICMPV6:58,IPPROTO_NONE:59,IPPROTO_DSTOPTS:60,IPPROTO_MTP:92,IPPROTO_ENCAP:98,IPPROTO_PIM:103,IPPROTO_COMP:108,IPPROTO_RAW:255,IPPROTO_MAX:256,;in_port_t:t(85,2)=(87,2) :T(85,3)=eIPPORT_ECHO:7,IPPORT_DISCARD:9,IPPORT_SYSTAT:11,IPPORT_DAYTIME:13,IPPORT_NETSTAT:15,IPPORT_FTP:21,IPPORT_TELNET:23,IPPORT_SMTP:25,IPPORT_TIMESERVER:37,IPPORT_NAMESERVER:42,IPPORT_WHOIS:43,IPPORT_MTP:57,IPPORT_TFTP:69,IPPORT_RJE:77,IPPORT_FINGER:79,IPPORT_TTYLINK:87,IPPORT_SUPDUP:95,IPPORT_EXECSERVER:512,IPPORT_LOGINSERVER:513,IPPORT_CMDSERVER:514,IPPORT_EFSSERVER:520,IPPORT_BIFFUDP:512,IPPORT_WHOSERVER:513,IPPORT_ROUTESERVER:520,IPPORT_RESERVED:1024,IPPORT_USERRESERVED:5000,;in_addr_t:t(85,4)=(87,3)in_addr:T(85,5)=s4s_addr:(85,4),0,32;;in6_addr:T(85,6)=s16in6_u:(85,7)=u16u6_addr8:(85,8)=ar(6,33);0;15;(87,1),0,128;u6_addr16:(85,9)=ar(6,33);0;7;(87,2),0,128;u6_addr32:(85,10)=ar(6,33);0;3;(87,3),0,128;;,0,128;;/usr/include/bits/socket.hsockaddr_in:T(85,11)=s16sin_family:(82,1),0,16;sin_port:(85,2),16,16;sin_addr:(85,5),32,32;sin_zero:(85,12)=ar(6,33);0;7;(0,11),64,64;;sockaddr_in6:T(85,13)=s28sin6_family:(82,1),0,16;sin6_port:(85,2),16,16;sin6_flowinfo:(87,3),32,32;sin6_addr:(85,6),64,128;sin6_scope_id:(87,3),192,32;;ipv6_mreq:T(85,14)=s20ipv6mr_multiaddr:(85,6),0,128;ipv6mr_interface:(0,4),128,32;;/usr/include/bits/in.hip_opts:T(93,1)=s44ip_dst:(85,5),0,32;ip_opts:(93,2)=ar(6,33);0;39;(0,2),32,320;;ip_mreq:T(93,3)=s8imr_multiaddr:(85,5),0,32;imr_interface:(85,5),32,32;;ip_mreqn:T(93,4)=s12imr_multiaddr:(85,5),0,32;imr_address:(85,5),32,32;imr_ifindex:(0,1),64,32;;in_pktinfo:T(93,5)=s12ipi_ifindex:(0,1),0,32;ipi_spec_dst:(85,5),32,32;ipi_addr:(85,5),64,32;;/usr/include/endian.h/usr/include/bits/byteswap.hin6_pktinfo:T(85,15)=s20ipi6_addr:(85,6),0,128;ipi6_ifindex:(0,4),128,32;;/usr/include/arpa/inet.h/usr/include/features.h/usr/include/netinet/in.h/usr/include/netdb.h/usr/include/features.h/usr/include/netinet/in.h/usr/include/stdint.h/usr/include/rpc/netdb.h/usr/include/features.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.hrpcent:T(103,1)=s12r_name:(6,36),0,32;r_aliases:(103,2)=*(6,36),32,32;r_number:(0,1),64,32;;/usr/include/bits/netdb.hnetent:T(106,1)=s16n_name:(6,36),0,32;n_aliases:(103,2),32,32;n_addrtype:(0,1),64,32;n_net:(87,3),96,32;;hostent:T(99,1)=s20h_name:(6,36),0,32;h_aliases:(103,2),32,32;h_addrtype:(0,1),64,32;h_length:(0,1),96,32;h_addr_list:(103,2),128,32;;servent:T(99,2)=s16s_name:(6,36),0,32;s_aliases:(103,2),32,32;s_port:(0,1),64,32;s_proto:(6,36),96,32;;protoent:T(99,3)=s12p_name:(6,36),0,32;p_aliases:(103,2),32,32;p_proto:(0,1),64,32;;addrinfo:T(99,4)=s32ai_flags:(0,1),0,32;ai_family:(0,1),32,32;ai_socktype:(0,1),64,32;ai_protocol:(0,1),96,32;ai_addrlen:(70,1),128,32;ai_addr:(99,5)=*(70,3),160,32;ai_canonname:(6,36),192,32;ai_next:(99,6)=*(99,4),224,32;;/usr/include/sys/signal.h/usr/include/signal.h/usr/include/features.h/usr/include/bits/sigset.hsig_atomic_t:t(108,1)=(45,1)/usr/include/bits/types.h/usr/include/bits/signum.h__sighandler_t:t(108,2)=(108,3)=*(108,4)=f(0,20)sig_t:t(108,5)=(108,2)/usr/include/time.h/usr/include/bits/siginfo.h/usr/include/bits/wordsize.hsigval:T(114,1)=u4sival_int:(0,1),0,32;sival_ptr:(0,19),0,32;;sigval_t:t(114,2)=(114,1)siginfo:T(114,3)=s128si_signo:(0,1),0,32;si_errno:(0,1),32,32;si_code:(0,1),64,32;_sifields:(114,4)=u116_pad:(114,5)=ar(6,33);0;28;(0,1),0,928;_kill:(114,6)=s8si_pid:(6,25),0,32;si_uid:(6,18),32,32;;,0,64;_timer:(114,7)=s8_timer1:(0,4),0,32;_timer2:(0,4),32,32;;,0,64;_rt:(114,8)=s12si_pid:(6,25),0,32;si_uid:(6,18),32,32;si_sigval:(114,2),64,32;;,0,96;_sigchld:(114,9)=s20si_pid:(6,25),0,32;si_uid:(6,18),32,32;si_status:(0,1),64,32;si_utime:(6,41),96,32;si_stime:(6,41),128,32;;,0,160;_sigfault:(114,10)=s4si_addr:(0,19),0,32;;,0,32;_sigpoll:(114,11)=s8si_band:(0,3),0,32;si_fd:(0,1),32,32;;,0,64;;,96,928;;siginfo_t:t(114,12)=(114,3) :T(114,13)=eSI_ASYNCNL:-6,SI_SIGIO:-5,SI_ASYNCIO:-4,SI_MESGQ:-3,SI_TIMER:-2,SI_QUEUE:-1,SI_USER:0,SI_KERNEL:128,; :T(114,14)=eILL_ILLOPC:1,ILL_ILLOPN:2,ILL_ILLADR:3,ILL_ILLTRP:4,ILL_PRVOPC:5,ILL_PRVREG:6,ILL_COPROC:7,ILL_BADSTK:8,; :T(114,15)=eFPE_INTDIV:1,FPE_INTOVF:2,FPE_FLTDIV:3,FPE_FLTOVF:4,FPE_FLTUND:5,FPE_FLTRES:6,FPE_FLTINV:7,FPE_FLTSUB:8,; :T(114,16)=eSEGV_MAPERR:1,SEGV_ACCERR:2,; :T(114,17)=eBUS_ADRALN:1,BUS_ADRERR:2,BUS_OBJERR:3,; :T(114,18)=eTRAP_BRKPT:1,TRAP_TRACE:2,; :T(114,19)=eCLD_EXITED:1,CLD_KILLED:2,CLD_DUMPED:3,CLD_TRAPPED:4,CLD_STOPPED:5,CLD_CONTINUED:6,; :T(114,20)=ePOLL_IN:1,POLL_OUT:2,POLL_MSG:3,POLL_ERR:4,POLL_PRI:5,POLL_HUP:6,;sigevent:T(114,21)=s64sigev_value:(114,2),0,32;sigev_signo:(0,1),32,32;sigev_notify:(0,1),64,32;_sigev_un:(114,22)=u52_pad:(114,23)=ar(6,33);0;12;(0,1),0,416;_sigev_thread:(114,24)=s8_function:(114,25)=*(114,26)=f(0,20),0,32;_attribute:(114,27)=*(9,5),32,32;;,0,64;;,96,416;;sigevent_t:t(114,28)=(114,21) :T(114,29)=eSIGEV_SIGNAL:0,SIGEV_NONE:1,SIGEV_THREAD:2,;/usr/include/bits/sigaction.hsigaction:T(116,1)=s140__sigaction_handler:(116,2)=u4sa_handler:(108,2),0,32;sa_sigaction:(116,3)=*(116,4)=f(0,20),0,32;;,0,32;sa_mask:(45,2),32,1024;sa_flags:(0,1),1056,32;sa_restorer:(116,5)=*(116,6)=f(0,20),1088,32;;sigvec:T(108,6)=s12sv_handler:(108,2),0,32;sv_mask:(0,1),32,32;sv_flags:(0,1),64,32;;/usr/include/bits/sigcontext.h/usr/include/asm/sigcontext.h_fpreg:T(118,1)=s10significand:(118,2)=ar(6,33);0;3;(0,9),0,64;exponent:(0,9),64,16;;_fpxreg:T(118,3)=s16significand:(118,2),0,64;exponent:(0,9),64,16;padding:(27,8),80,48;;_xmmreg:T(118,4)=s16element:(118,5)=ar(6,33);0;3;(0,5),0,128;;_fpstate:T(118,6)=s624cw:(0,5),0,32;sw:(0,5),32,32;tag:(0,5),64,32;ipoff:(0,5),96,32;cssel:(0,5),128,32;dataoff:(0,5),160,32;datasel:(0,5),192,32;_st:(118,7)=ar(6,33);0;7;(118,1),224,640;status:(0,9),864,16;magic:(0,9),880,16;_fxsr_env:(118,8)=ar(6,33);0;5;(0,5),896,192;mxcsr:(0,5),1088,32;reserved:(0,5),1120,32;_fxsr_st:(118,9)=ar(6,33);0;7;(118,3),1152,1024;_xmm:(118,10)=ar(6,33);0;7;(118,4),2176,1024;padding:(118,11)=ar(6,33);0;55;(0,5),3200,1792;;sigcontext:T(118,12)=s88gs:(0,9),0,16;__gsh:(0,9),16,16;fs:(0,9),32,16;__fsh:(0,9),48,16;es:(0,9),64,16;__esh:(0,9),80,16;ds:(0,9),96,16;__dsh:(0,9),112,16;edi:(0,5),128,32;esi:(0,5),160,32;ebp:(0,5),192,32;esp:(0,5),224,32;ebx:(0,5),256,32;edx:(0,5),288,32;ecx:(0,5),320,32;eax:(0,5),352,32;trapno:(0,5),384,32;err:(0,5),416,32;eip:(0,5),448,32;cs:(0,9),480,16;__csh:(0,9),496,16;eflags:(0,5),512,32;esp_at_signal:(0,5),544,32;ss:(0,9),576,16;__ssh:(0,9),592,16;fpstate:(118,13)=*(118,6),608,32;oldmask:(0,5),640,32;cr2:(0,5),672,32;;/usr/include/bits/sigstack.hsigstack:T(119,1)=s8ss_sp:(0,19),0,32;ss_onstack:(0,1),32,32;; :T(119,2)=eSS_ONSTACK:1,SS_DISABLE:2,;sigaltstack:T(119,3)=s12ss_sp:(0,19),0,32;ss_flags:(0,1),32,32;ss_size:(5,1),64,32;;stack_t:t(119,4)=(119,3)/usr/include/bits/sigthread.h/usr/include/sys/wait.h/usr/include/features.h/usr/include/signal.h/usr/include/sys/resource.h/usr/include/features.h/usr/include/bits/resource.h/usr/include/bits/types.h__rlimit_resource:T(126,1)=eRLIMIT_CPU:0,RLIMIT_FSIZE:1,RLIMIT_DATA:2,RLIMIT_STACK:3,RLIMIT_CORE:4,RLIMIT_RSS:5,RLIMIT_NOFILE:7,RLIMIT_OFILE:7,RLIMIT_AS:9,RLIMIT_NPROC:6,RLIMIT_MEMLOCK:8,RLIMIT_LOCKS:10,RLIMIT_NLIMITS:11,RLIM_NLIMITS:11,;rlim_t:t(126,2)=(6,27)rlimit:T(126,3)=s8rlim_cur:(126,2),0,32;rlim_max:(126,2),32,32;;__rusage_who:T(126,4)=eRUSAGE_SELF:0,RUSAGE_CHILDREN:-1,RUSAGE_BOTH:-2,;/usr/include/bits/time.hrusage:T(126,5)=s72ru_utime:(47,1),0,64;ru_stime:(47,1),64,64;ru_maxrss:(0,3),128,32;ru_ixrss:(0,3),160,32;ru_idrss:(0,3),192,32;ru_isrss:(0,3),224,32;ru_minflt:(0,3),256,32;ru_majflt:(0,3),288,32;ru_nswap:(0,3),320,32;ru_inblock:(0,3),352,32;ru_oublock:(0,3),384,32;ru_msgsnd:(0,3),416,32;ru_msgrcv:(0,3),448,32;ru_nsignals:(0,3),480,32;ru_nvcsw:(0,3),512,32;ru_nivcsw:(0,3),544,32;;__priority_which:T(126,6)=ePRIO_PROCESS:0,PRIO_PGRP:1,PRIO_USER:2,;__rlimit_resource_t:t(124,1)=(0,1)__rusage_who_t:t(124,2)=(0,1)__priority_which_t:t(124,3)=(0,1)/usr/include/bits/waitflags.h__WAIT_STATUS:t(121,1)=(121,2)=u4__uptr:(121,3)=*(121,4)=xuwait:,0,32;__iptr:(121,5)=*(0,1),0,32;;/usr/include/bits/waitstatus.h/usr/include/endian.hwait:T(121,4)=u4w_status:(0,1),0,32;__wait_terminated:(130,1)=s4__w_termsig:(0,4),0,7;__w_coredump:(0,4),7,1;__w_retcode:(0,4),8,8;:(0,4),16,16;;,0,32;__wait_stopped:(130,2)=s4__w_stopval:(0,4),0,8;__w_stopsig:(0,4),8,8;:(0,4),16,16;;,0,32;; :T(121,6)=eP_ALL:0,P_PID:1,P_PGID:2,;idtype_t:t(121,7)=(121,6)/usr/include/bits/siginfo.h/usr/include/bits/wordsize.h/usr/include/errno.h/usr/include/features.h/usr/include/bits/errno.h/usr/include/linux/errno.h/usr/include/asm/errno.h/usr/include/stdio.h/usr/include/ctype.h/usr/include/features.h/usr/include/bits/types.h/usr/include/endian.h :T(140,1)=e_ISupper:256,_ISlower:512,_ISalpha:1024,_ISdigit:2048,_ISxdigit:4096,_ISspace:8192,_ISprint:16384,_ISgraph:32768,_ISblank:1,_IScntrl:2,_ISpunct:4,_ISalnum:8,;/usr/include/string.h/usr/include/features.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h/usr/include/bits/string.h/usr/include/bits/string2.h/usr/include/endian.h/usr/include/bits/types.h/usr/include/stdlib.h/usr/include/stdlib.h/usr/include/time.h/usr/include/features.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h/usr/include/bits/time.h/usr/include/bits/types.h/usr/include/bits/types.hclock_t:t(153,1)=(6,41)tm:T(153,2)=s44tm_sec:(0,1),0,32;tm_min:(0,1),32,32;tm_hour:(0,1),64,32;tm_mday:(0,1),96,32;tm_mon:(0,1),128,32;tm_year:(0,1),160,32;tm_wday:(0,1),192,32;tm_yday:(0,1),224,32;tm_isdst:(0,1),256,32;tm_gmtoff:(0,3),288,32;tm_zone:(18,32),320,32;;itimerspec:T(153,3)=s16it_interval:(46,1),0,64;it_value:(46,1),64,64;;/usr/include/sys/time.h/usr/include/features.h/usr/include/bits/types.h/usr/include/time.h/usr/include/bits/time.h/usr/include/sys/select.htimezone:T(159,1)=s8tz_minuteswest:(0,1),0,32;tz_dsttime:(0,1),32,32;;__timezone_ptr_t:t(159,2)=(159,3)=*(159,1)__itimer_which:T(159,4)=eITIMER_REAL:0,ITIMER_VIRTUAL:1,ITIMER_PROF:2,;itimerval:T(159,5)=s16it_interval:(47,1),0,64;it_value:(47,1),64,64;;__itimer_which_t:t(159,6)=(0,1)/usr/include/unistd.h/usr/include/features.h/usr/include/bits/posix_opt.h/usr/include/bits/types.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.h/usr/include/bits/confname.h :T(170,1)=e_PC_LINK_MAX:0,_PC_MAX_CANON:1,_PC_MAX_INPUT:2,_PC_NAME_MAX:3,_PC_PATH_MAX:4,_PC_PIPE_BUF:5,_PC_CHOWN_RESTRICTED:6,_PC_NO_TRUNC:7,_PC_VDISABLE:8,_PC_SYNC_IO:9,_PC_ASYNC_IO:10,_PC_PRIO_IO:11,_PC_SOCK_MAXBUF:12,_PC_FILESIZEBITS:13,_PC_REC_INCR_XFER_SIZE:14,_PC_REC_MAX_XFER_SIZE:15,_PC_REC_MIN_XFER_SIZE:16,_PC_REC_XFER_ALIGN:17,_PC_ALLOC_SIZE_MIN:18,_PC_SYMLINK_MAX:19,; :T(170,2)=e_SC_ARG_MAX:0,_SC_CHILD_MAX:1,_SC_CLK_TCK:2,_SC_NGROUPS_MAX:3,_SC_OPEN_MAX:4,_SC_STREAM_MAX:5,_SC_TZNAME_MAX:6,_SC_JOB_CONTROL:7,_SC_SAVED_IDS:8,_SC_REALTIME_SIGNALS:9,_SC_PRIORITY_SCHEDULING:10,_SC_TIMERS:11,_SC_ASYNCHRONOUS_IO:12,_SC_PRIORITIZED_IO:13,_SC_SYNCHRONIZED_IO:14,_SC_FSYNC:15,_SC_MAPPED_FILES:16,_SC_MEMLOCK:17,_SC_MEMLOCK_RANGE:18,_SC_MEMORY_PROTECTION:19,_SC_MESSAGE_PASSING:20,_SC_SEMAPHORES:21,_SC_SHARED_MEMORY_OBJECTS:22,_SC_AIO_LISTIO_MAX:23,_SC_AIO_MAX:24,_SC_AIO_PRIO_DELTA_MAX:25,_SC_DELAYTIMER_MAX:26,_SC_MQ_OPEN_MAX:27,_SC_MQ_PRIO_MAX:28,_SC_VERSION:29,_SC_PAGESIZE:30,_SC_RTSIG_MAX:31,_SC_SEM_NSEMS_MAX:32,_SC_SEM_VALUE_MAX:33,_SC_SIGQUEUE_MAX:34,_SC_TIMER_MAX:35,_SC_BC_BASE_MAX:36,_SC_BC_DIM_MAX:37,_SC_BC_SCALE_MAX:38,_SC_BC_STRING_MAX:39,_SC_COLL_WEIGHTS_MAX:40,_SC_EQUIV_CLASS_MAX:41,_SC_EXPR_NEST_MAX:42,_SC_LINE_MAX:43,_SC_RE_DUP_MAX:44,_SC_CHARCLASS_NAME_MAX:45,_SC_2_VERSION:46,_SC_2_C_BIND:47,_SC_2_C_DEV:48,_SC_2_FORT_DEV:49,_SC_2_FORT_RUN:50,_SC_2_SW_DEV:51,_SC_2_LOCALEDEF:52,_SC_PII:53,_SC_PII_XTI:54,_SC_PII_SOCKET:55,_SC_PII_INTERNET:56,_SC_PII_OSI:57,_SC_POLL:58,_SC_SELECT:59,_SC_UIO_MAXIOV:60,_SC_IOV_MAX:60,_SC_PII_INTERNET_STREAM:61,_SC_PII_INTERNET_DGRAM:62,_SC_PII_OSI_COTS:63,_SC_PII_OSI_CLTS:64,_SC_PII_OSI_M:65,_SC_T_IOV_MAX:66,_SC_THREADS:67,_SC_THREAD_SAFE_FUNCTIONS:68,_SC_GETGR_R_SIZE_MAX:69,_SC_GETPW_R_SIZE_MAX:70,_SC_LOGIN_NAME_MAX:71,_SC_TTY_NAME_MAX:72,_SC_THREAD_DESTRUCTOR_ITERATIONS:73,_SC_THREAD_KEYS_MAX:74,_SC_THREAD_STACK_MIN:75,_SC_THREAD_THREADS_MAX:76,_SC_THREAD_ATTR_STACKADDR:77,_SC_THREAD_ATTR_STACKSIZE:78,_SC_THREAD_PRIORITY_SCHEDULING:79,_SC_THREAD_PRIO_INHERIT:80,_SC_THREAD_PRIO_PROTECT:81,_SC_THREAD_PROCESS_SHARED:82,_SC_NPROCESSORS_CONF:83,_SC_NPROCESSORS_ONLN:84,_SC_PHYS_PAGES:85,_SC_AVPHYS_PAGES:86,_SC_ATEXIT_MAX:87,_SC_PASS_MAX:88,_SC_XOPEN_VERSION:89,_SC_XOPEN_XCU_VERSION:90,_SC_XOPEN_UNIX:91,_SC_XOPEN_CRYPT:92,_SC_XOPEN_ENH_I18N:93,_SC_XOPEN_SHM:94,_SC_2_CHAR_TERM:95,_SC_2_C_VERSION:96,_SC_2_UPE:97,_SC_XOPEN_XPG2:98,_SC_XOPEN_XPG3:99,_SC_XOPEN_XPG4:100,_SC_CHAR_BIT:101,_SC_CHAR_MAX:102,_SC_CHAR_MIN:103,_SC_INT_MAX:104,_SC_INT_MIN:105,_SC_LONG_BIT:106,_SC_WORD_BIT:107,_SC_MB_LEN_MAX:108,_SC_NZERO:109,_SC_SSIZE_MAX:110,_SC_SCHAR_MAX:111,_SC_SCHAR_MIN:112,_SC_SHRT_MAX:113,_SC_SHRT_MIN:114,_SC_UCHAR_MAX:115,_SC_UINT_MAX:116,_SC_ULONG_MAX:117,_SC_USHRT_MAX:118,_SC_NL_ARGMAX:119,_SC_NL_LANGMAX:120,_SC_NL_MSGMAX:121,_SC_NL_NMAX:122,_SC_NL_SETMAX:123,_SC_NL_TEXTMAX:124,_SC_XBS5_ILP32_OFF32:125,_SC_XBS5_ILP32_OFFBIG:126,_SC_XBS5_LP64_OFF64:127,_SC_XBS5_LPBIG_OFFBIG:128,_SC_XOPEN_LEGACY:129,_SC_XOPEN_REALTIME:130,_SC_XOPEN_REALTIME_THREADS:131,_SC_ADVISORY_INFO:132,_SC_BARRIERS:133,_SC_BASE:134,_SC_C_LANG_SUPPORT:135,_SC_C_LANG_SUPPORT_R:136,_SC_CLOCK_SELECTION:137,_SC_CPUTIME:138,_SC_THREAD_CPUTIME:139,_SC_DEVICE_IO:140,_SC_DEVICE_SPECIFIC:141,_SC_DEVICE_SPECIFIC_R:142,_SC_FD_MGMT:143,_SC_FIFO:144,_SC_PIPE:145,_SC_FILE_ATTRIBUTES:146,_SC_FILE_LOCKING:147,_SC_FILE_SYSTEM:148,_SC_MONOTONIC_CLOCK:149,_SC_MULTI_PROCESS:150,_SC_SINGLE_PROCESS:151,_SC_NETWORKING:152,_SC_READER_WRITER_LOCKS:153,_SC_SPIN_LOCKS:154,_SC_REGEXP:155,_SC_REGEX_VERSION:156,_SC_SHELL:157,_SC_SIGNALS:158,_SC_SPAWN:159,_SC_SPORADIC_SERVER:160,_SC_THREAD_SPORADIC_SERVER:161,_SC_SYSTEM_DATABASE:162,_SC_SYSTEM_DATABASE_R:163,_SC_TIMEOUTS:164,_SC_TYPED_MEMORY_OBJECTS:165,_SC_USER_GROUPS:166,_SC_USER_GROUPS_R:167,_SC_2_PBS:168,_SC_2_PBS_ACCOUNTING:169,_SC_2_PBS_LOCATE:170,_SC_2_PBS_MESSAGE:171,_SC_2_PBS_TRACK:172,_SC_SYMLOOP_MAX:173,_SC_STREAMS:174,_SC_2_PBS_CHECKPOINT:175,_SC_V6_ILP32_OFF32:176,_SC_V6_ILP32_OFFBIG:177,_SC_V6_LP64_OFF64:178,_SC_V6_LPBIG_OFFBIG:179,_SC_HOST_NAME_MAX:180,_SC_TRACE:181,_SC_TRACE_EVENT_FILTER:182,_SC_TRACE_INHERIT:183,_SC_TRACE_LOG:184,; :T(170,3)=e_CS_PATH:0,_CS_V6_WIDTH_RESTRICTED_ENVS:1,;/usr/include/getopt.h../../../include/tdsver.hrcsid_tdsver_h:S(172,1)=ar(6,33);0;92;(0,2)no_unused_tdsver_h_warn:S(172,2)=ar(0,1);0;-1;(0,19)TDS_CHAR:t(59,3)=(0,2)TDS_UCHAR:t(59,4)=(0,11)TDS_TINYINT:t(59,5)=(0,11)TDS_SMALLINT:t(59,6)=(0,8)TDS_USMALLINT:t(59,7)=(0,9)TDS_INT:t(59,8)=(0,1)TDS_UINT:t(59,9)=(0,4)TDS_REAL:t(59,10)=(0,12)TDS_FLOAT:t(59,11)=(0,13)TDS_INT8:t(59,12)=(0,6)TDS_UINT8:t(59,13)=(0,7)tdsnumeric:T(59,14)=s19precision:(0,11),0,8;scale:(0,11),8,8;array:(59,15)=ar(6,33);0;16;(0,11),16,136;;TDS_NUMERIC:t(59,16)=(59,14)tdsoldmoney:T(59,17)=s8mnyhigh:(59,8),0,32;mnylow:(59,8),32,32;;TDS_OLD_MONEY:t(59,18)=(59,17)tdsmoney:T(59,19)=u8tdsoldmoney:(59,18),0,64;mny:(59,12),0,64;;TDS_MONEY:t(59,20)=(59,19)tdsmoney4:T(59,21)=s4mny4:(59,8),0,32;;TDS_MONEY4:t(59,22)=(59,21)tdsdatetime:T(59,23)=s8dtdays:(59,8),0,32;dttime:(59,8),32,32;;TDS_DATETIME:t(59,24)=(59,23)tdsdatetime4:T(59,25)=s4days:(59,7),0,16;minutes:(59,7),16,16;;TDS_DATETIME4:t(59,26)=(59,25)tdsvarbinary:T(59,27)=s260len:(59,8),0,32;array:(59,28)=ar(6,33);0;255;(59,3),32,2048;;TDS_VARBINARY:t(59,29)=(59,27)tdsvarchar:T(59,30)=s260len:(59,8),0,32;array:(59,28),32,2048;;TDS_VARCHAR:t(59,31)=(59,30)tdsunique:T(59,32)=s16Data1:(59,9),0,32;Data2:(59,7),32,16;Data3:(59,7),48,16;Data4:(59,33)=ar(6,33);0;7;(59,4),64,64;;TDS_UNIQUE:t(59,34)=(59,32)tdsdaterec:T(59,35)=s40year:(59,8),0,32;month:(59,8),32,32;day:(59,8),64,32;dayofyear:(59,8),96,32;weekday:(59,8),128,32;hour:(59,8),160,32;minute:(59,8),192,32;second:(59,8),224,32;millisecond:(59,8),256,32;tzone:(59,8),288,32;;TDSDATEREC:t(59,36)=(59,35)tds_login:T(59,37)=s292host_name:(59,38)=ar(6,33);0;30;(59,3),0,248;user_name:(59,38),248,248;password:(59,39)=ar(6,33);0;40;(59,3),496,328;bulk_copy:(59,5),824,8;app_name:(59,38),832,248;server_name:(59,38),1080,248;major_version:(59,5),1328,8;minor_version:(59,5),1336,8;library:(59,40)=ar(6,33);0;11;(59,3),1344,96;language:(59,38),1440,248;encrypted:(59,5),1688,8;char_set:(59,38),1696,248;block_size:(59,6),1952,16;suppress_language:(59,5),1968,8;connect_timeout:(59,8),1984,32;query_timeout:(59,8),2016,32;longquery_timeout:(59,8),2048,32;longquery_func:(59,41)=*(59,42)=f(0,20),2080,32;longquery_param:(0,3),2112,32;capabilities:(59,43)=ar(6,33);0;17;(0,11),2144,144;port:(0,1),2304,32;;TDSLOGIN:t(59,44)=(59,37)tds_config_info:T(59,45)=s120server_name:(6,36),0,32;host:(6,36),32,32;ip_addr:(6,36),64,32;port:(0,1),96,32;minor_version:(59,6),128,16;major_version:(59,6),144,16;block_size:(0,1),160,32;language:(6,36),192,32;char_set:(6,36),224,32;database:(6,36),256,32;dump_file:(6,36),288,32;broken_dates:(0,1),320,32;broken_money:(0,1),352,32;timeout:(0,1),384,32;connect_timeout:(0,1),416,32;host_name:(6,36),448,32;default_domain:(6,36),480,32;try_server_login:(0,1),512,32;try_domain_login:(0,1),544,32;xdomain_auth:(0,1),576,32;debug_level:(0,1),608,32;emul_little_endian:(0,1),640,32;text_size:(0,1),672,32;app_name:(6,36),704,32;user_name:(6,36),736,32;password:(6,36),768,32;library:(6,36),800,32;bulk_copy:(0,1),832,32;suppress_language:(0,1),864,32;encrypted:(0,1),896,32;client_charset:(6,36),928,32;;TDSCONFIGINFO:t(59,46)=(59,45)tds_loc_info:T(59,47)=s12language:(6,36),0,32;char_set:(6,36),32,32;date_fmt:(6,36),64,32;;TDSLOCINFO:t(59,48)=(59,47)tds_column_info:T(59,49)=s356column_type:(59,6),0,16;column_type_save:(59,6),16,16;column_usertype:(59,6),32,16;column_flags:(59,6),48,16;column_size:(59,8),64,32;column_offset:(59,8),96,32;column_namelen:(59,5),128,8;column_varint_size:(59,5),136,8;column_name:(59,28),144,2048;column_bindtype:(59,6),2192,16;column_bindfmt:(59,6),2208,16;column_bindlen:(59,9),2240,32;column_nullbind:(59,50)=*(59,3),2272,32;varaddr:(59,50),2304,32;column_lenbind:(59,50),2336,32;column_prec:(59,6),2368,16;column_scale:(59,6),2384,16;column_textsize:(59,8),2400,32;column_textpos:(59,8),2432,32;column_text_sqlgetdatapos:(59,8),2464,32;column_textptr:(59,51)=ar(6,33);0;15;(59,3),2496,128;column_timestamp:(59,52)=ar(6,33);0;7;(59,3),2624,64;column_textvalue:(59,50),2688,32;column_nullable:(59,5),2720,8;column_writeable:(59,5),2728,8;column_identity:(59,5),2736,8;column_unicodedata:(59,5),2744,8;collation:(59,53)=ar(6,33);0;4;(59,3),2752,40;cur_row_size:(59,8),2816,32;;TDSCOLINFO:t(59,54)=(59,49)tds_result_info:T(59,55)=s28rows_exist:(59,6),0,16;row_count:(59,8),32,32;row_size:(59,8),64,32;num_cols:(59,6),96,16;more_results:(59,5),112,8;columns:(59,56)=*(59,57)=*(59,54),128,32;null_info_size:(0,1),160,32;current_row:(18,34),192,32;;TDSRESULTINFO:t(59,58)=(59,55) :T(59,59)=eTDS_QUERYING:0,TDS_PENDING:1,TDS_COMPLETED:2,TDS_CANCELED:3,TDS_DEAD:4,;tds_compute_info:T(59,60)=s20num_cols:(59,6),0,16;row_size:(59,8),32,32;columns:(59,56),64,32;null_info_size:(0,1),96,32;current_row:(18,34),128,32;;TDSCOMPUTEINFO:t(59,61)=(59,60)tds_param_info:T(59,62)=s20num_cols:(59,6),0,16;row_size:(59,8),32,32;columns:(59,56),64,32;null_info_size:(0,1),96,32;current_row:(18,34),128,32;;TDSPARAMINFO:t(59,63)=(59,62)tds_input_param:T(59,64)=s16column_type:(59,6),0,16;varaddr:(59,50),32,32;column_bindlen:(59,9),64,32;is_null:(59,3),96,8;;TDSINPUTPARAM:t(59,65)=(59,64)tds_msg_info:T(59,66)=s28priv_msg_type:(59,6),0,16;line_number:(59,6),16,16;msg_number:(59,9),32,32;msg_state:(59,6),64,16;msg_level:(59,6),80,16;server:(59,50),96,32;message:(59,50),128,32;proc_name:(59,50),160,32;sql_state:(59,50),192,32;;TDSMSGINFO:t(59,67)=(59,66)tds_env_info:T(59,68)=s16block_size:(0,1),0,32;language:(6,36),32,32;charset:(6,36),64,32;database:(6,36),96,32;;TDSENVINFO:t(59,69)=(59,68)tds_dynamic:T(59,70)=s48id:(59,71)=ar(6,33);0;29;(0,2),0,240;dyn_state:(0,1),256,32;res_info:(59,72)=*(59,58),288,32;num_params:(0,1),320,32;params:(59,73)=*(59,74)=*(59,65),352,32;;TDSDYNAMIC:t(59,75)=(59,70)TDSCONTEXT:t(59,76)=(59,77)=xstds_context:TDSSOCKET:t(59,78)=(59,79)=xstds_socket:tds_context:T(59,77)=s16locale:(59,80)=*(59,48),0,32;parent:(0,19),32,32;msg_handler:(59,81)=*(59,82)=f(0,1),64,32;err_handler:(59,81),96,32;;tds_socket:T(59,79)=s152s:(0,1),0,32;major_version:(59,6),32,16;minor_version:(59,6),48,16;capabilities:(59,43),64,144;broken_dates:(0,11),208,8;in_buf:(18,34),224,32;out_buf:(18,34),256,32;in_buf_max:(0,4),288,32;in_pos:(0,4),320,32;out_pos:(0,4),352,32;in_len:(0,4),384,32;out_len:(0,4),416,32;out_flag:(0,11),448,8;last_packet:(0,11),456,8;parent:(0,19),480,32;res_info:(59,72),512,32;comp_info:(59,83)=*(59,61),544,32;param_info:(59,84)=*(59,63),576,32;has_status:(59,5),608,8;ret_status:(59,8),640,32;msg_info:(59,85)=*(59,67),672,32;state:(59,5),704,8;rows_affected:(0,1),736,32;timeout:(59,8),768,32;longquery_timeout:(59,8),800,32;longquery_func:(59,41),832,32;longquery_param:(0,3),864,32;queryStarttime:(33,1),896,32;env:(59,86)=*(59,69),928,32;num_dyns:(0,1),960,32;cur_dyn_elem:(0,1),992,32;dyns:(59,87)=*(59,88)=*(59,75),1024,32;emul_little_endian:(0,1),1056,32;date_fmt:(6,36),1088,32;tds_ctx:(59,89)=*(59,76),1120,32;iconv_info:(0,19),1152,32;config:(59,90)=*(59,46),1184,32;;tds_answer:T(59,91)=s48lm_resp:(59,92)=ar(6,33);0;23;(0,11),0,192;nt_resp:(59,92),192,192;;TDSANSWER:t(59,93)=(59,91)rcsid_sybdb_h:S(58,1)=ar(6,33);0;56;(0,2)no_unused_sybdb_h_warn:S(58,2)=ar(0,1);0;-1;(0,19)RETCODE:t(58,3)=(0,1)DBCURSOR:t(58,4)=(0,20)DBXLATE:t(58,5)=(0,20)DBSORTORDER:t(58,6)=(0,20)DBLOGINFO:t(58,7)=(0,20)DBVOIDPTR:t(58,8)=(0,19)SHORT:t(58,9)=(0,8)USHORT:t(58,10)=(0,9)INTFUNCPTR:t(58,11)=(58,12)=*(58,13)=f(0,1)STATUS:t(58,14)=(0,1)BOOL:t(58,15)=(0,11)DBBOOL:t(58,16)=(0,11)DBCHAR:t(58,17)=(59,3)DBTINYINT:t(58,18)=(0,11)DBSMALLINT:t(58,19)=(59,6)DBINT:t(58,20)=(59,8)DBBINARY:t(58,21)=(0,11)DBREAL:t(58,22)=(59,10)DBFLT8:t(58,23)=(59,11)DBUSMALLINT:t(58,24)=(0,9)DBNUMERIC:t(58,25)=(59,16)DBMONEY:t(58,26)=(59,20)DBMONEY4:t(58,27)=(59,22)DBDATETIME:t(58,28)=(59,24)DBDATETIME4:t(58,29)=(59,26)LOGINREC:t(58,30)=(58,31)=s4tds_login:(0,19),0,32;;BYTE:t(58,32)=(0,11)dbtypeinfo:T(58,33)=s8precision:(58,20),0,32;scale:(58,20),32,32;;DBTYPEINFO:t(58,34)=(58,33)tag_DBPROC_ROWBUF:T(58,35)=s36buffering_on:(0,1),0,32;first_in_buf:(0,1),32,32;next_row:(0,1),64,32;newest:(0,1),96,32;oldest:(0,1),128,32;elcount:(0,1),160,32;element_size:(0,1),192,32;rows_in_buf:(0,1),224,32;rows:(0,19),256,32;;DBPROC_ROWBUF:t(58,36)=(58,35)BCP_HOSTCOLINFO:t(58,37)=(58,38)=s32host_column:(0,1),0,32;host_var:(0,19),32,32;datatype:(0,1),64,32;prefix_len:(0,1),96,32;column_len:(58,20),128,32;terminator:(58,39)=*(58,32),160,32;term_len:(0,1),192,32;tab_colnum:(0,1),224,32;;BCP_COLINFO:t(58,40)=(58,41)=s312tab_colnum:(0,1),0,32;db_name:(58,42)=ar(6,33);0;255;(0,2),32,2048;db_minlen:(59,6),2080,16;db_maxlen:(59,6),2096,16;db_colcnt:(59,6),2112,16;db_type:(59,5),2128,8;db_type_save:(59,5),2136,8;db_usertype:(59,6),2144,16;db_varint_size:(59,5),2160,8;db_length:(59,8),2176,32;db_nullable:(59,5),2208,8;db_status:(59,5),2216,8;db_offset:(59,6),2224,16;db_default:(59,5),2240,8;db_prec:(59,5),2248,8;db_scale:(59,5),2256,8;db_flags:(59,6),2272,16;db_size:(59,8),2304,32;db_unicodedata:(59,5),2336,8;db_collate:(58,43)=ar(6,33);0;4;(0,2),2344,40;data_size:(0,3),2400,32;data:(58,39),2432,32;txptr_offset:(0,1),2464,32;;DBPROCESS:t(58,44)=(58,45)=s144tds_socket:(58,46)=*(59,78),0,32;row_buf:(58,36),32,288;noautofree:(0,1),320,32;more_results:(0,1),352,32;user_data:(58,39),384,32;dbbuf:(18,34),416,32;dbbufsz:(0,1),448,32;empty_res_hack:(0,1),480,32;text_size:(59,8),512,32;text_sent:(59,8),544,32;bcp_hostfile:(59,50),576,32;bcp_errorfile:(59,50),608,32;bcp_tablename:(59,50),640,32;bcp_insert_stmt:(59,50),672,32;bcp_direction:(59,8),704,32;bcp_colcount:(59,8),736,32;host_colcount:(59,8),768,32;bcp_columns:(58,47)=*(58,48)=*(58,40),800,32;host_columns:(58,49)=*(58,50)=*(58,37),832,32;firstrow:(59,8),864,32;lastrow:(59,8),896,32;maxerrs:(59,8),928,32;bcpbatch:(59,8),960,32;sendrow_init:(59,8),992,32;var_cols:(59,8),1024,32;typeinfo:(58,34),1056,64;avail_flag:(0,11),1120,8;;dbdaterec:T(58,51)=s40dateyear:(58,20),0,32;datemonth:(58,20),32,32;datedmonth:(58,20),64,32;datedyear:(58,20),96,32;datedweek:(58,20),128,32;datehour:(58,20),160,32;dateminute:(58,20),192,32;datesecond:(58,20),224,32;datemsecond:(58,20),256,32;datetzone:(58,20),288,32;;DBDATEREC:t(58,52)=(58,51)EHANDLEFUNC:t(58,53)=(58,54)=*(58,55)=f(0,1)MHANDLEFUNC:t(58,56)=(58,57)=*(58,58)=f(0,1) :T(58,59)=eDBPADOFF:0,DBPADON:1,;rcsid_sybfront_h:S(57,1)=ar(6,33);0;58;(0,2)no_unused_sybfront_h_warn:S(57,2)=ar(0,1);0;-1;(0,19)rcsid_sqlfront_h:S(56,1)=ar(6,33);0;58;(0,2)no_unused_sqlfront_h_warn:S(56,2)=ar(0,1);0;-1;(0,19)../../../include/sqldb.h../../../include/sybdb.hrcsid_sqldb_h:S(173,1)=ar(6,33);0;55;(0,2)no_unused_sqldb_h_warn:S(173,2)=ar(0,1);0;-1;(0,19)common.hrcsid_common_h:S(175,1)=ar(6,33);0;56;(0,2)no_unused_common_h_warn:S(175,2)=ar(0,1);0;-1;(0,19)software_version:S(0,21)=ar(6,33);0;53;(0,2)no_unused_var_warn:S(0,22)=ar(0,1);0;-1;(0,19)failed:G(0,1)main:F(0,1)argc:p(0,1)argv:p(103,2)login:r(0,23)=*(58,30)dbproc:(0,24)=*(58,44)i:r(0,1)teststr:(0,25)=ar(6,33);0;1023;(0,2)testint:(58,20)fp:r(0,26)=*(1,1)result:r(0,3)isiz:(0,3)blob:(6,36)rblob:(6,36)textPtr:(18,34)timeStamp:(18,34)objname:(58,42)sqlCmd:(58,42)rbuf:(0,27)=ar(6,33);0;4095;(0,2)numread:(0,3)cmd:(0,25)Start About to logon t0013After logon Usage: %s infile outfile rbCannot open input file: %s Dropping table drop table #dblib0013creating table insert %s Error inserting blob #dblib0013.PigTureselect Was expecting a result set.col %d is %s Had problem with bind Failed. Expected a row SET TEXTSIZE 2147483647select 2 Error extracting blob wbfailedPASSEDWas expecting no more rows t0013.cfailed!okaydblib %s on %s About to open, PASSWORD: %s, USER: %s, SERVER: %s About to read binary input file create table #dblib0013 (i int not null, PigTure image not null)insert into #dblib0013 values (1, '')SELECT PigTure FROM #dblib0013 WHERE i = 1select * from #dblib0013 order by iFailed. Expected i to be %d, was %d Saving first blob data row to file: %s Unable to open output file: %s Read blob data row %d --> %s %d byte comparison GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2).symtab.strtab.shstrtab.text.rel.text.data.rel.data.bss.note.stab.rel.stab.stabstr.rodata.str1.1.rodata.str1.32.comment4 ! ãX+à@ 1 dè; @ F4 +  L ôè°VT6š_2[мn2 Ò€ ~ Ô;ÛÔ‡ä×@F $ßæñÿ 88*@=>€[ ]j‚ 9\§€;¸¼Òà;ãý@8 x"€91¼Ià6Z  m r w |  † ‹@ + •E šH Ÿd ¥t «Š ±€ ·š ½à â É  Ϧ Õ¼ ÛÏ á` ç× íó ó ù ÿ  1 I S à j #  )m /t 5@ ;{ A— GŸ M§ S¬   Y `Ÿer‚‰‘˜¨´ÄÐØáìñø $*17>DNX`go}‡“˜¢©³ºÀÈÓÚßt0013.crcsid_tds_hno_unused_tds_h_warnrcsid_tds_configs_hno_unused_tds_configs_h_warnrcsid_tdsver_hno_unused_tdsver_h_warnrcsid_sybdb_hno_unused_sybdb_h_warnrcsid_sybfront_hno_unused_sybfront_h_warnrcsid_sqlfront_hno_unused_sqlfront_h_warnrcsid_sqldb_hno_unused_sqldb_h_warnrcsid_common_hno_unused_common_h_warnsoftware_versionno_unused_var_warn.LC0.LC1.LC2.LC3.LC4.LC5.LC6.LC7.LC8.LC9.LC10.LC11.LC12.LC13.LC14.LC15.LC16.LC17.LC18.LC19.LC20.LC21.LC22.LC23.LC24.LC25.LC26.LC27.LC28.LC29.LC30.LC31.LC32.LC33.LC34.LC35.LC36.LC37.LC38.LC39.LC40failedmaintdsdump_openread_login_infostdoutfprintfdbinitsyb_err_handlerdberrhandlesyb_msg_handlerdbmsghandledbloginPASSWORDdbsetlnameUSERSERVERtdsdbopenDATABASEdbusestderrfopenfseekftellmallocfreadfclosedbcmddbsqlexecdbresultssprintfmemcpydbtxptrdbtxtimestampdbnextrowdbwritetextexitdbcolnameprintfdbnumcolsdbbindabortreallocdbreadtextfwritefreedbexitHI!J&K+L2M7N>OCPJPJUKZQfRlSvT|S†ŒS“˜¢¨J­KµU»VÀWëXöüJKJK' -Y2KD!OZa"gYlKƒ[‹\ž[ª]¿^È_Ï#ÕJÚKá$ì`øa b% J%K,&7`CaVbf'lJqKx(„c)“J˜K¦`²aÆbÖ*âcð`üab+Y!K<,BdQeff}gµhÐ-ÖJÛKâ.í`ùab/JF(K4iKjU0ZkllŽmœ1¢Y¨F±K¶nÆgÔ2ÚYàFéKõi 3YFK$n2gB4HdV`banbu5{J€K‡*c›`§a³bÁ6ÇYÌKo0dPph7mkt8Z‘9—YœK¼qÄ_ð:÷;<kr"g2=8Y>FGKSiYs_Ff>k?r@xA~JƒK‰F8<€„\`¼À x|¼À Ð Ü ô ÌØÌ Ø Ä"Ð"è"ô"0#<#`#l#„##¨#G+freetds-1.3.6/src/dblib/unittests/t0014.c000644 025423 025423 00000013640 14056414221 021427 0ustar00fredianofrediano000000 000000 /* * Purpose: Test sending and receiving TEXT datatype * Functions: dbbind dbmoretext dbreadtext dbtxptr dbtxtimestamp dbwritetext */ #include "common.h" #define BLOB_BLOCK_SIZE 4096 char *testargs[] = { "", FREETDS_SRCDIR "/data.bin", "t0014.out" }; static int test(int argc, char **argv, int over4k) { const int rows_to_add = 3; LOGINREC *login; DBPROCESS *dbproc; DBPROCESS *blobproc; int i; DBINT testint; FILE *fp; long result, isiz; char *blob, *rblob; unsigned char *textPtr, *timeStamp; char objname[256]; char sqlCmd[256]; char rbuf[BLOB_BLOCK_SIZE]; long numread; int numtowrite, numwritten; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0014"); printf("About to open %s..%s for user '%s'\n", SERVER, DATABASE, USER); dbproc = dbopen(login, SERVER); blobproc = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); dbuse(blobproc, DATABASE); } dbloginfree(login); printf("After logon\n"); printf("About to read binary input file\n"); if (argc == 1) { argv = testargs; argc = 3; } if (argc < 3) { fprintf(stderr, "Usage: %s infile outfile\n", argv[0]); return 1; } if ((fp = fopen(argv[1], "rb")) == NULL) { fprintf(stderr, "Cannot open input file: %s\n", argv[1]); return 2; } result = fseek(fp, 0, SEEK_END); isiz = ftell(fp); result = fseek(fp, 0, SEEK_SET); blob = (char *) malloc(isiz); result = fread((void *) blob, isiz, 1, fp); assert(result == 1); fclose(fp); /* FIXME this test seem to not work using temporary tables (sybase?)... */ printf("Dropping table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 0; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } for (i = 0; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error inserting blob\n"); return 4; } while ((result = dbnextrow(dbproc)) != NO_MORE_ROWS) { result = REG_ROW; result = DBTXPLEN; strcpy(objname, "dblib0014.PigTure"); textPtr = dbtxptr(dbproc, 1); timeStamp = dbtxtimestamp(dbproc, 1); if (!textPtr && !timeStamp && dbtds(dbproc) >= DBTDS_7_2) { printf("Protocol 7.2+ detected, test not supported\n"); free(blob); dbexit(); exit(0); } /* * Use #ifdef if you want to test dbmoretext mode (needed for 16-bit apps) * Use #ifndef for big buffer version (32-bit) */ if (over4k) { if (dbwritetext(blobproc, objname, textPtr, DBTXPLEN, timeStamp, TRUE, isiz, (BYTE*) blob) != SUCCEED) return 5; } else { if (dbwritetext(blobproc, objname, textPtr, DBTXPLEN, timeStamp, TRUE, isiz, NULL) != SUCCEED) return 15; dbsqlok(blobproc); dbresults(blobproc); numtowrite = 0; /* Send the update value in chunks. */ for (numwritten = 0; numwritten < isiz; numwritten += numtowrite) { numtowrite = (isiz - numwritten); if (numtowrite > BLOB_BLOCK_SIZE) numtowrite = BLOB_BLOCK_SIZE; dbmoretext(blobproc, (DBINT) numtowrite, (BYTE *) (blob + numwritten)); } dbsqlok(blobproc); while (dbresults(blobproc) != NO_MORE_RESULTS) continue; } } } printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) { printf("col %d is %s\n", i, dbcolname(dbproc, i)); } if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); abort(); } for (i = 0; i < rows_to_add; i++) { char expected[1024]; sprintf(expected, "row %03d", i); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } /* get the image */ strcpy(sqlCmd, "SET TEXTSIZE 2147483647"); dbcmd(blobproc, sqlCmd); dbsqlexec(blobproc); if (dbresults(blobproc) != SUCCEED) { dbcancel(blobproc); return 16; } sprintf(sqlCmd, "SELECT PigTure FROM dblib0014 WHERE i = %d", i); dbcmd(blobproc, sqlCmd); dbsqlexec(blobproc); if (dbresults(blobproc) != SUCCEED) { fprintf(stderr, "Error extracting blob\n"); return 6; } numread = 0; rblob = NULL; while ((result = dbreadtext(blobproc, rbuf, BLOB_BLOCK_SIZE)) != NO_MORE_ROWS) { if (result != 0) { /* this indicates not end of row */ rblob = (char*) realloc(rblob, result + numread); memcpy((void *) (rblob + numread), (void *) rbuf, result); numread += result; } } if (i == 0) { printf("Saving first blob data row to file: %s\n", argv[2]); if ((fp = fopen(argv[2], "wb")) == NULL) { fprintf(stderr, "Unable to open output file: %s\n", argv[2]); return 3; } result = fwrite((void *) rblob, numread, 1, fp); fclose(fp); } printf("Read blob data row %d --> %s %ld byte comparison\n", (int) testint, (memcmp(blob, rblob, numread)) ? "failed" : "PASSED", numread); free(rblob); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Was expecting no more rows\n"); exit(1); } free(blob); printf("Dropping table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } dbexit(); return 0; } int main(int argc, char **argv) { int res; res = test(argc, argv, 0); if (!res) res = test(argc, argv, 1); if (res) return res; printf("dblib okay on %s\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/t0014.sql000644 025423 025423 00000000676 14056414221 022011 0ustar00fredianofrediano000000 000000 if object_id('dblib0014') is not null drop table dblib0014 go create table dblib0014 (i int not null, PigTure image not null) go insert into dblib0014 values (0, '') go insert into dblib0014 values (1, '') go insert into dblib0014 values (2, '') go SELECT PigTure FROM dblib0014 WHERE i = 0 go SELECT PigTure FROM dblib0014 WHERE i = 1 go SELECT PigTure FROM dblib0014 WHERE i = 2 go select * from dblib0014 order by i go drop table dblib0014 go freetds-1.3.6/src/dblib/unittests/t0015.c000644 025423 025423 00000005470 14056414221 021432 0ustar00fredianofrediano000000 000000 /* * Purpose: Test binding and retrieving strings and ints, and cancelling results * Functions: dbbind dbcancel dbnextrow dbnumcols dbresults dbsqlexec */ #include "common.h" int main(int argc, char **argv) { const int rows_to_add = 50; LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0015"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 0; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); if (SUCCEED != dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); abort(); } if (SUCCEED != dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr)) { fprintf(stderr, "Had problem with bind\n"); abort(); } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } dbcancel(dbproc); printf("select 2\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a result set."); exit(1); } if (SUCCEED != dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); abort(); } if (SUCCEED != dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr)) { fprintf(stderr, "Had problem with bind\n"); abort(); } for (i = 26; i < rows_to_add; i++) { char expected[1024]; sprintf(expected, "row %03d", i); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { fprintf(stderr, "Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Was expecting no more rows\n"); exit(1); } dbexit(); printf("%s %s\n", __FILE__, "OK"); return 0; } freetds-1.3.6/src/dblib/unittests/t0015.sql000644 025423 025423 00000005044 14056414221 022004 0ustar00fredianofrediano000000 000000 create table #dblib0015 (i int not null, s char(10) not null) go insert into #dblib0015 values (0, 'row 000') go insert into #dblib0015 values (1, 'row 001') go insert into #dblib0015 values (2, 'row 002') go insert into #dblib0015 values (3, 'row 003') go insert into #dblib0015 values (4, 'row 004') go insert into #dblib0015 values (5, 'row 005') go insert into #dblib0015 values (6, 'row 006') go insert into #dblib0015 values (7, 'row 007') go insert into #dblib0015 values (8, 'row 008') go insert into #dblib0015 values (9, 'row 009') go insert into #dblib0015 values (10, 'row 010') go insert into #dblib0015 values (11, 'row 011') go insert into #dblib0015 values (12, 'row 012') go insert into #dblib0015 values (13, 'row 013') go insert into #dblib0015 values (14, 'row 014') go insert into #dblib0015 values (15, 'row 015') go insert into #dblib0015 values (16, 'row 016') go insert into #dblib0015 values (17, 'row 017') go insert into #dblib0015 values (18, 'row 018') go insert into #dblib0015 values (19, 'row 019') go insert into #dblib0015 values (20, 'row 020') go insert into #dblib0015 values (21, 'row 021') go insert into #dblib0015 values (22, 'row 022') go insert into #dblib0015 values (23, 'row 023') go insert into #dblib0015 values (24, 'row 024') go insert into #dblib0015 values (25, 'row 025') go insert into #dblib0015 values (26, 'row 026') go insert into #dblib0015 values (27, 'row 027') go insert into #dblib0015 values (28, 'row 028') go insert into #dblib0015 values (29, 'row 029') go insert into #dblib0015 values (30, 'row 030') go insert into #dblib0015 values (31, 'row 031') go insert into #dblib0015 values (32, 'row 032') go insert into #dblib0015 values (33, 'row 033') go insert into #dblib0015 values (34, 'row 034') go insert into #dblib0015 values (35, 'row 035') go insert into #dblib0015 values (36, 'row 036') go insert into #dblib0015 values (37, 'row 037') go insert into #dblib0015 values (38, 'row 038') go insert into #dblib0015 values (39, 'row 039') go insert into #dblib0015 values (40, 'row 040') go insert into #dblib0015 values (41, 'row 041') go insert into #dblib0015 values (42, 'row 042') go insert into #dblib0015 values (43, 'row 043') go insert into #dblib0015 values (44, 'row 044') go insert into #dblib0015 values (45, 'row 045') go insert into #dblib0015 values (46, 'row 046') go insert into #dblib0015 values (47, 'row 047') go insert into #dblib0015 values (48, 'row 048') go insert into #dblib0015 values (49, 'row 049') go select * from #dblib0015 order by i go select * from #dblib0015 where i > 25 order by i go freetds-1.3.6/src/dblib/unittests/t0016.c000644 025423 025423 00000015044 14056414221 021431 0ustar00fredianofrediano000000 000000 /* * Purpose: Test bcp in and out, and specifically bcp_colfmt() * Functions: bcp_colfmt bcp_columns bcp_exec bcp_init */ #include "common.h" static int failed = 0; static void failure(const char *fmt, ...) { va_list ap; failed = 1; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); } #define INFILE_NAME "t0016" #define TABLE_NAME "#dblib0016" static void test_file(const char *fn); static int compare_files(const char *fn1, const char *fn2); static unsigned count_file_rows(FILE *f); static DBPROCESS *dbproc; int main(int argc, char *argv[]) { LOGINREC *login; char in_file[30]; unsigned int n; setbuf(stdout, NULL); setbuf(stderr, NULL); set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); BCP_SETL(login, TRUE); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0016"); DBSETLCHARSET(login, "UTF-8"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); } dbloginfree(login); printf("After logon\n"); strcpy(in_file, INFILE_NAME); for (n = 1; n <= 100; ++n) { test_file(in_file); sprintf(in_file, "%s_%d", INFILE_NAME, n); if (sql_reopen(in_file) != SUCCEED) break; } dbclose(dbproc); dbexit(); printf("dblib %s on %s\n", (failed ? "failed!" : "okay"), __FILE__); return failed ? 1 : 0; } static int got_error = 0; static int ignore_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line) { got_error = 1; return 0; } static int ignore_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { got_error = 1; return INT_CANCEL; } static char line1[1024*16]; static char line2[1024*16]; static void test_file(const char *fn) { int i; RETCODE ret; int num_cols = 0; const char *out_file = "t0016.out"; const char *err_file = "t0016.err"; DBINT rows_copied; unsigned num_rows = 2; FILE *input_file; char in_file[256]; snprintf(in_file, sizeof(in_file), "%s/%s.in", FREETDS_SRCDIR, fn); input_file = fopen(in_file, "rb"); if (!input_file) { sprintf(in_file, "%s.in", fn); input_file = fopen(in_file, "rb"); } if (!input_file) { fprintf(stderr, "could not open %s\n", in_file); exit(1); } num_rows = count_file_rows(input_file); fclose(input_file); dberrhandle(ignore_err_handler); dbmsghandle(ignore_msg_handler); printf("Creating table '%s'\n", TABLE_NAME); got_error = 0; sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) continue; dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); if (got_error) return; /* BCP in */ printf("bcp_init with in_file as '%s'\n", in_file); ret = bcp_init(dbproc, TABLE_NAME, in_file, err_file, DB_IN); if (ret != SUCCEED) failure("bcp_init failed\n"); printf("return from bcp_init = %d\n", ret); ret = sql_cmd(dbproc); printf("return from dbcmd = %d\n", ret); ret = dbsqlexec(dbproc); printf("return from dbsqlexec = %d\n", ret); if (dbresults(dbproc) != FAIL) { num_cols = dbnumcols(dbproc); printf("Number of columns = %d\n", num_cols); while (dbnextrow(dbproc) != NO_MORE_ROWS) { } } ret = bcp_columns(dbproc, num_cols); if (ret != SUCCEED) failure("bcp_columns failed\n"); printf("return from bcp_columns = %d\n", ret); for (i = 1; i < num_cols; i++) { if ((ret = bcp_colfmt(dbproc, i, SYBCHAR, 0, -1, (const BYTE *) "\t", sizeof(char), i)) == FAIL) failure("return from bcp_colfmt = %d\n", ret); } if ((ret = bcp_colfmt(dbproc, num_cols, SYBCHAR, 0, -1, (const BYTE *) "\n", sizeof(char), num_cols)) == FAIL) failure("return from bcp_colfmt = %d\n", ret); ret = bcp_exec(dbproc, &rows_copied); if (ret != SUCCEED || rows_copied != num_rows) failure("bcp_exec failed\n"); printf("%d rows copied in\n", rows_copied); /* BCP out */ rows_copied = 0; ret = bcp_init(dbproc, TABLE_NAME, out_file, err_file, DB_OUT); if (ret != SUCCEED) failure("bcp_int failed\n"); printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != FAIL) { num_cols = dbnumcols(dbproc); while (dbnextrow(dbproc) != NO_MORE_ROWS) { } } ret = bcp_columns(dbproc, num_cols); for (i = 1; i < num_cols; i++) { if ((ret = bcp_colfmt(dbproc, i, SYBCHAR, 0, -1, (const BYTE *) "\t", sizeof(char), i)) == FAIL) failure("return from bcp_colfmt = %d\n", ret); } if ((ret = bcp_colfmt(dbproc, num_cols, SYBCHAR, 0, -1, (const BYTE *) "\n", sizeof(char), num_cols)) == FAIL) failure("return from bcp_colfmt = %d\n", ret); ret = bcp_exec(dbproc, &rows_copied); if (ret != SUCCEED || rows_copied != num_rows) failure("bcp_exec failed\n"); printf("%d rows copied out\n", rows_copied); printf("Dropping table '%s'\n", TABLE_NAME); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) continue; if (failed) return; if (compare_files(in_file, out_file)) printf("Input and output files are equal\n"); else failed = 1; } static size_t fgets_raw(char *s, int len, FILE *f) { char *p = s; while (len > 1) { int c = getc(f); if (c == EOF) { if (ferror(f)) return 0; break; } *p++ = c; --len; if (c == '\n') break; } if (len > 0) *p = 0; return p - s; } static int compare_files(const char *fn1, const char *fn2) { int equal = 1; FILE *f1, *f2; size_t s1, s2; /* check input and output should be the same */ f1 = fopen(fn1, "r"); f2 = fopen(fn2, "r"); if (f1 != NULL && f2 != NULL) { int line = 1; for (;; ++line) { s1 = fgets_raw(line1, sizeof(line1), f1); s2 = fgets_raw(line2, sizeof(line2), f2); /* EOF or error of one */ if (!!s1 != !!s2) { equal = 0; failure("error reading a file or EOF of a file\n"); break; } /* EOF or error of both */ if (!s1) { if (feof(f1) && feof(f2)) break; equal = 0; failure("error reading a file\n"); break; } if (s1 != s2 || memcmp(line1, line2, s1) != 0) { equal = 0; failure("File different at line %d\n" " input: %s" " output: %s", line, line1, line2); } } } else { equal = 0; failure("error opening files\n"); } if (f1) fclose(f1); if (f2) fclose(f2); return equal; } static unsigned count_file_rows(FILE *f) { size_t s; unsigned rows = 1; char last = '\n'; assert(f); while ((s = fgets_raw(line1, sizeof(line1), f)) != 0) { last = line1[s-1]; if (last == '\n') ++rows; } if (last == '\n') --rows; assert(!ferror(f)); return rows; } freetds-1.3.6/src/dblib/unittests/t0016.sql000644 025423 025423 00000000371 14056414221 022003 0ustar00fredianofrediano000000 000000 create table #dblib0016 (f1 int not null, s1 int null, f2 numeric(10,2) null, f3 varchar(255) not null, f4 datetime null, [group] varchar(20)) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_1.sql000644 025423 025423 00000000273 14056414221 022224 0ustar00fredianofrediano000000 000000 create table #dblib0016 (f1 int not null, str nvarchar(5), uuid uniqueidentifier) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_2.sql000644 025423 025423 00000000255 14056414221 022225 0ustar00fredianofrediano000000 000000 create table #dblib0016 (f1 int not null, f2 text, f3 varchar(20) ) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_3.sql000644 025423 025423 00000000300 14056414221 022215 0ustar00fredianofrediano000000 000000 create table #dblib0016 (f1 int not null, f2 char(20) not null, f3 binary(4) not null) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_4.sql000644 025423 025423 00000000270 14056414221 022224 0ustar00fredianofrediano000000 000000 create table #dblib0016 (f1 int not null, f2 char(20) null, f3 binary(4) null) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_5.sql000644 025423 025423 00000001221 14056414221 022222 0ustar00fredianofrediano000000 000000 create table #dblib0016 (f0 int not null, f1 varchar(60) not null, f2 varchar(60) not null, f3 varchar(60) not null, f4 varchar(60) not null, f5 varchar(60) not null, f6 varchar(60) not null, f7 varchar(60) not null, f8 varchar(60) not null, f9 varchar(60) not null, f10 varchar(60) not null, f11 varchar(60) not null, f12 varchar(60) not null, f13 varchar(60) not null, f14 varchar(60) not null, f15 varchar(60) not null, f16 varchar(60) not null, f17 varchar(60) not null, f18 varchar(60) not null, f19 varchar(60) not null, f20 varchar(60) not null) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_6.sql000644 025423 025423 00000000233 14056414221 022225 0ustar00fredianofrediano000000 000000 create table #dblib0016 (f0 datetime2(3) not null) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_7.sql000644 025423 025423 00000000262 14056414221 022230 0ustar00fredianofrediano000000 000000 create table #dblib0016 (b1 bit, b2 bit, i1 int not null, b3 bit, b4 bit) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_8.sql000644 025423 025423 00000000241 14056414221 022226 0ustar00fredianofrediano000000 000000 create table #dblib0016 (b1 bit, b2 bit, b3 bit, b4 bit) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_9.sql000644 025423 025423 00000000505 14056414221 022232 0ustar00fredianofrediano000000 000000 -- check if bit are all collased together, the layout will be -- 8 bits (b1-b8), i1, 1 bit (b9) -> 6 bytes create table #dblib0016 (b1 bit, b2 bit, b3 bit, b4 bit, b5 bit, b6 bit, b7 bit, b8 bit, i1 int not null, b9 bit) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_10.sql000644 025423 025423 00000000261 14056414221 022301 0ustar00fredianofrediano000000 000000 set textsize 65536 create table #dblib0016 (id int not null, data image) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016_11.sql000644 025423 025423 00000000516 14056414221 022305 0ustar00fredianofrediano000000 000000 create table #dblib0016 (id int not null, var uniqueidentifier null, c1 char(20) not null, v1 varchar(20) not null, c2 char(20) null, v2 varchar(20) null, b1 binary(20) null, vb1 varbinary(20) null, img image null, txt text null) go select * from #dblib0016 where 0=1 go select * from #dblib0016 where 0=1 go drop table #dblib0016 go freetds-1.3.6/src/dblib/unittests/t0016.in000644 025423 025423 00000000224 14056414221 021607 0ustar00fredianofrediano000000 000000 1 2 123.45 This is a varchar 255 field 2001-09-11 09:13:13.663 group1 4 5 56789.12 This is another varchar 255 field 2000-02-29 13:01:01.000 group2 freetds-1.3.6/src/dblib/unittests/t0016_1.in000644 025423 025423 00000000140 14056414221 022024 0ustar00fredianofrediano000000 000000 1 æâ€Â¢Ã°Å‹ 47C9B7E7-7AD6-4EE5-B29B-D81569251E8B 4 ciao2 82E8E9A8-61D3-424E-9AB5-AFD38CC41E36 freetds-1.3.6/src/dblib/unittests/t0016_2.in000644 025423 025423 00000001413 14056414221 022031 0ustar00fredianofrediano000000 000000 1 This is a text 255 field varchar 1 4 This is another text 255 field. I'm trying to get a quite long string. This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! This is the first bcp text test! varcharX freetds-1.3.6/src/dblib/unittests/t0016_3.in000644 025423 025423 00000000100 14056414221 022022 0ustar00fredianofrediano000000 000000 1 Just a char 01020304 2 Other test 89abcdef freetds-1.3.6/src/dblib/unittests/t0016_4.in000644 025423 025423 00000000055 14056414221 022034 0ustar00fredianofrediano000000 000000 1 Just a char 01020304 2 Other test 89abcdef freetds-1.3.6/src/dblib/unittests/t0016_5.in000644 025423 025423 00000001732 14056414221 022040 0ustar00fredianofrediano000000 000000 1 test very very very long varchar 1 test very very very long varchar 2 test very very very long varchar 3 test very very very long varchar 4 test very very very long varchar 5 test very very very long varchar 6 test very very very long varchar 7 test very very very long varchar 8 test very very very long varchar 9 test very very very long varchar 10 test very very very long varchar 11 test very very very long varchar 12 test very very very long varchar 13 test very very very long varchar 14 test very very very long varchar 15 test very very very long varchar 16 test very very very long varchar 17 test very very very long varchar 18 test very very very long varchar 19 test very very very long varchar 20 3 test very very very long varchar 1 test very very very long varchar 2 test very very very long varchar 3 test very very very long varchar 4 test very very very long varchar 5 test very very very long varchar 6 test very very very long varchar 7 x x x x x x x x x x x x x freetds-1.3.6/src/dblib/unittests/t0016_6.in000644 025423 025423 00000000060 14056414221 022032 0ustar00fredianofrediano000000 000000 2014-04-15 20:23:45.123 2038-11-27 04:12:32.876 freetds-1.3.6/src/dblib/unittests/t0016_7.in000644 025423 025423 00000000032 14056414221 022032 0ustar00fredianofrediano000000 000000 1 0 1234 1 0 0 1 7654 0 1 freetds-1.3.6/src/dblib/unittests/t0016_8.in000644 025423 025423 00000000020 14056414221 022030 0ustar00fredianofrediano000000 000000 1 0 1 0 0 1 1 0 freetds-1.3.6/src/dblib/unittests/t0016_9.in000644 025423 025423 00000000063 14056414221 022040 0ustar00fredianofrediano000000 000000 1 0 1 0 1 0 1 0 123456 1 0 1 1 0 0 1 1 0 8765432 1 freetds-1.3.6/src/dblib/unittests/t0016_10.in000644 025423 025423 00000052376 14056414221 022126 0ustar00fredianofrediano000000 000000 1 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 2 fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210 freetds-1.3.6/src/dblib/unittests/t0016_11.in000644 025423 025423 00000000107 14056414221 022110 0ustar00fredianofrediano000000 000000 1 00 2 a b freetds-1.3.6/src/dblib/unittests/t0017.c000644 025423 025423 00000011212 14056414271 021430 0ustar00fredianofrediano000000 000000 /* * Purpose: Test bcp in, with dbvarylen() * Functions: bcp_colfmt bcp_columns bcp_exec bcp_init dbvarylen */ #include "common.h" #include int main(int argc, char *argv[]) { int failed = 0; LOGINREC *login; DBPROCESS *dbproc; int i; RETCODE ret; int big_endian = 1; char *out_file = "t0017.out"; static const char in_file_le[] = FREETDS_SRCDIR "/t0017.in"; static const char in_file_be[] = FREETDS_SRCDIR "/t0017.in.be"; const char *in_file = in_file_le; const char *err_file = "t0017.err"; DBINT rows_copied; int num_cols = 0; int col_type[256]; DBBOOL col_varylen[256]; int prefix_len; if (((char *) &big_endian)[0] == 1) big_endian = 0; if (big_endian) in_file = in_file_be; setbuf(stdout, NULL); setbuf(stderr, NULL); set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon ... "); login = dblogin(); assert(login); BCP_SETL(login, TRUE); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0017"); printf("done\n"); printf("Opening \"%s\" for \"%s\" ... ", SERVER, USER); dbproc = dbopen(login, SERVER); assert(dbproc); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); } dbloginfree(login); printf("done\n"); printf("Creating table ... "); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("done\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } /* BCP out */ printf("bcp_init... "); ret = bcp_init(dbproc, "#dblib0017", out_file, err_file, DB_OUT); if (ret != SUCCEED) failed = 1; printf("done\n"); printf("Issuing SELECT ... "); sql_cmd(dbproc); dbsqlexec(dbproc); printf("done\nFetching metadata ... "); if (dbresults(dbproc) != FAIL) { num_cols = dbnumcols(dbproc); for (i = 0; i < num_cols; ++i) { col_type[i] = dbcoltype(dbproc, i + 1); col_varylen[i] = dbvarylen(dbproc, i + 1); } while (dbnextrow(dbproc) != NO_MORE_ROWS) { } } printf("done\n"); printf("bcp_columns ... "); ret = bcp_columns(dbproc, num_cols); if (ret != SUCCEED) failed = 1; for (i = 0; i < num_cols; i++) { prefix_len = 0; if (col_type[i] == SYBIMAGE || col_type[i] == SYBTEXT) { prefix_len = 4; } else if (col_varylen[i]) { prefix_len = 1; } printf("bind %d prefix %d col_type %s\n", i, prefix_len, col_type[i] == SYBIMAGE ? "image" : "other"); ret = bcp_colfmt(dbproc, i + 1, col_type[i], prefix_len, -1, NULL, 0, i + 1); if (ret == FAIL) { fprintf(stderr, "return from bcp_colfmt = %d\n", ret); failed = 1; } } printf("done\n"); rows_copied = -1; printf("bcp_exec ... "); ret = bcp_exec(dbproc, &rows_copied); if (ret != SUCCEED || rows_copied != 1) failed = 1; printf("%d rows copied\n", rows_copied); /* delete rows */ sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } /* * BCP in */ printf("bcp_init... "); ret = bcp_init(dbproc, "#dblib0017", in_file, err_file, DB_IN); if (ret != SUCCEED) failed = 1; printf("done\n"); printf("Issuing SELECT ... "); sql_cmd(dbproc); dbsqlexec(dbproc); printf("done\nFetching metadata ... "); if (dbresults(dbproc) != FAIL) { num_cols = dbnumcols(dbproc); for (i = 0; i < num_cols; i++) { col_type[i] = dbcoltype(dbproc, i + 1); col_varylen[i] = dbvarylen(dbproc, i + 1); } while (dbnextrow(dbproc) != NO_MORE_ROWS) { } } while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("done\n"); printf("bcp_columns ... "); ret = bcp_columns(dbproc, num_cols); if (ret != SUCCEED) failed = 1; for (i = 0; i < num_cols; i++) { prefix_len = 0; if (col_type[i] == SYBIMAGE || col_type[i] == SYBTEXT) { prefix_len = 4; } else if (col_varylen[i]) { prefix_len = 1; } ret = bcp_colfmt(dbproc, i + 1, col_type[i], prefix_len, -1, NULL, 0, i + 1); if (ret == FAIL) { fprintf(stderr, "return from bcp_colfmt = %d\n", ret); failed = 1; } } printf("done\n"); printf("bcp_exec ... "); rows_copied = -1; ret = bcp_exec(dbproc, &rows_copied); if (ret != SUCCEED || rows_copied != 1) failed = 1; printf("done\n"); /* test we inserted correctly row */ if (!failed) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { while ((ret=dbnextrow(dbproc)) != NO_MORE_ROWS) { fprintf(stderr, "Invalid dbnextrow result %d executing query\n", ret); failed = 1; } } } printf("%d rows copied\n", rows_copied); dbclose(dbproc); dbexit(); printf("dblib %s on %s\n", (failed ? "failed!" : "okay"), __FILE__); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0017.sql000644 025423 025423 00000000726 14056414221 022010 0ustar00fredianofrediano000000 000000 create table #dblib0017 (c1 int null, c2 text) go insert into #dblib0017(c1,c2) values(1144201745,'prova di testo questo testo dovrebbe andare a finire in un campo text') go select * from #dblib0017 where 0=1 go delete from #dblib0017 go select * from #dblib0017 where 0=1 go SET NOCOUNT ON DECLARE @n INT SELECT @n = COUNT(*) FROM #dblib0017 WHERE c1=1144201745 AND c2 LIKE 'prova di testo questo testo dovrebbe andare a finire in un campo text' IF @n <> 1 SELECT 0 go freetds-1.3.6/src/dblib/unittests/t0017.in000644 025423 025423 00000000116 14056414221 021610 0ustar00fredianofrediano000000 000000 "3DEprova di testo questo testo dovrebbe andare a finire in un campo textfreetds-1.3.6/src/dblib/unittests/t0017.in.be000644 025423 025423 00000000116 14056414221 022175 0ustar00fredianofrediano000000 000000 D3"Eprova di testo questo testo dovrebbe andare a finire in un campo textfreetds-1.3.6/src/dblib/unittests/t0018.c000644 025423 025423 00000006472 14056414221 021440 0ustar00fredianofrediano000000 000000 /* * Purpose: Test behaviour of DBCOUNT() for updates and inserts * Functions: DBCOUNT dbbind dbnextrow dbnumcols dbopen dbresults dbsqlexec */ #include "common.h" int failed = 0; int main(int argc, char **argv) { const int rows_to_add = 50; LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0018"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); for (i = 0; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } if (DBCOUNT(dbproc) != 1) { failed = 1; printf("Was expecting a rows affect to be 1."); exit(1); } } printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); printf("Checking for an empty result set.\n"); if (dbresults(dbproc) != SUCCEED) { failed = 1; printf("Was expecting a result set.\n"); exit(1); } if(DBROWS(dbproc) != FAIL) { failed = 1; printf("Was expecting no rows to be available.\n"); exit(1); } printf("Checking for a result set with content.\n"); if (dbresults(dbproc) != SUCCEED) { failed = 1; printf("Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); if (SUCCEED != dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint)) { failed = 1; fprintf(stderr, "Had problem with bind\n"); abort(); } if (SUCCEED != dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr)) { failed = 1; fprintf(stderr, "Had problem with bind\n"); abort(); } for (i = 0; i < rows_to_add; i++) { char expected[1024]; sprintf(expected, "row %03d", i); if (REG_ROW != dbnextrow(dbproc)) { failed = 1; fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { failed = 1; fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { failed = 1; printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } printf("Read a row of data -> %d %s\n", (int) testint, teststr); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { failed = 1; fprintf(stderr, "Was expecting no more rows\n"); exit(1); } if (DBCOUNT(dbproc) != rows_to_add) { failed = 1; printf("Was expecting a rows affect to be %d was %d.\n", rows_to_add, DBCOUNT(dbproc)); exit(1); } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } if (DBCOUNT(dbproc) != rows_to_add) { failed = 1; printf("Was expecting a rows affect to be %d was %d.\n", rows_to_add, DBCOUNT(dbproc)); exit(1); } else { printf("Number of rows affected by update = %d.\n", DBCOUNT(dbproc)); } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0018.sql000644 025423 025423 00000005066 14056414221 022013 0ustar00fredianofrediano000000 000000 create table #dblib0018 (i int not null, s char(10) not null) go insert into #dblib0018 values (0, 'row 000') go insert into #dblib0018 values (1, 'row 001') go insert into #dblib0018 values (2, 'row 002') go insert into #dblib0018 values (3, 'row 003') go insert into #dblib0018 values (4, 'row 004') go insert into #dblib0018 values (5, 'row 005') go insert into #dblib0018 values (6, 'row 006') go insert into #dblib0018 values (7, 'row 007') go insert into #dblib0018 values (8, 'row 008') go insert into #dblib0018 values (9, 'row 009') go insert into #dblib0018 values (10, 'row 010') go insert into #dblib0018 values (11, 'row 011') go insert into #dblib0018 values (12, 'row 012') go insert into #dblib0018 values (13, 'row 013') go insert into #dblib0018 values (14, 'row 014') go insert into #dblib0018 values (15, 'row 015') go insert into #dblib0018 values (16, 'row 016') go insert into #dblib0018 values (17, 'row 017') go insert into #dblib0018 values (18, 'row 018') go insert into #dblib0018 values (19, 'row 019') go insert into #dblib0018 values (20, 'row 020') go insert into #dblib0018 values (21, 'row 021') go insert into #dblib0018 values (22, 'row 022') go insert into #dblib0018 values (23, 'row 023') go insert into #dblib0018 values (24, 'row 024') go insert into #dblib0018 values (25, 'row 025') go insert into #dblib0018 values (26, 'row 026') go insert into #dblib0018 values (27, 'row 027') go insert into #dblib0018 values (28, 'row 028') go insert into #dblib0018 values (29, 'row 029') go insert into #dblib0018 values (30, 'row 030') go insert into #dblib0018 values (31, 'row 031') go insert into #dblib0018 values (32, 'row 032') go insert into #dblib0018 values (33, 'row 033') go insert into #dblib0018 values (34, 'row 034') go insert into #dblib0018 values (35, 'row 035') go insert into #dblib0018 values (36, 'row 036') go insert into #dblib0018 values (37, 'row 037') go insert into #dblib0018 values (38, 'row 038') go insert into #dblib0018 values (39, 'row 039') go insert into #dblib0018 values (40, 'row 040') go insert into #dblib0018 values (41, 'row 041') go insert into #dblib0018 values (42, 'row 042') go insert into #dblib0018 values (43, 'row 043') go insert into #dblib0018 values (44, 'row 044') go insert into #dblib0018 values (45, 'row 045') go insert into #dblib0018 values (46, 'row 046') go insert into #dblib0018 values (47, 'row 047') go insert into #dblib0018 values (48, 'row 048') go insert into #dblib0018 values (49, 'row 049') go select * into #tmp0 from #dblib0018 select * from #tmp0 order by i go update #dblib0018 set s = 'row 000' go freetds-1.3.6/src/dblib/unittests/t0019.c000644 025423 025423 00000007616 14056414221 021442 0ustar00fredianofrediano000000 000000 /* * Purpose: Test Some conversion, check trimming error and results * Functions: dbconvert dberrhandle dbmsghandle dbinit dbexit */ #include "common.h" #include static int failure = 0; static const char *cur_result = ""; static const char *cur_test = ""; static int cur_line = 0; int test(int srctype, const void *srcdata, int srclen, int dsttype, int dstlen); int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { /* * For server messages, cancel the query and rely on the * message handler to spew the appropriate error messages out. */ if (dberr == SYBESMSG) return INT_CANCEL; if (dberr == 20049) { fprintf(stderr, "OK: anticipated error %d (%s) arrived\n", dberr, dberrstr); } else { fprintf(stderr, "DB-LIBRARY error (severity %d, dberr %d, oserr %d, dberrstr %s, oserrstr %s):\n", severity, dberr, oserr, dberrstr ? dberrstr : "(null)", oserrstr ? oserrstr : "(null)"); } fflush(stderr); return INT_CANCEL; } int test(int srctype, const void *srcdata, int srclen, int dsttype, int dstlen) { DBCHAR buf[10]; char s[20], *p; int i, len, correct; char out[256]; memset(buf, '*', sizeof(buf)); len = dbconvert(NULL, srctype, (const BYTE*) srcdata, srclen, dsttype, (BYTE*) buf, dstlen); /* build result string */ sprintf(out, "len=%d", len); p = s; for (i = 0; i < sizeof(buf); ++i) { *p++ = isprint((unsigned char) buf[i]) ? buf[i] : '.'; sprintf(strchr(out, 0), " %02X", (unsigned char) buf[i]); } *p = 0; correct = 0; if (len == -1) { if (strcmp(cur_result, "error") == 0) correct = 1; } else { if (strcmp(cur_result, out) == 0) correct = 1; } if (!correct) { failure = 1; printf("\nline: %d test: %s\n" "%s\n%s\n" "failed :( should be '%s'\n", cur_line, cur_test, s, out, cur_result); } return 0; } #define TEST(s,out) \ { cur_result = out; cur_line = __LINE__; cur_test = #s; test s; } int main(int argc, char *argv[]) { if (dbinit() == FAIL) return 1; dberrhandle(err_handler); dbmsghandle(syb_msg_handler); TEST((SYBBINARY, "ciao\0\0", 6, SYBBINARY, -2), "len=6 63 69 61 6F 00 00 2A 2A 2A 2A"); TEST((SYBCHAR, "ciao ", 6, SYBCHAR, -2), "len=6 63 69 61 6F 20 20 00 2A 2A 2A"); TEST((SYBCHAR, "ciao\0\0", 6, SYBCHAR, -2), "len=6 63 69 61 6F 00 00 00 2A 2A 2A"); TEST((SYBCHAR, "ciao ", 6, SYBCHAR, -1), "len=4 63 69 61 6F 00 2A 2A 2A 2A 2A"); TEST((SYBCHAR, "ciao\0\0", 6, SYBCHAR, -1), "len=6 63 69 61 6F 00 00 00 2A 2A 2A"); TEST((SYBCHAR, "ciao ", 6, SYBCHAR, 8), "len=6 63 69 61 6F 20 20 20 20 2A 2A"); TEST((SYBCHAR, "ciao\0\0", 6, SYBCHAR, 8), "len=6 63 69 61 6F 00 00 20 20 2A 2A"); TEST((SYBCHAR, "ciao ", 6, SYBCHAR, 4), "error"); TEST((SYBCHAR, "ciao\0\0", 6, SYBCHAR, 4), "error"); TEST((SYBCHAR, "ciao ", 6, SYBCHAR, 6), "len=6 63 69 61 6F 20 20 2A 2A 2A 2A"); TEST((SYBCHAR, "ciao\0\0", 6, SYBCHAR, 6), "len=6 63 69 61 6F 00 00 2A 2A 2A 2A"); /* convert from NULL to BINARY */ TEST((SYBBINARY, "", 0, SYBBINARY, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBVARBINARY, "", 0, SYBBINARY, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBIMAGE, "", 0, SYBBINARY, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBBINARY, "", 0, SYBVARBINARY, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBVARBINARY, "", 0, SYBVARBINARY, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBIMAGE, "", 0, SYBVARBINARY, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBBINARY, "", 0, SYBIMAGE, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBVARBINARY, "", 0, SYBIMAGE, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBIMAGE, "", 0, SYBIMAGE, 6), "len=6 00 00 00 00 00 00 2A 2A 2A 2A"); TEST((SYBBINARY, "", 0, SYBBINARY, -1), "len=0 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A"); dbexit(); if (!failure) printf("All tests passed!\n"); return failure; } freetds-1.3.6/src/dblib/unittests/t0020.c000644 025423 025423 00000003774 14056414221 021433 0ustar00fredianofrediano000000 000000 /* * Purpose: Test for proper return code from dbsqlexec() * Functions: db_name dbcmd dberrhandle dbmsghandle dbnextrow dbopen dbresults dbsqlexec */ #include "common.h" int failed = 0; int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); /* * The bad column name message has severity 16, causing db-lib to call the error handler after calling the message handler. * This wrapper anticipates that behavior, and again sets the userdata, telling the handler this error is expected. */ int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { int expected_error = 207; dbsetuserdata(dbproc, (BYTE*) &expected_error); return syb_err_handler(dbproc, severity, dberr, oserr, dberrstr, oserrstr); } int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; RETCODE ret; int expected_error; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0020"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); sql_cmd(dbproc); fprintf(stderr, "The following invalid column error is normal.\n"); expected_error = 207; dbsetuserdata(dbproc, (BYTE*) &expected_error); ret = dbsqlexec(dbproc); if (ret != FAIL) { failed = 1; fprintf(stderr, "Failed. Expected FAIL to be returned.\n"); exit(1); } sql_cmd(dbproc); ret = dbsqlexec(dbproc); if (ret != SUCCEED) { failed = 1; fprintf(stderr, "Failed. Expected SUCCEED to be returned.\n"); exit(1); } while (dbresults(dbproc) != NO_MORE_RESULTS) { while (dbnextrow(dbproc) != NO_MORE_ROWS) continue; } dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0020.sql000644 025423 025423 00000000144 14056414221 021774 0ustar00fredianofrediano000000 000000 /* request an invalid column from a non-existent table */ select dsjfkl dsjf go select db_name() go freetds-1.3.6/src/dblib/unittests/t0022.c000644 025423 025423 00000012703 14056414221 021425 0ustar00fredianofrediano000000 000000 /* * Purpose: Test retrieving output parameters and return status * Functions: DBTDS dbnumrets dbresults dbretdata dbretlen dbretname dbrettype dbsqlexec */ #include "common.h" #include int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; int erc, failed = 0; char *retname = NULL; int rettype = 0, retlen = 0; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0022"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); printf("Dropping proc\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while ((erc = dbresults(dbproc)) == SUCCEED) { printf("dbresult succeeded dropping procedure\n"); while ((erc = dbnextrow(dbproc)) == SUCCEED) { printf("dbnextrow returned spurious rows dropping procedure\n"); assert(0); /* dropping a procedure returns no rows */ } assert(erc == NO_MORE_ROWS); } assert(erc == NO_MORE_RESULTS); printf("creating proc\n"); sql_cmd(dbproc); if (dbsqlexec(dbproc) == FAIL) { printf("Failed to create proc t0022.\n"); exit(1); } while ((erc = dbresults(dbproc)) != NO_MORE_RESULTS) { assert(erc != FAIL); while ((erc = dbnextrow(dbproc)) == SUCCEED) { assert(0); /* creating a procedure returns no rows */ } assert(erc == NO_MORE_ROWS); } sql_cmd(dbproc); dbsqlexec(dbproc); while ((erc = dbresults(dbproc)) != NO_MORE_RESULTS) { if (erc == FAIL) { printf("Was expecting a result set.\n"); exit(1); } while ((erc = dbnextrow(dbproc)) == SUCCEED) { assert(0); /* procedure returns no rows */ } assert(erc == NO_MORE_ROWS); } #if defined(DBTDS_7_0) && defined(DBTDS_7_1) && defined(DBTDS_7_2) && defined(DBTDS_7_3) && defined(DBTDS_7_4) if ((dbnumrets(dbproc) == 0) && ((DBTDS(dbproc) == DBTDS_7_0) || (DBTDS(dbproc) == DBTDS_7_1) || (DBTDS(dbproc) == DBTDS_7_2) || (DBTDS(dbproc) == DBTDS_7_3) || (DBTDS(dbproc) == DBTDS_7_4))) { printf("WARNING: Received no return parameters from server!\n"); printf("WARNING: This is likely due to a bug in Microsoft\n"); printf("WARNING: SQL Server 7.0 SP3 and later.\n"); printf("WARNING: Please try again using TDS protocol 4.2.\n"); dbcmd(dbproc, "drop proc t0022"); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } dbexit(); exit(0); } #endif for (i = 1; i <= dbnumrets(dbproc); i++) { retname = dbretname(dbproc, i); printf("ret name %d is %s\n", i, retname); rettype = dbrettype(dbproc, i); printf("ret type %d is %d\n", i, rettype); retlen = dbretlen(dbproc, i); printf("ret len %d is %d\n", i, retlen); dbconvert(dbproc, rettype, dbretdata(dbproc, i), retlen, SYBVARCHAR, (BYTE*) teststr, -1); printf("ret data %d is %s\n", i, teststr); } if ((retname == NULL) || strcmp(retname, "@b")) { printf("Was expecting a retname to be @b.\n"); exit(1); } if (strcmp(teststr, "42")) { printf("Was expecting a retdata to be 42.\n"); exit(1); } if (rettype != SYBINT4) { printf("Was expecting a rettype to be SYBINT4 was %d.\n", rettype); exit(1); } if (retlen != 4) { printf("Was expecting a retlen to be 4.\n"); exit(1); } printf("Dropping proc\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } /* * Chapter 2: test for resultsets containing only a return status */ printf("Dropping proc t0022a\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while ((erc = dbresults(dbproc)) == SUCCEED) { printf("dbresult succeeded dropping procedure\n"); while ((erc = dbnextrow(dbproc)) == SUCCEED) { printf("dbnextrow returned spurious rows dropping procedure\n"); assert(0); /* dropping a procedure returns no rows */ } assert(erc == NO_MORE_ROWS); } assert(erc == NO_MORE_RESULTS); printf("creating proc t0022a\n"); sql_cmd(dbproc); if (dbsqlexec(dbproc) == FAIL) { printf("Failed to create proc t0022a.\n"); exit(1); } while ((erc = dbresults(dbproc)) != NO_MORE_RESULTS) { assert(erc != FAIL); while ((erc = dbnextrow(dbproc)) == SUCCEED) { assert(0); /* creating a procedure returns no rows */ } assert(erc == NO_MORE_ROWS); } sql_cmd(dbproc); dbsqlexec(dbproc); for (i=1; (erc = dbresults(dbproc)) != NO_MORE_RESULTS; i++) { enum {expected_iterations = 2}; DBBOOL fret; DBINT status; if (erc == FAIL) { printf("t0022a failed for some reason.\n"); exit(1); } printf("procedure returned %srows\n", DBROWS(dbproc)==SUCCEED? "" : "no "); while ((erc = dbnextrow(dbproc)) == SUCCEED) { assert(0); /* procedure returns no rows */ } assert(erc == NO_MORE_ROWS); fret = dbhasretstat(dbproc); printf("procedure has %sreturn status\n", fret==TRUE? "" : "no "); assert(fret == TRUE); status = dbretstatus(dbproc); printf("return status %d is %d\n", i, (int) status); switch (i) { case 1: assert(status == 17); break; case 2: assert(status == 1024); break; default: assert(i <= expected_iterations); } } assert(erc == NO_MORE_RESULTS); printf("Dropping proc t0022a\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } /* end chapter 2 */ dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/t0022.sql000644 025423 025423 00000000531 14056414221 021776 0ustar00fredianofrediano000000 000000 if object_id('t0022') is not null drop proc t0022 go create proc t0022 (@b int out) as begin select @b = 42 return 66 end go declare @b int exec t0022 @b = @b output go drop proc t0022 go if object_id('t0022a') is not null drop proc t0022a go create proc t0022a (@b int) as return @b go exec t0022a 17 exec t0022a 1024 go drop proc t0022a go freetds-1.3.6/src/dblib/unittests/t0023.c000644 025423 025423 00000010702 14056414221 021423 0ustar00fredianofrediano000000 000000 /* * Purpose: Test retrieving compute rows * Functions: dbaltbind dbaltcolid dbaltop dbalttype dbnumalts */ #include "common.h" #include static int got_error = 0; static int compute_supported = 1; static int compute_msg_handler(DBPROCESS * dbproc, DBINT msgno, int state, int severity, char *text, char *server, char *proc, int line) { if (strstr(text, "compute")) compute_supported = 0; else got_error = 1; return 0; } int main(int argc, char *argv[]) { LOGINREC *login; DBPROCESS *dbproc; int i; DBINT rowint; DBCHAR rowchar[2]; DBCHAR rowdate[32]; DBINT rowtype; DBINT computeint; DBCHAR computedate[32]; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0023"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); sql_cmd(dbproc); dbmsghandle(compute_msg_handler); i = dbsqlexec(dbproc); dbmsghandle(syb_msg_handler); if (!compute_supported) { printf("compute clause not supported, skip test!\n"); dbexit(); return 0; } if (got_error) { fprintf(stderr, "Unexpected error from query.\n"); exit(1); } while ((i=dbresults(dbproc)) != NO_MORE_RESULTS) { while (dbnextrow(dbproc) != NO_MORE_ROWS) continue; } printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } printf("insert\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } printf("select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Was expecting a result set.\n"); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) printf("col %d is %s\n", i, dbcolname(dbproc, i)); printf("binding row columns\n"); if (SUCCEED != dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & rowint)) { fprintf(stderr, "Had problem with bind col1\n"); abort(); } if (SUCCEED != dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) rowchar)) { fprintf(stderr, "Had problem with bind col2\n"); abort(); } if (SUCCEED != dbbind(dbproc, 3, STRINGBIND, 0, (BYTE *) rowdate)) { fprintf(stderr, "Had problem with bind col3\n"); abort(); } printf("testing compute clause 1\n"); if (dbnumalts(dbproc, 1) != 1) { fprintf(stderr, "Had problem with dbnumalts 1\n"); abort(); } if (dbalttype(dbproc, 1, 1) != SYBINT4) { fprintf(stderr, "Had problem with dbalttype 1, 1\n"); abort(); } if (dbaltcolid(dbproc, 1, 1) != 1) { fprintf(stderr, "Had problem with dbaltcolid 1, 1\n"); abort(); } if (dbaltop(dbproc, 1, 1) != SYBAOPSUM) { fprintf(stderr, "Had problem with dbaltop 1, 1\n"); abort(); } if (SUCCEED != dbaltbind(dbproc, 1, 1, INTBIND, 0, (BYTE *) & computeint)) { fprintf(stderr, "Had problem with dbaltbind 1, 1\n"); abort(); } printf("testing compute clause 2\n"); if (dbnumalts(dbproc, 2) != 1) { fprintf(stderr, "Had problem with dbnumalts 2\n"); abort(); } if (dbalttype(dbproc, 2, 1) != SYBDATETIME) { fprintf(stderr, "Had problem with dbalttype 2, 1\n"); abort(); } if (dbaltcolid(dbproc, 2, 1) != 3) { fprintf(stderr, "Had problem with dbaltcolid 2, 1\n"); abort(); } if (dbaltop(dbproc, 2, 1) != SYBAOPMAX) { fprintf(stderr, "Had problem with dbaltop 2, 1\n"); abort(); } if (SUCCEED != dbaltbind(dbproc, 2, 1, STRINGBIND, -1, (BYTE *) computedate)) { fprintf(stderr, "Had problem with dbaltbind 2, 1\n"); abort(); } while ((rowtype = dbnextrow(dbproc)) != NO_MORE_ROWS) { if (rowtype == REG_ROW) { printf("gotten a regular row\n"); } if (rowtype == 1) { printf("gotten a compute row for clause 1\n"); printf("value of sum(col1) = %d\n", computeint); } if (rowtype == 2) { printf("gotten a compute row for clause 2\n"); printf("value of max(col3) = %s\n", computedate); } } dbexit(); printf("%s %s\n", __FILE__, "OK"); return 0; } freetds-1.3.6/src/dblib/unittests/t0023.sql000644 025423 025423 00000001140 14056414221 021774 0ustar00fredianofrediano000000 000000 select name from sysobjects where name = 'missing' compute max(name) go create table #dblib0023 (col1 int not null, col2 char(1) not null, col3 datetime not null) go insert into #dblib0023 values (1, 'A', 'Jan 1 2002 10:00:00AM') go insert into #dblib0023 values (2, 'A', 'Jan 2 2002 10:00:00AM') go insert into #dblib0023 values (3, 'A', 'Jan 3 2002 10:00:00AM') go insert into #dblib0023 values (8, 'B', 'Jan 4 2002 10:00:00AM') go insert into #dblib0023 values (9, 'B', 'Jan 5 2002 10:00:00AM') go select col1, col2, col3 from #dblib0023 order by col2 compute sum(col1) by col2 compute max(col3) go freetds-1.3.6/src/dblib/unittests/text_buffer.c000644 025423 025423 00000005550 14056414221 023175 0ustar00fredianofrediano000000 000000 /* * Purpose: Test to see if row buffering and blobs works correctly. * Functions: dbbind dbnextrow dbopen dbresults dbsqlexec dbgetrow */ #include "common.h" int main(int argc, char **argv) { LOGINREC *login; DBPROCESS *dbproc; int i; char teststr[1024]; DBINT testint; set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); /* Fortify_EnterScope(); */ dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "text_buffer"); DBSETLHOST(login, "ntbox.dntis.ro"); printf("About to open\n"); dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); #ifdef MICROSOFT_DBLIB dbsetopt(dbproc, DBBUFFER, "100"); #else dbsetopt(dbproc, DBBUFFER, "100", 0); #endif printf("creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("insert\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } printf("select\n"); dbcmd(dbproc, "select * from #dblib order by i"); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set."); return 1; } for (i = 1; i <= dbnumcols(dbproc); i++) { printf("col %d is %s\n", i, dbcolname(dbproc, i)); } dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint); dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "dblib failed for %s:%d\n", __FILE__, __LINE__); return 1; } if (dbdatlen(dbproc, 2) != 6 || 0 != strcmp("ABCDEF", teststr)) { fprintf(stderr, "Expected |%s|, found |%s|\n", "ABCDEF", teststr); fprintf(stderr, "dblib failed for %s:%d\n", __FILE__, __LINE__); return 1; } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "dblib failed for %s:%d\n", __FILE__, __LINE__); return 1; } if (dbdatlen(dbproc, 2) != 3 || 0 != strcmp("abc", teststr)) { fprintf(stderr, "Expected |%s|, found |%s|\n", "abc", teststr); fprintf(stderr, "dblib failed for %s:%d\n", __FILE__, __LINE__); return 1; } /* get again row 1 */ dbgetrow(dbproc, 1); /* here length and string should be ok */ if (dbdatlen(dbproc, 2) != 6 || 0 != strcmp("ABCDEF", teststr)) { fprintf(stderr, "Expected |%s|, found |%s|\n", "ABCDEF", teststr); fprintf(stderr, "dblib failed for %s:%d\n", __FILE__, __LINE__); return 1; } dbgetrow(dbproc, 2); if (dbdatlen(dbproc, 2) != 3 || 0 != strcmp("abc", teststr)) { fprintf(stderr, "Expected |%s|, found |%s|\n", "abc", teststr); fprintf(stderr, "dblib failed for %s:%d\n", __FILE__, __LINE__); return 1; } dbexit(); printf("%s OK\n", __FILE__); return 0; } freetds-1.3.6/src/dblib/unittests/text_buffer.sql000644 025423 025423 00000000246 14056414221 023547 0ustar00fredianofrediano000000 000000 create table #dblib (i int not null, s text) go insert into #dblib values (1, 'ABCDEF') go insert into #dblib values (2, 'abc') go select * from #dblib order by i go freetds-1.3.6/src/dblib/unittests/thread.c000644 025423 025423 00000011360 14056414271 022130 0ustar00fredianofrediano000000 000000 /* * Purpose: Test dblib thread safety */ #include "common.h" #include #include #include #ifdef HAVE_UNISTD_H #include #endif #include #ifdef TDS_HAVE_MUTEX static tds_mutex mutex = TDS_MUTEX_INITIALIZER; static int result = 0; static int thread_count = 0; #define ROWS 20 #define NUM_THREAD 10 #define NUM_LOOP 100 static void set_failed(void) { tds_mutex_lock(&mutex); result = 1; tds_mutex_unlock(&mutex); } static int test(DBPROCESS *dbproc) { int i; char teststr[1024]; DBINT testint; /* printf("select\n"); */ dbcmd(dbproc, "select * from dblib_thread order by i"); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { printf("Was expecting a result set.\n"); set_failed(); return 1; } if (SUCCEED != dbbind(dbproc, 1, INTBIND, 0, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); abort(); } if (SUCCEED != dbbind(dbproc, 2, STRINGBIND, 0, (BYTE *) teststr)) { fprintf(stderr, "Had problem with bind\n"); abort(); } for (i = 0; i < ROWS; i++) { char expected[64]; sprintf(expected, "row %d", i); memset(teststr, 'x', sizeof(teststr)); teststr[0] = 0; teststr[sizeof(teststr) - 1] = 0; if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); set_failed(); return 1; } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } if (0 != strncmp(teststr, expected, strlen(expected))) { printf("Failed. Expected s to be |%s|, was |%s|\n", expected, teststr); abort(); } /* printf("Read a row of data -> %d |%s|\n", (int) testint, teststr); */ } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Was expecting no more rows\n"); set_failed(); return 1; } dbcancel(dbproc); return 0; } static TDS_THREAD_PROC_DECLARE(thread_test, arg) { int i; int num = TDS_PTR2INT(arg); DBPROCESS *dbproc; LOGINREC *login; login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "thread"); dbproc = dbopen(login, SERVER); if (!dbproc) { dbloginfree(login); fprintf(stderr, "Unable to connect to %s\n", SERVER); set_failed(); return TDS_THREAD_RESULT(0); } dbloginfree(login); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); tds_mutex_lock(&mutex); ++thread_count; tds_mutex_unlock(&mutex); printf("thread %2d waiting for all threads to start\n", num+1); tds_mutex_lock(&mutex); while (thread_count < NUM_THREAD) { tds_mutex_unlock(&mutex); tds_sleep_ms(50); tds_mutex_lock(&mutex); } tds_mutex_unlock(&mutex); for (i = 1; i <= NUM_LOOP; ++i) { printf("thread %2d of %2d loop %d\n", num+1, NUM_THREAD, i); if (test(dbproc) || result != 0) break; } dbclose(dbproc); return TDS_THREAD_RESULT(0); } int main(int argc, char **argv) { int i; tds_thread th[NUM_THREAD]; DBPROCESS *dbproc; LOGINREC *login; read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "thread"); printf("About to open \"%s\"\n", SERVER); dbproc = dbopen(login, SERVER); if (!dbproc) { fprintf(stderr, "Unable to connect to %s\n", SERVER); return 1; } dbloginfree(login); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); printf("Dropping table\n"); dbcmd(dbproc, "if object_id('dblib_thread') is not null drop table dblib_thread"); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } printf("creating table\n"); dbcmd(dbproc, "create table dblib_thread (i int not null, s char(10) not null)"); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } printf("insert\n"); for (i = 0; i < ROWS; i++) { char cmd[128]; sprintf(cmd, "insert into dblib_thread values (%d, 'row %d')", i, i); dbcmd(dbproc, cmd); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } } for (i = 0; i < NUM_THREAD; ++i) { int err = tds_thread_create(&th[i], thread_test, TDS_INT2PTR(i)); if (err != 0) { fprintf(stderr, "Error %d (%s) creating thread\n", err, strerror(err)); return 1; } /* MSSQL rejects the connections if they come in too fast */ tds_sleep_s(1); } for (i = 0; i < NUM_THREAD; ++i) { tds_thread_join(th[i], NULL); printf("thread: %d exited\n", i + 1); } printf("Dropping table\n"); dbcmd(dbproc, "drop table dblib_thread"); dbsqlexec(dbproc); while (dbresults(dbproc) == SUCCEED) { /* nop */ } dbexit(); return result; } #else /* !TDS_HAVE_PTHREAD_MUTEX */ int main(int argc, char **argv) { printf("Not possible for this platform.\n"); return 0; } #endif freetds-1.3.6/src/dblib/unittests/timeout.c000644 025423 025423 00000016726 14056414221 022355 0ustar00fredianofrediano000000 000000 /* * Purpose: Test handling of timeouts with an error handler * Functions: dberrhandle, dbsetlogintime, dbsettime, dbsetopt, dbclropt, dbisopt * \todo We test returning INT_CANCEL for a login timeout. We don't test it for a query_timeout. */ #include "common.h" #include static int ntimeouts = 0, ncancels = 0; static const int max_timeouts = 2, timeout_seconds = 2; static time_t start_time; static int timeout_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); static int chkintr(DBPROCESS * dbproc); static int hndlintr(DBPROCESS * dbproc); #if !defined(SYBETIME) #define SYBETIME SQLETIME #define INT_TIMEOUT INT_CANCEL dbsetinterrupt(DBPROCESS *dbproc, void* hand, void* p) {} #endif static int timeout_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { /* * For server messages, cancel the query and rely on the * message handler to spew the appropriate error messages out. */ if (dberr == SYBESMSG) return INT_CANCEL; if (dberr == SYBETIME) { fprintf(stderr, "%d timeouts received in %ld seconds, ", ++ntimeouts, (long int) (time(NULL) - start_time)); if (ntimeouts > max_timeouts) { if (++ncancels > 1) { fprintf(stderr, "could not timeout cleanly, breaking connection\n"); ncancels = 0; return INT_CANCEL; } fprintf(stderr, "lost patience, cancelling (allowing 10 seconds)\n"); if (dbsettime(10) == FAIL) fprintf(stderr, "... but dbsettime() failed in error handler\n"); return INT_TIMEOUT; } fprintf(stderr, "continuing to wait\n"); return INT_CONTINUE; } ntimeouts = 0; /* reset */ fprintf(stderr, "DB-LIBRARY error (severity %d, dberr %d, oserr %d, dberrstr %s, oserrstr %s):\n", severity, dberr, oserr, dberrstr ? dberrstr : "(null)", oserrstr ? oserrstr : "(null)"); fflush(stderr); /* * If the dbprocess is dead or the dbproc is a NULL pointer and * we are not in the middle of logging in, then we need to exit. * We can't do anything from here on out anyway. * It's OK to end up here in response to a dbconvert() that * resulted in overflow, so don't exit in that case. */ if ((dbproc == NULL) || DBDEAD(dbproc)) { if (dberr != SYBECOFL) { fprintf(stderr, "error: dbproc (%p) is %s, goodbye\n", dbproc, dbproc? (DBDEAD(dbproc)? "DEAD" : "OK") : "NULL"); exit(255); } } return INT_CANCEL; } static int chkintr(DBPROCESS * dbproc) { printf("in chkintr, %ld seconds elapsed\n", (long int) (time(NULL) - start_time)); return FALSE; } static int hndlintr(DBPROCESS * dbproc) { printf("in hndlintr, %ld seconds elapsed\n", (long int) (time(NULL) - start_time)); return INT_CONTINUE; } static int failed = 0; static void test(int per_process) { LOGINREC *login; DBPROCESS *dbproc; int i, r; RETCODE erc, row_code; int num_resultset = 0; char teststr[1024]; char timeout[32]; sprintf(timeout, "%d", timeout_seconds); ntimeouts = 0; ncancels = 0; /* * Connect to server */ dberrhandle(timeout_err_handler); dbmsghandle(syb_msg_handler); printf("About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "#timeout"); printf("About to open %s.%s\n", SERVER, DATABASE); /* * One way to test the login timeout is to connect to a discard server (grep discard /etc/services). * It's normally supported by inetd. */ printf ("using %d 1-second login timeouts\n", max_timeouts); dbsetlogintime(1); start_time = time(NULL); /* keep track of when we started for reporting purposes */ if (NULL == (dbproc = dbopen(login, SERVER))){ fprintf(stderr, "Failed: dbopen\n"); exit(1); } printf ("connected.\n"); if (strlen(DATABASE)) dbuse(dbproc, DATABASE); dbloginfree(login); /* Set a very long global timeout. */ if (per_process) dbsettime(5 * 60); /* Verify no query timeout is set for this DBPROCESS */ if (dbisopt(dbproc, DBSETTIME, 0)) { printf("unexpected return code from dbisopt() before calling dbsetopt(..., DBSETTIME, ...)\n"); exit(1); } if (FAIL == dbsetopt(dbproc, DBSETTIME, timeout, 0)) { fprintf(stderr, "Failed: dbsetopt(..., DBSETTIME, \"%d\")\n", timeout_seconds); exit(1); } /* Verify a query timeout is actually set for this DBPROCESS now */ if (!dbisopt(dbproc, DBSETTIME, 0)) { printf("unexpected return code from dbisopt() after calling dbsetopt(..., DBSETTIME, ...)\n"); exit(1); } if (FAIL == dbclropt(dbproc, DBSETTIME, 0)) { fprintf(stderr, "Failed: dbclropt(..., DBSETTIME, ...)\n"); exit(1); } /* Verify no query timeout remains set for this DBPROCESS */ if (dbisopt(dbproc, DBSETTIME, 0)) { printf("unexpected return code from dbisopt() after calling dbclropt(..., DBSETTIME, ...)\n"); exit(1); } printf ("using %d %d-second query timeouts\n", max_timeouts, timeout_seconds); if (per_process) { if (FAIL == dbsetopt(dbproc, DBSETTIME, timeout, 0)) { fprintf(stderr, "Failed: dbsetopt(..., DBSETTIME, \"%d\")\n", timeout_seconds); exit(1); } /* Verify setting the global timeout won't override the per-process timeout value */ if (FAIL == dbsettime(35)) { fprintf(stderr, "Failed: dbsettime\n"); exit(1); } } else { if (FAIL == dbsettime(timeout_seconds)) { fprintf(stderr, "Failed: dbsettime\n"); exit(1); } } /* send something that will take awhile to execute */ printf ("issuing a query that will take 30 seconds\n"); if (FAIL == sql_cmd(dbproc)) { fprintf(stderr, "Failed: dbcmd\n"); exit(1); } start_time = time(NULL); /* keep track of when we started for reporting purposes */ ntimeouts = 0; dbsetinterrupt(dbproc, (void*)chkintr, (void*)hndlintr); if (FAIL == dbsqlsend(dbproc)) { fprintf(stderr, "Failed: dbsend\n"); exit(1); } /* wait for it to execute */ printf("executing dbsqlok\n"); erc = dbsqlok(dbproc); if (erc != FAIL) { fprintf(stderr, "dbsqlok should fail for timeout\n"); exit(1); } /* retrieve outputs per usual */ r = 0; for (i=0; (erc = dbresults(dbproc)) != NO_MORE_RESULTS; i++) { int nrows, ncols; switch (erc) { case SUCCEED: if (DBROWS(dbproc) == FAIL){ r++; continue; } assert(DBROWS(dbproc) == SUCCEED); printf("dbrows() returned SUCCEED, processing rows\n"); ncols = dbnumcols(dbproc); ++num_resultset; printf("bound 1 of %d columns ('%s') in result %d.\n", ncols, dbcolname(dbproc, 1), ++r); dbbind(dbproc, 1, STRINGBIND, 0, (BYTE *) teststr); printf("\t%s\n\t-----------\n", dbcolname(dbproc, 1)); while ((row_code = dbnextrow(dbproc)) != NO_MORE_ROWS) { if (row_code == REG_ROW) { printf("\t%s\n", teststr); } else { /* not supporting computed rows in this unit test */ failed = 1; fprintf(stderr, "Failed. Expected a row\n"); exit(1); } } nrows = (int) dbcount(dbproc); printf("row count %d\n", nrows); if (nrows < 0){ failed++; printf("error: dbrows() returned SUCCEED, but dbcount() returned -1\n"); } if (FAIL == dbclropt(dbproc, DBSETTIME, 0)) { failed++; printf("error: dbclropt(dbproc, DBSETTIME, ...) failed\n"); } break; case FAIL: printf("dbresults returned FAIL\n"); exit(1); default: printf("unexpected return code %d from dbresults\n", erc); exit(1); } if (i > 1) { failed++; break; } } /* while dbresults */ } int main(int argc, char **argv) { set_malloc_options(); read_login_info(argc, argv); printf("Starting %s\n", argv[0]); dbinit(); test(0); test(1); dbexit(); printf("%s %s\n", __FILE__, (failed ? "failed!" : "OK")); return failed ? 1 : 0; } freetds-1.3.6/src/dblib/unittests/timeout.sql000644 025423 025423 00000000264 14056414221 022720 0ustar00fredianofrediano000000 000000 select getdate() as 'begintime' waitfor delay '00:00:30' select getdate() as 'endtime' go select getdate() as 'begintime' waitfor delay '00:00:30' select getdate() as 'endtime' go freetds-1.3.6/src/dblib/unittests/CMakeLists.txt000644 025423 025423 00000001425 14056414221 023251 0ustar00fredianofrediano000000 000000 add_library(d_common STATIC common.c common.h) foreach(target t0001 t0002 t0003 t0004 t0005 t0006 t0007 t0008 t0009 t0011 t0012 t0013 t0014 t0015 t0016 t0017 t0018 t0019 t0020 dbsafestr t0022 t0023 rpc dbmorecmds bcp thread text_buffer done_handling timeout hang null null2 setnull numeric pending cancel spid canquery batch_stmt_ins_sel batch_stmt_ins_upd bcp_getl empty_rowsets string_bind colinfo bcp2) add_executable(d_${target} EXCLUDE_FROM_ALL ${target}.c) set_target_properties(d_${target} PROPERTIES OUTPUT_NAME ${target}) target_link_libraries(d_${target} d_common sybdb replacements tdsutils ${lib_NETWORK} ${lib_BASE}) add_test(NAME d_${target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND d_${target}) add_dependencies(check d_${target}) endforeach(target) freetds-1.3.6/src/ctlib/Makefile.am000644 025423 025423 00000001047 14056414221 020524 0ustar00fredianofrediano000000 000000 SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include lib_LTLIBRARIES = libct.la libct_la_SOURCES= ct.c cs.c blk.c ctutil.c if MINGW32 libct_la_SOURCES += winmain.c endif # version bumped for 0.64, I hope we'll bump it less in the future -- freddy77 libct_la_LDFLAGS = -version-info 4:0:0 $(FREETDS_SYMBOLIC) if !MACOSX libct_la_LDFLAGS += -export-symbols-regex '^(cs_|ct_|blk_).*' endif libct_la_LIBADD = ../tds/libtds.la ../replacements/libreplacements.la $(LTLIBICONV) $(FREETDS_LIBGCC) EXTRA_DIST = ctlib.def CMakeLists.txt winmain.c freetds-1.3.6/src/ctlib/Makefile.in000644 025423 025423 00000067751 14162303356 020557 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @MINGW32_TRUE@am__append_1 = winmain.c @MACOSX_FALSE@am__append_2 = -export-symbols-regex '^(cs_|ct_|blk_).*' subdir = src/ctlib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libct_la_DEPENDENCIES = ../tds/libtds.la \ ../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__libct_la_SOURCES_DIST = ct.c cs.c blk.c ctutil.c winmain.c @MINGW32_TRUE@am__objects_1 = winmain.lo am_libct_la_OBJECTS = ct.lo cs.lo blk.lo ctutil.lo $(am__objects_1) libct_la_OBJECTS = $(am_libct_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libct_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libct_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/blk.Plo ./$(DEPDIR)/cs.Plo \ ./$(DEPDIR)/ct.Plo ./$(DEPDIR)/ctutil.Plo \ ./$(DEPDIR)/winmain.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libct_la_SOURCES) DIST_SOURCES = $(am__libct_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include lib_LTLIBRARIES = libct.la libct_la_SOURCES = ct.c cs.c blk.c ctutil.c $(am__append_1) # version bumped for 0.64, I hope we'll bump it less in the future -- freddy77 libct_la_LDFLAGS = -version-info 4:0:0 $(FREETDS_SYMBOLIC) \ $(am__append_2) libct_la_LIBADD = ../tds/libtds.la ../replacements/libreplacements.la $(LTLIBICONV) $(FREETDS_LIBGCC) EXTRA_DIST = ctlib.def CMakeLists.txt winmain.c all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/ctlib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/ctlib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libct.la: $(libct_la_OBJECTS) $(libct_la_DEPENDENCIES) $(EXTRA_libct_la_DEPENDENCIES) $(AM_V_CCLD)$(libct_la_LINK) -rpath $(libdir) $(libct_la_OBJECTS) $(libct_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blk.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctutil.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winmain.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/blk.Plo -rm -f ./$(DEPDIR)/cs.Plo -rm -f ./$(DEPDIR)/ct.Plo -rm -f ./$(DEPDIR)/ctutil.Plo -rm -f ./$(DEPDIR)/winmain.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/blk.Plo -rm -f ./$(DEPDIR)/cs.Plo -rm -f ./$(DEPDIR)/ct.Plo -rm -f ./$(DEPDIR)/ctutil.Plo -rm -f ./$(DEPDIR)/winmain.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-libLTLIBRARIES .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/ctlib/ct.c000644 025423 025423 00000366770 14056414271 017270 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001 Brian Bruns * Copyright (C) 2002, 2003, 2004, 2005 James K. Lowden * Copyright (C) 2011-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include "ctpublic.h" #include "ctlib.h" #include #include #include #include static const char * ct_describe_cmd_state(CS_INT state); /** * Read a row of data * @return 0 on success */ static int _ct_fetch_cursor(CS_COMMAND * cmd, CS_INT type, CS_INT offset, CS_INT option, CS_INT * rows_read); static int _ct_fetchable_results(CS_COMMAND * cmd); static TDSRET _ct_process_return_status(TDSSOCKET * tds); static int _ct_fill_param(CS_INT cmd_type, CS_PARAM * param, CS_DATAFMT * datafmt, CS_VOID * data, CS_INT * datalen, CS_SMALLINT * indicator, CS_BYTE byvalue); static void _ct_initialise_cmd(CS_COMMAND *cmd); static CS_RETCODE _ct_cancel_cleanup(CS_COMMAND * cmd); static CS_INT _ct_map_compute_op(CS_INT comp_op); /* Added for CT_DIAG */ /* Code changes starts here - CT_DIAG - 01 */ static CS_INT ct_diag_storeclientmsg(CS_CONTEXT * context, CS_CONNECTION * conn, CS_CLIENTMSG * message); static CS_INT ct_diag_storeservermsg(CS_CONTEXT * context, CS_CONNECTION * conn, CS_SERVERMSG * message); static CS_INT ct_diag_countmsg(CS_CONTEXT * context, CS_INT type, CS_INT * count); static CS_INT ct_diag_getclientmsg(CS_CONTEXT * context, CS_INT idx, CS_CLIENTMSG * message); static CS_INT ct_diag_getservermsg(CS_CONTEXT * context, CS_INT idx, CS_SERVERMSG * message); /* Code changes ends here - CT_DIAG - 01 */ /* Added code for RPC functionality -SUHA */ /* RPC Code changes starts here */ static void rpc_clear(CSREMOTE_PROC * rpc); static void param_clear(CSREMOTE_PROC_PARAM * pparam); static TDSPARAMINFO *paraminfoalloc(TDSSOCKET * tds, CS_PARAM * first_param); static CS_DYNAMIC * _ct_allocate_dynamic(CS_CONNECTION * con, char *id, int idlen); static CS_INT _ct_deallocate_dynamic(CS_CONNECTION * con, CS_DYNAMIC *dyn); static CS_DYNAMIC * _ct_locate_dynamic(CS_CONNECTION * con, char *id, int idlen); /* RPC Code changes ends here */ static const char * _ct_get_layer(int layer) { tdsdump_log(TDS_DBG_FUNC, "_ct_get_layer(%d)\n", layer); switch (layer) { case 1: return "user api layer"; break; case 2: return "blk layer"; break; default: break; } return "unrecognized layer"; } static const char * _ct_get_origin(int origin) { tdsdump_log(TDS_DBG_FUNC, "_ct_get_origin(%d)\n", origin); switch (origin) { case 1: return "external error"; break; case 2: return "internal CT-Library error"; break; case 4: return "common library error"; break; case 5: return "intl library error"; break; case 6: return "user error"; break; case 7: return "internal BLK-Library error"; break; default: break; } return "unrecognized origin"; } static const char * _ct_get_user_api_layer_error(int error) { tdsdump_log(TDS_DBG_FUNC, "_ct_get_user_api_layer_error(%d)\n", error); switch (error) { case 137: return "A bind count of %1! is not consistent with the count supplied for existing binds. " "The current bind count is %2!."; break; case 138: return "Use direction CS_BLK_IN or CS_BLK_OUT for a bulk copy operation."; break; case 139: return "The parameter tblname cannot be NULL."; break; case 140: return "Failed when processing results from server."; break; case 141: return "Parameter %1! has an illegal value of %2!"; break; case 142: return "No value or default value available and NULL not allowed. col = %1! row = %2! ."; break; case 143: return "parameter name(s) must be supplied for LANGUAGE command."; break; case 16843163: return "This routine cannot be called when the command structure is idle."; break; default: break; } return "unrecognized error"; } static char * _ct_get_msgstr(const char *funcname, int layer, int origin, int severity, int number) { char *m; tdsdump_log(TDS_DBG_FUNC, "_ct_get_msgstr(%s, %d, %d, %d, %d)\n", funcname, layer, origin, severity, number); if (asprintf(&m, "%s: %s: %s: %s", funcname, _ct_get_layer(layer), _ct_get_origin(origin), _ct_get_user_api_layer_error(number) ) < 0) { return NULL; } return m; } void _ctclient_msg(CS_CONNECTION * con, const char *funcname, int layer, int origin, int severity, int number, const char *fmt, ...) { CS_CONTEXT *ctx = con->ctx; va_list ap; CS_CLIENTMSG cm; char *msgstr; tdsdump_log(TDS_DBG_FUNC, "_ctclient_msg(%p, %s, %d, %d, %d, %d, %s)\n", con, funcname, layer, origin, severity, number, fmt); va_start(ap, fmt); if (ctx->_clientmsg_cb) { cm.severity = severity; cm.msgnumber = (((layer << 24) & 0xFF000000) | ((origin << 16) & 0x00FF0000) | ((severity << 8) & 0x0000FF00) | ((number) & 0x000000FF)); msgstr = _ct_get_msgstr(funcname, layer, origin, severity, number); tds_vstrbuild(cm.msgstring, CS_MAX_MSG, &(cm.msgstringlen), msgstr, CS_NULLTERM, fmt, CS_NULLTERM, ap); cm.msgstring[cm.msgstringlen] = '\0'; free(msgstr); cm.osnumber = 0; cm.osstring[0] = '\0'; cm.osstringlen = 0; cm.status = 0; /* cm.sqlstate */ cm.sqlstatelen = 0; ctx->_clientmsg_cb(ctx, con, &cm); } va_end(ap); } static CS_RETCODE ct_set_command_state(CS_COMMAND *cmd, CS_INT state) { tdsdump_log(TDS_DBG_FUNC, "setting command state to %s (from %s)\n", ct_describe_cmd_state(state), ct_describe_cmd_state(cmd->command_state)); cmd->command_state = state; return CS_SUCCEED; } static const char * ct_describe_cmd_state(CS_INT state) { tdsdump_log(TDS_DBG_FUNC, "ct_describe_cmd_state(%d)\n", state); switch (state) { case _CS_COMMAND_IDLE: return "IDLE"; case _CS_COMMAND_BUILDING: return "BUILDING"; case _CS_COMMAND_READY: return "READY"; case _CS_COMMAND_SENT: return "SENT"; } return "???"; } CS_RETCODE ct_exit(CS_CONTEXT * ctx, CS_INT unused) { tdsdump_log(TDS_DBG_FUNC, "ct_exit(%p, %d)\n", ctx, unused); return CS_SUCCEED; } CS_RETCODE ct_init(CS_CONTEXT * ctx, CS_INT version) { /* uncomment the next line to get pre-login trace */ /* tdsdump_open("/tmp/tds2.log"); */ tdsdump_log(TDS_DBG_FUNC, "ct_init(%p, %d)\n", ctx, version); ctx->tds_ctx->msg_handler = _ct_handle_server_message; ctx->tds_ctx->err_handler = _ct_handle_client_message; return CS_SUCCEED; } CS_RETCODE ct_con_alloc(CS_CONTEXT * ctx, CS_CONNECTION ** con) { TDSLOGIN *login; tdsdump_log(TDS_DBG_FUNC, "ct_con_alloc(%p, %p)\n", ctx, con); login = tds_alloc_login(1); if (!login) return CS_FAIL; /* set default values */ if (!tds_set_library(login, "CT-Library")) { tds_free_login(login); return CS_FAIL; } *con = tds_new0(CS_CONNECTION, 1); if (!*con) { tds_free_login(login); return CS_FAIL; } (*con)->tds_login = login; (*con)->server_addr = NULL; /* so we know who we belong to */ (*con)->ctx = ctx; /* tds_set_packet((*con)->tds_login, TDS_DEF_BLKSZ); */ return CS_SUCCEED; } CS_RETCODE ct_callback(CS_CONTEXT * ctx, CS_CONNECTION * con, CS_INT action, CS_INT type, CS_VOID * func) { int (*funcptr) (void *, void *, void *) = (int (*)(void *, void *, void *)) func; tdsdump_log(TDS_DBG_FUNC, "ct_callback(%p, %p, %d, %d, %p)\n", ctx, con, action, type, func); tdsdump_log(TDS_DBG_FUNC, "ct_callback() action = %s\n", CS_GET ? "CS_GET" : "CS_SET"); /* one of these has to be defined */ if (!ctx && !con) return CS_FAIL; if (action == CS_GET) { switch (type) { case CS_CLIENTMSG_CB: *(void **) func = (CS_VOID *) (con ? con->_clientmsg_cb : ctx->_clientmsg_cb); return CS_SUCCEED; case CS_SERVERMSG_CB: *(void **) func = (CS_VOID *) (con ? con->_servermsg_cb : ctx->_servermsg_cb); return CS_SUCCEED; default: fprintf(stderr, "Unknown callback %d\n", type); *(void **) func = NULL; return CS_SUCCEED; } } /* CS_SET */ switch (type) { case CS_CLIENTMSG_CB: if (con) con->_clientmsg_cb = (CS_CLIENTMSG_FUNC) funcptr; else ctx->_clientmsg_cb = (CS_CLIENTMSG_FUNC) funcptr; break; case CS_SERVERMSG_CB: if (con) con->_servermsg_cb = (CS_SERVERMSG_FUNC) funcptr; else ctx->_servermsg_cb = (CS_SERVERMSG_FUNC) funcptr; break; } return CS_SUCCEED; } CS_RETCODE ct_con_props(CS_CONNECTION * con, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len) { CS_INT intval, maxcp; TDSSOCKET *tds; TDSLOGIN *tds_login; tdsdump_log(TDS_DBG_FUNC, "ct_con_props(%p, %d, %d, %p, %d, %p)\n", con, action, property, buffer, buflen, out_len); tdsdump_log(TDS_DBG_FUNC, "ct_con_props() action = %s property = %d\n", CS_GET ? "CS_GET" : "CS_SET", property); tds = con->tds_socket; tds_login = con->tds_login; if (action == CS_SET) { char *set_buffer = NULL; bool copy_ret = true; switch (property) { /* string properties */ case CS_USERNAME: case CS_PASSWORD: case CS_APPNAME: case CS_HOSTNAME: case CS_CLIENTCHARSET: case CS_DATABASE: case CS_SERVERADDR: case CS_SEC_SERVERPRINCIPAL: if (buflen == CS_NULLTERM) { set_buffer = strdup((char *) buffer); if (!set_buffer) return CS_FAIL; } else if (buflen == CS_UNUSED) { return CS_SUCCEED; } else { set_buffer = tds_strndup(buffer, buflen); if (!set_buffer) return CS_FAIL; } break; } /* * XXX "login" properties shouldn't be set after * login. I don't know if it should fail silently * or return an error. */ switch (property) { case CS_USERNAME: copy_ret = tds_set_user(tds_login, set_buffer); break; case CS_PASSWORD: copy_ret = tds_set_passwd(tds_login, set_buffer); break; case CS_APPNAME: copy_ret = tds_set_app(tds_login, set_buffer); break; case CS_HOSTNAME: copy_ret = tds_set_host(tds_login, set_buffer); break; case CS_CLIENTCHARSET: copy_ret = tds_set_client_charset(tds_login, set_buffer); break; case CS_PORT: tds_set_port(tds_login, *((int *) buffer)); break; case CS_DATABASE: copy_ret = !!tds_dstr_copy(&tds_login->database, set_buffer); break; case CS_SERVERADDR: { /* Format of this property: "[hostname] [port]" */ char *host, *port, *lasts = NULL; int portno; host= strtok_r(set_buffer, " ", &lasts); port= strtok_r(NULL, " ", &lasts); if (!host || !port) { free(set_buffer); return CS_FAIL; } portno = (int)strtol(port, NULL, 10); if (portno < 1 || portno >= 65536) { free(set_buffer); return CS_FAIL; } con->server_addr = strdup(host); tds_set_port(tds_login, portno); break; } case CS_SEC_SERVERPRINCIPAL: copy_ret = !!tds_dstr_copy(&tds_login->server_spn, set_buffer); break; case CS_LOC_PROP: /* sybase docs say that this structure must be copied, not referenced */ if (!buffer) return CS_FAIL; if (con->locale) _cs_locale_free(con->locale); con->locale = _cs_locale_copy((CS_LOCALE *) buffer); if (!con->locale) return CS_FAIL; break; case CS_USERDATA: free(con->userdata); con->userdata = (void *) malloc(buflen + 1); tdsdump_log(TDS_DBG_INFO2, "setting userdata orig %p new %p\n", buffer, con->userdata); con->userdata_len = buflen; memcpy(con->userdata, buffer, buflen); break; case CS_BULK_LOGIN: memcpy(&intval, buffer, sizeof(intval)); tds_set_bulk(tds_login, !!intval); break; case CS_PACKETSIZE: memcpy(&intval, buffer, sizeof(intval)); tds_set_packet(tds_login, (short) intval); break; case CS_TDS_VERSION: /* * FIXME * (a) We don't support all versions in tds/login.c - * I tried to pick reasonable versions. * (b) Might need support outside of tds/login.c * (c) It's a "negotiated" property so probably * needs tds_process_env_chg() support * (d) Minor - we don't check against context * which should limit the acceptable values */ if (*(int *) buffer == CS_TDS_AUTO) { tds_set_version(tds_login, 0, 0); } else if (*(int *) buffer == CS_TDS_40) { tds_set_version(tds_login, 4, 2); } else if (*(int *) buffer == CS_TDS_42) { tds_set_version(tds_login, 4, 2); } else if (*(int *) buffer == CS_TDS_46) { tds_set_version(tds_login, 4, 6); } else if (*(int *) buffer == CS_TDS_495) { tds_set_version(tds_login, 4, 6); } else if (*(int *) buffer == CS_TDS_50) { tds_set_version(tds_login, 5, 0); } else if (*(int *) buffer == CS_TDS_70) { tds_set_version(tds_login, 7, 0); } else if (*(int *) buffer == CS_TDS_71) { tds_set_version(tds_login, 7, 1); } else if (*(int *) buffer == CS_TDS_72) { tds_set_version(tds_login, 7, 2); } else if (*(int *) buffer == CS_TDS_73) { tds_set_version(tds_login, 7, 3); } else if (*(int *) buffer == CS_TDS_74) { tds_set_version(tds_login, 7, 4); } else { return CS_FAIL; } break; case CS_TIMEOUT: /* set the query timeout as an integer in seconds */ tds_login->query_timeout = *(CS_INT *) buffer; if (tds_login->query_timeout == CS_NO_LIMIT) tds_login->query_timeout = 0; if (tds) tds->query_timeout = tds_login->query_timeout; break; case CS_LOGIN_TIMEOUT: /* set the connect timeout as an integer in seconds */ tds_login->connect_timeout = *(CS_INT *) buffer; if (tds_login->connect_timeout == CS_NO_LIMIT) tds_login->connect_timeout = 0; break; case CS_SEC_NETWORKAUTH: con->network_auth = !!(*(CS_INT *) buffer); break; case CS_SEC_MUTUALAUTH: tds_login->mutual_authentication = !!(*(CS_INT *) buffer); break; case CS_SEC_DELEGATION: tds_login->gssapi_use_delegation = !!(*(CS_INT *) buffer); break; default: tdsdump_log(TDS_DBG_ERROR, "Unknown property %d\n", property); break; } free(set_buffer); if (!copy_ret) return CS_FAIL; } else if (action == CS_GET) { DSTR *s; switch (property) { case CS_USERNAME: s = &tds_login->user_name; goto str_copy; case CS_PASSWORD: s = &tds_login->password; goto str_copy; case CS_APPNAME: s = &tds_login->app_name; goto str_copy; case CS_HOSTNAME: s = &tds_login->client_host_name; goto str_copy; case CS_SERVERNAME: s = &tds_login->server_name; goto str_copy; case CS_CLIENTCHARSET: s = &tds_login->client_charset; goto str_copy; case CS_DATABASE: s = &tds_login->database; str_copy: if (out_len) *out_len = tds_dstr_len(s); strlcpy((char *) buffer, tds_dstr_cstr(s), buflen); break; case CS_LOC_PROP: if (buflen != CS_UNUSED || !con->locale || !buffer) return CS_FAIL; if (!_cs_locale_copy_inplace((CS_LOCALE *) buffer, con->locale)) return CS_FAIL; break; case CS_USERDATA: tdsdump_log(TDS_DBG_INFO2, "fetching userdata %p\n", con->userdata); maxcp = con->userdata_len; if (out_len) *out_len = maxcp; if (maxcp > buflen) maxcp = buflen; memcpy(buffer, con->userdata, maxcp); break; case CS_CON_STATUS: intval = 0; if (!(IS_TDSDEAD(tds))) intval |= CS_CONSTAT_CONNECTED; if (tds && tds->state == TDS_DEAD) intval |= CS_CONSTAT_DEAD; memcpy(buffer, &intval, sizeof(intval)); break; case CS_BULK_LOGIN: if (tds_login->bulk_copy) intval = CS_FALSE; else intval = CS_TRUE; memcpy(buffer, &intval, sizeof(intval)); break; case CS_PACKETSIZE: if (tds) intval = tds->conn->env.block_size; else intval = tds_login->block_size; memcpy(buffer, &intval, sizeof(intval)); if (out_len) *out_len = sizeof(intval); break; case CS_TDS_VERSION: switch (tds->conn->tds_version) { case 0x400: (*(int *) buffer = CS_TDS_40); break; case 0x402: (*(int *) buffer = CS_TDS_42); break; case 0x406: (*(int *) buffer = CS_TDS_46); break; case 0x400 + 95: (*(int *) buffer = CS_TDS_495); break; case 0x500: (*(int *) buffer = CS_TDS_50); break; case 0x700: (*(int *) buffer = CS_TDS_70); break; case 0x701: (*(int *) buffer = CS_TDS_71); break; case 0x702: (*(int *) buffer = CS_TDS_72); break; case 0x703: (*(int *) buffer = CS_TDS_73); break; case 0x704: (*(int *) buffer = CS_TDS_74); break; default: return CS_FAIL; } break; case CS_PARENT_HANDLE: *(CS_CONTEXT **) buffer = con->ctx; break; case CS_TIMEOUT: *(CS_INT *) buffer = tds_login->query_timeout; if (tds_login->query_timeout == 0) *(CS_INT *) buffer = CS_NO_LIMIT; break; case CS_LOGIN_TIMEOUT: *(CS_INT *) buffer = tds_login->connect_timeout; if (tds_login->connect_timeout == 0) *(CS_INT *) buffer = CS_NO_LIMIT; break; default: tdsdump_log(TDS_DBG_ERROR, "Unknown property %d\n", property); break; } } return CS_SUCCEED; } CS_RETCODE ct_connect(CS_CONNECTION * con, CS_CHAR * servername, CS_INT snamelen) { char *server; int needfree = 0; CS_CONTEXT *ctx; TDSLOGIN *login; bool copy_ret; tdsdump_log(TDS_DBG_FUNC, "ct_connect(%p, %s, %d)\n", con, servername ? servername : "NULL", snamelen); if (con->server_addr) { server = ""; } else if (!servername || snamelen == 0 || snamelen == CS_UNUSED) { server = NULL; } else if (snamelen == CS_NULLTERM) { server = (char *) servername; } else { server = tds_strndup(servername, snamelen); needfree++; } copy_ret = tds_set_server(con->tds_login, server); if (needfree) free(server); if (!copy_ret) return CS_FAIL; ctx = con->ctx; if (!(con->tds_socket = tds_alloc_socket(ctx->tds_ctx, 512))) return CS_FAIL; tds_set_parent(con->tds_socket, (void *) con); if (!(login = tds_read_config_info(con->tds_socket, con->tds_login, ctx->tds_ctx->locale))) { tds_free_socket(con->tds_socket); con->tds_socket = NULL; return CS_FAIL; } if (con->server_addr) { if (TDS_FAILED(tds_lookup_host_set(con->server_addr, &login->ip_addrs))) goto Cleanup; if (!tds_dstr_copy(&login->server_host_name, con->server_addr)) goto Cleanup; } /* Timeouts ... */ if (ctx->login_timeout > 0) { login->connect_timeout = ctx->login_timeout; } if (ctx->query_timeout > 0) { login->query_timeout = ctx->query_timeout; } /* override locale settings with CS_CONNECTION settings, if any */ if (con->locale) { if (con->locale->charset) { if (!tds_dstr_copy(&login->server_charset, con->locale->charset)) goto Cleanup; } if (con->locale->language) { if (!tds_dstr_copy(&login->language, con->locale->language)) goto Cleanup; } if (con->locale->time && tds_get_ctx(con->tds_socket)) { TDSLOCALE *locale = tds_get_ctx(con->tds_socket)->locale; free(locale->date_fmt); /* TODO convert format from CTLib to libTDS */ locale->date_fmt = strdup(con->locale->time); if (!locale->date_fmt) goto Cleanup; } /* TODO how to handle this? if (con->locale->collate) { } */ } if (con->network_auth) { tds_dstr_empty(&login->user_name); tds_dstr_empty(&login->password); } if (TDS_FAILED(tds_connect_and_login(con->tds_socket, login))) goto Cleanup; tds_free_login(login); tdsdump_log(TDS_DBG_FUNC, "leaving ct_connect() returning %d\n", CS_SUCCEED); return CS_SUCCEED; Cleanup: tds_free_socket(con->tds_socket); con->tds_socket = NULL; tds_free_login(login); tdsdump_log(TDS_DBG_FUNC, "leaving ct_connect() returning %d\n", CS_FAIL); return CS_FAIL; } CS_RETCODE ct_cmd_alloc(CS_CONNECTION * con, CS_COMMAND ** pcmd) { CS_COMMAND *pcommand, *cmd; tdsdump_log(TDS_DBG_FUNC, "ct_cmd_alloc(%p, %p)\n", con, pcmd); if (!con) return CS_FAIL; *pcmd = cmd = tds_new0(CS_COMMAND, 1); if (!cmd) return CS_FAIL; /* so we know who we belong to */ cmd->con = con; /* initialise command state */ ct_set_command_state(cmd, _CS_COMMAND_IDLE); if (!con->cmds) { tdsdump_log(TDS_DBG_FUNC, "ct_cmd_alloc() : allocating command list to head\n"); con->cmds = cmd; } else { for (pcommand = con->cmds; pcommand->next != NULL; pcommand = pcommand->next) continue; pcommand->next = cmd; } return CS_SUCCEED; } CS_RETCODE ct_command(CS_COMMAND * cmd, CS_INT type, const CS_VOID * buffer, CS_INT buflen, CS_INT option) { int query_len, current_query_len; tdsdump_log(TDS_DBG_FUNC, "ct_command(%p, %d, %p, %d, %d)\n", cmd, type, buffer, buflen, option); if (!cmd) return CS_FAIL; /* * Unless we are in the process of building a CS_LANG_CMD command, * clear everything, ready to start anew */ if (cmd->command_state != _CS_COMMAND_BUILDING) { _ct_initialise_cmd(cmd); ct_set_command_state(cmd, _CS_COMMAND_IDLE); } switch (type) { case CS_LANG_CMD: switch (option) { case CS_MORE: /* The text in buffer is only part of the language command to be executed. */ case CS_END: /* The text in buffer is the last part of the language command to be executed. */ case CS_UNUSED: /* Equivalent to CS_END. */ if (buflen == CS_NULLTERM) { query_len = strlen((const char *) buffer); } else { query_len = buflen; } /* small fix for no crash */ if (query_len == CS_UNUSED) { cmd->query = NULL; return CS_FAIL; } switch (cmd->command_state) { case _CS_COMMAND_IDLE: cmd->query = tds_strndup(buffer, query_len); if (option == CS_MORE) { ct_set_command_state(cmd, _CS_COMMAND_BUILDING); } else { ct_set_command_state(cmd, _CS_COMMAND_READY); } break; case _CS_COMMAND_BUILDING: current_query_len = strlen(cmd->query); cmd->query = (CS_CHAR *) realloc(cmd->query, current_query_len + query_len + 1); strncat(cmd->query, (const char *) buffer, query_len); cmd->query[current_query_len + query_len] = '\0'; if (option == CS_MORE) { ct_set_command_state(cmd, _CS_COMMAND_BUILDING); } else { ct_set_command_state(cmd, _CS_COMMAND_READY); } break; } break; default: return CS_FAIL; } break; case CS_RPC_CMD: /* Code changed for RPC functionality -SUHA */ /* RPC code changes starts here */ cmd->rpc = tds_new0(CSREMOTE_PROC, 1); if (!cmd->rpc) return CS_FAIL; if (buflen == CS_NULLTERM) { cmd->rpc->name = strdup((const char*) buffer); if (!cmd->rpc->name) return CS_FAIL; } else if (buflen > 0) { cmd->rpc->name = tds_strndup(buffer, buflen); if (!cmd->rpc->name) return CS_FAIL; } else { return CS_FAIL; } cmd->rpc->param_list = NULL; tdsdump_log(TDS_DBG_INFO1, "ct_command() added rpcname \"%s\"\n", cmd->rpc->name); /* FIXME: I don't know the value for RECOMPILE, NORECOMPILE options. Hence assigning zero */ switch (option) { case CS_RECOMPILE: /* Recompile the stored procedure before executing it. */ cmd->rpc->options = 0; break; case CS_NO_RECOMPILE: /* Do not recompile the stored procedure before executing it. */ cmd->rpc->options = 0; break; case CS_UNUSED: /* Equivalent to CS_NO_RECOMPILE. */ cmd->rpc->options = 0; break; default: return CS_FAIL; } ct_set_command_state(cmd, _CS_COMMAND_READY); break; /* RPC code changes ends here */ case CS_SEND_DATA_CMD: switch (option) { case CS_COLUMN_DATA: /* The data will be used for a text or image column update. */ cmd->send_data_started = 0; break; case CS_BULK_DATA: /* For internal Sybase use only. The data will be used for a bulk copy operation. */ default: return CS_FAIL; } ct_set_command_state(cmd, _CS_COMMAND_READY); break; case CS_SEND_BULK_CMD: switch (option) { case CS_BULK_INIT: /* For internal Sybase use only. Initialize a bulk copy operation. */ case CS_BULK_CONT: /* For internal Sybase use only. Continue a bulk copy operation. */ default: return CS_FAIL; } ct_set_command_state(cmd, _CS_COMMAND_READY); break; default: return CS_FAIL; } cmd->command_type = type; return CS_SUCCEED; } static void _ct_initialise_cmd(CS_COMMAND *cmd) { free(cmd->query); cmd->query = NULL; tdsdump_log(TDS_DBG_FUNC, "_ct_initialise_cmd(%p)\n", cmd); if (cmd->input_params) { param_clear(cmd->input_params); cmd->input_params = NULL; } ct_set_command_state(cmd, _CS_COMMAND_IDLE); rpc_clear(cmd->rpc); cmd->rpc = NULL; } CS_RETCODE ct_send(CS_COMMAND * cmd) { TDSSOCKET *tds; TDSRET ret; TDSPARAMINFO *pparam_info; tdsdump_log(TDS_DBG_FUNC, "ct_send(%p)\n", cmd); if (!cmd || !cmd->con || !cmd->con->tds_socket) return CS_FAIL; tdsdump_log(TDS_DBG_FUNC, "ct_send() command_type = %d\n", cmd->command_type); tds = cmd->con->tds_socket; if (cmd->cancel_state == _CS_CANCEL_PENDING) { _ct_cancel_cleanup(cmd); return CS_CANCELED; } if (cmd->command_state == _CS_COMMAND_IDLE) { tdsdump_log(TDS_DBG_FUNC, "ct_send() command_state = IDLE\n"); _ctclient_msg(cmd->con, "ct_send", 1, 1, 1, 16843163, ""); return CS_FAIL; } cmd->results_state = _CS_RES_NONE; if (cmd->command_type == CS_DYNAMIC_CMD) { CS_DYNAMIC *dyn = cmd->dyn; TDSDYNAMIC *tdsdyn; if (!dyn) return CS_FAIL; switch (cmd->dynamic_cmd) { case CS_PREPARE: if (TDS_FAILED(tds_submit_prepare(tds, dyn->stmt, dyn->id, &dyn->tdsdyn, NULL))) return CS_FAIL; ct_set_command_state(cmd, _CS_COMMAND_SENT); return CS_SUCCEED; break; case CS_EXECUTE: tdsdyn = dyn->tdsdyn; if (!tdsdyn) { tdsdump_log(TDS_DBG_INFO1, "ct_send(CS_EXECUTE) no tdsdyn!\n"); return CS_FAIL; } pparam_info = paraminfoalloc(tds, dyn->param_list); if (!pparam_info && dyn->param_list) return CS_FAIL; tds_free_input_params(tdsdyn); tdsdyn->params = pparam_info; if (TDS_FAILED(tds_submit_execute(tds, tdsdyn))) return CS_FAIL; ct_set_command_state(cmd, _CS_COMMAND_SENT); return CS_SUCCEED; break; case CS_DESCRIBE_INPUT: tdsdump_log(TDS_DBG_INFO1, "ct_send(CS_DESCRIBE_INPUT)\n"); ct_set_command_state(cmd, _CS_COMMAND_SENT); cmd->results_state = _CS_RES_DESCRIBE_RESULT; if (tds->cur_dyn) tds_set_current_results(tds, tds->cur_dyn->res_info); else tds_set_current_results(tds, tds->param_info); break; case CS_DESCRIBE_OUTPUT: tdsdump_log(TDS_DBG_INFO1, "ct_send(CS_DESCRIBE_OUTPUT)\n"); ct_set_command_state(cmd, _CS_COMMAND_SENT); cmd->results_state = _CS_RES_DESCRIBE_RESULT; tds_set_current_results(tds, tds->res_info); break; case CS_DEALLOC: tdsdyn = dyn->tdsdyn; if (!tdsdyn) { tdsdump_log(TDS_DBG_INFO1, "ct_send(CS_DEALLOC) no tdsdyn!\n"); return CS_FAIL; } if (TDS_FAILED(tds_submit_unprepare(tds, tdsdyn))) return CS_FAIL; ct_set_command_state(cmd, _CS_COMMAND_SENT); return CS_SUCCEED; break; default: return CS_FAIL; } } if (cmd->command_type == CS_RPC_CMD) { CSREMOTE_PROC *rpc = cmd->rpc; /* sanity */ if (!cmd->rpc /* ct_command should allocate pointer */ || !rpc->name) { /* can't be ready without a name */ return CS_FAIL; } pparam_info = paraminfoalloc(tds, rpc->param_list); ret = tds_submit_rpc(tds, rpc->name, pparam_info, NULL); tds_free_param_results(pparam_info); ct_set_command_state(cmd, _CS_COMMAND_SENT); if (TDS_FAILED(ret)) return CS_FAIL; return CS_SUCCEED; } /* RPC Code changes ends here */ if (cmd->command_type == CS_LANG_CMD) { ret = TDS_FAIL; if (cmd->input_params) { pparam_info = paraminfoalloc(tds, cmd->input_params); ret = tds_submit_query_params(tds, cmd->query, pparam_info, NULL); tds_free_param_results(pparam_info); } else { ret = tds_submit_query(tds, cmd->query); } ct_set_command_state(cmd, _CS_COMMAND_SENT); if (TDS_FAILED(ret)) { tdsdump_log(TDS_DBG_WARN, "ct_send() failed\n"); return CS_FAIL; } tdsdump_log(TDS_DBG_INFO2, "ct_send() succeeded\n"); return CS_SUCCEED; } /* Code added for CURSOR support */ if (cmd->command_type == CS_CUR_CMD) { TDSCURSOR *cursor; /* sanity */ /* * ct_cursor declare should allocate cursor pointer * cursor stmt cannot be NULL * cursor name cannot be NULL */ int something_to_send = 0; tdsdump_log(TDS_DBG_FUNC, "ct_send() : CS_CUR_CMD\n"); cursor = cmd->cursor; if (!cursor) { tdsdump_log(TDS_DBG_FUNC, "ct_send() : cursor not present\n"); return CS_FAIL; } if (!cursor->query) { tdsdump_log(TDS_DBG_FUNC, "ct_send() : cursor->query is null\n"); return CS_FAIL; } if (!cursor->cursor_name) { tdsdump_log(TDS_DBG_FUNC, "ct_send() : cursor->name is null\n"); return CS_FAIL; } if (cursor->status.declare == _CS_CURS_TYPE_REQUESTED) { ret = tds_cursor_declare(tds, cursor, NULL, &something_to_send); if (TDS_SUCCEED(ret)){ cursor->status.declare = TDS_CURSOR_STATE_SENT; /* Cursor is declared */ if (something_to_send == 0) { cmd->results_state = _CS_RES_END_RESULTS; } } else { tdsdump_log(TDS_DBG_WARN, "ct_send(): cursor declare failed \n"); return CS_FAIL; } } if (cursor->status.cursor_row == _CS_CURS_TYPE_REQUESTED && cursor->status.declare == _CS_CURS_TYPE_SENT) { ret = tds_cursor_setrows(tds, cursor, &something_to_send); if (TDS_SUCCEED(ret)){ cursor->status.cursor_row = TDS_CURSOR_STATE_SENT; /* Cursor rows set */ if (something_to_send == 0) { cmd->results_state = _CS_RES_END_RESULTS; } } else { tdsdump_log(TDS_DBG_WARN, "ct_send(): cursor set rows failed\n"); return CS_FAIL; } } if (cursor->status.open == _CS_CURS_TYPE_REQUESTED && cursor->status.declare == _CS_CURS_TYPE_SENT) { ret = tds_cursor_open(tds, cursor, NULL, &something_to_send); if (TDS_SUCCEED(ret)){ cursor->status.open = TDS_CURSOR_STATE_SENT; cmd->results_state = _CS_RES_INIT; } else { tdsdump_log(TDS_DBG_WARN, "ct_send(): cursor open failed\n"); return CS_FAIL; } } if (something_to_send) { tdsdump_log(TDS_DBG_WARN, "ct_send(): sending cursor commands\n"); tds_flush_packet(tds); tds_set_state(tds, TDS_PENDING); something_to_send = 0; ct_set_command_state(cmd, _CS_COMMAND_SENT); return CS_SUCCEED; } if (cursor->status.close == _CS_CURS_TYPE_REQUESTED){ if (cursor->status.dealloc == TDS_CURSOR_STATE_REQUESTED) { /* FIXME what happen if tds_cursor_dealloc return TDS_FAIL ?? */ ret = tds_cursor_close(tds, cursor); tds_release_cursor(&cmd->cursor); cursor = NULL; } else { ret = tds_cursor_close(tds, cursor); cursor->status.close = TDS_CURSOR_STATE_SENT; } } if (cursor && cursor->status.dealloc == _CS_CURS_TYPE_REQUESTED) { /* FIXME what happen if tds_cursor_dealloc return TDS_FAIL ?? */ ret = tds_cursor_dealloc(tds, cursor); tds_release_cursor(&cmd->cursor); tds_free_all_results(tds); } if (TDS_SUCCEED(ret)) cmd->results_state = _CS_RES_INIT; ct_set_command_state(cmd, _CS_COMMAND_SENT); return CS_SUCCEED; } if (cmd->command_type == CS_SEND_DATA_CMD) { tds_writetext_end(tds); ct_set_command_state(cmd, _CS_COMMAND_SENT); } return CS_SUCCEED; } CS_RETCODE ct_results(CS_COMMAND * cmd, CS_INT * result_type) { TDSSOCKET *tds; CS_CONTEXT *context; TDSRET tdsret; CS_INT res_type; CS_INT done_flags; TDS_INT8 rows_affected; unsigned process_flags; tdsdump_log(TDS_DBG_FUNC, "ct_results(%p, %p)\n", cmd, result_type); if (cmd->cancel_state == _CS_CANCEL_PENDING) { _ct_cancel_cleanup(cmd); return CS_CANCELED; } if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; cmd->bind_count = CS_UNUSED; context = cmd->con->ctx; tds = cmd->con->tds_socket; cmd->row_prefetched = 0; /* * depending on the current results state, we may * not need to call tds_process_tokens... */ switch (cmd->results_state) { case _CS_RES_CMD_SUCCEED: *result_type = CS_CMD_SUCCEED; cmd->results_state = _CS_RES_CMD_DONE; return CS_SUCCEED; case _CS_RES_CMD_DONE: *result_type = CS_CMD_DONE; cmd->results_state = _CS_RES_INIT; return CS_SUCCEED; case _CS_RES_END_RESULTS: *result_type = CS_CMD_DONE; cmd->results_state = _CS_RES_INIT; return CS_END_RESULTS; case _CS_RES_DESCRIBE_RESULT: *result_type = CS_DESCRIBE_RESULT; cmd->results_state = _CS_RES_CMD_DONE; return CS_SUCCEED; case _CS_RES_NONE: /* first time in after ct_send */ cmd->results_state = _CS_RES_INIT; tds->rows_affected = TDS_NO_COUNT; break; case _CS_RES_INIT: tds->rows_affected = TDS_NO_COUNT; break; default: break; } rows_affected = tds->rows_affected; /* * see what "result" tokens we have. a "result" in ct-lib terms also * includes row data. Some result types always get reported back to * the calling program, others are only reported back if the relevant * config flag is set. */ process_flags = TDS_TOKEN_RESULTS; for (;;) { tdsret = tds_process_tokens(tds, &res_type, &done_flags, process_flags); tdsdump_log(TDS_DBG_FUNC, "ct_results() process_result_tokens returned %d (type %d) \n", tdsret, res_type); switch (tdsret) { case TDS_SUCCESS: cmd->curr_result_type = res_type; switch (res_type) { case CS_COMPUTEFMT_RESULT: /* * set results state to indicate that we * have a result set (empty for the moment) * If the CS_EXPOSE_FMTS property has been * set in ct_config(), we need to return an * appropraite format result, otherwise just * carry on and get the next token..... */ cmd->results_state = _CS_RES_RESULTSET_EMPTY; if (context->config.cs_expose_formats) { *result_type = res_type; return CS_SUCCEED; } break; case CS_ROWFMT_RESULT: cmd->curr_result_type = CS_ROW_RESULT; cmd->results_state = _CS_RES_RESULTSET_EMPTY; rows_affected = tds->rows_affected = TDS_NO_COUNT; if (cmd->command_type == CS_CUR_CMD || cmd->command_type == CS_DYNAMIC_CMD) break; /* don't process DONE tokens */ process_flags = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_STOPAT_DONE|TDS_STOPAT_ROW| TDS_STOPAT_COMPUTE|TDS_RETURN_PROC; break; case CS_ROW_RESULT: /* * we've hit a data row. pass back that fact * to the calling program. set results state * to show that the result set has rows... */ cmd->results_state = _CS_RES_RESULTSET_ROWS; if (cmd->command_type == CS_CUR_CMD) { *result_type = CS_CURSOR_RESULT; } else { *result_type = CS_ROW_RESULT; } return CS_SUCCEED; break; case CS_COMPUTE_RESULT: /* * we've hit a compute data row. We have to get hold of this * data now, as it's necessary to tie this data back to its * result format...the user may call ct_res_info() & friends * after getting back a compute "result". * * but first, if we've hit this compute row without having * hit a data row first, we need to return a CS_ROW_RESULT * before letting them have the compute row... */ if (cmd->results_state == _CS_RES_RESULTSET_EMPTY) { *result_type = CS_ROW_RESULT; tds_set_current_results(tds, tds->res_info); cmd->results_state = _CS_RES_RESULTSET_ROWS; return CS_SUCCEED; } tdsret = tds_process_tokens(tds, &res_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE); /* set results state to show that the result set has rows... */ cmd->results_state = _CS_RES_RESULTSET_ROWS; *result_type = res_type; if (tdsret == TDS_SUCCESS && (res_type == TDS_ROW_RESULT || res_type == TDS_COMPUTE_RESULT)) { if (res_type == TDS_COMPUTE_RESULT) { cmd->row_prefetched = 1; return CS_SUCCEED; } else { /* this couldn't really happen, but... */ return CS_FAIL; } } else return CS_FAIL; break; case TDS_DONE_RESULT: /* * A done token signifies the end of a logical * command. There are three possibilities... * 1. Simple command with no result set, i.e. * update, delete, insert * 2. Command with result set but no rows * 3. Command with result set and rows * in these cases we need to: * 1. return CS_CMD_FAIL/SUCCED depending on * the status returned in done_flags * 2. "manufacture" a CS_ROW_RESULT return, * and set the results state to DONE * 3. return with CS_CMD_DONE and reset the * results_state */ tdsdump_log(TDS_DBG_FUNC, "ct_results() results state = %d\n",cmd->results_state); tdsdump_log(TDS_DBG_FUNC, "ct_results() command type = %d\n",cmd->command_type); tdsdump_log(TDS_DBG_FUNC, "ct_results() dynamic cmd = %d\n",cmd->dynamic_cmd); if ((cmd->command_type == CS_DYNAMIC_CMD) && (cmd->dynamic_cmd == CS_PREPARE || cmd->dynamic_cmd == CS_DEALLOC)) { *result_type = CS_CMD_SUCCEED; cmd->results_state = _CS_RES_CMD_DONE; return CS_SUCCEED; } if (tds->rows_affected != TDS_NO_COUNT) rows_affected = tds->rows_affected; tds->rows_affected = rows_affected; switch (cmd->results_state) { case _CS_RES_INIT: case _CS_RES_STATUS: if (done_flags & TDS_DONE_ERROR) *result_type = CS_CMD_FAIL; else *result_type = CS_CMD_SUCCEED; cmd->results_state = _CS_RES_CMD_DONE; break; case _CS_RES_RESULTSET_EMPTY: if (cmd->command_type == CS_CUR_CMD) { *result_type = CS_CURSOR_RESULT; } else { *result_type = CS_ROW_RESULT; } cmd->results_state = _CS_RES_RESULTSET_ROWS; break; case _CS_RES_RESULTSET_ROWS: *result_type = CS_CMD_DONE; cmd->results_state = _CS_RES_INIT; break; } return CS_SUCCEED; break; case TDS_DONEINPROC_RESULT: /* * A doneinproc token may signify the end of a * logical command if the command had a result * set. Otherwise it is ignored.... */ if (tds->rows_affected != TDS_NO_COUNT) rows_affected = tds->rows_affected; tds->rows_affected = rows_affected; switch (cmd->results_state) { case _CS_RES_INIT: /* command had no result set */ break; case _CS_RES_RESULTSET_EMPTY: if (cmd->command_type == CS_CUR_CMD) { *result_type = CS_CURSOR_RESULT; cmd->results_state = _CS_RES_CMD_DONE; } else { *result_type = CS_ROW_RESULT; cmd->results_state = _CS_RES_RESULTSET_ROWS; } return CS_SUCCEED; break; case _CS_RES_RESULTSET_ROWS: *result_type = CS_CMD_DONE; cmd->results_state = _CS_RES_INIT; return CS_SUCCEED; break; } break; case TDS_DONEPROC_RESULT: /* * A DONEPROC result means the end of a logical * command only if it was one of the commands * directly sent from ct_send, not as a result * of a nested stored procedure call. We know * if this is the case if a STATUS_RESULT was * received immediately prior to the DONE_PROC */ if (tds->rows_affected != TDS_NO_COUNT) rows_affected = tds->rows_affected; tds->rows_affected = rows_affected; if (done_flags & TDS_DONE_ERROR) *result_type = CS_CMD_FAIL; else *result_type = CS_CMD_SUCCEED; cmd->results_state = _CS_RES_CMD_DONE; return CS_SUCCEED; break; case TDS_PARAM_RESULT: cmd->row_prefetched = 1; *result_type = res_type; return CS_SUCCEED; break; case TDS_STATUS_RESULT: _ct_process_return_status(tds); cmd->row_prefetched = 1; *result_type = res_type; cmd->results_state = _CS_RES_STATUS; return CS_SUCCEED; break; case TDS_DESCRIBE_RESULT: if (cmd->dynamic_cmd == CS_DESCRIBE_INPUT || cmd->dynamic_cmd == CS_DESCRIBE_OUTPUT) { *result_type = res_type; return CS_SUCCEED; } break; default: *result_type = res_type; return CS_SUCCEED; break; } break; case TDS_NO_MORE_RESULTS: /* some commands can be re-sent once completed */ /* so mark the command state as 'ready'... */ if (cmd->command_type == CS_LANG_CMD || cmd->command_type == CS_RPC_CMD || cmd->command_type == CS_CUR_CMD || cmd->command_type == CS_DYNAMIC_CMD) { ct_set_command_state(cmd, _CS_COMMAND_READY); } /* if we have just completed processing a dynamic deallocate */ /* get rid of our dynamic statement structure... */ if (cmd->command_type == CS_DYNAMIC_CMD && cmd->dynamic_cmd == CS_DEALLOC) { _ct_deallocate_dynamic(cmd->con, cmd->dyn); cmd->dyn = NULL; } return CS_END_RESULTS; break; case TDS_CANCELLED: cmd->cancel_state = _CS_CANCEL_NOCANCEL; return CS_CANCELED; break; default: return CS_FAIL; break; } /* switch (tdsret) */ } /* for (;;) */ } CS_RETCODE ct_bind(CS_COMMAND * cmd, CS_INT item, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT * copied, CS_SMALLINT * indicator) { TDSCOLUMN *colinfo; TDSRESULTINFO *resinfo; TDSSOCKET *tds; CS_CONNECTION *con = cmd->con; CS_INT bind_count; tdsdump_log(TDS_DBG_FUNC, "ct_bind(%p, %d, %p, %p, %p, %p)\n", cmd, item, datafmt, buffer, copied, indicator); tdsdump_log(TDS_DBG_FUNC, "ct_bind() datafmt count = %d column_number = %d\n", datafmt->count, item); if (!con || !con->tds_socket) return CS_FAIL; tds = con->tds_socket; resinfo = tds->current_results; /* check item value */ if (!resinfo || item <= 0 || item > resinfo->num_cols) return CS_FAIL; colinfo = resinfo->columns[item - 1]; /* * Check whether the request is for array binding, and ensure that the user * supplies the same datafmt->count to the subsequent ct_bind calls */ bind_count = (datafmt->count == 0) ? 1 : datafmt->count; /* first bind for this result set */ if (cmd->bind_count == CS_UNUSED) { cmd->bind_count = bind_count; } else { /* all subsequent binds for this result set - the bind counts must be the same */ if (cmd->bind_count != bind_count) { _ctclient_msg(con, "ct_bind", 1, 1, 1, 137, "%d, %d", bind_count, cmd->bind_count); return CS_FAIL; } } /* bind the column_varaddr to the address of the buffer */ colinfo = resinfo->columns[item - 1]; colinfo->column_varaddr = (char *) buffer; colinfo->column_bindtype = datafmt->datatype; colinfo->column_bindfmt = datafmt->format; colinfo->column_bindlen = datafmt->maxlength; if (indicator) { colinfo->column_nullbind = indicator; } if (copied) { colinfo->column_lenbind = copied; } return CS_SUCCEED; } CS_RETCODE ct_fetch(CS_COMMAND * cmd, CS_INT type, CS_INT offset, CS_INT option, CS_INT * prows_read) { TDS_INT ret_type; TDSRET ret; TDS_INT marker; TDS_INT temp_count; TDSSOCKET *tds; CS_INT rows_read_dummy; tdsdump_log(TDS_DBG_FUNC, "ct_fetch(%p, %d, %d, %d, %p)\n", cmd, type, offset, option, prows_read); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; if (cmd->command_state == _CS_COMMAND_IDLE) { _ctclient_msg(cmd->con, "ct_fetch", 1, 1, 1, 16843163, ""); return CS_FAIL; } if (cmd->cancel_state == _CS_CANCEL_PENDING) { _ct_cancel_cleanup(cmd); return CS_CANCELED; } if (!prows_read) prows_read = &rows_read_dummy; tds = cmd->con->tds_socket; /* * Call a special function for fetches from a cursor because * the processing is too incompatible to patch into a single function */ if (cmd->command_type == CS_CUR_CMD) { return _ct_fetch_cursor(cmd, type, offset, option, prows_read); } *prows_read = 0; if ( cmd->bind_count == CS_UNUSED ) cmd->bind_count = 1; /* compute rows and parameter results have been pre-fetched by ct_results() */ if (cmd->row_prefetched) { cmd->row_prefetched = 0; cmd->get_data_item = 0; cmd->get_data_bytes_returned = 0; if (_ct_bind_data(cmd->con->ctx, tds->current_results, tds->current_results, 0)) return CS_ROW_FAIL; *prows_read = 1; return CS_SUCCEED; } if (cmd->results_state == _CS_RES_CMD_DONE) return CS_END_DATA; if (cmd->curr_result_type == CS_COMPUTE_RESULT) return CS_END_DATA; if (cmd->curr_result_type == CS_CMD_FAIL) return CS_CMD_FAIL; marker = tds_peek(tds); if ((cmd->curr_result_type == CS_ROW_RESULT && marker != TDS_ROW_TOKEN && marker != TDS_NBC_ROW_TOKEN) || (cmd->curr_result_type == CS_STATUS_RESULT && marker != TDS_RETURNSTATUS_TOKEN) ) return CS_END_DATA; /* Array Binding Code changes start here */ for (temp_count = 0; temp_count < cmd->bind_count; temp_count++) { ret = tds_process_tokens(tds, &ret_type, NULL, TDS_STOPAT_ROWFMT|TDS_STOPAT_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE); tdsdump_log(TDS_DBG_FUNC, "inside ct_fetch() process_row_tokens returned %d\n", ret); switch (ret) { case TDS_SUCCESS: if (ret_type == TDS_ROW_RESULT || ret_type == TDS_COMPUTE_RESULT) { cmd->get_data_item = 0; cmd->get_data_bytes_returned = 0; if (_ct_bind_data(cmd->con->ctx, tds->current_results, tds->current_results, temp_count)) return CS_ROW_FAIL; (*prows_read)++; break; } case TDS_NO_MORE_RESULTS: return CS_END_DATA; break; case TDS_CANCELLED: cmd->cancel_state = _CS_CANCEL_NOCANCEL; return CS_CANCELED; break; default: return CS_FAIL; break; } /* have we reached the end of the rows ? */ marker = tds_peek(tds); if (cmd->curr_result_type == CS_ROW_RESULT && marker != TDS_ROW_TOKEN && marker != TDS_NBC_ROW_TOKEN) break; } /* Array Binding Code changes end here */ return CS_SUCCEED; } static CS_RETCODE _ct_fetch_cursor(CS_COMMAND * cmd, CS_INT type, CS_INT offset, CS_INT option, CS_INT * rows_read) { TDSSOCKET * tds; TDSCURSOR *cursor; TDS_INT restype; TDSRET ret; TDS_INT temp_count; TDS_INT done_flags; TDS_INT rows_this_fetch = 0; tdsdump_log(TDS_DBG_FUNC, "_ct_fetch_cursor(%p, %d, %d, %d, %p)\n", cmd, type, offset, option, rows_read); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tds = cmd->con->tds_socket; if (rows_read) *rows_read = 0; /* taking a copy of the cmd->bind_count value. */ temp_count = cmd->bind_count; if ( cmd->bind_count == CS_UNUSED ) cmd->bind_count = 1; cursor = cmd->cursor; if (!cursor) { tdsdump_log(TDS_DBG_FUNC, "ct_fetch_cursor() : cursor not present\n"); return CS_FAIL; } /* currently we are placing this restriction on cursor fetches. */ /* the alternatives are too awful to contemplate at the moment */ /* i.e. buffering all the rows from the fetch internally... */ if (cmd->bind_count < cursor->cursor_rows) { tdsdump_log(TDS_DBG_WARN, "_ct_fetch_cursor(): bind count must equal cursor rows \n"); return CS_FAIL; } if (TDS_FAILED(tds_cursor_fetch(tds, cursor, TDS_CURSOR_FETCH_NEXT, 0))) { tdsdump_log(TDS_DBG_WARN, "ct_fetch(): cursor fetch failed\n"); return CS_FAIL; } cursor->status.fetch = TDS_CURSOR_STATE_SENT; while ((tds_process_tokens(tds, &restype, &done_flags, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (restype) { case CS_ROWFMT_RESULT: break; case CS_ROW_RESULT: for (temp_count = 0; temp_count < cmd->bind_count; temp_count++) { ret = tds_process_tokens(tds, &restype, NULL, TDS_STOPAT_ROWFMT|TDS_STOPAT_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE); tdsdump_log(TDS_DBG_FUNC, "_ct_fetch_cursor() tds_process_tokens returned %d\n", ret); if (ret == TDS_SUCCESS && (restype == TDS_ROW_RESULT || restype == TDS_COMPUTE_RESULT)) { cmd->get_data_item = 0; cmd->get_data_bytes_returned = 0; if (restype == TDS_ROW_RESULT) { if (_ct_bind_data(cmd->con->ctx, tds->current_results, tds->current_results, temp_count)) return CS_ROW_FAIL; if (rows_read) *rows_read = *rows_read + 1; rows_this_fetch++; } } else { if (TDS_FAILED(ret)) return CS_FAIL; break; } } break; case TDS_DONE_RESULT: break; } } if (rows_this_fetch) return CS_SUCCEED; cmd->results_state = _CS_RES_CMD_SUCCEED; return CS_END_DATA; } int _ct_bind_data(CS_CONTEXT *ctx, TDSRESULTINFO * resinfo, TDSRESULTINFO *bindinfo, CS_INT offset) { TDSCOLUMN *curcol, *bindcol; unsigned char *src, *dest; int i, result = 0; CS_DATAFMT srcfmt, destfmt; TDS_INT datalen_dummy, *pdatalen; TDS_SMALLINT nullind_dummy, *nullind; tdsdump_log(TDS_DBG_FUNC, "_ct_bind_data(%p, %p, %p, %d)\n", ctx, resinfo, bindinfo, offset); for (i = 0; i < resinfo->num_cols; i++) { CS_RETCODE ret; CONV_RESULT convert_buffer; curcol = resinfo->columns[i]; bindcol = bindinfo->columns[i]; tdsdump_log(TDS_DBG_FUNC, "_ct_bind_data(): column %d is type %d and has length %d\n", i, curcol->column_type, curcol->column_cur_size); if (curcol->column_hidden) continue; /* * Retrieve the initial bound column_varaddress and increment it if offset specified */ dest = (unsigned char *) bindcol->column_varaddr; if (dest) dest += offset * bindcol->column_bindlen; nullind = &nullind_dummy; if (bindcol->column_nullbind) { nullind = bindcol->column_nullbind; assert(nullind); nullind += offset; } pdatalen = &datalen_dummy; if (bindcol->column_lenbind) { pdatalen = bindcol->column_lenbind; assert(pdatalen); pdatalen += offset; } /* no destination specified */ if (!dest) { *pdatalen = 0; continue; } /* NULL column */ if (curcol->column_cur_size < 0) { *nullind = -1; *pdatalen = 0; continue; } src = curcol->column_data; if (is_blob_col(curcol)) src = (unsigned char *) ((TDSBLOB *) src)->textvalue; srcfmt.datatype = _cs_convert_not_client(ctx, curcol, &convert_buffer, &src); if (srcfmt.datatype == CS_ILLEGAL_TYPE) srcfmt.datatype = _ct_get_client_type(curcol, false); if (srcfmt.datatype == CS_ILLEGAL_TYPE) { result = 1; continue; } srcfmt.maxlength = curcol->column_cur_size; destfmt.datatype = bindcol->column_bindtype; destfmt.maxlength = bindcol->column_bindlen; destfmt.format = bindcol->column_bindfmt; /* if convert return FAIL mark error but process other columns */ if ((ret = cs_convert(ctx, &srcfmt, src, &destfmt, dest, pdatalen) != CS_SUCCEED)) { tdsdump_log(TDS_DBG_FUNC, "cs_convert-result = %d\n", ret); result = 1; tdsdump_log(TDS_DBG_INFO1, "error: converted only %d bytes for type %d \n", *pdatalen, srcfmt.datatype); } *nullind = 0; } return result; } CS_RETCODE ct_cmd_drop(CS_COMMAND * cmd) { CS_CONNECTION *con; tdsdump_log(TDS_DBG_FUNC, "ct_cmd_drop(%p)\n", cmd); if (cmd) { free(cmd->query); if (cmd->input_params) param_clear(cmd->input_params); free(cmd->userdata); if (cmd->rpc) { if (cmd->rpc->param_list) param_clear(cmd->rpc->param_list); free(cmd->rpc->name); free(cmd->rpc); } free(cmd->iodesc); /* now remove this command from the list of commands in the connection */ con = cmd->con; if (con) { CS_COMMAND **pvictim; for (pvictim = &con->cmds; *pvictim != cmd; ) { if (!*pvictim) { tdsdump_log(TDS_DBG_FUNC, "ct_cmd_drop() : cannot find command entry in list \n"); return CS_FAIL; } pvictim = &(*pvictim)->next; } /* remove from list */ *pvictim = cmd->next; cmd->next = NULL; } free(cmd); } return CS_SUCCEED; } CS_RETCODE ct_close(CS_CONNECTION * con, CS_INT option) { tdsdump_log(TDS_DBG_FUNC, "ct_close(%p, %d)\n", con, option); tds_close_socket(con->tds_socket); tds_free_socket(con->tds_socket); con->tds_socket = NULL; return CS_SUCCEED; } CS_RETCODE ct_con_drop(CS_CONNECTION * con) { CS_COMMAND *cmd, *next_cmd; tdsdump_log(TDS_DBG_FUNC, "ct_con_drop(%p)\n", con); if (con) { free(con->userdata); if (con->tds_login) tds_free_login(con->tds_login); while ((cmd = con->cmds) != NULL) { next_cmd = cmd->next; cmd->con = NULL; cmd->dyn = NULL; cmd->next = NULL; con->cmds = next_cmd; } while (con->dynlist) _ct_deallocate_dynamic(con, con->dynlist); if (con->locale) _cs_locale_free(con->locale); tds_free_socket(con->tds_socket); con->tds_socket = NULL; free(con->server_addr); free(con); } return CS_SUCCEED; } int _ct_get_client_type(const TDSCOLUMN *col, bool describe) { TDS_SERVER_TYPE type = col->column_type; TDS_INT size = col->column_size; tdsdump_log(TDS_DBG_FUNC, "_ct_get_client_type(type %d, user %d, size %d)\n", type, col->column_usertype, size); if (type == SYBVARIANT && describe) return CS_CHAR_TYPE; if (type == SYBVARIANT) { type = ((const TDSVARIANT *) col->column_data)->type; size = ((const TDSVARIANT *) col->column_data)->size; } switch (tds_get_conversion_type(type, size)) { case SYBBIT: return CS_BIT_TYPE; break; case SYBCHAR: case SYBVARCHAR: return CS_CHAR_TYPE; break; case SYBINT8: return CS_BIGINT_TYPE; break; case SYBINT4: return CS_INT_TYPE; break; case SYBINT2: return CS_SMALLINT_TYPE; break; case SYBINT1: return CS_TINYINT_TYPE; break; case SYBREAL: return CS_REAL_TYPE; break; case SYBFLT8: return CS_FLOAT_TYPE; break; case SYBMONEY: return CS_MONEY_TYPE; break; case SYBMONEY4: return CS_MONEY4_TYPE; break; case SYBDATETIME: return CS_DATETIME_TYPE; break; case SYBDATETIME4: return CS_DATETIME4_TYPE; break; case SYBNUMERIC: return CS_NUMERIC_TYPE; break; case SYBDECIMAL: return CS_DECIMAL_TYPE; break; case SYBBINARY: case SYBVARBINARY: return CS_BINARY_TYPE; break; case SYBIMAGE: return CS_IMAGE_TYPE; break; case SYBTEXT: return CS_TEXT_TYPE; break; case SYBUNIQUE: return CS_UNIQUE_TYPE; break; case SYBLONGCHAR: return CS_LONGCHAR_TYPE; break; case SYBLONGBINARY: if (col->column_usertype == USER_UNICHAR_TYPE || col->column_usertype == USER_UNIVARCHAR_TYPE) return CS_UNICHAR_TYPE; return CS_LONGBINARY_TYPE; break; case SYBUINT1: return CS_TINYINT_TYPE; break; case SYBUINT2: return CS_USMALLINT_TYPE; break; case SYBUINT4: return CS_UINT_TYPE; break; case SYBUINT8: return CS_UBIGINT_TYPE; break; case SYBDATE: return CS_DATE_TYPE; break; case SYBTIME: return CS_TIME_TYPE; break; case SYB5BIGTIME: return CS_BIGTIME_TYPE; break; case SYB5BIGDATETIME: return CS_BIGDATETIME_TYPE; break; case SYBVARIANT: return CS_CHAR_TYPE; break; /* handled by _cs_convert_not_client */ case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: break; } return _cs_convert_not_client(NULL, col, NULL, NULL); } TDS_SERVER_TYPE _ct_get_server_type(TDSSOCKET *tds, int datatype) { tdsdump_log(TDS_DBG_FUNC, "_ct_get_server_type(%d)\n", datatype); switch (datatype) { case CS_IMAGE_TYPE: return SYBIMAGE; case CS_BINARY_TYPE: return SYBBINARY; case CS_BIT_TYPE: return SYBBIT; case CS_CHAR_TYPE: return SYBCHAR; case CS_VARCHAR_TYPE: return SYBVARCHAR; case CS_LONG_TYPE: case CS_UBIGINT_TYPE: if (!tds || tds_capability_has_req(tds->conn, TDS_REQ_DATA_UINT8)) return SYBUINT8; return SYBINT8; case CS_UINT_TYPE: if (!tds || tds_capability_has_req(tds->conn, TDS_REQ_DATA_UINT4)) return SYBUINT4; return SYBINT4; case CS_USMALLINT_TYPE: if (!tds || tds_capability_has_req(tds->conn, TDS_REQ_DATA_UINT2)) return SYBUINT2; return SYBINT2; case CS_BIGINT_TYPE: return SYBINT8; case CS_INT_TYPE: return SYBINT4; case CS_SMALLINT_TYPE: return SYBINT2; case CS_TINYINT_TYPE: return SYBINT1; case CS_REAL_TYPE: return SYBREAL; case CS_FLOAT_TYPE: return SYBFLT8; case CS_MONEY_TYPE: return SYBMONEY; case CS_MONEY4_TYPE: return SYBMONEY4; case CS_DATETIME_TYPE: return SYBDATETIME; case CS_DATETIME4_TYPE: return SYBDATETIME4; case CS_NUMERIC_TYPE: return SYBNUMERIC; case CS_DECIMAL_TYPE: return SYBDECIMAL; case CS_VARBINARY_TYPE: return SYBVARBINARY; case CS_TEXT_TYPE: return SYBTEXT; case CS_UNIQUE_TYPE: return SYBUNIQUE; case CS_LONGBINARY_TYPE: return SYBLONGBINARY; case CS_UNICHAR_TYPE: return SYBVARCHAR; case CS_LONGCHAR_TYPE: if (!tds || IS_TDS7_PLUS(tds->conn)) return SYBVARCHAR; return SYBLONGCHAR; case CS_DATE_TYPE: if (!tds || tds_capability_has_req(tds->conn, TDS_REQ_DATA_DATE)) return SYBDATE; return SYBDATETIME; case CS_TIME_TYPE: if (!tds || tds_capability_has_req(tds->conn, TDS_REQ_DATA_TIME)) return SYBTIME; return SYBDATETIME; case CS_BIGDATETIME_TYPE: if (!tds || tds_capability_has_req(tds->conn, TDS_REQ_DATA_BIGDATETIME)) return SYB5BIGDATETIME; return SYBDATETIME; case CS_BIGTIME_TYPE: if (!tds || tds_capability_has_req(tds->conn, TDS_REQ_DATA_BIGTIME)) return SYB5BIGTIME; return SYBDATETIME; default: /* TODO * SENSITIVITY, BOUNDARY, VOID, USHORT, BLOB, UNITEXT, XML, * USER */ return TDS_INVALID_TYPE; break; } } CS_RETCODE ct_cancel(CS_CONNECTION * conn, CS_COMMAND * cmd, CS_INT type) { CS_RETCODE ret; CS_COMMAND *cmds; CS_COMMAND *conn_cmd; CS_CONNECTION *cmd_conn; tdsdump_log(TDS_DBG_FUNC, "ct_cancel(%p, %p, %d)\n", conn, cmd, type); /* * Comments taken from Sybase ct-library reference manual * ------------------------------------------------------ * * "To cancel current results, an application calls ct_cancel * with type as CT_CANCEL CURRENT. This is equivalent to * calling ct_fetch until it returns CS_END_DATA" * * "For CS_CANCEL_CURRENT cancels, cmd must be supplied" * "For CS_CANCEL_CURRENT cancels, connection must be NULL" */ if (type == CS_CANCEL_CURRENT) { tdsdump_log(TDS_DBG_FUNC, "CS_CANCEL_CURRENT\n"); if (conn || !cmd) return CS_FAIL; if (!_ct_fetchable_results(cmd)) { tdsdump_log(TDS_DBG_FUNC, "ct_cancel() no fetchable results - return()\n"); return CS_SUCCEED; } tdsdump_log(TDS_DBG_FUNC, "ct_cancel() - fetching results()\n"); do { ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, NULL); } while ((ret == CS_SUCCEED) || (ret == CS_ROW_FAIL)); if (cmd->con && cmd->con->tds_socket) tds_free_all_results(cmd->con->tds_socket); if (ret == CS_END_DATA) { return CS_SUCCEED; } return CS_FAIL; } /* * Comments taken from Sybase ct-library reference manual * ------------------------------------------------------ * * "To cancel the current command and all results generated * by it, call ct_cancel with type as CS_CANCEL_ATTN or * CS_CANCEL_ALL. Both of these calls tell client library * to : * * Send an attention to the server * * discard any results already generated by the command * Both types of cancel return CS_SUCCEED immediately, w/o * sending an attention, if no command is in progress. * If an application has not yet called ct_send to send an * initiated command, a CS_CANCEL_ATTN has no effect. * * If a command has been sent and ct_results has not been * called, a ct_cancel (CS_CANCEL_ATTN) has no effect." * * "For CS_CANCEL_ATTN cancels, one of connection or cmd * must be NULL. if cmd is supplied and connection is NULL * the cancel operation applies only to the command pend- * ing for this command structure. If cmd is NULL and * connection is supplied, the cancel operation applies to * all commands pending for this connection. */ if (type == CS_CANCEL_ATTN) { if ((conn && cmd) || (!conn && !cmd)) { return CS_FAIL; } if (cmd) { tdsdump_log(TDS_DBG_FUNC, "CS_CANCEL_ATTN with cmd\n"); cmd_conn = cmd->con; switch (cmd->command_state) { case _CS_COMMAND_IDLE: case _CS_COMMAND_READY: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state READY/IDLE\n"); break; case _CS_COMMAND_SENT: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state SENT results_state %d\n", cmd->results_state); if (cmd->results_state != _CS_RES_NONE) { tdsdump_log(TDS_DBG_FUNC, "ct_cancel() sending a cancel \n"); tds_send_cancel(cmd_conn->tds_socket); cmd->cancel_state = _CS_CANCEL_PENDING; } break; } } if (conn) { tdsdump_log(TDS_DBG_FUNC, "CS_CANCEL_ATTN with connection\n"); for (cmds = conn->cmds; cmds != NULL; cmds = cmds->next) { conn_cmd = cmds; switch (conn_cmd->command_state) { case _CS_COMMAND_IDLE: case _CS_COMMAND_READY: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state READY/IDLE\n"); break; case _CS_COMMAND_SENT: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state SENT\n"); if (conn_cmd->results_state != _CS_RES_NONE) { tdsdump_log(TDS_DBG_FUNC, "ct_cancel() sending a cancel \n"); tds_send_cancel(conn->tds_socket); conn_cmd->cancel_state = _CS_CANCEL_PENDING; } break; } } } return CS_SUCCEED; } /* * Comments taken from Sybase ct-library reference manual * ------------------------------------------------------ * * "To cancel the current command and all results generated * by it, call ct_cancel with type as CS_CANCEL_ATTN or * CS_CANCEL_ALL. Both of these calls tell client library * to : * * Send an attention to the server * * discard any results already generated by the command * Both types of cancel return CS_SUCCEED immediately, w/o * sending an attention, if no command is in progress. * * If an application has not yet called ct_send to send an * initiated command, a CS_CANCEL_ALL cancel discards the * initiated command without sending an attention to the * server. * * CS_CANCEL_ALL leaves the command structure in a 'clean' * state, available for use in another operation. * * "For CS_CANCEL_ALL cancels, one of connection or cmd * must be NULL. if cmd is supplied and connection is NULL * the cancel operation applies only to the command pend- * ing for this command structure. If cmd is NULL and * connection is supplied, the cancel operation applies to * all commands pending for this connection. */ if (type == CS_CANCEL_ALL) { if ((conn && cmd) || (!conn && !cmd)) { return CS_FAIL; } if (cmd) { tdsdump_log(TDS_DBG_FUNC, "CS_CANCEL_ALL with cmd\n"); cmd_conn = cmd->con; switch (cmd->command_state) { case _CS_COMMAND_IDLE: case _CS_COMMAND_BUILDING: case _CS_COMMAND_READY: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state READY/IDLE\n"); _ct_initialise_cmd(cmd); break; case _CS_COMMAND_SENT: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state SENT\n"); tdsdump_log(TDS_DBG_FUNC, "ct_cancel() sending a cancel \n"); tds_send_cancel(cmd_conn->tds_socket); tds_process_cancel(cmd_conn->tds_socket); _ct_initialise_cmd(cmd); cmd->cancel_state = _CS_CANCEL_PENDING; break; } } if (conn) { tdsdump_log(TDS_DBG_FUNC, "CS_CANCEL_ALL with connection\n"); for (cmds = conn->cmds; cmds != NULL; cmds = cmds->next) { tdsdump_log(TDS_DBG_FUNC, "ct_cancel() cancelling a command for a connection\n"); conn_cmd = cmds; switch (conn_cmd->command_state) { case _CS_COMMAND_IDLE: case _CS_COMMAND_BUILDING: case _CS_COMMAND_READY: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state SENT\n"); _ct_initialise_cmd(conn_cmd); break; case _CS_COMMAND_SENT: tdsdump_log(TDS_DBG_FUNC, "ct_cancel() command state SENT\n"); tdsdump_log(TDS_DBG_FUNC, "ct_cancel() sending a cancel \n"); tds_send_cancel(conn->tds_socket); tds_process_cancel(conn->tds_socket); _ct_initialise_cmd(conn_cmd); conn_cmd->cancel_state = _CS_CANCEL_PENDING; break; } } } return CS_SUCCEED; } return CS_FAIL; } static CS_RETCODE _ct_cancel_cleanup(CS_COMMAND * cmd) { CS_CONNECTION * con; tdsdump_log(TDS_DBG_FUNC, "_ct_cancel_cleanup(%p)\n", cmd); con = cmd->con; if (con && !IS_TDSDEAD(con->tds_socket)) tds_process_cancel(con->tds_socket); cmd->cancel_state = _CS_CANCEL_NOCANCEL; return CS_SUCCEED; } CS_RETCODE ct_describe(CS_COMMAND * cmd, CS_INT item, CS_DATAFMT * datafmt) { TDSSOCKET *tds; TDSRESULTINFO *resinfo; TDSCOLUMN *curcol; tdsdump_log(TDS_DBG_FUNC, "ct_describe(%p, %d, %p)\n", cmd, item, datafmt); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tds = cmd->con->tds_socket; resinfo = tds->current_results;; if (item < 1 || item > resinfo->num_cols) return CS_FAIL; curcol = resinfo->columns[item - 1]; /* name is always null terminated */ strlcpy(datafmt->name, tds_dstr_cstr(&curcol->column_name), sizeof(datafmt->name)); datafmt->namelen = strlen(datafmt->name); /* need to turn the SYBxxx into a CS_xxx_TYPE */ datafmt->datatype = _ct_get_client_type(curcol, true); if (datafmt->datatype == CS_ILLEGAL_TYPE) return CS_FAIL; tdsdump_log(TDS_DBG_INFO1, "ct_describe() datafmt->datatype = %d server type %d\n", datafmt->datatype, curcol->column_type); if (is_numeric_type(curcol->column_type)) datafmt->maxlength = sizeof(CS_NUMERIC); else datafmt->maxlength = curcol->column_size; datafmt->usertype = curcol->column_usertype; datafmt->precision = curcol->column_prec; datafmt->scale = curcol->column_scale; /* * There are other options that can be returned, but these are the * only two being noted via the TDS layer. */ datafmt->status = 0; if (curcol->column_nullable) datafmt->status |= CS_CANBENULL; if (curcol->column_identity) datafmt->status |= CS_IDENTITY; if (curcol->column_writeable) datafmt->status |= CS_UPDATABLE; if (curcol->column_key) datafmt->status |= CS_KEY; if (curcol->column_hidden) datafmt->status |= CS_HIDDEN; if (curcol->column_timestamp) datafmt->status |= CS_TIMESTAMP; datafmt->count = 1; datafmt->locale = NULL; return CS_SUCCEED; } CS_RETCODE ct_res_info(CS_COMMAND * cmd, CS_INT type, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len) { TDSSOCKET *tds; TDSRESULTINFO *resinfo; TDSCOLUMN *curcol; CS_INT int_val; int i; tdsdump_log(TDS_DBG_FUNC, "ct_res_info(%p, %d, %p, %d, %p)\n", cmd, type, buffer, buflen, out_len); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tds = cmd->con->tds_socket; resinfo = tds->current_results; switch (type) { case CS_NUMDATA: int_val = 0; if (resinfo) { for (i = 0; i < resinfo->num_cols; i++) { curcol = resinfo->columns[i]; if (!curcol->column_hidden) { int_val++; } } } tdsdump_log(TDS_DBG_FUNC, "ct_res_info(): Number of columns is %d\n", int_val); memcpy(buffer, &int_val, sizeof(CS_INT)); break; case CS_ROW_COUNT: if (cmd->results_state == _CS_RES_STATUS) return CS_FAIL; /* 64 -> 32 bit conversion saturate to the maximum */ int_val = tds->rows_affected > 0x7fffffff ? 0x7fffffff : (CS_INT) tds->rows_affected; tdsdump_log(TDS_DBG_FUNC, "ct_res_info(): Number of rows is %d\n", int_val); memcpy(buffer, &int_val, sizeof(CS_INT)); break; default: fprintf(stderr, "Unknown type in ct_res_info: %d\n", type); return CS_FAIL; break; } return CS_SUCCEED; } CS_RETCODE ct_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { CS_RETCODE ret = CS_SUCCEED; CS_INT *buf = (CS_INT *) buffer; tdsdump_log(TDS_DBG_FUNC, "ct_config(%p, %d, %d, %p, %d, %p)\n", ctx, action, property, buffer, buflen, outlen); tdsdump_log(TDS_DBG_FUNC, "ct_config() action = %s property = %d\n", CS_GET ? "CS_GET" : CS_SET ? "CS_SET" : CS_SUPPORTED ? "CS_SUPPORTED" : "CS_CLEAR", property); switch (property) { case CS_EXPOSE_FMTS: switch (action) { case CS_SUPPORTED: *buf = CS_TRUE; break; case CS_SET: if (*buf != CS_TRUE && *buf != CS_FALSE) ret = CS_FAIL; else ctx->config.cs_expose_formats = *buf; break; case CS_GET: if (buf) *buf = ctx->config.cs_expose_formats; else ret = CS_FAIL; break; case CS_CLEAR: ctx->config.cs_expose_formats = CS_FALSE; break; default: ret = CS_FAIL; } break; case CS_VER_STRING: { ret = CS_FAIL; switch (action) { case CS_GET: { if (buffer && buflen > 0 && outlen) { const TDS_COMPILETIME_SETTINGS *settings= tds_get_compiletime_settings(); *outlen= snprintf((char*)buffer, buflen, "%s (%s, default tds version=%s)", settings->freetds_version, (settings->threadsafe ? "threadsafe" : "non-threadsafe"), settings->tdsver ); ((char*)buffer)[buflen - 1]= 0; if (*outlen < 0) *outlen = strlen((char*) buffer); ret = CS_SUCCEED; } break; default: ret = CS_FAIL; break; } } } break; case CS_VERSION: ret = CS_FAIL; switch (action) { case CS_GET: { if (buffer && buflen > 0 && outlen) { const TDS_COMPILETIME_SETTINGS *settings= tds_get_compiletime_settings(); *outlen= snprintf((char*) buffer, buflen, "%s", settings->freetds_version); ((char*)buffer)[buflen - 1]= 0; if (*outlen < 0) *outlen = strlen((char*) buffer); ret = CS_SUCCEED; } break; default: ret = CS_FAIL; break; } } break; case CS_TIMEOUT: switch (action) { case CS_SET: ctx->query_timeout = *((unsigned int*)buf); break; case CS_GET: *((unsigned int*)buf) = ctx->query_timeout; break; case CS_CLEAR: ctx->query_timeout = -1; break; default: ret = CS_FAIL; break; } break; case CS_LOGIN_TIMEOUT: switch (action) { case CS_SET: ctx->login_timeout = *((unsigned int*)buf); break; case CS_GET: *((unsigned int*)buf) = ctx->login_timeout; break; case CS_CLEAR: ctx->login_timeout = -1; break; default: ret = CS_FAIL; break; } break; default: ret = CS_SUCCEED; break; } return ret; } CS_RETCODE ct_cmd_props(CS_COMMAND * cmd, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { TDSCURSOR *cursor; int maxcp; tdsdump_log(TDS_DBG_FUNC, "ct_cmd_props(%p, %d, %d, %p, %d, %p)\n", cmd, action, property, buffer, buflen, outlen); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tdsdump_log(TDS_DBG_FUNC, "ct_cmd_props() action = %s property = %d\n", CS_GET ? "CS_GET" : "CS_SET", property); if (action == CS_SET) { switch (property) { case CS_USERDATA: free(cmd->userdata); cmd->userdata = (void *) malloc(buflen + 1); tdsdump_log(TDS_DBG_INFO2, "setting userdata orig %p new %p\n", buffer, cmd->userdata); cmd->userdata_len = buflen; memcpy(cmd->userdata, buffer, buflen); break; default: break; } } if (action == CS_GET) { switch (property) { case CS_PARENT_HANDLE: *(CS_CONNECTION **) buffer = cmd->con; break; case CS_CUR_STATUS: case CS_CUR_ID: case CS_CUR_NAME: case CS_CUR_ROWCOUNT: cursor = cmd->cursor; if (!cursor) { tdsdump_log(TDS_DBG_FUNC, "ct_cmd_props() : cannot find cursor\n"); if (property == CS_CUR_STATUS) { *(CS_INT *)buffer = (CS_INT) CS_CURSTAT_NONE; if (outlen) *outlen = sizeof(CS_INT); return CS_SUCCEED; } else { return CS_FAIL; } } if (property == CS_CUR_STATUS) { *(CS_INT *)buffer = cursor->srv_status; if (outlen) *outlen = sizeof(CS_INT); } if (property == CS_CUR_ID) { *(CS_INT *)buffer = cursor->cursor_id; if (outlen) *outlen = sizeof(CS_INT); } if (property == CS_CUR_NAME) { size_t len = strlen(cursor->cursor_name); if ((CS_INT) len >= buflen) return CS_FAIL; strcpy((char*) buffer, cursor->cursor_name); if (outlen) *outlen = len; } if (property == CS_CUR_ROWCOUNT) { *(CS_INT *)buffer = cursor->cursor_rows; if (outlen) *outlen = sizeof(CS_INT); } break; case CS_USERDATA: tdsdump_log(TDS_DBG_INFO2, "fetching userdata %p\n", cmd->userdata); maxcp = cmd->userdata_len; if (outlen) *outlen = maxcp; if (maxcp > buflen) maxcp = buflen; memcpy(buffer, cmd->userdata, maxcp); break; default: break; } } return CS_SUCCEED; } CS_RETCODE ct_compute_info(CS_COMMAND * cmd, CS_INT type, CS_INT colnum, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { TDSSOCKET *tds; TDSRESULTINFO *resinfo; TDSCOLUMN *curcol; CS_INT int_val; CS_SMALLINT *dest_by_col_ptr; TDS_SMALLINT *src_by_col_ptr; int i; tdsdump_log(TDS_DBG_FUNC, "ct_compute_info(%p, %d, %d, %p, %d, %p)\n", cmd, type, colnum, buffer, buflen, outlen); tdsdump_log(TDS_DBG_FUNC, "ct_compute_info() type = %d, colnum = %d\n", type, colnum); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tds = cmd->con->tds_socket; resinfo = tds->current_results; switch (type) { case CS_BYLIST_LEN: if (!resinfo) { int_val = 0; } else { int_val = resinfo->by_cols; } memcpy(buffer, &int_val, sizeof(CS_INT)); if (outlen) *outlen = sizeof(CS_INT); break; case CS_COMP_BYLIST: if (buflen < (CS_INT) (resinfo->by_cols * sizeof(CS_SMALLINT))) { return CS_FAIL; } else { dest_by_col_ptr = (CS_SMALLINT *) buffer; src_by_col_ptr = resinfo->bycolumns; for (i = 0; i < resinfo->by_cols; i++) { *dest_by_col_ptr = *src_by_col_ptr; dest_by_col_ptr++; src_by_col_ptr++; } if (outlen) *outlen = (resinfo->by_cols * sizeof(CS_SMALLINT)); } break; case CS_COMP_COLID: if (!resinfo) { int_val = 0; } else { curcol = resinfo->columns[colnum - 1]; int_val = curcol->column_operand; } memcpy(buffer, &int_val, sizeof(CS_INT)); if (outlen) *outlen = sizeof(CS_INT); break; case CS_COMP_ID: if (!resinfo) { int_val = 0; } else { int_val = resinfo->computeid; } memcpy(buffer, &int_val, sizeof(CS_INT)); if (outlen) *outlen = sizeof(CS_INT); break; case CS_COMP_OP: if (!resinfo) { int_val = 0; } else { curcol = resinfo->columns[colnum - 1]; int_val = _ct_map_compute_op(curcol->column_operator); } memcpy(buffer, &int_val, sizeof(CS_INT)); if (outlen) *outlen = sizeof(CS_INT); break; default: fprintf(stderr, "Unknown type in ct_compute_info: %d\n", type); return CS_FAIL; break; } return CS_SUCCEED; } CS_RETCODE ct_get_data(CS_COMMAND * cmd, CS_INT item, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { TDSRESULTINFO *resinfo; TDSCOLUMN *curcol; unsigned char *src; TDS_INT srclen; tdsdump_log(TDS_DBG_FUNC, "ct_get_data(%p, %d, %p, %d, %p)\n", cmd, item, buffer, buflen, outlen); tdsdump_log(TDS_DBG_FUNC, "ct_get_data() item = %d buflen = %d\n", item, buflen); /* basic validations... */ if (!cmd || !cmd->con || !cmd->con->tds_socket || !(resinfo = cmd->con->tds_socket->current_results)) return CS_FAIL; if (item < 1 || item > resinfo->num_cols) return CS_FAIL; if (!buffer) return CS_FAIL; if (buflen == CS_UNUSED) return CS_FAIL; if (cmd->cancel_state == _CS_CANCEL_PENDING) { _ct_cancel_cleanup(cmd); return CS_CANCELED; } /* This is a new column we are being asked to return */ if (item != cmd->get_data_item) { TDSBLOB *blob = NULL; size_t table_namelen, column_namelen; /* allocate needed descriptor if needed */ free(cmd->iodesc); cmd->iodesc = tds_new0(CS_IODESC, 1); if (!cmd->iodesc) return CS_FAIL; /* reset these values */ cmd->get_data_item = item; cmd->get_data_bytes_returned = 0; /* get at the source data and length */ curcol = resinfo->columns[item - 1]; src = curcol->column_data; if (is_blob_col(curcol)) { blob = (TDSBLOB *) src; src = (unsigned char *) blob->textvalue; } /* now populate the io_desc structure for this data item */ cmd->iodesc->iotype = CS_IODATA; cmd->iodesc->datatype = curcol->column_type; cmd->iodesc->locale = cmd->con->locale; cmd->iodesc->usertype = curcol->column_usertype; cmd->iodesc->total_txtlen = curcol->column_cur_size; cmd->iodesc->offset = 0; cmd->iodesc->log_on_update = CS_FALSE; /* TODO quote needed ?? */ /* avoid possible buffer overflow */ table_namelen = tds_dstr_len(&curcol->table_name); if (table_namelen + 2 > sizeof(cmd->iodesc->name)) table_namelen = sizeof(cmd->iodesc->name) - 2; column_namelen = tds_dstr_len(&curcol->column_name); if (table_namelen + column_namelen + 2 > sizeof(cmd->iodesc->name)) column_namelen = sizeof(cmd->iodesc->name) - 2 - table_namelen; sprintf(cmd->iodesc->name, "%*.*s.%*.*s", (int) table_namelen, (int) table_namelen, tds_dstr_cstr(&curcol->table_name), (int) column_namelen, (int) column_namelen, tds_dstr_cstr(&curcol->column_name)); cmd->iodesc->namelen = strlen(cmd->iodesc->name); if (blob && blob->valid_ptr) { memcpy(cmd->iodesc->timestamp, blob->timestamp, CS_TS_SIZE); cmd->iodesc->timestamplen = CS_TS_SIZE; memcpy(cmd->iodesc->textptr, blob->textptr, CS_TP_SIZE); cmd->iodesc->textptrlen = CS_TP_SIZE; } } else { /* get at the source data */ curcol = resinfo->columns[item - 1]; src = curcol->column_data; if (is_blob_col(curcol)) src = (unsigned char *) ((TDSBLOB *) src)->textvalue; } /* * and adjust the data and length based on * what we may have already returned */ srclen = curcol->column_cur_size; if (srclen < 0) srclen = 0; src += cmd->get_data_bytes_returned; srclen -= cmd->get_data_bytes_returned; /* if we have enough buffer to cope with all the data */ if (buflen >= srclen) { memcpy(buffer, src, srclen); cmd->get_data_bytes_returned += srclen; if (outlen) *outlen = srclen; if (item < resinfo->num_cols) return CS_END_ITEM; return CS_END_DATA; } memcpy(buffer, src, buflen); cmd->get_data_bytes_returned += buflen; if (outlen) *outlen = buflen; return CS_SUCCEED; } CS_RETCODE ct_send_data(CS_COMMAND * cmd, CS_VOID * buffer, CS_INT buflen) { TDSSOCKET *tds; char textptr_string[35]; /* 16 * 2 + 2 (0x) + 1 */ char timestamp_string[19]; /* 8 * 2 + 2 (0x) + 1 */ char *c; int s; char hex2[3]; tdsdump_log(TDS_DBG_FUNC, "ct_send_data(%p, %p, %d)\n", cmd, buffer, buflen); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tds = cmd->con->tds_socket; /* basic validations */ if (cmd->command_type != CS_SEND_DATA_CMD) return CS_FAIL; if (!cmd->iodesc || !cmd->iodesc->textptrlen) return CS_FAIL; /* first ct_send_data for this column */ if (!cmd->send_data_started) { /* turn the timestamp and textptr into character format */ c = textptr_string; for (s = 0; s < cmd->iodesc->textptrlen; s++) { sprintf(hex2, "%02x", cmd->iodesc->textptr[s]); *c++ = hex2[0]; *c++ = hex2[1]; } *c = '\0'; c = timestamp_string; for (s = 0; s < cmd->iodesc->timestamplen; s++) { sprintf(hex2, "%02x", cmd->iodesc->timestamp[s]); *c++ = hex2[0]; *c++ = hex2[1]; } *c = '\0'; /* submit the writetext command */ if (TDS_FAILED(tds_writetext_start(tds, cmd->iodesc->name, textptr_string, timestamp_string, (cmd->iodesc->log_on_update == CS_TRUE), cmd->iodesc->total_txtlen))) return CS_FAIL; cmd->send_data_started = 1; } if (TDS_FAILED(tds_writetext_continue(tds, (const TDS_UCHAR*) buffer, buflen))) return CS_FAIL; return CS_SUCCEED; } CS_RETCODE ct_data_info(CS_COMMAND * cmd, CS_INT action, CS_INT colnum, CS_IODESC * iodesc) { TDSSOCKET *tds; TDSRESULTINFO *resinfo; tdsdump_log(TDS_DBG_FUNC, "ct_data_info(%p, %d, %d, %p)\n", cmd, action, colnum, iodesc); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tds = cmd->con->tds_socket; resinfo = tds->current_results; switch (action) { case CS_SET: if (iodesc->timestamplen < 0 || iodesc->timestamplen > CS_TS_SIZE) return CS_FAIL; if (iodesc->textptrlen < 0 || iodesc->textptrlen > CS_TP_SIZE) return CS_FAIL; free(cmd->iodesc); cmd->iodesc = tds_new0(CS_IODESC, 1); cmd->iodesc->iotype = CS_IODATA; cmd->iodesc->datatype = iodesc->datatype; cmd->iodesc->locale = cmd->con->locale; cmd->iodesc->usertype = iodesc->usertype; cmd->iodesc->total_txtlen = iodesc->total_txtlen; cmd->iodesc->offset = iodesc->offset; cmd->iodesc->log_on_update = iodesc->log_on_update; strcpy(cmd->iodesc->name, iodesc->name); cmd->iodesc->namelen = iodesc->namelen; memcpy(cmd->iodesc->timestamp, iodesc->timestamp, iodesc->timestamplen); cmd->iodesc->timestamplen = iodesc->timestamplen; memcpy(cmd->iodesc->textptr, iodesc->textptr, iodesc->textptrlen); cmd->iodesc->textptrlen = iodesc->textptrlen; break; case CS_GET: if (colnum < 1 || colnum > resinfo->num_cols) return CS_FAIL; if (colnum != cmd->get_data_item) return CS_FAIL; iodesc->iotype = cmd->iodesc->iotype; iodesc->datatype = cmd->iodesc->datatype; iodesc->locale = cmd->iodesc->locale; iodesc->usertype = cmd->iodesc->usertype; iodesc->total_txtlen = cmd->iodesc->total_txtlen; iodesc->offset = cmd->iodesc->offset; iodesc->log_on_update = CS_FALSE; strcpy(iodesc->name, cmd->iodesc->name); iodesc->namelen = cmd->iodesc->namelen; memcpy(iodesc->timestamp, cmd->iodesc->timestamp, cmd->iodesc->timestamplen); iodesc->timestamplen = cmd->iodesc->timestamplen; memcpy(iodesc->textptr, cmd->iodesc->textptr, cmd->iodesc->textptrlen); iodesc->textptrlen = cmd->iodesc->textptrlen; break; default: return CS_FAIL; } return CS_SUCCEED; } CS_RETCODE ct_capability(CS_CONNECTION * con, CS_INT action, CS_INT type, CS_INT capability, CS_VOID * value) { TDSLOGIN *login; int idx = 0; unsigned char bitmask = 0; TDS_CAPABILITY_TYPE *cap = NULL; tdsdump_log(TDS_DBG_FUNC, "ct_capability(%p, %d, %d, %d, %p)\n", con, action, type, capability, value); login = (TDSLOGIN *) con->tds_login; #define CONV_CAP(ct,tds) case ct: idx=tds; break; if (type == CS_CAP_RESPONSE) { cap = &login->capabilities.types[1]; switch (capability) { CONV_CAP(CS_DATA_NOBOUNDARY, TDS_RES_DATA_NOBOUNDARY); CONV_CAP(CS_RES_NOTDSDEBUG, TDS_RES_NOTDSDEBUG); CONV_CAP(CS_RES_NOSTRIPBLANKS, TDS_RES_NOSTRIPBLANKS); CONV_CAP(CS_DATA_NOINT8, TDS_RES_DATA_NOINT8); CONV_CAP(CS_DATA_NOINTN, TDS_RES_DATA_INTN); CONV_CAP(CS_DATA_NODATETIMEN, TDS_RES_DATA_NODATETIMEN); CONV_CAP(CS_DATA_NOMONEYN, TDS_RES_DATA_NOMONEYN); CONV_CAP(CS_CON_NOOOB, TDS_RES_CON_NOOOB); CONV_CAP(CS_CON_NOINBAND, TDS_RES_CON_NOINBAND); CONV_CAP(CS_PROTO_NOTEXT, TDS_RES_PROTO_NOTEXT); CONV_CAP(CS_PROTO_NOBULK, TDS_RES_PROTO_NOBULK); CONV_CAP(CS_DATA_NOSENSITIVITY, TDS_RES_DATA_NOSENSITIVITY); CONV_CAP(CS_DATA_NOFLT4, TDS_RES_DATA_NOFLT4); CONV_CAP(CS_DATA_NOFLT8, TDS_RES_DATA_NOFLT8); CONV_CAP(CS_DATA_NONUM, TDS_RES_DATA_NONUM); CONV_CAP(CS_DATA_NOTEXT, TDS_RES_DATA_NOTEXT); CONV_CAP(CS_DATA_NOIMAGE, TDS_RES_DATA_NOIMAGE); CONV_CAP(CS_DATA_NODEC, TDS_RES_DATA_NODEC); CONV_CAP(CS_DATA_NOLCHAR, TDS_RES_DATA_NOLCHAR); CONV_CAP(CS_DATA_NOLBIN, TDS_RES_DATA_NOLBIN); CONV_CAP(CS_DATA_NOCHAR, TDS_RES_DATA_NOCHAR); CONV_CAP(CS_DATA_NOVCHAR, TDS_RES_DATA_NOVCHAR); CONV_CAP(CS_DATA_NOBIN, TDS_RES_DATA_NOBIN); CONV_CAP(CS_DATA_NOVBIN, TDS_RES_DATA_NOVBIN); CONV_CAP(CS_DATA_NOMNY8, TDS_RES_DATA_NOMNY8); CONV_CAP(CS_DATA_NOMNY4, TDS_RES_DATA_NOMNY4); CONV_CAP(CS_DATA_NODATE8, TDS_RES_DATA_NODATE8); CONV_CAP(CS_DATA_NODATE4, TDS_RES_DATA_NODATE4); CONV_CAP(CS_RES_NOMSG, TDS_RES_NOMSG); CONV_CAP(CS_RES_NOEED, TDS_RES_NOEED); CONV_CAP(CS_RES_NOPARAM, TDS_RES_NOPARAM); CONV_CAP(CS_DATA_NOINT1, TDS_RES_DATA_NOINT1); CONV_CAP(CS_DATA_NOINT2, TDS_RES_DATA_NOINT2); CONV_CAP(CS_DATA_NOINT4, TDS_RES_DATA_NOINT4); CONV_CAP(CS_DATA_NOBIT, TDS_RES_DATA_NOBIT); } /* end capability */ } /* End handling CS_CAP_RESPONSE (returned) */ /* * Begin handling CS_CAP_REQUEST * These capabilities describe the types of requests that a server can support. */ if (type == CS_CAP_REQUEST) { if (action == CS_SET) { tdsdump_log(TDS_DBG_SEVERE, "ct_capability -- attempt to set a read-only capability (type %d, action %d)\n", type, action); return CS_FAIL; } cap = &login->capabilities.types[0]; switch (capability) { CONV_CAP(CS_PROTO_DYNPROC, TDS_REQ_PROTO_DYNPROC); CONV_CAP(CS_DATA_FLTN, TDS_REQ_DATA_FLTN); CONV_CAP(CS_DATA_BITN, TDS_REQ_DATA_BITN); CONV_CAP(CS_DATA_INT8, TDS_REQ_DATA_INT8); CONV_CAP(CS_DATA_VOID, TDS_REQ_DATA_VOID); CONV_CAP(CS_CON_INBAND, TDS_REQ_CON_INBAND); CONV_CAP(CS_CON_LOGICAL, TDS_REQ_CON_LOGICAL); CONV_CAP(CS_PROTO_TEXT, TDS_REQ_PROTO_TEXT); CONV_CAP(CS_PROTO_BULK, TDS_REQ_PROTO_BULK); CONV_CAP(CS_REQ_URGNOTIF, TDS_REQ_URGEVT); CONV_CAP(CS_DATA_SENSITIVITY, TDS_REQ_DATA_SENSITIVITY); CONV_CAP(CS_DATA_BOUNDARY, TDS_REQ_DATA_BOUNDARY); CONV_CAP(CS_PROTO_DYNAMIC, TDS_REQ_PROTO_DYNAMIC); CONV_CAP(CS_DATA_MONEYN, TDS_REQ_DATA_MONEYN); CONV_CAP(CS_CSR_PREV, TDS_REQ_CSR_PREV); CONV_CAP(CS_CSR_FIRST, TDS_REQ_CSR_FIRST); CONV_CAP(CS_CSR_LAST, TDS_REQ_CSR_LAST); CONV_CAP(CS_CSR_ABS, TDS_REQ_CSR_ABS); CONV_CAP(CS_CSR_REL, TDS_REQ_CSR_REL); CONV_CAP(CS_CSR_MULTI, TDS_REQ_CSR_MULTI); CONV_CAP(CS_CON_OOB, TDS_REQ_CON_OOB); CONV_CAP(CS_DATA_NUM, TDS_REQ_DATA_NUM); CONV_CAP(CS_DATA_TEXT, TDS_REQ_DATA_TEXT); CONV_CAP(CS_DATA_IMAGE, TDS_REQ_DATA_IMAGE); CONV_CAP(CS_DATA_DEC, TDS_REQ_DATA_DEC); CONV_CAP(CS_DATA_LCHAR, TDS_REQ_DATA_LCHAR); CONV_CAP(CS_DATA_LBIN, TDS_REQ_DATA_LBIN); CONV_CAP(CS_DATA_INTN, TDS_REQ_DATA_INTN); CONV_CAP(CS_DATA_DATETIMEN, TDS_REQ_DATA_DATETIMEN); CONV_CAP(CS_DATA_BIN, TDS_REQ_DATA_BIN); CONV_CAP(CS_DATA_VBIN, TDS_REQ_DATA_VBIN); CONV_CAP(CS_DATA_MNY8, TDS_REQ_DATA_MNY8); CONV_CAP(CS_DATA_MNY4, TDS_REQ_DATA_MNY4); CONV_CAP(CS_DATA_DATE8, TDS_REQ_DATA_DATE8); CONV_CAP(CS_DATA_DATE4, TDS_REQ_DATA_DATE4); CONV_CAP(CS_DATA_FLT4, TDS_REQ_DATA_FLT4); CONV_CAP(CS_DATA_FLT8, TDS_REQ_DATA_FLT8); CONV_CAP(CS_REQ_MSG, TDS_REQ_MSG); CONV_CAP(CS_REQ_PARAM, TDS_REQ_PARAM); CONV_CAP(CS_DATA_INT1, TDS_REQ_DATA_INT1); CONV_CAP(CS_DATA_INT2, TDS_REQ_DATA_INT2); CONV_CAP(CS_DATA_INT4, TDS_REQ_DATA_INT4); CONV_CAP(CS_DATA_BIT, TDS_REQ_DATA_BIT); CONV_CAP(CS_DATA_CHAR, TDS_REQ_DATA_CHAR); CONV_CAP(CS_DATA_VCHAR, TDS_REQ_DATA_VCHAR); CONV_CAP(CS_REQ_LANG, TDS_REQ_LANG); CONV_CAP(CS_REQ_RPC, TDS_REQ_RPC); CONV_CAP(CS_REQ_NOTIF, TDS_REQ_EVT); CONV_CAP(CS_REQ_MSTMT, TDS_REQ_MSTMT); CONV_CAP(CS_REQ_BCP, TDS_REQ_BCP); CONV_CAP(CS_REQ_CURSOR, TDS_REQ_CURSOR); CONV_CAP(CS_REQ_DYN, TDS_REQ_DYNF); } /* end capability */ } /* End handling CS_CAP_REQUEST */ #undef CONV_CAP if (!cap) { tdsdump_log(TDS_DBG_SEVERE, "ct_capability -- unknown capability type\n"); return CS_FAIL; } if (idx == 0) { tdsdump_log(TDS_DBG_SEVERE, "ct_capability -- attempt to set/get a non-existant capability\n"); return CS_FAIL; } bitmask = 1 << (idx&7); idx = sizeof(cap->values) - 1 - (idx>>3); assert(0 <= idx && idx <= sizeof(cap->values)); switch (action) { case CS_SET: /* Having established the offset and the bitmask, we can now turn the capability on or off */ switch (*(CS_BOOL *) value) { case CS_TRUE: cap->values[idx] |= bitmask; break; case CS_FALSE: cap->values[idx] &= ~bitmask; break; default: tdsdump_log(TDS_DBG_SEVERE, "ct_capability -- unknown value\n"); return CS_FAIL; } break; case CS_GET: *(CS_BOOL *) value = (cap->values[idx] & bitmask) ? CS_TRUE : CS_FALSE; break; default: tdsdump_log(TDS_DBG_SEVERE, "ct_capability -- unknown action\n"); return CS_FAIL; } return CS_SUCCEED; } /* end ct_capability */ CS_RETCODE ct_dynamic(CS_COMMAND * cmd, CS_INT type, CS_CHAR * id, CS_INT idlen, CS_CHAR * buffer, CS_INT buflen) { int query_len; CS_CONNECTION *con; CS_DYNAMIC *dyn; tdsdump_log(TDS_DBG_FUNC, "ct_dynamic(%p, %d, %p, %d, %p, %d)\n", cmd, type, id, idlen, buffer, buflen); if (!cmd->con) return CS_FAIL; con = cmd->con; switch (type) { case CS_PREPARE: dyn = _ct_allocate_dynamic(con, id, idlen); if (!dyn) return CS_FAIL; /* now the query */ if (buflen == CS_NULLTERM) { query_len = strlen(buffer); } else { query_len = buflen; } dyn->stmt = tds_strndup(buffer, query_len); cmd->dyn = dyn; break; case CS_DEALLOC: cmd->dyn = _ct_locate_dynamic(con, id, idlen); if (!cmd->dyn) return CS_FAIL; break; case CS_DESCRIBE_INPUT: case CS_DESCRIBE_OUTPUT: cmd->dyn = _ct_locate_dynamic(con, id, idlen); if (!cmd->dyn) return CS_FAIL; break; case CS_EXECUTE: cmd->dyn = _ct_locate_dynamic(con, id, idlen); if (!cmd->dyn) return CS_FAIL; tdsdump_log(TDS_DBG_FUNC, "ct_dynamic() calling param_clear\n"); param_clear(cmd->dyn->param_list); cmd->dyn->param_list = NULL; break; default: return CS_FAIL; } cmd->command_type = CS_DYNAMIC_CMD; cmd->dynamic_cmd = type; ct_set_command_state(cmd, _CS_COMMAND_READY); return CS_SUCCEED; } CS_RETCODE ct_param(CS_COMMAND * cmd, CS_DATAFMT * datafmt, CS_VOID * data, CS_INT datalen, CS_SMALLINT indicator) { CSREMOTE_PROC *rpc; CS_DYNAMIC *dyn; CS_PARAM **pparam; CS_PARAM *param; tdsdump_log(TDS_DBG_FUNC, "ct_param(%p, %p, %p, %d, %hd)\n", cmd, datafmt, data, datalen, indicator); tdsdump_log(TDS_DBG_INFO1, "ct_param() data addr = %p data length = %d\n", data, datalen); if (!cmd) return CS_FAIL; switch (cmd->command_type) { case CS_RPC_CMD: if (!cmd->rpc) { printf("RPC is NULL ct_param\n"); return CS_FAIL; } param = tds_new0(CSREMOTE_PROC_PARAM, 1); if (!param) return CS_FAIL; if (CS_SUCCEED != _ct_fill_param(cmd->command_type, param, datafmt, data, &datalen, &indicator, 1)) { tdsdump_log(TDS_DBG_INFO1, "ct_param() failed to add rpc param\n"); tdsdump_log(TDS_DBG_INFO1, "ct_param() failed to add input value\n"); free(param); return CS_FAIL; } rpc = cmd->rpc; pparam = &rpc->param_list; while (*pparam) { pparam = &(*pparam)->next; } *pparam = param; tdsdump_log(TDS_DBG_INFO1, " ct_param() added rpc parameter %s \n", (*param).name); return CS_SUCCEED; break; case CS_LANG_CMD: /* only accept CS_INPUTVALUE as the status */ if (CS_INPUTVALUE != datafmt->status) { tdsdump_log(TDS_DBG_ERROR, "illegal datafmt->status(%d) passed to ct_param()\n", datafmt->status); return CS_FAIL; } param = tds_new0(CSREMOTE_PROC_PARAM, 1); if (!param) return CS_FAIL; if (CS_SUCCEED != _ct_fill_param(cmd->command_type, param, datafmt, data, &datalen, &indicator, 1)) { free(param); return CS_FAIL; } if (!cmd->input_params) { cmd->input_params = param; } else { pparam = &cmd->input_params; while ((*pparam)->next) pparam = &(*pparam)->next; (*pparam)->next = param; } tdsdump_log(TDS_DBG_INFO1, "ct_param() added input value\n"); return CS_SUCCEED; break; case CS_DYNAMIC_CMD: if (!cmd->dyn) { tdsdump_log(TDS_DBG_INFO1, "cmd->dyn is NULL ct_param\n"); return CS_FAIL; } param = tds_new0(CS_DYNAMIC_PARAM, 1); if (!param) return CS_FAIL; if (CS_SUCCEED != _ct_fill_param(cmd->command_type, param, datafmt, data, &datalen, &indicator, 1)) { tdsdump_log(TDS_DBG_INFO1, "ct_param() failed to add CS_DYNAMIC param\n"); free(param); return CS_FAIL; } dyn = cmd->dyn; pparam = &dyn->param_list; while (*pparam) { pparam = &(*pparam)->next; } *pparam = param; return CS_SUCCEED; break; } return CS_FAIL; } CS_RETCODE ct_setparam(CS_COMMAND * cmd, CS_DATAFMT * datafmt, CS_VOID * data, CS_INT * datalen, CS_SMALLINT * indicator) { CSREMOTE_PROC *rpc; CS_PARAM **pparam; CS_PARAM *param; CS_DYNAMIC *dyn; tdsdump_log(TDS_DBG_FUNC, "ct_setparam(%p, %p, %p, %p, %p)\n", cmd, datafmt, data, datalen, indicator); tdsdump_log(TDS_DBG_FUNC, "ct_setparam() command type = %d, data type = %d\n", cmd->command_type, datafmt->datatype); /* Code changed for RPC functionality - SUHA */ /* RPC code changes starts here */ if (!cmd) return CS_FAIL; switch (cmd->command_type) { case CS_RPC_CMD: if (!cmd->rpc) { printf("RPC is NULL ct_param\n"); return CS_FAIL; } param = tds_new0(CSREMOTE_PROC_PARAM, 1); if (!param) return CS_FAIL; if (CS_SUCCEED != _ct_fill_param(cmd->command_type, param, datafmt, data, datalen, indicator, 0)) { tdsdump_log(TDS_DBG_INFO1, "ct_setparam() failed to add rpc param\n"); tdsdump_log(TDS_DBG_INFO1, "ct_setparam() failed to add input value\n"); free(param); return CS_FAIL; } rpc = cmd->rpc; pparam = &rpc->param_list; tdsdump_log(TDS_DBG_INFO1, " ct_setparam() reached here\n"); if (*pparam != NULL) { while ((*pparam)->next != NULL) { pparam = &(*pparam)->next; } pparam = &(*pparam)->next; } *pparam = param; param->next = NULL; tdsdump_log(TDS_DBG_INFO1, " ct_setparam() added parameter %s \n", (*param).name); return CS_SUCCEED; break; case CS_DYNAMIC_CMD : if (!cmd->dyn) { printf("cmd->dyn is NULL ct_param\n"); return CS_FAIL; } param = tds_new0(CS_DYNAMIC_PARAM, 1); if (!param) return CS_FAIL; if (CS_SUCCEED != _ct_fill_param(cmd->command_type, param, datafmt, data, datalen, indicator, 0)) { tdsdump_log(TDS_DBG_INFO1, "ct_setparam() failed to add dynamic param\n"); free(param); return CS_FAIL; } dyn = cmd->dyn; pparam = &dyn->param_list; if (*pparam != NULL) { while ((*pparam)->next != NULL) { pparam = &(*pparam)->next; } pparam = &(*pparam)->next; } *pparam = param; param->next = NULL; tdsdump_log(TDS_DBG_INFO1, "ct_setparam() added dynamic parameter\n"); return CS_SUCCEED; break; case CS_LANG_CMD: /* only accept CS_INPUTVALUE as the status */ if (CS_INPUTVALUE != datafmt->status) { tdsdump_log(TDS_DBG_ERROR, "illegal datafmt->status(%d) passed to ct_setparam()\n", datafmt->status); return CS_FAIL; } param = tds_new0(CSREMOTE_PROC_PARAM, 1); if (!param) return CS_FAIL; if (CS_SUCCEED != _ct_fill_param(cmd->command_type, param, datafmt, data, datalen, indicator, 0)) { tdsdump_log(TDS_DBG_INFO1, "ct_setparam() failed to add language param\n"); free(param); return CS_FAIL; } if (!cmd->input_params) { cmd->input_params = param; } else { pparam = &cmd->input_params; while ((*pparam)->next) pparam = &(*pparam)->next; (*pparam)->next = param; } tdsdump_log(TDS_DBG_INFO1, "ct_setparam() added language parameter\n"); return CS_SUCCEED; break; } return CS_FAIL; } CS_RETCODE ct_options(CS_CONNECTION * con, CS_INT action, CS_INT option, CS_VOID * param, CS_INT paramlen, CS_INT * outlen) { TDS_OPTION_CMD tds_command; TDS_OPTION tds_option = 0; TDS_OPTION_ARG tds_argument; TDS_INT tds_argsize = 0; TDSSOCKET *tds; const char *action_string = NULL; int i; /* boolean options can all be treated the same way */ static const struct TDS_BOOL_OPTION_MAP { CS_INT option; TDS_OPTION tds_option; } tds_bool_option_map[] = { { CS_OPT_ANSINULL, TDS_OPT_ANSINULL } , { CS_OPT_CHAINXACTS, TDS_OPT_CHAINXACTS } , { CS_OPT_CURCLOSEONXACT, TDS_OPT_CURCLOSEONXACT } , { CS_OPT_FIPSFLAG, TDS_OPT_FIPSFLAG } , { CS_OPT_FORCEPLAN, TDS_OPT_FORCEPLAN } , { CS_OPT_FORMATONLY, TDS_OPT_FORMATONLY } , { CS_OPT_GETDATA, TDS_OPT_GETDATA } , { CS_OPT_NOCOUNT, TDS_OPT_NOCOUNT } , { CS_OPT_NOEXEC, TDS_OPT_NOEXEC } , { CS_OPT_PARSEONLY, TDS_OPT_PARSEONLY } , { CS_OPT_QUOTED_IDENT, TDS_OPT_QUOTED_IDENT } , { CS_OPT_RESTREES, TDS_OPT_RESTREES } , { CS_OPT_SHOWPLAN, TDS_OPT_SHOWPLAN } , { CS_OPT_STATS_IO, TDS_OPT_STAT_IO } , { CS_OPT_STATS_TIME, TDS_OPT_STAT_TIME } , { CS_OPT_ARITHIGNORE, TDS_OPT_ARITHIGNOREON } , { CS_OPT_ARITHABORT, TDS_OPT_ARITHABORTON } }; tdsdump_log(TDS_DBG_FUNC, "ct_options(%p, %d, %d, %p, %d, %p)\n", con, action, option, param, paramlen, outlen); if (!param) return CS_FAIL; if (!con || !(tds=con->tds_socket)) return CS_FAIL; /* * Set the tds command */ switch (action) { case CS_GET: tds_command = TDS_OPT_LIST; /* will be acknowledged by TDS_OPT_INFO */ action_string = "CS_GET"; tds_argsize = 0; break; case CS_SET: tds_command = TDS_OPT_SET; action_string = "CS_SET"; break; case CS_CLEAR: tds_command = TDS_OPT_DEFAULT; action_string = "CS_CLEAR"; tds_argsize = 0; break; default: tdsdump_log(TDS_DBG_FUNC, "ct_options: invalid action = %d\n", action); return CS_FAIL; } assert(tds_command && action_string); tdsdump_log(TDS_DBG_FUNC, "ct_options: %s, option = %d\n", action_string, option); /* * Set the tds option * The following TDS options apparently cannot be set with this function. * TDS_OPT_CHARSET * TDS_OPT_CURREAD * TDS_OPT_IDENTITYOFF * TDS_OPT_IDENTITYON * TDS_OPT_CURWRITE * TDS_OPT_NATLANG * TDS_OPT_ROWCOUNT */ /* * First, take care of the easy cases, the booleans. */ for (i = 0; i < TDS_VECTOR_SIZE(tds_bool_option_map); i++) { if (tds_bool_option_map[i].option != option) continue; tds_option = tds_bool_option_map[i].tds_option; if (action == CS_SET) { switch (*(CS_BOOL *) param) { case CS_TRUE: tds_argument.ti = 1; break; case CS_FALSE: tds_argument.ti = 0; break; default: return CS_FAIL; } tds_argsize = 1; } if (action == CS_GET) { tds_argsize = 0; } goto SEND_OPTION; } /* * Non-booleans are more complicated. */ switch (option) { case CS_OPT_ANSIPERM: case CS_OPT_STR_RTRUNC: /* no documented tds option */ switch (*(CS_BOOL *) param) { case CS_TRUE: case CS_FALSE: break; /* end valid choices */ default: if (action == CS_SET) return CS_FAIL; } break; case CS_OPT_AUTHOFF: tds_option = TDS_OPT_AUTHOFF; tds_argument.c = (TDS_CHAR *) param; tds_argsize = (action == CS_SET) ? paramlen : 0; break; case CS_OPT_AUTHON: tds_option = TDS_OPT_AUTHON; tds_argument.c = (TDS_CHAR *) param; tds_argsize = (action == CS_SET) ? paramlen : 0; break; case CS_OPT_DATEFIRST: tds_option = TDS_OPT_DATEFIRST; switch (*(CS_INT *) param) { case CS_OPT_SUNDAY: tds_argument.ti = TDS_OPT_SUNDAY; break; case CS_OPT_MONDAY: tds_argument.ti = TDS_OPT_MONDAY; break; case CS_OPT_TUESDAY: tds_argument.ti = TDS_OPT_TUESDAY; break; case CS_OPT_WEDNESDAY: tds_argument.ti = TDS_OPT_WEDNESDAY; break; case CS_OPT_THURSDAY: tds_argument.ti = TDS_OPT_THURSDAY; break; case CS_OPT_FRIDAY: tds_argument.ti = TDS_OPT_FRIDAY; break; case CS_OPT_SATURDAY: tds_argument.ti = TDS_OPT_SATURDAY; break; default: if (action == CS_SET) return CS_FAIL; } tds_argsize = (action == CS_SET) ? 1 : 0; break; case CS_OPT_DATEFORMAT: tds_option = TDS_OPT_DATEFORMAT; switch (*(CS_INT *) param) { case CS_OPT_FMTMDY: tds_argument.ti = TDS_OPT_FMTMDY; break; case CS_OPT_FMTDMY: tds_argument.ti = TDS_OPT_FMTDMY; break; case CS_OPT_FMTYMD: tds_argument.ti = TDS_OPT_FMTYMD; break; case CS_OPT_FMTYDM: tds_argument.ti = TDS_OPT_FMTYDM; break; case CS_OPT_FMTMYD: tds_argument.ti = TDS_OPT_FMTMYD; break; case CS_OPT_FMTDYM: tds_argument.ti = TDS_OPT_FMTDYM; break; default: if (action == CS_SET) return CS_FAIL; } tds_argsize = (action == CS_SET) ? 1 : 0; break; case CS_OPT_ISOLATION: tds_option = TDS_OPT_ISOLATION; switch (*(char *) param) { case CS_OPT_LEVEL0: /* CS_OPT_LEVEL0 requires SQL Server version 11.0 or later or Adaptive Server. */ tds_argument.ti = TDS_OPT_LEVEL0; break; case CS_OPT_LEVEL1: tds_argument.ti = TDS_OPT_LEVEL1; break; case CS_OPT_LEVEL2: tds_argument.ti = TDS_OPT_LEVEL2; break; case CS_OPT_LEVEL3: tds_argument.ti = TDS_OPT_LEVEL3; break; default: if (action == CS_SET) return CS_FAIL; } tds_argsize = (action == CS_SET) ? 1 : 0; break; case CS_OPT_TEXTSIZE: tds_option = TDS_OPT_TEXTSIZE; tds_argument.i = *(CS_INT *) param; tds_argsize = (action == CS_SET) ? sizeof(tds_argument.i) : 0; break; case CS_OPT_TRUNCIGNORE: tds_option = TDS_OPT_TRUNCABORT; /* note inverted sense */ switch (*(CS_BOOL *) param) { case CS_TRUE: case CS_FALSE: break; default: if (action == CS_SET) return CS_FAIL; } tds_argument.ti = !*(CS_BOOL *) param; tds_argsize = (action == CS_SET) ? 1 : 0; break; default: return CS_FAIL; /* invalid option */ } SEND_OPTION: tdsdump_log(TDS_DBG_FUNC, "\ttds_submit_optioncmd will be action(%s) option(%d) arg(%x) arglen(%d)\n", action_string, tds_option, tds_argsize == 1 ? tds_argument.ti : (tds_argsize == 4 ? tds_argument.i : 0), tds_argsize); if (TDS_FAILED(tds_submit_optioncmd(tds, tds_command, tds_option, &tds_argument, tds_argsize))) { return CS_FAIL; } if (action == CS_GET) { switch (option) { case CS_OPT_ANSINULL : case CS_OPT_CHAINXACTS : case CS_OPT_CURCLOSEONXACT : case CS_OPT_NOCOUNT : case CS_OPT_QUOTED_IDENT : *(CS_BOOL *)param = tds->option_value; break; case CS_OPT_DATEFIRST: switch (tds->option_value) { case TDS_OPT_SUNDAY: *(CS_INT *)param = CS_OPT_SUNDAY; break; case TDS_OPT_MONDAY: *(CS_INT *)param = CS_OPT_MONDAY; break; case TDS_OPT_TUESDAY: *(CS_INT *)param = CS_OPT_TUESDAY; break; case TDS_OPT_WEDNESDAY: *(CS_INT *)param = CS_OPT_WEDNESDAY; break; case TDS_OPT_THURSDAY: *(CS_INT *)param = CS_OPT_THURSDAY; break; case TDS_OPT_FRIDAY: *(CS_INT *)param = CS_OPT_FRIDAY; break; case TDS_OPT_SATURDAY: *(CS_INT *)param = CS_OPT_SATURDAY; break; default: return CS_FAIL; } break; case CS_OPT_DATEFORMAT: switch (tds->option_value) { case TDS_OPT_FMTDMY: *(CS_INT *)param = CS_OPT_FMTDMY; break; case TDS_OPT_FMTDYM: *(CS_INT *)param = CS_OPT_FMTDYM; break; case TDS_OPT_FMTMDY: *(CS_INT *)param = CS_OPT_FMTMDY; break; case TDS_OPT_FMTMYD: *(CS_INT *)param = CS_OPT_FMTMYD; break; case TDS_OPT_FMTYMD: *(CS_INT *)param = CS_OPT_FMTYMD; break; case TDS_OPT_FMTYDM: *(CS_INT *)param = CS_OPT_FMTYDM; break; default: return CS_FAIL; } break; case CS_OPT_ARITHABORT : case CS_OPT_ARITHIGNORE : *(CS_BOOL *)param = tds->option_value; break; case CS_OPT_TRUNCIGNORE : break; } } return CS_SUCCEED; } /* end ct_options() */ CS_RETCODE ct_poll(CS_CONTEXT * ctx, CS_CONNECTION * connection, CS_INT milliseconds, CS_CONNECTION ** compconn, CS_COMMAND ** compcmd, CS_INT * compid, CS_INT * compstatus) { tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED ct_poll()\n"); tdsdump_log(TDS_DBG_FUNC, "ct_poll(%p, %p, %d, %p, %p, %p, %p)\n", ctx, connection, milliseconds, compconn, compcmd, compid, compstatus); return CS_FAIL; } CS_RETCODE ct_cursor(CS_COMMAND * cmd, CS_INT type, CS_CHAR * name, CS_INT namelen, CS_CHAR * text, CS_INT tlen, CS_INT option) { TDSSOCKET *tds; TDSCURSOR *cursor; tdsdump_log(TDS_DBG_FUNC, "ct_cursor(%p, %d, %p, %d, %p, %d, %d)\n", cmd, type, name, namelen, text, tlen, option); if (!cmd->con || !cmd->con->tds_socket) return CS_FAIL; tds = cmd->con->tds_socket; cmd->command_type = CS_CUR_CMD; tdsdump_log(TDS_DBG_FUNC, "ct_cursor() : type = %d \n", type); switch (type) { case CS_CURSOR_DECLARE: cursor = tds_alloc_cursor(tds, name, namelen == CS_NULLTERM ? strlen(name) : namelen, text, tlen == CS_NULLTERM ? strlen(text) : tlen); if (!cursor) return CS_FAIL; cursor->cursor_rows = 1; cursor->options = option; cursor->status.declare = TDS_CURSOR_STATE_REQUESTED; cursor->status.cursor_row = TDS_CURSOR_STATE_UNACTIONED; cursor->status.open = TDS_CURSOR_STATE_UNACTIONED; cursor->status.fetch = TDS_CURSOR_STATE_UNACTIONED; cursor->status.close = TDS_CURSOR_STATE_UNACTIONED; cursor->status.dealloc = TDS_CURSOR_STATE_UNACTIONED; tds_release_cursor(&cmd->cursor); cmd->cursor = cursor; ct_set_command_state(cmd, _CS_COMMAND_READY); return CS_SUCCEED; break; case CS_CURSOR_ROWS: cursor = cmd->cursor; if (!cursor) { tdsdump_log(TDS_DBG_FUNC, "ct_cursor() : cursor not present\n"); return CS_FAIL; } if (cursor->status.declare == _CS_CURS_TYPE_REQUESTED || cursor->status.declare == _CS_CURS_TYPE_SENT) { cursor->cursor_rows = option; cursor->status.cursor_row = TDS_CURSOR_STATE_REQUESTED; ct_set_command_state(cmd, _CS_COMMAND_READY); return CS_SUCCEED; } else { cursor->status.cursor_row = TDS_CURSOR_STATE_UNACTIONED; tdsdump_log(TDS_DBG_FUNC, "ct_cursor() : cursor not declared\n"); return CS_FAIL; } break; case CS_CURSOR_OPEN: cursor = cmd->cursor; if (!cursor) { tdsdump_log(TDS_DBG_FUNC, "ct_cursor() : cursor not present\n"); return CS_FAIL; } if (cursor->status.declare == _CS_CURS_TYPE_REQUESTED || cursor->status.declare == _CS_CURS_TYPE_SENT ) { cursor->status.open = TDS_CURSOR_STATE_REQUESTED; return CS_SUCCEED; ct_set_command_state(cmd, _CS_COMMAND_READY); } else { cursor->status.open = TDS_CURSOR_STATE_UNACTIONED; tdsdump_log(TDS_DBG_FUNC, "ct_cursor() : cursor not declared\n"); return CS_FAIL; } break; case CS_CURSOR_CLOSE: cursor = cmd->cursor; if (!cursor) { tdsdump_log(TDS_DBG_FUNC, "ct_cursor() : cursor not present\n"); return CS_FAIL; } cursor->status.cursor_row = TDS_CURSOR_STATE_UNACTIONED; cursor->status.open = TDS_CURSOR_STATE_UNACTIONED; cursor->status.fetch = TDS_CURSOR_STATE_UNACTIONED; cursor->status.close = TDS_CURSOR_STATE_REQUESTED; if (option == CS_DEALLOC) { cursor->status.dealloc = TDS_CURSOR_STATE_REQUESTED; } ct_set_command_state(cmd, _CS_COMMAND_READY); return CS_SUCCEED; case CS_CURSOR_DEALLOC: cursor = cmd->cursor; if (!cursor) { tdsdump_log(TDS_DBG_FUNC, "ct_cursor() : cursor not present\n"); return CS_FAIL; } cursor->status.dealloc = TDS_CURSOR_STATE_REQUESTED; ct_set_command_state(cmd, _CS_COMMAND_READY); return CS_SUCCEED; case CS_IMPLICIT_CURSOR: tdsdump_log(TDS_DBG_INFO1, "CS_IMPLICIT_CURSOR: Option not implemented\n"); return CS_FAIL; case CS_CURSOR_OPTION: tdsdump_log(TDS_DBG_INFO1, "CS_CURSOR_OPTION: Option not implemented\n"); return CS_FAIL; case CS_CURSOR_UPDATE: tdsdump_log(TDS_DBG_INFO1, "CS_CURSOR_UPDATE: Option not implemented\n"); return CS_FAIL; case CS_CURSOR_DELETE: tdsdump_log(TDS_DBG_INFO1, "CS_CURSOR_DELETE: Option not implemented\n"); return CS_FAIL; } return CS_FAIL; } static int _ct_fetchable_results(CS_COMMAND * cmd) { tdsdump_log(TDS_DBG_FUNC, "_ct_fetchable_results(%p)\n", cmd); switch (cmd->curr_result_type) { case CS_COMPUTE_RESULT: case CS_CURSOR_RESULT: case CS_PARAM_RESULT: case CS_ROW_RESULT: case CS_STATUS_RESULT: return 1; } return 0; } static TDSRET _ct_process_return_status(TDSSOCKET * tds) { TDSRESULTINFO *info; TDSCOLUMN *curcol; TDS_INT saved_status; TDSRET rc; enum { num_cols = 1 }; tdsdump_log(TDS_DBG_FUNC, "_ct_process_return_status(%p)\n", tds); assert(tds); saved_status = tds->ret_status; tds_free_all_results(tds); /* allocate the columns structure */ tds->res_info = tds_alloc_results(num_cols); tds_set_current_results(tds, tds->res_info); if (!tds->res_info) return TDS_FAIL; info = tds->res_info; curcol = info->columns[0]; tds_set_column_type(tds->conn, curcol, SYBINT4); tdsdump_log(TDS_DBG_INFO1, "generating return status row. type = %d(%s), varint_size %d\n", curcol->column_type, tds_prtype(curcol->column_type), curcol->column_varint_size); rc = tds_alloc_row(info); if (TDS_FAILED(rc)) return rc; assert(curcol->column_data != NULL); *(TDS_INT *) curcol->column_data = saved_status; return TDS_SUCCESS; } /* Code added for RPC functionality - SUHA */ /* RPC code changes starts here */ static const unsigned char * paramrowalloc(TDSPARAMINFO * params, TDSCOLUMN * curcol, int param_num, void *value, int size) { const void *row = tds_alloc_param_data(curcol); tdsdump_log(TDS_DBG_INFO1, "paramrowalloc, size = %d, data = %p, row_size = %d\n", size, curcol->column_data, params->row_size); if (!row) return NULL; if (value) { /* TODO check for BLOB and numeric */ if (size > curcol->column_size) { tdsdump_log(TDS_DBG_FUNC, "paramrowalloc(): RESIZE %d to %d\n", size, curcol->column_size); size = curcol->column_size; } /* TODO blobs */ if (!is_blob_col(curcol)) memcpy(curcol->column_data, value, size); else { TDSBLOB *blob = (TDSBLOB *) curcol->column_data; blob->textvalue = tds_new(TDS_CHAR, size ? size : 1); tdsdump_log(TDS_DBG_FUNC, "blob parameter supported, size %d textvalue pointer is %p\n", size, blob->textvalue); if (!blob->textvalue) return NULL; memcpy(blob->textvalue, value, size); } curcol->column_cur_size = size; } else { tdsdump_log(TDS_DBG_FUNC, "paramrowalloc(): setting parameter #%d to NULL\n", param_num); curcol->column_cur_size = -1; } return (const unsigned char*) row; } /** * Allocate memory and copy the rpc information into a TDSPARAMINFO structure. */ static TDSPARAMINFO * paraminfoalloc(TDSSOCKET * tds, CS_PARAM * first_param) { int i; CS_PARAM *p; TDSCOLUMN *pcol; TDSPARAMINFO *params = NULL, *new_params; int temp_type; TDS_SERVER_TYPE tds_type; tdsdump_log(TDS_DBG_FUNC, "paraminfoalloc(%p, %p)\n", tds, first_param); /* sanity */ if (!first_param) return NULL; for (i = 0, p = first_param; p != NULL; p = p->next, i++) { const unsigned char *prow; CS_BYTE *temp_value = NULL; CS_INT temp_datalen = 0; if (!(new_params = tds_alloc_param_result(params))) goto memory_error; params = new_params; /* * The parameteter data has been passed by reference * i.e. using ct_setparam rather than ct_param */ temp_type = p->datatype; tds_type = _ct_get_server_type(tds, p->datatype); if (tds_type == TDS_INVALID_TYPE) goto type_error; if (p->param_by_value == 0) { /* * there are three ways to indicate null parameters * 1) *ind == -1 * 2) *datalen == 0 * 3) value, datalen and ind as NULL. Here value == NULL is * sufficient */ if (*(p->ind) != -1 && p->value != NULL && *(p->datalen) != 0) { /* datafmt.datalen is ignored for fixed length types */ if (is_fixed_type(tds_type)) { temp_datalen = tds_get_size_by_type(tds_type); } else { temp_datalen = (*(p->datalen) == CS_UNUSED) ? 0 : *(p->datalen); } temp_value = p->value; } } else { temp_value = p->value; temp_datalen = *(p->datalen); } if (temp_type == CS_VARCHAR_TYPE || temp_type == CS_VARBINARY_TYPE) { CS_VARCHAR *vc = (CS_VARCHAR *) temp_value; if (vc) { temp_datalen = vc->len; temp_value = (CS_BYTE *) vc->str; } } pcol = params->columns[i]; /* meta data */ if (p->name) if (!tds_dstr_copy(&pcol->column_name, p->name)) goto memory_error; tds_set_param_type(tds->conn, pcol, tds_type); if (temp_datalen == CS_NULLTERM && temp_value) temp_datalen = strlen((const char*) temp_value); pcol->column_prec = p->precision; pcol->column_scale = p->scale; if (pcol->column_varint_size) { if (p->maxlen < 0) { tds_free_param_results(params); return NULL; } pcol->on_server.column_size = pcol->column_size = p->maxlen; pcol->column_cur_size = temp_value ? temp_datalen : -1; if (temp_datalen > 0 && temp_datalen > p->maxlen) pcol->on_server.column_size = pcol->column_size = temp_datalen; } else { pcol->column_cur_size = pcol->column_size; } if (p->status == CS_RETURN) pcol->column_output = 1; else pcol->column_output = 0; /* actual data */ tdsdump_log(TDS_DBG_FUNC, "paraminfoalloc: status = %d, maxlen %d \n", p->status, p->maxlen); tdsdump_log(TDS_DBG_FUNC, "paraminfoalloc: name = %s, varint size %d " "column_type %d size %d, %d column_cur_size %d column_output = %d\n", tds_dstr_cstr(&pcol->column_name), pcol->column_varint_size, pcol->column_type, pcol->on_server.column_size, pcol->column_size, pcol->column_cur_size, pcol->column_output); prow = paramrowalloc(params, pcol, i, temp_value, temp_datalen); if (!prow) goto memory_error; } return params; memory_error: tdsdump_log(TDS_DBG_SEVERE, "out of memory for rpc!"); type_error: tds_free_param_results(params); return NULL; } static void rpc_clear(CSREMOTE_PROC * rpc) { tdsdump_log(TDS_DBG_FUNC, "rpc_clear(%p)\n", rpc); if (!rpc) return; param_clear(rpc->param_list); free(rpc->name); free(rpc); } /** * recursively erase the parameter list */ static void param_clear(CS_PARAM * pparam) { tdsdump_log(TDS_DBG_FUNC, "param_clear(%p)\n", pparam); if (!pparam) return; if (pparam->next) { param_clear(pparam->next); pparam->next = NULL; } /* free self after clearing children */ free(pparam->name); if (pparam->param_by_value) free(pparam->value); /* * DO NOT free datalen or ind, they are just pointer * to client data or private structure */ free(pparam); } /* RPC Code changes ends here */ static int _ct_fill_param(CS_INT cmd_type, CS_PARAM *param, CS_DATAFMT *datafmt, CS_VOID *data, CS_INT *datalen, CS_SMALLINT *indicator, CS_BYTE byvalue) { TDS_SERVER_TYPE desttype; tdsdump_log(TDS_DBG_FUNC, "_ct_fill_param(%d, %p, %p, %p, %p, %p, %x)\n", cmd_type, param, datafmt, data, datalen, indicator, byvalue); if (cmd_type == CS_DYNAMIC_CMD) { param->name = NULL; } else { if (datafmt->namelen == CS_NULLTERM) { param->name = strdup(datafmt->name); if (!param->name) return CS_FAIL; } else if (datafmt->namelen > 0) { param->name = tds_strndup(datafmt->name, datafmt->namelen); if (!param->name) return CS_FAIL; } else { param->name = NULL; } } param->status = datafmt->status; tdsdump_log(TDS_DBG_INFO1, " _ct_fill_param() status = %d \n", param->status); /* * translate datafmt.datatype, e.g. CS_SMALLINT_TYPE * to Server type, e.g. SYBINT2 */ desttype = _ct_get_server_type(NULL, datafmt->datatype); if (desttype == TDS_INVALID_TYPE) return CS_FAIL; param->datatype = datafmt->datatype; if (is_numeric_type(desttype)) { param->scale = datafmt->scale; param->precision = datafmt->precision; if (param->scale < 0 || param->precision < 0 || param->precision > MAXPRECISION || param->scale > param->precision) return CS_FAIL; } param->maxlen = datafmt->maxlength; if (is_fixed_type(desttype)) { param->maxlen = tds_get_size_by_type(desttype); } param->param_by_value = byvalue; if (byvalue) { param->datalen = ¶m->datalen_value; *(param->datalen) = *datalen; param->ind = ¶m->indicator_value; *(param->ind) = *indicator; /* * There are two ways to indicate a parameter with a null value: * - Pass indicator as -1. In this case, data and datalen are ignored. * - Pass data as NULL and datalen as 0 or CS_UNUSED */ if (*indicator == -1 || (!data && (*datalen == 0 || *datalen == CS_UNUSED))) { param->value = NULL; *(param->datalen) = 0; } else { /* datafmt.datalen is ignored for fixed length types */ if (is_fixed_type(desttype)) { *(param->datalen) = tds_get_size_by_type(desttype); } else { *(param->datalen) = (*datalen == CS_UNUSED) ? 0 : *datalen; } if (data) { if (*(param->datalen) == CS_NULLTERM) { tdsdump_log(TDS_DBG_INFO1, " _ct_fill_param() about to strdup string %u bytes long\n", (unsigned int) strlen((const char*) data)); *(param->datalen) = strlen((const char*) data); } else if (*(param->datalen) < 0) { return CS_FAIL; } param->value = tds_new(CS_BYTE, *(param->datalen) ? *(param->datalen) : 1); if (!param->value) return CS_FAIL; memcpy(param->value, data, *(param->datalen)); param->param_by_value = 1; } else { param->value = NULL; *(param->datalen) = 0; } } } else { /* not by value, i.e. by reference */ param->datalen = datalen; param->ind = indicator; param->value = (CS_BYTE*) data; } return CS_SUCCEED; } /* Code added for ct_diag implementation */ /* Code changes start here - CT_DIAG - 02*/ CS_RETCODE ct_diag(CS_CONNECTION * conn, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer) { tdsdump_log(TDS_DBG_FUNC, "ct_diag(%p, %d, %d, %d, %p)\n", conn, operation, type, idx, buffer); switch (operation) { case CS_INIT: if (conn->ctx->cs_errhandletype == _CS_ERRHAND_CB) { /* contrary to the manual page you don't seem to */ /* be able to turn on inline message handling */ /* using cs_diag, once a callback is installed! */ return CS_FAIL; } conn->ctx->cs_errhandletype = _CS_ERRHAND_INLINE; if (conn->ctx->cs_diag_msglimit_client == 0) conn->ctx->cs_diag_msglimit_client = CS_NO_LIMIT; if (conn->ctx->cs_diag_msglimit_server == 0) conn->ctx->cs_diag_msglimit_server = CS_NO_LIMIT; if (conn->ctx->cs_diag_msglimit_total == 0) conn->ctx->cs_diag_msglimit_total = CS_NO_LIMIT; conn->ctx->_clientmsg_cb = (CS_CLIENTMSG_FUNC) ct_diag_storeclientmsg; conn->ctx->_servermsg_cb = (CS_SERVERMSG_FUNC) ct_diag_storeservermsg; break; case CS_MSGLIMIT: if (conn->ctx->cs_errhandletype != _CS_ERRHAND_INLINE) return CS_FAIL; if (type == CS_CLIENTMSG_TYPE) conn->ctx->cs_diag_msglimit_client = *(CS_INT *) buffer; if (type == CS_SERVERMSG_TYPE) conn->ctx->cs_diag_msglimit_server = *(CS_INT *) buffer; if (type == CS_ALLMSG_TYPE) conn->ctx->cs_diag_msglimit_total = *(CS_INT *) buffer; break; case CS_CLEAR: if (conn->ctx->cs_errhandletype != _CS_ERRHAND_INLINE) return CS_FAIL; return _ct_diag_clearmsg(conn->ctx, type); break; case CS_GET: if (conn->ctx->cs_errhandletype != _CS_ERRHAND_INLINE) return CS_FAIL; if (!buffer) return CS_FAIL; if (type == CS_CLIENTMSG_TYPE) { if (idx == 0 || (conn->ctx->cs_diag_msglimit_client != CS_NO_LIMIT && idx > conn->ctx->cs_diag_msglimit_client)) return CS_FAIL; return (ct_diag_getclientmsg(conn->ctx, idx, (CS_CLIENTMSG *) buffer)); } if (type == CS_SERVERMSG_TYPE) { if (idx == 0 || (conn->ctx->cs_diag_msglimit_server != CS_NO_LIMIT && idx > conn->ctx->cs_diag_msglimit_server)) return CS_FAIL; return (ct_diag_getservermsg(conn->ctx, idx, (CS_SERVERMSG *) buffer)); } break; case CS_STATUS: if (conn->ctx->cs_errhandletype != _CS_ERRHAND_INLINE) return CS_FAIL; if (!buffer) return CS_FAIL; return (ct_diag_countmsg(conn->ctx, type, (CS_INT *) buffer)); break; } return CS_SUCCEED; } static CS_INT ct_diag_storeclientmsg(CS_CONTEXT * context, CS_CONNECTION * conn, CS_CLIENTMSG * message) { struct cs_diag_msg_client **curptr; struct cs_diag_msg_svr **scurptr; CS_INT msg_count = 0; tdsdump_log(TDS_DBG_FUNC, "ct_diag_storeclientmsg(%p, %p, %p)\n", context, conn, message); curptr = &(conn->ctx->clientstore); scurptr = &(conn->ctx->svrstore); /* if we already have a list of messages, go to the end of the list... */ while (*curptr != NULL) { msg_count++; curptr = &((*curptr)->next); } /* messages over and above the agreed limit */ /* are simply discarded... */ if (conn->ctx->cs_diag_msglimit_client != CS_NO_LIMIT && msg_count >= conn->ctx->cs_diag_msglimit_client) { return CS_FAIL; } /* messages over and above the agreed TOTAL limit */ /* are simply discarded */ if (conn->ctx->cs_diag_msglimit_total != CS_NO_LIMIT) { while (*scurptr != NULL) { msg_count++; scurptr = &((*scurptr)->next); } if (msg_count >= conn->ctx->cs_diag_msglimit_total) { return CS_FAIL; } } *curptr = tds_new(struct cs_diag_msg_client, 1); if (!*curptr) return CS_FAIL; (*curptr)->next = NULL; (*curptr)->clientmsg = tds_new(CS_CLIENTMSG, 1); if (!(*curptr)->clientmsg) return CS_FAIL; memcpy((*curptr)->clientmsg, message, sizeof(CS_CLIENTMSG)); return CS_SUCCEED; } static CS_INT ct_diag_storeservermsg(CS_CONTEXT * context, CS_CONNECTION * conn, CS_SERVERMSG * message) { struct cs_diag_msg_svr **curptr; struct cs_diag_msg_client **ccurptr; CS_INT msg_count = 0; tdsdump_log(TDS_DBG_FUNC, "ct_diag_storeservermsg(%p, %p, %p)\n", context, conn, message); curptr = &(conn->ctx->svrstore); ccurptr = &(conn->ctx->clientstore); /* if we already have a list of messages, go to the end of the list... */ while (*curptr != NULL) { msg_count++; curptr = &((*curptr)->next); } /* messages over and above the agreed limit */ /* are simply discarded... */ if (conn->ctx->cs_diag_msglimit_server != CS_NO_LIMIT && msg_count >= conn->ctx->cs_diag_msglimit_server) { return CS_FAIL; } /* messages over and above the agreed TOTAL limit */ /* are simply discarded... */ if (conn->ctx->cs_diag_msglimit_total != CS_NO_LIMIT) { while (*ccurptr != NULL) { msg_count++; ccurptr = &((*ccurptr)->next); } if (msg_count >= conn->ctx->cs_diag_msglimit_total) { return CS_FAIL; } } *curptr = tds_new(struct cs_diag_msg_svr, 1); if (!*curptr) return CS_FAIL; (*curptr)->next = NULL; (*curptr)->servermsg = tds_new(CS_SERVERMSG, 1); if (!(*curptr)->servermsg) return CS_FAIL; memcpy((*curptr)->servermsg, message, sizeof(CS_SERVERMSG)); return CS_SUCCEED; } static CS_INT ct_diag_getclientmsg(CS_CONTEXT * context, CS_INT idx, CS_CLIENTMSG * message) { struct cs_diag_msg_client *curptr; CS_INT msg_count = 0, msg_found = 0; tdsdump_log(TDS_DBG_FUNC, "ct_diag_getclientmsg(%p, %d, %p)\n", context, idx, message); curptr = context->clientstore; /* if we already have a list of messages, go to the end of the list... */ while (curptr != NULL) { msg_count++; if (msg_count == idx) { msg_found++; break; } curptr = curptr->next; } if (msg_found) { memcpy(message, curptr->clientmsg, sizeof(CS_CLIENTMSG)); return CS_SUCCEED; } return CS_NOMSG; } static CS_INT ct_diag_getservermsg(CS_CONTEXT * context, CS_INT idx, CS_SERVERMSG * message) { struct cs_diag_msg_svr *curptr; CS_INT msg_count = 0, msg_found = 0; tdsdump_log(TDS_DBG_FUNC, "ct_diag_getservermsg(%p, %d, %p)\n", context, idx, message); curptr = context->svrstore; /* if we already have a list of messages, go to the end of the list... */ while (curptr != NULL) { msg_count++; if (msg_count == idx) { msg_found++; break; } curptr = curptr->next; } if (msg_found) { memcpy(message, curptr->servermsg, sizeof(CS_SERVERMSG)); return CS_SUCCEED; } else { return CS_NOMSG; } } CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type) { struct cs_diag_msg_client *curptr, *freeptr; struct cs_diag_msg_svr *scurptr, *sfreeptr; tdsdump_log(TDS_DBG_FUNC, "_ct_diag_clearmsg(%p, %d)\n", context, type); if (type == CS_CLIENTMSG_TYPE || type == CS_ALLMSG_TYPE) { curptr = context->clientstore; context->clientstore = NULL; while (curptr != NULL) { freeptr = curptr; curptr = freeptr->next; free(freeptr->clientmsg); free(freeptr); } } if (type == CS_SERVERMSG_TYPE || type == CS_ALLMSG_TYPE) { scurptr = context->svrstore; context->svrstore = NULL; while (scurptr != NULL) { sfreeptr = scurptr; scurptr = sfreeptr->next; free(sfreeptr->servermsg); free(sfreeptr); } } return CS_SUCCEED; } static CS_INT ct_diag_countmsg(CS_CONTEXT * context, CS_INT type, CS_INT * count) { struct cs_diag_msg_client *curptr; struct cs_diag_msg_svr *scurptr; CS_INT msg_count = 0; tdsdump_log(TDS_DBG_FUNC, "ct_diag_countmsg(%p, %d, %p)\n", context, type, count); if (type == CS_CLIENTMSG_TYPE || type == CS_ALLMSG_TYPE) { curptr = context->clientstore; while (curptr != NULL) { msg_count++; curptr = curptr->next; } } if (type == CS_SERVERMSG_TYPE || type == CS_ALLMSG_TYPE) { scurptr = context->svrstore; while (scurptr != NULL) { msg_count++; scurptr = scurptr->next; } } *count = msg_count; return CS_SUCCEED; } /* Code changes ends here - CT_DIAG - 02*/ static CS_DYNAMIC * _ct_allocate_dynamic(CS_CONNECTION * con, char *id, int idlen) { CS_DYNAMIC *dyn; CS_DYNAMIC **pdyn; int id_len; tdsdump_log(TDS_DBG_FUNC, "_ct_allocate_dynamic(%p, %p, %d)\n", con, id, idlen); dyn = tds_new0(CS_DYNAMIC, 1); if (idlen == CS_NULLTERM) id_len = strlen(id); else id_len = idlen; if (dyn != NULL) { dyn->id = tds_strndup(id, id_len); if (!con->dynlist) { tdsdump_log(TDS_DBG_INFO1, "_ct_allocate_dynamic() attaching dynamic command to head\n"); con->dynlist = dyn; } else { pdyn = &con->dynlist; while (*pdyn) { pdyn = &(*pdyn)->next; } *pdyn = dyn; } } return (dyn); } static CS_DYNAMIC * _ct_locate_dynamic(CS_CONNECTION * con, char *id, int idlen) { CS_DYNAMIC *dyn; int id_len; tdsdump_log(TDS_DBG_FUNC, "_ct_locate_dynamic(%p, %p, %d)\n", con, id, idlen); if (idlen == CS_NULLTERM) id_len = strlen(id); else id_len = idlen; tdsdump_log(TDS_DBG_INFO1, "_ct_locate_dynamic() looking for %s\n", (char *) id); for (dyn = con->dynlist; dyn != NULL; dyn = dyn->next) { tdsdump_log(TDS_DBG_INFO1, "_ct_locate_dynamic() matching with %s\n", (char *) dyn->id); if (strncmp(dyn->id, id, id_len) == 0) break; } return (dyn); } static CS_INT _ct_deallocate_dynamic(CS_CONNECTION * con, CS_DYNAMIC *dyn) { CS_DYNAMIC **pvictim; tdsdump_log(TDS_DBG_FUNC, "_ct_deallocate_dynamic(%p, %p)\n", con, dyn); if (!dyn) return CS_SUCCEED; pvictim = &con->dynlist; for (; *pvictim != dyn;) { if (!*pvictim) { tdsdump_log(TDS_DBG_FUNC, "ct_deallocate_dynamic() : cannot find entry in list\n"); return CS_FAIL; } pvictim = &(*pvictim)->next; } /* detach node */ tdsdump_log(TDS_DBG_FUNC, "ct_deallocate_dynamic() : relinking list\n"); *pvictim = dyn->next; dyn->next = NULL; tdsdump_log(TDS_DBG_FUNC, "ct_deallocate_dynamic() : relinked list\n"); /* free dynamic */ tds_release_dynamic(&dyn->tdsdyn); free(dyn->id); free(dyn->stmt); param_clear(dyn->param_list); free(dyn); return CS_SUCCEED; } static CS_INT _ct_map_compute_op(CS_INT comp_op) { switch (comp_op) { case SYBAOPCNT: case SYBAOPCNTU: case SYBAOPCNT_BIG: return CS_OP_COUNT; case SYBAOPSUM: case SYBAOPSUMU: return CS_OP_SUM; case SYBAOPAVG: case SYBAOPAVGU: return CS_OP_AVG; case SYBAOPMIN: return CS_OP_MIN; case SYBAOPMAX: return CS_OP_MAX; } return comp_op; } freetds-1.3.6/src/ctlib/cs.c000644 025423 025423 00000103010 14056414271 017237 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "cspublic.h" #include "ctlib.h" #undef cs_dt_crack static CS_INT cs_diag_storemsg(CS_CONTEXT *context, CS_CLIENTMSG *message); static CS_INT cs_diag_clearmsg(CS_CONTEXT *context, CS_INT type); static CS_INT cs_diag_getmsg(CS_CONTEXT *context, CS_INT idx, CS_CLIENTMSG *message); static CS_INT cs_diag_countmsg(CS_CONTEXT *context, CS_INT *count); const char * cs_prretcode(int retcode) { static char unknown[24]; tdsdump_log(TDS_DBG_FUNC, "cs_prretcode(%d)\n", retcode); switch(retcode) { case CS_SUCCEED: return "CS_SUCCEED"; case CS_FAIL: return "CS_FAIL"; case CS_MEM_ERROR: return "CS_MEM_ERROR"; case CS_PENDING: return "CS_PENDING"; case CS_QUIET: return "CS_QUIET"; case CS_BUSY: return "CS_BUSY"; case CS_INTERRUPT: return "CS_INTERRUPT"; case CS_BLK_HAS_TEXT: return "CS_BLK_HAS_TEXT"; case CS_CONTINUE: return "CS_CONTINUE"; case CS_FATAL: return "CS_FATAL"; case CS_RET_HAFAILOVER: return "CS_RET_HAFAILOVER"; case CS_UNSUPPORTED: return "CS_UNSUPPORTED"; case CS_CANCELED: return "CS_CANCELED"; case CS_ROW_FAIL: return "CS_ROW_FAIL"; case CS_END_DATA: return "CS_END_DATA"; case CS_END_RESULTS: return "CS_END_RESULTS"; case CS_END_ITEM: return "CS_END_ITEM"; case CS_NOMSG: return "CS_NOMSG"; case CS_TIMED_OUT: return "CS_TIMED_OUT"; default: sprintf(unknown, "oops: %u ??", retcode); } return unknown; } static const char * _cs_get_layer(int layer) { tdsdump_log(TDS_DBG_FUNC, "_cs_get_layer(%d)\n", layer); switch (layer) { case 2: return "cslib user api layer"; break; default: break; } return "unrecognized layer"; } static const char * _cs_get_origin(int origin) { tdsdump_log(TDS_DBG_FUNC, "_cs_get_origin(%d)\n", origin); switch (origin) { case 1: return "external error"; break; case 2: return "internal CS-Library error"; break; case 4: return "common library error"; break; case 5: return "intl library error"; break; default: break; } return "unrecognized origin"; } static const char * _cs_get_user_api_layer_error(int error) { tdsdump_log(TDS_DBG_FUNC, "_cs_get_user_api_layer_error(%d)\n", error); switch (error) { case 3: return "Memory allocation failure."; break; case 16: return "Conversion between %1! and %2! datatypes is not supported."; break; case 20: return "The conversion/operation resulted in overflow."; break; case 24: return "The conversion/operation was stopped due to a syntax error in the source field."; break; default: break; } return "unrecognized error"; } static char * _cs_get_msgstr(const char *funcname, int layer, int origin, int severity, int number) { char *m; tdsdump_log(TDS_DBG_FUNC, "_cs_get_msgstr(%s, %d, %d, %d, %d)\n", funcname, layer, origin, severity, number); if (asprintf(&m, "%s: %s: %s: %s", funcname, _cs_get_layer(layer), _cs_get_origin(origin), (layer == 2) ? _cs_get_user_api_layer_error(number) : "unrecognized error") < 0) { return NULL; } return m; } static void _csclient_msg(CS_CONTEXT * ctx, const char *funcname, int layer, int origin, int severity, int number, const char *fmt, ...) { va_list ap; CS_CLIENTMSG cm; char *msgstr; tdsdump_log(TDS_DBG_FUNC, "_csclient_msg(%p, %s, %d, %d, %d, %d, %s)\n", ctx, funcname, layer, origin, severity, number, fmt); va_start(ap, fmt); if (ctx->_cslibmsg_cb) { cm.severity = severity; cm.msgnumber = (((layer << 24) & 0xFF000000) | ((origin << 16) & 0x00FF0000) | ((severity << 8) & 0x0000FF00) | ((number) & 0x000000FF)); msgstr = _cs_get_msgstr(funcname, layer, origin, severity, number); tds_vstrbuild(cm.msgstring, CS_MAX_MSG, &(cm.msgstringlen), msgstr, CS_NULLTERM, fmt, CS_NULLTERM, ap); cm.msgstring[cm.msgstringlen] = '\0'; free(msgstr); cm.osnumber = 0; cm.osstring[0] = '\0'; cm.osstringlen = 0; cm.status = 0; /* cm.sqlstate */ cm.sqlstatelen = 0; ctx->_cslibmsg_cb(ctx, &cm); } va_end(ap); } /** * Allocate new CS_LOCALE and initialize it * returns NULL on out of memory errors */ static CS_LOCALE * _cs_locale_alloc(void) { tdsdump_log(TDS_DBG_FUNC, "_cs_locale_alloc()\n"); return tds_new0(CS_LOCALE, 1); } static void _cs_locale_free_contents(CS_LOCALE *locale) { tdsdump_log(TDS_DBG_FUNC, "_cs_locale_free_contents(%p)\n", locale); /* free strings */ free(locale->language); locale->language = NULL; free(locale->charset); locale->charset = NULL; free(locale->time); locale->time = NULL; free(locale->collate); locale->collate = NULL; } void _cs_locale_free(CS_LOCALE *locale) { tdsdump_log(TDS_DBG_FUNC, "_cs_locale_free(%p)\n", locale); /* free contents */ _cs_locale_free_contents(locale); /* free the data structure */ free(locale); } /* returns 0 on out of memory errors, 1 for OK */ int _cs_locale_copy_inplace(CS_LOCALE *new_locale, CS_LOCALE *orig) { tdsdump_log(TDS_DBG_FUNC, "_cs_locale_copy_inplace(%p, %p)\n", new_locale, orig); _cs_locale_free_contents(new_locale); if (orig->language) { new_locale->language = strdup(orig->language); if (!new_locale->language) goto Cleanup; } if (orig->charset) { new_locale->charset = strdup(orig->charset); if (!new_locale->charset) goto Cleanup; } if (orig->time) { new_locale->time = strdup(orig->time); if (!new_locale->time) goto Cleanup; } if (orig->collate) { new_locale->collate = strdup(orig->collate); if (!new_locale->collate) goto Cleanup; } return 1; Cleanup: _cs_locale_free_contents(new_locale); return 0; } /* returns NULL on out of memory errors */ CS_LOCALE * _cs_locale_copy(CS_LOCALE *orig) { CS_LOCALE *new_locale; tdsdump_log(TDS_DBG_FUNC, "_cs_locale_copy(%p)\n", orig); new_locale = _cs_locale_alloc(); if (!new_locale) return NULL; if (orig->language) { new_locale->language = strdup(orig->language); if (!new_locale->language) goto Cleanup; } if (orig->charset) { new_locale->charset = strdup(orig->charset); if (!new_locale->charset) goto Cleanup; } if (orig->time) { new_locale->time = strdup(orig->time); if (!new_locale->time) goto Cleanup; } if (orig->collate) { new_locale->collate = strdup(orig->collate); if (!new_locale->collate) goto Cleanup; } return new_locale; Cleanup: _cs_locale_free(new_locale); return NULL; } CS_RETCODE cs_ctx_alloc(CS_INT version, CS_CONTEXT ** ctx) { TDSCONTEXT *tds_ctx; tdsdump_log(TDS_DBG_FUNC, "cs_ctx_alloc(%d, %p)\n", version, ctx); *ctx = tds_new0(CS_CONTEXT, 1); tds_ctx = tds_alloc_context(*ctx); if (!tds_ctx) { free(*ctx); return CS_FAIL; } (*ctx)->tds_ctx = tds_ctx; if (tds_ctx->locale && !tds_ctx->locale->date_fmt) { /* set default in case there's no locale file */ tds_ctx->locale->date_fmt = strdup(STD_DATETIME_FMT); } (*ctx)->login_timeout = -1; (*ctx)->query_timeout = -1; return CS_SUCCEED; } CS_RETCODE cs_ctx_global(CS_INT version, CS_CONTEXT ** ctx) { static CS_CONTEXT *global_cs_ctx = NULL; tdsdump_log(TDS_DBG_FUNC, "cs_ctx_global(%d, %p)\n", version, ctx); if (global_cs_ctx != NULL) { *ctx = global_cs_ctx; return CS_SUCCEED; } if (cs_ctx_alloc(version, ctx) != CS_SUCCEED) { return CS_FAIL; } global_cs_ctx = *ctx; return CS_SUCCEED; } CS_RETCODE cs_ctx_drop(CS_CONTEXT * ctx) { tdsdump_log(TDS_DBG_FUNC, "cs_ctx_drop(%p)\n", ctx); if (ctx) { _ct_diag_clearmsg(ctx, CS_ALLMSG_TYPE); free(ctx->userdata); if (ctx->tds_ctx) tds_free_context(ctx->tds_ctx); free(ctx); } return CS_SUCCEED; } CS_RETCODE cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { CS_INT maxcp; /* declared for - CS_USERDATA changes - swapna*/ tdsdump_log(TDS_DBG_FUNC, "cs_config(%p, %d, %d, %p, %d, %p)\n", ctx, action, property, buffer, buflen, outlen); if (action == CS_GET) { if (buffer == NULL) { return CS_SUCCEED; } switch (property) { case CS_MESSAGE_CB: *(void **) buffer = (void*) ctx->_cslibmsg_cb; return CS_SUCCEED; case CS_USERDATA: maxcp = ctx->userdata_len; if (outlen) *outlen = maxcp; if (maxcp > buflen) maxcp = buflen; memcpy(buffer, ctx->userdata, maxcp); return CS_SUCCEED; case CS_EXTRA_INF: case CS_LOC_PROP: case CS_VERSION: return CS_FAIL; break; } } if (action == CS_SET) { switch (property) { case CS_MESSAGE_CB: if ( ctx->cs_errhandletype == _CS_ERRHAND_INLINE) { cs_diag_clearmsg(ctx, CS_UNUSED); } ctx->_cslibmsg_cb = (CS_CSLIBMSG_FUNC) buffer; ctx->cs_errhandletype = _CS_ERRHAND_CB; return CS_SUCCEED; case CS_USERDATA: free(ctx->userdata); if (buflen == CS_NULLTERM) { maxcp = strlen((char*) buffer) + 1; } else { maxcp = buflen; } ctx->userdata = (void *) malloc(maxcp); if ( ctx->userdata == NULL) { return CS_FAIL; } ctx->userdata_len = maxcp; if (buffer) { memcpy(ctx->userdata, buffer, maxcp); } else { return CS_FAIL; } return CS_SUCCEED; case CS_EXTRA_INF: case CS_LOC_PROP: case CS_VERSION: return CS_FAIL; break; } } if (action == CS_CLEAR) { switch (property) { case CS_MESSAGE_CB: if ( ctx->cs_errhandletype == _CS_ERRHAND_INLINE) { cs_diag_clearmsg(ctx, CS_UNUSED); } ctx->_cslibmsg_cb = NULL; ctx->cs_errhandletype = 0; return CS_SUCCEED; case CS_USERDATA: free(ctx->userdata); ctx->userdata = NULL; return CS_SUCCEED; case CS_EXTRA_INF: case CS_LOC_PROP: case CS_VERSION: return CS_FAIL; break; } } return CS_FAIL; } CS_RETCODE cs_convert(CS_CONTEXT * ctx, CS_DATAFMT * srcfmt, CS_VOID * srcdata, CS_DATAFMT * destfmt, CS_VOID * destdata, CS_INT * resultlen) { TDS_SERVER_TYPE src_type, desttype; int src_len, destlen, len; CONV_RESULT cres; unsigned char *dest; CS_RETCODE ret; CS_INT dummy; CS_VARCHAR *destvc = NULL; tdsdump_log(TDS_DBG_FUNC, "cs_convert(%p, %p, %p, %p, %p, %p)\n", ctx, srcfmt, srcdata, destfmt, destdata, resultlen); /* If destination is NULL we have a problem */ if (destdata == NULL) { /* TODO: add error message */ tdsdump_log(TDS_DBG_FUNC, "error: destdata is null\n"); return CS_FAIL; } /* If destfmt is NULL we have a problem */ if (destfmt == NULL) { /* TODO: add error message */ tdsdump_log(TDS_DBG_FUNC, "error: destfmt is null\n"); return CS_FAIL; } if (resultlen == NULL) resultlen = &dummy; /* If source is indicated to be NULL, set dest to low values */ if (srcdata == NULL) { /* TODO: implement cs_setnull */ tdsdump_log(TDS_DBG_FUNC, "srcdata is null\n"); memset(destdata, '\0', destfmt->maxlength); *resultlen = 0; return CS_SUCCEED; } src_type = _ct_get_server_type(NULL, srcfmt->datatype); if (src_type == TDS_INVALID_TYPE) return CS_FAIL; src_len = srcfmt->maxlength; if (srcfmt->datatype == CS_VARCHAR_TYPE || srcfmt->datatype == CS_VARBINARY_TYPE) { CS_VARCHAR *vc = (CS_VARCHAR *) srcdata; src_len = vc->len; srcdata = vc->str; } desttype = _ct_get_server_type(NULL, destfmt->datatype); if (desttype == TDS_INVALID_TYPE) return CS_FAIL; destlen = destfmt->maxlength; if (destfmt->datatype == CS_VARCHAR_TYPE || destfmt->datatype == CS_VARBINARY_TYPE) { destvc = (CS_VARCHAR *) destdata; destlen = sizeof(destvc->str); destdata = destvc->str; } else if (is_numeric_type(desttype)) { destlen = sizeof(TDS_NUMERIC); } tdsdump_log(TDS_DBG_FUNC, "converting type %d (%d bytes) to type = %d (%d bytes)\n", src_type, src_len, desttype, destlen); if (!is_fixed_type(desttype) && (destlen <= 0)) { return CS_FAIL; } dest = (unsigned char *) destdata; /* many times we are asked to convert a data type to itself */ if (src_type == desttype) { int minlen = src_len < destlen? src_len : destlen; tdsdump_log(TDS_DBG_FUNC, "cs_convert() srctype == desttype\n"); switch (desttype) { case SYBLONGBINARY: case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: memcpy(dest, srcdata, src_len); *resultlen = src_len; if (src_len > destlen) { tdsdump_log(TDS_DBG_FUNC, "error: src_len > destlen\n"); ret = CS_FAIL; } else { switch (destfmt->format) { case CS_FMT_PADNULL: memset(dest + src_len, '\0', destlen - src_len); *resultlen = destlen; /* fall through */ case CS_FMT_UNUSED: ret = CS_SUCCEED; break; default: ret = CS_FAIL; break; } } if (destvc) { destvc->len = minlen; *resultlen = sizeof(*destvc); } break; case SYBCHAR: case SYBVARCHAR: case SYBTEXT: tdsdump_log(TDS_DBG_FUNC, "cs_convert() desttype = character\n"); memcpy(dest, srcdata, minlen); *resultlen = minlen; if (src_len > destlen) { tdsdump_log(TDS_DBG_FUNC, "error: src_len > destlen\n"); ret = CS_FAIL; } else { switch (destfmt->format) { case CS_FMT_NULLTERM: if (src_len == destlen) { *resultlen = src_len; tdsdump_log(TDS_DBG_FUNC, "error: no room for null terminator\n"); ret = CS_FAIL; } else { dest[src_len] = '\0'; *resultlen = src_len + 1; ret = CS_SUCCEED; } break; case CS_FMT_PADBLANK: memset(dest + src_len, ' ', destlen - src_len); *resultlen = destlen; ret = CS_SUCCEED; break; case CS_FMT_PADNULL: memset(dest + src_len, '\0', destlen - src_len); *resultlen = destlen; ret = CS_SUCCEED; break; case CS_FMT_UNUSED: ret = CS_SUCCEED; break; default: tdsdump_log(TDS_DBG_FUNC, "no destination format specified!\n"); ret = CS_FAIL; break; } } if (destvc) { destvc->len = minlen; *resultlen = sizeof(*destvc); } break; case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBUINT4: case SYBINT8: case SYBUINT8: case SYBFLT8: case SYBREAL: case SYBBIT: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBTIME: case SYBDATE: case SYB5BIGDATETIME: case SYB5BIGTIME: *resultlen = tds_get_size_by_type(src_type); if (*resultlen > 0) memcpy(dest, srcdata, *resultlen); ret = CS_SUCCEED; break; case SYBNUMERIC: case SYBDECIMAL: src_len = tds_numeric_bytes_per_prec[((TDS_NUMERIC *) srcdata)->precision] + 2; case SYBBITN: case SYBUNIQUE: memcpy(dest, srcdata, minlen); *resultlen = minlen; if (src_len > destlen) { tdsdump_log(TDS_DBG_FUNC, "error: src_len > destlen\n"); ret = CS_FAIL; } else { ret = CS_SUCCEED; } break; default: tdsdump_log(TDS_DBG_FUNC, "error: unrecognized type\n"); ret = CS_FAIL; break; } tdsdump_log(TDS_DBG_FUNC, "cs_convert() returning %s\n", cs_prretcode(ret)); return ret; } assert(src_type != desttype); /* set the output precision/scale for conversions to numeric type */ if (is_numeric_type(desttype)) { cres.n.precision = destfmt->precision; cres.n.scale = destfmt->scale; if (destfmt->precision == CS_SRC_VALUE) cres.n.precision = srcfmt->precision; if (destfmt->scale == CS_SRC_VALUE) cres.n.scale = srcfmt->scale; } tdsdump_log(TDS_DBG_FUNC, "cs_convert() calling tds_convert\n"); len = tds_convert(ctx->tds_ctx, src_type, srcdata, src_len, desttype, &cres); tdsdump_log(TDS_DBG_FUNC, "cs_convert() tds_convert returned %d\n", len); switch (len) { case TDS_CONVERT_NOAVAIL: _csclient_msg(ctx, "cs_convert", 2, 1, 1, 16, "%d, %d", src_type, desttype); return CS_FAIL; break; case TDS_CONVERT_SYNTAX: _csclient_msg(ctx, "cs_convert", 2, 4, 1, 24, ""); return CS_FAIL; break; case TDS_CONVERT_NOMEM: _csclient_msg(ctx, "cs_convert", 2, 4, 1, 3, ""); return CS_FAIL; break; case TDS_CONVERT_OVERFLOW: _csclient_msg(ctx, "cs_convert", 2, 4, 1, 20, ""); return CS_FAIL; break; case TDS_CONVERT_FAIL: return CS_FAIL; break; default: if (len < 0) { return CS_FAIL; } break; } switch (desttype) { case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: ret = CS_SUCCEED; if (len > destlen) { tdsdump_log(TDS_DBG_FUNC, "error_handler: Data-conversion resulted in overflow\n"); ret = CS_FAIL; len = destlen; } memcpy(dest, cres.ib, len); free(cres.ib); *resultlen = destlen; if (destvc) { destvc->len = len; *resultlen = sizeof(*destvc); } memset(dest + len, '\0', destlen - len); break; case SYBBIT: case SYBBITN: /* fall trough, act same way of TINYINT */ case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBUINT4: case SYBINT8: case SYBUINT8: case SYBFLT8: case SYBREAL: case SYBMONEY: case SYBMONEY4: case SYBDATETIME: case SYBDATETIME4: case SYBTIME: case SYBDATE: case SYBUNIQUE: case SYB5BIGDATETIME: case SYB5BIGTIME: *resultlen = tds_get_size_by_type(desttype); memcpy(dest, &(cres.ti), *resultlen); ret = CS_SUCCEED; break; case SYBNUMERIC: case SYBDECIMAL: src_len = tds_numeric_bytes_per_prec[cres.n.precision] + 2; memcpy(dest, &(cres.n), src_len); *resultlen = src_len; ret = CS_SUCCEED; break; case SYBCHAR: case SYBVARCHAR: case SYBTEXT: ret = CS_SUCCEED; if (len > destlen) { tdsdump_log(TDS_DBG_FUNC, "Data-conversion resulted in overflow\n"); len = destlen; ret = CS_FAIL; } switch (destfmt->format) { case CS_FMT_NULLTERM: tdsdump_log(TDS_DBG_FUNC, "cs_convert() FMT_NULLTERM\n"); if (len == destlen) { tdsdump_log(TDS_DBG_FUNC, "not enough room for data + a null terminator - error\n"); ret = CS_FAIL; /* not enough room for data + a null terminator - error */ } else { memcpy(dest, cres.c, len); dest[len] = 0; *resultlen = len + 1; } break; case CS_FMT_PADBLANK: tdsdump_log(TDS_DBG_FUNC, "cs_convert() FMT_PADBLANK\n"); /* strcpy here can lead to a small buffer overflow */ memcpy(dest, cres.c, len); memset(dest + len, ' ', destlen - len); *resultlen = destlen; break; case CS_FMT_PADNULL: tdsdump_log(TDS_DBG_FUNC, "cs_convert() FMT_PADNULL\n"); /* strcpy here can lead to a small buffer overflow */ memcpy(dest, cres.c, len); memset(dest + len, '\0', destlen - len); *resultlen = destlen; break; case CS_FMT_UNUSED: tdsdump_log(TDS_DBG_FUNC, "cs_convert() FMT_UNUSED\n"); memcpy(dest, cres.c, len); *resultlen = len; break; default: ret = CS_FAIL; break; } if (destvc) { destvc->len = len; *resultlen = sizeof(*destvc); } free(cres.c); break; default: ret = CS_FAIL; break; } tdsdump_log(TDS_DBG_FUNC, "cs_convert() returning %s\n", cs_prretcode(ret)); return (ret); } CS_RETCODE cs_dt_crack_v2(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec) { TDSDATEREC dr; TDS_INT tds_type; bool extended = false; tdsdump_log(TDS_DBG_FUNC, "cs_dt_crack_v2(%p, %d, %p, %p)\n", ctx, datetype, dateval, daterec); switch (datetype) { case CS_DATETIME_TYPE: tds_type = SYBDATETIME; break; case CS_DATETIME4_TYPE: tds_type = SYBDATETIME4; break; case CS_DATE_TYPE: tds_type = SYBDATE; break; case CS_TIME_TYPE: tds_type = SYBTIME; break; case CS_BIGDATETIME_TYPE: tds_type = SYB5BIGDATETIME; extended = true; break; case CS_BIGTIME_TYPE: tds_type = SYB5BIGTIME; extended = true; break; default: return CS_FAIL; } tds_datecrack(tds_type, dateval, &dr); /* Sybase CT-Library does not set these fields for CS_BIGTIME_TYPE */ if (tds_type != SYB5BIGTIME) { daterec->dateyear = dr.year; daterec->datemonth = dr.month; daterec->datedmonth = dr.day; daterec->datedyear = dr.dayofyear; daterec->datedweek = dr.weekday; } daterec->datehour = dr.hour; daterec->dateminute = dr.minute; daterec->datesecond = dr.second; daterec->datemsecond = dr.decimicrosecond / 10000u; daterec->datetzone = 0; if (extended) { daterec->datesecfrac = dr.decimicrosecond / 10u; daterec->datesecprec = 1000000; } return CS_SUCCEED; } CS_RETCODE cs_dt_crack(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec) { tdsdump_log(TDS_DBG_FUNC, "cs_dt_crack(%p, %d, %p, %p)\n", ctx, datetype, dateval, daterec); if (datetype != CS_BIGDATETIME_TYPE && datetype != CS_BIGTIME_TYPE) return cs_dt_crack_v2(ctx, datetype, dateval, daterec); return CS_FAIL; } CS_RETCODE cs_loc_alloc(CS_CONTEXT * ctx, CS_LOCALE ** locptr) { CS_LOCALE *tds_csloc; tdsdump_log(TDS_DBG_FUNC, "cs_loc_alloc(%p, %p)\n", ctx, locptr); tds_csloc = _cs_locale_alloc(); if (!tds_csloc) return CS_FAIL; *locptr = tds_csloc; return CS_SUCCEED; } CS_RETCODE cs_loc_drop(CS_CONTEXT * ctx, CS_LOCALE * locale) { tdsdump_log(TDS_DBG_FUNC, "cs_loc_drop(%p, %p)\n", ctx, locale); if (!locale) return CS_FAIL; _cs_locale_free(locale); return CS_SUCCEED; } CS_RETCODE cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { CS_RETCODE code = CS_FAIL; tdsdump_log(TDS_DBG_FUNC, "cs_locale(%p, %d, %p, %d, %p, %d, %p)\n", ctx, action, locale, type, buffer, buflen, outlen); if (action == CS_SET) { switch (type) { case CS_LC_ALL: /* what to do here if there is locale data? */ if (!buffer) { code = CS_SUCCEED; } break; case CS_SYB_CHARSET: if (buflen == CS_NULLTERM) { buflen = strlen((char *)buffer); } free(locale->charset); locale->charset = tds_strndup(buffer, buflen); if (!locale->charset) break; code = CS_SUCCEED; break; case CS_SYB_LANG: if (buflen == CS_NULLTERM) { buflen = strlen((char *)buffer); } free(locale->language); locale->language = tds_strndup(buffer, buflen); if (!locale->language) break; code = CS_SUCCEED; break; case CS_SYB_LANG_CHARSET: { int i; char *b = (char *)buffer; if (buflen == CS_NULLTERM) { buflen = strlen(b); } /* find '.' character */ for (i = 0; i < buflen; ++i) { if (b[i] == '.') { break; } } /* not found */ if (i == buflen) { break; } if (i) { free(locale->language); locale->language = tds_strndup(b, i); if (!locale->language) break; } if (i != (buflen - 1)) { free(locale->charset); locale->charset = tds_strndup(b + i + 1, buflen - i - 1); if (!locale->charset) break; } code = CS_SUCCEED; break; } /* TODO commented out until the code works end-to-end case CS_SYB_SORTORDER: if (buflen == CS_NULLTERM) { buflen = strlen((char *)buffer); } free(locale->collate); locale->collate = tds_strndup(buffer, buflen); if (!locale->collate) break; code = CS_SUCCEED; break; */ } } else if (action == CS_GET) { int tlen; switch (type) { case CS_SYB_CHARSET: tlen = (locale->charset ? strlen(locale->charset) : 0) + 1; if (buflen < tlen) { if (outlen) *outlen = tlen; break; } if (locale->charset) strcpy((char *)buffer, locale->charset); else ((char *)buffer)[0] = '\0'; code = CS_SUCCEED; break; case CS_SYB_LANG: tlen = (locale->language ? strlen(locale->language) : 0) + 1; if (buflen < tlen) { if (outlen) *outlen = tlen; break; } if (locale->language) strcpy((char *)buffer, locale->language); else ((char *)buffer)[0] = '\0'; code = CS_SUCCEED; break; case CS_SYB_LANG_CHARSET: { int clen; tlen = (locale->language ? strlen(locale->language) : 0) + 1; clen = (locale->charset ? strlen(locale->charset) : 0) + 1; if (buflen < (tlen + clen)) { if (outlen) *outlen = tlen + clen; break; } if (locale->language) strcpy((char *)buffer, locale->language); else ((char *)buffer)[0] = '\0'; strcat((char *)buffer, "."); if (locale->charset) { tlen = strlen((char *)buffer); strcpy((char *)buffer + tlen, locale->charset); } code = CS_SUCCEED; break; } case CS_SYB_SORTORDER: tlen = (locale->collate ? strlen(locale->collate) : 0) + 1; if (buflen < tlen) { if (outlen) *outlen = tlen; break; } if (locale->collate) strcpy((char *)buffer, locale->collate); else ((char *)buffer)[0] = '\0'; code = CS_SUCCEED; break; } } return code; } CS_RETCODE cs_dt_info(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_INT item, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { tdsdump_log(TDS_DBG_FUNC, "cs_dt_info(%p, %d, %p, %d, %d, %p, %d, %p)\n", ctx, action, locale, type, item, buffer, buflen, outlen); if (action == CS_SET) { switch (type) { case CS_DT_CONVFMT: break; } } return CS_SUCCEED; } CS_RETCODE cs_strbuild(CS_CONTEXT * ctx, CS_CHAR * buffer, CS_INT buflen, CS_INT * resultlen, CS_CHAR * text, CS_INT textlen, CS_CHAR * formats, CS_INT formatlen, ...) { va_list ap; TDSRET rc; tdsdump_log(TDS_DBG_FUNC, "cs_strbuild(%p, %p, %d, %p, %p, %d, %p, %d)\n", ctx, buffer, buflen, resultlen, text, textlen, formats, formatlen); va_start(ap, formatlen); rc = tds_vstrbuild(buffer, buflen, resultlen, text, textlen, formats, formatlen, ap); va_end(ap); return TDS_SUCCEED(rc) ? CS_SUCCEED : CS_FAIL; } CS_RETCODE cs_calc(CS_CONTEXT * ctx, CS_INT op, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_VOID * dest) { tdsdump_log(TDS_DBG_FUNC, "cs_calc(%p, %d, %d, %p, %p, %p)\n", ctx, op, datatype, var1, var2, dest); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_calc()\n"); return CS_FAIL; } CS_RETCODE cs_cmp(CS_CONTEXT * ctx, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_INT * result) { tdsdump_log(TDS_DBG_FUNC, "cs_cmp(%p, %d, %p, %p, %p)\n", ctx, datatype, var1, var2, result); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_cmp()\n"); return CS_FAIL; } CS_RETCODE cs_conv_mult(CS_CONTEXT * ctx, CS_LOCALE * srcloc, CS_LOCALE * destloc, CS_INT * conv_multiplier) { tdsdump_log(TDS_DBG_FUNC, "cs_conv_mult(%p, %p, %p, %p)\n", ctx, srcloc, destloc, conv_multiplier); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_conv_mult()\n"); return CS_FAIL; } CS_RETCODE cs_diag(CS_CONTEXT * ctx, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer) { tdsdump_log(TDS_DBG_FUNC, "cs_diag(%p, %d, %d, %d, %p)\n", ctx, operation, type, idx, buffer); switch (operation) { case CS_INIT: if ( ctx->cs_errhandletype == _CS_ERRHAND_CB) { /* contrary to the manual page you don't seem to */ /* be able to turn on inline message handling */ /* using cs_diag, once a callback is installed! */ return CS_FAIL; } ctx->cs_errhandletype = _CS_ERRHAND_INLINE; ctx->cs_diag_msglimit = CS_NO_LIMIT; ctx->_cslibmsg_cb = (CS_CSLIBMSG_FUNC) cs_diag_storemsg; break; case CS_MSGLIMIT: if ( ctx->cs_errhandletype != _CS_ERRHAND_INLINE) { return CS_FAIL; } ctx->cs_diag_msglimit = *(CS_INT *)buffer; break; case CS_CLEAR: if ( ctx->cs_errhandletype != _CS_ERRHAND_INLINE) { return CS_FAIL; } return (cs_diag_clearmsg(ctx, type)); break; case CS_GET: if ( ctx->cs_errhandletype != _CS_ERRHAND_INLINE) { return CS_FAIL; } if (buffer == NULL) return CS_FAIL; if (idx == 0 || (ctx->cs_diag_msglimit != CS_NO_LIMIT && idx > ctx->cs_diag_msglimit) ) return CS_FAIL; return (cs_diag_getmsg(ctx, idx, (CS_CLIENTMSG *)buffer)); break; case CS_STATUS: if ( ctx->cs_errhandletype != _CS_ERRHAND_INLINE) { return CS_FAIL; } if (buffer == NULL) return CS_FAIL; return (cs_diag_countmsg(ctx, (CS_INT *)buffer)); break; } return CS_SUCCEED; } CS_RETCODE cs_manage_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_CHAR * srcname, CS_INT srcnamelen, CS_INT desttype, CS_CHAR * destname, CS_INT destnamelen, CS_INT * conv_multiplier, CS_CONV_FUNC * func) { tdsdump_log(TDS_DBG_FUNC, "cs_manage_convert(%p, %d, %d, %p, %d, %d, %p, %d, %p, %p)\n", ctx, action, srctype, srcname, srcnamelen, desttype, destname, destnamelen, conv_multiplier, func); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_manage_convert()\n"); return CS_FAIL; } CS_RETCODE cs_objects(CS_CONTEXT * ctx, CS_INT action, CS_OBJNAME * objname, CS_OBJDATA * objdata) { tdsdump_log(TDS_DBG_FUNC, "cs_objects(%p, %d, %p, %p)\n", ctx, action, objname, objdata); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_objects()\n"); return CS_FAIL; } CS_RETCODE cs_set_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_INT desttype, CS_CONV_FUNC * func) { tdsdump_log(TDS_DBG_FUNC, "cs_set_convert(%p, %d, %d, %d, %p)\n", ctx, action, srctype, desttype, func); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_set_convert()\n"); return CS_FAIL; } CS_RETCODE cs_setnull(CS_CONTEXT * ctx, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT buflen) { tdsdump_log(TDS_DBG_FUNC, "cs_setnull(%p, %p, %p, %d)\n", ctx, datafmt, buffer, buflen); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_setnull()\n"); return CS_FAIL; } CS_RETCODE cs_strcmp(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_INT type, CS_CHAR * str1, CS_INT len1, CS_CHAR * str2, CS_INT len2, CS_INT * result) { tdsdump_log(TDS_DBG_FUNC, "cs_strcmp(%p, %p, %d, %p, %d, %p, %d, %p)\n", ctx, locale, type, str1, len1, str2, len2, result); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_strcmp()\n"); return CS_FAIL; } CS_RETCODE cs_time(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen, CS_DATEREC * daterec) { tdsdump_log(TDS_DBG_FUNC, "cs_time(%p, %p, %p, %d, %p, %p)\n", ctx, locale, buffer, buflen, outlen, daterec); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED cs_time()\n"); return CS_FAIL; } CS_RETCODE cs_will_convert(CS_CONTEXT * ctx, CS_INT srctype, CS_INT desttype, CS_BOOL * result) { tdsdump_log(TDS_DBG_FUNC, "cs_will_convert(%p, %d, %d, %p)\n", ctx, srctype, desttype, result); srctype = _ct_get_server_type(NULL, srctype); desttype = _ct_get_server_type(NULL, desttype); *result = (tds_willconvert(srctype, desttype) ? CS_TRUE : CS_FALSE); return CS_SUCCEED; } static CS_INT cs_diag_storemsg(CS_CONTEXT *context, CS_CLIENTMSG *message) { struct cs_diag_msg **curptr; CS_INT msg_count = 0; tdsdump_log(TDS_DBG_FUNC, "cs_diag_storemsg(%p, %p)\n", context, message); curptr = &(context->msgstore); /* if we already have a list of messages, */ /* go to the end of the list... */ while (*curptr != NULL) { msg_count++; curptr = &((*curptr)->next); } /* messages over and above the agreed limit */ /* are simply discarded... */ if (context->cs_diag_msglimit != CS_NO_LIMIT && msg_count >= context->cs_diag_msglimit) { return CS_FAIL; } *curptr = tds_new(struct cs_diag_msg, 1); if (*curptr == NULL) { return CS_FAIL; } else { (*curptr)->next = NULL; (*curptr)->msg = tds_new(CS_CLIENTMSG, 1); if ((*curptr)->msg == NULL) { return CS_FAIL; } else { memcpy((*curptr)->msg, message, sizeof(CS_CLIENTMSG)); } } return CS_SUCCEED; } static CS_INT cs_diag_getmsg(CS_CONTEXT *context, CS_INT idx, CS_CLIENTMSG *message) { struct cs_diag_msg *curptr; CS_INT msg_count = 0, msg_found = 0; tdsdump_log(TDS_DBG_FUNC, "cs_diag_getmsg(%p, %d, %p)\n", context, idx, message); curptr = context->msgstore; /* if we already have a list of messages, */ /* go to the end of the list... */ while (curptr != NULL) { msg_count++; if (msg_count == idx) { msg_found++; break; } curptr = curptr->next; } if (msg_found) { memcpy(message, curptr->msg, sizeof(CS_CLIENTMSG)); return CS_SUCCEED; } else { return CS_NOMSG; } } static CS_INT cs_diag_clearmsg(CS_CONTEXT *context, CS_INT type) { struct cs_diag_msg *curptr, *freeptr; tdsdump_log(TDS_DBG_FUNC, "cs_diag_clearmsg(%p, %d)\n", context, type); curptr = context->msgstore; context->msgstore = NULL; while (curptr != NULL ) { freeptr = curptr; curptr = freeptr->next; free(freeptr->msg); free(freeptr); } return CS_SUCCEED; } static CS_INT cs_diag_countmsg(CS_CONTEXT *context, CS_INT *count) { struct cs_diag_msg *curptr; CS_INT msg_count = 0; tdsdump_log(TDS_DBG_FUNC, "cs_diag_countmsg(%p, %p)\n", context, count); curptr = context->msgstore; while (curptr != NULL) { msg_count++; curptr = curptr->next; } *count = msg_count; return CS_SUCCEED; } /** * Try to convert to a type we can handle */ int _cs_convert_not_client(CS_CONTEXT *ctx, const TDSCOLUMN *curcol, CONV_RESULT *convert_buffer, unsigned char **p_src) { int ct_type; TDS_SERVER_TYPE desttype, type = curcol->column_type; if (type == SYBVARIANT) type = ((const TDSVARIANT *) curcol->column_data)->type; switch (type) { case SYBMSDATE: desttype = SYBDATE; ct_type = CS_DATE_TYPE; break; case SYBMSTIME: desttype = SYB5BIGTIME; ct_type = CS_BIGTIME_TYPE; break; case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: desttype = SYB5BIGDATETIME; ct_type = CS_BIGDATETIME_TYPE; break; default: return CS_ILLEGAL_TYPE; } if (convert_buffer) { int len = tds_convert(ctx->tds_ctx, type, *p_src, curcol->column_cur_size, desttype, convert_buffer); if (len < 0) return CS_ILLEGAL_TYPE; /* TODO _csclient_msg ?? */ *p_src = (unsigned char *) convert_buffer; } return ct_type; } freetds-1.3.6/src/ctlib/blk.c000644 025423 025423 00000046547 14056414271 017427 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-2004, 2005, 2010 Brian Bruns, Bill Thompson * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "bkpublic.h" #include "ctpublic.h" #include "ctlib.h" static void _blk_null_error(TDSBCPINFO *bcpinfo, int index, int offset); static TDSRET _blk_get_col_data(TDSBCPINFO *bulk, TDSCOLUMN *bcpcol, int offset); static CS_RETCODE _blk_rowxfer_in(CS_BLKDESC * blkdesc, CS_INT rows_to_xfer, CS_INT * rows_xferred); static CS_RETCODE _blk_rowxfer_out(CS_BLKDESC * blkdesc, CS_INT rows_to_xfer, CS_INT * rows_xferred); #define CONN(bulk) ((CS_CONNECTION *) (bulk)->bcpinfo.parent) TDS_COMPILE_CHECK(same_size, sizeof(CS_BLKDESC) == sizeof(TDSBCPINFO)); TDS_COMPILE_CHECK(nested_type, TDS_OFFSET(CS_BLKDESC, bcpinfo) == 0); CS_RETCODE blk_alloc(CS_CONNECTION * connection, CS_INT version, CS_BLKDESC ** blk_pointer) { CS_BLKDESC *blkdesc; tdsdump_log(TDS_DBG_FUNC, "blk_alloc(%p, %d, %p)\n", connection, version, blk_pointer); if (!connection || !connection->tds_socket) return CS_FAIL; if (connection->tds_socket->conn->tds_version < 0x500) return CS_FAIL; blkdesc = (CS_BLKDESC *) tds_alloc_bcpinfo(); if (!blkdesc) return CS_FAIL; /* so we know who we belong to */ blkdesc->bcpinfo.parent = connection; *blk_pointer = blkdesc; return CS_SUCCEED; } CS_RETCODE blk_bind(CS_BLKDESC * blkdesc, CS_INT item, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT * datalen, CS_SMALLINT * indicator) { TDSCOLUMN *colinfo; CS_CONNECTION *con; CS_INT bind_count; int i; tdsdump_log(TDS_DBG_FUNC, "blk_bind(%p, %d, %p, %p, %p, %p)\n", blkdesc, item, datafmt, buffer, datalen, indicator); if (!blkdesc) { return CS_FAIL; } con = CONN(blkdesc); if (item == CS_UNUSED) { /* clear all bindings */ if (datafmt == NULL && buffer == NULL && datalen == NULL && indicator == NULL ) { blkdesc->bcpinfo.bind_count = CS_UNUSED; for (i = 0; i < blkdesc->bcpinfo.bindinfo->num_cols; i++ ) { colinfo = blkdesc->bcpinfo.bindinfo->columns[i]; colinfo->column_varaddr = NULL; colinfo->column_bindtype = 0; colinfo->column_bindfmt = 0; colinfo->column_bindlen = 0; colinfo->column_nullbind = NULL; colinfo->column_lenbind = NULL; } } return CS_SUCCEED; } /* check item value */ if (item < 1 || item > blkdesc->bcpinfo.bindinfo->num_cols) { _ctclient_msg(con, "blk_bind", 2, 5, 1, 141, "%s, %d", "colnum", item); return CS_FAIL; } /* clear bindings for this column */ if (datafmt == NULL && buffer == NULL && datalen == NULL && indicator == NULL ) { colinfo = blkdesc->bcpinfo.bindinfo->columns[item - 1]; colinfo->column_varaddr = NULL; colinfo->column_bindtype = 0; colinfo->column_bindfmt = 0; colinfo->column_bindlen = 0; colinfo->column_nullbind = NULL; colinfo->column_lenbind = NULL; return CS_SUCCEED; } if (datafmt == NULL) return CS_FAIL; /* * check whether the request is for array binding and ensure that user * supplies the same datafmt->count to the subsequent ct_bind calls */ bind_count = (datafmt->count == 0) ? 1 : datafmt->count; /* first bind for this result set */ if (blkdesc->bcpinfo.bind_count == CS_UNUSED) { blkdesc->bcpinfo.bind_count = bind_count; } else { /* all subsequent binds for this result set - the bind counts must be the same */ if (blkdesc->bcpinfo.bind_count != bind_count) { _ctclient_msg(con, "blk_bind", 1, 1, 1, 137, "%d, %d", bind_count, blkdesc->bcpinfo.bind_count); return CS_FAIL; } } /* bind the column_varaddr to the address of the buffer */ colinfo = blkdesc->bcpinfo.bindinfo->columns[item - 1]; colinfo->column_varaddr = (char *) buffer; colinfo->column_bindtype = datafmt->datatype; colinfo->column_bindfmt = datafmt->format; colinfo->column_bindlen = datafmt->maxlength; if (indicator) { colinfo->column_nullbind = indicator; } if (datalen) { colinfo->column_lenbind = datalen; } return CS_SUCCEED; } CS_RETCODE blk_colval(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp, CS_INT colnum, CS_VOID * valuep, CS_INT valuelen, CS_INT * outlenp) { tdsdump_log(TDS_DBG_FUNC, "blk_colval(%p, %p, %p, %d, %p, %d, %p)\n", srvproc, blkdescp, rowp, colnum, valuep, valuelen, outlenp); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_colval()\n"); return CS_FAIL; } CS_RETCODE blk_default(CS_BLKDESC * blkdesc, CS_INT colnum, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { tdsdump_log(TDS_DBG_FUNC, "blk_default(%p, %d, %p, %d, %p)\n", blkdesc, colnum, buffer, buflen, outlen); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_default()\n"); return CS_FAIL; } CS_RETCODE blk_describe(CS_BLKDESC * blkdesc, CS_INT item, CS_DATAFMT * datafmt) { TDSCOLUMN *curcol; tdsdump_log(TDS_DBG_FUNC, "blk_describe(%p, %d, %p)\n", blkdesc, item, datafmt); if (item < 1 || item > blkdesc->bcpinfo.bindinfo->num_cols) { _ctclient_msg(CONN(blkdesc), "blk_describe", 2, 5, 1, 141, "%s, %d", "colnum", item); return CS_FAIL; } curcol = blkdesc->bcpinfo.bindinfo->columns[item - 1]; /* name is always null terminated */ strlcpy(datafmt->name, tds_dstr_cstr(&curcol->column_name), sizeof(datafmt->name)); datafmt->namelen = strlen(datafmt->name); /* need to turn the SYBxxx into a CS_xxx_TYPE */ datafmt->datatype = _ct_get_client_type(curcol, true); if (datafmt->datatype == CS_ILLEGAL_TYPE) return CS_FAIL; tdsdump_log(TDS_DBG_INFO1, "blk_describe() datafmt->datatype = %d server type %d\n", datafmt->datatype, curcol->column_type); /* FIXME is ok this value for numeric/decimal? */ datafmt->maxlength = curcol->column_size; datafmt->usertype = curcol->column_usertype; datafmt->precision = curcol->column_prec; datafmt->scale = curcol->column_scale; /* * There are other options that can be returned, but these are the * only two being noted via the TDS layer. */ datafmt->status = 0; if (curcol->column_nullable) datafmt->status |= CS_CANBENULL; if (curcol->column_identity) datafmt->status |= CS_IDENTITY; datafmt->count = 1; datafmt->locale = NULL; return CS_SUCCEED; } CS_RETCODE blk_done(CS_BLKDESC * blkdesc, CS_INT type, CS_INT * outrow) { TDSSOCKET *tds; int rows_copied; tdsdump_log(TDS_DBG_FUNC, "blk_done(%p, %d, %p)\n", blkdesc, type, outrow); tds = CONN(blkdesc)->tds_socket; switch (type) { case CS_BLK_BATCH: if (TDS_FAILED(tds_bcp_done(tds, &rows_copied))) { _ctclient_msg(CONN(blkdesc), "blk_done", 2, 5, 1, 140, ""); return CS_FAIL; } if (outrow) *outrow = rows_copied; if (TDS_FAILED(tds_bcp_start(tds, &blkdesc->bcpinfo))) { _ctclient_msg(CONN(blkdesc), "blk_done", 2, 5, 1, 140, ""); return CS_FAIL; } break; case CS_BLK_ALL: if (TDS_FAILED(tds_bcp_done(tds, &rows_copied))) { _ctclient_msg(CONN(blkdesc), "blk_done", 2, 5, 1, 140, ""); return CS_FAIL; } if (outrow) *outrow = rows_copied; /* free allocated storage in blkdesc & initialise flags, etc. */ tds_deinit_bcpinfo(&blkdesc->bcpinfo); blkdesc->bcpinfo.direction = 0; blkdesc->bcpinfo.bind_count = CS_UNUSED; blkdesc->bcpinfo.xfer_init = 0; break; } return CS_SUCCEED; } CS_RETCODE blk_drop(CS_BLKDESC * blkdesc) { tdsdump_log(TDS_DBG_FUNC, "blk_drop(%p)\n", blkdesc); /* this is possible as CS_BLKDESC contains just bcpinfo field */ tds_free_bcpinfo(&blkdesc->bcpinfo); return CS_SUCCEED; } CS_RETCODE blk_getrow(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp) { tdsdump_log(TDS_DBG_FUNC, "blk_getrow(%p, %p, %p)\n", srvproc, blkdescp, rowp); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_getrow()\n"); return CS_FAIL; } CS_RETCODE blk_gettext(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp, CS_INT bufsize, CS_INT * outlenp) { tdsdump_log(TDS_DBG_FUNC, "blk_gettext(%p, %p, %p, %d, %p)\n", srvproc, blkdescp, rowp, bufsize, outlenp); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_gettext()\n"); return CS_FAIL; } CS_RETCODE blk_init(CS_BLKDESC * blkdesc, CS_INT direction, CS_CHAR * tablename, CS_INT tnamelen) { tdsdump_log(TDS_DBG_FUNC, "blk_init(%p, %d, %p, %d)\n", blkdesc, direction, tablename, tnamelen); if (!blkdesc) { return CS_FAIL; } if (direction != CS_BLK_IN && direction != CS_BLK_OUT ) { _ctclient_msg(CONN(blkdesc), "blk_init", 2, 6, 1, 138, ""); return CS_FAIL; } if (!tablename) { _ctclient_msg(CONN(blkdesc), "blk_init", 2, 6, 1, 139, ""); return CS_FAIL; } if (tnamelen == CS_NULLTERM) tnamelen = strlen(tablename); /* free allocated storage in blkdesc & initialise flags, etc. */ tds_deinit_bcpinfo(&blkdesc->bcpinfo); /* string can be no-nul terminated so copy with memcpy */ if (!tds_dstr_copyn(&blkdesc->bcpinfo.tablename, tablename, tnamelen)) { return CS_FAIL; } blkdesc->bcpinfo.direction = direction; blkdesc->bcpinfo.bind_count = CS_UNUSED; blkdesc->bcpinfo.xfer_init = 0; if (TDS_FAILED(tds_bcp_init(CONN(blkdesc)->tds_socket, &blkdesc->bcpinfo))) { _ctclient_msg(CONN(blkdesc), "blk_init", 2, 5, 1, 140, ""); return CS_FAIL; } blkdesc->bcpinfo.bind_count = CS_UNUSED; return CS_SUCCEED; } CS_RETCODE blk_props(CS_BLKDESC * blkdesc, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen) { int retval, intval; tdsdump_log(TDS_DBG_FUNC, "blk_props(%p, %d, %d, %p, %d, %p)\n", blkdesc, action, property, buffer, buflen, outlen); switch (property) { case BLK_IDENTITY: switch (action) { case CS_SET: if (buffer) { memcpy(&intval, buffer, sizeof(intval)); if (intval == CS_TRUE) blkdesc->bcpinfo.identity_insert_on = 1; if (intval == CS_FALSE) blkdesc->bcpinfo.identity_insert_on = 0; } return CS_SUCCEED; break; case CS_GET: retval = blkdesc->bcpinfo.identity_insert_on == 1 ? CS_TRUE : CS_FALSE ; if (buffer) { memcpy (buffer, &retval, sizeof(retval)); if (outlen) *outlen = sizeof(retval); } return CS_SUCCEED; break; default: _ctclient_msg(CONN(blkdesc), "blk_props", 2, 5, 1, 141, "%s, %d", "action", action); break; } break; default: _ctclient_msg(CONN(blkdesc), "blk_props", 2, 5, 1, 141, "%s, %d", "property", property); break; } return CS_FAIL; } CS_RETCODE blk_rowalloc(SRV_PROC * srvproc, CS_BLK_ROW ** row) { tdsdump_log(TDS_DBG_FUNC, "blk_rowalloc(%p, %p)\n", srvproc, row); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_rowalloc()\n"); return CS_FAIL; } CS_RETCODE blk_rowdrop(SRV_PROC * srvproc, CS_BLK_ROW * row) { tdsdump_log(TDS_DBG_FUNC, "blk_rowdrop(%p, %p)\n", srvproc, row); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_rowdrop()\n"); return CS_FAIL; } CS_RETCODE blk_rowxfer(CS_BLKDESC * blkdesc) { tdsdump_log(TDS_DBG_FUNC, "blk_rowxfer(%p)\n", blkdesc); return blk_rowxfer_mult(blkdesc, NULL); } CS_RETCODE blk_rowxfer_mult(CS_BLKDESC * blkdesc, CS_INT * row_count) { CS_INT rows_to_xfer = 0; CS_INT rows_xferred = 0; CS_RETCODE ret; tdsdump_log(TDS_DBG_FUNC, "blk_rowxfer_mult(%p, %p)\n", blkdesc, row_count); if (!row_count || *row_count == 0 ) rows_to_xfer = blkdesc->bcpinfo.bind_count; else rows_to_xfer = *row_count; if (blkdesc->bcpinfo.direction == CS_BLK_IN) { ret = _blk_rowxfer_in(blkdesc, rows_to_xfer, &rows_xferred); } else { ret = _blk_rowxfer_out(blkdesc, rows_to_xfer, &rows_xferred); } if (row_count) *row_count = rows_xferred; return ret; } CS_RETCODE blk_sendrow(CS_BLKDESC * blkdesc, CS_BLK_ROW * row) { tdsdump_log(TDS_DBG_FUNC, "blk_sendrow(%p, %p)\n", blkdesc, row); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_sendrow()\n"); return CS_FAIL; } CS_RETCODE blk_sendtext(CS_BLKDESC * blkdesc, CS_BLK_ROW * row, CS_BYTE * buffer, CS_INT buflen) { tdsdump_log(TDS_DBG_FUNC, "blk_sendtext(%p, %p, %p, %d)\n", blkdesc, row, buffer, buflen); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_sendtext()\n"); return CS_FAIL; } CS_RETCODE blk_srvinit(SRV_PROC * srvproc, CS_BLKDESC * blkdescp) { tdsdump_log(TDS_DBG_FUNC, "blk_srvinit(%p, %p)\n", srvproc, blkdescp); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_srvinit()\n"); return CS_FAIL; } CS_RETCODE blk_textxfer(CS_BLKDESC * blkdesc, CS_BYTE * buffer, CS_INT buflen, CS_INT * outlen) { tdsdump_log(TDS_DBG_FUNC, "blk_textxfer(%p, %p, %d, %p)\n", blkdesc, buffer, buflen, outlen); tdsdump_log(TDS_DBG_FUNC, "UNIMPLEMENTED blk_textxfer()\n"); return CS_FAIL; } static CS_RETCODE _blk_rowxfer_out(CS_BLKDESC * blkdesc, CS_INT rows_to_xfer, CS_INT * rows_xferred) { TDSSOCKET *tds; TDS_INT result_type; TDSRET ret; TDS_INT temp_count; tdsdump_log(TDS_DBG_FUNC, "_blk_rowxfer_out(%p, %d, %p)\n", blkdesc, rows_to_xfer, rows_xferred); if (!blkdesc || !CONN(blkdesc)) return CS_FAIL; tds = CONN(blkdesc)->tds_socket; /* * the first time blk_xfer called after blk_init() * do the query and get to the row data... */ if (blkdesc->bcpinfo.xfer_init == 0) { if (TDS_FAILED(tds_submit_queryf(tds, "select * from %s", tds_dstr_cstr(&blkdesc->bcpinfo.tablename)))) { _ctclient_msg(CONN(blkdesc), "blk_rowxfer", 2, 5, 1, 140, ""); return CS_FAIL; } while ((ret = tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { if (result_type == TDS_ROW_RESULT) break; } if (ret != TDS_SUCCESS || result_type != TDS_ROW_RESULT) { _ctclient_msg(CONN(blkdesc), "blk_rowxfer", 2, 5, 1, 140, ""); return CS_FAIL; } blkdesc->bcpinfo.xfer_init = 1; } if (rows_xferred) *rows_xferred = 0; for (temp_count = 0; temp_count < rows_to_xfer; temp_count++) { ret = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_STOPAT_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE); tdsdump_log(TDS_DBG_FUNC, "blk_rowxfer_out() process_row_tokens returned %d\n", ret); switch (ret) { case TDS_SUCCESS: if (result_type == TDS_ROW_RESULT || result_type == TDS_COMPUTE_RESULT) { if (result_type == TDS_ROW_RESULT) { if (_ct_bind_data( CONN(blkdesc)->ctx, tds->current_results, blkdesc->bcpinfo.bindinfo, temp_count)) return CS_ROW_FAIL; if (rows_xferred) *rows_xferred = *rows_xferred + 1; } break; } case TDS_NO_MORE_RESULTS: return CS_END_DATA; break; default: _ctclient_msg(CONN(blkdesc), "blk_rowxfer", 2, 5, 1, 140, ""); return CS_FAIL; break; } } return CS_SUCCEED; } static CS_RETCODE _blk_rowxfer_in(CS_BLKDESC * blkdesc, CS_INT rows_to_xfer, CS_INT * rows_xferred) { TDSSOCKET *tds; TDS_INT each_row; tdsdump_log(TDS_DBG_FUNC, "_blk_rowxfer_in(%p, %d, %p)\n", blkdesc, rows_to_xfer, rows_xferred); if (!blkdesc) return CS_FAIL; tds = CONN(blkdesc)->tds_socket; /* * the first time blk_xfer called after blk_init() * do the query and get to the row data... */ if (blkdesc->bcpinfo.xfer_init == 0) { /* * first call the start_copy function, which will * retrieve details of the database table columns */ if (TDS_FAILED(tds_bcp_start_copy_in(tds, &blkdesc->bcpinfo))) { _ctclient_msg(CONN(blkdesc), "blk_rowxfer", 2, 5, 1, 140, ""); return CS_FAIL; } blkdesc->bcpinfo.xfer_init = 1; } for (each_row = 0; each_row < rows_to_xfer; each_row++ ) { if (tds_bcp_send_record(tds, &blkdesc->bcpinfo, _blk_get_col_data, _blk_null_error, each_row) == TDS_SUCCESS) { /* FIXME */ } } return CS_SUCCEED; } static void _blk_null_error(TDSBCPINFO *bcpinfo, int index, int offset) { CS_BLKDESC *blkdesc = (CS_BLKDESC *) bcpinfo; tdsdump_log(TDS_DBG_FUNC, "_blk_null_error(%p, %d, %d)\n", bcpinfo, index, offset); _ctclient_msg(CONN(blkdesc), "blk_rowxfer", 2, 7, 1, 142, "%d, %d", index + 1, offset + 1); } static TDSRET _blk_get_col_data(TDSBCPINFO *bulk, TDSCOLUMN *bindcol, int offset) { int result = 0; bool null_column = false; unsigned char *src = NULL; CS_INT srctype = 0; CS_INT srclen = 0; CS_INT destlen = 0; CS_SMALLINT *nullind = NULL; CS_INT *datalen = NULL; CS_BLKDESC *blkdesc = (CS_BLKDESC *) bulk; CS_CONTEXT *ctx = CONN(blkdesc)->ctx; CS_DATAFMT srcfmt, destfmt; tdsdump_log(TDS_DBG_FUNC, "_blk_get_col_data(%p, %p, %d)\n", bulk, bindcol, offset); /* * Retrieve the initial bound column_varaddress * and increment it if offset specified */ src = (unsigned char *) bindcol->column_varaddr; if (!src) { tdsdump_log(TDS_DBG_ERROR, "error source field not addressable\n"); return TDS_FAIL; } src += offset * bindcol->column_bindlen; if (bindcol->column_nullbind) { nullind = bindcol->column_nullbind; nullind += offset; } if (bindcol->column_lenbind) { datalen = bindcol->column_lenbind; datalen += offset; } srctype = bindcol->column_bindtype; /* passes to cs_convert */ tdsdump_log(TDS_DBG_INFO1, "blk_get_col_data srctype = %d\n", srctype); tdsdump_log(TDS_DBG_INFO1, "blk_get_col_data datalen = %d\n", datalen ? *datalen : -1); if (datalen) { if (*datalen == CS_UNUSED) { switch (srctype) { case CS_LONG_TYPE: srclen = 8; break; case CS_FLOAT_TYPE: srclen = 8; break; case CS_MONEY_TYPE: srclen = 8; break; case CS_DATETIME_TYPE: srclen = 8; break; case CS_INT_TYPE: srclen = 4; break; case CS_UINT_TYPE: srclen = 4; break; case CS_REAL_TYPE: srclen = 4; break; case CS_MONEY4_TYPE: srclen = 4; break; case CS_DATETIME4_TYPE: srclen = 4; break; case CS_SMALLINT_TYPE: srclen = 2; break; case CS_USMALLINT_TYPE: srclen = 2; break; case CS_TINYINT_TYPE: srclen = 1; break; case CS_BIT_TYPE: srclen = 1; break; case CS_BIGINT_TYPE: srclen = 8; break; case CS_UBIGINT_TYPE: srclen = 8; break; case CS_UNIQUE_TYPE: srclen = 16; break; default: printf("error not fixed length type (%d) and datalen not specified\n", bindcol->column_bindtype); return CS_FAIL; } } else { srclen = *datalen; } } if (srclen == 0) { if (nullind && *nullind == -1) null_column = true; } if (!null_column) { CONV_RESULT convert_buffer; srcfmt.datatype = srctype; srcfmt.maxlength = srclen; destfmt.datatype = _cs_convert_not_client(ctx, bindcol, &convert_buffer, &src); if (destfmt.datatype == CS_ILLEGAL_TYPE) destfmt.datatype = _ct_get_client_type(bindcol, false); if (destfmt.datatype == CS_ILLEGAL_TYPE) return CS_FAIL; destfmt.maxlength = bindcol->on_server.column_size; destfmt.precision = bindcol->column_prec; destfmt.scale = bindcol->column_scale; destfmt.format = CS_FMT_UNUSED; /* if convert return FAIL mark error but process other columns */ if ((result = cs_convert(ctx, &srcfmt, (CS_VOID *) src, &destfmt, (CS_VOID *) bindcol->bcp_column_data->data, &destlen)) != CS_SUCCEED) { tdsdump_log(TDS_DBG_INFO1, "convert failed for %d \n", srcfmt.datatype); return CS_FAIL; } } bindcol->bcp_column_data->datalen = destlen; bindcol->bcp_column_data->is_null = null_column; return TDS_SUCCESS; } freetds-1.3.6/src/ctlib/ctutil.c000644 025423 025423 00000014663 14056414271 020155 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "cspublic.h" #include "ctlib.h" #include #include /* #include "fortify.h" */ /* * test include consistency * I don't think all compiler are able to compile this code... if not comment it */ #if ENABLE_EXTRA_CHECKS #define TEST_EQUAL(t,a,b) TDS_COMPILE_CHECK(t,a==b) TEST_EQUAL(t03,CS_NULLTERM,TDS_NULLTERM); TEST_EQUAL(t04,CS_CMD_SUCCEED,TDS_CMD_SUCCEED); TEST_EQUAL(t05,CS_CMD_FAIL,TDS_CMD_FAIL); TEST_EQUAL(t06,CS_CMD_DONE,TDS_CMD_DONE); TEST_EQUAL(t07,CS_NO_COUNT,TDS_NO_COUNT); TEST_EQUAL(t08,CS_COMPUTE_RESULT,TDS_COMPUTE_RESULT); TEST_EQUAL(t09,CS_PARAM_RESULT,TDS_PARAM_RESULT); TEST_EQUAL(t10,CS_ROW_RESULT,TDS_ROW_RESULT); TEST_EQUAL(t11,CS_STATUS_RESULT,TDS_STATUS_RESULT); TEST_EQUAL(t12,CS_COMPUTEFMT_RESULT,TDS_COMPUTEFMT_RESULT); TEST_EQUAL(t13,CS_ROWFMT_RESULT,TDS_ROWFMT_RESULT); TEST_EQUAL(t14,CS_MSG_RESULT,TDS_MSG_RESULT); TEST_EQUAL(t15,CS_DESCRIBE_RESULT,TDS_DESCRIBE_RESULT); #define TEST_ATTRIBUTE(t,sa,fa,sb,fb) \ TDS_COMPILE_CHECK(t,sizeof(((sa*)0)->fa) == sizeof(((sb*)0)->fb) && TDS_OFFSET(sa,fa) == TDS_OFFSET(sb,fb)) TEST_ATTRIBUTE(t21,TDS_MONEY4,mny4,CS_MONEY4,mny4); TEST_ATTRIBUTE(t22,TDS_OLD_MONEY,mnyhigh,CS_MONEY,mnyhigh); TEST_ATTRIBUTE(t23,TDS_OLD_MONEY,mnylow,CS_MONEY,mnylow); TEST_ATTRIBUTE(t24,TDS_DATETIME,dtdays,CS_DATETIME,dtdays); TEST_ATTRIBUTE(t25,TDS_DATETIME,dttime,CS_DATETIME,dttime); TEST_ATTRIBUTE(t26,TDS_DATETIME4,days,CS_DATETIME4,days); TEST_ATTRIBUTE(t27,TDS_DATETIME4,minutes,CS_DATETIME4,minutes); TEST_ATTRIBUTE(t28,TDS_NUMERIC,precision,CS_NUMERIC,precision); TEST_ATTRIBUTE(t29,TDS_NUMERIC,scale,CS_NUMERIC,scale); TEST_ATTRIBUTE(t30,TDS_NUMERIC,array,CS_NUMERIC,array); TEST_ATTRIBUTE(t30,TDS_NUMERIC,precision,CS_DECIMAL,precision); TEST_ATTRIBUTE(t31,TDS_NUMERIC,scale,CS_DECIMAL,scale); TEST_ATTRIBUTE(t32,TDS_NUMERIC,array,CS_DECIMAL,array); #endif /* * error handler * This callback function should be invoked only from libtds through tds_ctx->err_handler. */ int _ct_handle_client_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAGE * msg) { CS_CLIENTMSG errmsg; CS_CONNECTION *con = NULL; CS_CONTEXT *ctx = NULL; int ret = (int) CS_SUCCEED; tdsdump_log(TDS_DBG_FUNC, "_ct_handle_client_message(%p, %p, %p)\n", ctx_tds, tds, msg); if (tds && tds_get_parent(tds)) { con = (CS_CONNECTION *) tds_get_parent(tds); } memset(&errmsg, '\0', sizeof(errmsg)); errmsg.msgnumber = msg->msgno; errmsg.severity = msg->severity; strlcpy(errmsg.msgstring, msg->message, sizeof(errmsg.msgstring)); errmsg.msgstringlen = strlen(errmsg.msgstring); errmsg.osstring[0] = '\0'; errmsg.osstringlen = 0; /* if there is no connection, attempt to call the context handler */ if (!con) { ctx = (CS_CONTEXT *) ctx_tds->parent; if (ctx->_clientmsg_cb) ret = ctx->_clientmsg_cb(ctx, con, &errmsg); } else if (con->_clientmsg_cb) ret = con->_clientmsg_cb(con->ctx, con, &errmsg); else if (con->ctx->_clientmsg_cb) ret = con->ctx->_clientmsg_cb(con->ctx, con, &errmsg); /* * The return code from the error handler is either CS_SUCCEED or CS_FAIL. * This function was called by libtds with some kind of communications failure, and there are * no cases in which "succeed" could mean anything: In most cases, the function is going to fail * no matter what. * * Timeouts are a different matter; it's up to the client to decide whether to continue * waiting or to abort the operation and close the socket. ct-lib applications do their * own cancel processing -- they can call ct_cancel from within the error handler -- so * they don't need to return TDS_INT_TIMEOUT. They can, however, return TDS_INT_CONTINUE * or TDS_INT_CANCEL. We map the client's return code to those. * * Only for timeout errors does TDS_INT_CANCEL cause libtds to break the connection. */ if (msg->msgno == TDSETIME) { switch (ret) { case CS_SUCCEED: return TDS_INT_CONTINUE; case CS_FAIL: return TDS_INT_CANCEL; } } return TDS_INT_CANCEL; } /* message handler */ TDSRET _ct_handle_server_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAGE * msg) { CS_SERVERMSG errmsg; CS_CONNECTION *con = NULL; CS_CONTEXT *ctx = NULL; CS_RETCODE ret = CS_SUCCEED; tdsdump_log(TDS_DBG_FUNC, "_ct_handle_server_message(%p, %p, %p)\n", ctx_tds, tds, msg); if (tds && tds_get_parent(tds)) con = (CS_CONNECTION *) tds_get_parent(tds); memset(&errmsg, '\0', sizeof(errmsg)); errmsg.msgnumber = msg->msgno; strlcpy(errmsg.text, msg->message, sizeof(errmsg.text)); errmsg.textlen = strlen(errmsg.text); errmsg.sqlstate[0] = 0; if (msg->sql_state) strlcpy((char *) errmsg.sqlstate, msg->sql_state, sizeof(errmsg.sqlstate)); errmsg.sqlstatelen = strlen((char *) errmsg.sqlstate); errmsg.state = msg->state; errmsg.severity = msg->severity; errmsg.line = msg->line_number; if (msg->server) { errmsg.svrnlen = strlen(msg->server); strlcpy(errmsg.svrname, msg->server, CS_MAX_NAME); } if (msg->proc_name) { errmsg.proclen = strlen(msg->proc_name); strlcpy(errmsg.proc, msg->proc_name, CS_MAX_NAME); } /* if there is no connection, attempt to call the context handler */ if (!con) { ctx = (CS_CONTEXT *) ctx_tds->parent; if (ctx->_servermsg_cb) ret = ctx->_servermsg_cb(ctx, con, &errmsg); } else if (con->_servermsg_cb) { ret = con->_servermsg_cb(con->ctx, con, &errmsg); } else if (con->ctx->_servermsg_cb) { ret = con->ctx->_servermsg_cb(con->ctx, con, &errmsg); } return ret == CS_SUCCEED ? TDS_SUCCESS : TDS_FAIL; } freetds-1.3.6/src/ctlib/winmain.c000644 025423 025423 00000000041 14056414221 020267 0ustar00fredianofrediano000000 000000 #include "../../win32/initnet.c" freetds-1.3.6/src/ctlib/ctlib.def000644 025423 025423 00000001744 14056414221 020251 0ustar00fredianofrediano000000 000000 EXPORTS blk_alloc blk_bind blk_colval blk_default blk_describe blk_done blk_drop blk_getrow blk_gettext blk_init blk_props blk_rowalloc blk_rowdrop blk_rowxfer blk_rowxfer_mult blk_sendrow blk_sendtext blk_srvinit blk_textxfer cs_calc cs_cmp cs_config cs_convert cs_conv_mult cs_ctx_alloc cs_ctx_drop cs_ctx_global cs_diag cs_dt_crack cs_dt_info cs_locale cs_loc_alloc cs_loc_drop cs_manage_convert cs_objects cs_prretcode cs_set_convert cs_setnull cs_strbuild cs_strcmp cs_time cs_will_convert ct_bind ct_callback ct_cancel ct_capability ct_close ct_cmd_alloc ct_cmd_drop ct_cmd_props ct_command ct_compute_info ct_con_alloc ct_con_drop ct_config ct_connect ct_con_props ct_cursor ct_data_info ct_describe ct_diag ct_dynamic ct_exit ct_fetch ct_get_data ct_init ct_options ct_param ct_poll ct_res_info ct_results ct_send ct_send_data ct_setparam freetds-1.3.6/src/ctlib/CMakeLists.txt000644 025423 025423 00000002167 14056414221 021234 0ustar00fredianofrediano000000 000000 add_subdirectory(unittests) set(static_lib_name ct) if(WIN32) set(win_SRCS winmain.c ctlib.def) set(static_lib_name libct) endif() add_library(ct SHARED ct.c cs.c blk.c ctutil.c ${win_SRCS} ) target_compile_definitions(ct PUBLIC DLL_EXPORT=1) target_link_libraries(ct tds replacements tdsutils ${lib_NETWORK} ${lib_BASE}) add_library(ct-static STATIC ct.c cs.c blk.c ctutil.c ) # See http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F SET_TARGET_PROPERTIES(ct-static PROPERTIES OUTPUT_NAME ${static_lib_name}) SET_TARGET_PROPERTIES(ct PROPERTIES CLEAN_DIRECT_OUTPUT 1) SET_TARGET_PROPERTIES(ct-static PROPERTIES CLEAN_DIRECT_OUTPUT 1) target_link_libraries(ct-static tds replacements tdsutils ${lib_NETWORK} ${lib_BASE}) if(NOT WIN32) set_target_properties(ct PROPERTIES SOVERSION "4.0.0") endif() if(MINGW OR CYGWIN) set_target_properties(ct PROPERTIES LINK_FLAGS "--static") endif(MINGW OR CYGWIN) INSTALL(TARGETS ct ct-static PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) freetds-1.3.6/src/ctlib/unittests/000755 025423 025423 00000000000 14162303405 020527 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/ctlib/unittests/Makefile.am000644 025423 025423 00000004570 14107141721 022571 0ustar00fredianofrediano000000 000000 NULL= TESTS = \ t0001$(EXEEXT) \ t0002$(EXEEXT) \ t0003$(EXEEXT) \ t0004$(EXEEXT) \ t0005$(EXEEXT) \ cs_convert$(EXEEXT) \ t0007$(EXEEXT) \ t0008$(EXEEXT) \ t0009$(EXEEXT) \ connect_fail$(EXEEXT) \ ct_options$(EXEEXT) \ lang_ct_param$(EXEEXT) \ array_bind$(EXEEXT) \ cs_diag$(EXEEXT) \ get_send_data$(EXEEXT) \ rpc_ct_param$(EXEEXT) \ rpc_ct_setparam$(EXEEXT) \ ct_diagclient$(EXEEXT) \ ct_diagserver$(EXEEXT) \ ct_diagall$(EXEEXT) \ cs_config$(EXEEXT) \ cancel$(EXEEXT) \ blk_in$(EXEEXT) \ blk_out$(EXEEXT) \ ct_cursor$(EXEEXT) \ ct_cursors$(EXEEXT) \ ct_dynamic$(EXEEXT) \ blk_in2$(EXEEXT) \ datafmt$(EXEEXT) \ data$(EXEEXT) \ rpc_fail$(EXEEXT) \ row_count$(EXEEXT) \ all_types$(EXEEXT) \ long_binary$(EXEEXT) \ will_convert$(EXEEXT) \ variant$(EXEEXT) \ $(NULL) check_PROGRAMS = $(TESTS) t0001_SOURCES = t0001.c t0002_SOURCES = t0002.c t0003_SOURCES = t0003.c t0004_SOURCES = t0004.c t0005_SOURCES = t0005.c cs_convert_SOURCES = cs_convert.c t0007_SOURCES = t0007.c t0008_SOURCES = t0008.c t0009_SOURCES = t0009.c connect_fail_SOURCES = connect_fail.c ct_options_SOURCES = ct_options.c lang_ct_param_SOURCES = lang_ct_param.c array_bind_SOURCES = array_bind.c cs_diag_SOURCES = cs_diag.c get_send_data_SOURCES = get_send_data.c rpc_ct_param_SOURCES = rpc_ct_param.c rpc_ct_setparam_SOURCES = rpc_ct_setparam.c ct_diagclient_SOURCES = ct_diagclient.c ct_diagserver_SOURCES = ct_diagserver.c ct_diagall_SOURCES = ct_diagall.c cs_config_SOURCES = cs_config.c cancel_SOURCES = cancel.c blk_in_SOURCES = blk_in.h blk_in.c blk_out_SOURCES = blk_out.c ct_cursor_SOURCES = ct_cursor.c ct_cursors_SOURCES = ct_cursors.c ct_dynamic_SOURCES = ct_dynamic.c blk_in2_SOURCES = blk_in2.c datafmt_SOURCES = datafmt.c data_SOURCES = data.c rpc_fail_SOURCES = rpc_fail.c row_count_SOURCES = row_count.c all_types_SOURCES = all_types.c all_types_LDFLAGS = -static ../libct.la ../../tds/unittests/libcommon.a -shared long_binary_SOURCES = long_binary.c will_convert_SOURCES = will_convert.c variant_SOURCES = variant.c noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include if MINGW32 AM_LDFLAGS = -no-fast-install else AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" endif LDADD = libcommon.a ../libct.la ../../replacements/libreplacements.la $(LTLIBICONV) CLEANFILES = tdsdump.out EXTRA_DIST = CMakeLists.txt freetds-1.3.6/src/ctlib/unittests/Makefile.in000644 025423 025423 00000213267 14162303356 022614 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ TESTS = t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT) t0004$(EXEEXT) \ t0005$(EXEEXT) cs_convert$(EXEEXT) t0007$(EXEEXT) \ t0008$(EXEEXT) t0009$(EXEEXT) connect_fail$(EXEEXT) \ ct_options$(EXEEXT) lang_ct_param$(EXEEXT) array_bind$(EXEEXT) \ cs_diag$(EXEEXT) get_send_data$(EXEEXT) rpc_ct_param$(EXEEXT) \ rpc_ct_setparam$(EXEEXT) ct_diagclient$(EXEEXT) \ ct_diagserver$(EXEEXT) ct_diagall$(EXEEXT) cs_config$(EXEEXT) \ cancel$(EXEEXT) blk_in$(EXEEXT) blk_out$(EXEEXT) \ ct_cursor$(EXEEXT) ct_cursors$(EXEEXT) ct_dynamic$(EXEEXT) \ blk_in2$(EXEEXT) datafmt$(EXEEXT) data$(EXEEXT) \ rpc_fail$(EXEEXT) row_count$(EXEEXT) all_types$(EXEEXT) \ long_binary$(EXEEXT) will_convert$(EXEEXT) variant$(EXEEXT) \ $(am__EXEEXT_1) check_PROGRAMS = $(am__EXEEXT_2) subdir = src/ctlib/unittests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = am__EXEEXT_2 = t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT) \ t0004$(EXEEXT) t0005$(EXEEXT) cs_convert$(EXEEXT) \ t0007$(EXEEXT) t0008$(EXEEXT) t0009$(EXEEXT) \ connect_fail$(EXEEXT) ct_options$(EXEEXT) \ lang_ct_param$(EXEEXT) array_bind$(EXEEXT) cs_diag$(EXEEXT) \ get_send_data$(EXEEXT) rpc_ct_param$(EXEEXT) \ rpc_ct_setparam$(EXEEXT) ct_diagclient$(EXEEXT) \ ct_diagserver$(EXEEXT) ct_diagall$(EXEEXT) cs_config$(EXEEXT) \ cancel$(EXEEXT) blk_in$(EXEEXT) blk_out$(EXEEXT) \ ct_cursor$(EXEEXT) ct_cursors$(EXEEXT) ct_dynamic$(EXEEXT) \ blk_in2$(EXEEXT) datafmt$(EXEEXT) data$(EXEEXT) \ rpc_fail$(EXEEXT) row_count$(EXEEXT) all_types$(EXEEXT) \ long_binary$(EXEEXT) will_convert$(EXEEXT) variant$(EXEEXT) \ $(am__EXEEXT_1) LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libcommon_a_AR = $(AR) $(ARFLAGS) libcommon_a_LIBADD = am_libcommon_a_OBJECTS = common.$(OBJEXT) libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) am_all_types_OBJECTS = all_types.$(OBJEXT) all_types_OBJECTS = $(am_all_types_OBJECTS) all_types_LDADD = $(LDADD) am__DEPENDENCIES_1 = all_types_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = all_types_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(all_types_LDFLAGS) $(LDFLAGS) -o $@ am_array_bind_OBJECTS = array_bind.$(OBJEXT) array_bind_OBJECTS = $(am_array_bind_OBJECTS) array_bind_LDADD = $(LDADD) array_bind_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_blk_in_OBJECTS = blk_in.$(OBJEXT) blk_in_OBJECTS = $(am_blk_in_OBJECTS) blk_in_LDADD = $(LDADD) blk_in_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_blk_in2_OBJECTS = blk_in2.$(OBJEXT) blk_in2_OBJECTS = $(am_blk_in2_OBJECTS) blk_in2_LDADD = $(LDADD) blk_in2_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_blk_out_OBJECTS = blk_out.$(OBJEXT) blk_out_OBJECTS = $(am_blk_out_OBJECTS) blk_out_LDADD = $(LDADD) blk_out_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_cancel_OBJECTS = cancel.$(OBJEXT) cancel_OBJECTS = $(am_cancel_OBJECTS) cancel_LDADD = $(LDADD) cancel_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_connect_fail_OBJECTS = connect_fail.$(OBJEXT) connect_fail_OBJECTS = $(am_connect_fail_OBJECTS) connect_fail_LDADD = $(LDADD) connect_fail_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_cs_config_OBJECTS = cs_config.$(OBJEXT) cs_config_OBJECTS = $(am_cs_config_OBJECTS) cs_config_LDADD = $(LDADD) cs_config_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_cs_convert_OBJECTS = cs_convert.$(OBJEXT) cs_convert_OBJECTS = $(am_cs_convert_OBJECTS) cs_convert_LDADD = $(LDADD) cs_convert_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_cs_diag_OBJECTS = cs_diag.$(OBJEXT) cs_diag_OBJECTS = $(am_cs_diag_OBJECTS) cs_diag_LDADD = $(LDADD) cs_diag_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_ct_cursor_OBJECTS = ct_cursor.$(OBJEXT) ct_cursor_OBJECTS = $(am_ct_cursor_OBJECTS) ct_cursor_LDADD = $(LDADD) ct_cursor_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_ct_cursors_OBJECTS = ct_cursors.$(OBJEXT) ct_cursors_OBJECTS = $(am_ct_cursors_OBJECTS) ct_cursors_LDADD = $(LDADD) ct_cursors_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_ct_diagall_OBJECTS = ct_diagall.$(OBJEXT) ct_diagall_OBJECTS = $(am_ct_diagall_OBJECTS) ct_diagall_LDADD = $(LDADD) ct_diagall_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_ct_diagclient_OBJECTS = ct_diagclient.$(OBJEXT) ct_diagclient_OBJECTS = $(am_ct_diagclient_OBJECTS) ct_diagclient_LDADD = $(LDADD) ct_diagclient_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_ct_diagserver_OBJECTS = ct_diagserver.$(OBJEXT) ct_diagserver_OBJECTS = $(am_ct_diagserver_OBJECTS) ct_diagserver_LDADD = $(LDADD) ct_diagserver_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_ct_dynamic_OBJECTS = ct_dynamic.$(OBJEXT) ct_dynamic_OBJECTS = $(am_ct_dynamic_OBJECTS) ct_dynamic_LDADD = $(LDADD) ct_dynamic_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_ct_options_OBJECTS = ct_options.$(OBJEXT) ct_options_OBJECTS = $(am_ct_options_OBJECTS) ct_options_LDADD = $(LDADD) ct_options_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_data_OBJECTS = data.$(OBJEXT) data_OBJECTS = $(am_data_OBJECTS) data_LDADD = $(LDADD) data_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_datafmt_OBJECTS = datafmt.$(OBJEXT) datafmt_OBJECTS = $(am_datafmt_OBJECTS) datafmt_LDADD = $(LDADD) datafmt_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_get_send_data_OBJECTS = get_send_data.$(OBJEXT) get_send_data_OBJECTS = $(am_get_send_data_OBJECTS) get_send_data_LDADD = $(LDADD) get_send_data_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_lang_ct_param_OBJECTS = lang_ct_param.$(OBJEXT) lang_ct_param_OBJECTS = $(am_lang_ct_param_OBJECTS) lang_ct_param_LDADD = $(LDADD) lang_ct_param_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_long_binary_OBJECTS = long_binary.$(OBJEXT) long_binary_OBJECTS = $(am_long_binary_OBJECTS) long_binary_LDADD = $(LDADD) long_binary_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_row_count_OBJECTS = row_count.$(OBJEXT) row_count_OBJECTS = $(am_row_count_OBJECTS) row_count_LDADD = $(LDADD) row_count_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_rpc_ct_param_OBJECTS = rpc_ct_param.$(OBJEXT) rpc_ct_param_OBJECTS = $(am_rpc_ct_param_OBJECTS) rpc_ct_param_LDADD = $(LDADD) rpc_ct_param_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_rpc_ct_setparam_OBJECTS = rpc_ct_setparam.$(OBJEXT) rpc_ct_setparam_OBJECTS = $(am_rpc_ct_setparam_OBJECTS) rpc_ct_setparam_LDADD = $(LDADD) rpc_ct_setparam_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_rpc_fail_OBJECTS = rpc_fail.$(OBJEXT) rpc_fail_OBJECTS = $(am_rpc_fail_OBJECTS) rpc_fail_LDADD = $(LDADD) rpc_fail_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0001_OBJECTS = t0001.$(OBJEXT) t0001_OBJECTS = $(am_t0001_OBJECTS) t0001_LDADD = $(LDADD) t0001_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0002_OBJECTS = t0002.$(OBJEXT) t0002_OBJECTS = $(am_t0002_OBJECTS) t0002_LDADD = $(LDADD) t0002_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0003_OBJECTS = t0003.$(OBJEXT) t0003_OBJECTS = $(am_t0003_OBJECTS) t0003_LDADD = $(LDADD) t0003_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0004_OBJECTS = t0004.$(OBJEXT) t0004_OBJECTS = $(am_t0004_OBJECTS) t0004_LDADD = $(LDADD) t0004_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0005_OBJECTS = t0005.$(OBJEXT) t0005_OBJECTS = $(am_t0005_OBJECTS) t0005_LDADD = $(LDADD) t0005_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0007_OBJECTS = t0007.$(OBJEXT) t0007_OBJECTS = $(am_t0007_OBJECTS) t0007_LDADD = $(LDADD) t0007_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0008_OBJECTS = t0008.$(OBJEXT) t0008_OBJECTS = $(am_t0008_OBJECTS) t0008_LDADD = $(LDADD) t0008_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_t0009_OBJECTS = t0009.$(OBJEXT) t0009_OBJECTS = $(am_t0009_OBJECTS) t0009_LDADD = $(LDADD) t0009_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_variant_OBJECTS = variant.$(OBJEXT) variant_OBJECTS = $(am_variant_OBJECTS) variant_LDADD = $(LDADD) variant_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) am_will_convert_OBJECTS = will_convert.$(OBJEXT) will_convert_OBJECTS = $(am_will_convert_OBJECTS) will_convert_LDADD = $(LDADD) will_convert_DEPENDENCIES = libcommon.a ../libct.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/all_types.Po \ ./$(DEPDIR)/array_bind.Po ./$(DEPDIR)/blk_in.Po \ ./$(DEPDIR)/blk_in2.Po ./$(DEPDIR)/blk_out.Po \ ./$(DEPDIR)/cancel.Po ./$(DEPDIR)/common.Po \ ./$(DEPDIR)/connect_fail.Po ./$(DEPDIR)/cs_config.Po \ ./$(DEPDIR)/cs_convert.Po ./$(DEPDIR)/cs_diag.Po \ ./$(DEPDIR)/ct_cursor.Po ./$(DEPDIR)/ct_cursors.Po \ ./$(DEPDIR)/ct_diagall.Po ./$(DEPDIR)/ct_diagclient.Po \ ./$(DEPDIR)/ct_diagserver.Po ./$(DEPDIR)/ct_dynamic.Po \ ./$(DEPDIR)/ct_options.Po ./$(DEPDIR)/data.Po \ ./$(DEPDIR)/datafmt.Po ./$(DEPDIR)/get_send_data.Po \ ./$(DEPDIR)/lang_ct_param.Po ./$(DEPDIR)/long_binary.Po \ ./$(DEPDIR)/row_count.Po ./$(DEPDIR)/rpc_ct_param.Po \ ./$(DEPDIR)/rpc_ct_setparam.Po ./$(DEPDIR)/rpc_fail.Po \ ./$(DEPDIR)/t0001.Po ./$(DEPDIR)/t0002.Po ./$(DEPDIR)/t0003.Po \ ./$(DEPDIR)/t0004.Po ./$(DEPDIR)/t0005.Po ./$(DEPDIR)/t0007.Po \ ./$(DEPDIR)/t0008.Po ./$(DEPDIR)/t0009.Po \ ./$(DEPDIR)/variant.Po ./$(DEPDIR)/will_convert.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcommon_a_SOURCES) $(all_types_SOURCES) \ $(array_bind_SOURCES) $(blk_in_SOURCES) $(blk_in2_SOURCES) \ $(blk_out_SOURCES) $(cancel_SOURCES) $(connect_fail_SOURCES) \ $(cs_config_SOURCES) $(cs_convert_SOURCES) $(cs_diag_SOURCES) \ $(ct_cursor_SOURCES) $(ct_cursors_SOURCES) \ $(ct_diagall_SOURCES) $(ct_diagclient_SOURCES) \ $(ct_diagserver_SOURCES) $(ct_dynamic_SOURCES) \ $(ct_options_SOURCES) $(data_SOURCES) $(datafmt_SOURCES) \ $(get_send_data_SOURCES) $(lang_ct_param_SOURCES) \ $(long_binary_SOURCES) $(row_count_SOURCES) \ $(rpc_ct_param_SOURCES) $(rpc_ct_setparam_SOURCES) \ $(rpc_fail_SOURCES) $(t0001_SOURCES) $(t0002_SOURCES) \ $(t0003_SOURCES) $(t0004_SOURCES) $(t0005_SOURCES) \ $(t0007_SOURCES) $(t0008_SOURCES) $(t0009_SOURCES) \ $(variant_SOURCES) $(will_convert_SOURCES) DIST_SOURCES = $(libcommon_a_SOURCES) $(all_types_SOURCES) \ $(array_bind_SOURCES) $(blk_in_SOURCES) $(blk_in2_SOURCES) \ $(blk_out_SOURCES) $(cancel_SOURCES) $(connect_fail_SOURCES) \ $(cs_config_SOURCES) $(cs_convert_SOURCES) $(cs_diag_SOURCES) \ $(ct_cursor_SOURCES) $(ct_cursors_SOURCES) \ $(ct_diagall_SOURCES) $(ct_diagclient_SOURCES) \ $(ct_diagserver_SOURCES) $(ct_dynamic_SOURCES) \ $(ct_options_SOURCES) $(data_SOURCES) $(datafmt_SOURCES) \ $(get_send_data_SOURCES) $(lang_ct_param_SOURCES) \ $(long_binary_SOURCES) $(row_count_SOURCES) \ $(rpc_ct_param_SOURCES) $(rpc_ct_setparam_SOURCES) \ $(rpc_fail_SOURCES) $(t0001_SOURCES) $(t0002_SOURCES) \ $(t0003_SOURCES) $(t0004_SOURCES) $(t0005_SOURCES) \ $(t0007_SOURCES) $(t0008_SOURCES) $(t0009_SOURCES) \ $(variant_SOURCES) $(will_convert_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = t0001_SOURCES = t0001.c t0002_SOURCES = t0002.c t0003_SOURCES = t0003.c t0004_SOURCES = t0004.c t0005_SOURCES = t0005.c cs_convert_SOURCES = cs_convert.c t0007_SOURCES = t0007.c t0008_SOURCES = t0008.c t0009_SOURCES = t0009.c connect_fail_SOURCES = connect_fail.c ct_options_SOURCES = ct_options.c lang_ct_param_SOURCES = lang_ct_param.c array_bind_SOURCES = array_bind.c cs_diag_SOURCES = cs_diag.c get_send_data_SOURCES = get_send_data.c rpc_ct_param_SOURCES = rpc_ct_param.c rpc_ct_setparam_SOURCES = rpc_ct_setparam.c ct_diagclient_SOURCES = ct_diagclient.c ct_diagserver_SOURCES = ct_diagserver.c ct_diagall_SOURCES = ct_diagall.c cs_config_SOURCES = cs_config.c cancel_SOURCES = cancel.c blk_in_SOURCES = blk_in.h blk_in.c blk_out_SOURCES = blk_out.c ct_cursor_SOURCES = ct_cursor.c ct_cursors_SOURCES = ct_cursors.c ct_dynamic_SOURCES = ct_dynamic.c blk_in2_SOURCES = blk_in2.c datafmt_SOURCES = datafmt.c data_SOURCES = data.c rpc_fail_SOURCES = rpc_fail.c row_count_SOURCES = row_count.c all_types_SOURCES = all_types.c all_types_LDFLAGS = -static ../libct.la ../../tds/unittests/libcommon.a -shared long_binary_SOURCES = long_binary.c will_convert_SOURCES = will_convert.c variant_SOURCES = variant.c noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include @MINGW32_FALSE@AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" @MINGW32_TRUE@AM_LDFLAGS = -no-fast-install LDADD = libcommon.a ../libct.la ../../replacements/libreplacements.la $(LTLIBICONV) CLEANFILES = tdsdump.out EXTRA_DIST = CMakeLists.txt all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/ctlib/unittests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/ctlib/unittests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) $(EXTRA_libcommon_a_DEPENDENCIES) $(AM_V_at)-rm -f libcommon.a $(AM_V_AR)$(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) $(AM_V_at)$(RANLIB) libcommon.a all_types$(EXEEXT): $(all_types_OBJECTS) $(all_types_DEPENDENCIES) $(EXTRA_all_types_DEPENDENCIES) @rm -f all_types$(EXEEXT) $(AM_V_CCLD)$(all_types_LINK) $(all_types_OBJECTS) $(all_types_LDADD) $(LIBS) array_bind$(EXEEXT): $(array_bind_OBJECTS) $(array_bind_DEPENDENCIES) $(EXTRA_array_bind_DEPENDENCIES) @rm -f array_bind$(EXEEXT) $(AM_V_CCLD)$(LINK) $(array_bind_OBJECTS) $(array_bind_LDADD) $(LIBS) blk_in$(EXEEXT): $(blk_in_OBJECTS) $(blk_in_DEPENDENCIES) $(EXTRA_blk_in_DEPENDENCIES) @rm -f blk_in$(EXEEXT) $(AM_V_CCLD)$(LINK) $(blk_in_OBJECTS) $(blk_in_LDADD) $(LIBS) blk_in2$(EXEEXT): $(blk_in2_OBJECTS) $(blk_in2_DEPENDENCIES) $(EXTRA_blk_in2_DEPENDENCIES) @rm -f blk_in2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(blk_in2_OBJECTS) $(blk_in2_LDADD) $(LIBS) blk_out$(EXEEXT): $(blk_out_OBJECTS) $(blk_out_DEPENDENCIES) $(EXTRA_blk_out_DEPENDENCIES) @rm -f blk_out$(EXEEXT) $(AM_V_CCLD)$(LINK) $(blk_out_OBJECTS) $(blk_out_LDADD) $(LIBS) cancel$(EXEEXT): $(cancel_OBJECTS) $(cancel_DEPENDENCIES) $(EXTRA_cancel_DEPENDENCIES) @rm -f cancel$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cancel_OBJECTS) $(cancel_LDADD) $(LIBS) connect_fail$(EXEEXT): $(connect_fail_OBJECTS) $(connect_fail_DEPENDENCIES) $(EXTRA_connect_fail_DEPENDENCIES) @rm -f connect_fail$(EXEEXT) $(AM_V_CCLD)$(LINK) $(connect_fail_OBJECTS) $(connect_fail_LDADD) $(LIBS) cs_config$(EXEEXT): $(cs_config_OBJECTS) $(cs_config_DEPENDENCIES) $(EXTRA_cs_config_DEPENDENCIES) @rm -f cs_config$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cs_config_OBJECTS) $(cs_config_LDADD) $(LIBS) cs_convert$(EXEEXT): $(cs_convert_OBJECTS) $(cs_convert_DEPENDENCIES) $(EXTRA_cs_convert_DEPENDENCIES) @rm -f cs_convert$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cs_convert_OBJECTS) $(cs_convert_LDADD) $(LIBS) cs_diag$(EXEEXT): $(cs_diag_OBJECTS) $(cs_diag_DEPENDENCIES) $(EXTRA_cs_diag_DEPENDENCIES) @rm -f cs_diag$(EXEEXT) $(AM_V_CCLD)$(LINK) $(cs_diag_OBJECTS) $(cs_diag_LDADD) $(LIBS) ct_cursor$(EXEEXT): $(ct_cursor_OBJECTS) $(ct_cursor_DEPENDENCIES) $(EXTRA_ct_cursor_DEPENDENCIES) @rm -f ct_cursor$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ct_cursor_OBJECTS) $(ct_cursor_LDADD) $(LIBS) ct_cursors$(EXEEXT): $(ct_cursors_OBJECTS) $(ct_cursors_DEPENDENCIES) $(EXTRA_ct_cursors_DEPENDENCIES) @rm -f ct_cursors$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ct_cursors_OBJECTS) $(ct_cursors_LDADD) $(LIBS) ct_diagall$(EXEEXT): $(ct_diagall_OBJECTS) $(ct_diagall_DEPENDENCIES) $(EXTRA_ct_diagall_DEPENDENCIES) @rm -f ct_diagall$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ct_diagall_OBJECTS) $(ct_diagall_LDADD) $(LIBS) ct_diagclient$(EXEEXT): $(ct_diagclient_OBJECTS) $(ct_diagclient_DEPENDENCIES) $(EXTRA_ct_diagclient_DEPENDENCIES) @rm -f ct_diagclient$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ct_diagclient_OBJECTS) $(ct_diagclient_LDADD) $(LIBS) ct_diagserver$(EXEEXT): $(ct_diagserver_OBJECTS) $(ct_diagserver_DEPENDENCIES) $(EXTRA_ct_diagserver_DEPENDENCIES) @rm -f ct_diagserver$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ct_diagserver_OBJECTS) $(ct_diagserver_LDADD) $(LIBS) ct_dynamic$(EXEEXT): $(ct_dynamic_OBJECTS) $(ct_dynamic_DEPENDENCIES) $(EXTRA_ct_dynamic_DEPENDENCIES) @rm -f ct_dynamic$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ct_dynamic_OBJECTS) $(ct_dynamic_LDADD) $(LIBS) ct_options$(EXEEXT): $(ct_options_OBJECTS) $(ct_options_DEPENDENCIES) $(EXTRA_ct_options_DEPENDENCIES) @rm -f ct_options$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ct_options_OBJECTS) $(ct_options_LDADD) $(LIBS) data$(EXEEXT): $(data_OBJECTS) $(data_DEPENDENCIES) $(EXTRA_data_DEPENDENCIES) @rm -f data$(EXEEXT) $(AM_V_CCLD)$(LINK) $(data_OBJECTS) $(data_LDADD) $(LIBS) datafmt$(EXEEXT): $(datafmt_OBJECTS) $(datafmt_DEPENDENCIES) $(EXTRA_datafmt_DEPENDENCIES) @rm -f datafmt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(datafmt_OBJECTS) $(datafmt_LDADD) $(LIBS) get_send_data$(EXEEXT): $(get_send_data_OBJECTS) $(get_send_data_DEPENDENCIES) $(EXTRA_get_send_data_DEPENDENCIES) @rm -f get_send_data$(EXEEXT) $(AM_V_CCLD)$(LINK) $(get_send_data_OBJECTS) $(get_send_data_LDADD) $(LIBS) lang_ct_param$(EXEEXT): $(lang_ct_param_OBJECTS) $(lang_ct_param_DEPENDENCIES) $(EXTRA_lang_ct_param_DEPENDENCIES) @rm -f lang_ct_param$(EXEEXT) $(AM_V_CCLD)$(LINK) $(lang_ct_param_OBJECTS) $(lang_ct_param_LDADD) $(LIBS) long_binary$(EXEEXT): $(long_binary_OBJECTS) $(long_binary_DEPENDENCIES) $(EXTRA_long_binary_DEPENDENCIES) @rm -f long_binary$(EXEEXT) $(AM_V_CCLD)$(LINK) $(long_binary_OBJECTS) $(long_binary_LDADD) $(LIBS) row_count$(EXEEXT): $(row_count_OBJECTS) $(row_count_DEPENDENCIES) $(EXTRA_row_count_DEPENDENCIES) @rm -f row_count$(EXEEXT) $(AM_V_CCLD)$(LINK) $(row_count_OBJECTS) $(row_count_LDADD) $(LIBS) rpc_ct_param$(EXEEXT): $(rpc_ct_param_OBJECTS) $(rpc_ct_param_DEPENDENCIES) $(EXTRA_rpc_ct_param_DEPENDENCIES) @rm -f rpc_ct_param$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rpc_ct_param_OBJECTS) $(rpc_ct_param_LDADD) $(LIBS) rpc_ct_setparam$(EXEEXT): $(rpc_ct_setparam_OBJECTS) $(rpc_ct_setparam_DEPENDENCIES) $(EXTRA_rpc_ct_setparam_DEPENDENCIES) @rm -f rpc_ct_setparam$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rpc_ct_setparam_OBJECTS) $(rpc_ct_setparam_LDADD) $(LIBS) rpc_fail$(EXEEXT): $(rpc_fail_OBJECTS) $(rpc_fail_DEPENDENCIES) $(EXTRA_rpc_fail_DEPENDENCIES) @rm -f rpc_fail$(EXEEXT) $(AM_V_CCLD)$(LINK) $(rpc_fail_OBJECTS) $(rpc_fail_LDADD) $(LIBS) t0001$(EXEEXT): $(t0001_OBJECTS) $(t0001_DEPENDENCIES) $(EXTRA_t0001_DEPENDENCIES) @rm -f t0001$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0001_OBJECTS) $(t0001_LDADD) $(LIBS) t0002$(EXEEXT): $(t0002_OBJECTS) $(t0002_DEPENDENCIES) $(EXTRA_t0002_DEPENDENCIES) @rm -f t0002$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0002_OBJECTS) $(t0002_LDADD) $(LIBS) t0003$(EXEEXT): $(t0003_OBJECTS) $(t0003_DEPENDENCIES) $(EXTRA_t0003_DEPENDENCIES) @rm -f t0003$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0003_OBJECTS) $(t0003_LDADD) $(LIBS) t0004$(EXEEXT): $(t0004_OBJECTS) $(t0004_DEPENDENCIES) $(EXTRA_t0004_DEPENDENCIES) @rm -f t0004$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0004_OBJECTS) $(t0004_LDADD) $(LIBS) t0005$(EXEEXT): $(t0005_OBJECTS) $(t0005_DEPENDENCIES) $(EXTRA_t0005_DEPENDENCIES) @rm -f t0005$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0005_OBJECTS) $(t0005_LDADD) $(LIBS) t0007$(EXEEXT): $(t0007_OBJECTS) $(t0007_DEPENDENCIES) $(EXTRA_t0007_DEPENDENCIES) @rm -f t0007$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0007_OBJECTS) $(t0007_LDADD) $(LIBS) t0008$(EXEEXT): $(t0008_OBJECTS) $(t0008_DEPENDENCIES) $(EXTRA_t0008_DEPENDENCIES) @rm -f t0008$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0008_OBJECTS) $(t0008_LDADD) $(LIBS) t0009$(EXEEXT): $(t0009_OBJECTS) $(t0009_DEPENDENCIES) $(EXTRA_t0009_DEPENDENCIES) @rm -f t0009$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0009_OBJECTS) $(t0009_LDADD) $(LIBS) variant$(EXEEXT): $(variant_OBJECTS) $(variant_DEPENDENCIES) $(EXTRA_variant_DEPENDENCIES) @rm -f variant$(EXEEXT) $(AM_V_CCLD)$(LINK) $(variant_OBJECTS) $(variant_LDADD) $(LIBS) will_convert$(EXEEXT): $(will_convert_OBJECTS) $(will_convert_DEPENDENCIES) $(EXTRA_will_convert_DEPENDENCIES) @rm -f will_convert$(EXEEXT) $(AM_V_CCLD)$(LINK) $(will_convert_OBJECTS) $(will_convert_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/all_types.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array_bind.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blk_in.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blk_in2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blk_out.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cancel.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect_fail.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cs_config.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cs_convert.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cs_diag.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct_cursor.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct_cursors.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct_diagall.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct_diagclient.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct_diagserver.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct_dynamic.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ct_options.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datafmt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get_send_data.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lang_ct_param.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_binary.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/row_count.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc_ct_param.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc_ct_setparam.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc_fail.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0001.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0002.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0003.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0004.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0005.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0007.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0008.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0009.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/variant.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/will_convert.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? t0001.log: t0001$(EXEEXT) @p='t0001$(EXEEXT)'; \ b='t0001'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0002.log: t0002$(EXEEXT) @p='t0002$(EXEEXT)'; \ b='t0002'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0003.log: t0003$(EXEEXT) @p='t0003$(EXEEXT)'; \ b='t0003'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0004.log: t0004$(EXEEXT) @p='t0004$(EXEEXT)'; \ b='t0004'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0005.log: t0005$(EXEEXT) @p='t0005$(EXEEXT)'; \ b='t0005'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cs_convert.log: cs_convert$(EXEEXT) @p='cs_convert$(EXEEXT)'; \ b='cs_convert'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0007.log: t0007$(EXEEXT) @p='t0007$(EXEEXT)'; \ b='t0007'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0008.log: t0008$(EXEEXT) @p='t0008$(EXEEXT)'; \ b='t0008'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0009.log: t0009$(EXEEXT) @p='t0009$(EXEEXT)'; \ b='t0009'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) connect_fail.log: connect_fail$(EXEEXT) @p='connect_fail$(EXEEXT)'; \ b='connect_fail'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ct_options.log: ct_options$(EXEEXT) @p='ct_options$(EXEEXT)'; \ b='ct_options'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) lang_ct_param.log: lang_ct_param$(EXEEXT) @p='lang_ct_param$(EXEEXT)'; \ b='lang_ct_param'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) array_bind.log: array_bind$(EXEEXT) @p='array_bind$(EXEEXT)'; \ b='array_bind'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cs_diag.log: cs_diag$(EXEEXT) @p='cs_diag$(EXEEXT)'; \ b='cs_diag'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) get_send_data.log: get_send_data$(EXEEXT) @p='get_send_data$(EXEEXT)'; \ b='get_send_data'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) rpc_ct_param.log: rpc_ct_param$(EXEEXT) @p='rpc_ct_param$(EXEEXT)'; \ b='rpc_ct_param'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) rpc_ct_setparam.log: rpc_ct_setparam$(EXEEXT) @p='rpc_ct_setparam$(EXEEXT)'; \ b='rpc_ct_setparam'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ct_diagclient.log: ct_diagclient$(EXEEXT) @p='ct_diagclient$(EXEEXT)'; \ b='ct_diagclient'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ct_diagserver.log: ct_diagserver$(EXEEXT) @p='ct_diagserver$(EXEEXT)'; \ b='ct_diagserver'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ct_diagall.log: ct_diagall$(EXEEXT) @p='ct_diagall$(EXEEXT)'; \ b='ct_diagall'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cs_config.log: cs_config$(EXEEXT) @p='cs_config$(EXEEXT)'; \ b='cs_config'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) cancel.log: cancel$(EXEEXT) @p='cancel$(EXEEXT)'; \ b='cancel'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) blk_in.log: blk_in$(EXEEXT) @p='blk_in$(EXEEXT)'; \ b='blk_in'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) blk_out.log: blk_out$(EXEEXT) @p='blk_out$(EXEEXT)'; \ b='blk_out'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ct_cursor.log: ct_cursor$(EXEEXT) @p='ct_cursor$(EXEEXT)'; \ b='ct_cursor'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ct_cursors.log: ct_cursors$(EXEEXT) @p='ct_cursors$(EXEEXT)'; \ b='ct_cursors'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) ct_dynamic.log: ct_dynamic$(EXEEXT) @p='ct_dynamic$(EXEEXT)'; \ b='ct_dynamic'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) blk_in2.log: blk_in2$(EXEEXT) @p='blk_in2$(EXEEXT)'; \ b='blk_in2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) datafmt.log: datafmt$(EXEEXT) @p='datafmt$(EXEEXT)'; \ b='datafmt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) data.log: data$(EXEEXT) @p='data$(EXEEXT)'; \ b='data'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) rpc_fail.log: rpc_fail$(EXEEXT) @p='rpc_fail$(EXEEXT)'; \ b='rpc_fail'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) row_count.log: row_count$(EXEEXT) @p='row_count$(EXEEXT)'; \ b='row_count'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) all_types.log: all_types$(EXEEXT) @p='all_types$(EXEEXT)'; \ b='all_types'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) long_binary.log: long_binary$(EXEEXT) @p='long_binary$(EXEEXT)'; \ b='long_binary'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) will_convert.log: will_convert$(EXEEXT) @p='will_convert$(EXEEXT)'; \ b='will_convert'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) variant.log: variant$(EXEEXT) @p='variant$(EXEEXT)'; \ b='variant'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/all_types.Po -rm -f ./$(DEPDIR)/array_bind.Po -rm -f ./$(DEPDIR)/blk_in.Po -rm -f ./$(DEPDIR)/blk_in2.Po -rm -f ./$(DEPDIR)/blk_out.Po -rm -f ./$(DEPDIR)/cancel.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/connect_fail.Po -rm -f ./$(DEPDIR)/cs_config.Po -rm -f ./$(DEPDIR)/cs_convert.Po -rm -f ./$(DEPDIR)/cs_diag.Po -rm -f ./$(DEPDIR)/ct_cursor.Po -rm -f ./$(DEPDIR)/ct_cursors.Po -rm -f ./$(DEPDIR)/ct_diagall.Po -rm -f ./$(DEPDIR)/ct_diagclient.Po -rm -f ./$(DEPDIR)/ct_diagserver.Po -rm -f ./$(DEPDIR)/ct_dynamic.Po -rm -f ./$(DEPDIR)/ct_options.Po -rm -f ./$(DEPDIR)/data.Po -rm -f ./$(DEPDIR)/datafmt.Po -rm -f ./$(DEPDIR)/get_send_data.Po -rm -f ./$(DEPDIR)/lang_ct_param.Po -rm -f ./$(DEPDIR)/long_binary.Po -rm -f ./$(DEPDIR)/row_count.Po -rm -f ./$(DEPDIR)/rpc_ct_param.Po -rm -f ./$(DEPDIR)/rpc_ct_setparam.Po -rm -f ./$(DEPDIR)/rpc_fail.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/t0004.Po -rm -f ./$(DEPDIR)/t0005.Po -rm -f ./$(DEPDIR)/t0007.Po -rm -f ./$(DEPDIR)/t0008.Po -rm -f ./$(DEPDIR)/t0009.Po -rm -f ./$(DEPDIR)/variant.Po -rm -f ./$(DEPDIR)/will_convert.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/all_types.Po -rm -f ./$(DEPDIR)/array_bind.Po -rm -f ./$(DEPDIR)/blk_in.Po -rm -f ./$(DEPDIR)/blk_in2.Po -rm -f ./$(DEPDIR)/blk_out.Po -rm -f ./$(DEPDIR)/cancel.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/connect_fail.Po -rm -f ./$(DEPDIR)/cs_config.Po -rm -f ./$(DEPDIR)/cs_convert.Po -rm -f ./$(DEPDIR)/cs_diag.Po -rm -f ./$(DEPDIR)/ct_cursor.Po -rm -f ./$(DEPDIR)/ct_cursors.Po -rm -f ./$(DEPDIR)/ct_diagall.Po -rm -f ./$(DEPDIR)/ct_diagclient.Po -rm -f ./$(DEPDIR)/ct_diagserver.Po -rm -f ./$(DEPDIR)/ct_dynamic.Po -rm -f ./$(DEPDIR)/ct_options.Po -rm -f ./$(DEPDIR)/data.Po -rm -f ./$(DEPDIR)/datafmt.Po -rm -f ./$(DEPDIR)/get_send_data.Po -rm -f ./$(DEPDIR)/lang_ct_param.Po -rm -f ./$(DEPDIR)/long_binary.Po -rm -f ./$(DEPDIR)/row_count.Po -rm -f ./$(DEPDIR)/rpc_ct_param.Po -rm -f ./$(DEPDIR)/rpc_ct_setparam.Po -rm -f ./$(DEPDIR)/rpc_fail.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/t0004.Po -rm -f ./$(DEPDIR)/t0005.Po -rm -f ./$(DEPDIR)/t0007.Po -rm -f ./$(DEPDIR)/t0008.Po -rm -f ./$(DEPDIR)/t0009.Po -rm -f ./$(DEPDIR)/variant.Po -rm -f ./$(DEPDIR)/will_convert.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am recheck tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/ctlib/unittests/common.c000644 025423 025423 00000023511 14056414271 022173 0ustar00fredianofrediano000000 000000 #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif #ifndef DBNTWIN32 #include #endif #include #include "common.h" #ifdef TDS_STATIC_CAST #include "ctlib.h" #endif char USER[512]; char SERVER[512]; char PASSWORD[512]; char DATABASE[512]; COMMON_PWD common_pwd = {0}; static char *DIRNAME = NULL; static const char *BASENAME = NULL; static const char *PWD = "../../../PWD"; int cslibmsg_cb_invoked = 0; int clientmsg_cb_invoked = 0; int servermsg_cb_invoked = 0; static CS_RETCODE continue_logging_in(CS_CONTEXT ** ctx, CS_CONNECTION ** conn, CS_COMMAND ** cmd, int verbose); #if defined(__MINGW32__) || defined(_MSC_VER) static char * tds_dirname(char* path) { char *p, *p2; for (p = path + strlen(path); --p > path && (*p == '/' || *p == '\\');) *p = '\0'; p = strrchr(path, '/'); if (!p) p = path; p2 = strrchr(p, '\\'); if (p2) p = p2; *p = 0; return path; } #define dirname tds_dirname #endif CS_RETCODE read_login_info(void) { FILE *in = NULL; char line[512]; char *s1, *s2; if (common_pwd.initialized) { strcpy(USER, common_pwd.USER); strcpy(PASSWORD, common_pwd.PASSWORD); strcpy(SERVER, common_pwd.SERVER); strcpy(DATABASE, common_pwd.DATABASE); return CS_SUCCEED; } s1 = getenv("TDSPWDFILE"); if (s1 && s1[0]) in = fopen(s1, "r"); if (!in) in = fopen(PWD, "r"); if (!in) { fprintf(stderr, "Can not open PWD file \"%s\"\n\n", PWD); return CS_FAIL; } while (fgets(line, sizeof(line), in)) { s1 = strtok(line, "="); s2 = strtok(NULL, "\n"); if (!s1 || !s2) { continue; } if (!strcmp(s1, "UID")) { strcpy(USER, s2); } else if (!strcmp(s1, "SRV")) { strcpy(SERVER, s2); } else if (!strcmp(s1, "PWD")) { strcpy(PASSWORD, s2); } else if (!strcmp(s1, "DB")) { strcpy(DATABASE, s2); } } fclose(in); return CS_SUCCEED; } static CS_RETCODE establish_login(int argc, char **argv) { extern char *optarg; extern int optind; COMMON_PWD options = {0}; #if !defined(__MINGW32__) && !defined(_MSC_VER) int ch; #endif BASENAME = basename((char *)argv[0]); DIRNAME = dirname((char *)argv[0]); #if !defined(__MINGW32__) && !defined(_MSC_VER) /* process command line options (handy for manual testing) */ while ((ch = getopt(argc, argv, "U:P:S:D:f:m:v")) != -1) { switch (ch) { case 'U': strcpy(options.USER, optarg); break; case 'P': strcpy(options.PASSWORD, optarg); break; case 'S': strcpy(options.SERVER, optarg); break; case 'D': strcpy(options.DATABASE, optarg); break; case 'f': /* override default PWD file */ PWD = strdup(optarg); break; case 'm': common_pwd.maxlength = strtol(optarg, NULL, 10); case 'v': common_pwd.fverbose = 1; break; case '?': default: fprintf(stderr, "usage: %s [-v] [-f PWD]\n" " [-U username] [-P password]\n" " [-S servername] [-D database]\n" , BASENAME); exit(1); } } #endif read_login_info(); /* override PWD file with command-line options */ if (*options.USER) strcpy(USER, options.USER); if (*options.PASSWORD) strcpy(PASSWORD, options.PASSWORD); if (*options.SERVER) strcpy(SERVER, options.SERVER); if (*options.DATABASE) strcpy(DATABASE, options.DATABASE); return (*USER && *SERVER && *DATABASE)? CS_SUCCEED : CS_FAIL; } CS_RETCODE try_ctlogin_with_options(int argc, char **argv, CS_CONTEXT ** ctx, CS_CONNECTION ** conn, CS_COMMAND ** cmd, int verbose) { CS_RETCODE ret; if ((ret = establish_login(argc, argv)) != CS_SUCCEED) { if (verbose) { fprintf(stderr, "read_login_info() failed!\n"); } return ret; } return continue_logging_in(ctx, conn, cmd, verbose); } /* old way: because I'm too lazy to change every unit test */ CS_RETCODE try_ctlogin(CS_CONTEXT ** ctx, CS_CONNECTION ** conn, CS_COMMAND ** cmd, int verbose) { CS_RETCODE ret; if ((ret = read_login_info()) != CS_SUCCEED) { if (verbose) { fprintf(stderr, "read_login_info() failed!\n"); } return ret; } return continue_logging_in(ctx, conn, cmd, verbose); } CS_RETCODE continue_logging_in(CS_CONTEXT ** ctx, CS_CONNECTION ** conn, CS_COMMAND ** cmd, int verbose) { CS_RETCODE ret; char query[512+10]; #ifdef TDS_STATIC_CAST TDSCONTEXT *tds_ctx; #endif ret = cs_ctx_alloc(CS_VERSION_100, ctx); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Context Alloc failed!\n"); } return ret; } #ifdef TDS_STATIC_CAST /* Force default date format, some tests rely on it */ tds_ctx = (TDSCONTEXT *) (*ctx)->tds_ctx; if (tds_ctx && tds_ctx->locale && tds_ctx->locale->date_fmt) { free(tds_ctx->locale->date_fmt); tds_ctx->locale->date_fmt = strdup("%b %d %Y %I:%M%p"); } #endif ret = ct_init(*ctx, CS_VERSION_100); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Library Init failed!\n"); } return ret; } if ((ret = ct_callback(*ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID*) clientmsg_cb)) != CS_SUCCEED) { fprintf(stderr, "ct_callback() failed\n"); return ret; } if ((ret = ct_callback(*ctx, NULL, CS_SET, CS_SERVERMSG_CB, servermsg_cb)) != CS_SUCCEED) { fprintf(stderr, "ct_callback() failed\n"); return ret; } ret = ct_con_alloc(*ctx, conn); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Connect Alloc failed!\n"); } return ret; } ret = ct_con_props(*conn, CS_SET, CS_USERNAME, USER, CS_NULLTERM, NULL); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "ct_con_props() SET USERNAME failed!\n"); } return ret; } ret = ct_con_props(*conn, CS_SET, CS_PASSWORD, PASSWORD, CS_NULLTERM, NULL); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "ct_con_props() SET PASSWORD failed!\n"); } return ret; } printf("connecting as %s to %s.%s\n", USER, SERVER, DATABASE); ret = ct_connect(*conn, SERVER, CS_NULLTERM); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Connection failed!\n"); } ct_con_drop(*conn); *conn = NULL; cs_ctx_drop(*ctx); *ctx = NULL; return ret; } ret = ct_cmd_alloc(*conn, cmd); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Command Alloc failed!\n"); } ct_con_drop(*conn); *conn = NULL; cs_ctx_drop(*ctx); *ctx = NULL; return ret; } sprintf(query, "use %s", DATABASE); ret = run_command(*cmd, query); if (ret != CS_SUCCEED) return ret; return CS_SUCCEED; } CS_RETCODE try_ctlogout(CS_CONTEXT * ctx, CS_CONNECTION * conn, CS_COMMAND * cmd, int verbose) { CS_RETCODE ret; ret = ct_cancel(conn, NULL, CS_CANCEL_ALL); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "ct_cancel() failed!\n"); } return ret; } ct_cmd_drop(cmd); ct_close(conn, CS_UNUSED); ct_con_drop(conn); ct_exit(ctx, CS_UNUSED); cs_ctx_drop(ctx); return CS_SUCCEED; } /* Run commands from which we expect no results returned */ CS_RETCODE run_command(CS_COMMAND * cmd, const char *sql) { CS_RETCODE ret, results_ret; CS_INT result_type; if (cmd == NULL) { return CS_FAIL; } ret = ct_command(cmd, CS_LANG_CMD, sql, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return ret; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); /* return CS_FAIL; */ break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return CS_FAIL; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return CS_FAIL; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return CS_FAIL; } return CS_SUCCEED; } CS_INT cslibmsg_cb(CS_CONTEXT * connection, CS_CLIENTMSG * errmsg) { cslibmsg_cb_invoked++; fprintf(stderr, "\nCS-Library Message:\n"); fprintf(stderr, "number %d layer %d origin %d severity %d number %d\n", errmsg->msgnumber, CS_LAYER(errmsg->msgnumber), CS_ORIGIN(errmsg->msgnumber), CS_SEVERITY(errmsg->msgnumber), CS_NUMBER(errmsg->msgnumber)); fprintf(stderr, "msgstring: %s\n", errmsg->msgstring); fprintf(stderr, "osstring: %s\n", (errmsg->osstringlen > 0) ? errmsg->osstring : "(null)"); return CS_SUCCEED; } CS_RETCODE clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg) { clientmsg_cb_invoked++; fprintf(stderr, "\nOpen Client Message:\n"); fprintf(stderr, "number %d layer %d origin %d severity %d number %d\n", errmsg->msgnumber, CS_LAYER(errmsg->msgnumber), CS_ORIGIN(errmsg->msgnumber), CS_SEVERITY(errmsg->msgnumber), CS_NUMBER(errmsg->msgnumber)); fprintf(stderr, "msgstring: %s\n", errmsg->msgstring); fprintf(stderr, "osstring: %s\n", (errmsg->osstringlen > 0) ? errmsg->osstring : "(null)"); return CS_SUCCEED; } CS_RETCODE servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg) { servermsg_cb_invoked++; if (srvmsg->msgnumber == 5701 || srvmsg->msgnumber == 5703) { fprintf(stderr, "%s\n", srvmsg->text); return CS_SUCCEED; } fprintf(stderr, "%s Message %d severity %d state %d line %d:\n", srvmsg->svrnlen > 0? srvmsg->svrname : "Server", srvmsg->msgnumber, srvmsg->severity, srvmsg->state, srvmsg->line); if (srvmsg->proclen > 0) fprintf(stderr, "proc %s: ", srvmsg->proc); fprintf(stderr, "\t\"%s\"\n", srvmsg->text); return CS_SUCCEED; } const char * res_type_str(CS_RETCODE ret) { static char str[64]; #define S(s) case s: return #s; switch ((int) ret) { S(CS_ROW_RESULT) S(CS_PARAM_RESULT) S(CS_STATUS_RESULT) S(CS_MSG_RESULT) S(CS_CMD_SUCCEED) S(CS_CMD_DONE) S(CS_CMD_FAIL) S(CS_COMPUTE_RESULT) #undef S } sprintf(str, "?? (%d)", (int) ret); return str; } freetds-1.3.6/src/ctlib/unittests/common.h000644 025423 025423 00000002273 14056414221 022175 0ustar00fredianofrediano000000 000000 #ifndef _freetds_ctlib_common_h #define _freetds_ctlib_common_h extern char SERVER[512]; extern char DATABASE[512]; extern char USER[512]; extern char PASSWORD[512]; typedef struct { int initialized; char SERVER[512]; char DATABASE[512]; char USER[512]; char PASSWORD[512]; char fverbose; int maxlength; } COMMON_PWD; extern COMMON_PWD common_pwd; CS_RETCODE read_login_info(void); extern int cslibmsg_cb_invoked; extern int clientmsg_cb_invoked; extern int servermsg_cb_invoked; CS_RETCODE try_ctlogin(CS_CONTEXT ** ctx, CS_CONNECTION ** conn, CS_COMMAND ** cmd, int verbose); CS_RETCODE try_ctlogin_with_options(int argc, char **argv, CS_CONTEXT ** ctx, CS_CONNECTION ** conn, CS_COMMAND ** cmd, int verbose); CS_RETCODE try_ctlogout(CS_CONTEXT * ctx, CS_CONNECTION * conn, CS_COMMAND * cmd, int verbose); CS_RETCODE run_command(CS_COMMAND * cmd, const char *sql); CS_RETCODE cslibmsg_cb(CS_CONTEXT * connection, CS_CLIENTMSG * errmsg); CS_RETCODE clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg); CS_RETCODE servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg); const char *res_type_str(CS_RETCODE ret); #endif freetds-1.3.6/src/ctlib/unittests/all_types.c000644 025423 025423 00000004344 14056414271 022702 0ustar00fredianofrediano000000 000000 /* try all types from server */ #undef NDEBUG #include #include #include #include "common.h" #include #include #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #include "../../tds/unittests/common.h" #include static CS_CONTEXT *ctx = NULL; static void test_type(TDSSOCKET *tds, TDSCOLUMN *col) { TDSRESULTINFO *resinfo, *bindinfo; TDSCOLUMN *oldcol, *bindcol; char out_buf[256]; CS_INT len; /* we should be able to support a type coming from server */ if (_ct_get_client_type(col, false) == CS_ILLEGAL_TYPE) { fprintf(stderr, "not supported\n"); assert(0); } /* try to convert anyway, this should succeed */ resinfo = tds_alloc_results(1); assert(resinfo); bindinfo = tds_alloc_results(1); assert(bindinfo); /* hack to pass our column to _ct_bind_data */ oldcol = resinfo->columns[0]; resinfo->columns[0] = col; memset(out_buf, '-', sizeof(out_buf)); bindcol = bindinfo->columns[0]; bindcol->column_varaddr = out_buf; bindcol->column_bindlen = sizeof(out_buf); bindcol->column_bindtype = CS_CHAR_TYPE; bindcol->column_bindfmt = CS_FMT_NULLTERM; len = -1; bindcol->column_lenbind = &len; /* every column should be at least be convertible to something */ if (_ct_bind_data(ctx, resinfo, bindinfo, 0)) { fprintf(stderr, "conversion failed\n"); assert(0); } /* just safety, we use small data for now */ assert(len < sizeof(out_buf)); /* we said terminated, check for terminator */ assert(len >= 1 && len < sizeof(out_buf)); assert(out_buf[len - 1] == 0); printf("output (%d): %s\n", len, out_buf); resinfo->columns[0] = oldcol; tds_free_results(resinfo); tds_free_results(bindinfo); } int main(int argc, char **argv) { TDSCONTEXT *tds_ctx; TDSSOCKET *tds; CS_RETCODE ret; tdsdump_open(getenv("TDSDUMP")); ret = cs_ctx_alloc(CS_VERSION_100, &ctx); assert(ret == CS_SUCCEED); tds_ctx = tds_alloc_context(NULL); assert(tds_ctx); tds = tds_alloc_socket(tds_ctx, 512); assert(tds); tds->conn->use_iconv = 0; if (TDS_FAILED(tds_iconv_open(tds->conn, "UTF-8", 1))) { fprintf(stderr, "Failed to initialize iconv\n"); return 1; } tds_all_types(tds, test_type); tds_free_socket(tds); tds_free_context(tds_ctx); cs_ctx_drop(ctx); return 0; } freetds-1.3.6/src/ctlib/unittests/array_bind.c000644 025423 025423 00000011631 14056414221 023010 0ustar00fredianofrediano000000 000000 #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" /* Testing: array binding of result set */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT datalength[2]; CS_SMALLINT ind[2]; CS_INT count, row_count = 0; CS_INT cv; CS_CHAR select[1024]; CS_INT col1[2]; CS_CHAR col2[2][5]; CS_CHAR col3[2][32]; printf("%s: Retrieve data using array binding \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = run_command(cmd, "CREATE TABLE #ctlibarray (col1 int not null, col2 char(4) not null, col3 datetime not null)"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (1, 'AAAA', 'Jan 1 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (2, 'BBBB', 'Jan 2 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (3, 'CCCC', 'Jan 3 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (8, 'DDDD', 'Jan 4 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (9, 'EEEE', 'Jan 5 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; strcpy(select, "select col1, col2, col3 from #ctlibarray order by col1 "); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command(%s) failed\n", select); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 3) { fprintf(stderr, "num_cols %d != 3", num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } datafmt.count = 2; ret = ct_bind(cmd, 1, &datafmt, &col1[0], datalength, ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } ret = ct_describe(cmd, 2, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 5; datafmt.count = 2; ret = ct_bind(cmd, 2, &datafmt, &col2[0], datalength, ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } ret = ct_describe(cmd, 3, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 32; datafmt.count = 2; ret = ct_bind(cmd, 3, &datafmt, &col3[0], datalength, ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } count = 0; while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ printf("ct_fetch returned %d rows\n", count); for (cv = 0; cv < count; cv++) printf("col1 = %d col2= '%s', col3 = '%s'\n", col1[cv], col2[cv], col3[cv]); } count = 0; } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/blk_in.h000644 025423 025423 00000006625 14056414221 022150 0ustar00fredianofrediano000000 000000 char create_table_sql[] = "CREATE TABLE all_types_bcp_unittest (\n" " not_null_bit bit NOT NULL\n" "\n" " , not_null_char char(10) NOT NULL\n" " , not_null_varchar varchar(10) NOT NULL\n" "\n" " , not_null_datetime datetime NOT NULL\n" " , not_null_smalldatetime smalldatetime NOT NULL\n" "\n" " , not_null_money money NOT NULL\n" " , not_null_smallmoney smallmoney NOT NULL\n" "\n" " , not_null_float float NOT NULL\n" " , not_null_real real NOT NULL\n" "\n" " , not_null_decimal decimal(5,2) NOT NULL\n" " , not_null_numeric numeric(5,2) NOT NULL\n" "\n" " , not_null_int int NOT NULL\n" " , not_null_smallint smallint NOT NULL\n" " , not_null_tinyint tinyint NOT NULL\n" "\n" " , nullable_char char(10) NULL\n" " , nullable_varchar varchar(10) NULL\n" "\n" " , nullable_datetime datetime NULL\n" " , nullable_smalldatetime smalldatetime NULL\n" "\n" " , nullable_money money NULL\n" " , nullable_smallmoney smallmoney NULL\n" "\n" " , nullable_float float NULL\n" " , nullable_real real NULL\n" "\n" " , nullable_decimal decimal(5,2) NULL\n" " , nullable_numeric numeric(5,2) NULL\n" "\n" " , nullable_int int NULL\n" " , nullable_smallint smallint NULL\n" " , nullable_tinyint tinyint NULL\n" "\n" " /* Excludes: \n" " * binary\n" " * image\n" " * uniqueidentifier\n" " * varbinary\n" " * text\n" " * timestamp\n" " * nchar\n" " * ntext\n" " * nvarchar\n" " */\n" ")\n" "\n" "INSERT all_types_bcp_unittest \n" "VALUES ( 1 -- not_null_bit\n" "\n" " , 'a' -- not_null_char\n" " , 'a' -- not_null_varchar\n" "\n" " , 'Dec 17 2003 3:44PM' -- not_null_datetime\n" " , 'Dec 17 2003 3:44PM' -- not_null_smalldatetime\n" "\n" " , 12.34 -- not_null_money\n" " , 12.34 -- not_null_smallmoney\n" "\n" " , 12.34 -- not_null_float\n" " , 12.34 -- not_null_real\n" "\n" " , 12.34 -- not_null_decimal\n" " , 12.34 -- not_null_numeric\n" "\n" " , 1234 -- not_null_int\n" " , 1234 -- not_null_smallint\n" " , 123 -- not_null_tinyint\n" "\n" " , 'a' -- nullable_char\n" " , 'a' -- nullable_varchar\n" "\n" " , 'Dec 17 2003 3:44PM' -- nullable_datetime\n" " , 'Dec 17 2003 3:44PM' -- nullable_smalldatetime\n" "\n" " , 12.34 -- nullable_money\n" " , 12.34 -- nullable_smallmoney\n" "\n" " , 12.34 -- nullable_float\n" " , 12.34 -- nullable_real\n" "\n" " , 12.34 -- nullable_decimal\n" " , 12.34 -- nullable_numeric\n" "\n" " , 1234 -- nullable_int\n" " , 1234 -- nullable_smallint\n" " , 123 -- nullable_tinyint\n" ")\n" "INSERT all_types_bcp_unittest\n" " ( not_null_bit \n" "\n" " , not_null_char \n" " , not_null_varchar \n" "\n" " , not_null_datetime \n" " , not_null_smalldatetime \n" "\n" " , not_null_money \n" " , not_null_smallmoney \n" "\n" " , not_null_float \n" " , not_null_real \n" "\n" " , not_null_decimal \n" " , not_null_numeric \n" "\n" " , not_null_int \n" " , not_null_smallint \n" " , not_null_tinyint \n" " ) \n" "VALUES (\n" " 1 -- not_null_bit\n" "\n" " , 'a' -- not_null_char\n" " , 'a' -- not_null_varchar\n" "\n" " , 'Dec 17 2003 3:44PM' -- not_null_datetime\n" " , 'Dec 17 2003 3:44PM' -- not_null_smalldatetime\n" "\n" " , 12.34 -- not_null_money\n" " , 12.34 -- not_null_smallmoney\n" "\n" " , 12.34 -- not_null_float\n" " , 12.34 -- not_null_real\n" "\n" " , 12.34 -- not_null_decimal\n" " , 12.34 -- not_null_numeric\n" "\n" " , 1234 -- not_null_int\n" " , 1234 -- not_null_smallint\n" " , 123 -- not_null_tinyint\n" ")\n"; freetds-1.3.6/src/ctlib/unittests/blk_in.c000644 025423 025423 00000020470 14056414221 022135 0ustar00fredianofrediano000000 000000 #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" #include "blk_in.h" static CS_RETCODE do_bind(CS_BLKDESC * blkdesc, int colnum, CS_INT host_format, CS_INT host_type, CS_INT host_maxlen, void *var_addr, CS_INT *var_len_addr, CS_SMALLINT *var_ind_addr ); static char command[512]; /* * Static data for insertion */ int not_null_bit = 1; CS_INT l_not_null_bit = 4; CS_SMALLINT i_not_null_bit = 0; char not_null_char[] = "a char"; CS_INT l_not_null_char = 6; CS_SMALLINT i_not_null_char = 0; char not_null_varchar[] = "a varchar"; CS_INT l_not_null_varchar = 9; CS_SMALLINT i_not_null_varchar = 0; char not_null_datetime[] = "Dec 17 2003 3:44PM"; CS_INT l_not_null_datetime = 19; CS_SMALLINT i_not_null_datetime = 0; char not_null_smalldatetime[] = "Dec 17 2003 3:44PM"; CS_INT l_not_null_smalldatetime = 19; CS_SMALLINT i_not_null_smalldatetime = 0; char not_null_money[] = "12.34"; CS_INT l_not_null_money = 5; CS_SMALLINT i_not_null_money = 0; char not_null_smallmoney[] = "12.34"; CS_INT l_not_null_smallmoney = 5; CS_SMALLINT i_not_null_smallmoney = 0; char not_null_float[] = "12.34"; CS_INT l_not_null_float = 5; CS_SMALLINT i_not_null_float = 0; char not_null_real[] = "12.34"; CS_INT l_not_null_real = 5; CS_SMALLINT i_not_null_real = 0; char not_null_decimal[] = "12.34"; CS_INT l_not_null_decimal = 5; CS_SMALLINT i_not_null_decimal = 0; char not_null_numeric[] = "12.34"; CS_INT l_not_null_numeric = 5; CS_SMALLINT i_not_null_numeric = 0; int not_null_int = 1234; CS_INT l_not_null_int = 4; CS_SMALLINT i_not_null_int = 0; int not_null_smallint = 1234; CS_INT l_not_null_smallint = 4; CS_SMALLINT i_not_null_smallint = 0; int not_null_tinyint = 123; CS_INT l_not_null_tinyint = 4; CS_SMALLINT i_not_null_tinyint = 0; CS_INT l_null_char = 0; CS_SMALLINT i_null_char = -1; CS_INT l_null_varchar = 0; CS_SMALLINT i_null_varchar = -1; CS_INT l_null_datetime = 0; CS_SMALLINT i_null_datetime = -1; CS_INT l_null_smalldatetime = 0; CS_SMALLINT i_null_smalldatetime = -1; CS_INT l_null_money = 0; CS_SMALLINT i_null_money = -1; CS_INT l_null_smallmoney = 0; CS_SMALLINT i_null_smallmoney = -1; CS_INT l_null_float = 0; CS_SMALLINT i_null_float = -1; CS_INT l_null_real = 0; CS_SMALLINT i_null_real = -1; CS_INT l_null_decimal = 0; CS_SMALLINT i_null_decimal = -1; CS_INT l_null_numeric = 0; CS_SMALLINT i_null_numeric = -1; CS_INT l_null_int = 0; CS_SMALLINT i_null_int = -1; CS_INT l_null_smallint = 0; CS_SMALLINT i_null_smallint = -1; CS_INT l_null_tinyint = 0; CS_SMALLINT i_null_tinyint = -1; static void do_binds(CS_BLKDESC * blkdesc) { enum { prefixlen = 0 }; enum { termlen = 0 }; enum NullValue { IsNull, IsNotNull }; /* non nulls */ do_bind(blkdesc, 1, CS_FMT_UNUSED, CS_INT_TYPE, 4, ¬_null_bit, &l_not_null_bit, &i_not_null_bit); do_bind(blkdesc, 2, CS_FMT_NULLTERM, CS_CHAR_TYPE, 7, not_null_char, &l_not_null_char, &i_not_null_char); do_bind(blkdesc, 3, CS_FMT_NULLTERM, CS_CHAR_TYPE, 10, not_null_varchar, &l_not_null_varchar, &i_not_null_varchar); do_bind(blkdesc, 4, CS_FMT_NULLTERM, CS_CHAR_TYPE, 20, not_null_datetime, &l_not_null_datetime, &i_not_null_datetime); do_bind(blkdesc, 5, CS_FMT_NULLTERM, CS_CHAR_TYPE, 20, not_null_smalldatetime, &l_not_null_smalldatetime, &i_not_null_smalldatetime); do_bind(blkdesc, 6, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_money, &l_not_null_money, &i_not_null_money); do_bind(blkdesc, 7, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_smallmoney, &l_not_null_smallmoney, &i_not_null_smallmoney); do_bind(blkdesc, 8, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_float, &l_not_null_float, &i_not_null_float); do_bind(blkdesc, 9, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_real, &l_not_null_real, &i_not_null_real); do_bind(blkdesc, 10, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_decimal, &l_not_null_decimal, &i_not_null_decimal); do_bind(blkdesc, 11, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_numeric, &l_not_null_numeric, &i_not_null_numeric); do_bind(blkdesc, 12, CS_FMT_UNUSED, CS_INT_TYPE, 4, ¬_null_int, &l_not_null_int, &i_not_null_int); do_bind(blkdesc, 13, CS_FMT_UNUSED, CS_INT_TYPE, 4, ¬_null_smallint, &l_not_null_smallint, &i_not_null_smallint); do_bind(blkdesc, 14, CS_FMT_UNUSED, CS_INT_TYPE, 4, ¬_null_tinyint, &l_not_null_tinyint, &i_not_null_tinyint); /* nulls */ do_bind(blkdesc, 15, CS_FMT_NULLTERM, CS_CHAR_TYPE, 7, not_null_char, &l_null_char, &i_null_char); do_bind(blkdesc, 16, CS_FMT_NULLTERM, CS_CHAR_TYPE, 10, not_null_varchar, &l_null_varchar, &i_null_varchar); do_bind(blkdesc, 17, CS_FMT_NULLTERM, CS_CHAR_TYPE, 20, not_null_datetime, &l_null_datetime, &i_null_datetime); do_bind(blkdesc, 18, CS_FMT_NULLTERM, CS_CHAR_TYPE, 20, not_null_smalldatetime, &l_null_smalldatetime, &i_null_smalldatetime); do_bind(blkdesc, 19, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_money, &l_null_money, &i_null_money); do_bind(blkdesc, 20, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_smallmoney, &l_null_smallmoney, &i_null_smallmoney); do_bind(blkdesc, 21, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_float, &l_null_float, &i_null_float); do_bind(blkdesc, 22, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_real, &l_null_real, &i_null_real); do_bind(blkdesc, 23, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_decimal, &l_null_decimal, &i_null_decimal); do_bind(blkdesc, 24, CS_FMT_NULLTERM, CS_CHAR_TYPE, 6, not_null_numeric, &l_null_numeric, &i_null_numeric); do_bind(blkdesc, 25, CS_FMT_UNUSED, CS_INT_TYPE, 4, ¬_null_int, &l_null_int, &i_null_int); do_bind(blkdesc, 26, CS_FMT_UNUSED, CS_INT_TYPE, 4, ¬_null_smallint, &l_null_smallint, &i_null_smallint); do_bind(blkdesc, 27, CS_FMT_UNUSED, CS_INT_TYPE, 4, ¬_null_tinyint, &l_null_tinyint, &i_null_tinyint); } static CS_RETCODE do_bind(CS_BLKDESC * blkdesc, int colnum, CS_INT host_format, CS_INT host_type, CS_INT host_maxlen, void *var_addr, CS_INT *var_len_addr, CS_SMALLINT *var_ind_addr ) { CS_DATAFMT datafmt; CS_RETCODE ret; ret = blk_describe(blkdesc, colnum, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_describe(%d) failed", colnum); return ret; } datafmt.format = host_format; datafmt.datatype = host_type; datafmt.maxlength = host_maxlen; datafmt.count = 1; ret = blk_bind(blkdesc, colnum, &datafmt, var_addr, var_len_addr, var_ind_addr ); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_bind() failed\n"); return ret; } return ret; } int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_BLKDESC *blkdesc; int verbose = 0; int count = 0; int ret; int i; const char *table_name = "all_types_bcp_unittest"; printf("%s: Retrieve data using array binding \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } sprintf(command,"if exists (select 1 from sysobjects where type = 'U' and name = '%s') drop table %s", table_name, table_name); ret = run_command(cmd, command); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, create_table_sql); if (ret != CS_SUCCEED) return 1; ret = blk_alloc(conn, BLK_VERSION_100, &blkdesc); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_alloc() failed\n"); return 1; } ret = blk_init(blkdesc, CS_BLK_IN, (char *) table_name, CS_NULLTERM ); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_init() failed\n"); return 1; } do_binds(blkdesc); printf("Sending same row 10 times... \n"); for (i=0; i<10; i++) { if((ret = blk_rowxfer(blkdesc)) != CS_SUCCEED) { fprintf(stderr, "blk_rowxfer() failed\n"); return 1; } } ret = blk_done(blkdesc, CS_BLK_ALL, &count); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_done() failed\n"); return 1; } blk_drop(blkdesc); printf("%d rows copied.\n", count); printf("done\n"); ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/blk_in2.c000644 025423 025423 00000004761 14056414221 022224 0ustar00fredianofrediano000000 000000 /* * Test from MATSUMOTO, Tadashi * Cfr "blk_init fails by the even number times execution" on ML, 2007-03-09 * This mix bulk and cancel */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" static const char create_table_sql[] = "CREATE TABLE hogexxx (col varchar(100))"; static CS_RETCODE hoge_blkin(CS_CONNECTION * con, CS_BLKDESC * blk, char *table, char *data) { CS_DATAFMT meta = { "" }; CS_INT length = 5; CS_INT row = 0; if (CS_SUCCEED != ct_cancel(con, NULL, CS_CANCEL_ALL)) return CS_FAIL; if (CS_SUCCEED != blk_init(blk, CS_BLK_IN, table, CS_NULLTERM)) return CS_FAIL; meta.count = 1; meta.datatype = CS_CHAR_TYPE; meta.format = CS_FMT_PADBLANK; meta.maxlength = 5; if (CS_SUCCEED != blk_bind(blk, (int) 1, &meta, data, &length, NULL)) return CS_FAIL; if (CS_SUCCEED != blk_rowxfer(blk)) return CS_FAIL; if (CS_SUCCEED != blk_done(blk, CS_BLK_ALL, &row)) return CS_FAIL; return CS_SUCCEED; } int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_BLKDESC *blkdesc; int verbose = 0; int ret = 0; int i; char command[512]; static char table_name[20] = "hogexxx"; printf("%s: Inserting data using bulk cancelling\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } sprintf(command, "if exists (select 1 from sysobjects where type = 'U' and name = '%s') drop table %s", table_name, table_name); ret = run_command(cmd, command); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, create_table_sql); if (ret != CS_SUCCEED) return 1; ret = blk_alloc(conn, BLK_VERSION_100, &blkdesc); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_alloc() failed\n"); return 1; } for (i = 0; i < 10; i++) { /* compute some data */ memset(command, ' ', sizeof(command)); memset(command, 'a' + i, (i * 37) % 11); ret = hoge_blkin(conn, blkdesc, table_name, command); if (ret != CS_SUCCEED) return 1; } blk_drop(blkdesc); /* TODO test correct insert */ printf("done\n"); ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/blk_out.c000644 025423 025423 00000007750 14056414221 022344 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include "common.h" /* Testing: array binding of result set */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_BLKDESC *blkdesc; int verbose = 0; CS_RETCODE ret; CS_DATAFMT datafmt; CS_INT count = 0; CS_INT col1[2]; CS_CHAR col2[2][5]; CS_CHAR col3[2][32]; CS_INT lencol1[2]; CS_SMALLINT indcol1[2]; CS_INT lencol2[2]; CS_SMALLINT indcol2[2]; CS_INT lencol3[2]; CS_SMALLINT indcol3[2]; int i; printf("%s: Retrieve data using array binding \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } /* do not test error */ ret = run_command(cmd, "IF OBJECT_ID('tempdb..#ctlibarray') IS NOT NULL DROP TABLE #ctlibarray"); ret = run_command(cmd, "CREATE TABLE #ctlibarray (col1 int null, col2 char(4) not null, col3 datetime not null)"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (1, 'AAAA', 'Jan 1 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (2, 'BBBB', 'Jan 2 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (3, 'CCCC', 'Jan 3 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (8, 'DDDD', 'Jan 4 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (NULL, 'EEEE', 'Jan 5 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = blk_alloc(conn, BLK_VERSION_100, &blkdesc); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_alloc() failed\n"); return 1; } ret = blk_init(blkdesc, CS_BLK_OUT, "#ctlibarray", CS_NULLTERM ); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_init() failed\n"); return 1; } ret = blk_describe(blkdesc, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_describe(1) failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } datafmt.count = 2; ret = blk_bind(blkdesc, 1, &datafmt, &col1[0], &lencol1[0], &indcol1[0]); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_bind() failed\n"); return 1; } ret = blk_describe(blkdesc, 2, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_describe(2) failed"); return 1; } datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 5; datafmt.count = 2; ret = blk_bind(blkdesc, 2, &datafmt, col2[0], &lencol2[0], &indcol2[0]); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_bind() failed\n"); return 1; } ret = blk_describe(blkdesc, 3, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "blk_describe() failed"); return 1; } datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 32; datafmt.count = 2; ret = blk_bind(blkdesc, 3, &datafmt, col3[0], &lencol3[0], &indcol3[0]); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while((ret = blk_rowxfer_mult(blkdesc, &count)) == CS_SUCCEED) { for(i = 0; i < count; i++) { printf("retrieved %d (%d,%d) %s (%d,%d) %s (%d,%d)\n", col1[i], lencol1[i], indcol1[i], col2[i], lencol2[i], indcol2[i], col3[i], lencol3[i], indcol3[i] ); } } switch (ret) { case CS_END_DATA: for(i = 0; i < count; i++) { printf("retrieved %d (%d,%d) %s (%d,%d) %s (%d,%d)\n", col1[i], lencol1[i], indcol1[i], col2[i], lencol2[i], indcol2[i], col3[i], lencol3[i], indcol3[i] ); } break; case CS_FAIL: case CS_ROW_FAIL: fprintf(stderr, "blk_rowxfer_mult() failed\n"); return 1; } blk_drop(blkdesc); ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/cancel.c000644 025423 025423 00000011556 14056414221 022131 0ustar00fredianofrediano000000 000000 #include #include #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include "common.h" #if defined(HAVE_ALARM) && defined(HAVE_SETITIMER) /* protos */ int do_fetch(CS_COMMAND * cmd, int *cnt); void catch_alrm(int); /* Globals */ static volatile CS_COMMAND *g_cmd = NULL; void catch_alrm(int sig_num) { signal(SIGALRM, catch_alrm); printf("- SIGALRM\n"); /* Cancel current command */ if (g_cmd) ct_cancel(NULL, (CS_COMMAND *) g_cmd, CS_CANCEL_ATTN); fflush(stdout); } /* Testing: Test asynchronous ct_cancel() */ int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int i, verbose = 0, cnt = 0; CS_RETCODE ret; CS_INT result_type; struct itimerval timer; char query[1024]; unsigned clock = 200000; printf("%s: Check asynchronous called ct_cancel()\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } /* Create needed tables */ ret = run_command(cmd, "CREATE TABLE #t0010 (id int, col1 varchar(255))"); if (ret != CS_SUCCEED) return 1; for (i = 0; i < 10; i++) { sprintf(query, "INSERT #t0010 (id, col1) values (%d, 'This is field no %d')", i, i); ret = run_command(cmd, query); if (ret != CS_SUCCEED) return 1; } /* Set SIGALRM signal handler */ signal(SIGALRM, catch_alrm); for (;;) { /* TODO better to use alarm AFTER ct_send ?? */ /* Set timer */ timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = clock; timer.it_value.tv_sec = 0; timer.it_value.tv_usec = clock; if (0 != setitimer(ITIMER_REAL, &timer, NULL)) { fprintf(stderr, "Could not set realtime timer.\n"); return 1; } /* Issue a command returning many rows */ ret = ct_command(cmd, CS_LANG_CMD, "SELECT * FROM #t0010 t1, #t0010 t2, #t0010 t3, #t0010 t4", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed.\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "first ct_send() failed.\n"); return 1; } /* Save a global reference for the interrupt handler */ g_cmd = cmd; while ((ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { printf("More results?...\n"); if (result_type == CS_STATUS_RESULT) continue; switch ((int) result_type) { case CS_ROW_RESULT: printf("do_fetch() returned: %d\n", do_fetch(cmd, &cnt)); break; } } /* We should not have received all rows, as the alarm signal cancelled it... */ if (cnt < 10000) break; if (clock <= 5000) { fprintf(stderr, "All rows read, this may not occur.\n"); return 1; } g_cmd = NULL; clock /= 2; } /* Remove timer */ timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = 0; timer.it_value.tv_sec = 0; timer.it_value.tv_usec = 0; if (0 != setitimer(ITIMER_REAL, &timer, NULL)) { fprintf(stderr, "Could not remove realtime timer.\n"); return 1; } /* * Issue another command, this will be executed after a ct_cancel, * to test if wire state is consistent */ ret = ct_command(cmd, CS_LANG_CMD, "SELECT * FROM #t0010 t1, #t0010 t2, #t0010 t3", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed.\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "second ct_send() failed.\n"); return 1; } while ((ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { printf("More results?...\n"); if (result_type == CS_STATUS_RESULT) continue; switch ((int) result_type) { case CS_ROW_RESULT: printf("do_fetch() returned: %d\n", do_fetch(cmd, &cnt)); break; } } if (1000 != cnt) { /* This time, all rows must have been received */ fprintf(stderr, "Incorrect number of rows read.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } printf("%s: asynchronous cancel test: PASSED\n", __FILE__); return 0; } int do_fetch(CS_COMMAND * cmd, int *cnt) { CS_INT count, row_count = 0; CS_RETCODE ret; while ((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) { /* printf ("ct_fetch() == CS_SUCCEED\n"); */ row_count += count; } (*cnt) = row_count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else if (ret == CS_END_DATA) { printf("do_fetch retrieved %d rows\n", row_count); return 0; } else if (ret == CS_CMD_FAIL) { printf("do_fetch(): command aborted after receiving %d rows\n", row_count); return 0; } else { fprintf(stderr, "ct_fetch() unexpected return %d on row %d.\n", ret, row_count); return 1; } } #else int main(void) { return 0; } #endif freetds-1.3.6/src/ctlib/unittests/connect_fail.c000644 025423 025423 00000003073 14056414221 023323 0ustar00fredianofrediano000000 000000 #include #include #include #include "common.h" int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; int ret = 1; read_login_info(); if (cs_ctx_alloc(CS_VERSION_100, &ctx) != CS_SUCCEED) { fprintf(stderr, "Context Alloc failed!\n"); return ret; } if (ct_init(ctx, CS_VERSION_100) != CS_SUCCEED) { fprintf(stderr, "Library Init failed!\n"); return ret; } if (ct_con_alloc(ctx, &conn) != CS_SUCCEED) { fprintf(stderr, "Connect Alloc failed!\n"); return ret; } if (ct_con_props(conn, CS_SET, CS_USERNAME, (CS_VOID*) "sa", CS_NULLTERM, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_con_props() SET USERNAME failed!\n"); return ret; } if (ct_con_props(conn, CS_SET, CS_PASSWORD, (CS_VOID*) "invalid", CS_NULLTERM, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_con_props() SET PASSWORD failed!\n"); return ret; } if (ct_connect(conn, SERVER, CS_NULLTERM) != CS_FAIL) { fprintf(stderr, "Connection succeeded??\n"); return ret; } if (ct_cancel(conn, NULL, CS_CANCEL_ALL) != CS_SUCCEED) { fprintf(stderr, "ct_cancel() failed!\n"); return ret; } if (ct_close(conn, CS_UNUSED) != CS_SUCCEED) { fprintf(stderr, "ct_close() failed!\n"); return ret; } if (ct_con_drop(conn) != CS_SUCCEED) { fprintf(stderr, "ct_con_drop() failed!\n"); return ret; } if (ct_exit(ctx, CS_UNUSED) != CS_SUCCEED) { fprintf(stderr, "ct_exit() failed!\n"); return ret; } if (cs_ctx_drop(ctx) != CS_SUCCEED) { fprintf(stderr, "cs_ctx_drop() failed!\n"); return ret; } printf("Test succeeded\n"); return 0; } freetds-1.3.6/src/ctlib/unittests/cs_config.c000644 025423 025423 00000005415 14056414221 022633 0ustar00fredianofrediano000000 000000 #include #include #ifdef HAVE_STRING_H #include #endif #include #include #include "common.h" int main(int argc, char **argv) { int verbose = 1; CS_CONTEXT *ctx; CS_CHAR string_in[16], string_out[16]; CS_INT int_in, int_out; CS_INT ret_len; if (verbose) { printf("Trying cs_config with CS_USERDATA\n\n"); } if (cs_ctx_alloc(CS_VERSION_100, &ctx) != CS_SUCCEED) { fprintf(stderr, "cs_ctx_alloc() for first context failed\n"); } if (ct_init(ctx, CS_VERSION_100) != CS_SUCCEED) { fprintf(stderr, "ct_init() for first context failed\n"); } printf("Testing CS_SET/GET USERDATA with char array\n"); strcpy(string_in,"FreeTDS"); if (cs_config(ctx, CS_SET, CS_USERDATA, (CS_VOID *)string_in, CS_NULLTERM, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_config() set failed\n"); return 1; } if (cs_config(ctx, CS_GET, CS_USERDATA, (CS_VOID *)string_out, 16, &ret_len) != CS_SUCCEED) { fprintf(stderr, "cs_config() get failed\n"); return 1; } if (strcmp(string_in, string_out)) { printf("returned value >%s< not as stored >%s<\n", (char *)string_out, (char *)string_in); return 1; } if (ret_len != (strlen(string_in) + 1)) { printf("returned length >%d< not as expected >%u<\n", ret_len, (unsigned int) (strlen(string_in) + 1)); return 1; } printf("Testing CS_SET/GET USERDATA with char array\n"); strcpy(string_in,"FreeTDS"); if (cs_config(ctx, CS_SET, CS_USERDATA, (CS_VOID *)string_in, CS_NULLTERM, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_config() set failed\n"); return 1; } strcpy(string_out,"XXXXXXXXXXXXXXX"); if (cs_config(ctx, CS_GET, CS_USERDATA, (CS_VOID *)string_out, 4, &ret_len) != CS_SUCCEED) { fprintf(stderr, "cs_config() get failed\n"); return 1; } if (strcmp(string_out, "FreeXXXXXXXXXXX")) { printf("returned value >%s< not as expected >%s<\n", (char *)string_out, "FreeXXXXXXXXXXX"); return 1; } if (ret_len != (strlen(string_in) + 1)) { printf("returned length >%d< not as expected >%u<\n", ret_len, (unsigned int) (strlen(string_in) + 1)); return 1; } printf("Testing CS_SET/GET USERDATA with int\n"); int_in = 255; if (cs_config(ctx, CS_SET, CS_USERDATA, (CS_VOID *)&int_in, sizeof(int), NULL) != CS_SUCCEED) { fprintf(stderr, "cs_config() set failed\n"); return 1; } if (cs_config(ctx, CS_GET, CS_USERDATA, (CS_VOID *)&int_out, sizeof(int), &ret_len) != CS_SUCCEED) { fprintf(stderr, "cs_config() get failed\n"); return 1; } if (int_in != int_out) { printf("returned value >%d< not as stored >%d<\n", int_out, int_in); return 1; } if (ret_len != (sizeof(int))) { printf("returned length >%d< not as expected >%u<\n", ret_len, (unsigned int) sizeof(int)); return 1; } cs_ctx_drop(ctx); return 0; } freetds-1.3.6/src/ctlib/unittests/cs_convert.c000644 025423 025423 00000025743 14056414221 023054 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include static CS_CONTEXT *ctx; static int allSuccess = 1; typedef const char *STR; static int DoTest( /* source information */ CS_INT fromtype, void *fromdata, CS_INT fromlen, /* to information */ CS_INT totype, CS_INT tomaxlen, /* expected result */ CS_RETCODE tores, void *todata, CS_INT tolen, /* fields in string format */ STR sdecl, STR sfromtype, STR sfromdata, STR sfromlen, STR stotype, STR stomaxlen, STR stores, STR stodata, STR stolen, /* source line number for error reporting */ int line) { CS_DATAFMT destfmt, srcfmt; CS_INT reslen; CS_RETCODE retcode; int i; char buffer[1024]; const char *err = ""; assert(tolen >= 0); memset(&destfmt, 0, sizeof(destfmt)); destfmt.datatype = totype; destfmt.maxlength = tomaxlen; memset(&srcfmt, 0, sizeof(srcfmt)); srcfmt.datatype = fromtype; srcfmt.maxlength = fromlen; /* * FIXME this fix some thing but if error cs_convert should return * CS_UNUSED; note that this is defined 5.. a valid result ... */ reslen = 0; /* * TODO: add special case for CS_CHAR_TYPE and give different * flags and len */ /* do convert */ memset(buffer, 23, sizeof(buffer)); retcode = cs_convert(ctx, &srcfmt, fromdata, &destfmt, buffer, &reslen); /* test result of convert */ if (tores != retcode) { err = "result"; goto Failed; } /* test result len */ if (reslen != tolen) { err = "result length"; goto Failed; } /* test buffer */ if (todata && memcmp(todata, buffer, tolen) != 0) { int n; for (n = 0; n < tolen; ++n) printf("%02x ", ((unsigned char*)todata)[n]); printf("\n"); for (n = 0; n < tolen; ++n) printf("%02x ", ((unsigned char*)buffer)[n]); printf("\n"); err = "result data"; goto Failed; } /* test other part of buffer */ if (todata) memset(buffer, 23, tolen); for (i = 0; i < sizeof(buffer); ++i) if (buffer[i] != 23) { err = "buffer left"; goto Failed; } /* success */ return 0; Failed: fprintf(stderr, "Test %s failed (ret=%d len=%d)\n", err, (int) retcode, (int) reslen); fprintf(stderr, "line: %d\n DO_TEST(decl=%s,\n" "\t fromtype=%s,fromdata=%s,fromlen=%s,\n" "\t totype=%s,tomaxlen=%s,\n" "\t tores=%s,todata=%s,tolen=%s);\n", line, sdecl, sfromtype, sfromdata, sfromlen, stotype, stomaxlen, stores, stodata, stolen); allSuccess = 0; return 1; } #define DO_TEST(decl,fromtype,fromdata,fromlen,totype,tomaxlen,tores,todata,tolen) { \ decl; \ DoTest(fromtype,fromdata,fromlen,totype,tomaxlen,tores,todata,tolen,\ #decl,#fromtype,#fromdata,#fromlen,#totype,#tomaxlen,#tores,#todata,#tolen,\ __LINE__);\ } int main(int argc, char **argv) { CS_RETCODE ret; volatile CS_BIGINT one = 1; int verbose = 1; printf("%s: Testing conversion\n", __FILE__); ret = cs_ctx_alloc(CS_VERSION_100, &ctx); if (ret != CS_SUCCEED) { fprintf(stderr, "Init failed\n"); return 1; } /* TODO For each conversion test different values of fromlen and tolen */ /* * * INT to everybody */ DO_TEST(CS_INT test = 12345; CS_INT test2 = 12345, CS_INT_TYPE, &test, sizeof(test), CS_INT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 12345; CS_INT test2 = 12345, CS_INT_TYPE, &test, sizeof(test), CS_INT_TYPE, sizeof(test2) * 2, CS_SUCCEED, &test2, sizeof(test2)); /* FIXME: correct ?? */ DO_TEST(CS_INT test = 12345; CS_INT test2 = 12345, CS_INT_TYPE, &test, sizeof(test), CS_INT_TYPE, sizeof(CS_SMALLINT), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 1234; CS_SMALLINT test2 = 1234, CS_INT_TYPE, &test, sizeof(test), CS_SMALLINT_TYPE, 1, CS_SUCCEED, &test2, sizeof(test2)); /* biggest and smallest SMALLINT */ DO_TEST(CS_INT test = 32767; CS_SMALLINT test2 = 32767, CS_INT_TYPE, &test, sizeof(test), CS_SMALLINT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = -32768; CS_SMALLINT test2 = -32768, CS_INT_TYPE, &test, sizeof(test), CS_SMALLINT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); /* overflow */ DO_TEST(CS_INT test = 32768; CS_SMALLINT test2 = 12345, CS_INT_TYPE, &test, sizeof(test), CS_SMALLINT_TYPE, sizeof(test2), CS_FAIL, NULL, 0); DO_TEST(CS_INT test = -32769; CS_SMALLINT test2 = 12345, CS_INT_TYPE, &test, sizeof(test), CS_SMALLINT_TYPE, sizeof(test2), CS_FAIL, NULL, 0); /* biggest and smallest TINYINT */ DO_TEST(CS_INT test = 255; CS_TINYINT test2 = 255, CS_INT_TYPE, &test, sizeof(test), CS_TINYINT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 0; CS_TINYINT test2 = 0, CS_INT_TYPE, &test, sizeof(test), CS_TINYINT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); /* overflow */ DO_TEST(CS_INT test = 256; CS_TINYINT test2 = 1, CS_INT_TYPE, &test, sizeof(test), CS_TINYINT_TYPE, sizeof(test2), CS_FAIL, NULL, 0); DO_TEST(CS_INT test = -1; CS_TINYINT test2 = 1, CS_INT_TYPE, &test, sizeof(test), CS_TINYINT_TYPE, sizeof(test2), CS_FAIL, NULL, 0); /* biggest and smallest BIT */ DO_TEST(CS_INT test = 1; CS_BYTE test2 = 1, CS_INT_TYPE, &test, sizeof(test), CS_BIT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 0; CS_BYTE test2 = 0, CS_INT_TYPE, &test, sizeof(test), CS_BIT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); /* overflow FIXME: or 1 if != 0 ?? */ DO_TEST(CS_INT test = 2; CS_BYTE test2 = 1, CS_INT_TYPE, &test, sizeof(test), CS_BIT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = -1; CS_BYTE test2 = 1, CS_INT_TYPE, &test, sizeof(test), CS_BIT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 1234; CS_REAL test2 = 1234.0, CS_INT_TYPE, &test, sizeof(test), CS_REAL_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = -8765; CS_REAL test2 = -8765.0, CS_INT_TYPE, &test, sizeof(test), CS_REAL_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 1234; CS_FLOAT test2 = 1234.0, CS_INT_TYPE, &test, sizeof(test), CS_FLOAT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = -8765; CS_FLOAT test2 = -8765.0, CS_INT_TYPE, &test, sizeof(test), CS_FLOAT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 1234678; CS_MONEY4 test2 = { 1234678} , CS_INT_TYPE, &test, sizeof(test), CS_MONEY4_TYPE, sizeof(test2), CS_FAIL, NULL, 0); DO_TEST(CS_INT test = -8765; CS_MONEY4 test2 = { -8765 * 10000} , CS_INT_TYPE, &test, sizeof(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); /* strange money formatting */ DO_TEST(CS_CHAR test[] = ""; CS_MONEY4 test2 = { 0} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_CHAR test[] = "."; CS_MONEY4 test2 = { 0} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_CHAR test[] = ".12"; CS_MONEY4 test2 = { 1200} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_CHAR test[] = "++++-123"; CS_MONEY4 test2 = { -123 * 10000} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_FAIL, NULL, 0); DO_TEST(CS_CHAR test[] = " -123"; CS_MONEY4 test2 = { -123 * 10000} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_CHAR test[] = " +123"; CS_MONEY4 test2 = { 123 * 10000} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_CHAR test[] = "+123.1234"; CS_MONEY4 test2 = { 1231234} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_CHAR test[] = "+123.123411"; CS_MONEY4 test2 = { 1231234} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_CHAR test[] = "+123.12.3411"; CS_MONEY4 test2 = { 1231234} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_FAIL, NULL, 0); DO_TEST(CS_CHAR test[] = "pippo"; CS_MONEY4 test2 = { 0} , CS_CHAR_TYPE, test, strlen(test), CS_MONEY4_TYPE, sizeof(test2), CS_FAIL, NULL, 0); /* not terminated money */ DO_TEST(CS_CHAR test[] = "-1234567"; CS_MONEY4 test2 = { -1230000} , CS_CHAR_TYPE, test, 4, CS_MONEY4_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 1234678; CS_MONEY test2; test2.mnyhigh = ((one * 1234678) * 10000) >> 32; test2.mnylow = (CS_UINT) ((one * 1234678) * 10000), CS_INT_TYPE, &test, sizeof(test), CS_MONEY_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = -8765; CS_MONEY test2; test2.mnyhigh = ((one * -8765) * 10000) >> 32; test2.mnylow = (CS_UINT) ((one * -8765) * 10000), CS_INT_TYPE, &test, sizeof(test), CS_MONEY_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); DO_TEST(CS_INT test = 12345; CS_CHAR test2[] = "12345", CS_INT_TYPE, &test, sizeof(test), CS_CHAR_TYPE, sizeof(test2), CS_SUCCEED, test2, sizeof(test2) - 1); { CS_VARCHAR test2 = { 5, "12345"}; memset(test2.str+5, 23, 251); DO_TEST(CS_INT test = 12345, CS_INT_TYPE,&test,sizeof(test), CS_VARCHAR_TYPE,sizeof(test2), CS_SUCCEED,&test2,sizeof(test2)); } DO_TEST(CS_CHAR test[] = "12345"; CS_INT test2 = 12345, CS_CHAR_TYPE, test, 5, CS_INT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); /* unterminated number */ DO_TEST(CS_CHAR test[] = " - 12345"; CS_INT test2 = -12, CS_CHAR_TYPE, test, 5, CS_INT_TYPE, sizeof(test2), CS_SUCCEED, &test2, sizeof(test2)); /* to binary */ DO_TEST(CS_CHAR test[] = "abc"; CS_CHAR test2[] = "abc", CS_BINARY_TYPE, test, 3, CS_BINARY_TYPE, 3, CS_SUCCEED, test2, 3); #if 0 DO_TEST(CS_CHAR test[] = "abcdef"; CS_CHAR test2[] = "ab", CS_BINARY_TYPE, test, 6, CS_BINARY_TYPE, 2, CS_FAIL, test2, 2); DO_TEST(CS_CHAR test[] = "abc"; CS_CHAR test2[] = "ab", CS_BINARY_TYPE, test, 3, CS_BINARY_TYPE, 2, CS_FAIL, test2, 2); #endif DO_TEST(CS_CHAR test[] = "616263"; CS_CHAR test2[] = "abc", CS_CHAR_TYPE, test, 6, CS_BINARY_TYPE, 3, CS_SUCCEED, test2, 3); DO_TEST(CS_CHAR test[] = "616263646566"; CS_CHAR test2[] = "abc", CS_CHAR_TYPE, test, 12, CS_BINARY_TYPE, 3, CS_FAIL, test2, 3); /* to char */ DO_TEST(CS_INT test = 1234567; CS_CHAR test2[] = "1234567", CS_INT_TYPE, &test, sizeof(test), CS_CHAR_TYPE, 7, CS_SUCCEED, test2, 7); DO_TEST(CS_CHAR test[] = "abc"; CS_CHAR test2[] = "ab", CS_CHAR_TYPE, test, 3, CS_CHAR_TYPE, 2, CS_FAIL, test2, 2); DO_TEST(CS_CHAR test[] = "abc"; CS_CHAR test2[] = "616263", CS_BINARY_TYPE, test, 3, CS_CHAR_TYPE, 6, CS_SUCCEED, test2, 6); DO_TEST(CS_CHAR test[] = "abcdef"; CS_CHAR test2[] = "616263", CS_BINARY_TYPE, test, 6, CS_CHAR_TYPE, 6, CS_FAIL, test2, 6); ret = cs_ctx_drop(ctx); if (ret != CS_SUCCEED) { fprintf(stderr, "Drop failed\n"); return 2; } if (verbose && allSuccess) { printf("Test succeded\n"); } return allSuccess ? 0 : 1; } freetds-1.3.6/src/ctlib/unittests/cs_diag.c000644 025423 025423 00000005251 14056414221 022270 0ustar00fredianofrediano000000 000000 #include #include #include #include #include "common.h" /* * ct_send SQL |select name = @@servername| * ct_bind variable * ct_fetch and print results */ int main(int argc, char **argv) { int verbose = 1; CS_CONTEXT *ctx; CS_RETCODE ret; CS_DATAFMT srcfmt; CS_INT src = 32768; CS_DATAFMT dstfmt; CS_SMALLINT dst; CS_DATETIME dst_date; int i; CS_INT num_msgs; CS_CLIENTMSG client_message; printf("%s: Testing context callbacks\n", __FILE__); srcfmt.datatype = CS_INT_TYPE; srcfmt.maxlength = sizeof(CS_INT); srcfmt.locale = NULL; dstfmt.datatype = CS_SMALLINT_TYPE; dstfmt.maxlength = sizeof(CS_SMALLINT); dstfmt.locale = NULL; if (verbose) { printf("Trying clientmsg_cb with context\n"); } if (cs_ctx_alloc(CS_VERSION_100, &ctx) != CS_SUCCEED) { fprintf(stderr, "cs_ctx_alloc() failed\n"); } if (ct_init(ctx, CS_VERSION_100) != CS_SUCCEED) { fprintf(stderr, "ct_init() failed\n"); } if (cs_diag(ctx, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_INIT) failed\n"); return 1; } if (cs_convert(ctx, &srcfmt, &src, &dstfmt, &dst, NULL) == CS_SUCCEED) { fprintf(stderr, "cs_convert() succeeded when failure was expected\n"); return 1; } dstfmt.datatype = CS_DATETIME_TYPE; dstfmt.maxlength = sizeof(CS_DATETIME); dstfmt.locale = NULL; if (cs_convert(ctx, &srcfmt, &src, &dstfmt, &dst_date, NULL) == CS_SUCCEED) { fprintf(stderr, "cs_convert() succeeded when failure was expected\n"); return 1; } if (cs_diag(ctx, CS_STATUS, CS_CLIENTMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_STATUS) failed\n"); return 1; } for (i = 0; i < num_msgs; i++ ) { if (cs_diag(ctx, CS_GET, CS_CLIENTMSG_TYPE, i + 1, &client_message) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_GET) failed\n"); return 1; } cslibmsg_cb(NULL, &client_message); } if ((ret = cs_diag(ctx, CS_GET, CS_CLIENTMSG_TYPE, i + 1, &client_message)) != CS_NOMSG) { fprintf(stderr, "cs_diag(CS_GET) did not fail with CS_NOMSG\n"); return 1; } if (cs_diag(ctx, CS_CLEAR, CS_CLIENTMSG_TYPE, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_CLEAR) failed\n"); return 1; } if (cs_diag(ctx, CS_STATUS, CS_CLIENTMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_STATUS) failed\n"); return 1; } if (num_msgs != 0) { fprintf(stderr, "cs_diag(CS_CLEAR) failed there are still %d messages on queue\n", num_msgs); return 1; } if (ct_exit(ctx, CS_UNUSED) != CS_SUCCEED) { fprintf(stderr, "ct_exit() failed\n"); } if (cs_ctx_drop(ctx) != CS_SUCCEED) { fprintf(stderr, "cx_ctx_drop() failed\n"); } return 0; } freetds-1.3.6/src/ctlib/unittests/ct_cursor.c000644 025423 025423 00000036275 14056414221 022714 0ustar00fredianofrediano000000 000000 #include #include #ifdef HAVE_STRING_H #include #endif #include #include "common.h" static int update_second_table(CS_COMMAND * cmd2, char *value); int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_COMMAND *cmd2; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT count, row_count = 0; CS_DATAFMT datafmt; CS_SMALLINT ind; int verbose = 1; CS_CHAR name[3]; CS_CHAR col1[6]; CS_INT datalength; CS_CHAR text[128]; CS_INT num_cols, i, j; CS_INT props_value; printf("%s: Testing ct_cursor()\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = ct_cmd_alloc(conn, &cmd2); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Command Alloc failed!\n"); } return ret; } ret = run_command(cmd, "CREATE TABLE #test_table (col1 char(4))"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table (col1) VALUES ('AAA')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table (col1) VALUES ('BBB')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table (col1) VALUES ('CCC')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd2, "CREATE TABLE #test_table2 (col1 char(4))"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd2, "INSERT #test_table2 (col1) VALUES ('---')"); if (ret != CS_SUCCEED) return 1; if (verbose) { printf("Trying declare, rows , open in one SEND\n"); } strcpy(text, "select col1 from #test_table where 1 = 1"); strcpy(name, "c1"); ret = ct_cursor(cmd, CS_CURSOR_DECLARE, name, CS_NULLTERM, text, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor declare failed\n"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_ROWS, name, CS_NULLTERM, NULL, CS_UNUSED, (CS_INT) 1); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor set cursor rows failed"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_OPEN, name, CS_NULLTERM, text, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor open failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send failed\n"); } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: case CS_CMD_DONE: case CS_CMD_FAIL: case CS_STATUS_RESULT: break; case CS_CURSOR_RESULT: ret = ct_cmd_props(cmd, CS_GET, CS_CUR_STATUS, &props_value, sizeof(CS_INT), NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cmd_props() failed\n"); return 1; } if (props_value & CS_CURSTAT_DECLARED) { fprintf(stderr, "ct_cmd_props claims cursor is in DECLARED state when it should be OPEN\n"); return 1; } if (!(props_value & CS_CURSTAT_OPEN)) { fprintf(stderr, "ct_cmd_props claims cursor is not in OPEN state when it should be \n"); return 1; } if (props_value & CS_CURSTAT_CLOSED) { fprintf(stderr, "ct_cmd_props claims cursor is in CLOSED state when it should be OPEN\n"); return 1; } ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "unexpected num of columns = %d \n", num_cols); return 1; } for (i = 0; i < num_cols; i++) { /* here we can finally test for the return status column */ ret = ct_describe(cmd, i + 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed for column %d\n", i); return 1; } if (datafmt.status & CS_RETURN) { printf("ct_describe() column %d \n", i); } datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 6; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd, 1, &datafmt, col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } } row_count = 0; while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { if (row_count == 0) { for (j = 0; j < num_cols; j++) { printf("\n%s\n", datafmt.name); } printf("------\n\n"); } for (j = 0; j < num_cols; j++) { printf("%s\n\n", col1); row_count++; } ret = update_second_table(cmd2, col1); if (ret) return ret; } switch ((int) ret) { case CS_END_DATA: break; case CS_ROW_FAIL: fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return. %d\n", ret); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } ret = ct_cursor(cmd, CS_CURSOR_CLOSE, name, CS_NULLTERM, NULL, CS_UNUSED, CS_DEALLOC); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor(close) failed\n"); return ret; } if ((ret = ct_send(cmd)) != CS_SUCCEED) { fprintf(stderr, "BILL ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(2) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } ret = ct_cmd_props(cmd, CS_GET, CS_CUR_STATUS, &props_value, sizeof(CS_INT), NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cmd_props() failed"); return 1; } if (props_value != CS_CURSTAT_NONE) { fprintf(stderr, "ct_cmd_props() CS_CUR_STATUS != CS_CURSTAT_NONE \n"); return 1; } if (verbose) { printf("Trying declare, rows, open one at a time \n"); } strcpy(text, "select col1 from #test_table where 2 = 2"); ret = ct_cursor(cmd, CS_CURSOR_DECLARE, name, 3, text, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor declare failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send failed\n"); } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(4) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_ROWS, name, 3, NULL, CS_UNUSED, (CS_INT) 1); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor set cursor rows failed"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send failed\n"); } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(5) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_OPEN, name, 3, text, 26, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor open failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send failed\n"); } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results(6) result_type CS_CMD_FAIL.\n"); break; case CS_STATUS_RESULT: printf("ct_results: CS_STATUS_RESULT detected for sp_who\n"); case CS_CURSOR_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "unexpected num of columns = %d \n", num_cols); return 1; } for (i = 0; i < num_cols; i++) { /* here we can finally test for the return status column */ ret = ct_describe(cmd, i + 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed for column %d\n", i); return 1; } if (datafmt.status & CS_RETURN) { printf("ct_describe() column %d \n", i); } datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 6; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd, 1, &datafmt, col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } } row_count = 0; while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { if (row_count == 0) { for (j = 0; j < num_cols; j++) { printf("\n%s\n", datafmt.name); } printf("------\n\n"); } for (j = 0; j < num_cols; j++) { printf("%s\n\n", col1); row_count++; } } switch ((int) ret) { case CS_END_DATA: break; case CS_ROW_FAIL: fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return. %d\n", ret); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } ret = ct_cursor(cmd, CS_CURSOR_CLOSE, name, 3, NULL, CS_UNUSED, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor(close) failed\n"); return ret; } if ((ret = ct_send(cmd)) != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(7) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_DEALLOC, name, 3, NULL, CS_UNUSED, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor(dealloc) failed\n"); return ret; } if ((ret = ct_send(cmd)) != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(8) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } if (verbose) { printf("Running normal select command after cursor operations\n"); } ret = ct_command(cmd, CS_LANG_CMD, "select col1 from #test_table", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 6; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd, 1, &datafmt, col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else if (ret == CS_SUCCEED) { ; } else { break; } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.%d\n", ret); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type. %d\n", result_type); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ct_cmd_drop(cmd2); ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 2; } if (verbose) { printf("Test suceeded\n"); } return 0; } static int update_second_table(CS_COMMAND * cmd2, char *value) { CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT count, row_count = 0; CS_DATAFMT datafmt; CS_SMALLINT ind; CS_CHAR col1[6]; CS_INT datalength; CS_CHAR text[128]; sprintf(text, "update #test_table2 set col1 = '%s' ", value); ret = run_command(cmd2, text); if (ret != CS_SUCCEED) return 1; ret = ct_command(cmd2, CS_LANG_CMD, "select col1 from #test_table2", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd2); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd2, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 6; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd2, 1, &datafmt, col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd2, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else if (ret == CS_SUCCEED) { ; } else { break; } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.%d\n", ret); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type. %d\n", result_type); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/ct_cursors.c000644 025423 025423 00000023232 14056414221 023064 0ustar00fredianofrediano000000 000000 #include #include #ifdef HAVE_STRING_H #include #endif #include #include "common.h" int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_COMMAND *cmd2; CS_COMMAND *cmd3; CS_RETCODE ret; CS_RETCODE ret2; CS_RETCODE results_ret; CS_INT result_type; CS_INT count, count2, row_count = 0; CS_DATAFMT datafmt; CS_DATAFMT datafmt2; CS_SMALLINT ind; int verbose = 1; CS_CHAR *name = "c1"; CS_CHAR *name2 = "c2"; CS_CHAR col1[6]; CS_CHAR col2[6]; CS_INT datalength; CS_CHAR text[128]; CS_INT num_cols, i; memset(col1, 0, sizeof(col1)); memset(col2, 0, sizeof(col2)); printf("%s: use multiple cursors on the same connection\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = ct_cmd_alloc(conn, &cmd2); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Command Alloc failed!\n"); } return ret; } ret = ct_cmd_alloc(conn, &cmd3); if (ret != CS_SUCCEED) { if (verbose) { fprintf(stderr, "Command Alloc failed!\n"); } return ret; } ret = run_command(cmd, "CREATE TABLE #test_table (col1 char(4))"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table (col1) VALUES ('AAA')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table (col1) VALUES ('BBB')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table (col1) VALUES ('CCC')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "CREATE TABLE #test_table2 (col1 char(4))"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table2 (col1) VALUES ('XXX')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table2 (col1) VALUES ('YYY')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "INSERT #test_table2 (col1) VALUES ('ZZZ')"); if (ret != CS_SUCCEED) return 1; if (verbose) { printf("opening first cursor on connection\n"); } strcpy(text, "select col1 from #test_table order by col1"); ret = ct_cursor(cmd, CS_CURSOR_DECLARE, name, CS_NULLTERM, text, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor declare failed\n"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_ROWS, name, CS_NULLTERM, NULL, CS_UNUSED, (CS_INT) 1); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor set cursor rows failed"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_OPEN, name, CS_NULLTERM, text, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor open failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_FAIL: fprintf(stderr, "ct_results failed\n"); return 1; case CS_CMD_SUCCEED: case CS_CMD_DONE: case CS_STATUS_RESULT: break; case CS_CURSOR_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "unexpected num of columns = %d \n", num_cols); return 1; } for (i = 0; i < num_cols; i++) { /* here we can finally test for the return status column */ ret = ct_describe(cmd, i + 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed for column %d\n", i); return 1; } if (datafmt.status & CS_RETURN) { printf("ct_describe() column %d \n", i); } datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 6; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd, 1, &datafmt, col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } if (verbose) { printf("opening second cursor on connection\n"); } strcpy(text, "select col1 from #test_table2 order by col1"); ret = ct_cursor(cmd2, CS_CURSOR_DECLARE, name2, CS_NULLTERM, text, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor declare failed\n"); return 1; } ret = ct_cursor(cmd2, CS_CURSOR_ROWS, name2, CS_NULLTERM, NULL, CS_UNUSED, (CS_INT) 1); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor set cursor rows failed"); return 1; } ret = ct_cursor(cmd2, CS_CURSOR_OPEN, name2, CS_NULLTERM, text, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor open failed\n"); return 1; } ret = ct_send(cmd2); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send failed\n"); return 1; } while ((results_ret = ct_results(cmd2, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_FAIL: fprintf(stderr, "ct_results failed\n"); return 1; case CS_CMD_SUCCEED: case CS_CMD_DONE: case CS_STATUS_RESULT: break; case CS_CURSOR_RESULT: ret = ct_res_info(cmd2, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "unexpected num of columns = %d \n", num_cols); return 1; } for (i = 0; i < num_cols; i++) { /* here we can finally test for the return status column */ ret = ct_describe(cmd2, i + 1, &datafmt2); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed for column %d\n", i); return 1; } if (datafmt2.status & CS_RETURN) { printf("ct_describe() column %d \n", i); } datafmt2.datatype = CS_CHAR_TYPE; datafmt2.format = CS_FMT_NULLTERM; datafmt2.maxlength = 6; datafmt2.count = 1; datafmt2.locale = NULL; ret = ct_bind(cmd2, 1, &datafmt2, col2, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } row_count = 0; while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { ret2 = ct_fetch(cmd2, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count2); if (ret == CS_SUCCEED && ret2 == CS_SUCCEED) { printf("%s\t\t\t%s\n", col1, col2); } } switch ((int) ret) { case CS_END_DATA: break; case CS_ROW_FAIL: fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } if (verbose) { printf("closing first cursor on connection\n"); } ret = ct_cursor(cmd, CS_CURSOR_CLOSE, name, CS_NULLTERM, NULL, CS_UNUSED, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor(close) failed\n"); return ret; } if ((ret = ct_send(cmd)) != CS_SUCCEED) { fprintf(stderr, "BILL ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(2) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } ret = ct_cursor(cmd, CS_CURSOR_DEALLOC, name, CS_NULLTERM, NULL, CS_UNUSED, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor(dealloc) failed\n"); return ret; } if ((ret = ct_send(cmd)) != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(3) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } if (verbose) { printf("closing second cursor on connection\n"); } ret = ct_cursor(cmd2, CS_CURSOR_CLOSE, name2, CS_NULLTERM, NULL, CS_UNUSED, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor(close) failed\n"); return ret; } if ((ret = ct_send(cmd2)) != CS_SUCCEED) { fprintf(stderr, "BILL ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd2, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(2) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } ret = ct_cursor(cmd2, CS_CURSOR_DEALLOC, name2, CS_NULLTERM, NULL, CS_UNUSED, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_cursor(dealloc) failed\n"); return ret; } if ((ret = ct_send(cmd2)) != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return ret; } while ((results_ret = ct_results(cmd2, &result_type)) == CS_SUCCEED) { if (result_type == CS_CMD_FAIL) { fprintf(stderr, "ct_results(3) result_type CS_CMD_FAIL.\n"); return 1; } } if (results_ret != CS_END_RESULTS) { fprintf(stderr, "ct_results() returned BAD.\n"); return 1; } ct_cmd_drop(cmd2); ct_cmd_drop(cmd3); if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 2; } if (verbose) { printf("Test succeded\n"); } return 0; } freetds-1.3.6/src/ctlib/unittests/ct_diagall.c000644 025423 025423 00000014504 14056414221 022763 0ustar00fredianofrediano000000 000000 #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" /* Testing: Client and server Messages */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT datalength[2]; CS_SMALLINT ind[2]; CS_INT count, row_count = 0; CS_INT cv; int i; CS_CHAR select[1024]; CS_INT col1[2]; CS_CHAR col2[2][5]; CS_INT num_msgs, totmsgs; CS_CLIENTMSG client_message; CS_SERVERMSG server_message; printf("%s: Retrieve data using array binding \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } if (ct_diag(conn, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_INIT) failed\n"); return 1; } totmsgs = 5; if (ct_diag(conn, CS_MSGLIMIT, CS_ALLMSG_TYPE, CS_UNUSED, &totmsgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_MSGLIMIT) failed\n"); return 1; } printf("Maximum message limit is set to: %d\n", totmsgs); ret = run_command(cmd, "CREATE TABLE #ctlibarray (col1 int not null, col2 char(4) not null, col3 datetime not null)"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (1, 'AAAA', 'Jan 1 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (2, 'BBBB', 'Jan 2 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; strcpy(select, "select col1, col2 from #ctlibarray order by col1 "); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command(%s) failed\n", select); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 2) { fprintf(stderr, "num_cols %d != 2", num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } datafmt.count = 2; ret = ct_bind(cmd, 1, &datafmt, &col1[0], datalength, ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } ret = ct_describe(cmd, 2, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 5; datafmt.count = 4; ret = ct_bind(cmd, 2, &datafmt, &col2[0], datalength, ind); if (ret != CS_SUCCEED) { datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 5; datafmt.count = 2; ret = ct_bind(cmd, 2, &datafmt, &col2[0], datalength, ind); } if (ret != CS_SUCCEED) { return 1; } count = 0; while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ printf("ct_fetch returned %d rows\n", count); for (cv = 0; cv < count; cv++) printf("col1 = %d col2= '%s'\n", col1[cv], col2[cv]); } count = 0; } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } ret = run_command(cmd, "DROP TABLE #ctlibarray3"); ret = run_command(cmd, "DROP TABLE #ctlibarray4"); ret = run_command(cmd, "DROP TABLE #ctlibarray5"); if (ct_diag(conn, CS_STATUS, CS_ALLMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_STATUS) failed\n"); return 1; } printf("Total number of client/server messages = %d \n", num_msgs); if (ct_diag(conn, CS_STATUS, CS_CLIENTMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_STATUS) failed\n"); return 1; } printf("Number of client messages returned: %d\n", num_msgs); for (i = 0; i < num_msgs; i++) { if (ct_diag(conn, CS_GET, CS_CLIENTMSG_TYPE, i + 1, &client_message) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_GET) failed\n"); return 1; } clientmsg_cb(ctx, conn, &client_message); } if (ct_diag(conn, CS_STATUS, CS_SERVERMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_STATUS) failed\n"); return 1; } printf("Number of server messages returned: %d\n", num_msgs); for (i = 0; i < num_msgs; i++) { if (ct_diag(conn, CS_GET, CS_SERVERMSG_TYPE, i + 1, &server_message) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_GET) failed\n"); return 1; } servermsg_cb(ctx, conn, &server_message); } if (ct_diag(conn, CS_CLEAR, CS_ALLMSG_TYPE, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_CLEAR) failed\n"); return 1; } if (ct_diag(conn, CS_STATUS, CS_ALLMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_STATUS) failed\n"); return 1; } if (num_msgs != 0) { fprintf(stderr, "cs_diag(CS_CLEAR) failed there are still %d messages on queue\n", num_msgs); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/ct_diagclient.c000644 025423 025423 00000013242 14056414221 023467 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" /* Testing: Client Messages */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT datalength[2]; CS_SMALLINT ind[2]; CS_INT count, row_count = 0; CS_INT cv; int i; CS_CHAR select[1024]; CS_INT col1[2]; CS_CHAR col2[2][5]; CS_INT num_msgs, totmsgs; CS_CLIENTMSG client_message; int result = 1; printf("%s: Retrieve data using array binding \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } if (ct_diag(conn, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_INIT) failed\n"); return 1; } totmsgs = 1; if (ct_diag(conn, CS_MSGLIMIT, CS_CLIENTMSG_TYPE, CS_UNUSED, &totmsgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_MSGLIMIT) failed\n"); return 1; } printf("Maximum message limit is set to: %d\n", totmsgs); ret = run_command(cmd, "CREATE TABLE #ctlibarray (col1 int not null, col2 char(4) not null, col3 datetime not null)"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (1, 'AAAA', 'Jan 1 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlibarray values (2, 'BBBB', 'Jan 2 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; strcpy(select, "select col1, col2 from #ctlibarray order by col1 "); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command(%s) failed\n", select); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 2) { fprintf(stderr, "num_cols %d != 2", num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } datafmt.count = 2; ret = ct_bind(cmd, 1, &datafmt, &col1[0], datalength, ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } ret = ct_describe(cmd, 2, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 5; datafmt.count = 4; ret = ct_bind(cmd, 2, &datafmt, &col2[0], datalength, ind); if (ret != CS_SUCCEED) { if (ct_diag(conn, CS_STATUS, CS_CLIENTMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_STATUS) failed\n"); return 1; } printf("Number of client messages returned: %d\n", num_msgs); for (i = 0; i < num_msgs; i++) { if (ct_diag(conn, CS_GET, CS_CLIENTMSG_TYPE, i + 1, &client_message) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_GET) failed\n"); return 1; } clientmsg_cb(ctx, conn, &client_message); } if (ct_diag(conn, CS_CLEAR, CS_CLIENTMSG_TYPE, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_CLEAR) failed\n"); return 1; } if (ct_diag(conn, CS_STATUS, CS_CLIENTMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_STATUS) failed\n"); return 1; } if (num_msgs != 0) { fprintf(stderr, "cs_diag(CS_CLEAR) failed there are still %d messages on queue\n", num_msgs); return 1; } /* we catch error, good */ result = 0; } else { fprintf(stderr, "ct_bind() succeeded while it shouldn't\n"); return 1; } datafmt.count = 2; ret = ct_bind(cmd, 2, &datafmt, &col2[0], datalength, ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } count = 0; while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ printf("ct_fetch returned %d rows\n", count); for (cv = 0; cv < count; cv++) printf("col1 = %d col2= '%s'\n", col1[cv], col2[cv]); } count = 0; } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return result; } freetds-1.3.6/src/ctlib/unittests/ct_diagserver.c000644 025423 025423 00000003627 14056414221 023525 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" /* Testing: Server messages limit */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; int i; CS_INT num_msgs, totMsgs; CS_SERVERMSG server_message; if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } if (ct_diag(conn, CS_INIT, CS_UNUSED, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_INIT) failed\n"); return 1; } totMsgs = 4; if (ct_diag(conn, CS_MSGLIMIT, CS_SERVERMSG_TYPE, CS_UNUSED, &totMsgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_STATUS) failed\n"); return 1; } printf("Maximum message limit is set to %d.\n", totMsgs); if (ct_diag(conn, CS_STATUS, CS_SERVERMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "ct_diag(CS_STATUS) failed\n"); return 1; } printf("Number of messages returned: %d\n", num_msgs); for (i = 0; i < num_msgs; i++) { if (ct_diag(conn, CS_GET, CS_SERVERMSG_TYPE, i + 1, &server_message) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_GET) failed\n"); return 1; } servermsg_cb(ctx, conn, &server_message); } if (ct_diag(conn, CS_CLEAR, CS_SERVERMSG_TYPE, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_CLEAR) failed\n"); return 1; } if (ct_diag(conn, CS_STATUS, CS_SERVERMSG_TYPE, CS_UNUSED, &num_msgs) != CS_SUCCEED) { fprintf(stderr, "cs_diag(CS_STATUS) failed\n"); return 1; } if (num_msgs != 0) { fprintf(stderr, "cs_diag(CS_CLEAR) failed there are still %d messages on queue\n", num_msgs); return 1; } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/ct_dynamic.c000644 025423 025423 00000027065 14056414221 023020 0ustar00fredianofrediano000000 000000 #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" static CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * errmsg); static CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg); static int verbose = 0; static CS_CONTEXT *ctx; static CS_CONNECTION *conn; static CS_COMMAND *cmd; static CS_COMMAND *cmd2; static void cleanup(void) { CS_RETCODE ret; if (verbose) { printf("Trying logout\n"); } if (cmd2) ct_cmd_drop(cmd2); ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); exit(1); } } static void chk(int check, const char *fmt, ...) { va_list ap; if (check) return; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); cleanup(); exit(1); } int main(int argc, char *argv[]) { int errCode = 1; CS_RETCODE ret; CS_RETCODE results_ret; CS_CHAR cmdbuf[4096]; CS_CHAR name[257]; CS_INT datalength; CS_SMALLINT ind; CS_INT count; CS_INT num_cols; CS_INT row_count = 0; CS_DATAFMT datafmt; CS_DATAFMT descfmt; CS_INT intvar; CS_INT intvarsize; CS_SMALLINT intvarind; CS_INT res_type; int i; if (argc > 1 && (0 == strcmp(argv[1], "-v"))) verbose = 1; printf("%s: use ct_dynamic to prepare and execute a statement\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *) ex_clientmsg_cb); ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) ex_servermsg_cb); ret = ct_cmd_alloc(conn, &cmd2); chk(ret == CS_SUCCEED, "cmd2_alloc failed\n"); /* do not test error */ ret = run_command(cmd, "IF OBJECT_ID('tempdb..#ct_dynamic') IS NOT NULL DROP table #ct_dynamic"); strcpy(cmdbuf, "create table #ct_dynamic (id numeric identity not null, \ name varchar(30), age int, cost money, bdate datetime, fval float) "); ret = run_command(cmd, cmdbuf); chk(ret == CS_SUCCEED, "create table failed\n"); strcpy(cmdbuf, "insert into #ct_dynamic ( name , age , cost , bdate , fval ) "); strcat(cmdbuf, "values ('Bill', 44, 2000.00, 'May 21 1960', 60.97 ) "); ret = run_command(cmd, cmdbuf); chk(ret == CS_SUCCEED, "insert table failed\n"); strcpy(cmdbuf, "insert into #ct_dynamic ( name , age , cost , bdate , fval ) "); strcat(cmdbuf, "values ('Freddy', 32, 1000.00, 'Jan 21 1972', 70.97 ) "); ret = run_command(cmd, cmdbuf); chk(ret == CS_SUCCEED, "insert table failed\n"); strcpy(cmdbuf, "insert into #ct_dynamic ( name , age , cost , bdate , fval ) "); strcat(cmdbuf, "values ('James', 42, 5000.00, 'May 21 1962', 80.97 ) "); ret = run_command(cmd, cmdbuf); chk(ret == CS_SUCCEED, "insert table failed\n"); strcpy(cmdbuf, "select name from #ct_dynamic where age = ?"); ret = ct_dynamic(cmd, CS_PREPARE, "age", CS_NULLTERM, cmdbuf, CS_NULLTERM); chk(ret == CS_SUCCEED, "ct_dynamic failed\n"); chk(ct_send(cmd) == CS_SUCCEED, "ct_send(CS_PREPARE) failed\n"); while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_CMD_SUCCEED: case CS_CMD_DONE: break; case CS_CMD_FAIL: break; default: goto ERR; } } chk(ret == CS_END_RESULTS, "ct_results() unexpected return.\n", (int) ret); ret = ct_dynamic(cmd, CS_DESCRIBE_INPUT, "age", CS_NULLTERM, NULL, CS_UNUSED); chk(ret == CS_SUCCEED, "ct_dynamic failed\n"); chk(ct_send(cmd) == CS_SUCCEED, "ct_send(CS_DESCRIBE_INPUT) failed\n"); while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_DESCRIBE_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); chk(ret == CS_SUCCEED, "ct_res_info() failed"); for (i = 1; i <= num_cols; i++) { ret = ct_describe(cmd, i, &descfmt); chk(ret == CS_SUCCEED, "ct_describe() failed"); fprintf(stderr, "CS_DESCRIBE_INPUT parameter %d :\n", i); if (descfmt.namelen == 0) fprintf(stderr, "\t\tNo name...\n"); else fprintf(stderr, "\t\tName = %*.*s\n", descfmt.namelen, descfmt.namelen, descfmt.name); fprintf(stderr, "\t\tType = %d\n", descfmt.datatype); fprintf(stderr, "\t\tLength = %d\n", descfmt.maxlength); } break; case CS_CMD_SUCCEED: case CS_CMD_DONE: break; case CS_CMD_FAIL: break; default: goto ERR; } } ret = ct_dynamic(cmd, CS_DESCRIBE_OUTPUT, "age", CS_NULLTERM, NULL, CS_UNUSED); chk(ret == CS_SUCCEED, "ct_dynamic failed\n"); chk(ct_send(cmd) == CS_SUCCEED, "ct_send(CS_DESCRIBE_OUTPUT) failed\n"); while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_DESCRIBE_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); chk(ret == CS_SUCCEED, "ct_res_info() failed"); chk(num_cols == 1, "CS_DESCRIBE_OUTPUT showed %d columns , expected 1\n", num_cols); for (i = 1; i <= num_cols; i++) { ret = ct_describe(cmd, i, &descfmt); chk(ret == CS_SUCCEED, "ct_describe() failed"); if (descfmt.namelen == 0) fprintf(stderr, "\t\tNo name...\n"); else fprintf(stderr, "\t\tName = %*.*s\n", descfmt.namelen, descfmt.namelen, descfmt.name); fprintf(stderr, "\t\tType = %d\n", descfmt.datatype); fprintf(stderr, "\t\tLength = %d\n", descfmt.maxlength); } break; case CS_CMD_SUCCEED: case CS_CMD_DONE: break; case CS_CMD_FAIL: break; default: goto ERR; } } /* execute dynamic on a second command to check it still works */ ret = ct_dynamic(cmd2, CS_EXECUTE, "age", CS_NULLTERM, NULL, CS_UNUSED); chk(ret == CS_SUCCEED, "ct_dynamic failed\n"); intvar = 44; intvarsize = 4; intvarind = 0; datafmt.name[0] = 0; datafmt.namelen = 0; datafmt.datatype = CS_INT_TYPE; datafmt.status = CS_INPUTVALUE; ret = ct_setparam(cmd2, &datafmt, (CS_VOID *) & intvar, &intvarsize, &intvarind); chk(ret == CS_SUCCEED, "ct_setparam(int) failed\n"); chk(ct_send(cmd2) == CS_SUCCEED, "ct_send(CS_EXECUTE) failed\n"); while ((results_ret = ct_results(cmd2, &res_type)) == CS_SUCCEED) { chk(res_type != CS_CMD_FAIL, "1: ct_results() result_type CS_CMD_FAIL.\n"); chk(res_type != CS_COMPUTE_RESULT, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); switch ((int) res_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_ROW_RESULT: datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 256; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd2, 1, &datafmt, name, &datalength, &ind); chk(ret == CS_SUCCEED, "ct_bind() failed\n"); while (((ret = ct_fetch(cmd2, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; chk(ret != CS_ROW_FAIL, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); if (ret == CS_SUCCEED) { chk(!strcmp(name, "Bill"), "fetched value '%s' expected 'Bill'\n", name); } else { break; } } chk(ret == CS_END_DATA, "ct_fetch() unexpected return %d.\n", (int) ret); break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } chk(results_ret == CS_END_RESULTS, "ct_results() unexpected return.\n", (int) results_ret); intvar = 32; chk(ct_send(cmd2) == CS_SUCCEED, "ct_send(CS_EXECUTE) failed\n"); while ((results_ret = ct_results(cmd2, &res_type)) == CS_SUCCEED) { chk(res_type != CS_CMD_FAIL, "2: ct_results() result_type CS_CMD_FAIL.\n"); chk(res_type != CS_COMPUTE_RESULT, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); switch ((int) res_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_ROW_RESULT: datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 256; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd2, 1, &datafmt, name, &datalength, &ind); chk(ret == CS_SUCCEED, "ct_bind() failed\n"); while (((ret = ct_fetch(cmd2, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; chk(ret != CS_ROW_FAIL, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); if (ret == CS_SUCCEED) { chk(!strcmp(name, "Freddy"), "fetched value '%s' expected 'Freddy'\n", name); } else { break; } } chk(ret == CS_END_DATA, "ct_fetch() unexpected return %d.\n", (int) ret); break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } chk(results_ret == CS_END_RESULTS, "ct_results() unexpected return.\n", (int) results_ret); ret = ct_dynamic(cmd, CS_DEALLOC, "age", CS_NULLTERM, NULL, CS_UNUSED); chk(ret == CS_SUCCEED, "ct_dynamic failed\n"); chk(ct_send(cmd) == CS_SUCCEED, "ct_send(CS_DEALLOC) failed\n"); while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_CMD_SUCCEED: case CS_CMD_DONE: break; case CS_CMD_FAIL: break; default: goto ERR; } } chk(ret == CS_END_RESULTS, "ct_results() unexpected return.\n", (int) ret); /* * check we can prepare again dynamic with same name after deallocation */ strcpy(cmdbuf, "select name from #ct_dynamic where age = ?"); ret = ct_dynamic(cmd, CS_PREPARE, "age", CS_NULLTERM, cmdbuf, CS_NULLTERM); chk(ret == CS_SUCCEED, "ct_dynamic failed\n"); chk(ct_send(cmd) == CS_SUCCEED, "ct_send(CS_PREPARE) failed\n"); while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_CMD_SUCCEED: case CS_CMD_DONE: break; case CS_CMD_FAIL: break; default: goto ERR; } } chk(ret == CS_END_RESULTS, "ct_results() unexpected return.\n", (int) ret); ct_dynamic(cmd, CS_DEALLOC, "invalid", CS_NULLTERM, NULL, CS_UNUSED); ct_send(cmd); while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) chk(res_type != CS_ROW_RESULT, "Rows not expected\n"); chk(ret == CS_END_RESULTS, "ct_results() unexpected return.\n", (int) ret); ret = ct_dynamic(cmd2, CS_EXECUTE, "age", CS_NULLTERM, NULL, CS_UNUSED); chk(ret == CS_SUCCEED, "ct_dynamic failed\n"); intvar = 32; intvarsize = 4; intvarind = 0; datafmt.name[0] = 0; datafmt.namelen = 0; datafmt.datatype = CS_INT_TYPE; datafmt.status = CS_INPUTVALUE; ret = ct_setparam(cmd2, &datafmt, (CS_VOID *) & intvar, &intvarsize, &intvarind); chk(ct_send(cmd2) == CS_SUCCEED, "ct_send(CS_EXECUTE) failed\n"); /* all tests succeeded */ errCode = 0; ERR: cleanup(); return errCode; } static CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg) { printf("\nOpen Client Message:\n"); printf("Message number: LAYER = (%d) ORIGIN = (%d) ", CS_LAYER(errmsg->msgnumber), CS_ORIGIN(errmsg->msgnumber)); printf("SEVERITY = (%d) NUMBER = (%d)\n", CS_SEVERITY(errmsg->msgnumber), CS_NUMBER(errmsg->msgnumber)); printf("Message String: %s\n", errmsg->msgstring); if (errmsg->osstringlen > 0) { printf("Operating System Error: %s\n", errmsg->osstring); } fflush(stdout); return CS_SUCCEED; } static CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg) { printf("\nServer message:\n"); printf("Message number: %d, Severity %d, ", srvmsg->msgnumber, srvmsg->severity); printf("State %d, Line %d\n", srvmsg->state, srvmsg->line); if (srvmsg->svrnlen > 0) { printf("Server '%s'\n", srvmsg->svrname); } if (srvmsg->proclen > 0) { printf(" Procedure '%s'\n", srvmsg->proc); } printf("Message String: %s\n", srvmsg->text); fflush(stdout); return CS_SUCCEED; } freetds-1.3.6/src/ctlib/unittests/ct_options.c000644 025423 025423 00000006201 14056414221 023054 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" /* Testing: Set and get options with ct_options */ int main(int argc, char *argv[]) { int verbose = 0; CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_RETCODE ret; CS_INT datefirst = 0; CS_INT dateformat = 0; CS_BOOL truefalse = 999; if (verbose) { printf("Trying login\n"); } if (argc >= 5) { common_pwd.initialized = argc; strcpy(common_pwd.SERVER, argv[1]); strcpy(common_pwd.DATABASE, argv[2]); strcpy(common_pwd.USER, argv[3]); strcpy(common_pwd.PASSWORD, argv[4]); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } printf("%s: Set/Retrieve DATEFIRST\n", __FILE__); /* DATEFIRST */ datefirst = CS_OPT_WEDNESDAY; if (ct_options(conn, CS_SET, CS_OPT_DATEFIRST, &datefirst, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } datefirst = 999; if (ct_options(conn, CS_GET, CS_OPT_DATEFIRST, &datefirst, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } if (datefirst != CS_OPT_WEDNESDAY) { fprintf(stderr, "ct_options(DATEFIRST) didn't work retrieved %d expected %d\n", datefirst, CS_OPT_WEDNESDAY); return 1; } printf("%s: Set/Retrieve DATEFORMAT\n", __FILE__); /* DATEFORMAT */ dateformat = CS_OPT_FMTMYD; if (ct_options(conn, CS_SET, CS_OPT_DATEFORMAT, &dateformat, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } dateformat = 999; if (ct_options(conn, CS_GET, CS_OPT_DATEFORMAT, &dateformat, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } if (dateformat != CS_OPT_FMTMYD) { fprintf(stderr, "ct_options(DATEFORMAT) didn't work retrieved %d expected %d\n", dateformat, CS_OPT_FMTMYD); return 1; } printf("%s: Set/Retrieve ANSINULL\n", __FILE__); /* ANSI NULLS */ truefalse = CS_TRUE; if (ct_options(conn, CS_SET, CS_OPT_ANSINULL, &truefalse, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } truefalse = 999; if (ct_options(conn, CS_GET, CS_OPT_ANSINULL, &truefalse, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } if (truefalse != CS_TRUE) { fprintf(stderr, "ct_options(ANSINULL) didn't work\n"); return 1; } printf("%s: Set/Retrieve CHAINXACTS\n", __FILE__); /* CHAINED XACT */ truefalse = CS_TRUE; if (ct_options(conn, CS_SET, CS_OPT_CHAINXACTS, &truefalse, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } truefalse = 999; if (ct_options(conn, CS_GET, CS_OPT_CHAINXACTS, &truefalse, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "ct_options() failed\n"); return 1; } if (truefalse != CS_TRUE) { fprintf(stderr, "ct_options(CHAINXACTS) didn't work\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/data.c000644 025423 025423 00000005641 14056414221 021613 0ustar00fredianofrediano000000 000000 /* Test some data from server. Currently tests MS XML type */ #undef NDEBUG #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include "common.h" int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT copied = 0; CS_SMALLINT ind = 0; CS_INT count; const char *select; char buffer[128]; int tds_version; printf("%s: test data from server\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin_with_options(argc, argv, &ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } verbose += common_pwd.fverbose; ret = ct_con_props(conn, CS_GET, CS_TDS_VERSION, &tds_version, CS_UNUSED, NULL); if (ret == CS_SUCCEED) { switch (tds_version) { case CS_TDS_70: case CS_TDS_71: fprintf(stderr, "This TDS version does not support XML.\n"); try_ctlogout(ctx, conn, cmd, verbose); return 0; } } select = "select cast('ciaohi' as xml) as name"; printf("%s\n", select); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); assert(ret == CS_SUCCEED); ret = ct_send(cmd); assert(ret == CS_SUCCEED); ret = ct_results(cmd, &result_type); assert(ret == CS_SUCCEED); switch (result_type) { case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL, probably not MSSQL.\n"); try_ctlogout(ctx, conn, cmd, verbose); return 0; case CS_ROW_RESULT: break; default: fprintf(stderr, "ct_results() unexpected return %d.\n", result_type); goto Cleanup; } ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); assert(ret == CS_SUCCEED); assert(num_cols == 1); ret = ct_describe(cmd, 1, &datafmt); assert(ret == CS_SUCCEED); assert(strcmp(datafmt.name, "name") == 0); assert(datafmt.datatype == CS_LONGCHAR_TYPE); assert(datafmt.maxlength == 0x7fffffff); assert(datafmt.scale == 0); assert(datafmt.precision == 0); datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 100; printf("binding column 1\n"); ret = ct_bind(cmd, 1, &datafmt, buffer, &copied, &ind); assert(ret == CS_SUCCEED); printf("fetching rows.\n"); while ((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) { fprintf(stderr, "ct_fetch() returned %d.\n", (int) ret); buffer[copied] = '\0'; fprintf(stderr, "copied %d bytes: [%s]\n", copied, buffer); } assert(ret == CS_END_DATA); do { ret = ct_results(cmd, &result_type); } while (ret == CS_SUCCEED); ret = ct_results(cmd, &result_type); assert(ret == CS_END_RESULTS); if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); assert(ret == CS_SUCCEED); return 0; Cleanup: try_ctlogout(ctx, conn, cmd, verbose); return 1; } freetds-1.3.6/src/ctlib/unittests/datafmt.c000644 025423 025423 00000007764 14056414221 022332 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include "common.h" /* Testing: data truncation behavior of ct_fetch */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT copied = 0; CS_SMALLINT ind = 0; CS_INT count, row_count = 0; CS_CHAR select[1024]; char *addr = NULL; printf("%s: test data truncation behavior of ct_fetch \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin_with_options(argc, argv, &ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } verbose += common_pwd.fverbose; strcpy(select, "select name from systypes where datalength(name) > 2*9 order by datalength(name)"); printf("%s\n", select); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command(%s) failed\n", select); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); free(addr); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); free(addr); return 1; } fprintf(stderr, "%d column%s\n", num_cols, num_cols==1? "":"s"); ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed\n"); free(addr); return 1; } fprintf(stderr, "type = %d\n", datafmt.datatype); fprintf(stderr, "maxlength = %d\n", datafmt.maxlength); if (datafmt.datatype == CS_CHAR_TYPE) { fprintf(stderr, "CS_CHAR_TYPE\n"); datafmt.format = CS_FMT_NULLTERM; addr = (char *) malloc(datafmt.maxlength); } fprintf(stderr, "binding column 1 (%s)\n", datafmt.name); /* set maxlength to something short to test truncation behavior */ if (common_pwd.maxlength) datafmt.maxlength = common_pwd.maxlength; ret = ct_bind(cmd, 1, &datafmt, addr, &copied, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); free(addr); return 1; } fprintf(stderr, "fetching rows with datafmt.maxlength = %d\n", datafmt.maxlength); while ((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) != CS_END_DATA) { fprintf(stderr, "ct_fetch() row %d returned %d.\n", row_count, (int) ret); addr[copied] = '\0'; fprintf(stderr, "copied %d bytes: [%s]\n", copied, addr); row_count += count; switch (ret) { case CS_SUCCEED: printf("ct_fetch returned %d row%s\n", count, count==1? "":"s"); break; case CS_ROW_FAIL: fprintf(stderr, "error: ct_fetch() returned CS_ROW_FAIL on row %d.\n", row_count); free(addr); return 1; case CS_CANCELED: fprintf(stderr, "error: ct_fetch() returned CS_CANCELED??\n"); free(addr); return 1; case CS_FAIL: fprintf(stderr, "error: ct_fetch() returned CS_FAIL.\n"); free(addr); return 1; default: fprintf(stderr, "error: ct_fetch() unexpected return.\n"); free(addr); return 1; } } break; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); free(addr); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); free(addr); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); free(addr); return 1; } free(addr); return 0; } freetds-1.3.6/src/ctlib/unittests/get_send_data.c000644 025423 025423 00000014503 14056414221 023460 0ustar00fredianofrediano000000 000000 #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" static CS_CONNECTION *conn = NULL; /* Testing: Retrieve CS_TEXT_TYPE using ct_bind() */ int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_COMMAND *cmd; int i, verbose = 0; CS_RETCODE ret; CS_RETCODE ret2; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT datalength; CS_SMALLINT ind; CS_INT count, row_count = 0; CS_INT id; CS_CHAR name[600]; CS_CHAR *nameptr; CS_INT getlen; char large_sql[1024]; char len600[601]; char len800[801]; char temp[11]; char *textptr; CS_IODESC iodesc; int tds_version; len600[0] = 0; name[0] = 0; for (i = 0; i < 60; i++) { sprintf(temp, "_abcde_%03d", (i + 1) * 10); strcat(len600, temp); } len600[600] = '\0'; len800[0] = 0; for (i = 0; i < 80; i++) { sprintf(temp, "_zzzzz_%03d", (i + 1) * 10); strcat(len800, temp); } len800[800] = '\0'; printf("%s: Retrieve CS_TEXT_TYPE using ct_bind()\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = ct_con_props(conn, CS_GET, CS_TDS_VERSION, &tds_version, CS_UNUSED, NULL); if (ret == CS_SUCCEED) { if (tds_version >= CS_TDS_72) { printf("Protocol TDS7.2+ detected, test not supported\n"); try_ctlogout(ctx, conn, cmd, verbose); return 0; } } ret = run_command(cmd, "CREATE TABLE #test_table (id int, name text)"); if (ret != CS_SUCCEED) return 1; sprintf(large_sql, "INSERT #test_table (id, name) VALUES (2, '%s')", len600); ret = run_command(cmd, large_sql); if (ret != CS_SUCCEED) return 1; ret = ct_command(cmd, CS_LANG_CMD, "SELECT id, name FROM #test_table", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 2) { fprintf(stderr, "num_cols %d != 2", num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } ret = ct_bind(cmd, 1, &datafmt, &id, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ if (verbose) { printf("id = '%d'\n", id); } nameptr = name; while ((ret2 = ct_get_data(cmd, 2 , nameptr, 200, &getlen )) == CS_SUCCEED) { nameptr += getlen; } if (ret2 != CS_END_DATA) { fprintf(stderr, "ct_get_data() failed\n"); return 1; } if (memcmp(name, len600, 600)) { fprintf(stderr, "Bad return data\n"); return 1; } printf("%s: Trying ct_data_info on text column\n", __FILE__); if (ct_data_info(cmd, CS_GET, 2, &iodesc) != CS_SUCCEED) { fprintf(stderr, "ct_data_info() failed\n"); return 1; } else { printf("datatype = %d\n", iodesc.datatype); printf("usertype = %d\n", iodesc.usertype); printf("text len = %d\n", iodesc.total_txtlen); printf("name = %*.*s\n", iodesc.namelen, iodesc.namelen, iodesc.name); } } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if ((ret = ct_command(cmd, CS_SEND_DATA_CMD, NULL, CS_UNUSED, CS_COLUMN_DATA)) != CS_SUCCEED) { fprintf(stderr, "ct_command(CS_SEND_DATA_CMD) failed.\n"); return 1; } iodesc.total_txtlen = 800; iodesc.log_on_update = CS_TRUE; if (ct_data_info(cmd, CS_SET, CS_UNUSED, &iodesc) != CS_SUCCEED) { fprintf(stderr, "ct_data_info() failed\n"); return 1; } for ( i = 0 ; i < 800 ; i += 200 ) { textptr = &len800[i]; ret = ct_send_data(cmd, textptr, (CS_INT) 200); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send_data failed\n"); return 1; } } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: break; case CS_PARAM_RESULT: break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/lang_ct_param.c000644 025423 025423 00000022220 14056414221 023461 0ustar00fredianofrediano000000 000000 #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" static const char *query = "insert into #ctparam_lang (name,name2,age,cost,bdate,fval) values (@in1, @in2, @in3, @moneyval, @dateval, @floatval)"; CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * errmsg); CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg); static int insert_test(CS_CONNECTION *conn, CS_COMMAND *cmd, int useNames); /* Testing: binding of data via ct_param */ int main(int argc, char *argv[]) { int errCode = 0; CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_CHAR cmdbuf[4096]; if (argc > 1 && (0 == strcmp(argv[1], "-v"))) verbose = 1; printf("%s: submit language query with variables using ct_param\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *) ex_clientmsg_cb); ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) ex_servermsg_cb); strcpy(cmdbuf, "create table #ctparam_lang (id numeric identity not null, \ name varchar(30), name2 varchar(20), age int, cost money, bdate datetime, fval float) "); ret = run_command(cmd, cmdbuf); if (ret != CS_SUCCEED) { fprintf(stderr, "create table failed\n"); errCode = 1; goto ERR; } /* test by name */ errCode = insert_test(conn, cmd, 1); /* if worked, test by position */ if (0 == errCode) errCode = insert_test(conn, cmd, 0); query = "insert into #ctparam_lang (name,name2,age,cost,bdate,fval) values (?, ?, ?, ?, ?, ?)"; if (0 == errCode) errCode = insert_test(conn, cmd, 0); if (verbose && (0 == errCode)) printf("lang_ct_param tests successful\n"); ERR: if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return errCode; } static int insert_test(CS_CONNECTION *conn, CS_COMMAND *cmd, int useNames) { CS_CONTEXT *ctx; CS_RETCODE ret; CS_INT res_type; CS_DATAFMT datafmt; CS_DATAFMT srcfmt; CS_DATAFMT destfmt; CS_INT intvar; CS_FLOAT floatvar; CS_MONEY moneyvar; CS_DATEREC datevar; char moneystring[10]; char dummy_name[30]; char dummy_name2[20]; CS_INT destlen; CS_INT rowsAffected = -1; int rows_found; /* clear table */ run_command(cmd, "delete #ctparam_lang"); /* * Assign values to the variables used for parameter passing. */ intvar = 2; floatvar = 0.12; strcpy(dummy_name, "joe blow"); strcpy(dummy_name2, ""); strcpy(moneystring, "300.90"); /* * Clear and setup the CS_DATAFMT structures used to convert datatypes. */ memset(&srcfmt, 0, sizeof(CS_DATAFMT)); srcfmt.datatype = CS_CHAR_TYPE; srcfmt.maxlength = strlen(moneystring); srcfmt.precision = 5; srcfmt.scale = 2; srcfmt.locale = NULL; memset(&destfmt, 0, sizeof(CS_DATAFMT)); destfmt.datatype = CS_MONEY_TYPE; destfmt.maxlength = sizeof(CS_MONEY); destfmt.precision = 5; destfmt.scale = 2; destfmt.locale = NULL; /* * Convert the string representing the money value * to a CS_MONEY variable. Since this routine does not have the * context handle, we use the property functions to get it. */ if ((ret = ct_cmd_props(cmd, CS_GET, CS_PARENT_HANDLE, &conn, CS_UNUSED, NULL)) != CS_SUCCEED) { fprintf(stderr, "ct_cmd_props() failed\n"); return 1; } if ((ret = ct_con_props(conn, CS_GET, CS_PARENT_HANDLE, &ctx, CS_UNUSED, NULL)) != CS_SUCCEED) { fprintf(stderr, "ct_con_props() failed\n"); return 1; } ret = cs_convert(ctx, &srcfmt, (CS_VOID *) moneystring, &destfmt, &moneyvar, &destlen); if (ret != CS_SUCCEED) { fprintf(stderr, "cs_convert() failed\n"); return 1; } /* * create the command */ if ((ret = ct_command(cmd, CS_LANG_CMD, query, strlen(query), CS_UNUSED)) != CS_SUCCEED) { fprintf(stderr, "ct_command(CS_LANG_CMD) failed\n"); return 1; } /* * Clear and setup the CS_DATAFMT structure, then pass * each of the parameters for the query. */ memset(&datafmt, 0, sizeof(datafmt)); if (useNames) strcpy(datafmt.name, "@in1"); else datafmt.name[0] = 0; datafmt.maxlength = 255; datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_CHAR_TYPE; datafmt.status = CS_INPUTVALUE; /* * The character string variable is filled in by the RPC so pass NULL * for the data 0 for data length, and -1 for the indicator arguments. */ ret = ct_param(cmd, &datafmt, dummy_name, strlen(dummy_name), 0); if (CS_SUCCEED != ret) { fprintf(stderr, "ct_param(char) failed\n"); return 1; } if (useNames) strcpy(datafmt.name, "@in2"); else datafmt.name[0] = 0; datafmt.maxlength = 255; datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_CHAR_TYPE; datafmt.status = CS_INPUTVALUE; ret = ct_param(cmd, &datafmt, dummy_name2, strlen(dummy_name2), 0); if (CS_SUCCEED != ret) { fprintf(stderr, "ct_param(char) failed\n"); return 1; } if (useNames) strcpy(datafmt.name, "@in3"); else datafmt.name[0] = 0; datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_INT_TYPE; datafmt.status = CS_INPUTVALUE; ret = ct_param(cmd, &datafmt, (CS_VOID *) & intvar, CS_SIZEOF(CS_INT), 0); if (CS_SUCCEED != ret) { fprintf(stderr, "ct_param(int) failed\n"); return 1; } if (useNames) strcpy(datafmt.name, "@moneyval"); else datafmt.name[0] = 0; datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_MONEY_TYPE; datafmt.status = CS_INPUTVALUE; ret = ct_param(cmd, &datafmt, (CS_VOID *) & moneyvar, CS_SIZEOF(CS_MONEY), 0); if (CS_SUCCEED != ret) { fprintf(stderr, "ct_param(money) failed\n"); return 1; } if (useNames) strcpy(datafmt.name, "@dateval"); else datafmt.name[0] = 0; datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_DATETIME_TYPE; datafmt.status = CS_INPUTVALUE; memset(&datevar, 0, sizeof(CS_DATEREC)); datevar.dateyear = 2003; datevar.datemonth = 2; datevar.datedmonth = 1; ret = ct_param(cmd, &datafmt, &datevar, 0, 0); if (CS_SUCCEED != ret) { fprintf(stderr, "ct_param(datetime) failed"); return 1; } if (useNames) strcpy(datafmt.name, "@floatval"); else datafmt.name[0] = 0; datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_FLOAT_TYPE; datafmt.status = CS_INPUTVALUE; ret = ct_param(cmd, &datafmt, &floatvar, 0, 0); if (CS_SUCCEED != ret) { fprintf(stderr, "ct_param(float) failed"); return 1; } /* * Send the command to the server */ if (ct_send(cmd) != CS_SUCCEED) { fprintf(stderr, "ct_send(CS_LANG_CMD) failed\n"); return 1; } /* * Process the results. */ while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_CMD_SUCCEED: case CS_CMD_DONE: { CS_INT rowsAffected=0; ct_res_info(cmd, CS_ROW_COUNT, &rowsAffected, CS_UNUSED, NULL); if (1 != rowsAffected) fprintf(stderr, "insert touched %d rows instead of 1\n", rowsAffected); else rows_found = 1; } break; case CS_CMD_FAIL: /* * The server encountered an error while * processing our command. */ fprintf(stderr, "ct_results returned CS_CMD_FAIL.\n"); break; case CS_STATUS_RESULT: /* * The server encountered an error while * processing our command. */ fprintf(stderr, "ct_results returned CS_STATUS_RESULT.\n"); break; default: /* * We got something unexpected. */ fprintf(stderr, "ct_results returned unexpected result type %d\n", res_type); return 1; } } if (ret != CS_END_RESULTS) { fprintf(stderr, "ct_results returned unexpected result %d.\n", (int) ret); exit(1); } if (!rows_found) { fprintf(stderr, "expected 1 rows inserted, inserted %d.\n", (int) rowsAffected); exit(1); } /* test row inserted */ ret = run_command(cmd, "if not exists(select * from #ctparam_lang where name = 'joe blow' and name2 is not null and age = 2) select 1"); if (ret != CS_SUCCEED) { fprintf(stderr, "check row inserted failed\n"); exit(1); } return 0; } CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg) { printf("\nOpen Client Message:\n"); printf("Message number: LAYER = (%d) ORIGIN = (%d) ", CS_LAYER(errmsg->msgnumber), CS_ORIGIN(errmsg->msgnumber)); printf("SEVERITY = (%d) NUMBER = (%d)\n", CS_SEVERITY(errmsg->msgnumber), CS_NUMBER(errmsg->msgnumber)); printf("Message String: %s\n", errmsg->msgstring); if (errmsg->osstringlen > 0) { printf("Operating System Error: %s\n", errmsg->osstring); } fflush(stdout); return CS_SUCCEED; } CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg) { printf("\nServer message:\n"); printf("Message number: %d, Severity %d, ", srvmsg->msgnumber, srvmsg->severity); printf("State %d, Line %d\n", srvmsg->state, srvmsg->line); if (srvmsg->svrnlen > 0) { printf("Server '%s'\n", srvmsg->svrname); } if (srvmsg->proclen > 0) { printf(" Procedure '%s'\n", srvmsg->proc); } printf("Message String: %s\n", srvmsg->text); fflush(stdout); return CS_SUCCEED; } freetds-1.3.6/src/ctlib/unittests/long_binary.c000644 025423 025423 00000007044 14056414221 023204 0ustar00fredianofrediano000000 000000 /* Test we can insert long binary into database. */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" static const CS_INT unused = CS_UNUSED, nullterm = CS_NULLTERM; static CS_INT result_len = -1; static CS_RETCODE csmsg_callback(CS_CONTEXT *ctx, CS_CLIENTMSG * emsgp) { printf("message from csmsg_callback(): %s\n", emsgp->msgstring); return CS_SUCCEED; } static void check_ret(const char *name, CS_RETCODE ret) { if (ret != CS_SUCCEED) { fprintf(stderr, "%s(): failed\n", name); exit(1); } } static int fetch_results(CS_COMMAND * command) { CS_INT result_type, int_result, copied, rows_read; CS_SMALLINT ind = 0; CS_DATAFMT datafmt; int result = 0; memset(&datafmt, 0, sizeof(datafmt)); datafmt.datatype = CS_INT_TYPE; datafmt.count = 1; check_ret("ct_results", ct_results(command, &result_type)); do { if (result_type == CS_ROW_RESULT) { check_ret("ct_bind", ct_bind(command, 1, &datafmt, &int_result, &copied, &ind)); check_ret("ct_fetch", ct_fetch(command, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows_read)); printf("received %d bytes\n", (int) int_result); result_len = int_result; } if (result_type == CS_CMD_FAIL) { result = 1; } } while (ct_results(command, &result_type) == CS_SUCCEED); return result; } static int execute_sql(CS_COMMAND * command, const char *sql) { printf("executing sql: %s\n", sql); check_ret("ct_command", ct_command(command, CS_LANG_CMD, sql, nullterm, unused)); check_ret("ct_send", ct_send(command)); return fetch_results(command); } int main(int argc, char **argv) { int verbose = 0; CS_COMMAND *command; CS_CONNECTION *connection; CS_CONTEXT *context; unsigned char buffer[65536]; CS_INT buffer_len = 8192; CS_SMALLINT ind = 0; CS_DATAFMT datafmt; CS_INT ret; int i; printf("-- begin --\n"); check_ret("try_ctlogin", try_ctlogin(&context, &connection, &command, verbose)); check_ret("cs_config", cs_config(context, CS_SET, CS_MESSAGE_CB, (CS_VOID *) csmsg_callback, unused, 0)); execute_sql(command, "if object_id('mps_table') is not null drop table mps_table"); execute_sql(command, "if object_id('mps_rpc') is not null drop procedure mps_rpc"); /* if this query fails probably we are using wrong database vendor or version */ ret = execute_sql(command, "create procedure mps_rpc (@varbinary_param varbinary(max)) as " "insert mps_table values (@varbinary_param) " "select len(varbinary_data) from mps_table"); if (ret != 0) { try_ctlogout(context, connection, command, verbose); return 0; } execute_sql(command, "create table mps_table (varbinary_data varbinary(max))"); if (argc > 1) buffer_len = atoi(argv[1]); if (buffer_len < 0 || buffer_len > sizeof(buffer)) return 1; printf("sending %d bytes\n", buffer_len); for (i = 0; i < buffer_len; i++) buffer[i] = (rand() % 16); memset(&datafmt, 0, sizeof(datafmt)); strcpy(datafmt.name, "@varbinary_param"); datafmt.namelen = nullterm; datafmt.datatype = CS_IMAGE_TYPE; datafmt.status = CS_INPUTVALUE; check_ret("ct_command", ct_command(command, CS_RPC_CMD, "mps_rpc", nullterm, unused)); check_ret("ct_setparam", ct_setparam(command, &datafmt, buffer, &buffer_len, &ind)); check_ret("ct_send", ct_send(command)); fetch_results(command); execute_sql(command, "drop table mps_table"); execute_sql(command, "drop procedure mps_rpc"); try_ctlogout(context, connection, command, verbose); printf("-- end --\n"); return (result_len == buffer_len) ? 0 : 1; } freetds-1.3.6/src/ctlib/unittests/row_count.c000644 025423 025423 00000023643 14056414271 022730 0ustar00fredianofrediano000000 000000 /* * Tests rows count * * These are the results using Sybase CT-Library. This test check that ct_results returns the same results. * * * "insert into #tmp1 values(1) " * "insert into #tmp1 values(2) " * "insert into #tmp1 values(3) " * "select * from #tmp1 " * * Open Client Message: * number 16843050 layer 1 origin 1 severity 1 number 42 * msgstring: ct_res_info(ROWCOUNT): user api layer: external error: This routine cannot be called after ct_results() returns a result type of CS_ROW_RESULT. * osstring: (null) * ct_results returned CS_ROW_RESULT type and -1 rows * All done processing rows. * ct_results returned CS_CMD_DONE type and 3 rows * * Open Client Message: * number 16843051 layer 1 origin 1 severity 1 number 43 * msgstring: ct_res_info(ROWCOUNT): user api layer: external error: This routine cannot be called after ct_results() returns a result type of CS_STATUS_RESULT. * osstring: (null) * ct_results returned CS_STATUS_RESULT type and -1 rows * All done processing rows. * ct_results returned CS_CMD_SUCCEED type and -1 rows * ct_results returned CS_CMD_DONE type and -1 rows * * * "insert into #tmp1 values(1) " * "insert into #tmp1 values(2) " * "insert into #tmp1 values(3) " * "select * from #tmp1 " * "insert into #tmp1 values(4) " * "delete from #tmp1 where i <= 2 " * * Open Client Message: * number 16843050 layer 1 origin 1 severity 1 number 42 * msgstring: ct_res_info(ROWCOUNT): user api layer: external error: This routine cannot be called after ct_results() returns a result type of CS_ROW_RESULT. * osstring: (null) * ct_results returned CS_ROW_RESULT type and -1 rows * All done processing rows. * ct_results returned CS_CMD_DONE type and 3 rows * * Open Client Message: * number 16843051 layer 1 origin 1 severity 1 number 43 * msgstring: ct_res_info(ROWCOUNT): user api layer: external error: This routine cannot be called after ct_results() returns a result type of CS_STATUS_RESULT. * osstring: (null) * ct_results returned CS_STATUS_RESULT type and -1 rows * All done processing rows. * ct_results returned CS_CMD_SUCCEED type and 2 rows * ct_results returned CS_CMD_DONE type and 2 rows */ #undef NDEBUG #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" #include static CS_CONTEXT *ctx; static CS_CONNECTION *conn; static CS_COMMAND *cmd; static CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg); static CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * errmsg); static CS_INT ex_display_results(CS_COMMAND * cmd, char *results); static int test(int final_rows, int no_rows); int main(int argc, char *argv[]) { CS_RETCODE ret; printf("%s: check row count returned\n", __FILE__); ret = try_ctlogin(&ctx, &conn, &cmd, 0); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *) ex_clientmsg_cb); ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) ex_servermsg_cb); /* do not test error */ run_command(cmd, "DROP PROCEDURE sample_rpc"); run_command(cmd, "drop table #tmp1"); /* test with rows from select */ if (test(0, 0) || test(1, 0)) return 1; /* test with empty select */ if (test(0, 1) || test(1, 1)) return 1; ret = try_ctlogout(ctx, conn, cmd, 0); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } static int test(int final_rows, int no_rows) { CS_RETCODE ret; CS_CHAR cmdbuf[4096]; char results[1024]; run_command(cmd, "create table #tmp1 (i int not null)"); strlcpy(cmdbuf, "create proc sample_rpc as ", sizeof(cmdbuf)); strlcpy(results, "CS_ROW_RESULT -1\n", sizeof(results)); strlcat(cmdbuf, "insert into #tmp1 values(1) " "insert into #tmp1 values(2) " "insert into #tmp1 values(3) ", sizeof(cmdbuf) ); if (no_rows) { strlcat(cmdbuf, "select * from #tmp1 where i > 10 ", sizeof(cmdbuf)); strlcat(results, "CS_CMD_DONE 0\n", sizeof(results)); } else { strlcat(cmdbuf, "select * from #tmp1 ", sizeof(cmdbuf)); strlcat(results, "CS_CMD_DONE 3\n", sizeof(results)); } strlcat(results, "CS_STATUS_RESULT -1\n", sizeof(results)); if (final_rows) { strlcat(cmdbuf, "insert into #tmp1 values(4) " "delete from #tmp1 where i <= 2 ", sizeof(cmdbuf) ); strlcat(results, "CS_CMD_SUCCEED 2\n" "CS_CMD_DONE 2\n", sizeof(results)); } else { strlcat(results, "CS_CMD_SUCCEED -1\n" "CS_CMD_DONE -1\n", sizeof(results)); } printf("testing query:\n----\n%s\n----\n", cmdbuf); ret = run_command(cmd, cmdbuf); if (ret != CS_SUCCEED) { fprintf(stderr, "create proc failed\n"); return 1; } printf("----------\n"); if ((ret = ct_command(cmd, CS_RPC_CMD, "sample_rpc", CS_NULLTERM, CS_NO_RECOMPILE)) != CS_SUCCEED) { fprintf(stderr, "ct_command(CS_RPC_CMD) failed"); return 1; } if (ct_send(cmd) != CS_SUCCEED) { fprintf(stderr, "ct_send(RPC) failed"); return 1; } ex_display_results(cmd, results); /* cleanup */ run_command(cmd, "DROP PROCEDURE sample_rpc"); run_command(cmd, "drop table #tmp1"); return 0; } static CS_INT ex_display_results(CS_COMMAND * cmd, char *results) { CS_RETCODE ret; CS_INT res_type; CS_INT num_cols; CS_INT row_count = 0; CS_INT rows_read; CS_SMALLINT msg_id; /* * Process the results of the RPC. */ while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { char res[32]; int rows, pos; CS_INT rowsAffected = -1; ct_res_info(cmd, CS_ROW_COUNT, &rowsAffected, CS_UNUSED, NULL); printf("ct_results returned %s type and %d rows\n", res_type_str(res_type), (int) rowsAffected); /* check expected results are the same as got ones */ pos = -1; assert(sscanf(results, "%30s %d %n", res, &rows, &pos) >= 2 && pos > 0); results += pos; if (strcmp(res_type_str(res_type), res) != 0 || rowsAffected != rows) { fprintf(stderr, "Expected ct_results %s rows %d\n", res, rows); exit(1); } switch (res_type) { case CS_ROW_RESULT: case CS_PARAM_RESULT: case CS_STATUS_RESULT: /* * All three of these result types are fetchable. * Since the result model for rpcs and rows have * been unified in the New Client-Library, we * will use the same routine to display them */ /* * Find out how many columns there are in this result set. */ ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info(CS_NUMDATA) failed"); return 1; } /* * Make sure we have at least one column */ if (num_cols <= 0) { fprintf(stderr, "ct_res_info(CS_NUMDATA) returned zero columns"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows_read)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { /* * Increment our row count by the number of rows just fetched. */ row_count = row_count + rows_read; /* * Check if we hit a recoverable error. */ if (ret == CS_ROW_FAIL) { printf("Error on row %d.\n", row_count); fflush(stdout); } } /* * We're done processing rows. Let's check the final return * value of ct_fetch(). */ switch ((int) ret) { case CS_END_DATA: /* * Everything went fine. */ printf("All done processing rows.\n"); fflush(stdout); break; case CS_FAIL: /* * Something terrible happened. */ fprintf(stderr, "ct_fetch returned CS_FAIL\n"); return 1; break; default: /* * We got an unexpected return value. */ fprintf(stderr, "ct_fetch returned %d\n", ret); return 1; break; } break; case CS_MSG_RESULT: ret = ct_res_info(cmd, CS_MSGTYPE, (CS_VOID *) & msg_id, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info(msg_id) failed"); return 1; } printf("ct_result returned CS_MSG_RESULT where msg id = %d.\n", msg_id); fflush(stdout); break; case CS_CMD_SUCCEED: case CS_CMD_DONE: case CS_CMD_FAIL: break; default: /* * We got something unexpected. */ fprintf(stderr, "ct_results returned unexpected result type."); return CS_FAIL; } } /* * We're done processing results. Let's check the * return value of ct_results() to see if everything * went ok. */ switch ((int) ret) { case CS_END_RESULTS: /* * Everything went fine. */ break; case CS_FAIL: /* * Something failed happened. */ fprintf(stderr, "ct_results failed."); break; default: /* * We got an unexpected return value. */ fprintf(stderr, "ct_results returned unexpected result type."); break; } return CS_SUCCEED; } static CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg) { printf("\nOpen Client Message:\n"); printf("Message number: LAYER = (%ld) ORIGIN = (%ld) ", (long) CS_LAYER(errmsg->msgnumber), (long) CS_ORIGIN(errmsg->msgnumber)); printf("SEVERITY = (%ld) NUMBER = (%ld)\n", (long) CS_SEVERITY(errmsg->msgnumber), (long) CS_NUMBER(errmsg->msgnumber)); printf("Message String: %s\n", errmsg->msgstring); if (errmsg->osstringlen > 0) { printf("Operating System Error: %s\n", errmsg->osstring); } fflush(stdout); return CS_SUCCEED; } static CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg) { printf("\nServer message:\n"); printf("Message number: %ld, Severity %ld, ", (long) srvmsg->msgnumber, (long) srvmsg->severity); printf("State %ld, Line %ld\n", (long) srvmsg->state, (long) srvmsg->line); if (srvmsg->svrnlen > 0) { printf("Server '%s'\n", srvmsg->svrname); } if (srvmsg->proclen > 0) { printf(" Procedure '%s'\n", srvmsg->proc); } printf("Message String: %s\n", srvmsg->text); fflush(stdout); return CS_SUCCEED; } freetds-1.3.6/src/ctlib/unittests/rpc_ct_param.c000644 025423 025423 00000040733 14056414221 023335 0ustar00fredianofrediano000000 000000 #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STRING_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" #define MAX(X,Y) (((X) > (Y)) ? (X) : (Y)) #define MIN(X,Y) (((X) < (Y)) ? (X) : (Y)) CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg); CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * errmsg); static CS_INT ex_display_dlen(CS_DATAFMT * column); static CS_RETCODE ex_display_header(CS_INT numcols, CS_DATAFMT columns[]); typedef struct _ex_column_data { CS_SMALLINT indicator; CS_CHAR *value; CS_INT valuelen; } EX_COLUMN_DATA; /* Testing: array binding of result set */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_INT res_type; CS_INT num_cols; CS_CHAR cmdbuf[4096]; CS_DATAFMT datafmt; CS_DATAFMT srcfmt; CS_DATAFMT destfmt; CS_INT intvar; CS_SMALLINT smallintvar; CS_FLOAT floatvar; CS_MONEY moneyvar; CS_BINARY binaryvar; CS_BIT bitvar = 1; char moneystring[10]; char rpc_name[15]; CS_INT destlen; CS_INT i; CS_INT j; CS_INT row_count = 0; CS_INT rows_read; CS_INT disp_len; EX_COLUMN_DATA *coldata; CS_DATAFMT *outdatafmt; CS_SMALLINT msg_id; printf("%s: submit a stored procedure using ct_param \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *) ex_clientmsg_cb); ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) ex_servermsg_cb); /* do not test error */ ret = run_command(cmd, "IF OBJECT_ID('sample_rpc') IS NOT NULL DROP PROCEDURE sample_rpc"); strcpy(cmdbuf, "create proc sample_rpc (@intparam int, \ @sintparam smallint output, @floatparam float output, \ @moneyparam money output, \ @dateparam datetime output, @charparam char(20) output, @empty varchar(20) output, \ @binaryparam binary(20) output, @bitparam bit) \ as "); strcat(cmdbuf, "select @intparam, @sintparam, @floatparam, @moneyparam, \ @dateparam, @charparam, @binaryparam \ select @sintparam = @sintparam + @intparam \ select @floatparam = @floatparam + @intparam \ select @moneyparam = @moneyparam + convert(money, @intparam) \ select @dateparam = getdate() \ select @charparam = \'The char parameters\' \ select @empty = \'\' \ select @binaryparam = @binaryparam \ print \'This is the message printed out by sample_rpc.\'"); ret = run_command(cmd, cmdbuf); if (ret != CS_SUCCEED) { fprintf(stderr, "create proc failed\n"); return 1; } /* * Assign values to the variables used for parameter passing. */ intvar = 2; smallintvar = 234; floatvar = 0.12; binaryvar = (CS_BINARY) 0xff; strcpy(rpc_name, "sample_rpc"); strcpy(moneystring, "300.90"); /* * Clear and setup the CS_DATAFMT structures used to convert datatypes. */ memset(&srcfmt, 0, sizeof(CS_DATAFMT)); srcfmt.datatype = CS_CHAR_TYPE; srcfmt.maxlength = strlen(moneystring); srcfmt.precision = 5; srcfmt.scale = 2; srcfmt.locale = NULL; memset(&destfmt, 0, sizeof(CS_DATAFMT)); destfmt.datatype = CS_MONEY_TYPE; destfmt.maxlength = sizeof(CS_MONEY); destfmt.precision = 5; destfmt.scale = 2; destfmt.locale = NULL; /* * Convert the string representing the money value * to a CS_MONEY variable. Since this routine does not have the * context handle, we use the property functions to get it. */ if ((ret = ct_cmd_props(cmd, CS_GET, CS_PARENT_HANDLE, &conn, CS_UNUSED, NULL)) != CS_SUCCEED) { fprintf(stderr, "ct_cmd_props() failed"); return 1; } if ((ret = ct_con_props(conn, CS_GET, CS_PARENT_HANDLE, &ctx, CS_UNUSED, NULL)) != CS_SUCCEED) { fprintf(stderr, "ct_con_props() failed"); return 1; } ret = cs_convert(ctx, &srcfmt, (CS_VOID *) moneystring, &destfmt, &moneyvar, &destlen); if (ret != CS_SUCCEED) { fprintf(stderr, "cs_convert() failed"); return 1; } /* * Send the RPC command for our stored procedure. */ if ((ret = ct_command(cmd, CS_RPC_CMD, rpc_name, CS_NULLTERM, CS_NO_RECOMPILE)) != CS_SUCCEED) { fprintf(stderr, "ct_command(CS_RPC_CMD) failed"); return 1; } /* * Clear and setup the CS_DATAFMT structure, then pass * each of the parameters for the RPC. */ memset(&datafmt, 0, sizeof(datafmt)); strcpy(datafmt.name, "@intparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_INT_TYPE; datafmt.maxlength = CS_UNUSED; datafmt.status = CS_INPUTVALUE; datafmt.locale = NULL; if ((ret = ct_param(cmd, &datafmt, (CS_VOID *) & intvar, CS_SIZEOF(CS_INT), 0)) != CS_SUCCEED) { fprintf(stderr, "ct_param(int) failed"); return 1; } strcpy(datafmt.name, "@sintparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_SMALLINT_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; if ((ret = ct_param(cmd, &datafmt, (CS_VOID *) & smallintvar, CS_SIZEOF(CS_SMALLINT), 0)) != CS_SUCCEED) { fprintf(stderr, "ct_param(smallint) failed"); return 1; } strcpy(datafmt.name, "@floatparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_FLOAT_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; if ((ret = ct_param(cmd, &datafmt, (CS_VOID *) & floatvar, CS_SIZEOF(CS_FLOAT), 0)) != CS_SUCCEED) { fprintf(stderr, "ct_param(float) failed"); return 1; } strcpy(datafmt.name, "@moneyparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_MONEY_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; if ((ret = ct_param(cmd, &datafmt, (CS_VOID *) & moneyvar, CS_SIZEOF(CS_MONEY), 0)) != CS_SUCCEED) { fprintf(stderr, "ct_param(money) failed"); return 1; } strcpy(datafmt.name, "@dateparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_DATETIME4_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; /* * The datetime variable is filled in by the RPC so pass NULL for * the data, 0 for data length, and -1 for the indicator arguments. */ if ((ret = ct_param(cmd, &datafmt, NULL, 0, -1)) != CS_SUCCEED) { fprintf(stderr, "ct_param(datetime4) failed"); return 1; } strcpy(datafmt.name, "@charparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_CHAR_TYPE; datafmt.maxlength = 60; datafmt.status = CS_RETURN; datafmt.locale = NULL; /* * The character string variable is filled in by the RPC so pass NULL * for the data 0 for data length, and -1 for the indicator arguments. */ if ((ret = ct_param(cmd, &datafmt, NULL, 0, -1)) != CS_SUCCEED) { fprintf(stderr, "ct_param(char) failed"); return 1; } strcpy(datafmt.name, "@empty"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_VARCHAR_TYPE; datafmt.maxlength = 60; datafmt.status = CS_RETURN; datafmt.locale = NULL; /* * The character string variable is filled in by the RPC so pass NULL * for the data 0 for data length, and -1 for the indicator arguments. */ if ((ret = ct_param(cmd, &datafmt, NULL, 0, -1)) != CS_SUCCEED) { fprintf(stderr, "ct_param(char) failed"); return 1; } strcpy(datafmt.name, "@binaryparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_BINARY_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; if ((ret = ct_param(cmd, &datafmt, (CS_VOID *) & binaryvar, CS_SIZEOF(CS_BINARY), 0)) != CS_SUCCEED) { fprintf(stderr, "ct_param(binary) failed"); return 1; } strcpy(datafmt.name, "@bitparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_BIT_TYPE; datafmt.maxlength = 1; datafmt.status = 0; datafmt.locale = NULL; if ((ret = ct_param(cmd, &datafmt, (CS_VOID *) & bitvar, CS_SIZEOF(CS_BIT), 0)) != CS_SUCCEED) { fprintf(stderr, "ct_param(binary) failed"); return 1; } /* * Send the command to the server */ if (ct_send(cmd) != CS_SUCCEED) { fprintf(stderr, "ct_send(RPC) failed"); return 1; } /* * Process the results of the RPC. */ while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_ROW_RESULT: case CS_PARAM_RESULT: case CS_STATUS_RESULT: /* * Print the result header based on the result type. */ switch ((int) res_type) { case CS_ROW_RESULT: printf("\nROW RESULTS\n"); break; case CS_PARAM_RESULT: printf("\nPARAMETER RESULTS\n"); break; case CS_STATUS_RESULT: printf("\nSTATUS RESULTS\n"); break; } fflush(stdout); /* * All three of these result types are fetchable. * Since the result model for rpcs and rows have * been unified in the New Client-Library, we * will use the same routine to display them */ /* * Find out how many columns there are in this result set. */ ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info(CS_NUMDATA) failed"); return 1; } /* * Make sure we have at least one column */ if (num_cols <= 0) { fprintf(stderr, "ct_res_info(CS_NUMDATA) returned zero columns"); return 1; } /* * Our program variable, called 'coldata', is an array of * EX_COLUMN_DATA structures. Each array element represents * one column. Each array element will re-used for each row. * * First, allocate memory for the data element to process. */ coldata = (EX_COLUMN_DATA *) malloc(num_cols * sizeof(EX_COLUMN_DATA)); if (coldata == NULL) { fprintf(stderr, "malloc coldata failed \n"); return 1; } outdatafmt = (CS_DATAFMT *) malloc(num_cols * sizeof(CS_DATAFMT)); if (outdatafmt == NULL) { fprintf(stderr, "malloc outdatafmt failed \n"); return 1; } for (i = 0; i < num_cols; i++) { ret = ct_describe(cmd, (i + 1), &outdatafmt[i]); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe failed \n"); return 1; } outdatafmt[i].maxlength = ex_display_dlen(&outdatafmt[i]) + 1; outdatafmt[i].datatype = CS_CHAR_TYPE; outdatafmt[i].format = CS_FMT_NULLTERM; coldata[i].value = (CS_CHAR *) malloc(outdatafmt[i].maxlength); if (coldata[i].value == NULL) { fprintf(stderr, "malloc coldata.value failed \n"); return 1; } coldata[i].value[0] = 0; ret = ct_bind(cmd, (i + 1), &outdatafmt[i], coldata[i].value, &coldata[i].valuelen, & coldata[i].indicator); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind failed \n"); return 1; } } if (ret != CS_SUCCEED) { for (j = 0; j < i; j++) { free(coldata[j].value); } free(coldata); free(outdatafmt); return 1; } ex_display_header(num_cols, outdatafmt); while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows_read)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { /* * Increment our row count by the number of rows just fetched. */ row_count = row_count + rows_read; /* * Check if we hit a recoverable error. */ if (ret == CS_ROW_FAIL) { printf("Error on row %d.\n", row_count); fflush(stdout); } /* * We have a row. Loop through the columns displaying the * column values. */ for (i = 0; i < num_cols; i++) { /* * Display the column value */ printf("%s", coldata[i].value); fflush(stdout); /* * If not last column, Print out spaces between this * column and next one. */ if (i != num_cols - 1) { disp_len = ex_display_dlen(&outdatafmt[i]); disp_len -= coldata[i].valuelen - 1; for (j = 0; j < disp_len; j++) { fputc(' ', stdout); } } } printf("\n"); fflush(stdout); } /* * Free allocated space. */ for (i = 0; i < num_cols; i++) { free(coldata[i].value); } free(coldata); free(outdatafmt); /* * We're done processing rows. Let's check the final return * value of ct_fetch(). */ switch ((int) ret) { case CS_END_DATA: /* * Everything went fine. */ printf("All done processing rows.\n"); fflush(stdout); break; case CS_FAIL: /* * Something terrible happened. */ fprintf(stderr, "ct_fetch returned CS_FAIL\n"); return 1; break; default: /* * We got an unexpected return value. */ fprintf(stderr, "ct_fetch returned %d\n", ret); return 1; break; } break; case CS_MSG_RESULT: ret = ct_res_info(cmd, CS_MSGTYPE, (CS_VOID *) & msg_id, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info(msg_id) failed"); return 1; } printf("ct_result returned CS_MSG_RESULT where msg id = %d.\n", msg_id); fflush(stdout); break; case CS_CMD_SUCCEED: /* * This means no rows were returned. */ break; case CS_CMD_DONE: /* * Done with result set. */ break; case CS_CMD_FAIL: /* * The server encountered an error while * processing our command. */ fprintf(stderr, "ct_results returned CS_CMD_FAIL."); break; default: /* * We got something unexpected. */ fprintf(stderr, "ct_results returned unexpected result type."); return CS_FAIL; } } /* * We're done processing results. Let's check the * return value of ct_results() to see if everything * went ok. */ switch ((int) ret) { case CS_END_RESULTS: /* * Everything went fine. */ break; case CS_FAIL: /* * Something failed happened. */ fprintf(stderr, "ct_results failed."); break; default: /* * We got an unexpected return value. */ fprintf(stderr, "ct_results returned unexpected result type."); break; } run_command(cmd, "DROP PROCEDURE sample_rpc"); if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } static CS_INT ex_display_dlen(CS_DATAFMT * column) { CS_INT len; switch ((int) column->datatype) { case CS_CHAR_TYPE: case CS_VARCHAR_TYPE: case CS_TEXT_TYPE: case CS_IMAGE_TYPE: len = MIN(column->maxlength, 1024); break; case CS_BINARY_TYPE: case CS_VARBINARY_TYPE: len = MIN((2 * column->maxlength) + 2, 1024); break; case CS_BIT_TYPE: case CS_TINYINT_TYPE: len = 3; break; case CS_SMALLINT_TYPE: len = 6; break; case CS_INT_TYPE: len = 11; break; case CS_REAL_TYPE: case CS_FLOAT_TYPE: len = 20; break; case CS_MONEY_TYPE: case CS_MONEY4_TYPE: len = 24; break; case CS_DATETIME_TYPE: case CS_DATETIME4_TYPE: len = 30; break; case CS_NUMERIC_TYPE: case CS_DECIMAL_TYPE: len = (CS_MAX_PREC + 2); break; default: len = 12; break; } return MAX((CS_INT) (strlen(column->name) + 1), len); } static CS_RETCODE ex_display_header(CS_INT numcols, CS_DATAFMT columns[]) { CS_INT i; CS_INT l; CS_INT j; CS_INT disp_len; fputc('\n', stdout); for (i = 0; i < numcols; i++) { disp_len = ex_display_dlen(&columns[i]); printf("%s", columns[i].name); fflush(stdout); l = disp_len - strlen(columns[i].name); for (j = 0; j < l; j++) { fputc(' ', stdout); fflush(stdout); } } fputc('\n', stdout); fflush(stdout); for (i = 0; i < numcols; i++) { disp_len = ex_display_dlen(&columns[i]); l = disp_len - 1; for (j = 0; j < l; j++) { fputc('-', stdout); } fputc(' ', stdout); } fputc('\n', stdout); return CS_SUCCEED; } CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg) { printf("\nOpen Client Message:\n"); printf("Message number: LAYER = (%ld) ORIGIN = (%ld) ", (long)CS_LAYER(errmsg->msgnumber), (long)CS_ORIGIN(errmsg->msgnumber)); printf("SEVERITY = (%ld) NUMBER = (%ld)\n", (long)CS_SEVERITY(errmsg->msgnumber), (long)CS_NUMBER(errmsg->msgnumber)); printf("Message String: %s\n", errmsg->msgstring); if (errmsg->osstringlen > 0) { printf("Operating System Error: %s\n", errmsg->osstring); } fflush(stdout); return CS_SUCCEED; } CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg) { printf("\nServer message:\n"); printf("Message number: %ld, Severity %ld, ", (long) srvmsg->msgnumber, (long) srvmsg->severity); printf("State %ld, Line %ld\n", (long) srvmsg->state, (long) srvmsg->line); if (srvmsg->svrnlen > 0) { printf("Server '%s'\n", srvmsg->svrname); } if (srvmsg->proclen > 0) { printf(" Procedure '%s'\n", srvmsg->proc); } printf("Message String: %s\n", srvmsg->text); fflush(stdout); return CS_SUCCEED; } freetds-1.3.6/src/ctlib/unittests/rpc_ct_setparam.c000644 025423 025423 00000040776 14056414221 024060 0ustar00fredianofrediano000000 000000 #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" #define MAX(X,Y) (((X) > (Y)) ? (X) : (Y)) #define MIN(X,Y) (((X) < (Y)) ? (X) : (Y)) CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg); CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * errmsg); static CS_RETCODE ex_display_header(CS_INT numcols, CS_DATAFMT columns[]); static CS_INT ex_display_dlen(CS_DATAFMT *column); static CS_INT ex_display_results(CS_COMMAND * cmd); typedef struct _ex_column_data { CS_SMALLINT indicator; CS_CHAR *value; CS_INT valuelen; } EX_COLUMN_DATA; /* Testing: array binding of result set */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_INT datalength; CS_SMALLINT nullind; CS_SMALLINT notnullind; CS_CHAR cmdbuf[4096]; CS_DATAFMT datafmt; CS_DATAFMT srcfmt; CS_DATAFMT destfmt; CS_INT intvar; CS_SMALLINT smallintvar; CS_FLOAT floatvar; CS_MONEY moneyvar; CS_BINARY binaryvar; char moneystring[10]; char rpc_name[15]; CS_INT destlen; printf("%s: submit a stored procedure using ct_setparam \n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *) ex_clientmsg_cb); ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) ex_servermsg_cb); /* do not test error */ ret = run_command(cmd, "IF OBJECT_ID('sample_rpc') IS NOT NULL DROP PROCEDURE sample_rpc"); strcpy(cmdbuf, "create proc sample_rpc (@intparam int, \ @sintparam smallint output, @floatparam float output, \ @moneyparam money output, \ @dateparam datetime output, @charparam char(20) output, \ @binaryparam varbinary(2000) output) \ as "); strcat(cmdbuf, "select @intparam, @sintparam, @floatparam, @moneyparam, \ @dateparam, @charparam, @binaryparam \ select @sintparam = @sintparam + @intparam \ select @floatparam = @floatparam + @intparam \ select @moneyparam = @moneyparam + convert(money, @intparam) \ select @dateparam = getdate() \ select @charparam = \'The char parameters\' \ select @binaryparam = @binaryparam \ print \'This is the message printed out by sample_rpc.\'"); ret = run_command(cmd, cmdbuf); if (ret != CS_SUCCEED) { fprintf(stderr, "create proc failed\n"); return 1; } /* * Assign values to the variables used for parameter passing. */ intvar = 2; smallintvar = 234; floatvar = 0.12; binaryvar = (CS_BINARY) 0xff; strcpy(rpc_name, "sample_rpc"); strcpy(moneystring, "300.90"); /* * Clear and setup the CS_DATAFMT structures used to convert datatypes. */ memset(&srcfmt, 0, sizeof(CS_DATAFMT)); srcfmt.datatype = CS_CHAR_TYPE; srcfmt.maxlength = strlen(moneystring); srcfmt.precision = 5; srcfmt.scale = 2; srcfmt.locale = NULL; memset(&destfmt, 0, sizeof(CS_DATAFMT)); destfmt.datatype = CS_MONEY_TYPE; destfmt.maxlength = sizeof(CS_MONEY); destfmt.precision = 5; destfmt.scale = 2; destfmt.locale = NULL; /* * Convert the string representing the money value * to a CS_MONEY variable. Since this routine does not have the * context handle, we use the property functions to get it. */ if ((ret = ct_cmd_props(cmd, CS_GET, CS_PARENT_HANDLE, &conn, CS_UNUSED, NULL)) != CS_SUCCEED) { fprintf(stderr, "ct_cmd_props() failed"); return 1; } if ((ret = ct_con_props(conn, CS_GET, CS_PARENT_HANDLE, &ctx, CS_UNUSED, NULL)) != CS_SUCCEED) { fprintf(stderr, "ct_con_props() failed"); return 1; } ret = cs_convert(ctx, &srcfmt, (CS_VOID *) moneystring, &destfmt, &moneyvar, &destlen); if (ret != CS_SUCCEED) { fprintf(stderr, "cs_convert() failed"); return 1; } /* * Send the RPC command for our stored procedure. */ if ((ret = ct_command(cmd, CS_RPC_CMD, rpc_name, CS_NULLTERM, CS_NO_RECOMPILE)) != CS_SUCCEED) { fprintf(stderr, "ct_command(CS_RPC_CMD) failed"); return 1; } nullind = -1; notnullind = 0; /* * Clear and setup the CS_DATAFMT structure, then pass * each of the parameters for the RPC. */ memset(&datafmt, 0, sizeof(datafmt)); strcpy(datafmt.name, "@intparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_INT_TYPE; datafmt.maxlength = CS_UNUSED; datafmt.status = CS_INPUTVALUE; datafmt.locale = NULL; datalength = CS_SIZEOF(CS_INT); if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & intvar, &datalength, ¬nullind)) != CS_SUCCEED) { fprintf(stderr, "ct_setparam(int) failed"); return 1; } strcpy(datafmt.name, "@sintparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_SMALLINT_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; datalength = CS_SIZEOF(CS_SMALLINT); if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & smallintvar, &datalength, ¬nullind)) != CS_SUCCEED) { fprintf(stderr, "ct_setparam(smallint) failed"); return 1; } strcpy(datafmt.name, "@floatparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_FLOAT_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; datalength = CS_SIZEOF(CS_FLOAT); if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & floatvar, &datalength, ¬nullind)) != CS_SUCCEED) { fprintf(stderr, "ct_setparam(float) failed"); return 1; } strcpy(datafmt.name, "@moneyparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_MONEY_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; datalength = CS_SIZEOF(CS_MONEY); if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & moneyvar, &datalength, ¬nullind)) != CS_SUCCEED) { fprintf(stderr, "ct_setparam(money) failed"); return 1; } strcpy(datafmt.name, "@dateparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_DATETIME4_TYPE; datafmt.maxlength = 255; datafmt.status = CS_RETURN; datafmt.locale = NULL; /* * The datetime variable is filled in by the RPC so pass NULL for * the data, 0 for data length, and -1 for the indicator arguments. */ datalength = 0; if ((ret = ct_setparam(cmd, &datafmt, NULL, &datalength, &nullind)) != CS_SUCCEED) { fprintf(stderr, "ct_setparam(datetime4) failed"); return 1; } strcpy(datafmt.name, "@charparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_CHAR_TYPE; datafmt.maxlength = 60; datafmt.status = CS_RETURN; datafmt.locale = NULL; datalength = 0; /* * The character string variable is filled in by the RPC so pass NULL * for the data 0 for data length, and -1 for the indicator arguments. */ if ((ret = ct_setparam(cmd, &datafmt, NULL, &datalength, &nullind)) != CS_SUCCEED) { fprintf(stderr, "ct_setparam(char) failed"); return 1; } strcpy(datafmt.name, "@binaryparam"); datafmt.namelen = CS_NULLTERM; datafmt.datatype = CS_LONGBINARY_TYPE; datafmt.maxlength = 2000; datafmt.status = CS_RETURN; datafmt.locale = NULL; datalength = CS_SIZEOF(CS_BINARY); nullind = -1; if ((ret = ct_setparam(cmd, &datafmt, (CS_VOID *) & binaryvar, &datalength, ¬nullind)) != CS_SUCCEED) { fprintf(stderr, "ct_setparam(binary) failed"); return 1; } /* * Send the command to the server */ if (ct_send(cmd) != CS_SUCCEED) { fprintf(stderr, "ct_send(RPC) failed"); return 1; } ret = ex_display_results(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ex_display_results failed\n"); return 1; } intvar = 3; if (ct_send(cmd) != CS_SUCCEED) { fprintf(stderr, "ct_send(RPC) failed"); return 1; } ret = ex_display_results(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ex_display_results failed\n"); return 1; } run_command(cmd, "DROP PROCEDURE sample_rpc"); if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } static CS_INT ex_display_results(CS_COMMAND * cmd) { CS_RETCODE ret; CS_INT res_type; CS_INT num_cols; EX_COLUMN_DATA *coldata; CS_DATAFMT *outdatafmt; CS_INT row_count = 0; CS_INT rows_read; CS_INT disp_len; CS_SMALLINT msg_id; int i, j; /* * Process the results of the RPC. */ while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { switch ((int) res_type) { case CS_ROW_RESULT: case CS_PARAM_RESULT: case CS_STATUS_RESULT: /* * Print the result header based on the result type. */ switch ((int) res_type) { case CS_ROW_RESULT: printf("\nROW RESULTS\n"); break; case CS_PARAM_RESULT: printf("\nPARAMETER RESULTS\n"); break; case CS_STATUS_RESULT: printf("\nSTATUS RESULTS\n"); break; } fflush(stdout); /* * All three of these result types are fetchable. * Since the result model for rpcs and rows have * been unified in the New Client-Library, we * will use the same routine to display them */ /* * Find out how many columns there are in this result set. */ ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info(CS_NUMDATA) failed"); return 1; } /* * Make sure we have at least one column */ if (num_cols <= 0) { fprintf(stderr, "ct_res_info(CS_NUMDATA) returned zero columns"); return 1; } /* * Our program variable, called 'coldata', is an array of * EX_COLUMN_DATA structures. Each array element represents * one column. Each array element will re-used for each row. * * First, allocate memory for the data element to process. */ coldata = (EX_COLUMN_DATA *) malloc(num_cols * sizeof(EX_COLUMN_DATA)); if (coldata == NULL) { fprintf(stderr, "malloc coldata failed \n"); return 1; } outdatafmt = (CS_DATAFMT *) malloc(num_cols * sizeof(CS_DATAFMT)); if (outdatafmt == NULL) { fprintf(stderr, "malloc outdatafmt failed \n"); return 1; } for (i = 0; i < num_cols; i++) { ret = ct_describe(cmd, (i + 1), &outdatafmt[i]); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe failed \n"); return 1; } outdatafmt[i].maxlength = ex_display_dlen(&outdatafmt[i]) + 1; outdatafmt[i].datatype = CS_CHAR_TYPE; outdatafmt[i].format = CS_FMT_NULLTERM; coldata[i].value = (CS_CHAR *) malloc(outdatafmt[i].maxlength); coldata[i].value[0] = 0; if (coldata[i].value == NULL) { fprintf(stderr, "malloc coldata.value failed \n"); return 1; } ret = ct_bind(cmd, (i + 1), &outdatafmt[i], coldata[i].value, &coldata[i].valuelen, & coldata[i].indicator); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind failed \n"); return 1; } } if (ret != CS_SUCCEED) { for (j = 0; j < i; j++) { free(coldata[j].value); } free(coldata); free(outdatafmt); return 1; } ex_display_header(num_cols, outdatafmt); while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows_read)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { /* * Increment our row count by the number of rows just fetched. */ row_count = row_count + rows_read; /* * Check if we hit a recoverable error. */ if (ret == CS_ROW_FAIL) { printf("Error on row %d.\n", row_count); fflush(stdout); } /* * We have a row. Loop through the columns displaying the * column values. */ for (i = 0; i < num_cols; i++) { /* * Display the column value */ printf("%s", coldata[i].value); fflush(stdout); /* * If not last column, Print out spaces between this * column and next one. */ if (i != num_cols - 1) { disp_len = ex_display_dlen(&outdatafmt[i]); disp_len -= coldata[i].valuelen - 1; for (j = 0; j < disp_len; j++) { fputc(' ', stdout); } } } printf("\n"); fflush(stdout); } /* * Free allocated space. */ for (i = 0; i < num_cols; i++) { free(coldata[i].value); } free(coldata); free(outdatafmt); /* * We're done processing rows. Let's check the final return * value of ct_fetch(). */ switch ((int) ret) { case CS_END_DATA: /* * Everything went fine. */ printf("All done processing rows.\n"); fflush(stdout); break; case CS_FAIL: /* * Something terrible happened. */ fprintf(stderr, "ct_fetch returned CS_FAIL\n"); return 1; break; default: /* * We got an unexpected return value. */ fprintf(stderr, "ct_fetch returned %d\n", ret); return 1; break; } break; case CS_MSG_RESULT: ret = ct_res_info(cmd, CS_MSGTYPE, (CS_VOID *) & msg_id, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info(msg_id) failed"); return 1; } printf("ct_result returned CS_MSG_RESULT where msg id = %d.\n", msg_id); fflush(stdout); break; case CS_CMD_SUCCEED: /* * This means no rows were returned. */ break; case CS_CMD_DONE: /* * Done with result set. */ break; case CS_CMD_FAIL: /* * The server encountered an error while * processing our command. */ fprintf(stderr, "ct_results returned CS_CMD_FAIL."); break; default: /* * We got something unexpected. */ fprintf(stderr, "ct_results returned unexpected result type."); return CS_FAIL; } } /* * We're done processing results. Let's check the * return value of ct_results() to see if everything * went ok. */ switch ((int) ret) { case CS_END_RESULTS: /* * Everything went fine. */ break; case CS_FAIL: /* * Something failed happened. */ fprintf(stderr, "ct_results failed."); break; default: /* * We got an unexpected return value. */ fprintf(stderr, "ct_results returned unexpected result type."); break; } return CS_SUCCEED; } static CS_INT ex_display_dlen(CS_DATAFMT *column) { CS_INT len; switch ((int) column->datatype) { case CS_CHAR_TYPE: case CS_VARCHAR_TYPE: case CS_TEXT_TYPE: case CS_IMAGE_TYPE: len = MIN(column->maxlength, 1024); break; case CS_BINARY_TYPE: case CS_VARBINARY_TYPE: len = MIN((2 * column->maxlength) + 2, 1024); break; case CS_BIT_TYPE: case CS_TINYINT_TYPE: len = 3; break; case CS_SMALLINT_TYPE: len = 6; break; case CS_INT_TYPE: len = 11; break; case CS_REAL_TYPE: case CS_FLOAT_TYPE: len = 20; break; case CS_MONEY_TYPE: case CS_MONEY4_TYPE: len = 24; break; case CS_DATETIME_TYPE: case CS_DATETIME4_TYPE: len = 30; break; case CS_NUMERIC_TYPE: case CS_DECIMAL_TYPE: len = (CS_MAX_PREC + 2); break; default: len = 12; break; } return MAX((CS_INT) (strlen(column->name) + 1), len); } static CS_RETCODE ex_display_header(CS_INT numcols, CS_DATAFMT columns[]) { CS_INT i; CS_INT l; CS_INT j; CS_INT disp_len; fputc('\n', stdout); for (i = 0; i < numcols; i++) { disp_len = ex_display_dlen(&columns[i]); printf("%s", columns[i].name); fflush(stdout); l = disp_len - strlen(columns[i].name); for (j = 0; j < l; j++) { fputc(' ', stdout); fflush(stdout); } } fputc('\n', stdout); fflush(stdout); for (i = 0; i < numcols; i++) { disp_len = ex_display_dlen(&columns[i]); l = disp_len - 1; for (j = 0; j < l; j++) { fputc('-', stdout); } fputc(' ', stdout); } fputc('\n', stdout); return CS_SUCCEED; } CS_RETCODE ex_clientmsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_CLIENTMSG * errmsg) { printf("\nOpen Client Message:\n"); printf("Message number: LAYER = (%ld) ORIGIN = (%ld) ", (long) CS_LAYER(errmsg->msgnumber), (long) CS_ORIGIN(errmsg->msgnumber)); printf("SEVERITY = (%ld) NUMBER = (%ld)\n", (long) CS_SEVERITY(errmsg->msgnumber), (long) CS_NUMBER(errmsg->msgnumber)); printf("Message String: %s\n", errmsg->msgstring); if (errmsg->osstringlen > 0) { printf("Operating System Error: %s\n", errmsg->osstring); } fflush(stdout); return CS_SUCCEED; } CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg) { printf("\nServer message:\n"); printf("Message number: %ld, Severity %ld, ", (long) srvmsg->msgnumber, (long) srvmsg->severity); printf("State %ld, Line %ld\n", (long) srvmsg->state, (long) srvmsg->line); if (srvmsg->svrnlen > 0) { printf("Server '%s'\n", srvmsg->svrname); } if (srvmsg->proclen > 0) { printf(" Procedure '%s'\n", srvmsg->proc); } printf("Message String: %s\n", srvmsg->text); fflush(stdout); return CS_SUCCEED; } freetds-1.3.6/src/ctlib/unittests/rpc_fail.c000644 025423 025423 00000005263 14056414221 022461 0ustar00fredianofrediano000000 000000 #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" static const char *printable_ret(CS_RETCODE ret) { #define CASE(x) case x: return #x; switch (ret) { CASE(CS_STATUS_RESULT) CASE(CS_ROW_RESULT) CASE(CS_PARAM_RESULT) CASE(CS_CMD_SUCCEED) CASE(CS_MSG_RESULT) CASE(CS_CMD_DONE) CASE(CS_CMD_FAIL) default: return "Unknown"; } } int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_INT res_type; CS_SMALLINT msg_id; int got_failure = 0; int got_done = 0; CS_INT rows_read; printf("%s: submit a not existing stored procedure\n", __FILE__); ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } if ((ret = ct_command(cmd, CS_RPC_CMD, "IDoNotExist", CS_NULLTERM, CS_NO_RECOMPILE)) != CS_SUCCEED) { fprintf(stderr, "ct_command(CS_RPC_CMD) failed"); return 1; } if (ct_send(cmd) != CS_SUCCEED) { fprintf(stderr, "ct_send(RPC) failed"); return 1; } while ((ret = ct_results(cmd, &res_type)) == CS_SUCCEED) { printf("ct_results returned %s\n", printable_ret(res_type)); switch ((int) res_type) { case CS_STATUS_RESULT: while (ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &rows_read) == CS_SUCCEED) continue; break; case CS_CMD_SUCCEED: fprintf(stderr, "a success was not expected from ct_results.\n"); return 1; case CS_ROW_RESULT: case CS_PARAM_RESULT: fprintf(stderr, "Only status results are expected\n"); return 1; case CS_MSG_RESULT: ret = ct_res_info(cmd, CS_MSGTYPE, (CS_VOID *) & msg_id, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info(msg_id) failed"); return 1; } printf("ct_result returned CS_MSG_RESULT where msg id = %d.\n", msg_id); break; case CS_CMD_DONE: got_done = 1; break; case CS_CMD_FAIL: got_failure = 1; break; default: fprintf(stderr, "ct_results returned unexpected result type.\n"); return 1; } } if (!got_failure) { fprintf(stderr, "a failure was expected from ct_results.\n"); return 1; } if (!got_done) { fprintf(stderr, "a done result was expected from ct_results.\n"); return 1; } switch ((int) ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results failed."); return 1; default: fprintf(stderr, "ct_results returned unexpected result type."); return 1; } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/t0001.c000644 025423 025423 00000001237 14056414221 021443 0ustar00fredianofrediano000000 000000 #include #include #include #include "common.h" int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_RETCODE ret; int verbose = 0; printf("%s: Testing login, logout\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 2; } if (verbose) { printf("Test succeeded\n"); } return 0; } freetds-1.3.6/src/ctlib/unittests/t0002.c000644 025423 025423 00000016251 14056414221 021446 0ustar00fredianofrediano000000 000000 #include #include #include #include #include "common.h" static int sp_who(CS_COMMAND *cmd); /* * ct_send SQL |select name = @@servername| * ct_bind variable * ct_fetch and print results */ int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_DATAFMT datafmt; CS_INT datalength; CS_SMALLINT ind; CS_INT count, row_count = 0; CS_INT result_type; CS_CHAR name[256]; printf("%s: Testing bind & select\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = ct_command(cmd, CS_LANG_CMD, "select name = @@servername", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 256; datafmt.count = 1; datafmt.locale = NULL; ret = ct_bind(cmd, 1, &datafmt, name, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else if (ret == CS_SUCCEED) { if (verbose) { printf("server name = %s\n", name); } } else { break; } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } /* * test parameter return code processing with sp_who */ sp_who(cmd); if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } int sp_who(CS_COMMAND *cmd) { enum {maxcol=10, colsize=260}; struct _col { CS_DATAFMT datafmt; CS_INT datalength; CS_SMALLINT ind; CS_CHAR data[colsize]; } col[maxcol]; CS_INT num_cols; CS_INT count, row_count = 0; CS_INT result_type; CS_RETCODE ret; CS_RETCODE results_ret; int i; int is_status_result=0; ret = ct_command(cmd, CS_LANG_CMD, "exec sp_who", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command: \"exec sp_who\" failed with %d\n", ret); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send: \"exec sp_who\" failed with %d\n", ret); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { is_status_result = 0; switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_STATUS_RESULT: printf("ct_results: CS_STATUS_RESULT detected for sp_who\n"); is_status_result = 1; /* fall through */ case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED || num_cols > maxcol) { fprintf(stderr, "ct_res_info() failed\n"); return 1; } if (num_cols <= 0) { fprintf(stderr, "ct_res_info() return strange values\n"); return 1; } if (is_status_result && num_cols != 1) { fprintf(stderr, "CS_STATUS_RESULT return more than 1 column\n"); return 1; } for (i=0; i < num_cols; i++) { /* here we can finally test for the return status column */ ret = ct_describe(cmd, i+1, &col[i].datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed for column %d\n", i); return 1; } if (col[i].datafmt.status & CS_RETURN) { printf("ct_describe() indicates a return code in column %d for sp_who\n", i); /* * other possible values: * CS_CANBENULL * CS_HIDDEN * CS_IDENTITY * CS_KEY * CS_VERSION_KEY * CS_TIMESTAMP * CS_UPDATABLE * CS_UPDATECOL */ } col[i].datafmt.datatype = CS_CHAR_TYPE; col[i].datafmt.format = CS_FMT_NULLTERM; col[i].datafmt.maxlength = colsize; col[i].datafmt.count = 1; col[i].datafmt.locale = NULL; ret = ct_bind(cmd, i+1, &col[i].datafmt, &col[i].data, &col[i].datalength, &col[i].ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } } row_count = 0; while ((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) { if( row_count == 0) { /* titles */ for (i=0; i < num_cols; i++) { char fmt[40]; if (col[i].datafmt.namelen == 0) { printf("unnamed%d ",i+1); continue; } sprintf(fmt, "%%-%d.%ds ", col[i].datafmt.namelen, col[i].datafmt.maxlength); printf(fmt, col[i].datafmt.name); } printf("\n"); } for (i=0; i < num_cols; i++) { /* data */ char fmt[40]; if (col[i].ind) continue; sprintf(fmt, "%%-%d.%ds ", col[i].datalength, col[i].datafmt.maxlength); printf(fmt, col[i].data); if (is_status_result && strcmp(col[i].data,"0")) { fprintf(stderr, "CS_STATUS_RESULT should return 0 as result\n"); return 1; } } printf("\n"); row_count += count; } if (is_status_result && row_count != 1) { fprintf(stderr, "CS_STATUS_RESULT should return a row\n"); return 1; } switch ((int) ret) { case CS_END_DATA: printf("ct_results fetched %d rows.\n", row_count); break; case CS_ROW_FAIL: fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/t0003.c000644 025423 025423 00000007740 14056414221 021452 0ustar00fredianofrediano000000 000000 #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include "common.h" /* Testing: Retrieve CS_TEXT_TYPE using ct_bind() */ int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int i, verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT datalength; CS_SMALLINT ind; CS_INT count, row_count = 0; CS_CHAR name[1024]; char large_sql[1024]; char len600[601]; char temp[11]; len600[0] = 0; name[0] = 0; for (i = 0; i < 60; i++) { sprintf(temp, "_abcde_%03d", (i + 1) * 10); strcat(len600, temp); } len600[600] = '\0'; printf("%s: Retrieve CS_TEXT_TYPE using ct_bind()\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = run_command(cmd, "CREATE TABLE #test_table (id int, name text)"); if (ret != CS_SUCCEED) return 1; /* ret = run_command(cmd, "INSERT #test_table (id, name) VALUES (1, 'name1')"); if (ret != CS_SUCCEED) return 1; */ sprintf(large_sql, "INSERT #test_table (id, name) VALUES (2, '%s')", len600); ret = run_command(cmd, large_sql); if (ret != CS_SUCCEED) return 1; ret = ct_command(cmd, CS_LANG_CMD, "SELECT name FROM #test_table", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "num_cols %d != 1", num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_NULLTERM; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } ret = ct_bind(cmd, 1, &datafmt, name, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ if (verbose) { printf("name = '%s'\n", name); } if (strcmp(name, len600)) { fprintf(stderr, "Bad return:\n'%s'\n! =\n'%s'\n", name, len600); return 1; } if (datalength != strlen(name) + 1) { fprintf(stderr, "Bad count:\n'%ld'\n! =\n'%d'\n", (long) strlen(name) + 1, count); return 1; } } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/t0004.c000644 025423 025423 00000007675 14056414221 021462 0ustar00fredianofrediano000000 000000 #include #include #include #include "common.h" /* protos */ int do_fetch(CS_COMMAND * cmd); CS_RETCODE do_results(CS_COMMAND * cmd, CS_INT * results); /* defines */ #define NUMROWS 5 /* Testing: Test order of ct_results() */ int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int i, verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; char query[1024]; CS_INT insert_results[] = { CS_CMD_SUCCEED, CS_CMD_DONE }; CS_INT update_results[] = { CS_CMD_SUCCEED, CS_CMD_DONE }; CS_INT select_results[] = { CS_ROW_RESULT, CS_CMD_DONE }; printf("%s: Check ordering of returns from cs_results()\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = run_command(cmd, "CREATE TABLE #t0004 (id int)"); if (ret != CS_SUCCEED) return 1; for (i = 0; i < NUMROWS; i++) { sprintf(query, "INSERT #t0004 (id) VALUES (%d)", i); ret = ct_command(cmd, CS_LANG_CMD, query, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } results_ret = do_results(cmd, insert_results); switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } } ret = ct_command(cmd, CS_LANG_CMD, "UPDATE #t0004 SET id = id + 1", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } results_ret = do_results(cmd, update_results); switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } /* single row select */ ret = ct_command(cmd, CS_LANG_CMD, "SELECT * FROM #t0004 WHERE id = 1", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } results_ret = do_results(cmd, select_results); switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } int do_fetch(CS_COMMAND * cmd) { CS_INT count, row_count = 0; CS_RETCODE ret; while ((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) { row_count += count; } if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else if (ret == CS_END_DATA) { return 0; } else { fprintf(stderr, "ct_fetch() unexpected return %d on row %d.\n", ret, row_count); return 1; } } CS_RETCODE do_results(CS_COMMAND * cmd, CS_INT * results) { int result_num; CS_RETCODE results_ret, result_type; result_num = 0; while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { printf("result_ret %d result_type %d\n", results_ret, result_type); if (result_type == CS_STATUS_RESULT) continue; if (result_type != results[result_num]) { fprintf(stderr, "ct_results() expected %d received %d\n", results[result_num], result_type); return CS_FAIL; } switch ((int) result_type) { case CS_ROW_RESULT: if (do_fetch(cmd)) { return CS_FAIL; } break; } result_num++; } return results_ret; } freetds-1.3.6/src/ctlib/unittests/t0005.c000644 025423 025423 00000001376 14056414221 021453 0ustar00fredianofrediano000000 000000 /* try login and logout multiple times in a row */ #include #include #include #include "common.h" int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_RETCODE ret; int verbose = 0; int i; printf("%s: Testing login, logout\n", __FILE__); for (i =0; i < 100; ++i) { if (verbose) printf("Trying login\n"); ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } if (verbose) printf("Trying logout\n"); ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 2; } } if (verbose) printf("Test succeeded\n"); return 0; } freetds-1.3.6/src/ctlib/unittests/t0007.c000644 025423 025423 00000013711 14056414221 021451 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" /* Testing: Retrieve CS_TEXT_TYPE using ct_bind() */ int main(int argc, char **argv) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt[4]; CS_INT datalength[4]; CS_SMALLINT ind[4]; CS_INT count, row_count = 0; CS_CHAR name[4][1024]; name[0][0] = 0; name[1][0] = 0; name[2][0] = 0; name[3][0] = 0; printf("%s: Retrieve CS_CHAR_TYPE using ct_bind()\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = ct_command(cmd, CS_LANG_CMD, "SELECT CONVERT(VARCHAR(7),'1234') AS test, CONVERT(VARCHAR(7),'') AS test2, CONVERT(VARCHAR(7),NULL) AS test3, CONVERT(NUMERIC(38,2), 123.45) as test4", CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command() failed\n"); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 4) { fprintf(stderr, "num_cols %d != 4", num_cols); return 1; } if (ct_describe(cmd, 1, &datafmt[0]) != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt[0].format = CS_FMT_NULLTERM; ++datafmt[0].maxlength; if (datafmt[0].maxlength > 1024) { datafmt[0].maxlength = 1024; } if (ct_describe(cmd, 2, &datafmt[1]) != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt[1].format = CS_FMT_NULLTERM; ++datafmt[1].maxlength; if (datafmt[1].maxlength > 1024) { datafmt[1].maxlength = 1024; } if (ct_describe(cmd, 3, &datafmt[2]) != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed\n"); return 1; } datafmt[2].format = CS_FMT_NULLTERM; ++datafmt[2].maxlength; if (datafmt[2].maxlength > 1024) { datafmt[2].maxlength = 1024; } if (ct_describe(cmd, 4, &datafmt[3]) != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed\n"); return 1; } datafmt[3].format = CS_FMT_NULLTERM; if (datafmt[3].maxlength != sizeof(CS_NUMERIC)) { fprintf(stderr, "wrong maxlength for numeric\n"); return 1; } ++datafmt[3].maxlength; if (datafmt[3].maxlength > 1024) { datafmt[3].maxlength = 1024; } if (ct_bind(cmd, 1, &datafmt[0], name[0], &datalength[0], &ind[0]) != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } if (ct_bind(cmd, 2, &datafmt[1], name[1], &datalength[1], &ind[1]) != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } if (ct_bind(cmd, 3, &datafmt[2], name[2], &datalength[2], &ind[2]) != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } if (ct_bind(cmd, 4, &datafmt[3], name[3], &datalength[3], &ind[3]) != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ if (verbose) { printf("name = '%s'\n", name[0]); } if (ind[0] != 0) { fprintf(stderr, "Returned NULL\n"); return 1; } if (strcmp(name[0], "1234")) { fprintf(stderr, "Bad return:\n'%s'\n! =\n'%s'\n", name[0], "1234"); return 1; } if (datalength[0] != strlen(name[0]) + 1) { fprintf(stderr, "Bad length:\n'%ld'\n! =\n'%d'\n", (long) strlen(name[0]) + 1, datalength[0]); return 1; } if (ind[1] != 0) { fprintf(stderr, "Returned NULL\n"); return 1; } /* empty are retunerd as a single space in TDS4.x and TDS5 */ if (strcmp(name[1], "") && strcmp(name[1], " ")) { fprintf(stderr, "Bad return:\n'%s'\n! =\n'%s'\n", name[1], ""); return 1; } if (datalength[1] != strlen(name[1]) + 1) { fprintf(stderr, "Col 2 bad length:\n'%ld'\n! =\n'%d'\n", (long) strlen(name[1]) + 1, datalength[1]); return 1; } if (ind[2] == 0) { fprintf(stderr, "Col 3 returned not NULL (ind %d len %d)\n", (int) ind[2], (int) datalength[2]); return 1; } if (strcmp(name[2], "")) { fprintf(stderr, "Col 3 bad return:\n'%s'\n! =\n'%s'\n", name[2], ""); return 1; } if (datalength[2] != 0) { fprintf(stderr, "Col 3 bad length:\n'%ld'\n! =\n'%d'\n", (long) 0, datalength[2]); return 1; } } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; case CS_COMPUTE_RESULT: fprintf(stderr, "ct_results() unexpected CS_COMPUTE_RESULT.\n"); return 1; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/t0008.c000644 025423 025423 00000007027 14056414221 021455 0ustar00fredianofrediano000000 000000 #include #include #include #include #include "common.h" /* * ct_send SQL |select name = @@servername| * ct_bind variable * ct_fetch and print results */ int main(int argc, char **argv) { int verbose = 1; CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; CS_RETCODE ret; CS_DATAFMT srcfmt; CS_INT src = 32768; CS_DATAFMT dstfmt; CS_SMALLINT dst; printf("%s: Testing context callbacks\n", __FILE__); srcfmt.datatype = CS_INT_TYPE; srcfmt.maxlength = sizeof(CS_INT); srcfmt.locale = NULL; #if 0 dstfmt.datatype = CS_SMALLINT_TYPE; #else dstfmt.datatype = CS_DATETIME_TYPE; #endif dstfmt.maxlength = sizeof(CS_SMALLINT); dstfmt.locale = NULL; if (verbose) { printf("Trying clientmsg_cb with context\n"); } if (cs_ctx_alloc(CS_VERSION_100, &ctx) != CS_SUCCEED) { fprintf(stderr, "cs_ctx_alloc() failed\n"); } if (ct_init(ctx, CS_VERSION_100) != CS_SUCCEED) { fprintf(stderr, "ct_init() failed\n"); } if (ct_callback(ctx, NULL, CS_SET, CS_CLIENTMSG_CB, (CS_VOID*) clientmsg_cb) != CS_SUCCEED) { fprintf(stderr, "ct_callback() failed\n"); return 1; } clientmsg_cb_invoked = 0; if (cs_convert(ctx, &srcfmt, &src, &dstfmt, &dst, NULL) == CS_SUCCEED) { fprintf(stderr, "cs_convert() succeeded when failure was expected\n"); return 1; } if (clientmsg_cb_invoked != 0) { fprintf(stderr, "clientmsg_cb was invoked!\n"); return 1; } if (verbose) { printf("Trying cslibmsg_cb\n"); } if (cs_config(ctx, CS_SET, CS_MESSAGE_CB, (CS_VOID*) cslibmsg_cb, CS_UNUSED, NULL) != CS_SUCCEED) { fprintf(stderr, "cs_config() failed\n"); return 1; } cslibmsg_cb_invoked = 0; if (cs_convert(ctx, &srcfmt, &src, &dstfmt, &dst, NULL) == CS_SUCCEED) { fprintf(stderr, "cs_convert() succeeded when failure was expected\n"); return 1; } if (cslibmsg_cb_invoked == 0) { fprintf(stderr, "cslibmsg_cb was not invoked!\n"); return 1; } if (ct_exit(ctx, CS_UNUSED) != CS_SUCCEED) { fprintf(stderr, "ct_exit() failed\n"); } if (cs_ctx_drop(ctx) != CS_SUCCEED) { fprintf(stderr, "cx_ctx_drop() failed\n"); } if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } if (verbose) { printf("Trying clientmsg_cb with connection\n"); } ret = ct_callback(NULL, conn, CS_SET, CS_CLIENTMSG_CB, (CS_VOID *) clientmsg_cb); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_callback() failed\n"); return 1; } clientmsg_cb_invoked = 0; ret = run_command(cmd, "."); if (ret != CS_SUCCEED) { fprintf(stderr, "run_command() failed\n"); return 1; } if (clientmsg_cb_invoked) { fprintf(stderr, "clientmsg_cb was invoked!\n"); return 1; } if (verbose) { printf("Trying servermsg_cb with connection\n"); } ret = ct_callback(NULL, conn, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) servermsg_cb); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_callback() failed\n"); return 1; } servermsg_cb_invoked = 0; #if 0 ret = run_command(cmd, "raiserror 99999 'This is a test'"); ret = run_command(cmd, "raiserror('This is a test', 17, 1)"); #else ret = run_command(cmd, "print 'This is a test'"); #endif if (ret != CS_SUCCEED) { fprintf(stderr, "run_command() failed\n"); return 1; } if (servermsg_cb_invoked == 0) { fprintf(stderr, "servermsg_cb was not invoked!\n"); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/t0009.c000644 025423 025423 00000021176 14056414221 021457 0ustar00fredianofrediano000000 000000 #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" static CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * errmsg); static int compute_supported = 1; /* Testing: Retrieve compute results */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols, compute_id; CS_DATAFMT datafmt; CS_INT datalength; CS_SMALLINT ind; CS_INT count, row_count = 0; CS_CHAR select[1024]; CS_INT col1; CS_CHAR col2[2]; CS_CHAR col3[32]; CS_INT compute_col1; CS_CHAR compute_col3[32]; unsigned rows[3] = { 0, 0, 0 }; printf("%s: Retrieve compute results processing\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } ret = run_command(cmd, "CREATE TABLE #ctlib0009 (col1 int not null, col2 char(1) not null, col3 datetime not null)"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlib0009 values (1, 'A', 'Jan 1 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlib0009 values (2, 'A', 'Jan 2 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlib0009 values (3, 'A', 'Jan 3 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlib0009 values (8, 'B', 'Jan 4 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; ret = run_command(cmd, "insert into #ctlib0009 values (9, 'B', 'Jan 5 2002 10:00:00AM')"); if (ret != CS_SUCCEED) return 1; strcpy(select, "select col1, col2, col3 from #ctlib0009 order by col2 "); strcat(select, "compute sum(col1) by col2 "); strcat(select, "compute max(col3)"); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command(%s) failed\n", select); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) ex_servermsg_cb); while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { printf("ct_results returned %s type\n", res_type_str(result_type)); switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: if (!compute_supported) { try_ctlogout(ctx, conn, cmd, verbose); return 0; } fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 3) { fprintf(stderr, "num_cols %d != 3", num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } ret = ct_bind(cmd, 1, &datafmt, &col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } ret = ct_describe(cmd, 2, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 2; ret = ct_bind(cmd, 2, &datafmt, col2, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } ret = ct_describe(cmd, 3, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 32; ret = ct_bind(cmd, 3, &datafmt, col3, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ printf("col1 = %d col2= '%s', col3 = '%s'\n", col1, col2, col3); ++rows[0]; } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; case CS_COMPUTE_RESULT: printf("testing compute_result\n"); ret = ct_compute_info(cmd, CS_COMP_ID, CS_UNUSED, &compute_id, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_compute_info() failed"); return 1; } if (compute_id != 1 && compute_id != 2) { fprintf(stderr, "invalid compute_id value"); return 1; } if (compute_id == 1) { ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "compute_id %d num_cols %d != 1", compute_id, num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > 1024) { datafmt.maxlength = 1024; } compute_col1 = -1; ret = ct_bind(cmd, 1, &datafmt, &compute_col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } } if (compute_id == 2) { ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "compute_id %d num_cols %d != 1", compute_id, num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.datatype = CS_CHAR_TYPE; datafmt.format = CS_FMT_NULLTERM; datafmt.maxlength = 32; compute_col3[0] = 0; ret = ct_bind(cmd, 1, &datafmt, compute_col3, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ if (compute_id == 1) { printf("compute_col1 = %d \n", compute_col1); if (compute_col1 != 6 && compute_col1 != 17) { fprintf(stderr, "(should be 6 or 17)\n"); return 1; } } if (compute_id == 2) { printf("compute_col3 = '%s'\n", compute_col3); if (strcmp("Jan 5 2002 10:00:00AM", compute_col3) && strcmp("Jan 05 2002 10:00AM", compute_col3) && strcmp("Jan 5 2002 10:00AM", compute_col3)) { fprintf(stderr, "(should be \"Jan 5 2002 10:00:00AM\")\n"); return 1; } } ++rows[compute_id]; } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (rows[0] != 5 || rows[1] != 2 || rows[2] != 1) { fprintf(stderr, "wrong number of rows: normal %u compute_1 %u compute_2 %u, expected 5 2 1\n", rows[0], rows[1], rows[2]); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } static CS_RETCODE ex_servermsg_cb(CS_CONTEXT * context, CS_CONNECTION * connection, CS_SERVERMSG * srvmsg) { if (strstr(srvmsg->text, "compute")) { compute_supported = 0; printf("Server does not support compute\n"); return CS_SUCCEED; } return servermsg_cb(context, connection, srvmsg); } freetds-1.3.6/src/ctlib/unittests/variant.c000644 025423 025423 00000011255 14056414271 022351 0ustar00fredianofrediano000000 000000 #undef NDEBUG #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include "common.h" /* Testing: Retrieving SQL_VARIANT */ int main(int argc, char *argv[]) { CS_CONTEXT *ctx; CS_CONNECTION *conn; CS_COMMAND *cmd; int verbose = 0; CS_RETCODE ret; CS_RETCODE results_ret; CS_INT result_type; CS_INT num_cols; CS_DATAFMT datafmt; CS_INT datalength; CS_SMALLINT ind; CS_INT count, row_count = 0; CS_CHAR select[1024]; CS_CHAR col1[128]; const char *expected[10]; unsigned num_expected = 0; unsigned rows = 0; memset(expected, 0, sizeof(expected)); printf("%s: Retrieve SQL_VARIANT column\n", __FILE__); if (verbose) { printf("Trying login\n"); } ret = try_ctlogin(&ctx, &conn, &cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Login failed\n"); return 1; } strcpy(select, "CREATE TABLE #ctlib0009 (n int, col1 sql_variant null)"); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); assert(ret == CS_SUCCEED); ret = ct_send(cmd); assert(ret == CS_SUCCEED); ret = ct_results(cmd, &result_type); assert(ret == CS_SUCCEED); switch (result_type) { case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL, probably not MSSQL.\n"); try_ctlogout(ctx, conn, cmd, verbose); return 0; case CS_CMD_SUCCEED: break; default: fprintf(stderr, "ct_results() unexpected return %d.\n", result_type); try_ctlogout(ctx, conn, cmd, verbose); return 1; } ret = run_command(cmd, "insert into #ctlib0009 values (1, 123)"); assert(ret == CS_SUCCEED); expected[num_expected++] = "123"; ret = run_command(cmd, "insert into #ctlib0009 values (2, NULL)"); assert(ret == CS_SUCCEED); expected[num_expected++] = ""; ret = run_command(cmd, "insert into #ctlib0009 values (3, 'hello')"); assert(ret == CS_SUCCEED); expected[num_expected++] = "hello"; ret = run_command(cmd, "insert into #ctlib0009 values (4, 123.456)"); assert(ret == CS_SUCCEED); expected[num_expected++] = "123.456"; strcpy(select, "select col1 from #ctlib0009 order by n"); ret = ct_command(cmd, CS_LANG_CMD, select, CS_NULLTERM, CS_UNUSED); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_command(%s) failed\n", select); return 1; } ret = ct_send(cmd); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_send() failed\n"); return 1; } ct_callback(ctx, NULL, CS_SET, CS_SERVERMSG_CB, (CS_VOID *) servermsg_cb); while ((results_ret = ct_results(cmd, &result_type)) == CS_SUCCEED) { printf("ct_results returned %s type\n", res_type_str(result_type)); switch ((int) result_type) { case CS_CMD_SUCCEED: break; case CS_CMD_DONE: break; case CS_CMD_FAIL: fprintf(stderr, "ct_results() result_type CS_CMD_FAIL.\n"); return 1; case CS_ROW_RESULT: ret = ct_res_info(cmd, CS_NUMDATA, &num_cols, CS_UNUSED, NULL); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_res_info() failed"); return 1; } if (num_cols != 1) { fprintf(stderr, "num_cols %d != 1", num_cols); return 1; } ret = ct_describe(cmd, 1, &datafmt); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_describe() failed"); return 1; } datafmt.format = CS_FMT_UNUSED; if (datafmt.maxlength > sizeof(col1)) { datafmt.maxlength = sizeof(col1); } ret = ct_bind(cmd, 1, &datafmt, col1, &datalength, &ind); if (ret != CS_SUCCEED) { fprintf(stderr, "ct_bind() failed\n"); return 1; } while (((ret = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED, &count)) == CS_SUCCEED) || (ret == CS_ROW_FAIL)) { row_count += count; if (ret == CS_ROW_FAIL) { fprintf(stderr, "ct_fetch() CS_ROW_FAIL on row %d.\n", row_count); return 1; } else { /* ret == CS_SUCCEED */ col1[datalength] = 0; printf("col1 = %s\n", col1); assert(strcmp(col1, expected[rows]) == 0); ++rows; } } switch ((int) ret) { case CS_END_DATA: break; case CS_FAIL: fprintf(stderr, "ct_fetch() returned CS_FAIL.\n"); return 1; default: fprintf(stderr, "ct_fetch() unexpected return.\n"); return 1; } break; default: fprintf(stderr, "ct_results() unexpected result_type.\n"); return 1; } } switch ((int) results_ret) { case CS_END_RESULTS: break; case CS_FAIL: fprintf(stderr, "ct_results() failed.\n"); return 1; break; default: fprintf(stderr, "ct_results() unexpected return.\n"); return 1; } if (rows != 4) { fprintf(stderr, "wrong number of rows: normal %u, expected 4\n", rows); return 1; } if (verbose) { printf("Trying logout\n"); } ret = try_ctlogout(ctx, conn, cmd, verbose); if (ret != CS_SUCCEED) { fprintf(stderr, "Logout failed\n"); return 1; } return 0; } freetds-1.3.6/src/ctlib/unittests/will_convert.c000644 025423 025423 00000013132 14056414221 023403 0ustar00fredianofrediano000000 000000 /* Test cs_will_convert */ #undef NDEBUG #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "common.h" static CS_CONTEXT *context; static void check_ret(const char *name, CS_RETCODE ret) { if (ret != CS_SUCCEED) { fprintf(stderr, "%s(): failed\n", name); exit(1); } } typedef struct { const char *expected; CS_INT from; } test_row; /* from * http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ocs_12.5.1.comlib/html/comlib/X12687.htm * X = conversion supported * . = conversion not supported * x = should be supported, but currently it's not * _ = should be not supported, but currently it is */ static const test_row test_rows[] = { /* B L V B C L V D D T S I D N F R M M B S T I U D T I O A I H O A A A I M N E U L E O O O E E M N A I N N R T A N R T T N A T C M O A N N U N X A I T M A G B R G C E E Y L I E A L E E N S T G C E E R B I C H T T I L M R T Y Y D I E H Y I N H A I I N I A I 4 A T A N A A R M M T N L C R I R A R R E E T Y V R Y 4 I Y T Y */ {"X X X x X X X x x X X X x x X X X X . . X X X x x", CS_BINARY_TYPE}, {"X X X x X X X x x X X X x x X X X X . . X X X x x", CS_LONGBINARY_TYPE}, {"X X X x X X X x x X X X x x X X X X . . X X X x x", CS_VARBINARY_TYPE}, {"X X X X X X X . . X X X X X X X _ _ . . X X X x x", CS_BIT_TYPE}, {"X X X X X X X X X X X X X X X X X X x x X X X X X", CS_CHAR_TYPE}, {"X X X X X X X X X X X X X X X X X X x x X X X X X", CS_LONGCHAR_TYPE}, {"X X X X X X X X X X X X X X X X X X x x X X X X X", CS_VARCHAR_TYPE}, {"_ _ X . X X X X X . . . . . . . . . . . X X X X X", CS_DATETIME_TYPE}, {"_ _ X . X X X X X . . . . . . . . . . . X X X X X", CS_DATETIME4_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_TINYINT_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_SMALLINT_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_INT_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_DECIMAL_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_NUMERIC_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_FLOAT_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_REAL_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_MONEY_TYPE}, {"X X X X X X X . . X X X X X X X X X . . X X _ . .", CS_MONEY4_TYPE}, {". . . . x x x . . . . . . . . . . . x . x . . . .", CS_BOUNDARY_TYPE}, {". . . . x x x . . . . . . . . . . . . x x . . . .", CS_SENSITIVITY_TYPE}, {"X X X X X X X X X X X X X X X X X X x x X X _ _ _", CS_TEXT_TYPE}, {"X X X x X X X x x X X X x x X X X X . . X X _ . .", CS_IMAGE_TYPE}, {"X X X X X X X X X _ _ _ _ _ _ _ _ _ . . _ _ _ _ _", CS_UNICHAR_TYPE}, {"_ _ X . X X X X X . . . . . . . . . . . X X X X _", CS_DATE_TYPE}, {"_ _ X . X X X X X . . . . . . . . . . . X X X _ X", CS_TIME_TYPE}, {NULL, 0} }; #define TEST_ALL_TYPES \ TEST_TYPE(BINARY) \ TEST_TYPE(LONGBINARY) \ TEST_TYPE(VARBINARY) \ TEST_TYPE(BIT) \ TEST_TYPE(CHAR) \ TEST_TYPE(LONGCHAR) \ TEST_TYPE(VARCHAR) \ TEST_TYPE(DATETIME) \ TEST_TYPE(DATETIME4) \ TEST_TYPE(TINYINT) \ TEST_TYPE(SMALLINT) \ TEST_TYPE(INT) \ TEST_TYPE(DECIMAL) \ TEST_TYPE(NUMERIC) \ TEST_TYPE(FLOAT) \ TEST_TYPE(REAL) \ TEST_TYPE(MONEY) \ TEST_TYPE(MONEY4) \ TEST_TYPE(BOUNDARY) \ TEST_TYPE(SENSITIVITY) \ TEST_TYPE(TEXT) \ TEST_TYPE(IMAGE) \ TEST_TYPE(UNICHAR) \ TEST_TYPE(DATE) \ TEST_TYPE(TIME) static CS_INT column_types[] = { #define TEST_TYPE(type) CS_ ## type ## _TYPE, TEST_ALL_TYPES #undef TEST_TYPE CS_ILLEGAL_TYPE }; static const char * type_name(CS_INT value) { switch (value) { #define TEST_TYPE(type) case CS_ ## type ## _TYPE: return #type; TEST_ALL_TYPES #undef TEST_TYPE } return "unknown!"; } static void test0(CS_INT from, CS_INT to, CS_BOOL expected, int line) { CS_BOOL res; res = 123; cs_will_convert(context, from, to, &res); if (res != expected) { fprintf(stderr, "Wrong result %d (%s) -> %d (%s) %d\n", from, type_name(from), to, type_name(to), res); exit(1); } res = 123; cs_will_convert(NULL, from, to, &res); if (res != expected) { fprintf(stderr, "Wrong result %d (%s) -> %d (%s) %d\n", from, type_name(from), to, type_name(to), res); exit(1); } } #define test(from, to, expected) test0(from, to, expected, __LINE__) int main(int argc, char **argv) { int verbose = 0; CS_COMMAND *command; CS_CONNECTION *connection; CS_INT from, to; const test_row *row; check_ret("try_ctlogin", try_ctlogin(&context, &connection, &command, verbose)); for (row = test_rows; row->expected; ++row) { const CS_INT *type; const char *expected = row->expected; for (type = column_types; *type != CS_ILLEGAL_TYPE; ++type) { switch (*expected) { case 'X': test(row->from, *type, CS_TRUE); break; case '.': test(row->from, *type, CS_FALSE); break; case 'x': case '_': /* ignore */ break; default: assert(0); } ++expected; assert(*expected == 0 || *expected == ' '); if (*expected) ++expected; } } for (from = CS_MAX_SYBTYPE + 1; from < 256; ++from) { for (to = CS_MAX_SYBTYPE + 1; to < 256; ++to) { CS_BOOL res; res = 123; cs_will_convert(context, from, to, &res); assert(res == CS_FALSE); res = 123; cs_will_convert(NULL, from, to, &res); assert(res == CS_FALSE); } } try_ctlogout(context, connection, command, verbose); return 0; } freetds-1.3.6/src/ctlib/unittests/CMakeLists.txt000644 025423 025423 00000001660 14056414271 023300 0ustar00fredianofrediano000000 000000 add_library(c_common STATIC common.c common.h) foreach(target t0001 t0002 t0003 t0004 t0005 cs_convert t0007 t0008 t0009 connect_fail ct_options lang_ct_param array_bind cs_diag get_send_data rpc_ct_param rpc_ct_setparam ct_diagclient ct_diagserver ct_diagall cs_config cancel blk_in blk_out ct_cursor ct_cursors ct_dynamic blk_in2 datafmt data all_types long_binary will_convert variant) add_executable(c_${target} EXCLUDE_FROM_ALL ${target}.c) set_target_properties(c_${target} PROPERTIES OUTPUT_NAME ${target}) if (target STREQUAL "all_types") target_link_libraries(c_${target} c_common ct-static t_common tds replacements tdsutils ${lib_NETWORK} ${lib_BASE}) else() target_link_libraries(c_${target} c_common ct replacements tdsutils ${lib_NETWORK} ${lib_BASE}) endif() add_test(NAME c_${target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND c_${target}) add_dependencies(check c_${target}) endforeach(target) freetds-1.3.6/src/tds/Makefile.am000644 025423 025423 00000003062 14056414222 020221 0ustar00fredianofrediano000000 000000 NULL= SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include noinst_LTLIBRARIES = libtds.la libtds_la_SOURCES = \ mem.c \ token.c \ util.c \ login.c \ read.c \ write.c \ convert.c \ numeric.c \ config.c \ query.c \ iconv.c \ locale.c \ vstrbuild.c \ getmac.c \ data.c \ net.c \ tls.c \ tds_checks.c \ log.c \ bulk.c \ packet.c \ stream.c \ random.c \ sec_negotiate.c \ sec_negotiate_gnutls.h \ sec_negotiate_openssl.h \ gssapi.c \ $(NULL) if HAVE_SSPI libtds_la_SOURCES += sspi.c else libtds_la_SOURCES += challenge.c endif libtds_la_LDFLAGS = libtds_la_LIBADD = $(NETWORK_LIBS) GENERATED_HEADER_FILES = tds_willconvert.h num_limits.h tds_types.h noinst_HEADERS = $(GENERATED_HEADER_FILES) EXTRA_DIST = $(GENERATED_HEADER_FILES) \ CMakeLists.txt \ challenge.c \ sspi.c \ $(NULL) # Perl is needed to build from a repository checkout. # Perl is *not* needed to build from a tarball. ## We have to build num_limits.h because automake can't infer the ## dependency (on num_limits.pl). data.c: tds_types.h if HAVE_PERL_SOURCES BUILT_SOURCES = $(GENERATED_HEADER_FILES) clean-local: cd $(srcdir) && rm -f $(BUILT_SOURCES) tds_willconvert.h: tds_willconvert.pl Makefile perl $(srcdir)/tds_willconvert.pl $(top_srcdir)/include/freetds/proto.h > $@.tmp mv $@.tmp $@ num_limits.h: num_limits.pl Makefile perl $(srcdir)/num_limits.pl > $@.tmp mv $@.tmp $@ tds_types.h: types.pl Makefile $(top_srcdir)/misc/types.csv perl $(srcdir)/types.pl $(top_srcdir)/misc/types.csv $(top_srcdir)/include/freetds/proto.h > $@.tmp mv $@.tmp $@ endif freetds-1.3.6/src/tds/tds_willconvert.h000644 025423 025423 00000010634 14162303404 021560 0ustar00fredianofrediano000000 000000 /*** Please do not edit this file! ***/ /*** It was generated with 'perl tds_willconvert.pl > tds_willconvert.h' ***/ /*** It is much easier to edit the __DATA__ table than this file. ***/ /*** ***/ /*** Thank you. ***/ static const uint8_t type2category[256] = { 0, /* 0 */ 0, /* 1 */ 0, /* 2 */ 0, /* 3 */ 0, /* 4 */ 0, /* 5 */ 0, /* 6 */ 0, /* 7 */ 0, /* 8 */ 0, /* 9 */ 0, /* 10 */ 0, /* 11 */ 0, /* 12 */ 0, /* 13 */ 0, /* 14 */ 0, /* 15 */ 0, /* 16 */ 0, /* 17 */ 0, /* 18 */ 0, /* 19 */ 0, /* 20 */ 0, /* 21 */ 0, /* 22 */ 0, /* 23 */ 0, /* 24 */ 0, /* 25 */ 0, /* 26 */ 0, /* 27 */ 0, /* 28 */ 0, /* 29 */ 0, /* 30 */ 0, /* SYBVOID */ 0, /* 32 */ 0, /* 33 */ 2, /* SYBIMAGE */ 6, /* SYBTEXT */ 7, /* SYBBLOB */ 2, /* SYBVARBINARY */ 0, /* SYBINTN */ 6, /* SYBVARCHAR */ 4, /* SYBMSDATE */ 4, /* SYBMSTIME */ 4, /* SYBMSDATETIME2 */ 4, /* SYBMSDATETIMEOFFSET */ 0, /* 44 */ 2, /* SYBBINARY */ 0, /* SYBINTERVAL */ 6, /* SYBCHAR */ 3, /* SYBINT1 */ 4, /* SYBDATE */ 1, /* SYBBIT */ 4, /* SYBTIME */ 3, /* SYBINT2 */ 0, /* 53 */ 0, /* 54 */ 0, /* 55 */ 3, /* SYBINT4 */ 0, /* 57 */ 4, /* SYBDATETIME4 */ 3, /* SYBREAL */ 3, /* SYBMONEY */ 4, /* SYBDATETIME */ 3, /* SYBFLT8 */ 0, /* 63 */ 3, /* SYBUINT1 */ 3, /* SYBUINT2 */ 3, /* SYBUINT4 */ 3, /* SYBUINT8 */ 0, /* SYBUINTN */ 0, /* 69 */ 0, /* 70 */ 0, /* 71 */ 0, /* 72 */ 0, /* 73 */ 0, /* 74 */ 0, /* 75 */ 0, /* 76 */ 0, /* 77 */ 0, /* 78 */ 0, /* 79 */ 0, /* 80 */ 0, /* 81 */ 0, /* 82 */ 0, /* 83 */ 0, /* 84 */ 0, /* 85 */ 0, /* 86 */ 0, /* 87 */ 0, /* 88 */ 0, /* 89 */ 0, /* 90 */ 0, /* 91 */ 0, /* 92 */ 0, /* 93 */ 0, /* 94 */ 0, /* 95 */ 0, /* 96 */ 0, /* 97 */ 0, /* SYBVARIANT */ 0, /* SYBNTEXT */ 0, /* 100 */ 0, /* 101 */ 0, /* 102 */ 5, /* SYBSENSITIVITY */ 1, /* SYBBOUNDARY */ 0, /* 105 */ 1, /* SYBDECIMAL */ 0, /* 107 */ 1, /* SYBNUMERIC */ 0, /* SYBFLTN */ 0, /* SYBMONEYN */ 0, /* SYBDATETIMN */ 0, /* 112 */ 0, /* 113 */ 0, /* 114 */ 0, /* 115 */ 0, /* 116 */ 0, /* 117 */ 0, /* 118 */ 0, /* 119 */ 0, /* 120 */ 0, /* 121 */ 3, /* SYBMONEY4 */ 0, /* SYBDATEN */ 0, /* 124 */ 0, /* 125 */ 0, /* 126 */ 3, /* SYBINT8 */ 0, /* 128 */ 0, /* 129 */ 0, /* 130 */ 0, /* 131 */ 0, /* 132 */ 0, /* 133 */ 0, /* 134 */ 0, /* 135 */ 0, /* 136 */ 0, /* 137 */ 0, /* 138 */ 0, /* 139 */ 0, /* 140 */ 0, /* 141 */ 0, /* 142 */ 0, /* 143 */ 0, /* 144 */ 0, /* 145 */ 0, /* 146 */ 0, /* SYBTIMEN */ 0, /* 148 */ 0, /* 149 */ 0, /* 150 */ 0, /* 151 */ 0, /* 152 */ 0, /* 153 */ 0, /* 154 */ 0, /* 155 */ 0, /* 156 */ 0, /* 157 */ 0, /* 158 */ 0, /* 159 */ 0, /* 160 */ 0, /* 161 */ 0, /* 162 */ 0, /* SYBXML */ 0, /* 164 */ 2, /* XSYBVARBINARY */ 0, /* 166 */ 6, /* XSYBVARCHAR */ 0, /* 168 */ 0, /* 169 */ 0, /* 170 */ 0, /* 171 */ 0, /* 172 */ 2, /* XSYBBINARY */ 0, /* SYBUNITEXT */ 6, /* SYBLONGCHAR */ 0, /* SYBSINT1 */ 0, /* 177 */ 0, /* 178 */ 0, /* 179 */ 0, /* 180 */ 0, /* 181 */ 0, /* 182 */ 0, /* 183 */ 0, /* 184 */ 0, /* 185 */ 0, /* 186 */ 4, /* SYB5BIGDATETIME */ 4, /* SYB5BIGTIME */ 0, /* 189 */ 0, /* 190 */ 0, /* SYB5INT8 */ 0, /* 192 */ 0, /* 193 */ 0, /* 194 */ 0, /* 195 */ 0, /* 196 */ 0, /* 197 */ 0, /* 198 */ 0, /* 199 */ 0, /* 200 */ 0, /* 201 */ 0, /* 202 */ 0, /* 203 */ 0, /* 204 */ 0, /* 205 */ 0, /* 206 */ 0, /* 207 */ 0, /* 208 */ 0, /* 209 */ 0, /* 210 */ 0, /* 211 */ 0, /* 212 */ 0, /* 213 */ 0, /* 214 */ 0, /* 215 */ 0, /* 216 */ 0, /* 217 */ 0, /* 218 */ 0, /* 219 */ 0, /* 220 */ 0, /* 221 */ 0, /* 222 */ 0, /* 223 */ 0, /* 224 */ 2, /* SYBLONGBINARY */ 0, /* 226 */ 0, /* 227 */ 0, /* 228 */ 0, /* 229 */ 0, /* 230 */ 0, /* XSYBNVARCHAR */ 0, /* 232 */ 0, /* 233 */ 0, /* 234 */ 0, /* 235 */ 0, /* 236 */ 0, /* 237 */ 0, /* 238 */ 0, /* XSYBNCHAR */ 0, /* SYBMSUDT */ 0, /* SYBMSXML */ 0, /* 242 */ 0, /* 243 */ 0, /* 244 */ 0, /* 245 */ 0, /* 246 */ 0, /* 247 */ 0, /* 248 */ 0, /* 249 */ 0, /* 250 */ 0, /* 251 */ 0, /* 252 */ 0, /* 253 */ 0, /* 254 */ 0, /* 255 */ }; static const uint32_t category_conversion[] = { 0, 78, /* SYBBIT */ 76, /* SYBIMAGE */ 78, /* SYBINT1 */ 84, /* SYBMSDATE */ 0, /* SYBSENSITIVITY */ 222, /* SYBTEXT */ 196, /* SYBUNIQUE */ }; freetds-1.3.6/src/tds/num_limits.h000644 025423 025423 00000020133 14162303404 020511 0ustar00fredianofrediano000000 000000 #define LIMIT_INDEXES_ADJUST 4 static const signed char limit_indexes[79]= { 0, /* 0 */ -3, /* 1 */ -6, /* 2 */ -9, /* 3 */ -12, /* 4 */ -15, /* 5 */ -18, /* 6 */ -21, /* 7 */ -24, /* 8 */ -27, /* 9 */ -30, /* 10 */ -32, /* 11 */ -34, /* 12 */ -36, /* 13 */ -38, /* 14 */ -40, /* 15 */ -42, /* 16 */ -44, /* 17 */ -46, /* 18 */ -48, /* 19 */ -50, /* 20 */ -51, /* 21 */ -52, /* 22 */ -53, /* 23 */ -54, /* 24 */ -55, /* 25 */ -56, /* 26 */ -57, /* 27 */ -58, /* 28 */ -59, /* 29 */ -59, /* 30 */ -59, /* 31 */ -59, /* 32 */ -60, /* 33 */ -61, /* 34 */ -62, /* 35 */ -63, /* 36 */ -64, /* 37 */ -65, /* 38 */ -66, /* 39 */ -66, /* 40 */ -66, /* 41 */ -66, /* 42 */ -66, /* 43 */ -66, /* 44 */ -66, /* 45 */ -66, /* 46 */ -66, /* 47 */ -66, /* 48 */ -66, /* 49 */ -65, /* 50 */ -64, /* 51 */ -63, /* 52 */ -62, /* 53 */ -61, /* 54 */ -60, /* 55 */ -59, /* 56 */ -58, /* 57 */ -57, /* 58 */ -55, /* 59 */ -53, /* 60 */ -51, /* 61 */ -49, /* 62 */ -47, /* 63 */ -45, /* 64 */ -44, /* 65 */ -43, /* 66 */ -42, /* 67 */ -41, /* 68 */ -39, /* 69 */ -37, /* 70 */ -35, /* 71 */ -33, /* 72 */ -31, /* 73 */ -29, /* 74 */ -27, /* 75 */ -25, /* 76 */ -23, /* 77 */ -21, /* 78 */ }; static const TDS_WORD limits[]= { 0x00000001u, /* 0 */ 0x0000000au, /* 1 */ 0x00000064u, /* 2 */ 0x000003e8u, /* 3 */ 0x00002710u, /* 4 */ 0x000186a0u, /* 5 */ 0x000f4240u, /* 6 */ 0x00989680u, /* 7 */ 0x05f5e100u, /* 8 */ 0x3b9aca00u, /* 9 */ 0x00000002u, /* 10 */ 0x540be400u, /* 11 */ 0x00000017u, /* 12 */ 0x4876e800u, /* 13 */ 0x000000e8u, /* 14 */ 0xd4a51000u, /* 15 */ 0x00000918u, /* 16 */ 0x4e72a000u, /* 17 */ 0x00005af3u, /* 18 */ 0x107a4000u, /* 19 */ 0x00038d7eu, /* 20 */ 0xa4c68000u, /* 21 */ 0x002386f2u, /* 22 */ 0x6fc10000u, /* 23 */ 0x01634578u, /* 24 */ 0x5d8a0000u, /* 25 */ 0x0de0b6b3u, /* 26 */ 0xa7640000u, /* 27 */ 0x8ac72304u, /* 28 */ 0x89e80000u, /* 29 */ 0x00000005u, /* 30 */ 0x6bc75e2du, /* 31 */ 0x63100000u, /* 32 */ 0x00000036u, /* 33 */ 0x35c9adc5u, /* 34 */ 0xdea00000u, /* 35 */ 0x0000021eu, /* 36 */ 0x19e0c9bau, /* 37 */ 0xb2400000u, /* 38 */ 0x0000152du, /* 39 */ 0x02c7e14au, /* 40 */ 0xf6800000u, /* 41 */ 0x0000d3c2u, /* 42 */ 0x1bceccedu, /* 43 */ 0xa1000000u, /* 44 */ 0x00084595u, /* 45 */ 0x16140148u, /* 46 */ 0x4a000000u, /* 47 */ 0x0052b7d2u, /* 48 */ 0xdcc80cd2u, /* 49 */ 0xe4000000u, /* 50 */ 0x033b2e3cu, /* 51 */ 0x9fd0803cu, /* 52 */ 0xe8000000u, /* 53 */ 0x204fce5eu, /* 54 */ 0x3e250261u, /* 55 */ 0x10000000u, /* 56 */ 0x00000001u, /* 57 */ 0x431e0faeu, /* 58 */ 0x6d7217cau, /* 59 */ 0xa0000000u, /* 60 */ 0x0000000cu, /* 61 */ 0x9f2c9cd0u, /* 62 */ 0x4674edeau, /* 63 */ 0x40000000u, /* 64 */ 0x0000007eu, /* 65 */ 0x37be2022u, /* 66 */ 0xc0914b26u, /* 67 */ 0x80000000u, /* 68 */ 0x000004eeu, /* 69 */ 0x2d6d415bu, /* 70 */ 0x85acef81u, /* 71 */ 0x0000314du, /* 72 */ 0xc6448d93u, /* 73 */ 0x38c15b0au, /* 74 */ 0x0001ed09u, /* 75 */ 0xbead87c0u, /* 76 */ 0x378d8e64u, /* 77 */ 0x00134261u, /* 78 */ 0x72c74d82u, /* 79 */ 0x2b878fe8u, /* 80 */ 0x00c097ceu, /* 81 */ 0x7bc90715u, /* 82 */ 0xb34b9f10u, /* 83 */ 0x0785ee10u, /* 84 */ 0xd5da46d9u, /* 85 */ 0x00f436a0u, /* 86 */ 0x4b3b4ca8u, /* 87 */ 0x5a86c47au, /* 88 */ 0x098a2240u, /* 89 */ 0x00000002u, /* 90 */ 0xf050fe93u, /* 91 */ 0x8943acc4u, /* 92 */ 0x5f655680u, /* 93 */ 0x0000001du, /* 94 */ 0x6329f1c3u, /* 95 */ 0x5ca4bfabu, /* 96 */ 0xb9f56100u, /* 97 */ 0x00000125u, /* 98 */ 0xdfa371a1u, /* 99 */ 0x9e6f7cb5u, /* 100 */ 0x4395ca00u, /* 101 */ 0x00000b7au, /* 102 */ 0xbc627050u, /* 103 */ 0x305adf14u, /* 104 */ 0xa3d9e400u, /* 105 */ 0x000072cbu, /* 106 */ 0x5bd86321u, /* 107 */ 0xe38cb6ceu, /* 108 */ 0x6682e800u, /* 109 */ 0x00047bf1u, /* 110 */ 0x9673df52u, /* 111 */ 0xe37f2410u, /* 112 */ 0x011d1000u, /* 113 */ 0x002cd76fu, /* 114 */ 0xe086b93cu, /* 115 */ 0xe2f768a0u, /* 116 */ 0x0b22a000u, /* 117 */ 0x01c06a5eu, /* 118 */ 0xc5433c60u, /* 119 */ 0xddaa1640u, /* 120 */ 0x6f5a4000u, /* 121 */ 0x118427b3u, /* 122 */ 0xb4a05bc8u, /* 123 */ 0xa8a4de84u, /* 124 */ 0x59868000u, /* 125 */ 0xaf298d05u, /* 126 */ 0x0e4395d6u, /* 127 */ 0x9670b12bu, /* 128 */ 0x7f410000u, /* 129 */ 0x00000006u, /* 130 */ 0xd79f8232u, /* 131 */ 0x8ea3da61u, /* 132 */ 0xe066ebb2u, /* 133 */ 0xf88a0000u, /* 134 */ 0x00000044u, /* 135 */ 0x6c3b15f9u, /* 136 */ 0x926687d2u, /* 137 */ 0xc40534fdu, /* 138 */ 0xb5640000u, /* 139 */ 0x000002acu, /* 140 */ 0x3a4edbbfu, /* 141 */ 0xb8014e3bu, /* 142 */ 0xa83411e9u, /* 143 */ 0x15e80000u, /* 144 */ 0x00001abau, /* 145 */ 0x4714957du, /* 146 */ 0x300d0e54u, /* 147 */ 0x9208b31au, /* 148 */ 0xdb100000u, /* 149 */ 0x00010b46u, /* 150 */ 0xc6cdd6e3u, /* 151 */ 0xe0828f4du, /* 152 */ 0xb456ff0cu, /* 153 */ 0x8ea00000u, /* 154 */ 0x000a70c3u, /* 155 */ 0xc40a64e6u, /* 156 */ 0xc5199909u, /* 157 */ 0x0b65f67du, /* 158 */ 0x92400000u, /* 159 */ 0x006867a5u, /* 160 */ 0xa867f103u, /* 161 */ 0xb2fffa5au, /* 162 */ 0x71fba0e7u, /* 163 */ 0xb6800000u, /* 164 */ 0x04140c78u, /* 165 */ 0x940f6a24u, /* 166 */ 0xfdffc788u, /* 167 */ 0x73d4490du, /* 168 */ 0x21000000u, /* 169 */ 0x28c87cb5u, /* 170 */ 0xc89a2571u, /* 171 */ 0xebfdcb54u, /* 172 */ 0x864ada83u, /* 173 */ 0x4a000000u, /* 174 */ 0x00000001u, /* 175 */ 0x97d4df19u, /* 176 */ 0xd6057673u, /* 177 */ 0x37e9f14du, /* 178 */ 0x3eec8920u, /* 179 */ 0xe4000000u, /* 180 */ 0x0000000fu, /* 181 */ 0xee50b702u, /* 182 */ 0x5c36a080u, /* 183 */ 0x2f236d04u, /* 184 */ 0x753d5b48u, /* 185 */ 0xe8000000u, /* 186 */ 0x0000009fu, /* 187 */ 0x4f272617u, /* 188 */ 0x9a224501u, /* 189 */ 0xd762422cu, /* 190 */ 0x946590d9u, /* 191 */ 0x10000000u, /* 192 */ 0x00000639u, /* 193 */ 0x17877cecu, /* 194 */ 0x0556b212u, /* 195 */ 0x69d695bdu, /* 196 */ 0xcbf7a87au, /* 197 */ 0xa0000000u, /* 198 */ 0x00003e3au, /* 199 */ 0xeb4ae138u, /* 200 */ 0x3562f4b8u, /* 201 */ 0x2261d969u, /* 202 */ 0xf7ac94cau, /* 203 */ 0x40000000u, /* 204 */ 0x00026e4du, /* 205 */ 0x30eccc32u, /* 206 */ 0x15dd8f31u, /* 207 */ 0x57d27e23u, /* 208 */ 0xacbdcfe6u, /* 209 */ 0x80000000u, /* 210 */ 0x00184f03u, /* 211 */ 0xe93ff9f4u, /* 212 */ 0xdaa797edu, /* 213 */ 0x6e38ed64u, /* 214 */ 0xbf6a1f01u, /* 215 */ 0x00f31627u, /* 216 */ 0x1c7fc390u, /* 217 */ 0x8a8bef46u, /* 218 */ 0x4e3945efu, /* 219 */ 0x7a25360au, /* 220 */ 0x097edd87u, /* 221 */ 0x1cfda3a5u, /* 222 */ 0x697758bfu, /* 223 */ 0x0e3cbb5au, /* 224 */ 0xc5741c64u, /* 225 */ 0x5ef4a747u, /* 226 */ 0x21e86476u, /* 227 */ 0x1ea97776u, /* 228 */ 0x8e5f518bu, /* 229 */ 0xb6891be8u, /* 230 */ 0x00000003u, /* 231 */ 0xb58e88c7u, /* 232 */ 0x5313ec9du, /* 233 */ 0x329eaaa1u, /* 234 */ 0x8fb92f75u, /* 235 */ 0x215b1710u, /* 236 */ 0x00000025u, /* 237 */ 0x179157c9u, /* 238 */ 0x3ec73e23u, /* 239 */ 0xfa32aa4fu, /* 240 */ 0x9d3bda93u, /* 241 */ 0x4d8ee6a0u, /* 242 */ 0x00000172u, /* 243 */ 0xebad6ddcu, /* 244 */ 0x73c86d67u, /* 245 */ 0xc5faa71cu, /* 246 */ 0x245689c1u, /* 247 */ 0x07950240u, /* 248 */ 0x00000e7du, /* 249 */ 0x34c64a9cu, /* 250 */ 0x85d4460du, /* 251 */ 0xbbca8719u, /* 252 */ 0x6b61618au, /* 253 */ 0x4bd21680u, /* 254 */ 0x000090e4u, /* 255 */ 0x0fbeea1du, /* 256 */ 0x3a4abc89u, /* 257 */ 0x55e946feu, /* 258 */ 0x31cdcf66u, /* 259 */ 0xf634e100u, /* 260 */ 0x0005a8e8u, /* 261 */ 0x9d752524u, /* 262 */ 0x46eb5d5du, /* 263 */ 0x5b1cc5edu, /* 264 */ 0xf20a1a05u, /* 265 */ 0x9e10ca00u, /* 266 */ 0x00389916u, /* 267 */ 0x2693736au, /* 268 */ 0xc531a5a5u, /* 269 */ 0x8f1fbb4bu, /* 270 */ 0x74650438u, /* 271 */ 0x2ca7e400u, /* 272 */ 0x0235faddu, /* 273 */ 0x81c2822bu, /* 274 */ 0xb3f07877u, /* 275 */ 0x973d50f2u, /* 276 */ 0x8bf22a31u, /* 277 */ 0xbe8ee800u, /* 278 */ 0x161bcca7u, /* 279 */ 0x119915b5u, /* 280 */ 0x0764b4abu, /* 281 */ 0xe8652979u, /* 282 */ 0x7775a5f1u, /* 283 */ 0x71951000u, /* 284 */ 0xdd15fe86u, /* 285 */ 0xaffad912u, /* 286 */ 0x49ef0eb7u, /* 287 */ 0x13f39ebeu, /* 288 */ 0xaa987b6eu, /* 289 */ 0x6fd2a000u, /* 290 */ }; freetds-1.3.6/src/tds/tds_types.h000644 025423 025423 00000114550 14162303405 020357 0ustar00fredianofrediano000000 000000 /* * This file produced from ./types.pl */ /** * Return the number of bytes needed by specified type. */ int tds_get_size_by_type(TDS_SERVER_TYPE servertype) { switch (servertype) { case SYBVOID: return 0; case SYBBIT: case SYBBITN: case SYBINT1: case SYBSINT1: case SYBUINT1: return 1; case SYBINT2: case SYBUINT2: return 2; case SYBMSDATE: return 3; case SYBDATE: case SYBDATEN: case SYBDATETIME4: case SYBINT4: case SYBMONEY4: case SYBREAL: case SYBTIME: case SYBTIMEN: case SYBUINT4: return 4; case SYB5BIGDATETIME: case SYB5BIGTIME: case SYB5INT8: case SYBDATETIME: case SYBFLT8: case SYBINT8: case SYBINTERVAL: case SYBMONEY: case SYBUINT8: return 8; case SYBUNIQUE: return 16; default: return 0; } } /** * tds_get_varint_size() returns the size of a variable length integer * returned in a result string */ int tds_get_varint_size(TDSCONNECTION * conn, int datatype) { switch (datatype) { case SYBBIT: case SYBDATETIME: case SYBDATETIME4: case SYBFLT8: case SYBINT1: case SYBINT2: case SYBINT4: case SYBMONEY: case SYBMONEY4: case SYBREAL: case SYBVOID: return 0; case SYBIMAGE: case SYBTEXT: return 4; } if (IS_TDS7_PLUS(conn)) { switch (datatype) { case SYBINT8: return 0; case XSYBBINARY: case XSYBCHAR: case XSYBNCHAR: case XSYBNVARCHAR: case XSYBVARBINARY: case XSYBVARCHAR: return 2; case SYBNTEXT: case SYBVARIANT: return 4; case SYBMSUDT: case SYBMSXML: return 8; } } else if (IS_TDS50(conn)) { switch (datatype) { case SYB5INT8: case SYBDATE: case SYBINTERVAL: case SYBSINT1: case SYBTIME: case SYBUINT1: case SYBUINT2: case SYBUINT4: case SYBUINT8: return 0; case SYBUNITEXT: case SYBXML: return 4; case SYBLONGBINARY: case SYBLONGCHAR: return 5; } } return 1; } /** * Return type suitable for conversions (convert all nullable types to fixed type) * @param srctype type to convert * @param colsize size of type * @result type for conversion */ TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize) { switch (srctype) { case SYBBITN: return SYBBIT; case SYBDATEN: return SYBDATE; case SYBDATETIMN: switch (colsize) { case 8: return SYBDATETIME; case 4: return SYBDATETIME4; } break; case SYBFLTN: switch (colsize) { case 8: return SYBFLT8; case 4: return SYBREAL; } break; case SYBINTN: switch (colsize) { case 8: return SYBINT8; case 4: return SYBINT4; case 2: return SYBINT2; case 1: return SYBINT1; } break; case SYBMONEYN: switch (colsize) { case 8: return SYBMONEY; case 4: return SYBMONEY4; } break; case SYBTIMEN: return SYBTIME; case SYBUINTN: switch (colsize) { case 8: return SYBUINT8; case 4: return SYBUINT4; case 2: return SYBUINT2; case 1: return SYBUINT1; } break; case SYB5INT8: return SYBINT8; default: break; } return srctype; } const uint16_t tds_type_flags_ms[256] = { /* 0 empty */ TDS_TYPEFLAG_INVALID, /* 1 empty */ TDS_TYPEFLAG_INVALID, /* 2 empty */ TDS_TYPEFLAG_INVALID, /* 3 empty */ TDS_TYPEFLAG_INVALID, /* 4 empty */ TDS_TYPEFLAG_INVALID, /* 5 empty */ TDS_TYPEFLAG_INVALID, /* 6 empty */ TDS_TYPEFLAG_INVALID, /* 7 empty */ TDS_TYPEFLAG_INVALID, /* 8 empty */ TDS_TYPEFLAG_INVALID, /* 9 empty */ TDS_TYPEFLAG_INVALID, /* 10 empty */ TDS_TYPEFLAG_INVALID, /* 11 empty */ TDS_TYPEFLAG_INVALID, /* 12 empty */ TDS_TYPEFLAG_INVALID, /* 13 empty */ TDS_TYPEFLAG_INVALID, /* 14 empty */ TDS_TYPEFLAG_INVALID, /* 15 empty */ TDS_TYPEFLAG_INVALID, /* 16 empty */ TDS_TYPEFLAG_INVALID, /* 17 empty */ TDS_TYPEFLAG_INVALID, /* 18 empty */ TDS_TYPEFLAG_INVALID, /* 19 empty */ TDS_TYPEFLAG_INVALID, /* 20 empty */ TDS_TYPEFLAG_INVALID, /* 21 empty */ TDS_TYPEFLAG_INVALID, /* 22 empty */ TDS_TYPEFLAG_INVALID, /* 23 empty */ TDS_TYPEFLAG_INVALID, /* 24 empty */ TDS_TYPEFLAG_INVALID, /* 25 empty */ TDS_TYPEFLAG_INVALID, /* 26 empty */ TDS_TYPEFLAG_INVALID, /* 27 empty */ TDS_TYPEFLAG_INVALID, /* 28 empty */ TDS_TYPEFLAG_INVALID, /* 29 empty */ TDS_TYPEFLAG_INVALID, /* 30 empty */ TDS_TYPEFLAG_INVALID, /* 31 SYBVOID */ TDS_TYPEFLAG_FIXED, /* 32 empty */ TDS_TYPEFLAG_INVALID, /* 33 empty */ TDS_TYPEFLAG_INVALID, /* 34 SYBIMAGE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY, /* 35 SYBTEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII, /* 36 SYBUNIQUE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 37 SYBVARBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT, /* 38 SYBINTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT, /* 39 SYBVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT, /* 40 SYBMSDATE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 41 SYBMSTIME */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 42 SYBMSDATETIME2 */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 43 SYBMSDATETIMEOFFSET */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 44 empty */ TDS_TYPEFLAG_INVALID, /* 45 SYBBINARY */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT, /* 46 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 47 SYBCHAR */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT, /* 48 SYBINT1 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 49 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME, /* 50 SYBBIT */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 51 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME, /* 52 SYBINT2 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 53 empty */ TDS_TYPEFLAG_INVALID, /* 54 empty */ TDS_TYPEFLAG_INVALID, /* 55 empty */ TDS_TYPEFLAG_INVALID, /* 56 SYBINT4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 57 empty */ TDS_TYPEFLAG_INVALID, /* 58 SYBDATETIME4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 59 SYBREAL */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 60 SYBMONEY */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 61 SYBDATETIME */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 62 SYBFLT8 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 63 empty */ TDS_TYPEFLAG_INVALID, /* 64 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 65 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 66 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 67 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 68 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE, /* 69 empty */ TDS_TYPEFLAG_INVALID, /* 70 empty */ TDS_TYPEFLAG_INVALID, /* 71 empty */ TDS_TYPEFLAG_INVALID, /* 72 empty */ TDS_TYPEFLAG_INVALID, /* 73 empty */ TDS_TYPEFLAG_INVALID, /* 74 empty */ TDS_TYPEFLAG_INVALID, /* 75 empty */ TDS_TYPEFLAG_INVALID, /* 76 empty */ TDS_TYPEFLAG_INVALID, /* 77 empty */ TDS_TYPEFLAG_INVALID, /* 78 empty */ TDS_TYPEFLAG_INVALID, /* 79 empty */ TDS_TYPEFLAG_INVALID, /* 80 empty */ TDS_TYPEFLAG_INVALID, /* 81 empty */ TDS_TYPEFLAG_INVALID, /* 82 empty */ TDS_TYPEFLAG_INVALID, /* 83 empty */ TDS_TYPEFLAG_INVALID, /* 84 empty */ TDS_TYPEFLAG_INVALID, /* 85 empty */ TDS_TYPEFLAG_INVALID, /* 86 empty */ TDS_TYPEFLAG_INVALID, /* 87 empty */ TDS_TYPEFLAG_INVALID, /* 88 empty */ TDS_TYPEFLAG_INVALID, /* 89 empty */ TDS_TYPEFLAG_INVALID, /* 90 empty */ TDS_TYPEFLAG_INVALID, /* 91 empty */ TDS_TYPEFLAG_INVALID, /* 92 empty */ TDS_TYPEFLAG_INVALID, /* 93 empty */ TDS_TYPEFLAG_INVALID, /* 94 empty */ TDS_TYPEFLAG_INVALID, /* 95 empty */ TDS_TYPEFLAG_INVALID, /* 96 empty */ TDS_TYPEFLAG_INVALID, /* 97 empty */ TDS_TYPEFLAG_INVALID, /* 98 SYBVARIANT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE, /* 99 SYBNTEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_UNICODE, /* 100 empty */ TDS_TYPEFLAG_INVALID, /* 101 empty */ TDS_TYPEFLAG_INVALID, /* 102 empty */ TDS_TYPEFLAG_INVALID, /* 103 SYBNVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE|TDS_TYPEFLAG_VARIANT, /* 104 SYBBITN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT, /* 105 empty */ TDS_TYPEFLAG_INVALID, /* 106 SYBDECIMAL */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT, /* 107 empty */ TDS_TYPEFLAG_INVALID, /* 108 SYBNUMERIC */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT, /* 109 SYBFLTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT, /* 110 SYBMONEYN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT, /* 111 SYBDATETIMN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 112 empty */ TDS_TYPEFLAG_INVALID, /* 113 empty */ TDS_TYPEFLAG_INVALID, /* 114 empty */ TDS_TYPEFLAG_INVALID, /* 115 empty */ TDS_TYPEFLAG_INVALID, /* 116 empty */ TDS_TYPEFLAG_INVALID, /* 117 empty */ TDS_TYPEFLAG_INVALID, /* 118 empty */ TDS_TYPEFLAG_INVALID, /* 119 empty */ TDS_TYPEFLAG_INVALID, /* 120 empty */ TDS_TYPEFLAG_INVALID, /* 121 empty */ TDS_TYPEFLAG_INVALID, /* 122 SYBMONEY4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 123 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 124 empty */ TDS_TYPEFLAG_INVALID, /* 125 empty */ TDS_TYPEFLAG_INVALID, /* 126 empty */ TDS_TYPEFLAG_INVALID, /* 127 SYBINT8 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 128 empty */ TDS_TYPEFLAG_INVALID, /* 129 empty */ TDS_TYPEFLAG_INVALID, /* 130 empty */ TDS_TYPEFLAG_INVALID, /* 131 empty */ TDS_TYPEFLAG_INVALID, /* 132 empty */ TDS_TYPEFLAG_INVALID, /* 133 empty */ TDS_TYPEFLAG_INVALID, /* 134 empty */ TDS_TYPEFLAG_INVALID, /* 135 empty */ TDS_TYPEFLAG_INVALID, /* 136 empty */ TDS_TYPEFLAG_INVALID, /* 137 empty */ TDS_TYPEFLAG_INVALID, /* 138 empty */ TDS_TYPEFLAG_INVALID, /* 139 empty */ TDS_TYPEFLAG_INVALID, /* 140 empty */ TDS_TYPEFLAG_INVALID, /* 141 empty */ TDS_TYPEFLAG_INVALID, /* 142 empty */ TDS_TYPEFLAG_INVALID, /* 143 empty */ TDS_TYPEFLAG_INVALID, /* 144 empty */ TDS_TYPEFLAG_INVALID, /* 145 empty */ TDS_TYPEFLAG_INVALID, /* 146 empty */ TDS_TYPEFLAG_INVALID, /* 147 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 148 empty */ TDS_TYPEFLAG_INVALID, /* 149 empty */ TDS_TYPEFLAG_INVALID, /* 150 empty */ TDS_TYPEFLAG_INVALID, /* 151 empty */ TDS_TYPEFLAG_INVALID, /* 152 empty */ TDS_TYPEFLAG_INVALID, /* 153 empty */ TDS_TYPEFLAG_INVALID, /* 154 empty */ TDS_TYPEFLAG_INVALID, /* 155 empty */ TDS_TYPEFLAG_INVALID, /* 156 empty */ TDS_TYPEFLAG_INVALID, /* 157 empty */ TDS_TYPEFLAG_INVALID, /* 158 empty */ TDS_TYPEFLAG_INVALID, /* 159 empty */ TDS_TYPEFLAG_INVALID, /* 160 empty */ TDS_TYPEFLAG_INVALID, /* 161 empty */ TDS_TYPEFLAG_INVALID, /* 162 empty */ TDS_TYPEFLAG_INVALID, /* 163 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE, /* 164 empty */ TDS_TYPEFLAG_INVALID, /* 165 XSYBVARBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT, /* 166 empty */ TDS_TYPEFLAG_INVALID, /* 167 XSYBVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT, /* 168 empty */ TDS_TYPEFLAG_INVALID, /* 169 empty */ TDS_TYPEFLAG_INVALID, /* 170 empty */ TDS_TYPEFLAG_INVALID, /* 171 empty */ TDS_TYPEFLAG_INVALID, /* 172 empty */ TDS_TYPEFLAG_INVALID, /* 173 XSYBBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT, /* 174 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE, /* 175 XSYBCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT, /* 176 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 177 empty */ TDS_TYPEFLAG_INVALID, /* 178 empty */ TDS_TYPEFLAG_INVALID, /* 179 empty */ TDS_TYPEFLAG_INVALID, /* 180 empty */ TDS_TYPEFLAG_INVALID, /* 181 empty */ TDS_TYPEFLAG_INVALID, /* 182 empty */ TDS_TYPEFLAG_INVALID, /* 183 empty */ TDS_TYPEFLAG_INVALID, /* 184 empty */ TDS_TYPEFLAG_INVALID, /* 185 empty */ TDS_TYPEFLAG_INVALID, /* 186 empty */ TDS_TYPEFLAG_INVALID, /* 187 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 188 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 189 empty */ TDS_TYPEFLAG_INVALID, /* 190 empty */ TDS_TYPEFLAG_INVALID, /* 191 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 192 empty */ TDS_TYPEFLAG_INVALID, /* 193 empty */ TDS_TYPEFLAG_INVALID, /* 194 empty */ TDS_TYPEFLAG_INVALID, /* 195 empty */ TDS_TYPEFLAG_INVALID, /* 196 empty */ TDS_TYPEFLAG_INVALID, /* 197 empty */ TDS_TYPEFLAG_INVALID, /* 198 empty */ TDS_TYPEFLAG_INVALID, /* 199 empty */ TDS_TYPEFLAG_INVALID, /* 200 empty */ TDS_TYPEFLAG_INVALID, /* 201 empty */ TDS_TYPEFLAG_INVALID, /* 202 empty */ TDS_TYPEFLAG_INVALID, /* 203 empty */ TDS_TYPEFLAG_INVALID, /* 204 empty */ TDS_TYPEFLAG_INVALID, /* 205 empty */ TDS_TYPEFLAG_INVALID, /* 206 empty */ TDS_TYPEFLAG_INVALID, /* 207 empty */ TDS_TYPEFLAG_INVALID, /* 208 empty */ TDS_TYPEFLAG_INVALID, /* 209 empty */ TDS_TYPEFLAG_INVALID, /* 210 empty */ TDS_TYPEFLAG_INVALID, /* 211 empty */ TDS_TYPEFLAG_INVALID, /* 212 empty */ TDS_TYPEFLAG_INVALID, /* 213 empty */ TDS_TYPEFLAG_INVALID, /* 214 empty */ TDS_TYPEFLAG_INVALID, /* 215 empty */ TDS_TYPEFLAG_INVALID, /* 216 empty */ TDS_TYPEFLAG_INVALID, /* 217 empty */ TDS_TYPEFLAG_INVALID, /* 218 empty */ TDS_TYPEFLAG_INVALID, /* 219 empty */ TDS_TYPEFLAG_INVALID, /* 220 empty */ TDS_TYPEFLAG_INVALID, /* 221 empty */ TDS_TYPEFLAG_INVALID, /* 222 empty */ TDS_TYPEFLAG_INVALID, /* 223 empty */ TDS_TYPEFLAG_INVALID, /* 224 empty */ TDS_TYPEFLAG_INVALID, /* 225 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY, /* 226 empty */ TDS_TYPEFLAG_INVALID, /* 227 empty */ TDS_TYPEFLAG_INVALID, /* 228 empty */ TDS_TYPEFLAG_INVALID, /* 229 empty */ TDS_TYPEFLAG_INVALID, /* 230 empty */ TDS_TYPEFLAG_INVALID, /* 231 XSYBNVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_UNICODE|TDS_TYPEFLAG_VARIANT, /* 232 empty */ TDS_TYPEFLAG_INVALID, /* 233 empty */ TDS_TYPEFLAG_INVALID, /* 234 empty */ TDS_TYPEFLAG_INVALID, /* 235 empty */ TDS_TYPEFLAG_INVALID, /* 236 empty */ TDS_TYPEFLAG_INVALID, /* 237 empty */ TDS_TYPEFLAG_INVALID, /* 238 empty */ TDS_TYPEFLAG_INVALID, /* 239 XSYBNCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_UNICODE|TDS_TYPEFLAG_VARIANT, /* 240 SYBMSUDT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE, /* 241 SYBMSXML */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE, /* 242 empty */ TDS_TYPEFLAG_INVALID, /* 243 empty */ TDS_TYPEFLAG_INVALID, /* 244 empty */ TDS_TYPEFLAG_INVALID, /* 245 empty */ TDS_TYPEFLAG_INVALID, /* 246 empty */ TDS_TYPEFLAG_INVALID, /* 247 empty */ TDS_TYPEFLAG_INVALID, /* 248 empty */ TDS_TYPEFLAG_INVALID, /* 249 empty */ TDS_TYPEFLAG_INVALID, /* 250 empty */ TDS_TYPEFLAG_INVALID, /* 251 empty */ TDS_TYPEFLAG_INVALID, /* 252 empty */ TDS_TYPEFLAG_INVALID, /* 253 empty */ TDS_TYPEFLAG_INVALID, /* 254 empty */ TDS_TYPEFLAG_INVALID, /* 255 empty */ TDS_TYPEFLAG_INVALID, }; #if 0 const uint16_t tds_type_flags_syb[256] = { /* 0 empty */ TDS_TYPEFLAG_INVALID, /* 1 empty */ TDS_TYPEFLAG_INVALID, /* 2 empty */ TDS_TYPEFLAG_INVALID, /* 3 empty */ TDS_TYPEFLAG_INVALID, /* 4 empty */ TDS_TYPEFLAG_INVALID, /* 5 empty */ TDS_TYPEFLAG_INVALID, /* 6 empty */ TDS_TYPEFLAG_INVALID, /* 7 empty */ TDS_TYPEFLAG_INVALID, /* 8 empty */ TDS_TYPEFLAG_INVALID, /* 9 empty */ TDS_TYPEFLAG_INVALID, /* 10 empty */ TDS_TYPEFLAG_INVALID, /* 11 empty */ TDS_TYPEFLAG_INVALID, /* 12 empty */ TDS_TYPEFLAG_INVALID, /* 13 empty */ TDS_TYPEFLAG_INVALID, /* 14 empty */ TDS_TYPEFLAG_INVALID, /* 15 empty */ TDS_TYPEFLAG_INVALID, /* 16 empty */ TDS_TYPEFLAG_INVALID, /* 17 empty */ TDS_TYPEFLAG_INVALID, /* 18 empty */ TDS_TYPEFLAG_INVALID, /* 19 empty */ TDS_TYPEFLAG_INVALID, /* 20 empty */ TDS_TYPEFLAG_INVALID, /* 21 empty */ TDS_TYPEFLAG_INVALID, /* 22 empty */ TDS_TYPEFLAG_INVALID, /* 23 empty */ TDS_TYPEFLAG_INVALID, /* 24 empty */ TDS_TYPEFLAG_INVALID, /* 25 empty */ TDS_TYPEFLAG_INVALID, /* 26 empty */ TDS_TYPEFLAG_INVALID, /* 27 empty */ TDS_TYPEFLAG_INVALID, /* 28 empty */ TDS_TYPEFLAG_INVALID, /* 29 empty */ TDS_TYPEFLAG_INVALID, /* 30 empty */ TDS_TYPEFLAG_INVALID, /* 31 SYBVOID */ TDS_TYPEFLAG_FIXED, /* 32 empty */ TDS_TYPEFLAG_INVALID, /* 33 empty */ TDS_TYPEFLAG_INVALID, /* 34 SYBIMAGE */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY, /* 35 SYBTEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_COLLATE|TDS_TYPEFLAG_ASCII, /* 36 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_NULLABLE, /* 37 SYBVARBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT, /* 38 SYBINTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT, /* 39 SYBVARCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT, /* 40 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 41 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 42 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 43 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 44 empty */ TDS_TYPEFLAG_INVALID, /* 45 SYBBINARY */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY|TDS_TYPEFLAG_VARIANT, /* 46 SYBINTERVAL */ TDS_TYPEFLAG_FIXED, /* 47 SYBCHAR */ TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_VARIANT, /* 48 SYBINT1 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 49 SYBDATE */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME, /* 50 SYBBIT */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 51 SYBTIME */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME, /* 52 SYBINT2 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 53 empty */ TDS_TYPEFLAG_INVALID, /* 54 empty */ TDS_TYPEFLAG_INVALID, /* 55 empty */ TDS_TYPEFLAG_INVALID, /* 56 SYBINT4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 57 empty */ TDS_TYPEFLAG_INVALID, /* 58 SYBDATETIME4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 59 SYBREAL */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 60 SYBMONEY */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 61 SYBDATETIME */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 62 SYBFLT8 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 63 empty */ TDS_TYPEFLAG_INVALID, /* 64 SYBUINT1 */ TDS_TYPEFLAG_FIXED, /* 65 SYBUINT2 */ TDS_TYPEFLAG_FIXED, /* 66 SYBUINT4 */ TDS_TYPEFLAG_FIXED, /* 67 SYBUINT8 */ TDS_TYPEFLAG_FIXED, /* 68 SYBUINTN */ TDS_TYPEFLAG_NULLABLE, /* 69 empty */ TDS_TYPEFLAG_INVALID, /* 70 empty */ TDS_TYPEFLAG_INVALID, /* 71 empty */ TDS_TYPEFLAG_INVALID, /* 72 empty */ TDS_TYPEFLAG_INVALID, /* 73 empty */ TDS_TYPEFLAG_INVALID, /* 74 empty */ TDS_TYPEFLAG_INVALID, /* 75 empty */ TDS_TYPEFLAG_INVALID, /* 76 empty */ TDS_TYPEFLAG_INVALID, /* 77 empty */ TDS_TYPEFLAG_INVALID, /* 78 empty */ TDS_TYPEFLAG_INVALID, /* 79 empty */ TDS_TYPEFLAG_INVALID, /* 80 empty */ TDS_TYPEFLAG_INVALID, /* 81 empty */ TDS_TYPEFLAG_INVALID, /* 82 empty */ TDS_TYPEFLAG_INVALID, /* 83 empty */ TDS_TYPEFLAG_INVALID, /* 84 empty */ TDS_TYPEFLAG_INVALID, /* 85 empty */ TDS_TYPEFLAG_INVALID, /* 86 empty */ TDS_TYPEFLAG_INVALID, /* 87 empty */ TDS_TYPEFLAG_INVALID, /* 88 empty */ TDS_TYPEFLAG_INVALID, /* 89 empty */ TDS_TYPEFLAG_INVALID, /* 90 empty */ TDS_TYPEFLAG_INVALID, /* 91 empty */ TDS_TYPEFLAG_INVALID, /* 92 empty */ TDS_TYPEFLAG_INVALID, /* 93 empty */ TDS_TYPEFLAG_INVALID, /* 94 empty */ TDS_TYPEFLAG_INVALID, /* 95 empty */ TDS_TYPEFLAG_INVALID, /* 96 empty */ TDS_TYPEFLAG_INVALID, /* 97 empty */ TDS_TYPEFLAG_INVALID, /* 98 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE, /* 99 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE, /* 100 empty */ TDS_TYPEFLAG_INVALID, /* 101 empty */ TDS_TYPEFLAG_INVALID, /* 102 empty */ TDS_TYPEFLAG_INVALID, /* 103 SYBSENSITIVITY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII, /* 104 SYBBOUNDARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII, /* 105 empty */ TDS_TYPEFLAG_INVALID, /* 106 SYBDECIMAL */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT, /* 107 empty */ TDS_TYPEFLAG_INVALID, /* 108 SYBNUMERIC */ TDS_TYPEFLAG_NUMERIC|TDS_TYPEFLAG_VARIANT, /* 109 SYBFLTN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT, /* 110 SYBMONEYN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIANT, /* 111 SYBDATETIMN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME|TDS_TYPEFLAG_VARIANT, /* 112 empty */ TDS_TYPEFLAG_INVALID, /* 113 empty */ TDS_TYPEFLAG_INVALID, /* 114 empty */ TDS_TYPEFLAG_INVALID, /* 115 empty */ TDS_TYPEFLAG_INVALID, /* 116 empty */ TDS_TYPEFLAG_INVALID, /* 117 empty */ TDS_TYPEFLAG_INVALID, /* 118 empty */ TDS_TYPEFLAG_INVALID, /* 119 empty */ TDS_TYPEFLAG_INVALID, /* 120 empty */ TDS_TYPEFLAG_INVALID, /* 121 empty */ TDS_TYPEFLAG_INVALID, /* 122 SYBMONEY4 */ TDS_TYPEFLAG_FIXED|TDS_TYPEFLAG_VARIANT, /* 123 SYBDATEN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 124 empty */ TDS_TYPEFLAG_INVALID, /* 125 empty */ TDS_TYPEFLAG_INVALID, /* 126 empty */ TDS_TYPEFLAG_INVALID, /* 127 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_FIXED, /* 128 empty */ TDS_TYPEFLAG_INVALID, /* 129 empty */ TDS_TYPEFLAG_INVALID, /* 130 empty */ TDS_TYPEFLAG_INVALID, /* 131 empty */ TDS_TYPEFLAG_INVALID, /* 132 empty */ TDS_TYPEFLAG_INVALID, /* 133 empty */ TDS_TYPEFLAG_INVALID, /* 134 empty */ TDS_TYPEFLAG_INVALID, /* 135 empty */ TDS_TYPEFLAG_INVALID, /* 136 empty */ TDS_TYPEFLAG_INVALID, /* 137 empty */ TDS_TYPEFLAG_INVALID, /* 138 empty */ TDS_TYPEFLAG_INVALID, /* 139 empty */ TDS_TYPEFLAG_INVALID, /* 140 empty */ TDS_TYPEFLAG_INVALID, /* 141 empty */ TDS_TYPEFLAG_INVALID, /* 142 empty */ TDS_TYPEFLAG_INVALID, /* 143 empty */ TDS_TYPEFLAG_INVALID, /* 144 empty */ TDS_TYPEFLAG_INVALID, /* 145 empty */ TDS_TYPEFLAG_INVALID, /* 146 empty */ TDS_TYPEFLAG_INVALID, /* 147 SYBTIMEN */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 148 empty */ TDS_TYPEFLAG_INVALID, /* 149 empty */ TDS_TYPEFLAG_INVALID, /* 150 empty */ TDS_TYPEFLAG_INVALID, /* 151 empty */ TDS_TYPEFLAG_INVALID, /* 152 empty */ TDS_TYPEFLAG_INVALID, /* 153 empty */ TDS_TYPEFLAG_INVALID, /* 154 empty */ TDS_TYPEFLAG_INVALID, /* 155 empty */ TDS_TYPEFLAG_INVALID, /* 156 empty */ TDS_TYPEFLAG_INVALID, /* 157 empty */ TDS_TYPEFLAG_INVALID, /* 158 empty */ TDS_TYPEFLAG_INVALID, /* 159 empty */ TDS_TYPEFLAG_INVALID, /* 160 empty */ TDS_TYPEFLAG_INVALID, /* 161 empty */ TDS_TYPEFLAG_INVALID, /* 162 empty */ TDS_TYPEFLAG_INVALID, /* 163 SYBXML */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE, /* 164 empty */ TDS_TYPEFLAG_INVALID, /* 165 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY, /* 166 empty */ TDS_TYPEFLAG_INVALID, /* 167 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE, /* 168 empty */ TDS_TYPEFLAG_INVALID, /* 169 empty */ TDS_TYPEFLAG_INVALID, /* 170 empty */ TDS_TYPEFLAG_INVALID, /* 171 empty */ TDS_TYPEFLAG_INVALID, /* 172 empty */ TDS_TYPEFLAG_INVALID, /* 173 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY, /* 174 SYBUNITEXT */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE, /* 175 SYBLONGCHAR */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_ASCII, /* 176 SYBSINT1 */ TDS_TYPEFLAG_FIXED, /* 177 empty */ TDS_TYPEFLAG_INVALID, /* 178 empty */ TDS_TYPEFLAG_INVALID, /* 179 empty */ TDS_TYPEFLAG_INVALID, /* 180 empty */ TDS_TYPEFLAG_INVALID, /* 181 empty */ TDS_TYPEFLAG_INVALID, /* 182 empty */ TDS_TYPEFLAG_INVALID, /* 183 empty */ TDS_TYPEFLAG_INVALID, /* 184 empty */ TDS_TYPEFLAG_INVALID, /* 185 empty */ TDS_TYPEFLAG_INVALID, /* 186 empty */ TDS_TYPEFLAG_INVALID, /* 187 SYB5BIGDATETIME */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 188 SYB5BIGTIME */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_DATETIME, /* 189 empty */ TDS_TYPEFLAG_INVALID, /* 190 empty */ TDS_TYPEFLAG_INVALID, /* 191 SYB5INT8 */ TDS_TYPEFLAG_FIXED, /* 192 empty */ TDS_TYPEFLAG_INVALID, /* 193 empty */ TDS_TYPEFLAG_INVALID, /* 194 empty */ TDS_TYPEFLAG_INVALID, /* 195 empty */ TDS_TYPEFLAG_INVALID, /* 196 empty */ TDS_TYPEFLAG_INVALID, /* 197 empty */ TDS_TYPEFLAG_INVALID, /* 198 empty */ TDS_TYPEFLAG_INVALID, /* 199 empty */ TDS_TYPEFLAG_INVALID, /* 200 empty */ TDS_TYPEFLAG_INVALID, /* 201 empty */ TDS_TYPEFLAG_INVALID, /* 202 empty */ TDS_TYPEFLAG_INVALID, /* 203 empty */ TDS_TYPEFLAG_INVALID, /* 204 empty */ TDS_TYPEFLAG_INVALID, /* 205 empty */ TDS_TYPEFLAG_INVALID, /* 206 empty */ TDS_TYPEFLAG_INVALID, /* 207 empty */ TDS_TYPEFLAG_INVALID, /* 208 empty */ TDS_TYPEFLAG_INVALID, /* 209 empty */ TDS_TYPEFLAG_INVALID, /* 210 empty */ TDS_TYPEFLAG_INVALID, /* 211 empty */ TDS_TYPEFLAG_INVALID, /* 212 empty */ TDS_TYPEFLAG_INVALID, /* 213 empty */ TDS_TYPEFLAG_INVALID, /* 214 empty */ TDS_TYPEFLAG_INVALID, /* 215 empty */ TDS_TYPEFLAG_INVALID, /* 216 empty */ TDS_TYPEFLAG_INVALID, /* 217 empty */ TDS_TYPEFLAG_INVALID, /* 218 empty */ TDS_TYPEFLAG_INVALID, /* 219 empty */ TDS_TYPEFLAG_INVALID, /* 220 empty */ TDS_TYPEFLAG_INVALID, /* 221 empty */ TDS_TYPEFLAG_INVALID, /* 222 empty */ TDS_TYPEFLAG_INVALID, /* 223 empty */ TDS_TYPEFLAG_INVALID, /* 224 empty */ TDS_TYPEFLAG_INVALID, /* 225 SYBLONGBINARY */ TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_BINARY, /* 226 empty */ TDS_TYPEFLAG_INVALID, /* 227 empty */ TDS_TYPEFLAG_INVALID, /* 228 empty */ TDS_TYPEFLAG_INVALID, /* 229 empty */ TDS_TYPEFLAG_INVALID, /* 230 empty */ TDS_TYPEFLAG_INVALID, /* 231 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE, /* 232 empty */ TDS_TYPEFLAG_INVALID, /* 233 empty */ TDS_TYPEFLAG_INVALID, /* 234 empty */ TDS_TYPEFLAG_INVALID, /* 235 empty */ TDS_TYPEFLAG_INVALID, /* 236 empty */ TDS_TYPEFLAG_INVALID, /* 237 empty */ TDS_TYPEFLAG_INVALID, /* 238 empty */ TDS_TYPEFLAG_INVALID, /* 239 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE, /* 240 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE, /* 241 empty */ TDS_TYPEFLAG_INVALID|TDS_TYPEFLAG_NULLABLE|TDS_TYPEFLAG_VARIABLE|TDS_TYPEFLAG_UNICODE, /* 242 empty */ TDS_TYPEFLAG_INVALID, /* 243 empty */ TDS_TYPEFLAG_INVALID, /* 244 empty */ TDS_TYPEFLAG_INVALID, /* 245 empty */ TDS_TYPEFLAG_INVALID, /* 246 empty */ TDS_TYPEFLAG_INVALID, /* 247 empty */ TDS_TYPEFLAG_INVALID, /* 248 empty */ TDS_TYPEFLAG_INVALID, /* 249 empty */ TDS_TYPEFLAG_INVALID, /* 250 empty */ TDS_TYPEFLAG_INVALID, /* 251 empty */ TDS_TYPEFLAG_INVALID, /* 252 empty */ TDS_TYPEFLAG_INVALID, /* 253 empty */ TDS_TYPEFLAG_INVALID, /* 254 empty */ TDS_TYPEFLAG_INVALID, /* 255 empty */ TDS_TYPEFLAG_INVALID, }; const char *const tds_type_names[256] = { /* 0 */ "", /* 1 */ "", /* 2 */ "", /* 3 */ "", /* 4 */ "", /* 5 */ "", /* 6 */ "", /* 7 */ "", /* 8 */ "", /* 9 */ "", /* 10 */ "", /* 11 */ "", /* 12 */ "", /* 13 */ "", /* 14 */ "", /* 15 */ "", /* 16 */ "", /* 17 */ "", /* 18 */ "", /* 19 */ "", /* 20 */ "", /* 21 */ "", /* 22 */ "", /* 23 */ "", /* 24 */ "", /* 25 */ "", /* 26 */ "", /* 27 */ "", /* 28 */ "", /* 29 */ "", /* 30 */ "", /* 31 */ "SYBVOID", /* 32 */ "", /* 33 */ "", /* 34 */ "SYBIMAGE", /* 35 */ "SYBTEXT", /* 36 */ "SYBUNIQUE", /* 37 */ "SYBVARBINARY", /* 38 */ "SYBINTN", /* 39 */ "SYBVARCHAR", /* 40 */ "SYBMSDATE", /* 41 */ "SYBMSTIME", /* 42 */ "SYBMSDATETIME2", /* 43 */ "SYBMSDATETIMEOFFSET", /* 44 */ "", /* 45 */ "SYBBINARY", /* 46 */ "SYBINTERVAL", /* 47 */ "SYBCHAR", /* 48 */ "SYBINT1", /* 49 */ "SYBDATE", /* 50 */ "SYBBIT", /* 51 */ "SYBTIME", /* 52 */ "SYBINT2", /* 53 */ "", /* 54 */ "", /* 55 */ "", /* 56 */ "SYBINT4", /* 57 */ "", /* 58 */ "SYBDATETIME4", /* 59 */ "SYBREAL", /* 60 */ "SYBMONEY", /* 61 */ "SYBDATETIME", /* 62 */ "SYBFLT8", /* 63 */ "", /* 64 */ "SYBUINT1", /* 65 */ "SYBUINT2", /* 66 */ "SYBUINT4", /* 67 */ "SYBUINT8", /* 68 */ "SYBUINTN", /* 69 */ "", /* 70 */ "", /* 71 */ "", /* 72 */ "", /* 73 */ "", /* 74 */ "", /* 75 */ "", /* 76 */ "", /* 77 */ "", /* 78 */ "", /* 79 */ "", /* 80 */ "", /* 81 */ "", /* 82 */ "", /* 83 */ "", /* 84 */ "", /* 85 */ "", /* 86 */ "", /* 87 */ "", /* 88 */ "", /* 89 */ "", /* 90 */ "", /* 91 */ "", /* 92 */ "", /* 93 */ "", /* 94 */ "", /* 95 */ "", /* 96 */ "", /* 97 */ "", /* 98 */ "SYBVARIANT", /* 99 */ "SYBNTEXT", /* 100 */ "", /* 101 */ "", /* 102 */ "", /* 103 */ "SYBNVARCHAR or SYBSENSITIVITY", /* 104 */ "SYBBITN or SYBBOUNDARY", /* 105 */ "", /* 106 */ "SYBDECIMAL", /* 107 */ "", /* 108 */ "SYBNUMERIC", /* 109 */ "SYBFLTN", /* 110 */ "SYBMONEYN", /* 111 */ "SYBDATETIMN", /* 112 */ "", /* 113 */ "", /* 114 */ "", /* 115 */ "", /* 116 */ "", /* 117 */ "", /* 118 */ "", /* 119 */ "", /* 120 */ "", /* 121 */ "", /* 122 */ "SYBMONEY4", /* 123 */ "SYBDATEN", /* 124 */ "", /* 125 */ "", /* 126 */ "", /* 127 */ "SYBINT8", /* 128 */ "", /* 129 */ "", /* 130 */ "", /* 131 */ "", /* 132 */ "", /* 133 */ "", /* 134 */ "", /* 135 */ "", /* 136 */ "", /* 137 */ "", /* 138 */ "", /* 139 */ "", /* 140 */ "", /* 141 */ "", /* 142 */ "", /* 143 */ "", /* 144 */ "", /* 145 */ "", /* 146 */ "", /* 147 */ "SYBTIMEN", /* 148 */ "", /* 149 */ "", /* 150 */ "", /* 151 */ "", /* 152 */ "", /* 153 */ "", /* 154 */ "", /* 155 */ "", /* 156 */ "", /* 157 */ "", /* 158 */ "", /* 159 */ "", /* 160 */ "", /* 161 */ "", /* 162 */ "", /* 163 */ "SYBXML", /* 164 */ "", /* 165 */ "XSYBVARBINARY", /* 166 */ "", /* 167 */ "XSYBVARCHAR", /* 168 */ "", /* 169 */ "", /* 170 */ "", /* 171 */ "", /* 172 */ "", /* 173 */ "XSYBBINARY", /* 174 */ "SYBUNITEXT", /* 175 */ "XSYBCHAR or SYBLONGCHAR", /* 176 */ "SYBSINT1", /* 177 */ "", /* 178 */ "", /* 179 */ "", /* 180 */ "", /* 181 */ "", /* 182 */ "", /* 183 */ "", /* 184 */ "", /* 185 */ "", /* 186 */ "", /* 187 */ "SYB5BIGDATETIME", /* 188 */ "SYB5BIGTIME", /* 189 */ "", /* 190 */ "", /* 191 */ "SYB5INT8", /* 192 */ "", /* 193 */ "", /* 194 */ "", /* 195 */ "", /* 196 */ "", /* 197 */ "", /* 198 */ "", /* 199 */ "", /* 200 */ "", /* 201 */ "", /* 202 */ "", /* 203 */ "", /* 204 */ "", /* 205 */ "", /* 206 */ "", /* 207 */ "", /* 208 */ "", /* 209 */ "", /* 210 */ "", /* 211 */ "", /* 212 */ "", /* 213 */ "", /* 214 */ "", /* 215 */ "", /* 216 */ "", /* 217 */ "", /* 218 */ "", /* 219 */ "", /* 220 */ "", /* 221 */ "", /* 222 */ "", /* 223 */ "", /* 224 */ "", /* 225 */ "SYBLONGBINARY", /* 226 */ "", /* 227 */ "", /* 228 */ "", /* 229 */ "", /* 230 */ "", /* 231 */ "XSYBNVARCHAR", /* 232 */ "", /* 233 */ "", /* 234 */ "", /* 235 */ "", /* 236 */ "", /* 237 */ "", /* 238 */ "", /* 239 */ "XSYBNCHAR", /* 240 */ "SYBMSUDT", /* 241 */ "SYBMSXML", /* 242 */ "", /* 243 */ "", /* 244 */ "", /* 245 */ "", /* 246 */ "", /* 247 */ "", /* 248 */ "", /* 249 */ "", /* 250 */ "", /* 251 */ "", /* 252 */ "", /* 253 */ "", /* 254 */ "", /* 255 */ "", }; #endif freetds-1.3.6/src/tds/Makefile.in000644 025423 025423 00000076611 14162303357 020250 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @HAVE_SSPI_TRUE@am__append_1 = sspi.c @HAVE_SSPI_FALSE@am__append_2 = challenge.c subdir = src/tds ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libtds_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libtds_la_SOURCES_DIST = mem.c token.c util.c login.c read.c \ write.c convert.c numeric.c config.c query.c iconv.c locale.c \ vstrbuild.c getmac.c data.c net.c tls.c tds_checks.c log.c \ bulk.c packet.c stream.c random.c sec_negotiate.c \ sec_negotiate_gnutls.h sec_negotiate_openssl.h gssapi.c sspi.c \ challenge.c am__objects_1 = @HAVE_SSPI_TRUE@am__objects_2 = sspi.lo @HAVE_SSPI_FALSE@am__objects_3 = challenge.lo am_libtds_la_OBJECTS = mem.lo token.lo util.lo login.lo read.lo \ write.lo convert.lo numeric.lo config.lo query.lo iconv.lo \ locale.lo vstrbuild.lo getmac.lo data.lo net.lo tls.lo \ tds_checks.lo log.lo bulk.lo packet.lo stream.lo random.lo \ sec_negotiate.lo gssapi.lo $(am__objects_1) $(am__objects_2) \ $(am__objects_3) libtds_la_OBJECTS = $(am_libtds_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libtds_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libtds_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bulk.Plo ./$(DEPDIR)/challenge.Plo \ ./$(DEPDIR)/config.Plo ./$(DEPDIR)/convert.Plo \ ./$(DEPDIR)/data.Plo ./$(DEPDIR)/getmac.Plo \ ./$(DEPDIR)/gssapi.Plo ./$(DEPDIR)/iconv.Plo \ ./$(DEPDIR)/locale.Plo ./$(DEPDIR)/log.Plo \ ./$(DEPDIR)/login.Plo ./$(DEPDIR)/mem.Plo ./$(DEPDIR)/net.Plo \ ./$(DEPDIR)/numeric.Plo ./$(DEPDIR)/packet.Plo \ ./$(DEPDIR)/query.Plo ./$(DEPDIR)/random.Plo \ ./$(DEPDIR)/read.Plo ./$(DEPDIR)/sec_negotiate.Plo \ ./$(DEPDIR)/sspi.Plo ./$(DEPDIR)/stream.Plo \ ./$(DEPDIR)/tds_checks.Plo ./$(DEPDIR)/tls.Plo \ ./$(DEPDIR)/token.Plo ./$(DEPDIR)/util.Plo \ ./$(DEPDIR)/vstrbuild.Plo ./$(DEPDIR)/write.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtds_la_SOURCES) DIST_SOURCES = $(am__libtds_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include noinst_LTLIBRARIES = libtds.la libtds_la_SOURCES = mem.c token.c util.c login.c read.c write.c \ convert.c numeric.c config.c query.c iconv.c locale.c \ vstrbuild.c getmac.c data.c net.c tls.c tds_checks.c log.c \ bulk.c packet.c stream.c random.c sec_negotiate.c \ sec_negotiate_gnutls.h sec_negotiate_openssl.h gssapi.c \ $(NULL) $(am__append_1) $(am__append_2) libtds_la_LDFLAGS = libtds_la_LIBADD = $(NETWORK_LIBS) GENERATED_HEADER_FILES = tds_willconvert.h num_limits.h tds_types.h noinst_HEADERS = $(GENERATED_HEADER_FILES) EXTRA_DIST = $(GENERATED_HEADER_FILES) \ CMakeLists.txt \ challenge.c \ sspi.c \ $(NULL) @HAVE_PERL_SOURCES_TRUE@BUILT_SOURCES = $(GENERATED_HEADER_FILES) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/tds/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/tds/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtds.la: $(libtds_la_OBJECTS) $(libtds_la_DEPENDENCIES) $(EXTRA_libtds_la_DEPENDENCIES) $(AM_V_CCLD)$(libtds_la_LINK) $(libtds_la_OBJECTS) $(libtds_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bulk.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/challenge.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getmac.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gssapi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locale.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/login.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/numeric.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packet.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/query.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sec_negotiate.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sspi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tds_checks.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/token.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vstrbuild.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: installdirs-recursive installdirs-am: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_FALSE@clean-local: clean: clean-recursive clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/bulk.Plo -rm -f ./$(DEPDIR)/challenge.Plo -rm -f ./$(DEPDIR)/config.Plo -rm -f ./$(DEPDIR)/convert.Plo -rm -f ./$(DEPDIR)/data.Plo -rm -f ./$(DEPDIR)/getmac.Plo -rm -f ./$(DEPDIR)/gssapi.Plo -rm -f ./$(DEPDIR)/iconv.Plo -rm -f ./$(DEPDIR)/locale.Plo -rm -f ./$(DEPDIR)/log.Plo -rm -f ./$(DEPDIR)/login.Plo -rm -f ./$(DEPDIR)/mem.Plo -rm -f ./$(DEPDIR)/net.Plo -rm -f ./$(DEPDIR)/numeric.Plo -rm -f ./$(DEPDIR)/packet.Plo -rm -f ./$(DEPDIR)/query.Plo -rm -f ./$(DEPDIR)/random.Plo -rm -f ./$(DEPDIR)/read.Plo -rm -f ./$(DEPDIR)/sec_negotiate.Plo -rm -f ./$(DEPDIR)/sspi.Plo -rm -f ./$(DEPDIR)/stream.Plo -rm -f ./$(DEPDIR)/tds_checks.Plo -rm -f ./$(DEPDIR)/tls.Plo -rm -f ./$(DEPDIR)/token.Plo -rm -f ./$(DEPDIR)/util.Plo -rm -f ./$(DEPDIR)/vstrbuild.Plo -rm -f ./$(DEPDIR)/write.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/bulk.Plo -rm -f ./$(DEPDIR)/challenge.Plo -rm -f ./$(DEPDIR)/config.Plo -rm -f ./$(DEPDIR)/convert.Plo -rm -f ./$(DEPDIR)/data.Plo -rm -f ./$(DEPDIR)/getmac.Plo -rm -f ./$(DEPDIR)/gssapi.Plo -rm -f ./$(DEPDIR)/iconv.Plo -rm -f ./$(DEPDIR)/locale.Plo -rm -f ./$(DEPDIR)/log.Plo -rm -f ./$(DEPDIR)/login.Plo -rm -f ./$(DEPDIR)/mem.Plo -rm -f ./$(DEPDIR)/net.Plo -rm -f ./$(DEPDIR)/numeric.Plo -rm -f ./$(DEPDIR)/packet.Plo -rm -f ./$(DEPDIR)/query.Plo -rm -f ./$(DEPDIR)/random.Plo -rm -f ./$(DEPDIR)/read.Plo -rm -f ./$(DEPDIR)/sec_negotiate.Plo -rm -f ./$(DEPDIR)/sspi.Plo -rm -f ./$(DEPDIR)/stream.Plo -rm -f ./$(DEPDIR)/tds_checks.Plo -rm -f ./$(DEPDIR)/tls.Plo -rm -f ./$(DEPDIR)/token.Plo -rm -f ./$(DEPDIR)/util.Plo -rm -f ./$(DEPDIR)/vstrbuild.Plo -rm -f ./$(DEPDIR)/write.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all check install install-am \ install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic clean-libtool \ clean-local clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Perl is needed to build from a repository checkout. # Perl is *not* needed to build from a tarball. data.c: tds_types.h @HAVE_PERL_SOURCES_TRUE@clean-local: @HAVE_PERL_SOURCES_TRUE@ cd $(srcdir) && rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_TRUE@tds_willconvert.h: tds_willconvert.pl Makefile @HAVE_PERL_SOURCES_TRUE@ perl $(srcdir)/tds_willconvert.pl $(top_srcdir)/include/freetds/proto.h > $@.tmp @HAVE_PERL_SOURCES_TRUE@ mv $@.tmp $@ @HAVE_PERL_SOURCES_TRUE@num_limits.h: num_limits.pl Makefile @HAVE_PERL_SOURCES_TRUE@ perl $(srcdir)/num_limits.pl > $@.tmp @HAVE_PERL_SOURCES_TRUE@ mv $@.tmp $@ @HAVE_PERL_SOURCES_TRUE@tds_types.h: types.pl Makefile $(top_srcdir)/misc/types.csv @HAVE_PERL_SOURCES_TRUE@ perl $(srcdir)/types.pl $(top_srcdir)/misc/types.csv $(top_srcdir)/include/freetds/proto.h > $@.tmp @HAVE_PERL_SOURCES_TRUE@ mv $@.tmp $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/tds/mem.c000644 025423 025423 00000134113 14056414271 017115 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2005-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #include #include #include #include #include #include #if HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_LOCALE_H #include #endif /* HAVE_LOCALE_H */ #ifdef HAVE_LANGINFO_H #include #endif /* HAVE_LANGINFO_H */ static void tds_free_env(TDSCONNECTION * conn); static void tds_free_compute_results(TDSSOCKET * tds); static void tds_free_compute_result(TDSCOMPUTEINFO * comp_info); #undef TEST_MALLOC #define TEST_MALLOC(dest,type) \ {if (!(dest = (type*)calloc(1, sizeof(type)))) goto Cleanup;} #undef TEST_CALLOC #define TEST_CALLOC(dest,type,n) \ {if (!(dest = (type*)calloc((n), sizeof(type)))) goto Cleanup;} /** * \ingroup libtds * \defgroup mem Memory allocation * Allocate or free resources. Allocation can fail only on out of memory. * In such case they return NULL and leave the state as before call. * Mainly function names are in the form tds_alloc_XX or tds_free_XXX. * tds_alloc_XXX functions allocate structures and return pointer to allocated * data while tds_free_XXX take structure pointers and free them. Some functions * require additional parameters to initialize structure correctly. * The main exception are structures that use reference counting. These structures * have tds_alloc_XXX functions but instead of tds_free_XXX use tds_release_XXX. */ /** * \addtogroup mem * @{ */ static volatile unsigned int inc_num = 1; /** * Get an id for dynamic query based on TDS information * \param conn state information for the connection and the TDS protocol * \return TDS_FAIL or TDS_SUCCESS */ static char * tds_get_dynid(TDSCONNECTION * conn, char *id) { unsigned long n; int i; char *p; char c; CHECK_CONN_EXTRA(conn); inc_num = (inc_num + 1) & 0xffff; /* some version of Sybase require length <= 10, so we code id */ n = (unsigned long) (TDS_INTPTR) conn; p = id; *p++ = (char) ('a' + (n % 26u)); n /= 26u; for (i = 0; i < 9; ++i) { c = (char) ('0' + (n % 36u)); *p++ = (c < ('0' + 10)) ? c : c + ('a' - '0' - 10); /* printf("%d -> %d(%c)\n",n%36u,p[-1],p[-1]); */ n /= 36u; if (i == 4) n += 3u * inc_num; } *p = 0; return id; } #include extern const TDSCOLUMNFUNCS tds_invalid_funcs; #include static TDSCOLUMN * tds_alloc_column(void) { TDSCOLUMN *col; TEST_MALLOC(col, TDSCOLUMN); tds_dstr_init(&col->table_name); tds_dstr_init(&col->column_name); tds_dstr_init(&col->table_column_name); col->funcs = &tds_invalid_funcs; Cleanup: return col; } static void tds_free_column(TDSCOLUMN *col) { tds_dstr_free(&col->table_name); tds_dstr_free(&col->column_name); tds_dstr_free(&col->table_column_name); free(col); } /** * \fn TDSDYNAMIC *tds_alloc_dynamic(TDSCONNECTION *conn, const char *id) * \brief Allocate a dynamic statement. * \param conn the connection within which to allocate the statement. * \param id a character label identifying the statement. * \return a pointer to the allocated structure (NULL on failure). * * tds_alloc_dynamic is used to implement placeholder code under TDS 5.0 */ TDSDYNAMIC * tds_alloc_dynamic(TDSCONNECTION * conn, const char *id) { TDSDYNAMIC *dyn; char tmp_id[30]; if (id) { /* check to see if id already exists (shouldn't) */ if (tds_lookup_dynamic(conn, id)) return NULL; } else { unsigned int n; id = tmp_id; for (n = 0;;) { if (!tds_lookup_dynamic(conn, tds_get_dynid(conn, tmp_id))) break; if (++n == 256) return NULL; } } TEST_MALLOC(dyn, TDSDYNAMIC); /* take into account pointer in list */ dyn->ref_count = 2; /* insert into list */ dyn->next = conn->dyns; conn->dyns = dyn; strlcpy(dyn->id, id, TDS_MAX_DYNID_LEN); return dyn; Cleanup: return NULL; } /** * \fn void tds_free_input_params(TDSDYNAMIC *dyn) * \brief Frees all allocated input parameters of a dynamic statement. * \param dyn the dynamic statement whose input parameter are to be freed * * tds_free_input_params frees all parameters for the give dynamic statement */ void tds_free_input_params(TDSDYNAMIC * dyn) { TDSPARAMINFO *info; info = dyn->params; if (info) { tds_free_param_results(info); dyn->params = NULL; } } /* * Called when dynamic got deallocated from server */ void tds_dynamic_deallocated(TDSCONNECTION *conn, TDSDYNAMIC *dyn) { TDSDYNAMIC **victim; tdsdump_log(TDS_DBG_FUNC, "tds_dynamic_deallocated() : freeing dynamic_id %s\n", dyn->id); victim = &conn->dyns; while (*victim != dyn) { if (*victim == NULL) { tdsdump_log(TDS_DBG_FUNC, "tds_dynamic_deallocated() : cannot find id %s\n", dyn->id); return; } victim = &(*victim)->next; } /* remove from list */ *victim = dyn->next; dyn->next = NULL; /* assure there is no id left */ dyn->num_id = 0; tds_release_dynamic(&dyn); } /** * \fn void tds_release_dynamic(TDSDYNAMIC **pdyn) * \brief Frees dynamic statement * \param pdyn pointer to dynamic statement to be freed. */ void tds_release_dynamic(TDSDYNAMIC ** pdyn) { TDSDYNAMIC *dyn; dyn = *pdyn; *pdyn = NULL; if (!dyn || --dyn->ref_count > 0) return; tds_detach_results(dyn->res_info); tds_free_results(dyn->res_info); tds_free_input_params(dyn); free(dyn->query); free(dyn); } /** * \fn TDSPARAMINFO *tds_alloc_param_result(TDSPARAMINFO *old_param) * \brief Adds a output parameter to TDSPARAMINFO. * \param old_param a pointer to the TDSPARAMINFO structure containing the * current set of output parameter, or NULL if none exists. * \return a pointer to the new TDSPARAMINFO structure. * * tds_alloc_param_result() works a bit differently than the other alloc result * functions. Output parameters come in individually with no total number * given in advance, so we simply call this func every time with get a * TDS_PARAM_TOKEN and let it realloc the columns struct one bigger. * tds_free_all_results() usually cleans up after us. */ TDSPARAMINFO * tds_alloc_param_result(TDSPARAMINFO * old_param) { TDSPARAMINFO *param_info; TDSCOLUMN *colinfo; /* parameters cannot have row associated */ if (old_param && (old_param->current_row || old_param->row_free)) return NULL; colinfo = tds_alloc_column(); if (!colinfo) return NULL; param_info = old_param; if (!param_info) { TEST_MALLOC(param_info, TDSPARAMINFO); param_info->ref_count = 1; } if (!TDS_RESIZE(param_info->columns, param_info->num_cols + 1u)) goto Cleanup; param_info->columns[param_info->num_cols++] = colinfo; return param_info; Cleanup: if (!old_param) free(param_info); free(colinfo); return NULL; } /** * Delete latest parameter */ void tds_free_param_result(TDSPARAMINFO * param_info) { TDSCOLUMN *col; if (!param_info || param_info->num_cols <= 0) return; col = param_info->columns[--param_info->num_cols]; if (col->column_data && col->column_data_free) col->column_data_free(col); if (param_info->num_cols == 0) TDS_ZERO_FREE(param_info->columns); /* * NOTE some informations should be freed too but when this function * is called are not used. I hope to remove the need for this * function ASAP * A better way is to support different way to allocate and get * parameters * -- freddy77 */ tds_free_column(col); } static void tds_param_free(TDSCOLUMN *col) { if (!col->column_data) return; if (is_blob_col(col)) { TDSBLOB *blob = (TDSBLOB *) col->column_data; free(blob->textvalue); } TDS_ZERO_FREE(col->column_data); } /** * Allocate data for a parameter. * @param curparam parameter to retrieve size information * @return NULL on failure or new data */ void * tds_alloc_param_data(TDSCOLUMN * curparam) { TDS_INT data_size; void *data; CHECK_COLUMN_EXTRA(curparam); data_size = curparam->funcs->row_len(curparam); /* allocate data */ if (curparam->column_data && curparam->column_data_free) curparam->column_data_free(curparam); curparam->column_data_free = tds_param_free; data = malloc(data_size); curparam->column_data = (unsigned char*) data; if (!data) return NULL; /* if is a blob reset buffer */ if (is_blob_col(curparam)) memset(data, 0, sizeof(TDSBLOB)); return data; } /** * Allocate memory for storing compute info * return NULL on out of memory */ static TDSCOMPUTEINFO * tds_alloc_compute_result(TDS_USMALLINT num_cols, TDS_USMALLINT by_cols) { TDS_USMALLINT col; TDSCOMPUTEINFO *info; TEST_MALLOC(info, TDSCOMPUTEINFO); info->ref_count = 1; TEST_CALLOC(info->columns, TDSCOLUMN *, num_cols); info->num_cols = num_cols; for (col = 0; col < num_cols; col++) if (!(info->columns[col] = tds_alloc_column())) goto Cleanup; if (by_cols) { TEST_CALLOC(info->bycolumns, TDS_SMALLINT, by_cols); info->by_cols = by_cols; } return info; Cleanup: tds_free_compute_result(info); return NULL; } TDSCOMPUTEINFO ** tds_alloc_compute_results(TDSSOCKET * tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols) { TDS_UINT n; TDSCOMPUTEINFO **comp_info; TDSCOMPUTEINFO *cur_comp_info; tdsdump_log(TDS_DBG_FUNC, "alloc_compute_result. num_cols = %d bycols = %d\n", num_cols, by_cols); tdsdump_log(TDS_DBG_FUNC, "alloc_compute_result. num_comp_info = %d\n", tds->num_comp_info); cur_comp_info = tds_alloc_compute_result(num_cols, by_cols); if (!cur_comp_info) return NULL; n = tds->num_comp_info; comp_info = (TDSCOMPUTEINFO **) TDS_RESIZE(tds->comp_info, n + 1u); if (!comp_info) { tds_free_compute_result(cur_comp_info); return NULL; } tds->comp_info = comp_info; comp_info[n] = cur_comp_info; tds->num_comp_info = n + 1u; tdsdump_log(TDS_DBG_FUNC, "alloc_compute_result. num_comp_info = %d\n", tds->num_comp_info); return comp_info; } TDSRESULTINFO * tds_alloc_results(TDS_USMALLINT num_cols) { TDSRESULTINFO *res_info; TDS_USMALLINT col; TEST_MALLOC(res_info, TDSRESULTINFO); res_info->ref_count = 1; if (num_cols) TEST_CALLOC(res_info->columns, TDSCOLUMN *, num_cols); for (col = 0; col < num_cols; col++) if (!(res_info->columns[col] = tds_alloc_column())) goto Cleanup; res_info->num_cols = num_cols; res_info->row_size = 0; return res_info; Cleanup: tds_free_results(res_info); return NULL; } void tds_set_current_results(TDSSOCKET *tds, TDSRESULTINFO *info) { tds_detach_results(info); if (tds->current_results) tds->current_results->attached_to = NULL; if (info) info->attached_to = tds; tds->in_row = (info != NULL); tds->current_results = info; } /** * Detach result info from it current socket */ void tds_detach_results(TDSRESULTINFO *info) { if (info && info->attached_to) { info->attached_to->current_results = NULL; info->attached_to->in_row = false; info->attached_to = NULL; } } static void tds_row_free(TDSRESULTINFO *res_info, unsigned char *row) { int i; const TDSCOLUMN *col; if (!res_info || !row) return; for (i = 0; i < res_info->num_cols; ++i) { col = res_info->columns[i]; if (is_blob_col(col)) { TDSBLOB *blob = (TDSBLOB *) &row[col->column_data - res_info->current_row]; if (blob->textvalue) TDS_ZERO_FREE(blob->textvalue); } } free(row); } /** * Allocate space for row store * return NULL on out of memory */ TDSRET tds_alloc_row(TDSRESULTINFO * res_info) { int i, num_cols = res_info->num_cols; unsigned char *ptr; TDSCOLUMN *col; TDS_UINT row_size; /* compute row size */ row_size = 0; for (i = 0; i < num_cols; ++i) { col = res_info->columns[i]; col->column_data_free = NULL; row_size += col->funcs->row_len(col); row_size += (TDS_ALIGN_SIZE - 1); row_size -= row_size % TDS_ALIGN_SIZE; } res_info->row_size = row_size; ptr = tds_new0(unsigned char, res_info->row_size); res_info->current_row = ptr; if (!ptr) return TDS_FAIL; res_info->row_free = tds_row_free; /* fill column_data */ row_size = 0; for (i = 0; i < num_cols; ++i) { col = res_info->columns[i]; col->column_data = ptr + row_size; row_size += col->funcs->row_len(col); row_size += (TDS_ALIGN_SIZE - 1); row_size -= row_size % TDS_ALIGN_SIZE; } return TDS_SUCCESS; } TDSRET tds_alloc_compute_row(TDSCOMPUTEINFO * res_info) { return tds_alloc_row(res_info); } void tds_free_param_results(TDSPARAMINFO * param_info) { tds_free_results(param_info); } static void tds_free_compute_result(TDSCOMPUTEINFO * comp_info) { tds_free_results(comp_info); } static void tds_free_compute_results(TDSSOCKET * tds) { TDSCOMPUTEINFO ** comp_info = tds->comp_info; TDS_UINT i, num_comp = tds->num_comp_info; tds->comp_info = NULL; tds->num_comp_info = 0; for (i = 0; i < num_comp; i++) { if (comp_info && comp_info[i]) { tds_detach_results(comp_info[i]); tds_free_compute_result(comp_info[i]); } } if (num_comp) free(comp_info); } void tds_free_row(TDSRESULTINFO * res_info, unsigned char *row) { assert(res_info); if (!row || !res_info->row_free) return; res_info->row_free(res_info, row); } void tds_free_results(TDSRESULTINFO * res_info) { int i; TDSCOLUMN *curcol; if (!res_info) return; if (--res_info->ref_count != 0) return; tds_detach_results(res_info); if (res_info->num_cols && res_info->columns) { for (i = 0; i < res_info->num_cols; i++) if ((curcol = res_info->columns[i]) != NULL) { if (curcol->bcp_terminator) TDS_ZERO_FREE(curcol->bcp_terminator); tds_free_bcp_column_data(curcol->bcp_column_data); curcol->bcp_column_data = NULL; if (curcol->column_data && curcol->column_data_free) curcol->column_data_free(curcol); } } if (res_info->current_row && res_info->row_free) res_info->row_free(res_info, res_info->current_row); if (res_info->num_cols && res_info->columns) { for (i = 0; i < res_info->num_cols; i++) if ((curcol = res_info->columns[i]) != NULL) tds_free_column(curcol); free(res_info->columns); } free(res_info->bycolumns); free(res_info); } void tds_free_all_results(TDSSOCKET * tds) { tdsdump_log(TDS_DBG_FUNC, "tds_free_all_results()\n"); tds_detach_results(tds->res_info); tds_free_results(tds->res_info); tds->res_info = NULL; tds_detach_results(tds->param_info); tds_free_param_results(tds->param_info); tds->param_info = NULL; tds_free_compute_results(tds); tds->has_status = false; tds->in_row = false; tds->ret_status = 0; if (tds->cur_dyn) tds_detach_results(tds->cur_dyn->res_info); } /* * Return 1 if winsock is initialized, else 0. */ static int winsock_initialized(void) { #if defined(_WIN32) || defined(_WIN64) static bool initialized = false; static tds_mutex mtx = TDS_MUTEX_INITIALIZER; WSADATA wsa_data; int erc; if (initialized) return 1; tds_mutex_lock(&mtx); /* same check inside the mutex */ if (initialized) { tds_mutex_unlock(&mtx); return 1; } /* initialize the socket layer */ erc = WSAStartup(MAKEWORD(2, 2), &wsa_data); initialized = (erc == 0); tds_mutex_unlock(&mtx); if (erc != 0) { char *errstr = sock_strerror(erc); tdsdump_log(TDS_DBG_ERROR, "tds_init_winsock: WSAStartup failed with %d (%s)\n", erc, errstr); sock_strerror_free(errstr); return 0; } #endif return 1; } TDSCONTEXT * tds_alloc_context(void * parent) { TDSCONTEXT *context; TDSLOCALE *locale; if (!winsock_initialized()) return NULL; if ((locale = tds_get_locale()) == NULL) return NULL; if ((context = tds_new0(TDSCONTEXT, 1)) == NULL) { tds_free_locale(locale); return NULL; } context->locale = locale; context->parent = parent; context->money_use_2_digits = false; return context; } void tds_free_context(TDSCONTEXT * context) { if (!context) return; tds_free_locale(context->locale); free(context); } TDSLOCALE * tds_alloc_locale(void) { TDSLOCALE *locale; TEST_MALLOC(locale, TDSLOCALE); return locale; Cleanup: tds_free_locale(locale); return NULL; } /* * Default capabilities. */ #undef REQ #define SUPPORTED_REQ_CAP(i) \ REQ(i,LANG) REQ(i,RPC) REQ(i,EVT) REQ(i,MSTMT) REQ(i,BCP) REQ(i,CURSOR) REQ(i,DYNF) \ REQ(i,MSG) REQ(i,PARAM) REQ(i,DATA_INT1) REQ(i,DATA_INT2) REQ(i,DATA_INT4) REQ(i,DATA_BIT) \ REQ(i,DATA_CHAR) REQ(i,DATA_VCHAR) REQ(i,DATA_BIN) REQ(i,DATA_VBIN) REQ(i,DATA_MNY8) \ REQ(i,DATA_MNY4) REQ(i,DATA_DATE8) REQ(i,DATA_DATE4) REQ(i,DATA_FLT4) REQ(i,DATA_FLT8) \ REQ(i,DATA_NUM) REQ(i,DATA_TEXT) REQ(i,DATA_IMAGE) REQ(i,DATA_DEC) REQ(i,DATA_LCHAR) \ REQ(i,DATA_LBIN) REQ(i,DATA_INTN) REQ(i,DATA_DATETIMEN) REQ(i,DATA_MONEYN) \ REQ(i,CSR_PREV) REQ(i,CSR_FIRST) REQ(i,CSR_LAST) REQ(i,CSR_ABS) REQ(i,CSR_REL) \ REQ(i,CSR_MULTI) REQ(i,CON_INBAND) REQ(i,PROTO_TEXT) REQ(i,PROTO_BULK) \ REQ(i,DATA_SENSITIVITY) REQ(i,DATA_BOUNDARY) REQ(i,PROTO_DYNPROC) REQ(i,DATA_FLTN) \ REQ(i,DATA_BITN) REQ(i,DATA_INT8) REQ(i,WIDETABLE) \ REQ(i,DATA_UINT2) REQ(i,DATA_UINT4) REQ(i,DATA_UINT8) REQ(i,DATA_UINTN) REQ(i,LARGEIDENT) \ REQ(i,SRVPKTSIZE) REQ(i,DATA_DATE) REQ(i,DATA_TIME) REQ(i,DATA_BIGTIME) REQ(i,DATA_BIGDATETIME) #define REQ(i,n) |(((TDS_REQ_ ## n / 8) == i)?(1<<(TDS_REQ_ ## n & 7)):0) #define REQB(i) 0 SUPPORTED_REQ_CAP(i) #undef RES #define SUPPORTED_RES_CAP(i) \ RES(i,CON_NOOOB) RES(i,PROTO_NOTEXT) RES(i,PROTO_NOBULK) RES(i,NOTDSDEBUG) #define RES(i,n) |(((TDS_RES_ ## n / 8) == i)?(1<<(TDS_RES_ ## n & 7)):0) #define RESB(i) 0 SUPPORTED_RES_CAP(i) static const TDS_CAPABILITIES defaultcaps = { { /* type, len, data, data, data, data, data, data, data, data, data, data, data, data, data, data (14 bytes) */ { 1, 14, { REQB(13), REQB(12), REQB(11), REQB(10), REQB(9), REQB(8), REQB(7), REQB(6), REQB(5), REQB(4), REQB(3), REQB(2), REQB(1), REQB(0) } }, { 2, 14, { RESB(13), RESB(12), RESB(11), RESB(10), RESB(9), RESB(8), RESB(7), RESB(6), RESB(5), RESB(4), RESB(3), RESB(2), RESB(1), RESB(0) } } } }; /* check we match the values size */ TDS_COMPILE_CHECK(tds_values_len, sizeof(defaultcaps.types[0].values) == 14); /* check we match the default size */ TDS_COMPILE_CHECK(tds_cap_len, sizeof(defaultcaps) == TDS_MAX_CAPABILITY); /** * Initialize login structure with locale information and other stuff for connection * @param locale locale information (copied to configuration information) * @result login structure or NULL if initialization error */ TDSLOGIN* tds_init_login(TDSLOGIN *login, TDSLOCALE * locale) { char hostname[128]; #if HAVE_NL_LANGINFO && defined(CODESET) const char *charset; #else char *lc_all, *tok = NULL; #endif /* * TDS 7.0: * ODBC driver settings. * Change to initial language must succeed. */ login->option_flag2 = TDS_INIT_LANG_REQUIRED|TDS_ODBC_ON; login->tds_version = TDS_DEFAULT_VERSION; login->block_size = 0; #if HAVE_NL_LANGINFO && defined(CODESET) charset = nl_langinfo(CODESET); if (strcmp(tds_canonical_charset_name(charset), "US-ASCII") == 0) charset = "ISO-8859-1"; if (!tds_dstr_copy(&login->client_charset, charset)) return NULL; #else if (!tds_dstr_copy(&login->client_charset, "ISO-8859-1")) return NULL; if ((lc_all = strdup(setlocale(LC_ALL, NULL))) == NULL) return NULL; if (strtok_r(lc_all, ".", &tok)) { char *encoding = strtok_r(NULL, "@", &tok); #ifdef _WIN32 /* windows give numeric codepage*/ if (encoding && atoi(encoding) > 0) { char *p; if (asprintf(&p, "CP%s", encoding) >= 0) { free(lc_all); lc_all = encoding = p; } } #endif if (encoding) { if (!tds_dstr_copy(&login->client_charset, encoding)) return NULL; } } free(lc_all); #endif if (locale) { if (locale->language) if (!tds_dstr_copy(&login->language, locale->language)) return NULL; if (locale->server_charset) if (!tds_dstr_copy(&login->server_charset, locale->server_charset)) return NULL; } if (tds_dstr_isempty(&login->language)) { if (!tds_dstr_copy(&login->language, TDS_DEF_LANG)) return NULL; } memset(hostname, '\0', sizeof(hostname)); gethostname(hostname, sizeof(hostname)); hostname[sizeof(hostname) - 1] = '\0'; /* make sure it's terminated */ if (!tds_dstr_copy(&login->client_host_name, hostname)) return NULL; login->valid_configuration = 1; login->check_ssl_hostname = 1; return login; } TDSCURSOR * tds_alloc_cursor(TDSSOCKET *tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen) { TDSCURSOR *cursor; TDSCURSOR *pcursor; TEST_MALLOC(cursor, TDSCURSOR); cursor->ref_count = 1; cursor->type = TDS_CUR_TYPE_KEYSET; cursor->concurrency = TDS_CUR_CONCUR_OPTIMISTIC; TEST_CALLOC(cursor->cursor_name, char, namelen + 1); memcpy(cursor->cursor_name, name, namelen); TEST_CALLOC(cursor->query, char, querylen + 1); memcpy(cursor->query, query, querylen); if (tds->conn->cursors == NULL) { tds->conn->cursors = cursor; } else { for (pcursor = tds->conn->cursors; pcursor->next; pcursor = pcursor->next) continue; pcursor->next = cursor; } /* take into account reference in connection list */ ++cursor->ref_count; return cursor; Cleanup: tds_release_cursor(&cursor); return NULL; } /* * Called when cursor got deallocated from server */ void tds_cursor_deallocated(TDSCONNECTION *conn, TDSCURSOR *cursor) { TDSCURSOR **victim; tdsdump_log(TDS_DBG_FUNC, "tds_cursor_deallocated() : freeing cursor_id %d\n", cursor->cursor_id); victim = &conn->cursors; while (*victim != cursor) { if (*victim == NULL) { tdsdump_log(TDS_DBG_FUNC, "tds_cursor_deallocated() : cannot find cursor_id %d\n", cursor->cursor_id); return; } victim = &(*victim)->next; } /* remove from list */ *victim = cursor->next; cursor->next = NULL; tds_release_cursor(&cursor); } /* * Decrement reference counter and free if necessary. * Called internally by libTDS and by upper library when you don't need * cursor reference anymore */ void tds_release_cursor(TDSCURSOR **pcursor) { TDSCURSOR *cursor = *pcursor; *pcursor = NULL; if (!cursor || --cursor->ref_count > 0) return; tdsdump_log(TDS_DBG_FUNC, "tds_release_cursor() : freeing cursor_id %d\n", cursor->cursor_id); tdsdump_log(TDS_DBG_FUNC, "tds_release_cursor() : freeing cursor results\n"); tds_detach_results(cursor->res_info); tds_free_results(cursor->res_info); if (cursor->cursor_name) { tdsdump_log(TDS_DBG_FUNC, "tds_release_cursor() : freeing cursor name\n"); free(cursor->cursor_name); } if (cursor->query) { tdsdump_log(TDS_DBG_FUNC, "tds_release_cursor() : freeing cursor query\n"); free(cursor->query); } tdsdump_log(TDS_DBG_FUNC, "tds_release_cursor() : cursor_id %d freed\n", cursor->cursor_id); free(cursor); } TDSLOGIN * tds_alloc_login(int use_environment) { TDSLOGIN *login = NULL; const char *server_name = TDS_DEF_SERVER; TEST_MALLOC(login, TDSLOGIN); login->check_ssl_hostname = 1; login->use_utf16 = 1; login->bulk_copy = 1; tds_dstr_init(&login->server_name); tds_dstr_init(&login->language); tds_dstr_init(&login->server_charset); tds_dstr_init(&login->client_host_name); tds_dstr_init(&login->server_host_name); tds_dstr_init(&login->app_name); tds_dstr_init(&login->user_name); tds_dstr_init(&login->password); tds_dstr_init(&login->library); tds_dstr_init(&login->new_password); login->ip_addrs = NULL; tds_dstr_init(&login->database); tds_dstr_init(&login->dump_file); tds_dstr_init(&login->client_charset); tds_dstr_init(&login->instance_name); tds_dstr_init(&login->server_realm_name); tds_dstr_init(&login->server_spn); tds_dstr_init(&login->cafile); tds_dstr_init(&login->crlfile); tds_dstr_init(&login->db_filename); tds_dstr_init(&login->openssl_ciphers); tds_dstr_init(&login->routing_address); if (use_environment) { const char *s; if ((s=getenv("DSQUERY")) != NULL) server_name = s; if ((s=getenv("TDSQUERY")) != NULL) server_name = s; } if (!tds_dstr_copy(&login->server_name, server_name)) { free(login); return NULL; } login->capabilities = defaultcaps; login->use_ntlmv2_specified = 0; login->use_ntlmv2 = 1; login->enable_tls_v1 = 1; Cleanup: return login; } void tds_free_login(TDSLOGIN * login) { if (!login) return; /* for security reason clear memory */ tds_dstr_zero(&login->password); tds_dstr_free(&login->password); tds_dstr_zero(&login->new_password); tds_dstr_free(&login->new_password); tds_dstr_free(&login->server_name); tds_dstr_free(&login->language); tds_dstr_free(&login->server_charset); tds_dstr_free(&login->client_host_name); tds_dstr_free(&login->app_name); tds_dstr_free(&login->user_name); tds_dstr_free(&login->library); tds_dstr_free(&login->client_charset); tds_dstr_free(&login->server_host_name); if (login->ip_addrs != NULL) freeaddrinfo(login->ip_addrs); tds_dstr_free(&login->database); tds_dstr_free(&login->dump_file); tds_dstr_free(&login->instance_name); tds_dstr_free(&login->server_realm_name); tds_dstr_free(&login->server_spn); tds_dstr_free(&login->cafile); tds_dstr_free(&login->crlfile); tds_dstr_free(&login->db_filename); tds_dstr_free(&login->openssl_ciphers); tds_dstr_free(&login->routing_address); free(login); } TDSPACKET * tds_alloc_packet(void *buf, unsigned len) { TDSPACKET *packet = (TDSPACKET *) malloc(len + TDS_OFFSET(TDSPACKET, buf)); if (TDS_LIKELY(packet)) { tds_packet_zero_data_start(packet); packet->data_len = 0; packet->capacity = len; packet->sid = 0; packet->next = NULL; if (buf) { memcpy(packet->buf, buf, len); packet->data_len = len; } } return packet; } TDSPACKET * tds_realloc_packet(TDSPACKET *packet, unsigned len) { if (packet->capacity < len) { packet = (TDSPACKET *) realloc(packet, len + TDS_OFFSET(TDSPACKET, buf)); if (TDS_LIKELY(packet)) packet->capacity = len; } return packet; } void tds_free_packets(TDSPACKET *packet) { TDSPACKET *next; for (; packet; packet = next) { next = packet->next; free(packet); } } static void tds_deinit_connection(TDSCONNECTION *conn) { if (conn->authentication) conn->authentication->free(conn, conn->authentication); conn->authentication = NULL; while (conn->dyns) tds_dynamic_deallocated(conn, conn->dyns); while (conn->cursors) tds_cursor_deallocated(conn, conn->cursors); tds_ssl_deinit(conn); /* close connection and free inactive sockets */ tds_connection_close(conn); tds_wakeup_close(&conn->wakeup); tds_iconv_free(conn); free(conn->product_name); free(conn->server); tds_free_env(conn); tds_free_packets(conn->packet_cache); tds_mutex_free(&conn->list_mtx); #if ENABLE_ODBC_MARS tds_free_packets(conn->packets); tds_free_packets(conn->recv_packet); tds_free_packets(conn->send_packets); free(conn->sessions); #endif } static TDSCONNECTION * tds_init_connection(TDSCONNECTION *conn, TDSCONTEXT *context, unsigned int bufsize) { conn->env.block_size = bufsize; conn->s = INVALID_SOCKET; conn->use_iconv = 1; conn->tds_ctx = context; if (tds_wakeup_init(&conn->wakeup)) goto Cleanup; if (tds_iconv_alloc(conn)) goto Cleanup; if (tds_mutex_init(&conn->list_mtx)) goto Cleanup; #if ENABLE_ODBC_MARS TEST_CALLOC(conn->sessions, TDSSOCKET*, 64); conn->num_sessions = 64; #endif return conn; Cleanup: tds_wakeup_close(&conn->wakeup); tds_iconv_free(conn); return NULL; } static TDSSOCKET * tds_init_socket(TDSSOCKET * tds_socket, unsigned int bufsize) { TDSPACKET *pkt; tds_socket->parent = NULL; tds_socket->recv_packet = tds_alloc_packet(NULL, bufsize); if (!tds_socket->recv_packet) goto Cleanup; tds_socket->in_buf = tds_socket->recv_packet->buf; pkt = tds_alloc_packet(NULL, bufsize + TDS_ADDITIONAL_SPACE); if (!pkt) goto Cleanup; tds_set_current_send_packet(tds_socket, pkt); tds_socket->out_buf_max = bufsize; /* Jeff's hack, init to no timeout */ tds_socket->query_timeout = 0; tds_init_write_buf(tds_socket); tds_socket->state = TDS_DEAD; tds_socket->env_chg_func = NULL; if (tds_mutex_init(&tds_socket->wire_mtx)) goto Cleanup; #ifdef ENABLE_ODBC_MARS tds_socket->sid = 0; if (tds_cond_init(&tds_socket->packet_cond)) goto Cleanup; tds_socket->recv_seq = 0; tds_socket->send_seq = 0; tds_socket->recv_wnd = 4; tds_socket->send_wnd = 4; #endif return tds_socket; Cleanup: return NULL; } #if ENABLE_ODBC_MARS static void tds_free_connection(TDSCONNECTION *conn) { if (!conn) return; assert(conn->in_net_tds == NULL); tds_deinit_connection(conn); free(conn); } static TDSCONNECTION * tds_alloc_connection(TDSCONTEXT *context, unsigned int bufsize) { TDSCONNECTION *conn; TEST_MALLOC(conn, TDSCONNECTION); if (!tds_init_connection(conn, context, bufsize)) goto Cleanup; return conn; Cleanup: tds_free_connection(conn); return NULL; } static TDSSOCKET * tds_alloc_socket_base(unsigned int bufsize) { TDSSOCKET *tds_socket; TEST_MALLOC(tds_socket, TDSSOCKET); if (!tds_init_socket(tds_socket, bufsize)) goto Cleanup; return tds_socket; Cleanup: tds_free_socket(tds_socket); return NULL; } TDSSOCKET * tds_alloc_socket(TDSCONTEXT * context, unsigned int bufsize) { TDSCONNECTION *conn = tds_alloc_connection(context, bufsize); TDSSOCKET *tds; if (!conn) return NULL; tds = tds_alloc_socket_base(bufsize); if (tds) { conn->sessions[0] = tds; tds->conn = conn; return tds; } tds_free_connection(conn); return NULL; } static bool tds_alloc_new_sid(TDSSOCKET *tds) { uint16_t sid; TDSCONNECTION *conn = tds->conn; tds_mutex_lock(&conn->list_mtx); for (sid = 1; sid < conn->num_sessions; ++sid) if (!conn->sessions[sid]) break; if (sid == conn->num_sessions) { /* extend array */ TDSSOCKET **s = (TDSSOCKET **) TDS_RESIZE(conn->sessions, sid+64); if (!s) goto error; memset(s + conn->num_sessions, 0, sizeof(*s) * 64); conn->num_sessions += 64; } conn->sessions[sid] = tds; tds->sid = sid; error: tds_mutex_unlock(&conn->list_mtx); return tds->sid != 0; } TDSSOCKET * tds_alloc_additional_socket(TDSCONNECTION *conn) { TDSSOCKET *tds; if (!IS_TDS72_PLUS(conn) || !conn->mars) return NULL; tds = tds_alloc_socket_base(sizeof(TDS72_SMP_HEADER) + conn->env.block_size); if (!tds) return NULL; tds->send_packet->data_start = sizeof(TDS72_SMP_HEADER); tds->out_buf = tds->send_packet->buf + sizeof(TDS72_SMP_HEADER); tds->out_buf_max -= sizeof(TDS72_SMP_HEADER); tds->conn = conn; if (!tds_alloc_new_sid(tds)) goto Cleanup; tds->state = TDS_IDLE; if (TDS_FAILED(tds_append_syn(tds))) goto Cleanup; return tds; Cleanup: tds_free_socket(tds); return NULL; } #else /* !ENABLE_ODBC_MARS */ TDSSOCKET * tds_alloc_socket(TDSCONTEXT * context, unsigned int bufsize) { TDSSOCKET *tds_socket; TEST_MALLOC(tds_socket, TDSSOCKET); if (!tds_init_connection(tds_socket->conn, context, bufsize)) goto Cleanup; if (!tds_init_socket(tds_socket, bufsize)) goto Cleanup; return tds_socket; Cleanup: tds_free_socket(tds_socket); return NULL; } #endif /* !ENABLE_ODBC_MARS */ TDSSOCKET * tds_realloc_socket(TDSSOCKET * tds, size_t bufsize) { TDSPACKET *packet; #if ENABLE_ODBC_MARS size_t smp_hdr_len = tds->conn->mars ? sizeof(TDS72_SMP_HEADER) : 0; #else enum { smp_hdr_len = 0 }; #endif assert(tds && tds->out_buf && tds->send_packet); if (bufsize < 512) bufsize = 512; /* prevent nasty memory conditions, server should send the request at * the beginning only */ if (tds->out_pos > bufsize || tds->frozen) return NULL; tds->conn->env.block_size = bufsize; packet = tds_realloc_packet(tds->send_packet, smp_hdr_len + bufsize + TDS_ADDITIONAL_SPACE); if (packet == NULL) return NULL; #if ENABLE_ODBC_MARS packet->data_start = smp_hdr_len; #endif tds->out_buf_max = bufsize; tds_set_current_send_packet(tds, packet); return tds; } #if ENABLE_ODBC_MARS static void tds_connection_remove_socket(TDSCONNECTION *conn, TDSSOCKET *tds) { unsigned n; bool must_free_connection = true; tds_mutex_lock(&conn->list_mtx); if (tds->sid < conn->num_sessions) conn->sessions[tds->sid] = NULL; for (n = 0; n < conn->num_sessions; ++n) if (TDSSOCKET_VALID(conn->sessions[n])) { must_free_connection = false; break; } if (!must_free_connection) { /* tds use connection member so must be valid */ tds_append_fin(tds); } tds_mutex_unlock(&conn->list_mtx); /* detach entirely */ tds->conn = NULL; if (must_free_connection) tds_free_connection(conn); } #else static void inline tds_connection_remove_socket(TDSCONNECTION *conn, TDSSOCKET *tds) { tds_deinit_connection(conn); } #endif void tds_free_socket(TDSSOCKET * tds) { #if ENABLE_EXTRA_CHECKS TDSDYNAMIC *dyn; TDSCURSOR *cur; #endif if (!tds) return; /* detach this socket */ tds_release_cur_dyn(tds); tds_release_cursor(&tds->cur_cursor); tds_detach_results(tds->current_results); #if ENABLE_EXTRA_CHECKS for (dyn = tds->conn->dyns; dyn; dyn = dyn->next) { if (dyn->res_info && dyn->res_info->attached_to == tds) { assert(0); } } for (cur = tds->conn->cursors; cur; cur = cur->next) { if (cur->res_info && cur->res_info->attached_to == tds) { assert(0); } } #endif tds_free_all_results(tds); #if ENABLE_ODBC_MARS tds_cond_destroy(&tds->packet_cond); #endif tds_connection_remove_socket(tds->conn, tds); tds_free_packets(tds->recv_packet); if (tds->frozen_packets) tds_free_packets(tds->frozen_packets); else tds_free_packets(tds->send_packet); free(tds); } void tds_free_locale(TDSLOCALE * locale) { if (!locale) return; free(locale->language); free(locale->server_charset); free(locale->date_fmt); free(locale); } static void tds_free_env(TDSCONNECTION* conn) { if (conn->env.language) TDS_ZERO_FREE(conn->env.language); if (conn->env.charset) TDS_ZERO_FREE(conn->env.charset); if (conn->env.database) TDS_ZERO_FREE(conn->env.database); } void tds_free_msg(TDSMESSAGE * message) { if (message) { message->priv_msg_type = 0; message->msgno = 0; message->state = 0; message->severity = 0; message->line_number = 0; TDS_ZERO_FREE(message->message); TDS_ZERO_FREE(message->server); TDS_ZERO_FREE(message->proc_name); TDS_ZERO_FREE(message->sql_state); } } #define SQLS_ENTRY(number,state) case number: p = state; break char * tds_alloc_client_sqlstate(int msgno) { const char *p = NULL; switch (msgno) { SQLS_ENTRY(17000, "S1T00"); /* timeouts ??? */ SQLS_ENTRY(20004, "08S01"); /* Communication link failure */ SQLS_ENTRY(20006, "08S01"); SQLS_ENTRY(20009, "08S01"); SQLS_ENTRY(20020, "08S01"); SQLS_ENTRY(20019, "24000"); /* Invalid cursor state */ SQLS_ENTRY(20014, "28000"); /* Invalid authorization specification */ SQLS_ENTRY(2400, "42000"); /* Syntax error or access violation */ SQLS_ENTRY(2401, "42000"); SQLS_ENTRY(2403, "42000"); SQLS_ENTRY(2404, "42000"); SQLS_ENTRY(2402, "S1000"); /* General error */ } if (p != NULL) return strdup(p); else return NULL; } char * tds_alloc_lookup_sqlstate(TDSSOCKET * tds, int msgno) { const char *p = NULL; char *q = NULL; if (TDS_IS_MSSQL(tds)) { switch (msgno) { /* MSSQL Server */ SQLS_ENTRY(3621,"01000"); SQLS_ENTRY(8153,"01003"); /* Null in aggregate */ SQLS_ENTRY(911, "08004"); /* Server rejected connection */ SQLS_ENTRY(512, "21000"); /* Subquery returns more than one value */ SQLS_ENTRY(213, "21S01"); /* Insert column list mismatch */ SQLS_ENTRY(109, "21S01"); SQLS_ENTRY(110, "21S01"); SQLS_ENTRY(1774,"21S02"); /* Ref column mismatch */ SQLS_ENTRY(8152,"22001"); /* String data would be truncated */ SQLS_ENTRY(5146,"22003"); /* Numeric value out of range */ SQLS_ENTRY(168, "22003"); /* Arithmetic overflow */ SQLS_ENTRY(220, "22003"); SQLS_ENTRY(232, "22003"); SQLS_ENTRY(234, "22003"); SQLS_ENTRY(236, "22003"); SQLS_ENTRY(238, "22003"); SQLS_ENTRY(244, "22003"); SQLS_ENTRY(246, "22003"); SQLS_ENTRY(248, "22003"); SQLS_ENTRY(519, "22003"); SQLS_ENTRY(520, "22003"); SQLS_ENTRY(521, "22003"); SQLS_ENTRY(522, "22003"); SQLS_ENTRY(523, "22003"); SQLS_ENTRY(524, "22003"); SQLS_ENTRY(1007,"22003"); SQLS_ENTRY(3606,"22003"); SQLS_ENTRY(8115,"22003"); SQLS_ENTRY(206, "22005"); /* Error in assignment */ SQLS_ENTRY(235, "22005"); SQLS_ENTRY(247, "22005"); SQLS_ENTRY(249, "22005"); SQLS_ENTRY(256, "22005"); SQLS_ENTRY(257, "22005"); SQLS_ENTRY(305, "22005"); SQLS_ENTRY(409, "22005"); SQLS_ENTRY(518, "22005"); SQLS_ENTRY(529, "22005"); SQLS_ENTRY(210, "22007"); /* Invalid datetime format */ SQLS_ENTRY(241, "22007"); SQLS_ENTRY(295, "22007"); SQLS_ENTRY(242, "22008"); /* Datetime out of range */ SQLS_ENTRY(296, "22008"); SQLS_ENTRY(298, "22008"); SQLS_ENTRY(535, "22008"); SQLS_ENTRY(542, "22008"); SQLS_ENTRY(517, "22008"); SQLS_ENTRY(3607, "22012"); /* Div by zero */ SQLS_ENTRY(8134, "22012"); SQLS_ENTRY(245, "22018"); /* Syntax error? */ SQLS_ENTRY(2627, "23000"); /* Constraint violation */ SQLS_ENTRY(515, "23000"); SQLS_ENTRY(233, "23000"); SQLS_ENTRY(273, "23000"); SQLS_ENTRY(530, "23000"); SQLS_ENTRY(2601,"23000"); SQLS_ENTRY(2615,"23000"); SQLS_ENTRY(2626,"23000"); SQLS_ENTRY(3604,"23000"); SQLS_ENTRY(3605,"23000"); SQLS_ENTRY(544, "23000"); SQLS_ENTRY(547, "23000"); SQLS_ENTRY(550, "23000"); SQLS_ENTRY(4415, "23000"); SQLS_ENTRY(1505, "23000"); SQLS_ENTRY(1508, "23000"); SQLS_ENTRY(3725, "23000"); SQLS_ENTRY(3726, "23000"); SQLS_ENTRY(4712, "23000"); SQLS_ENTRY(10055, "23000"); SQLS_ENTRY(10065, "23000"); SQLS_ENTRY(11011, "23000"); SQLS_ENTRY(11040, "23000"); SQLS_ENTRY(16999, "24000"); /* Invalid cursor state */ SQLS_ENTRY(16905, "24000"); SQLS_ENTRY(16917, "24000"); SQLS_ENTRY(16946, "24000"); SQLS_ENTRY(16950, "24000"); SQLS_ENTRY(266, "25000"); /* Invalid transaction state */ SQLS_ENTRY(277,"25000"); SQLS_ENTRY(611,"25000"); SQLS_ENTRY(3906,"25000"); SQLS_ENTRY(3908,"25000"); SQLS_ENTRY(6401,"25000"); SQLS_ENTRY(626, "25000"); SQLS_ENTRY(627, "25000"); SQLS_ENTRY(628, "25000"); SQLS_ENTRY(3902, "25000"); SQLS_ENTRY(3903, "25000"); SQLS_ENTRY(3916, "25000"); SQLS_ENTRY(3918, "25000"); SQLS_ENTRY(3919, "25000"); SQLS_ENTRY(3921, "25000"); SQLS_ENTRY(3922, "25000"); SQLS_ENTRY(3926, "25000"); SQLS_ENTRY(7969, "25000"); SQLS_ENTRY(8506, "25000"); SQLS_ENTRY(15626, "25000"); SQLS_ENTRY(18456, "28000"); /* Login failed? */ SQLS_ENTRY(6104, "37000"); /* Syntax error or access violation */ SQLS_ENTRY(8114, "37000"); SQLS_ENTRY(131, "37000"); SQLS_ENTRY(137, "37000"); SQLS_ENTRY(170, "37000"); SQLS_ENTRY(174, "37000"); SQLS_ENTRY(201, "37000"); SQLS_ENTRY(2812, "37000"); SQLS_ENTRY(2526, "37000"); SQLS_ENTRY(8144, "37000"); SQLS_ENTRY(17308, "42000"); /* Syntax/Access violation */ SQLS_ENTRY(17571, "42000"); SQLS_ENTRY(18002, "42000"); SQLS_ENTRY(229, "42000"); SQLS_ENTRY(230, "42000"); SQLS_ENTRY(262, "42000"); SQLS_ENTRY(2557, "42000"); SQLS_ENTRY(2571, "42000"); SQLS_ENTRY(2760, "42000"); SQLS_ENTRY(3110, "42000"); SQLS_ENTRY(3704, "42000"); SQLS_ENTRY(4613, "42000"); SQLS_ENTRY(4618, "42000"); SQLS_ENTRY(4834, "42000"); SQLS_ENTRY(5011, "42000"); SQLS_ENTRY(5116, "42000"); SQLS_ENTRY(5812, "42000"); SQLS_ENTRY(6004, "42000"); SQLS_ENTRY(6102, "42000"); SQLS_ENTRY(7956, "42000"); SQLS_ENTRY(11010, "42000"); SQLS_ENTRY(11045, "42000"); SQLS_ENTRY(14126, "42000"); SQLS_ENTRY(15247, "42000"); SQLS_ENTRY(15622, "42000"); SQLS_ENTRY(20604, "42000"); SQLS_ENTRY(21049, "42000"); SQLS_ENTRY(113, "42000"); SQLS_ENTRY(2714, "42S01"); /* Table or view already exists */ SQLS_ENTRY(208, "42S02"); /* Table or view not found */ SQLS_ENTRY(3701, "42S02"); SQLS_ENTRY(1913, "42S11"); /* Index already exists */ SQLS_ENTRY(15605, "42S11"); SQLS_ENTRY(307, "42S12"); /* Index not found */ SQLS_ENTRY(308, "42S12"); SQLS_ENTRY(10033, "42S12"); SQLS_ENTRY(15323, "42S12"); SQLS_ENTRY(18833, "42S12"); SQLS_ENTRY(4925, "42S21"); /* Column already exists */ SQLS_ENTRY(21255, "42S21"); SQLS_ENTRY(1911, "42S22"); /* Column not found */ SQLS_ENTRY(207, "42S22"); SQLS_ENTRY(4924, "42S22"); SQLS_ENTRY(4926, "42S22"); SQLS_ENTRY(15645, "42S22"); SQLS_ENTRY(21166, "42S22"); } } else { switch (msgno) { /* Sybase */ SQLS_ENTRY(3621, "01000"); SQLS_ENTRY(9501, "01003"); /* Null in aggregate */ SQLS_ENTRY(911, "08004"); /* Server rejected connection */ SQLS_ENTRY(512, "21000"); /* Subquery returns more than one value */ SQLS_ENTRY(213, "21S01"); /* Insert column list mismatch */ SQLS_ENTRY(109, "21S01"); SQLS_ENTRY(110, "21S01"); SQLS_ENTRY(1715, "21S02"); /* Ref column mismatch */ SQLS_ENTRY(9502, "22001"); /* String data would be truncated */ SQLS_ENTRY(220, "22003"); /* Arithmetic overflow */ SQLS_ENTRY(168, "22003"); SQLS_ENTRY(227, "22003"); SQLS_ENTRY(232, "22003"); SQLS_ENTRY(234, "22003"); SQLS_ENTRY(236, "22003"); SQLS_ENTRY(238, "22003"); SQLS_ENTRY(244, "22003"); SQLS_ENTRY(246, "22003"); SQLS_ENTRY(247, "22003"); SQLS_ENTRY(248, "22003"); SQLS_ENTRY(519, "22003"); SQLS_ENTRY(520, "22003"); SQLS_ENTRY(521, "22003"); SQLS_ENTRY(522, "22003"); SQLS_ENTRY(523, "22003"); SQLS_ENTRY(524, "22003"); SQLS_ENTRY(3606, "22003"); SQLS_ENTRY(206, "22005"); /* Error in assignment */ SQLS_ENTRY(235, "22005"); SQLS_ENTRY(249, "22005"); SQLS_ENTRY(256, "22005"); SQLS_ENTRY(305, "22005"); SQLS_ENTRY(409, "22005"); SQLS_ENTRY(518, "22005"); SQLS_ENTRY(529, "22005"); SQLS_ENTRY(535, "22008"); /* Datetime out of range */ SQLS_ENTRY(542, "22008"); SQLS_ENTRY(517, "22008"); SQLS_ENTRY(3607, "22012"); /* Div by zero */ SQLS_ENTRY(245, "22018"); /* Syntax error? */ SQLS_ENTRY(544, "23000"); /* Constraint violation */ SQLS_ENTRY(233, "23000"); SQLS_ENTRY(273, "23000"); SQLS_ENTRY(530, "23000"); SQLS_ENTRY(2601,"23000"); SQLS_ENTRY(2615,"23000"); SQLS_ENTRY(2626,"23000"); SQLS_ENTRY(3604,"23000"); SQLS_ENTRY(3605,"23000"); SQLS_ENTRY(545, "23000"); SQLS_ENTRY(546, "23000"); SQLS_ENTRY(547, "23000"); SQLS_ENTRY(548, "23000"); SQLS_ENTRY(549, "23000"); SQLS_ENTRY(550, "23000"); SQLS_ENTRY(1505, "23000"); SQLS_ENTRY(1508, "23000"); SQLS_ENTRY(565, "24000"); /* Invalid cursor state */ SQLS_ENTRY(558, "24000"); SQLS_ENTRY(559, "24000"); SQLS_ENTRY(6235, "24000"); SQLS_ENTRY(583, "24000"); SQLS_ENTRY(6259, "24000"); SQLS_ENTRY(6260, "24000"); SQLS_ENTRY(562, "24000"); SQLS_ENTRY(277, "25000"); /* Invalid transaction state */ SQLS_ENTRY(611,"25000"); SQLS_ENTRY(3906,"25000"); SQLS_ENTRY(3908,"25000"); SQLS_ENTRY(6401,"25000"); SQLS_ENTRY(627, "25000"); SQLS_ENTRY(628, "25000"); SQLS_ENTRY(641, "25000"); SQLS_ENTRY(642, "25000"); SQLS_ENTRY(1276, "25000"); SQLS_ENTRY(3902, "25000"); SQLS_ENTRY(3903, "25000"); SQLS_ENTRY(6104, "37000"); /* Syntax error or access violation */ SQLS_ENTRY(102, "37000"); SQLS_ENTRY(137, "37000"); SQLS_ENTRY(7327, "37000"); SQLS_ENTRY(201, "37000"); SQLS_ENTRY(257, "37000"); SQLS_ENTRY(2812, "37000"); SQLS_ENTRY(2526, "37000"); SQLS_ENTRY(11021, "37000"); SQLS_ENTRY(229, "42000"); /* Syntax/Access violation */ SQLS_ENTRY(230, "42000"); SQLS_ENTRY(262, "42000"); SQLS_ENTRY(4602, "42000"); SQLS_ENTRY(4603, "42000"); SQLS_ENTRY(4608, "42000"); SQLS_ENTRY(10306, "42000"); SQLS_ENTRY(10323, "42000"); SQLS_ENTRY(10330, "42000"); SQLS_ENTRY(10331, "42000"); SQLS_ENTRY(10332, "42000"); SQLS_ENTRY(11110, "42000"); SQLS_ENTRY(11113, "42000"); SQLS_ENTRY(11118, "42000"); SQLS_ENTRY(11121, "42000"); SQLS_ENTRY(17222, "42000"); SQLS_ENTRY(17223, "42000"); SQLS_ENTRY(18350, "42000"); SQLS_ENTRY(18351, "42000"); SQLS_ENTRY(113, "42000"); SQLS_ENTRY(2714, "42S01"); /* Table or view already exists */ SQLS_ENTRY(208, "42S02"); /* Table or view not found */ SQLS_ENTRY(3701, "42S02"); SQLS_ENTRY(1913, "42S11"); /* Index already exists */ SQLS_ENTRY(307, "42S12"); /* Index not found */ SQLS_ENTRY(7010, "42S12"); SQLS_ENTRY(18091, "42S12"); SQLS_ENTRY(1921, "42S21"); /* Column already exists */ SQLS_ENTRY(1720, "42S22"); /* Column not found */ SQLS_ENTRY(207, "42S22"); SQLS_ENTRY(4934, "42S22"); SQLS_ENTRY(18117, "42S22"); } } if (p != NULL && (q = strdup(p)) != NULL) { /* FIXME correct here ?? */ /* Convert known ODBC 3.x states listed above to 2.x */ if (memcmp(q, "42S", 3) == 0) memcpy(q, "S00", 3); return q; } return NULL; } BCPCOLDATA * tds_alloc_bcp_column_data(unsigned int column_size) { BCPCOLDATA *coldata; TEST_MALLOC(coldata, BCPCOLDATA); if (column_size > 4 * 1024) column_size = 4 * 1024; TEST_CALLOC(coldata->data, unsigned char, column_size); return coldata; Cleanup: tds_free_bcp_column_data(coldata); return NULL; } void tds_free_bcp_column_data(BCPCOLDATA * coldata) { if (!coldata) return; free(coldata->data); free(coldata); } TDSBCPINFO * tds_alloc_bcpinfo(void) { TDSBCPINFO *bcpinfo; TEST_MALLOC(bcpinfo, TDSBCPINFO); tds_dstr_init(&bcpinfo->tablename); return bcpinfo; Cleanup: return NULL; } void tds_deinit_bcpinfo(TDSBCPINFO *bcpinfo) { tds_dstr_free(&bcpinfo->tablename); TDS_ZERO_FREE(bcpinfo->insert_stmt); tds_free_results(bcpinfo->bindinfo); bcpinfo->bindinfo = NULL; } void tds_free_bcpinfo(TDSBCPINFO *bcpinfo) { if (bcpinfo) { tds_deinit_bcpinfo(bcpinfo); free(bcpinfo); } } /** * Reallocate a pointer and update it if success * \param pp pointer to pointer to be reallocated * \param new_size new size to be allocated * \return new pointer allocated, NULL on failure */ void * tds_realloc(void **pp, size_t new_size) { void *p; /* some implementation of malloc/realloc does not like size==0 */ if (!new_size) new_size = 1; /* use malloc if not allocated before, some implementation require it */ if (*pp) p = realloc(*pp, new_size); else p = malloc(new_size); /* update pointer only on success */ if (p) *pp = p; return p; } /** @} */ freetds-1.3.6/src/tds/token.c000644 025423 025423 00000261770 14056414271 017471 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2005-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * \file * \brief Contains all routines to get replies from server */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #if HAVE_MALLOC_H #include #endif /* HAVE_MALLOC_H */ #include #include #include #include #include #include #include #include #include #include /** \cond HIDDEN_SYMBOLS */ #define USE_ICONV (tds->conn->use_iconv) #define TDS_GET_COLUMN_TYPE(col) do { \ TDS_TINYINT _tds_type = tds_get_byte(tds); \ if (!is_tds_type_valid(_tds_type)) \ return TDS_FAIL; \ tds_set_column_type(tds->conn, col, (TDS_SERVER_TYPE) _tds_type); \ } while(0) #define TDS_GET_COLUMN_INFO(tds, col) \ TDS_PROPAGATE(col->funcs->get_info(tds, col)) /** \endcond */ static TDSRET tds_process_info(TDSSOCKET * tds, int marker); static TDSRET tds_process_compute_result(TDSSOCKET * tds); static TDSRET tds_process_compute_names(TDSSOCKET * tds); static TDSRET tds7_process_compute_result(TDSSOCKET * tds); static TDSRET tds5_process_result(TDSSOCKET * tds); static TDSRET tds_process_col_name(TDSSOCKET * tds); static TDSRET tds_process_col_fmt(TDSSOCKET * tds); static TDSRET tds_process_tabname(TDSSOCKET *tds); static TDSRET tds_process_colinfo(TDSSOCKET * tds, char **names, int num_names); static TDSRET tds_process_compute(TDSSOCKET * tds); static TDSRET tds_process_cursor_tokens(TDSSOCKET * tds); static TDSRET tds_process_row(TDSSOCKET * tds); static TDSRET tds_process_nbcrow(TDSSOCKET * tds); static TDSRET tds_process_featureextack(TDSSOCKET * tds); static TDSRET tds_process_param_result(TDSSOCKET * tds, TDSPARAMINFO ** info); static TDSRET tds7_process_result(TDSSOCKET * tds); static TDSDYNAMIC *tds_process_dynamic(TDSSOCKET * tds); static TDSRET tds_process_auth(TDSSOCKET * tds); static TDSRET tds_process_env_chg(TDSSOCKET * tds); static TDSRET tds_process_param_result_tokens(TDSSOCKET * tds); static TDSRET tds_process_params_result_token(TDSSOCKET * tds); static TDSRET tds_process_dyn_result(TDSSOCKET * tds); static TDSRET tds5_process_result2(TDSSOCKET * tds); static TDSRET tds5_process_dyn_result2(TDSSOCKET * tds); static TDSRET tds_process_default_tokens(TDSSOCKET * tds, int marker); static TDSRET tds5_process_optioncmd(TDSSOCKET * tds); static TDSRET tds_process_end(TDSSOCKET * tds, int marker, /*@out@*/ int *flags_parm); static TDSRET tds_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int is_param); static /*@observer@*/ const char *tds_token_name(unsigned char marker); static void adjust_character_column_size(TDSSOCKET * tds, TDSCOLUMN * curcol); static int determine_adjusted_size(const TDSICONV * char_conv, int size); static /*@observer@*/ const char *tds_pr_op(int op); static int tds_alloc_get_string(TDSSOCKET * tds, /*@special@*/ char **string, size_t len) /*allocates *string*/; /** * \ingroup libtds * \defgroup token Results processing * Handle tokens in packets. Many PDU (packets data unit) contain tokens. * (like result description, rows, data, errors and many other). */ /** * \addtogroup token * @{ */ /** * tds_process_default_tokens() is a catch all function that is called to * process tokens not known to other tds_process_* routines * @tds * @param marker Token type */ static TDSRET tds_process_default_tokens(TDSSOCKET * tds, int marker) { int tok_size; int done_flags; TDS_INT ret_status; TDS_CAPABILITY_TYPE *cap; CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_FUNC, "tds_process_default_tokens() marker is %x(%s)\n", marker, tds_token_name(marker)); if (IS_TDSDEAD(tds)) { tdsdump_log(TDS_DBG_FUNC, "leaving tds_process_default_tokens() connection dead\n"); tds_close_socket(tds); return TDS_FAIL; } switch (marker) { case TDS_AUTH_TOKEN: return tds_process_auth(tds); break; case TDS_ENVCHANGE_TOKEN: return tds_process_env_chg(tds); break; case TDS_DONE_TOKEN: case TDS_DONEPROC_TOKEN: case TDS_DONEINPROC_TOKEN: return tds_process_end(tds, marker, &done_flags); break; case TDS_PROCID_TOKEN: tds_get_n(tds, NULL, 8); break; case TDS_RETURNSTATUS_TOKEN: ret_status = tds_get_int(tds); marker = tds_peek(tds); if (marker != TDS_PARAM_TOKEN && marker != TDS_DONEPROC_TOKEN && marker != TDS_DONE_TOKEN) break; tds->has_status = true; tds->ret_status = ret_status; tdsdump_log(TDS_DBG_INFO1, "tds_process_default_tokens: return status is %d\n", tds->ret_status); break; case TDS_ERROR_TOKEN: case TDS_INFO_TOKEN: case TDS_EED_TOKEN: return tds_process_info(tds, marker); break; case TDS_CAPABILITY_TOKEN: tok_size = tds_get_usmallint(tds); cap = tds->conn->capabilities.types; memset(cap, 0, 2*sizeof(*cap)); cap[0].type = 1; cap[0].len = sizeof(cap[0].values); cap[1].type = 2; cap[1].len = sizeof(cap[1].values); while (tok_size > 1) { unsigned char type, size, *p; type = tds_get_byte(tds); size = tds_get_byte(tds); tok_size -= 2 + size; if (type != 1 && type != 2) { tds_get_n(tds, NULL, size); continue; } if (size > sizeof(cap->values)) { tds_get_n(tds, NULL, size - sizeof(cap->values)); size = sizeof(cap->values); } p = (unsigned char *) &cap[type]; if (!tds_get_n(tds, p-size, size)) return TDS_FAIL; /* * Sybase 11.0 servers return the wrong length in the capability packet, * causing us to read past the done packet. */ if (tds->conn->product_version < TDS_SYB_VER(12, 0, 0) && type == 2) break; } break; /* PARAM_TOKEN can be returned inserting text in db, to return new timestamp */ case TDS_PARAM_TOKEN: tds_unget_byte(tds); return tds_process_param_result_tokens(tds); break; case TDS7_RESULT_TOKEN: return tds7_process_result(tds); break; case TDS_OPTIONCMD_TOKEN: return tds5_process_optioncmd(tds); break; case TDS_RESULT_TOKEN: return tds5_process_result(tds); break; case TDS_ROWFMT2_TOKEN: return tds5_process_result2(tds); break; case TDS_COLNAME_TOKEN: return tds_process_col_name(tds); break; case TDS_COLFMT_TOKEN: return tds_process_col_fmt(tds); break; case TDS_ROW_TOKEN: return tds_process_row(tds); break; case TDS5_PARAMFMT_TOKEN: /* store discarded parameters in param_info, not in old dynamic */ tds_release_cur_dyn(tds); return tds_process_dyn_result(tds); break; case TDS5_PARAMFMT2_TOKEN: tds_release_cur_dyn(tds); return tds5_process_dyn_result2(tds); break; case TDS5_PARAMS_TOKEN: /* save params */ return tds_process_params_result_token(tds); break; case TDS_CURINFO_TOKEN: return tds_process_cursor_tokens(tds); break; case TDS_CONTROL_FEATUREEXTACK_TOKEN: if (IS_TDS74_PLUS(tds->conn)) return tds_process_featureextack(tds); /* fall through */ case TDS5_DYNAMIC_TOKEN: case TDS_LOGINACK_TOKEN: case TDS_ORDERBY_TOKEN: tdsdump_log(TDS_DBG_WARN, "Eating %s token\n", tds_token_name(marker)); tds_get_n(tds, NULL, tds_get_usmallint(tds)); break; case TDS_MSG_TOKEN: tok_size = tds_get_byte(tds); if (tok_size >= 3) { tds_get_byte(tds); tds5_negotiate_set_msg_type(tds->conn->authentication, tds_get_usmallint(tds)); tok_size -= 3; } tds_get_n(tds, NULL, tok_size); break; case TDS_TABNAME_TOKEN: /* used for FOR BROWSE query */ return tds_process_tabname(tds); break; case TDS_COLINFO_TOKEN: return tds_process_colinfo(tds, NULL, 0); break; case TDS_SESSIONSTATE_TOKEN: case TDS_ORDERBY2_TOKEN: tdsdump_log(TDS_DBG_WARN, "Eating %s token\n", tds_token_name(marker)); tds_get_n(tds, NULL, tds_get_uint(tds)); break; case TDS_NBC_ROW_TOKEN: return tds_process_nbcrow(tds); break; default: tds_close_socket(tds); tdserror(tds_get_ctx(tds), tds, TDSEBTOK, 0); tdsdump_log(TDS_DBG_ERROR, "Unknown marker: %d(%x)!!\n", marker, (unsigned char) marker); return TDS_FAIL; } return TDS_SUCCESS; } static TDSRET tds_process_loginack(TDSSOCKET *tds, TDSRET *login_succeeded) { unsigned int len; unsigned char ack; TDS_UINT product_version; int memrc = 0; struct { unsigned char major, minor, tiny[2]; unsigned int reported; const char *name; } ver; tds->conn->tds71rev1 = 0; len = tds_get_usmallint(tds); if (len < 10) return TDS_FAIL; ack = tds_get_byte(tds); ver.major = tds_get_byte(tds); ver.minor = tds_get_byte(tds); ver.tiny[0] = tds_get_byte(tds); ver.tiny[1] = tds_get_byte(tds); ver.reported = (ver.major << 24) | (ver.minor << 16) | (ver.tiny[0] << 8) | ver.tiny[1]; if (ver.reported == 0x07010000) tds->conn->tds71rev1 = 1; /* Log reported server product name, cf. MS-TDS LOGINACK documentation. */ switch (ver.reported) { case 0x07000000: ver.name = "7.0"; tds->conn->tds_version = 0x700; break; case 0x07010000: ver.name = "2000"; tds->conn->tds_version = 0x701; break; case 0x71000001: ver.name = "2000 SP1"; tds->conn->tds_version = 0x701; break; case 0x72090002: ver.name = "2005"; tds->conn->tds_version = 0x702; break; case 0x730A0003: ver.name = "2008 (no NBCROW or fSparseColumnSet)"; tds->conn->tds_version = 0x703; break; case 0x730B0003: ver.name = "2008"; tds->conn->tds_version = 0x703; break; case 0x74000004: ver.name = "2012-2017"; tds->conn->tds_version = 0x704; break; default: ver.name = "unknown"; break; } tdsdump_log(TDS_DBG_FUNC, "server reports TDS version %x.%x.%x.%x\n", ver.major, ver.minor, ver.tiny[0], ver.tiny[1]); tdsdump_log(TDS_DBG_FUNC, "Product name for 0x%x is %s\n", ver.reported, ver.name); /* Get server product name. */ /* Ignore product name length; some servers seem to set it incorrectly. */ tds_get_byte(tds); product_version = 0; /* Compute product name length from packet length. */ len -= 10; free(tds->conn->product_name); if (ver.major >= 7u) { product_version = 0x80u; memrc += tds_alloc_get_string(tds, &tds->conn->product_name, len / 2); } else if (ver.major >= 5) { memrc += tds_alloc_get_string(tds, &tds->conn->product_name, len); } else { memrc += tds_alloc_get_string(tds, &tds->conn->product_name, len); if (tds->conn->product_name != NULL && strstr(tds->conn->product_name, "Microsoft") != NULL) product_version = 0x80u; } if (memrc != 0) return TDS_FAIL; product_version |= tds_get_byte(tds); product_version <<= 8; product_version |= tds_get_byte(tds); product_version <<= 8; product_version |= tds_get_byte(tds); product_version <<= 8; product_version |= tds_get_byte(tds); /* * MSSQL 6.5 and 7.0 seem to return strange values for this * using TDS 4.2, something like 5F 06 32 FF for 6.50 */ if (ver.major == 4 && ver.minor == 2 && (product_version & 0xff0000ffu) == 0x5f0000ffu) product_version = ((product_version & 0xffff00u) | 0x800000u) << 8; tds->conn->product_version = product_version; tdsdump_log(TDS_DBG_FUNC, "Product version %lX\n", (unsigned long) product_version); /* * TDS 5.0 reports 5 on success 6 on failure * TDS 4.2 reports 1 on success and is not * present on failure */ if (ack == 5 || ack == 1 || (IS_TDS50(tds->conn) && ack == 0x85)) { *login_succeeded = TDS_SUCCESS; /* authentication is now useless */ if (tds->conn->authentication) { tds->conn->authentication->free(tds->conn, tds->conn->authentication); tds->conn->authentication = NULL; } } return TDS_SUCCESS; } /** * tds_process_login_tokens() is called after sending the login packet * to the server. It returns the success or failure of the login * dependent on the protocol version. 4.2 sends an ACK token only when * successful, TDS 5.0 sends it always with a success byte within * @tds */ TDSRET tds_process_login_tokens(TDSSOCKET * tds) { TDSRET succeed = TDS_FAIL; int marker; CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_FUNC, "tds_process_login_tokens()\n"); do { marker = tds_get_byte(tds); tdsdump_log(TDS_DBG_FUNC, "looking for login token, got %x(%s)\n", marker, tds_token_name(marker)); switch (marker) { case TDS_LOGINACK_TOKEN: TDS_PROPAGATE(tds_process_loginack(tds, &succeed)); break; default: TDS_PROPAGATE(tds_process_default_tokens(tds, marker)); break; } if (marker == TDS_DONE_TOKEN && IS_TDS50(tds->conn) && tds->conn->authentication) { TDSAUTHENTICATION *auth = tds->conn->authentication; if (TDS_SUCCEED(auth->handle_next(tds, auth, 0))) { marker = 0; continue; } } } while (marker != TDS_DONE_TOKEN); /* set the spid */ if (TDS_IS_MSSQL(tds)) tds->conn->spid = TDS_GET_A2BE(tds->in_buf+4); tdsdump_log(TDS_DBG_FUNC, "tds_process_login_tokens() returning %s\n", (succeed == TDS_SUCCESS)? "TDS_SUCCESS" : "TDS_FAIL"); return succeed; } /** * Process authentication token. * This token is only TDS 7.0+. * \tds */ static TDSRET tds_process_auth(TDSSOCKET * tds) { unsigned int pdu_size; CHECK_TDS_EXTRA(tds); #if ENABLE_EXTRA_CHECKS if (!IS_TDS7_PLUS(tds->conn)) tdsdump_log(TDS_DBG_ERROR, "Called auth on TDS version < 7\n"); #endif pdu_size = tds_get_usmallint(tds); tdsdump_log(TDS_DBG_INFO1, "TDS_AUTH_TOKEN PDU size %u\n", pdu_size); if (!tds->conn->authentication) return TDS_FAIL; return tds->conn->authentication->handle_next(tds, tds->conn->authentication, pdu_size); } /** * process all streams. * tds_process_tokens() is called after submitting a query with * tds_submit_query() and is responsible for calling the routines to * populate tds->res_info if appropriate (some query have no result sets) * @tds * @param result_type A pointer to an integer variable which * tds_process_tokens sets to indicate the current type of result. * @par * Values that indicate command status * * * * *
    TDS_DONE_RESULTThe results of a command have been completely processed. * This command returned no rows.
    TDS_DONEPROC_RESULTThe results of a command have been completely processed. * This command returned rows.
    TDS_DONEINPROC_RESULTThe results of a command have been completely processed. * This command returned rows.
    * Values that indicate results information is available * * * * * * * * * *
    TDS_ROWFMT_RESULTRegular Data format informationtds->res_info now contains the result details ; tds->current_results now points to that data
    TDS_COMPUTEFMT_ RESULTCompute data format informationtds->comp_info now contains the result data; tds->current_results now points to that data
    TDS_DESCRIBE_RESULT
    * Values that indicate data is available * * * * * * * * * * * * * * *
    ValueMeaningInformation returned
    TDS_ROW_RESULTRegular row results1 or more rows of regular data can now be retrieved
    TDS_COMPUTE_RESULTCompute row resultsA single row of compute data can now be retrieved
    TDS_PARAM_RESULTReturn parameter resultsparam_info or cur_dyn->params contain returned parameters
    TDS_STATUS_RESULTStored procedure status resultstds->ret_status contain the returned code
    * @param done_flags Flags contained in the TDS_DONE*_TOKEN readed * @param flag Flags to select token type to stop/return * @todo Complete TDS_DESCRIBE_RESULT description * @retval TDS_SUCCESS if a result set is available for processing. * @retval TDS_FAIL on error. * @retval TDS_NO_MORE_RESULTS if all results have been completely processed. * @retval anything returned by one of the many functions it calls. :-( */ TDSRET tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsigned flag) { int marker; TDSPARAMINFO *pinfo = NULL; TDSCOLUMN *curcol; TDSRET rc; TDS_INT8 saved_rows_affected = tds->rows_affected; TDS_INT ret_status; int cancel_seen = 0; unsigned return_flag = 0; /** \cond HIDDEN_SYMBOLS */ #define SET_RETURN(ret, f) do { \ *result_type = ret; \ return_flag = TDS_RETURN_##f | TDS_STOPAT_##f; \ if (flag & TDS_STOPAT_##f) {\ tds_unget_byte(tds); \ tdsdump_log(TDS_DBG_FUNC, "tds_process_tokens::SET_RETURN stopping on current token\n"); \ goto set_return_exit; \ } } while(0) /** \endcond */ CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_FUNC, "tds_process_tokens(%p, %p, %p, 0x%x)\n", tds, result_type, done_flags, flag); if (tds->state == TDS_IDLE || tds->state == TDS_SENDING) { tdsdump_log(TDS_DBG_FUNC, "tds_process_tokens() state is COMPLETED\n"); *result_type = TDS_DONE_RESULT; return TDS_NO_MORE_RESULTS; } if (tds_set_state(tds, TDS_READING) != TDS_READING) return TDS_FAIL; rc = TDS_SUCCESS; for (;;) { marker = tds_get_byte(tds); tdsdump_log(TDS_DBG_INFO1, "processing result tokens. marker is %x(%s)\n", marker, tds_token_name(marker)); switch (marker) { case TDS7_RESULT_TOKEN: /* * If we're processing the results of a cursor fetch * from sql server we don't want to pass back the * TDS_ROWFMT_RESULT to the calling API */ if (tds->current_op != TDS_OP_CURSORFETCH) SET_RETURN(TDS_ROWFMT_RESULT, ROWFMT); rc = tds7_process_result(tds); if (TDS_FAILED(rc)) break; /* handle browse information (if present) */ marker = tds_get_byte(tds); if (marker != TDS_TABNAME_TOKEN) tds_unget_byte(tds); else rc = tds_process_tabname(tds); break; case TDS_RESULT_TOKEN: SET_RETURN(TDS_ROWFMT_RESULT, ROWFMT); rc = tds5_process_result(tds); break; case TDS_ROWFMT2_TOKEN: SET_RETURN(TDS_ROWFMT_RESULT, ROWFMT); rc = tds5_process_result2(tds); break; case TDS_COLNAME_TOKEN: rc = tds_process_col_name(tds); break; case TDS_COLFMT_TOKEN: SET_RETURN(TDS_ROWFMT_RESULT, ROWFMT); rc = tds_process_col_fmt(tds); if (TDS_FAILED(rc)) break; /* handle browse information (if present) */ marker = tds_get_byte(tds); if (marker != TDS_TABNAME_TOKEN) tds_unget_byte(tds); else rc = tds_process_tabname(tds); break; case TDS_PARAM_TOKEN: tds_unget_byte(tds); if (tds->current_op) { tdsdump_log(TDS_DBG_FUNC, "processing parameters for op %d\n", tds->current_op); while ((marker = tds_get_byte(tds)) == TDS_PARAM_TOKEN) { tdsdump_log(TDS_DBG_INFO1, "calling tds_process_param_result\n"); rc = tds_process_param_result(tds, &pinfo); if (TDS_FAILED(rc)) goto set_return_exit; } tds_unget_byte(tds); tdsdump_log(TDS_DBG_FUNC, "%d hidden return parameters\n", pinfo ? pinfo->num_cols : -1); if (pinfo && pinfo->num_cols > 0) { curcol = pinfo->columns[0]; if (tds->current_op == TDS_OP_CURSOROPEN && tds->cur_cursor) { TDSCURSOR *cursor = tds->cur_cursor; cursor->cursor_id = *(TDS_INT *) curcol->column_data; tdsdump_log(TDS_DBG_FUNC, "stored internal cursor id %d\n", cursor->cursor_id); cursor->srv_status &= ~(TDS_CUR_ISTAT_CLOSED|TDS_CUR_ISTAT_OPEN|TDS_CUR_ISTAT_DEALLOC); cursor->srv_status |= cursor->cursor_id ? TDS_CUR_ISTAT_OPEN : TDS_CUR_ISTAT_CLOSED|TDS_CUR_ISTAT_DEALLOC; } if ((tds->current_op == TDS_OP_PREPARE || tds->current_op == TDS_OP_PREPEXEC) && tds->cur_dyn && tds->cur_dyn->num_id == 0 && curcol->column_cur_size > 0) { tds->cur_dyn->num_id = *(TDS_INT *) curcol->column_data; } if (tds->current_op == TDS_OP_UNPREPARE) tds_dynamic_deallocated(tds->conn, tds->cur_dyn); } tds_free_param_results(pinfo); } else { SET_RETURN(TDS_PARAM_RESULT, PROC); rc = tds_process_param_result_tokens(tds); } break; case TDS_COMPUTE_NAMES_TOKEN: rc = tds_process_compute_names(tds); break; case TDS_COMPUTE_RESULT_TOKEN: SET_RETURN(TDS_COMPUTEFMT_RESULT, COMPUTEFMT); rc = tds_process_compute_result(tds); break; case TDS7_COMPUTE_RESULT_TOKEN: SET_RETURN(TDS_COMPUTEFMT_RESULT, COMPUTEFMT); rc = tds7_process_compute_result(tds); break; case TDS_ROW_TOKEN: case TDS_NBC_ROW_TOKEN: /* overstepped the mark... */ if (tds->cur_cursor) { tds_set_current_results(tds, tds->cur_cursor->res_info); tdsdump_log(TDS_DBG_INFO1, "tds_process_tokens(). set current_results to cursor->res_info\n"); } else { /* assure that we point to row, not to compute */ if (tds->res_info) tds_set_current_results(tds, tds->res_info); } /* I don't know when this it's false but it happened, also server can send garbage... */ if (tds->current_results) tds->current_results->rows_exist = true; SET_RETURN(TDS_ROW_RESULT, ROW); switch (marker) { case TDS_ROW_TOKEN: rc = tds_process_row(tds); break; case TDS_NBC_ROW_TOKEN: rc = tds_process_nbcrow(tds); break; } break; case TDS_CMP_ROW_TOKEN: /* I don't know when this it's false but it happened, also server can send garbage... */ if (tds->res_info) tds->res_info->rows_exist = true; SET_RETURN(TDS_COMPUTE_RESULT, COMPUTE); rc = tds_process_compute(tds); break; case TDS_RETURNSTATUS_TOKEN: ret_status = tds_get_int(tds); marker = tds_peek(tds); if (marker != TDS_PARAM_TOKEN && marker != TDS_DONEPROC_TOKEN && marker != TDS_DONE_TOKEN && marker != TDS5_PARAMFMT_TOKEN && marker != TDS5_PARAMFMT2_TOKEN) break; if (tds->current_op) { /* TODO perhaps we should use ret_status ?? */ } else { /* TODO optimize */ flag &= ~TDS_STOPAT_PROC; SET_RETURN(TDS_STATUS_RESULT, PROC); tds->has_status = true; tds->ret_status = ret_status; tdsdump_log(TDS_DBG_FUNC, "tds_process_tokens: return status is %d\n", tds->ret_status); rc = TDS_SUCCESS; } break; case TDS5_DYNAMIC_TOKEN: /* process acknowledge dynamic */ tds_set_cur_dyn(tds, tds_process_dynamic(tds)); /* special case, prepared statement cannot be prepared */ if (!tds->cur_dyn || tds->cur_dyn->emulated) break; marker = tds_get_byte(tds); if (marker != TDS_EED_TOKEN) { tds_unget_byte(tds); break; } tds_process_info(tds, marker); if (!tds->cur_dyn || !tds->cur_dyn->emulated) break; marker = tds_get_byte(tds); if (marker != TDS_DONE_TOKEN) { tds_unget_byte(tds); break; } rc = tds_process_end(tds, marker, done_flags); if (done_flags) *done_flags &= ~TDS_DONE_ERROR; /* FIXME warning to macro expansion */ SET_RETURN(TDS_DONE_RESULT, DONE); break; case TDS5_PARAMFMT_TOKEN: SET_RETURN(TDS_DESCRIBE_RESULT, PARAMFMT); rc = tds_process_dyn_result(tds); break; case TDS5_PARAMFMT2_TOKEN: SET_RETURN(TDS_DESCRIBE_RESULT, PARAMFMT); rc = tds5_process_dyn_result2(tds); break; case TDS5_PARAMS_TOKEN: SET_RETURN(TDS_PARAM_RESULT, PROC); rc = tds_process_params_result_token(tds); break; case TDS_CURINFO_TOKEN: rc = tds_process_cursor_tokens(tds); break; case TDS_DONE_TOKEN: SET_RETURN(TDS_DONE_RESULT, DONE); rc = tds_process_end(tds, marker, done_flags); switch (tds->current_op) { case TDS_OP_DYN_DEALLOC: if (done_flags && (*done_flags & TDS_DONE_ERROR) == 0) tds_dynamic_deallocated(tds->conn, tds->cur_dyn); break; default: break; } break; case TDS_DONEPROC_TOKEN: SET_RETURN(TDS_DONEPROC_RESULT, DONE); rc = tds_process_end(tds, marker, done_flags); tds->rows_affected = saved_rows_affected; switch (tds->current_op) { default: break; case TDS_OP_CURSOROPEN: *result_type = TDS_DONE_RESULT; break; case TDS_OP_CURSORCLOSE: tdsdump_log(TDS_DBG_FUNC, "TDS_OP_CURSORCLOSE\n"); if (tds->cur_cursor) { TDSCURSOR *cursor = tds->cur_cursor; cursor->srv_status &= ~TDS_CUR_ISTAT_OPEN; cursor->srv_status |= TDS_CUR_ISTAT_CLOSED|TDS_CUR_ISTAT_DECLARED; if (cursor->status.dealloc == TDS_CURSOR_STATE_SENT) { tds_cursor_deallocated(tds->conn, cursor); } } *result_type = TDS_NO_MORE_RESULTS; rc = TDS_NO_MORE_RESULTS; break; case TDS_OP_UNPREPARE: if (done_flags && (*done_flags & TDS_DONE_ERROR) == 0) tds_dynamic_deallocated(tds->conn, tds->cur_dyn); *result_type = TDS_NO_MORE_RESULTS; rc = TDS_NO_MORE_RESULTS; break; case TDS_OP_CURSOR: case TDS_OP_CURSORPREPARE: case TDS_OP_CURSOREXECUTE: case TDS_OP_CURSORPREPEXEC: case TDS_OP_CURSORUNPREPARE: case TDS_OP_CURSORFETCH: case TDS_OP_CURSOROPTION: case TDS_OP_PREPEXECRPC: *result_type = TDS_NO_MORE_RESULTS; rc = TDS_NO_MORE_RESULTS; break; } break; case TDS_DONEINPROC_TOKEN: switch(tds->current_op) { case TDS_OP_CURSOROPEN: case TDS_OP_CURSORFETCH: case TDS_OP_PREPARE: case TDS_OP_CURSORCLOSE: rc = tds_process_end(tds, marker, done_flags); if (tds->rows_affected != TDS_NO_COUNT) { saved_rows_affected = tds->rows_affected; } break; default: SET_RETURN(TDS_DONEINPROC_RESULT, DONE); rc = tds_process_end(tds, marker, done_flags); break; } break; case TDS_ERROR_TOKEN: case TDS_INFO_TOKEN: case TDS_EED_TOKEN: SET_RETURN(TDS_MSG_RESULT, MSG); rc = tds_process_default_tokens(tds, marker); break; case TDS_ENVCHANGE_TOKEN: SET_RETURN(TDS_MSG_RESULT, ENV); rc = tds_process_default_tokens(tds, marker); break; default: SET_RETURN(TDS_OTHERS_RESULT, OTHERS); rc = tds_process_default_tokens(tds, marker); break; } set_return_exit: if (TDS_FAILED(rc)) { if (rc == TDS_CANCELLED) tds_set_state(tds, TDS_PENDING); else tds_close_socket(tds); return rc; } cancel_seen |= tds->in_cancel; if (cancel_seen) { /* during cancel handle all tokens */ flag = TDS_HANDLE_ALL; } if ((return_flag & flag) != 0) { tds_set_state(tds, TDS_PENDING); return rc; } if (tds->state == TDS_IDLE || tds->state == TDS_SENDING) return cancel_seen ? TDS_CANCELLED : TDS_NO_MORE_RESULTS; if (tds->state == TDS_DEAD) { /* TODO free all results ?? */ return TDS_FAIL; } } } /** * Process results for simple query as "SET TEXTSIZE" or "USE dbname" * If the statement returns results, beware they are discarded. * * This function was written to avoid direct calls to tds_process_default_tokens * (which caused problems such as ignoring query errors). * Results are read until idle state or severe failure (do not stop for * statement failure). * @return see tds_process_tokens for results (TDS_NO_MORE_RESULTS is never returned) */ TDSRET tds_process_simple_query(TDSSOCKET * tds) { TDS_INT res_type; TDS_INT done_flags; TDSRET rc; TDSRET ret = TDS_SUCCESS; CHECK_TDS_EXTRA(tds); while ((rc = tds_process_tokens(tds, &res_type, &done_flags, TDS_RETURN_DONE)) == TDS_SUCCESS) { switch (res_type) { case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if ((done_flags & TDS_DONE_ERROR) != 0) ret = TDS_FAIL; break; default: break; } } if (TDS_FAILED(rc)) ret = rc; return ret; } /** * Holds list of names */ struct namelist { /** string name */ char *name; /** next element in the list */ struct namelist *next; }; /** * Frees list of names * \param head list head to free */ static void tds_free_namelist(struct namelist *head) { struct namelist *cur = head, *prev; while (cur != NULL) { prev = cur; cur = cur->next; free(prev->name); free(prev); } } /** * Reads list of names (usually table names) * \tds * \param remainder bytes left to read * \param p_head list head to return * \param large true if name length from network are 2 byte (usually 1) */ static int tds_read_namelist(TDSSOCKET * tds, int remainder, struct namelist **p_head, int large) { struct namelist *head = NULL, *cur = NULL, *prev; int num_names = 0; /* * this is a little messy...TDS 5.0 gives the number of columns * upfront, while in TDS 4.2, you're expected to figure it out * by the size of the message. So, I use a link list to get the * colum names and then allocate the result structure, copy * and delete the linked list */ while (remainder > 0) { TDS_USMALLINT namelen; prev = cur; if (!(cur = tds_new(struct namelist, 1))) { tds_free_namelist(head); return -1; } cur->next = NULL; if (prev) prev->next = cur; else head = cur; if (large) { namelen = tds_get_usmallint(tds); remainder -= 2; } else { namelen = tds_get_byte(tds); --remainder; } if (tds_alloc_get_string(tds, &cur->name, namelen) < 0) { tds_free_namelist(head); return -1; } remainder -= namelen; if (IS_TDS7_PLUS(tds->conn)) remainder -= namelen; num_names++; } *p_head = head; return num_names; } /** * tds_process_col_name() is one half of the result set under TDS 4.2 * it contains all the column names, a TDS_COLFMT_TOKEN should * immediately follow this token with the datatype/size information * This is a 4.2 only function * \tds */ static TDSRET tds_process_col_name(TDSSOCKET * tds) { int hdrsize; int col, num_names = 0; struct namelist *head = NULL, *cur = NULL; TDSCOLUMN *curcol; TDSRESULTINFO *info; CHECK_TDS_EXTRA(tds); hdrsize = tds_get_usmallint(tds); if ((num_names = tds_read_namelist(tds, hdrsize, &head, 0)) < 0) return TDS_FAIL; /* free results/computes/params etc... */ tds_free_all_results(tds); tds->rows_affected = TDS_NO_COUNT; if ((info = tds_alloc_results(num_names)) == NULL) goto memory_error; tds->res_info = info; tds_set_current_results(tds, info); cur = head; for (col = 0; col < num_names; ++col) { curcol = info->columns[col]; if (!tds_dstr_copy(&curcol->column_name, cur->name)) goto memory_error; cur = cur->next; } tds_free_namelist(head); return TDS_SUCCESS; memory_error: tds_free_namelist(head); return TDS_FAIL; } /** * tds_process_col_fmt() is the other half of result set processing * under TDS 4.2. It follows tds_process_col_name(). It contains all the * column type and size information. * This is a 4.2 only function * \tds */ static TDSRET tds_process_col_fmt(TDSSOCKET * tds) { unsigned int col; TDSCOLUMN *curcol; TDSRESULTINFO *info; TDS_USMALLINT flags; CHECK_TDS_EXTRA(tds); tds_get_usmallint(tds); /* hdrsize */ /* TODO use current_results instead of res_info ?? */ info = tds->res_info; if (!info || info->num_cols < 0) return TDS_FAIL; for (col = 0; col < info->num_cols; col++) { curcol = info->columns[col]; /* In Sybase all 4 byte are used for usertype, while mssql place 2 byte as usertype and 2 byte as flags */ if (TDS_IS_MSSQL(tds)) { curcol->column_usertype = tds_get_smallint(tds); flags = tds_get_usmallint(tds); curcol->column_nullable = flags & 0x01; curcol->column_writeable = (flags & 0x08) > 0; curcol->column_identity = (flags & 0x10) > 0; } else { curcol->column_usertype = tds_get_int(tds); } /* on with our regularly scheduled code (mlilback, 11/7/01) */ TDS_GET_COLUMN_TYPE(curcol); tdsdump_log(TDS_DBG_INFO1, "processing result. type = %d(%s), varint_size %d\n", curcol->column_type, tds_prtype(curcol->column_type), curcol->column_varint_size); TDS_GET_COLUMN_INFO(tds, curcol); /* Adjust column size according to client's encoding */ curcol->on_server.column_size = curcol->column_size; adjust_character_column_size(tds, curcol); } return tds_alloc_row(info); } /** * Reads table names for TDS 7.1+. * TDS 7.1+ return table names as an array of names * (so database.schema.owner.name as separate names) * \tds * \param remainder bytes left to read * \param p_head pointer to list head to return * \return number of element returned or -1 on error */ static int tds71_read_table_names(TDSSOCKET *tds, int remainder, struct namelist **p_head) { struct namelist *head = NULL, *cur = NULL, *prev; int num_names = 0; /* * this is a little messy...TDS 5.0 gives the number of columns * upfront, while in TDS 4.2, you're expected to figure it out * by the size of the message. So, I use a link list to get the * colum names and then allocate the result structure, copy * and delete the linked list */ while (remainder > 0) { int elements, i; size_t len; char *partials[4], *p; prev = cur; if (!(cur = tds_new(struct namelist, 1))) { tds_free_namelist(head); return -1; } cur->name = NULL; cur->next = NULL; if (prev) prev->next = cur; else head = cur; elements = tds_get_byte(tds); --remainder; if (elements <= 0 || elements > 4) { tds_free_namelist(head); return -1; } /* read partials IDs and compute full length */ len = 0; for (i = 0; i < elements; ++i) { TDS_USMALLINT namelen = tds_get_usmallint(tds); remainder -= 2 + 2 * namelen; if (tds_alloc_get_string(tds, &partials[i], namelen) < 0) { while (i > 0) free(partials[--i]); tds_free_namelist(head); return -1; } len += tds_quote_id(tds, NULL, partials[i], -1) + 1; } /* allocate full name */ p = tds_new(char, len); if (!p) { i = elements; while (i > 0) free(partials[--i]); tds_free_namelist(head); return -1; } /* compose names */ cur->name = p; for (i = 0; i < elements; ++i) { p += tds_quote_id(tds, p, partials[i], -1); *p++ = '.'; free(partials[i]); } *--p = 0; num_names++; } *p_head = head; return num_names; } /** * Process list of table from network. * This token is only TDS 4.2 * \tds */ static TDSRET tds_process_tabname(TDSSOCKET *tds) { struct namelist *head, *cur; int num_names, hdrsize, i; char **names; unsigned char marker; TDSRET rc; hdrsize = tds_get_usmallint(tds); /* different structure for tds7.1 */ /* hdrsize check is required for tds7.1 revision 1 (mssql without SPs) */ /* TODO change tds_version ?? */ if (IS_TDS71_PLUS(tds->conn) && (!IS_TDS71(tds->conn) || !tds->conn->tds71rev1)) num_names = tds71_read_table_names(tds, hdrsize, &head); else num_names = tds_read_namelist(tds, hdrsize, &head, IS_TDS7_PLUS(tds->conn)); if (num_names <= 0) return TDS_FAIL; /* put in an array */ names = tds_new(char*, num_names); if (!names) { tds_free_namelist(head); return TDS_FAIL; } for (cur = head, i = 0; i < num_names; ++i, cur = cur->next) names[i] = cur->name; rc = TDS_SUCCESS; marker = tds_get_byte(tds); if (marker != TDS_COLINFO_TOKEN) tds_unget_byte(tds); else rc = tds_process_colinfo(tds, names, num_names); free(names); tds_free_namelist(head); return rc; } /** * Reads column information. * This token is only TDS 4.2 * \tds * \param[in] names table names * \param[in] num_names number of table names */ static TDSRET tds_process_colinfo(TDSSOCKET * tds, char **names, int num_names) { unsigned int hdrsize, l; TDSCOLUMN *curcol; TDSRESULTINFO *info; unsigned int bytes_read = 0; struct { unsigned char num_col; unsigned char num_table; unsigned char flags; } col_info; CHECK_TDS_EXTRA(tds); hdrsize = tds_get_usmallint(tds); info = tds->current_results; while (bytes_read < hdrsize) { tds_get_n(tds, &col_info, 3); bytes_read += 3; curcol = NULL; if (info && col_info.num_col > 0 && col_info.num_col <= info->num_cols) curcol = info->columns[col_info.num_col - 1]; if (curcol) { curcol->column_writeable = (col_info.flags & 0x4) == 0; curcol->column_key = (col_info.flags & 0x8) > 0; curcol->column_hidden = (col_info.flags & 0x10) > 0; if (names && col_info.num_table > 0 && col_info.num_table <= num_names) if (!tds_dstr_copy(&curcol->table_name, names[col_info.num_table - 1])) return TDS_FAIL; } /* read real column name */ if (col_info.flags & 0x20) { l = tds_get_byte(tds); if (curcol) { tds_dstr_get(tds, &curcol->table_column_name, l); if (IS_TDS7_PLUS(tds->conn)) l *= 2; } else { if (IS_TDS7_PLUS(tds->conn)) l *= 2; /* discard silently */ tds_get_n(tds, NULL, l); } bytes_read += l + 1; } } return TDS_SUCCESS; } /** * process output parameters of a stored * procedure. This differs from regular row/compute results in that there * is no total number of parameters given, they just show up singly. * \tds * \param[out] pinfo output parameter. * Should point to a not allocated structure */ static TDSRET tds_process_param_result(TDSSOCKET * tds, TDSPARAMINFO ** pinfo) { TDSCOLUMN *curparam; TDSPARAMINFO *info; TDSRET token; tdsdump_log(TDS_DBG_FUNC, "tds_process_param_result(%p, %p)\n", tds, pinfo); CHECK_TDS_EXTRA(tds); if (*pinfo) CHECK_PARAMINFO_EXTRA(*pinfo); /* TODO check if current_results is a param result */ /* limited to 64K but possible types are always smaller (not TEXT/IMAGE) */ tds_get_smallint(tds); /* header size */ if ((info = tds_alloc_param_result(*pinfo)) == NULL) return TDS_FAIL; *pinfo = info; curparam = info->columns[info->num_cols - 1]; /* * FIXME check support for tds7+ (seem to use same format of tds5 for data...) * perhaps varint_size can be 2 or collation can be specified ?? */ TDS_PROPAGATE(tds_get_data_info(tds, curparam, 1)); curparam->column_cur_size = curparam->column_size; /* needed ?? */ if (tds_alloc_param_data(curparam) == NULL) return TDS_FAIL; token = curparam->funcs->get_data(tds, curparam); if (TDS_UNLIKELY(tds_write_dump)) tdsdump_col(curparam); /* * Real output parameters will either be unnamed or will have a valid * parameter name beginning with '@'. Ignore any other Spurious parameters * such as those returned from calls to writetext in the proc. */ if (!tds_dstr_isempty(&curparam->column_name) && tds_dstr_cstr(&curparam->column_name)[0] != '@') tds_free_param_result(*pinfo); return token; } /** * Process parameters from networks. * Read all consecutives paramaters, not a single one. * Parameters are then stored in tds->param_info or tds->cur_dyn->res_info * depending if we are reading cursor results or normal parameters. * \tds */ static TDSRET tds_process_param_result_tokens(TDSSOCKET * tds) { int marker; TDSPARAMINFO **pinfo; CHECK_TDS_EXTRA(tds); if (tds->cur_dyn) pinfo = &(tds->cur_dyn->res_info); else pinfo = &(tds->param_info); while ((marker = tds_get_byte(tds)) == TDS_PARAM_TOKEN) { TDS_PROPAGATE(tds_process_param_result(tds, pinfo)); } if (!marker) { tdsdump_log(TDS_DBG_FUNC, "error: tds_process_param_result() returned TDS_FAIL\n"); return TDS_FAIL; } tds_set_current_results(tds, *pinfo); tds_unget_byte(tds); return TDS_SUCCESS; } /** * tds_process_params_result_token() processes params on TDS5. * \tds */ static TDSRET tds_process_params_result_token(TDSSOCKET * tds) { unsigned int i; TDSPARAMINFO *info; CHECK_TDS_EXTRA(tds); /* TODO check if current_results is a param result */ info = tds->current_results; if (!info) return TDS_FAIL; for (i = 0; i < info->num_cols; i++) { TDSCOLUMN *curcol = info->columns[i]; TDS_PROPAGATE(curcol->funcs->get_data(tds, curcol)); } return TDS_SUCCESS; } /** * tds_process_compute_result() processes compute result sets. These functions * need work but since they get little use, nobody has complained! * It is very similar to normal result sets. * \tds */ static TDSRET tds_process_compute_result(TDSSOCKET * tds) { unsigned int col, num_cols; TDS_TINYINT by_cols = 0; TDS_SMALLINT *cur_by_col; TDS_SMALLINT compute_id = 0; TDSCOLUMN *curcol; TDSCOMPUTEINFO *info = NULL; unsigned int i; CHECK_TDS_EXTRA(tds); tds_get_smallint(tds); /* header size*/ /* * Compute statement id which this relates to. * You can have more than one compute clause in a SQL statement */ compute_id = tds_get_smallint(tds); num_cols = tds_get_byte(tds); tdsdump_log(TDS_DBG_INFO1, "tds_process_compute_result(): compute_id %d for %d columns\n", compute_id, num_cols); for (i=0; i < tds->num_comp_info; ++i) { if (tds->comp_info[i]->computeid == compute_id) { info = tds->comp_info[i]; break; } } if (NULL == info) { tdsdump_log(TDS_DBG_FUNC, "logic error: compute_id (%d) from server not found in tds->comp_info\n", compute_id); return TDS_FAIL; } tdsdump_log(TDS_DBG_FUNC, "found computeid %d in tds->comp_info\n", info->computeid); tds_set_current_results(tds, info); tdsdump_log(TDS_DBG_INFO1, "processing compute result. num_cols = %d\n", num_cols); /* * Iterate over compute columns returned, * e.g. COMPUTE SUM(x), AVG(x) would return num_cols = 2. */ for (col = 0; col < num_cols; col++) { tdsdump_log(TDS_DBG_INFO1, "processing compute column %d\n", col); curcol = info->columns[col]; curcol->column_operator = tds_get_byte(tds); curcol->column_operand = tds_get_byte(tds); /* If no name has been defined for the compute column, use "max", "avg" etc. */ if (tds_dstr_isempty(&curcol->column_name)) if (!tds_dstr_copy(&curcol->column_name, tds_pr_op(curcol->column_operator))) return TDS_FAIL; /* User defined data type of the column */ curcol->column_usertype = tds_get_int(tds); TDS_GET_COLUMN_TYPE(curcol); TDS_GET_COLUMN_INFO(tds, curcol); tdsdump_log(TDS_DBG_INFO1, "compute column_size is %d\n", curcol->column_size); /* Adjust column size according to client's encoding */ curcol->on_server.column_size = curcol->column_size; /* TODO check if this column can have collation information associated */ adjust_character_column_size(tds, curcol); /* skip locale */ if (!IS_TDS42(tds->conn)) tds_get_n(tds, NULL, tds_get_byte(tds)); } by_cols = tds_get_byte(tds); tdsdump_log(TDS_DBG_INFO1, "processing tds compute result, by_cols = %d\n", by_cols); if (by_cols) { if ((info->bycolumns = tds_new0(TDS_SMALLINT, by_cols)) == NULL) return TDS_FAIL; } info->by_cols = by_cols; cur_by_col = info->bycolumns; for (col = 0; col < by_cols; col++) { *cur_by_col = tds_get_byte(tds); cur_by_col++; } return tds_alloc_compute_row(info); } /** * Reads data information from wire * \tds * \param curcol column where to store information */ static TDSRET tds7_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol) { CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); /* User defined data type of the column */ curcol->column_usertype = IS_TDS72_PLUS(tds->conn) ? tds_get_int(tds) : tds_get_smallint(tds); curcol->column_flags = tds_get_smallint(tds); /* Flags */ curcol->column_nullable = curcol->column_flags & 0x01; curcol->column_writeable = (curcol->column_flags & 0x08) > 0; curcol->column_identity = (curcol->column_flags & 0x10) > 0; curcol->column_computed = (curcol->column_flags & 0x20) > 0; TDS_GET_COLUMN_TYPE(curcol); /* sets "cardinal" type */ curcol->column_timestamp = (curcol->column_type == SYBBINARY && curcol->column_usertype == TDS_UT_TIMESTAMP); TDS_GET_COLUMN_INFO(tds, curcol); /* Adjust column size according to client's encoding */ curcol->on_server.column_size = curcol->column_size; /* NOTE adjustements must be done after curcol->char_conv initialization */ adjust_character_column_size(tds, curcol); /* * under 7.0 lengths are number of characters not * number of bytes...tds_get_string handles this */ tds_dstr_get(tds, &curcol->column_name, tds_get_byte(tds)); tdsdump_log(TDS_DBG_INFO1, "tds7_get_data_info: \n" "\tcolname = %s\n" "\ttype = %d (%s)\n" "\tserver's type = %d (%s)\n" "\tcolumn_varint_size = %d\n" "\tcolumn_size = %d (%d on server)\n", tds_dstr_cstr(&curcol->column_name), curcol->column_type, tds_prtype(curcol->column_type), curcol->on_server.column_type, tds_prtype(curcol->on_server.column_type), curcol->column_varint_size, curcol->column_size, curcol->on_server.column_size); CHECK_COLUMN_EXTRA(curcol); return TDS_SUCCESS; } /** * tds7_process_result() is the TDS 7.0 result set processing routine. It * is responsible for populating the tds->res_info structure. * This is a TDS 7.0 only function * \tds */ static TDSRET tds7_process_result(TDSSOCKET * tds) { int col, num_cols; TDSRET result; TDSRESULTINFO *info; CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_INFO1, "processing TDS7 result metadata.\n"); /* read number of columns and allocate the columns structure */ num_cols = tds_get_smallint(tds); /* This can be a DUMMY results token from a cursor fetch */ if (num_cols < 0) { tdsdump_log(TDS_DBG_INFO1, "no meta data\n"); return TDS_SUCCESS; } tds_free_all_results(tds); tds->rows_affected = TDS_NO_COUNT; if ((info = tds_alloc_results(num_cols)) == NULL) return TDS_FAIL; tds_set_current_results(tds, info); if (tds->cur_cursor) { tds_free_results(tds->cur_cursor->res_info); tds->cur_cursor->res_info = info; tdsdump_log(TDS_DBG_INFO1, "set current_results to cursor->res_info\n"); } else { tds->res_info = info; tdsdump_log(TDS_DBG_INFO1, "set current_results (%d column%s) to tds->res_info\n", num_cols, (num_cols==1? "":"s")); } /* * loop through the columns populating COLINFO struct from * server response */ tdsdump_log(TDS_DBG_INFO1, "setting up %d columns\n", num_cols); for (col = 0; col < num_cols; col++) { TDSCOLUMN *curcol = info->columns[col]; TDS_PROPAGATE(tds7_get_data_info(tds, curcol)); } if (num_cols > 0) { static const char dashes[31] = "------------------------------"; tdsdump_log(TDS_DBG_INFO1, " %-20s %-15s %-15s %-7s\n", "name", "size/wsize", "type/wtype", "utype"); tdsdump_log(TDS_DBG_INFO1, " %-20s %15s %15s %7s\n", dashes+10, dashes+30-15, dashes+30-15, dashes+30-7); } for (col = 0; col < num_cols; col++) { TDSCOLUMN *curcol = info->columns[col]; tdsdump_log(TDS_DBG_INFO1, " %-20s %7d/%-7d %7d/%-7d %7d\n", tds_dstr_cstr(&curcol->column_name), curcol->column_size, curcol->on_server.column_size, curcol->column_type, curcol->on_server.column_type, curcol->column_usertype); } /* all done now allocate a row for tds_process_row to use */ result = tds_alloc_row(info); CHECK_TDS_EXTRA(tds); return result; } /** * Reads data metadata from wire * \param tds state information for the socket and the TDS protocol * \param curcol column where to store information * \param is_param true if metadata are for a parameter (false for normal * column) */ static TDSRET tds_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int is_param) { CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); tdsdump_log(TDS_DBG_INFO1, "tds_get_data_info(%p, %p, %d) %s\n", tds, curcol, is_param, is_param? "[for parameter]" : ""); tds_dstr_get(tds, &curcol->column_name, tds_get_byte(tds)); curcol->column_flags = tds_get_byte(tds); /* Flags */ if (!is_param) { /* TODO check if all flags are the same for all TDS versions */ if (IS_TDS50(tds->conn)) curcol->column_hidden = curcol->column_flags & 0x1; curcol->column_key = (curcol->column_flags & 0x2) > 1; curcol->column_writeable = (curcol->column_flags & 0x10) > 1; curcol->column_nullable = (curcol->column_flags & 0x20) > 1; curcol->column_identity = (curcol->column_flags & 0x40) > 1; #if 0 /**************************************** * NumParts=BYTE; (introduced in TDS 7.2) * PartName=US_VARCHAR;(introduced in TDS 7.2) * TableName=NumParts, {PartName}-; * ColName= HYPERLINK \l "B_VARCHAR_Def" B_VARCHAR; * ColumnData=UserType, Flags, [TableName], // ColName; * NoMetaData='0xFF', '0xFF'; */ enum column_flag_bits_according_to_microsoft { case_sensitive = 0x0001 , nullable = 0x0002 , updateable = 0x0004 , might_be_updateable = 0x0008 , identity = 0x0010 , computed = 0x0020 , us_reserved_odbc = 0x0040 | 0x0080 , is_fixed_len_clr_type = 0x0100 , is_hidden_browse_pk = 0x0200 , is_browse_pk = 0x0400 , might_be_nullable = 0x0800 }; /* TODO: implement members in TDSCOLUMN */ if (IS_TDS72_PLUS(tds->conn)) { curcol->is_computed = (curcol->column_flags & (1 << 4)) > 1; curcol->us_reserved_odbc1 = (curcol->column_flags & (1 << 5)) > 1; curcol->us_reserved_odbc2 = (curcol->column_flags & (1 << 6)) > 1; curcol->is_fixed_len_clr_type = (curcol->column_flags & (1 << 7)) > 1; } #endif } if (IS_TDS72_PLUS(tds->conn)) { tds_get_n(tds, NULL, 2); #if 0 /* TODO: implement members in TDSCOLUMN, values untested */ curcol->us_reserved1 = (curcol->column_flags & 0x01); curcol->us_reserved2 = (curcol->column_flags & 0x02); curcol->us_reserved3 = (curcol->column_flags & 0x04); curcol->us_reserved4 = (curcol->column_flags & 0x08); curcol->is_hidden = (curcol->column_flags & 0x10); curcol->is_key = (curcol->column_flags & 0x20); curcol->is_nullable_unknown = (curcol->column_flags & 0x40); #endif } curcol->column_usertype = tds_get_int(tds); TDS_GET_COLUMN_TYPE(curcol); tdsdump_log(TDS_DBG_INFO1, "processing result. type = %d(%s), varint_size %d\n", curcol->column_type, tds_prtype(curcol->column_type), curcol->column_varint_size); TDS_GET_COLUMN_INFO(tds, curcol); tdsdump_log(TDS_DBG_INFO1, "processing result. column_size %d\n", curcol->column_size); /* Adjust column size according to client's encoding */ curcol->on_server.column_size = curcol->column_size; adjust_character_column_size(tds, curcol); return TDS_SUCCESS; } /** * tds5_process_result() is the TDS 5.0 result set processing routine. * It is responsible for populating the tds->res_info structure. * This is a TDS 5.0 only function * \tds */ static TDSRET tds5_process_result(TDSSOCKET * tds) { unsigned int col, num_cols; TDSCOLUMN *curcol; TDSRESULTINFO *info; CHECK_TDS_EXTRA(tds); tds_free_all_results(tds); tds->rows_affected = TDS_NO_COUNT; tds_get_usmallint(tds); /* header size */ /* read number of columns and allocate the columns structure */ num_cols = tds_get_usmallint(tds); if ((info = tds_alloc_results(num_cols)) == NULL) return TDS_FAIL; tds_set_current_results(tds, info); if (tds->cur_cursor) tds->cur_cursor->res_info = info; else tds->res_info = info; /* * loop through the columns populating COLINFO struct from * server response */ for (col = 0; col < info->num_cols; col++) { curcol = info->columns[col]; TDS_PROPAGATE(tds_get_data_info(tds, curcol, 0)); /* skip locale information */ /* NOTE do not put into tds_get_data_info, param do not have locale information */ tds_get_n(tds, NULL, tds_get_byte(tds)); } return tds_alloc_row(info); } /** * tds5_process_result2() is the new TDS 5.0 result set processing routine. * It is responsible for populating the tds->res_info structure. * This is a TDS 5.0 only function * \tds */ static TDSRET tds5_process_result2(TDSSOCKET * tds) { unsigned int colnamelen; TDS_USMALLINT col, num_cols; TDSCOLUMN *curcol; TDSRESULTINFO *info; CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_INFO1, "tds5_process_result2\n"); /* * free previous resultset */ tds_free_all_results(tds); tds->rows_affected = TDS_NO_COUNT; /* * read length of packet (4 bytes) */ tds_get_uint(tds); /* read number of columns and allocate the columns structure */ num_cols = tds_get_usmallint(tds); if ((info = tds_alloc_results(num_cols)) == NULL) return TDS_FAIL; tds_set_current_results(tds, info); if (tds->cur_cursor) tds->cur_cursor->res_info = info; else tds->res_info = info; tdsdump_log(TDS_DBG_INFO1, "num_cols=%d\n", num_cols); /* TODO reuse some code... */ /* * loop through the columns populating COLINFO struct from * server response */ for (col = 0; col < info->num_cols; col++) { curcol = info->columns[col]; /* label */ tds_dstr_get(tds, &curcol->column_name, tds_get_byte(tds)); /* TODO save informations somewhere */ /* database */ colnamelen = tds_get_byte(tds); tds_get_n(tds, NULL, colnamelen); /* * tds_get_n(tds, curcol->catalog_name, colnamelen); * curcol->catalog_name[colnamelen] = '\0'; */ /* owner */ colnamelen = tds_get_byte(tds); tds_get_n(tds, NULL, colnamelen); /* * tds_get_n(tds, curcol->schema_name, colnamelen); * curcol->schema_name[colnamelen] = '\0'; */ /* table */ /* TODO use with owner and database */ tds_dstr_get(tds, &curcol->table_name, tds_get_byte(tds)); /* table column name */ tds_dstr_get(tds, &curcol->table_column_name, tds_get_byte(tds)); /* if label is empty, use the table column name */ if (tds_dstr_isempty(&curcol->column_name)) if (!tds_dstr_dup(&curcol->column_name, &curcol->table_column_name)) return TDS_FAIL; /* flags (4 bytes) */ curcol->column_flags = tds_get_int(tds); curcol->column_hidden = curcol->column_flags & 0x1; curcol->column_key = (curcol->column_flags & 0x2) > 1; curcol->column_writeable = (curcol->column_flags & 0x10) > 1; curcol->column_nullable = (curcol->column_flags & 0x20) > 1; curcol->column_identity = (curcol->column_flags & 0x40) > 1; curcol->column_usertype = tds_get_int(tds); TDS_GET_COLUMN_TYPE(curcol); TDS_GET_COLUMN_INFO(tds, curcol); /* Adjust column size according to client's encoding */ curcol->on_server.column_size = curcol->column_size; adjust_character_column_size(tds, curcol); /* discard Locale */ tds_get_n(tds, NULL, tds_get_byte(tds)); /* * Dump all information on this column */ tdsdump_log(TDS_DBG_INFO1, "col %d:\n", col); tdsdump_log(TDS_DBG_INFO1, "\tcolumn_name=[%s]\n", tds_dstr_cstr(&curcol->column_name)); /* tdsdump_log(TDS_DBG_INFO1, "\tcolumn_name=[%s]\n", curcol->column_colname); tdsdump_log(TDS_DBG_INFO1, "\tcatalog=[%s] schema=[%s] table=[%s]\n", curcol->catalog_name, curcol->schema_name, curcol->table_name, curcol->column_colname); */ tdsdump_log(TDS_DBG_INFO1, "\tflags=%x utype=%d type=%d server type %d varint=%d\n", curcol->column_flags, curcol->column_usertype, curcol->column_type, curcol->on_server.column_type, curcol->column_varint_size); tdsdump_log(TDS_DBG_INFO1, "\tcolsize=%d prec=%d scale=%d\n", curcol->column_size, curcol->column_prec, curcol->column_scale); } return tds_alloc_row(info); } /** * tds_process_compute() processes compute rows and places them in the row * buffer. * \tds */ static TDSRET tds_process_compute(TDSSOCKET * tds) { unsigned int i; TDSCOLUMN *curcol; TDSCOMPUTEINFO *info; TDS_INT id; CHECK_TDS_EXTRA(tds); id = tds_get_smallint(tds); tdsdump_log(TDS_DBG_INFO1, "tds_process_compute() found compute id %d\n", id); for (i = 0;; ++i) { if (i >= tds->num_comp_info) { tdsdump_log(TDS_DBG_INFO1, "tds_process_compute() FAIL: id exceeds bound (%d)\n", tds->num_comp_info); return TDS_FAIL; } info = tds->comp_info[i]; if (info->computeid == id) break; } tds_set_current_results(tds, info); for (i = 0; i < info->num_cols; i++) { curcol = info->columns[i]; if (TDS_FAILED(curcol->funcs->get_data(tds, curcol))) { tdsdump_log(TDS_DBG_INFO1, "tds_process_compute() FAIL: get_data() failed\n"); return TDS_FAIL; } } return TDS_SUCCESS; } /** * tds_process_row() processes rows and places them in the row buffer. * \tds */ static TDSRET tds_process_row(TDSSOCKET * tds) { unsigned int i; TDSCOLUMN *curcol; TDSRESULTINFO *info; CHECK_TDS_EXTRA(tds); info = tds->current_results; if (!info || info->num_cols <= 0) return TDS_FAIL; for (i = 0; i < info->num_cols; i++) { tdsdump_log(TDS_DBG_INFO1, "tds_process_row(): reading column %d \n", i); curcol = info->columns[i]; TDS_PROPAGATE(curcol->funcs->get_data(tds, curcol)); } return TDS_SUCCESS; } /** * tds_process_nbcrow() processes rows and places them in the row buffer. */ static TDSRET tds_process_nbcrow(TDSSOCKET * tds) { unsigned int i; TDSCOLUMN *curcol; TDSRESULTINFO *info; char *nbcbuf; CHECK_TDS_EXTRA(tds); info = tds->current_results; if (!info || info->num_cols <= 0) return TDS_FAIL; nbcbuf = (char *) alloca((info->num_cols + 7) / 8); tds_get_n(tds, nbcbuf, (info->num_cols + 7) / 8); for (i = 0; i < info->num_cols; i++) { curcol = info->columns[i]; tdsdump_log(TDS_DBG_INFO1, "tds_process_nbcrow(): reading column %d \n", i); if (nbcbuf[i / 8] & (1 << (i % 8))) { curcol->column_cur_size = -1; } else { TDS_PROPAGATE(curcol->funcs->get_data(tds, curcol)); } } return TDS_SUCCESS; } static TDSRET tds_process_featureextack(TDSSOCKET * tds) { CHECK_TDS_EXTRA(tds); /* TODO do something with it */ for (;;) { TDS_UINT data_len; TDS_TINYINT feature_id; feature_id = tds_get_byte(tds); if (feature_id == 0xff) break; data_len = tds_get_uint(tds); tds_get_n(tds, NULL, data_len); } return TDS_SUCCESS; } /** * Attempt to close all deferred closes (dynamics and cursors). * \tds */ static void tds_process_pending_closes(TDSSOCKET *tds) { TDSDYNAMIC *dyn, *next_dyn; TDSCURSOR *cursor, *next_cursor; int all_closed = 1; /* avoid recursions */ tds->conn->pending_close = 0; /* scan all cursors to close */ cursor = tds->conn->cursors; if (cursor) ++cursor->ref_count; for (; cursor; cursor = next_cursor) { next_cursor = cursor->next; if (next_cursor) ++next_cursor->ref_count; if (cursor->defer_close) { cursor->status.dealloc = TDS_CURSOR_STATE_REQUESTED; if (TDS_FAILED(tds_cursor_close(tds, cursor)) || TDS_FAILED(tds_process_simple_query(tds))) { all_closed = 0; } else { cursor->defer_close = false; tds_cursor_dealloc(tds, cursor); } } tds_release_cursor(&cursor); } /* scan all dynamic to close */ dyn = tds->conn->dyns; if (dyn) ++dyn->ref_count; for (; dyn; dyn = next_dyn) { next_dyn = dyn->next; if (next_dyn) ++next_dyn->ref_count; if (dyn->defer_close) { if (TDS_FAILED(tds_submit_unprepare(tds, dyn)) || TDS_FAILED(tds_process_simple_query(tds))) { all_closed = 0; } else { dyn->defer_close = false; } } tds_release_dynamic(&dyn); } if (!all_closed) tds->conn->pending_close = 1; } /** * tds_process_end() processes any of the DONE, DONEPROC, or DONEINPROC * tokens. * \param tds state information for the socket and the TDS protocol * \param marker TDS token number * \param flags_parm filled with bit flags (see TDS_DONE_ constants). * Is NULL nothing is returned */ static TDSRET tds_process_end(TDSSOCKET * tds, int marker, int *flags_parm) { bool more_results, was_cancelled, error, done_count_valid; int tmp; TDS_INT8 rows_affected; CHECK_TDS_EXTRA(tds); tmp = tds_get_usmallint(tds); tds_get_smallint(tds); /* state */ more_results = (tmp & TDS_DONE_MORE_RESULTS) != 0; was_cancelled = (tmp & TDS_DONE_CANCELLED) != 0; error = (tmp & TDS_DONE_ERROR) != 0; done_count_valid = (tmp & TDS_DONE_COUNT) != 0; tdsdump_log(TDS_DBG_FUNC, "tds_process_end: more_results = %d\n" "\t\twas_cancelled = %d\n" "\t\terror = %d\n" "\t\tdone_count_valid = %d\n", more_results, was_cancelled, error, done_count_valid); tds->in_row = false; if (tds->res_info) { tds->res_info->more_results = more_results; /* FIXME this should not happen !!! */ if (tds->current_results == NULL) tds_set_current_results(tds, tds->res_info); } if (flags_parm) *flags_parm = tmp; rows_affected = IS_TDS72_PLUS(tds->conn) ? tds_get_int8(tds) : tds_get_int(tds); tdsdump_log(TDS_DBG_FUNC, " rows_affected = %" PRId64 "\n", rows_affected); if (was_cancelled || (!more_results && !tds->in_cancel)) { tdsdump_log(TDS_DBG_FUNC, "tds_process_end() state set to TDS_IDLE\n"); /* reset of in_cancel should must done before setting IDLE */ tds->in_cancel = 0; if (tds->bulk_query) { tds->out_flag = TDS_BULK; tds_set_state(tds, TDS_SENDING); tds->bulk_query = false; } else { tds_set_state(tds, TDS_IDLE); if (tds->conn->pending_close) tds_process_pending_closes(tds); } } if (IS_TDSDEAD(tds)) return TDS_FAIL; /* * rows affected is in the tds struct because a query may affect rows but * have no result set. */ if (done_count_valid) tds->rows_affected = rows_affected; else tds->rows_affected = TDS_NO_COUNT; if (IS_TDSDEAD(tds)) return TDS_FAIL; return was_cancelled ? TDS_CANCELLED : TDS_SUCCESS; } static TDSRET tds_process_env_routing(TDSSOCKET * tds) { unsigned len = tds_get_usmallint(tds); if (len) { /* protocol (byte, 0 for ip) * port (short, not 0) * us_varchar */ uint8_t protocol; uint16_t port, address_len; if (len < 5) return TDS_FAIL; protocol = tds_get_byte(tds); port = tds_get_usmallint(tds); address_len = tds_get_usmallint(tds); len -= 5; if (address_len * 2u < len) return TDS_FAIL; if (protocol == 0 && port != 0 && tds->login) { tds->login->routing_port = port; tds_dstr_get(tds, &tds->login->routing_address, address_len); tds_get_n(tds, NULL, len - 2 * address_len); } else { tds_get_n(tds, NULL, len); } } tds_get_n(tds, NULL, tds_get_usmallint(tds)); return TDS_SUCCESS; } /** * tds_process_env_chg() * when ever certain things change on the server, such as database, character * set, language, or block size. A environment change message is generated * There is no action taken currently, but certain functions at the CLI level * that return the name of the current database will need to use this. * \tds */ static TDSRET tds_process_env_chg(TDSSOCKET * tds) { unsigned int size; TDS_TINYINT type; char *oldval = NULL; char *newval = NULL; char **dest; int new_block_size; int memrc = 0; CHECK_TDS_EXTRA(tds); size = tds_get_usmallint(tds); if (TDS_UNLIKELY(size < 1)) { tdsdump_log(TDS_DBG_ERROR, "Got invalid size %u\n", size); tds_close_socket(tds); return TDS_FAIL; } /* * this came in a patch, apparently someone saw an env message * that was different from what we are handling? -- brian * changed back because it won't handle multibyte chars -- 7.0 */ /* tds_get_n(tds,NULL,size); */ type = tds_get_byte(tds); /* * handle collate default change (if you change db or during login) * this environment is not a string so need different handles */ if (type == TDS_ENV_SQLCOLLATION) { /* save new collation */ size = tds_get_byte(tds); tdsdump_log(TDS_DBG_ERROR, "tds_process_env_chg(): %d bytes of collation data received\n", size); tdsdump_dump_buf(TDS_DBG_NETWORK, "tds->conn->collation was", tds->conn->collation, 5); memset(tds->conn->collation, 0, 5); if (size < 5) { tds_get_n(tds, tds->conn->collation, size); } else { tds_get_n(tds, tds->conn->collation, 5); tds_get_n(tds, NULL, size - 5); tds7_srv_charset_changed(tds->conn, tds->conn->collation); } tdsdump_dump_buf(TDS_DBG_NETWORK, "tds->conn->collation now", tds->conn->collation, 5); /* discard old one */ tds_get_n(tds, NULL, tds_get_byte(tds)); return TDS_SUCCESS; } if (type == TDS_ENV_BEGINTRANS) { /* TODO check size */ size = tds_get_byte(tds); tds_get_n(tds, tds->conn->tds72_transaction, 8); tds_get_n(tds, NULL, tds_get_byte(tds)); return TDS_SUCCESS; } if (type == TDS_ENV_COMMITTRANS || type == TDS_ENV_ROLLBACKTRANS) { memset(tds->conn->tds72_transaction, 0, 8); tds_get_n(tds, NULL, tds_get_byte(tds)); tds_get_n(tds, NULL, tds_get_byte(tds)); return TDS_SUCCESS; } if (IS_TDS71_PLUS(tds->conn) && type == TDS_ENV_ROUTING) return tds_process_env_routing(tds); /* discard byte values, not still supported */ /* TODO support them */ if (IS_TDS71_PLUS(tds->conn) && type > TDS_ENV_PACKSIZE) { /* discard rest of the packet */ tds_get_n(tds, NULL, size - 1); return TDS_SUCCESS; } /* fetch the new value */ memrc += tds_alloc_get_string(tds, &newval, tds_get_byte(tds)); /* fetch the old value */ memrc += tds_alloc_get_string(tds, &oldval, tds_get_byte(tds)); if (memrc != 0) { free(newval); free(oldval); return TDS_FAIL; } dest = NULL; switch (type) { case TDS_ENV_PACKSIZE: new_block_size = atoi(newval); if (new_block_size >= 512) { tdsdump_log(TDS_DBG_INFO1, "changing block size from %s to %d\n", oldval, new_block_size); /* * Is possible to have a shrink if server limits packet * size more than what we specified */ /* Reallocate buffer if possible (strange values from server or out of memory) use older buffer */ tds_realloc_socket(tds, new_block_size); } break; case TDS_ENV_DATABASE: dest = &tds->conn->env.database; break; case TDS_ENV_LANG: dest = &tds->conn->env.language; break; case TDS_ENV_CHARSET: tdsdump_log(TDS_DBG_FUNC, "server indicated charset change to \"%s\"\n", newval); dest = &tds->conn->env.charset; tds_srv_charset_changed(tds->conn, newval); break; } if (tds->env_chg_func) { (*(tds->env_chg_func)) (tds, type, oldval, newval); } free(oldval); if (newval) { if (dest) { free(*dest); *dest = newval; } else free(newval); } return TDS_SUCCESS; } /** * tds_process_info() is called for INFO, ERR, or EED tokens and is responsible * for calling the CLI's message handling routine * \returns TDS_SUCCESS if informational, TDS_FAIL if error. */ static TDSRET tds_process_info(TDSSOCKET * tds, int marker) { int rc; unsigned int len_sqlstate; int has_eed = 0; TDSMESSAGE msg; unsigned int packet_len, char_len, readed_len = 10; CHECK_TDS_EXTRA(tds); if (!tds->in_row) tds_free_all_results(tds); /* make sure message has been freed */ memset(&msg, 0, sizeof(TDSMESSAGE)); /* packet length */ packet_len = tds_get_usmallint(tds); /* message number */ msg.msgno = tds_get_int(tds); /* msg state */ msg.state = tds_get_byte(tds); /* msg level */ msg.severity = tds_get_byte(tds); /* determine if msg or error */ switch (marker) { case TDS_EED_TOKEN: if (msg.severity <= 10) msg.priv_msg_type = 0; else msg.priv_msg_type = 1; /* read SQL state */ len_sqlstate = tds_get_byte(tds); msg.sql_state = tds_new(char, len_sqlstate + 1); if (!msg.sql_state) { tds_free_msg(&msg); return TDS_FAIL; } tds_get_n(tds, msg.sql_state, len_sqlstate); msg.sql_state[len_sqlstate] = '\0'; /* do a better mapping using native errors */ if (strcmp(msg.sql_state, "ZZZZZ") == 0) TDS_ZERO_FREE(msg.sql_state); /* if has_eed = 1, extended error data follows */ has_eed = tds_get_byte(tds); /* junk status and transaction state */ tds_get_smallint(tds); readed_len += 4 + len_sqlstate; break; case TDS_INFO_TOKEN: msg.priv_msg_type = 0; break; case TDS_ERROR_TOKEN: msg.priv_msg_type = 1; break; default: tdsdump_log(TDS_DBG_ERROR, "tds_process_info() called with unknown marker '%d'!\n", (int) marker); tds_free_msg(&msg); return TDS_FAIL; } tdsdump_log(TDS_DBG_ERROR, "tds_process_info() reading message %d from server\n", msg.msgno); #define GET_STRING(dest, len_type) do { \ unsigned int to_read_size = tds_get_ ## len_type(tds); \ char_len += to_read_size; \ rc += tds_alloc_get_string(tds, dest, to_read_size); \ } while(0) char_len = 0; rc = 0; /* the message */ GET_STRING(&msg.message, usmallint); /* server name */ GET_STRING(&msg.server, byte); if ((!msg.server || !msg.server[0]) && tds->login) { TDS_ZERO_FREE(msg.server); if (-1 == asprintf(&msg.server, "[%s]", tds_dstr_cstr(&tds->login->server_name))) { tdsdump_log(TDS_DBG_ERROR, "out of memory (%d), %s\n", errno, strerror(errno)); return TDS_FAIL; } } /* stored proc name if available */ GET_STRING(&msg.proc_name, byte); readed_len += char_len * (IS_TDS7_PLUS(tds->conn) ? 2 : 1); /* line number in the sql statement where the problem occured */ /* login still not done, we don't know exactly the version */ if (tds->conn->product_version == 0 ? IS_TDS7_PLUS(tds->conn) && readed_len + 4 <= packet_len : IS_TDS72_PLUS(tds->conn)) { msg.line_number = tds_get_int(tds); readed_len += 4; } else { msg.line_number = tds_get_smallint(tds); readed_len += 2; } /* discard additional bytes */ if (packet_len > readed_len) tds_get_n(tds, NULL, packet_len - readed_len); #undef GET_STRING /* * If the server doesn't provide an sqlstate, map one via server native errors * I'm assuming there is not a protocol I'm missing to fetch these from the server? * I know sybase has an sqlstate column in it's sysmessages table, mssql doesn't and * TDS_EED_TOKEN is not being called for me. */ if (msg.sql_state == NULL) msg.sql_state = tds_alloc_lookup_sqlstate(tds, msg.msgno); /* In case extended error data is sent, we just try to discard it */ if (has_eed == 1) { int next_marker; for (;;) { switch (next_marker = tds_get_byte(tds)) { case TDS5_PARAMFMT_TOKEN: case TDS5_PARAMFMT2_TOKEN: case TDS5_PARAMS_TOKEN: if (TDS_FAILED(tds_process_default_tokens(tds, next_marker))) --rc; continue; } break; } tds_unget_byte(tds); } /* * call the msg_handler that was set by an upper layer * (dblib, ctlib or some other one). Call it with the pointer to * the "parent" structure. */ if (rc != 0) { tds_free_msg(&msg); return TDS_FAIL; } /* special case, */ if (marker == TDS_EED_TOKEN && tds->cur_dyn && !TDS_IS_MSSQL(tds) && msg.msgno == 2782) { /* we must emulate prepare */ tds->cur_dyn->emulated = 1; tds_dynamic_deallocated(tds->conn, tds->cur_dyn); } else if (marker == TDS_INFO_TOKEN && msg.msgno == 16954 && TDS_IS_MSSQL(tds) && tds->current_op == TDS_OP_CURSOROPEN && tds->cur_cursor) { /* here mssql say "Executing SQL directly; no cursor." opening cursor */ } else { if (tds_get_ctx(tds)->msg_handler) { tdsdump_log(TDS_DBG_ERROR, "tds_process_info() calling client msg handler\n"); tds_get_ctx(tds)->msg_handler(tds_get_ctx(tds), tds, &msg); } else if (msg.msgno) { tdsdump_log(TDS_DBG_WARN, "Msg %d, Severity %d, State %d, Server %s, Line %d\n%s\n", msg.msgno, msg.severity , msg.state, msg.server, msg.line_number, msg.message); } } if (!tds->conn->server) { tds->conn->server = msg.server; msg.server = NULL; } tds_free_msg(&msg); tdsdump_log(TDS_DBG_ERROR, "tds_process_info() returning TDS_SUCCESS\n"); return TDS_SUCCESS; } /** * Reads a string from wire in a new allocated buffer * \tds * \param string output string * \param len length of string to read * \returns 0 for success, -1 on error. */ static int tds_alloc_get_string(TDSSOCKET * tds, char **string, size_t len) { char *s; size_t out_len; CHECK_TDS_EXTRA(tds); /* assure sufficient space for every conversion */ s = tds_new(char, len * 4 + 1); out_len = tds_get_string(tds, len, s, len * 4); if (!s) { *string = NULL; return -1; } s = (char*) realloc(s, out_len + 1); s[out_len] = '\0'; *string = s; return 0; } /** * \remarks Process the incoming token stream until it finds * an end token (DONE, DONEPROC, DONEINPROC) with the cancel flag set. * At that point the connection should be ready to handle a new query. * \tds */ TDSRET tds_process_cancel(TDSSOCKET * tds) { CHECK_TDS_EXTRA(tds); /* silly cases, nothing to do */ if (!tds->in_cancel) return TDS_SUCCESS; /* TODO handle cancellation sending data */ if (tds->state != TDS_PENDING) return TDS_SUCCESS; /* TODO support TDS5 cancel, wait for cancel packet first, then wait for done */ for (;;) { TDS_INT result_type; switch (tds_process_tokens(tds, &result_type, NULL, 0)) { case TDS_FAIL: return TDS_FAIL; case TDS_CANCELLED: case TDS_SUCCESS: case TDS_NO_MORE_RESULTS: return TDS_SUCCESS; } } } /** * Finds a dynamic given string id * \return dynamic or NULL is not found * \param conn state information for the socket and the TDS protocol * \param id dynamic id to search */ TDSDYNAMIC * tds_lookup_dynamic(TDSCONNECTION * conn, const char *id) { TDSDYNAMIC *curr; CHECK_CONN_EXTRA(conn); for (curr = conn->dyns; curr != NULL; curr = curr->next) { if (!strcmp(curr->id, id)) return curr; } return NULL; } /** * tds_process_dynamic() * finds the element of the dyns array for the id * \tds * \return allocated dynamic or NULL on failure. */ static TDSDYNAMIC * tds_process_dynamic(TDSSOCKET * tds) { unsigned int token_sz; unsigned char type; TDS_TINYINT id_len, drain = 0; char id[TDS_MAX_DYNID_LEN + 1]; CHECK_TDS_EXTRA(tds); token_sz = tds_get_usmallint(tds); type = tds_get_byte(tds); tds_get_byte(tds); /* status */ /* handle only acknowledge */ if (type != TDS_DYN_ACK) { tdsdump_log(TDS_DBG_ERROR, "Unrecognized TDS5_DYN type %x\n", type); tds_get_n(tds, NULL, token_sz - 2); return NULL; } id_len = tds_get_byte(tds); if (id_len > TDS_MAX_DYNID_LEN) { drain = id_len - TDS_MAX_DYNID_LEN; id_len = TDS_MAX_DYNID_LEN; } id_len = tds_get_string(tds, id_len, id, TDS_MAX_DYNID_LEN); id[id_len] = '\0'; if (drain) { tds_get_n(tds, NULL, drain); } return tds_lookup_dynamic(tds->conn, id); } /** * Process results from dynamic. * \tds */ static TDSRET tds_process_dyn_result(TDSSOCKET * tds) { unsigned int col, num_cols; TDSCOLUMN *curcol; TDSPARAMINFO *info; TDSDYNAMIC *dyn; CHECK_TDS_EXTRA(tds); tds_get_usmallint(tds); /* header size */ num_cols = tds_get_usmallint(tds); /* read number of columns and allocate the columns structure */ if ((info = tds_alloc_results(num_cols)) == NULL) return TDS_FAIL; if (tds->cur_dyn) { dyn = tds->cur_dyn; tds_free_param_results(dyn->res_info); dyn->res_info = info; } else { tds_free_param_results(tds->param_info); tds->param_info = info; } tds_set_current_results(tds, info); for (col = 0; col < info->num_cols; col++) { curcol = info->columns[col]; TDS_PROPAGATE(tds_get_data_info(tds, curcol, 1)); /* skip locale information */ tds_get_n(tds, NULL, tds_get_byte(tds)); } return tds_alloc_row(info); } /** * Process new TDS 5.0 token for describing output parameters * \tds */ static TDSRET tds5_process_dyn_result2(TDSSOCKET * tds) { unsigned int col, num_cols; TDSCOLUMN *curcol; TDSPARAMINFO *info; CHECK_TDS_EXTRA(tds); tds_get_uint(tds); /* header size */ num_cols = tds_get_usmallint(tds); /* read number of columns and allocate the columns structure */ if ((info = tds_alloc_results(num_cols)) == NULL) return TDS_FAIL; if (tds->cur_dyn) { TDSDYNAMIC *dyn = tds->cur_dyn; tds_free_param_results(dyn->res_info); dyn->res_info = info; } else { tds_free_param_results(tds->param_info); tds->param_info = info; } tds_set_current_results(tds, info); for (col = 0; col < info->num_cols; col++) { curcol = info->columns[col]; /* TODO reuse tds_get_data_info code, sligthly different */ /* column name */ tds_dstr_get(tds, &curcol->column_name, tds_get_byte(tds)); /* column status */ curcol->column_flags = tds_get_int(tds); curcol->column_nullable = (curcol->column_flags & 0x20) > 0; /* user type */ curcol->column_usertype = tds_get_int(tds); /* column type */ TDS_GET_COLUMN_TYPE(curcol); TDS_GET_COLUMN_INFO(tds, curcol); /* Adjust column size according to client's encoding */ curcol->on_server.column_size = curcol->column_size; adjust_character_column_size(tds, curcol); /* discard Locale */ tds_get_n(tds, NULL, tds_get_byte(tds)); tdsdump_log(TDS_DBG_INFO1, "elem %d:\n", col); tdsdump_log(TDS_DBG_INFO1, "\tcolumn_name=[%s]\n", tds_dstr_cstr(&curcol->column_name)); tdsdump_log(TDS_DBG_INFO1, "\tflags=%x utype=%d type=%d server type %d varint=%d\n", curcol->column_flags, curcol->column_usertype, curcol->column_type, curcol->on_server.column_type, curcol->column_varint_size); tdsdump_log(TDS_DBG_INFO1, "\tcolsize=%d prec=%d scale=%d\n", curcol->column_size, curcol->column_prec, curcol->column_scale); } return tds_alloc_row(info); } /** * tds_get_token_size() returns the size of a fixed length token * used by tds_process_cancel() to determine how to read past a token * \param marker token type. */ int tds_get_token_size(int marker) { /* TODO finish */ switch (marker) { case TDS_DONE_TOKEN: case TDS_DONEPROC_TOKEN: case TDS_DONEINPROC_TOKEN: return 8; case TDS_RETURNSTATUS_TOKEN: return 4; case TDS_PROCID_TOKEN: return 8; default: return 0; } } /** * tds_process_compute_names() processes compute result sets. * \tds */ static TDSRET tds_process_compute_names(TDSSOCKET * tds) { int hdrsize; int num_cols = 0; TDS_USMALLINT compute_id = 0; TDSCOMPUTEINFO *info; int col; struct namelist *head = NULL, *cur; CHECK_TDS_EXTRA(tds); hdrsize = tds_get_usmallint(tds); tdsdump_log(TDS_DBG_INFO1, "processing tds5 compute names. hdrsize = %d\n", hdrsize); /* * compute statement id which this relates * to. You can have more than one compute * statement in a SQL statement */ compute_id = tds_get_usmallint(tds); if ((num_cols = tds_read_namelist(tds, hdrsize - 2, &head, 0)) <= 0) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "processing tds5 compute names. num_cols = %d\n", num_cols); if ((tds->comp_info = tds_alloc_compute_results(tds, num_cols, 0)) == NULL) goto memory_error; tdsdump_log(TDS_DBG_INFO1, "processing tds5 compute names. num_comp_info = %d\n", tds->num_comp_info); info = tds->comp_info[tds->num_comp_info - 1]; tds_set_current_results(tds, info); info->computeid = compute_id; cur = head; for (col = 0; col < num_cols; col++) { TDSCOLUMN *curcol = info->columns[col]; if (!tds_dstr_copy(&curcol->column_name, cur->name)) goto memory_error; cur = cur->next; } tds_free_namelist(head); return TDS_SUCCESS; memory_error: tds_free_namelist(head); return TDS_FAIL; } /** * tds7_process_compute_result() processes compute result sets for TDS 7/8. * They is are very similar to normal result sets. * \tds */ static TDSRET tds7_process_compute_result(TDSSOCKET * tds) { unsigned int col, num_cols; TDS_TINYINT by_cols; TDS_SMALLINT *cur_by_col; TDS_USMALLINT compute_id; TDSCOLUMN *curcol; TDSCOMPUTEINFO *info; CHECK_TDS_EXTRA(tds); /* compute without result should never happens */ if (!tds->res_info) return TDS_FAIL; /* * number of compute columns returned - so * COMPUTE SUM(x), AVG(x)... would return * num_cols = 2 */ num_cols = tds_get_usmallint(tds); tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. num_cols = %u\n", num_cols); /* * compute statement id which this relates * to. You can have more than one compute * statement in a SQL statement */ compute_id = tds_get_usmallint(tds); tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. compute_id = %u\n", compute_id); /* * number of "by" columns in compute - so * COMPUTE SUM(x) BY a, b, c would return * by_cols = 3 */ by_cols = tds_get_byte(tds); tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. by_cols = %d\n", by_cols); if ((tds->comp_info = tds_alloc_compute_results(tds, num_cols, by_cols)) == NULL) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. num_comp_info = %d\n", tds->num_comp_info); info = tds->comp_info[tds->num_comp_info - 1]; tds_set_current_results(tds, info); tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. point 0\n"); info->computeid = compute_id; /* * the by columns are a list of the column * numbers in the select statement */ cur_by_col = info->bycolumns; for (col = 0; col < by_cols; col++) { *cur_by_col = tds_get_smallint(tds); cur_by_col++; } tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. point 1\n"); for (col = 0; col < num_cols; col++) { tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. point 2\n"); curcol = info->columns[col]; curcol->column_operator = tds_get_byte(tds); curcol->column_operand = tds_get_smallint(tds); TDS_PROPAGATE(tds7_get_data_info(tds, curcol)); if (tds_dstr_isempty(&curcol->column_name)) if (!tds_dstr_copy(&curcol->column_name, tds_pr_op(curcol->column_operator))) return TDS_FAIL; } /* all done now allocate a row for tds_process_row to use */ tdsdump_log(TDS_DBG_INFO1, "processing tds7 compute result. point 5 \n"); return tds_alloc_compute_row(info); } /** * Reads cursor command results. * This contains status of cursors. * \tds */ static TDSRET tds_process_cursor_tokens(TDSSOCKET * tds) { TDS_USMALLINT hdrsize; TDS_INT cursor_id; TDS_TINYINT namelen; TDS_USMALLINT cursor_status; TDSCURSOR *cursor; CHECK_TDS_EXTRA(tds); hdrsize = tds_get_usmallint(tds); cursor_id = tds_get_int(tds); hdrsize -= sizeof(TDS_INT); if (cursor_id == 0){ namelen = tds_get_byte(tds); hdrsize -= 1; /* discard name */ tds_get_n(tds, NULL, namelen); hdrsize -= namelen; } tds_get_byte(tds); /* cursor command */ cursor_status = tds_get_usmallint(tds); hdrsize -= 3; if (hdrsize == sizeof(TDS_INT)) tds_get_int(tds); /* row count TODO useless ?? */ if (tds->cur_cursor) { cursor = tds->cur_cursor; cursor->cursor_id = cursor_id; cursor->srv_status = cursor_status; if ((cursor_status & TDS_CUR_ISTAT_DEALLOC) != 0) tds_cursor_deallocated(tds->conn, cursor); } return TDS_SUCCESS; } /** * Process option cmd results. * This token is available only on TDS 5.0 (Sybase). * \tds */ static TDSRET tds5_process_optioncmd(TDSSOCKET * tds) { TDS_INT command; TDS_TINYINT option; TDS_TINYINT argsize; TDS_INT arg; CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_INFO1, "tds5_process_optioncmd()\n"); if (!IS_TDS50(tds->conn)) return TDS_FAIL; tds_get_usmallint(tds); /* length */ command = tds_get_byte(tds); option = tds_get_byte(tds); argsize = tds_get_byte(tds); switch (argsize) { case 0: arg = 0; break; case 1: arg = tds_get_byte(tds); break; case 4: arg = tds_get_int(tds); break; default: tdsdump_log(TDS_DBG_INFO1, "oops: cannot process option %d of size %d\n", option, argsize); /* ignore argument */ tds_get_n(tds, NULL, argsize); return TDS_FAIL; } tdsdump_log(TDS_DBG_INFO1, "received option %d value %d\n", option, arg); if (command != TDS_OPT_INFO) return TDS_FAIL; tds->option_value = arg; return TDS_SUCCESS; } /** * Returns string representation for a given operation * \param op operation code * \return string representation. Empty if not found. */ static const char * tds_pr_op(int op) { /** \cond HIDDEN_SYMBOLS */ #define TYPE(con, s) case con: return s; break /** \endcond */ switch (op) { TYPE(SYBAOPAVG, "avg"); TYPE(SYBAOPAVGU, "avg"); TYPE(SYBAOPCNT, "count"); TYPE(SYBAOPCNTU, "count"); TYPE(SYBAOPMAX, "max"); TYPE(SYBAOPMIN, "min"); TYPE(SYBAOPSUM, "sum"); TYPE(SYBAOPSUMU, "sum"); TYPE(SYBAOPCHECKSUM_AGG, "checksum_agg"); TYPE(SYBAOPCNT_BIG, "count"); TYPE(SYBAOPSTDEV, "stdevp"); TYPE(SYBAOPSTDEVP, "stdevp"); TYPE(SYBAOPVAR, "var"); TYPE(SYBAOPVARP, "varp"); default: break; } return ""; #undef TYPE } /** * Returns string representation of the given type. * \param type data type * \return type as string. Empty if not found. */ const char * tds_prtype(int type) { /** \cond HIDDEN_SYMBOLS */ #define TYPE(con, s) case con: return s; break /** \endcond */ switch (type) { TYPE(SYBAOPAVG, "avg"); TYPE(SYBAOPCNT, "count"); TYPE(SYBAOPMAX, "max"); TYPE(SYBAOPMIN, "min"); TYPE(SYBAOPSUM, "sum"); TYPE(SYBBINARY, "binary"); TYPE(SYBLONGBINARY, "longbinary"); TYPE(SYBBIT, "bit"); TYPE(SYBBITN, "bit-null"); TYPE(SYBCHAR, "char"); TYPE(SYBDATETIME4, "smalldatetime"); TYPE(SYBDATETIME, "datetime"); TYPE(SYBDATETIMN, "datetime-null"); TYPE(SYBDECIMAL, "decimal"); TYPE(SYBFLT8, "float"); TYPE(SYBFLTN, "float-null"); TYPE(SYBIMAGE, "image"); TYPE(SYBINT1, "tinyint"); TYPE(SYBINT2, "smallint"); TYPE(SYBINT4, "int"); TYPE(SYBINT8, "bigint"); TYPE(SYBUINT1, "unsigned tinyint"); TYPE(SYBUINT2, "unsigned smallint"); TYPE(SYBUINT4, "unsigned int"); TYPE(SYBUINT8, "unsigned bigint"); TYPE(SYBINTN, "integer-null"); TYPE(SYBMONEY4, "smallmoney"); TYPE(SYBMONEY, "money"); TYPE(SYBMONEYN, "money-null"); TYPE(SYBNTEXT, "UCS-2 text"); TYPE(SYBNVARCHAR, "UCS-2 varchar"); TYPE(SYBNUMERIC, "numeric"); TYPE(SYBREAL, "real"); TYPE(SYBTEXT, "text"); TYPE(SYBUNIQUE, "uniqueidentifier"); TYPE(SYBVARBINARY, "varbinary"); TYPE(SYBVARCHAR, "varchar"); TYPE(SYBVARIANT, "variant"); TYPE(SYBVOID, "void"); TYPE(XSYBBINARY, "xbinary"); TYPE(XSYBCHAR, "xchar"); TYPE(XSYBNCHAR, "x UCS-2 char"); TYPE(XSYBNVARCHAR, "x UCS-2 varchar"); TYPE(XSYBVARBINARY, "xvarbinary"); TYPE(XSYBVARCHAR, "xvarchar"); TYPE(SYBMSXML, "xml"); TYPE(SYBMSDATE, "date"); TYPE(SYBMSTIME, "time"); TYPE(SYBMSDATETIME2, "datetime2"); TYPE(SYBMSDATETIMEOFFSET, "datetimeoffset"); TYPE(SYBDATE, "date"); TYPE(SYBTIME, "time"); TYPE(SYB5BIGTIME, "bigtime"); TYPE(SYB5BIGDATETIME, "bigdatetime"); default: break; } return ""; #undef TYPE } /** * Returns string representation for a given token type * \param marker token type * \return string representation. Empty if not token not valid. */ static const char * tds_token_name(unsigned char marker) { switch (marker) { case TDS5_PARAMFMT2_TOKEN: return "TDS5_PARAMFMT2"; case TDS_ORDERBY2_TOKEN: return "ORDERBY2"; case TDS_ROWFMT2_TOKEN: return "ROWFMT2"; case TDS_LOGOUT_TOKEN: return "LOGOUT"; case TDS_RETURNSTATUS_TOKEN: return "RETURNSTATUS"; case TDS_PROCID_TOKEN: return "PROCID"; case TDS7_RESULT_TOKEN: return "TDS7_RESULT"; case TDS_CURINFO_TOKEN: return "TDS_CURINFO"; case TDS7_COMPUTE_RESULT_TOKEN: return "TDS7_COMPUTE_RESULT"; case TDS_COLNAME_TOKEN: return "COLNAME"; case TDS_COLFMT_TOKEN: return "COLFMT"; case TDS_DYNAMIC2_TOKEN: return "DYNAMIC2"; case TDS_TABNAME_TOKEN: return "TABNAME"; case TDS_COLINFO_TOKEN: return "COLINFO"; case TDS_COMPUTE_NAMES_TOKEN: return "COMPUTE_NAMES"; case TDS_COMPUTE_RESULT_TOKEN: return "COMPUTE_RESULT"; case TDS_ORDERBY_TOKEN: return "ORDERBY"; case TDS_ERROR_TOKEN: return "ERROR"; case TDS_INFO_TOKEN: return "INFO"; case TDS_PARAM_TOKEN: return "PARAM"; case TDS_LOGINACK_TOKEN: return "LOGINACK"; case TDS_CONTROL_FEATUREEXTACK_TOKEN: return "CONTROL/FEATUREEXTACK"; case TDS_ROW_TOKEN: return "ROW"; case TDS_NBC_ROW_TOKEN: return "NBC_ROW"; case TDS_CMP_ROW_TOKEN: return "CMP_ROW"; case TDS5_PARAMS_TOKEN: return "TDS5_PARAMS"; case TDS_CAPABILITY_TOKEN: return "CAPABILITY"; case TDS_ENVCHANGE_TOKEN: return "ENVCHANGE"; case TDS_SESSIONSTATE_TOKEN: return "SESSIONSTATE"; case TDS_EED_TOKEN: return "EED"; case TDS_DBRPC_TOKEN: return "DBRPC"; case TDS5_DYNAMIC_TOKEN: return "TDS5_DYNAMIC"; case TDS5_PARAMFMT_TOKEN: return "TDS5_PARAMFMT"; case TDS_AUTH_TOKEN: return "AUTH"; case TDS_RESULT_TOKEN: return "RESULT"; case TDS_DONE_TOKEN: return "DONE"; case TDS_DONEPROC_TOKEN: return "DONEPROC"; case TDS_DONEINPROC_TOKEN: return "DONEINPROC"; case TDS_MSG_TOKEN: return "MSG"; default: break; } return ""; } /** * Adjust column size according to client's encoding * \tds * \param curcol column to adjust */ static void adjust_character_column_size(TDSSOCKET * tds, TDSCOLUMN * curcol) { CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); if (is_ascii_type(curcol->on_server.column_type)) { /* don't override setting from column collation */ if (!curcol->char_conv) curcol->char_conv = tds->conn->char_convs[client2server_chardata]; goto compute; } if (IS_TDS7_PLUS(tds->conn)) { if (is_unicode_type(curcol->on_server.column_type)) curcol->char_conv = tds->conn->char_convs[client2ucs2]; goto compute; } /* Sybase UNI(VAR)CHAR fields are transmitted via SYBLONGBINARY and in UTF-16 */ if (is_unicode_type(curcol->on_server.column_type) || (curcol->on_server.column_type == SYBLONGBINARY && ( curcol->column_usertype == USER_UNICHAR_TYPE || curcol->column_usertype == USER_UNIVARCHAR_TYPE))) { const int canonic_client = tds->conn->char_convs[client2ucs2]->from.charset.canonic; const int sybase_utf16 = TDS_CHARSET_UTF_16LE; if (tds_capability_has_res(tds->conn, TDS_RES_IMAGE_NONCHAR)) { curcol->char_conv = tds_iconv_get_info(tds->conn, canonic_client, TDS_CHARSET_UTF_8); goto compute; } curcol->char_conv = tds_iconv_get_info(tds->conn, canonic_client, sybase_utf16); /* fallback to UCS-2LE */ /* FIXME should be useless. Does not works always */ if (!curcol->char_conv) curcol->char_conv = tds->conn->char_convs[client2ucs2]; } compute: if (!USE_ICONV || !curcol->char_conv) return; curcol->on_server.column_size = curcol->column_size; curcol->column_size = determine_adjusted_size(curcol->char_conv, curcol->column_size); tdsdump_log(TDS_DBG_INFO1, "adjust_character_column_size:\n" "\tServer charset: %s\n" "\tServer column_size: %d\n" "\tClient charset: %s\n" "\tClient column_size: %d\n", curcol->char_conv->to.charset.name, curcol->on_server.column_size, curcol->char_conv->from.charset.name, curcol->column_size); } /** * Allow for maximum possible size of converted data, * while being careful about integer division truncation. * All character data pass through iconv. It doesn't matter if the server side * is Unicode or not; even Latin1 text need conversion if, * for example, the client is UTF-8. * \param char_conv conversion structure * \param size unconverted byte size * \return maximum size for converted string */ static int determine_adjusted_size(const TDSICONV * char_conv, int size) { if (!char_conv) return size; /* same charset */ if ((char_conv->flags & TDS_ENCODING_MEMCPY) != 0 || char_conv->to.charset.canonic == char_conv->from.charset.canonic) return size; /* avoid possible overflow */ if (size >= 0x10000000) return 0x7fffffff; size *= char_conv->from.charset.max_bytes_per_char; if (size % char_conv->to.charset.min_bytes_per_char) size += char_conv->to.charset.min_bytes_per_char; size /= char_conv->to.charset.min_bytes_per_char; return size; } /** @} */ freetds-1.3.6/src/tds/util.c000644 025423 025423 00000033053 14056414271 017315 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef _WIN32 #include #endif #include #include #include /** * Set state of TDS connection, with logging and checking. * \param tds state information for the socket and the TDS protocol * \param state the new state of the connection, cf. TDS_STATE. * \return the new state, which might not be \a state. */ TDS_STATE tds_set_state(TDSSOCKET * tds, TDS_STATE state) { TDS_STATE prior_state; static const char state_names[][8] = { "IDLE", "WRITING", "SENDING", "PENDING", "READING", "DEAD" }; assert(state < TDS_VECTOR_SIZE(state_names)); assert(tds->state < TDS_VECTOR_SIZE(state_names)); prior_state = tds->state; if (state == prior_state) return state; switch(state) { case TDS_PENDING: if (prior_state == TDS_READING || prior_state == TDS_WRITING) { tds->state = TDS_PENDING; tds_mutex_unlock(&tds->wire_mtx); break; } tdsdump_log(TDS_DBG_ERROR, "logic error: cannot change query state from %s to %s\n", state_names[prior_state], state_names[state]); break; case TDS_READING: /* transition to READING are valid only from PENDING */ if (tds_mutex_trylock(&tds->wire_mtx)) return tds->state; if (tds->state != TDS_PENDING) { tds_mutex_unlock(&tds->wire_mtx); tdsdump_log(TDS_DBG_ERROR, "logic error: cannot change query state from %s to %s\n", state_names[prior_state], state_names[state]); break; } tds->state = state; break; case TDS_SENDING: if (prior_state != TDS_READING && prior_state != TDS_WRITING) { tdsdump_log(TDS_DBG_ERROR, "logic error: cannot change query state from %s to %s\n", state_names[prior_state], state_names[state]); break; } if (tds->state == TDS_READING) { /* TODO check this code, copied from tds_submit_prepare */ tds_free_all_results(tds); tds->rows_affected = TDS_NO_COUNT; tds_release_cursor(&tds->cur_cursor); tds_release_cur_dyn(tds); tds->current_op = TDS_OP_NONE; } tds_mutex_unlock(&tds->wire_mtx); tds->state = state; break; case TDS_IDLE: if (prior_state == TDS_DEAD && TDS_IS_SOCKET_INVALID(tds_get_s(tds))) { tdsdump_log(TDS_DBG_ERROR, "logic error: cannot change query state from %s to %s\n", state_names[prior_state], state_names[state]); break; } case TDS_DEAD: if (prior_state == TDS_READING || prior_state == TDS_WRITING) tds_mutex_unlock(&tds->wire_mtx); tds->state = state; /* invalid, code should have either close or aborted all freezes */ if (TDS_UNLIKELY(tds->frozen)) { TDSFREEZE freeze; tds->frozen = 1; freeze.tds = tds; freeze.pkt = tds->frozen_packets; freeze.pkt_pos = 8; freeze.size_len = 0; tds_freeze_abort(&freeze); tds_connection_close(tds->conn); } break; case TDS_WRITING: CHECK_TDS_EXTRA(tds); if (tds_mutex_trylock(&tds->wire_mtx)) return tds->state; if (tds->state == TDS_DEAD) { tds_mutex_unlock(&tds->wire_mtx); tdsdump_log(TDS_DBG_ERROR, "logic error: cannot change query state from %s to %s\n", state_names[prior_state], state_names[state]); tdserror(tds_get_ctx(tds), tds, TDSEWRIT, 0); break; } else if (tds->state != TDS_IDLE && tds->state != TDS_SENDING) { tds_mutex_unlock(&tds->wire_mtx); tdsdump_log(TDS_DBG_ERROR, "logic error: cannot change query state from %s to %s\n", state_names[prior_state], state_names[state]); tdserror(tds_get_ctx(tds), tds, TDSERPND, 0); break; } if (tds->state == TDS_IDLE) { /* TODO check this code, copied from tds_submit_prepare */ tds_free_all_results(tds); tds->rows_affected = TDS_NO_COUNT; tds_release_cursor(&tds->cur_cursor); tds_release_cur_dyn(tds); tds->current_op = TDS_OP_NONE; } tds->state = state; break; default: assert(0); break; } state = tds->state; tdsdump_log(TDS_DBG_INFO1, "Changed query state from %s to %s\n", state_names[prior_state], state_names[state]); CHECK_TDS_EXTRA(tds); return state; } void tds_swap_bytes(void *buf, int bytes) { unsigned char tmp, *begin, *last; begin = (unsigned char *) buf; last = begin + bytes; while (begin < --last) { tmp = *last; *last = *begin; *begin++ = tmp; } } unsigned int tds_gettime_ms(void) { #ifdef _WIN32 return GetTickCount(); #elif defined(HAVE_GETHRTIME) return (unsigned int) (gethrtime() / 1000000u); #elif defined(HAVE_CLOCK_GETTIME) && defined(TDS_GETTIMEMILLI_CONST) struct timespec ts; clock_gettime(TDS_GETTIMEMILLI_CONST, &ts); return (unsigned int) (ts.tv_sec * 1000u + ts.tv_nsec / 1000000u); #elif defined(HAVE_GETTIMEOFDAY) struct timeval tv; gettimeofday(&tv, NULL); return (unsigned int) (tv.tv_sec * 1000u + tv.tv_usec / 1000u); #else #error How to implement tds_gettime_ms ?? #endif } /* * Call the client library's error handler */ #define EXINFO 1 #define EXUSER 2 #define EXNONFATAL 3 #define EXCONVERSION 4 #define EXSERVER 5 #define EXTIME 6 #define EXPROGRAM 7 #define EXRESOURCE 8 #define EXCOMM 9 #define EXFATAL 10 #define EXCONSISTENCY 11 typedef struct tds_error_message { TDSERRNO msgno; int severity; const char *msgtext; } TDS_ERROR_MESSAGE; static const TDS_ERROR_MESSAGE tds_error_messages[] = { { TDSEICONVIU, EXCONVERSION, "Buffer exhausted converting characters from client into server's character set" } , { TDSEICONVAVAIL, EXCONVERSION, "Character set conversion is not available between client character set '%.*s' and " "server character set '%.*s'" } , { TDSEICONVO, EXCONVERSION, "Error converting characters into server's character set. Some character(s) could " "not be converted" } , { TDSEICONVI, EXCONVERSION, "Some character(s) could not be converted into client's character set. " "Unconverted bytes were changed to question marks ('?')" } , { TDSEICONV2BIG, EXCONVERSION, "Some character(s) could not be converted into client's character set" } , { TDSEPORTINSTANCE, EXUSER, "Both port and instance specified" } , { TDSERPND, EXPROGRAM, "Attempt to initiate a new Adaptive Server operation with results pending" } , { TDSEBTOK, EXCOMM, "Bad token from the server: Datastream processing out of sync" } , { TDSECAP, EXCOMM, "DB-Library capabilities not accepted by the Server" } , { TDSECAPTYP, EXCOMM, "Unexpected capability type in CAPABILITY datastream" } , { TDSECLOS, EXCOMM, "Error in closing network connection" } , { TDSECONN, EXCOMM, "Unable to connect: Adaptive Server is unavailable or does not exist" } , { TDSEEUNR, EXCOMM, "Unsolicited event notification received" } , { TDSEFCON, EXCOMM, "Adaptive Server connection failed" } , { TDSENEG, EXCOMM, "Negotiated login attempt failed" } , { TDSEOOB, EXCOMM, "Error in sending out-of-band data to the server" } , { TDSEREAD, EXCOMM, "Read from the server failed" } , { TDSETIME, EXTIME, "Adaptive Server connection timed out" } , { TDSESEOF, EXCOMM, "Unexpected EOF from the server" } , { TDSEINTF, EXUSER, "Server name not found in configuration files." } , { TDSESOCK, EXCOMM, "Unable to open socket" } , { TDSESYNC, EXCOMM, "Read attempted while out of synchronization with Adaptive Server" } , { TDSEUHST, EXUSER, "Unknown host machine name." } , { TDSEUMSG, EXCOMM, "Unknown message-id in MSG datastream" } , { TDSEUSCT, EXCOMM, "Unable to set communications timer" } , { TDSEUTDS, EXCOMM, "Unrecognized TDS version received from the server" } , { TDSEWRIT, EXCOMM, "Write to the server failed" } , { TDSECONF, EXUSER, "Local configuration error. " "Check TDSDUMPCONFIG log for details." } /* last, with msgno == TDSEOK */ , { TDSEOK, EXCONSISTENCY, "unrecognized msgno" } }; static const char * retname(int retcode) { switch(retcode) { case TDS_INT_CONTINUE: return "TDS_INT_CONTINUE"; case TDS_INT_CANCEL: return "TDS_INT_CANCEL"; case TDS_INT_TIMEOUT: return "TDS_INT_TIMEOUT"; } assert(0); return "nonesuch"; } /** * \brief Call the client library's error handler (for library-generated errors only) * * The client library error handler may return: * TDS_INT_CANCEL -- Return TDS_FAIL to the calling function. For TDSETIME, closes the connection first. * TDS_INT_CONTINUE -- For TDSETIME only, retry the network read/write operation. Else invalid. * TDS_INT_TIMEOUT -- For TDSETIME only, send a TDSCANCEL packet. Else invalid. * * These are Sybase semantics, but they serve all purposes. * The application tells the library to quit, fail, retry, or attempt to cancel. In the event of a network timeout, * a failed operation necessarily means the connection becomes unusable, because no cancellation dialog was * concluded with the server. * * It is the client library's duty to call the error handler installed by the application, if any, and to interpret the * installed handler's return code. It may return to this function one of the above codes only. This function will not * check the return code because there's nothing that can be done here except abort. It is merely passed to the * calling function, which will (we hope) DTRT. * * \param tds_ctx points to a TDSCONTEXT structure * \param tds the connection structure, may be NULL if not connected * \param msgno an enumerated libtds msgno, cf. tds.h * \param errnum the OS errno, if it matters, else zero * * \returns client library function's return code */ int tdserror (const TDSCONTEXT * tds_ctx, TDSSOCKET * tds, int msgno, int errnum) { #if 0 static const char int_exit_text[] = "FreeTDS: libtds: exiting because client error handler returned %d for msgno %d\n"; static const char int_invalid_text[] = "%s (%d) received from client library error handler for nontimeout for error %d." " Treating as INT_EXIT\n"; #endif const TDS_ERROR_MESSAGE *err; TDSMESSAGE msg; int rc = TDS_INT_CANCEL; tdsdump_log(TDS_DBG_FUNC, "tdserror(%p, %p, %d, %d)\n", tds_ctx, tds, msgno, errnum); /* look up the error message */ for (err = tds_error_messages; err->msgno != TDSEOK; ++err) { if (err->msgno == msgno) break; } CHECK_CONTEXT_EXTRA(tds_ctx); if (tds) CHECK_TDS_EXTRA(tds); if (tds_ctx && tds_ctx->err_handler) { memset(&msg, 0, sizeof(TDSMESSAGE)); msg.msgno = msgno; msg.severity = err->severity; msg.state = -1; msg.server = "OpenClient"; msg.line_number = -1; msg.message = (TDS_CHAR*) err->msgtext; msg.sql_state = tds_alloc_client_sqlstate(msgno); msg.oserr = errnum; /* * Call client library handler. * The client library must return a valid code. It is not checked again here. */ rc = tds_ctx->err_handler(tds_ctx, tds, &msg); tdsdump_log(TDS_DBG_FUNC, "tdserror: client library returned %s(%d)\n", retname(rc), rc); TDS_ZERO_FREE(msg.sql_state); } else { const static char msg[] = "tdserror: client library not called because either " "tds_ctx (%p) or tds_ctx->err_handler is NULL\n"; tdsdump_log(TDS_DBG_ERROR, msg, tds_ctx); } assert(msgno == TDSETIME || rc != TDS_INT_TIMEOUT); /* client library should prevent */ assert(msgno == TDSETIME || rc != TDS_INT_CONTINUE); /* client library should prevent */ if (msgno != TDSETIME && rc != TDS_INT_CANCEL) { tdsdump_log(TDS_DBG_SEVERE, "exit: %s(%d) valid only for TDSETIME\n", retname(rc), rc); rc = TDS_INT_CANCEL; } if (rc == TDS_INT_TIMEOUT) { tds_send_cancel(tds); rc = TDS_INT_CONTINUE; } tdsdump_log(TDS_DBG_FUNC, "tdserror: returning %s(%d)\n", retname(rc), rc); return rc; } /** * Copy a string of length len to a new allocated buffer * This function does not read more than len bytes * Please note that some system implementation of strndup * do not assure they don't read past len bytes as they * use still strlen to check length to copy limiting * after strlen to size passed * String returned is NUL terminated * * \param s string to copy from * \param len length to copy * * \returns string copied or NULL if errors */ char * tds_strndup(const void *s, TDS_INTPTR len) { char *out; const char *end; if (len < 0) return NULL; end = (const char *) memchr(s, '\0', len); if (end) len = end - (const char *) s; out = tds_new(char, len + 1); if (out) { memcpy(out, s, len); out[len] = 0; } return out; } freetds-1.3.6/src/tds/login.c000644 025423 025423 00000113334 14113367621 017451 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2005-2015 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #ifdef _WIN32 #include #endif #include #include #include #include #include #include #include #include static TDSRET tds_send_login(TDSSOCKET * tds, const TDSLOGIN * login); static TDSRET tds71_do_login(TDSSOCKET * tds, TDSLOGIN * login); static TDSRET tds7_send_login(TDSSOCKET * tds, const TDSLOGIN * login); static void tds7_crypt_pass(const unsigned char *clear_pass, size_t len, unsigned char *crypt_pass); #undef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) void tds_set_version(TDSLOGIN * tds_login, TDS_TINYINT major_ver, TDS_TINYINT minor_ver) { tds_login->tds_version = ((TDS_USMALLINT) major_ver << 8) + minor_ver; } void tds_set_packet(TDSLOGIN * tds_login, int packet_size) { tds_login->block_size = packet_size; } void tds_set_port(TDSLOGIN * tds_login, int port) { tds_login->port = port; } bool tds_set_passwd(TDSLOGIN * tds_login, const char *password) { if (password) { tds_dstr_zero(&tds_login->password); return !!tds_dstr_copy(&tds_login->password, password); } return true; } void tds_set_bulk(TDSLOGIN * tds_login, bool enabled) { tds_login->bulk_copy = enabled ? 1 : 0; } bool tds_set_user(TDSLOGIN * tds_login, const char *username) { return !!tds_dstr_copy(&tds_login->user_name, username); } bool tds_set_host(TDSLOGIN * tds_login, const char *hostname) { return !!tds_dstr_copy(&tds_login->client_host_name, hostname); } bool tds_set_app(TDSLOGIN * tds_login, const char *application) { return !!tds_dstr_copy(&tds_login->app_name, application); } /** * \brief Set the servername in a TDSLOGIN structure * * Normally copies \a server into \a tds_login. If \a server does not point to a plausible name, the environment * variables TDSQUERY and DSQUERY are used, in that order. If they don't exist, the "default default" servername * is "SYBASE" (although the utility of that choice is a bit murky). * * \param tds_login points to a TDSLOGIN structure * \param server the servername, or NULL, or a zero-length string * \todo open the log file earlier, so these messages can be seen. */ bool tds_set_server(TDSLOGIN * tds_login, const char *server) { #if 0 /* Doing this in tds_alloc_login instead */ static const char *names[] = { "TDSQUERY", "DSQUERY", "SYBASE" }; int i; for (i=0; i < TDS_VECTOR_SIZE(names) && (!server || strlen(server) == 0); i++) { const char *source; if (i + 1 == TDS_VECTOR_SIZE(names)) { server = names[i]; source = "compiled-in default"; } else { server = getenv(names[i]); source = names[i]; } if (server) { tdsdump_log(TDS_DBG_INFO1, "Setting TDSLOGIN::server_name to '%s' from %s.\n", server, source); } } #endif if (server) return !!tds_dstr_copy(&tds_login->server_name, server); return true; } bool tds_set_library(TDSLOGIN * tds_login, const char *library) { return !!tds_dstr_copy(&tds_login->library, library); } bool tds_set_client_charset(TDSLOGIN * tds_login, const char *charset) { return !!tds_dstr_copy(&tds_login->client_charset, charset); } bool tds_set_language(TDSLOGIN * tds_login, const char *language) { return !!tds_dstr_copy(&tds_login->language, language); } struct tds_save_msg { TDSMESSAGE msg; char type; }; struct tds_save_env { char *oldval; char *newval; int type; }; typedef struct tds_save_context { /* must be first !!! */ TDSCONTEXT ctx; unsigned num_msg; struct tds_save_msg msgs[10]; unsigned num_env; struct tds_save_env envs[10]; } TDSSAVECONTEXT; static void tds_save(TDSSAVECONTEXT *ctx, char type, TDSMESSAGE *msg) { struct tds_save_msg *dest_msg; if (ctx->num_msg >= TDS_VECTOR_SIZE(ctx->msgs)) return; dest_msg = &ctx->msgs[ctx->num_msg]; dest_msg->type = type; dest_msg->msg = *msg; #define COPY(name) if (msg->name) dest_msg->msg.name = strdup(msg->name); COPY(server); COPY(message); COPY(proc_name); COPY(sql_state); #undef COPY ++ctx->num_msg; } static int tds_save_msg(const TDSCONTEXT *ctx, TDSSOCKET *tds, TDSMESSAGE *msg) { tds_save((TDSSAVECONTEXT *) ctx, 0, msg); return 0; } static int tds_save_err(const TDSCONTEXT *ctx, TDSSOCKET *tds, TDSMESSAGE *msg) { tds_save((TDSSAVECONTEXT *) ctx, 1, msg); return TDS_INT_CANCEL; } static void tds_save_env(TDSSOCKET * tds, int type, char *oldval, char *newval) { TDSSAVECONTEXT *ctx; struct tds_save_env *env; if (tds_get_ctx(tds)->msg_handler != tds_save_msg) return; ctx = (TDSSAVECONTEXT *) tds_get_ctx(tds); if (ctx->num_env >= TDS_VECTOR_SIZE(ctx->envs)) return; env = &ctx->envs[ctx->num_env]; env->type = type; env->oldval = oldval ? strdup(oldval) : NULL; env->newval = newval ? strdup(newval) : NULL; ++ctx->num_env; } static void init_save_context(TDSSAVECONTEXT *ctx, const TDSCONTEXT *old_ctx) { memset(ctx, 0, sizeof(*ctx)); ctx->ctx.locale = old_ctx->locale; ctx->ctx.msg_handler = tds_save_msg; ctx->ctx.err_handler = tds_save_err; } static void replay_save_context(TDSSOCKET *tds, TDSSAVECONTEXT *ctx) { unsigned n; /* replay all recorded messages */ for (n = 0; n < ctx->num_msg; ++n) if (ctx->msgs[n].type == 0) { if (tds_get_ctx(tds)->msg_handler) tds_get_ctx(tds)->msg_handler(tds_get_ctx(tds), tds, &ctx->msgs[n].msg); } else { if (tds_get_ctx(tds)->err_handler) tds_get_ctx(tds)->err_handler(tds_get_ctx(tds), tds, &ctx->msgs[n].msg); } /* replay all recorded envs */ for (n = 0; n < ctx->num_env; ++n) if (tds->env_chg_func) tds->env_chg_func(tds, ctx->envs[n].type, ctx->envs[n].oldval, ctx->envs[n].newval); } static void reset_save_context(TDSSAVECONTEXT *ctx) { unsigned n; /* free all messages */ for (n = 0; n < ctx->num_msg; ++n) tds_free_msg(&ctx->msgs[n].msg); ctx->num_msg = 0; /* free all envs */ for (n = 0; n < ctx->num_env; ++n) { free(ctx->envs[n].oldval); free(ctx->envs[n].newval); } ctx->num_env = 0; } static void free_save_context(TDSSAVECONTEXT *ctx) { reset_save_context(ctx); } /** * Retrieve and set @@spid * \tds */ static TDSRET tds_set_spid(TDSSOCKET * tds) { TDS_INT result_type; TDS_INT done_flags; TDSRET rc; TDSCOLUMN *curcol; CHECK_TDS_EXTRA(tds); while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_RETURN_ROW|TDS_RETURN_DONE)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROW_RESULT: if (!tds->res_info) return TDS_FAIL; if (tds->res_info->num_cols != 1) break; curcol = tds->res_info->columns[0]; switch (tds_get_conversion_type(curcol->column_type, curcol->column_size)) { case SYBINT2: tds->conn->spid = *((TDS_USMALLINT *) curcol->column_data); break; case SYBINT4: tds->conn->spid = *((TDS_UINT *) curcol->column_data); break; default: return TDS_FAIL; } break; case TDS_DONE_RESULT: if ((done_flags & TDS_DONE_ERROR) != 0) return TDS_FAIL; break; } } if (rc == TDS_NO_MORE_RESULTS) rc = TDS_SUCCESS; return rc; } static TDSRET tds_setup_connection(TDSSOCKET *tds, TDSLOGIN *login, bool set_db, bool set_spid) { TDSRET erc; char *str; int len; len = 128 + tds_quote_id(tds, NULL, tds_dstr_cstr(&login->database),-1); if ((str = tds_new(char, len)) == NULL) return TDS_FAIL; str[0] = 0; if (login->text_size) { sprintf(str, "set textsize %d ", login->text_size); } if (set_spid && tds->conn->spid == -1) { strcat(str, "select @@spid "); } /* Select proper database if specified. * SQL Anywhere does not support multiple databases and USE statement * so don't send the request to avoid connection failures */ if (set_db && !tds_dstr_isempty(&login->database) && (tds->conn->product_name == NULL || strcasecmp(tds->conn->product_name, "SQL Anywhere") != 0)) { strcat(str, "use "); tds_quote_id(tds, strchr(str, 0), tds_dstr_cstr(&login->database), -1); } /* nothing to set, just return */ if (str[0] == 0) { free(str); return TDS_SUCCESS; } erc = tds_submit_query(tds, str); free(str); if (TDS_FAILED(erc)) return erc; if (set_spid && tds->conn->spid == -1) erc = tds_set_spid(tds); else erc = tds_process_simple_query(tds); return erc; } /** * Do a connection to socket * @param tds connection structure. This should be a non-connected connection. * @return TDS_FAIL or TDS_SUCCESS if a connection was made to the server's port. * @return TDSERROR enumerated type if no TCP/IP connection could be formed. * @param login info for login * @remark Possible error conditions: * - TDSESOCK: socket(2) failed: insufficient local resources * - TDSECONN: connect(2) failed: invalid hostname or port (ETIMEDOUT, ECONNREFUSED, ENETUNREACH) * - TDSEFCON: connect(2) succeeded, login packet not acknowledged. * - TDS_FAIL: connect(2) succeeded, login failed. */ static int tds_connect(TDSSOCKET * tds, TDSLOGIN * login, int *p_oserr) { int erc = -TDSEFCON; int connect_timeout = 0; bool db_selected = false; struct addrinfo *addrs; int orig_port; bool rerouted = false; /* save to restore during redirected connection */ unsigned int orig_mars = login->mars; /* * A major version of 0 means try to guess the TDS version. * We try them in an order that should work. */ const static TDS_USMALLINT versions[] = { 0x704 , 0x500 }; if (!login->valid_configuration) { tdserror(tds_get_ctx(tds), tds, TDSECONF, 0); return TDS_FAIL; } if (TDS_MAJOR(login) == 0) { unsigned int i; TDSSAVECONTEXT save_ctx; const TDSCONTEXT *old_ctx = tds_get_ctx(tds); typedef void (*env_chg_func_t) (TDSSOCKET * tds, int type, char *oldval, char *newval); env_chg_func_t old_env_chg = tds->env_chg_func; init_save_context(&save_ctx, old_ctx); tds_set_ctx(tds, &save_ctx.ctx); tds->env_chg_func = tds_save_env; for (i = 0; i < TDS_VECTOR_SIZE(versions); ++i) { int orig_size = tds->conn->env.block_size; login->tds_version = versions[i]; reset_save_context(&save_ctx); erc = tds_connect(tds, login, p_oserr); if (TDS_FAILED(erc)) { tds_close_socket(tds); if (tds->conn->env.block_size != orig_size) tds_realloc_socket(tds, orig_size); } if (erc != -TDSEFCON) /* TDSEFCON indicates wrong TDS version */ break; if (login->server_is_valid) break; } tds->env_chg_func = old_env_chg; tds_set_ctx(tds, old_ctx); replay_save_context(tds, &save_ctx); free_save_context(&save_ctx); if (TDS_FAILED(erc)) tdserror(tds_get_ctx(tds), tds, -erc, *p_oserr); return erc; } /* * If a dump file has been specified, start logging */ if (!tds_dstr_isempty(&login->dump_file) && !tdsdump_isopen()) { if (login->debug_flags) tds_debug_flags = login->debug_flags; tdsdump_open(tds_dstr_cstr(&login->dump_file)); } tds->login = login; tds->conn->tds_version = login->tds_version; /* set up iconv if not already initialized*/ if (tds->conn->char_convs[client2ucs2]->to.cd == (iconv_t) -1) { if (!tds_dstr_isempty(&login->client_charset)) { if (TDS_FAILED(tds_iconv_open(tds->conn, tds_dstr_cstr(&login->client_charset), login->use_utf16))) return -TDSEMEM; } } connect_timeout = login->connect_timeout; /* Jeff's hack - begin */ tds->query_timeout = connect_timeout ? connect_timeout : login->query_timeout; /* end */ /* verify that ip_addr is not empty */ if (login->ip_addrs == NULL) { tdserror(tds_get_ctx(tds), tds, TDSEUHST, 0 ); tdsdump_log(TDS_DBG_ERROR, "IP address pointer is empty\n"); if (!tds_dstr_isempty(&login->server_name)) { tdsdump_log(TDS_DBG_ERROR, "Server %s not found!\n", tds_dstr_cstr(&login->server_name)); } else { tdsdump_log(TDS_DBG_ERROR, "No server specified!\n"); } return -TDSECONN; } tds->conn->capabilities = login->capabilities; reroute: erc = TDSEINTF; orig_port = login->port; for (addrs = login->ip_addrs; addrs != NULL; addrs = addrs->ai_next) { /* * By some reasons ftds forms 3 linked tds_addrinfo (addrs * variable here) for one server address. The structures * differs in their ai_socktype and ai_protocol field * values. Typically the combinations are: * ai_socktype | ai_protocol * ----------------------------- * 1 (SOCK_STREAM) | 6 (tcp) * 2 (SOCK_DGRAM) | 17 (udp) * 3 (SOCK_RAW) | 0 (ip) * * Later on these fields are not used and dtds always * creates a tcp socket. In case if there is a connection * problem this behavior leads to 3 tries with the provided * timeout which basically multiplies the spent time * without any good result. So it was decided to skip the * non tcp addresses. * * NOTE: on Windows exactly one tds_addrinfo structure is * formed and it has 0 in both ai_socktype and * ai_protocol fields. So skipping is conditional for * non-Windows platforms */ #ifndef _WIN32 if (addrs->ai_socktype != SOCK_STREAM) continue; #endif login->port = orig_port; if (!IS_TDS50(tds->conn) && !tds_dstr_isempty(&login->instance_name) && !login->port) login->port = tds7_get_instance_port(addrs, tds_dstr_cstr(&login->instance_name)); if (login->port >= 1) { if ((erc = tds_open_socket(tds, addrs, login->port, connect_timeout, p_oserr)) == TDSEOK) break; } else { erc = TDSECONN; } } if (erc != TDSEOK) { if (login->port < 1) tdsdump_log(TDS_DBG_ERROR, "invalid port number\n"); tdserror(tds_get_ctx(tds), tds, erc, *p_oserr); return -erc; } /* * Beyond this point, we're connected to the server. We know we have a valid TCP/IP address+socket pair. * Although network errors *might* happen, most problems from here on out will be TDS-level errors, * either TDS version problems or authentication problems. */ tds_set_state(tds, TDS_IDLE); tds->conn->spid = -1; /* discard possible previous authentication */ if (tds->conn->authentication) { tds->conn->authentication->free(tds->conn, tds->conn->authentication); tds->conn->authentication = NULL; } if (IS_TDS71_PLUS(tds->conn)) { erc = tds71_do_login(tds, login); db_selected = true; } else if (IS_TDS7_PLUS(tds->conn)) { erc = tds7_send_login(tds, login); db_selected = true; } else { tds->out_flag = TDS_LOGIN; erc = tds_send_login(tds, login); } if (TDS_FAILED(erc) || TDS_FAILED(tds_process_login_tokens(tds))) { tdsdump_log(TDS_DBG_ERROR, "login packet %s\n", TDS_SUCCEED(erc)? "accepted":"rejected"); tds_close_socket(tds); tdserror(tds_get_ctx(tds), tds, TDSEFCON, 0); /* "Adaptive Server connection failed" */ return -TDSEFCON; } /* need to do rerouting */ if (IS_TDS71_PLUS(tds->conn) && !tds_dstr_isempty(&login->routing_address) && login->routing_port) { TDSRET ret; char *server_name = NULL; tds_close_socket(tds); /* only one redirection is allowed */ if (rerouted) { tdserror(tds_get_ctx(tds), tds, TDSEFCON, 0); return -TDSEFCON; } if (asprintf(&server_name, "%s,%d", tds_dstr_cstr(&login->routing_address), login->routing_port) < 0) { tdserror(tds_get_ctx(tds), tds, TDSEFCON, 0); return -TDSEMEM; } if (!tds_dstr_set(&login->server_name, server_name)) { free(server_name); tdserror(tds_get_ctx(tds), tds, TDSEFCON, 0); return -TDSEMEM; } login->mars = orig_mars; login->port = login->routing_port; ret = tds_lookup_host_set(tds_dstr_cstr(&login->routing_address), &login->ip_addrs); login->routing_port = 0; tds_dstr_free(&login->routing_address); if (TDS_FAILED(ret)) { tdserror(tds_get_ctx(tds), tds, TDSEFCON, 0); return -TDSEFCON; } rerouted = true; goto reroute; } #if ENABLE_ODBC_MARS /* initialize SID */ if (IS_TDS72_PLUS(tds->conn) && login->mars) { TDS72_SMP_HEADER *p; tds_extra_assert(tds->sid == 0); tds_extra_assert(tds->conn->sessions[0] == tds); tds_extra_assert(tds->send_packet != NULL); tds_extra_assert(!tds->send_packet->next); tds->conn->mars = 1; /* start session with a SMP SYN */ if (TDS_FAILED(tds_append_syn(tds))) return -TDSEMEM; /* reallocate send_packet */ if (!tds_realloc_socket(tds, tds->out_buf_max)) return -TDSEMEM; /* start SMP DATA header */ p = (TDS72_SMP_HEADER *) tds->send_packet->buf; p->signature = TDS72_SMP; p->type = TDS_SMP_DATA; tds_init_write_buf(tds); } #endif erc = tds_setup_connection(tds, login, !db_selected, true); /* try without asking @@spid, some servers do not support it */ if (TDS_FAILED(erc) && tds->conn->spid == -1) erc = tds_setup_connection(tds, login, !db_selected, false); if (TDS_FAILED(erc)) return erc; tds->query_timeout = login->query_timeout; tds->login = NULL; return TDS_SUCCESS; } int tds_connect_and_login(TDSSOCKET * tds, TDSLOGIN * login) { int oserr = 0; return tds_connect(tds, login, &oserr); } static int tds_put_login_string(TDSSOCKET * tds, const char *buf, int n) { const int buf_len = buf ? (int)strlen(buf) : 0; return tds_put_buf(tds, (const unsigned char *) buf, n, buf_len); } static TDSRET tds_send_login(TDSSOCKET * tds, const TDSLOGIN * login) { static const unsigned char le1[] = { 0x03, 0x01, 0x06, 0x0a, 0x09, 0x01 }; static const unsigned char le2[] = { 0x00, 13, 17 }; /* * capabilities are now part of the tds structure. * unsigned char capabilities[]= {0x01,0x07,0x03,109,127,0xFF,0xFF,0xFF,0xFE,0x02,0x07,0x00,0x00,0x0A,104,0x00,0x00,0x00}; */ /* * This is the original capabilities packet we were working with (sqsh) * unsigned char capabilities[]= {0x01,0x07,0x03,109,127,0xFF,0xFF,0xFF,0xFE,0x02,0x07,0x00,0x00,0x0A,104,0x00,0x00,0x00}; * original with 4.x messages * unsigned char capabilities[]= {0x01,0x07,0x03,109,127,0xFF,0xFF,0xFF,0xFE,0x02,0x07,0x00,0x00,0x00,120,192,0x00,0x0D}; * This is isql 11.0.3 * unsigned char capabilities[]= {0x01,0x07,0x00,96, 129,207, 0xFF,0xFE,62, 0x02,0x07,0x00,0x00,0x00,120,192,0x00,0x0D}; * like isql but with 5.0 messages * unsigned char capabilities[]= {0x01,0x07,0x00,96, 129,207, 0xFF,0xFE,62, 0x02,0x07,0x00,0x00,0x00,120,192,0x00,0x00}; */ unsigned char protocol_version[4]; unsigned char program_version[4]; unsigned char sec_flags = 0; bool use_kerberos = false; int len; char blockstr[16]; TDS_TINYINT encryption_level = login->encryption_level; /* override lservname field for ASA servers */ const char *lservname = getenv("ASA_DATABASE")? getenv("ASA_DATABASE") : tds_dstr_cstr(&login->server_name); if (strchr(tds_dstr_cstr(&login->user_name), '\\') != NULL) { tdsdump_log(TDS_DBG_ERROR, "NT login not supported using TDS 4.x or 5.0\n"); return TDS_FAIL; } if (tds_dstr_isempty(&login->user_name)) { if (!IS_TDS50(tds->conn)) { tdsdump_log(TDS_DBG_ERROR, "Kerberos login not supported using TDS 4.x\n"); return TDS_FAIL; } #ifdef ENABLE_KRB5 /* try kerberos */ sec_flags = TDS5_SEC_LOG_SECSESS; use_kerberos = true; tds->conn->authentication = tds_gss_get_auth(tds); if (!tds->conn->authentication) return TDS_FAIL; #else tdsdump_log(TDS_DBG_ERROR, "requested GSS authentication but not compiled in\n"); return TDS_FAIL; #endif } if (encryption_level == TDS_ENCRYPTION_DEFAULT) encryption_level = TDS_ENCRYPTION_OFF; if (!use_kerberos && encryption_level != TDS_ENCRYPTION_OFF) { if (!IS_TDS50(tds->conn)) { tdsdump_log(TDS_DBG_ERROR, "Encryption not supported using TDS 4.x\n"); return TDS_FAIL; } tds->conn->authentication = tds5_negotiate_get_auth(tds); if (!tds->conn->authentication) return TDS_FAIL; } if (IS_TDS42(tds->conn)) { memcpy(protocol_version, "\004\002\000\000", 4); memcpy(program_version, "\004\002\000\000", 4); } else if (IS_TDS46(tds->conn)) { memcpy(protocol_version, "\004\006\000\000", 4); memcpy(program_version, "\004\002\000\000", 4); } else if (IS_TDS50(tds->conn)) { memcpy(protocol_version, "\005\000\000\000", 4); memcpy(program_version, "\005\000\000\000", 4); } else { tdsdump_log(TDS_DBG_SEVERE, "Unknown protocol version!\n"); return TDS_FAIL; } /* * the following code is adapted from Arno Pedusaar's * (psaar@fenar.ee) MS-SQL Client. His was a much better way to * do this, (well...mine was a kludge actually) so here's mostly his */ tds_put_login_string(tds, tds_dstr_cstr(&login->client_host_name), TDS_MAXNAME); /* client host name */ tds_put_login_string(tds, tds_dstr_cstr(&login->user_name), TDS_MAXNAME); /* account name */ /* account password */ if (encryption_level != TDS_ENCRYPTION_OFF) { tds_put_login_string(tds, NULL, TDS_MAXNAME); } else { tds_put_login_string(tds, tds_dstr_cstr(&login->password), TDS_MAXNAME); } sprintf(blockstr, "%d", (int) getpid()); tds_put_login_string(tds, blockstr, TDS_MAXNAME); /* host process */ tds_put_n(tds, le1, 6); tds_put_byte(tds, !login->bulk_copy); tds_put_n(tds, NULL, 2); if (IS_TDS42(tds->conn)) { tds_put_int(tds, 512); } else { tds_put_int(tds, 0); } tds_put_n(tds, NULL, 3); tds_put_login_string(tds, tds_dstr_cstr(&login->app_name), TDS_MAXNAME); tds_put_login_string(tds, lservname, TDS_MAXNAME); if (IS_TDS42(tds->conn)) { tds_put_login_string(tds, tds_dstr_cstr(&login->password), 255); } else if (encryption_level != TDS_ENCRYPTION_OFF) { tds_put_n(tds, NULL, 256); } else { len = (int)tds_dstr_len(&login->password); if (len > 253) len = 0; tds_put_byte(tds, 0); tds_put_byte(tds, len); tds_put_n(tds, tds_dstr_cstr(&login->password), len); tds_put_n(tds, NULL, 253 - len); tds_put_byte(tds, len + 2); } tds_put_n(tds, protocol_version, 4); /* TDS version; { 0x04,0x02,0x00,0x00 } */ tds_put_login_string(tds, tds_dstr_cstr(&login->library), TDS_PROGNLEN); /* client program name */ if (IS_TDS42(tds->conn)) { tds_put_int(tds, 0); } else { tds_put_n(tds, program_version, 4); /* program version ? */ } tds_put_n(tds, le2, 3); tds_put_login_string(tds, tds_dstr_cstr(&login->language), TDS_MAXNAME); /* language */ tds_put_byte(tds, login->suppress_language); /* oldsecure(2), should be zero, used by old software */ tds_put_n(tds, NULL, 2); /* seclogin(1) bitmask */ if (sec_flags == 0 && encryption_level != TDS_ENCRYPTION_OFF) sec_flags = TDS5_SEC_LOG_ENCRYPT2|TDS5_SEC_LOG_ENCRYPT3; tds_put_byte(tds, sec_flags); /* secbulk(1) * halogin(1) type of ha login * hasessionid(6) id of session to reconnect * secspare(2) not used */ tds_put_n(tds, NULL, 10); /* use empty charset to handle conversions on client */ tds_put_login_string(tds, "", TDS_MAXNAME); /* charset */ /* this is a flag, mean that server should use character set provided by client */ /* TODO notify charset change ?? what's correct meaning ?? -- freddy77 */ tds_put_byte(tds, 1); /* network packet size */ if (login->block_size < 65536u && login->block_size >= 512) sprintf(blockstr, "%d", login->block_size); else strcpy(blockstr, "512"); tds_put_login_string(tds, blockstr, TDS_PKTLEN); if (IS_TDS42(tds->conn)) { tds_put_n(tds, NULL, 8); } else if (IS_TDS46(tds->conn)) { tds_put_n(tds, NULL, 4); } else if (IS_TDS50(tds->conn)) { /* just padding to 8 bytes */ tds_put_n(tds, NULL, 4); /* send capabilities */ tds_put_byte(tds, TDS_CAPABILITY_TOKEN); tds_put_smallint(tds, sizeof(tds->conn->capabilities)); tds_put_n(tds, &tds->conn->capabilities, sizeof(tds->conn->capabilities)); } #ifdef ENABLE_KRB5 if (use_kerberos) tds5_gss_send(tds); #endif return tds_flush_packet(tds); } /** * tds7_send_login() -- Send a TDS 7.0 login packet * TDS 7.0 login packet is vastly different and so gets its own function * \returns the return value is ignored by the caller. :-/ */ static TDSRET tds7_send_login(TDSSOCKET * tds, const TDSLOGIN * login) { static const unsigned char client_progver[] = { 6, 0x83, 0xf2, 0xf8 }, connection_id[] = { 0x00, 0x00, 0x00, 0x00 }, collation[] = { 0x36, 0x04, 0x00, 0x00 }; enum { tds70Version = 0x70000000, tds71Version = 0x71000001, tds72Version = 0x72090002, tds73Version = 0x730B0003, tds74Version = 0x74000004, }; TDS_UCHAR sql_type_flag = 0x00; TDS_INT time_zone = -120; TDS_INT tds7version = tds70Version; TDS_INT block_size = 4096; unsigned char option_flag1 = TDS_SET_LANG_ON | TDS_USE_DB_NOTIFY | TDS_INIT_DB_FATAL; unsigned char option_flag2 = login->option_flag2; unsigned char option_flag3 = 0; unsigned char hwaddr[6]; size_t packet_size, current_pos; TDSRET rc; void *data = NULL; TDSDYNAMICSTREAM data_stream; TDSSTATICINSTREAM input; const char *user_name = tds_dstr_cstr(&login->user_name); unsigned char *pwd; /* FIXME: These are defined as size_t, but should be TDS_SMALLINT. */ size_t user_name_len = strlen(user_name); size_t auth_len = 0; static const char ext_data[] = "\x0a\x01\x00\x00\x00\x01" /* Enable UTF-8 */ "\xff"; size_t ext_len = IS_TDS74_PLUS(tds->conn) ? sizeof(ext_data) - 1 : 0; /* fields */ enum { HOST_NAME, USER_NAME, PASSWORD, APP_NAME, SERVER_NAME, EXTENSION, LIBRARY_NAME, LANGUAGE, DATABASE_NAME, DB_FILENAME, NEW_PASSWORD, NUM_DATA_FIELDS }; struct { const void *ptr; unsigned pos, len, limit; } data_fields[NUM_DATA_FIELDS], *field; tds->out_flag = TDS7_LOGIN; current_pos = packet_size = IS_TDS72_PLUS(tds->conn) ? 86 + 8 : 86; /* ? */ /* check ntlm */ #ifdef HAVE_SSPI if (strchr(user_name, '\\') != NULL || user_name_len == 0) { tdsdump_log(TDS_DBG_INFO2, "using SSPI authentication for '%s' account\n", user_name); tds->conn->authentication = tds_sspi_get_auth(tds); if (!tds->conn->authentication) return TDS_FAIL; auth_len = tds->conn->authentication->packet_len; packet_size += auth_len; #else if (strchr(user_name, '\\') != NULL) { tdsdump_log(TDS_DBG_INFO2, "using NTLM authentication for '%s' account\n", user_name); tds->conn->authentication = tds_ntlm_get_auth(tds); if (!tds->conn->authentication) return TDS_FAIL; auth_len = tds->conn->authentication->packet_len; packet_size += auth_len; } else if (user_name_len == 0) { # ifdef ENABLE_KRB5 /* try kerberos */ tdsdump_log(TDS_DBG_INFO2, "using GSS authentication\n"); tds->conn->authentication = tds_gss_get_auth(tds); if (!tds->conn->authentication) return TDS_FAIL; auth_len = tds->conn->authentication->packet_len; packet_size += auth_len; # else tdsdump_log(TDS_DBG_ERROR, "requested GSS authentication but not compiled in\n"); return TDS_FAIL; # endif #endif } /* initialize ouput buffer for strings */ rc = tds_dynamic_stream_init(&data_stream, &data, 0); if (TDS_FAILED(rc)) return rc; #define SET_FIELD_DSTR(field, dstr, len_limit) do { \ data_fields[field].ptr = tds_dstr_cstr(&(dstr)); \ data_fields[field].len = tds_dstr_len(&(dstr)); \ data_fields[field].limit = (len_limit) * 2; \ } while(0) /* setup data fields */ memset(data_fields, 0, sizeof(data_fields)); SET_FIELD_DSTR(HOST_NAME, login->client_host_name, 128); if (!tds->conn->authentication) { SET_FIELD_DSTR(USER_NAME, login->user_name, 128); SET_FIELD_DSTR(PASSWORD, login->password, 128); } SET_FIELD_DSTR(APP_NAME, login->app_name, 128); SET_FIELD_DSTR(SERVER_NAME, login->server_name, 128); SET_FIELD_DSTR(LIBRARY_NAME, login->library, 128); SET_FIELD_DSTR(LANGUAGE, login->language, 128); SET_FIELD_DSTR(DATABASE_NAME, login->database, 128); SET_FIELD_DSTR(DB_FILENAME, login->db_filename, 260); if (IS_TDS72_PLUS(tds->conn) && login->use_new_password) { option_flag3 |= TDS_CHANGE_PASSWORD; SET_FIELD_DSTR(NEW_PASSWORD, login->new_password, 128); } if (ext_len) option_flag3 |= TDS_EXTENSION; /* convert data fields */ for (field = data_fields; field < data_fields + TDS_VECTOR_SIZE(data_fields); ++field) { size_t data_pos; data_pos = data_stream.size; field->pos = current_pos + data_pos; if (field->len) { tds_staticin_stream_init(&input, field->ptr, field->len); rc = tds_convert_stream(tds, tds->conn->char_convs[client2ucs2], to_server, &input.stream, &data_stream.stream); if (TDS_FAILED(rc)) { free(data); return TDS_FAIL; } } else if (ext_len && field == &data_fields[EXTENSION]) { if (data_stream.stream.write(&data_stream.stream, 4) != 4) { free(data); return TDS_FAIL; } field->len = 4; continue; } data_stream.size = MIN(data_stream.size, data_pos + field->limit); data_stream.stream.write(&data_stream.stream, 0); field->len = data_stream.size - data_pos; } pwd = (unsigned char *) data + data_fields[PASSWORD].pos - current_pos; tds7_crypt_pass(pwd, data_fields[PASSWORD].len, pwd); pwd = (unsigned char *) data + data_fields[NEW_PASSWORD].pos - current_pos; tds7_crypt_pass(pwd, data_fields[NEW_PASSWORD].len, pwd); packet_size += data_stream.size; if (ext_len) { packet_size += ext_len; pwd = (unsigned char *) data + data_fields[EXTENSION].pos - current_pos; TDS_PUT_UA4LE(pwd, current_pos + data_stream.size + auth_len); } #if !defined(TDS_DEBUG_LOGIN) tdsdump_log(TDS_DBG_INFO2, "quietly sending TDS 7+ login packet\n"); do { TDSDUMP_OFF_ITEM off_item; tdsdump_off(&off_item); #endif TDS_PUT_INT(tds, packet_size); switch (login->tds_version) { case 0x700: tds7version = tds70Version; break; case 0x701: tds7version = tds71Version; break; case 0x702: tds7version = tds72Version; break; case 0x703: tds7version = tds73Version; break; case 0x704: tds7version = tds74Version; break; default: assert(0 && 0x700 <= login->tds_version && login->tds_version <= 0x704); } tds_put_int(tds, tds7version); if (4096 <= login->block_size && login->block_size < 65536u) block_size = login->block_size; tds_put_int(tds, block_size); /* desired packet size being requested by client */ if (block_size > tds->out_buf_max) tds_realloc_socket(tds, block_size); tds_put_n(tds, client_progver, sizeof(client_progver)); /* client program version ? */ tds_put_int(tds, getpid()); /* process id of this process */ tds_put_n(tds, connection_id, sizeof(connection_id)); if (!login->bulk_copy) option_flag1 |= TDS_DUMPLOAD_OFF; tds_put_byte(tds, option_flag1); if (tds->conn->authentication) option_flag2 |= TDS_INTEGRATED_SECURITY_ON; tds_put_byte(tds, option_flag2); if (login->readonly_intent && IS_TDS71_PLUS(tds->conn)) sql_type_flag |= TDS_READONLY_INTENT; tds_put_byte(tds, sql_type_flag); if (IS_TDS73_PLUS(tds->conn)) option_flag3 |= TDS_UNKNOWN_COLLATION_HANDLING; tds_put_byte(tds, option_flag3); tds_put_int(tds, time_zone); tds_put_n(tds, collation, sizeof(collation)); #define PUT_STRING_FIELD_PTR(field) do { \ TDS_PUT_SMALLINT(tds, data_fields[field].pos); \ TDS_PUT_SMALLINT(tds, data_fields[field].len / 2u); \ } while(0) /* host name */ PUT_STRING_FIELD_PTR(HOST_NAME); if (tds->conn->authentication) { tds_put_int(tds, 0); tds_put_int(tds, 0); } else { /* username */ PUT_STRING_FIELD_PTR(USER_NAME); /* password */ PUT_STRING_FIELD_PTR(PASSWORD); } /* app name */ PUT_STRING_FIELD_PTR(APP_NAME); /* server name */ PUT_STRING_FIELD_PTR(SERVER_NAME); /* extensions */ if (ext_len) { TDS_PUT_SMALLINT(tds, data_fields[EXTENSION].pos); tds_put_smallint(tds, 4); } else { tds_put_int(tds, 0); } /* library name */ PUT_STRING_FIELD_PTR(LIBRARY_NAME); /* language - kostya@warmcat.excom.spb.su */ PUT_STRING_FIELD_PTR(LANGUAGE); /* database name */ PUT_STRING_FIELD_PTR(DATABASE_NAME); /* MAC address */ tds_getmac(tds_get_s(tds), hwaddr); tds_put_n(tds, hwaddr, 6); /* authentication stuff */ TDS_PUT_SMALLINT(tds, current_pos + data_stream.size); TDS_PUT_SMALLINT(tds, MIN(auth_len, 0xffffu)); /* db file */ PUT_STRING_FIELD_PTR(DB_FILENAME); if (IS_TDS72_PLUS(tds->conn)) { /* new password */ PUT_STRING_FIELD_PTR(NEW_PASSWORD); /* SSPI long */ tds_put_int(tds, auth_len >= 0xffffu ? auth_len : 0); } tds_put_n(tds, data, data_stream.size); if (tds->conn->authentication) tds_put_n(tds, tds->conn->authentication->packet, auth_len); if (ext_len) tds_put_n(tds, ext_data, ext_len); rc = tds_flush_packet(tds); #if !defined(TDS_DEBUG_LOGIN) tdsdump_on(&off_item); } while(0); #endif free(data); return rc; } /** * tds7_crypt_pass() -- 'encrypt' TDS 7.0 style passwords. * the calling function is responsible for ensuring crypt_pass is at least * 'len' characters */ static void tds7_crypt_pass(const unsigned char *clear_pass, size_t len, unsigned char *crypt_pass) { size_t i; for (i = 0; i < len; i++) crypt_pass[i] = ((clear_pass[i] << 4) | (clear_pass[i] >> 4)) ^ 0xA5; } static TDSRET tds71_do_login(TDSSOCKET * tds, TDSLOGIN* login) { int i, pkt_len; const char *instance_name = tds_dstr_isempty(&login->instance_name) ? "MSSQLServer" : tds_dstr_cstr(&login->instance_name); int instance_name_len = strlen(instance_name) + 1; TDS_CHAR crypt_flag; unsigned int start_pos = 21; TDSRET ret; #define START_POS 21 #define UI16BE(n) ((n) >> 8), ((n) & 0xffu) #define SET_UI16BE(i,n) TDS_PUT_UA2BE(&buf[i],n) TDS_UCHAR buf[] = { /* netlib version */ 0, UI16BE(START_POS), UI16BE(6), /* encryption */ 1, UI16BE(START_POS + 6), UI16BE(1), /* instance */ 2, UI16BE(START_POS + 6 + 1), UI16BE(0), /* process id */ 3, UI16BE(0), UI16BE(4), /* MARS enables */ 4, UI16BE(0), UI16BE(1), /* end */ 0xff }; static const TDS_UCHAR netlib8[] = { 8, 0, 1, 0x55, 0, 0 }; static const TDS_UCHAR netlib9[] = { 9, 0, 0, 0, 0, 0 }; TDS_UCHAR *p; TDS_TINYINT encryption_level = login->encryption_level; SET_UI16BE(13, instance_name_len); if (!IS_TDS72_PLUS(tds->conn)) { SET_UI16BE(16, START_POS + 6 + 1 + instance_name_len); /* strip MARS setting */ buf[20] = 0xff; } else { start_pos += 5; #undef START_POS #define START_POS 26 SET_UI16BE(1, START_POS); SET_UI16BE(6, START_POS + 6); SET_UI16BE(11, START_POS + 6 + 1); SET_UI16BE(16, START_POS + 6 + 1 + instance_name_len); SET_UI16BE(21, START_POS + 6 + 1 + instance_name_len + 4); } assert(start_pos >= 21 && start_pos <= sizeof(buf)); assert(buf[start_pos-1] == 0xff); if (encryption_level == TDS_ENCRYPTION_DEFAULT) encryption_level = TDS_ENCRYPTION_REQUEST; /* * fix a problem with mssql2k which doesn't like * packet splitted during SSL handshake */ if (tds->out_buf_max < 4096) tds_realloc_socket(tds, 4096); /* do prelogin */ tds->out_flag = TDS71_PRELOGIN; tds_put_n(tds, buf, start_pos); /* netlib version */ tds_put_n(tds, IS_TDS72_PLUS(tds->conn) ? netlib9 : netlib8, 6); /* encryption */ #if !defined(HAVE_GNUTLS) && !defined(HAVE_OPENSSL) /* not supported */ tds_put_byte(tds, TDS7_ENCRYPT_NOT_SUP); #else /* The observation working with Microsoft SQL Server is that OFF did not mean off, and you would end up with encryption turned on. Therefore when the freetds.conf says encrypt = off we really want no encryption, and claiming lack of support works for that. Note that the configuration default in this subroutine always been request due to code above that tests for TDS_ENCRYPTION_DEFAULT. */ tds_put_byte(tds, encryption_level == TDS_ENCRYPTION_OFF ? TDS7_ENCRYPT_NOT_SUP : encryption_level >= TDS_ENCRYPTION_REQUIRE ? TDS7_ENCRYPT_ON : TDS7_ENCRYPT_OFF); #endif /* instance */ tds_put_n(tds, instance_name, instance_name_len); /* pid */ tds_put_int(tds, getpid()); /* MARS (1 enabled) */ if (IS_TDS72_PLUS(tds->conn)) #if ENABLE_ODBC_MARS tds_put_byte(tds, login->mars); login->mars = 0; #else tds_put_byte(tds, 0); #endif ret = tds_flush_packet(tds); if (TDS_FAILED(ret)) return ret; /* now process reply from server */ ret = tds_read_packet(tds); if (ret <= 0 || tds->in_flag != TDS_REPLY) return TDS_FAIL; login->server_is_valid = 1; pkt_len = tds->in_len - tds->in_pos; /* the only thing we care is flag */ p = tds->in_buf + tds->in_pos; /* default 2, no certificate, no encryption */ crypt_flag = TDS7_ENCRYPT_NOT_SUP; for (i = 0;; i += 5) { TDS_UCHAR type; int off, len; if (i >= pkt_len) return TDS_FAIL; type = p[i]; if (type == 0xff) break; /* check packet */ if (i+4 >= pkt_len) return TDS_FAIL; off = TDS_GET_UA2BE(&p[i+1]); len = TDS_GET_UA2BE(&p[i+3]); if (off > pkt_len || (off+len) > pkt_len) return TDS_FAIL; if (type == 1 && len >= 1) { crypt_flag = p[off]; } #if ENABLE_ODBC_MARS if (IS_TDS72_PLUS(tds->conn) && type == 4 && len >= 1) login->mars = p[off]; #endif } /* we readed all packet */ tds->in_pos += pkt_len; /* TODO some mssql version do not set last packet, update tds according */ tdsdump_log(TDS_DBG_INFO1, "detected crypt flag %d\n", crypt_flag); /* if server do not has certificate do normal login */ if (crypt_flag == TDS7_ENCRYPT_NOT_SUP) { /* unless we wanted encryption and got none, then fail */ if (encryption_level >= TDS_ENCRYPTION_REQUIRE) return TDS_FAIL; return tds7_send_login(tds, login); } /* * if server has a certificate it requires at least a crypted login * (even if data is not encrypted) */ /* here we have to do encryption ... */ ret = tds_ssl_init(tds); if (TDS_FAILED(ret)) return ret; /* server just encrypt the first packet */ if (crypt_flag == TDS7_ENCRYPT_OFF) tds->conn->encrypt_single_packet = 1; ret = tds7_send_login(tds, login); /* if flag is TDS7_ENCRYPT_OFF(0) it means that after login server continue not encrypted */ if (crypt_flag == TDS7_ENCRYPT_OFF || TDS_FAILED(ret)) tds_ssl_deinit(tds->conn); return ret; } freetds-1.3.6/src/tds/read.c000644 025423 025423 00000017603 14056414222 017252 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2005-2014 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * \file * \brief Grab data from TDS packets */ #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #include #include #include #include static size_t read_and_convert(TDSSOCKET * tds, TDSICONV * char_conv, size_t * wire_size, char *outbuf, size_t outbytesleft); /** * \ingroup libtds * \defgroup network Network functions * Functions for reading or writing from network. */ /** * \addtogroup network * @{ */ /** * Return a single byte from the input buffer * \tds */ unsigned char tds_get_byte(TDSSOCKET * tds) { while (tds->in_pos >= tds->in_len) { if (tds_read_packet(tds) < 0) return 0; } return tds->in_buf[tds->in_pos++]; } /** * Unget will always work as long as you don't call it twice in a row. It * it may work if you call it multiple times as long as you don't backup * over the beginning of network packet boundary which can occur anywhere in * the token stream. * \tds */ void tds_unget_byte(TDSSOCKET * tds) { /* this is a one trick pony...don't call it twice */ tds->in_pos--; } /** * Reads a byte from the TDS stream without removing it * \tds */ unsigned char tds_peek(TDSSOCKET * tds) { unsigned char result = tds_get_byte(tds); if (tds->in_pos > 0) --tds->in_pos; return result; } /* tds_peek() */ /** * Get an int16 from the server. */ TDS_USMALLINT tds_get_usmallint(TDSSOCKET * tds) { TDS_USMALLINT bytes[1]; tds_get_n(tds, &bytes, 2); return (TDS_USMALLINT) TDS_GET_A2LE(&bytes); } /** * Get an int32 from the server. * \tds */ TDS_UINT tds_get_uint(TDSSOCKET * tds) { TDS_UINT bytes; tds_get_n(tds, &bytes, 4); return TDS_GET_A4LE(&bytes); } /** * Get an uint64 from the server. * \tds */ TDS_UINT8 tds_get_uint8(TDSSOCKET * tds) { TDS_UINT h; TDS_UINT l; TDS_UINT bytes[2]; tds_get_n(tds, bytes, 8); l = TDS_GET_A4LE(bytes); h = TDS_GET_A4LE(bytes+1); return (((TDS_UINT8) h) << 32) | l; } /** * Fetch a string from the wire. * Output string is NOT null terminated. * If TDS version is 7 or 8 read unicode string and convert it. * This function should be use to read server default encoding strings like * columns name, table names, etc, not for data (use tds_get_char_data instead) * @return bytes written to \a dest * @param tds connection information * @param string_len length of string to read from wire * (in server characters, bytes for tds4-tds5, ucs2 for tds7+) * @param dest destination buffer, if NULL string is read and discarded * @param dest_size destination buffer size, in bytes */ size_t tds_get_string(TDSSOCKET * tds, size_t string_len, char *dest, size_t dest_size) { size_t wire_bytes = string_len; unsigned conv = client2server_chardata; if (IS_TDS7_PLUS(tds->conn)) { wire_bytes *= 2u; conv = client2ucs2; } if (dest == NULL) { tds_get_n(tds, NULL, wire_bytes); return string_len; } return read_and_convert(tds, tds->conn->char_convs[conv], &wire_bytes, dest, dest_size); } /** * Fetch character data the wire. * Output is NOT null terminated. * If \a char_conv is not NULL, convert data accordingly. * \param tds state information for the socket and the TDS protocol * \param row_buffer destination buffer in current_row. Can't be NULL * \param wire_size size to read from wire (in bytes) * \param curcol column information * \return TDS_SUCCESS or TDS_FAIL (probably memory error on text data) */ TDSRET tds_get_char_data(TDSSOCKET * tds, char *row_buffer, size_t wire_size, TDSCOLUMN * curcol) { size_t in_left; assert(curcol->char_conv); /* * row_buffer is a column buffer, allocated when the column's metadata are processed * and reused for each row. */ /* silly case, empty string */ if (wire_size == 0) { curcol->column_cur_size = 0; return TDS_SUCCESS; } in_left = curcol->column_size; curcol->column_cur_size = read_and_convert(tds, curcol->char_conv, &wire_size, row_buffer, in_left); if (TDS_UNLIKELY(wire_size > 0)) { tds_get_n(tds, NULL, wire_size); tdsdump_log(TDS_DBG_NETWORK, "error: tds_get_char_data: discarded %u on wire while reading %d into client. \n", (unsigned int) wire_size, curcol->column_cur_size); return TDS_FAIL; } return TDS_SUCCESS; } /** * Get N bytes from the buffer and return them in the already allocated space * given to us. We ASSUME that the person calling this function has done the * bounds checking for us since they know how many bytes they want here. * dest of NULL means we just want to eat the bytes. (tetherow@nol.org) */ bool tds_get_n(TDSSOCKET * tds, void *dest, size_t need) { for (;;) { unsigned int have = tds->in_len - tds->in_pos; if (need <= have) break; /* We need more than is in the buffer, copy what is there */ if (dest != NULL) { memcpy((char *) dest, tds->in_buf + tds->in_pos, have); dest = (char *) dest + have; } need -= have; if (TDS_UNLIKELY(tds_read_packet(tds) < 0)) return false; } if (need > 0) { /* get the remainder if there is any */ if (dest != NULL) { memcpy((char *) dest, tds->in_buf + tds->in_pos, need); } tds->in_pos += need; } return true; } /** * For UTF-8 and similar, tds_iconv() may encounter a partial sequence when the chunk boundary * is not aligned with the character boundary. In that event, it will return an error, and * some number of bytes (less than a character) will remain in the tail end of temp[]. They are * moved to the beginning, ptemp is adjusted to point just behind them, and the next chunk is read. * \tds * \param char_conv conversion structure * \param[out] wire_size size readed from wire * \param outbuf buffer to write to * \param outbytesleft buffer length * \return bytes readed */ static size_t read_and_convert(TDSSOCKET * tds, TDSICONV * char_conv, size_t * wire_size, char *outbuf, size_t outbytesleft) { int res; TDSDATAINSTREAM r; TDSSTATICOUTSTREAM w; tds_datain_stream_init(&r, tds, *wire_size); tds_staticout_stream_init(&w, outbuf, outbytesleft); res = tds_convert_stream(tds, char_conv, to_client, &r.stream, &w.stream); *wire_size = r.wire_size; return (char *) w.stream.buffer - outbuf; } /** * Reads a string from wire and put in a DSTR. * On error we read the bytes from the wire anyway. * \tds * \param[out] s output string * \param[in] len string length (in characters) * \return string or NULL on error */ DSTR* tds_dstr_get(TDSSOCKET * tds, DSTR * s, size_t len) { size_t out_len; CHECK_TDS_EXTRA(tds); /* assure sufficient space for every conversion */ if (TDS_UNLIKELY(!tds_dstr_alloc(s, len * 4))) { tds_get_n(tds, NULL, len); return NULL; } out_len = tds_get_string(tds, len, tds_dstr_buf(s), len * 4); tds_dstr_setlen(s, out_len); return s; } /** @} */ freetds-1.3.6/src/tds/write.c000644 025423 025423 00000012407 14056414222 017466 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2005 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #include #include #if TDS_ADDITIONAL_SPACE < 8 #error Not supported #endif /** * \addtogroup network * @{ */ /* * CRE 01262002 making buf a void * means we can put any type without casting * much like read() and memcpy() */ int tds_put_n(TDSSOCKET * tds, const void *buf, size_t n) { size_t left; const unsigned char *bufp = (const unsigned char *) buf; for (; n;) { if (tds->out_buf_max <= tds->out_pos) { tds_write_packet(tds, 0x0); continue; } left = tds->out_buf_max - tds->out_pos; if (left > n) left = n; if (bufp) { memcpy(tds->out_buf + tds->out_pos, bufp, left); bufp += left; } else { memset(tds->out_buf + tds->out_pos, 0, left); } tds->out_pos += (unsigned int)left; n -= left; } return 0; } /** * Output a string to wire * automatic translate string to unicode if needed * \return bytes written to wire * \param tds state information for the socket and the TDS protocol * \param s string to write * \param len length of string in characters, or -1 for null terminated */ int tds_put_string(TDSSOCKET * tds, const char *s, int len) { int res; TDSSTATICINSTREAM r; TDSDATAOUTSTREAM w; enum TDS_ICONV_ENTRY iconv_entry; if (len < 0) { TDS_ENCODING *client; client = &tds->conn->char_convs[client2ucs2]->from.charset; if (client->min_bytes_per_char == 1) { /* ascii or UTF-8 */ len = (int)strlen(s); } else if (client->min_bytes_per_char == 2) { /* UCS-2 or variant */ const char *p = s; while (p[0] || p[1]) p += 2; len = (int)(p - s); } else if (client->min_bytes_per_char == 4) { /* UCS-4 or variant */ const char *p = s; while (p[0] || p[1] || p[2] || p[3]) p += 4; len = (int)(p - s); } else { assert(client->min_bytes_per_char < 3); /* FIXME */ } } assert(len >= 0); /* valid test only if client and server share a character set. TODO conversions for Sybase */ if (IS_TDS7_PLUS(tds->conn)) { iconv_entry = client2ucs2; } else if (IS_TDS50(tds->conn)) { iconv_entry = client2server_chardata; } else { tds_put_n(tds, s, len); return len; } tds_staticin_stream_init(&r, s, len); tds_dataout_stream_init(&w, tds); res = tds_convert_stream(tds, tds->conn->char_convs[iconv_entry], to_server, &r.stream, &w.stream); return w.written; } int tds_put_buf(TDSSOCKET * tds, const unsigned char *buf, int dsize, int ssize) { int cpsize; cpsize = ssize > dsize ? dsize : ssize; tds_put_n(tds, buf, cpsize); dsize -= cpsize; tds_put_n(tds, NULL, dsize); return tds_put_byte(tds, cpsize); } int tds_put_int8(TDSSOCKET * tds, TDS_INT8 i) { TDS_UCHAR *p; if (tds->out_pos >= tds->out_buf_max) tds_write_packet(tds, 0x0); p = &tds->out_buf[tds->out_pos]; TDS_PUT_UA4LE(p, (TDS_UINT) i); TDS_PUT_UA4LE(p+4, (TDS_UINT) (i >> 32)); tds->out_pos += 8; return 0; } int tds_put_int(TDSSOCKET * tds, TDS_INT i) { TDS_UCHAR *p; if (tds->out_pos >= tds->out_buf_max) tds_write_packet(tds, 0x0); p = &tds->out_buf[tds->out_pos]; TDS_PUT_UA4LE(p, i); tds->out_pos += 4; return 0; } int tds_put_smallint(TDSSOCKET * tds, TDS_SMALLINT si) { TDS_UCHAR *p; if (tds->out_pos >= tds->out_buf_max) tds_write_packet(tds, 0x0); p = &tds->out_buf[tds->out_pos]; TDS_PUT_UA2LE(p, si); tds->out_pos += 2; return 0; } int tds_put_byte(TDSSOCKET * tds, unsigned char c) { if (tds->out_pos >= (unsigned int)tds->out_buf_max) tds_write_packet(tds, 0x0); tds->out_buf[tds->out_pos++] = c; return 0; } int tds_init_write_buf(TDSSOCKET * tds) { TDS_MARK_UNDEFINED(tds->out_buf, tds->out_buf_max); tds->out_pos = 8; return 0; } /** * Flush packet to server * @return TDS_FAIL or TDS_SUCCESS */ TDSRET tds_flush_packet(TDSSOCKET * tds) { TDSRET result = TDS_FAIL; /* GW added check for tds->s */ if (!IS_TDSDEAD(tds)) { if (tds->out_pos > tds->out_buf_max) { result = tds_write_packet(tds, 0x00); if (TDS_FAILED(result)) return result; } result = tds_write_packet(tds, 0x01); } return result; } /** @} */ freetds-1.3.6/src/tds/convert.c000644 025423 025423 00000246342 14056414271 020027 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STRINGS_H #include #endif /* HAVE_STRINGS_H */ #include #include #include #include typedef unsigned short utf16_t; struct tds_time { int tm_year; /**< year (0=1900) */ int tm_mon; /**< month (0-11) */ int tm_mday; /**< month day (1-31) */ int tm_hour; /**< hours (0-23) */ int tm_min; /**< minutes (0-59) */ int tm_sec; /**< seconds (0-59) */ int tm_ns; /**< nanoseconds (0-999999999) */ }; static TDS_INT tds_convert_int(TDS_INT num, int desttype, CONV_RESULT * cr); static TDS_INT tds_convert_int1(const TDS_TINYINT * src, int desttype, CONV_RESULT * cr); static TDS_INT tds_convert_int2(const TDS_SMALLINT * src, int desttype, CONV_RESULT * cr); static TDS_INT tds_convert_uint2(const TDS_USMALLINT * src, int desttype, CONV_RESULT * cr); static TDS_INT tds_convert_int4(const TDS_INT* src, int desttype, CONV_RESULT * cr); static TDS_INT tds_convert_uint4(const TDS_UINT * src, int desttype, CONV_RESULT * cr); static TDS_INT tds_convert_int8(const TDS_INT8 * src, int desttype, CONV_RESULT * cr); static TDS_INT tds_convert_uint8(const TDS_UINT8 * src, int desttype, CONV_RESULT * cr); static int string_to_datetime(const char *datestr, TDS_UINT len, int desttype, CONV_RESULT * cr); static bool is_dd_mon_yyyy(char *t); static int store_dd_mon_yyy_date(char *datestr, struct tds_time *t); static const char *parse_numeric(const char *buf, const char *pend, bool * p_negative, size_t *p_digits, size_t *p_decimals); #define test_alloc(x) {if ((x)==NULL) return TDS_CONVERT_NOMEM;} #define IS_TINYINT(x) ( 0 <= (x) && (x) <= 0xff ) #define IS_SMALLINT(x) ( -32768 <= (x) && (x) <= 32767 ) #define IS_USMALLINT(x) ( 0 <= (x) && (x) <= 65535 ) /* * f77: I don't write -2147483648, some compiler seem to have some problem * with this constant although is a valid 32bit value */ #define TDS_INT_MIN (-2147483647l-1l) #define TDS_INT_MAX 2147483647l #define IS_INT(x) (TDS_INT_MIN <= (x) && (x) <= TDS_INT_MAX) #define TDS_UINT_MAX 4294967295lu #define IS_UINT(x) (0 <= (x) && (x) <= TDS_UINT_MAX) #define TDS_INT8_MAX ((((TDS_INT8) 0x7fffffffl) << 32) + (TDS_INT8) 0xfffffffflu) #define TDS_INT8_MIN (-(((TDS_INT8)1)<<62) -(((TDS_INT8)1)<<62)) #define IS_INT8(x) (TDS_INT8_MIN <= (x) && (x) <= TDS_INT8_MAX) #define TDS_UINT8_MAX ((((TDS_UINT8) 0xfffffffflu) << 32) + 0xfffffffflu) #define IS_UINT8(x) (0 <= (x) && (x) <= TDS_UINT8_MAX) #define TDS_ISDIGIT(c) ((c) >= '0' && (c) <= '9') #define BIGDATETIME_BIAS 693961 /** * \ingroup libtds * \defgroup convert Conversion * Conversions between datatypes. Supports, for example, dbconvert(). */ /** * \addtogroup convert * @{ */ /** * convert a number in string to a TDSNUMERIC * @return sizeof(TDS_NUMERIC) on success, TDS_CONVERT_* failure code on failure */ static int string_to_numeric(const char *instr, const char *pend, CONV_RESULT * cr); /** * convert a zero terminated string to NUMERIC * @return sizeof(TDS_NUMERIC) on success, TDS_CONVERT_* failure code on failure */ static int stringz_to_numeric(const char *instr, CONV_RESULT * cr); static TDS_INT string_to_int(const char *buf, const char *pend, TDS_INT * res); static TDS_INT string_to_int8(const char *buf, const char *pend, TDS_INT8 * res); static TDS_INT string_to_uint8(const char *buf, const char *pend, TDS_UINT8 * res); static TDS_INT string_to_float(const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr); static int store_hour(const char *, const char *, struct tds_time *); static int store_time(const char *, struct tds_time *); static int store_yymmdd_date(const char *, struct tds_time *); static int store_monthname(const char *, struct tds_time *); static int store_numeric_date(const char *, struct tds_time *); static int store_mday(const char *, struct tds_time *); static int store_year(int, struct tds_time *); /* static int days_this_year (int years); */ static bool is_timeformat(const char *); static bool is_numeric(const char *); static bool is_alphabetic(const char *); static bool is_ampm(const char *); #define is_monthname(s) (store_monthname(s, NULL) >= 0) static bool is_numeric_dateformat(const char *); #if 0 static TDS_UINT utf16len(const utf16_t * s); static const char *tds_prtype(int token); #endif const char tds_hex_digits[] = "0123456789abcdef"; /** * Copy a terminated string to result and return len or TDS_CONVERT_NOMEM */ static TDS_INT string_to_result(int desttype, const char *s, CONV_RESULT * cr) { size_t len = strlen(s); if (desttype != TDS_CONVERT_CHAR) { cr->c = tds_new(TDS_CHAR, len + 1); test_alloc(cr->c); memcpy(cr->c, s, len + 1); } else { memcpy(cr->cc.c, s, len < cr->cc.len ? len : cr->cc.len); } return (TDS_INT)len; } /** * Copy binary data to to result and return len or TDS_CONVERT_NOMEM */ static TDS_INT binary_to_result(int desttype, const void *data, size_t len, CONV_RESULT * cr) { if (desttype != TDS_CONVERT_BINARY) { cr->ib = tds_new(TDS_CHAR, len); test_alloc(cr->ib); memcpy(cr->ib, data, len); } else { memcpy(cr->cb.ib, data, len < cr->cb.len ? len : cr->cb.len); } return (TDS_INT)len; } #define CASE_ALL_CHAR \ SYBCHAR: case SYBVARCHAR: case SYBTEXT: case XSYBCHAR: case XSYBVARCHAR #define CASE_ALL_BINARY \ SYBBINARY: case SYBVARBINARY: case SYBIMAGE: case XSYBBINARY: case XSYBVARBINARY: \ case SYBLONGBINARY: case TDS_CONVERT_BINARY /* TODO implement me */ /* static TDS_INT tds_convert_ntext(int srctype,TDS_CHAR *src,TDS_UINT srclen, int desttype, CONV_RESULT *cr) { return TDS_CONVERT_NOAVAIL; } */ static TDS_INT tds_convert_binary(const TDS_UCHAR * src, TDS_INT srclen, int desttype, CONV_RESULT * cr) { int cplen; int s; char *c; switch (desttype) { case TDS_CONVERT_CHAR: cplen = srclen * 2; if ((TDS_UINT)cplen > cr->cc.len) cplen = cr->cc.len; c = cr->cc.c; for (s = 0; cplen >= 2; ++s, cplen -= 2) { *c++ = tds_hex_digits[src[s]>>4]; *c++ = tds_hex_digits[src[s]&0xF]; } if (cplen) *c = tds_hex_digits[src[s]>>4]; return srclen * 2; case CASE_ALL_CHAR: /* * NOTE: Do not prepend 0x to string. * The libraries all expect a bare string, without a 0x prefix. * Applications such as isql and query analyzer provide the "0x" prefix. */ /* 2 * source length + 1 for terminator */ cr->c = tds_new(TDS_CHAR, (srclen * 2) + 1); test_alloc(cr->c); c = cr->c; for (s = 0; s < srclen; s++) { *c++ = tds_hex_digits[src[s]>>4]; *c++ = tds_hex_digits[src[s]&0xF]; } *c = '\0'; return (srclen * 2); break; case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBUINT4: case SYBINT8: case SYBUINT8: case SYBMONEY4: case SYBMONEY: case SYBREAL: case SYBFLT8: cplen = tds_get_size_by_type(desttype); if (srclen >= cplen) srclen = cplen; memcpy(cr, src, srclen); memset(((char*) cr) + srclen, 0, cplen - srclen); return cplen; break; /* conversions not allowed */ case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: /* TODO should we do some test for these types or work as ints ?? */ case SYBDECIMAL: case SYBNUMERIC: case SYBBIT: case SYBBITN: default: break; } return TDS_CONVERT_NOAVAIL; } TDS_INT tds_char2hex(TDS_CHAR *dest, TDS_UINT destlen, const TDS_CHAR * src, TDS_UINT srclen) { unsigned int i; unsigned char hex1, c = 0; /* if srclen if odd we must add a "0" before ... */ i = 0; /* number where to start converting */ if (srclen & 1) { ++srclen; i = 1; --src; } for (; i < srclen; ++i) { hex1 = src[i]; if ('0' <= hex1 && hex1 <= '9') hex1 &= 0x0f; else { hex1 &= 0x20 ^ 0xff; /* mask off 0x20 to ensure upper case */ if ('A' <= hex1 && hex1 <= 'F') { hex1 -= ('A' - 10); } else { tdsdump_log(TDS_DBG_INFO1, "error_handler: attempt to convert data stopped by syntax error in source field \n"); return TDS_CONVERT_SYNTAX; } } assert(hex1 < 0x10); if ((i/2u) >= destlen) continue; if (i & 1) dest[i / 2u] = c | hex1; else c = hex1 << 4; } return srclen / 2u; } static TDS_INT tds_convert_char(const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr) { unsigned int i; TDS_INT8 mymoney; char mynumber[28]; TDS_INT tds_i; TDS_INT8 tds_i8; TDS_UINT8 tds_ui8; TDS_INT rc; bool negative; size_t digits, decimals; switch (desttype) { case TDS_CONVERT_CHAR: memcpy(cr->cc.c, src, srclen < cr->cc.len ? srclen : cr->cc.len); return srclen; case CASE_ALL_CHAR: cr->c = tds_new(TDS_CHAR, srclen + 1); test_alloc(cr->c); memcpy(cr->c, src, srclen); cr->c[srclen] = 0; return srclen; break; case SYBINT1: case SYBUINT1: if ((rc = string_to_int(src, src + srclen, &tds_i)) < 0) return rc; if (!IS_TINYINT(tds_i)) return TDS_CONVERT_OVERFLOW; cr->ti = tds_i; return sizeof(TDS_TINYINT); break; case SYBINT2: if ((rc = string_to_int(src, src + srclen, &tds_i)) < 0) return rc; if (!IS_SMALLINT(tds_i)) return TDS_CONVERT_OVERFLOW; cr->si = tds_i; return sizeof(TDS_SMALLINT); break; case SYBUINT2: if ((rc = string_to_int(src, src + srclen, &tds_i)) < 0) return rc; if (!IS_USMALLINT(tds_i)) return TDS_CONVERT_OVERFLOW; cr->usi = (TDS_USMALLINT) tds_i; return sizeof(TDS_USMALLINT); break; case SYBINT4: if ((rc = string_to_int(src, src + srclen, &tds_i)) < 0) return rc; cr->i = tds_i; return sizeof(TDS_INT); break; case SYBUINT4: if ((rc = string_to_int8(src, src + srclen, &tds_i8)) < 0) return rc; if (!IS_UINT(tds_i8)) return TDS_CONVERT_OVERFLOW; cr->ui = (TDS_UINT) tds_i8; return sizeof(TDS_UINT); break; case SYBINT8: if ((rc = string_to_int8(src, src + srclen, &tds_i8)) < 0) return rc; cr->bi = tds_i8; return sizeof(TDS_INT8); break; case SYBUINT8: if ((rc = string_to_uint8(src, src + srclen, &tds_ui8)) < 0) return rc; cr->ubi = tds_ui8; return sizeof(TDS_UINT8); break; case SYBFLT8: case SYBREAL: return string_to_float(src, srclen, desttype, cr); break; case SYBBIT: case SYBBITN: if ((rc = string_to_int(src, src + srclen, &tds_i)) < 0) return rc; cr->ti = tds_i ? 1 : 0; return sizeof(TDS_TINYINT); break; case SYBMONEY: case SYBMONEY4: src = parse_numeric(src, src + srclen, &negative, &digits, &decimals); if (!src) return TDS_CONVERT_SYNTAX; if (digits > 18) return TDS_CONVERT_OVERFLOW; i = 0; if (negative) mynumber[i++] = '-'; for (; digits; --digits) mynumber[i++] = *src++; src++; for (digits = 0; digits < 4 && digits < decimals; ++digits) mynumber[i++] = *src++; for (; digits < 4; ++digits) mynumber[i++] = '0'; /* convert number and check for overflow */ if (string_to_int8(mynumber, mynumber + i, &mymoney) < 0) return TDS_CONVERT_OVERFLOW; if (desttype == SYBMONEY) { cr->m.mny = mymoney; return sizeof(TDS_MONEY); } else { if (!IS_INT(mymoney)) return TDS_CONVERT_OVERFLOW; cr->m4.mny4 = (TDS_INT) mymoney; return sizeof(TDS_MONEY4); } break; case SYBDATETIME: case SYBDATETIME4: case SYBMSTIME: case SYBMSDATE: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYBTIME: case SYBDATE: case SYB5BIGTIME: case SYB5BIGDATETIME: return string_to_datetime(src, srclen, desttype, cr); break; case SYBNUMERIC: case SYBDECIMAL: return string_to_numeric(src, src + srclen, cr); break; case SYBUNIQUE:{ unsigned n = 0; char c; /* * format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX * or {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} * or XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXXXXXX * or {XXXXXXXX-XXXX-XXXX-XXXXXXXXXXXXXXXX} * SQL seem to ignore the additional braces. */ if (srclen < (32 + 3)) return TDS_CONVERT_SYNTAX; if (src[0] == '{') { TDS_UINT last = (src[8+1 + 4+1 + 4+1 + 4 + 1] == '-') ? 32+4+1 : 32+3+1; if (srclen <= last || src[last] != '}') return TDS_CONVERT_SYNTAX; ++src; } /* * Test each character and get value. * sscanf works if the number terminates with less digits. */ for (i = 0; i < 32 + 3; ++i) { c = src[i]; switch (i) { case 8: if (c != '-') return TDS_CONVERT_SYNTAX; cr->u.Data1 = n; n = 0; break; case 8+1 + 4: if (c != '-') return TDS_CONVERT_SYNTAX; cr->u.Data2 = n; n = 0; break; case 8+1 + 4+1 + 4: if (c != '-') return TDS_CONVERT_SYNTAX; cr->u.Data3 = n; n = 0; break; case 8+1 + 4+1 + 4+1 + 4: /* skip last (optional) dash */ if (c == '-') { if (--srclen < 32 + 3) return TDS_CONVERT_SYNTAX; c = (++src)[i]; } /* fall through */ default: n = n << 4; if (c >= '0' && c <= '9') n += c - '0'; else { c &= 0x20 ^ 0xff; if (c >= 'A' && c <= 'F') n += c - ('A' - 10); else return TDS_CONVERT_SYNTAX; } if (i > (16 + 2) && !(i & 1)) { cr->u.Data4[(i >> 1) - 10] = n; n = 0; } } } } return sizeof(TDS_UNIQUE); default: return TDS_CONVERT_NOAVAIL; break; } /* end switch */ } /* tds_convert_char */ static TDS_INT tds_convert_bit(const TDS_CHAR * src, int desttype, CONV_RESULT * cr) { return tds_convert_int(src[0] ? 1 : 0, desttype, cr); } static TDS_INT tds_convert_int1(const TDS_TINYINT * src, int desttype, CONV_RESULT * cr) { return tds_convert_int(*src, desttype, cr); } static TDS_INT tds_convert_int2(const TDS_SMALLINT * src, int desttype, CONV_RESULT * cr) { return tds_convert_int(*src, desttype, cr); } static TDS_INT tds_convert_uint2(const TDS_USMALLINT * src, int desttype, CONV_RESULT * cr) { return tds_convert_int(*src, desttype, cr); } static TDS_INT tds_convert_int4(const TDS_INT * src, int desttype, CONV_RESULT * cr) { return tds_convert_int(*src, desttype, cr); } static TDS_INT tds_convert_uint4(const TDS_UINT * src, int desttype, CONV_RESULT * cr) { TDS_UINT8 num; num = *src; return tds_convert_uint8(&num, desttype, cr); } static TDS_INT tds_convert_int_numeric(unsigned char scale, unsigned char sign, TDS_UINT num, CONV_RESULT * cr) { unsigned char orig_prec = cr->n.precision, orig_scale = cr->n.scale; cr->n.precision = 10; cr->n.scale = scale; cr->n.array[0] = sign; cr->n.array[1] = 0; TDS_PUT_UA4BE(&(cr->n.array[2]), num); return tds_numeric_change_prec_scale(&(cr->n), orig_prec, orig_scale); } static TDS_INT tds_convert_int8_numeric(unsigned char scale, unsigned char sign, TDS_UINT8 num, CONV_RESULT * cr) { unsigned char orig_prec = cr->n.precision, orig_scale = cr->n.scale; cr->n.precision = 20; cr->n.scale = scale; cr->n.array[0] = sign; cr->n.array[1] = 0; TDS_PUT_UA4BE(&(cr->n.array[2]), (TDS_UINT) (num >> 32)); TDS_PUT_UA4BE(&(cr->n.array[6]), (TDS_UINT) num); return tds_numeric_change_prec_scale(&(cr->n), orig_prec, orig_scale); } static TDS_INT tds_convert_int(TDS_INT num, int desttype, CONV_RESULT * cr) { TDS_CHAR tmp_str[16]; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: sprintf(tmp_str, "%d", num); return string_to_result(desttype, tmp_str, cr); break; case SYBINT1: case SYBUINT1: if (!IS_TINYINT(num)) return TDS_CONVERT_OVERFLOW; cr->ti = (TDS_TINYINT) num; return sizeof(TDS_TINYINT); break; case SYBINT2: if (!IS_SMALLINT(num)) return TDS_CONVERT_OVERFLOW; cr->si = num; return sizeof(TDS_SMALLINT); break; case SYBUINT2: if (!IS_USMALLINT(num)) return TDS_CONVERT_OVERFLOW; cr->usi = (TDS_USMALLINT) num; return sizeof(TDS_USMALLINT); break; case SYBINT4: cr->i = num; return sizeof(TDS_INT); break; case SYBUINT4: if (num < 0) return TDS_CONVERT_OVERFLOW; cr->ui = (TDS_UINT) num; return sizeof(TDS_UINT); break; case SYBINT8: cr->bi = num; return sizeof(TDS_INT8); break; case SYBUINT8: if (num < 0) return TDS_CONVERT_OVERFLOW; cr->ubi = (TDS_UINT8) num; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: cr->ti = num ? 1 : 0; return sizeof(TDS_TINYINT); break; case SYBFLT8: cr->f = num; return sizeof(TDS_FLOAT); break; case SYBREAL: cr->r = (TDS_REAL) num; return sizeof(TDS_REAL); break; case SYBMONEY4: if (num > 214748 || num < -214748) return TDS_CONVERT_OVERFLOW; cr->m4.mny4 = num * 10000; return sizeof(TDS_MONEY4); break; case SYBMONEY: cr->m.mny = (TDS_INT8) num *10000; return sizeof(TDS_MONEY); break; case SYBNUMERIC: case SYBDECIMAL: if (num < 0) return tds_convert_int_numeric(0, 1, (TDS_UINT) -num, cr); return tds_convert_int_numeric(0, 0, (TDS_UINT) num, cr); break; /* handled by upper layer */ case CASE_ALL_BINARY: /* conversions not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_int8(const TDS_INT8 *src, int desttype, CONV_RESULT * cr) { TDS_INT8 buf; TDS_CHAR tmp_str[24]; memcpy(&buf, src, sizeof(buf)); if (IS_INT(buf)) return tds_convert_int((TDS_INT) buf, desttype, cr); switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: sprintf(tmp_str, "%" PRId64, buf); return string_to_result(desttype, tmp_str, cr); break; case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBMONEY4: return TDS_CONVERT_OVERFLOW; break; case SYBUINT4: if (!IS_UINT(buf)) return TDS_CONVERT_OVERFLOW; cr->ui = (TDS_UINT) buf; return sizeof(TDS_UINT); break; case SYBINT8: cr->bi = buf; return sizeof(TDS_INT8); break; case SYBUINT8: if (buf < 0) return TDS_CONVERT_OVERFLOW; cr->ubi = (TDS_UINT8) buf; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: /* this cannot be 0 as already tested above */ cr->ti = 1; return sizeof(TDS_TINYINT); break; case SYBFLT8: cr->f = (TDS_FLOAT) buf; return sizeof(TDS_FLOAT); break; case SYBREAL: cr->r = (TDS_REAL) buf; return sizeof(TDS_REAL); break; case SYBMONEY: if (buf > (TDS_INT8_MAX / 10000) || buf < (TDS_INT8_MIN / 10000)) return TDS_CONVERT_OVERFLOW; cr->m.mny = buf * 10000; return sizeof(TDS_MONEY); break; case SYBNUMERIC: case SYBDECIMAL: if (buf < 0) return tds_convert_int8_numeric(0, 1, -buf, cr); return tds_convert_int8_numeric(0, 0, buf, cr); break; /* conversions not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_uint8(const TDS_UINT8 *src, int desttype, CONV_RESULT * cr) { TDS_UINT8 buf; TDS_CHAR tmp_str[24]; memcpy(&buf, src, sizeof(buf)); /* IS_INT does not work here due to unsigned/signed conversions */ if (buf <= (TDS_UINT8) TDS_INT_MAX) return tds_convert_int((TDS_INT) buf, desttype, cr); switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: sprintf(tmp_str, "%" PRIu64, buf); return string_to_result(desttype, tmp_str, cr); break; case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBMONEY4: return TDS_CONVERT_OVERFLOW; break; case SYBUINT4: if (!IS_UINT(buf)) return TDS_CONVERT_OVERFLOW; cr->ui = (TDS_UINT) buf; return sizeof(TDS_UINT); break; case SYBINT8: if (buf > (TDS_UINT8) TDS_INT8_MAX) return TDS_CONVERT_OVERFLOW; cr->bi = (TDS_INT8) buf; return sizeof(TDS_INT8); break; case SYBUINT8: cr->ubi = buf; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: /* this cannot be 0 as already tested above */ cr->ti = 1; return sizeof(TDS_TINYINT); break; case SYBFLT8: cr->f = (TDS_FLOAT) buf; return sizeof(TDS_FLOAT); break; case SYBREAL: cr->r = (TDS_REAL) buf; return sizeof(TDS_REAL); break; case SYBMONEY: if (buf > (TDS_INT8_MAX / 10000)) return TDS_CONVERT_OVERFLOW; cr->m.mny = buf * 10000; return sizeof(TDS_MONEY); break; case SYBNUMERIC: case SYBDECIMAL: return tds_convert_int8_numeric(0, 0, buf, cr); break; /* conversions not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_numeric(const TDS_NUMERIC * src, int desttype, CONV_RESULT * cr) { char tmpstr[MAXPRECISION]; TDS_INT i, ret; TDS_INT8 bi; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: if (tds_numeric_to_string(src, tmpstr) < 0) return TDS_CONVERT_FAIL; return string_to_result(desttype, tmpstr, cr); break; case SYBINT1: case SYBUINT1: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 3, 0); if (ret < 0) return ret; if (cr->n.array[1] || (cr->n.array[0] && cr->n.array[2])) return TDS_CONVERT_OVERFLOW; cr->ti = cr->n.array[2]; return sizeof(TDS_TINYINT); break; case SYBINT2: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 5, 0); if (ret < 0) return ret; if (cr->n.array[1]) return TDS_CONVERT_OVERFLOW; i = TDS_GET_UA2BE(&(cr->n.array[2])); if (cr->n.array[0]) i = -i; if (((i >> 15) ^ cr->n.array[0]) & 1) return TDS_CONVERT_OVERFLOW; cr->si = (TDS_SMALLINT) i; return sizeof(TDS_SMALLINT); break; case SYBUINT2: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 5, 0); if (ret < 0) return ret; if (cr->n.array[0] || cr->n.array[1]) return TDS_CONVERT_OVERFLOW; i = TDS_GET_UA2BE(&(cr->n.array[2])); cr->usi = (TDS_USMALLINT) i; return sizeof(TDS_USMALLINT); break; case SYBINT4: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 10, 0); if (ret < 0) return ret; if (cr->n.array[1]) return TDS_CONVERT_OVERFLOW; i = TDS_GET_UA4BE(&(cr->n.array[2])); if (cr->n.array[0]) i = -i; if (((i >> 31) ^ cr->n.array[0]) & 1) return TDS_CONVERT_OVERFLOW; cr->i = i; return sizeof(TDS_INT); break; case SYBUINT4: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 10, 0); if (ret < 0) return ret; if (cr->n.array[0] || cr->n.array[1]) return TDS_CONVERT_OVERFLOW; i = TDS_GET_UA4BE(&(cr->n.array[2])); cr->ui = i; return sizeof(TDS_UINT); break; case SYBINT8: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 20, 0); if (ret < 0) return ret; if (cr->n.array[1]) return TDS_CONVERT_OVERFLOW; bi = TDS_GET_UA4BE(&(cr->n.array[2])); bi = (bi << 32) + TDS_GET_UA4BE(&(cr->n.array[6])); if (cr->n.array[0]) bi = -bi; if (((bi >> 63) ^ cr->n.array[0]) & 1) return TDS_CONVERT_OVERFLOW; cr->bi = bi; return sizeof(TDS_INT8); break; case SYBUINT8: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 20, 0); if (ret < 0) return ret; if (cr->n.array[0] || cr->n.array[1]) return TDS_CONVERT_OVERFLOW; bi = TDS_GET_UA4BE(&(cr->n.array[2])); bi = (bi << 32) + TDS_GET_UA4BE(&(cr->n.array[6])); cr->ubi = bi; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: cr->ti = 0; for (i = tds_numeric_bytes_per_prec[src->precision]; --i > 0;) if (src->array[i] != 0) { cr->ti = 1; break; } return sizeof(TDS_TINYINT); break; case SYBMONEY4: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 10, 4); if (ret < 0) return ret; if (cr->n.array[1]) return TDS_CONVERT_OVERFLOW; i = TDS_GET_UA4BE(&(cr->n.array[2])); if (cr->n.array[0]) i = -i; if (((i >> 31) ^ cr->n.array[0]) & 1) return TDS_CONVERT_OVERFLOW; cr->m4.mny4 = i; return sizeof(TDS_MONEY4); break; case SYBMONEY: cr->n = *src; ret = tds_numeric_change_prec_scale(&(cr->n), 20, 4); if (ret < 0) return ret; if (cr->n.array[1]) return TDS_CONVERT_OVERFLOW; bi = TDS_GET_UA4BE(&(cr->n.array[2])); bi = (bi << 32) + TDS_GET_UA4BE(&(cr->n.array[6])); if (cr->n.array[0]) bi = -bi; if (((bi >> 63) ^ cr->n.array[0]) & 1) return TDS_CONVERT_OVERFLOW; cr->m.mny = bi; return sizeof(TDS_MONEY); break; case SYBNUMERIC: case SYBDECIMAL: { unsigned char prec = cr->n.precision, scale = cr->n.scale; cr->n = *src; return tds_numeric_change_prec_scale(&(cr->n), prec, scale); } break; case SYBFLT8: if (tds_numeric_to_string(src, tmpstr) < 0) return TDS_CONVERT_FAIL; cr->f = atof(tmpstr); return 8; break; case SYBREAL: if (tds_numeric_to_string(src, tmpstr) < 0) return TDS_CONVERT_FAIL; cr->r = (TDS_REAL) atof(tmpstr); return 4; break; /* TODO conversions to money */ /* conversions not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_money4(const TDSCONTEXT * tds_ctx, const TDS_MONEY4 * src, int desttype, CONV_RESULT * cr) { TDS_MONEY4 mny; long dollars; char tmp_str[33]; char *p; mny = *src; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: { unsigned dollars; /* * round to 2 decimal digits * rounding with dollars = (mny.mny4 + 5000) /10000 * can give arithmetic overflow so I use * dollars = (mny.mny4/50 + 1)/2 */ /* TODO round also all conversions to int and from money ?? */ p = tmp_str; if (mny.mny4 < 0) { *p++ = '-'; /* we use unsigned cause this cause arithmetic problem for -2^31*/ dollars = -mny.mny4; } else { dollars = mny.mny4; } if (tds_ctx->money_use_2_digits) { /* print only 2 decimal digits as server does */ dollars = (dollars + 50) / 100; sprintf(p, "%u.%02u", dollars / 100u, dollars % 100u); } else { sprintf(p, "%u.%04u", dollars / 10000u, dollars % 10000u); } return string_to_result(desttype, tmp_str, cr); } break; case SYBINT1: case SYBUINT1: dollars = mny.mny4 / 10000; if (!IS_TINYINT(dollars)) return TDS_CONVERT_OVERFLOW; cr->ti = (TDS_TINYINT) dollars; return sizeof(TDS_TINYINT); break; case SYBINT2: dollars = mny.mny4 / 10000; if (!IS_SMALLINT(dollars)) return TDS_CONVERT_OVERFLOW; cr->si = (TDS_SMALLINT) dollars; return sizeof(TDS_SMALLINT); break; case SYBUINT2: dollars = mny.mny4 / 10000; if (!IS_USMALLINT(dollars)) return TDS_CONVERT_OVERFLOW; cr->usi = (TDS_USMALLINT) dollars; return sizeof(TDS_USMALLINT); break; case SYBINT4: cr->i = mny.mny4 / 10000; return sizeof(TDS_INT); break; case SYBUINT4: dollars = mny.mny4 / 10000; if (!IS_UINT(dollars)) return TDS_CONVERT_OVERFLOW; cr->ui = dollars; return sizeof(TDS_UINT); break; case SYBINT8: cr->bi = mny.mny4 / 10000; return sizeof(TDS_INT8); break; case SYBUINT8: dollars = mny.mny4 / 10000; if (!IS_UINT8(dollars)) return TDS_CONVERT_OVERFLOW; cr->ubi = dollars; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: cr->ti = mny.mny4 ? 1 : 0; return sizeof(TDS_TINYINT); break; case SYBFLT8: cr->f = ((TDS_FLOAT) mny.mny4) / 10000.0; return sizeof(TDS_FLOAT); break; case SYBREAL: cr->r = (TDS_REAL) (mny.mny4 / 10000.0); return sizeof(TDS_REAL); break; case SYBMONEY: cr->m.mny = (TDS_INT8) mny.mny4; return sizeof(TDS_MONEY); break; case SYBMONEY4: cr->m4 = mny; return sizeof(TDS_MONEY4); break; case SYBDECIMAL: case SYBNUMERIC: if (mny.mny4 < 0) return tds_convert_int_numeric(4, 1, (TDS_UINT) -mny.mny4, cr); return tds_convert_int_numeric(4, 0, (TDS_UINT) mny.mny4, cr); /* conversions not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: return TDS_CONVERT_NOAVAIL; break; } return TDS_CONVERT_FAIL; } static TDS_INT tds_convert_money(const TDSCONTEXT * tds_ctx, const TDS_MONEY * src, int desttype, CONV_RESULT * cr) { char *s; TDS_INT8 mymoney, dollars; char tmpstr[64]; tdsdump_log(TDS_DBG_FUNC, "tds_convert_money()\n"); mymoney = ((TDS_INT8) src->tdsoldmoney.mnyhigh << 32) | src->tdsoldmoney.mnylow; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: s = tds_money_to_string((const TDS_MONEY *) src, tmpstr, tds_ctx->money_use_2_digits); return string_to_result(desttype, s, cr); break; case SYBINT1: case SYBUINT1: if (mymoney <= -10000 || mymoney >= 256 * 10000) return TDS_CONVERT_OVERFLOW; /* TODO: round ?? */ cr->ti = (TDS_TINYINT) (((TDS_INT) mymoney) / 10000); return sizeof(TDS_TINYINT); break; case SYBINT2: if (mymoney <= -32769 * 10000 || mymoney >= 32768 * 10000) return TDS_CONVERT_OVERFLOW; cr->si = (TDS_SMALLINT) (((TDS_INT) mymoney) / 10000); return sizeof(TDS_SMALLINT); break; case SYBUINT2: if (mymoney <= -1 * 10000 || mymoney >= 65536 * 10000) return TDS_CONVERT_OVERFLOW; cr->usi = (TDS_USMALLINT) (((TDS_INT) mymoney) / 10000); return sizeof(TDS_USMALLINT); break; case SYBINT4: dollars = mymoney / 10000; if (!IS_INT(dollars)) return TDS_CONVERT_OVERFLOW; cr->i = (TDS_INT) dollars; return sizeof(TDS_INT); break; case SYBUINT4: dollars = mymoney / 10000; if (!IS_UINT(dollars)) return TDS_CONVERT_OVERFLOW; cr->ui = (TDS_UINT) dollars; return sizeof(TDS_UINT); break; case SYBINT8: cr->bi = mymoney / 10000; return sizeof(TDS_INT8); break; case SYBUINT8: dollars = mymoney / 10000; if (dollars < 0) return TDS_CONVERT_OVERFLOW; cr->ubi = (TDS_UINT8) dollars; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: cr->ti = mymoney ? 1 : 0; return sizeof(TDS_TINYINT); break; case SYBFLT8: cr->f = ((TDS_FLOAT) mymoney) / 10000.0; return sizeof(TDS_FLOAT); break; case SYBREAL: cr->r = (TDS_REAL) (mymoney / 10000.0); return sizeof(TDS_REAL); break; case SYBMONEY4: if (!IS_INT(mymoney)) return TDS_CONVERT_OVERFLOW; cr->m4.mny4 = (TDS_INT) mymoney; return sizeof(TDS_MONEY4); break; case SYBMONEY: cr->m.mny = mymoney; return sizeof(TDS_MONEY); break; case SYBDECIMAL: case SYBNUMERIC: if (mymoney < 0) return tds_convert_int8_numeric(4, 1, -mymoney, cr); return tds_convert_int8_numeric(4, 0, mymoney, cr); break; /* conversions not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_datetimeall(const TDSCONTEXT * tds_ctx, int srctype, const TDS_DATETIMEALL * dta, int desttype, CONV_RESULT * cr) { char whole_date_string[64]; TDSDATEREC when; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: tds_datecrack(srctype, dta, &when); tds_strftime(whole_date_string, sizeof(whole_date_string), tds_ctx->locale->date_fmt, &when, dta->time_prec); return string_to_result(desttype, whole_date_string, cr); case SYBDATETIME: if (!IS_INT(dta->date)) return TDS_CONVERT_OVERFLOW; cr->dt.dtdays = (TDS_INT) dta->date; cr->dt.dttime = (TDS_INT) ((dta->time * 3u + 50000u) / 100000u); return sizeof(TDS_DATETIME); case SYBDATETIME4: if (!IS_USMALLINT(dta->date)) return TDS_CONVERT_OVERFLOW; cr->dt4.days = (TDS_USMALLINT) dta->date; cr->dt4.minutes = (TDS_USMALLINT) ((dta->time + 30u * 10000000u) / (60u * 10000000u)); return sizeof(TDS_DATETIME4); case SYBMSDATETIMEOFFSET: case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: cr->dta = *dta; return sizeof(TDS_DATETIMEALL); case SYBDATE: if (!IS_INT(dta->date)) return TDS_CONVERT_OVERFLOW; cr->date = (TDS_INT) dta->date; return sizeof(TDS_DATE); case SYBTIME: cr->time = (TDS_INT) ((dta->time * 3u + 50000u) / 100000u); return sizeof(TDS_TIME); case SYB5BIGTIME: cr->bigtime = dta->time / 10u; return sizeof(TDS_UINT8); case SYB5BIGDATETIME: cr->bigtime = dta->time / 10u + (dta->date + BIGDATETIME_BIAS) * ((TDS_UINT8) 86400u * 1000000u); return sizeof(TDS_UINT8); /* conversions not allowed */ case SYBUNIQUE: case SYBBIT: case SYBBITN: case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBUINT4: case SYBINT8: case SYBUINT8: case SYBMONEY4: case SYBMONEY: case SYBNUMERIC: case SYBDECIMAL: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_datetime(const TDSCONTEXT * tds_ctx, const TDS_DATETIME * dt, int desttype, unsigned precision, CONV_RESULT * cr) { char whole_date_string[64]; TDSDATEREC when; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: tds_datecrack(SYBDATETIME, dt, &when); tds_strftime(whole_date_string, sizeof(whole_date_string), tds_ctx->locale->date_fmt, &when, 3); return string_to_result(desttype, whole_date_string, cr); case SYBDATETIME: cr->dt = *dt; return sizeof(TDS_DATETIME); case SYBDATETIME4: if (!IS_USMALLINT(dt->dtdays)) return TDS_CONVERT_OVERFLOW; cr->dt4.days = dt->dtdays; cr->dt4.minutes = (dt->dttime / 300) / 60; return sizeof(TDS_DATETIME4); case SYBDATE: cr->date = dt->dtdays; return sizeof(TDS_DATE); case SYBTIME: cr->time = dt->dttime; return sizeof(TDS_TIME); case SYBMSDATETIMEOFFSET: case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: memset(&cr->dta, 0, sizeof(cr->dta)); cr->dta.time_prec = precision; if (desttype == SYBMSDATETIMEOFFSET) cr->dta.has_offset = 1; if (desttype != SYBMSDATE) { cr->dta.has_time = 1; cr->dta.time_prec = 3; cr->dta.time = (((TDS_UINT8) dt->dttime) * 20 + 3) / 6 * 10000u; } if (desttype != SYBMSTIME) { cr->dta.has_date = 1; cr->dta.date = dt->dtdays; } return sizeof(TDS_DATETIMEALL); case SYB5BIGTIME: cr->bigtime = (((TDS_UINT8) dt->dttime) * 20u + 3u) / 6u * 1000u; return sizeof(TDS_BIGTIME); case SYB5BIGDATETIME: cr->bigdatetime = (((TDS_UINT8) dt->dttime) * 20u + 3u) / 6u * 1000u + (dt->dtdays + BIGDATETIME_BIAS) * ((TDS_UINT8) 86400u * 1000000u); return sizeof(TDS_BIGDATETIME); /* conversions not allowed */ case SYBUNIQUE: case SYBBIT: case SYBBITN: case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBUINT4: case SYBINT8: case SYBUINT8: case SYBMONEY4: case SYBMONEY: case SYBNUMERIC: case SYBDECIMAL: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_datetime4(const TDSCONTEXT * tds_ctx, const TDS_DATETIME4 * dt4, int desttype, CONV_RESULT * cr) { TDS_DATETIME dt; if (desttype == SYBDATETIME4) { cr->dt4 = *dt4; return sizeof(TDS_DATETIME4); } /* convert to DATETIME and use tds_convert_datetime */ dt.dtdays = dt4->days; dt.dttime = dt4->minutes * (60u * 300u); return tds_convert_datetime(tds_ctx, &dt, desttype, 0, cr); } static TDS_INT tds_convert_time(const TDSCONTEXT * tds_ctx, const TDS_TIME * time, int desttype, CONV_RESULT * cr) { TDS_DATETIME dt; if (desttype == SYBTIME) { cr->time = *time; return sizeof(TDS_TIME); } /* convert to DATETIME and use tds_convert_datetime */ dt.dtdays = 0; dt.dttime = *time; return tds_convert_datetime(tds_ctx, &dt, desttype, 0, cr); } static TDS_INT tds_convert_date(const TDSCONTEXT * tds_ctx, const TDS_DATE * date, int desttype, CONV_RESULT * cr) { TDS_DATETIME dt; if (desttype == SYBDATE) { cr->date = *date; return sizeof(TDS_DATE); } /* convert to DATETIME and use tds_convert_datetime */ dt.dtdays = *date; dt.dttime = 0; return tds_convert_datetime(tds_ctx, &dt, desttype, 0, cr); } static TDS_INT tds_convert_bigtime(const TDSCONTEXT * tds_ctx, const TDS_BIGTIME * bigtime, int desttype, CONV_RESULT * cr) { TDS_DATETIMEALL dta; if (desttype == SYB5BIGTIME) { cr->bigtime = *bigtime; return sizeof(TDS_BIGTIME); } /* convert to DATETIMEALL and use tds_convert_datetimeall */ memset(&dta, 0, sizeof(dta)); dta.time_prec = 6; dta.has_time = 1; dta.time = *bigtime % ((TDS_UINT8) 86400u * 1000000u) * 10u; return tds_convert_datetimeall(tds_ctx, SYBMSTIME, &dta, desttype, cr); } static TDS_INT tds_convert_bigdatetime(const TDSCONTEXT * tds_ctx, const TDS_BIGDATETIME * bigdatetime, int desttype, CONV_RESULT * cr) { TDS_DATETIMEALL dta; TDS_UINT8 bdt; if (desttype == SYB5BIGDATETIME) { cr->bigdatetime = *bigdatetime; return sizeof(TDS_BIGDATETIME); } /* convert to DATETIMEALL and use tds_convert_datetimeall */ bdt = *bigdatetime; memset(&dta, 0, sizeof(dta)); dta.time_prec = 6; dta.has_time = 1; dta.time = bdt % ((TDS_UINT8) 86400u * 1000000u) * 10u; bdt /= (TDS_UINT8) 86400u * 1000000u; dta.has_date = 1; dta.date = bdt - BIGDATETIME_BIAS; return tds_convert_datetimeall(tds_ctx, SYBMSDATETIME2, &dta, desttype, cr); } static TDS_INT tds_convert_real(const TDS_REAL* src, int desttype, CONV_RESULT * cr) { TDS_REAL the_value; /* FIXME how many big should be this buffer ?? */ char tmp_str[128]; TDS_INT mymoney4; TDS_INT8 mymoney; the_value = *src; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: sprintf(tmp_str, "%.9g", the_value); return string_to_result(desttype, tmp_str, cr); break; case SYBINT1: case SYBUINT1: if (!IS_TINYINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->ti = (TDS_TINYINT) the_value; return sizeof(TDS_TINYINT); break; case SYBINT2: if (!IS_SMALLINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->si = (TDS_SMALLINT) the_value; return sizeof(TDS_SMALLINT); break; case SYBUINT2: if (!IS_USMALLINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->usi = (TDS_USMALLINT) the_value; return sizeof(TDS_USMALLINT); break; case SYBINT4: if (!IS_INT(the_value)) return TDS_CONVERT_OVERFLOW; cr->i = (TDS_INT) the_value; return sizeof(TDS_INT); break; case SYBUINT4: if (!IS_UINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->ui = (TDS_UINT) the_value; return sizeof(TDS_UINT); break; case SYBINT8: if (the_value > (TDS_REAL) TDS_INT8_MAX || the_value < (TDS_REAL) TDS_INT8_MIN) return TDS_CONVERT_OVERFLOW; cr->bi = (TDS_INT8) the_value; return sizeof(TDS_INT8); break; case SYBUINT8: if (the_value > (TDS_REAL) TDS_UINT8_MAX || the_value < 0) return TDS_CONVERT_OVERFLOW; cr->ubi = (TDS_UINT8) the_value; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: cr->ti = the_value ? 1 : 0; return sizeof(TDS_TINYINT); break; case SYBFLT8: cr->f = the_value; return sizeof(TDS_FLOAT); break; case SYBREAL: cr->r = the_value; return sizeof(TDS_REAL); break; case SYBMONEY: if (the_value > (TDS_REAL) (TDS_INT8_MAX / 10000) || the_value < (TDS_REAL) (TDS_INT8_MIN / 10000)) return TDS_CONVERT_OVERFLOW; mymoney = (TDS_INT8) (the_value * 10000); cr->m.mny = mymoney; return sizeof(TDS_MONEY); break; case SYBMONEY4: if (the_value > (TDS_REAL) (TDS_INT_MAX / 10000) || the_value < (TDS_REAL) (TDS_INT_MIN / 10000)) return TDS_CONVERT_OVERFLOW; mymoney4 = (TDS_INT) (the_value * 10000); cr->m4.mny4 = mymoney4; return sizeof(TDS_MONEY4); break; case SYBNUMERIC: case SYBDECIMAL: sprintf(tmp_str, "%.*f", cr->n.scale, the_value); return stringz_to_numeric(tmp_str, cr); break; /* not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; } /* * TODO: emit SYBECLPR errors: "Data conversion resulted in loss of precision". * There are many places where this would be correct to do, but the test is tedious * (convert e.g. 1.5 -> SYBINT and test if output == input) and we don't have a good, * API-independent alternative to tds_client_msg(). Postponed until then. */ static TDS_INT tds_convert_flt8(const TDS_FLOAT* src, int desttype, CONV_RESULT * cr) { TDS_FLOAT the_value; char tmp_str[25]; memcpy(&the_value, src, 8); switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: sprintf(tmp_str, "%.17g", the_value); return string_to_result(desttype, tmp_str, cr); break; case SYBINT1: case SYBUINT1: if (!IS_TINYINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->ti = (TDS_TINYINT) the_value; return sizeof(TDS_TINYINT); break; case SYBINT2: if (!IS_SMALLINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->si = (TDS_SMALLINT) the_value; return sizeof(TDS_SMALLINT); break; case SYBUINT2: if (!IS_USMALLINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->usi = (TDS_USMALLINT) the_value; return sizeof(TDS_USMALLINT); break; case SYBINT4: if (!IS_INT(the_value)) return TDS_CONVERT_OVERFLOW; cr->i = (TDS_INT) the_value; return sizeof(TDS_INT); break; case SYBUINT4: if (!IS_UINT(the_value)) return TDS_CONVERT_OVERFLOW; cr->ui = (TDS_UINT) the_value; return sizeof(TDS_UINT); break; case SYBINT8: if (the_value > (TDS_FLOAT) TDS_INT8_MAX || the_value < (TDS_FLOAT) TDS_INT8_MIN) return TDS_CONVERT_OVERFLOW; cr->bi = (TDS_INT8) the_value; return sizeof(TDS_INT8); break; case SYBUINT8: if (the_value > (TDS_FLOAT) TDS_UINT8_MAX || the_value < 0) return TDS_CONVERT_OVERFLOW; cr->ubi = (TDS_UINT8) the_value; return sizeof(TDS_UINT8); break; case SYBBIT: case SYBBITN: cr->ti = the_value ? 1 : 0; return sizeof(TDS_TINYINT); break; case SYBMONEY: if (the_value > (TDS_FLOAT) (TDS_INT8_MAX / 10000) || the_value < (TDS_FLOAT) (TDS_INT8_MIN / 10000)) return TDS_CONVERT_OVERFLOW; cr->m.mny = (TDS_INT8) (the_value * 10000); return sizeof(TDS_MONEY); break; case SYBMONEY4: if (the_value > (TDS_FLOAT) (TDS_INT_MAX / 10000) || the_value < (TDS_FLOAT) (TDS_INT_MIN / 10000)) return TDS_CONVERT_OVERFLOW; cr->m4.mny4 = (TDS_INT) (the_value * 10000); return sizeof(TDS_MONEY4); break; case SYBREAL: /* TODO check overflow */ cr->r = (TDS_REAL)the_value; return sizeof(TDS_REAL); break; case SYBFLT8: cr->f = the_value; return sizeof(TDS_FLOAT); break; case SYBNUMERIC: case SYBDECIMAL: sprintf(tmp_str, "%.*f", cr->n.scale, the_value); return stringz_to_numeric(tmp_str, cr); break; /* not allowed */ case SYBUNIQUE: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_unique(const TDS_CHAR * src, int desttype, CONV_RESULT * cr) { /* * raw data is equivalent to structure and always aligned, * so this cast is portable */ const TDS_UNIQUE *u = (const TDS_UNIQUE *) src; char buf[37]; switch (desttype) { case TDS_CONVERT_CHAR: case CASE_ALL_CHAR: sprintf(buf, "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", (int) u->Data1, (int) u->Data2, (int) u->Data3, u->Data4[0], u->Data4[1], u->Data4[2], u->Data4[3], u->Data4[4], u->Data4[5], u->Data4[6], u->Data4[7]); return string_to_result(desttype, buf, cr); break; case SYBUNIQUE: /* * Here we can copy raw to structure because we adjust * byte order in tds_swap_datatype */ memcpy(&(cr->u), src, sizeof(TDS_UNIQUE)); return sizeof(TDS_UNIQUE); break; /* do not warn for not convertible types */ case SYBBIT: case SYBBITN: case SYBINT1: case SYBUINT1: case SYBINT2: case SYBUINT2: case SYBINT4: case SYBUINT4: case SYBINT8: case SYBUINT8: case SYBMONEY4: case SYBMONEY: case SYBDATETIME4: case SYBDATETIME: case SYBDATETIMN: case SYBREAL: case SYBFLT8: default: break; } return TDS_CONVERT_NOAVAIL; } static TDS_INT tds_convert_to_binary(int srctype, const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr) { size_t len; TDS_CHAR *ib; switch (srctype) { case CASE_ALL_BINARY: len = srclen; break; case SYBBIT: case SYBBITN: case SYBINT1: case SYBUINT1: len = 1; break; case SYBINT2: case SYBUINT2: len = 2; break; case SYBINT4: case SYBUINT4: len = 4; break; case SYBINT8: case SYBUINT8: len = sizeof(TDS_INT8); break; case SYBMONEY4: len = sizeof(TDS_MONEY4); break; case SYBMONEY: len = sizeof(TDS_MONEY); break; case SYBNUMERIC: case SYBDECIMAL: len = sizeof(TDS_NUMERIC); break; case SYBREAL: len = sizeof(TDS_REAL); break; case SYBFLT8: len = sizeof(TDS_FLOAT); break; case SYBDATETIME: len = sizeof(TDS_DATETIME); break; case SYBDATETIME4: len = sizeof(TDS_DATETIME4); break; case SYBTIME: len = sizeof(TDS_TIME); break; case SYBDATE: len = sizeof(TDS_DATE); break; case SYBMSTIME: case SYBMSDATE: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: len = sizeof(TDS_DATETIMEALL); break; case SYB5BIGTIME: len = sizeof(TDS_BIGTIME); break; case SYB5BIGDATETIME: len = sizeof(TDS_BIGDATETIME); break; case SYBUNIQUE: len = sizeof(TDS_UNIQUE); break; case CASE_ALL_CHAR: /* skip leading "0x" or "0X" */ if (srclen >= 2 && src[0] == '0' && (src[1] == 'x' || src[1] == 'X')) { src += 2; srclen -= 2; } /* ignore trailing blanks and nulls */ /* FIXME is good to ignore null ?? */ while (srclen > 0 && (src[srclen - 1] == ' ' || src[srclen - 1] == '\0')) --srclen; /* a binary string output will be half the length of */ /* the string which represents it in hexadecimal */ ib = cr->cb.ib; if (desttype != TDS_CONVERT_BINARY) { cr->ib = tds_new(TDS_CHAR, (srclen + 2u) / 2u); test_alloc(cr->ib); ib = cr->ib; } return tds_char2hex(ib, desttype == TDS_CONVERT_BINARY ? cr->cb.len : 0xffffffffu, src, srclen); default: return TDS_CONVERT_NOAVAIL; } return binary_to_result(desttype, src, len, cr); } /** * tds_convert * convert a type to another. * If you convert to SYBDECIMAL/SYBNUMERIC you MUST initialize precision * and scale of cr. * Do not expect strings to be zero terminated. Databases support zero inside * string. Using strlen may result on data loss or even a segmentation fault. * Instead, use memcpy to copy destination using length returned. * This function does not handle NULL, srclen should be >0. Client libraries handle NULLs each in their own way. * @param tds_ctx context (used in conversion to data and to return messages) * @param srctype type of source * @param src pointer to source data to convert * @param srclen length in bytes of source (not counting terminator or strings) * @param desttype type of destination * @param cr structure to hold result * @return length of result or TDS_CONVERT_* failure code on failure. All TDS_CONVERT_* constants are <0. */ TDS_INT tds_convert(const TDSCONTEXT *tds_ctx, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr) { TDS_INT length = 0; assert(srclen >= 0 && srclen <= 2147483647u); if (srctype == SYBVARIANT) { TDSVARIANT *v = (TDSVARIANT*) src; srctype = v->type; src = v->data; srclen = v->data_len; } switch (desttype) { case CASE_ALL_BINARY: return tds_convert_to_binary(srctype, src, srclen, desttype, cr); } switch (srctype) { case CASE_ALL_CHAR: length = tds_convert_char(src, srclen, desttype, cr); break; case SYBMONEY4: length = tds_convert_money4(tds_ctx, (const TDS_MONEY4 *) src, desttype, cr); break; case SYBMONEY: length = tds_convert_money(tds_ctx, (const TDS_MONEY *) src, desttype, cr); break; case SYBNUMERIC: case SYBDECIMAL: length = tds_convert_numeric((const TDS_NUMERIC *) src, desttype, cr); break; case SYBBIT: case SYBBITN: length = tds_convert_bit(src, desttype, cr); break; case SYBINT1: case SYBUINT1: length = tds_convert_int1((const TDS_TINYINT *) src, desttype, cr); break; case SYBINT2: length = tds_convert_int2((const TDS_SMALLINT *) src, desttype, cr); break; case SYBUINT2: length = tds_convert_uint2((const TDS_USMALLINT *) src, desttype, cr); break; case SYBINT4: length = tds_convert_int4((const TDS_INT *) src, desttype, cr); break; case SYBUINT4: length = tds_convert_uint4((const TDS_UINT *) src, desttype, cr); break; case SYBINT8: length = tds_convert_int8((const TDS_INT8 *) src, desttype, cr); break; case SYBUINT8: length = tds_convert_uint8((const TDS_UINT8 *) src, desttype, cr); break; case SYBREAL: length = tds_convert_real((const TDS_REAL *) src, desttype, cr); break; case SYBFLT8: length = tds_convert_flt8((const TDS_FLOAT *) src, desttype, cr); break; case SYBMSTIME: case SYBMSDATE: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: length = tds_convert_datetimeall(tds_ctx, srctype, (const TDS_DATETIMEALL *) src, desttype, cr); break; case SYBDATETIME: length = tds_convert_datetime(tds_ctx, (const TDS_DATETIME* ) src, desttype, 3, cr); break; case SYBDATETIME4: length = tds_convert_datetime4(tds_ctx, (const TDS_DATETIME4* ) src, desttype, cr); break; case SYBTIME: length = tds_convert_time(tds_ctx, (const TDS_TIME *) src, desttype, cr); break; case SYBDATE: length = tds_convert_date(tds_ctx, (const TDS_DATE *) src, desttype, cr); break; case SYB5BIGTIME: length = tds_convert_bigtime(tds_ctx, (const TDS_BIGTIME *) src, desttype, cr); break; case SYB5BIGDATETIME: length = tds_convert_bigdatetime(tds_ctx, (const TDS_BIGDATETIME *) src, desttype, cr); break; case CASE_ALL_BINARY: length = tds_convert_binary((const TDS_UCHAR *) src, srclen, desttype, cr); break; case SYBUNIQUE: length = tds_convert_unique(src, desttype, cr); break; case SYBNVARCHAR: case SYBNTEXT: default: return TDS_CONVERT_NOAVAIL; break; } /* fix MONEY case */ #if !defined(WORDS_BIGENDIAN) if (length > 0 && desttype == SYBMONEY) { cr->m.mny = ((TDS_UINT8) cr->m.mny) >> 32 | (cr->m.mny << 32); } #endif return length; } static int string_to_datetime(const char *instr, TDS_UINT len, int desttype, CONV_RESULT * cr) { enum states { GOING_IN_BLIND, PUT_NUMERIC_IN_CONTEXT, DOING_ALPHABETIC_DATE }; char *in; char *tok; char *lasts; char last_token[32]; int monthdone = 0; int yeardone = 0; int mdaydone = 0; struct tds_time t; unsigned int dt_time; TDS_INT dt_days; int i; enum states current_state; memset(&t, '\0', sizeof(t)); t.tm_mday = 1; in = tds_strndup(instr, len); test_alloc(in); tok = strtok_r(in, " ,", &lasts); current_state = GOING_IN_BLIND; while (tok != NULL) { tdsdump_log(TDS_DBG_INFO1, "string_to_datetime: current_state = %d\n", current_state); switch (current_state) { case GOING_IN_BLIND: /* If we have no idea of current context, then if we have */ /* encountered a purely alphabetic string, it MUST be an */ /* alphabetic month name or prefix... */ if (is_alphabetic(tok)) { tdsdump_log(TDS_DBG_INFO1, "string_to_datetime: is_alphabetic\n"); if (store_monthname(tok, &t) >= 0) { monthdone++; current_state = DOING_ALPHABETIC_DATE; } else { goto string_garbled; } } /* ...whereas if it is numeric, it could be a number of */ /* things... */ else if (is_numeric(tok)) { tdsdump_log(TDS_DBG_INFO1, "string_to_datetime: is_numeric\n"); switch (strlen(tok)) { /* in this context a 4 character numeric can */ /* ONLY be the year part of an alphabetic date */ case 4: store_year(atoi(tok), &t); yeardone++; current_state = DOING_ALPHABETIC_DATE; break; /* whereas these could be the hour part of a */ /* time specification ( 4 PM ) or the leading */ /* day part of an alphabetic date ( 15 Jan ) */ case 2: case 1: strcpy(last_token, tok); current_state = PUT_NUMERIC_IN_CONTEXT; break; /* this must be a [YY]YYMMDD date */ case 6: case 8: if (store_yymmdd_date(tok, &t)) current_state = GOING_IN_BLIND; else goto string_garbled; break; /* anything else is nonsense... */ default: goto string_garbled; break; } } /* it could be [M]M/[D]D/[YY]YY format */ else if (is_numeric_dateformat(tok)) { tdsdump_log(TDS_DBG_INFO1, "string_to_datetime: is_numeric_dateformat\n"); store_numeric_date(tok, &t); current_state = GOING_IN_BLIND; } else if (is_dd_mon_yyyy(tok)) { tdsdump_log(TDS_DBG_INFO1, "string_to_datetime: is_dd_mon_yyyy\n"); store_dd_mon_yyy_date(tok, &t); current_state = GOING_IN_BLIND; } else if (is_timeformat(tok)) { tdsdump_log(TDS_DBG_INFO1, "string_to_datetime: is_timeformat\n"); store_time(tok, &t); current_state = GOING_IN_BLIND; } else { tdsdump_log(TDS_DBG_INFO1, "string_to_datetime: string_garbled\n"); goto string_garbled; } break; /* end of GOING_IN_BLIND */ case DOING_ALPHABETIC_DATE: if (is_alphabetic(tok)) { if (!monthdone && store_monthname(tok, &t) >= 0) { monthdone++; if (monthdone && yeardone && mdaydone) current_state = GOING_IN_BLIND; else current_state = DOING_ALPHABETIC_DATE; } else { goto string_garbled; } } else if (is_numeric(tok)) { if (mdaydone && yeardone) goto string_garbled; else switch (strlen(tok)) { case 4: store_year(atoi(tok), &t); yeardone++; if (monthdone && yeardone && mdaydone) current_state = GOING_IN_BLIND; else current_state = DOING_ALPHABETIC_DATE; break; case 2: case 1: if (!mdaydone) { store_mday(tok, &t); mdaydone++; if (monthdone && yeardone && mdaydone) current_state = GOING_IN_BLIND; else current_state = DOING_ALPHABETIC_DATE; } else { store_year(atoi(tok), &t); yeardone++; if (monthdone && yeardone && mdaydone) current_state = GOING_IN_BLIND; else current_state = DOING_ALPHABETIC_DATE; } break; default: goto string_garbled; } } else { goto string_garbled; } break; /* end of DOING_ALPHABETIC_DATE */ case PUT_NUMERIC_IN_CONTEXT: if (is_alphabetic(tok)) { if (store_monthname(tok, &t) >= 0) { store_mday(last_token, &t); mdaydone++; monthdone++; if (monthdone && yeardone && mdaydone) current_state = GOING_IN_BLIND; else current_state = DOING_ALPHABETIC_DATE; } else if (is_ampm(tok)) { store_hour(last_token, tok, &t); current_state = GOING_IN_BLIND; } else { goto string_garbled; } } else if (is_numeric(tok)) { switch (strlen(tok)) { case 4: case 2: store_mday(last_token, &t); mdaydone++; store_year(atoi(tok), &t); yeardone++; if (monthdone && yeardone && mdaydone) current_state = GOING_IN_BLIND; else current_state = DOING_ALPHABETIC_DATE; break; default: goto string_garbled; } } else { goto string_garbled; } break; /* end of PUT_NUMERIC_IN_CONTEXT */ } tok = strtok_r(NULL, " ,", &lasts); } i = (t.tm_mon - 13) / 12; dt_days = 1461 * (t.tm_year + 1900 + i) / 4 + (367 * (t.tm_mon - 1 - 12 * i)) / 12 - (3 * ((t.tm_year + 2000 + i) / 100)) / 4 + t.tm_mday - 693932; free(in); if (desttype == SYBDATE) { cr->date = dt_days; return sizeof(TDS_DATE); } dt_time = t.tm_hour * 60 + t.tm_min; /* TODO check for overflow */ if (desttype == SYBDATETIME4) { cr->dt4.days = dt_days; cr->dt4.minutes = dt_time; return sizeof(TDS_DATETIME4); } dt_time = dt_time * 60 + t.tm_sec; if (desttype == SYBDATETIME) { cr->dt.dtdays = dt_days; cr->dt.dttime = dt_time * 300 + (t.tm_ns / 1000000u * 300 + 150) / 1000; return sizeof(TDS_DATETIME); } if (desttype == SYBTIME) { cr->time = dt_time * 300 + (t.tm_ns / 1000000u * 300 + 150) / 1000; return sizeof(TDS_TIME); } if (desttype == SYB5BIGTIME) { cr->bigtime = dt_time * (TDS_UINT8) 1000000u + t.tm_ns / 1000u; return sizeof(TDS_BIGTIME); } if (desttype == SYB5BIGDATETIME) { cr->bigdatetime = (dt_days + BIGDATETIME_BIAS) * ((TDS_UINT8) 86400u * 1000000u) + dt_time * (TDS_UINT8) 1000000u + t.tm_ns / 1000u; return sizeof(TDS_BIGDATETIME); } cr->dta.has_offset = 0; cr->dta.offset = 0; cr->dta.has_date = 1; cr->dta.date = dt_days; cr->dta.has_time = 1; cr->dta.time_prec = 7; /* TODO correct value */ cr->dta.time = ((TDS_UINT8) dt_time) * 10000000u + t.tm_ns / 100u; return sizeof(TDS_DATETIMEALL); string_garbled: tdsdump_log(TDS_DBG_INFO1, "error_handler: Attempt to convert data stopped by syntax error in source field \n"); free(in); return TDS_CONVERT_SYNTAX; } static int stringz_to_numeric(const char *instr, CONV_RESULT * cr) { return string_to_numeric(instr, instr + strlen(instr), cr); } static int string_to_numeric(const char *instr, const char *pend, CONV_RESULT * cr) { char mynumber[(MAXPRECISION + 7) / 8 * 8 + 8]; /* num packaged 8 digit, see below for detail */ TDS_UINT packed_num[(MAXPRECISION + 7) / 8]; char *ptr; int i = 0; int j = 0; int bytes; bool negative; size_t digits, decimals; /* FIXME: application can pass invalid value for precision and scale ?? */ if (cr->n.precision > MAXPRECISION) return TDS_CONVERT_FAIL; if (cr->n.precision == 0) cr->n.precision = MAXPRECISION; /* assume max precision */ if (cr->n.scale > cr->n.precision) return TDS_CONVERT_FAIL; instr = parse_numeric(instr, pend, &negative, &digits, &decimals); if (!instr) return TDS_CONVERT_SYNTAX; cr->n.array[0] = negative ? 1 : 0; /* translate a number like 000ddddd.ffff to 00000000dddddffff00 */ /* * Having disposed of any sign and leading blanks, * vet the digit string, counting places before and after * the decimal point. Dispense with trailing blanks, if any. */ ptr = mynumber; for (i = 0; i < 8; ++i) *ptr++ = '0'; /* too many digits, error */ if (cr->n.precision - cr->n.scale < digits) return TDS_CONVERT_OVERFLOW; /* copy digits before the dot */ memcpy(ptr, instr, digits); ptr += digits; instr += digits + 1; /* copy digits after the dot */ if (decimals > cr->n.scale) decimals = cr->n.scale; memcpy(ptr, instr, decimals); /* fill up decimal digits */ memset(ptr + decimals, '0', cr->n.scale - decimals); ptr += cr->n.scale; /* * Packaged number explanation: * We package 8 decimal digits in one number. * Because 10^8 = 5^8 * 2^8 = 5^8 * 256, dividing 10^8 by 256 leaves no remainder. * We can thus split it into bytes in an optimized way. */ /* transform to packaged one */ j = -1; ptr -= 8; do { TDS_UINT n = *ptr++; for (i = 1; i < 8; ++i) n = n * 10u + *ptr++; /* fix packet number and store */ packed_num[++j] = n - ((TDS_UINT) '0' * 11111111lu); ptr -= 16; } while (ptr > mynumber); memset(cr->n.array + 1, 0, sizeof(cr->n.array) - 1); bytes = tds_numeric_bytes_per_prec[cr->n.precision]; while (j > 0 && !packed_num[j]) --j; for (;;) { bool is_zero = true; TDS_UINT carry = 0; i = j; if (!packed_num[j]) --j; do { TDS_UINT tmp = packed_num[i]; if (tmp) is_zero = false; /* divide for 256 for find another byte */ /* * carry * (25u*25u*25u*25u) = carry * 10^8 / 256u * using unsigned number is just an optimization * compiler can translate division to a shift and remainder * to a binary AND */ packed_num[i] = carry * (25u * 25u * 25u * 25u) + tmp / 256u; carry = tmp % 256u; } while(--i >= 0); if (is_zero) break; /* * source number is limited to 38 decimal digit * 10^39-1 < 2^128 (16 byte) so this cannot make an overflow */ cr->n.array[--bytes] = carry; } return sizeof(TDS_NUMERIC); } static bool is_numeric_dateformat(const char *t) { const char *instr; int slashes = 0; int hyphens = 0; int periods = 0; int digits = 0; for (instr = t; *instr; instr++) { if (!isdigit((unsigned char) *instr) && *instr != '/' && *instr != '-' && *instr != '.') return false; if (*instr == '/') slashes++; else if (*instr == '-') hyphens++; else if (*instr == '.') periods++; else digits++; } if (hyphens + slashes + periods != 2) return false; if (hyphens == 1 || slashes == 1 || periods == 1) return false; if (digits < 4 || digits > 8) return false; return true; } /* This function will check if an alphanumeric string */ /* holds a date in any of the following formats : */ /* DD-MON-YYYY */ /* DD-MON-YY */ /* DDMONYY */ /* DDMONYYYY */ static bool is_dd_mon_yyyy(char *t) { char *instr; char month[4]; instr = t; if (!isdigit((unsigned char) *instr)) return false; instr++; if (!isdigit((unsigned char) *instr)) return false; instr++; if (*instr == '-') { instr++; strlcpy(month, instr, 4); if (!is_monthname(month)) return false; instr += 3; if (*instr != '-') return false; instr++; if (!isdigit((unsigned char) *instr)) return false; instr++; if (!isdigit((unsigned char) *instr)) return false; instr++; if (*instr) { if (!isdigit((unsigned char) *instr)) return false; instr++; if (!isdigit((unsigned char) *instr)) return false; } } else { strlcpy(month, instr, 4); if (!is_monthname(month)) return false; instr += 3; if (!isdigit((unsigned char) *instr)) return false; instr++; if (!isdigit((unsigned char) *instr)) return false; instr++; if (*instr) { if (!isdigit((unsigned char) *instr)) return false; instr++; if (!isdigit((unsigned char) *instr)) return false; } } return true; } static bool is_ampm(const char *datestr) { if (strcasecmp(datestr, "am") == 0) return true; if (strcasecmp(datestr, "pm") == 0) return true; return false; } static bool is_alphabetic(const char *datestr) { const char *s; for (s = datestr; *s; s++) { if (!isalpha((unsigned char) *s)) return false; } return true; } static bool is_numeric(const char *datestr) { const char *s; for (s = datestr; *s; s++) { if (!isdigit((unsigned char) *s)) return false; } return true; } static bool is_timeformat(const char *datestr) { const char *s; for (s = datestr; *s; s++) { if (!isdigit((unsigned char) *s) && *s != ':' && *s != '.') break; } if (*s) return is_ampm(s); return true; } static int store_year(int year, struct tds_time *t) { if (year < 0) return 0; if (year < 100) { if (year > 49) t->tm_year = year; else t->tm_year = 100 + year; return (1); } if (year < 1753) return (0); if (year <= 9999) { t->tm_year = year - 1900; return (1); } return (0); } static int store_mday(const char *datestr, struct tds_time *t) { int mday = atoi(datestr); if (mday > 0 && mday < 32) { t->tm_mday = mday; return 1; } return 0; } static int store_numeric_date(const char *datestr, struct tds_time *t) { int TDS_MONTH = 0; int TDS_DAY = 0; int TDS_YEAR = 0; int state; char last_char = 0; const char *s; int month = 0, year = 0, mday = 0; /* Its YYYY-MM-DD format */ if (strlen(datestr) == 10 && *(datestr + 4) == '-' && *(datestr + 7) == '-') { TDS_YEAR = 0; TDS_MONTH = 1; TDS_DAY = 2; state = TDS_YEAR; } /* else we assume MDY */ else { TDS_MONTH = 0; TDS_DAY = 1; TDS_YEAR = 2; state = TDS_MONTH; } for (s = datestr; *s; s++) { if (!isdigit((unsigned char) *s) && isdigit((unsigned char) last_char)) { state++; } else { if (state == TDS_MONTH) month = (month * 10) + (*s - '0'); if (state == TDS_DAY) mday = (mday * 10) + (*s - '0'); if (state == TDS_YEAR) year = (year * 10) + (*s - '0'); } last_char = *s; } if (month > 0 && month < 13) t->tm_mon = month - 1; else return 0; if (mday > 0 && mday < 32) t->tm_mday = mday; else return 0; return store_year(year, t); } static int store_dd_mon_yyy_date(char *datestr, struct tds_time *t) { char dd[3]; int mday; char mon[4]; int year; tdsdump_log(TDS_DBG_INFO1, "store_dd_mon_yyy_date: %s\n", datestr); strlcpy(dd, datestr, 3); mday = atoi(dd); if (mday > 0 && mday < 32) t->tm_mday = mday; else return 0; if (datestr[2] == '-') { strlcpy(mon, &datestr[3], 4); if (store_monthname(mon, t) < 0) { tdsdump_log(TDS_DBG_INFO1, "store_dd_mon_yyy_date: store_monthname failed\n"); return 0; } year = atoi(&datestr[7]); tdsdump_log(TDS_DBG_INFO1, "store_dd_mon_yyy_date: year %d\n", year); return store_year(year, t); } else { strlcpy(mon, &datestr[2], 4); if (store_monthname(mon, t) < 0) { tdsdump_log(TDS_DBG_INFO1, "store_dd_mon_yyy_date: store_monthname failed\n"); return 0; } year = atoi(&datestr[5]); tdsdump_log(TDS_DBG_INFO1, "store_dd_mon_yyy_date: year %d\n", year); return store_year(year, t); } } /** * Test if a string is a month name and store correct month number * @return month number (0-11) or -1 if not match * @param datestr string to check * @param t where to store month (if NULL no store is done) */ static int store_monthname(const char *datestr, struct tds_time *t) { int ret; tdsdump_log(TDS_DBG_INFO1, "store_monthname: %ld %s\n", (long) strlen(datestr), datestr); if (strlen(datestr) == 3) { if (strcasecmp(datestr, "jan") == 0) ret = 0; else if (strcasecmp(datestr, "feb") == 0) ret = 1; else if (strcasecmp(datestr, "mar") == 0) ret = 2; else if (strcasecmp(datestr, "apr") == 0) ret = 3; else if (strcasecmp(datestr, "may") == 0) ret = 4; else if (strcasecmp(datestr, "jun") == 0) ret = 5; else if (strcasecmp(datestr, "jul") == 0) ret = 6; else if (strcasecmp(datestr, "aug") == 0) ret = 7; else if (strcasecmp(datestr, "sep") == 0) ret = 8; else if (strcasecmp(datestr, "oct") == 0) ret = 9; else if (strcasecmp(datestr, "nov") == 0) ret = 10; else if (strcasecmp(datestr, "dec") == 0) ret = 11; else return -1; } else { if (strcasecmp(datestr, "january") == 0) ret = 0; else if (strcasecmp(datestr, "february") == 0) ret = 1; else if (strcasecmp(datestr, "march") == 0) ret = 2; else if (strcasecmp(datestr, "april") == 0) ret = 3; else if (strcasecmp(datestr, "june") == 0) ret = 5; else if (strcasecmp(datestr, "july") == 0) ret = 6; else if (strcasecmp(datestr, "august") == 0) ret = 7; else if (strcasecmp(datestr, "september") == 0) ret = 8; else if (strcasecmp(datestr, "october") == 0) ret = 9; else if (strcasecmp(datestr, "november") == 0) ret = 10; else if (strcasecmp(datestr, "december") == 0) ret = 11; else return -1; } if (t) t->tm_mon = ret; return ret; } static int store_yymmdd_date(const char *datestr, struct tds_time *t) { int month = 0, year = 0, mday = 0; int wholedate; wholedate = atoi(datestr); year = wholedate / 10000; month = (wholedate - (year * 10000)) / 100; mday = (wholedate - (year * 10000) - (month * 100)); if (month > 0 && month < 13) t->tm_mon = month - 1; else return 0; if (mday > 0 && mday < 32) t->tm_mday = mday; else return 0; return (store_year(year, t)); } static int store_time(const char *datestr, struct tds_time *t) { enum { TDS_HOURS, TDS_MINUTES, TDS_SECONDS, TDS_FRACTIONS }; int state = TDS_HOURS; char last_sep = '\0'; const char *s; unsigned int hours = 0, minutes = 0, seconds = 0, nanosecs = 0; int ret = 1; unsigned ns_div = 1; for (s = datestr; *s && strchr("apmAPM", (int) *s) == NULL; s++) { if (*s == ':' || *s == '.') { last_sep = *s; state++; } else { if (*s < '0' || *s > '9') ret = 0; switch (state) { case TDS_HOURS: hours = (hours * 10u) + (*s - '0'); break; case TDS_MINUTES: minutes = (minutes * 10u) + (*s - '0'); break; case TDS_SECONDS: seconds = (seconds * 10u) + (*s - '0'); break; case TDS_FRACTIONS: if (ns_div < 1000000000u) { nanosecs = (nanosecs * 10u) + (*s - '0'); ns_div *= 10; } break; } } } if (*s) { if (strcasecmp(s, "am") == 0) { if (hours == 12) hours = 0; t->tm_hour = hours; } if (strcasecmp(s, "pm") == 0) { if (hours == 0) ret = 0; if (hours > 0u && hours < 12u) t->tm_hour = hours + 12; else t->tm_hour = hours; } } else { if (hours < 24u) t->tm_hour = hours; else ret = 0; } if (minutes < 60u) t->tm_min = minutes; else ret = 0; if (seconds < 60u) t->tm_sec = seconds; else ret = 0; tdsdump_log(TDS_DBG_FUNC, "store_time() nanosecs = %d\n", nanosecs); if (nanosecs) { if (nanosecs < ns_div && last_sep == '.') t->tm_ns = nanosecs * (1000000000u / ns_div); else if (nanosecs < 1000u) t->tm_ns = nanosecs * 1000000u; else ret = 0; } return (ret); } static int store_hour(const char *hour, const char *ampm, struct tds_time *t) { int ret = 1; int hours; hours = atoi(hour); if (hours >= 0 && hours < 24) { if (strcasecmp(ampm, "am") == 0) { if (hours == 12) hours = 0; t->tm_hour = hours; } if (strcasecmp(ampm, "pm") == 0) { if (hours == 0) ret = 0; if (hours > 0 && hours < 12) t->tm_hour = hours + 12; else t->tm_hour = hours; } } return ret; } /** * Get same type but nullable * @param srctype type requires * @return nullable type */ TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype) { switch (srctype) { case SYBCHAR: return SYBVARCHAR; break; case SYBINT1: case SYBUINT1: case SYBINT2: case SYBINT4: case SYBINT8: /* TODO sure ?? */ case SYBUINT2: case SYBUINT4: case SYBUINT8: return SYBINTN; break; case SYBREAL: case SYBFLT8: return SYBFLTN; break; case SYBDATETIME: case SYBDATETIME4: return SYBDATETIMN; break; case SYBBIT: return SYBBITN; break; case SYBMONEY: case SYBMONEY4: return SYBMONEYN; break; case SYBTIME: return SYBTIMEN; break; case SYBDATE: return SYBDATEN; break; default: break; } return srctype; } static void two_digit(char *out, int num) { if (num < 1) num = 1; if (num > 31) num = 31; out[0] = num < 10 ? ' ' : num/10 + '0'; out[1] = num%10 + '0'; } /** * format a date string according to an "extended" strftime(3) formatting definition. * @param buf output buffer * @param maxsize size of buffer in bytes (space include terminator) * @param format format string passed to strftime(3), except that %z represents fraction of seconds. * @param dr date to convert * @param prec second fraction precision (0-7). * @return length of string returned, 0 for error */ size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * dr, int prec) { struct tm tm; size_t length; char *our_format; char *pz = NULL; bool z_found = false; assert(buf); assert(format); assert(dr); assert(0 <= dr->decimicrosecond && dr->decimicrosecond < 10000000); if (prec < 0 || prec > 7) prec = 3; tm.tm_sec = dr->second; tm.tm_min = dr->minute; tm.tm_hour = dr->hour; tm.tm_mday = dr->day; tm.tm_mon = dr->month; tm.tm_year = dr->year - 1900; tm.tm_wday = dr->weekday; tm.tm_yday = dr->dayofyear; tm.tm_isdst = 0; #ifdef HAVE_STRUCT_TM_TM_ZONE tm.tm_zone = NULL; #elif defined(HAVE_STRUCT_TM___TM_ZONE) tm.__tm_zone = NULL; #endif /* more characters are required because we replace %z with up to 7 digits */ our_format = tds_new(char, strlen(format) + 1 + 5); if (!our_format) return 0; strcpy(our_format, format); for (pz = our_format; *pz; ) { if (*pz++ != '%') continue; switch (*pz) { case 0: continue; case '%': /* escaped, do not treat as format on next iteration */ break; case 'e': /* not portable: day of month, single digit preceded by a blank */ /* not supported on old Windows versions */ two_digit(pz-1, dr->day); break; case 'l': /* not portable: 12-hour, single digit preceded by a blank */ /* not supported on: SCO Unix, AIX, HP-UX, Windows * supported on: *BSD, MacOS, Linux, Solaris */ two_digit(pz-1, (dr->hour + 11u) % 12u + 1); break; case 'z': /* * Look for "%z" in the format string. If found, replace it with dr->milliseconds. * For example, if milliseconds is 124, the format string * "%b %d %Y %H:%M:%S.%z" would become * "%b %d %Y %H:%M:%S.124". */ if (z_found) break; z_found = true; --pz; if (prec || pz <= our_format || pz[-1] != '.') { char buf[12]; sprintf(buf, "%07d", dr->decimicrosecond); memcpy(pz, buf, prec); strcpy(pz + prec, format + (pz - our_format) + 2); pz += prec; } else { strcpy(pz - 1, format + (pz - our_format) + 2); pz--; } continue; } ++pz; } length = strftime(buf, maxsize, our_format, &tm); free(our_format); return length; } #if 0 static TDS_UINT utf16len(const utf16_t * s) { const utf16_t *p = s; while (*p++) continue; return p - s; } #endif #include "tds_willconvert.h" /** * Test if a conversion is possible * @param srctype source type * @param desttype destination type * @return 0 if not convertible */ unsigned char tds_willconvert(int srctype, int desttype) { TDS_TINYINT cat_from, cat_to; TDS_UINT yn; tdsdump_log(TDS_DBG_FUNC, "tds_willconvert(%d, %d)\n", srctype, desttype); /* they must be from 0 to 255 */ if (((srctype|desttype) & ~0xff) != 0) return 0; cat_from = type2category[srctype]; cat_to = type2category[desttype]; yn = category_conversion[cat_from]; yn = (yn >> cat_to) & 1; tdsdump_log(TDS_DBG_FUNC, "tds_willconvert(%d, %d) returns %s\n", srctype, desttype, yn? "yes":"no"); return yn; } #if 0 select day(d) as day, datepart(dw, d) as weekday, datepart(week, d) as week, d as 'date' from #t order by d day weekday week date ----------- ----------- ----------- ---------- 1 5 1 2009-01-01 Thursday 2 6 1 2009-01-02 Friday 3 7 1 2009-01-03 Saturday 4 1 2 2009-01-04 Sunday 5 2 2 2009-01-05 6 3 2 2009-01-06 7 4 2 2009-01-07 8 5 2 2009-01-08 9 6 2 2009-01-09 10 7 2 2009-01-10 11 1 3 2009-01-11 12 2 3 2009-01-12 13 3 3 2009-01-13 14 4 3 2009-01-14 15 5 3 2009-01-15 16 6 3 2009-01-16 17 7 3 2009-01-17 18 1 4 2009-01-18 19 2 4 2009-01-19 20 3 4 2009-01-20 21 4 4 2009-01-21 22 5 4 2009-01-22 23 6 4 2009-01-23 24 7 4 2009-01-24 25 1 5 2009-01-25 26 2 5 2009-01-26 27 3 5 2009-01-27 28 4 5 2009-01-28 29 5 5 2009-01-29 30 6 5 2009-01-30 31 7 5 2009-01-31 #endif /** * Convert from db date format to a structured date format * @param datetype source date type. SYBDATETIME or SYBDATETIME4 * @param di source date * @param dr destination date * @return TDS_FAIL or TDS_SUCCESS */ TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC * dr) { int dt_days; unsigned int dt_time; int years, months, days, ydays, wday, hours, mins, secs, dms, tzone = 0; int l, n, i, j; memset(dr, 0, sizeof(*dr)); if (datetype == SYBMSDATE || datetype == SYBMSTIME || datetype == SYBMSDATETIME2 || datetype == SYBMSDATETIMEOFFSET) { const TDS_DATETIMEALL *dta = (const TDS_DATETIMEALL *) di; dt_days = (datetype == SYBMSTIME) ? 0 : dta->date; if (datetype == SYBMSDATE) { dms = 0; secs = 0; dt_time = 0; } else { dms = dta->time % 10000000u; dt_time = (unsigned int) (dta->time / 10000000u); secs = dt_time % 60; dt_time = dt_time / 60; } if (datetype == SYBMSDATETIMEOFFSET) { --dt_days; dt_time = dt_time + 1440 + dta->offset; dt_days += dt_time / 1440; dt_time %= 1440; tzone = dta->offset; } } else if (datetype == SYBDATETIME) { const TDS_DATETIME *dt = (const TDS_DATETIME *) di; dt_time = dt->dttime; dms = ((dt_time % 300) * 1000 + 150) / 300 * 10000u; dt_time = dt_time / 300; secs = dt_time % 60; dt_time = dt_time / 60; dt_days = dt->dtdays; } else if (datetype == SYBDATETIME4) { const TDS_DATETIME4 *dt4 = (const TDS_DATETIME4 *) di; secs = 0; dms = 0; dt_days = dt4->days; dt_time = dt4->minutes; } else if (datetype == SYBDATE) { dt_days = *((const TDS_DATE *) di); dms = 0; secs = 0; dt_time = 0; } else if (datetype == SYBTIME) { dt_time = *((const TDS_TIME *) di); dms = ((dt_time % 300) * 1000 + 150) / 300 * 10000u; dt_time = dt_time / 300; secs = dt_time % 60; dt_time = dt_time / 60; dt_days = 0; } else if (datetype == SYB5BIGTIME) { TDS_UINT8 bigtime = *((const TDS_BIGTIME *) di); dt_days = 0; dms = bigtime % 1000000u * 10u; dt_time = (bigtime / 1000000u) % 86400u; secs = dt_time % 60; dt_time = dt_time / 60u; } else if (datetype == SYB5BIGDATETIME) { TDS_UINT8 bigdatetime = *((const TDS_BIGDATETIME*) di); dms = bigdatetime % 1000000u * 10u; bigdatetime /= 1000000u; secs = bigdatetime % 60u; bigdatetime /= 60u; dt_time = bigdatetime % (24u*60u); dt_days = bigdatetime / (24u*60u) - BIGDATETIME_BIAS; } else { return TDS_FAIL; } /* * -53690 is minimun (1753-1-1) (Gregorian calendar start in 1732) * 2958463 is maximun (9999-12-31) */ l = dt_days + (146038 + 146097*4); wday = (l + 4) % 7; n = (4 * l) / 146097; /* n century */ l = l - (146097 * n + 3) / 4; /* days from xx00-02-28 (y-m-d) */ i = (4000 * (l + 1)) / 1461001; /* years from xx00-02-28 */ l = l - (1461 * i) / 4; /* year days from xx00-02-28 */ ydays = l >= 306 ? l - 305 : l + 60; l += 31; j = (80 * l) / 2447; days = l - (2447 * j) / 80; l = j / 11; months = j + 1 - 12 * l; years = 100 * (n - 1) + i + l; if (l == 0 && (years & 3) == 0 && (years % 100 != 0 || years % 400 == 0)) ++ydays; hours = dt_time / 60; mins = dt_time % 60; dr->year = years; dr->month = months; dr->quarter = months / 3; dr->day = days; dr->dayofyear = ydays; dr->weekday = wday; dr->hour = hours; dr->minute = mins; dr->second = secs; dr->decimicrosecond = dms; dr->timezone = tzone; return TDS_SUCCESS; } /** * \brief convert a number in string to TDS_INT * * \return TDS_CONVERT_* or failure code on error * \remarks Sybase's char->int conversion tolerates embedded blanks, * such that "convert( int, ' - 13 ' )" works. * If we find blanks, we copy the string to a temporary buffer, * skipping the blanks. * We return the results of atoi() with a clean string. * * n.b. it is possible to embed all sorts of non-printable characters, but we * only check for spaces. at this time, no one on the project has tested anything else. */ static TDS_INT string_to_int(const char *buf, const char *pend, TDS_INT * res) { bool negative; unsigned int num; /* we use unsigned here for best overflow check */ size_t digits, decimals; buf = parse_numeric(buf, pend, &negative, &digits, &decimals); if (!buf) return TDS_CONVERT_SYNTAX; num = 0; for (; digits; --digits, ++buf) { /* add a digit to number and check for overflow */ /* NOTE I didn't forget a digit, I check overflow before multiply to prevent overflow */ if (num > 214748364u) return TDS_CONVERT_OVERFLOW; num = num * 10u + (*buf - '0'); } /* check for overflow and convert unsigned to signed */ if (negative) { if (num > 2147483648u) return TDS_CONVERT_OVERFLOW; *res = 0 - num; } else { if (num >= 2147483648u) return TDS_CONVERT_OVERFLOW; *res = num; } return sizeof(TDS_INT); } /** * \brief convert a number in string to TDS_INT8 * * \return TDS_CONVERT_* or failure code on error */ static TDS_INT /* copied from string_ti_int and modified */ parse_int8(const char *buf, const char *pend, TDS_UINT8 * res, bool * p_negative) { TDS_UINT8 num; size_t digits, decimals; buf = parse_numeric(buf, pend, p_negative, &digits, &decimals); if (!buf) return TDS_CONVERT_SYNTAX; num = 0; for (; digits; --digits, ++buf) { /* add a digit to number and check for overflow */ TDS_UINT8 prev = num; if (num > (((TDS_UINT8) 1u) << 63) / 5u) return TDS_CONVERT_OVERFLOW; num = num * 10u + (*buf - '0'); if (num < prev) return TDS_CONVERT_OVERFLOW; } *res = num; return sizeof(TDS_INT8); } /** * \brief convert a number in string to TDS_INT8 * * \return TDS_CONVERT_* or failure code on error */ static TDS_INT /* copied from string_ti_int and modified */ string_to_int8(const char *buf, const char *pend, TDS_INT8 * res) { TDS_UINT8 num; TDS_INT parse_res; bool negative; parse_res = parse_int8(buf, pend, &num, &negative); if (parse_res < 0) return parse_res; /* check for overflow and convert unsigned to signed */ if (negative) { if (num > (((TDS_UINT8) 1) << 63)) return TDS_CONVERT_OVERFLOW; *res = 0 - num; } else { if (num >= (((TDS_UINT8) 1) << 63)) return TDS_CONVERT_OVERFLOW; *res = num; } return sizeof(TDS_INT8); } /** * \brief convert a number in string to TDS_UINT8 * * \return TDS_CONVERT_* or failure code on error */ static TDS_INT /* copied from string_to_int8 and modified */ string_to_uint8(const char *buf, const char *pend, TDS_UINT8 * res) { TDS_UINT8 num; TDS_INT parse_res; bool negative; parse_res = parse_int8(buf, pend, &num, &negative); if (parse_res < 0) return parse_res; /* check for overflow */ if (negative && num) return TDS_CONVERT_OVERFLOW; *res = num; return sizeof(TDS_UINT8); } /** * Parse a string for numbers. * * Syntax can be something like " *[+-] *[0-9]*\.[0-9]* *". * * The function ignore all spaces. It strips leading zeroes which could * possibly lead to overflow. * The function returns a pointer to the integer part followed by *p_digits * digits followed by a dot followed by *p_decimals digits (dot and * fractional digits are optional, in this case *p_decimals is 0). * * @param buf start of string * @param pend pointer to string end * @param p_negative store if number is negative * @param p_digits store number of integer digits * @param p_decimals store number of fractional digits * @return pointer to first not zero digit. If NULL this indicate a syntax * error. */ static const char * parse_numeric(const char *buf, const char *pend, bool *p_negative, size_t *p_digits, size_t *p_decimals) { enum { blank = ' ' }; #define SKIP_IF(cond) while (p != pend && (cond)) ++p; const char *p, *start; bool negative = false; *p_decimals = 0; p = buf; /* ignore leading spaces */ SKIP_IF(*p == blank); if (p == pend) { *p_negative = false; *p_digits = 0; return p; } /* check for sign */ switch (*p) { case '-': negative = true; /* fall thru */ case '+': /* skip spaces between sign and number */ ++p; SKIP_IF(*p == blank); break; } *p_negative = negative; /* a digit must be present */ if (p == pend) return NULL; /* * skip leading zeroes * Not skipping them cause numbers like "000000000000" to * appear like overflow */ SKIP_IF(*p == '0'); start = p; SKIP_IF(TDS_ISDIGIT(*p)); *p_digits = p - start; /* parse decimal part */ if (p != pend && *p == '.') { const char *decimals_start = ++p; SKIP_IF(TDS_ISDIGIT(*p)); *p_decimals = p - decimals_start; } /* check for trailing spaces */ SKIP_IF(*p == blank); if (p != pend) return NULL; return start; } static TDS_INT string_to_float(const TDS_CHAR * src, TDS_UINT srclen, int desttype, CONV_RESULT * cr) { char tmpstr[128]; char *end; double res; /* ignore leading spaces */ while (srclen > 0 && src[0] == ' ') ++src, --srclen; /* ignore trailing blanks and nulls */ while (srclen > 0 && (src[srclen - 1] == ' ' || src[srclen - 1] == '\0')) --srclen; if (srclen >= sizeof(tmpstr)) return TDS_CONVERT_OVERFLOW; memcpy(tmpstr, src, srclen); tmpstr[srclen] = 0; errno = 0; res = strtod(tmpstr, &end); if (errno == ERANGE) return TDS_CONVERT_OVERFLOW; if (end != tmpstr + srclen) return TDS_CONVERT_SYNTAX; if (desttype == SYBREAL) { /* FIXME check overflows */ cr->r = (TDS_REAL)res; return sizeof(TDS_REAL); } cr->f = res; return sizeof(TDS_FLOAT); } /** @} */ freetds-1.3.6/src/tds/numeric.c000644 025423 025423 00000024042 14056414222 017774 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2005-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include /** * tds_numeric_bytes_per_prec is indexed by precision and will * tell us the number of bytes required to store the specified * precision (with the sign). * Support precision up to 77 digits */ const int tds_numeric_bytes_per_prec[] = { /* * precision can't be 0 but using a value > 0 assure no * core if for some bug it's 0... */ 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 21, 21, 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33 }; TDS_COMPILE_CHECK(maxprecision, MAXPRECISION < TDS_VECTOR_SIZE(tds_numeric_bytes_per_prec) ); /* * money is a special case of numeric really...that why its here */ char * tds_money_to_string(const TDS_MONEY * money, char *s, bool use_2_digits) { TDS_INT8 mymoney; TDS_UINT8 n; char *p; /* sometimes money it's only 4-byte aligned so always compute 64-bit */ mymoney = (((TDS_INT8) money->tdsoldmoney.mnyhigh) << 32) | money->tdsoldmoney.mnylow; p = s; if (mymoney < 0) { *p++ = '-'; /* we use unsigned cause this cause arithmetic problem for -2^63*/ n = -mymoney; } else { n = mymoney; } /* if machine is 64 bit you do not need to split n */ if (use_2_digits) { n = (n+ 50) / 100; sprintf(p, "%" PRIu64 ".%02u", n / 100u, (unsigned) (n % 100u)); } else { sprintf(p, "%" PRIu64 ".%04u", n / 10000u, (unsigned) (n % 10000u)); } return s; } /** * @return <0 if error */ TDS_INT tds_numeric_to_string(const TDS_NUMERIC * numeric, char *s) { const unsigned char *number; unsigned int packet[sizeof(numeric->array) / 2]; unsigned int *pnum, *packet_start; unsigned int *const packet_end = packet + TDS_VECTOR_SIZE(packet); unsigned int packet10k[(MAXPRECISION + 3) / 4]; unsigned int *p; int num_bytes; unsigned int remainder, n, i, m; /* a bit of debug */ #if ENABLE_EXTRA_CHECKS memset(packet, 0x55, sizeof(packet)); memset(packet10k, 0x55, sizeof(packet10k)); #endif if (numeric->precision < 1 || numeric->precision > MAXPRECISION || numeric->scale > numeric->precision) return TDS_CONVERT_FAIL; /* set sign */ if (numeric->array[0] == 1) *s++ = '-'; /* put number in a 16bit array */ number = numeric->array; num_bytes = tds_numeric_bytes_per_prec[numeric->precision]; n = num_bytes - 1; pnum = packet_end; for (; n > 1; n -= 2) *--pnum = TDS_GET_UA2BE(&number[n - 1]); if (n == 1) *--pnum = number[n]; while (!*pnum) { ++pnum; if (pnum == packet_end) { *s++ = '0'; if (numeric->scale) { *s++ = '.'; i = numeric->scale; do { *s++ = '0'; } while (--i); } *s = 0; return 1; } } packet_start = pnum; /* transform 2^16 base number in 10^4 base number */ for (p = packet10k + TDS_VECTOR_SIZE(packet10k); packet_start != packet_end;) { pnum = packet_start; n = *pnum; remainder = n % 10000u; if (!(*pnum++ = (n / 10000u))) packet_start = pnum; for (; pnum != packet_end; ++pnum) { n = remainder * (256u * 256u) + *pnum; remainder = n % 10000u; *pnum = n / 10000u; } *--p = remainder; } /* transform to 10 base number and output */ i = 4 * (unsigned int)((packet10k + TDS_VECTOR_SIZE(packet10k)) - p); /* current digit */ /* skip leading zeroes */ n = 1000; remainder = *p; while (remainder < n) n /= 10, --i; if (i <= numeric->scale) { *s++ = '0'; *s++ = '.'; m = i; while (m < numeric->scale) *s++ = '0', ++m; } for (;;) { *s++ = (remainder / n) + '0'; --i; remainder %= n; n /= 10; if (!n) { n = 1000; if (++p == packet10k + TDS_VECTOR_SIZE(packet10k)) break; remainder = *p; } if (i == numeric->scale) *s++ = '.'; } *s = 0; return 1; } #define TDS_WORD uint32_t #define TDS_DWORD uint64_t #define TDS_WORD_DDIGIT 9 /* include to check limits */ #include "num_limits.h" static int tds_packet_check_overflow(TDS_WORD *packet, unsigned int packet_len, unsigned int prec) { unsigned int i, len, stop; const TDS_WORD *limit = &limits[limit_indexes[prec] + LIMIT_INDEXES_ADJUST * prec]; len = limit_indexes[prec+1] - limit_indexes[prec] + LIMIT_INDEXES_ADJUST; stop = prec / (sizeof(TDS_WORD) * 8); /* * Now a number is * ... P[3] P[2] P[1] P[0] * while upper limit + 1 is * zeroes limit[0 .. len-1] 0[0 .. stop-1] * we must assure that number < upper limit + 1 */ if (packet_len >= len + stop) { /* higher packets must be zero */ for (i = packet_len; --i >= len + stop; ) if (packet[i] > 0) return TDS_CONVERT_OVERFLOW; /* test limit */ for (;; --i, ++limit) { if (i <= stop) { /* last must be >= not > */ if (packet[i] >= *limit) return TDS_CONVERT_OVERFLOW; break; } if (packet[i] > *limit) return TDS_CONVERT_OVERFLOW; if (packet[i] < *limit) break; } } return 0; } TDS_INT tds_numeric_change_prec_scale(TDS_NUMERIC * numeric, unsigned char new_prec, unsigned char new_scale) { static const TDS_WORD factors[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; TDS_WORD packet[(sizeof(numeric->array) - 1) / sizeof(TDS_WORD)]; unsigned int i, packet_len; int scale_diff, bytes; if (numeric->precision < 1 || numeric->precision > MAXPRECISION || numeric->scale > numeric->precision) return TDS_CONVERT_FAIL; if (new_prec < 1 || new_prec > MAXPRECISION || new_scale > new_prec) return TDS_CONVERT_FAIL; scale_diff = new_scale - numeric->scale; if (scale_diff == 0 && new_prec >= numeric->precision) { i = tds_numeric_bytes_per_prec[new_prec] - tds_numeric_bytes_per_prec[numeric->precision]; if (i > 0) { memmove(numeric->array + 1 + i, numeric->array + 1, sizeof(numeric->array) - 1 - i); memset(numeric->array + 1, 0, i); } numeric->precision = new_prec; return sizeof(TDS_NUMERIC); } /* package number */ bytes = tds_numeric_bytes_per_prec[numeric->precision] - 1; i = 0; do { /* * note that if bytes are smaller we have a small buffer * overflow in numeric->array however is not a problem * cause overflow occurs in numeric and number is fixed below */ packet[i] = TDS_GET_UA4BE(&numeric->array[bytes-3]); ++i; } while ( (bytes -= sizeof(TDS_WORD)) > 0); /* fix last packet */ if (bytes < 0) packet[i-1] &= 0xffffffffu >> (8 * -bytes); while (i > 1 && packet[i-1] == 0) --i; packet_len = i; if (scale_diff >= 0) { /* check overflow before multiply */ if (tds_packet_check_overflow(packet, packet_len, new_prec - scale_diff)) return TDS_CONVERT_OVERFLOW; if (scale_diff == 0) { i = tds_numeric_bytes_per_prec[numeric->precision] - tds_numeric_bytes_per_prec[new_prec]; if (i > 0) memmove(numeric->array + 1, numeric->array + 1 + i, sizeof(numeric->array) - 1 - i); numeric->precision = new_prec; return sizeof(TDS_NUMERIC); } /* multiply */ do { /* multiply by at maximun TDS_WORD_DDIGIT */ unsigned int n = scale_diff > TDS_WORD_DDIGIT ? TDS_WORD_DDIGIT : scale_diff; TDS_WORD factor = factors[n]; TDS_WORD carry = 0; scale_diff -= n; for (i = 0; i < packet_len; ++i) { TDS_DWORD n = packet[i] * ((TDS_DWORD) factor) + carry; packet[i] = (TDS_WORD) n; carry = n >> (8 * sizeof(TDS_WORD)); } /* here we can expand number safely cause we know that it can't overflow */ if (carry) packet[packet_len++] = carry; } while (scale_diff > 0); } else { /* check overflow */ if (new_prec - scale_diff < numeric->precision) if (tds_packet_check_overflow(packet, packet_len, new_prec - scale_diff)) return TDS_CONVERT_OVERFLOW; /* divide */ scale_diff = -scale_diff; do { unsigned int n = scale_diff > TDS_WORD_DDIGIT ? TDS_WORD_DDIGIT : scale_diff; TDS_WORD factor = factors[n]; TDS_WORD borrow = 0; scale_diff -= n; for (i = packet_len; i > 0; ) { #if defined(__GNUC__) && __GNUC__ >= 3 && defined(__i386__) --i; __asm__ ("divl %4": "=a"(packet[i]), "=d"(borrow): "0"(packet[i]), "1"(borrow), "r"(factor)); #elif defined(__WATCOMC__) && defined(DOS32X) TDS_WORD Int64div32(TDS_WORD* low,TDS_WORD high,TDS_WORD factor); #pragma aux Int64div32 = "mov eax, dword ptr[esi]" \ "div ecx" \ "mov dword ptr[esi], eax" \ parm [ESI] [EDX] [ECX] value [EDX] modify [EAX EDX]; borrow = Int64div32(&packet[i], borrow, factor); #else TDS_DWORD n = (((TDS_DWORD) borrow) << (8 * sizeof(TDS_WORD))) + packet[--i]; packet[i] = (TDS_WORD) (n / factor); borrow = n % factor; #endif } } while (scale_diff > 0); } /* back to our format */ numeric->precision = new_prec; numeric->scale = new_scale; bytes = tds_numeric_bytes_per_prec[numeric->precision] - 1; for (i = bytes / sizeof(TDS_WORD); i >= packet_len; --i) packet[i] = 0; for (i = 0; bytes >= sizeof(TDS_WORD); bytes -= sizeof(TDS_WORD), ++i) { TDS_PUT_UA4BE(&numeric->array[bytes-3], packet[i]); } if (bytes) { TDS_WORD remainder = packet[i]; do { numeric->array[bytes] = (TDS_UCHAR) remainder; remainder >>= 8; } while (--bytes); } return sizeof(TDS_NUMERIC); } freetds-1.3.6/src/tds/config.c000644 025423 025423 00000117575 14056414271 017621 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_LIMITS_H #include #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #ifdef _WIN32 #include #endif #include #include #include #include #include static int tds_config_login(TDSLOGIN * connection, TDSLOGIN * login); static int tds_config_env_tdsdump(TDSLOGIN * login); static void tds_config_env_tdsver(TDSLOGIN * login); static void tds_config_env_tdsport(TDSLOGIN * login); static int tds_config_env_tdshost(TDSLOGIN * login); static bool tds_read_conf_sections(FILE * in, const char *server, TDSLOGIN * login); static int tds_read_interfaces(const char *server, TDSLOGIN * login); static int parse_server_name_for_port(TDSLOGIN * connection, TDSLOGIN * login, bool update_server); static int tds_lookup_port(const char *portname); static void tds_config_encryption(const char * value, TDSLOGIN * login); static char *interf_file = NULL; #define TDS_ISSPACE(c) isspace((unsigned char ) (c)) const char STD_DATETIME_FMT[] = "%b %e %Y %I:%M%p"; #if !defined(_WIN32) && !defined(DOS32X) static const char pid_config_logpath[] = "/tmp/tdsconfig.log.%d"; static const char freetds_conf[] = "%s/etc/freetds.conf"; static const char location[] = "(from $FREETDS/etc)"; static const char pid_logpath[] = "/tmp/freetds.log.%d"; static const char interfaces_path[] = "/etc/freetds"; #else static const char pid_config_logpath[] = "c:\\tdsconfig.log.%d"; static const char freetds_conf[] = "%s\\freetds.conf"; static const char location[] = "(from $FREETDS)"; static const char pid_logpath[] = "c:\\freetds.log.%d"; static const char interfaces_path[] = "c:\\"; #endif /** * \ingroup libtds * \defgroup config Configuration * Handle reading of configuration */ /** * \addtogroup config * @{ */ /** * tds_read_config_info() will fill the tds connection structure based on configuration * information gathered in the following order: * 1) Program specified in TDSLOGIN structure * 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST * 3) A config file with the following search order: * a) a readable file specified by environment variable FREETDSCONF * b) a readable file in ~/.freetds.conf * c) a readable file in $prefix/etc/freetds.conf * 3) ~/.interfaces if exists * 4) $SYBASE/interfaces if exists * 5) TDS_DEF_* default values * * .tdsrc and freetds.conf have been added to make the package easier to * integration with various Linux and *BSD distributions. */ TDSLOGIN * tds_read_config_info(TDSSOCKET * tds, TDSLOGIN * login, TDSLOCALE * locale) { TDSLOGIN *connection; char *s; char *path; pid_t pid; int opened = 0; bool found; struct addrinfo *addrs; /* allocate a new structure with hard coded and build-time defaults */ connection = tds_alloc_login(0); if (!connection || !tds_init_login(connection, locale)) { tds_free_login(connection); return NULL; } s = getenv("TDSDUMPCONFIG"); if (s) { if (*s) { opened = tdsdump_open(s); } else { pid = getpid(); if (asprintf(&path, pid_config_logpath, (int) pid) >= 0) { if (*path) { opened = tdsdump_open(path); } free(path); } } } tdsdump_log(TDS_DBG_INFO1, "Getting connection information for [%s].\n", tds_dstr_cstr(&login->server_name)); /* (The server name is set in login.c.) */ /* Read the config files. */ tdsdump_log(TDS_DBG_INFO1, "Attempting to read conf files.\n"); found = tds_read_conf_file(connection, tds_dstr_cstr(&login->server_name)); if (!found) { if (parse_server_name_for_port(connection, login, true)) { found = tds_read_conf_file(connection, tds_dstr_cstr(&connection->server_name)); /* do it again to really override what found in freetds.conf */ parse_server_name_for_port(connection, login, false); if (!found && TDS_SUCCEED(tds_lookup_host_set(tds_dstr_cstr(&connection->server_name), &connection->ip_addrs))) { if (!tds_dstr_dup(&connection->server_host_name, &connection->server_name)) { tds_free_login(connection); return NULL; } found = true; } if (!tds_dstr_dup(&login->server_name, &connection->server_name)) { tds_free_login(connection); return NULL; } } } if (!found) { /* fallback to interfaces file */ tdsdump_log(TDS_DBG_INFO1, "Failed in reading conf file. Trying interface files.\n"); if (!tds_read_interfaces(tds_dstr_cstr(&login->server_name), connection)) { tdsdump_log(TDS_DBG_INFO1, "Failed to find [%s] in configuration files; trying '%s' instead.\n", tds_dstr_cstr(&login->server_name), tds_dstr_cstr(&connection->server_name)); if (connection->ip_addrs == NULL) tdserror(tds_get_ctx(tds), tds, TDSEINTF, 0); } } /* Override config file settings with environment variables. */ tds_fix_login(connection); /* And finally apply anything from the login structure */ if (!tds_config_login(connection, login)) { tds_free_login(connection); return NULL; } if (opened) { char tmp[128]; tdsdump_log(TDS_DBG_INFO1, "Final connection parameters:\n"); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "server_name", tds_dstr_cstr(&connection->server_name)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "server_host_name", tds_dstr_cstr(&connection->server_host_name)); for (addrs = connection->ip_addrs; addrs != NULL; addrs = addrs->ai_next) tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "ip_addr", tds_addrinfo2str(addrs, tmp, sizeof(tmp))); if (connection->ip_addrs == NULL) tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "ip_addr", ""); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "instance_name", tds_dstr_cstr(&connection->instance_name)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "port", connection->port); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "major_version", TDS_MAJOR(connection)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "minor_version", TDS_MINOR(connection)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "block_size", connection->block_size); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "language", tds_dstr_cstr(&connection->language)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "server_charset", tds_dstr_cstr(&connection->server_charset)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "connect_timeout", connection->connect_timeout); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "client_host_name", tds_dstr_cstr(&connection->client_host_name)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "client_charset", tds_dstr_cstr(&connection->client_charset)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "use_utf16", connection->use_utf16); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "app_name", tds_dstr_cstr(&connection->app_name)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "user_name", tds_dstr_cstr(&connection->user_name)); /* tdsdump_log(TDS_DBG_PASSWD, "\t%20s = %s\n", "password", tds_dstr_cstr(&connection->password)); (no such flag yet) */ tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "library", tds_dstr_cstr(&connection->library)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "bulk_copy", (int)connection->bulk_copy); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "suppress_language", (int)connection->suppress_language); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "encrypt level", (int)connection->encryption_level); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "query_timeout", connection->query_timeout); /* tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "capabilities", tds_dstr_cstr(&connection->capabilities)); (not null terminated) */ tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "database", tds_dstr_cstr(&connection->database)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "dump_file", tds_dstr_cstr(&connection->dump_file)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %x\n", "debug_flags", connection->debug_flags); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "text_size", connection->text_size); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "server_realm_name", tds_dstr_cstr(&connection->server_realm_name)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "server_spn", tds_dstr_cstr(&connection->server_spn)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "cafile", tds_dstr_cstr(&connection->cafile)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "crlfile", tds_dstr_cstr(&connection->crlfile)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "check_ssl_hostname", connection->check_ssl_hostname); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "db_filename", tds_dstr_cstr(&connection->db_filename)); tdsdump_log(TDS_DBG_INFO1, "\t%20s = %d\n", "readonly_intent", connection->readonly_intent); #ifdef HAVE_OPENSSL tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "openssl_ciphers", tds_dstr_cstr(&connection->openssl_ciphers)); #endif tdsdump_close(); } /* * If a dump file has been specified, start logging */ if (!tds_dstr_isempty(&connection->dump_file) && !tdsdump_isopen()) { if (connection->debug_flags) tds_debug_flags = connection->debug_flags; tdsdump_open(tds_dstr_cstr(&connection->dump_file)); } return connection; } /** * Fix configuration after reading it. * Currently this read some environment variables and replace some options. */ void tds_fix_login(TDSLOGIN * login) { /* Now check the environment variables */ tds_config_env_tdsver(login); tds_config_env_tdsdump(login); tds_config_env_tdsport(login); tds_config_env_tdshost(login); } static bool tds_try_conf_file(const char *path, const char *how, const char *server, TDSLOGIN * login) { bool found = false; FILE *in; if ((in = fopen(path, "r")) == NULL) { tdsdump_log(TDS_DBG_INFO1, "Could not open '%s' (%s).\n", path, how); return found; } tdsdump_log(TDS_DBG_INFO1, "Found conf file '%s' %s.\n", path, how); found = tds_read_conf_sections(in, server, login); if (found) { tdsdump_log(TDS_DBG_INFO1, "Success: [%s] defined in %s.\n", server, path); } else { tdsdump_log(TDS_DBG_INFO2, "[%s] not found.\n", server); } fclose(in); return found; } /** * Return filename from HOME directory * @return allocated string or NULL if error */ char * tds_get_home_file(const char *file) { char *home, *path; home = tds_get_homedir(); if (!home) return NULL; if (asprintf(&path, "%s/%s", home, file) < 0) path = NULL; free(home); return path; } /** * Read configuration info for given server * return 0 on error * @param login where to store configuration * @param server section of file configuration that hold * configuration for a server */ bool tds_read_conf_file(TDSLOGIN * login, const char *server) { char *path = NULL; char *eptr = NULL; bool found = false; if (interf_file) { found = tds_try_conf_file(interf_file, "set programmatically", server, login); } /* FREETDSCONF env var, pkleef@openlinksw.com 01/21/02 */ if (!found) { path = getenv("FREETDSCONF"); if (path) { found = tds_try_conf_file(path, "(from $FREETDSCONF)", server, login); } else { tdsdump_log(TDS_DBG_INFO2, "... $FREETDSCONF not set. Trying $FREETDS/etc.\n"); } } /* FREETDS env var, Bill Thompson 16/07/03 */ if (!found) { eptr = getenv("FREETDS"); if (eptr) { if (asprintf(&path, freetds_conf, eptr) >= 0) { found = tds_try_conf_file(path, location, server, login); free(path); } } else { tdsdump_log(TDS_DBG_INFO2, "... $FREETDS not set. Trying $HOME.\n"); } } if (!found) { path = tds_get_home_file(".freetds.conf"); if (path) { found = tds_try_conf_file(path, "(.freetds.conf)", server, login); free(path); } else { tdsdump_log(TDS_DBG_INFO2, "... Error getting ~/.freetds.conf. Trying %s.\n", FREETDS_SYSCONFFILE); } } if (!found) { found = tds_try_conf_file(FREETDS_SYSCONFFILE, "(default)", server, login); } return found; } static bool tds_read_conf_sections(FILE * in, const char *server, TDSLOGIN * login) { DSTR default_instance = DSTR_INITIALIZER; int default_port; bool found; tds_read_conf_section(in, "global", tds_parse_conf_section, login); if (!server[0]) return false; rewind(in); if (!tds_dstr_dup(&default_instance, &login->instance_name)) return false; default_port = login->port; found = tds_read_conf_section(in, server, tds_parse_conf_section, login); if (!login->valid_configuration) { tds_dstr_free(&default_instance); return false; } /* * If both instance and port are specified and neither one came from the default, it's an error * TODO: If port/instance is specified in the non-default, it has priority over the default setting. * TODO: test this. */ if (!tds_dstr_isempty(&login->instance_name) && login->port && !(!tds_dstr_isempty(&default_instance) || default_port)) { tdsdump_log(TDS_DBG_ERROR, "error: cannot specify both port %d and instance %s.\n", login->port, tds_dstr_cstr(&login->instance_name)); /* tdserror(tds_get_ctx(tds), tds, TDSEPORTINSTANCE, 0); */ } tds_dstr_free(&default_instance); return found; } static const struct { char value[7]; unsigned char to_return; } boolean_values[] = { { "yes", 1 }, { "no", 0 }, { "on", 1 }, { "off", 0 }, { "true", 1 }, { "false", 0 } }; int tds_parse_boolean(const char *value, int default_value) { int p; for (p = 0; p < TDS_VECTOR_SIZE(boolean_values); ++p) { if (!strcasecmp(value, boolean_values[p].value)) return boolean_values[p].to_return; } return default_value; } int tds_config_boolean(const char *option, const char *value, TDSLOGIN *login) { int ret = tds_parse_boolean(value, -1); if (ret >= 0) return ret; tdsdump_log(TDS_DBG_ERROR, "UNRECOGNIZED option value '%s' for boolean setting '%s'!\n", value, option); login->valid_configuration = 0; return 0; } static void tds_config_encryption(const char * value, TDSLOGIN * login) { TDS_ENCRYPTION_LEVEL lvl = TDS_ENCRYPTION_OFF; if (!strcasecmp(value, TDS_STR_ENCRYPTION_OFF)) ; else if (!strcasecmp(value, TDS_STR_ENCRYPTION_REQUEST)) lvl = TDS_ENCRYPTION_REQUEST; else if (!strcasecmp(value, TDS_STR_ENCRYPTION_REQUIRE)) lvl = TDS_ENCRYPTION_REQUIRE; else { tdsdump_log(TDS_DBG_ERROR, "UNRECOGNIZED option value '%s' for '%s' setting!\n", value, TDS_STR_ENCRYPTION); tdsdump_log(TDS_DBG_ERROR, "Valid settings are: ('%s', '%s', '%s')\n", TDS_STR_ENCRYPTION_OFF, TDS_STR_ENCRYPTION_REQUEST, TDS_STR_ENCRYPTION_REQUIRE); lvl = TDS_ENCRYPTION_REQUIRE; /* Assuming "require" is safer than "no" */ login->valid_configuration = 0; } login->encryption_level = lvl; } /** * Read a section of configuration file (INI style file) * @param in configuration file * @param section section to read * @param tds_conf_parse callback that receive every entry in section * @param param parameter to pass to callback function */ bool tds_read_conf_section(FILE * in, const char *section, TDSCONFPARSE tds_conf_parse, void *param) { char line[256], *value; #define option line char *s; char p; int i; int insection = 0; bool found = false; tdsdump_log(TDS_DBG_INFO1, "Looking for section %s.\n", section); while (fgets(line, sizeof(line), in)) { s = line; /* skip leading whitespace */ while (*s && TDS_ISSPACE(*s)) s++; /* skip it if it's a comment line */ if (*s == ';' || *s == '#') continue; /* read up to the = ignoring duplicate spaces */ p = 0; i = 0; while (*s && *s != '=') { if (!TDS_ISSPACE(*s)) { if (TDS_ISSPACE(p)) option[i++] = ' '; option[i++] = tolower((unsigned char) *s); } p = *s; s++; } /* skip if empty option */ if (!i) continue; /* skip the = */ if (*s) s++; /* terminate the option, must be done after skipping = */ option[i] = '\0'; /* skip leading whitespace */ while (*s && TDS_ISSPACE(*s)) s++; /* read up to a # ; or null ignoring duplicate spaces */ value = s; p = 0; i = 0; while (*s && *s != ';' && *s != '#') { if (!TDS_ISSPACE(*s)) { if (TDS_ISSPACE(p)) value[i++] = ' '; value[i++] = *s; } p = *s; s++; } value[i] = '\0'; if (option[0] == '[') { s = strchr(option, ']'); if (s) *s = '\0'; tdsdump_log(TDS_DBG_INFO1, "\tFound section %s.\n", &option[1]); if (!strcasecmp(section, &option[1])) { tdsdump_log(TDS_DBG_INFO1, "Got a match.\n"); insection = 1; found = true; } else { insection = 0; } } else if (insection) { tds_conf_parse(option, value, param); } } tdsdump_log(TDS_DBG_INFO1, "\tReached EOF\n"); return found; #undef option } /* Also used to scan ODBC.INI entries */ void tds_parse_conf_section(const char *option, const char *value, void *param) { TDSLOGIN *login = (TDSLOGIN *) param; void *s = param; tdsdump_log(TDS_DBG_INFO1, "\t%s = '%s'\n", option, value); if (!strcmp(option, TDS_STR_VERSION)) { tds_config_verstr(value, login); } else if (!strcmp(option, TDS_STR_BLKSZ)) { int val = atoi(value); if (val >= 512 && val < 65536) login->block_size = val; } else if (!strcmp(option, TDS_STR_SWAPDT)) { /* this option is deprecated, just check value for compatibility */ tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_GSSAPI_DELEGATION)) { /* gssapi flag addition */ login->gssapi_use_delegation = tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_STR_MUTUAL_AUTHENTICATION)) { login->mutual_authentication = tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_STR_DUMPFILE)) { s = tds_dstr_copy(&login->dump_file, value); } else if (!strcmp(option, TDS_STR_DEBUGFLAGS)) { char *end; long flags; flags = strtol(value, &end, 0); if (*value != '\0' && *end == '\0' && flags != LONG_MIN && flags != LONG_MAX) login->debug_flags = flags; } else if (!strcmp(option, TDS_STR_TIMEOUT) || !strcmp(option, TDS_STR_QUERY_TIMEOUT)) { if (atoi(value)) login->query_timeout = atoi(value); } else if (!strcmp(option, TDS_STR_CONNTIMEOUT)) { if (atoi(value)) login->connect_timeout = atoi(value); } else if (!strcmp(option, TDS_STR_HOST)) { char tmp[128]; struct addrinfo *addrs; if (TDS_FAILED(tds_lookup_host_set(value, &login->ip_addrs))) { tdsdump_log(TDS_DBG_WARN, "Found host entry %s however name resolution failed. \n", value); return; } tdsdump_log(TDS_DBG_INFO1, "Found host entry %s \n", value); s = tds_dstr_copy(&login->server_host_name, value); for (addrs = login->ip_addrs; addrs != NULL; addrs = addrs->ai_next) tdsdump_log(TDS_DBG_INFO1, "IP addr is %s.\n", tds_addrinfo2str(addrs, tmp, sizeof(tmp))); } else if (!strcmp(option, TDS_STR_PORT)) { if (atoi(value)) login->port = atoi(value); } else if (!strcmp(option, TDS_STR_EMUL_LE)) { /* obsolete, ignore */ tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_STR_TEXTSZ)) { if (atoi(value)) login->text_size = atoi(value); } else if (!strcmp(option, TDS_STR_CHARSET)) { s = tds_dstr_copy(&login->server_charset, value); tdsdump_log(TDS_DBG_INFO1, "%s is %s.\n", option, tds_dstr_cstr(&login->server_charset)); } else if (!strcmp(option, TDS_STR_CLCHARSET)) { s = tds_dstr_copy(&login->client_charset, value); tdsdump_log(TDS_DBG_INFO1, "tds_parse_conf_section: %s is %s.\n", option, tds_dstr_cstr(&login->client_charset)); } else if (!strcmp(option, TDS_STR_USE_UTF_16)) { login->use_utf16 = tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_STR_LANGUAGE)) { s = tds_dstr_copy(&login->language, value); } else if (!strcmp(option, TDS_STR_APPENDMODE)) { tds_g_append_mode = tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_STR_INSTANCE)) { s = tds_dstr_copy(&login->instance_name, value); } else if (!strcmp(option, TDS_STR_ENCRYPTION)) { tds_config_encryption(value, login); } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) { s = tds_dstr_copy(&login->server_name, value); } else if (!strcmp(option, TDS_STR_USENTLMV2)) { login->use_ntlmv2 = tds_config_boolean(option, value, login); login->use_ntlmv2_specified = 1; } else if (!strcmp(option, TDS_STR_USELANMAN)) { login->use_lanman = tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_STR_REALM)) { s = tds_dstr_copy(&login->server_realm_name, value); } else if (!strcmp(option, TDS_STR_SPN)) { s = tds_dstr_copy(&login->server_spn, value); } else if (!strcmp(option, TDS_STR_CAFILE)) { s = tds_dstr_copy(&login->cafile, value); } else if (!strcmp(option, TDS_STR_CRLFILE)) { s = tds_dstr_copy(&login->crlfile, value); } else if (!strcmp(option, TDS_STR_CHECKSSLHOSTNAME)) { login->check_ssl_hostname = tds_config_boolean(option, value, login); } else if (!strcmp(option, TDS_STR_DBFILENAME)) { s = tds_dstr_copy(&login->db_filename, value); } else if (!strcmp(option, TDS_STR_DATABASE)) { s = tds_dstr_copy(&login->database, value); } else if (!strcmp(option, TDS_STR_READONLY_INTENT)) { login->readonly_intent = tds_config_boolean(option, value, login); tdsdump_log(TDS_DBG_FUNC, "Setting ReadOnly Intent to '%s'.\n", value); } else if (!strcmp(option, TLS_STR_OPENSSL_CIPHERS)) { s = tds_dstr_copy(&login->openssl_ciphers, value); } else if (!strcmp(option, TDS_STR_ENABLE_TLS_V1)) { login->enable_tls_v1 = tds_config_boolean(option, value, login); } else { tdsdump_log(TDS_DBG_INFO1, "UNRECOGNIZED option '%s' ... ignoring.\n", option); } if (!s) login->valid_configuration = 0; } static int tds_config_login(TDSLOGIN * connection, TDSLOGIN * login) { DSTR *res = &login->server_name; if (!tds_dstr_isempty(&login->server_name)) { if (1 || tds_dstr_isempty(&connection->server_name)) res = tds_dstr_dup(&connection->server_name, &login->server_name); } if (login->tds_version) connection->tds_version = login->tds_version; if (res && !tds_dstr_isempty(&login->language)) res = tds_dstr_dup(&connection->language, &login->language); if (res && !tds_dstr_isempty(&login->server_charset)) res = tds_dstr_dup(&connection->server_charset, &login->server_charset); if (res && !tds_dstr_isempty(&login->client_charset)) { res = tds_dstr_dup(&connection->client_charset, &login->client_charset); tdsdump_log(TDS_DBG_INFO1, "tds_config_login: %s is %s.\n", "client_charset", tds_dstr_cstr(&connection->client_charset)); } if (!login->use_utf16) connection->use_utf16 = login->use_utf16; if (res && !tds_dstr_isempty(&login->database)) { res = tds_dstr_dup(&connection->database, &login->database); tdsdump_log(TDS_DBG_INFO1, "tds_config_login: %s is %s.\n", "database_name", tds_dstr_cstr(&connection->database)); } if (res && !tds_dstr_isempty(&login->client_host_name)) res = tds_dstr_dup(&connection->client_host_name, &login->client_host_name); if (res && !tds_dstr_isempty(&login->app_name)) res = tds_dstr_dup(&connection->app_name, &login->app_name); if (res && !tds_dstr_isempty(&login->user_name)) res = tds_dstr_dup(&connection->user_name, &login->user_name); if (res && !tds_dstr_isempty(&login->password)) { /* for security reason clear memory */ tds_dstr_zero(&connection->password); res = tds_dstr_dup(&connection->password, &login->password); } if (res && !tds_dstr_isempty(&login->library)) res = tds_dstr_dup(&connection->library, &login->library); if (login->encryption_level) connection->encryption_level = login->encryption_level; if (login->suppress_language) connection->suppress_language = 1; if (!login->bulk_copy) connection->bulk_copy = 0; if (login->block_size) connection->block_size = login->block_size; if (login->gssapi_use_delegation) connection->gssapi_use_delegation = login->gssapi_use_delegation; if (login->mutual_authentication) connection->mutual_authentication = login->mutual_authentication; if (login->port) connection->port = login->port; if (login->connect_timeout) connection->connect_timeout = login->connect_timeout; if (login->query_timeout) connection->query_timeout = login->query_timeout; if (!login->check_ssl_hostname) connection->check_ssl_hostname = login->check_ssl_hostname; if (res && !tds_dstr_isempty(&login->db_filename)) res = tds_dstr_dup(&connection->db_filename, &login->db_filename); if (res && !tds_dstr_isempty(&login->openssl_ciphers)) res = tds_dstr_dup(&connection->openssl_ciphers, &login->openssl_ciphers); if (res && !tds_dstr_isempty(&login->server_spn)) res = tds_dstr_dup(&connection->server_spn, &login->server_spn); /* copy other info not present in configuration file */ connection->capabilities = login->capabilities; if (login->readonly_intent) connection->readonly_intent = login->readonly_intent; connection->use_new_password = login->use_new_password; if (login->use_ntlmv2_specified) { connection->use_ntlmv2_specified = login->use_ntlmv2_specified; connection->use_ntlmv2 = login->use_ntlmv2; } if (res) res = tds_dstr_dup(&connection->new_password, &login->new_password); return res != NULL; } static int tds_config_env_tdsdump(TDSLOGIN * login) { char *s = getenv("TDSDUMP"); if (!s) return 1; if (!strlen(s)) { char *path; pid_t pid = getpid(); if (asprintf(&path, pid_logpath, (int) pid) < 0) return 0; if (!tds_dstr_set(&login->dump_file, path)) { free(path); return 0; } } else { if (!tds_dstr_copy(&login->dump_file, s)) return 0; } tdsdump_log(TDS_DBG_INFO1, "Setting 'dump_file' to '%s' from $TDSDUMP.\n", tds_dstr_cstr(&login->dump_file)); return 1; } static void tds_config_env_tdsport(TDSLOGIN * login) { char *s; if ((s = getenv("TDSPORT"))) { login->port = tds_lookup_port(s); tds_dstr_empty(&login->instance_name); tdsdump_log(TDS_DBG_INFO1, "Setting 'port' to %s from $TDSPORT.\n", s); } return; } static void tds_config_env_tdsver(TDSLOGIN * login) { char *tdsver; if ((tdsver = getenv("TDSVER"))) { TDS_USMALLINT *pver = tds_config_verstr(tdsver, login); tdsdump_log(TDS_DBG_INFO1, "TDS version %sset to %s from $TDSVER.\n", (pver? "":"not "), tdsver); } return; } /* TDSHOST env var, pkleef@openlinksw.com 01/21/02 */ static int tds_config_env_tdshost(TDSLOGIN * login) { const char *tdshost; char tmp[128]; struct addrinfo *addrs; if (!(tdshost = getenv("TDSHOST"))) return 1; if (TDS_FAILED(tds_lookup_host_set(tdshost, &login->ip_addrs))) { tdsdump_log(TDS_DBG_WARN, "Name resolution failed for '%s' from $TDSHOST.\n", tdshost); return 0; } if (!tds_dstr_copy(&login->server_host_name, tdshost)) return 0; for (addrs = login->ip_addrs; addrs != NULL; addrs = addrs->ai_next) { tdsdump_log(TDS_DBG_INFO1, "Setting IP Address to %s (%s) from $TDSHOST.\n", tds_addrinfo2str(addrs, tmp, sizeof(tmp)), tdshost); } return 1; } #define TDS_FIND(k,b,c) tds_find(k, b, TDS_VECTOR_SIZE(b), sizeof(b[0]), c) static const void * tds_find(const void *key, const void *base, size_t nelem, size_t width, int (*compar)(const void *, const void *)) { size_t n; const char *p = (const char*) base; for (n = nelem; n != 0; --n) { if (0 == compar(key, p)) return p; p += width; } return NULL; } struct tdsvername_t { const char name[6]; TDS_USMALLINT version; }; static int tds_vername_cmp(const void *key, const void *pelem) { return strcmp((const char *)key, ((const struct tdsvername_t *)pelem)->name); } /** * Set TDS version from given string * @param tdsver tds string version * @param login where to store information * @return as encoded hex value: high nybble major, low nybble minor. */ TDS_USMALLINT * tds_config_verstr(const char *tdsver, TDSLOGIN * login) { static const struct tdsvername_t tds_versions[] = { { "0", 0x000 } , {"auto", 0x000 } , { "4.2", 0x402 } , { "50", 0x500 } , { "5.0", 0x500 } , { "70", 0x700 } , { "7.0", 0x700 } , { "7.1", 0x701 } , { "7.2", 0x702 } , { "7.3", 0x703 } , { "7.4", 0x704 } }; const struct tdsvername_t *pver; if (!login) { assert(login); return NULL; } if ((pver = (const struct tdsvername_t *) TDS_FIND(tdsver, tds_versions, tds_vername_cmp)) == NULL) { tdsdump_log(TDS_DBG_INFO1, "error: no such version: %s\n", tdsver); return NULL; } login->tds_version = pver->version; tdsdump_log(TDS_DBG_INFO1, "Setting tds version to %s (0x%0x).\n", tdsver, pver->version); return &login->tds_version; } /** * Set the full name of interface file * @param interf file name */ TDSRET tds_set_interfaces_file_loc(const char *interf) { /* Free it if already set */ if (interf_file != NULL) TDS_ZERO_FREE(interf_file); /* If no filename passed, leave it NULL */ if ((interf == NULL) || (interf[0] == '\0')) { return TDS_SUCCESS; } /* Set to new value */ if ((interf_file = strdup(interf)) == NULL) { return TDS_FAIL; } return TDS_SUCCESS; } /** * Get the IP address for a hostname. Store server's IP address * in the string 'ip' in dotted-decimal notation. (The "hostname" might itself * be a dotted-decimal address. * * If we can't determine the IP address then 'ip' will be set to empty * string. */ /* TODO callers seem to set always connection info... change it */ struct addrinfo * tds_lookup_host(const char *servername) /* (I) name of the server */ { struct addrinfo hints, *addr = NULL; assert(servername != NULL); memset(&hints, '\0', sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; #ifdef AI_ADDRCONFIG hints.ai_flags |= AI_ADDRCONFIG; #endif if (getaddrinfo(servername, NULL, &hints, &addr)) return NULL; return addr; } TDSRET tds_lookup_host_set(const char *servername, struct addrinfo **addr) { struct addrinfo *newaddr; assert(servername != NULL && addr != NULL); if ((newaddr = tds_lookup_host(servername)) != NULL) { if (*addr != NULL) freeaddrinfo(*addr); *addr = newaddr; return TDS_SUCCESS; } return TDS_FAIL; } /** * Given a portname lookup the port. * * If we can't determine the port number then return 0. */ static int tds_lookup_port(const char *portname) { int num = atoi(portname); if (!num) num = tds_getservice(portname); return num; } /* TODO same code in convert.c ?? */ static int hexdigit(int c) { if (c >= '0' && c <= '9') return c - '0'; /* ascii optimization, 'A' -> 'a', 'a' -> 'a' */ c |= 0x20; if (c >= 'a' && c <= 'f') return c - 'a' + 10; return 0; /* bad hex digit */ } static int hex2num(char *hex) { return hexdigit(hex[0]) * 16 + hexdigit(hex[1]); } /** * Open and read the file 'file' searching for a logical server * by the name of 'host'. If one is found then lookup * the IP address and port number and store them in 'login' * * \param dir name of base directory for interface file * \param file name of the interface file * \param host logical host to search for * \return 0 if not fount 1 if found */ static int search_interface_file(TDSLOGIN * login, const char *dir, const char *file, const char *host) { char *pathname; char line[255]; char tmp_ip[sizeof(line)]; char tmp_port[sizeof(line)]; char tmp_ver[sizeof(line)]; FILE *in; char *field; int found = 0; int server_found = 0; char *lasts; line[0] = '\0'; tmp_ip[0] = '\0'; tmp_port[0] = '\0'; tmp_ver[0] = '\0'; tdsdump_log(TDS_DBG_INFO1, "Searching interfaces file %s/%s.\n", dir, file); pathname = tds_new(char, strlen(dir) + strlen(file) + 10); if (!pathname) return 0; /* * create the full pathname to the interface file */ if (file[0] == '\0') { pathname[0] = '\0'; } else { if (dir[0] == '\0') { pathname[0] = '\0'; } else { strcpy(pathname, dir); strcat(pathname, TDS_SDIR_SEPARATOR); } strcat(pathname, file); } /* * parse the interfaces file and find the server and port */ if ((in = fopen(pathname, "r")) == NULL) { tdsdump_log(TDS_DBG_INFO1, "Couldn't open %s.\n", pathname); free(pathname); return 0; } tdsdump_log(TDS_DBG_INFO1, "Interfaces file %s opened.\n", pathname); while (fgets(line, sizeof(line) - 1, in)) { if (line[0] == '#') continue; /* comment */ if (!TDS_ISSPACE(line[0])) { field = strtok_r(line, "\n\t ", &lasts); if (!strcmp(field, host)) { found = 1; tdsdump_log(TDS_DBG_INFO1, "Found matching entry for host %s.\n", host); } else found = 0; } else if (found && TDS_ISSPACE(line[0])) { field = strtok_r(line, "\n\t ", &lasts); if (field != NULL && !strcmp(field, "query")) { field = strtok_r(NULL, "\n\t ", &lasts); /* tcp or tli */ if (!strcmp(field, "tli")) { tdsdump_log(TDS_DBG_INFO1, "TLI service.\n"); field = strtok_r(NULL, "\n\t ", &lasts); /* tcp */ field = strtok_r(NULL, "\n\t ", &lasts); /* device */ field = strtok_r(NULL, "\n\t ", &lasts); /* host/port */ if (strlen(field) >= 18) { sprintf(tmp_port, "%d", hex2num(&field[6]) * 256 + hex2num(&field[8])); sprintf(tmp_ip, "%d.%d.%d.%d", hex2num(&field[10]), hex2num(&field[12]), hex2num(&field[14]), hex2num(&field[16])); tdsdump_log(TDS_DBG_INFO1, "tmp_port = %s. tmp_ip = %s.\n", tmp_port, tmp_ip); } } else { field = strtok_r(NULL, "\n\t ", &lasts); /* ether */ strcpy(tmp_ver, field); field = strtok_r(NULL, "\n\t ", &lasts); /* host */ strcpy(tmp_ip, field); tdsdump_log(TDS_DBG_INFO1, "host field %s.\n", tmp_ip); field = strtok_r(NULL, "\n\t ", &lasts); /* port */ strcpy(tmp_port, field); } /* else */ server_found = 1; } /* if */ } /* else if */ } /* while */ fclose(in); free(pathname); /* * Look up the host and service */ if (server_found) { if (TDS_SUCCEED(tds_lookup_host_set(tmp_ip, &login->ip_addrs))) { struct addrinfo *addrs; if (!tds_dstr_copy(&login->server_host_name, tmp_ip)) return 0; for (addrs = login->ip_addrs; addrs != NULL; addrs = addrs->ai_next) { tdsdump_log(TDS_DBG_INFO1, "Resolved IP as '%s'.\n", tds_addrinfo2str(login->ip_addrs, line, sizeof(line))); } } else { tdsdump_log(TDS_DBG_WARN, "Name resolution failed for IP '%s'.\n", tmp_ip); } if (tmp_port[0]) login->port = tds_lookup_port(tmp_port); if (tmp_ver[0]) tds_config_verstr(tmp_ver, login); } return server_found; } /* search_interface_file() */ /** * Try to find the IP number and port for a (possibly) logical server name. * * @note This function uses only the interfaces file and is deprecated. */ static int tds_read_interfaces(const char *server, TDSLOGIN * login) { int found = 0; /* read $SYBASE/interfaces */ if (!server || !server[0]) { server = getenv("TDSQUERY"); if (!server || !server[0]) server = "SYBASE"; tdsdump_log(TDS_DBG_INFO1, "Setting server to %s from $TDSQUERY.\n", server); } tdsdump_log(TDS_DBG_INFO1, "Looking for server %s....\n", server); /* * Look for the server in the interf_file iff interf_file has been set. */ if (interf_file) { tdsdump_log(TDS_DBG_INFO1, "Looking for server in file %s.\n", interf_file); found = search_interface_file(login, "", interf_file, server); } /* * if we haven't found the server yet then look for a $HOME/.interfaces file */ if (!found) { char *path = tds_get_home_file(".interfaces"); if (path) { tdsdump_log(TDS_DBG_INFO1, "Looking for server in %s.\n", path); found = search_interface_file(login, "", path, server); free(path); } } /* * if we haven't found the server yet then look in $SYBBASE/interfaces file */ if (!found) { const char *sybase = getenv("SYBASE"); #ifdef __VMS /* We've got to be in unix syntax for later slash-joined concatenation. */ #include const char *unixspec = decc$translate_vms(sybase); if ( (int)unixspec != 0 && (int)unixspec != -1 ) sybase = unixspec; #endif if (!sybase || !sybase[0]) sybase = interfaces_path; tdsdump_log(TDS_DBG_INFO1, "Looking for server in %s/interfaces.\n", sybase); found = search_interface_file(login, sybase, "interfaces", server); } /* * If we still don't have the server and port then assume the user * typed an actual server host name. */ if (!found) { int ip_port; const char *env_port; /* * Make a guess about the port number */ if (login->port == 0) { /* * Not set in the [global] section of the * configure file, take a guess. */ ip_port = TDS_DEF_PORT; } else { /* * Preserve setting from the [global] section * of the configure file. */ ip_port = login->port; } if ((env_port = getenv("TDSPORT")) != NULL) { ip_port = tds_lookup_port(env_port); tdsdump_log(TDS_DBG_INFO1, "Setting 'ip_port' to %s from $TDSPORT.\n", env_port); } else tdsdump_log(TDS_DBG_INFO1, "Setting 'ip_port' to %d as a guess.\n", ip_port); /* * look up the host */ if (TDS_SUCCEED(tds_lookup_host_set(server, &login->ip_addrs))) if (!tds_dstr_copy(&login->server_host_name, server)) return 0; if (ip_port) login->port = ip_port; } return found; } /** * Check the server name to find port info first * Warning: connection-> & login-> are all modified when needed * \return 1 when found, else 0 */ static int parse_server_name_for_port(TDSLOGIN * connection, TDSLOGIN * login, bool update_server) { const char *pSep; const char *server; /* seek the ':' in login server_name */ server = tds_dstr_cstr(&login->server_name); /* IPv6 address can be quoted */ if (server[0] == '[') { pSep = strstr(server, "]:"); if (pSep) ++pSep; } else { pSep = strrchr(server, ':'); } if (pSep && pSep != server) { /* yes, i found it! */ /* modify connection-> && login->server_name & ->port */ login->port = connection->port = atoi(pSep + 1); tds_dstr_empty(&connection->instance_name); } else { /* handle instance name */ pSep = strrchr(server, '\\'); if (!pSep || pSep == server) return 0; if (!tds_dstr_copy(&connection->instance_name, pSep + 1)) return 0; connection->port = 0; } if (!update_server || !tds_dstr_copyn(&connection->server_name, server, pSep - server)) return 0; return 1; } /** * Return a structure capturing the compile-time settings provided to the * configure script. */ const TDS_COMPILETIME_SETTINGS * tds_get_compiletime_settings(void) { static const TDS_COMPILETIME_SETTINGS settings = { TDS_VERSION_NO , FREETDS_SYSCONFDIR , "unknown" /* need fancy script in makefile */ # if TDS50 , "5.0" # elif TDS71 , "7.1" # elif TDS72 , "7.2" # elif TDS73 , "7.3" # elif TDS74 , "7.4" # else , "auto" # endif # ifdef MSDBLIB , true # else , false # endif # ifdef TDS_SYBASE_COMPAT , true # else , false # endif # ifdef _REENTRANT , true # else , false # endif # ifdef HAVE_ICONV , true # else , false # endif # ifdef IODBC , true # else , false # endif # ifdef UNIXODBC , true # else , false # endif # ifdef HAVE_OPENSSL , true # else , false # endif # ifdef HAVE_GNUTLS , true # else , false # endif # if ENABLE_ODBC_MARS , true # else , false # endif # ifdef HAVE_SSPI , true # else , false # endif # ifdef ENABLE_KRB5 , true # else , false # endif }; assert(settings.tdsver); return &settings; } /** @} */ freetds-1.3.6/src/tds/query.c000644 025423 025423 00000277432 14056414271 017520 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include #include #include #include #include #include static TDSRET tds5_put_params(TDSSOCKET * tds, TDSPARAMINFO * info, int flags) TDS_WUR; static void tds7_put_query_params(TDSSOCKET * tds, const char *query, size_t query_len); static TDSRET tds_put_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int flags); static inline TDSRET tds_put_data(TDSSOCKET * tds, TDSCOLUMN * curcol); static TDSRET tds7_write_param_def_from_query(TDSSOCKET * tds, const char* converted_query, size_t converted_query_len, TDSPARAMINFO * params) TDS_WUR; static TDSRET tds7_write_param_def_from_params(TDSSOCKET * tds, const char* query, size_t query_len, TDSPARAMINFO * params) TDS_WUR; static TDSRET tds_put_param_as_string(TDSSOCKET * tds, TDSPARAMINFO * params, int n); static TDSRET tds_send_emulated_execute(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params); static int tds_count_placeholders_ucs2le(const char *query, const char *query_end); #define TDS_PUT_DATA_USE_NAME 1 #define TDS_PUT_DATA_PREFIX_NAME 2 #define TDS_PUT_DATA_LONG_STATUS 4 #undef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #undef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) /* All manner of client to server submittal functions */ /** * \ingroup libtds * \defgroup query Query * Function to handle query. */ /** * \addtogroup query * @{ */ /** * Accept an ASCII string, convert it to UCS2-LE * The input is NUL-terminated, but the output does not contains the NUL. * \param buffer buffer where to store output * \param buf string to write * \return bytes written */ static size_t tds_ascii_to_ucs2(char *buffer, const char *buf) { char *s; assert(buffer && buf && *buf); /* This is an internal function. Call it correctly. */ for (s = buffer; *buf != '\0'; ++buf) { *s++ = *buf; *s++ = '\0'; } return s - buffer; } /** * Utility to convert a constant ascii string to ucs2 and send to server. * Used to send internal store procedure names to server. * \tds * \param s constanst string to send */ #define TDS_PUT_N_AS_UCS2(tds, s) do { \ char buffer[sizeof(s)*2-2]; \ tds_put_smallint(tds, sizeof(buffer)/2); \ tds_put_n(tds, buffer, tds_ascii_to_ucs2(buffer, s)); \ } while(0) /** * Convert a string in an allocated buffer * \param tds state information for the socket and the TDS protocol * \param char_conv information about the encodings involved * \param s input string * \param len input string length (in bytes), -1 for NUL-terminated * \param out_len returned output length (in bytes) * \return string allocated (or input pointer if no conversion required) or NULL if error */ const char * tds_convert_string(TDSSOCKET * tds, TDSICONV * char_conv, const char *s, int len, size_t *out_len) { char *buf; const char *ib; char *ob; size_t il, ol; /* char_conv is only mostly const */ TDS_ERRNO_MESSAGE_FLAGS *suppress = (TDS_ERRNO_MESSAGE_FLAGS*) &char_conv->suppress; CHECK_TDS_EXTRA(tds); il = len < 0 ? strlen(s) : (size_t) len; if (char_conv->flags == TDS_ENCODING_MEMCPY) { *out_len = il; return s; } /* allocate needed buffer (+1 is to exclude 0 case) */ ol = il * char_conv->to.charset.max_bytes_per_char / char_conv->from.charset.min_bytes_per_char + 1; buf = tds_new(char, ol); if (!buf) return NULL; ib = s; ob = buf; memset(suppress, 0, sizeof(char_conv->suppress)); if (tds_iconv(tds, char_conv, to_server, &ib, &il, &ob, &ol) == (size_t)-1) { free(buf); return NULL; } *out_len = ob - buf; return buf; } #if ENABLE_EXTRA_CHECKS void tds_convert_string_free(const char *original, const char *converted) { if (original != converted) free((char *) converted); } #endif /** * Flush query packet. * Used at the end of packet write to really send packet to server. * This also changes the state to TDS_PENDING. * \tds */ static TDSRET tds_query_flush_packet(TDSSOCKET *tds) { TDSRET ret = tds_flush_packet(tds); /* TODO depend on result ?? */ tds_set_state(tds, TDS_PENDING); return ret; } /** * Set current dynamic. * \tds * \param dyn dynamic to set */ void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn) { if (dyn) ++dyn->ref_count; tds_release_cur_dyn(tds); tds->cur_dyn = dyn; } /** * Sends a language string to the database server for * processing. TDS 4.2 is a plain text message with a packet type of 0x01, * TDS 7.0 is a unicode string with packet type 0x01, and TDS 5.0 uses a * TDS_LANGUAGE_TOKEN to encapsulate the query and a packet type of 0x0f. * \tds * \param query language query to submit * \return TDS_FAIL or TDS_SUCCESS */ TDSRET tds_submit_query(TDSSOCKET * tds, const char *query) { return tds_submit_query_params(tds, query, NULL, NULL); } /** * Substitute ?-style placeholders with named (\@param) ones. * Sybase does not support ?-style placeholders so convert them. * Also the function replace parameter names. * \param query query string * \param[in,out] query_len pointer to query length. * On input length of input query, on output length * of output query * \param params parameters to send to server * \returns new query or NULL on error */ static char * tds5_fix_dot_query(const char *query, size_t *query_len, TDSPARAMINFO * params) { int i; size_t len, pos; const char *e, *s; size_t size = *query_len + 30; char colname[32]; char *out; out = tds_new(char, size); if (!out) goto memory_error; pos = 0; s = query; for (i = 0;; ++i) { e = tds_next_placeholder(s); len = e ? e - s : strlen(s); if (pos + len + 12 >= size) { size = pos + len + 30; if (!TDS_RESIZE(out, size)) goto memory_error; } memcpy(out + pos, s, len); pos += len; if (!e) break; pos += sprintf(out + pos, "@P%d", i + 1); if (!params || i >= params->num_cols) goto memory_error; sprintf(colname, "@P%d", i + 1); if (!tds_dstr_copy(¶ms->columns[i]->column_name, colname)) goto memory_error; s = e + 1; } out[pos] = 0; *query_len = pos; return out; memory_error: free(out); return NULL; } /** * Write data to wire * \tds * \param curcol column where store column information * \return TDS_FAIL on error or TDS_SUCCESS */ static inline TDSRET tds_put_data(TDSSOCKET * tds, TDSCOLUMN * curcol) { return curcol->funcs->put_data(tds, curcol, 0); } /** * Start query packet of a given type * \tds * \param packet_type packet type * \param head extra information to put in a TDS7 header */ static TDSRET tds_start_query_head(TDSSOCKET *tds, unsigned char packet_type, TDSHEADERS * head) { tds->out_flag = packet_type; if (IS_TDS72_PLUS(tds->conn)) { TDSFREEZE outer; tds_freeze(tds, &outer, 4); /* total length */ tds_put_int(tds, 18); /* length: transaction descriptor */ tds_put_smallint(tds, 2); /* type: transaction descriptor */ tds_put_n(tds, tds->conn->tds72_transaction, 8); /* transaction */ tds_put_int(tds, 1); /* request count */ if (head && head->qn_msgtext && head->qn_options) { TDSFREEZE query; tds_freeze(tds, &query, 4); /* length: query notification */ tds_put_smallint(tds, 1); /* type: query notification */ TDS_START_LEN_USMALLINT(tds) { tds_put_string(tds, head->qn_msgtext, -1); /* notifyid */ } TDS_END_LEN TDS_START_LEN_USMALLINT(tds) { tds_put_string(tds, head->qn_options, -1); /* ssbdeployment */ } TDS_END_LEN if (head->qn_timeout != 0) tds_put_int(tds, head->qn_timeout); /* timeout */ tds_freeze_close_len(&query, tds_freeze_written(&query)); } tds_freeze_close_len(&outer, tds_freeze_written(&outer)); } return TDS_SUCCESS; } /** * Start query packet of a given type * \tds * \param packet_type packet type */ void tds_start_query(TDSSOCKET *tds, unsigned char packet_type) { /* no need to check return value here because tds_start_query_head() cannot fail when given a NULL head parameter */ tds_start_query_head(tds, packet_type, NULL); } /** * Sends a language string to the database server for * processing. TDS 4.2 is a plain text message with a packet type of 0x01, * TDS 7.0 is a unicode string with packet type 0x01, and TDS 5.0 uses a * TDS_LANGUAGE_TOKEN to encapsulate the query and a packet type of 0x0f. * \tds * \param query language query to submit * \param params parameters of query * \return TDS_FAIL or TDS_SUCCESS */ TDSRET tds_submit_query_params(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params, TDSHEADERS * head) { size_t query_len; int num_params = params ? params->num_cols : 0; CHECK_TDS_EXTRA(tds); if (params) CHECK_PARAMINFO_EXTRA(params); if (!query) return TDS_FAIL; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; query_len = strlen(query); if (IS_TDS50(tds->conn)) { char *new_query = NULL; /* are there '?' style parameters ? */ if (tds_next_placeholder(query)) { if ((new_query = tds5_fix_dot_query(query, &query_len, params)) == NULL) { tds_set_state(tds, TDS_IDLE); return TDS_FAIL; } query = new_query; } tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS_LANGUAGE_TOKEN); TDS_START_LEN_UINT(tds) { tds_put_byte(tds, params ? 1 : 0); /* 1 if there are params, 0 otherwise */ tds_put_string(tds, query, query_len); } TDS_END_LEN if (params) { /* add on parameters */ int flags = tds_dstr_isempty(¶ms->columns[0]->column_name) ? 0 : TDS_PUT_DATA_USE_NAME; TDS_PROPAGATE(tds5_put_params(tds, params, flags)); } free(new_query); } else if (!IS_TDS7_PLUS(tds->conn) || !params || !params->num_cols) { if (tds_start_query_head(tds, TDS_QUERY, head) != TDS_SUCCESS) return TDS_FAIL; tds_put_string(tds, query, (int)query_len); } else { TDSCOLUMN *param; int count, i; size_t converted_query_len; const char *converted_query; TDSFREEZE outer; TDSRET rc; converted_query = tds_convert_string(tds, tds->conn->char_convs[client2ucs2], query, (int)query_len, &converted_query_len); if (!converted_query) { tds_set_state(tds, TDS_IDLE); return TDS_FAIL; } count = tds_count_placeholders_ucs2le(converted_query, converted_query + converted_query_len); if (tds_start_query_head(tds, TDS_RPC, head) != TDS_SUCCESS) { tds_convert_string_free(query, converted_query); return TDS_FAIL; } tds_freeze(tds, &outer, 0); /* procedure name */ if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_EXECUTESQL); } else { TDS_PUT_N_AS_UCS2(tds, "sp_executesql"); } tds_put_smallint(tds, 0); /* string with sql statement */ if (!count) { tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBNTEXT); /* must be Ntype */ TDS_PUT_INT(tds, converted_query_len); if (IS_TDS71_PLUS(tds->conn)) tds_put_n(tds, tds->conn->collation, 5); TDS_PUT_INT(tds, converted_query_len); tds_put_n(tds, converted_query, converted_query_len); rc = tds7_write_param_def_from_params(tds, converted_query, converted_query_len, params); } else { tds7_put_query_params(tds, converted_query, converted_query_len); rc = tds7_write_param_def_from_query(tds, converted_query, converted_query_len, params); } tds_convert_string_free(query, converted_query); if (TDS_FAILED(rc)) { tds_freeze_abort(&outer); return rc; } tds_freeze_close(&outer); for (i = 0; i < num_params; i++) { param = params->columns[i]; TDS_PROPAGATE(tds_put_data_info(tds, param, 0)); TDS_PROPAGATE(tds_put_data(tds, param)); } tds->current_op = TDS_OP_EXECUTESQL; } return tds_query_flush_packet(tds); } /** * Format and submit a query * \tds * \param queryf query format. printf like expansion is performed on * this query. */ TDSRET tds_submit_queryf(TDSSOCKET * tds, const char *queryf, ...) { va_list ap; char *query = NULL; TDSRET rc = TDS_FAIL; CHECK_TDS_EXTRA(tds); va_start(ap, queryf); if (vasprintf(&query, queryf, ap) >= 0) { rc = tds_submit_query(tds, query); free(query); } va_end(ap); return rc; } /** * Skip a comment in a query * \param s start of the string (or part of it) * \returns pointer to end of comment */ const char * tds_skip_comment(const char *s) { const char *p = s; if (*p == '-' && p[1] == '-') { for (;*++p != '\0';) if (*p == '\n') return p + 1; } else if (*p == '/' && p[1] == '*') { ++p; for(;*++p != '\0';) if (*p == '*' && p[1] == '/') return p + 2; } else ++p; return p; } /** * Skip quoting string (like 'sfsf', "dflkdj" or [dfkjd]) * \param s pointer to first quoting character. @verbatim Should be ', " or [. @endverbatim * \return character after quoting */ const char * tds_skip_quoted(const char *s) { const char *p = s; char quote = (*s == '[') ? ']' : *s; for (; *++p;) { if (*p == quote) { if (*++p != quote) return p; } } return p; } /** * Get position of next placeholder * \param start pointer to part of query to search * \return next placeholder or NULL if not found */ const char * tds_next_placeholder(const char *start) { const char *p = start; if (!p) return NULL; for (;;) { switch (*p) { case '\0': return NULL; case '\'': case '\"': case '[': p = tds_skip_quoted(p); break; case '-': case '/': p = tds_skip_comment(p); break; case '?': return p; default: ++p; break; } } } /** * Count the number of placeholders ('?') in a query * \param query query string */ int tds_count_placeholders(const char *query) { const char *p = query - 1; int count = 0; for (;; ++count) { if (!(p = tds_next_placeholder(p + 1))) return count; } } /** * Skip a comment in a query * \param s start of the string (or part of it). Encoded in ucs2le * \param end end of string * \returns pointer to end of comment */ static const char * tds_skip_comment_ucs2le(const char *s, const char *end) { const char *p = s; if (p+4 <= end && memcmp(p, "-\0-", 4) == 0) { for (;(p+=2) < end;) if (p[0] == '\n' && p[1] == 0) return p + 2; } else if (p+4 <= end && memcmp(p, "/\0*", 4) == 0) { p += 2; end -= 2; for(;(p+=2) < end;) if (memcmp(p, "*\0/", 4) == 0) return p + 4; return end + 2; } else p += 2; return p; } /** * Return pointer to end of a quoted string. * At the beginning pointer should point to delimiter. * \param s start of string to skip encoded in ucs2le * \param end pointer to end of string */ static const char * tds_skip_quoted_ucs2le(const char *s, const char *end) { const char *p = s; char quote = (*s == '[') ? ']' : *s; assert(s[1] == 0 && s < end && (end - s) % 2 == 0); for (; (p += 2) != end;) { if (p[0] == quote && !p[1]) { p += 2; if (p == end || p[0] != quote || p[1]) return p; } } return p; } /** * Found the next placeholder (? or \@param) in a string. * String must be encoded in ucs2le. * \param start start of the string (or part of it) * \param end end of string * \param named true if named parameters should be returned * \returns either start of next placeholder or end if not found */ static const char * tds_next_placeholder_ucs2le(const char *start, const char *end, int named) { const char *p = start; char prev = ' ', c; assert(p && start <= end && (end - start) % 2 == 0); for (; p != end;) { if (p[1]) { prev = ' '; p += 2; continue; } c = p[0]; switch (c) { case '\'': case '\"': case '[': p = tds_skip_quoted_ucs2le(p, end); break; case '-': case '/': p = tds_skip_comment_ucs2le(p, end); c = ' '; break; case '?': return p; case '@': if (named && !isalnum((unsigned char) prev)) return p; default: p += 2; break; } prev = c; } return end; } /** * Count the number of placeholders ('?') in a query * \param query query encoded in ucs2le * \param query_end end of query * \return number of placeholders found */ static int tds_count_placeholders_ucs2le(const char *query, const char *query_end) { const char *p = query - 2; int count = 0; for (;; ++count) { if ((p = tds_next_placeholder_ucs2le(p + 2, query_end, 0)) == query_end) return count; } } /** * Return declaration for column (like "varchar(20)"). * * This depends on: * - on_server.column_type * - varint_size (for varchar(max) distinction) * - column_size * - precision/scale (numeric) * * \tds * \param curcol column * \param out buffer to hold declaration * \return TDS_FAIL or TDS_SUCCESS */ TDSRET tds_get_column_declaration(TDSSOCKET * tds, TDSCOLUMN * curcol, char *out) { const char *fmt = NULL; /* unsigned int is required by printf format, don't use size_t */ unsigned int max_len = IS_TDS7_PLUS(tds->conn) ? 8000 : 255; unsigned int size; CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); size = tds_fix_column_size(tds, curcol); switch (tds_get_conversion_type(curcol->on_server.column_type, curcol->on_server.column_size)) { case XSYBCHAR: case SYBCHAR: fmt = "CHAR(%u)"; break; case SYBVARCHAR: case XSYBVARCHAR: if (curcol->column_varint_size == 8) fmt = "VARCHAR(MAX)"; else fmt = "VARCHAR(%u)"; break; case SYBUINT1: case SYBINT1: fmt = "TINYINT"; break; case SYBINT2: fmt = "SMALLINT"; break; case SYBINT4: fmt = "INT"; break; case SYBINT8: /* TODO even for Sybase ?? */ fmt = "BIGINT"; break; case SYBFLT8: fmt = "FLOAT"; break; case SYBDATETIME: fmt = "DATETIME"; break; case SYBDATE: fmt = "DATE"; break; case SYBTIME: fmt = "TIME"; break; case SYBBIT: fmt = "BIT"; break; case SYBTEXT: fmt = "TEXT"; break; case SYBLONGBINARY: /* TODO correct ?? */ case SYBIMAGE: fmt = "IMAGE"; break; case SYBMONEY4: fmt = "SMALLMONEY"; break; case SYBMONEY: fmt = "MONEY"; break; case SYBDATETIME4: fmt = "SMALLDATETIME"; break; case SYBREAL: fmt = "REAL"; break; case SYBBINARY: case XSYBBINARY: fmt = "BINARY(%u)"; break; case SYBVARBINARY: case XSYBVARBINARY: if (curcol->column_varint_size == 8) fmt = "VARBINARY(MAX)"; else fmt = "VARBINARY(%u)"; break; case SYBNUMERIC: fmt = "NUMERIC(%d,%d)"; goto numeric_decimal; case SYBDECIMAL: fmt = "DECIMAL(%d,%d)"; numeric_decimal: sprintf(out, fmt, curcol->column_prec, curcol->column_scale); return TDS_SUCCESS; break; case SYBUNIQUE: if (IS_TDS7_PLUS(tds->conn)) fmt = "UNIQUEIDENTIFIER"; break; case SYBNTEXT: if (IS_TDS7_PLUS(tds->conn)) fmt = "NTEXT"; break; case SYBNVARCHAR: case XSYBNVARCHAR: if (curcol->column_varint_size == 8) { fmt = "NVARCHAR(MAX)"; } else if (IS_TDS7_PLUS(tds->conn)) { fmt = "NVARCHAR(%u)"; max_len = 4000; size /= 2u; } break; case XSYBNCHAR: if (IS_TDS7_PLUS(tds->conn)) { fmt = "NCHAR(%u)"; max_len = 4000; size /= 2u; } break; case SYBVARIANT: if (IS_TDS7_PLUS(tds->conn)) fmt = "SQL_VARIANT"; break; /* TODO support scale !! */ case SYBMSTIME: fmt = "TIME"; break; case SYBMSDATE: fmt = "DATE"; break; case SYBMSDATETIME2: fmt = "DATETIME2"; break; case SYBMSDATETIMEOFFSET: fmt = "DATETIMEOFFSET"; break; case SYB5BIGTIME: fmt = "BIGTIME"; break; case SYB5BIGDATETIME: fmt = "BIGDATETIME"; break; case SYBUINT2: fmt = "UNSIGNED SMALLINT"; break; case SYBUINT4: fmt = "UNSIGNED INT"; break; case SYBUINT8: fmt = "UNSIGNED BIGINT"; break; /* nullable types should not occur here... */ case SYBFLTN: case SYBMONEYN: case SYBDATETIMN: case SYBBITN: case SYBINTN: assert(0); /* TODO... */ case SYBVOID: case SYBSINT1: default: tdsdump_log(TDS_DBG_ERROR, "Unknown type %d\n", tds_get_conversion_type(curcol->on_server.column_type, curcol->on_server.column_size)); break; } if (fmt) { /* fill out */ sprintf(out, fmt, size > 0 ? MIN(size, max_len) : 1u); return TDS_SUCCESS; } out[0] = 0; return TDS_FAIL; } /** * Write string with parameters definition, useful for TDS7+. * Looks like "@P1 INT, @P2 VARCHAR(100)" * \param tds state information for the socket and the TDS protocol * \param converted_query query to send to server in ucs2le encoding * \param converted_query_len query length in bytes * \param params parameters to build declaration * \return result of write */ /* TODO find a better name for this function */ static TDSRET tds7_write_param_def_from_query(TDSSOCKET * tds, const char* converted_query, size_t converted_query_len, TDSPARAMINFO * params) { char declaration[128], *p; int i, count; size_t written; TDSFREEZE outer, inner; assert(IS_TDS7_PLUS(tds->conn)); CHECK_TDS_EXTRA(tds); if (params) CHECK_PARAMINFO_EXTRA(params); count = tds_count_placeholders_ucs2le(converted_query, converted_query + converted_query_len); /* string with parameters types */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBNTEXT); /* must be Ntype */ /* put parameters definitions */ tds_freeze(tds, &outer, 4); if (IS_TDS71_PLUS(tds->conn)) tds_put_n(tds, tds->conn->collation, 5); tds_freeze(tds, &inner, 4); for (i = 0; i < count; ++i) { p = declaration; if (i) *p++ = ','; /* get this parameter declaration */ p += sprintf(p, "@P%d ", i+1); if (!params || i >= params->num_cols) { strcpy(p, "varchar(4000)"); } else if (TDS_FAILED(tds_get_column_declaration(tds, params->columns[i], p))) { tds_freeze_abort(&inner); tds_freeze_abort(&outer); return TDS_FAIL; } tds_put_string(tds, declaration, -1); } written = tds_freeze_written(&inner) - 4; tds_freeze_close_len(&inner, written ? written : -1); tds_freeze_close_len(&outer, written); return TDS_SUCCESS; } /** * Write string with parameters definition, useful for TDS7+. * Looks like "@P1 INT, @P2 VARCHAR(100)" * \param tds state information for the socket and the TDS protocol * \param query query to send to server encoded in ucs2le * \param query_len query length in bytes * \param params parameters to build declaration * \return result of the operation */ /* TODO find a better name for this function */ static TDSRET tds7_write_param_def_from_params(TDSSOCKET * tds, const char* query, size_t query_len, TDSPARAMINFO * params) { char declaration[40]; int i; struct tds_ids { const char *p; size_t len; } *ids = NULL; TDSFREEZE outer, inner; size_t written; assert(IS_TDS7_PLUS(tds->conn)); CHECK_TDS_EXTRA(tds); if (params) CHECK_PARAMINFO_EXTRA(params); /* string with parameters types */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBNTEXT); /* must be Ntype */ /* put parameters definitions */ tds_freeze(tds, &outer, 4); if (IS_TDS71_PLUS(tds->conn)) tds_put_n(tds, tds->conn->collation, 5); tds_freeze(tds, &inner, 4); if (!params || !params->num_cols) { tds_freeze_close_len(&inner, -1); tds_freeze_close_len(&outer, 0); return TDS_SUCCESS; } /* try to detect missing names */ ids = tds_new0(struct tds_ids, params->num_cols); if (!ids) goto Cleanup; if (tds_dstr_isempty(¶ms->columns[0]->column_name)) { const char *s = query, *e, *id_end; const char *query_end = query + query_len; for (i = 0; i < params->num_cols; s = e + 2) { e = tds_next_placeholder_ucs2le(s, query_end, 1); if (e == query_end) break; if (e[0] != '@') continue; /* find end of param name */ for (id_end = e + 2; id_end != query_end; id_end += 2) if (!id_end[1] && (id_end[0] != '_' && id_end[1] != '#' && !isalnum((unsigned char) id_end[0]))) break; ids[i].p = e; ids[i].len = id_end - e; ++i; } } for (i = 0; i < params->num_cols; ++i) { if (i) tds_put_smallint(tds, ','); /* this part of buffer can be not-ascii compatible, use all ucs2... */ if (ids[i].p) { tds_put_n(tds, ids[i].p, ids[i].len); } else { tds_put_string(tds, tds_dstr_cstr(¶ms->columns[i]->column_name), tds_dstr_len(¶ms->columns[i]->column_name)); } tds_put_smallint(tds, ' '); /* get this parameter declaration */ tds_get_column_declaration(tds, params->columns[i], declaration); if (!declaration[0]) goto Cleanup; tds_put_string(tds, declaration, -1); } free(ids); written = tds_freeze_written(&inner) - 4; tds_freeze_close_len(&inner, written); tds_freeze_close_len(&outer, written); return TDS_SUCCESS; Cleanup: free(ids); tds_freeze_abort(&inner); tds_freeze_abort(&outer); return TDS_FAIL; } /** * Output params types and query (required by sp_prepare/sp_executesql/sp_prepexec) * \param tds state information for the socket and the TDS protocol * \param query query (encoded in ucs2le) * \param query_len query length in bytes */ static void tds7_put_query_params(TDSSOCKET * tds, const char *query, size_t query_len) { size_t len; int i, num_placeholders; const char *s, *e; char buf[24]; const char *const query_end = query + query_len; CHECK_TDS_EXTRA(tds); assert(IS_TDS7_PLUS(tds->conn)); /* we use all "@PX" for parameters */ num_placeholders = tds_count_placeholders_ucs2le(query, query_end); len = num_placeholders * 2; /* adjust for the length of X */ for (i = 10; i <= num_placeholders; i *= 10) { len += num_placeholders - i + 1; } /* string with sql statement */ /* replace placeholders with dummy parametes */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBNTEXT); /* must be Ntype */ len = 2u * len + query_len; TDS_PUT_INT(tds, len); if (IS_TDS71_PLUS(tds->conn)) tds_put_n(tds, tds->conn->collation, 5); TDS_PUT_INT(tds, len); s = query; /* TODO do a test with "...?" and "...?)" */ for (i = 1;; ++i) { e = tds_next_placeholder_ucs2le(s, query_end, 0); assert(e && query <= e && e <= query_end); tds_put_n(tds, s, e - s); if (e == query_end) break; sprintf(buf, "@P%d", i); tds_put_string(tds, buf, -1); s = e + 2; } } /** * Creates a temporary stored procedure in the server. * * Under TDS 4.2 dynamic statements are emulated building sql command. * TDS 5 does not uses parameters type. * TDS 7+ uses parameter types to prepare the query. You should * prepare again the query if parameters changes. * \param tds state information for the socket and the TDS protocol * \param query language query with given placeholders (?) * \param id string to identify the dynamic query. Pass NULL for automatic generation. * \param dyn_out will receive allocated TDSDYNAMIC*. Any older allocated dynamic won't be freed, Can be NULL. * \param params parameters to use. It can be NULL even if parameters are present. Used only for TDS7+ * \return TDS_FAIL or TDS_SUCCESS */ /* TODO parse all results ?? */ TDSRET tds_submit_prepare(TDSSOCKET * tds, const char *query, const char *id, TDSDYNAMIC ** dyn_out, TDSPARAMINFO * params) { int query_len; TDSRET rc = TDS_FAIL; TDSDYNAMIC *dyn; CHECK_TDS_EXTRA(tds); if (params) CHECK_PARAMINFO_EXTRA(params); if (!query || !dyn_out) return TDS_FAIL; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; /* allocate a structure for this thing */ dyn = tds_alloc_dynamic(tds->conn, id); if (!dyn) return TDS_FAIL; tds_release_dynamic(dyn_out); *dyn_out = dyn; tds_release_cur_dyn(tds); /* TDS5 sometimes cannot accept prepare so we need to store query */ if (!IS_TDS7_PLUS(tds->conn)) { dyn->query = strdup(query); if (!dyn->query) goto failure; } if (!IS_TDS50(tds->conn) && !IS_TDS7_PLUS(tds->conn)) { dyn->emulated = 1; tds_dynamic_deallocated(tds->conn, dyn); tds_set_state(tds, TDS_IDLE); return TDS_SUCCESS; } query_len = (int)strlen(query); tds_set_cur_dyn(tds, dyn); if (IS_TDS7_PLUS(tds->conn)) { size_t converted_query_len; const char *converted_query; TDSFREEZE outer; TDSRET rc; converted_query = tds_convert_string(tds, tds->conn->char_convs[client2ucs2], query, query_len, &converted_query_len); if (!converted_query) goto failure; tds_freeze(tds, &outer, 0); tds_start_query(tds, TDS_RPC); /* procedure name */ if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_PREPARE); } else { TDS_PUT_N_AS_UCS2(tds, "sp_prepare"); } tds_put_smallint(tds, 0); /* return param handle (int) */ tds_put_byte(tds, 0); tds_put_byte(tds, 1); /* result */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 0); rc = tds7_write_param_def_from_query(tds, converted_query, converted_query_len, params); tds7_put_query_params(tds, converted_query, converted_query_len); tds_convert_string_free(query, converted_query); if (TDS_FAILED(rc)) { tds_freeze_abort(&outer); return rc; } tds_freeze_close(&outer); /* options, 1 == RETURN_METADATA */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, 1); tds->current_op = TDS_OP_PREPARE; } else { tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS5_DYNAMIC_TOKEN); TDS_START_LEN_USMALLINT(tds) { tds_put_byte(tds, TDS_DYN_PREPARE); tds_put_byte(tds, 0x00); TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, dyn->id, -1); } TDS_END_LEN /* TODO how to pass parameters type? like store procedures ? */ TDS_START_LEN_USMALLINT(tds) { if (tds_capability_has_req(tds->conn, TDS_REQ_PROTO_DYNPROC)) { tds_put_n(tds, "create proc ", 12); tds_put_string(tds, dyn->id, -1); tds_put_n(tds, " as ", 4); } tds_put_string(tds, query, query_len); } TDS_END_LEN } TDS_END_LEN } rc = tds_query_flush_packet(tds); if (TDS_SUCCEED(rc)) return rc; failure: /* TODO correct if writing fail ?? */ tds_set_state(tds, TDS_IDLE); tds_release_dynamic(dyn_out); tds_dynamic_deallocated(tds->conn, dyn); return rc; } /** * Submit a prepared query with parameters * \param tds state information for the socket and the TDS protocol * \param query language query with given placeholders (?) * \param params parameters to send * \return TDS_FAIL or TDS_SUCCESS */ TDSRET tds_submit_execdirect(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params, TDSHEADERS * head) { size_t query_len; TDSCOLUMN *param; TDSDYNAMIC *dyn; size_t id_len; TDSFREEZE outer; CHECK_TDS_EXTRA(tds); CHECK_PARAMINFO_EXTRA(params); if (!query) return TDS_FAIL; query_len = strlen(query); if (IS_TDS7_PLUS(tds->conn)) { int i; size_t converted_query_len; const char *converted_query; TDSRET rc; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; converted_query = tds_convert_string(tds, tds->conn->char_convs[client2ucs2], query, (int)query_len, &converted_query_len); if (!converted_query) { tds_set_state(tds, TDS_IDLE); return TDS_FAIL; } if (tds_start_query_head(tds, TDS_RPC, head) != TDS_SUCCESS) { tds_convert_string_free(query, converted_query); return TDS_FAIL; } tds_freeze(tds, &outer, 0); /* procedure name */ if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_EXECUTESQL); } else { TDS_PUT_N_AS_UCS2(tds, "sp_executesql"); } tds_put_smallint(tds, 0); tds7_put_query_params(tds, converted_query, converted_query_len); rc = tds7_write_param_def_from_query(tds, converted_query, converted_query_len, params); tds_convert_string_free(query, converted_query); if (TDS_FAILED(rc)) { tds_freeze_abort(&outer); return rc; } tds_freeze_close(&outer); for (i = 0; i < params->num_cols; i++) { param = params->columns[i]; TDS_PROPAGATE(tds_put_data_info(tds, param, 0)); TDS_PROPAGATE(tds_put_data(tds, param)); } tds->current_op = TDS_OP_EXECUTESQL; return tds_query_flush_packet(tds); } /* allocate a structure for this thing */ dyn = tds_alloc_dynamic(tds->conn, NULL); if (!dyn) return TDS_FAIL; /* check if no parameters */ if (params && !params->num_cols) params = NULL; /* TDS 4.2, emulate prepared statements */ /* * TODO Sybase seems to not support parameters in prepared execdirect * so use language or prepare and then exec */ if (!IS_TDS50(tds->conn) || params) { TDSRET ret = TDS_SUCCESS; if (!params) { ret = tds_submit_query(tds, query); } else { dyn->emulated = 1; dyn->params = params; dyn->query = strdup(query); if (!dyn->query) ret = TDS_FAIL; if (TDS_SUCCEED(ret)) if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) ret = TDS_FAIL; if (TDS_SUCCEED(ret)) { ret = tds_send_emulated_execute(tds, dyn->query, dyn->params); if (TDS_SUCCEED(ret)) ret = tds_query_flush_packet(tds); } /* do not free our parameters */ dyn->params = NULL; } tds_dynamic_deallocated(tds->conn, dyn); tds_release_dynamic(&dyn); return ret; } tds_release_cur_dyn(tds); tds->cur_dyn = dyn; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds->out_flag = TDS_NORMAL; id_len = strlen(dyn->id); tds_put_byte(tds, TDS5_DYNAMIC_TOKEN); tds_freeze(tds, &outer, 2); tds_put_byte(tds, TDS_DYN_EXEC_IMMED); tds_put_byte(tds, params ? 0x01 : 0); TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, dyn->id, id_len); } TDS_END_LEN /* TODO how to pass parameters type? like store procedures ? */ TDS_START_LEN_USMALLINT(tds) { tds_put_n(tds, "create proc ", 12); tds_put_string(tds, dyn->id, id_len); tds_put_n(tds, " as ", 4); tds_put_string(tds, query, query_len); } TDS_END_LEN tds_freeze_close(&outer); if (params) TDS_PROPAGATE(tds5_put_params(tds, params, 0)); return tds_flush_packet(tds); } /** * Creates a temporary stored procedure in the server and execute it. * \param tds state information for the socket and the TDS protocol * \param query language query with given placeholders ('?') * \param id string to identify the dynamic query. Pass NULL for automatic generation. * \param dyn_out will receive allocated TDSDYNAMIC*. Any older allocated dynamic won't be freed. Can be NULL. * \param params parameters to use. It can be NULL even if parameters are present. * \return TDS_FAIL or TDS_SUCCESS */ TDSRET tds71_submit_prepexec(TDSSOCKET * tds, const char *query, const char *id, TDSDYNAMIC ** dyn_out, TDSPARAMINFO * params) { int query_len; TDSRET rc = TDS_FAIL; TDSDYNAMIC *dyn; size_t converted_query_len; const char *converted_query; TDSFREEZE outer; CHECK_TDS_EXTRA(tds); if (params) CHECK_PARAMINFO_EXTRA(params); if (!query || !dyn_out || !IS_TDS7_PLUS(tds->conn)) return TDS_FAIL; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; /* allocate a structure for this thing */ dyn = tds_alloc_dynamic(tds->conn, id); if (!dyn) return TDS_FAIL; tds_release_dynamic(dyn_out); *dyn_out = dyn; tds_set_cur_dyn(tds, dyn); query_len = (int)strlen(query); converted_query = tds_convert_string(tds, tds->conn->char_convs[client2ucs2], query, query_len, &converted_query_len); if (!converted_query) goto failure; tds_freeze(tds, &outer, 0); tds_start_query(tds, TDS_RPC); /* procedure name */ if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_PREPEXEC); } else { TDS_PUT_N_AS_UCS2(tds, "sp_prepexec"); } tds_put_smallint(tds, 0); /* return param handle (int) */ tds_put_byte(tds, 0); tds_put_byte(tds, 1); /* result */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 0); rc = tds7_write_param_def_from_query(tds, converted_query, converted_query_len, params); tds7_put_query_params(tds, converted_query, converted_query_len); tds_convert_string_free(query, converted_query); if (TDS_FAILED(rc)) { tds_freeze_abort(&outer); return rc; } tds_freeze_close(&outer); if (params) { int i; for (i = 0; i < params->num_cols; i++) { TDSCOLUMN *param = params->columns[i]; TDS_PROPAGATE(tds_put_data_info(tds, param, 0)); TDS_PROPAGATE(tds_put_data(tds, param)); } } tds->current_op = TDS_OP_PREPEXEC; rc = tds_query_flush_packet(tds); if (TDS_SUCCEED(rc)) return rc; failure: /* TODO correct if writing fail ?? */ tds_set_state(tds, TDS_IDLE); tds_release_dynamic(dyn_out); tds_dynamic_deallocated(tds->conn, dyn); return rc; } /** * Get column size for wire */ size_t tds_fix_column_size(TDSSOCKET * tds, TDSCOLUMN * curcol) { size_t size = curcol->on_server.column_size, min; if (!size) { size = curcol->column_size; if (is_unicode_type(curcol->on_server.column_type)) size *= 2u; } switch (curcol->column_varint_size) { case 1: size = MAX(MIN(size, 255), 1); break; case 2: /* note that varchar(max)/varbinary(max) have a varint of 8 */ if (curcol->on_server.column_type == XSYBNVARCHAR || curcol->on_server.column_type == XSYBNCHAR) min = 2; else min = 1; size = MAX(MIN(size, 8000u), min); break; case 4: if (curcol->on_server.column_type == SYBNTEXT) size = 0x7ffffffeu; else size = 0x7fffffffu; break; default: break; } return size; } /** * Put data information to wire * \param tds state information for the socket and the TDS protocol * \param curcol column where to store information * \param flags bit flags on how to send data (use TDS_PUT_DATA_USE_NAME for use name information) * \return TDS_SUCCESS or TDS_FAIL */ static TDSRET tds_put_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int flags) { int len; CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); if (flags & TDS_PUT_DATA_USE_NAME) { len = tds_dstr_len(&curcol->column_name); tdsdump_log(TDS_DBG_ERROR, "tds_put_data_info putting param_name \n"); if (IS_TDS7_PLUS(tds->conn)) { TDSFREEZE outer; size_t written; tds_freeze(tds, &outer, 1); if ((flags & TDS_PUT_DATA_PREFIX_NAME) != 0) tds_put_smallint(tds, '@'); tds_put_string(tds, tds_dstr_cstr(&curcol->column_name), len); written = (tds_freeze_written(&outer) - 1) / 2; tds_freeze_close_len(&outer, written); } else { TDS_START_LEN_TINYINT(tds) { /* param name len */ tds_put_string(tds, tds_dstr_cstr(&curcol->column_name), len); } TDS_END_LEN } } else { tds_put_byte(tds, 0x00); /* param name len */ } /* * TODO support other flags (use defaul null/no metadata) * bit 1 (2 as flag) in TDS7+ is "default value" bit * (what's the meaning of "default value" ?) */ tdsdump_log(TDS_DBG_ERROR, "tds_put_data_info putting status \n"); if (flags & TDS_PUT_DATA_LONG_STATUS) tds_put_int(tds, curcol->column_output); /* status (input) */ else tds_put_byte(tds, curcol->column_output); /* status (input) */ if (!IS_TDS7_PLUS(tds->conn)) tds_put_int(tds, curcol->column_usertype); /* usertype */ tds_put_byte(tds, curcol->on_server.column_type); if (curcol->funcs->put_info(tds, curcol) != TDS_SUCCESS) return TDS_FAIL; /* TODO needed in TDS4.2 ?? now is called only if TDS >= 5 */ if (!IS_TDS7_PLUS(tds->conn)) tds_put_byte(tds, 0x00); /* locale info length */ return TDS_SUCCESS; } /** * Send dynamic request on TDS 7+ to be executed * \tds * \param dyn dynamic query to execute */ static TDSRET tds7_send_execute(TDSSOCKET * tds, TDSDYNAMIC * dyn) { TDSCOLUMN *param; TDSPARAMINFO *info; int i; /* procedure name */ /* NOTE do not call this procedure using integer name (TDS_SP_EXECUTE) on mssql2k, it doesn't work! */ TDS_PUT_N_AS_UCS2(tds, "sp_execute"); tds_put_smallint(tds, 0); /* flags */ /* id of prepared statement */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, dyn->num_id); info = dyn->params; if (info) for (i = 0; i < info->num_cols; i++) { param = info->columns[i]; TDS_PROPAGATE(tds_put_data_info(tds, param, 0)); TDS_PROPAGATE(tds_put_data(tds, param)); } tds->current_op = TDS_OP_EXECUTE; return TDS_SUCCESS; } /** * Sends a previously prepared dynamic statement to the server. * \param tds state information for the socket and the TDS protocol * \param dyn dynamic proc to execute. Must build from same tds. */ TDSRET tds_submit_execute(TDSSOCKET * tds, TDSDYNAMIC * dyn) { CHECK_TDS_EXTRA(tds); /* TODO this dynamic should be in tds */ CHECK_DYNAMIC_EXTRA(dyn); tdsdump_log(TDS_DBG_FUNC, "tds_submit_execute()\n"); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_set_cur_dyn(tds, dyn); if (IS_TDS7_PLUS(tds->conn)) { /* check proper id */ if (dyn->num_id == 0) { tds_set_state(tds, TDS_IDLE); return TDS_FAIL; } /* RPC on sp_execute */ tds_start_query(tds, TDS_RPC); tds7_send_execute(tds, dyn); return tds_query_flush_packet(tds); } if (dyn->emulated) { TDS_PROPAGATE(tds_send_emulated_execute(tds, dyn->query, dyn->params)); return tds_query_flush_packet(tds); } /* query has been prepared successfully, discard original query */ if (dyn->query) TDS_ZERO_FREE(dyn->query); tds->out_flag = TDS_NORMAL; /* dynamic id */ tds_put_byte(tds, TDS5_DYNAMIC_TOKEN); TDS_START_LEN_USMALLINT(tds) { tds_put_byte(tds, 0x02); tds_put_byte(tds, dyn->params ? 0x01 : 0); TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, dyn->id, -1); } TDS_END_LEN tds_put_smallint(tds, 0); } TDS_END_LEN if (dyn->params) TDS_PROPAGATE(tds5_put_params(tds, dyn->params, 0)); /* send it */ return tds_query_flush_packet(tds); } /** * Send parameters to server. * \tds * \param info parameters to send * \param flags 0 or TDS_PUT_DATA_USE_NAME */ static TDSRET tds5_put_params(TDSSOCKET * tds, TDSPARAMINFO * info, int flags) { int i; bool wide = false; CHECK_TDS_EXTRA(tds); CHECK_PARAMINFO_EXTRA(info); /* column descriptions */ for (;;) { TDSFREEZE outer, inner; tds_freeze(tds, &outer, 0); if (wide) { tds_put_byte(tds, TDS5_PARAMFMT2_TOKEN); tds_freeze(tds, &inner, 4); flags |= TDS_PUT_DATA_LONG_STATUS; } else { tds_put_byte(tds, TDS5_PARAMFMT_TOKEN); tds_freeze(tds, &inner, 2); } /* number of parameters */ tds_put_smallint(tds, info->num_cols); /* column detail for each parameter */ for (i = 0; i < info->num_cols; i++) TDS_PROPAGATE(tds_put_data_info(tds, info->columns[i], flags)); /* if we fits we are fine */ if (wide || tds_freeze_written(&inner) - 2 < 0x10000u) { tds_freeze_close(&inner); tds_freeze_close(&outer); break; } /* try again with wide */ tds_freeze_abort(&inner); tds_freeze_abort(&outer); if (!tds_capability_has_req(tds->conn, TDS_REQ_WIDETABLE)) return TDS_FAIL; wide = true; } /* row data */ tds_put_byte(tds, TDS5_PARAMS_TOKEN); for (i = 0; i < info->num_cols; i++) TDS_PROPAGATE(tds_put_data(tds, info->columns[i])); return TDS_SUCCESS; } /** * Check if dynamic request must be unprepared. * Depending on status and protocol version request should be unprepared * or not. * \tds * \param dyn dynamic request to check */ int tds_needs_unprepare(TDSCONNECTION * conn, TDSDYNAMIC * dyn) { CHECK_CONN_EXTRA(conn); CHECK_DYNAMIC_EXTRA(dyn); /* check if statement is prepared */ if (IS_TDS7_PLUS(conn) && !dyn->num_id) return 0; if (dyn->emulated || !dyn->id[0]) return 0; return 1; } /** * Unprepare dynamic on idle. * This let libTDS close the prepared statement when possible. * \tds * \param dyn dynamic request to close */ TDSRET tds_deferred_unprepare(TDSCONNECTION * conn, TDSDYNAMIC * dyn) { CHECK_CONN_EXTRA(conn); CHECK_DYNAMIC_EXTRA(dyn); if (!tds_needs_unprepare(conn, dyn)) { tds_dynamic_deallocated(conn, dyn); return TDS_SUCCESS; } dyn->defer_close = true; conn->pending_close = 1; return TDS_SUCCESS; } /** * Send a unprepare request for a prepared query * \param tds state information for the socket and the TDS protocol * \param dyn dynamic query * \result TDS_SUCCESS or TDS_FAIL */ TDSRET tds_submit_unprepare(TDSSOCKET * tds, TDSDYNAMIC * dyn) { CHECK_TDS_EXTRA(tds); /* TODO test dyn in tds */ CHECK_DYNAMIC_EXTRA(dyn); if (!dyn) return TDS_FAIL; tdsdump_log(TDS_DBG_FUNC, "tds_submit_unprepare() %s\n", dyn->id); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_set_cur_dyn(tds, dyn); if (IS_TDS7_PLUS(tds->conn)) { /* RPC on sp_execute */ tds_start_query(tds, TDS_RPC); /* procedure name */ if (IS_TDS71_PLUS(tds->conn)) { /* save some byte for mssql2k */ tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_UNPREPARE); } else { TDS_PUT_N_AS_UCS2(tds, "sp_unprepare"); } tds_put_smallint(tds, 0); /* flags */ /* id of prepared statement */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, dyn->num_id); tds->current_op = TDS_OP_UNPREPARE; return tds_query_flush_packet(tds); } if (dyn->emulated) { tds_start_query(tds, TDS_QUERY); /* just a dummy select to return some data */ tds_put_string(tds, "select 1 where 0=1", -1); return tds_query_flush_packet(tds); } tds->out_flag = TDS_NORMAL; /* dynamic id */ tds_put_byte(tds, TDS5_DYNAMIC_TOKEN); TDS_START_LEN_USMALLINT(tds) { tds_put_byte(tds, TDS_DYN_DEALLOC); tds_put_byte(tds, 0x00); TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, dyn->id, -1); } TDS_END_LEN tds_put_smallint(tds, 0); } TDS_END_LEN /* send it */ tds->current_op = TDS_OP_DYN_DEALLOC; return tds_query_flush_packet(tds); } /** * Send RPC as string query. * This function is used on old protocol which does not support RPC queries. * \tds * \param rpc_name name of RPC to invoke * \param params parameters to send to server * \returns TDS_FAIL or TDS_SUCCESS */ static TDSRET tds4_send_emulated_rpc(TDSSOCKET * tds, const char *rpc_name, TDSPARAMINFO * params) { TDSCOLUMN *param; int i, n; int num_params = params ? params->num_cols : 0; const char *sep = " "; char buf[80]; /* create params and set */ for (i = 0, n = 0; i < num_params; ++i) { param = params->columns[i]; /* declare and set output parameters */ if (!param->column_output) continue; ++n; sprintf(buf, " DECLARE @P%d ", n); tds_get_column_declaration(tds, param, buf + strlen(buf)); sprintf(buf + strlen(buf), " SET @P%d=", n); tds_put_string(tds, buf, -1); tds_put_param_as_string(tds, params, i); } /* put exec statement */ tds_put_string(tds, " EXEC ", 6); tds_put_string(tds, rpc_name, -1); /* put arguments */ for (i = 0, n = 0; i < num_params; ++i) { param = params->columns[i]; tds_put_string(tds, sep, -1); if (!tds_dstr_isempty(¶m->column_name)) { tds_put_string(tds, tds_dstr_cstr(¶m->column_name), tds_dstr_len(¶m->column_name)); tds_put_string(tds, "=", 1); } if (param->column_output) { ++n; sprintf(buf, "@P%d OUTPUT", n); tds_put_string(tds, buf, -1); } else { tds_put_param_as_string(tds, params, i); } sep = ","; } return tds_query_flush_packet(tds); } /** * Calls a RPC from server. Output parameters will be stored in tds->param_info. * \param tds state information for the socket and the TDS protocol * \param rpc_name name of RPC * \param params parameters informations. NULL for no parameters */ TDSRET tds_submit_rpc(TDSSOCKET * tds, const char *rpc_name, TDSPARAMINFO * params, TDSHEADERS * head) { TDSCOLUMN *param; int rpc_name_len, i; int num_params = params ? params->num_cols : 0; CHECK_TDS_EXTRA(tds); if (params) CHECK_PARAMINFO_EXTRA(params); assert(tds); assert(rpc_name); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; /* distinguish from dynamic query */ tds_release_cur_dyn(tds); rpc_name_len = (int)strlen(rpc_name); if (IS_TDS7_PLUS(tds->conn)) { TDSFREEZE outer; size_t written; if (tds_start_query_head(tds, TDS_RPC, head) != TDS_SUCCESS) return TDS_FAIL; /* procedure name */ tds_freeze(tds, &outer, 2); tds_put_string(tds, rpc_name, rpc_name_len); written = tds_freeze_written(&outer) / 2 - 1; tds_freeze_close_len(&outer, written); /* * TODO support flags * bit 0 (1 as flag) in TDS7/TDS5 is "recompile" * bit 1 (2 as flag) in TDS7+ is "no metadata" bit * (I don't know meaning of "no metadata") */ tds_put_smallint(tds, 0); for (i = 0; i < num_params; i++) { param = params->columns[i]; TDS_PROPAGATE(tds_put_data_info(tds, param, TDS_PUT_DATA_USE_NAME)); TDS_PROPAGATE(tds_put_data(tds, param)); } return tds_query_flush_packet(tds); } if (IS_TDS50(tds->conn)) { tds->out_flag = TDS_NORMAL; /* DBRPC */ tds_put_byte(tds, TDS_DBRPC_TOKEN); TDS_START_LEN_USMALLINT(tds) { TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, rpc_name, rpc_name_len); } TDS_END_LEN /* TODO flags */ tds_put_smallint(tds, num_params ? 2 : 0); } TDS_END_LEN if (num_params) TDS_PROPAGATE(tds5_put_params(tds, params, TDS_PUT_DATA_USE_NAME)); /* send it */ return tds_query_flush_packet(tds); } /* emulate it for TDS4.x, send RPC for mssql */ if (tds->conn->tds_version < 0x500) return tds4_send_emulated_rpc(tds, rpc_name, params); /* TODO continue, support for TDS4?? */ tds_set_state(tds, TDS_IDLE); return TDS_FAIL; } /** * tds_send_cancel() sends an empty packet (8 byte header only) * tds_process_cancel should be called directly after this. * \param tds state information for the socket and the TDS protocol * \remarks * tcp will either deliver the packet or time out. * (TIME_WAIT determines how long it waits between retries.) * * On sending the cancel, we may get EAGAIN. We then select(2) until we know * either 1) it succeeded or 2) it didn't. On failure, close the socket, * tell the app, and fail the function. * * On success, we read(2) and wait for a reply with select(2). If we get * one, great. If the client's timeout expires, we tell him, but all we can * do is wait some more or give up and close the connection. If he tells us * to cancel again, we wait some more. */ TDSRET tds_send_cancel(TDSSOCKET * tds) { #if ENABLE_ODBC_MARS CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_FUNC, "tds_send_cancel: %sin_cancel and %sidle\n", (tds->in_cancel? "":"not "), (tds->state == TDS_IDLE? "":"not ")); /* one cancel is sufficient */ if (tds->in_cancel || tds->state == TDS_IDLE) { return TDS_SUCCESS; } tds->in_cancel = 1; if (tds_mutex_trylock(&tds->conn->list_mtx)) { /* TODO check */ /* signal other socket */ tds_wakeup_send(&tds->conn->wakeup, 1); return TDS_SUCCESS; } if (tds->conn->in_net_tds) { tds_mutex_unlock(&tds->conn->list_mtx); /* TODO check */ /* signal other socket */ tds_wakeup_send(&tds->conn->wakeup, 1); return TDS_SUCCESS; } tds_mutex_unlock(&tds->conn->list_mtx); /* problem: if we are in in_net and we got a signal ?? on timeout we and a cancel, directly in in_net if we hold the lock and we get a signal lock create a death lock if we use a recursive mutex and we can get the lock there are 2 cases - same thread, we could add a packet and signal, no try ok - first thread locking, we could add a packet but are we sure it get processed ??, no try ok if recursive mutex and we can't get another thread, wait if mutex is not recursive and we get the lock (try) - nobody locked, if in_net it could be same or another if mutex is not recursive and we can't get the lock - another thread is locking, sending signal require not exiting and global list (not protected by list_mtx) - same thread have lock, we can't wait nothing without deathlock, setting a flag in tds and signaling could help if a tds is waiting for data or is waiting for a condition or for a signal in poll pass cancel request on socket ?? */ tds->out_flag = TDS_CANCEL; tds->out_pos = 8; tdsdump_log(TDS_DBG_FUNC, "tds_send_cancel: sending cancel packet\n"); return tds_flush_packet(tds); #else TDSRET rc; /* * if we are not able to get the lock signal other thread * this means that either: * - another thread is processing data * - we got called from a signal inside processing thread * - we got called from message handler */ if (tds_mutex_trylock(&tds->wire_mtx)) { /* TODO check */ if (!tds->in_cancel) tds->in_cancel = 1; /* signal other socket */ tds_wakeup_send(&tds->conn->wakeup, 1); return TDS_SUCCESS; } CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_FUNC, "tds_send_cancel: %sin_cancel and %sidle\n", (tds->in_cancel? "":"not "), (tds->state == TDS_IDLE? "":"not ")); /* one cancel is sufficient */ if (tds->in_cancel || tds->state == TDS_IDLE) { tds_mutex_unlock(&tds->wire_mtx); return TDS_SUCCESS; } rc = tds_put_cancel(tds); tds_mutex_unlock(&tds->wire_mtx); return rc; #endif } /** * Quote a string properly. Output string is always NUL-terminated * \tds * \param buffer output buffer. If NULL function will just return * required bytes * \param quoting quote character (should be one of '\'', '"', ']') * \param id string to quote * \param len length of string to quote * \returns size of output string */ static size_t tds_quote(TDSSOCKET * tds, char *buffer, char quoting, const char *id, size_t len) { size_t size; const char *src, *pend; char *dst; CHECK_TDS_EXTRA(tds); pend = id + len; /* quote */ src = id; if (!buffer) { size = 2u + len; for (; src != pend; ++src) if (*src == quoting) ++size; return size; } dst = buffer; *dst++ = (quoting == ']') ? '[' : quoting; for (; src != pend; ++src) { if (*src == quoting) *dst++ = quoting; *dst++ = *src; } *dst++ = quoting; *dst = 0; return dst - buffer; } /** * Quote an id * \param tds state information for the socket and the TDS protocol * \param buffer buffer to store quoted id. If NULL do not write anything * (useful to compute quote length) * \param id id to quote * \param idlen id length (< 0 for NUL terminated) * \result written chars (not including needed terminator) * \see tds_quote_id_rpc */ size_t tds_quote_id(TDSSOCKET * tds, char *buffer, const char *id, int idlen) { size_t i, len; CHECK_TDS_EXTRA(tds); len = idlen < 0 ? strlen(id) : (size_t) idlen; /* quote always for mssql */ if (TDS_IS_MSSQL(tds) || tds->conn->product_version >= TDS_SYB_VER(12, 5, 1)) return tds_quote(tds, buffer, ']', id, len); /* need quote ?? */ for (i = 0; i < len; ++i) { char c = id[i]; if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (i > 0 && c >= '0' && c <= '9') continue; if (c == '_') continue; return tds_quote(tds, buffer, '\"', id, len); } if (buffer) { memcpy(buffer, id, len); buffer[len] = '\0'; } return len; } /** * Quote an id for a RPC call * \param tds state information for the socket and the TDS protocol * \param buffer buffer to store quoted id. If NULL do not write anything * (useful to compute quote length) * \param id id to quote * \param idlen id length (< 0 for NUL terminated) * \result written chars (not including needed terminator) * \see tds_quote_id */ size_t tds_quote_id_rpc(TDSSOCKET * tds, char *buffer, const char *id, int idlen) { size_t len; /* We are quoting for RPC calls, not base language queries. For RPC calls Sybase * servers don't accept '[]' style quoting so don't use them but use normal * identifier quoting ('""') */ char quote_id_char = TDS_IS_MSSQL(tds) ? ']' : '\"'; CHECK_TDS_EXTRA(tds); len = idlen < 0 ? strlen(id) : (size_t) idlen; return tds_quote(tds, buffer, quote_id_char, id, len); } /** * Quote a string * \param tds state information for the socket and the TDS protocol * \param buffer buffer to store quoted id. If NULL do not write anything * (useful to compute quote length) * \param str string to quote (not necessary NUL-terminated) * \param len length of string (-1 for NUL-terminated) * \result written chars (not including needed terminator) */ size_t tds_quote_string(TDSSOCKET * tds, char *buffer, const char *str, int len) { return tds_quote(tds, buffer, '\'', str, len < 0 ? strlen(str) : (size_t) len); } /** * Set current cursor. * Current cursor is the one will receive output from server. * \tds * \param cursor cursor to set as current */ static inline void tds_set_cur_cursor(TDSSOCKET *tds, TDSCURSOR *cursor) { ++cursor->ref_count; if (tds->cur_cursor) tds_release_cursor(&tds->cur_cursor); tds->cur_cursor = cursor; } TDSRET tds_cursor_declare(TDSSOCKET * tds, TDSCURSOR * cursor, TDSPARAMINFO *params, int *something_to_send) { CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_declare() cursor id = %d\n", cursor->cursor_id); if (IS_TDS7_PLUS(tds->conn)) { cursor->srv_status |= TDS_CUR_ISTAT_DECLARED; cursor->srv_status |= TDS_CUR_ISTAT_CLOSED; cursor->srv_status |= TDS_CUR_ISTAT_RDONLY; } if (IS_TDS50(tds->conn)) { if (!*something_to_send) { if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds->out_flag = TDS_NORMAL; } if (tds->state != TDS_WRITING || tds->out_flag != TDS_NORMAL) return TDS_FAIL; tds_put_byte(tds, TDS_CURDECLARE_TOKEN); /* length of the data stream that follows */ TDS_START_LEN_USMALLINT(tds) { TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, cursor->cursor_name, -1); } TDS_END_LEN tds_put_byte(tds, 1); /* cursor option is read only=1, unused=0 */ tds_put_byte(tds, 0); /* status unused=0 */ TDS_START_LEN_USMALLINT(tds) { tds_put_string(tds, cursor->query, -1); } TDS_END_LEN tds_put_tinyint(tds, 0); /* number of columns = 0 , valid value applicable only for updatable cursor */ } TDS_END_LEN *something_to_send = 1; } return TDS_SUCCESS; } TDSRET tds_cursor_open(TDSSOCKET * tds, TDSCURSOR * cursor, TDSPARAMINFO *params, int *something_to_send) { CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_open() cursor id = %d\n", cursor->cursor_id); if (!*something_to_send) { if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; } if (tds->state != TDS_WRITING) return TDS_FAIL; tds_set_cur_cursor(tds, cursor); if (IS_TDS50(tds->conn)) { tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS_CUROPEN_TOKEN); TDS_START_LEN_USMALLINT(tds) { /*tds_put_int(tds, cursor->cursor_id); *//* Only if cursor id is passed as zero, the cursor name need to be sent */ tds_put_int(tds, 0); TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, cursor->cursor_name, -1); } TDS_END_LEN tds_put_byte(tds, 0); /* Cursor status : 0 for no arguments */ } TDS_END_LEN *something_to_send = 1; } if (IS_TDS7_PLUS(tds->conn)) { const char *converted_query; size_t converted_query_len; int num_params = params ? params->num_cols : 0; TDSFREEZE outer; TDSRET rc = TDS_SUCCESS; /* cursor statement */ converted_query = tds_convert_string(tds, tds->conn->char_convs[client2ucs2], cursor->query, (int)strlen(cursor->query), &converted_query_len); if (!converted_query) { if (!*something_to_send) tds_set_state(tds, TDS_IDLE); return TDS_FAIL; } tds_freeze(tds, &outer, 0); /* RPC call to sp_cursoropen */ tds_start_query(tds, TDS_RPC); /* procedure identifier by number */ if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_CURSOROPEN); } else { TDS_PUT_N_AS_UCS2(tds, "sp_cursoropen"); } tds_put_smallint(tds, 0); /* flags */ /* return cursor handle (int) */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 1); /* output parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 0); if (num_params) { tds7_put_query_params(tds, converted_query, converted_query_len); } else { tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, SYBNTEXT); /* must be Ntype */ TDS_PUT_INT(tds, converted_query_len); if (IS_TDS71_PLUS(tds->conn)) tds_put_n(tds, tds->conn->collation, 5); TDS_PUT_INT(tds, converted_query_len); tds_put_n(tds, converted_query, (int)converted_query_len); } /* type */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 1); /* output parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, num_params ? cursor->type | 0x1000 : cursor->type); /* concurrency */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 1); /* output parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, cursor->concurrency); /* row count */ tds_put_byte(tds, 0); tds_put_byte(tds, 1); /* output parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, 0); if (num_params) { int i; rc = tds7_write_param_def_from_query(tds, converted_query, converted_query_len, params); for (i = 0; i < num_params; i++) { TDSCOLUMN *param = params->columns[i]; /* TODO check error */ tds_put_data_info(tds, param, 0); /* FIXME handle error */ tds_put_data(tds, param); } } tds_convert_string_free(cursor->query, converted_query); if (TDS_FAILED(rc)) { tds_freeze_abort(&outer); if (!*something_to_send) tds_set_state(tds, TDS_IDLE); return rc; } tds_freeze_close(&outer); *something_to_send = 1; tds->current_op = TDS_OP_CURSOROPEN; tdsdump_log(TDS_DBG_ERROR, "tds_cursor_open (): RPC call set up \n"); } tdsdump_log(TDS_DBG_ERROR, "tds_cursor_open (): cursor open completed\n"); return TDS_SUCCESS; } TDSRET tds_cursor_setrows(TDSSOCKET * tds, TDSCURSOR * cursor, int *something_to_send) { CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_setrows() cursor id = %d\n", cursor->cursor_id); if (IS_TDS7_PLUS(tds->conn)) { cursor->srv_status &= ~TDS_CUR_ISTAT_DECLARED; cursor->srv_status |= TDS_CUR_ISTAT_CLOSED; cursor->srv_status |= TDS_CUR_ISTAT_ROWCNT; } if (IS_TDS50(tds->conn)) { if (!*something_to_send) { if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds->out_flag = TDS_NORMAL; } if (tds->state != TDS_WRITING || tds->out_flag != TDS_NORMAL) return TDS_FAIL; tds_set_cur_cursor(tds, cursor); tds_put_byte(tds, TDS_CURINFO_TOKEN); TDS_START_LEN_USMALLINT(tds) { /* length of data stream that follows */ /* tds_put_int(tds, tds->cursor->cursor_id); */ /* Cursor id */ tds_put_int(tds, 0); TDS_START_LEN_TINYINT(tds) { tds_put_string(tds, cursor->cursor_name, -1); } TDS_END_LEN tds_put_byte(tds, 1); /* Command TDS_CUR_CMD_SETCURROWS */ tds_put_byte(tds, 0x00); /* Status - TDS_CUR_ISTAT_ROWCNT 0x0020 */ tds_put_byte(tds, 0x20); /* Status - TDS_CUR_ISTAT_ROWCNT 0x0020 */ tds_put_int(tds, cursor->cursor_rows); /* row count to set */ } TDS_END_LEN *something_to_send = 1; } return TDS_SUCCESS; } static void tds7_put_cursor_fetch(TDSSOCKET * tds, TDS_INT cursor_id, TDS_TINYINT fetch_type, TDS_INT i_row, TDS_INT num_rows) { if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_CURSORFETCH); } else { TDS_PUT_N_AS_UCS2(tds, "sp_cursorfetch"); } /* This flag tells the SP only to */ /* output a dummy metadata token */ tds_put_smallint(tds, 2); /* input cursor handle (int) */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, cursor_id); /* fetch type - 2 = NEXT */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, fetch_type); /* row number */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); if ((fetch_type & 0x30) != 0) { tds_put_byte(tds, 4); tds_put_int(tds, i_row); } else { tds_put_byte(tds, 0); } /* number of rows to fetch */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, num_rows); } TDSRET tds_cursor_fetch(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row) { CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_fetch() cursor id = %d\n", cursor->cursor_id); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_set_cur_cursor(tds, cursor); if (IS_TDS50(tds->conn)) { size_t len = strlen(cursor->cursor_name); size_t row_len = 0; tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS_CURFETCH_TOKEN); if (len > (255-10)) len = (255-10); if (fetch_type == TDS_CURSOR_FETCH_ABSOLUTE || fetch_type == TDS_CURSOR_FETCH_RELATIVE) row_len = 4; /*tds_put_smallint(tds, 8); */ TDS_PUT_SMALLINT(tds, 6 + len + row_len); /* length of the data stream that follows */ /*tds_put_int(tds, cursor->cursor_id); *//* cursor id returned by the server */ tds_put_int(tds, 0); TDS_PUT_BYTE(tds, len); tds_put_n(tds, cursor->cursor_name, len); tds_put_tinyint(tds, fetch_type); /* optional argument to fetch row at absolute/relative position */ if (row_len) tds_put_int(tds, i_row); return tds_query_flush_packet(tds); } if (IS_TDS7_PLUS(tds->conn)) { /* RPC call to sp_cursorfetch */ static const unsigned char mssql_fetch[7] = { 0, 2, /* TDS_CURSOR_FETCH_NEXT */ 4, /* TDS_CURSOR_FETCH_PREV */ 1, /* TDS_CURSOR_FETCH_FIRST */ 8, /* TDS_CURSOR_FETCH_LAST */ 0x10, /* TDS_CURSOR_FETCH_ABSOLUTE */ 0x20 /* TDS_CURSOR_FETCH_RELATIVE */ }; tds_start_query(tds, TDS_RPC); /* TODO enum for 2 ... */ if (cursor->type == 2 && fetch_type == TDS_CURSOR_FETCH_ABSOLUTE) { /* strangely dynamic cursor do not support absolute so emulate it with first + relative */ tds7_put_cursor_fetch(tds, cursor->cursor_id, 1, 0, 0); /* TODO define constant */ tds_put_byte(tds, IS_TDS72_PLUS(tds->conn) ? 0xff : 0x80); tds7_put_cursor_fetch(tds, cursor->cursor_id, 0x20, i_row, cursor->cursor_rows); } else { /* TODO check fetch_type ?? */ tds7_put_cursor_fetch(tds, cursor->cursor_id, mssql_fetch[fetch_type], i_row, cursor->cursor_rows); } tds->current_op = TDS_OP_CURSORFETCH; return tds_query_flush_packet(tds); } tds_set_state(tds, TDS_IDLE); return TDS_SUCCESS; } TDSRET tds_cursor_get_cursor_info(TDSSOCKET *tds, TDSCURSOR *cursor, TDS_UINT *prow_number, TDS_UINT *prow_count) { int done_flags; TDSRET retcode; TDS_INT result_type; CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_get_cursor_info() cursor id = %d\n", cursor->cursor_id); /* Assume not known */ assert(prow_number && prow_count); *prow_number = 0; *prow_count = 0; if (IS_TDS7_PLUS(tds->conn)) { /* Change state to querying */ if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; /* Remember the server has been sent a command for this cursor */ tds_set_cur_cursor(tds, cursor); /* General initialization of server command */ tds_start_query(tds, TDS_RPC); /* Create and send query to server */ if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_CURSORFETCH); } else { TDS_PUT_N_AS_UCS2(tds, "sp_cursorfetch"); } /* This flag tells the SP only to */ /* output a dummy metadata token */ tds_put_smallint(tds, 2); /* input cursor handle (int) */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, cursor->cursor_id); tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, 0x100); /* FETCH_INFO */ /* row number */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 1); /* output parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 0); /* number of rows fetched */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 1); /* output parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 0); /* Adjust current state */ tds->current_op = TDS_OP_NONE; TDS_PROPAGATE(tds_query_flush_packet(tds)); /* Process answer from server */ for (;;) { retcode = tds_process_tokens(tds, &result_type, &done_flags, TDS_RETURN_PROC); tdsdump_log(TDS_DBG_FUNC, "tds_cursor_get_cursor_info: tds_process_tokens returned %d\n", retcode); tdsdump_log(TDS_DBG_FUNC, " result_type=%d, TDS_DONE_COUNT=%x, TDS_DONE_ERROR=%x\n", result_type, (done_flags & TDS_DONE_COUNT), (done_flags & TDS_DONE_ERROR)); switch (retcode) { case TDS_NO_MORE_RESULTS: return TDS_SUCCESS; case TDS_SUCCESS: if (result_type==TDS_PARAM_RESULT) { /* Status is updated when TDS_STATUS_RESULT token arrives, before the params are processed */ if (tds->has_status && tds->ret_status==0) { TDSPARAMINFO *pinfo = tds->current_results; /* Make sure the params retuned have the correct type and size */ if (pinfo && pinfo->num_cols==2 && pinfo->columns[0]->on_server.column_type==SYBINTN && pinfo->columns[1]->on_server.column_type==SYBINTN && pinfo->columns[0]->column_size==4 && pinfo->columns[1]->column_size==4) { /* Take the values */ *prow_number = (TDS_UINT)(*(TDS_INT *) pinfo->columns[0]->column_data); *prow_count = (TDS_UINT)(*(TDS_INT *) pinfo->columns[1]->column_data); tdsdump_log(TDS_DBG_FUNC, "----------------> prow_number=%u, prow_count=%u\n", *prow_count, *prow_number); } } } break; default: return retcode; } } } return TDS_SUCCESS; } TDSRET tds_cursor_close(TDSSOCKET * tds, TDSCURSOR * cursor) { CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_close() cursor id = %d\n", cursor->cursor_id); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_set_cur_cursor(tds, cursor); if (IS_TDS50(tds->conn)) { tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS_CURCLOSE_TOKEN); tds_put_smallint(tds, 5); /* length of the data stream that follows */ tds_put_int(tds, cursor->cursor_id); /* cursor id returned by the server is available now */ if (cursor->status.dealloc == TDS_CURSOR_STATE_REQUESTED) { tds_put_byte(tds, 0x01); /* Close option: TDS_CUR_COPT_DEALLOC */ cursor->status.dealloc = TDS_CURSOR_STATE_SENT; } else tds_put_byte(tds, 0x00); /* Close option: TDS_CUR_COPT_UNUSED */ } if (IS_TDS7_PLUS(tds->conn)) { /* RPC call to sp_cursorclose */ tds_start_query(tds, TDS_RPC); if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_CURSORCLOSE); } else { TDS_PUT_N_AS_UCS2(tds, "sp_cursorclose"); } /* This flag tells the SP to output only a dummy metadata token */ tds_put_smallint(tds, 2); /* input cursor handle (int) */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, cursor->cursor_id); tds->current_op = TDS_OP_CURSORCLOSE; } return tds_query_flush_packet(tds); } TDSRET tds_cursor_setname(TDSSOCKET * tds, TDSCURSOR * cursor) { TDSFREEZE outer; size_t written; CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_setname() cursor id = %d\n", cursor->cursor_id); if (!IS_TDS7_PLUS(tds->conn)) return TDS_SUCCESS; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_set_cur_cursor(tds, cursor); /* RPC call to sp_cursoroption */ tds_start_query(tds, TDS_RPC); if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_CURSOROPTION); } else { TDS_PUT_N_AS_UCS2(tds, "sp_cursoroption"); } tds_put_smallint(tds, 0); /* input cursor handle (int) */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, cursor->cursor_id); /* code, 2 == set cursor name */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, 2); /* cursor name */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, XSYBNVARCHAR); tds_freeze(tds, &outer, 2); if (IS_TDS71_PLUS(tds->conn)) tds_put_n(tds, tds->conn->collation, 5); TDS_START_LEN_USMALLINT(tds) { tds_put_string(tds, cursor->cursor_name, -1); written = tds_freeze_written(current_freeze) - 2; } TDS_END_LEN tds_freeze_close_len(&outer, written); tds->current_op = TDS_OP_CURSOROPTION; return tds_query_flush_packet(tds); } TDSRET tds_cursor_update(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO *params) { CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_update() cursor id = %d\n", cursor->cursor_id); /* client must provide parameters for update */ if (op == TDS_CURSOR_UPDATE && (!params || params->num_cols <= 0)) return TDS_FAIL; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_set_cur_cursor(tds, cursor); if (IS_TDS50(tds->conn)) { tds->out_flag = TDS_NORMAL; /* FIXME finish*/ tds_set_state(tds, TDS_IDLE); return TDS_FAIL; } if (IS_TDS7_PLUS(tds->conn)) { /* RPC call to sp_cursorclose */ tds_start_query(tds, TDS_RPC); if (IS_TDS71_PLUS(tds->conn)) { tds_put_smallint(tds, -1); tds_put_smallint(tds, TDS_SP_CURSOR); } else { TDS_PUT_N_AS_UCS2(tds, "sp_cursor"); } tds_put_smallint(tds, 0); /* input cursor handle (int) */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, cursor->cursor_id); /* cursor operation */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, 32 | op); /* row number */ tds_put_byte(tds, 0); /* no parameter name */ tds_put_byte(tds, 0); /* input parameter */ tds_put_byte(tds, SYBINTN); tds_put_byte(tds, 4); tds_put_byte(tds, 4); tds_put_int(tds, i_row); /* update require table name */ if (op == TDS_CURSOR_UPDATE) { TDSCOLUMN *param; unsigned int n, num_params; const char *table_name = NULL; TDSFREEZE outer; size_t written; /* empty table name */ tds_put_byte(tds, 0); tds_put_byte(tds, 0); tds_put_byte(tds, XSYBNVARCHAR); num_params = params->num_cols; for (n = 0; n < num_params; ++n) { param = params->columns[n]; if (!tds_dstr_isempty(¶m->table_name)) { table_name = tds_dstr_cstr(¶m->table_name); break; } } tds_freeze(tds, &outer, 2); if (IS_TDS71_PLUS(tds->conn)) tds_put_n(tds, tds->conn->collation, 5); TDS_START_LEN_USMALLINT(tds) { if (table_name) tds_put_string(tds, table_name, -1); written = tds_freeze_written(current_freeze) - 2; } TDS_END_LEN tds_freeze_close_len(&outer, written); /* output columns to update */ for (n = 0; n < num_params; ++n) { param = params->columns[n]; /* TODO check error */ tds_put_data_info(tds, param, TDS_PUT_DATA_USE_NAME|TDS_PUT_DATA_PREFIX_NAME); /* FIXME handle error */ tds_put_data(tds, param); } } tds->current_op = TDS_OP_CURSOR; } return tds_query_flush_packet(tds); } /** * Check if a cursor is allocated into the server. * If is not allocated it assures is removed from the connection list * \tds * \return true if allocated false otherwise */ static bool tds_cursor_check_allocated(TDSCONNECTION * conn, TDSCURSOR * cursor) { if (cursor->srv_status == TDS_CUR_ISTAT_UNUSED || (cursor->srv_status & TDS_CUR_ISTAT_DEALLOC) != 0 || (IS_TDS7_PLUS(conn) && (cursor->srv_status & TDS_CUR_ISTAT_CLOSED) != 0)) { tds_cursor_deallocated(conn, cursor); return false; } return true; } /** * Send a deallocation request to server */ TDSRET tds_cursor_dealloc(TDSSOCKET * tds, TDSCURSOR * cursor) { TDSRET res = TDS_SUCCESS; CHECK_TDS_EXTRA(tds); if (!cursor) return TDS_FAIL; if (!tds_cursor_check_allocated(tds->conn, cursor)) return TDS_SUCCESS; tdsdump_log(TDS_DBG_INFO1, "tds_cursor_dealloc() cursor id = %d\n", cursor->cursor_id); if (IS_TDS50(tds->conn)) { if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_set_cur_cursor(tds, cursor); tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS_CURCLOSE_TOKEN); tds_put_smallint(tds, 5); /* length of the data stream that follows */ tds_put_int(tds, cursor->cursor_id); /* cursor id returned by the server is available now */ tds_put_byte(tds, 0x01); /* Close option: TDS_CUR_COPT_DEALLOC */ res = tds_query_flush_packet(tds); } /* * in TDS 5 the cursor deallocate function involves * a server interaction. The cursor will be freed * when we receive acknowledgement of the cursor * deallocate from the server. for TDS 7 we do it * here... */ if (IS_TDS7_PLUS(tds->conn)) { if (cursor->status.dealloc == TDS_CURSOR_STATE_SENT || cursor->status.dealloc == TDS_CURSOR_STATE_REQUESTED) { tdsdump_log(TDS_DBG_ERROR, "tds_cursor_dealloc(): freeing cursor \n"); } } return res; } /** * Deallocate cursor on idle. * This let libTDS close the cursor when possible. * \tds * \param cursor cursor to close */ TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR * cursor) { CHECK_CONN_EXTRA(conn); CHECK_CURSOR_EXTRA(cursor); /* do not mark if already deallocated */ if (!tds_cursor_check_allocated(conn, cursor)) return TDS_SUCCESS; cursor->defer_close = true; conn->pending_close = 1; return TDS_SUCCESS; } /** * Send a string to server while quoting it. * \tds * \param s string start * \param end string end */ static void tds_quote_and_put(TDSSOCKET * tds, const char *s, const char *end) { char buf[256]; int i; CHECK_TDS_EXTRA(tds); for (i = 0; s != end; ++s) { buf[i++] = *s; if (*s == '\'') buf[i++] = '\''; if (i >= 254) { tds_put_string(tds, buf, i); i = 0; } } tds_put_string(tds, buf, i); } typedef struct tds_quoteout_stream { TDSOUTSTREAM stream; TDSSOCKET *tds; char buffer[2048]; } TDSQUOTEOUTSTREAM; static int tds_quoteout_stream_write(TDSOUTSTREAM *stream, size_t len) { TDSQUOTEOUTSTREAM *s = (TDSQUOTEOUTSTREAM *) stream; TDSSOCKET *tds = s->tds; uint16_t buf[sizeof(s->buffer)]; assert(len <= stream->buf_len); #define QUOTE(type, ch) do { \ type *src, *dst = (type *) buf, *end = (type *) (s->buffer + len); \ \ for (src = (type *) s->buffer; src < end; ++src) { \ if (*src == (ch)) \ *dst++ = *src; \ *dst++ = *src; \ } \ tds_put_n(tds, buf, (char *) dst - (char *) buf); \ } while(0) if (IS_TDS7_PLUS(tds->conn)) QUOTE(uint16_t, TDS_HOST2LE('\'')); else QUOTE(char, '\''); #undef QUOTE return len; } static void tds_quoteout_stream_init(TDSQUOTEOUTSTREAM * stream, TDSSOCKET * tds) { stream->stream.write = tds_quoteout_stream_write; stream->stream.buffer = stream->buffer; stream->stream.buf_len = sizeof(stream->buffer); stream->tds = tds; } static TDSRET tds_put_char_param_as_string(TDSSOCKET * tds, const TDSCOLUMN *curcol) { TDS_CHAR *src; TDSICONV *char_conv = curcol->char_conv; int from, to; TDSSTATICINSTREAM r; TDSQUOTEOUTSTREAM w; src = (TDS_CHAR *) curcol->column_data; if (is_blob_col(curcol)) src = ((TDSBLOB *)src)->textvalue; if (is_unicode_type(curcol->on_server.column_type)) tds_put_string(tds, "N", 1); tds_put_string(tds, "\'", 1); /* Compute proper characted conversion. * The conversion should be to UTF16/UCS2 for MS SQL. * Avoid double conversion, convert directly from client to server. */ from = char_conv ? char_conv->from.charset.canonic : tds->conn->char_convs[client2ucs2]->from.charset.canonic; to = tds->conn->char_convs[IS_TDS7_PLUS(tds->conn) ? client2ucs2 : client2server_chardata]->to.charset.canonic; if (!char_conv || char_conv->to.charset.canonic != to) char_conv = tds_iconv_get_info(tds->conn, from, to); if (!char_conv) return TDS_FAIL; tds_staticin_stream_init(&r, src, curcol->column_cur_size); tds_quoteout_stream_init(&w, tds); tds_convert_stream(tds, char_conv, to_server, &r.stream, &w.stream); tds_put_string(tds, "\'", 1); return TDS_SUCCESS; } /** * Send a parameter to server. * Parameters are converted to string and sent to server. * \tds * \param params parameters structure * \param n number of parameter to send * \returns TDS_FAIL or TDS_SUCCESS */ static TDSRET tds_put_param_as_string(TDSSOCKET * tds, TDSPARAMINFO * params, int n) { TDSCOLUMN *curcol = params->columns[n]; CONV_RESULT cr; TDS_INT res; TDS_CHAR *src; int src_len = curcol->column_cur_size; int i; char buf[256]; bool quote = false; CHECK_TDS_EXTRA(tds); CHECK_PARAMINFO_EXTRA(params); if (src_len < 0) { /* on TDS 4 TEXT/IMAGE cannot be NULL, use empty */ if (!IS_TDS50_PLUS(tds->conn) && is_blob_type(curcol->on_server.column_type)) tds_put_string(tds, "''", 2); else tds_put_string(tds, "NULL", 4); return TDS_SUCCESS; } if (is_char_type(curcol->on_server.column_type)) return tds_put_char_param_as_string(tds, curcol); src = (TDS_CHAR *) curcol->column_data; if (is_blob_col(curcol)) src = ((TDSBLOB *)src)->textvalue; /* we could try to use only tds_convert but is not good in all cases */ switch (curcol->on_server.column_type) { /* binary/char, do conversion in line */ case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: case XSYBBINARY: case XSYBVARBINARY: tds_put_string(tds, "0x", 2); for (i=0; src_len; ++src, --src_len) { buf[i++] = tds_hex_digits[*src >> 4 & 0xF]; buf[i++] = tds_hex_digits[*src & 0xF]; if (i == 256) { tds_put_string(tds, buf, i); i = 0; } } tds_put_string(tds, buf, i); break; /* TODO date, use iso format */ case SYBDATETIME: case SYBDATETIME4: case SYBDATETIMN: case SYBMSTIME: case SYBMSDATE: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYBTIME: case SYBDATE: case SYB5BIGTIME: case SYB5BIGDATETIME: /* TODO use an ISO context */ case SYBUNIQUE: quote = true; default: res = tds_convert(tds_get_ctx(tds), tds_get_conversion_type(curcol->on_server.column_type, curcol->column_size), src, src_len, SYBCHAR, &cr); if (res < 0) return TDS_FAIL; if (quote) tds_put_string(tds, "\'", 1); tds_quote_and_put(tds, cr.c, cr.c + res); if (quote) tds_put_string(tds, "\'", 1); free(cr.c); } return TDS_SUCCESS; } /** * Emulate prepared execute traslating to a normal language */ static TDSRET tds_send_emulated_execute(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params) { int num_placeholders, i; const char *s, *e; CHECK_TDS_EXTRA(tds); assert(query); num_placeholders = tds_count_placeholders(query); if (num_placeholders && num_placeholders > params->num_cols) return TDS_FAIL; /* * NOTE: even for TDS5 we use this packet so to avoid computing * entire sql command */ tds->out_flag = TDS_QUERY; if (!num_placeholders) { tds_put_string(tds, query, -1); return TDS_SUCCESS; } s = query; for (i = 0;; ++i) { e = tds_next_placeholder(s); tds_put_string(tds, s, (int)(e ? e - s : -1)); if (!e) break; /* now translate parameter in string */ tds_put_param_as_string(tds, params, i); s = e + 1; } return TDS_SUCCESS; } enum { MUL_STARTED = 1 }; TDSRET tds_multiple_init(TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS * head) { unsigned char packet_type; multiple->type = type; multiple->flags = 0; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; packet_type = TDS_QUERY; switch (type) { case TDS_MULTIPLE_QUERY: break; case TDS_MULTIPLE_EXECUTE: case TDS_MULTIPLE_RPC: if (IS_TDS7_PLUS(tds->conn)) packet_type = TDS_RPC; break; } if (tds_start_query_head(tds, packet_type, head) != TDS_SUCCESS) return TDS_FAIL; return TDS_SUCCESS; } TDSRET tds_multiple_done(TDSSOCKET *tds, TDSMULTIPLE *multiple) { assert(tds && multiple); return tds_query_flush_packet(tds); } TDSRET tds_multiple_query(TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO * params) { assert(multiple->type == TDS_MULTIPLE_QUERY); if (multiple->flags & MUL_STARTED) tds_put_string(tds, " ", 1); multiple->flags |= MUL_STARTED; return tds_send_emulated_execute(tds, query, params); } TDSRET tds_multiple_execute(TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC * dyn) { assert(multiple->type == TDS_MULTIPLE_EXECUTE); if (IS_TDS7_PLUS(tds->conn)) { if (multiple->flags & MUL_STARTED) { /* TODO define constant */ tds_put_byte(tds, IS_TDS72_PLUS(tds->conn) ? 0xff : 0x80); } multiple->flags |= MUL_STARTED; tds7_send_execute(tds, dyn); return TDS_SUCCESS; } if (multiple->flags & MUL_STARTED) tds_put_string(tds, " ", 1); multiple->flags |= MUL_STARTED; return tds_send_emulated_execute(tds, dyn->query, dyn->params); } /** * Send option commands to server. * Option commands are used to change server options. * \tds * \param command command type. * \param option option to set/get. * \param param parameter value * \param param_size length of parameter value in bytes */ TDSRET tds_submit_optioncmd(TDSSOCKET * tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size) { char cmd[128]; CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_FUNC, "tds_submit_optioncmd() \n"); if (IS_TDS50(tds->conn)) { if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS_OPTIONCMD_TOKEN); tds_put_smallint(tds, 3 + param_size); tds_put_byte(tds, command); tds_put_byte(tds, option); tds_put_byte(tds, param_size); if (param_size) tds_put_n(tds, param, param_size); tds_query_flush_packet(tds); TDS_PROPAGATE(tds_process_simple_query(tds)); return TDS_SUCCESS; } if (!IS_TDS7_PLUS(tds->conn)) return TDS_SUCCESS; cmd[0] = 0; if (command == TDS_OPT_SET) { char datefmt[4]; switch (option) { case TDS_OPT_ANSINULL : sprintf(cmd, "SET ANSI_NULLS %s", param->ti ? "ON" : "OFF"); break; case TDS_OPT_ARITHABORTON : strcpy(cmd, "SET ARITHABORT ON"); break; case TDS_OPT_ARITHABORTOFF : strcpy(cmd, "SET ARITHABORT OFF"); break; case TDS_OPT_ARITHIGNOREON : strcpy(cmd, "SET ARITHIGNORE ON"); break; case TDS_OPT_ARITHIGNOREOFF : strcpy(cmd, "SET ARITHIGNORE OFF"); break; case TDS_OPT_CHAINXACTS : sprintf(cmd, "SET IMPLICIT_TRANSACTIONS %s", param->ti ? "ON" : "OFF"); break; case TDS_OPT_CURCLOSEONXACT : sprintf(cmd, "SET CURSOR_CLOSE_ON_COMMIT %s", param->ti ? "ON" : "OFF"); break; case TDS_OPT_NOCOUNT : sprintf(cmd, "SET NOCOUNT %s", param->ti ? "ON" : "OFF"); break; case TDS_OPT_QUOTED_IDENT : sprintf(cmd, "SET QUOTED_IDENTIFIER %s", param->ti ? "ON" : "OFF"); break; case TDS_OPT_TRUNCABORT : sprintf(cmd, "SET ANSI_WARNINGS %s", param->ti ? "OFF" : "ON"); break; case TDS_OPT_DATEFIRST : sprintf(cmd, "SET DATEFIRST %d", param->ti); break; case TDS_OPT_DATEFORMAT : switch (param->ti) { case TDS_OPT_FMTDMY: strcpy(datefmt,"dmy"); break; case TDS_OPT_FMTDYM: strcpy(datefmt,"dym"); break; case TDS_OPT_FMTMDY: strcpy(datefmt,"mdy"); break; case TDS_OPT_FMTMYD: strcpy(datefmt,"myd"); break; case TDS_OPT_FMTYDM: strcpy(datefmt,"ydm"); break; case TDS_OPT_FMTYMD: strcpy(datefmt,"ymd"); break; } sprintf(cmd, "SET DATEFORMAT %s", datefmt); break; case TDS_OPT_TEXTSIZE: sprintf(cmd, "SET TEXTSIZE %d", (int) param->i); break; /* TODO */ case TDS_OPT_STAT_TIME: case TDS_OPT_STAT_IO: case TDS_OPT_ROWCOUNT: case TDS_OPT_NATLANG: case TDS_OPT_ISOLATION: case TDS_OPT_AUTHON: case TDS_OPT_CHARSET: case TDS_OPT_SHOWPLAN: case TDS_OPT_NOEXEC: case TDS_OPT_PARSEONLY: case TDS_OPT_GETDATA: case TDS_OPT_FORCEPLAN: case TDS_OPT_FORMATONLY: case TDS_OPT_FIPSFLAG: case TDS_OPT_RESTREES: case TDS_OPT_IDENTITYON: case TDS_OPT_CURREAD: case TDS_OPT_CURWRITE: case TDS_OPT_IDENTITYOFF: case TDS_OPT_AUTHOFF: break; } tds_submit_query(tds, cmd); TDS_PROPAGATE(tds_process_simple_query(tds)); } if (command == TDS_OPT_LIST) { int optionval = 0; TDS_INT resulttype; switch (option) { case TDS_OPT_ANSINULL : case TDS_OPT_ARITHABORTON : case TDS_OPT_ARITHABORTOFF : case TDS_OPT_ARITHIGNOREON : case TDS_OPT_ARITHIGNOREOFF : case TDS_OPT_CHAINXACTS : case TDS_OPT_CURCLOSEONXACT : case TDS_OPT_NOCOUNT : case TDS_OPT_QUOTED_IDENT : case TDS_OPT_TRUNCABORT : tdsdump_log(TDS_DBG_FUNC, "SELECT @@options\n"); strcpy(cmd, "SELECT @@options"); break; case TDS_OPT_DATEFIRST : strcpy(cmd, "SELECT @@datefirst"); break; case TDS_OPT_DATEFORMAT : strcpy(cmd, "SELECT DATEPART(dy,'01/02/03')"); break; case TDS_OPT_TEXTSIZE: strcpy(cmd, "SELECT @@textsize"); break; /* TODO */ case TDS_OPT_STAT_TIME: case TDS_OPT_STAT_IO: case TDS_OPT_ROWCOUNT: case TDS_OPT_NATLANG: case TDS_OPT_ISOLATION: case TDS_OPT_AUTHON: case TDS_OPT_CHARSET: case TDS_OPT_SHOWPLAN: case TDS_OPT_NOEXEC: case TDS_OPT_PARSEONLY: case TDS_OPT_GETDATA: case TDS_OPT_FORCEPLAN: case TDS_OPT_FORMATONLY: case TDS_OPT_FIPSFLAG: case TDS_OPT_RESTREES: case TDS_OPT_IDENTITYON: case TDS_OPT_CURREAD: case TDS_OPT_CURWRITE: case TDS_OPT_IDENTITYOFF: case TDS_OPT_AUTHOFF: default: tdsdump_log(TDS_DBG_FUNC, "what!\n"); } tds_submit_query(tds, cmd); while (tds_process_tokens(tds, &resulttype, NULL, TDS_TOKEN_RESULTS) == TDS_SUCCESS) { switch (resulttype) { case TDS_ROWFMT_RESULT: break; case TDS_ROW_RESULT: while (tds_process_tokens(tds, &resulttype, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW) == TDS_SUCCESS) { TDSCOLUMN *col; CONV_RESULT dres; int ctype; unsigned char* src; int srclen; if (resulttype != TDS_ROW_RESULT) break; if (!tds->current_results) continue; col = tds->current_results->columns[0]; ctype = tds_get_conversion_type(col->on_server.column_type, col->column_size); src = col->column_data; srclen = col->column_cur_size; tds_convert(tds_get_ctx(tds), ctype, src, srclen, SYBINT4, &dres); optionval = dres.i; } break; default: break; } } tdsdump_log(TDS_DBG_FUNC, "optionval = %d\n", optionval); switch (option) { case TDS_OPT_CHAINXACTS : tds->option_value = (optionval & 0x02) > 0; break; case TDS_OPT_CURCLOSEONXACT : tds->option_value = (optionval & 0x04) > 0; break; case TDS_OPT_TRUNCABORT : tds->option_value = (optionval & 0x08) > 0; break; case TDS_OPT_ANSINULL : tds->option_value = (optionval & 0x20) > 0; break; case TDS_OPT_ARITHABORTON : tds->option_value = (optionval & 0x40) > 0; break; case TDS_OPT_ARITHABORTOFF : tds->option_value = (optionval & 0x40) > 0; break; case TDS_OPT_ARITHIGNOREON : tds->option_value = (optionval & 0x80) > 0; break; case TDS_OPT_ARITHIGNOREOFF : tds->option_value = (optionval & 0x80) > 0; break; case TDS_OPT_QUOTED_IDENT : tds->option_value = (optionval & 0x0100) > 0; break; case TDS_OPT_NOCOUNT : tds->option_value = (optionval & 0x0200) > 0; break; case TDS_OPT_TEXTSIZE: case TDS_OPT_DATEFIRST : tds->option_value = optionval; break; case TDS_OPT_DATEFORMAT : switch (optionval) { case 61: tds->option_value = TDS_OPT_FMTYDM; break; case 34: tds->option_value = TDS_OPT_FMTYMD; break; case 32: tds->option_value = TDS_OPT_FMTDMY; break; case 60: tds->option_value = TDS_OPT_FMTYDM; break; case 2: tds->option_value = TDS_OPT_FMTMDY; break; case 3: tds->option_value = TDS_OPT_FMTMYD; break; } break; /* TODO */ case TDS_OPT_STAT_TIME: case TDS_OPT_STAT_IO: case TDS_OPT_ROWCOUNT: case TDS_OPT_NATLANG: case TDS_OPT_ISOLATION: case TDS_OPT_AUTHON: case TDS_OPT_CHARSET: case TDS_OPT_SHOWPLAN: case TDS_OPT_NOEXEC: case TDS_OPT_PARSEONLY: case TDS_OPT_GETDATA: case TDS_OPT_FORCEPLAN: case TDS_OPT_FORMATONLY: case TDS_OPT_FIPSFLAG: case TDS_OPT_RESTREES: case TDS_OPT_IDENTITYON: case TDS_OPT_CURREAD: case TDS_OPT_CURWRITE: case TDS_OPT_IDENTITYOFF: case TDS_OPT_AUTHOFF: break; } tdsdump_log(TDS_DBG_FUNC, "tds_submit_optioncmd: returned option_value = %d\n", tds->option_value); } return TDS_SUCCESS; } /** * Send a rollback request. * TDS 7.2+ need this in order to handle transactions correctly if MARS is used. * \tds * \sa tds_submit_commit, tds_submit_rollback */ TDSRET tds_submit_begin_tran(TDSSOCKET *tds) { CHECK_TDS_EXTRA(tds); if (!IS_TDS72_PLUS(tds->conn)) return tds_submit_query(tds, "BEGIN TRANSACTION"); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_start_query(tds, TDS7_TRANS); /* begin transaction */ tds_put_smallint(tds, 5); tds_put_byte(tds, 0); /* new transaction level TODO */ tds_put_byte(tds, 0); /* new transaction name */ return tds_query_flush_packet(tds); } /** * Send a rollback request. * TDS 7.2+ need this in order to handle transactions correctly if MARS is used. * \tds * \param cont true to start a new transaction * \sa tds_submit_begin_tran, tds_submit_commit */ TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont) { CHECK_TDS_EXTRA(tds); if (!IS_TDS72_PLUS(tds->conn)) return tds_submit_query(tds, cont ? "IF @@TRANCOUNT > 0 ROLLBACK BEGIN TRANSACTION" : "IF @@TRANCOUNT > 0 ROLLBACK"); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_start_query(tds, TDS7_TRANS); tds_put_smallint(tds, 8); /* rollback */ tds_put_byte(tds, 0); /* name */ if (cont) { tds_put_byte(tds, 1); tds_put_byte(tds, 0); /* new transaction level TODO */ tds_put_byte(tds, 0); /* new transaction name */ } else { tds_put_byte(tds, 0); /* do not continue */ } return tds_query_flush_packet(tds); } /** * Send a commit request. * TDS 7.2+ need this in order to handle transactions correctly if MARS is used. * \tds * \param cont true to start a new transaction * \sa tds_submit_rollback, tds_submit_begin_tran */ TDSRET tds_submit_commit(TDSSOCKET *tds, int cont) { CHECK_TDS_EXTRA(tds); if (!IS_TDS72_PLUS(tds->conn)) return tds_submit_query(tds, cont ? "IF @@TRANCOUNT > 0 COMMIT BEGIN TRANSACTION" : "IF @@TRANCOUNT > 0 COMMIT"); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_start_query(tds, TDS7_TRANS); tds_put_smallint(tds, 7); /* commit */ tds_put_byte(tds, 0); /* name */ if (cont) { tds_put_byte(tds, 1); tds_put_byte(tds, 0); /* new transaction level TODO */ tds_put_byte(tds, 0); /* new transaction name */ } else { tds_put_byte(tds, 0); /* do not continue */ } return tds_query_flush_packet(tds); } static const TDSCONTEXT empty_ctx = {0}; TDSRET tds_disconnect(TDSSOCKET * tds) { TDS_INT old_timeout; const TDSCONTEXT *old_ctx; CHECK_TDS_EXTRA(tds); tdsdump_log(TDS_DBG_FUNC, "tds_disconnect() \n"); if (!IS_TDS50(tds->conn)) return TDS_SUCCESS; old_timeout = tds->query_timeout; old_ctx = tds_get_ctx(tds); /* avoid to stall forever */ tds->query_timeout = 5; /* do not report errors to upper libraries */ tds_set_ctx(tds, &empty_ctx); if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) { tds->query_timeout = old_timeout; tds_set_ctx(tds, old_ctx); return TDS_FAIL; } tds->out_flag = TDS_NORMAL; tds_put_byte(tds, TDS_LOGOUT_TOKEN); tds_put_byte(tds, 0); tds_query_flush_packet(tds); return tds_process_simple_query(tds); } /* * TODO add function to return type suitable for param * ie: * sybvarchar -> sybvarchar / xsybvarchar * sybint4 -> sybintn */ /** @} */ freetds-1.3.6/src/tds/iconv.c000644 025423 025423 00000104106 14111343115 017442 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * \file * \brief Handle character conversions to/from server */ #include #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H #include #endif #include #include #include #include #if HAVE_ICONV #include #endif #define CHARSIZE(charset) ( ((charset)->min_bytes_per_char == (charset)->max_bytes_per_char )? \ (charset)->min_bytes_per_char : 0 ) static int collate2charset(TDSCONNECTION * conn, TDS_UCHAR collate[5]); static size_t skip_one_input_sequence(iconv_t cd, const TDS_ENCODING * charset, const char **input, size_t * input_size); static int tds_iconv_info_init(TDSICONV * char_conv, int client_canonic, int server_canonic); static int tds_iconv_init(void); static void _iconv_close(iconv_t * cd); static void tds_iconv_info_close(TDSICONV * char_conv); /** * \ingroup libtds * \defgroup conv Charset conversion * Convert between different charsets. */ #define TDS_ICONV_ENCODING_TABLES #include /* this will contain real iconv names */ static const char *iconv_names[TDS_VECTOR_SIZE(canonic_charsets)]; static int iconv_initialized = 0; static const char *ucs2name; enum { POS_ISO1, POS_UTF8, POS_UCS2LE, POS_UCS2BE }; static const struct { uint32_t len; /* this field must be aligned at least to 2 bytes */ char data[12]; } test_strings[4] = { /* same string in required charsets */ { 4, "Ao\xD3\xE5" }, { 6, "Ao\xC3\x93\xC3\xA5" }, { 8, "A\x00o\x000\xD3\x00\xE5\x00" }, { 8, "\x00" "A\x00o\x000\xD3\x00\xE5" }, }; /** * Initialize charset searching for UTF-8, UCS-2 and ISO8859-1 */ static int tds_iconv_init(void) { int i; iconv_t cd; /* first entries should be constants */ assert(strcmp(canonic_charsets[POS_ISO1].name, "ISO-8859-1") == 0); assert(strcmp(canonic_charsets[POS_UTF8].name, "UTF-8") == 0); assert(strcmp(canonic_charsets[POS_UCS2LE].name, "UCS-2LE") == 0); assert(strcmp(canonic_charsets[POS_UCS2BE].name, "UCS-2BE") == 0); /* fast tests for GNU-iconv */ cd = tds_sys_iconv_open("ISO-8859-1", "UTF-8"); if (cd != (iconv_t) -1) { iconv_names[POS_ISO1] = "ISO-8859-1"; iconv_names[POS_UTF8] = "UTF-8"; tds_sys_iconv_close(cd); } else { /* search names for ISO8859-1 and UTF-8 */ for (i = 0; iconv_aliases[i].alias; ++i) { int j; if (iconv_aliases[i].canonic != POS_ISO1) continue; for (j = 0; iconv_aliases[j].alias; ++j) { if (iconv_aliases[j].canonic != POS_UTF8) continue; cd = tds_sys_iconv_open(iconv_aliases[i].alias, iconv_aliases[j].alias); if (cd != (iconv_t) -1) { iconv_names[POS_ISO1] = iconv_aliases[i].alias; iconv_names[POS_UTF8] = iconv_aliases[j].alias; tds_sys_iconv_close(cd); break; } } if (iconv_names[POS_ISO1]) break; } /* required characters not found !!! */ if (!iconv_names[POS_ISO1]) return 1; } /* now search for UCS-2 */ cd = tds_sys_iconv_open(iconv_names[POS_ISO1], "UCS-2LE"); if (cd != (iconv_t) -1) { iconv_names[POS_UCS2LE] = "UCS-2LE"; tds_sys_iconv_close(cd); } cd = tds_sys_iconv_open(iconv_names[POS_ISO1], "UCS-2BE"); if (cd != (iconv_t) -1) { iconv_names[POS_UCS2BE] = "UCS-2BE"; tds_sys_iconv_close(cd); } /* long search needed ?? */ if (!iconv_names[POS_UCS2LE] || !iconv_names[POS_UCS2BE]) { for (i = 0; iconv_aliases[i].alias; ++i) { if (strncmp(canonic_charsets[iconv_aliases[i].canonic].name, "UCS-2", 5) != 0) continue; cd = tds_sys_iconv_open(iconv_aliases[i].alias, iconv_names[POS_ISO1]); if (cd != (iconv_t) -1) { char ib[1]; char ob[4]; size_t il, ol; ICONV_CONST char *pib; char *pob; int byte_sequence = 0; /* try to convert 'A' and check result */ ib[0] = 0x41; pib = ib; pob = ob; il = 1; ol = 4; ob[0] = ob[1] = 0; if (tds_sys_iconv(cd, &pib, &il, &pob, &ol) != (size_t) - 1) { /* byte order sequence ?? */ if (ol == 0) { ob[0] = ob[2]; byte_sequence = 1; /* TODO save somewhere */ } /* save name without sequence (if present) */ if (ob[0]) il = POS_UCS2LE; else il = POS_UCS2BE; if (!iconv_names[il] || !byte_sequence) iconv_names[il] = iconv_aliases[i].alias; } tds_sys_iconv_close(cd); } } } /* we need a UCS-2 (big endian or little endian) */ if (!iconv_names[POS_UCS2LE] && !iconv_names[POS_UCS2BE]) return 2; ucs2name = iconv_names[POS_UCS2LE] ? iconv_names[POS_UCS2LE] : iconv_names[POS_UCS2BE]; for (i = 0; i < 4; ++i) tdsdump_log(TDS_DBG_INFO1, "local name for %s is %s\n", canonic_charsets[i].name, iconv_names[i] ? iconv_names[i] : "(null)"); /* base conversions checks */ for (i = 0; i < 4 * 4; ++i) { const int from = i / 4; const int to = i % 4; char ob[16]; size_t il, ol; ICONV_CONST char *pib; char *pob; size_t res; if (!iconv_names[from] || !iconv_names[to]) continue; cd = tds_sys_iconv_open(iconv_names[to], iconv_names[from]); if (cd == (iconv_t) -1) return 1; pib = (ICONV_CONST char *) test_strings[from].data; il = test_strings[from].len; pob = ob; ol = sizeof(ob); res = tds_sys_iconv(cd, &pib, &il, &pob, &ol); tds_sys_iconv_close(cd); if (res != 0 || sizeof(ob) - ol != test_strings[to].len || memcmp(ob, test_strings[to].data, test_strings[to].len) != 0) return 1; } /* success (it should always occurs) */ return 0; } /** * Get iconv name given canonic */ static const char * tds_set_iconv_name(int charset) { int i; iconv_t cd; assert(iconv_initialized); /* try using canonic name and UTF-8 and UCS2 */ cd = tds_sys_iconv_open(iconv_names[POS_UTF8], canonic_charsets[charset].name); if (cd != (iconv_t) -1) { iconv_names[charset] = canonic_charsets[charset].name; tds_sys_iconv_close(cd); return iconv_names[charset]; } cd = tds_sys_iconv_open(ucs2name, canonic_charsets[charset].name); if (cd != (iconv_t) -1) { iconv_names[charset] = canonic_charsets[charset].name; tds_sys_iconv_close(cd); return iconv_names[charset]; } /* try all alternatives */ for (i = 0; iconv_aliases[i].alias; ++i) { if (iconv_aliases[i].canonic != charset) continue; cd = tds_sys_iconv_open(iconv_names[POS_UTF8], iconv_aliases[i].alias); if (cd != (iconv_t) -1) { iconv_names[charset] = iconv_aliases[i].alias; tds_sys_iconv_close(cd); return iconv_names[charset]; } cd = tds_sys_iconv_open(ucs2name, iconv_aliases[i].alias); if (cd != (iconv_t) -1) { iconv_names[charset] = iconv_aliases[i].alias; tds_sys_iconv_close(cd); return iconv_names[charset]; } } /* charset not found, pretend it's ISO 8859-1 */ iconv_names[charset] = canonic_charsets[POS_ISO1].name; return NULL; } static void tds_iconv_reset(TDSICONV *conv) { /* * (min|max)_bytes_per_char can be used to divide * so init to safe values */ conv->to.charset.min_bytes_per_char = 1; conv->to.charset.max_bytes_per_char = 1; conv->from.charset.min_bytes_per_char = 1; conv->from.charset.max_bytes_per_char = 1; conv->to.charset.name = conv->from.charset.name = ""; conv->to.charset.canonic = conv->from.charset.canonic = 0; conv->to.cd = (iconv_t) -1; conv->from.cd = (iconv_t) -1; } /** * Allocate iconv stuff * \return 0 for success */ int tds_iconv_alloc(TDSCONNECTION * conn) { int i; TDSICONV *char_conv; assert(!conn->char_convs); if (!(conn->char_convs = tds_new(TDSICONV *, initial_char_conv_count + 1))) return 1; char_conv = tds_new0(TDSICONV, initial_char_conv_count); if (!char_conv) { TDS_ZERO_FREE(conn->char_convs); return 1; } conn->char_conv_count = initial_char_conv_count + 1; for (i = 0; i < initial_char_conv_count; ++i) { conn->char_convs[i] = &char_conv[i]; tds_iconv_reset(&char_conv[i]); } /* chardata is just a pointer to another iconv info */ conn->char_convs[initial_char_conv_count] = conn->char_convs[client2server_chardata]; return 0; } /** * \addtogroup conv * @{ * Set up the initial iconv conversion descriptors. * When the socket is allocated, three TDSICONV structures are attached to iconv. * They have fixed meanings: * \li 0. Client <-> UCS-2 (client2ucs2) * \li 1. Client <-> server single-byte charset (client2server_chardata) * * Other designs that use less data are possible, but these three conversion needs are * very often needed. By reserving them, we avoid searching the array for our most common purposes. * * To solve different iconv names and portability problems FreeTDS maintains * a list of aliases each charset. * * First we discover the names of our minimum required charsets (UTF-8, ISO8859-1 and UCS2). * Later, as and when it's needed, we try to discover others. * * There is one list of canonic names (GNU iconv names) and two sets of aliases * (one for other iconv implementations and another for Sybase). For every * canonic charset name we cache the iconv name found during discovery. */ TDSRET tds_iconv_open(TDSCONNECTION * conn, const char *charset, int use_utf16) { static const char UCS_2LE[] = "UCS-2LE"; int canonic; int canonic_charset = tds_canonical_charset(charset); int canonic_env_charset = conn->env.charset ? tds_canonical_charset(conn->env.charset) : -1; int fOK, ret; TDS_ENCODING *client = &conn->char_convs[client2ucs2]->from.charset; TDS_ENCODING *server = &conn->char_convs[client2ucs2]->to.charset; tdsdump_log(TDS_DBG_FUNC, "tds_iconv_open(%p, %s)\n", conn, charset); /* TDS 5.0 support only UTF-16 encodings */ if (IS_TDS50(conn)) use_utf16 = true; /* initialize */ if (!iconv_initialized) { if ((ret = tds_iconv_init()) > 0) { static const char names[][12] = { "ISO 8859-1", "UCS-2" }; assert(ret < 3); tdsdump_log(TDS_DBG_FUNC, "error: tds_iconv_init() returned %d; " "could not find a name for %s that your iconv accepts.\n" "use: \"configure --disable-libiconv\"", ret, names[ret-1]); return TDS_FAIL; } iconv_initialized = 1; } /* * Client <-> UCS-2 (client2ucs2) */ tdsdump_log(TDS_DBG_FUNC, "setting up conversions for client charset \"%s\"\n", charset); tdsdump_log(TDS_DBG_FUNC, "preparing iconv for \"%s\" <-> \"%s\" conversion\n", charset, UCS_2LE); fOK = 0; if (use_utf16) { canonic = TDS_CHARSET_UTF_16LE; fOK = tds_iconv_info_init(conn->char_convs[client2ucs2], canonic_charset, canonic); } if (!fOK) { canonic = TDS_CHARSET_UCS_2LE; fOK = tds_iconv_info_init(conn->char_convs[client2ucs2], canonic_charset, canonic); } if (!fOK) return TDS_FAIL; /* * How many UTF-8 bytes we need is a function of what the input character set is. * TODO This could definitely be more sophisticated, but it deals with the common case. */ if (client->min_bytes_per_char == 1 && client->max_bytes_per_char == 4 && server->max_bytes_per_char == 1) { /* ie client is UTF-8 and server is ISO-8859-1 or variant. */ client->max_bytes_per_char = 3; } /* * Client <-> server single-byte charset * TODO: the server hasn't reported its charset yet, so this logic can't work here. * not sure what to do about that yet. */ conn->char_convs[client2server_chardata]->flags = TDS_ENCODING_MEMCPY; if (canonic_env_charset >= 0) { tdsdump_log(TDS_DBG_FUNC, "preparing iconv for \"%s\" <-> \"%s\" conversion\n", charset, conn->env.charset); fOK = tds_iconv_info_init(conn->char_convs[client2server_chardata], canonic_charset, canonic_env_charset); if (!fOK) return TDS_FAIL; } else { conn->char_convs[client2server_chardata]->from.charset = canonic_charsets[canonic_charset]; conn->char_convs[client2server_chardata]->to.charset = canonic_charsets[canonic_charset]; } tdsdump_log(TDS_DBG_FUNC, "tds_iconv_open: done\n"); return TDS_SUCCESS; } /** * Open iconv descriptors to convert between character sets (both directions). * 1. Look up the canonical names of the character sets. * 2. Look up their widths. * 3. Ask iconv to open a conversion descriptor. * 4. Fail if any of the above offer any resistance. * \remarks The charset names written to \a iconv will be the canonical names, * not necessarily the names passed in. */ static int tds_iconv_info_init(TDSICONV * char_conv, int client_canonical, int server_canonical) { TDS_ENCODING *client = &char_conv->from.charset; TDS_ENCODING *server = &char_conv->to.charset; assert(char_conv->to.cd == (iconv_t) -1); assert(char_conv->from.cd == (iconv_t) -1); if (client_canonical < 0) { tdsdump_log(TDS_DBG_FUNC, "tds_iconv_info_init: client charset name \"%d\" invalid\n", client_canonical); return 0; } if (server_canonical < 0) { tdsdump_log(TDS_DBG_FUNC, "tds_iconv_info_init: server charset name \"%d\" invalid\n", server_canonical); return 0; } *client = canonic_charsets[client_canonical]; *server = canonic_charsets[server_canonical]; /* special case, same charset, no conversion */ if (client_canonical == server_canonical) { char_conv->to.cd = (iconv_t) -1; char_conv->from.cd = (iconv_t) -1; char_conv->flags = TDS_ENCODING_MEMCPY; return 1; } char_conv->flags = 0; /* get iconv names */ if (!iconv_names[client_canonical]) { if (!tds_set_iconv_name(client_canonical)) { tdsdump_log(TDS_DBG_FUNC, "Charset %d not supported by iconv, using \"%s\" instead\n", client_canonical, iconv_names[client_canonical]); } } if (!iconv_names[server_canonical]) { if (!tds_set_iconv_name(server_canonical)) { tdsdump_log(TDS_DBG_FUNC, "Charset %d not supported by iconv, using \"%s\" instead\n", server_canonical, iconv_names[server_canonical]); } } char_conv->to.cd = tds_sys_iconv_open(iconv_names[server_canonical], iconv_names[client_canonical]); if (char_conv->to.cd == (iconv_t) -1) { tdsdump_log(TDS_DBG_FUNC, "tds_iconv_info_init: cannot convert \"%s\"->\"%s\"\n", client->name, server->name); } char_conv->from.cd = tds_sys_iconv_open(iconv_names[client_canonical], iconv_names[server_canonical]); if (char_conv->from.cd == (iconv_t) -1) { tdsdump_log(TDS_DBG_FUNC, "tds_iconv_info_init: cannot convert \"%s\"->\"%s\"\n", server->name, client->name); } /* TODO, do some optimizations like UCS2 -> UTF8 min,max = 2,2 (UCS2) and 1,4 (UTF8) */ /* tdsdump_log(TDS_DBG_FUNC, "tds_iconv_info_init: converting \"%s\"->\"%s\"\n", client->name, server->name); */ return 1; } static void _iconv_close(iconv_t * cd) { static const iconv_t invalid = (iconv_t) -1; if (*cd != invalid) { tds_sys_iconv_close(*cd); *cd = invalid; } } static void tds_iconv_info_close(TDSICONV * char_conv) { _iconv_close(&char_conv->to.cd); _iconv_close(&char_conv->from.cd); } void tds_iconv_close(TDSCONNECTION * conn) { int i; for (i = 0; i < conn->char_conv_count; ++i) tds_iconv_info_close(conn->char_convs[i]); } #define CHUNK_ALLOC 4 void tds_iconv_free(TDSCONNECTION * conn) { int i; if (!conn->char_convs) return; tds_iconv_close(conn); free(conn->char_convs[0]); for (i = initial_char_conv_count + 1; i < conn->char_conv_count; i += CHUNK_ALLOC) free(conn->char_convs[i]); TDS_ZERO_FREE(conn->char_convs); conn->char_conv_count = 0; } static void tds_iconv_err(TDSSOCKET *tds, int err) { if (tds) tdserror(tds_get_ctx(tds), tds, err, 0); } /** * Wrapper around iconv(3). Same parameters, with slightly different behavior. * \param tds state information for the socket and the TDS protocol * \param io Enumerated value indicating whether the data are being sent to or received from the server. * \param conv information about the encodings involved, including the iconv(3) conversion descriptors. * \param inbuf address of pointer to the input buffer of data to be converted. * \param inbytesleft address of count of bytes in \a inbuf. * \param outbuf address of pointer to the output buffer. * \param outbytesleft address of count of bytes in \a outbuf. * \retval number of irreversible conversions performed. -1 on error, see iconv(3) documentation for * a description of the possible values of \e errno. * \remarks Unlike iconv(3), none of the arguments can be nor point to NULL. Like iconv(3), all pointers will * be updated. Success is signified by a nonnegative return code and \a *inbytesleft == 0. * If the conversion descriptor in \a iconv is -1 or NULL, \a inbuf is copied to \a outbuf, * and all parameters updated accordingly. * * If a character in \a inbuf cannot be converted because no such cbaracter exists in the * \a outbuf character set, we emit messages similar to the ones Sybase emits when it fails such a conversion. * The message varies depending on the direction of the data. * On a read error, we emit Msg 2403, Severity 16 (EX_INFO): * "WARNING! Some character(s) could not be converted into client's character set. * Unconverted bytes were changed to question marks ('?')." * On a write error we emit Msg 2402, Severity 16 (EX_USER): * "Error converting client characters into server's character set. Some character(s) could not be converted." * and return an error code. Client libraries relying on this routine should reflect an error back to the application. * * \todo Check for variable multibyte non-UTF-8 input character set. * \todo Use more robust error message generation. * \todo For reads, cope with \a outbuf encodings that don't have the equivalent of an ASCII '?'. * \todo Support alternative to '?' for the replacement character. */ size_t tds_iconv(TDSSOCKET * tds, TDSICONV * conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft) { static const iconv_t invalid = (iconv_t) -1; TDSICONVDIR *from = NULL; TDSICONVDIR *to = NULL; iconv_t error_cd = invalid; char quest_mark[] = "?"; /* best to leave non-const; implementations vary */ ICONV_CONST char *pquest_mark; size_t lquest_mark; size_t irreversible; size_t one_character; bool eilseq_raised = false; int conv_errno; /* cast away const-ness */ TDS_ERRNO_MESSAGE_FLAGS *suppress = (TDS_ERRNO_MESSAGE_FLAGS*) &conv->suppress; assert(inbuf && inbytesleft && outbuf && outbytesleft); /* if empty there's nothing to return. * This fix case with some iconv implementation that does * not handle *inbuf == NULL and *inbytesleft == 0 as * empty strings */ if (*inbytesleft == 0) return 0; switch (io) { case to_server: from = &conv->from; to = &conv->to; break; case to_client: from = &conv->to; to = &conv->from; break; default: tdsdump_log(TDS_DBG_FUNC, "tds_iconv: unable to determine if %d means in or out. \n", io); assert(io == to_server || io == to_client); break; } /* silly case, memcpy */ if (conv->flags & TDS_ENCODING_MEMCPY || to->cd == invalid) { size_t len = *inbytesleft < *outbytesleft ? *inbytesleft : *outbytesleft; memcpy(*outbuf, *inbuf, len); conv_errno = *inbytesleft > *outbytesleft ? E2BIG : 0; *inbytesleft -= len; *outbytesleft -= len; *inbuf += len; *outbuf += len; errno = conv_errno; return conv_errno ? (size_t) -1 : 0; } /* * Call iconv() as many times as necessary, until we reach the end of input or exhaust output. */ for (;;) { conv_errno = 0; irreversible = tds_sys_iconv(to->cd, (ICONV_CONST char **) inbuf, inbytesleft, outbuf, outbytesleft); /* iconv success, return */ if (irreversible != (size_t) - 1) { /* here we detect end of conversion and try to reset shift state */ if (inbuf) { /* * if inbuf or *inbuf is NULL iconv reset the shift state. * Note that setting inbytesleft to NULL can cause core so don't do it! */ inbuf = NULL; continue; } break; } /* save errno, other function could change its value */ conv_errno = errno; if (conv_errno == EILSEQ) eilseq_raised = true; if (conv_errno != EILSEQ || io != to_client || !inbuf) break; /* * Invalid input sequence encountered reading from server. * Skip one input sequence, adjusting pointers. */ one_character = skip_one_input_sequence(to->cd, &from->charset, inbuf, inbytesleft); if (!one_character) break; /* * To replace invalid input with '?', we have to convert a UTF-8 '?' into the output character set. * In unimaginably weird circumstances, this might be impossible. * We use UTF-8 instead of ASCII because some implementations * do not convert singlebyte <-> singlebyte. */ if (error_cd == invalid) { error_cd = tds_sys_iconv_open(to->charset.name, iconv_names[POS_UTF8]); if (error_cd == invalid) { break; /* what to do? */ } } lquest_mark = 1; pquest_mark = quest_mark; irreversible = tds_sys_iconv(error_cd, &pquest_mark, &lquest_mark, outbuf, outbytesleft); if (irreversible == (size_t) - 1) break; if (!*inbytesleft) break; } if (eilseq_raised && !suppress->eilseq) { /* invalid multibyte input sequence encountered */ if (io == to_client) { if (irreversible == (size_t) - 1) { tds_iconv_err(tds, TDSEICONV2BIG); } else { tds_iconv_err(tds, TDSEICONVI); conv_errno = 0; } } else { tds_iconv_err(tds, TDSEICONVO); } suppress->eilseq = 1; } switch (conv_errno) { case EINVAL: /* incomplete multibyte sequence is encountered */ if (suppress->einval) break; /* in chunk conversion this can mean we end a chunk inside a character */ tds_iconv_err(tds, TDSEICONVAVAIL); suppress->einval = 1; break; case E2BIG: /* output buffer has no more room */ if (suppress->e2big) break; tds_iconv_err(tds, TDSEICONVIU); suppress->e2big = 1; break; default: break; } if (error_cd != invalid) { tds_sys_iconv_close(error_cd); } errno = conv_errno; return irreversible; } /** * Get a iconv info structure, allocate and initialize if needed */ TDSICONV * tds_iconv_get_info(TDSCONNECTION * conn, int canonic_client, int canonic_server) { TDSICONV *info; int i; /* search a charset from already allocated charsets */ for (i = conn->char_conv_count; --i >= initial_char_conv_count;) if (canonic_client == conn->char_convs[i]->from.charset.canonic && canonic_server == conn->char_convs[i]->to.charset.canonic) return conn->char_convs[i]; /* allocate a new iconv structure */ if (conn->char_conv_count % CHUNK_ALLOC == ((initial_char_conv_count + 1) % CHUNK_ALLOC)) { TDSICONV **p; TDSICONV *infos; infos = tds_new(TDSICONV, CHUNK_ALLOC); if (!infos) return NULL; p = (TDSICONV **) realloc(conn->char_convs, sizeof(TDSICONV *) * (conn->char_conv_count + CHUNK_ALLOC)); if (!p) { free(infos); return NULL; } conn->char_convs = p; memset(infos, 0, sizeof(TDSICONV) * CHUNK_ALLOC); for (i = 0; i < CHUNK_ALLOC; ++i) { conn->char_convs[i + conn->char_conv_count] = &infos[i]; tds_iconv_reset(&infos[i]); } } info = conn->char_convs[conn->char_conv_count++]; /* init */ if (tds_iconv_info_init(info, canonic_client, canonic_server)) return info; tds_iconv_info_close(info); --conn->char_conv_count; return NULL; } TDSICONV * tds_iconv_get(TDSCONNECTION * conn, const char *client_charset, const char *server_charset) { int canonic_client_charset_num = tds_canonical_charset(client_charset); int canonic_server_charset_num = tds_canonical_charset(server_charset); if (canonic_client_charset_num < 0) { tdsdump_log(TDS_DBG_FUNC, "tds_iconv_get: what is charset \"%s\"?\n", client_charset); return NULL; } if (canonic_server_charset_num < 0) { tdsdump_log(TDS_DBG_FUNC, "tds_iconv_get: what is charset \"%s\"?\n", server_charset); return NULL; } return tds_iconv_get_info(conn, canonic_client_charset_num, canonic_server_charset_num); } /* change singlebyte conversions according to server */ static void tds_srv_charset_changed_num(TDSCONNECTION * conn, int canonic_charset_num) { TDSICONV *char_conv = conn->char_convs[client2server_chardata]; if (IS_TDS7_PLUS(conn) && canonic_charset_num == TDS_CHARSET_ISO_8859_1) canonic_charset_num = TDS_CHARSET_CP1252; tdsdump_log(TDS_DBG_FUNC, "setting server single-byte charset to \"%s\"\n", canonic_charsets[canonic_charset_num].name); if (canonic_charset_num == char_conv->to.charset.canonic) return; /* find and set conversion */ char_conv = tds_iconv_get_info(conn, conn->char_convs[client2ucs2]->from.charset.canonic, canonic_charset_num); if (char_conv) conn->char_convs[client2server_chardata] = char_conv; } void tds_srv_charset_changed(TDSCONNECTION * conn, const char *charset) { int n = tds_canonical_charset(charset); /* ignore request to change to unknown charset */ if (n < 0) { tdsdump_log(TDS_DBG_FUNC, "tds_srv_charset_changed: what is charset \"%s\"?\n", charset); return; } tds_srv_charset_changed_num(conn, n); } /* change singlebyte conversions according to server */ void tds7_srv_charset_changed(TDSCONNECTION * conn, TDS_UCHAR collation[5]) { tds_srv_charset_changed_num(conn, collate2charset(conn, collation)); } /** * Move the input sequence pointer to the next valid position. * Used when an input character cannot be converted. * \returns number of bytes to skip. */ /* FIXME possible buffer reading overflow ?? */ static size_t skip_one_input_sequence(iconv_t cd, const TDS_ENCODING * charset, const char **input, size_t * input_size) { unsigned charsize = CHARSIZE(charset); char ib[16]; char ob[16]; ICONV_CONST char *pib; char *pob; size_t il, ol, l; iconv_t cd2; /* usually fixed size and UTF-8 do not have state, so do not reset it */ if (charsize) goto skip_charsize; if (0 == strcmp(charset->name, "UTF-8")) { /* * Deal with UTF-8. * bytes | bits | representation * 1 | 7 | 0vvvvvvv * 2 | 11 | 110vvvvv 10vvvvvv * 3 | 16 | 1110vvvv 10vvvvvv 10vvvvvv * 4 | 21 | 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */ int c = **input; c = c & (c >> 1); do { ++charsize; } while ((c <<= 1) & 0x80); goto skip_charsize; } /* handle state encoding */ /* extract state from iconv */ pob = ib; ol = sizeof(ib); tds_sys_iconv(cd, NULL, NULL, &pob, &ol); /* init destination conversion */ /* TODO use largest fixed size for this platform */ cd2 = tds_sys_iconv_open("UCS-4", charset->name); if (cd2 == (iconv_t) -1) return 0; /* add part of input */ il = ol; if (il > *input_size) il = *input_size; l = sizeof(ib) - ol; memcpy(ib + l, *input, il); il += l; /* translate a single character */ pib = ib; pob = ob; /* TODO use size of largest fixed charset */ ol = 4; tds_sys_iconv(cd2, &pib, &il, &pob, &ol); /* adjust input */ l = (pib - ib) - l; *input += l; *input_size -= l; /* extract state */ pob = ib; ol = sizeof(ib); tds_sys_iconv(cd, NULL, NULL, &pob, &ol); /* set input state */ pib = ib; il = sizeof(ib) - ol; pob = ob; ol = sizeof(ob); tds_sys_iconv(cd, &pib, &il, &pob, &ol); tds_sys_iconv_close(cd2); if (l != 0) return l; /* last blindly attempt, skip minimum bytes */ charsize = charset->min_bytes_per_char; /* fall through */ skip_charsize: if (charsize > *input_size) return 0; *input += charsize; *input_size -= charsize; return charsize; } #include /** * Determine canonical iconv character set. * \returns canonical position, or -1 if lookup failed. * \remarks Returned name can be used in bytes_per_char(), above. */ int tds_canonical_charset(const char *charset_name) { const struct charset_alias *c = charset_lookup(charset_name, strlen(charset_name)); return c ? c->canonic : -1; } /** * Determine canonical iconv character set name. * \returns canonical name, or NULL if lookup failed. * \remarks Returned name can be used in bytes_per_char(), above. */ const char * tds_canonical_charset_name(const char *charset_name) { int res; /* get numeric pos */ res = tds_canonical_charset(charset_name); if (res >= 0) return canonic_charsets[res].name; return charset_name; /* hope for the best */ } static int collate2charset(TDSCONNECTION * conn, TDS_UCHAR collate[5]) { int cp = 0; const int sql_collate = collate[4]; /* extract 16 bit of LCID (it's 20 bits but higher 4 are just variations) */ const int lcid = TDS_GET_UA2LE(collate); /* starting with bit 20 (little endian, so 3rd byte bit 4) there are 8 bits: * fIgnoreCase fIgnoreAccent fIgnoreKana fIgnoreWidth fBinary fBinary2 fUTF8 FRESERVEDBIT * so fUTF8 is on the 4th byte bit 2 */ if ((collate[3] & 0x4) != 0 && IS_TDS74_PLUS(conn)) return TDS_CHARSET_UTF_8; /* * The table from the MSQLServer reference "Windows Collation Designators" * and from " NLS Information for Microsoft Windows XP". * * See also https://go.microsoft.com/fwlink/?LinkId=119987 [MSDN-SQLCollation] */ switch (sql_collate) { case 30: /* SQL_Latin1_General_CP437_BIN */ case 31: /* SQL_Latin1_General_CP437_CS_AS */ case 32: /* SQL_Latin1_General_CP437_CI_AS */ case 33: /* SQL_Latin1_General_Pref_CP437_CI_AS */ case 34: /* SQL_Latin1_General_CP437_CI_AI */ return TDS_CHARSET_CP437; case 40: /* SQL_Latin1_General_CP850_BIN */ case 41: /* SQL_Latin1_General_CP850_CS_AS */ case 42: /* SQL_Latin1_General_CP850_CI_AS */ case 43: /* SQL_Latin1_General_Pref_CP850_CI_AS */ case 44: /* SQL_Latin1_General_CP850_CI_AI */ case 49: /* SQL_1xCompat_CP850_CI_AS */ case 55: /* SQL_AltDiction_CP850_CS_AS */ case 56: /* SQL_AltDiction_Pref_CP850_CI_AS */ case 57: /* SQL_AltDiction_CP850_CI_AI */ case 58: /* SQL_Scandinavian_Pref_CP850_CI_AS */ case 59: /* SQL_Scandinavian_CP850_CS_AS */ case 60: /* SQL_Scandinavian_CP850_CI_AS */ case 61: /* SQL_AltDiction_CP850_CI_AS */ return TDS_CHARSET_CP850; case 80: /* SQL_Latin1_General_1250_BIN */ case 81: /* SQL_Latin1_General_CP1250_CS_AS */ case 82: /* SQL_Latin1_General_CP1250_CI_AS */ return TDS_CHARSET_CP1250; case 105: /* SQL_Latin1_General_CP1251_CS_AS */ case 106: /* SQL_Latin1_General_CP1251_CI_AS */ return TDS_CHARSET_CP1251; case 113: /* SQL_Latin1_General_CP1253_CS_AS */ case 114: /* SQL_Latin1_General_CP1253_CI_AS */ case 120: /* SQL_MixDiction_CP1253_CS_AS */ case 121: /* SQL_AltDiction_CP1253_CS_AS */ case 122: /* SQL_AltDiction2_CP1253_CS_AS */ case 124: /* SQL_Latin1_General_CP1253_CI_AI */ return TDS_CHARSET_CP1253; case 137: /* SQL_Latin1_General_CP1255_CS_AS */ case 138: /* SQL_Latin1_General_CP1255_CI_AS */ return TDS_CHARSET_CP1255; case 145: /* SQL_Latin1_General_CP1256_CS_AS */ case 146: /* SQL_Latin1_General_CP1256_CI_AS */ return TDS_CHARSET_CP1256; case 153: /* SQL_Latin1_General_CP1257_CS_AS */ case 154: /* SQL_Latin1_General_CP1257_CI_AS */ return TDS_CHARSET_CP1257; } switch (lcid) { case 0x405: case 0x40e: /* 0x1040e */ case 0x415: case 0x418: case 0x41a: case 0x41b: case 0x41c: case 0x424: case 0x442: case 0x81a: case 0x104e: /* ?? */ case 0x141a: cp = TDS_CHARSET_CP1250; break; case 0x402: case 0x419: case 0x422: case 0x423: case 0x42f: case 0x43f: case 0x440: case 0x444: case 0x450: case 0x82c: case 0x843: case 0xc1a: case 0x46d: case 0x201a: case 0x485: cp = TDS_CHARSET_CP1251; break; case 0x1007: case 0x1009: case 0x100a: case 0x100c: case 0x1407: case 0x1409: case 0x140a: case 0x140c: case 0x1809: case 0x180a: case 0x180c: case 0x1c09: case 0x1c0a: case 0x2009: case 0x200a: case 0x2409: case 0x240a: case 0x2809: case 0x280a: case 0x2c09: case 0x2c0a: case 0x3009: case 0x300a: case 0x3409: case 0x340a: case 0x380a: case 0x3c0a: case 0x400a: case 0x403: case 0x406: case 0x417: case 0x42e: case 0x43b: case 0x452: case 0x462: case 0x47a: case 0x47c: case 0x47e: case 0x483: case 0x407: /* 0x10407 */ case 0x409: case 0x40a: case 0x40b: case 0x40c: case 0x40f: case 0x410: case 0x413: case 0x414: case 0x416: case 0x41d: case 0x421: case 0x42d: case 0x436: case 0x437: /* 0x10437 */ case 0x438: /*case 0x439: ??? Unicode only */ case 0x43e: case 0x440a: case 0x441: case 0x456: case 0x480a: case 0x4c0a: case 0x500a: case 0x807: case 0x809: case 0x80a: case 0x80c: case 0x810: case 0x813: case 0x814: case 0x816: case 0x81d: case 0x83b: case 0x83e: case 0x85f: case 0xc07: case 0xc09: case 0xc0a: case 0xc0c: cp = TDS_CHARSET_CP1252; break; case 0x408: cp = TDS_CHARSET_CP1253; break; case 0x41f: case 0x42c: case 0x443: cp = TDS_CHARSET_CP1254; break; case 0x40d: cp = TDS_CHARSET_CP1255; break; case 0x1001: case 0x1401: case 0x1801: case 0x1c01: case 0x2001: case 0x2401: case 0x2801: case 0x2c01: case 0x3001: case 0x3401: case 0x3801: case 0x3c01: case 0x4001: case 0x401: case 0x480: case 0x420: case 0x429: case 0x48c: case 0x801: case 0xc01: cp = TDS_CHARSET_CP1256; break; case 0x425: case 0x426: case 0x427: case 0x827: /* ?? */ cp = TDS_CHARSET_CP1257; break; case 0x42a: cp = TDS_CHARSET_CP1258; break; case 0x41e: cp = TDS_CHARSET_CP874; break; case 0x411: /* 0x10411 */ cp = TDS_CHARSET_CP932; break; case 0x1004: case 0x804: /* 0x20804 */ cp = TDS_CHARSET_GB18030; break; case 0x412: /* 0x10412 */ cp = TDS_CHARSET_CP949; break; case 0x1404: case 0x404: /* 0x30404 */ case 0xc04: cp = TDS_CHARSET_CP950; break; default: cp = TDS_CHARSET_CP1252; } return cp; } /** * Get iconv information from a LCID (to support different column encoding under MSSQL2K) */ TDSICONV * tds_iconv_from_collate(TDSCONNECTION * conn, TDS_UCHAR collate[5]) { int canonic_charset = collate2charset(conn, collate); /* same as client (usually this is true, so this improve performance) ? */ if (conn->char_convs[client2server_chardata]->to.charset.canonic == canonic_charset) return conn->char_convs[client2server_chardata]; return tds_iconv_get_info(conn, conn->char_convs[client2ucs2]->from.charset.canonic, canonic_charset); } /** @} */ freetds-1.3.6/src/tds/locale.c000644 025423 025423 00000006217 14056414271 017601 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2005-2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_LOCALE_H #include #endif #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #include #include static void tds_parse_locale(const char *option, const char *value, void *param); /** * Get locale information. * @return allocated structure with all information or NULL if error */ TDSLOCALE * tds_get_locale(void) { TDSLOCALE *locale; char *s; FILE *in; /* allocate a new structure with hard coded and build-time defaults */ locale = tds_alloc_locale(); if (!locale) return NULL; tdsdump_log(TDS_DBG_INFO1, "Attempting to read locales.conf file\n"); in = fopen(FREETDS_LOCALECONFFILE, "r"); if (in) { tds_read_conf_section(in, "default", tds_parse_locale, locale); #if HAVE_LOCALE_H s = setlocale(LC_ALL, NULL); #else s = getenv("LANG"); #endif if (s && s[0]) { bool found; char buf[128]; const char *strip = "@._"; /* do not change environment !!! */ strlcpy(buf, s, sizeof(buf)); /* search full name */ rewind(in); found = tds_read_conf_section(in, buf, tds_parse_locale, locale); /* * Here we try to strip some part of language in order to * catch similar language * LANG is composed by * language[_sublanguage][.charset][@modified] * ie it_IT@euro or it_IT.UTF-8 so we strip in order * modifier, charset and sublanguage * ie it_IT@euro -> it_IT -> it */ for (;!found && *strip; ++strip) { s = strrchr(buf, *strip); if (!s) continue; *s = 0; rewind(in); found = tds_read_conf_section(in, buf, tds_parse_locale, locale); } } fclose(in); } return locale; } static void tds_parse_locale(const char *option, const char *value, void *param) { TDSLOCALE *locale = (TDSLOCALE *) param; if (!strcmp(option, TDS_STR_CHARSET)) { free(locale->server_charset); locale->server_charset = strdup(value); } else if (!strcmp(option, TDS_STR_LANGUAGE)) { free(locale->language); locale->language = strdup(value); } else if (!strcmp(option, TDS_STR_DATEFMT)) { free(locale->date_fmt); locale->date_fmt = strdup(value); } } freetds-1.3.6/src/tds/vstrbuild.c000644 025423 025423 00000010175 14056414271 020356 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include struct string_linked_list { char *str; struct string_linked_list *next; }; /* * XXX The magic use of \xFF is bletcherous, but I can't think of anything * better right now. */ static char * norm_fmt(const char *fmt, int fmtlen) { char *newfmt; char *cp; char skip = 0; if (fmtlen == TDS_NULLTERM) { fmtlen = strlen(fmt); } if ((newfmt = tds_new(char, fmtlen + 1)) == NULL) return NULL; for (cp = newfmt; fmtlen > 0; fmtlen--, fmt++) { switch (*fmt) { case ',': case ' ': if (!skip) { *cp++ = '\377'; skip = 1; } break; default: skip = 0; *cp++ = *fmt; break; } } *cp = '\0'; return newfmt; } TDSRET tds_vstrbuild(char *buffer, int buflen, int *resultlen, const char *text, int textlen, const char *formats, int formatlen, va_list ap) { char *newformat; char *params; char *token; const char *sep = "\377"; char *lasts; int tokcount = 0; struct string_linked_list *head = NULL; struct string_linked_list *item = NULL; struct string_linked_list **tail = &head; int i; int state; char **string_array = NULL; int pnum = 0; int pdigit; char *paramp = NULL; TDSRET rc = TDS_FAIL; *resultlen = 0; if (textlen == TDS_NULLTERM) { textlen = (int)strlen(text); } if ((newformat = norm_fmt(formats, formatlen)) == NULL) { return TDS_FAIL; } if (vasprintf(¶ms, newformat, ap) < 0) { free(newformat); return TDS_FAIL; } free(newformat); for (token = strtok_r(params, sep, &lasts); token != NULL; token = strtok_r(NULL, sep, &lasts)) { if ((*tail = tds_new(struct string_linked_list, 1)) == NULL) { goto out; } (*tail)->str = token; (*tail)->next = NULL; tail = &((*tail)->next); tokcount++; } if ((string_array = tds_new(char *, tokcount + 1)) == NULL) { goto out; } for (item = head, i = 0; i < tokcount; item = item->next, i++) { if (item == NULL) { goto out; } string_array[i] = item->str; while (*(string_array[i]) == ' ') { string_array[i]++; } } #define COPYING 1 #define CALCPARAM 2 #define OUTPARAM 3 state = COPYING; while ((buflen > 0) && (textlen > 0)) { switch (state) { case COPYING: switch (*text) { case '%': state = CALCPARAM; text++; textlen--; pnum = 0; break; default: *buffer++ = *text++; buflen--; textlen--; (*resultlen)++; break; } break; case CALCPARAM: switch (*text) { case '!': if (pnum <= tokcount) { paramp = string_array[pnum - 1]; state = OUTPARAM; } text++; textlen--; break; default: pdigit = *text++ - '0'; if ((pdigit >= 0) && (pdigit <= 9)) { pnum *= 10; pnum += pdigit; } textlen--; break; } break; case OUTPARAM: switch (*paramp) { case 0: state = COPYING; break; default: *buffer++ = *paramp++; buflen--; (*resultlen)++; } break; default: /* unknown state */ goto out; break; } } rc = TDS_SUCCESS; out: free(string_array); for (item = head; item != NULL; item = head) { head = head->next; free(item); } free(params); return rc; } freetds-1.3.6/src/tds/getmac.c000644 025423 025423 00000003617 14056414222 017577 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-2002 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #ifdef __linux__ #include #include #include #include #include #endif /* TODO get real MAC */ void tds_getmac(TDS_SYS_SOCKET s, unsigned char mac[6]) { /* implementation for Linux */ #ifdef __linux__ struct ifreq ifr; struct ifreq *IFR; struct ifconf ifc; char buf[1024]; int i; memset(mac, 0, 6); ifc.ifc_len = sizeof(buf); ifc.ifc_buf = buf; ioctl(s, SIOCGIFCONF, &ifc); IFR = ifc.ifc_req; for (i = ifc.ifc_len / (int)sizeof(struct ifreq); --i >= 0; ++IFR) { strcpy(ifr.ifr_name, IFR->ifr_name); if (ioctl(s, SIOCGIFFLAGS, &ifr) == 0) { if (!(ifr.ifr_flags & IFF_LOOPBACK)) { if (ioctl(s, SIOCGIFHWADDR, &ifr) == 0) { memcpy(mac, ifr.ifr_hwaddr.sa_data, 6); break; } } } } #else /* !defined(__linux__) */ memset(mac, 0, 6); #endif } freetds-1.3.6/src/tds/data.c000644 025423 025423 00000126516 14056414271 017260 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2003-2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * \page new_type How to add a new type * \section intro Introduction * Adding a new type in FreeTDS is a quite complicated task involving * different tasks. * * To see an example you can look at * \commit{adb893f1381fd3ea40564c775e30dc8cdc81dcf2} * ("Implement big(date)time types") and parent changes in the source * repository. * * \section tds libTDS changes *
      *
    • protocol. First thing to do is add the type to the protocol. * A type usually have some mnemonic constant and a structure. * Declare them in \c include/freetds/proto.h file. Note that * here you should declare the structure the server use not * the structure to hold the data in libTDS. *
      Cfr \commit{a74a06e1f97f3137f6cf1bc7319dd7a2cfb52b1f}. * *
    • base information. Add the type to \c misc/types.csv file * (I use LibreOffice Calc to do it). This table maintain the * base information for a type. *
      Cfr \commit{680cb3371e042bb372cbc5e6feb4054e50d40c1a}. * *
    • data. There should be some code to handle this type to/from * the server. This code is implemented in \c include/freetds/data.h * and \c src/tds/data.c. You can either add a new set of functions * to handle this new type or add the type handling do another set * of types depending on how complicated is that type. * One thing you have to to at this step is determine how you store * that type in libTDS. This is quite important at upper level * libraries will have to use these structures or even present * these data to client code (like DB-Library usually do). * Due to the way FreeTDS works now you would get a linker error * in the ODBC part. You can either ignore the error and proceed * with libTDS, add the code to ODBC or disable temporarily ODBC. *
      Cfr \commit{680cb3371e042bb372cbc5e6feb4054e50d40c1a}. * *
    • enable the type from server. In order to receive the new type * from the server you have to tell the server that we support * that type. This can be either done changing the protocol (usually * Microsoft) or enabling some flags (capabilities for Sybase). *
      Cfr \commit{a498703ff9e309c656b19dd990f4cad0283a47c7}. * *
    • conversions. Conversions are not hard to write but usually * require quite a bit of coding. After extending CONV_RESULT * type in \c include/freetds/convert.h and adding the type to * the script that generate the conversion tables in * \c src/tds/tds_willconvert.pl you have to write the big part * in \c src/tds/covnert.c. You have to implement all kind of * conversions you declared in the previous file. Reuse the * functions that are there (for instance there are some * parser functions). Also if there are similar types it could * be helpful to convert first your type to a super type then * use the conversion for that type. For instance for SMALLINT * type (\c tds_convert_int2) the type is just readed and then * \c tds_convert_int is called which handle any int (actually * 32 bit integer). Same for data where the \c TDS_DATETIMEALL * structure is used. Note that conversions to binary (which * usually are implemented) are done in another function * (\c tds_convert_to_binary). *
      Cfr \commit{9ed52cb78f725607ac109c8c284ca7c4658d87a9}. * *
    • string definition. Add string for your type to * \c src/tds/token.c in \c tds_prtype. *
      Cfr \commit{ac0d3b46db7d98436cd76f906b7d455f7651faae}. * *
    • conversion tests. You probably will have done some mistake * with conversions but don't mind, there are some tests which * will help sorting this out. * \c src/tds/unittests/convert.c * try any possible combination of conversion to check if * all conversion are implemented (it does not check the * conversions themself). * \c src/tds/unittests/t0007.c test that your conversion * are working. Just add manually the conversions you want * to try. *
      Cfr \commit{abcc09c9a88acd0e9a45b46dab3ca44309917a02}. * *
    • parameter. Add type/parameter declaration in * \c tds_get_column_declaration in \c src/tds/query.c. * Also do any necessary step to initialize the parameter * to send to server. *
      Cfr \commit{54fdd3233e430c045cf5524ac385770738d9e92c}, * \commit{88cfea19d91245372779b8893a2d62b42696cd49}. * *
    • emulated prepared/rpc. If needed handle your type * in \c tds_put_param_as_string in \c src/tds/query.c. *
      Cfr \commit{017b7bf2fee0f09847e64546d27382d2f2b756f4}. * *
    * * \section odbc ODBC changes * ODBC is the most complicated library to add a type to. * Usually its data are different from libTDS so you have to add additional * code for conversions which are not required by other libraries. *
      *
    • type information. Every type in ODBC have related information. * These information are set in \c src/odbc/odbc_data.c. * Depending on the changes you did for data in libTDS you should * handle the new type. *
      Cfr \commit{71e189e206dc9b6f6513e0aa0e4133a4f8dec110}. * *
    • type information test. Related to the previous change there * is \c src/odbc/unittests/describecol.c test. Add a test case * for new type. You should attempt to run same test also on * proprietary library if possible. *
      Cfr \commit{8a8ec16a6a514a5d6ac66c2470eff51f6a8d4a53}. * *
    • conversions from odbc. Define how the ODBC type should convert * to the server and implement the conversion. *
      Cfr \commit{29606cbf413c44e49ddfcfb8a93b8a6bd2565a84}, * \commit{87c84e20a594472a72990b12d4a1451b22e6714b}. * *
    • conversions to binary. Binary representation in ODBC are usually * different from server ones. If so implement the proper conversions. *
      Cfr \commit{56009f35d3e0def339a0c5cb98d006e5e710d523}. * *
    • conversions to characters. Same problem for character types. *
      Cfr \commit{25ff091880dabc32f28a73f09bf31c01314aca2f}. * *
    • conversion test. You probably want to test ODBC conversions. * This can be done changing \c src/odbc/unittests/data.c test and * \c src/odbc/unittests/genparams.c. *
      Cfr \commit{e69f7d564dac44884f7c5f0106cceafce4af168b}. *
    * * \section ctlib CT-Library changes * This is quite easy as usual the conversion in libTDS are fine for * this library. *
      *
    • define type in \c include/cspublic.h *
    • implement conversion in \c src/ctlib/cs.h *
    • set corrent conversion from cs types to server in * \c src/ctlib/ct.c *
    * Cfr \commit{c5e71e5ad4a557038ecedcec457e2531ab02a77b}. * * \section dblib DB-Library changes * A bit more complicated than CT-Library but not that much. *
      *
    • add type and binding type to \c include/sybdb.h *
    • add NULL handling in \c dbgetnull, \c dbsetnull * and \c default_null_representation in * \c src/dblib/dblib.c *
    • add binding to dbbindtype *
    • add support for conversion from/to server *
    • add printable size *
    • return correct type string *
    * Cfr \commit{99dd126e0eb248dd3079b2a7cf97437fe3bcd163}. * * \section apps Applications changes * datacopy application requires some changes too to support new types * so add them to \c src/apps/datacopy.c. *
    Cfr \commit{e59c48ac39c76abb036651f8ec238090eef321c9}. */ /** * @file * @brief Handle different data handling from network */ #include #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #include #include #include #include #include #include #include #define USE_ICONV (tds->conn->use_iconv) static const TDSCOLUMNFUNCS *tds_get_column_funcs(TDSCONNECTION *conn, int type); static void tds_swap_numeric(TDS_NUMERIC *num); #undef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #undef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) /** * Set type of column initializing all dependency. * column_usertype should already be set. * @param curcol column to set * @param type type to set */ void tds_set_column_type(TDSCONNECTION * conn, TDSCOLUMN * curcol, TDS_SERVER_TYPE type) { /* set type */ curcol->on_server.column_type = type; curcol->funcs = tds_get_column_funcs(conn, type); curcol->column_type = tds_get_cardinal_type(type, curcol->column_usertype); /* set size */ curcol->column_cur_size = -1; curcol->column_varint_size = tds_get_varint_size(conn, type); if (curcol->column_varint_size == 0) curcol->column_cur_size = curcol->on_server.column_size = curcol->column_size = tds_get_size_by_type(type); } /** * Set type of column initializing all dependency * \param tds state information for the socket and the TDS protocol * \param curcol column to set * \param type type to set */ void tds_set_param_type(TDSCONNECTION * conn, TDSCOLUMN * curcol, TDS_SERVER_TYPE type) { if (IS_TDS7_PLUS(conn)) { switch (type) { case SYBVARCHAR: type = XSYBVARCHAR; break; case SYBCHAR: type = XSYBCHAR; break; case SYBVARBINARY: type = XSYBVARBINARY; break; case SYBBINARY: type = XSYBBINARY; break; case SYBBIT: type = SYBBITN; break; /* avoid warning on other types */ default: break; } } else if (IS_TDS50(conn)) { switch (type) { case SYBINT8: type = SYB5INT8; break; /* avoid warning on other types */ default: break; } } tds_set_column_type(conn, curcol, type); if (is_collate_type(type) || is_char_type(type)) { curcol->char_conv = conn->char_convs[is_unicode_type(type) ? client2ucs2 : client2server_chardata]; memcpy(curcol->column_collation, conn->collation, sizeof(conn->collation)); } /* special case, GUID, varint != 0 but only a size */ /* TODO VARIANT, when supported */ switch (type) { case SYBUNIQUE: curcol->on_server.column_size = curcol->column_size = sizeof(TDS_UNIQUE); break; case SYBBITN: curcol->on_server.column_size = curcol->column_size = sizeof(TDS_TINYINT); break; /* mssql 2005 don't like SYBINT4 as parameter closing connection */ case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: curcol->on_server.column_type = SYBINTN; curcol->column_varint_size = 1; curcol->column_cur_size = -1; break; case SYBMONEY4: case SYBMONEY: curcol->on_server.column_type = SYBMONEYN; curcol->column_varint_size = 1; curcol->column_cur_size = -1; break; case SYBDATETIME: case SYBDATETIME4: curcol->on_server.column_type = SYBDATETIMN; curcol->column_varint_size = 1; curcol->column_cur_size = -1; break; case SYBFLT8: case SYBREAL: curcol->on_server.column_type = SYBFLTN; curcol->column_varint_size = 1; curcol->column_cur_size = -1; break; case SYBNTEXT: if (IS_TDS72_PLUS(conn)) { curcol->column_varint_size = 8; curcol->on_server.column_type = XSYBNVARCHAR; } break; case SYBTEXT: if (IS_TDS72_PLUS(conn)) { curcol->column_varint_size = 8; curcol->on_server.column_type = XSYBVARCHAR; } break; case SYBIMAGE: if (IS_TDS72_PLUS(conn)) { curcol->column_varint_size = 8; curcol->on_server.column_type = XSYBVARBINARY; } break; case SYB5BIGTIME: case SYB5BIGDATETIME: curcol->column_prec = 6; curcol->column_scale = 6; break; default: break; } } TDS_SERVER_TYPE tds_get_cardinal_type(TDS_SERVER_TYPE datatype, int usertype) { switch (datatype) { case XSYBVARBINARY: return SYBVARBINARY; case XSYBBINARY: return SYBBINARY; case SYBNTEXT: return SYBTEXT; case XSYBNVARCHAR: case XSYBVARCHAR: return SYBVARCHAR; case XSYBNCHAR: case XSYBCHAR: return SYBCHAR; case SYB5INT8: return SYBINT8; case SYBLONGBINARY: switch (usertype) { case USER_UNICHAR_TYPE: case USER_UNIVARCHAR_TYPE: return SYBTEXT; } break; case SYBMSXML: return SYBLONGCHAR; default: break; } return datatype; } TDSRET tds_generic_get_info(TDSSOCKET *tds, TDSCOLUMN *col) { switch (col->column_varint_size) { case 8: col->column_size = 0x7ffffffflu; break; case 5: case 4: col->column_size = tds_get_int(tds); if (col->column_size < 0) return TDS_FAIL; break; case 2: /* assure > 0 */ col->column_size = tds_get_smallint(tds); /* under TDS7.2 this means ?var???(MAX) */ if (col->column_size < 0 && IS_TDS72_PLUS(tds->conn)) { if (is_char_type(col->column_type)) col->column_size = 0x3ffffffflu; else col->column_size = 0x7ffffffflu; col->column_varint_size = 8; } if (col->column_size < 0) return TDS_FAIL; break; case 1: col->column_size = tds_get_byte(tds); break; case 0: col->column_size = tds_get_size_by_type(col->column_type); break; } if (IS_TDS71_PLUS(tds->conn) && is_collate_type(col->on_server.column_type)) { /* based on true type as sent by server */ /* * first 2 bytes are windows code (such as 0x409 for english) * other 2 bytes ??? * last bytes is id in syscharsets */ tds_get_n(tds, col->column_collation, 5); col->char_conv = tds_iconv_from_collate(tds->conn, col->column_collation); } /* Only read table_name for blob columns (eg. not for SYBLONGBINARY) */ if (is_blob_type(col->on_server.column_type)) { /* discard this additional byte */ if (IS_TDS72_PLUS(tds->conn)) { unsigned char num_parts = tds_get_byte(tds); /* TODO do not discard first ones */ for (; num_parts; --num_parts) { tds_dstr_get(tds, &col->table_name, tds_get_usmallint(tds)); } } else { tds_dstr_get(tds, &col->table_name, tds_get_usmallint(tds)); } } else if (IS_TDS72_PLUS(tds->conn) && col->on_server.column_type == SYBMSXML) { unsigned char has_schema = tds_get_byte(tds); if (has_schema) { /* discard schema informations */ tds_get_string(tds, tds_get_byte(tds), NULL, 0); /* dbname */ tds_get_string(tds, tds_get_byte(tds), NULL, 0); /* schema owner */ tds_get_string(tds, tds_get_usmallint(tds), NULL, 0); /* schema collection */ } } return TDS_SUCCESS; } /* tds_generic_row_len support also variant and return size to hold blob */ TDS_COMPILE_CHECK(variant_size, sizeof(TDSBLOB) >= sizeof(TDSVARIANT)); TDS_INT tds_generic_row_len(TDSCOLUMN *col) { CHECK_COLUMN_EXTRA(col); if (is_blob_col(col)) return sizeof(TDSBLOB); return col->column_size; } static TDSRET tds_get_char_dynamic(TDSSOCKET *tds, TDSCOLUMN *curcol, void **pp, size_t allocated, TDSINSTREAM *r_stream) { TDSRET res; TDSDYNAMICSTREAM w; /* * Blobs don't use a column's fixed buffer because the official maximum size is 2 GB. * Instead, they're reallocated as necessary, based on the data's size. */ res = tds_dynamic_stream_init(&w, pp, allocated); if (TDS_FAILED(res)) return res; if (USE_ICONV && curcol->char_conv) res = tds_convert_stream(tds, curcol->char_conv, to_client, r_stream, &w.stream); else res = tds_copy_stream(r_stream, &w.stream); curcol->column_cur_size = w.size; return res; } typedef struct tds_varmax_stream { TDSINSTREAM stream; TDSSOCKET *tds; TDS_INT chunk_left; } TDSVARMAXSTREAM; static int tds_varmax_stream_read(TDSINSTREAM *stream, void *ptr, size_t len) { TDSVARMAXSTREAM *s = (TDSVARMAXSTREAM *) stream; /* read chunk len if needed */ if (s->chunk_left == 0) { TDS_INT l = tds_get_int(s->tds); if (l <= 0) l = -1; s->chunk_left = l; } /* no more data ?? */ if (s->chunk_left < 0) return 0; /* read part of data */ if (len > s->chunk_left) len = s->chunk_left; s->chunk_left -= len; if (tds_get_n(s->tds, ptr, len)) return len; return -1; } static TDSRET tds72_get_varmax(TDSSOCKET * tds, TDSCOLUMN * curcol) { TDS_INT8 len; TDSVARMAXSTREAM r; size_t allocated = 0; void **pp = (void**) &(((TDSBLOB*) curcol->column_data)->textvalue); len = tds_get_int8(tds); /* NULL */ if (len == -1) { curcol->column_cur_size = -1; return TDS_SUCCESS; } /* try to allocate an initial buffer */ if (len > (TDS_INT8) (~((size_t) 0) >> 1)) return TDS_FAIL; if (len > 0) { TDS_ZERO_FREE(*pp); allocated = (size_t) len; if (is_unicode_type(curcol->on_server.column_type)) allocated /= 2; } r.stream.read = tds_varmax_stream_read; r.tds = tds; r.chunk_left = 0; return tds_get_char_dynamic(tds, curcol, pp, allocated, &r.stream); } TDS_COMPILE_CHECK(tds_variant_size, sizeof(((TDSVARIANT*)0)->data) == sizeof(((TDSBLOB*)0)->textvalue)); TDS_COMPILE_CHECK(tds_variant_offset,TDS_OFFSET(TDSVARIANT, data) == TDS_OFFSET(TDSBLOB, textvalue)); /* * This strange type has following structure * 0 len (int32) -- NULL * len (int32), type (int8), data -- ints, date, etc * len (int32), type (int8), 7 (int8), collation, column size (int16) -- [n]char, [n]varchar, binary, varbinary * BLOBS (text/image) not supported */ TDSRET tds_variant_get(TDSSOCKET * tds, TDSCOLUMN * curcol) { unsigned int colsize = tds_get_uint(tds); int varint; TDS_SERVER_TYPE type; TDS_UCHAR info_len; TDSVARIANT *v; TDSRET rc; /* NULL */ curcol->column_cur_size = -1; if (colsize < 2) { tds_get_n(tds, NULL, colsize); return TDS_SUCCESS; } type = (TDS_SERVER_TYPE) tds_get_byte(tds); info_len = tds_get_byte(tds); if (!is_variant_inner_type(type)) goto error_type; v = (TDSVARIANT*) curcol->column_data; v->type = type; colsize -= 2; if (info_len > colsize) goto error_type; if (is_collate_type(type)) { if (sizeof(v->collation) > info_len) goto error_type; tds_get_n(tds, v->collation, sizeof(v->collation)); colsize -= sizeof(v->collation); info_len -= sizeof(v->collation); curcol->char_conv = is_unicode_type(type) ? tds->conn->char_convs[client2ucs2] : tds_iconv_from_collate(tds->conn, v->collation); } /* special case for numeric */ if (is_numeric_type(type)) { TDS_NUMERIC *num; if (info_len != 2) goto error_type; if (v->data) TDS_ZERO_FREE(v->data); v->data_len = sizeof(TDS_NUMERIC); num = tds_new0(TDS_NUMERIC, 1); if (!num) goto error_memory; v->data = (TDS_CHAR *) num; num->precision = tds_get_byte(tds); num->scale = tds_get_byte(tds); colsize -= 2; /* check prec/scale, don't let server crash us */ if (num->precision < 1 || num->precision > MAXPRECISION || num->scale > num->precision) goto error_type; if (colsize > sizeof(num->array)) goto error_type; curcol->column_cur_size = colsize; tds_get_n(tds, num->array, colsize); if (IS_TDS7_PLUS(tds->conn)) tds_swap_numeric(num); return TDS_SUCCESS; } /* special case for MS date/time */ switch (type) { case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: if (info_len != 1) goto error_type; curcol->column_scale = curcol->column_prec = tds_get_byte(tds); if (curcol->column_prec > 7) goto error_type; colsize -= info_len; info_len = 0; /* fall through */ case SYBMSDATE: if (info_len != 0) goto error_type; /* dirty trick */ tds->in_buf[--tds->in_pos] = colsize; if (v->data) TDS_ZERO_FREE(v->data); v->data_len = sizeof(TDS_DATETIMEALL); v->data = tds_new0(TDS_CHAR, sizeof(TDS_DATETIMEALL)); curcol->column_type = type; curcol->column_data = (unsigned char *) v->data; /* trick, call get function */ rc = tds_msdatetime_get(tds, curcol); curcol->column_type = SYBVARIANT; curcol->column_data = (unsigned char *) v; return rc; default: break; } varint = (type == SYBUNIQUE) ? 0 : tds_get_varint_size(tds->conn, type); if (varint != info_len || varint > 2) goto error_type; switch (varint) { case 0: v->size = tds_get_size_by_type(type); break; case 1: v->size = tds_get_byte(tds); break; case 2: v->size = tds_get_smallint(tds); break; default: goto error_type; } colsize -= info_len; curcol->column_cur_size = colsize; if (v->data) TDS_ZERO_FREE(v->data); if (colsize) { TDSRET res; TDSDATAINSTREAM r; if (USE_ICONV && curcol->char_conv) v->type = tds_get_cardinal_type(type, 0); tds_datain_stream_init(&r, tds, colsize); res = tds_get_char_dynamic(tds, curcol, (void **) &v->data, colsize, &r.stream); if (TDS_FAILED(res)) return res; colsize = curcol->column_cur_size; #ifdef WORDS_BIGENDIAN tds_swap_datatype(tds_get_conversion_type(type, colsize), v->data); #endif } v->data_len = colsize; CHECK_COLUMN_EXTRA(curcol); return TDS_SUCCESS; error_type: error_memory: tds_get_n(tds, NULL, colsize); return TDS_FAIL; } /** * Read a data from wire * \param tds state information for the socket and the TDS protocol * \param curcol column where store column information * \return TDS_FAIL on error or TDS_SUCCESS */ TDSRET tds_generic_get(TDSSOCKET * tds, TDSCOLUMN * curcol) { unsigned char *dest; int len, colsize; int fillchar; TDSBLOB *blob = NULL; CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); tdsdump_log(TDS_DBG_INFO1, "tds_get_data: type %d, varint size %d\n", curcol->column_type, curcol->column_varint_size); switch (curcol->column_varint_size) { case 4: /* It's a BLOB... */ len = tds_get_byte(tds); blob = (TDSBLOB *) curcol->column_data; if (len == 16) { /* Jeff's hack */ tds_get_n(tds, blob->textptr, 16); tds_get_n(tds, blob->timestamp, 8); blob->valid_ptr = 1; if (IS_TDS72_PLUS(tds->conn) && memcmp(blob->textptr, "dummy textptr\0\0",16) == 0) blob->valid_ptr = 0; colsize = tds_get_int(tds); } else { colsize = -1; } break; case 5: colsize = tds_get_int(tds); if (colsize == 0) colsize = -1; break; case 8: return tds72_get_varmax(tds, curcol); case 2: colsize = tds_get_smallint(tds); break; case 1: colsize = tds_get_byte(tds); if (colsize == 0) colsize = -1; break; case 0: /* TODO this should be column_size */ colsize = tds_get_size_by_type(curcol->column_type); break; default: colsize = -1; break; } if (IS_TDSDEAD(tds)) return TDS_FAIL; tdsdump_log(TDS_DBG_INFO1, "tds_get_data(): wire column size is %d \n", colsize); /* set NULL flag in the row buffer */ if (colsize < 0) { curcol->column_cur_size = -1; return TDS_SUCCESS; } /* * We're now set to read the data from the wire. For varying types (e.g. char/varchar) * make sure that curcol->column_cur_size reflects the size of the read data, * after any charset conversion. tds_get_char_data() does that for you, * but of course tds_get_n() doesn't. * * colsize == wire_size, bytes to read * curcol->column_cur_size == sizeof destination buffer, room to write */ dest = curcol->column_data; if (is_blob_col(curcol)) { TDSDATAINSTREAM r; size_t allocated; TDSRET ret; blob = (TDSBLOB *) dest; /* cf. column_varint_size case 4, above */ /* empty string */ if (colsize == 0) { curcol->column_cur_size = 0; if (blob->textvalue) TDS_ZERO_FREE(blob->textvalue); return TDS_SUCCESS; } allocated = MAX(curcol->column_cur_size, 0); if (colsize > allocated) { TDS_ZERO_FREE(blob->textvalue); allocated = colsize; if (is_unicode_type(curcol->on_server.column_type)) allocated /= 2; } tds_datain_stream_init(&r, tds, colsize); ret = tds_get_char_dynamic(tds, curcol, (void **) &blob->textvalue, allocated, &r.stream); if (TDS_FAILED(ret) && TDS_UNLIKELY(r.wire_size > 0)) { tds_get_n(tds, NULL, r.wire_size); return ret; } return TDS_SUCCESS; } /* non-numeric and non-blob */ if (USE_ICONV && curcol->char_conv) { if (TDS_FAILED(tds_get_char_data(tds, (char *) dest, colsize, curcol))) return TDS_FAIL; } else { /* * special case, some servers seem to return more data in some conditions * (ASA 7 returning 4 byte nullable integer) */ int discard_len = 0; if (colsize > curcol->column_size) { discard_len = colsize - curcol->column_size; colsize = curcol->column_size; } if (!tds_get_n(tds, dest, colsize)) return TDS_FAIL; if (discard_len > 0) tds_get_n(tds, NULL, discard_len); curcol->column_cur_size = colsize; } /* pad (UNI)CHAR and BINARY types */ fillchar = 0; switch (curcol->column_type) { /* extra handling for SYBLONGBINARY */ case SYBLONGBINARY: if (curcol->column_usertype != USER_UNICHAR_TYPE) break; case SYBCHAR: case XSYBCHAR: if (curcol->column_size != curcol->on_server.column_size) break; /* FIXME use client charset */ fillchar = ' '; case SYBBINARY: case XSYBBINARY: if (colsize < curcol->column_size) memset(dest + colsize, fillchar, curcol->column_size - colsize); colsize = curcol->column_size; break; default: break; } #ifdef WORDS_BIGENDIAN tdsdump_log(TDS_DBG_INFO1, "swapping coltype %d\n", tds_get_conversion_type(curcol->column_type, colsize)); tds_swap_datatype(tds_get_conversion_type(curcol->column_type, colsize), dest); #endif return TDS_SUCCESS; } /** * Put data information to wire * \param tds state information for the socket and the TDS protocol * \param col column where to store information * \return TDS_SUCCESS or TDS_FAIL */ TDSRET tds_generic_put_info(TDSSOCKET * tds, TDSCOLUMN * col) { size_t size; CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(col); size = tds_fix_column_size(tds, col); switch (col->column_varint_size) { case 0: break; case 1: tds_put_byte(tds, size); break; case 2: tds_put_smallint(tds, size); break; case 5: case 4: tds_put_int(tds, size); break; case 8: tds_put_smallint(tds, 0xffff); break; } /* TDS5 wants a table name for LOBs */ if (IS_TDS50(tds->conn) && is_blob_type(col->on_server.column_type)) tds_put_smallint(tds, 0); /* TDS7.1 output collate information */ if (IS_TDS71_PLUS(tds->conn) && is_collate_type(col->on_server.column_type)) tds_put_n(tds, tds->conn->collation, 5); return TDS_SUCCESS; } /** * Write data to wire * \param tds state information for the socket and the TDS protocol * \param curcol column where store column information * \return TDS_FAIL on error or TDS_SUCCESS */ TDSRET tds_generic_put(TDSSOCKET * tds, TDSCOLUMN * curcol, int bcp7) { unsigned char *src; TDSBLOB *blob = NULL; size_t colsize, size; const char *s; int converted = 0; CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); tdsdump_log(TDS_DBG_INFO1, "tds_generic_put: colsize = %d\n", (int) curcol->column_cur_size); /* output NULL data */ if (curcol->column_cur_size < 0) { tdsdump_log(TDS_DBG_INFO1, "tds_generic_put: null param\n"); switch (curcol->column_varint_size) { case 5: tds_put_int(tds, 0); break; case 4: if ((bcp7 || !IS_TDS7_PLUS(tds->conn)) && is_blob_type(curcol->on_server.column_type)) tds_put_byte(tds, 0); else tds_put_int(tds, -1); break; case 2: tds_put_smallint(tds, -1); break; case 8: tds_put_int8(tds, -1); break; default: assert(curcol->column_varint_size); /* FIXME not good for SYBLONGBINARY/SYBLONGCHAR (still not supported) */ tds_put_byte(tds, 0); break; } return TDS_SUCCESS; } colsize = curcol->column_cur_size; size = tds_fix_column_size(tds, curcol); src = curcol->column_data; if (is_blob_col(curcol)) { blob = (TDSBLOB *) src; src = (unsigned char *) blob->textvalue; } s = (char *) src; /* convert string if needed */ if (!bcp7 && curcol->char_conv && curcol->char_conv->flags != TDS_ENCODING_MEMCPY && colsize) { size_t output_size; #if 0 /* TODO this case should be optimized */ /* we know converted bytes */ if (curcol->char_conv->client_charset.min_bytes_per_char == curcol->char_conv->client_charset.max_bytes_per_char && curcol->char_conv->server_charset.min_bytes_per_char == curcol->char_conv->server_charset.max_bytes_per_char) { converted_size = colsize * curcol->char_conv->server_charset.min_bytes_per_char / curcol->char_conv->client_charset.min_bytes_per_char; } else { #endif /* we need to convert data before */ /* TODO this can be a waste of memory... */ converted = 1; s = tds_convert_string(tds, curcol->char_conv, s, colsize, &output_size); colsize = (TDS_INT)output_size; if (!s) { /* on conversion error put a empty string */ /* TODO on memory failure we should compute converted size and use chunks */ colsize = 0; converted = -1; } } /* * TODO here we limit data sent with MIN, should mark somewhere * and inform client ?? * Test proprietary behavior */ if (IS_TDS7_PLUS(tds->conn)) { tdsdump_log(TDS_DBG_INFO1, "tds_generic_put: not null param varint_size = %d\n", curcol->column_varint_size); switch (curcol->column_varint_size) { case 8: /* this difference for BCP operation is due to * a bug in different server version that does * not accept a length here */ tds_put_int8(tds, bcp7 ? -2 : colsize); tds_put_int(tds, colsize); break; case 4: /* It's a BLOB... */ colsize = MIN(colsize, size); /* mssql require only size */ if (bcp7 && is_blob_type(curcol->on_server.column_type)) { static const unsigned char textptr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; tds_put_byte(tds, 16); tds_put_n(tds, textptr, 16); tds_put_n(tds, textptr, 8); } tds_put_int(tds, colsize); break; case 2: colsize = MIN(colsize, size); tds_put_smallint(tds, colsize); break; case 1: colsize = MIN(colsize, size); tds_put_byte(tds, colsize); break; case 0: /* TODO should be column_size */ colsize = tds_get_size_by_type(curcol->on_server.column_type); break; } /* conversion error, exit with an error */ if (converted < 0) return TDS_FAIL; /* put real data */ if (blob) { tds_put_n(tds, s, colsize); } else { #ifdef WORDS_BIGENDIAN unsigned char buf[64]; if (!converted && colsize < 64) { tdsdump_log(TDS_DBG_INFO1, "swapping coltype %d\n", tds_get_conversion_type(curcol->column_type, colsize)); memcpy(buf, s, colsize); tds_swap_datatype(tds_get_conversion_type(curcol->column_type, colsize), buf); s = (char *) buf; } #endif tds_put_n(tds, s, colsize); } /* finish chunk for varchar/varbinary(max) */ if (curcol->column_varint_size == 8 && colsize) tds_put_int(tds, 0); } else { /* TODO ICONV handle charset conversions for data */ /* put size of data */ switch (curcol->column_varint_size) { case 5: /* It's a LONGBINARY */ colsize = MIN(colsize, 0x7fffffff); tds_put_int(tds, colsize); break; case 4: /* It's a BLOB... */ tds_put_byte(tds, 16); tds_put_n(tds, blob->textptr, 16); tds_put_n(tds, blob->timestamp, 8); colsize = MIN(colsize, 0x7fffffff); tds_put_int(tds, colsize); break; case 2: colsize = MIN(colsize, 8000); tds_put_smallint(tds, colsize); break; case 1: if (!colsize) { tds_put_byte(tds, 1); if (is_char_type(curcol->column_type)) tds_put_byte(tds, ' '); else tds_put_byte(tds, 0); if (converted > 0) tds_convert_string_free((char*)src, s); return TDS_SUCCESS; } colsize = MIN(colsize, 255); tds_put_byte(tds, colsize); break; case 0: /* TODO should be column_size */ colsize = tds_get_size_by_type(curcol->column_type); break; } /* conversion error, exit with an error */ if (converted < 0) return TDS_FAIL; /* put real data */ if (blob) { tds_put_n(tds, s, colsize); } else { #ifdef WORDS_BIGENDIAN unsigned char buf[64]; if (!converted && colsize < 64) { tdsdump_log(TDS_DBG_INFO1, "swapping coltype %d\n", tds_get_conversion_type(curcol->column_type, colsize)); memcpy(buf, s, colsize); tds_swap_datatype(tds_get_conversion_type(curcol->column_type, colsize), buf); s = (char *) buf; } #endif tds_put_n(tds, s, colsize); } } if (converted > 0) tds_convert_string_free((char*)src, s); return TDS_SUCCESS; } TDSRET tds_numeric_get_info(TDSSOCKET *tds, TDSCOLUMN *col) { col->column_size = tds_get_byte(tds); col->column_prec = tds_get_byte(tds); /* precision */ col->column_scale = tds_get_byte(tds); /* scale */ /* check prec/scale, don't let server crash us */ if (col->column_prec < 1 || col->column_prec > MAXPRECISION || col->column_scale > col->column_prec) return TDS_FAIL; return TDS_SUCCESS; } TDS_INT tds_numeric_row_len(TDSCOLUMN *col) { return sizeof(TDS_NUMERIC); } TDSRET tds_numeric_get(TDSSOCKET * tds, TDSCOLUMN * curcol) { int colsize; TDS_NUMERIC *num; CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(curcol); colsize = tds_get_byte(tds); /* set NULL flag in the row buffer */ if (colsize <= 0) { curcol->column_cur_size = -1; return TDS_SUCCESS; } /* * Since these can be passed around independent * of the original column they came from, we embed the TDS_NUMERIC datatype in the row buffer * instead of using the wire representation, even though it uses a few more bytes. */ num = (TDS_NUMERIC *) curcol->column_data; memset(num, '\0', sizeof(TDS_NUMERIC)); /* TODO perhaps it would be fine to change format ?? */ num->precision = curcol->column_prec; num->scale = curcol->column_scale; /* server is going to crash freetds ?? */ /* TODO close connection it server try to do so ?? */ if (colsize > sizeof(num->array)) return TDS_FAIL; tds_get_n(tds, num->array, colsize); if (IS_TDS7_PLUS(tds->conn)) tds_swap_numeric(num); /* corrected colsize for column_cur_size */ curcol->column_cur_size = sizeof(TDS_NUMERIC); return TDS_SUCCESS; } TDSRET tds_numeric_put_info(TDSSOCKET * tds, TDSCOLUMN * col) { CHECK_TDS_EXTRA(tds); CHECK_COLUMN_EXTRA(col); #if 1 tds_put_byte(tds, tds_numeric_bytes_per_prec[col->column_prec]); tds_put_byte(tds, col->column_prec); tds_put_byte(tds, col->column_scale); #else TDS_NUMERIC *num = (TDS_NUMERIC *) col->column_data; tds_put_byte(tds, tds_numeric_bytes_per_prec[num->precision]); tds_put_byte(tds, num->precision); tds_put_byte(tds, num->scale); #endif return TDS_SUCCESS; } TDSRET tds_numeric_put(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7) { TDS_NUMERIC *num = (TDS_NUMERIC *) col->column_data, buf; unsigned char colsize; if (col->column_cur_size < 0) { tds_put_byte(tds, 0); return TDS_SUCCESS; } colsize = tds_numeric_bytes_per_prec[num->precision]; tds_put_byte(tds, colsize); buf = *num; if (IS_TDS7_PLUS(tds->conn)) tds_swap_numeric(&buf); tds_put_n(tds, buf.array, colsize); return TDS_SUCCESS; } TDSRET tds_variant_put_info(TDSSOCKET * tds, TDSCOLUMN * col) { /* TODO */ return TDS_FAIL; } TDSRET tds_variant_put(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7) { /* TODO */ return TDS_FAIL; } TDSRET tds_msdatetime_get_info(TDSSOCKET * tds, TDSCOLUMN * col) { col->column_scale = col->column_prec = 0; if (col->column_type != SYBMSDATE) { col->column_scale = col->column_prec = tds_get_byte(tds); if (col->column_prec > 7) return TDS_FAIL; } col->on_server.column_size = col->column_size = sizeof(TDS_DATETIMEALL); return TDS_SUCCESS; } TDS_INT tds_msdatetime_row_len(TDSCOLUMN *col) { return sizeof(TDS_DATETIMEALL); } TDSRET tds_msdatetime_get(TDSSOCKET * tds, TDSCOLUMN * col) { TDS_DATETIMEALL *dt = (TDS_DATETIMEALL*) col->column_data; int size = tds_get_byte(tds); if (size == 0) { col->column_cur_size = -1; return TDS_SUCCESS; } memset(dt, 0, sizeof(*dt)); if (col->column_type == SYBMSDATETIMEOFFSET) size -= 2; if (col->column_type != SYBMSTIME) size -= 3; if (size < 0) return TDS_FAIL; dt->time_prec = col->column_prec; /* get time part */ if (col->column_type != SYBMSDATE) { TDS_UINT8 u8; int i; if (size < 3 || size > 5) return TDS_FAIL; u8 = 0; tds_get_n(tds, &u8, size); #ifdef WORDS_BIGENDIAN tds_swap_bytes(&u8, 8); #endif for (i = col->column_prec; i < 7; ++i) u8 *= 10; dt->time = u8; dt->has_time = 1; } else if (size != 0) return TDS_FAIL; /* get date part */ if (col->column_type != SYBMSTIME) { TDS_UINT ui; ui = 0; tds_get_n(tds, &ui, 3); #ifdef WORDS_BIGENDIAN tds_swap_bytes(&ui, 4); #endif dt->has_date = 1; dt->date = ui - 693595; } /* get time offset */ if (col->column_type == SYBMSDATETIMEOFFSET) { dt->offset = tds_get_smallint(tds); if (dt->offset > 840 || dt->offset < -840) return TDS_FAIL; dt->has_offset = 1; } col->column_cur_size = sizeof(TDS_DATETIMEALL); return TDS_SUCCESS; } TDSRET tds_msdatetime_put_info(TDSSOCKET * tds, TDSCOLUMN * col) { /* TODO precision */ if (col->on_server.column_type != SYBMSDATE) tds_put_byte(tds, 7); return TDS_SUCCESS; } TDSRET tds_msdatetime_put(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7) { const TDS_DATETIMEALL *dta = (const TDS_DATETIMEALL *) col->column_data; unsigned char buf[12], *p; if (col->column_cur_size < 0) { tds_put_byte(tds, 0); return TDS_SUCCESS; } /* TODO precision */ p = buf + 1; if (col->on_server.column_type != SYBMSDATE) { TDS_PUT_UA4LE(p, (TDS_UINT) dta->time); p[4] = (unsigned char) (dta->time >> 32); p += 5; } if (col->on_server.column_type != SYBMSTIME) { TDS_UINT ui = dta->date + 693595; TDS_PUT_UA4LE(p, ui); p += 3; } if (col->on_server.column_type == SYBMSDATETIMEOFFSET) { TDS_PUT_UA2LE(p, dta->offset); p += 2; } buf[0] = p - buf - 1; tds_put_n(tds, buf, p - buf); return TDS_SUCCESS; } TDSRET tds_clrudt_get_info(TDSSOCKET * tds, TDSCOLUMN * col) { /* TODO save fields */ /* FIXME support RPC */ /* MAX_BYTE_SIZE */ tds_get_usmallint(tds); /* DB_NAME */ tds_get_string(tds, tds_get_byte(tds), NULL, 0); /* SCHEMA_NAME */ tds_get_string(tds, tds_get_byte(tds), NULL, 0); /* TYPE_NAME */ tds_get_string(tds, tds_get_byte(tds), NULL, 0); /* UDT_METADATA */ tds_get_string(tds, tds_get_usmallint(tds), NULL, 0); col->column_size = 0x7ffffffflu; col->column_varint_size = 8; return TDS_SUCCESS; } TDS_INT tds_clrudt_row_len(TDSCOLUMN *col) { col->column_varint_size = 8; /* TODO save other fields */ return sizeof(TDSBLOB); } TDSRET tds_clrudt_put_info(TDSSOCKET * tds, TDSCOLUMN * col) { /* FIXME support properly*/ tds_put_byte(tds, 0); /* db_name */ tds_put_byte(tds, 0); /* schema_name */ tds_put_byte(tds, 0); /* type_name */ return TDS_SUCCESS; } TDSRET tds_sybbigtime_get_info(TDSSOCKET * tds, TDSCOLUMN * col) { col->column_scale = col->column_prec = 6; tds_get_byte(tds); /* 8, size */ tds_get_byte(tds); /* 6, precision ?? */ col->on_server.column_size = col->column_size = sizeof(TDS_UINT8); return TDS_SUCCESS; } TDS_INT tds_sybbigtime_row_len(TDSCOLUMN *col) { return sizeof(TDS_UINT8); } TDSRET tds_sybbigtime_get(TDSSOCKET * tds, TDSCOLUMN * col) { TDS_UINT8 *dt = (TDS_UINT8 *) col->column_data; int size = tds_get_byte(tds); if (size == 0) { col->column_cur_size = -1; return TDS_SUCCESS; } col->column_cur_size = sizeof(TDS_UINT8); *dt = tds_get_int8(tds); return TDS_SUCCESS; } TDSRET tds_sybbigtime_put_info(TDSSOCKET * tds, TDSCOLUMN * col) { tds_put_byte(tds, 8); tds_put_byte(tds, 6); return TDS_SUCCESS; } TDSRET tds_sybbigtime_put(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7) { const TDS_UINT8 *dt = (const TDS_UINT8 *) col->column_data; if (col->column_cur_size < 0) { tds_put_byte(tds, 0); return TDS_SUCCESS; } tds_put_byte(tds, 8); tds_put_int8(tds, *dt); return TDS_SUCCESS; } TDSRET tds_invalid_get_info(TDSSOCKET * tds, TDSCOLUMN * col) { return TDS_FAIL; } TDS_INT tds_invalid_row_len(TDSCOLUMN *col) { return 0; } TDSRET tds_invalid_get(TDSSOCKET * tds, TDSCOLUMN * col) { return TDS_FAIL; } TDSRET tds_invalid_put_info(TDSSOCKET * tds, TDSCOLUMN * col) { return TDS_FAIL; } TDSRET tds_invalid_put(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7) { return TDS_FAIL; } #if ENABLE_EXTRA_CHECKS int tds_generic_check(const TDSCOLUMN *col) { return 0; } int tds_sybbigtime_check(const TDSCOLUMN *col) { assert(col->column_type == col->on_server.column_type); assert(col->on_server.column_size == col->column_size); assert(!is_numeric_type(col->column_type)); assert(!is_fixed_type(col->column_type)); assert(!is_blob_type(col->column_type)); assert(!is_variable_type(col->column_type)); assert(is_nullable_type(col->column_type)); assert(col->column_varint_size == 1); assert(col->column_prec == 6); assert(col->column_scale == col->column_prec); return 1; } int tds_clrudt_check(const TDSCOLUMN *col) { return 0; } int tds_msdatetime_check(const TDSCOLUMN *col) { assert(col->column_type == col->on_server.column_type); assert(col->on_server.column_size == col->column_size); assert(!is_numeric_type(col->column_type)); if (col->column_type == SYBMSDATE) { assert(is_fixed_type(col->column_type)); } else { assert(!is_fixed_type(col->column_type)); } assert(!is_blob_type(col->column_type)); assert(!is_variable_type(col->column_type)); assert(is_nullable_type(col->column_type)); assert(col->column_varint_size == 1); assert(col->column_prec >= 0 && col->column_prec <= 7); assert(col->column_scale == col->column_prec); return 1; } int tds_variant_check(const TDSCOLUMN *col) { return 0; } int tds_numeric_check(const TDSCOLUMN *col) { assert(col->column_type == col->on_server.column_type); assert(col->on_server.column_size == col->column_size); assert(is_numeric_type(col->column_type)); assert(!is_fixed_type(col->column_type)); assert(!is_blob_type(col->column_type)); assert(!is_variable_type(col->column_type)); assert(col->column_varint_size == 1); assert(col->column_prec >= 1 && col->column_prec <= MAXPRECISION); assert(col->column_scale <= col->column_prec); return 1; } int tds_invalid_check(const TDSCOLUMN *col) { return 1; } #endif #define TDS_DECLARE_FUNCS(name) \ extern const TDSCOLUMNFUNCS tds_ ## name ## _funcs #include TDS_DECLARE_FUNCS(generic); TDS_DECLARE_FUNCS(numeric); TDS_DECLARE_FUNCS(variant); TDS_DECLARE_FUNCS(msdatetime); TDS_DECLARE_FUNCS(clrudt); TDS_DECLARE_FUNCS(sybbigtime); TDS_DECLARE_FUNCS(invalid); #include static const TDSCOLUMNFUNCS * tds_get_column_funcs(TDSCONNECTION *conn, int type) { switch (type) { case SYBNUMERIC: case SYBDECIMAL: return &tds_numeric_funcs; case SYBMSUDT: return &tds_clrudt_funcs; case SYBVARIANT: if (IS_TDS7_PLUS(conn)) return &tds_variant_funcs; break; case SYBMSDATE: case SYBMSTIME: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: return &tds_msdatetime_funcs; case SYB5BIGTIME: case SYB5BIGDATETIME: return &tds_sybbigtime_funcs; } return &tds_generic_funcs; } #include "tds_types.h" #ifdef WORDS_BIGENDIAN void tds_swap_datatype(int coltype, void *b) { unsigned char *buf = (unsigned char *) b; switch (coltype) { case SYBDATETIME4: tds_swap_bytes(&buf[2], 2); case SYBINT2: case SYBUINT2: tds_swap_bytes(buf, 2); break; case SYBMONEY: case SYBDATETIME: tds_swap_bytes(&buf[4], 4); case SYBINT4: case SYBUINT4: case SYBMONEY4: case SYBREAL: case SYBDATE: case SYBTIME: tds_swap_bytes(buf, 4); break; case SYBINT8: case SYBUINT8: case SYBFLT8: case SYB5BIGTIME: case SYB5BIGDATETIME: tds_swap_bytes(buf, 8); break; case SYBUNIQUE: tds_swap_bytes(buf, 4); tds_swap_bytes(&buf[4], 2); tds_swap_bytes(&buf[6], 2); break; } } #endif /** * Converts numeric from Microsoft representation to internal one (Sybase). * \param num numeric data to convert */ static void tds_swap_numeric(TDS_NUMERIC *num) { /* swap the sign */ num->array[0] = (num->array[0] == 0) ? 1 : 0; /* swap the data */ tds_swap_bytes(&(num->array[1]), tds_numeric_bytes_per_prec[num->precision] - 1); } freetds-1.3.6/src/tds/net.c000644 025423 025423 00000102642 14056414271 017127 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Brian Bruns * Copyright (C) 2004-2015 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_NETINET_TCP_H #include #endif /* HAVE_NETINET_TCP_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #if HAVE_SYS_IOCTL_H #include #endif /* HAVE_SYS_IOCTL_H */ #if HAVE_SELECT_H #include #endif /* HAVE_SELECT_H */ #if HAVE_POLL_H #include #endif /* HAVE_POLL_H */ #if HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ #ifdef HAVE_SYS_EVENTFD_H #include #endif /* HAVE_SYS_EVENTFD_H */ #ifdef _WIN32 #include #include #include #endif #include #include #include #include #include #include /* error is always returned */ #define TDSSELERR 0 #define TDSPOLLURG 0x8000u #if ENABLE_ODBC_MARS static void tds_check_cancel(TDSCONNECTION *conn); #endif /** * \addtogroup network * @{ */ #ifdef _WIN32 int tds_socket_init(void) { WSADATA wsadata; return WSAStartup(MAKEWORD(2, 2), &wsadata); } void tds_socket_done(void) { WSACleanup(); } #endif #if !defined(SOL_TCP) && (defined(IPPROTO_TCP) || defined(_WIN32)) /* fix incompatibility between MS headers */ # ifndef IPPROTO_TCP # define IPPROTO_TCP IPPROTO_TCP # endif # define SOL_TCP IPPROTO_TCP #endif /* Optimize the way we send packets */ #undef USE_CORK #undef USE_NODELAY /* On early Linux use TCP_CORK if available */ #if defined(__linux__) && defined(TCP_CORK) #define USE_CORK 1 /* On *BSD try to use TCP_CORK */ /* * NOPUSH flag do not behave in the same way * cf ML "FreeBSD 5.0 performance problems with TCP_NOPUSH" */ #elif (defined(__FreeBSD__) || defined(__GNU_FreeBSD__) || defined(__OpenBSD__)) && defined(TCP_CORK) #define USE_CORK 1 /* otherwise use NODELAY */ #elif defined(TCP_NODELAY) && defined(SOL_TCP) #define USE_NODELAY 1 /* under VMS we have to define TCP_NODELAY */ #elif defined(__VMS) #define TCP_NODELAY 1 #define USE_NODELAY 1 #endif #ifndef __APPLE__ #undef SO_NOSIGPIPE #endif /** * Set socket to non-blocking * @param sock socket to set * @return 0 on success or error code */ int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock) { #if !defined(_WIN32) unsigned int ioctl_nonblocking = 1; #else u_long ioctl_nonblocking = 1; #endif if (IOCTLSOCKET(sock, FIONBIO, &ioctl_nonblocking) >= 0) return 0; return sock_errno; } static void tds_addrinfo_set_port(struct addrinfo *addr, unsigned int port) { assert(addr != NULL); switch(addr->ai_family) { case AF_INET: ((struct sockaddr_in *) addr->ai_addr)->sin_port = htons(port); break; #ifdef AF_INET6 case AF_INET6: ((struct sockaddr_in6 *) addr->ai_addr)->sin6_port = htons(port); break; #endif } } const char* tds_addrinfo2str(struct addrinfo *addr, char *name, int namemax) { #ifndef NI_NUMERICHOST #define NI_NUMERICHOST 0 #endif if (!name || namemax <= 0) return ""; if (getnameinfo(addr->ai_addr, addr->ai_addrlen, name, namemax, NULL, 0, NI_NUMERICHOST) == 0) return name; name[0] = 0; return name; } /** * Returns error stored in the socket */ static int tds_get_socket_error(TDS_SYS_SOCKET sock) { int err; SOCKLEN_T optlen = sizeof(err); char *errstr; /* check socket error */ if (tds_getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &err, &optlen) != 0) { err = sock_errno; errstr = sock_strerror(err); tdsdump_log(TDS_DBG_ERROR, "getsockopt(2) failed: %s\n", errstr); sock_strerror_free(errstr); } else if (err != 0) { errstr = sock_strerror(err); tdsdump_log(TDS_DBG_ERROR, "getsockopt(2) reported: %s\n", errstr); sock_strerror_free(errstr); } return err; } /** * Setup the socket and attempt a connection. * Function allocate the socket in *p_sock and try to start a connection. * @param p_sock where returned socket is stored. Socket is stored even on error. * Can be INVALID_SOCKET. * @param addr address to use for attempting the connection * @param port port to connect to * @param p_oserr where system error is returned * @returns TDSEOK is success, TDSEINPROGRESS if connection attempt is started * or any other error. */ static TDSERRNO tds_setup_socket(TDS_SYS_SOCKET *p_sock, struct addrinfo *addr, unsigned int port, int *p_oserr) { enum { TDS_SOCKET_KEEPALIVE_IDLE = 40, TDS_SOCKET_KEEPALIVE_INTERVAL = 2 }; TDS_SYS_SOCKET sock; char ipaddr[128]; int retval, len, err; char *errstr; #if defined(_WIN32) struct tcp_keepalive keepalive = { TRUE, TDS_SOCKET_KEEPALIVE_IDLE * 1000, TDS_SOCKET_KEEPALIVE_INTERVAL * 1000 }; DWORD written; #endif *p_oserr = 0; tds_addrinfo_set_port(addr, port); tds_addrinfo2str(addr, ipaddr, sizeof(ipaddr)); *p_sock = sock = socket(addr->ai_family, SOCK_STREAM, 0); if (TDS_IS_SOCKET_INVALID(sock)) { errstr = sock_strerror(*p_oserr = sock_errno); tdsdump_log(TDS_DBG_ERROR, "socket creation error: %s\n", errstr); sock_strerror_free(errstr); return TDSESOCK; } #ifdef SO_KEEPALIVE len = 1; setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (const void *) &len, sizeof(len)); #endif #if defined(_WIN32) if (WSAIoctl(sock, SIO_KEEPALIVE_VALS, &keepalive, sizeof(keepalive), NULL, 0, &written, NULL, NULL) != 0) { errstr = sock_strerror(*p_oserr = sock_errno); tdsdump_log(TDS_DBG_ERROR, "error setting keepalive: %s\n", errstr); sock_strerror_free(errstr); } #elif defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL) len = TDS_SOCKET_KEEPALIVE_IDLE; setsockopt(sock, SOL_TCP, TCP_KEEPIDLE, (const void *) &len, sizeof(len)); len = TDS_SOCKET_KEEPALIVE_INTERVAL; setsockopt(sock, SOL_TCP, TCP_KEEPINTVL, (const void *) &len, sizeof(len)); #endif #if defined(SO_NOSIGPIPE) len = 1; if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (const void *) &len, sizeof(len))) { *p_oserr = sock_errno; return TDSESOCK; } #endif len = 1; #if defined(USE_NODELAY) setsockopt(sock, SOL_TCP, TCP_NODELAY, (const void *) &len, sizeof(len)); #elif defined(USE_CORK) setsockopt(sock, SOL_TCP, TCP_NODELAY, (const void *) &len, sizeof(len)); setsockopt(sock, SOL_TCP, TCP_CORK, (const void *) &len, sizeof(len)); #else #error One should be defined #endif tdsdump_log(TDS_DBG_INFO1, "Connecting to %s port %d\n", ipaddr, port); #ifdef DOS32X /* the other connection doesn't work on WATTCP32 */ if (connect(sock, addr->ai_addr, addr->ai_addrlen) < 0) { *p_oserr = sock_errno; tdsdump_log(TDS_DBG_ERROR, "tds_setup_socket(): %s:%d", ipaddr, port); return TDSECONN; } return TDSEOK; #else if ((*p_oserr = tds_socket_set_nonblocking(sock)) != 0) { return TDSEUSCT; /* close enough: "Unable to set communications timer" */ } retval = connect(sock, addr->ai_addr, addr->ai_addrlen); if (retval == 0) { tdsdump_log(TDS_DBG_INFO2, "connection established\n"); return TDSEOK; } /* got some kind of error */ err = *p_oserr = sock_errno; errstr = sock_strerror(err); tdsdump_log(TDS_DBG_ERROR, "tds_setup_socket: connect(2) returned \"%s\"\n", errstr); sock_strerror_free(errstr); /* connection attempt started */ if (err == TDSSOCK_EINPROGRESS) return TDSEINPROGRESS; #if DEBUGGING_CONNECTING_PROBLEM if (err != ECONNREFUSED && err != ENETUNREACH) { tdsdump_dump_buf(TDS_DBG_ERROR, "Contents of sockaddr_in", addr->ai_addr, addr->ai_addrlen); tdsdump_log(TDS_DBG_ERROR, " sockaddr_in:\t" "%s = %x\n" "\t\t\t%s = %x\n" "\t\t\t%s = %s\n" , "sin_family", addr->ai_family , "port", port , "address", ipaddr ); } #endif return TDSECONN; #endif /* not DOS32X */ } typedef struct { struct addrinfo *addr; unsigned next_retry_time; unsigned retry_count; } retry_addr; TDSERRNO tds_open_socket(TDSSOCKET *tds, struct addrinfo *addr, unsigned int port, int timeout, int *p_oserr) { TDSCONNECTION *conn = tds->conn; int len, i; TDSERRNO tds_error; struct addrinfo *curr_addr; struct pollfd *fds; retry_addr *addresses; unsigned curr_time, start_time; typedef struct { retry_addr retry; struct pollfd fd; } alloc_addr; enum { MAX_RETRY = 10 }; *p_oserr = 0; if (!addr) return TDSECONN; tdsdump_log(TDS_DBG_INFO1, "Connecting with protocol version %d.%d\n", TDS_MAJOR(conn), TDS_MINOR(conn)); for (len = 0, curr_addr = addr; curr_addr != NULL; curr_addr = curr_addr->ai_next) ++len; addresses = (retry_addr *) tds_new0(alloc_addr, len); if (!addresses) return TDSEMEM; fds = (struct pollfd *) &addresses[len]; tds_error = TDSECONN; /* fill all structures */ curr_time = start_time = tds_gettime_ms(); for (len = 0, curr_addr = addr; curr_addr != NULL; curr_addr = curr_addr->ai_next) { fds[len].fd = INVALID_SOCKET; addresses[len].addr = curr_addr; addresses[len].next_retry_time = curr_time; addresses[len].retry_count = 0; ++len; } /* if we have only one address means that availability groups feature is not * present, avoid to check the addresses multiple times */ if (len == 1) addresses[0].retry_count = MAX_RETRY; timeout *= 1000; if (!timeout) { /* A timeout of zero means wait forever */ timeout = -1; } /* now the list is full with sockets trying to connect */ while (len) { int rc, poll_timeout = timeout; /* timeout */ if (poll_timeout >= 0) { if (curr_time - start_time > (unsigned) poll_timeout) { *p_oserr = TDSSOCK_ETIMEDOUT; goto exit; } poll_timeout -= curr_time - start_time; } /* try again if needed */ for (i = 0; i < len; ++i) { int time_left; if (!TDS_IS_SOCKET_INVALID(fds[i].fd)) continue; time_left = addresses[i].next_retry_time - curr_time; if (time_left <= 0) { TDS_SYS_SOCKET sock; tds_error = tds_setup_socket(&sock, addresses[i].addr, port, p_oserr); switch (tds_error) { case TDSEOK: /* connected! */ /* free other sockets and continue with this one */ conn->s = sock; tds_error = TDSEOK; goto exit; case TDSEINPROGRESS: /* save socket in the list */ fds[i].fd = sock; break; default: /* error, continue with other addresses */ if (!TDS_IS_SOCKET_INVALID(sock)) CLOSESOCKET(sock); --len; fds[i] = fds[len]; addresses[i] = addresses[len]; --i; continue; } } else { /* update timeout */ if (time_left < poll_timeout || poll_timeout < 0) poll_timeout = time_left; } } /* wait activities on file descriptors */ for (i = 0; i < len; ++i) { fds[i].revents = 0; fds[i].events = TDSSELWRITE|TDSSELERR; } tds_error = TDSECONN; rc = poll(fds, len, poll_timeout); i = sock_errno; /* save to avoid overrides */ curr_time = tds_gettime_ms(); /* error */ if (rc < 0) { *p_oserr = i; if (*p_oserr == TDSSOCK_EINTR) continue; goto exit; } /* got some event on file descriptors */ for (i = 0; i < len; ++i) { if (TDS_IS_SOCKET_INVALID(fds[i].fd)) continue; if (!fds[i].revents) continue; *p_oserr = tds_get_socket_error(fds[i].fd); if (*p_oserr || (fds[i].revents & POLLERR) != 0) { /* error, remove from list and possibly make * the loop exit */ CLOSESOCKET(fds[i].fd); fds[i].fd = INVALID_SOCKET; addresses[i].next_retry_time = curr_time + 1000; if (++addresses[i].retry_count >= MAX_RETRY || len == 1) { --len; fds[i] = fds[len]; addresses[i] = addresses[len]; --i; } continue; } if (fds[i].revents & POLLOUT) { conn->s = fds[i].fd; fds[i].fd = INVALID_SOCKET; tds_error = TDSEOK; goto exit; } } } exit: if (tds_error != TDSEOK) { tdsdump_log(TDS_DBG_ERROR, "tds_open_socket() failed\n"); } else { tdsdump_log(TDS_DBG_INFO2, "tds_open_socket() succeeded\n"); tds->state = TDS_IDLE; } while (--len >= 0) { if (!TDS_IS_SOCKET_INVALID(fds[len].fd)) CLOSESOCKET(fds[len].fd); } free(addresses); return tds_error; } /** * Close current socket. * For last socket close entire connection. * For MARS send FIN request. * This attempts a graceful disconnection, for ungraceful call * tds_connection_close. */ void tds_close_socket(TDSSOCKET * tds) { if (!IS_TDSDEAD(tds)) { #if ENABLE_ODBC_MARS TDSCONNECTION *conn = tds->conn; unsigned n = 0, count = 0; tds_mutex_lock(&conn->list_mtx); for (; n < conn->num_sessions; ++n) if (TDSSOCKET_VALID(conn->sessions[n])) ++count; if (count > 1) tds_append_fin(tds); tds_mutex_unlock(&conn->list_mtx); if (count <= 1) { tds_disconnect(tds); tds_connection_close(conn); } else { tds_set_state(tds, TDS_DEAD); } #else tds_disconnect(tds); tds_ssl_deinit(tds->conn); if (!TDS_IS_SOCKET_INVALID(tds_get_s(tds)) && CLOSESOCKET(tds_get_s(tds)) == -1) tdserror(tds_get_ctx(tds), tds, TDSECLOS, sock_errno); tds_set_s(tds, INVALID_SOCKET); tds_set_state(tds, TDS_DEAD); #endif } } void tds_connection_close(TDSCONNECTION *conn) { #if ENABLE_ODBC_MARS unsigned n = 0; #endif tds_ssl_deinit(conn); if (!TDS_IS_SOCKET_INVALID(conn->s)) { /* TODO check error ?? how to return it ?? */ CLOSESOCKET(conn->s); conn->s = INVALID_SOCKET; } #if ENABLE_ODBC_MARS tds_mutex_lock(&conn->list_mtx); for (; n < conn->num_sessions; ++n) if (TDSSOCKET_VALID(conn->sessions[n])) tds_set_state(conn->sessions[n], TDS_DEAD); tds_mutex_unlock(&conn->list_mtx); #else tds_set_state((TDSSOCKET* ) conn, TDS_DEAD); #endif } /** * Select on a socket until it's available or the timeout expires. * Meanwhile, call the interrupt function. * \return >0 ready descriptors * 0 timeout * <0 error (cf. errno). Caller should close socket and return failure. * This function does not call tdserror or close the socket because it can't know the context in which it's being called. */ int tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds) { int rc, seconds; unsigned int poll_seconds; assert(tds != NULL); assert(timeout_seconds >= 0); /* * The select loop. * If an interrupt handler is installed, we iterate once per second, * else we try once, timing out after timeout_seconds (0 == never). * If select(2) is interrupted by a signal (e.g. press ^C in sqsh), we timeout. * (The application can retry if desired by installing a signal handler.) * * We do not measure current time against end time, to avoid being tricked by ntpd(8) or similar. * Instead, we just count down. * * We exit on the first of these events: * 1. a descriptor is ready. (return to caller) * 2. select(2) returns an important error. (return to caller) * A timeout of zero says "wait forever". We do that by passing a NULL timeval pointer to select(2). */ poll_seconds = (tds_get_ctx(tds) && tds_get_ctx(tds)->int_handler)? 1 : timeout_seconds; for (seconds = timeout_seconds; timeout_seconds == 0 || seconds > 0; seconds -= poll_seconds) { struct pollfd fds[2]; int timeout = poll_seconds ? poll_seconds * 1000 : -1; if (TDS_IS_SOCKET_INVALID(tds_get_s(tds))) return -1; if ((tds_sel & TDSSELREAD) != 0 && tds->conn->tls_session && tds_ssl_pending(tds->conn)) return POLLIN; fds[0].fd = tds_get_s(tds); fds[0].events = tds_sel; fds[0].revents = 0; fds[1].fd = tds_wakeup_get_fd(&tds->conn->wakeup); fds[1].events = POLLIN; fds[1].revents = 0; rc = poll(fds, 2, timeout); if (rc > 0 ) { if (fds[0].revents & POLLERR) { set_sock_errno(TDSSOCK_ECONNRESET); return -1; } rc = fds[0].revents; if (fds[1].revents) { #if ENABLE_ODBC_MARS tds_check_cancel(tds->conn); #endif rc |= TDSPOLLURG; } return rc; } if (rc < 0) { char *errstr; switch (sock_errno) { case TDSSOCK_EINTR: /* FIXME this should be global maximun, not loop one */ seconds += poll_seconds; break; /* let interrupt handler be called */ default: /* documented: EFAULT, EBADF, EINVAL */ errstr = sock_strerror(sock_errno); tdsdump_log(TDS_DBG_ERROR, "error: poll(2) returned %d, \"%s\"\n", sock_errno, errstr); sock_strerror_free(errstr); return rc; } } assert(rc == 0 || (rc < 0 && sock_errno == TDSSOCK_EINTR)); if (tds_get_ctx(tds) && tds_get_ctx(tds)->int_handler) { /* interrupt handler installed */ /* * "If hndlintr() returns INT_CANCEL, DB-Library sends an attention token [TDS_BUFSTAT_ATTN] * to the server. This causes the server to discontinue command processing. * The server may send additional results that have already been computed. * When control returns to the mainline code, the mainline code should do * one of the following: * - Flush the results using dbcancel * - Process the results normally" */ int timeout_action = (*tds_get_ctx(tds)->int_handler) (tds_get_parent(tds)); switch (timeout_action) { case TDS_INT_CONTINUE: /* keep waiting */ continue; case TDS_INT_CANCEL: /* abort the current command batch */ /* FIXME tell tds_goodread() not to call tdserror() */ return 0; default: tdsdump_log(TDS_DBG_NETWORK, "tds_select: invalid interupt handler return code: %d\n", timeout_action); return -1; } } /* * We can reach here if no interrupt handler was installed and we either timed out or got EINTR. * We cannot be polling, so we are about to drop out of the loop. */ assert(poll_seconds == timeout_seconds); } return 0; } /** * Read from an OS socket * @TODO remove tds, save error somewhere, report error in another way * @returns 0 if blocking, <0 error >0 bytes read */ static int tds_socket_read(TDSCONNECTION * conn, TDSSOCKET *tds, unsigned char *buf, int buflen) { int len, err; #if ENABLE_EXTRA_CHECKS /* this simulate the fact that recv can return less bytes */ if (buflen >= 5) { static int cnt = 0; if (++cnt == 5) { cnt = 0; buflen -= 3; } } #endif /* read directly from socket*/ len = READSOCKET(conn->s, buf, buflen); if (len > 0) return len; err = sock_errno; if (len < 0 && TDSSOCK_WOULDBLOCK(err)) return 0; /* detect connection close */ tds_connection_close(conn); tdserror(conn->tds_ctx, tds, len == 0 ? TDSESEOF : TDSEREAD, len == 0 ? 0 : err); return -1; } /** * Write to an OS socket * @returns 0 if blocking, <0 error >0 bytes readed */ static int tds_socket_write(TDSCONNECTION *conn, TDSSOCKET *tds, const unsigned char *buf, int buflen) { int err, len; char *errstr; #if ENABLE_EXTRA_CHECKS /* this simulate the fact that send can return less bytes */ if (buflen >= 11) { static int cnt = 0; if (++cnt == 5) { cnt = 0; buflen -= 3; } } #endif #if defined(SO_NOSIGPIPE) len = send(conn->s, buf, buflen, 0); #else len = WRITESOCKET(conn->s, buf, buflen); #endif if (len > 0) return len; err = sock_errno; if (0 == len || TDSSOCK_WOULDBLOCK(err) || err == TDSSOCK_EINTR) return 0; assert(len < 0); /* detect connection close */ errstr = sock_strerror(err); tdsdump_log(TDS_DBG_NETWORK, "send(2) failed: %d (%s)\n", err, errstr); sock_strerror_free(errstr); tds_connection_close(conn); tdserror(conn->tds_ctx, tds, TDSEWRIT, err); return -1; } int tds_wakeup_init(TDSPOLLWAKEUP *wakeup) { TDS_SYS_SOCKET sv[2]; int ret; wakeup->s_signal = wakeup->s_signaled = INVALID_SOCKET; #if defined(__linux__) && HAVE_EVENTFD # ifdef EFD_CLOEXEC ret = eventfd(0, EFD_CLOEXEC|EFD_NONBLOCK); # else ret = -1; # endif /* Linux version up to 2.6.26 do not support flags, try without */ if (ret < 0 && (ret = eventfd(0, 0)) >= 0) { fcntl(ret, F_SETFD, fcntl(ret, F_GETFD, 0) | FD_CLOEXEC); fcntl(ret, F_SETFL, fcntl(ret, F_GETFL, 0) | O_NONBLOCK); } if (ret >= 0) { wakeup->s_signaled = ret; return 0; } #endif ret = socketpair(AF_UNIX, SOCK_STREAM, 0, sv); if (ret) return ret; wakeup->s_signal = sv[0]; wakeup->s_signaled = sv[1]; return 0; } void tds_wakeup_close(TDSPOLLWAKEUP *wakeup) { if (!TDS_IS_SOCKET_INVALID(wakeup->s_signal)) CLOSESOCKET(wakeup->s_signal); if (!TDS_IS_SOCKET_INVALID(wakeup->s_signaled)) CLOSESOCKET(wakeup->s_signaled); } void tds_wakeup_send(TDSPOLLWAKEUP *wakeup, char cancel) { #if defined(__linux__) && HAVE_EVENTFD if (wakeup->s_signal == -1) { uint64_t one = 1; (void) write(wakeup->s_signaled, &one, sizeof(one)); return; } #endif send(wakeup->s_signal, &cancel, sizeof(cancel), 0); } static int tds_connection_signaled(TDSCONNECTION *conn) { int len; char to_cancel[16]; #if defined(__linux__) && HAVE_EVENTFD if (conn->wakeup.s_signal == -1) return read(conn->wakeup.s_signaled, to_cancel, 8) > 0; #endif len = READSOCKET(conn->wakeup.s_signaled, to_cancel, sizeof(to_cancel)); do { /* no cancel found */ if (len <= 0) return 0; } while(!to_cancel[--len]); return 1; } #if ENABLE_ODBC_MARS static void tds_check_cancel(TDSCONNECTION *conn) { TDSSOCKET *tds; int rc; if (!tds_connection_signaled(conn)) return; do { unsigned n = 0; rc = TDS_SUCCESS; tds_mutex_lock(&conn->list_mtx); /* Here we scan all list searching for sessions that should send cancel packets */ for (; n < conn->num_sessions; ++n) if (TDSSOCKET_VALID(tds=conn->sessions[n]) && tds->in_cancel == 1) { /* send cancel */ tds->in_cancel = 2; tds_mutex_unlock(&conn->list_mtx); rc = tds_append_cancel(tds); tds_mutex_lock(&conn->list_mtx); if (rc != TDS_SUCCESS) break; } tds_mutex_unlock(&conn->list_mtx); /* for all failed */ /* this must be done outside loop cause it can alter list */ /* this must be done unlocked cause it can lock again */ if (rc != TDS_SUCCESS) tds_close_socket(tds); } while(rc != TDS_SUCCESS); } #endif /** * Loops until we have received some characters * return -1 on failure */ int tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen) { if (tds == NULL || buf == NULL || buflen < 1) return -1; for (;;) { int len, err; /* FIXME this block writing from other sessions */ len = tds_select(tds, TDSSELREAD, tds->query_timeout); #if !ENABLE_ODBC_MARS if (len > 0 && (len & TDSPOLLURG)) { tds_connection_signaled(tds->conn); /* send cancel */ if (tds->in_cancel == 1) tds_put_cancel(tds); continue; } #endif if (len > 0) { len = tds_socket_read(tds->conn, tds, buf, buflen); if (len == 0) continue; return len; } /* error */ if (len < 0) { if (TDSSOCK_WOULDBLOCK(sock_errno)) /* shouldn't happen, but OK */ continue; err = sock_errno; tds_connection_close(tds->conn); tdserror(tds_get_ctx(tds), tds, TDSEREAD, err); return -1; } /* timeout */ switch (tdserror(tds_get_ctx(tds), tds, TDSETIME, sock_errno)) { case TDS_INT_CONTINUE: break; default: case TDS_INT_CANCEL: tds_close_socket(tds); return -1; } } } int tds_connection_read(TDSSOCKET * tds, unsigned char *buf, int buflen) { TDSCONNECTION *conn = tds->conn; if (conn->tls_session) return tds_ssl_read(conn, buf, buflen); #if ENABLE_ODBC_MARS return tds_socket_read(conn, tds, buf, buflen); #else return tds_goodread(tds, buf, buflen); #endif } /** * \param tds the famous socket * \param buffer data to send * \param buflen bytes in buffer * \param last 1 if this is the last packet, else 0 * \return length written (>0), <0 on failure */ int tds_goodwrite(TDSSOCKET * tds, const unsigned char *buffer, size_t buflen) { int len; size_t sent = 0; assert(tds && buffer); while (sent < buflen) { /* TODO if send buffer is full we block receive !!! */ len = tds_select(tds, TDSSELWRITE, tds->query_timeout); if (len > 0) { len = tds_socket_write(tds->conn, tds, buffer + sent, buflen - sent); if (len == 0) continue; if (len < 0) return len; sent += len; continue; } /* error */ if (len < 0) { int err = sock_errno; char *errstr; if (TDSSOCK_WOULDBLOCK(err)) /* shouldn't happen, but OK, retry */ continue; errstr = sock_strerror(err); tdsdump_log(TDS_DBG_NETWORK, "select(2) failed: %d (%s)\n", err, errstr); sock_strerror_free(errstr); tds_connection_close(tds->conn); tdserror(tds_get_ctx(tds), tds, TDSEWRIT, err); return -1; } /* timeout */ tdsdump_log(TDS_DBG_NETWORK, "tds_goodwrite(): timed out, asking client\n"); switch (tdserror(tds_get_ctx(tds), tds, TDSETIME, sock_errno)) { case TDS_INT_CONTINUE: break; default: case TDS_INT_CANCEL: tds_close_socket(tds); return -1; } } return (int) sent; } void tds_socket_flush(TDS_SYS_SOCKET sock) { #ifdef USE_CORK int opt; opt = 0; setsockopt(sock, SOL_TCP, TCP_CORK, (const void *) &opt, sizeof(opt)); opt = 1; setsockopt(sock, SOL_TCP, TCP_CORK, (const void *) &opt, sizeof(opt)); #endif } int tds_connection_write(TDSSOCKET *tds, const unsigned char *buf, int buflen, int final) { int sent; TDSCONNECTION *conn = tds->conn; #if !defined(_WIN32) && !defined(MSG_NOSIGNAL) && !defined(DOS32X) && !defined(SO_NOSIGPIPE) void (*oldsig) (int); oldsig = signal(SIGPIPE, SIG_IGN); if (oldsig == SIG_ERR) { tdsdump_log(TDS_DBG_WARN, "TDS: Warning: Couldn't set SIGPIPE signal to be ignored\n"); } #endif if (conn->tls_session) sent = tds_ssl_write(conn, buf, buflen); else #if ENABLE_ODBC_MARS sent = tds_socket_write(conn, tds, buf, buflen); #else sent = tds_goodwrite(tds, buf, buflen); #endif /* force packet flush */ if (final && sent >= buflen) tds_socket_flush(tds_get_s(tds)); #if !defined(_WIN32) && !defined(MSG_NOSIGNAL) && !defined(DOS32X) && !defined(SO_NOSIGPIPE) if (signal(SIGPIPE, oldsig) == SIG_ERR) { tdsdump_log(TDS_DBG_WARN, "TDS: Warning: Couldn't reset SIGPIPE signal to previous value\n"); } #endif return sent; } /** * Get port of all instances * @return default port number or 0 if error * @remark experimental, cf. MC-SQLR.pdf. */ int tds7_get_instance_ports(FILE *output, struct addrinfo *addr) { int num_try; struct pollfd fd; int retval; TDS_SYS_SOCKET s; char msg[16*1024]; int msg_len = 0; int port = 0; char ipaddr[128]; tds_addrinfo_set_port(addr, 1434); tds_addrinfo2str(addr, ipaddr, sizeof(ipaddr)); tdsdump_log(TDS_DBG_ERROR, "tds7_get_instance_ports(%s)\n", ipaddr); /* create an UDP socket */ if (TDS_IS_SOCKET_INVALID(s = socket(addr->ai_family, SOCK_DGRAM, 0))) { char *errstr = sock_strerror(sock_errno); tdsdump_log(TDS_DBG_ERROR, "socket creation error: %s\n", errstr); sock_strerror_free(errstr); return 0; } /* * on cluster environment is possible that reply packet came from * different IP so do not filter by ip with connect */ if (tds_socket_set_nonblocking(s) != 0) { CLOSESOCKET(s); return 0; } /* * Request the instance's port from the server. * There is no easy way to detect if port is closed so we always try to * get a reply from server 16 times. */ for (num_try = 0; num_try < 16 && msg_len == 0; ++num_try) { /* send the request */ msg[0] = 3; if (sendto(s, msg, 1, 0, addr->ai_addr, addr->ai_addrlen) < 0) break; fd.fd = s; fd.events = POLLIN; fd.revents = 0; retval = poll(&fd, 1, 1000); /* on interrupt ignore */ if (retval < 0 && sock_errno == TDSSOCK_EINTR) continue; if (retval == 0) { /* timed out */ #if 1 tdsdump_log(TDS_DBG_ERROR, "tds7_get_instance_port: timed out on try %d of 16\n", num_try); continue; #else int rc; tdsdump_log(TDS_DBG_INFO1, "timed out\n"); switch(rc = tdserror(NULL, NULL, TDSETIME, 0)) { case TDS_INT_CONTINUE: continue; /* try again */ default: tdsdump_log(TDS_DBG_ERROR, "error: client error handler returned %d\n", rc); case TDS_INT_CANCEL: CLOSESOCKET(s); return 0; } #endif } if (retval < 0) break; /* got data, read and parse */ if ((msg_len = recv(s, msg, sizeof(msg) - 1, 0)) > 3 && msg[0] == 5) { char *name, sep[2] = ";", *save; /* assure null terminated */ msg[msg_len] = 0; tdsdump_dump_buf(TDS_DBG_INFO1, "instance info", msg, msg_len); if (0) { /* To debug, print the whole string. */ char *p; for (*sep = '\n', p=msg+3; p < msg + msg_len; p++) { if( *p == ';' ) *p = *sep; } fputs(msg + 3, output); } /* * Parse and print message. */ name = strtok_r(msg+3, sep, &save); while (name && output) { int i; static const char *const names[] = { "ServerName", "InstanceName", "IsClustered", "Version", "tcp", "np", "via" }; for (i=0; name && i < TDS_VECTOR_SIZE(names); i++) { const char *value = strtok_r(NULL, sep, &save); if (strcmp(name, names[i]) != 0) fprintf(output, "error: expecting '%s', found '%s'\n", names[i], name); if (value) fprintf(output, "%15s %s\n", name, value); else break; name = strtok_r(NULL, sep, &save); if (name && strcmp(name, names[0]) == 0) break; } if (name) fprintf(output, "\n"); } } } CLOSESOCKET(s); tdsdump_log(TDS_DBG_ERROR, "default instance port is %d\n", port); return port; } /** * Get port of given instance * @return port number or 0 if error */ int tds7_get_instance_port(struct addrinfo *addr, const char *instance) { int num_try; struct pollfd fd; int retval; TDS_SYS_SOCKET s; char msg[1024]; int msg_len; int port = 0; char ipaddr[128]; tds_addrinfo_set_port(addr, 1434); tds_addrinfo2str(addr, ipaddr, sizeof(ipaddr)); tdsdump_log(TDS_DBG_ERROR, "tds7_get_instance_port(%s, %s)\n", ipaddr, instance); /* create an UDP socket */ if (TDS_IS_SOCKET_INVALID(s = socket(addr->ai_family, SOCK_DGRAM, 0))) { char *errstr = sock_strerror(sock_errno); tdsdump_log(TDS_DBG_ERROR, "socket creation error: %s\n", errstr); sock_strerror_free(errstr); return 0; } /* * on cluster environment is possible that reply packet came from * different IP so do not filter by ip with connect */ if (tds_socket_set_nonblocking(s) != 0) { CLOSESOCKET(s); return 0; } /* * Request the instance's port from the server. * There is no easy way to detect if port is closed so we always try to * get a reply from server 16 times. */ for (num_try = 0; num_try < 16; ++num_try) { /* send the request */ msg[0] = 4; strlcpy(msg + 1, instance, sizeof(msg) - 1); if (sendto(s, msg, (int)strlen(msg) + 1, 0, addr->ai_addr, addr->ai_addrlen) < 0) break; fd.fd = s; fd.events = POLLIN; fd.revents = 0; retval = poll(&fd, 1, 1000); /* on interrupt ignore */ if (retval < 0 && sock_errno == TDSSOCK_EINTR) continue; if (retval == 0) { /* timed out */ #if 1 tdsdump_log(TDS_DBG_ERROR, "tds7_get_instance_port: timed out on try %d of 16\n", num_try); continue; #else int rc; tdsdump_log(TDS_DBG_INFO1, "timed out\n"); switch(rc = tdserror(NULL, NULL, TDSETIME, 0)) { case TDS_INT_CONTINUE: continue; /* try again */ default: tdsdump_log(TDS_DBG_ERROR, "error: client error handler returned %d\n", rc); case TDS_INT_CANCEL: CLOSESOCKET(s); return 0; } #endif } if (retval < 0) break; /* TODO pass also connection and set instance/servername ?? */ /* got data, read and parse */ if ((msg_len = recv(s, msg, sizeof(msg) - 1, 0)) > 3 && msg[0] == 5) { char *p; long l = 0; int instance_ok = 0, port_ok = 0; /* assure null terminated */ msg[msg_len] = 0; tdsdump_dump_buf(TDS_DBG_INFO1, "instance info", msg, msg_len); /* * Parse message and check instance name and port. * We don't check servername cause it can be very different from the client's. */ for (p = msg + 3;;) { char *name, *value; name = p; p = strchr(p, ';'); if (!p) break; *p++ = 0; value = name; if (*name) { value = p; p = strchr(p, ';'); if (!p) break; *p++ = 0; } if (strcasecmp(name, "InstanceName") == 0) { if (strcasecmp(value, instance) != 0) break; instance_ok = 1; } else if (strcasecmp(name, "tcp") == 0) { l = strtol(value, &p, 10); if (l > 0 && l <= 0xffff && *p == 0) port_ok = 1; } } if (port_ok && instance_ok) { port = l; break; } } } CLOSESOCKET(s); tdsdump_log(TDS_DBG_ERROR, "instance port is %d\n", port); return port; } #if defined(_WIN32) static const char tds_unknown_wsaerror[] = "undocumented WSA error code"; char * tds_prwsaerror(int erc) { char *errstr = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, NULL, erc, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), (LPTSTR)&errstr, 0, NULL); if (errstr) { size_t len = strlen(errstr); while (len > 0 && (errstr[len-1] == '\r' || errstr[len-1] == '\n')) errstr[len-1] = 0; return errstr; } return (char*) tds_unknown_wsaerror; } void tds_prwsaerror_free(char *s) { if (s != tds_unknown_wsaerror) LocalFree((HLOCAL) s); } #endif /** @} */ freetds-1.3.6/src/tds/tls.c000644 025423 025423 00000063432 14113367621 017146 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Brian Bruns * Copyright (C) 2004-2015 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include /* enabled some additional definitions for inet_pton */ #define _WIN32_WINNT 0x600 #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_DIRENT_H #include #endif /* HAVE_DIRENT_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #ifdef HAVE_SYS_SOCKET_H #include #endif #include #include #include #include #include #include /** * \addtogroup network * @{ */ #if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL) #ifdef HAVE_GNUTLS #define SSL_RET ssize_t #define SSL_PULL_ARGS gnutls_transport_ptr_t ptr, void *data, size_t len #define SSL_PUSH_ARGS gnutls_transport_ptr_t ptr, const void *data, size_t len #define SSL_PTR ptr #else /* some compatibility layer */ #if !HAVE_BIO_GET_DATA static inline void BIO_set_init(BIO *b, int init) { b->init = init; } static inline void BIO_set_data(BIO *b, void *ptr) { b->ptr = ptr; } static inline void * BIO_get_data(const BIO *b) { return b->ptr; } #define TLS_client_method SSLv23_client_method #define TLS_ST_OK SSL_ST_OK #endif #define SSL_RET int #define SSL_PULL_ARGS BIO *bio, char *data, int len #define SSL_PUSH_ARGS BIO *bio, const char *data, int len #define SSL_PTR BIO_get_data(bio) #endif #if !HAVE_ASN1_STRING_GET0_DATA #define ASN1_STRING_get0_data(x) ASN1_STRING_data(x) #endif static SSL_RET tds_pull_func_login(SSL_PULL_ARGS) { TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; int have; tdsdump_log(TDS_DBG_FUNC, "in tds_pull_func_login\n"); /* here we are initializing (crypted inside TDS packets) */ /* if we have some data send it */ /* here MARS is not already initialized so test is correct */ /* TODO test even after initializing ?? */ if (tds->out_pos > 8) tds_flush_packet(tds); for(;;) { have = tds->in_len - tds->in_pos; assert(have >= 0); if (have > 0) break; if (tds_read_packet(tds) < 0) return -1; } if (len > have) len = have; memcpy(data, tds->in_buf + tds->in_pos, len); tds->in_pos += len; return len; } static SSL_RET tds_push_func_login(SSL_PUSH_ARGS) { TDSSOCKET *tds = (TDSSOCKET *) SSL_PTR; tdsdump_log(TDS_DBG_FUNC, "in tds_push_func_login\n"); /* initializing SSL, write crypted data inside normal TDS packets */ tds_put_n(tds, data, len); return len; } static SSL_RET tds_pull_func(SSL_PULL_ARGS) { TDSCONNECTION *conn = (TDSCONNECTION *) SSL_PTR; TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "in tds_pull_func\n"); #if ENABLE_ODBC_MARS tds = conn->in_net_tds; assert(tds); #else tds = (TDSSOCKET *) conn; #endif /* already initialized (crypted TDS packets) */ /* read directly from socket */ /* TODO we block write on other sessions */ /* also we should already have tested for data on socket */ return tds_goodread(tds, (unsigned char*) data, len); } static SSL_RET tds_push_func(SSL_PUSH_ARGS) { TDSCONNECTION *conn = (TDSCONNECTION *) SSL_PTR; TDSSOCKET *tds; tdsdump_log(TDS_DBG_FUNC, "in tds_push_func\n"); /* write to socket directly */ #if ENABLE_ODBC_MARS tds = conn->in_net_tds; #else tds = (TDSSOCKET *) conn; #endif return tds_goodwrite(tds, (const unsigned char*) data, len); } static int tls_initialized = 0; static tds_mutex tls_mutex = TDS_MUTEX_INITIALIZER; #ifdef HAVE_GNUTLS static void tds_tls_log( int level, const char* s) { tdsdump_log(TDS_DBG_INFO1, "GNUTLS: level %d:\n %s", level, s); } #ifdef TDS_ATTRIBUTE_DESTRUCTOR static void __attribute__((destructor)) tds_tls_deinit(void) { if (tls_initialized) gnutls_global_deinit(); } #endif #if defined(_THREAD_SAFE) && defined(TDS_HAVE_PTHREAD_MUTEX) && !defined(GNUTLS_USE_NETTLE) GCRY_THREAD_OPTION_PTHREAD_IMPL; #define tds_gcry_init() gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread) #else #define tds_gcry_init() do {} while(0) #endif /* This piece of code is copied from GnuTLS new sources to handle IP in the certificate */ #if GNUTLS_VERSION_NUMBER < 0x030306 static int check_ip(gnutls_x509_crt_t cert, const void *ip, unsigned ip_size) { char temp[16]; size_t temp_size; unsigned i; int ret = 0; /* try matching against: * 1) a IPaddress alternative name (subjectAltName) extension * in the certificate */ /* Check through all included subjectAltName extensions, comparing * against all those of type IPAddress. */ for (i = 0; ret >= 0; ++i) { temp_size = sizeof(temp); ret = gnutls_x509_crt_get_subject_alt_name(cert, i, temp, &temp_size, NULL); if (ret == GNUTLS_SAN_IPADDRESS) { if (temp_size == ip_size && memcmp(temp, ip, ip_size) == 0) return 1; } else if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER) { ret = 0; } } /* not found a matching IP */ return 0; } static int tds_check_ip(gnutls_x509_crt_t cert, const char *hostname) { int ret; union { struct in_addr v4; struct in6_addr v6; } ip; unsigned ip_size; /* check whether @hostname is an ip address */ if (strchr(hostname, ':') != NULL) { ip_size = 16; ret = inet_pton(AF_INET6, hostname, &ip.v6); } else { ip_size = 4; ret = inet_pton(AF_INET, hostname, &ip.v4); } if (ret != 0) ret = check_ip(cert, &ip, ip_size); /* There are several misconfigured servers, that place their IP * in the DNS field of subjectAlternativeName. Don't break these * configurations and verify the IP as it would have been a DNS name. */ return ret; } /* function for replacing old GnuTLS version */ static int tds_x509_crt_check_hostname(gnutls_x509_crt_t cert, const char *hostname) { int ret; ret = tds_check_ip(cert, hostname); if (ret) return ret; return gnutls_x509_crt_check_hostname(cert, hostname); } #define gnutls_x509_crt_check_hostname tds_x509_crt_check_hostname #endif #if GNUTLS_VERSION_MAJOR < 3 static int tds_certificate_set_x509_system_trust(gnutls_certificate_credentials_t cred) { static const char ca_directory[] = "/etc/ssl/certs"; DIR *dir; struct dirent *dent; #ifdef HAVE_READDIR_R struct dirent ent; #endif int rc; int ncerts; size_t ca_file_length; char *ca_file; dir = opendir(ca_directory); if (!dir) return 0; ca_file_length = strlen(ca_directory) + sizeof(dent->d_name) + 2; ca_file = alloca(ca_file_length); ncerts = 0; for (;;) { struct stat st; #ifdef HAVE_READDIR_R if (readdir_r(dir, &ent, &dent)) dent = NULL; #else dent = readdir(dir); #endif if (!dent) break; snprintf(ca_file, ca_file_length, "%s/%s", ca_directory, dent->d_name); if (stat(ca_file, &st) != 0) continue; if (!S_ISREG(st.st_mode)) continue; rc = gnutls_certificate_set_x509_trust_file(cred, ca_file, GNUTLS_X509_FMT_PEM); if (rc >= 0) ncerts += rc; } closedir(dir); return ncerts; } #define gnutls_certificate_set_x509_system_trust tds_certificate_set_x509_system_trust #endif static int tds_verify_certificate(gnutls_session_t session) { unsigned int status; int ret; TDSSOCKET *tds = (TDSSOCKET *) gnutls_transport_get_ptr(session); #ifdef ENABLE_DEVELOPING unsigned int list_size; const gnutls_datum_t *cert_list; #endif if (!tds->login) return GNUTLS_E_CERTIFICATE_ERROR; ret = gnutls_certificate_verify_peers2(session, &status); if (ret < 0) { tdsdump_log(TDS_DBG_ERROR, "Error verifying certificate: %s\n", gnutls_strerror(ret)); return GNUTLS_E_CERTIFICATE_ERROR; } #ifdef ENABLE_DEVELOPING cert_list = gnutls_certificate_get_peers(session, &list_size); if (cert_list) { gnutls_x509_crt_t cert; gnutls_datum_t cinfo; char buf[8192]; size_t size; gnutls_x509_crt_init(&cert); gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER); /* This is the preferred way of printing short information about * a certificate. */ size = sizeof(buf); ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_PEM, buf, &size); if (ret == 0) { FILE *f = fopen("cert.dat", "wb"); if (f) { fwrite(buf, size, 1, f); fclose(f); } } ret = gnutls_x509_crt_print(cert, GNUTLS_CRT_PRINT_ONELINE, &cinfo); if (ret == 0) { tdsdump_log(TDS_DBG_INFO1, "Certificate info: %s\n", cinfo.data); gnutls_free(cinfo.data); } gnutls_x509_crt_deinit(cert); } #endif /* Certificate is not trusted */ if (status != 0) { tdsdump_log(TDS_DBG_ERROR, "Certificate status: %u\n", status); return GNUTLS_E_CERTIFICATE_ERROR; } /* check hostname */ if (tds->login->check_ssl_hostname) { const gnutls_datum_t *cert_list; unsigned int list_size; gnutls_x509_crt_t cert; cert_list = gnutls_certificate_get_peers(session, &list_size); if (!cert_list) { tdsdump_log(TDS_DBG_ERROR, "Error getting TLS session peers\n"); return GNUTLS_E_CERTIFICATE_ERROR; } gnutls_x509_crt_init(&cert); gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER); ret = gnutls_x509_crt_check_hostname(cert, tds_dstr_cstr(&tds->login->server_host_name)); gnutls_x509_crt_deinit(cert); if (!ret) { tdsdump_log(TDS_DBG_ERROR, "Certificate hostname does not match\n"); return GNUTLS_E_CERTIFICATE_ERROR; } } /* notify gnutls to continue handshake normally */ return 0; } TDSRET tds_ssl_init(TDSSOCKET *tds) { gnutls_session_t session; gnutls_certificate_credentials_t xcred; int ret; const char *tls_msg; xcred = NULL; session = NULL; tls_msg = "initializing tls"; if (!tls_initialized) { ret = 0; tds_mutex_lock(&tls_mutex); if (!tls_initialized) { tds_gcry_init(); ret = gnutls_global_init(); if (ret == 0) tls_initialized = 1; } tds_mutex_unlock(&tls_mutex); if (ret != 0) goto cleanup; } if (tds_write_dump && tls_initialized < 2) { gnutls_global_set_log_level(11); gnutls_global_set_log_function(tds_tls_log); tls_initialized = 2; } tls_msg = "allocating credentials"; ret = gnutls_certificate_allocate_credentials(&xcred); if (ret != 0) goto cleanup; if (!tds_dstr_isempty(&tds->login->cafile)) { tls_msg = "loading CA file"; if (strcasecmp(tds_dstr_cstr(&tds->login->cafile), "system") == 0) ret = gnutls_certificate_set_x509_system_trust(xcred); else ret = gnutls_certificate_set_x509_trust_file(xcred, tds_dstr_cstr(&tds->login->cafile), GNUTLS_X509_FMT_PEM); if (ret <= 0) goto cleanup; if (!tds_dstr_isempty(&tds->login->crlfile)) { tls_msg = "loading CRL file"; ret = gnutls_certificate_set_x509_crl_file(xcred, tds_dstr_cstr(&tds->login->crlfile), GNUTLS_X509_FMT_PEM); if (ret <= 0) goto cleanup; } #ifdef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION gnutls_certificate_set_verify_function(xcred, tds_verify_certificate); #endif } /* Initialize TLS session */ tls_msg = "initializing session"; ret = gnutls_init(&session, GNUTLS_CLIENT); if (ret != 0) goto cleanup; gnutls_transport_set_ptr(session, tds); gnutls_transport_set_pull_function(session, tds_pull_func_login); gnutls_transport_set_push_function(session, tds_push_func_login); /* NOTE: there functions return int however they cannot fail */ /* use default priorities... */ gnutls_set_default_priority(session); /* ... but overwrite some */ if (tds->login && tds->login->enable_tls_v1) ret = gnutls_priority_set_direct(session, "NORMAL:%COMPAT:-VERS-SSL3.0", NULL); else ret = gnutls_priority_set_direct(session, "NORMAL:%COMPAT:-VERS-SSL3.0:-VERS-TLS1.0", NULL); if (ret != 0) goto cleanup; /* mssql does not like padding too much */ #ifdef HAVE_GNUTLS_RECORD_DISABLE_PADDING gnutls_record_disable_padding(session); #endif /* put the anonymous credentials to the current session */ tls_msg = "setting credential"; ret = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); if (ret != 0) goto cleanup; /* Perform the TLS handshake */ tls_msg = "handshake"; ret = gnutls_handshake (session); if (ret != 0) goto cleanup; #ifndef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION if (!tds_dstr_isempty(&tds->login->cafile)) { ret = tds_verify_certificate(session); if (ret != 0) goto cleanup; } #endif tdsdump_log(TDS_DBG_INFO1, "handshake succeeded!!\n"); /* some TLS implementations send some sort of paddind at the end, remove it */ tds->in_pos = tds->in_len; gnutls_transport_set_ptr(session, tds->conn); gnutls_transport_set_pull_function(session, tds_pull_func); gnutls_transport_set_push_function(session, tds_push_func); tds->conn->tls_session = session; tds->conn->tls_credentials = xcred; return TDS_SUCCESS; cleanup: if (session) gnutls_deinit(session); if (xcred) gnutls_certificate_free_credentials(xcred); tdsdump_log(TDS_DBG_ERROR, "%s failed: %s\n", tls_msg, gnutls_strerror (ret)); return TDS_FAIL; } void tds_ssl_deinit(TDSCONNECTION *conn) { if (conn->tls_session) { gnutls_deinit((gnutls_session_t) conn->tls_session); conn->tls_session = NULL; } if (conn->tls_credentials) { gnutls_certificate_free_credentials((gnutls_certificate_credentials_t) conn->tls_credentials); conn->tls_credentials = NULL; } conn->encrypt_single_packet = 0; } #else static long tds_ssl_ctrl_login(BIO *b, int cmd, long num, void *ptr) { switch (cmd) { case BIO_CTRL_FLUSH: return 1; } return 0; } static int tds_ssl_free(BIO *a) { /* nothing to do but required */ return 1; } #if OPENSSL_VERSION_NUMBER < 0x1010000FL || defined(LIBRESSL_VERSION_NUMBER) static BIO_METHOD tds_method_login[1] = { { BIO_TYPE_MEM, "tds", tds_push_func_login, tds_pull_func_login, NULL, NULL, tds_ssl_ctrl_login, NULL, tds_ssl_free, NULL, }}; static BIO_METHOD tds_method[1] = { { BIO_TYPE_MEM, "tds", tds_push_func, tds_pull_func, NULL, NULL, NULL, NULL, tds_ssl_free, NULL, }}; static inline void tds_init_ssl_methods(void) { } #else static BIO_METHOD *tds_method_login; static BIO_METHOD *tds_method; static void tds_init_ssl_methods(void) { BIO_METHOD *meth; tds_method_login = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); BIO_meth_set_write(meth, tds_push_func_login); BIO_meth_set_read(meth, tds_pull_func_login); BIO_meth_set_ctrl(meth, tds_ssl_ctrl_login); BIO_meth_set_destroy(meth, tds_ssl_free); tds_method = meth = BIO_meth_new(BIO_TYPE_MEM, "tds"); BIO_meth_set_write(meth, tds_push_func); BIO_meth_set_read(meth, tds_pull_func); BIO_meth_set_destroy(meth, tds_ssl_free); } # ifdef TDS_ATTRIBUTE_DESTRUCTOR static void __attribute__((destructor)) tds_deinit_openssl_methods(void) { BIO_meth_free(tds_method_login); BIO_meth_free(tds_method); } # endif #endif #if OPENSSL_VERSION_NUMBER < 0x1010000FL || defined(LIBRESSL_VERSION_NUMBER) static tds_mutex *openssl_locks; static void openssl_locking_callback(int mode, int type, const char *file, int line) { if (mode & CRYPTO_LOCK) tds_mutex_lock(&openssl_locks[type]); else tds_mutex_unlock(&openssl_locks[type]); } static void tds_init_openssl_thread(void) { int i, n = CRYPTO_num_locks(); /* if already set do not overwrite, * application or another library took care of */ if (CRYPTO_get_locking_callback()) return; openssl_locks = tds_new(tds_mutex, n); for (i=0; i < n; ++i) tds_mutex_init(&openssl_locks[i]); /* read back in the attempt to avoid race conditions * this is not safe but there are no race free ways */ if (CRYPTO_get_locking_callback() == NULL) CRYPTO_set_locking_callback(openssl_locking_callback); if (CRYPTO_get_locking_callback() == openssl_locking_callback) return; for (i=0; i < n; ++i) tds_mutex_free(&openssl_locks[i]); free(openssl_locks); openssl_locks = NULL; } #ifdef TDS_ATTRIBUTE_DESTRUCTOR static void __attribute__((destructor)) tds_deinit_openssl(void) { int i, n; if (!tls_initialized || CRYPTO_get_locking_callback() != openssl_locking_callback) return; CRYPTO_set_locking_callback(NULL); n = CRYPTO_num_locks(); for (i=0; i < n; ++i) tds_mutex_free(&openssl_locks[i]); free(openssl_locks); openssl_locks = NULL; } #endif #else static inline void tds_init_openssl_thread(void) { } #endif static SSL_CTX * tds_init_openssl(void) { const SSL_METHOD *meth; if (!tls_initialized) { tds_mutex_lock(&tls_mutex); if (!tls_initialized) { SSL_library_init(); tds_init_openssl_thread(); tds_init_ssl_methods(); tls_initialized = 1; } tds_mutex_unlock(&tls_mutex); } meth = TLS_client_method(); if (meth == NULL) return NULL; return SSL_CTX_new (meth); } static int check_wildcard(const char *host, const char *match) { const char *p, *w; size_t n, lh, lm; /* U-label (binary) */ for (p = match; *p; ++p) if ((unsigned char) *p >= 0x80) return strcmp(host, match) == 0; for (;;) { /* A-label (starts with xn--) */ if (strncasecmp(match, "xn--", 4) == 0) break; /* match must not be in domain and domain should contains 2 parts */ w = strchr(match, '*'); p = strchr(match, '.'); if (!w || !p /* no wildcard or domain */ || p[1] == '.' /* empty domain */ || w > p || strchr(p, '*') != NULL) /* wildcard in domain */ break; p = strchr(p+1, '.'); if (!p || p[1] == 0) /* not another domain */ break; /* check start */ n = w - match; /* prefix len */ if (n > 0 && strncasecmp(host, match, n) != 0) return 0; /* check end */ lh = strlen(host); lm = strlen(match); n = lm - n - 1; /* suffix len */ if (lm - 1 > lh || strcasecmp(host+lh-n, match+lm-n) != 0 || host[0] == '.') return 0; return 1; } return strcasecmp(host, match) == 0; } #if ENABLE_EXTRA_CHECKS static void tds_check_wildcard_test(void) { assert(check_wildcard("foo", "foo") == 1); assert(check_wildcard("FOO", "foo") == 1); assert(check_wildcard("foo", "FOO") == 1); assert(check_wildcard("\x90oo", "\x90OO") == 0); assert(check_wildcard("xn--foo", "xn--foo") == 1); assert(check_wildcard("xn--FOO", "XN--foo") == 1); assert(check_wildcard("xn--a.example.org", "xn--*.example.org") == 0); assert(check_wildcard("a.*", "a.*") == 1); assert(check_wildcard("a.b", "a.*") == 0); assert(check_wildcard("ab", "a*") == 0); assert(check_wildcard("a.example.", "*.example.") == 0); assert(check_wildcard("a.example.com", "*.example.com") == 1); assert(check_wildcard("a.b.example.com", "a.*.example.com") == 0); assert(check_wildcard("foo.example.com", "foo*.example.com") == 1); assert(check_wildcard("fou.example.com", "foo*.example.com") == 0); assert(check_wildcard("baz.example.com", "*baz.example.com") == 1); assert(check_wildcard("buzz.example.com", "b*z.example.com") == 1); assert(check_wildcard("bz.example.com", "b*z.example.com") == 1); assert(check_wildcard(".example.com", "*.example.com") == 0); assert(check_wildcard("example.com", "*.example.com") == 0); } #else #define tds_check_wildcard_test() do { } while(0) #endif static int check_name_match(ASN1_STRING *name, const char *hostname) { char *name_utf8 = NULL; int ret, name_len; name_len = ASN1_STRING_to_UTF8((unsigned char **) &name_utf8, name); if (name_len < 0) return 0; tdsdump_log(TDS_DBG_INFO1, "Got name %s\n", name_utf8); ret = 0; if (strlen(name_utf8) == name_len && check_wildcard(name_utf8, hostname)) ret = 1; OPENSSL_free(name_utf8); return ret; } static int check_alt_names(X509 *cert, const char *hostname) { STACK_OF(GENERAL_NAME) *alt_names; int i, num; int ret = 1; union { struct in_addr v4; struct in6_addr v6; } ip; unsigned ip_size = 0; /* check whether @hostname is an ip address */ if (strchr(hostname, ':') != NULL) { ip_size = 16; ret = inet_pton(AF_INET6, hostname, &ip.v6); } else { ip_size = 4; ret = inet_pton(AF_INET, hostname, &ip.v4); } if (ret == 0) return -1; ret = -1; alt_names = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); if (!alt_names) return ret; num = sk_GENERAL_NAME_num(alt_names); tdsdump_log(TDS_DBG_INFO1, "Alt names number %d\n", num); for (i = 0; i < num; ++i) { const char *altptr; size_t altlen; const GENERAL_NAME *name = sk_GENERAL_NAME_value(alt_names, i); if (!name) continue; altptr = (const char *) ASN1_STRING_get0_data(name->d.ia5); altlen = (size_t) ASN1_STRING_length(name->d.ia5); if (name->type == GEN_DNS && ip_size == 0) { ret = 0; if (!check_name_match(name->d.dNSName, hostname)) continue; } else if (name->type == GEN_IPADD && ip_size != 0) { ret = 0; if (altlen != ip_size || memcmp(altptr, &ip, altlen) != 0) continue; } else { continue; } sk_GENERAL_NAME_pop_free(alt_names, GENERAL_NAME_free); return 1; } sk_GENERAL_NAME_pop_free(alt_names, GENERAL_NAME_free); return ret; } static int check_hostname(X509 *cert, const char *hostname) { int ret, i; X509_NAME *subject; ASN1_STRING *name; /* check by subject */ ret = check_alt_names(cert, hostname); if (ret >= 0) return ret; /* check by common name (old method) */ subject= X509_get_subject_name(cert); if (!subject) return 0; i = -1; while (X509_NAME_get_index_by_NID(subject, NID_commonName, i) >=0) i = X509_NAME_get_index_by_NID(subject, NID_commonName, i); if (i < 0) return 0; name = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subject, i)); if (!name) return 0; return check_name_match(name, hostname); } int tds_ssl_init(TDSSOCKET *tds) { #define DEFAULT_OPENSSL_CTX_OPTIONS (SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1) #define DEFAULT_OPENSSL_CIPHERS "HIGH:!SSLv2:!aNULL:-DH" SSL *con; SSL_CTX *ctx; BIO *b, *b2; int ret, connect_ret; const char *tls_msg; unsigned long ctx_options = DEFAULT_OPENSSL_CTX_OPTIONS; con = NULL; b = NULL; b2 = NULL; ret = 1; tds_check_wildcard_test(); tds_ssl_deinit(tds->conn); tls_msg = "initializing tls"; ctx = tds_init_openssl(); if (!ctx) goto cleanup; if (tds->login && tds->login->enable_tls_v1) ctx_options &= ~SSL_OP_NO_TLSv1; SSL_CTX_set_options(ctx, ctx_options); if (!tds_dstr_isempty(&tds->login->cafile)) { tls_msg = "loading CA file"; if (strcasecmp(tds_dstr_cstr(&tds->login->cafile), "system") == 0) ret = SSL_CTX_set_default_verify_paths(ctx); else ret = SSL_CTX_load_verify_locations(ctx, tds_dstr_cstr(&tds->login->cafile), NULL); if (ret != 1) goto cleanup; if (!tds_dstr_isempty(&tds->login->crlfile)) { X509_STORE *store = SSL_CTX_get_cert_store(ctx); X509_LOOKUP *lookup; tls_msg = "loading CRL file"; if (!(lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file())) || (!X509_load_crl_file(lookup, tds_dstr_cstr(&tds->login->crlfile), X509_FILETYPE_PEM))) goto cleanup; X509_STORE_set_flags(store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); } SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL); } /* Initialize TLS session */ tls_msg = "initializing session"; con = SSL_new(ctx); if (!con) goto cleanup; tls_msg = "creating bio"; b = BIO_new(tds_method_login); if (!b) goto cleanup; b2 = BIO_new(tds_method); if (!b2) goto cleanup; BIO_set_init(b, 1); BIO_set_data(b, tds); BIO_set_conn_hostname(b, tds_dstr_cstr(&tds->login->server_host_name)); SSL_set_bio(con, b, b); b = NULL; /* use default priorities unless overridden by openssl ciphers setting in freetds.conf file... */ if (!tds_dstr_isempty(&tds->login->openssl_ciphers)) { tdsdump_log(TDS_DBG_INFO1, "setting custom openssl cipher to:%s\n", tds_dstr_cstr(&tds->login->openssl_ciphers)); SSL_set_cipher_list(con, tds_dstr_cstr(&tds->login->openssl_ciphers) ); } else { tdsdump_log(TDS_DBG_INFO1, "setting default openssl cipher to:%s\n", DEFAULT_OPENSSL_CIPHERS ); SSL_set_cipher_list(con, DEFAULT_OPENSSL_CIPHERS); } #ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS /* this disable a security improvement but allow connection... */ SSL_set_options(con, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); #endif /* Perform the TLS handshake */ tls_msg = "handshake"; ERR_clear_error(); SSL_set_connect_state(con); connect_ret = SSL_connect(con); ret = connect_ret != 1 || SSL_get_state(con) != TLS_ST_OK; if (ret != 0) { tdsdump_log(TDS_DBG_ERROR, "handshake failed with %d %d %d\n", connect_ret, SSL_get_state(con), SSL_get_error(con, connect_ret)); goto cleanup; } /* flush pending data */ if (tds->out_pos > 8) tds_flush_packet(tds); /* check certificate hostname */ if (!tds_dstr_isempty(&tds->login->cafile) && tds->login->check_ssl_hostname) { X509 *cert; cert = SSL_get_peer_certificate(con); tls_msg = "checking hostname"; if (!cert || !check_hostname(cert, tds_dstr_cstr(&tds->login->server_host_name))) goto cleanup; X509_free(cert); } tdsdump_log(TDS_DBG_INFO1, "handshake succeeded!!\n"); /* some TLS implementations send some sort of paddind at the end, remove it */ tds->in_pos = tds->in_len; BIO_set_init(b2, 1); BIO_set_data(b2, tds->conn); SSL_set_bio(con, b2, b2); tds->conn->tls_session = con; tds->conn->tls_ctx = ctx; return TDS_SUCCESS; cleanup: if (b2) BIO_free(b2); if (b) BIO_free(b); if (con) { SSL_shutdown(con); SSL_free(con); } SSL_CTX_free(ctx); tdsdump_log(TDS_DBG_ERROR, "%s failed\n", tls_msg); return TDS_FAIL; } void tds_ssl_deinit(TDSCONNECTION *conn) { if (conn->tls_session) { /* NOTE do not call SSL_shutdown here */ SSL_free((SSL *) conn->tls_session); conn->tls_session = NULL; } if (conn->tls_ctx) { SSL_CTX_free((SSL_CTX *) conn->tls_ctx); conn->tls_ctx = NULL; } conn->encrypt_single_packet = 0; } #endif #endif /** @} */ freetds-1.3.6/src/tds/tds_checks.c000644 025423 025423 00000025771 14056414222 020456 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004-2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #undef NDEBUG #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #if ENABLE_EXTRA_CHECKS static void tds_check_packet_extra(const TDSPACKET * packet) { assert(packet); for (; packet; packet = packet->next) { assert(tds_packet_get_data_start(packet) == 0 || tds_packet_get_data_start(packet) == sizeof(TDS72_SMP_HEADER)); assert(packet->data_len + tds_packet_get_data_start(packet) <= packet->capacity); } } void tds_check_tds_extra(const TDSSOCKET * tds) { const int invalid_state = 0; int i; TDSDYNAMIC *cur_dyn = NULL; TDSCURSOR *cur_cursor = NULL; assert(tds); /* test state and connection */ switch (tds->state) { case TDS_DEAD: case TDS_WRITING: case TDS_SENDING: case TDS_PENDING: case TDS_IDLE: case TDS_READING: break; default: assert(invalid_state); } assert(tds->conn); #if ENABLE_ODBC_MARS assert(tds->sid < tds->conn->num_sessions); assert(tds->sid == 0 || tds->conn->mars); if (tds->state != TDS_DEAD) assert(!TDS_IS_SOCKET_INVALID(tds_get_s(tds))); #else assert(tds->state == TDS_DEAD || !TDS_IS_SOCKET_INVALID(tds_get_s(tds))); assert(tds->state != TDS_DEAD || TDS_IS_SOCKET_INVALID(tds_get_s(tds))); #endif /* test env */ tds_check_env_extra(&tds->conn->env); /* test buffers and positions */ assert(tds->send_packet != NULL); assert(tds->send_packet->next == NULL); tds_check_packet_extra(tds->send_packet); tds_check_packet_extra(tds->recv_packet); #if ENABLE_ODBC_MARS if (tds->conn->send_packets) assert(tds->conn->send_pos <= tds->conn->send_packets->data_len + tds->conn->send_packets->data_start); if (tds->conn->recv_packet) assert(tds->conn->recv_pos <= tds->conn->recv_packet->data_len + tds->conn->recv_packet->data_start); if (tds->conn->mars) assert(tds->send_packet->data_start == sizeof(TDS72_SMP_HEADER)); else assert(tds->send_packet->data_start == 0); #endif assert(tds->in_pos <= tds->in_len); assert(tds->in_len <= tds->recv_packet->capacity); /* TODO remove blocksize from env and use out_len ?? */ /* assert(tds->out_pos <= tds->out_len); */ /* assert(tds->out_len == 0 || tds->out_buf != NULL); */ assert(tds->send_packet->capacity >= tds->out_buf_max + TDS_ADDITIONAL_SPACE); assert(tds->out_buf == tds->send_packet->buf + tds_packet_get_data_start(tds->send_packet)); assert(tds->out_buf + tds->out_buf_max + TDS_ADDITIONAL_SPACE <= tds->send_packet->buf + tds->send_packet->capacity); assert(tds->out_pos <= tds->out_buf_max + TDS_ADDITIONAL_SPACE); assert(tds->in_buf == tds->recv_packet->buf || tds->in_buf == tds->recv_packet->buf + sizeof(TDS72_SMP_HEADER)); assert(tds->recv_packet->capacity > 0); /* test res_info */ if (tds->res_info) tds_check_resultinfo_extra(tds->res_info); /* test num_comp_info, comp_info */ assert(tds->num_comp_info >= 0); for (i = 0; i < tds->num_comp_info; ++i) { assert(tds->comp_info); tds_check_resultinfo_extra(tds->comp_info[i]); } /* param_info */ if (tds->param_info) tds_check_resultinfo_extra(tds->param_info); /* test cursors */ for (cur_cursor = tds->conn->cursors; cur_cursor != NULL; cur_cursor = cur_cursor->next) tds_check_cursor_extra(cur_cursor); /* test dynamics */ for (cur_dyn = tds->conn->dyns; cur_dyn != NULL; cur_dyn = cur_dyn->next) tds_check_dynamic_extra(cur_dyn); /* test tds_ctx */ tds_check_context_extra(tds_get_ctx(tds)); /* TODO test char_conv_count, char_convs */ /* we can't have compute and no results */ assert(tds->num_comp_info == 0 || tds->res_info != NULL); /* we can't have normal and parameters results */ /* TODO too strict ?? */ /* assert(tds->param_info == NULL || tds->res_info == NULL); */ if (tds->frozen) { TDSPACKET *pkt; assert(tds->frozen_packets != NULL); for (pkt = tds->frozen_packets; pkt; pkt = pkt->next) { if (pkt->next == NULL) assert(pkt == tds->send_packet); } } else { assert(tds->frozen_packets == NULL); } } void tds_check_context_extra(const TDSCONTEXT * ctx) { assert(ctx); } void tds_check_env_extra(const TDSENV * env) { assert(env); assert(env->block_size >= 0 && env->block_size <= 65536); } void tds_check_column_extra(const TDSCOLUMN * column) { int size; TDSCONNECTION conn; int varint_ok; int column_varint_size; assert(column); column_varint_size = column->column_varint_size; /* 8 is for varchar(max) or similar */ assert(column_varint_size == 8 || (column_varint_size <= 5 && column_varint_size != 3)); assert(column->column_scale <= column->column_prec); assert(column->column_prec <= MAXPRECISION); /* I don't like this that much... freddy77 */ if (column->column_type == 0) return; assert(column->funcs); assert(column->column_type > 0); /* specific checks, if true fully checked */ if (column->funcs->check(column)) return; /* check type and server type same or SQLNCHAR -> SQLCHAR */ #define SPECIAL(ttype, server_type, varint) \ if (column->column_type == ttype && column->on_server.column_type == server_type && column_varint_size == varint) {} else SPECIAL(SYBTEXT, XSYBVARCHAR, 8) SPECIAL(SYBTEXT, XSYBNVARCHAR, 8) SPECIAL(SYBIMAGE, XSYBVARBINARY, 8) assert(tds_get_cardinal_type(column->on_server.column_type, column->column_usertype) == column->column_type || (tds_get_conversion_type(column->on_server.column_type, column->column_size) == column->column_type && column_varint_size == 1 && is_fixed_type(column->column_type))); varint_ok = 0; if (column_varint_size == 8) { if (column->on_server.column_type == XSYBVARCHAR || column->on_server.column_type == XSYBVARBINARY || column->on_server.column_type == XSYBNVARCHAR) varint_ok = 1; } else if (is_blob_type(column->column_type)) { assert(column_varint_size >= 4); } else if (column->column_type == SYBVARIANT) { assert(column_varint_size == 4); } conn.tds_version = 0x500; varint_ok = varint_ok || tds_get_varint_size(&conn, column->on_server.column_type) == column_varint_size; conn.tds_version = 0x700; varint_ok = varint_ok || tds_get_varint_size(&conn, column->on_server.column_type) == column_varint_size; assert(varint_ok); assert(!is_numeric_type(column->column_type)); assert(column->column_cur_size <= column->column_size); /* check size of fixed type correct */ size = tds_get_size_by_type(column->column_type); /* these peculiar types are variable but have only a possible size */ if ((size > 0 && (column->column_type != SYBBITN && column->column_type != SYBDATEN && column->column_type != SYBTIMEN)) || column->column_type == SYBVOID) { /* check macro */ assert(is_fixed_type(column->column_type)); /* check current size */ assert(size == column->column_size); /* check cases where server need nullable types */ if (column->column_type != column->on_server.column_type && (column->column_type != SYBINT8 || column->on_server.column_type != SYB5INT8)) { assert(!is_fixed_type(column->on_server.column_type)); assert(column_varint_size == 1); assert(column->column_size == column->column_cur_size || column->column_cur_size == -1); } else { assert(column_varint_size == 0 || (column->column_type == SYBUNIQUE && column_varint_size == 1)); assert(column->column_size == column->column_cur_size || (column->column_type == SYBUNIQUE && column->column_cur_size == -1)); } assert(column->column_size == column->on_server.column_size); } else { assert(!is_fixed_type(column->column_type)); assert(is_char_type(column->column_type) || (column->on_server.column_size == column->column_size || column->on_server.column_size == 0)); assert(column_varint_size != 0); } /* check size of nullable types (ie intN) it's supported */ if (tds_get_conversion_type(column->column_type, 4) != column->column_type) { /* check macro */ assert(is_nullable_type(column->column_type)); /* check that size it's correct for this type of nullable */ assert(tds_get_conversion_type(column->column_type, column->column_size) != column->column_type); /* check current size */ assert(column->column_size >= column->column_cur_size || column->column_cur_size == -1); /* check same type and size on server */ assert(column->column_type == column->on_server.column_type); assert(column->column_size == column->on_server.column_size); } assert(column->column_iconv_left >= 0 && column->column_iconv_left <= sizeof(column->column_iconv_buf)); } void tds_check_resultinfo_extra(const TDSRESULTINFO * res_info) { int i; assert(res_info); assert(res_info->num_cols >= 0); assert(res_info->ref_count > 0); for (i = 0; i < res_info->num_cols; ++i) { assert(res_info->columns); tds_check_column_extra(res_info->columns[i]); assert(res_info->columns[i]->column_data != NULL || res_info->row_size == 0); } assert(res_info->row_size >= 0); assert(res_info->computeid >= 0); assert(res_info->by_cols >= 0); assert(res_info->by_cols == 0 || res_info->bycolumns); } void tds_check_cursor_extra(const TDSCURSOR * cursor) { assert(cursor); assert(cursor->ref_count > 0); if (cursor->res_info) tds_check_resultinfo_extra(cursor->res_info); } void tds_check_dynamic_extra(const TDSDYNAMIC * dyn) { assert(dyn); assert(dyn->ref_count > 0); if (dyn->res_info) tds_check_resultinfo_extra(dyn->res_info); if (dyn->params) tds_check_resultinfo_extra(dyn->params); assert(!dyn->emulated || dyn->query); } void tds_check_freeze_extra(const TDSFREEZE * freeze) { TDSPACKET *pkt; assert(freeze); assert(freeze->tds != NULL); assert(freeze->size_len <= 4 && freeze->size_len != 3); tds_check_tds_extra(freeze->tds); /* check position */ if (freeze->pkt == freeze->tds->send_packet) assert(freeze->tds->out_pos >= freeze->pkt_pos); else assert(freeze->pkt->data_len >= freeze->pkt_pos); /* check packet is in list */ for (pkt = freeze->tds->frozen_packets; ; pkt = pkt->next) { assert(pkt); if (pkt == freeze->pkt) break; /* found */ } } void tds_extra_assert_check(const char *fn, int line, int cond, const char *cond_str) { if (cond) return; fprintf(stderr, "%s:%d: Failed checking condition '%s'\n", fn, line, cond_str); abort(); } #endif /* ENABLE_EXTRA_CHECKS */ freetds-1.3.6/src/tds/log.c000644 025423 025423 00000027501 14056414271 017122 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2006-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef _WIN32 # include #endif #include #include #include #include /* for now all messages go to the log */ int tds_debug_flags = TDS_DBGFLAG_ALL | TDS_DBGFLAG_SOURCE; int tds_g_append_mode = 0; static char *g_dump_filename = NULL; /** Tell if TDS debug logging is turned on or off */ int tds_write_dump = 0; /** List of threads excluded from logging, used to exclude some sensitive data */ static TDSDUMP_OFF_ITEM *off_list; static FILE *g_dumpfile = NULL; /* file pointer for dump log */ static tds_mutex g_dump_mutex = TDS_MUTEX_INITIALIZER; static FILE* tdsdump_append(void); #ifdef TDS_ATTRIBUTE_DESTRUCTOR static void __attribute__((destructor)) tds_util_deinit(void) { tdsdump_close(); } #endif /** * Temporarily turn off logging for current thread. * @param off_item List item to be used by the function. * The item will be initialized by the function. * It's retained till is removed with tdsdump_on so it must be kept alive. */ void tdsdump_off(TDSDUMP_OFF_ITEM *off_item) { /* if already off don't add current thread to exclude list to make it faster */ if (!tds_write_dump) return; off_item->thread_id = tds_thread_get_current_id(); tds_mutex_lock(&g_dump_mutex); off_item->next = off_list; off_list = off_item; tds_mutex_unlock(&g_dump_mutex); } /* tdsdump_off() */ /** * Turn logging back on for current thread. * @param off_item List item to remove from global list. * Previously used by tdsdump_off(). */ void tdsdump_on(TDSDUMP_OFF_ITEM *off_item) { TDSDUMP_OFF_ITEM **curr; tds_mutex_lock(&g_dump_mutex); for (curr = &off_list; *curr != NULL; curr = &(*curr)->next) { if (*curr == off_item) { *curr = (*curr)->next; break; } } tds_mutex_unlock(&g_dump_mutex); } int tdsdump_isopen() { return g_dumpfile || g_dump_filename; } /** * Create and truncate a human readable dump file for the TDS * traffic. The name of the file is specified by the filename * parameter. If that is given as NULL or an empty string, * any existing log file will be closed. * * \return true if the file was opened, false if it couldn't be opened. */ int tdsdump_open(const char *filename) { int result; /* really should be a boolean, not an int */ tds_mutex_lock(&g_dump_mutex); /* same append file */ if (tds_g_append_mode && filename != NULL && g_dump_filename != NULL && strcmp(filename, g_dump_filename) == 0) { tds_mutex_unlock(&g_dump_mutex); return 1; } tds_write_dump = 0; /* free old one */ if (g_dumpfile != NULL && g_dumpfile != stdout && g_dumpfile != stderr) fclose(g_dumpfile); g_dumpfile = NULL; if (g_dump_filename) TDS_ZERO_FREE(g_dump_filename); /* required to close just log ?? */ if (filename == NULL || filename[0] == '\0') { tds_mutex_unlock(&g_dump_mutex); return 1; } result = 1; if (tds_g_append_mode) { g_dump_filename = strdup(filename); /* if mutex are available do not reopen file every time */ #ifdef TDS_HAVE_MUTEX g_dumpfile = tdsdump_append(); #endif } else if (!strcmp(filename, "stdout")) { g_dumpfile = stdout; } else if (!strcmp(filename, "stderr")) { g_dumpfile = stderr; } else if (NULL == (g_dumpfile = fopen(filename, "w"))) { result = 0; } if (result) tds_write_dump = 1; tds_mutex_unlock(&g_dump_mutex); if (result) { char today[64]; struct tm res; time_t t; time(&t); today[0] = 0; if (tds_localtime_r(&t, &res)) strftime(today, sizeof(today), "%Y-%m-%d %H:%M:%S", &res); tdsdump_log(TDS_DBG_INFO1, "Starting log file for FreeTDS %s\n" "\ton %s with debug flags 0x%x.\n", VERSION, today, tds_debug_flags); } return result; } /* tdsdump_open() */ static FILE* tdsdump_append(void) { if (!g_dump_filename) return NULL; if (!strcmp(g_dump_filename, "stdout")) { return stdout; } else if (!strcmp(g_dump_filename, "stderr")) { return stderr; } return fopen(g_dump_filename, "a"); } /** * Close the TDS dump log file. */ void tdsdump_close(void) { tds_mutex_lock(&g_dump_mutex); tds_write_dump = 0; if (g_dumpfile != NULL && g_dumpfile != stdout && g_dumpfile != stderr) fclose(g_dumpfile); g_dumpfile = NULL; if (g_dump_filename) TDS_ZERO_FREE(g_dump_filename); tds_mutex_unlock(&g_dump_mutex); } /* tdsdump_close() */ static void tdsdump_start(FILE *file, const char *fname, int line) { char buf[128], *pbuf; int started = 0; /* write always time before log */ if (tds_debug_flags & TDS_DBGFLAG_TIME) { fputs(tds_timestamp_str(buf, 127), file); started = 1; } pbuf = buf; if (tds_debug_flags & TDS_DBGFLAG_PID) { if (started) *pbuf++ = ' '; pbuf += sprintf(pbuf, "%d", (int) getpid()); started = 1; } if ((tds_debug_flags & TDS_DBGFLAG_SOURCE) && fname && line) { const char *p; p = strrchr(fname, '/'); if (p) fname = p + 1; p = strrchr(fname, '\\'); if (p) fname = p + 1; if (started) pbuf += sprintf(pbuf, " (%s:%d)", fname, line); else pbuf += sprintf(pbuf, "%s:%d", fname, line); started = 1; } if (started) *pbuf++ = ':'; *pbuf = 0; fputs(buf, file); } /** * Check if current thread is in the list of excluded threads * g_dump_mutex must be held. */ static bool current_thread_is_excluded(void) { TDSDUMP_OFF_ITEM *curr_off; tds_mutex_check_owned(&g_dump_mutex); for (curr_off = off_list; curr_off; curr_off = curr_off->next) if (tds_thread_is_current(curr_off->thread_id)) return true; return false; } #undef tdsdump_dump_buf /** * Dump the contents of data into the log file in a human readable format. * \param file source file name * \param level_line line and level combined. This and file are automatically computed by * TDS_DBG_* macros. * \param msg message to print before dump * \param buf buffer to dump * \param length number of bytes in the buffer */ void tdsdump_dump_buf(const char* file, unsigned int level_line, const char *msg, const void *buf, size_t length) { size_t i, j; #define BYTES_PER_LINE 16 const unsigned char *data = (const unsigned char *) buf; const int debug_lvl = level_line & 15; const int line = level_line >> 4; char line_buf[BYTES_PER_LINE * 8 + 16], *p; FILE *dumpfile; if (((tds_debug_flags >> debug_lvl) & 1) == 0 || !tds_write_dump) return; if (!g_dumpfile && !g_dump_filename) return; tds_mutex_lock(&g_dump_mutex); if (current_thread_is_excluded()) { tds_mutex_unlock(&g_dump_mutex); return; } dumpfile = g_dumpfile; #ifdef TDS_HAVE_MUTEX if (tds_g_append_mode && dumpfile == NULL) dumpfile = g_dumpfile = tdsdump_append(); #else if (tds_g_append_mode) dumpfile = tdsdump_append(); #endif if (dumpfile == NULL) { tds_mutex_unlock(&g_dump_mutex); return; } tdsdump_start(dumpfile, file, line); fprintf(dumpfile, "%s\n", msg); for (i = 0; i < length; i += BYTES_PER_LINE) { p = line_buf; /* * print the offset as a 4 digit hex number */ p += sprintf(p, "%04x", ((unsigned int) i) & 0xffffu); /* * print each byte in hex */ for (j = 0; j < BYTES_PER_LINE; j++) { if (j == BYTES_PER_LINE / 2) *p++ = '-'; else *p++ = ' '; if (j + i >= length) p += sprintf(p, " "); else p += sprintf(p, "%02x", data[i + j]); } /* * skip over to the ascii dump column */ p += sprintf(p, " |"); /* * print each byte in ascii */ for (j = i; j < length && (j - i) < BYTES_PER_LINE; j++) { if (j - i == BYTES_PER_LINE / 2) *p++ = ' '; p += sprintf(p, "%c", (isprint(data[j])) ? data[j] : '.'); } strcpy(p, "|\n"); fputs(line_buf, dumpfile); } fputs("\n", dumpfile); fflush(dumpfile); #ifndef TDS_HAVE_MUTEX if (tds_g_append_mode) { if (dumpfile != stdout && dumpfile != stderr) fclose(dumpfile); } #endif tds_mutex_unlock(&g_dump_mutex); } /* tdsdump_dump_buf() */ #define tdsdump_dump_buf TDSDUMP_BUF_FAST #undef tdsdump_log /** * Write a message to the debug log. * \param file name of the log file * \param level_line kind of detail to be included * \param fmt printf-like format string */ void tdsdump_log(const char* file, unsigned int level_line, const char *fmt, ...) { const int debug_lvl = level_line & 15; const int line = level_line >> 4; va_list ap; FILE *dumpfile; if (((tds_debug_flags >> debug_lvl) & 1) == 0 || !tds_write_dump) return; if (!g_dumpfile && !g_dump_filename) return; tds_mutex_lock(&g_dump_mutex); if (current_thread_is_excluded()) { tds_mutex_unlock(&g_dump_mutex); return; } dumpfile = g_dumpfile; #ifdef TDS_HAVE_MUTEX if (tds_g_append_mode && dumpfile == NULL) dumpfile = g_dumpfile = tdsdump_append(); #else if (tds_g_append_mode) dumpfile = tdsdump_append(); #endif if (dumpfile == NULL) { tds_mutex_unlock(&g_dump_mutex); return; } tdsdump_start(dumpfile, file, line); va_start(ap, fmt); vfprintf(dumpfile, fmt, ap); va_end(ap); fflush(dumpfile); #ifndef TDS_HAVE_MUTEX if (tds_g_append_mode) { if (dumpfile != stdout && dumpfile != stderr) fclose(dumpfile); } #endif tds_mutex_unlock(&g_dump_mutex); } /* tdsdump_log() */ #define tdsdump_log TDSDUMP_LOG_FAST /** * Write a column value to the debug log. * \param col column to dump */ void tdsdump_col(const TDSCOLUMN *col) { const char* type_name; char* data; TDS_SMALLINT type; assert(col); assert(col->column_data); type_name = tds_prtype(col->column_type); type = tds_get_conversion_type(col->column_type, col->column_size); switch(type) { case SYBCHAR: case SYBVARCHAR: if (col->column_cur_size >= 0) { data = tds_new0(char, 1 + col->column_cur_size); if (!data) { tdsdump_log(TDS_DBG_FUNC, "no memory to log data for type %s\n", type_name); return; } memcpy(data, col->column_data, col->column_cur_size); tdsdump_log(TDS_DBG_FUNC, "type %s has value \"%s\"\n", type_name, data); free(data); } else { tdsdump_log(TDS_DBG_FUNC, "type %s has value NULL\n", type_name); } break; case SYBINT1: tdsdump_log(TDS_DBG_FUNC, "type %s has value %d\n", type_name, (int)*(TDS_TINYINT*)col->column_data); break; case SYBINT2: tdsdump_log(TDS_DBG_FUNC, "type %s has value %d\n", type_name, (int)*(TDS_SMALLINT*)col->column_data); break; case SYBINT4: tdsdump_log(TDS_DBG_FUNC, "type %s has value %d\n", type_name, (int)*(TDS_INT*)col->column_data); break; case SYBREAL: tdsdump_log(TDS_DBG_FUNC, "type %s has value %f\n", type_name, (double)*(TDS_REAL*)col->column_data); break; case SYBFLT8: tdsdump_log(TDS_DBG_FUNC, "type %s has value %f\n", type_name, (double)*(TDS_FLOAT*)col->column_data); break; default: tdsdump_log(TDS_DBG_FUNC, "cannot log data for type %s\n", type_name); break; } } freetds-1.3.6/src/tds/bulk.c000644 025423 025423 00000104707 14056414271 017302 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008-2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * \file * \brief Handle bulk copy */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #include #include #include #include #include #include #include /** \cond HIDDEN_SYMBOLS */ #ifndef MAX #define MAX(a,b) ( (a) > (b) ? (a) : (b) ) #endif /** \endcond */ /** * Holds clause buffer */ typedef struct tds_pbcb { /** buffer */ char *pb; /** buffer length */ unsigned int cb; /** true is buffer came from malloc */ unsigned int from_malloc; } TDSPBCB; static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo); static TDSRET tds_bcp_start_insert_stmt(TDSSOCKET *tds, TDSBCPINFO *bcpinfo); static int tds5_bcp_add_fixed_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, unsigned char * rowbuffer, int start); static int tds5_bcp_add_variable_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, TDS_UCHAR *rowbuffer, int start, int *pncols); static void tds_bcp_row_free(TDSRESULTINFO* result, unsigned char *row); /** * Initialize BCP information. * Query structure of the table to server. * \tds * \param bcpinfo BCP information to initialize. Structure should be allocate * and table name and direction should be already set. */ TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo) { TDSRESULTINFO *resinfo; TDSRESULTINFO *bindinfo = NULL; TDSCOLUMN *curcol; TDS_INT result_type; int i; TDSRET rc; const char *fmt; /* FIXME don't leave state in processing state */ /* TODO quote tablename if needed */ if (bcpinfo->direction != TDS_BCP_QUERYOUT) fmt = "SET FMTONLY ON select * from %s SET FMTONLY OFF"; else fmt = "SET FMTONLY ON %s SET FMTONLY OFF"; if (TDS_FAILED(rc=tds_submit_queryf(tds, fmt, tds_dstr_cstr(&bcpinfo->tablename)))) /* TODO return an error ?? */ /* Attempt to use Bulk Copy with a non-existent Server table (might be why ...) */ return rc; /* TODO possibly stop at ROWFMT and copy before going to idle */ /* TODO check what happen if table is not present, cleanup on error */ while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) continue; if (TDS_FAILED(rc)) return rc; /* copy the results info from the TDS socket */ if (!tds->res_info) return TDS_FAIL; resinfo = tds->res_info; if ((bindinfo = tds_alloc_results(resinfo->num_cols)) == NULL) { rc = TDS_FAIL; goto cleanup; } bindinfo->row_size = resinfo->row_size; /* Copy the column metadata */ rc = TDS_FAIL; for (i = 0; i < bindinfo->num_cols; i++) { curcol = bindinfo->columns[i]; /* * TODO use memcpy ?? * curcol and resinfo->columns[i] are both TDSCOLUMN. * Why not "curcol = resinfo->columns[i];"? Because the rest of TDSCOLUMN (below column_timestamp) * isn't being used. Perhaps this "upper" part of TDSCOLUMN should be a substructure. * Or, see if the "lower" part is unused (and zeroed out) at this point, and just do one assignment. */ curcol->funcs = resinfo->columns[i]->funcs; curcol->column_type = resinfo->columns[i]->column_type; curcol->column_usertype = resinfo->columns[i]->column_usertype; curcol->column_flags = resinfo->columns[i]->column_flags; if (curcol->column_varint_size == 0) curcol->column_cur_size = resinfo->columns[i]->column_cur_size; else curcol->column_cur_size = -1; curcol->column_size = resinfo->columns[i]->column_size; curcol->column_varint_size = resinfo->columns[i]->column_varint_size; curcol->column_prec = resinfo->columns[i]->column_prec; curcol->column_scale = resinfo->columns[i]->column_scale; curcol->on_server.column_type = resinfo->columns[i]->on_server.column_type; curcol->on_server.column_size = resinfo->columns[i]->on_server.column_size; curcol->char_conv = resinfo->columns[i]->char_conv; if (!tds_dstr_dup(&curcol->column_name, &resinfo->columns[i]->column_name)) goto cleanup; if (!tds_dstr_dup(&curcol->table_column_name, &resinfo->columns[i]->table_column_name)) goto cleanup; curcol->column_nullable = resinfo->columns[i]->column_nullable; curcol->column_identity = resinfo->columns[i]->column_identity; curcol->column_timestamp = resinfo->columns[i]->column_timestamp; curcol->column_computed = resinfo->columns[i]->column_computed; memcpy(curcol->column_collation, resinfo->columns[i]->column_collation, 5); if (is_numeric_type(curcol->column_type)) { curcol->bcp_column_data = tds_alloc_bcp_column_data(sizeof(TDS_NUMERIC)); ((TDS_NUMERIC *) curcol->bcp_column_data->data)->precision = curcol->column_prec; ((TDS_NUMERIC *) curcol->bcp_column_data->data)->scale = curcol->column_scale; } else { curcol->bcp_column_data = tds_alloc_bcp_column_data(MAX(curcol->column_size,curcol->on_server.column_size)); } if (!curcol->bcp_column_data) goto cleanup; } if (!IS_TDS7_PLUS(tds->conn)) { bindinfo->current_row = tds_new(unsigned char, bindinfo->row_size); if (!bindinfo->current_row) goto cleanup; bindinfo->row_free = tds_bcp_row_free; } if (bcpinfo->identity_insert_on) { rc = tds_submit_queryf(tds, "set identity_insert %s on", tds_dstr_cstr(&bcpinfo->tablename)); if (TDS_FAILED(rc)) goto cleanup; /* TODO use tds_process_simple_query */ while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { } if (rc != TDS_NO_MORE_RESULTS) goto cleanup; } bcpinfo->bindinfo = bindinfo; bcpinfo->bind_count = 0; return TDS_SUCCESS; cleanup: tds_free_results(bindinfo); return rc; } /** * Help to build query to be sent to server. * Append column declaration to the query. * Only for TDS 7.0+. * \tds * \param[out] clause output string * \param bcpcol column to append * \param first true if column is the first * \return TDS_SUCCESS or TDS_FAIL. */ static TDSRET tds7_build_bulk_insert_stmt(TDSSOCKET * tds, TDSPBCB * clause, TDSCOLUMN * bcpcol, int first) { char column_type[40]; tdsdump_log(TDS_DBG_FUNC, "tds7_build_bulk_insert_stmt(%p, %p, %p, %d)\n", tds, clause, bcpcol, first); if (TDS_FAILED(tds_get_column_declaration(tds, bcpcol, column_type))) { tdserror(tds_get_ctx(tds), tds, TDSEBPROBADTYP, errno); tdsdump_log(TDS_DBG_FUNC, "error: cannot build bulk insert statement. unrecognized server datatype %d\n", bcpcol->on_server.column_type); return TDS_FAIL; } if (clause->cb < strlen(clause->pb) + tds_quote_id(tds, NULL, tds_dstr_cstr(&bcpcol->column_name), tds_dstr_len(&bcpcol->column_name)) + strlen(column_type) + ((first) ? 2u : 4u)) { char *temp = tds_new(char, 2 * clause->cb); if (!temp) { tdserror(tds_get_ctx(tds), tds, TDSEMEM, errno); return TDS_FAIL; } strcpy(temp, clause->pb); if (clause->from_malloc) free(clause->pb); clause->from_malloc = 1; clause->pb = temp; clause->cb *= 2; } if (!first) strcat(clause->pb, ", "); tds_quote_id(tds, strchr(clause->pb, 0), tds_dstr_cstr(&bcpcol->column_name), tds_dstr_len(&bcpcol->column_name)); strcat(clause->pb, " "); strcat(clause->pb, column_type); return TDS_SUCCESS; } /** * Prepare the query to be sent to server to request BCP information * \tds * \param bcpinfo BCP information */ static TDSRET tds_bcp_start_insert_stmt(TDSSOCKET * tds, TDSBCPINFO * bcpinfo) { char *query; if (IS_TDS7_PLUS(tds->conn)) { int i, firstcol, erc; char *hint; TDSCOLUMN *bcpcol; TDSPBCB colclause; char clause_buffer[4096] = { 0 }; colclause.pb = clause_buffer; colclause.cb = sizeof(clause_buffer); colclause.from_malloc = 0; /* TODO avoid asprintf, use always malloc-ed buffer */ firstcol = 1; for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { bcpcol = bcpinfo->bindinfo->columns[i]; if (bcpcol->column_timestamp) continue; if (!bcpinfo->identity_insert_on && bcpcol->column_identity) continue; if (bcpcol->column_computed) continue; tds7_build_bulk_insert_stmt(tds, &colclause, bcpcol, firstcol); firstcol = 0; } if (bcpinfo->hint) { if (asprintf(&hint, " with (%s)", bcpinfo->hint) < 0) hint = NULL; } else { hint = strdup(""); } if (!hint) { if (colclause.from_malloc) TDS_ZERO_FREE(colclause.pb); return TDS_FAIL; } erc = asprintf(&query, "insert bulk %s (%s)%s", tds_dstr_cstr(&bcpinfo->tablename), colclause.pb, hint); free(hint); if (colclause.from_malloc) TDS_ZERO_FREE(colclause.pb); /* just for good measure; not used beyond this point */ if (erc < 0) return TDS_FAIL; } else { /* NOTE: if we use "with nodescribe" for following inserts server do not send describe */ if (asprintf(&query, "insert bulk %s", tds_dstr_cstr(&bcpinfo->tablename)) < 0) return TDS_FAIL; } /* save the statement for later... */ bcpinfo->insert_stmt = query; return TDS_SUCCESS; } static TDSRET tds7_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, int offset) { int i; tds_put_byte(tds, TDS_ROW_TOKEN); /* 0xd1 */ for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { TDS_INT save_size; unsigned char *save_data; TDSBLOB blob; TDSCOLUMN *bindcol; TDSRET rc; bindcol = bcpinfo->bindinfo->columns[i]; /* * Don't send the (meta)data for timestamp columns or * identity columns unless indentity_insert is enabled. */ if ((!bcpinfo->identity_insert_on && bindcol->column_identity) || bindcol->column_timestamp || bindcol->column_computed) { continue; } rc = get_col_data(bcpinfo, bindcol, offset); if (TDS_FAILED(rc)) { tdsdump_log(TDS_DBG_INFO1, "get_col_data (column %d) failed\n", i + 1); return rc; } tdsdump_log(TDS_DBG_INFO1, "gotten column %d length %d null %d\n", i + 1, bindcol->bcp_column_data->datalen, bindcol->bcp_column_data->is_null); save_size = bindcol->column_cur_size; save_data = bindcol->column_data; assert(bindcol->column_data == NULL); if (bindcol->bcp_column_data->is_null) { bindcol->column_cur_size = -1; } else if (is_blob_col(bindcol)) { bindcol->column_cur_size = bindcol->bcp_column_data->datalen; memset(&blob, 0, sizeof(blob)); blob.textvalue = (TDS_CHAR *) bindcol->bcp_column_data->data; bindcol->column_data = (unsigned char *) &blob; } else { bindcol->column_cur_size = bindcol->bcp_column_data->datalen; bindcol->column_data = bindcol->bcp_column_data->data; } rc = bindcol->funcs->put_data(tds, bindcol, 1); bindcol->column_cur_size = save_size; bindcol->column_data = save_data; if (TDS_FAILED(rc)) return rc; } return TDS_SUCCESS; } static TDSRET tds5_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset) { int row_pos; int row_sz_pos; int blob_cols = 0; int var_cols_written = 0; TDS_INT old_record_size = bcpinfo->bindinfo->row_size; unsigned char *record = bcpinfo->bindinfo->current_row; int i; memset(record, '\0', old_record_size); /* zero the rowbuffer */ /* * offset 0 = number of var columns * offset 1 = row number. zeroed (datasever assigns) */ row_pos = 2; if ((row_pos = tds5_bcp_add_fixed_columns(bcpinfo, get_col_data, null_error, offset, record, row_pos)) < 0) return TDS_FAIL; row_sz_pos = row_pos; /* potential variable columns to write */ row_pos = tds5_bcp_add_variable_columns(bcpinfo, get_col_data, null_error, offset, record, row_pos, &var_cols_written); if (row_pos < 0) return TDS_FAIL; if (var_cols_written) { TDS_PUT_UA2LE(&record[row_sz_pos], row_pos); record[0] = var_cols_written; } tdsdump_log(TDS_DBG_INFO1, "old_record_size = %d new size = %d \n", old_record_size, row_pos); tds_put_smallint(tds, row_pos); tds_put_n(tds, record, row_pos); /* row is done, now handle any text/image data */ blob_cols = 0; for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { TDSCOLUMN *bindcol = bcpinfo->bindinfo->columns[i]; if (is_blob_type(bindcol->column_type)) { TDSRET rc = get_col_data(bcpinfo, bindcol, offset); if (TDS_FAILED(rc)) return rc; /* unknown but zero */ tds_put_smallint(tds, 0); tds_put_byte(tds, bindcol->column_type); tds_put_byte(tds, 0xff - blob_cols); /* * offset of txptr we stashed during variable * column processing */ tds_put_smallint(tds, bindcol->column_textpos); tds_put_int(tds, bindcol->bcp_column_data->datalen); tds_put_n(tds, bindcol->bcp_column_data->data, bindcol->bcp_column_data->datalen); blob_cols++; } } return TDS_SUCCESS; } /** * Send one row of data to server * \tds * \param bcpinfo BCP information * \param get_col_data function to call to retrieve data to be sent * \param ignored function to call if we try to send NULL if not allowed (not used) * \param offset passed to get_col_data and null_error to specify the row to get * \return TDS_SUCCESS or TDS_FAIL. */ TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset) { TDSRET rc; tdsdump_log(TDS_DBG_FUNC, "tds_bcp_send_bcp_record(%p, %p, %p, %p, %d)\n", tds, bcpinfo, get_col_data, null_error, offset); if (tds->out_flag != TDS_BULK || tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; if (IS_TDS7_PLUS(tds->conn)) rc = tds7_send_record(tds, bcpinfo, get_col_data, offset); else rc = tds5_send_record(tds, bcpinfo, get_col_data, null_error, offset); tds_set_state(tds, TDS_SENDING); return rc; } static inline void tds5_swap_data(const TDSCOLUMN *col, void *p) { #ifdef WORDS_BIGENDIAN tds_swap_datatype(tds_get_conversion_type(col->column_type, col->column_size), p); #endif } /** * Add fixed size columns to the row * \param bcpinfo BCP information * \param get_col_data function to call to retrieve data to be sent * \param ignored function to call if we try to send NULL if not allowed (not used) * \param offset passed to get_col_data and null_error to specify the row to get * \param rowbuffer row buffer to write to * \param start row buffer last end position * \returns new row length or -1 on error. */ static int tds5_bcp_add_fixed_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, unsigned char * rowbuffer, int start) { TDS_NUMERIC *num; int row_pos = start; int cpbytes; int i, j; int bitleft = 0, bitpos; assert(bcpinfo); assert(rowbuffer); tdsdump_log(TDS_DBG_FUNC, "tds5_bcp_add_fixed_columns(%p, %p, %p, %d, %p, %d)\n", bcpinfo, get_col_data, null_error, offset, rowbuffer, start); for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { TDSCOLUMN *const bcpcol = bcpinfo->bindinfo->columns[i]; const TDS_INT column_size = bcpcol->on_server.column_size; if (is_nullable_type(bcpcol->column_type) || bcpcol->column_nullable) continue; tdsdump_log(TDS_DBG_FUNC, "tds5_bcp_add_fixed_columns column %d is a fixed column\n", i + 1); if (TDS_FAILED(get_col_data(bcpinfo, bcpcol, offset))) { tdsdump_log(TDS_DBG_INFO1, "get_col_data (column %d) failed\n", i + 1); return -1; } /* We have no way to send a NULL at this point, return error to client */ if (bcpcol->bcp_column_data->is_null) { tdsdump_log(TDS_DBG_ERROR, "tds5_bcp_add_fixed_columns column %d is a null column\n", i + 1); /* No value or default value available and NULL not allowed. */ if (null_error) null_error(bcpinfo, i, offset); return -1; } if (is_numeric_type(bcpcol->column_type)) { num = (TDS_NUMERIC *) bcpcol->bcp_column_data->data; cpbytes = tds_numeric_bytes_per_prec[num->precision]; memcpy(&rowbuffer[row_pos], num->array, cpbytes); } else if (bcpcol->column_type == SYBBIT) { /* all bit are collapsed together */ if (!bitleft) { bitpos = row_pos++; bitleft = 8; rowbuffer[bitpos] = 0; } if (bcpcol->bcp_column_data->data[0]) rowbuffer[bitpos] |= 256 >> bitleft; --bitleft; continue; } else { cpbytes = bcpcol->bcp_column_data->datalen > column_size ? column_size : bcpcol->bcp_column_data->datalen; memcpy(&rowbuffer[row_pos], bcpcol->bcp_column_data->data, cpbytes); tds5_swap_data(bcpcol, &rowbuffer[row_pos]); /* CHAR data may need padding out to the database length with blanks */ /* TODO check binary !!! */ if (bcpcol->column_type == SYBCHAR && cpbytes < column_size) { for (j = cpbytes; j < column_size; j++) rowbuffer[row_pos + j] = ' '; } } row_pos += column_size; } return row_pos; } /** * Add variable size columns to the row * * \param bcpinfo BCP information already prepared * \param get_col_data function to call to retrieve data to be sent * \param null_error function to call if we try to send NULL if not allowed * \param offset passed to get_col_data and null_error to specify the row to get * \param rowbuffer The row image that will be sent to the server. * \param start Where to begin copying data into the rowbuffer. * \param pncols Address of output variable holding the count of columns added to the rowbuffer. * * \return length of (potentially modified) rowbuffer, or -1. */ static int tds5_bcp_add_variable_columns(TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset, TDS_UCHAR* rowbuffer, int start, int *pncols) { TDS_USMALLINT offsets[256]; unsigned int i, row_pos; unsigned int ncols = 0; assert(bcpinfo); assert(rowbuffer); assert(pncols); tdsdump_log(TDS_DBG_FUNC, "%4s %8s %18s %18s %8s\n", "col", "type", "is_nullable_type", "column_nullable", "is null" ); for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { TDSCOLUMN *bcpcol = bcpinfo->bindinfo->columns[i]; tdsdump_log(TDS_DBG_FUNC, "%4d %8d %18s %18s %8s\n", i, bcpcol->column_type, is_nullable_type(bcpcol->column_type)? "yes" : "no", bcpcol->column_nullable? "yes" : "no", bcpcol->bcp_column_data->is_null? "yes" : "no" ); } /* the first two bytes of the rowbuffer are reserved to hold the entire record length */ row_pos = start + 2; offsets[0] = row_pos; tdsdump_log(TDS_DBG_FUNC, "%4s %8s %8s %8s\n", "col", "ncols", "row_pos", "cpbytes"); for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { unsigned int cpbytes = 0; TDSCOLUMN *bcpcol = bcpinfo->bindinfo->columns[i]; /* * Is this column of "variable" type, i.e. NULLable * or naturally variable length e.g. VARCHAR */ if (!is_nullable_type(bcpcol->column_type) && !bcpcol->column_nullable) continue; tdsdump_log(TDS_DBG_FUNC, "%4d %8d %8d %8d\n", i, ncols, row_pos, cpbytes); if (TDS_FAILED(get_col_data(bcpinfo, bcpcol, offset))) return -1; /* If it's a NOT NULL column, and we have no data, throw an error. * This is the behavior for Sybase, this function is only used for Sybase */ if (!bcpcol->column_nullable && bcpcol->bcp_column_data->is_null) { /* No value or default value available and NULL not allowed. */ if (null_error) null_error(bcpinfo, i, offset); return -1; } /* move the column buffer into the rowbuffer */ if (!bcpcol->bcp_column_data->is_null) { if (is_blob_type(bcpcol->column_type)) { cpbytes = 16; bcpcol->column_textpos = row_pos; /* save for data write */ } else if (is_numeric_type(bcpcol->column_type)) { TDS_NUMERIC *num = (TDS_NUMERIC *) bcpcol->bcp_column_data->data; cpbytes = tds_numeric_bytes_per_prec[num->precision]; memcpy(&rowbuffer[row_pos], num->array, cpbytes); } else { cpbytes = bcpcol->bcp_column_data->datalen > bcpcol->column_size ? bcpcol->column_size : bcpcol->bcp_column_data->datalen; memcpy(&rowbuffer[row_pos], bcpcol->bcp_column_data->data, cpbytes); tds5_swap_data(bcpcol, &rowbuffer[row_pos]); } } row_pos += cpbytes; offsets[++ncols] = row_pos; tdsdump_dump_buf(TDS_DBG_NETWORK, "BCP row buffer so far", rowbuffer, row_pos); } tdsdump_log(TDS_DBG_FUNC, "%4d %8d %8d\n", i, ncols, row_pos); /* * The rowbuffer ends with an offset table and, optionally, an adjustment table. * The offset table has 1-byte elements that describe the locations of the start of each column in * the rowbuffer. If the largest offset is greater than 255, another table -- the adjustment table -- * is inserted just before the offset table. It holds the high bytes. * * Both tables are laid out in reverse: * #elements, offset N+1, offset N, offset N-1, ... offset 0 * E.g. for 2 columns you have 4 data points: * 1. How many elements (4) * 2. Start of column 3 (non-existent, "one off the end") * 3. Start of column 2 * 4. Start of column 1 * The length of each column is computed by subtracting its start from the its successor's start. * * The algorithm below computes both tables. If the adjustment table isn't needed, the * effect is to overwrite it with the offset table. */ while (ncols && offsets[ncols] == offsets[ncols-1]) ncols--; /* trailing NULL columns are not sent and are not included in the offset table */ if (ncols) { TDS_UCHAR *poff = rowbuffer + row_pos; unsigned int pfx_top = offsets[ncols] / 256; tdsdump_log(TDS_DBG_FUNC, "ncols=%u poff=%p [%u]\n", ncols, poff, offsets[ncols]); *poff++ = ncols + 1; /* this is some kind of run-length-prefix encoding */ while (pfx_top) { unsigned int n_pfx = 1; for (i = 0; i <= ncols ; ++i) if ((offsets[i] / 256) < pfx_top) ++n_pfx; *poff++ = n_pfx; --pfx_top; } tdsdump_log(TDS_DBG_FUNC, "poff=%p\n", poff); for (i=0; i <= ncols; i++) *poff++ = offsets[ncols-i] & 0xFF; row_pos = (unsigned int)(poff - rowbuffer); } tdsdump_log(TDS_DBG_FUNC, "%4d %8d %8d\n", i, ncols, row_pos); tdsdump_dump_buf(TDS_DBG_NETWORK, "BCP row buffer", rowbuffer, row_pos); *pncols = ncols; return ncols == 0? start : row_pos; } /** * Send BCP metadata to server. * Only for TDS 7.0+. * \tds * \param bcpinfo BCP information * \return TDS_SUCCESS or TDS_FAIL. */ static TDSRET tds7_bcp_send_colmetadata(TDSSOCKET *tds, TDSBCPINFO *bcpinfo) { TDSCOLUMN *bcpcol; int i, num_cols; tdsdump_log(TDS_DBG_FUNC, "tds7_bcp_send_colmetadata(%p, %p)\n", tds, bcpinfo); assert(tds && bcpinfo); if (tds->out_flag != TDS_BULK || tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; /* * Deep joy! For TDS 7 we have to send a colmetadata message followed by row data */ tds_put_byte(tds, TDS7_RESULT_TOKEN); /* 0x81 */ num_cols = 0; for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { bcpcol = bcpinfo->bindinfo->columns[i]; if ((!bcpinfo->identity_insert_on && bcpcol->column_identity) || bcpcol->column_timestamp || bcpcol->column_computed) { continue; } num_cols++; } tds_put_smallint(tds, num_cols); for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { size_t converted_len; const char *converted_name; bcpcol = bcpinfo->bindinfo->columns[i]; /* * dont send the (meta)data for timestamp columns, or * identity columns (unless indentity_insert is enabled */ if ((!bcpinfo->identity_insert_on && bcpcol->column_identity) || bcpcol->column_timestamp || bcpcol->column_computed) { continue; } if (IS_TDS72_PLUS(tds->conn)) tds_put_int(tds, bcpcol->column_usertype); else tds_put_smallint(tds, bcpcol->column_usertype); tds_put_smallint(tds, bcpcol->column_flags); tds_put_byte(tds, bcpcol->on_server.column_type); assert(bcpcol->funcs); bcpcol->funcs->put_info(tds, bcpcol); /* TODO put this in put_info. It seems that parameter format is * different from BCP format */ if (is_blob_type(bcpcol->on_server.column_type)) { converted_name = tds_convert_string(tds, tds->conn->char_convs[client2ucs2], tds_dstr_cstr(&bcpinfo->tablename), (int) tds_dstr_len(&bcpinfo->tablename), &converted_len); if (!converted_name) { tds_connection_close(tds->conn); return TDS_FAIL; } /* UTF-16 length is always size / 2 even for 4 byte letters (yes, 1 letter of length 2) */ TDS_PUT_SMALLINT(tds, converted_len / 2); tds_put_n(tds, converted_name, converted_len); tds_convert_string_free(tds_dstr_cstr(&bcpinfo->tablename), converted_name); } converted_name = tds_convert_string(tds, tds->conn->char_convs[client2ucs2], tds_dstr_cstr(&bcpcol->column_name), (int) tds_dstr_len(&bcpcol->column_name), &converted_len); if (!converted_name) { tds_connection_close(tds->conn); return TDS_FAIL; } /* UTF-16 length is always size / 2 even for 4 byte letters (yes, 1 letter of length 2) */ TDS_PUT_BYTE(tds, converted_len / 2); tds_put_n(tds, converted_name, converted_len); tds_convert_string_free(tds_dstr_cstr(&bcpcol->column_name), converted_name); } tds_set_state(tds, TDS_SENDING); return TDS_SUCCESS; } /** * Tell we finished sending BCP data to server * \tds * \param[out] rows_copied number of rows copied to server */ TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied) { TDSRET rc; tdsdump_log(TDS_DBG_FUNC, "tds_bcp_done(%p, %p)\n", tds, rows_copied); if (tds->out_flag != TDS_BULK || tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_flush_packet(tds); tds_set_state(tds, TDS_PENDING); rc = tds_process_simple_query(tds); if (TDS_FAILED(rc)) return rc; if (rows_copied) *rows_copied = tds->rows_affected; return TDS_SUCCESS; } /** * Start sending BCP data to server. * Initialize stream to accept data. * \tds * \param bcpinfo BCP information already prepared */ TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo) { TDSRET rc; tdsdump_log(TDS_DBG_FUNC, "tds_bcp_start(%p, %p)\n", tds, bcpinfo); if (!IS_TDS50_PLUS(tds->conn)) return TDS_FAIL; rc = tds_submit_query(tds, bcpinfo->insert_stmt); if (TDS_FAILED(rc)) return rc; /* set we want to switch to bulk state */ tds->bulk_query = true; /* * In TDS 5 we get the column information as a result set from the "insert bulk" command. * We're going to ignore it. */ rc = tds_process_simple_query(tds); if (TDS_FAILED(rc)) return rc; tds->out_flag = TDS_BULK; if (tds_set_state(tds, TDS_SENDING) != TDS_SENDING) return TDS_FAIL; if (IS_TDS7_PLUS(tds->conn)) tds7_bcp_send_colmetadata(tds, bcpinfo); return TDS_SUCCESS; } /** * Free row data allocated in the result set. */ static void tds_bcp_row_free(TDSRESULTINFO* result, unsigned char *row) { result->row_size = 0; TDS_ZERO_FREE(result->current_row); } /** * Start bulk copy to server * \tds * \param bcpinfo BCP information already prepared */ TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo) { TDSCOLUMN *bcpcol; int i; int fixed_col_len_tot = 0; int variable_col_len_tot = 0; int column_bcp_data_size = 0; int bcp_record_size = 0; TDSRET rc; TDS_INT var_cols; tdsdump_log(TDS_DBG_FUNC, "tds_bcp_start_copy_in(%p, %p)\n", tds, bcpinfo); rc = tds_bcp_start_insert_stmt(tds, bcpinfo); if (TDS_FAILED(rc)) return rc; rc = tds_bcp_start(tds, bcpinfo); if (TDS_FAILED(rc)) { /* TODO, in CTLib was _ctclient_msg(blkdesc->con, "blk_rowxfer", 2, 5, 1, 140, ""); */ return rc; } /* * Work out the number of "variable" columns. These are either nullable or of * varying length type e.g. varchar. */ var_cols = 0; if (IS_TDS50(tds->conn)) { for (i = 0; i < bcpinfo->bindinfo->num_cols; i++) { bcpcol = bcpinfo->bindinfo->columns[i]; /* * work out storage required for this datatype * blobs always require 16, numerics vary, the * rest can be taken from the server */ if (is_blob_type(bcpcol->on_server.column_type)) column_bcp_data_size = 16; else if (is_numeric_type(bcpcol->on_server.column_type)) column_bcp_data_size = tds_numeric_bytes_per_prec[bcpcol->column_prec]; else column_bcp_data_size = bcpcol->column_size; /* * now add that size into either fixed or variable * column totals... */ if (is_nullable_type(bcpcol->on_server.column_type) || bcpcol->column_nullable) { var_cols++; variable_col_len_tot += column_bcp_data_size; } else { fixed_col_len_tot += column_bcp_data_size; } } /* this formula taken from sybase manual... */ bcp_record_size = 4 + fixed_col_len_tot + variable_col_len_tot + ( (int)(variable_col_len_tot / 256 ) + 1 ) + (var_cols + 1) + 2; tdsdump_log(TDS_DBG_FUNC, "current_record_size = %d\n", bcpinfo->bindinfo->row_size); tdsdump_log(TDS_DBG_FUNC, "bcp_record_size = %d\n", bcp_record_size); if (bcp_record_size > bcpinfo->bindinfo->row_size) { if (!TDS_RESIZE(bcpinfo->bindinfo->current_row, bcp_record_size)) { tdsdump_log(TDS_DBG_FUNC, "could not realloc current_row\n"); return TDS_FAIL; } bcpinfo->bindinfo->row_free = tds_bcp_row_free; bcpinfo->bindinfo->row_size = bcp_record_size; } } return TDS_SUCCESS; } /** input stream to read a file */ typedef struct tds_file_stream { /** common fields, must be the first field */ TDSINSTREAM stream; /** file to read from */ FILE *f; /** terminator */ const char *terminator; /** terminator length in bytes */ size_t term_len; /** buffer for store bytes readed that could be the terminator */ char *left; size_t left_pos; } TDSFILESTREAM; /** \cond HIDDEN_SYMBOLS */ #if defined(_WIN32) && defined(HAVE__LOCK_FILE) && defined(HAVE__UNLOCK_FILE) #define TDS_HAVE_STDIO_LOCKED 1 #define flockfile(s) _lock_file(s) #define funlockfile(s) _unlock_file(s) #define getc_unlocked(s) _getc_nolock(s) #define feof_unlocked(s) _feof_nolock(s) #endif #ifndef TDS_HAVE_STDIO_LOCKED #undef getc_unlocked #undef feof_unlocked #undef flockfile #undef funlockfile #define getc_unlocked(s) getc(s) #define feof_unlocked(s) feof(s) #define flockfile(s) do { } while(0) #define funlockfile(s) do { } while(0) #endif /** \endcond */ /** * Reads a chunk of data from file stream checking for terminator * \param stream file stream * \param ptr buffer where to read data * \param len length of buffer */ static int tds_file_stream_read(TDSINSTREAM *stream, void *ptr, size_t len) { TDSFILESTREAM *s = (TDSFILESTREAM *) stream; int c; char *p = (char *) ptr; while (len) { if (memcmp(s->left, s->terminator - s->left_pos, s->term_len) == 0) return p - (char *) ptr; c = getc_unlocked(s->f); if (c == EOF) return -1; *p++ = s->left[s->left_pos]; --len; s->left[s->left_pos++] = c; s->left_pos %= s->term_len; } return p - (char *) ptr; } /** * Read a data file, passing the data through iconv(). * \retval TDS_SUCCESS success * \retval TDS_FAIL error reading the column * \retval TDS_NO_MORE_RESULTS end of file detected */ TDSRET tds_bcp_fread(TDSSOCKET * tds, TDSICONV * char_conv, FILE * stream, const char *terminator, size_t term_len, char **outbuf, size_t * outbytes) { TDSRET res; TDSFILESTREAM r; TDSDYNAMICSTREAM w; size_t readed; /* prepare streams */ r.stream.read = tds_file_stream_read; r.f = stream; r.term_len = term_len; r.left = tds_new0(char, term_len*3); r.left_pos = 0; if (!r.left) return TDS_FAIL; /* copy terminator twice, let terminator points to second copy */ memcpy(r.left + term_len, terminator, term_len); memcpy(r.left + term_len*2u, terminator, term_len); r.terminator = r.left + term_len*2u; /* read initial buffer to test with terminator */ readed = fread(r.left, 1, term_len, stream); if (readed != term_len) { free(r.left); if (readed == 0 && feof(stream)) return TDS_NO_MORE_RESULTS; return TDS_FAIL; } res = tds_dynamic_stream_init(&w, (void**) outbuf, 0); if (TDS_FAILED(res)) { free(r.left); return res; } /* convert/copy from input stream to output one */ flockfile(stream); if (char_conv == NULL) res = tds_copy_stream(&r.stream, &w.stream); else res = tds_convert_stream(tds, char_conv, to_server, &r.stream, &w.stream); funlockfile(stream); free(r.left); if (TDS_FAILED(res)) return res; *outbytes = w.size; /* terminate buffer */ if (!w.stream.buf_len) return TDS_FAIL; ((char *) w.stream.buffer)[0] = 0; w.stream.write(&w.stream, 1); return res; } /** * Start writing writetext request. * This request start a bulk session. * \tds * \param objname table name * \param textptr TEXTPTR (see sql documentation) * \param timestamp data timestamp * \param with_log is log is enabled during insert * \param size bytes to be inserted */ TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size) { TDSRET rc; /* TODO mssql does not like timestamp */ rc = tds_submit_queryf(tds, "writetext bulk %s 0x%s timestamp = 0x%s%s", objname, textptr, timestamp, with_log ? " with log" : ""); if (TDS_FAILED(rc)) return rc; /* set we want to switch to bulk state */ tds->bulk_query = true; /* read the end token */ rc = tds_process_simple_query(tds); if (TDS_FAILED(rc)) return rc; tds->out_flag = TDS_BULK; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_put_int(tds, size); tds_set_state(tds, TDS_SENDING); return TDS_SUCCESS; } /** * Send some data in the writetext request started by tds_writetext_start. * You should write in total (with multiple calls to this function) all * bytes declared calling tds_writetext_start. * \tds * \param text data to write * \param size data size in bytes */ TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size) { if (tds->out_flag != TDS_BULK || tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; /* TODO check size left */ tds_put_n(tds, text, size); tds_set_state(tds, TDS_SENDING); return TDS_SUCCESS; } /** * Finish sending writetext data. * \tds */ TDSRET tds_writetext_end(TDSSOCKET *tds) { if (tds->out_flag != TDS_BULK || tds_set_state(tds, TDS_WRITING) != TDS_WRITING) return TDS_FAIL; tds_flush_packet(tds); tds_set_state(tds, TDS_PENDING); return TDS_SUCCESS; } freetds-1.3.6/src/tds/packet.c000644 025423 025423 00000065473 14056414271 017622 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_POLL_H #include #endif /* HAVE_POLL_H */ #include #include #include #include #include #include #undef MAX #define MAX(a,b) (((a) > (b)) ? (a) : (b)) /** * \addtogroup network * @{ */ #if ENABLE_ODBC_MARS static TDSRET tds_update_recv_wnd(TDSSOCKET *tds, TDS_UINT new_recv_wnd); static int tds_packet_write(TDSCONNECTION *conn); #endif /* get packet from the cache */ static TDSPACKET * tds_get_packet(TDSCONNECTION *conn, unsigned len) { TDSPACKET *packet, *to_free = NULL; tds_mutex_lock(&conn->list_mtx); while ((packet = conn->packet_cache) != NULL) { --conn->num_cached_packets; conn->packet_cache = packet->next; /* return it */ if (packet->capacity >= len) { TDS_MARK_UNDEFINED(packet->buf, packet->capacity); packet->next = NULL; tds_packet_zero_data_start(packet); packet->data_len = 0; packet->sid = 0; break; } /* discard packet if too small */ packet->next = to_free; to_free = packet; } tds_mutex_unlock(&conn->list_mtx); if (to_free) tds_free_packets(to_free); if (!packet) packet = tds_alloc_packet(NULL, len); return packet; } /* append packets in cached list. must have the lock! */ static void tds_packet_cache_add(TDSCONNECTION *conn, TDSPACKET *packet) { TDSPACKET *last; unsigned count = 1; assert(conn && packet); tds_mutex_check_owned(&conn->list_mtx); if (conn->num_cached_packets >= 8) { tds_free_packets(packet); return; } for (last = packet; last->next; last = last->next) ++count; last->next = conn->packet_cache; conn->packet_cache = packet; conn->num_cached_packets += count; #if ENABLE_EXTRA_CHECKS count = 0; for (packet = conn->packet_cache; packet; packet = packet->next) ++count; assert(count == conn->num_cached_packets); #endif } #if ENABLE_ODBC_MARS /* read partial packet */ static bool tds_packet_read(TDSCONNECTION *conn, TDSSOCKET *tds) { TDSPACKET *packet = conn->recv_packet; int len; /* allocate some space to read data */ if (!packet) { conn->recv_packet = packet = tds_get_packet(conn, MAX(conn->env.block_size + sizeof(TDS72_SMP_HEADER), 512)); if (!packet) goto Memory_Error; TDS_MARK_UNDEFINED(packet->buf, packet->capacity); conn->recv_pos = 0; packet->data_len = 8; } assert(packet->data_start == 0); assert(conn->recv_pos < packet->data_len && packet->data_len <= packet->capacity); len = tds_connection_read(tds, packet->buf + conn->recv_pos, packet->data_len - conn->recv_pos); if (len < 0) goto Severe_Error; conn->recv_pos += len; assert(conn->recv_pos <= packet->data_len && packet->data_len <= packet->capacity); /* handle SMP */ if (conn->recv_pos > 0 && packet->buf[0] == TDS72_SMP) { TDS72_SMP_HEADER mars_header; uint16_t sid; TDSSOCKET *tds; TDS_UINT size; /* make sure we read the header */ if (conn->recv_pos < sizeof(mars_header)) { packet->data_len = sizeof(mars_header); return false; } memcpy(&mars_header, packet->buf, sizeof(mars_header)); tdsdump_dump_buf(TDS_DBG_HEADER, "Received MARS header", &mars_header, sizeof(mars_header)); sid = TDS_GET_A2LE(&mars_header.sid); /* FIXME this is done even by caller !! */ tds = NULL; tds_mutex_lock(&conn->list_mtx); if (sid < conn->num_sessions) { tds = conn->sessions[sid]; packet->sid = sid; } tds_mutex_unlock(&conn->list_mtx); if (tds == BUSY_SOCKET) { if (mars_header.type != TDS_SMP_FIN) { tdsdump_log(TDS_DBG_ERROR, "Received MARS with no session (%u)\n", sid); goto Severe_Error; } /* check if was just a "zombie" socket */ tds_mutex_lock(&conn->list_mtx); conn->sessions[sid] = NULL; tds_mutex_unlock(&conn->list_mtx); /* reset packet to initial state to reuse it */ packet->data_len = 8; conn->recv_pos = 0; return false; } if (!tds) { /* server sent a unknown packet, close connection */ goto Severe_Error; } tds->send_wnd = TDS_GET_A4LE(&mars_header.wnd); size = TDS_GET_A4LE(&mars_header.size); if (mars_header.type == TDS_SMP_ACK) { if (size != sizeof(mars_header)) goto Severe_Error; } else if (mars_header.type == TDS_SMP_DATA) { if (size < 0x18 || size > 0xffffu + sizeof(mars_header)) goto Severe_Error; /* avoid recursive SMP */ if (conn->recv_pos > 16 && packet->buf[16] == TDS72_SMP) goto Severe_Error; /* TODO is possible to put 2 TDS packet inside a single DATA ?? */ if (conn->recv_pos >= 20 && TDS_GET_A2BE(&packet->buf[18]) != size - 16) goto Severe_Error; tds->recv_seq = TDS_GET_A4LE(&mars_header.seq); /* * do not sent ACK here because this would lead to memory waste * if session is not able to handle all that packets */ } else if (mars_header.type == TDS_SMP_FIN) { if (size != sizeof(mars_header)) goto Severe_Error; /* this socket shold now not start another session */ // tds_set_state(tds, TDS_DEAD); } else goto Severe_Error; if (mars_header.type != TDS_SMP_DATA) return conn->recv_pos >= size; if (packet->data_len < size) { packet = tds_realloc_packet(packet, size); if (!packet) goto Memory_Error; conn->recv_packet = packet; } packet->data_len = size; if (conn->recv_pos >= size) { packet->data_start = sizeof(TDS72_SMP_HEADER); packet->data_len -= sizeof(TDS72_SMP_HEADER); return true; } return false; } assert(conn->recv_pos <= packet->data_len && packet->data_len <= packet->capacity); /* normal packet */ if (conn->recv_pos >= 8) { len = TDS_GET_A2BE(&packet->buf[2]); if (len < 8) goto Severe_Error; if (packet->data_len < len) { packet = tds_realloc_packet(packet, len); if (!packet) goto Memory_Error; conn->recv_packet = packet; } packet->data_len = len; return conn->recv_pos >= len; } return false; Memory_Error: Severe_Error: tds_connection_close(conn); tds_free_packets(packet); conn->recv_packet = NULL; return false; } static TDSPACKET* tds_build_packet(TDSSOCKET *tds, unsigned char *buf, unsigned len) { unsigned start; TDS72_SMP_HEADER mars[1], *p; TDSPACKET *packet; p = mars; if (buf[0] != TDS72_SMP && tds->conn->mars) { p->signature = TDS72_SMP; p->type = TDS_SMP_DATA; TDS_PUT_A2LE(&p->sid, tds->sid); TDS_PUT_A4LE(&p->size, len+16); ++tds->send_seq; TDS_PUT_A4LE(&p->seq, tds->send_seq); /* this is the acknowledge we give to server to stop sending !!! */ tds->recv_wnd = tds->recv_seq + 4; TDS_PUT_A4LE(&p->wnd, tds->recv_wnd); p++; } start = (char*) p - (char *) mars; packet = tds_get_packet(tds->conn, len + start); if (TDS_LIKELY(packet)) { packet->sid = tds->sid; memcpy(packet->buf, mars, start); memcpy(packet->buf + start, buf, len); packet->data_len = len + start; } return packet; } static void tds_append_packet(TDSPACKET **p_packet, TDSPACKET *packet) { while (*p_packet) p_packet = &((*p_packet)->next); *p_packet = packet; } int tds_append_cancel(TDSSOCKET *tds) { unsigned char buf[8]; TDSPACKET *packet; buf[0] = TDS_CANCEL; buf[1] = 1; TDS_PUT_A2BE(buf+2, 8); TDS_PUT_A4(buf+4, 0); if (IS_TDS7_PLUS(tds->conn) && !tds->login) buf[6] = 0x01; packet = tds_build_packet(tds, buf, 8); if (!packet) return TDS_FAIL; tds_mutex_lock(&tds->conn->list_mtx); tds_append_packet(&tds->conn->send_packets, packet); tds_mutex_unlock(&tds->conn->list_mtx); return TDS_SUCCESS; } static void tds_connection_network(TDSCONNECTION *conn, TDSSOCKET *tds, int send) { assert(!conn->in_net_tds); conn->in_net_tds = tds; tds_mutex_unlock(&conn->list_mtx); for (;;) { /* wait packets or update */ int rc = tds_select(tds, conn->send_packets ? TDSSELREAD|TDSSELWRITE : TDSSELREAD, tds->query_timeout); if (rc < 0) { /* FIXME better error report */ tds_connection_close(conn); break; } /* change notify */ /* TODO async */ if (!rc) { /* timeout */ tdsdump_log(TDS_DBG_INFO1, "timeout\n"); switch (rc = tdserror(tds_get_ctx(tds), tds, TDSETIME, sock_errno)) { case TDS_INT_CONTINUE: continue; default: case TDS_INT_CANCEL: tds_close_socket(tds); } break; } /* * we must write first to catch write errors as * write errors, not as read */ /* something to send */ if (conn->send_packets && (rc & POLLOUT) != 0) { TDSSOCKET *s; int sid = tds_packet_write(conn); if (sid < 0) continue; if (sid == tds->sid) break; /* return to caller */ tds_mutex_lock(&conn->list_mtx); if (sid < conn->num_sessions) { s = conn->sessions[sid]; if (TDSSOCKET_VALID(s)) tds_cond_signal(&s->packet_cond); } tds_mutex_unlock(&conn->list_mtx); /* avoid using a possible closed connection */ continue; } /* received */ if (rc & POLLIN) { TDSPACKET *packet; TDSSOCKET *s; /* try to read a packet */ if (!tds_packet_read(conn, tds)) continue; /* packet not complete */ packet = conn->recv_packet; conn->recv_packet = NULL; conn->recv_pos = 0; tdsdump_dump_buf(TDS_DBG_NETWORK, "Received packet", packet->buf, packet->data_start + packet->data_len); tds_mutex_lock(&conn->list_mtx); if (packet->sid < conn->num_sessions) { s = conn->sessions[packet->sid]; if (TDSSOCKET_VALID(s)) { /* append to correct session */ if (packet->buf[0] == TDS72_SMP && packet->buf[1] != TDS_SMP_DATA) tds_packet_cache_add(conn, packet); else tds_append_packet(&conn->packets, packet); packet = NULL; /* notify */ tds_cond_signal(&s->packet_cond); } } tds_mutex_unlock(&conn->list_mtx); tds_free_packets(packet); /* if we are receiving return the packet */ if (!send) break; } } tds_mutex_lock(&conn->list_mtx); conn->in_net_tds = NULL; } static TDSRET tds_connection_put_packet(TDSSOCKET *tds, TDSPACKET *packet) { TDSCONNECTION *conn = tds->conn; CHECK_TDS_EXTRA(tds); packet->sid = tds->sid; tds_mutex_lock(&conn->list_mtx); tds->sending_packet = packet; while (tds->sending_packet) { int wait_res; if (IS_TDSDEAD(tds)) { tdsdump_log(TDS_DBG_NETWORK, "Write attempt when state is TDS_DEAD"); break; } /* limit packet sending looking at sequence/window */ if (packet && (int32_t) (tds->send_seq - tds->send_wnd) < 0) { /* prepare MARS header if needed */ if (tds->conn->mars) { TDS72_SMP_HEADER *hdr; /* fill SMP data */ hdr = (TDS72_SMP_HEADER *) packet->buf; hdr->signature = TDS72_SMP; hdr->type = TDS_SMP_DATA; TDS_PUT_A2LE(&hdr->sid, packet->sid); TDS_PUT_A4LE(&hdr->size, packet->data_start + packet->data_len); ++tds->send_seq; TDS_PUT_A4LE(&hdr->seq, tds->send_seq); /* this is the acknowledge we give to server to stop sending */ tds->recv_wnd = tds->recv_seq + 4; TDS_PUT_A4LE(&hdr->wnd, tds->recv_wnd); } /* append packet */ tds_append_packet(&conn->send_packets, packet); packet = NULL; } /* network ok ? process network */ if (!conn->in_net_tds) { tds_connection_network(conn, tds, packet ? 0 : 1); if (tds->sending_packet) continue; /* here we are sure we sent the packet */ break; } /* signal thread processing network to handle our packet */ /* TODO check result */ tds_wakeup_send(&conn->wakeup, 0); /* wait local condition */ wait_res = tds_cond_timedwait(&tds->packet_cond, &conn->list_mtx, tds->query_timeout); if (wait_res != ETIMEDOUT) continue; tds_mutex_unlock(&conn->list_mtx); if (tdserror(tds_get_ctx(tds), tds, TDSETIME, ETIMEDOUT) != TDS_INT_CONTINUE) { tds->sending_packet = NULL; tds_close_socket(tds); tds_free_packets(packet); return TDS_FAIL; } tds_mutex_lock(&conn->list_mtx); } tds->sending_packet = NULL; tds_mutex_unlock(&conn->list_mtx); if (TDS_UNLIKELY(packet)) { tds_free_packets(packet); return TDS_FAIL; } if (IS_TDSDEAD(tds)) return TDS_FAIL; return TDS_SUCCESS; } #endif /* ENABLE_ODBC_MARS */ /** * Read in one 'packet' from the server. This is a wrapped outer packet of * the protocol (they bundle result packets into chunks and wrap them at * what appears to be 512 bytes regardless of how that breaks internal packet * up. (tetherow\@nol.org) * @return bytes read or -1 on failure */ int tds_read_packet(TDSSOCKET * tds) { #if ENABLE_ODBC_MARS TDSCONNECTION *conn = tds->conn; tds_mutex_lock(&conn->list_mtx); for (;;) { int wait_res; TDSPACKET **p_packet; if (IS_TDSDEAD(tds)) { tdsdump_log(TDS_DBG_NETWORK, "Read attempt when state is TDS_DEAD\n"); break; } /* if there is a packet for me return it */ for (p_packet = &conn->packets; *p_packet; p_packet = &(*p_packet)->next) if ((*p_packet)->sid == tds->sid) break; if (*p_packet) { /* remove our packet from list */ TDSPACKET *packet = *p_packet; *p_packet = packet->next; tds_packet_cache_add(conn, tds->recv_packet); tds_mutex_unlock(&conn->list_mtx); packet->next = NULL; tds->recv_packet = packet; tds->in_buf = packet->buf + packet->data_start; tds->in_len = packet->data_len; tds->in_pos = 8; tds->in_flag = tds->in_buf[0]; /* send acknowledge if needed */ if ((int32_t) (tds->recv_seq + 2 - tds->recv_wnd) >= 0) tds_update_recv_wnd(tds, tds->recv_seq + 4); return tds->in_len; } /* network ok ? process network */ if (!conn->in_net_tds) { tds_connection_network(conn, tds, 0); continue; } /* wait local condition */ wait_res = tds_cond_timedwait(&tds->packet_cond, &conn->list_mtx, tds->query_timeout); if (wait_res != ETIMEDOUT) continue; tds_mutex_unlock(&conn->list_mtx); if (tdserror(tds_get_ctx(tds), tds, TDSETIME, ETIMEDOUT) != TDS_INT_CONTINUE) { tds_close_socket(tds); return -1; } tds_mutex_lock(&conn->list_mtx); } tds_mutex_unlock(&conn->list_mtx); return -1; #else /* !ENABLE_ODBC_MARS */ unsigned char *pkt = tds->in_buf, *p, *end; if (IS_TDSDEAD(tds)) { tdsdump_log(TDS_DBG_NETWORK, "Read attempt when state is TDS_DEAD"); return -1; } tds->in_len = 0; tds->in_pos = 0; for (p = pkt, end = p+8; p < end;) { int len = tds_connection_read(tds, p, end - p); if (len <= 0) { tds_close_socket(tds); return -1; } p += len; if (p - pkt >= 4) { unsigned pktlen = TDS_GET_A2BE(pkt+2); /* packet must at least contains header */ if (TDS_UNLIKELY(pktlen < 8)) { tds_close_socket(tds); return -1; } if (TDS_UNLIKELY(pktlen > tds->recv_packet->capacity)) { TDSPACKET *packet = tds_realloc_packet(tds->recv_packet, pktlen); if (TDS_UNLIKELY(!packet)) { tds_close_socket(tds); return -1; } tds->recv_packet = packet; pkt = packet->buf; p = pkt + (p-tds->in_buf); tds->in_buf = pkt; } end = pkt + pktlen; } } /* set the received packet type flag */ tds->in_flag = pkt[0]; /* Set the length and pos (not sure what pos is used for now */ tds->in_len = p - pkt; tds->in_pos = 8; tdsdump_dump_buf(TDS_DBG_NETWORK, "Received packet", tds->in_buf, tds->in_len); return tds->in_len; #endif /* !ENABLE_ODBC_MARS */ } #if ENABLE_ODBC_MARS static TDSRET tds_update_recv_wnd(TDSSOCKET *tds, TDS_UINT new_recv_wnd) { TDS72_SMP_HEADER *mars; TDSPACKET *packet; if (!tds->conn->mars) return TDS_SUCCESS; packet = tds_get_packet(tds->conn, sizeof(*mars)); if (!packet) return TDS_FAIL; /* TODO check result */ packet->data_len = sizeof(*mars); packet->sid = tds->sid; mars = (TDS72_SMP_HEADER *) packet->buf; mars->signature = TDS72_SMP; mars->type = TDS_SMP_ACK; TDS_PUT_A2LE(&mars->sid, tds->sid); mars->size = TDS_HOST4LE(16); TDS_PUT_A4LE(&mars->seq, tds->send_seq); tds->recv_wnd = new_recv_wnd; TDS_PUT_A4LE(&mars->wnd, tds->recv_wnd); tds_mutex_lock(&tds->conn->list_mtx); tds_append_packet(&tds->conn->send_packets, packet); tds_mutex_unlock(&tds->conn->list_mtx); return TDS_SUCCESS; } static TDSRET tds_append_fin_syn(TDSSOCKET *tds, uint8_t type) { TDS72_SMP_HEADER mars; TDSPACKET *packet; if (!tds->conn->mars) return TDS_SUCCESS; mars.signature = TDS72_SMP; mars.type = type; TDS_PUT_A2LE(&mars.sid, tds->sid); mars.size = TDS_HOST4LE(16); TDS_PUT_A4LE(&mars.seq, tds->send_seq); tds->recv_wnd = tds->recv_seq + 4; TDS_PUT_A4LE(&mars.wnd, tds->recv_wnd); /* do not use tds_get_packet as it require no lock ! */ packet = tds_alloc_packet(&mars, sizeof(mars)); if (!packet) return TDS_FAIL; /* TODO check result */ packet->sid = tds->sid; /* we already hold lock so do not lock */ tds_append_packet(&tds->conn->send_packets, packet); if (type == TDS_SMP_FIN) { /* now is no more an active session */ tds->conn->sessions[tds->sid] = BUSY_SOCKET; tds_set_state(tds, TDS_DEAD); } return TDS_SUCCESS; } /** * Append a SMP FIN packet. * tds->conn->list_mtx must be locked. */ TDSRET tds_append_fin(TDSSOCKET *tds) { return tds_append_fin_syn(tds, TDS_SMP_FIN); } /** * Append a SMP SYN packet. * tds->conn->list_mtx must be unlocked. */ TDSRET tds_append_syn(TDSSOCKET *tds) { TDSRET ret; tds_mutex_lock(&tds->conn->list_mtx); ret = tds_append_fin_syn(tds, TDS_SMP_SYN); tds_mutex_unlock(&tds->conn->list_mtx); return ret; } #endif /* ENABLE_ODBC_MARS */ TDS_COMPILE_CHECK(additional, TDS_ADDITIONAL_SPACE != 0); TDSRET tds_write_packet(TDSSOCKET * tds, unsigned char final) { TDSRET res; unsigned int left = 0; TDSPACKET *pkt = tds->send_packet, *pkt_next = NULL; CHECK_TDS_EXTRA(tds); #if !ENABLE_ODBC_MARS if (tds->frozen) #endif { pkt->next = pkt_next = tds_get_packet(tds->conn, pkt->capacity); if (!pkt_next) return TDS_FAIL; #if ENABLE_ODBC_MARS if (tds->conn->mars) pkt_next->data_start = sizeof(TDS72_SMP_HEADER); #endif } if (tds->out_pos > tds->out_buf_max) { left = tds->out_pos - tds->out_buf_max; if (pkt_next) memcpy(pkt_next->buf + tds_packet_get_data_start(pkt_next) + 8, tds->out_buf + tds->out_buf_max, left); tds->out_pos = tds->out_buf_max; } /* we must assure server can accept our packet looking at * send_wnd and waiting for proper send_wnd if send_seq > send_wnd */ tds->out_buf[0] = tds->out_flag; tds->out_buf[1] = final; TDS_PUT_A2BE(tds->out_buf+2, tds->out_pos); TDS_PUT_A2BE(tds->out_buf+4, tds->conn->client_spid); TDS_PUT_A2(tds->out_buf+6, 0); if (IS_TDS7_PLUS(tds->conn) && !tds->login) tds->out_buf[6] = 0x01; if (tds->frozen) { pkt->data_len = tds->out_pos; tds_set_current_send_packet(tds, pkt_next); tds->out_pos = left + 8; CHECK_TDS_EXTRA(tds); return TDS_SUCCESS; } #if ENABLE_ODBC_MARS pkt->data_len = tds->out_pos; pkt->next = NULL; tds_set_current_send_packet(tds, pkt_next); res = tds_connection_put_packet(tds, pkt); #else /* !ENABLE_ODBC_MARS */ tdsdump_dump_buf(TDS_DBG_NETWORK, "Sending packet", tds->out_buf, tds->out_pos); /* GW added in check for write() returning <0 and SIGPIPE checking */ res = tds_connection_write(tds, tds->out_buf, tds->out_pos, final) <= 0 ? TDS_FAIL : TDS_SUCCESS; memcpy(tds->out_buf + 8, tds->out_buf + tds->out_buf_max, left); #endif /* !ENABLE_ODBC_MARS */ tds->out_pos = left + 8; if (TDS_UNLIKELY(tds->conn->encrypt_single_packet)) { tds->conn->encrypt_single_packet = 0; tds_ssl_deinit(tds->conn); } return res; } #if !ENABLE_ODBC_MARS int tds_put_cancel(TDSSOCKET * tds) { unsigned char out_buf[8]; int sent; out_buf[0] = TDS_CANCEL; /* out_flag */ out_buf[1] = 1; /* final */ out_buf[2] = 0; out_buf[3] = 8; TDS_PUT_A4(out_buf+4, 0); if (IS_TDS7_PLUS(tds->conn) && !tds->login) out_buf[6] = 0x01; tdsdump_dump_buf(TDS_DBG_NETWORK, "Sending packet", out_buf, 8); sent = tds_connection_write(tds, out_buf, 8, 1); if (sent > 0) tds->in_cancel = 2; /* GW added in check for write() returning <0 and SIGPIPE checking */ return sent <= 0 ? TDS_FAIL : TDS_SUCCESS; } #endif /* !ENABLE_ODBC_MARS */ #if ENABLE_ODBC_MARS static int tds_packet_write(TDSCONNECTION *conn) { int sent; int final; TDSPACKET *packet = conn->send_packets; assert(packet); if (conn->send_pos == 0) tdsdump_dump_buf(TDS_DBG_NETWORK, "Sending packet", packet->buf, packet->data_start + packet->data_len); /* take into account other session packets */ if (packet->next != NULL) final = 0; /* take into account other packets for this session */ else if (packet->buf[0] != TDS72_SMP) final = packet->buf[1] & 1; else final = 1; sent = tds_connection_write(conn->in_net_tds, packet->buf + conn->send_pos, packet->data_start + packet->data_len - conn->send_pos, final); if (TDS_UNLIKELY(sent < 0)) { /* TODO tdserror called ?? */ tds_connection_close(conn); return -1; } /* update sent data */ conn->send_pos += sent; /* remove packet if sent all data */ if (conn->send_pos >= packet->data_start + packet->data_len) { uint16_t sid = packet->sid; TDSSOCKET *tds; tds_mutex_lock(&conn->list_mtx); tds = conn->sessions[sid]; if (TDSSOCKET_VALID(tds) && tds->sending_packet == packet) tds->sending_packet = NULL; conn->send_packets = packet->next; packet->next = NULL; tds_packet_cache_add(conn, packet); tds_mutex_unlock(&conn->list_mtx); conn->send_pos = 0; return sid; } return -1; } #endif /* ENABLE_ODBC_MARS */ /** * Stop writing to server and cache every packet not sending them to server. * This is used to write data without worrying to compute length before. * If size_len is provided the number of bytes written between ::tds_freeze and * ::tds_freeze_close will be written as a number of size size_len. * This call should be followed by a ::tds_freeze_close, ::tds_freeze_close_len or * a ::tds_freeze_abort. Failing to match ::tds_freeze with a close would possibly * result in a disconnection from the server. * * @param[out] freeze structure to initialize * @param size_len length of the size to automatically write on close (0, 1, 2, or 4) */ void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len) { CHECK_TDS_EXTRA(tds); tds_extra_assert(size_len <= 4 && size_len != 3); if (tds->out_pos > tds->out_buf_max) tds_write_packet(tds, 0x0); if (!tds->frozen) tds->frozen_packets = tds->send_packet; ++tds->frozen; freeze->tds = tds; freeze->pkt = tds->send_packet; freeze->pkt_pos = tds->out_pos; freeze->size_len = size_len; if (size_len) tds_put_n(tds, NULL, size_len); CHECK_FREEZE_EXTRA(freeze); } /** * Compute how many bytes has been written from freeze * * @return bytes written since ::tds_freeze call */ size_t tds_freeze_written(TDSFREEZE *freeze) { TDSSOCKET *tds = freeze->tds; TDSPACKET *pkt = freeze->pkt; size_t size; CHECK_FREEZE_EXTRA(freeze); /* last packet needs special handling */ size = tds->out_pos; /* packets before last */ for (; pkt->next != NULL; pkt = pkt->next) size += pkt->data_len - 8; return size - freeze->pkt_pos; } /** * Discard all data written after the freeze * * After this call freeze should not be used. * * @param[in] freeze structure to work on */ TDSRET tds_freeze_abort(TDSFREEZE *freeze) { TDSSOCKET *tds = freeze->tds; TDSPACKET *pkt = freeze->pkt; CHECK_FREEZE_EXTRA(freeze); if (pkt->next) { tds_mutex_lock(&tds->conn->list_mtx); tds_packet_cache_add(tds->conn, pkt->next); tds_mutex_unlock(&tds->conn->list_mtx); pkt->next = NULL; tds_set_current_send_packet(tds, pkt); } tds->out_pos = freeze->pkt_pos; pkt->data_len = 8; --tds->frozen; if (!tds->frozen) tds->frozen_packets = NULL; freeze->tds = NULL; return TDS_SUCCESS; } /** * Stop keeping data for this specific freeze. * * If size_len was used for ::tds_freeze this function write the written bytes * at position when ::tds_freeze was called. * After this call freeze should not be used. * * @param[in] freeze structure to work on */ TDSRET tds_freeze_close(TDSFREEZE *freeze) { return tds_freeze_close_len(freeze, freeze->size_len ? tds_freeze_written(freeze) - freeze->size_len : 0); } static void tds_freeze_update_size(const TDSFREEZE *freeze, int32_t size) { TDSPACKET *pkt; unsigned pos = freeze->pkt_pos; unsigned size_len = freeze->size_len; pkt = freeze->pkt; do { if (pos >= pkt->data_len && pkt->next) { pkt = pkt->next; pos = 8; } pkt->buf[tds_packet_get_data_start(pkt) + pos] = size & 0xffu; size >>= 8; pos++; } while (--size_len); } /** * Stop keeping data for this specific freeze. * * Similar to ::tds_freeze_close but specify the size to be written instead * of letting ::tds_freeze_close compute it. * After this call freeze should not be used. * * @param[in] freeze structure to work on * @param[in] size size to write */ TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size) { TDSSOCKET *tds = freeze->tds; TDSPACKET *pkt; #if !ENABLE_ODBC_MARS TDSPACKET *last_pkt_sent = NULL; #endif CHECK_FREEZE_EXTRA(freeze); if (freeze->size_len) tds_freeze_update_size(freeze, size); /* if not last freeze we need just to update size */ freeze->tds = NULL; if (--tds->frozen != 0) return TDS_SUCCESS; tds->frozen_packets = NULL; pkt = freeze->pkt; while (pkt->next) { TDSPACKET *next = pkt->next; TDSRET rc; #if ENABLE_ODBC_MARS pkt->next = NULL; freeze->pkt = next; /* packet will get owned by function, no need to release it */ rc = tds_connection_put_packet(tds, pkt); #else rc = tds_connection_write(tds, pkt->buf, pkt->data_len, 0) <= 0 ? TDS_FAIL : TDS_SUCCESS; last_pkt_sent = pkt; #endif if (TDS_UNLIKELY(TDS_FAILED(rc))) { while (next->next) { pkt = next; next = pkt->next; } tds_extra_assert(pkt->next != NULL); tds_extra_assert(pkt->next == tds->send_packet); pkt->next = NULL; tds_mutex_lock(&tds->conn->list_mtx); tds_packet_cache_add(tds->conn, freeze->pkt); tds_mutex_unlock(&tds->conn->list_mtx); return rc; } pkt = next; } tds_extra_assert(pkt->next == NULL); tds_extra_assert(pkt == tds->send_packet); #if !ENABLE_ODBC_MARS if (last_pkt_sent) { tds_extra_assert(last_pkt_sent->next == pkt); last_pkt_sent->next = NULL; tds_mutex_lock(&tds->conn->list_mtx); tds_packet_cache_add(tds->conn, freeze->pkt); tds_mutex_unlock(&tds->conn->list_mtx); } #endif /* keep final packet so we can continue to add data */ return TDS_SUCCESS; } /** @} */ freetds-1.3.6/src/tds/stream.c000644 025423 025423 00000023552 14056414222 017632 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2013 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * \file * \brief Handle stream of data */ #include #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #include /** \cond HIDDEN_SYMBOLS */ #if ENABLE_EXTRA_CHECKS # define TEMP_INIT(s) const size_t temp_size = s; char* temp = tds_new(char, temp_size) # define TEMP_FREE free(temp); # define TEMP_SIZE temp_size #else # define TEMP_INIT(s) char temp[s] # define TEMP_FREE ; # define TEMP_SIZE sizeof(temp) #endif /** \endcond */ /** * Reads and writes from a stream converting characters * \tds * \param char_conv conversion structure * \param direction specify conversion to server or from server * \param istream input stream * \param ostream output stream * \return TDS_SUCCESS of TDS_FAIL */ TDSRET tds_convert_stream(TDSSOCKET * tds, TDSICONV * char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM * istream, TDSOUTSTREAM *ostream) { TEMP_INIT(4096); /* * temp (above) is the "preconversion" buffer, the place where the UCS-2 data * are parked before converting them to ASCII. It has to have a size, * and there's no advantage to allocating dynamically. * This also avoids any memory allocation error. */ const char *ib; size_t bufleft = 0; TDSRET res = TDS_FAIL; /* cast away const for message suppression sub-structure */ TDS_ERRNO_MESSAGE_FLAGS *suppress = (TDS_ERRNO_MESSAGE_FLAGS*) &char_conv->suppress; memset(suppress, 0, sizeof(char_conv->suppress)); for (ib = temp; ostream->buf_len; ib = temp + bufleft) { char *ob; int len, conv_errno; size_t ol; assert(ib >= temp); /* read a chunk of data */ len = istream->read(istream, (char*) ib, TEMP_SIZE - bufleft); if (len < 0) break; if (len == 0 && bufleft == 0) { res = TDS_SUCCESS; break; } bufleft += len; /* Convert chunk */ ib = temp; /* always convert from start of buffer */ convert_more: ob = ostream->buffer; ol = ostream->buf_len; /* FIXME not for last */ suppress->einval = 1; /* EINVAL matters only on the last chunk. */ suppress->e2big = 1; ol = tds_iconv(tds, char_conv, direction, (const char **) &ib, &bufleft, &ob, &ol); conv_errno = errno; /* write converted chunk */ len = ostream->write(ostream, ob - ostream->buffer); if (TDS_UNLIKELY(len < 0)) break; if ((size_t) -1 == ol) { tdsdump_log(TDS_DBG_NETWORK, "Error: tds_convert_stream: tds_iconv returned errno %d, conv_errno %d\n", errno, conv_errno); if (conv_errno == E2BIG && ostream->buf_len && bufleft && len) goto convert_more; if (conv_errno != EILSEQ) { tdsdump_log(TDS_DBG_NETWORK, "Error: tds_convert_stream: " "Gave up converting %u bytes due to error %d.\n", (unsigned int) bufleft, errno); tdsdump_dump_buf(TDS_DBG_NETWORK, "Troublesome bytes:", ib, bufleft); } if (TDS_UNLIKELY(ib == temp)) { /* tds_iconv did not convert anything, avoid infinite loop */ tdsdump_log(TDS_DBG_NETWORK, "No conversion possible: some bytes left.\n"); res = TDS_FAIL; if (conv_errno == EINVAL && tds) tdserror(tds_get_ctx(tds), tds, TDSEICONVAVAIL, 0); if (conv_errno == E2BIG && tds) tdserror(tds_get_ctx(tds), tds, TDSEICONVIU, 0); errno = conv_errno; break; } if (bufleft) memmove(temp, ib, bufleft); } } TEMP_FREE; return res; } /** * Reads and writes from a stream to another * \tds * \param istream input stream * \param ostream output stream * \return TDS_SUCCESS or TDS_FAIL */ TDSRET tds_copy_stream(TDSINSTREAM * istream, TDSOUTSTREAM * ostream) { while (ostream->buf_len) { /* read a chunk of data */ int len = istream->read(istream, ostream->buffer, ostream->buf_len); if (len == 0) return TDS_SUCCESS; if (TDS_UNLIKELY(len < 0)) break; /* write chunk */ len = ostream->write(ostream, len); if (TDS_UNLIKELY(len < 0)) break; } return TDS_FAIL; } /** * Reads data from network for input stream */ static int tds_datain_stream_read(TDSINSTREAM *stream, void *ptr, size_t len) { TDSDATAINSTREAM *s = (TDSDATAINSTREAM *) stream; if (len > s->wire_size) len = s->wire_size; if (!tds_get_n(s->tds, ptr, len)) return -1; s->wire_size -= len; return len; } /** * Initialize a data input stream. * This stream read data from network. * \param stream input stream to initialize * \tds * \param wire_size byte to read */ void tds_datain_stream_init(TDSDATAINSTREAM * stream, TDSSOCKET * tds, size_t wire_size) { stream->stream.read = tds_datain_stream_read; stream->wire_size = wire_size; stream->tds = tds; } /** * Writes data to network for output stream */ static int tds_dataout_stream_write(TDSOUTSTREAM *stream, size_t len) { TDSDATAOUTSTREAM *s = (TDSDATAOUTSTREAM *) stream; TDSSOCKET *tds = s->tds; assert(len <= stream->buf_len); assert(stream->buffer == (char *) tds->out_buf + tds->out_pos); assert(stream->buf_len == tds->out_buf_max - tds->out_pos + TDS_ADDITIONAL_SPACE); tds->out_pos += len; /* this must be strictly test as equal means we send a full packet * and we could be just at the end of packet so server would * wait for another packet with flag != 0 */ if (tds->out_pos > tds->out_buf_max) tds_write_packet(tds, 0x0); stream->buffer = (char *) tds->out_buf + tds->out_pos; stream->buf_len = tds->out_buf_max - tds->out_pos + TDS_ADDITIONAL_SPACE; s->written += len; return len; } /** * Initialize a data output stream. * This stream writes data to network. * \param stream output stream to initialize * \tds */ void tds_dataout_stream_init(TDSDATAOUTSTREAM * stream, TDSSOCKET * tds) { #if TDS_ADDITIONAL_SPACE < 4 #error Not supported #endif /* * we use the extra space as we want possible space for converting * a character and cause we don't want to send an exactly entire * packet with 0 flag and then nothing */ size_t left = tds->out_buf_max - tds->out_pos + TDS_ADDITIONAL_SPACE; assert(left > 0); stream->stream.write = tds_dataout_stream_write; stream->stream.buffer = (char *) tds->out_buf + tds->out_pos; stream->stream.buf_len = left; stream->written = 0; stream->tds = tds; } /** * Reads data from a static allocated buffer */ static int tds_staticin_stream_read(TDSINSTREAM *stream, void *ptr, size_t len) { TDSSTATICINSTREAM *s = (TDSSTATICINSTREAM *) stream; size_t cp = (len <= s->buf_left) ? len : s->buf_left; memcpy(ptr, s->buffer, cp); s->buffer += cp; s->buf_left -= cp; return cp; } /** * Initialize an input stream for read from a static allocated buffer * \param stream stream to initialize * \param ptr buffer to read from * \param len buffer size in bytes */ void tds_staticin_stream_init(TDSSTATICINSTREAM * stream, const void *ptr, size_t len) { stream->stream.read = tds_staticin_stream_read; stream->buffer = (const char *) ptr; stream->buf_left = len; } /** * Writes data to a static allocated buffer */ static int tds_staticout_stream_write(TDSOUTSTREAM *stream, size_t len) { assert(stream->buf_len >= len); stream->buffer += len; stream->buf_len -= len; return len; } /** * Initialize an output stream for write into a static allocated buffer * \param stream stream to initialize * \param ptr buffer to write to * \param len buffer size in bytes */ void tds_staticout_stream_init(TDSSTATICOUTSTREAM * stream, void *ptr, size_t len) { stream->stream.write = tds_staticout_stream_write; stream->stream.buffer = (char *) ptr; stream->stream.buf_len = len; } /** * Writes data to a dynamic allocated buffer */ static int tds_dynamic_stream_write(TDSOUTSTREAM *stream, size_t len) { TDSDYNAMICSTREAM *s = (TDSDYNAMICSTREAM *) stream; size_t wanted; s->size += len; /* grow linearly till some limit then exponentially */ if (s->size + 256 > s->allocated) { wanted = s->size + (s->size < 4096 ? 1024 : s->size / 8u); if (TDS_UNLIKELY(!tds_realloc(s->buf, wanted))) return -1; s->allocated = wanted; } assert(s->allocated > s->size); stream->buffer = (char *) *s->buf + s->size; stream->buf_len = s->allocated - s->size; return len; } /** * Initialize a dynamic output stream. * This stream write data into a dynamic allocated buffer. * \param stream stream to initialize * \param ptr pointer to pointer to buffer to fill. Buffer * will be extended as needed * \param allocated bytes initialially allocated for the buffer. * Useful to reuse buffers * \return TDS_SUCCESS on success, TDS_FAIL otherwise */ TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM * stream, void **ptr, size_t allocated) { const size_t initial_size = 1024; stream->stream.write = tds_dynamic_stream_write; stream->buf = ptr; if (allocated < initial_size) { free(*ptr); *ptr = NULL; allocated = initial_size; } if (!*ptr) { *ptr = malloc(allocated); if (TDS_UNLIKELY(!*ptr)) return TDS_FAIL; } stream->allocated = allocated; stream->size = 0; stream->stream.buffer = (char *) *ptr; stream->stream.buf_len = allocated; return TDS_SUCCESS; } freetds-1.3.6/src/tds/random.c000644 025423 025423 00000003424 14056414222 017613 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2005-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #ifdef HAVE_GNUTLS #include #include #ifndef HAVE_GNUTLS_RND #include #endif #elif defined(HAVE_OPENSSL) #include #endif void tds_random_buffer(unsigned char *out, int len) { int i; #if defined(HAVE_GNUTLS) && defined(HAVE_GNUTLS_RND) if (gnutls_rnd(GNUTLS_RND_RANDOM, out, len) >= 0) return; if (gnutls_rnd(GNUTLS_RND_NONCE, out, len) >= 0) return; #elif defined(HAVE_GNUTLS) void *p = gcry_random_bytes(len, GCRY_STRONG_RANDOM); if (p) { memcpy(out, p, len); free(p); return; } #elif defined(HAVE_OPENSSL) if (RAND_bytes(out, len) == 1) return; if (RAND_pseudo_bytes(out, len) >= 0) return; #endif /* TODO find a better random... */ for (i = 0; i < len; ++i) out[i] = rand() / (RAND_MAX / 256); } freetds-1.3.6/src/tds/sec_negotiate.c000644 025423 025423 00000011257 14056414271 021153 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STDDEF_H #include #endif /* HAVE_STDDEF_H */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #ifdef HAVE_GNUTLS # include "sec_negotiate_gnutls.h" #elif defined(HAVE_OPENSSL) # include "sec_negotiate_openssl.h" #endif /** * \ingroup libtds * \defgroup auth Authentication * Functions for handling authentication. */ /** * \addtogroup auth * @{ */ #if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL) typedef struct tds5_negotiate { TDSAUTHENTICATION tds_auth; } TDS5NEGOTIATE; static TDSRET tds5_negotiate_free(TDSCONNECTION * conn, TDSAUTHENTICATION * tds_auth) { TDS5NEGOTIATE *auth = (TDS5NEGOTIATE *) tds_auth; free(auth->tds_auth.packet); free(auth); return TDS_SUCCESS; } static void tds5_send_msg(TDSSOCKET *tds, uint16_t msg_type) { tds_put_tinyint(tds, TDS_MSG_TOKEN); tds_put_tinyint(tds, 3); /* length */ tds_put_tinyint(tds, 1); /* status, 1=has params */ tds_put_smallint(tds, msg_type); } static TDSRET tds5_negotiate_handle_next(TDSSOCKET * tds, TDSAUTHENTICATION * tds_auth, size_t len) { TDSPARAMINFO *info; void *rsa, *nonce = NULL; size_t rsa_len, nonce_len = 0; void *em; size_t em_size; TDSRET rc = TDS_FAIL; /* send next data for authentication */ if (!tds->login) goto error; /* we only support RSA authentication, we should have send 2/3 parameters: * 1- integer, cipher suite. 1 for RSA * 2- binary, rsa public key in PEM format * 3- binary, nonce (optional) */ /* message not supported */ if (tds_auth->msg_type != TDS5_MSG_SEC_ENCRYPT3) goto error; info = tds->param_info; if (!info || info->num_cols < 2) goto error; if (info->columns[1]->column_type != SYBLONGBINARY) goto error; if (info->num_cols >= 3 && info->columns[2]->column_type != SYBLONGBINARY) goto error; rsa = ((TDSBLOB*) info->columns[1]->column_data)->textvalue; rsa_len = info->columns[1]->column_size; if (info->num_cols >= 3) { nonce = ((TDSBLOB*) info->columns[2]->column_data)->textvalue; nonce_len = info->columns[2]->column_size; } em = tds5_rsa_encrypt(rsa, rsa_len, nonce, nonce_len, tds_dstr_cstr(&tds->login->password), &em_size); if (!em) goto error; tds->out_flag = TDS_NORMAL; /* password */ tds5_send_msg(tds, TDS5_MSG_SEC_LOGPWD3); tds_put_n(tds, "\xec\x0e\x00\x01\x00\x00\x00\x00\x00\x00\x00\xe1\xff\xff\xff\x7f\x00", 0x11); tds_put_byte(tds, TDS5_PARAMS_TOKEN); tds_put_int(tds, em_size); tds_put_n(tds, em, em_size); /* remote password */ tds5_send_msg(tds, TDS5_MSG_SEC_REMPWD3); tds_put_n(tds, "\xec\x17\x00\x02\x00\x00\x00\x00\x00\x00\x00\x27\xff\x00\x00\x00\x00\x00\x00\x00\xe1\xff\xff\xff\x7f\x00", 0x1a); tds_put_byte(tds, TDS5_PARAMS_TOKEN); tds_put_byte(tds, 0); tds_put_int(tds, em_size); tds_put_n(tds, em, em_size); free(em); rc = tds_flush_packet(tds); error: tds5_negotiate_free(tds->conn, tds_auth); tds->conn->authentication = NULL; return rc; } /** * Initialize Sybase negotiate handling * @param tds A pointer to the TDSSOCKET structure managing a client/server operation. * @return authentication info */ TDSAUTHENTICATION * tds5_negotiate_get_auth(TDSSOCKET * tds) { TDS5NEGOTIATE *auth; if (!tds->login) return NULL; auth = tds_new0(TDS5NEGOTIATE, 1); if (!auth) return NULL; auth->tds_auth.free = tds5_negotiate_free; auth->tds_auth.handle_next = tds5_negotiate_handle_next; return (TDSAUTHENTICATION *) auth; } #else /* not HAVE_GNUTLS or HAVE_OPENSSL */ TDSAUTHENTICATION * tds5_negotiate_get_auth(TDSSOCKET * tds) { tdsdump_log(TDS_DBG_ERROR, "Sybase authentication not supported if GnuTLS or OpenSSL are not present\n"); return NULL; } #endif /** @} */ freetds-1.3.6/src/tds/sec_negotiate_gnutls.h000644 025423 025423 00000021130 14056414222 022537 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #ifdef HAVE_GNUTLS_ABSTRACT_H # include #endif #if !defined(HAVE_NETTLE) || !defined(HAVE_GMP) || !defined(HAVE_GNUTLS_RND) # include #endif #ifndef HAVE_NETTLE # include #endif #ifdef HAVE_NETTLE # include # include # include #endif /** * \ingroup libtds * \defgroup auth Authentication * Functions for handling authentication. */ /** * \addtogroup auth * @{ */ #ifndef HAVE_GNUTLS #error HAVE_GNUTLS not defines, this file should not be included #endif /* emulate GMP if not present */ #ifndef HAVE_GMP #define HAVE_GMP 1 typedef struct { gcry_mpi_t num; } mpz_t[1]; #define mpz_powm(w,n,e,m) \ gcry_mpi_powm((w)->num, (n)->num, (e)->num, (m)->num); #define mpz_init(n) do { (n)->num = NULL; } while(0) #define mpz_clear(n) gcry_mpi_release((n)->num) #endif /* emulate Nettle is not present */ #ifndef HAVE_NETTLE #define HAVE_NETTLE 1 typedef void nettle_random_func(void *ctx, size_t len, uint8_t *out); static inline void nettle_mpz_set_str_256_u(mpz_t x, unsigned length, const uint8_t *s) { gcry_mpi_scan(&x->num, GCRYMPI_FMT_USG, s, length, NULL); } static inline void nettle_mpz_get_str_256(unsigned length, uint8_t *s, const mpz_t x) { gcry_mpi_print(GCRYMPI_FMT_USG, s, length, NULL, x->num); } struct asn1_der_iterator { const unsigned char *data, *data_end; unsigned long length; unsigned long type; }; enum asn1_iterator_result { ASN1_ITERATOR_ERROR, ASN1_ITERATOR_PRIMITIVE, ASN1_ITERATOR_CONSTRUCTED, ASN1_ITERATOR_END, }; enum { ASN1_SEQUENCE = ASN1_TAG_SEQUENCE, }; static enum asn1_iterator_result asn1_der_iterator_next(struct asn1_der_iterator *der) { unsigned char cls; unsigned long tag; int len; long l; if (asn1_get_tag_der(der->data, der->data_end - der->data, &cls, &len, &tag) != ASN1_SUCCESS) return ASN1_ITERATOR_ERROR; der->type = tag; der->data += len; l = asn1_get_length_der(der->data, der->data_end - der->data, &len); if (l < 0) return ASN1_ITERATOR_ERROR; der->data += len; der->length = l; if (cls == ASN1_CLASS_STRUCTURED) return ASN1_ITERATOR_CONSTRUCTED; return ASN1_ITERATOR_PRIMITIVE; } static enum asn1_iterator_result asn1_der_iterator_first(struct asn1_der_iterator *der, int size, const void *der_buf) { der->data = (const unsigned char *) der_buf; der->data_end = der->data + size; return asn1_der_iterator_next(der); } struct rsa_public_key { unsigned size; mpz_t n, e; }; static void rsa_public_key_init(struct rsa_public_key *key) { key->size = 0; mpz_init(key->n); mpz_init(key->e); } static void rsa_public_key_clear(struct rsa_public_key *key) { mpz_clear(key->n); mpz_clear(key->e); } static int rsa_public_key_from_der_iterator(struct rsa_public_key *key, unsigned key_bits, struct asn1_der_iterator *der) { enum asn1_iterator_result ret; ret = asn1_der_iterator_next(der); if (ret != ASN1_ITERATOR_PRIMITIVE || der->type != ASN1_TAG_INTEGER) return 0; gcry_mpi_scan(&key->n->num, GCRYMPI_FMT_USG, der->data, der->length, NULL); key->size = (gcry_mpi_get_nbits(key->n->num)+7)/8; der->data += der->length; ret = asn1_der_iterator_next(der); if (ret != ASN1_ITERATOR_PRIMITIVE || der->type != ASN1_TAG_INTEGER) return 0; gcry_mpi_scan(&key->e->num, GCRYMPI_FMT_USG, der->data, der->length, NULL); return 1; } static void sha1(uint8_t *hash, const void *data, size_t len) { gcry_md_hash_buffer(GCRY_MD_SHA1, hash, data, len); } #else static void sha1(uint8_t *hash, const void *data, size_t len) { struct sha1_ctx ctx; sha1_init(&ctx); sha1_update(&ctx, len, (const uint8_t *) data); sha1_digest(&ctx, 20, hash); } #endif static void rnd_func(void *ctx, size_t len, uint8_t * out) { tds_random_buffer(out, len); } #define dumpl(b,l) tdsdump_dump_buf(TDS_DBG_INFO1, #b, b, l) #ifndef dumpl #define dumpl(b,l) do {} while(0) #endif #define dump(b) dumpl(b, sizeof(b)) /* OAEP configuration parameters */ #define hash_func sha1 enum { hash_len = 20 }; /* sha1 length */ enum { key_size_max = 1024 }; /* max key in bytes */ static const char label[] = ""; static void memxor(uint8_t *dest, const uint8_t *src, size_t len) { size_t n; for (n = 0; n < len; ++n) dest[n] = dest[n] ^ src[n]; } static void mgf_mask(uint8_t *dest, size_t dest_len, const uint8_t *mask, size_t mask_len) { unsigned n = 0; uint8_t hash[hash_len]; uint8_t seed[mask_len + 4]; memcpy(seed, mask, mask_len); /* we always have some data and check is done internally */ for (;;) { TDS_PUT_UA4BE(seed+mask_len, n); hash_func(hash, seed, sizeof(seed)); if (dest_len <= hash_len) { memxor(dest, hash, dest_len); break; } memxor(dest, hash, hash_len); dest += hash_len; dest_len -= hash_len; ++n; } } static int oaep_encrypt(size_t key_size, void *random_ctx, nettle_random_func *random, size_t length, const uint8_t *message, mpz_t m) { /* EM: 0x00 ROS (HASH 0x00.. 0x01 message) */ struct { uint8_t all[1]; /* zero but used to access all data */ uint8_t ros[hash_len]; uint8_t db[key_size_max - hash_len - 1]; } em; const unsigned db_len = key_size - hash_len - 1; if (length + hash_len * 2 + 2 > key_size) /* Message too long for this key. */ return 0; /* create db */ memset(&em, 0, sizeof(em)); hash_func(em.db, label, strlen(label)); em.all[key_size - length - 1] = 0x1; memcpy(em.all+(key_size - length), message, length); dumpl(em.db, db_len); /* create ros */ random(random_ctx, hash_len, em.ros); dump(em.ros); /* mask db */ mgf_mask(em.db, db_len, em.ros, hash_len); dumpl(em.db, db_len); /* mask ros */ mgf_mask(em.ros, hash_len, em.db, db_len); dump(em.ros); nettle_mpz_set_str_256_u(m, key_size, em.all); return 1; } static int rsa_encrypt_oaep(const struct rsa_public_key *key, void *random_ctx, nettle_random_func *random, size_t length, const uint8_t *message, mpz_t gibberish) { if (!oaep_encrypt(key->size, random_ctx, random, length, message, gibberish)) return 0; mpz_powm(gibberish, gibberish, key->e, key->n); return 1; } static void* tds5_rsa_encrypt(const void *key, size_t key_len, const void *nonce, size_t nonce_len, const char *pwd, size_t *em_size) { int ret; mpz_t p; gnutls_datum_t pubkey_datum = { (unsigned char *) key, key_len }; struct asn1_der_iterator der; struct rsa_public_key pubkey; uint8_t *message; size_t message_len, pwd_len; uint8_t *em = NULL; unsigned char der_buf[2048]; size_t size = sizeof(der_buf); mpz_init(p); rsa_public_key_init(&pubkey); pwd_len = strlen(pwd); message_len = nonce_len + pwd_len; message = tds_new(uint8_t, message_len); if (!message) return NULL; memcpy(message, nonce, nonce_len); memcpy(message + nonce_len, pwd, pwd_len); /* use nettle directly */ /* parse PEM, get DER */ ret = gnutls_pem_base64_decode("RSA PUBLIC KEY", &pubkey_datum, der_buf, &size); if (ret) { tdsdump_log(TDS_DBG_ERROR, "Error %d decoding public key: %s\n", ret, gnutls_strerror(ret)); goto error; } /* get key with nettle using DER */ ret = asn1_der_iterator_first(&der, size, der_buf); if (ret != ASN1_ITERATOR_CONSTRUCTED || der.type != ASN1_SEQUENCE) { tdsdump_log(TDS_DBG_ERROR, "Invalid DER content\n"); goto error; } ret = rsa_public_key_from_der_iterator(&pubkey, key_size_max * 8, &der); if (!ret) { tdsdump_log(TDS_DBG_ERROR, "Invalid DER content\n"); goto error; } /* get password encrypted */ ret = rsa_encrypt_oaep(&pubkey, NULL, rnd_func, message_len, message, p); if (!ret) { tdsdump_log(TDS_DBG_ERROR, "Error encrypting message\n"); goto error; } em = tds_new(uint8_t, pubkey.size); *em_size = pubkey.size; if (!em) goto error; nettle_mpz_get_str_256(pubkey.size, em, p); tdsdump_dump_buf(TDS_DBG_INFO1, "em", em, pubkey.size); error: free(message); rsa_public_key_clear(&pubkey); mpz_clear(p); return em; } /** @} */ freetds-1.3.6/src/tds/sec_negotiate_openssl.h000644 025423 025423 00000004536 14056414222 022721 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include /** * \ingroup libtds * \defgroup auth Authentication * Functions for handling authentication. */ /** * \addtogroup auth * @{ */ #ifndef HAVE_OPENSSL #error HAVE_OPENSSL not defines, this file should not be included #endif static inline const BIGNUM* rsa_get_n(const RSA *rsa) { #if HAVE_RSA_GET0_KEY const BIGNUM *n, *e, *d; RSA_get0_key(rsa, &n, &e, &d); return n; #else return rsa->n; #endif } static void* tds5_rsa_encrypt(const void *key, size_t key_len, const void *nonce, size_t nonce_len, const char *pwd, size_t *em_size) { RSA *rsa = NULL; BIO *keybio; uint8_t *message = NULL; size_t message_len, pwd_len; uint8_t *em = NULL; int result; keybio = BIO_new_mem_buf((void*) key, key_len); if (keybio == NULL) goto error; rsa = PEM_read_bio_RSAPublicKey(keybio, &rsa, NULL, NULL); if (!rsa) goto error; pwd_len = strlen(pwd); message_len = nonce_len + pwd_len; message = tds_new(uint8_t, message_len); if (!message) goto error; memcpy(message, nonce, nonce_len); memcpy(message + nonce_len, pwd, pwd_len); em = tds_new(uint8_t, BN_num_bytes(rsa_get_n(rsa))); if (!em) goto error; result = RSA_public_encrypt(message_len, message, em, rsa, RSA_PKCS1_OAEP_PADDING); if (result < 0) goto error; free(message); RSA_free(rsa); BIO_free(keybio); *em_size = result; return em; error: free(message); free(em); RSA_free(rsa); BIO_free(keybio); return NULL; } /** @} */ freetds-1.3.6/src/tds/gssapi.c000644 025423 025423 00000037140 14056414271 017627 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2007-2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #if HAVE_COM_ERR_H #include #endif /* HAVE_COM_ERR_H */ #ifdef ENABLE_KRB5 #ifdef __APPLE__ #define KERBEROS_APPLE_DEPRECATED(x) #define GSSKRB_APPLE_DEPRECATED(x) #endif #include #include #include #include /** * \ingroup libtds * \defgroup auth Authentication * Functions for handling authentication. */ /** * \addtogroup auth * @{ */ typedef struct tds_gss_auth { TDSAUTHENTICATION tds_auth; gss_ctx_id_t gss_context; gss_name_t target_name; char *sname; OM_uint32 last_stat; } TDSGSSAUTH; static TDSRET tds_gss_free(TDSCONNECTION * conn, struct tds_authentication * tds_auth) { TDSGSSAUTH *auth = (TDSGSSAUTH *) tds_auth; OM_uint32 min_stat; if (auth->tds_auth.packet) { gss_buffer_desc send_tok; send_tok.value = (void *) auth->tds_auth.packet; send_tok.length = auth->tds_auth.packet_len; gss_release_buffer(&min_stat, &send_tok); } gss_release_name(&min_stat, &auth->target_name); free(auth->sname); if (auth->gss_context != GSS_C_NO_CONTEXT) gss_delete_sec_context(&min_stat, &auth->gss_context, GSS_C_NO_BUFFER); free(auth); return TDS_SUCCESS; } static TDSRET tds_gss_continue(TDSSOCKET * tds, struct tds_gss_auth *auth, gss_buffer_desc *token_ptr); static TDSRET tds7_gss_handle_next(TDSSOCKET * tds, struct tds_authentication * auth, size_t len) { TDSRET res; gss_buffer_desc recv_tok; if (((struct tds_gss_auth *) auth)->last_stat != GSS_S_CONTINUE_NEEDED) return TDS_FAIL; if (auth->packet) { OM_uint32 min_stat; gss_buffer_desc send_tok; send_tok.value = (void *) auth->packet; send_tok.length = auth->packet_len; gss_release_buffer(&min_stat, &send_tok); auth->packet = NULL; } recv_tok.length = len; recv_tok.value = tds_new(char, len); if (!recv_tok.value) return TDS_FAIL; tds_get_n(tds, recv_tok.value, len); res = tds_gss_continue(tds, (struct tds_gss_auth *) auth, &recv_tok); free(recv_tok.value); if (TDS_FAILED(res)) return res; if (auth->packet_len) { tds->out_flag = TDS7_AUTH; tds_put_n(tds, auth->packet, auth->packet_len); return tds_flush_packet(tds); } return TDS_SUCCESS; } static TDSRET tds5_gss_handle_next(TDSSOCKET * tds, struct tds_authentication * auth, size_t len) { TDSRET res; gss_buffer_desc recv_tok; TDSPARAMINFO *info; TDSCOLUMN *col; if (((struct tds_gss_auth *) auth)->last_stat != GSS_S_CONTINUE_NEEDED) return TDS_FAIL; if (auth->packet) { OM_uint32 min_stat; gss_buffer_desc send_tok; send_tok.value = (void *) auth->packet; send_tok.length = auth->packet_len; gss_release_buffer(&min_stat, &send_tok); auth->packet = NULL; } /* parse from saved message */ if (auth->msg_type != TDS5_MSG_SEC_OPAQUE) goto error; auth->msg_type = 0; info = tds->param_info; if (!info || info->num_cols < 5) goto error; /* check first column is int and TDS5_SEC_VERSION */ col = info->columns[0]; if (tds_get_conversion_type(col->on_server.column_type, col->on_server.column_size) != SYBINT4) goto error; if (*((TDS_INT *) col->column_data) != TDS5_SEC_VERSION) goto error; /* check second column is int and TDS5_SEC_SECSESS */ col = info->columns[1]; if (tds_get_conversion_type(col->on_server.column_type, col->on_server.column_size) != SYBINT4) goto error; if (*((TDS_INT *) col->column_data) != TDS5_SEC_SECSESS) goto error; col = info->columns[3]; if (col->column_type != SYBLONGBINARY) goto error; recv_tok.value = ((TDSBLOB*) col->column_data)->textvalue; recv_tok.length = col->column_size; res = tds_gss_continue(tds, (struct tds_gss_auth *) auth, &recv_tok); if (TDS_FAILED(res)) return res; tds->out_flag = TDS_NORMAL; res = tds5_gss_send(tds); if (TDS_FAILED(res)) return res; return tds_flush_packet(tds); error: return TDS_FAIL; } /** * Build a GSSAPI packet to send to server * @param tds A pointer to the TDSSOCKET structure managing a client/server operation. * @return size of packet */ TDSAUTHENTICATION * tds_gss_get_auth(TDSSOCKET * tds) { /* * TODO * There are some differences between this implementation and MS on * - MS use SPNEGO with 3 mechnisms (MS KRB5, KRB5, NTLMSSP) * - MS seems to use MUTUAL flag * - name type is "Service and Instance (2)" and not "Principal (1)" * check for memory leaks * check for errors in many functions * a bit more verbose * dinamically load library ?? */ gss_buffer_desc send_tok; OM_uint32 maj_stat, min_stat; /* same as GSS_KRB5_NT_PRINCIPAL_NAME but do not require .so library */ static gss_OID_desc nt_principal = { 10, (void*) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01" }; const char *server_name; /* Storage for getaddrinfo calls */ struct addrinfo *addrs = NULL; int len = 0; struct tds_gss_auth *auth; if (!tds->login) return NULL; auth = tds_new0(struct tds_gss_auth, 1); if (!auth) return NULL; auth->tds_auth.free = tds_gss_free; auth->tds_auth.handle_next = IS_TDS50(tds->conn) ? tds5_gss_handle_next : tds7_gss_handle_next; auth->gss_context = GSS_C_NO_CONTEXT; auth->last_stat = GSS_S_COMPLETE; server_name = tds_dstr_cstr(&tds->login->server_host_name); if (IS_TDS7_PLUS(tds->conn) && strchr(server_name, '.') == NULL) { struct addrinfo hints; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_V4MAPPED|AI_ADDRCONFIG|AI_CANONNAME|AI_FQDN; if (!getaddrinfo(server_name, NULL, &hints, &addrs) && addrs->ai_canonname && strchr(addrs->ai_canonname, '.') != NULL) server_name = addrs->ai_canonname; } if (!tds_dstr_isempty(&tds->login->server_spn)) { auth->sname = strdup(tds_dstr_cstr(&tds->login->server_spn)); } else if (IS_TDS7_PLUS(tds->conn)) { if (tds_dstr_isempty(&tds->login->server_realm_name)) { len = asprintf(&auth->sname, "MSSQLSvc/%s:%d", server_name, tds->login->port); } else { len = asprintf(&auth->sname, "MSSQLSvc/%s:%d@%s", server_name, tds->login->port, tds_dstr_cstr(&tds->login->server_realm_name)); } } else { /* TDS 5.0, Sybase */ server_name = tds_dstr_cstr(&tds->login->server_name); if (tds_dstr_isempty(&tds->login->server_realm_name)) { len = asprintf(&auth->sname, "%s", server_name); } else { len = asprintf(&auth->sname, "%s@%s", server_name, tds_dstr_cstr(&tds->login->server_realm_name)); } } if (addrs) freeaddrinfo(addrs); if (len < 0 || auth->sname == NULL) { tds_gss_free(tds->conn, (TDSAUTHENTICATION *) auth); return NULL; } tdsdump_log(TDS_DBG_NETWORK, "using kerberos name %s\n", auth->sname); /* * Import the name into target_name. Use send_tok to save * local variable space. */ send_tok.value = auth->sname; send_tok.length = strlen(auth->sname); maj_stat = gss_import_name(&min_stat, &send_tok, &nt_principal, &auth->target_name); switch (maj_stat) { case GSS_S_COMPLETE: tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_COMPLETE: gss_import_name completed successfully.\n"); if (TDS_FAILED(tds_gss_continue(tds, auth, GSS_C_NO_BUFFER))) { tds_gss_free(tds->conn, (TDSAUTHENTICATION *) auth); return NULL; } break; case GSS_S_BAD_NAMETYPE: tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_BAD_NAMETYPE: The input_name_type was unrecognized.\n"); break; case GSS_S_BAD_NAME: tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_BAD_NAME: The input_name parameter could not be interpreted as a name of the specified type.\n"); break; case GSS_S_BAD_MECH: tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: GSS_S_BAD_MECH: The input name-type was GSS_C_NT_EXPORT_NAME, but the mechanism contained within the input-name is not supported.\n"); break; default: tdsdump_log(TDS_DBG_NETWORK, "gss_import_name: unexpected error %d.\n", maj_stat); break; } if (GSS_ERROR(maj_stat)) { tds_gss_free(tds->conn, (TDSAUTHENTICATION *) auth); return NULL; } return (TDSAUTHENTICATION *) auth; } #ifndef HAVE_ERROR_MESSAGE static const char * tds_error_message(OM_uint32 e) { const char *m = strerror(e); if (m == NULL) return ""; return m; } #define error_message tds_error_message #endif static TDSRET tds_gss_continue(TDSSOCKET * tds, struct tds_gss_auth *auth, gss_buffer_desc *token_ptr) { gss_buffer_desc send_tok; OM_uint32 maj_stat, min_stat = 0; OM_uint32 ret_flags; int gssapi_flags; const char *msg = "???"; gss_OID pmech = GSS_C_NULL_OID; auth->last_stat = GSS_S_COMPLETE; send_tok.value = NULL; send_tok.length = 0; /* * Perform the context-establishement loop. * * On each pass through the loop, token_ptr points to the token * to send to the server (or GSS_C_NO_BUFFER on the first pass). * Every generated token is stored in send_tok which is then * transmitted to the server; every received token is stored in * recv_tok, which token_ptr is then set to, to be processed by * the next call to gss_init_sec_context. * * GSS-API guarantees that send_tok's length will be non-zero * if and only if the server is expecting another token from us, * and that gss_init_sec_context returns GSS_S_CONTINUE_NEEDED if * and only if the server has another token to send us. */ /* * We always want to ask for the mutual, replay, and integ flags. * We may ask for delegation based on config in the tds.conf and other conf files. */ gssapi_flags = GSS_C_REPLAY_FLAG | GSS_C_INTEG_FLAG; if (tds->login->gssapi_use_delegation) gssapi_flags |= GSS_C_DELEG_FLAG; if (tds->login->mutual_authentication || IS_TDS7_PLUS(tds->conn)) gssapi_flags |= GSS_C_MUTUAL_FLAG; maj_stat = gss_init_sec_context(&min_stat, GSS_C_NO_CREDENTIAL, &auth->gss_context, auth->target_name, GSS_C_NULL_OID, gssapi_flags, 0, NULL, /* no channel bindings */ token_ptr, &pmech, &send_tok, &ret_flags, NULL); /* ignore time_rec */ tdsdump_log(TDS_DBG_NETWORK, "gss_init_sec_context: actual mechanism at %p\n", pmech); if (pmech && pmech->elements) { tdsdump_dump_buf(TDS_DBG_NETWORK, "actual mechanism", pmech->elements, pmech->length); } auth->last_stat = maj_stat; switch (maj_stat) { case GSS_S_COMPLETE: msg = "GSS_S_COMPLETE: gss_init_sec_context completed successfully."; break; case GSS_S_CONTINUE_NEEDED: msg = "GSS_S_CONTINUE_NEEDED: gss_init_sec_context() routine must be called again."; break; case GSS_S_FAILURE: msg = "GSS_S_FAILURE: The routine failed for reasons that are not defined at the GSS level."; tdsdump_log(TDS_DBG_NETWORK, "gss_init_sec_context: min_stat %ld \"%s\"\n", (long) min_stat, error_message(min_stat)); break; case GSS_S_BAD_BINDINGS: msg = "GSS_S_BAD_BINDINGS: The channel bindings are not valid."; break; case GSS_S_BAD_MECH: msg = "GSS_S_BAD_MECH: The request security mechanism is not supported."; break; case GSS_S_BAD_NAME: msg = "GSS_S_BAD_NAME: The target_name parameter is not valid."; break; case GSS_S_BAD_SIG: msg = "GSS_S_BAD_SIG: The input token contains an incorrect integrity check value."; break; case GSS_S_CREDENTIALS_EXPIRED: msg = "GSS_S_CREDENTIALS_EXPIRED: The supplied credentials are no longer valid."; break; case GSS_S_DEFECTIVE_CREDENTIAL: msg = "GSS_S_DEFECTIVE_CREDENTIAL: Consistency checks performed on the credential failed."; break; case GSS_S_DEFECTIVE_TOKEN: msg = "GSS_S_DEFECTIVE_TOKEN: Consistency checks performed on the input token failed."; break; case GSS_S_DUPLICATE_TOKEN: msg = "GSS_S_DUPLICATE_TOKEN: The token is a duplicate of a token that has already been processed."; break; case GSS_S_NO_CONTEXT: msg = "GSS_S_NO_CONTEXT: The context handle provided by the caller does not refer to a valid security context."; break; case GSS_S_NO_CRED: msg = "GSS_S_NO_CRED: The supplied credential handle does not refer to a valid credential, the supplied credential is not"; break; case GSS_S_OLD_TOKEN: msg = "GSS_S_OLD_TOKEN: The token is too old to be checked for duplication against previous tokens which have already been processed."; break; } if (GSS_ERROR(maj_stat)) { gss_release_buffer(&min_stat, &send_tok); tdsdump_log(TDS_DBG_NETWORK, "gss_init_sec_context: %s\n", msg); return TDS_FAIL; } auth->tds_auth.packet = (uint8_t *) send_tok.value; auth->tds_auth.packet_len = send_tok.length; return TDS_SUCCESS; } static void tds5_send_msg(TDSSOCKET *tds, uint16_t msg_type) { tds_put_tinyint(tds, TDS_MSG_TOKEN); tds_put_tinyint(tds, 3); /* length */ tds_put_tinyint(tds, 1); /* status, 1=has params */ tds_put_smallint(tds, msg_type); } TDSRET tds5_gss_send(TDSSOCKET *tds) { uint32_t flags = TDS5_SEC_NETWORK_AUTHENTICATION; if (!tds->conn->authentication) return TDS_FAIL; if (tds->login) { if (tds->login->gssapi_use_delegation) flags |= TDS5_SEC_DELEGATION; if (tds->login->mutual_authentication) flags |= TDS5_SEC_MUTUAL_AUTHENTICATION; } tds5_send_msg(tds, TDS5_MSG_SEC_OPAQUE); tds_put_byte(tds, TDS5_PARAMFMT_TOKEN); TDS_START_LEN_USMALLINT(tds) { tds_put_smallint(tds, 5); /* # parameters */ tds_put_n(tds, NULL, 6); /* name len + output + usertype */ tds_put_tinyint(tds, SYBINTN); tds_put_tinyint(tds, 4); tds_put_tinyint(tds, 0); /* locale len */ tds_put_n(tds, NULL, 6); /* name len + output + usertype */ tds_put_tinyint(tds, SYBINTN); tds_put_tinyint(tds, 4); tds_put_tinyint(tds, 0); /* locale len */ tds_put_n(tds, NULL, 6); /* name len + output + usertype */ tds_put_tinyint(tds, SYBVARBINARY); tds_put_tinyint(tds, 255); tds_put_tinyint(tds, 0); /* locale len */ tds_put_n(tds, NULL, 6); /* name len + output + usertype */ tds_put_tinyint(tds, SYBLONGBINARY); tds_put_int(tds, 0x7fffffff); tds_put_tinyint(tds, 0); /* locale len */ tds_put_n(tds, NULL, 6); /* name len + output + usertype */ tds_put_tinyint(tds, SYBINTN); tds_put_tinyint(tds, 4); tds_put_tinyint(tds, 0); /* locale len */ } TDS_END_LEN tds_put_byte(tds, TDS5_PARAMS_TOKEN); tds_put_tinyint(tds, 4); tds_put_int(tds, TDS5_SEC_VERSION); tds_put_tinyint(tds, 4); tds_put_int(tds, TDS5_SEC_SECSESS); tds_put_tinyint(tds, 12); tds_put_n(tds, "\x06\x0a\x2b\x06\x01\x04\x01\x87\x01\x04\x06\x06", 12); /* KRB5 Sybase OID */ tds_put_int(tds, tds->conn->authentication->packet_len); tds_put_n(tds, tds->conn->authentication->packet, tds->conn->authentication->packet_len); tds_put_tinyint(tds, 4); tds_put_int(tds, flags); return TDS_SUCCESS; } /** @} */ #endif freetds-1.3.6/src/tds/sspi.c000644 025423 025423 00000017466 14056414271 017330 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include /* enabled some additional definitions for getaddrinfo */ #define _WIN32_WINNT 0x601 /* fix possible bug in sspi.h header */ #define FreeCredentialHandle FreeCredentialsHandle #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_SSPI #define SECURITY_WIN32 #include #include #include #include #include #include #include #include #include /** * \ingroup libtds * \defgroup auth Authentication * Functions for handling authentication. */ /** * \addtogroup auth * @{ */ typedef struct tds_sspi_auth { TDSAUTHENTICATION tds_auth; CredHandle cred; CtxtHandle cred_ctx; char *sname; } TDSSSPIAUTH; static HMODULE secdll = NULL; static PSecurityFunctionTableA sec_fn = NULL; static tds_mutex sec_mutex = TDS_MUTEX_INITIALIZER; static bool tds_init_secdll(void) { bool res = false; if (sec_fn) return true; tds_mutex_lock(&sec_mutex); for (;;) { if (!secdll) { secdll = LoadLibrary(TEXT("secur32.dll")); if (!secdll) break; } if (!sec_fn) { INIT_SECURITY_INTERFACE_A pInitSecurityInterface; pInitSecurityInterface = (INIT_SECURITY_INTERFACE_A) GetProcAddress(secdll, "InitSecurityInterfaceA"); if (!pInitSecurityInterface) break; sec_fn = pInitSecurityInterface(); if (!sec_fn) break; } res = true; break; } tds_mutex_unlock(&sec_mutex); return res; } static int tds_sspi_free(TDSCONNECTION * conn, struct tds_authentication * tds_auth) { TDSSSPIAUTH *auth = (TDSSSPIAUTH *) tds_auth; if (SecIsValidHandle(&auth->cred_ctx)) sec_fn->DeleteSecurityContext(&auth->cred_ctx); if (SecIsValidHandle(&auth->cred)) sec_fn->FreeCredentialsHandle(&auth->cred); if (auth->tds_auth.packet) sec_fn->FreeContextBuffer(auth->tds_auth.packet); free(auth->sname); free(auth); return TDS_SUCCESS; } static int tds_sspi_handle_next(TDSSOCKET * tds, struct tds_authentication * tds_auth, size_t len) { SecBuffer in_buf, out_buf; SecBufferDesc in_desc, out_desc; SECURITY_STATUS status; ULONG attrs; TimeStamp ts; uint8_t *auth_buf; TDSSSPIAUTH *auth = (TDSSSPIAUTH *) tds_auth; if (len < 1) return TDS_FAIL; auth_buf = tds_new(uint8_t, len); if (!auth_buf) return TDS_FAIL; tds_get_n(tds, auth_buf, (int)len); /* free previously allocated buffer */ if (auth->tds_auth.packet) { sec_fn->FreeContextBuffer(auth->tds_auth.packet); auth->tds_auth.packet = NULL; } in_desc.ulVersion = out_desc.ulVersion = SECBUFFER_VERSION; in_desc.cBuffers = out_desc.cBuffers = 1; in_desc.pBuffers = &in_buf; out_desc.pBuffers = &out_buf; in_buf.BufferType = SECBUFFER_TOKEN; in_buf.pvBuffer = auth_buf; in_buf.cbBuffer = (ULONG)len; out_buf.BufferType = SECBUFFER_TOKEN; out_buf.pvBuffer = NULL; out_buf.cbBuffer = 0; status = sec_fn->InitializeSecurityContext(&auth->cred, &auth->cred_ctx, auth->sname, ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONNECTION | ISC_REQ_ALLOCATE_MEMORY, 0, SECURITY_NETWORK_DREP, &in_desc, 0, &auth->cred_ctx, &out_desc, &attrs, &ts); free(auth_buf); auth->tds_auth.packet = out_buf.pvBuffer; switch (status) { case SEC_I_COMPLETE_AND_CONTINUE: sec_fn->CompleteAuthToken(&auth->cred_ctx, &out_desc); break; case SEC_I_CONTINUE_NEEDED: case SEC_E_OK: break; default: return TDS_FAIL; } if (out_buf.cbBuffer == 0) return TDS_SUCCESS; tds_put_n(tds, auth->tds_auth.packet, out_buf.cbBuffer); return tds_flush_packet(tds); } /** * Build a SSPI packet to send to server * @param tds A pointer to the TDSSOCKET structure managing a client/server operation. */ TDSAUTHENTICATION * tds_sspi_get_auth(TDSSOCKET * tds) { SecBuffer buf; SecBufferDesc desc; SECURITY_STATUS status; ULONG attrs; TimeStamp ts; SEC_WINNT_AUTH_IDENTITY identity; const char *p, *user_name, *server_name; struct addrinfo *addrs = NULL; TDSSSPIAUTH *auth; TDSLOGIN *login = tds->login; /* check login */ if (!login) return NULL; if (!tds_init_secdll()) return NULL; /* parse username/password informations */ memset(&identity, 0, sizeof(identity)); user_name = tds_dstr_cstr(&login->user_name); if ((p = strchr(user_name, '\\')) != NULL) { identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI; identity.Password = (void *) tds_dstr_cstr(&login->password); identity.PasswordLength = tds_dstr_len(&login->password); identity.Domain = (void *) user_name; identity.DomainLength = p - user_name; user_name = p + 1; identity.User = (void *) user_name; identity.UserLength = strlen(user_name); } auth = tds_new0(TDSSSPIAUTH, 1); if (!auth) return NULL; auth->tds_auth.free = tds_sspi_free; auth->tds_auth.handle_next = tds_sspi_handle_next; SecInvalidateHandle(&auth->cred); SecInvalidateHandle(&auth->cred_ctx); /* using Negotiate system will use proper protocol (either NTLM or Kerberos) */ if (sec_fn->AcquireCredentialsHandle(NULL, (char *)"Negotiate", SECPKG_CRED_OUTBOUND, NULL, identity.Domain ? &identity : NULL, NULL, NULL, &auth->cred, &ts) != SEC_E_OK) { free(auth); return NULL; } desc.ulVersion = SECBUFFER_VERSION; desc.cBuffers = 1; desc.pBuffers = &buf; buf.BufferType = SECBUFFER_TOKEN; buf.pvBuffer = NULL; buf.cbBuffer = 0; /* build SPN */ server_name = tds_dstr_cstr(&login->server_host_name); if (strchr(server_name, '.') == NULL) { struct addrinfo hints; int res; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_V4MAPPED|AI_ADDRCONFIG|AI_CANONNAME|AI_FQDN; res = getaddrinfo(server_name, NULL, &hints, &addrs); if (res) { /* some version of Windows does not support V4MAPPED * and ADDRCONFIG, try without them */ hints.ai_flags = AI_CANONNAME|AI_FQDN; res = getaddrinfo(server_name, NULL, &hints, &addrs); } if (!res && addrs->ai_canonname && strchr(addrs->ai_canonname, '.') != NULL) server_name = addrs->ai_canonname; } if (strchr(server_name, '.') != NULL) { if (asprintf(&auth->sname, "MSSQLSvc/%s:%d", server_name, login->port) < 0) { if (addrs) freeaddrinfo(addrs); tds_sspi_free(tds->conn, &auth->tds_auth); return NULL; } tdsdump_log(TDS_DBG_NETWORK, "kerberos name %s\n", auth->sname); } if (addrs) freeaddrinfo(addrs); status = sec_fn->InitializeSecurityContext(&auth->cred, NULL, auth->sname, ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONNECTION | ISC_REQ_ALLOCATE_MEMORY, 0, SECURITY_NETWORK_DREP, NULL, 0, &auth->cred_ctx, &desc, &attrs, &ts); switch (status) { case SEC_I_COMPLETE_AND_CONTINUE: sec_fn->CompleteAuthToken(&auth->cred_ctx, &desc); break; case SEC_I_CONTINUE_NEEDED: case SEC_E_OK: break; default: tds_sspi_free(tds->conn, &auth->tds_auth); return NULL; } auth->tds_auth.packet_len = buf.cbBuffer; auth->tds_auth.packet = buf.pvBuffer; return &auth->tds_auth; } /** @} */ #endif /* HAVE_SSPI */ freetds-1.3.6/src/tds/challenge.c000644 025423 025423 00000051555 14056414271 020271 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2005-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STDDEF_H #include #endif /* HAVE_STDDEF_H */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include #include #include #include #include #include #include #include /** * \ingroup libtds * \defgroup auth Authentication * Functions for handling authentication. */ /** * \addtogroup auth * @{ */ /* * The following code is based on some psuedo-C code from ronald@innovation.ch */ typedef struct tds_answer { unsigned char lm_resp[24]; unsigned char nt_resp[24]; } TDSANSWER; typedef struct { uint8_t response_type; uint8_t max_response_type; uint16_t reserved1; uint32_t reserved2; uint64_t timestamp; uint8_t challenge[8]; uint32_t unknown; /* target info block - variable length */ uint8_t target_info[4]; } names_blob_prefix_t; static TDSRET tds_answer_challenge(TDSSOCKET * tds, TDSLOGIN * login, const unsigned char *challenge, uint32_t * flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER * answer, unsigned char **ntlm_v2_response); static void tds_encrypt_answer(const unsigned char *hash, const unsigned char *challenge, unsigned char *answer); static void tds_convert_key(const unsigned char *key_56, DES_KEY * ks); static void convert_to_upper(char *buf, size_t len) { size_t i; for (i = 0; i < len; i++) buf[i] = toupper((unsigned char) buf[i]); } static size_t convert_to_usc2le_string(TDSSOCKET * tds, const char *s, size_t len, char *out) { const char *ib; char *ob; size_t il, ol; TDSICONV * char_conv = tds->conn->char_convs[client2ucs2]; /* char_conv is only mostly const */ TDS_ERRNO_MESSAGE_FLAGS *suppress = (TDS_ERRNO_MESSAGE_FLAGS *) & char_conv->suppress; if (char_conv->flags == TDS_ENCODING_MEMCPY) { memcpy(out, s, len); return len; } /* convert */ ib = s; il = len; ob = out; ol = len * 2; memset(suppress, 0, sizeof(char_conv->suppress)); if (tds_iconv(tds, char_conv, to_server, &ib, &il, &ob, &ol) == (size_t) - 1) return (size_t) -1; return ob - out; } static TDSRET make_ntlm_hash(TDSSOCKET * tds, const char *passwd, unsigned char ntlm_hash[16]) { MD4_CTX context; size_t passwd_len = 0; char passwd_usc2le[256]; size_t passwd_usc2le_len = 0; passwd_len = strlen(passwd); if (passwd_len > 128) passwd_len = 128; passwd_usc2le_len = convert_to_usc2le_string(tds, passwd, passwd_len, passwd_usc2le); if (passwd_usc2le_len == (size_t) -1) { memset((char *) passwd_usc2le, 0, sizeof(passwd_usc2le)); return TDS_FAIL; } /* compute NTLM hash */ MD4Init(&context); MD4Update(&context, (unsigned char *) passwd_usc2le, passwd_usc2le_len); MD4Final(&context, ntlm_hash); /* with security is best be pedantic */ memset((char *) passwd_usc2le, 0, passwd_usc2le_len); memset(&context, 0, sizeof(context)); return TDS_SUCCESS; } static TDSRET make_ntlm_v2_hash(TDSSOCKET * tds, const char *passwd, unsigned char ntlm_v2_hash[16]) { const char *user_name, *domain; size_t domain_len, user_name_len, len, buf_usc2le_len = 0; const char *p; unsigned char ntlm_hash[16]; char buf[128]; char buf_usc2le[512]; TDSRET res; user_name = tds_dstr_cstr(&tds->login->user_name); /* parse domain\username */ p = strchr(user_name, '\\'); domain = user_name; domain_len = p - user_name; user_name = p + 1; user_name_len = strlen(user_name); if (user_name_len > 128) user_name_len = 128; memcpy(buf, user_name, user_name_len); convert_to_upper(buf, user_name_len); len = convert_to_usc2le_string(tds, buf, user_name_len, buf_usc2le); if (len == (size_t) -1) return TDS_FAIL; buf_usc2le_len = len; if (domain_len > 128) domain_len = 128; /* Target is supposed to be case-sensitive */ len = convert_to_usc2le_string(tds, domain, domain_len, buf_usc2le + len); if (len == (size_t) -1) return TDS_FAIL; buf_usc2le_len += len; res = make_ntlm_hash(tds, passwd, ntlm_hash); hmac_md5(ntlm_hash, (const unsigned char *) buf_usc2le, buf_usc2le_len, ntlm_v2_hash); /* with security is best be pedantic */ memset(&ntlm_hash, 0, sizeof(ntlm_hash)); memset(buf, 0, sizeof(buf)); memset((char *) buf_usc2le, 0, buf_usc2le_len); return res; } /* * hash - The NTLMv2 Hash. * client_data - The client data (blob or client nonce). * challenge - The server challenge from the Type 2 message. */ static unsigned char * make_lm_v2_response(const unsigned char ntlm_v2_hash[16], const unsigned char *client_data, int client_data_len, const unsigned char challenge[8]) { int mac_len = 16 + client_data_len; unsigned char *mac; mac = tds_new(unsigned char, mac_len); if (!mac) return NULL; memcpy(mac + 8, challenge, 8); memcpy(mac + 16, client_data, client_data_len); hmac_md5(ntlm_v2_hash, mac + 8, client_data_len + 8, mac); return mac; } static TDSRET tds_answer_challenge_ntlmv2(TDSSOCKET * tds, TDSLOGIN * login, const unsigned char *challenge, uint32_t * flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER * answer, unsigned char **ntlm_v2_response) { TDSRET res; const char *passwd = tds_dstr_cstr(&login->password); /* NTLMv2 */ unsigned char *lm_v2_response; unsigned char ntlm_v2_hash[16]; const names_blob_prefix_t *names_blob_prefix; if (!names_blob) return TDS_FAIL; res = make_ntlm_v2_hash(tds, passwd, ntlm_v2_hash); if (TDS_FAILED(res)) return res; /* LMv2 response */ /* Take client's challenge from names_blob */ names_blob_prefix = (const names_blob_prefix_t *) names_blob; lm_v2_response = make_lm_v2_response(ntlm_v2_hash, names_blob_prefix->challenge, 8, challenge); if (!lm_v2_response) return TDS_FAIL; memcpy(answer->lm_resp, lm_v2_response, 24); free(lm_v2_response); /* NTLMv2 response */ /* Size of lm_v2_response is 16 + names_blob_len */ *ntlm_v2_response = make_lm_v2_response(ntlm_v2_hash, names_blob, names_blob_len, challenge); if (!*ntlm_v2_response) return TDS_FAIL; memset(ntlm_v2_hash, 0, sizeof(ntlm_v2_hash)); /* local not supported */ *flags &= ~0x4000; return TDS_SUCCESS; } /** * Crypt a given password using schema required for NTLMv1 or NTLM2 authentication * @param passwd clear text domain password * @param challenge challenge data given by server * @param flags NTLM flags from server side * @param answer buffer where to store crypted password */ static TDSRET tds_answer_challenge(TDSSOCKET * tds, TDSLOGIN * login, const unsigned char *challenge, uint32_t * flags, const unsigned char *names_blob, int names_blob_len, TDSANSWER * answer, unsigned char **ntlm_v2_response) { #define MAX_PW_SZ 14 const char *passwd = tds_dstr_cstr(&login->password); DES_KEY ks; unsigned char hash[24], ntlm2_challenge[16]; TDSRET res; memset(answer, 0, sizeof(TDSANSWER)); if (login->use_ntlmv2) { return tds_answer_challenge_ntlmv2(tds, login, challenge, flags, names_blob, names_blob_len, answer, ntlm_v2_response); } else if ((*flags & 0x80000) != 0) { /* NTLM2 */ MD5_CTX md5_ctx; tds_random_buffer(hash, 8); memset(hash + 8, 0, 16); memcpy(answer->lm_resp, hash, 24); MD5Init(&md5_ctx); MD5Update(&md5_ctx, challenge, 8); MD5Update(&md5_ctx, hash, 8); MD5Final(&md5_ctx, ntlm2_challenge); challenge = ntlm2_challenge; memset(&md5_ctx, 0, sizeof(md5_ctx)); } else if (login->use_lanman) { /* LM */ size_t len, i; unsigned char passwd_buf[MAX_PW_SZ]; static const des_cblock magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 }; /* convert password to upper and pad to 14 chars */ memset(passwd_buf, 0, MAX_PW_SZ); len = strlen(passwd); if (len > MAX_PW_SZ) len = MAX_PW_SZ; for (i = 0; i < len; i++) passwd_buf[i] = toupper((unsigned char) passwd[i]); /* hash the first 7 characters */ tds_convert_key(passwd_buf, &ks); tds_des_ecb_encrypt(&magic, sizeof(magic), &ks, (hash + 0)); /* hash the second 7 characters */ tds_convert_key(passwd_buf + 7, &ks); tds_des_ecb_encrypt(&magic, sizeof(magic), &ks, (hash + 8)); memset(hash + 16, 0, 5); tds_encrypt_answer(hash, challenge, answer->lm_resp); memset(passwd_buf, 0, sizeof(passwd_buf)); } else { memset(answer->lm_resp, 0, sizeof(answer->lm_resp)); } *flags = 0x8201; /* NTLM/NTLM2 response */ res = make_ntlm_hash(tds, passwd, hash); memset(hash + 16, 0, 5); tds_encrypt_answer(hash, challenge, answer->nt_resp); /* with security is best be pedantic */ memset(&ks, 0, sizeof(ks)); memset(hash, 0, sizeof(hash)); memset(ntlm2_challenge, 0, sizeof(ntlm2_challenge)); return res; } /* * takes a 21 byte array and treats it as 3 56-bit DES keys. The * 8 byte plaintext is encrypted with each key and the resulting 24 * bytes are stored in the results array. */ static void tds_encrypt_answer(const unsigned char *hash, const unsigned char *challenge, unsigned char *answer) { DES_KEY ks; tds_convert_key(hash, &ks); tds_des_ecb_encrypt(challenge, 8, &ks, answer); tds_convert_key(&hash[7], &ks); tds_des_ecb_encrypt(challenge, 8, &ks, &answer[8]); tds_convert_key(&hash[14], &ks); tds_des_ecb_encrypt(challenge, 8, &ks, &answer[16]); memset(&ks, 0, sizeof(ks)); } /* * turns a 56 bit key into the 64 bit, odd parity key and sets the key. * The key schedule ks is also set. */ static void tds_convert_key(const unsigned char *key_56, DES_KEY * ks) { des_cblock key; key[0] = key_56[0]; key[1] = ((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1); key[2] = ((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2); key[3] = ((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3); key[4] = ((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4); key[5] = ((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5); key[6] = ((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6); key[7] = (key_56[6] << 1) & 0xFF; tds_des_set_odd_parity(key); tds_des_set_key(ks, key, sizeof(key)); memset(&key, 0, sizeof(key)); } static TDSRET tds7_send_auth(TDSSOCKET * tds, const unsigned char *challenge, uint32_t flags, const unsigned char *names_blob, int names_blob_len) { size_t current_pos; TDSANSWER answer; /* FIXME: stuff duplicate in tds7_send_login */ const char *domain; const char *user_name; const char *host_name; const char *p; char *convert_buffer; size_t user_name_len, host_name_len, domain_len; TDSRET rc; unsigned char *ntlm_v2_response = NULL; unsigned int ntlm_response_len = 24; const unsigned int lm_response_len = 24; TDSLOGIN *login = tds->login; /* check connection */ if (!login) return TDS_FAIL; /* parse a bit of config */ user_name = tds_dstr_cstr(&login->user_name); user_name_len = tds_dstr_len(&login->user_name); host_name = tds_dstr_cstr(&login->client_host_name); host_name_len = tds_dstr_len(&login->client_host_name); /* convert strings */ convert_buffer = tds_new(char, (user_name_len + host_name_len) * 2); if (!convert_buffer) return TDS_FAIL; user_name_len = convert_to_usc2le_string(tds, user_name, user_name_len, convert_buffer); user_name = convert_buffer; if (user_name_len != (size_t) -1) { host_name_len = convert_to_usc2le_string(tds, host_name, host_name_len, convert_buffer + user_name_len); host_name = convert_buffer + user_name_len; } if (user_name_len == (size_t) -1 || host_name_len == (size_t) -1) { free(convert_buffer); return TDS_FAIL; } /* parse domain\username */ p = user_name; for (;;) { if (p >= user_name + user_name_len) { free(convert_buffer); return TDS_FAIL; } if (p[0] == '\\' && p[1] == 0) break; p += 2; } domain = user_name; domain_len = p - user_name; user_name = p + 2; user_name_len = domain + user_name_len - user_name; rc = tds_answer_challenge(tds, login, challenge, &flags, names_blob, names_blob_len, &answer, &ntlm_v2_response); if (TDS_FAILED(rc)) { free(convert_buffer); return rc; } ntlm_response_len = ntlm_v2_response ? 16 + names_blob_len : 24; /* ntlm_response_len = 0; */ tds->out_flag = TDS7_AUTH; tds_put_n(tds, "NTLMSSP", 8); tds_put_int(tds, 3); /* sequence 3 */ current_pos = 64u + domain_len + user_name_len + host_name_len; /* LM/LMv2 Response */ tds_put_smallint(tds, lm_response_len); /* lan man resp length */ tds_put_smallint(tds, lm_response_len); /* lan man resp length */ TDS_PUT_INT(tds, current_pos); /* resp offset */ current_pos += lm_response_len; /* NTLM/NTLMv2 Response */ tds_put_smallint(tds, ntlm_response_len); /* nt resp length */ tds_put_smallint(tds, ntlm_response_len); /* nt resp length */ TDS_PUT_INT(tds, current_pos); /* nt resp offset */ current_pos = 64; /* Target Name - domain or server name */ TDS_PUT_SMALLINT(tds, domain_len); TDS_PUT_SMALLINT(tds, domain_len); TDS_PUT_INT(tds, current_pos); current_pos += domain_len; /* username */ TDS_PUT_SMALLINT(tds, user_name_len); TDS_PUT_SMALLINT(tds, user_name_len); TDS_PUT_INT(tds, current_pos); current_pos += user_name_len; /* Workstation Name */ TDS_PUT_SMALLINT(tds, host_name_len); TDS_PUT_SMALLINT(tds, host_name_len); TDS_PUT_INT(tds, current_pos); current_pos += host_name_len; /* Session Key (optional) */ tds_put_smallint(tds, 0); tds_put_smallint(tds, 0); TDS_PUT_INT(tds, current_pos + lm_response_len + ntlm_response_len); /* flags */ /* "challenge" is 8 bytes long */ /* tds_answer_challenge(tds_dstr_cstr(&login->password), challenge, &flags, &answer); */ tds_put_int(tds, flags); /* OS Version Structure (Optional) */ /* Data itself */ tds_put_n(tds, domain, domain_len); tds_put_n(tds, user_name, user_name_len); tds_put_n(tds, host_name, host_name_len); /* data block */ tds_put_n(tds, answer.lm_resp, lm_response_len); if (ntlm_v2_response == NULL) { /* NTLMv1 */ tds_put_n(tds, answer.nt_resp, ntlm_response_len); } else { /* NTLMv2 */ tds_put_n(tds, ntlm_v2_response, ntlm_response_len); memset(ntlm_v2_response, 0, ntlm_response_len); free(ntlm_v2_response); } /* for security reason clear structure */ memset(&answer, 0, sizeof(TDSANSWER)); free(convert_buffer); return tds_flush_packet(tds); } typedef struct tds_ntlm_auth { TDSAUTHENTICATION tds_auth; } TDSNTLMAUTH; static TDSRET tds_ntlm_free(TDSCONNECTION * conn, TDSAUTHENTICATION * tds_auth) { TDSNTLMAUTH *auth = (TDSNTLMAUTH *) tds_auth; free(auth->tds_auth.packet); free(auth); return TDS_SUCCESS; } static const unsigned char ntlm_id[] = "NTLMSSP"; /** * put a 8 byte filetime from a time_t * This takes GMT as input */ static void unix_to_nt_time(uint64_t * nt, struct timeval *tv) { /* C time start on 1970, nt time on 1600 */ #define TIME_FIXUP_CONSTANT (((uint64_t) 134774U) * 86400U) uint64_t t2; t2 = tv->tv_sec; t2 += TIME_FIXUP_CONSTANT; t2 *= 1000u * 1000u * 10u; t2 += tv->tv_usec * 10u; *nt = t2; } static void fill_names_blob_prefix(names_blob_prefix_t * prefix) { struct timeval tv; uint64_t nttime = 0; gettimeofday(&tv, NULL); unix_to_nt_time(&nttime, &tv); prefix->response_type = 0x01; prefix->max_response_type = 0x01; prefix->reserved1 = 0x0000; prefix->reserved2 = 0x00000000; #ifdef WORDS_BIGENDIAN tds_swap_bytes(&nttime, 8); #endif prefix->timestamp = nttime; tds_random_buffer(prefix->challenge, sizeof(prefix->challenge)); prefix->unknown = 0x00000000; } static TDSRET tds_ntlm_handle_next(TDSSOCKET * tds, struct tds_authentication * auth, size_t len) { const int length = (int)len; unsigned char nonce[8]; uint32_t flags; int where; int data_block_offset; int names_blob_len = 0; unsigned char *names_blob = NULL; TDSRET rc; /* at least 32 bytes (till context) */ if (len < 32) return TDS_FAIL; tds_get_n(tds, nonce, 8); /* NTLMSSP\0 */ if (memcmp(nonce, ntlm_id, 8) != 0) return TDS_FAIL; if (tds_get_int(tds) != 2) /* sequence -> 2 */ return TDS_FAIL; tds_get_smallint(tds); /* domain len */ tds_get_smallint(tds); /* domain len */ data_block_offset = tds_get_int(tds); /* domain offset */ flags = tds_get_int(tds); /* flags */ tds_get_n(tds, nonce, 8); tdsdump_dump_buf(TDS_DBG_INFO1, "TDS_AUTH_TOKEN nonce", nonce, 8); where = 32; /*data_block_offset == 32 */ /* Version 1 -- The Context, Target Information, and OS Version structure are all omitted */ if (data_block_offset >= 48 && where + 16 <= length) { int target_info_len, target_info_offset; /* Version 2 -- The Context and Target Information fields are present, but the OS Version structure is not. */ tds_get_n(tds, NULL, 8); /* Context (two consecutive longs) */ target_info_len = tds_get_smallint(tds); /* Target Information len */ target_info_len = tds_get_smallint(tds); /* Target Information len */ target_info_offset = tds_get_int(tds); /* Target Information offset */ where += 16; if (data_block_offset >= 56 && where + 8 <= length) { /* Version 3 -- The Context, Target Information, and OS Version structure are all present. */ tds_get_n(tds, NULL, 8); /* OS Version Structure */ #if 0 /* if we have a version server handle NTLMv2 */ if (target_info_len > 0) flags &= ~0x80000; #endif where += 8; } /* read Target Info if possible */ if (target_info_len > 0 && target_info_offset >= where && target_info_offset + target_info_len <= length) { tds_get_n(tds, NULL, target_info_offset - where); where = target_info_offset; /* * the + 4 came from blob structure, after Target Info 4 * additional reserved bytes must be present * Search "davenport port" * (currently http://davenport.sourceforge.net/ntlm.html) */ names_blob_len = TDS_OFFSET(names_blob_prefix_t, target_info) + target_info_len + 4; /* read Target Info */ names_blob = tds_new0(unsigned char, names_blob_len); if (!names_blob) return TDS_FAIL; fill_names_blob_prefix((names_blob_prefix_t *) names_blob); tds_get_n(tds, names_blob + TDS_OFFSET(names_blob_prefix_t, target_info), target_info_len); where += target_info_len; } } /* discard anything left */ tds_get_n(tds, NULL, length - where); tdsdump_log(TDS_DBG_INFO1, "Draining %d bytes\n", (int) (len - where)); rc = tds7_send_auth(tds, nonce, flags, names_blob, names_blob_len); free(names_blob); return rc; } /** * Build a NTLMSPP packet to send to server * @param tds A pointer to the TDSSOCKET structure managing a client/server operation. * @return authentication info */ TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET * tds) { const char *domain; const char *user_name; const char *p; uint8_t *packet; int host_name_len; int domain_len; int auth_len; struct tds_ntlm_auth *auth; if (!tds->login) return NULL; user_name = tds_dstr_cstr(&tds->login->user_name); host_name_len = (int)tds_dstr_len(&tds->login->client_host_name); /* check override of domain */ if ((p = strchr(user_name, '\\')) == NULL) return NULL; domain = user_name; domain_len = (int)(p - user_name); auth = tds_new0(struct tds_ntlm_auth, 1); if (!auth) return NULL; auth->tds_auth.free = tds_ntlm_free; auth->tds_auth.handle_next = tds_ntlm_handle_next; auth->tds_auth.packet_len = auth_len = 40 + host_name_len + domain_len; auth->tds_auth.packet = packet = tds_new(uint8_t, auth_len); if (!packet) { free(auth); return NULL; } /* built NTLMSSP authentication packet */ memcpy(packet, ntlm_id, 8); /* sequence 1 client -> server */ TDS_PUT_A4(packet + 8, TDS_HOST4LE(1)); /* flags */ TDS_PUT_A4(packet + 12, TDS_HOST4LE(0x08b201)); /* domain info */ TDS_PUT_A2LE(packet + 16, domain_len); TDS_PUT_A2LE(packet + 18, domain_len); TDS_PUT_A4LE(packet + 20, 40 + host_name_len); /* hostname info */ TDS_PUT_A2LE(packet + 24, host_name_len); TDS_PUT_A2LE(packet + 26, host_name_len); TDS_PUT_A4 (packet + 28, TDS_HOST4LE(40)); /* * here XP put version like 05 01 28 0a (5.1.2600), * similar to GetVersion result * and some unknown bytes like 00 00 00 0f */ TDS_PUT_A4(packet + 32, TDS_HOST4LE(0x0a280105)); TDS_PUT_A4(packet + 36, TDS_HOST4LE(0x0f000000)); /* hostname and domain */ memcpy(packet + 40, tds_dstr_cstr(&tds->login->client_host_name), host_name_len); memcpy(packet + 40 + host_name_len, domain, domain_len); return (TDSAUTHENTICATION *) auth; } /** @} */ freetds-1.3.6/src/tds/CMakeLists.txt000644 025423 025423 00000006007 14056414222 020727 0ustar00fredianofrediano000000 000000 add_subdirectory(unittests) if(PERL_FOUND AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tds_willconvert.h") if (NOT GPERF) message(FATAL_ERROR "gperf not found!") endif() # get name of null device set(NULLNAME "/dev/null") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(NULLNAME "NUL:") endif(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(ENC_SOURCE_DIR "${CMAKE_SOURCE_DIR}/include/freetds") add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/tds_willconvert.h" COMMAND ${PERL_EXECUTABLE} tds_willconvert.pl ../../include/freetds/proto.h > "${CMAKE_CURRENT_BINARY_DIR}/tds_willconvert.h" MAIN_DEPENDENCY tds_willconvert.pl WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/include/freetds/encodings.h" COMMAND ${PERL_EXECUTABLE} "${ENC_SOURCE_DIR}/encodings.pl" "${ENC_SOURCE_DIR}" ${GPERF} > encodings.h 2> ${NULLNAME} MAIN_DEPENDENCY "${ENC_SOURCE_DIR}/encodings.pl" DEPENDS "${ENC_SOURCE_DIR}/alternative_character_sets.h" "${ENC_SOURCE_DIR}/character_sets.h" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/include/freetds") add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/num_limits.h" COMMAND ${PERL_EXECUTABLE} num_limits.pl > "${CMAKE_CURRENT_BINARY_DIR}/num_limits.h" MAIN_DEPENDENCY num_limits.pl WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/tds_types.h" COMMAND ${PERL_EXECUTABLE} types.pl ../../misc/types.csv ../../include/freetds/proto.h > "${CMAKE_CURRENT_BINARY_DIR}/tds_types.h" MAIN_DEPENDENCY types.pl DEPENDS ../../misc/types.csv ../../include/freetds/proto.h WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) add_custom_target(encodings_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/tds_willconvert.h" "${CMAKE_CURRENT_BINARY_DIR}/num_limits.h" "${CMAKE_CURRENT_BINARY_DIR}/tds_types.h" "${CMAKE_BINARY_DIR}/include/freetds/encodings.h") else(PERL_FOUND AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tds_willconvert.h") add_custom_target(encodings_h DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tds_willconvert.h" "${CMAKE_CURRENT_SOURCE_DIR}/num_limits.h" "${CMAKE_CURRENT_SOURCE_DIR}/tds_types.h" "${CMAKE_SOURCE_DIR}/include/freetds/encodings.h") endif(PERL_FOUND AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tds_willconvert.h") if(WIN32) set(add_SRCS sspi.c) else(WIN32) set(add_SRCS challenge.c) endif(WIN32) add_library(tds STATIC mem.c token.c util.c login.c read.c write.c convert.c numeric.c config.c query.c iconv.c locale.c vstrbuild.c getmac.c data.c net.c tls.c tds_checks.c log.c bulk.c packet.c stream.c random.c sec_negotiate_gnutls.h sec_negotiate_openssl.h sec_negotiate.c gssapi.c ${add_SRCS} ) target_include_directories(tds PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") add_dependencies(tds encodings_h) if (NOT WIN32) set_target_properties(tds PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() if(WIN32) INSTALL(TARGETS tds PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) endif(WIN32) freetds-1.3.6/src/tds/unittests/000755 025423 025423 00000000000 14162303405 020224 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/tds/unittests/Makefile.am000644 025423 025423 00000003774 14107141721 022273 0ustar00fredianofrediano000000 000000 NULL= TESTS = \ t0001$(EXEEXT) \ t0002$(EXEEXT) \ t0003$(EXEEXT) \ t0004$(EXEEXT) \ t0005$(EXEEXT) \ t0006$(EXEEXT) \ t0007$(EXEEXT) \ t0008$(EXEEXT) \ dynamic1$(EXEEXT) \ convert$(EXEEXT) \ dataread$(EXEEXT) \ utf8_1$(EXEEXT) \ utf8_2$(EXEEXT) \ utf8_3$(EXEEXT) \ numeric$(EXEEXT) \ iconv_fread$(EXEEXT) \ toodynamic$(EXEEXT) \ readconf$(EXEEXT) \ charconv$(EXEEXT) \ nulls$(EXEEXT) \ corrupt$(EXEEXT) \ declarations$(EXEEXT) \ portconf$(EXEEXT) \ parsing$(EXEEXT) \ freeze$(EXEEXT) \ strftime$(EXEEXT) \ log_elision$(EXEEXT) \ $(NULL) # flags test commented, not necessary for 0.62 # TODO add flags test again when needed check_PROGRAMS = $(TESTS) t0001_SOURCES = t0001.c t0002_SOURCES = t0002.c t0003_SOURCES = t0003.c t0004_SOURCES = t0004.c t0005_SOURCES = t0005.c t0006_SOURCES = t0006.c t0007_SOURCES = t0007.c t0008_SOURCES = t0008.c dynamic1_SOURCES = dynamic1.c convert_SOURCES = convert.c dataread_SOURCES = dataread.c # flags_SOURCES = flags.c utf8_1_SOURCES = utf8_1.c utf8_2_SOURCES = utf8_2.c utf8_3_SOURCES = utf8_3.c if ENABLE_DEVELOPING noinst_PROGRAMS = collations collations_SOURCES = collations.c endif numeric_SOURCES = numeric.c iconv_fread_SOURCES = iconv_fread.c charconv_SOURCES = charconv.c toodynamic_SOURCES = toodynamic.c nulls_SOURCES = nulls.c readconf_SOURCES = readconf.c readconf.in corrupt_SOURCES = corrupt.c declarations_SOURCES = declarations.c portconf_SOURCES = portconf.c portconf.in parsing_SOURCES = parsing.c freeze_SOURCES = freeze.c strftime_SOURCES = strftime.c log_elision_SOURCES = log_elision.c noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h utf8.c allcolumns.c AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir)/.. -I../ -DFREETDS_TOPDIR=\"$(top_srcdir)\" if MINGW32 AM_LDFLAGS = -no-fast-install else AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" endif LDADD = libcommon.a ../libtds.la ../../replacements/libreplacements.la $(LTLIBICONV) $(NETWORK_LIBS) CLEANFILES = tdsdump.out EXTRA_DIST = CMakeLists.txt freetds-1.3.6/src/tds/unittests/Makefile.in000644 025423 025423 00000173511 14162303357 022307 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ TESTS = t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT) t0004$(EXEEXT) \ t0005$(EXEEXT) t0006$(EXEEXT) t0007$(EXEEXT) t0008$(EXEEXT) \ dynamic1$(EXEEXT) convert$(EXEEXT) dataread$(EXEEXT) \ utf8_1$(EXEEXT) utf8_2$(EXEEXT) utf8_3$(EXEEXT) \ numeric$(EXEEXT) iconv_fread$(EXEEXT) toodynamic$(EXEEXT) \ readconf$(EXEEXT) charconv$(EXEEXT) nulls$(EXEEXT) \ corrupt$(EXEEXT) declarations$(EXEEXT) portconf$(EXEEXT) \ parsing$(EXEEXT) freeze$(EXEEXT) strftime$(EXEEXT) \ log_elision$(EXEEXT) $(am__EXEEXT_1) check_PROGRAMS = $(am__EXEEXT_2) @ENABLE_DEVELOPING_TRUE@noinst_PROGRAMS = collations$(EXEEXT) subdir = src/tds/unittests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = am__EXEEXT_2 = t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT) \ t0004$(EXEEXT) t0005$(EXEEXT) t0006$(EXEEXT) t0007$(EXEEXT) \ t0008$(EXEEXT) dynamic1$(EXEEXT) convert$(EXEEXT) \ dataread$(EXEEXT) utf8_1$(EXEEXT) utf8_2$(EXEEXT) \ utf8_3$(EXEEXT) numeric$(EXEEXT) iconv_fread$(EXEEXT) \ toodynamic$(EXEEXT) readconf$(EXEEXT) charconv$(EXEEXT) \ nulls$(EXEEXT) corrupt$(EXEEXT) declarations$(EXEEXT) \ portconf$(EXEEXT) parsing$(EXEEXT) freeze$(EXEEXT) \ strftime$(EXEEXT) log_elision$(EXEEXT) $(am__EXEEXT_1) PROGRAMS = $(noinst_PROGRAMS) LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libcommon_a_AR = $(AR) $(ARFLAGS) libcommon_a_LIBADD = am_libcommon_a_OBJECTS = common.$(OBJEXT) utf8.$(OBJEXT) \ allcolumns.$(OBJEXT) libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) am_charconv_OBJECTS = charconv.$(OBJEXT) charconv_OBJECTS = $(am_charconv_OBJECTS) charconv_LDADD = $(LDADD) am__DEPENDENCIES_1 = charconv_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__collations_SOURCES_DIST = collations.c @ENABLE_DEVELOPING_TRUE@am_collations_OBJECTS = collations.$(OBJEXT) collations_OBJECTS = $(am_collations_OBJECTS) collations_LDADD = $(LDADD) collations_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_convert_OBJECTS = convert.$(OBJEXT) convert_OBJECTS = $(am_convert_OBJECTS) convert_LDADD = $(LDADD) convert_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_corrupt_OBJECTS = corrupt.$(OBJEXT) corrupt_OBJECTS = $(am_corrupt_OBJECTS) corrupt_LDADD = $(LDADD) corrupt_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_dataread_OBJECTS = dataread.$(OBJEXT) dataread_OBJECTS = $(am_dataread_OBJECTS) dataread_LDADD = $(LDADD) dataread_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_declarations_OBJECTS = declarations.$(OBJEXT) declarations_OBJECTS = $(am_declarations_OBJECTS) declarations_LDADD = $(LDADD) declarations_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_dynamic1_OBJECTS = dynamic1.$(OBJEXT) dynamic1_OBJECTS = $(am_dynamic1_OBJECTS) dynamic1_LDADD = $(LDADD) dynamic1_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_freeze_OBJECTS = freeze.$(OBJEXT) freeze_OBJECTS = $(am_freeze_OBJECTS) freeze_LDADD = $(LDADD) freeze_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_iconv_fread_OBJECTS = iconv_fread.$(OBJEXT) iconv_fread_OBJECTS = $(am_iconv_fread_OBJECTS) iconv_fread_LDADD = $(LDADD) iconv_fread_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_log_elision_OBJECTS = log_elision.$(OBJEXT) log_elision_OBJECTS = $(am_log_elision_OBJECTS) log_elision_LDADD = $(LDADD) log_elision_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_nulls_OBJECTS = nulls.$(OBJEXT) nulls_OBJECTS = $(am_nulls_OBJECTS) nulls_LDADD = $(LDADD) nulls_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_numeric_OBJECTS = numeric.$(OBJEXT) numeric_OBJECTS = $(am_numeric_OBJECTS) numeric_LDADD = $(LDADD) numeric_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_parsing_OBJECTS = parsing.$(OBJEXT) parsing_OBJECTS = $(am_parsing_OBJECTS) parsing_LDADD = $(LDADD) parsing_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_portconf_OBJECTS = portconf.$(OBJEXT) portconf_OBJECTS = $(am_portconf_OBJECTS) portconf_LDADD = $(LDADD) portconf_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_readconf_OBJECTS = readconf.$(OBJEXT) readconf_OBJECTS = $(am_readconf_OBJECTS) readconf_LDADD = $(LDADD) readconf_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_strftime_OBJECTS = strftime.$(OBJEXT) strftime_OBJECTS = $(am_strftime_OBJECTS) strftime_LDADD = $(LDADD) strftime_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0001_OBJECTS = t0001.$(OBJEXT) t0001_OBJECTS = $(am_t0001_OBJECTS) t0001_LDADD = $(LDADD) t0001_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0002_OBJECTS = t0002.$(OBJEXT) t0002_OBJECTS = $(am_t0002_OBJECTS) t0002_LDADD = $(LDADD) t0002_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0003_OBJECTS = t0003.$(OBJEXT) t0003_OBJECTS = $(am_t0003_OBJECTS) t0003_LDADD = $(LDADD) t0003_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0004_OBJECTS = t0004.$(OBJEXT) t0004_OBJECTS = $(am_t0004_OBJECTS) t0004_LDADD = $(LDADD) t0004_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0005_OBJECTS = t0005.$(OBJEXT) t0005_OBJECTS = $(am_t0005_OBJECTS) t0005_LDADD = $(LDADD) t0005_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0006_OBJECTS = t0006.$(OBJEXT) t0006_OBJECTS = $(am_t0006_OBJECTS) t0006_LDADD = $(LDADD) t0006_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0007_OBJECTS = t0007.$(OBJEXT) t0007_OBJECTS = $(am_t0007_OBJECTS) t0007_LDADD = $(LDADD) t0007_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_t0008_OBJECTS = t0008.$(OBJEXT) t0008_OBJECTS = $(am_t0008_OBJECTS) t0008_LDADD = $(LDADD) t0008_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_toodynamic_OBJECTS = toodynamic.$(OBJEXT) toodynamic_OBJECTS = $(am_toodynamic_OBJECTS) toodynamic_LDADD = $(LDADD) toodynamic_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_utf8_1_OBJECTS = utf8_1.$(OBJEXT) utf8_1_OBJECTS = $(am_utf8_1_OBJECTS) utf8_1_LDADD = $(LDADD) utf8_1_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_utf8_2_OBJECTS = utf8_2.$(OBJEXT) utf8_2_OBJECTS = $(am_utf8_2_OBJECTS) utf8_2_LDADD = $(LDADD) utf8_2_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_utf8_3_OBJECTS = utf8_3.$(OBJEXT) utf8_3_OBJECTS = $(am_utf8_3_OBJECTS) utf8_3_LDADD = $(LDADD) utf8_3_DEPENDENCIES = libcommon.a ../libtds.la \ ../../replacements/libreplacements.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/allcolumns.Po \ ./$(DEPDIR)/charconv.Po ./$(DEPDIR)/collations.Po \ ./$(DEPDIR)/common.Po ./$(DEPDIR)/convert.Po \ ./$(DEPDIR)/corrupt.Po ./$(DEPDIR)/dataread.Po \ ./$(DEPDIR)/declarations.Po ./$(DEPDIR)/dynamic1.Po \ ./$(DEPDIR)/freeze.Po ./$(DEPDIR)/iconv_fread.Po \ ./$(DEPDIR)/log_elision.Po ./$(DEPDIR)/nulls.Po \ ./$(DEPDIR)/numeric.Po ./$(DEPDIR)/parsing.Po \ ./$(DEPDIR)/portconf.Po ./$(DEPDIR)/readconf.Po \ ./$(DEPDIR)/strftime.Po ./$(DEPDIR)/t0001.Po \ ./$(DEPDIR)/t0002.Po ./$(DEPDIR)/t0003.Po ./$(DEPDIR)/t0004.Po \ ./$(DEPDIR)/t0005.Po ./$(DEPDIR)/t0006.Po ./$(DEPDIR)/t0007.Po \ ./$(DEPDIR)/t0008.Po ./$(DEPDIR)/toodynamic.Po \ ./$(DEPDIR)/utf8.Po ./$(DEPDIR)/utf8_1.Po \ ./$(DEPDIR)/utf8_2.Po ./$(DEPDIR)/utf8_3.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libcommon_a_SOURCES) $(charconv_SOURCES) \ $(collations_SOURCES) $(convert_SOURCES) $(corrupt_SOURCES) \ $(dataread_SOURCES) $(declarations_SOURCES) \ $(dynamic1_SOURCES) $(freeze_SOURCES) $(iconv_fread_SOURCES) \ $(log_elision_SOURCES) $(nulls_SOURCES) $(numeric_SOURCES) \ $(parsing_SOURCES) $(portconf_SOURCES) $(readconf_SOURCES) \ $(strftime_SOURCES) $(t0001_SOURCES) $(t0002_SOURCES) \ $(t0003_SOURCES) $(t0004_SOURCES) $(t0005_SOURCES) \ $(t0006_SOURCES) $(t0007_SOURCES) $(t0008_SOURCES) \ $(toodynamic_SOURCES) $(utf8_1_SOURCES) $(utf8_2_SOURCES) \ $(utf8_3_SOURCES) DIST_SOURCES = $(libcommon_a_SOURCES) $(charconv_SOURCES) \ $(am__collations_SOURCES_DIST) $(convert_SOURCES) \ $(corrupt_SOURCES) $(dataread_SOURCES) $(declarations_SOURCES) \ $(dynamic1_SOURCES) $(freeze_SOURCES) $(iconv_fread_SOURCES) \ $(log_elision_SOURCES) $(nulls_SOURCES) $(numeric_SOURCES) \ $(parsing_SOURCES) $(portconf_SOURCES) $(readconf_SOURCES) \ $(strftime_SOURCES) $(t0001_SOURCES) $(t0002_SOURCES) \ $(t0003_SOURCES) $(t0004_SOURCES) $(t0005_SOURCES) \ $(t0006_SOURCES) $(t0007_SOURCES) $(t0008_SOURCES) \ $(toodynamic_SOURCES) $(utf8_1_SOURCES) $(utf8_2_SOURCES) \ $(utf8_3_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = t0001_SOURCES = t0001.c t0002_SOURCES = t0002.c t0003_SOURCES = t0003.c t0004_SOURCES = t0004.c t0005_SOURCES = t0005.c t0006_SOURCES = t0006.c t0007_SOURCES = t0007.c t0008_SOURCES = t0008.c dynamic1_SOURCES = dynamic1.c convert_SOURCES = convert.c dataread_SOURCES = dataread.c # flags_SOURCES = flags.c utf8_1_SOURCES = utf8_1.c utf8_2_SOURCES = utf8_2.c utf8_3_SOURCES = utf8_3.c @ENABLE_DEVELOPING_TRUE@collations_SOURCES = collations.c numeric_SOURCES = numeric.c iconv_fread_SOURCES = iconv_fread.c charconv_SOURCES = charconv.c toodynamic_SOURCES = toodynamic.c nulls_SOURCES = nulls.c readconf_SOURCES = readconf.c readconf.in corrupt_SOURCES = corrupt.c declarations_SOURCES = declarations.c portconf_SOURCES = portconf.c portconf.in parsing_SOURCES = parsing.c freeze_SOURCES = freeze.c strftime_SOURCES = strftime.c log_elision_SOURCES = log_elision.c noinst_LIBRARIES = libcommon.a libcommon_a_SOURCES = common.c common.h utf8.c allcolumns.c AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir)/.. -I../ -DFREETDS_TOPDIR=\"$(top_srcdir)\" @MINGW32_FALSE@AM_LDFLAGS = -no-install -L../.libs -R "$(abs_builddir)/../.libs" @MINGW32_TRUE@AM_LDFLAGS = -no-fast-install LDADD = libcommon.a ../libtds.la ../../replacements/libreplacements.la $(LTLIBICONV) $(NETWORK_LIBS) CLEANFILES = tdsdump.out EXTRA_DIST = CMakeLists.txt all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/tds/unittests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/tds/unittests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) $(EXTRA_libcommon_a_DEPENDENCIES) $(AM_V_at)-rm -f libcommon.a $(AM_V_AR)$(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) $(AM_V_at)$(RANLIB) libcommon.a charconv$(EXEEXT): $(charconv_OBJECTS) $(charconv_DEPENDENCIES) $(EXTRA_charconv_DEPENDENCIES) @rm -f charconv$(EXEEXT) $(AM_V_CCLD)$(LINK) $(charconv_OBJECTS) $(charconv_LDADD) $(LIBS) collations$(EXEEXT): $(collations_OBJECTS) $(collations_DEPENDENCIES) $(EXTRA_collations_DEPENDENCIES) @rm -f collations$(EXEEXT) $(AM_V_CCLD)$(LINK) $(collations_OBJECTS) $(collations_LDADD) $(LIBS) convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES) $(EXTRA_convert_DEPENDENCIES) @rm -f convert$(EXEEXT) $(AM_V_CCLD)$(LINK) $(convert_OBJECTS) $(convert_LDADD) $(LIBS) corrupt$(EXEEXT): $(corrupt_OBJECTS) $(corrupt_DEPENDENCIES) $(EXTRA_corrupt_DEPENDENCIES) @rm -f corrupt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(corrupt_OBJECTS) $(corrupt_LDADD) $(LIBS) dataread$(EXEEXT): $(dataread_OBJECTS) $(dataread_DEPENDENCIES) $(EXTRA_dataread_DEPENDENCIES) @rm -f dataread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dataread_OBJECTS) $(dataread_LDADD) $(LIBS) declarations$(EXEEXT): $(declarations_OBJECTS) $(declarations_DEPENDENCIES) $(EXTRA_declarations_DEPENDENCIES) @rm -f declarations$(EXEEXT) $(AM_V_CCLD)$(LINK) $(declarations_OBJECTS) $(declarations_LDADD) $(LIBS) dynamic1$(EXEEXT): $(dynamic1_OBJECTS) $(dynamic1_DEPENDENCIES) $(EXTRA_dynamic1_DEPENDENCIES) @rm -f dynamic1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dynamic1_OBJECTS) $(dynamic1_LDADD) $(LIBS) freeze$(EXEEXT): $(freeze_OBJECTS) $(freeze_DEPENDENCIES) $(EXTRA_freeze_DEPENDENCIES) @rm -f freeze$(EXEEXT) $(AM_V_CCLD)$(LINK) $(freeze_OBJECTS) $(freeze_LDADD) $(LIBS) iconv_fread$(EXEEXT): $(iconv_fread_OBJECTS) $(iconv_fread_DEPENDENCIES) $(EXTRA_iconv_fread_DEPENDENCIES) @rm -f iconv_fread$(EXEEXT) $(AM_V_CCLD)$(LINK) $(iconv_fread_OBJECTS) $(iconv_fread_LDADD) $(LIBS) log_elision$(EXEEXT): $(log_elision_OBJECTS) $(log_elision_DEPENDENCIES) $(EXTRA_log_elision_DEPENDENCIES) @rm -f log_elision$(EXEEXT) $(AM_V_CCLD)$(LINK) $(log_elision_OBJECTS) $(log_elision_LDADD) $(LIBS) nulls$(EXEEXT): $(nulls_OBJECTS) $(nulls_DEPENDENCIES) $(EXTRA_nulls_DEPENDENCIES) @rm -f nulls$(EXEEXT) $(AM_V_CCLD)$(LINK) $(nulls_OBJECTS) $(nulls_LDADD) $(LIBS) numeric$(EXEEXT): $(numeric_OBJECTS) $(numeric_DEPENDENCIES) $(EXTRA_numeric_DEPENDENCIES) @rm -f numeric$(EXEEXT) $(AM_V_CCLD)$(LINK) $(numeric_OBJECTS) $(numeric_LDADD) $(LIBS) parsing$(EXEEXT): $(parsing_OBJECTS) $(parsing_DEPENDENCIES) $(EXTRA_parsing_DEPENDENCIES) @rm -f parsing$(EXEEXT) $(AM_V_CCLD)$(LINK) $(parsing_OBJECTS) $(parsing_LDADD) $(LIBS) portconf$(EXEEXT): $(portconf_OBJECTS) $(portconf_DEPENDENCIES) $(EXTRA_portconf_DEPENDENCIES) @rm -f portconf$(EXEEXT) $(AM_V_CCLD)$(LINK) $(portconf_OBJECTS) $(portconf_LDADD) $(LIBS) readconf$(EXEEXT): $(readconf_OBJECTS) $(readconf_DEPENDENCIES) $(EXTRA_readconf_DEPENDENCIES) @rm -f readconf$(EXEEXT) $(AM_V_CCLD)$(LINK) $(readconf_OBJECTS) $(readconf_LDADD) $(LIBS) strftime$(EXEEXT): $(strftime_OBJECTS) $(strftime_DEPENDENCIES) $(EXTRA_strftime_DEPENDENCIES) @rm -f strftime$(EXEEXT) $(AM_V_CCLD)$(LINK) $(strftime_OBJECTS) $(strftime_LDADD) $(LIBS) t0001$(EXEEXT): $(t0001_OBJECTS) $(t0001_DEPENDENCIES) $(EXTRA_t0001_DEPENDENCIES) @rm -f t0001$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0001_OBJECTS) $(t0001_LDADD) $(LIBS) t0002$(EXEEXT): $(t0002_OBJECTS) $(t0002_DEPENDENCIES) $(EXTRA_t0002_DEPENDENCIES) @rm -f t0002$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0002_OBJECTS) $(t0002_LDADD) $(LIBS) t0003$(EXEEXT): $(t0003_OBJECTS) $(t0003_DEPENDENCIES) $(EXTRA_t0003_DEPENDENCIES) @rm -f t0003$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0003_OBJECTS) $(t0003_LDADD) $(LIBS) t0004$(EXEEXT): $(t0004_OBJECTS) $(t0004_DEPENDENCIES) $(EXTRA_t0004_DEPENDENCIES) @rm -f t0004$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0004_OBJECTS) $(t0004_LDADD) $(LIBS) t0005$(EXEEXT): $(t0005_OBJECTS) $(t0005_DEPENDENCIES) $(EXTRA_t0005_DEPENDENCIES) @rm -f t0005$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0005_OBJECTS) $(t0005_LDADD) $(LIBS) t0006$(EXEEXT): $(t0006_OBJECTS) $(t0006_DEPENDENCIES) $(EXTRA_t0006_DEPENDENCIES) @rm -f t0006$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0006_OBJECTS) $(t0006_LDADD) $(LIBS) t0007$(EXEEXT): $(t0007_OBJECTS) $(t0007_DEPENDENCIES) $(EXTRA_t0007_DEPENDENCIES) @rm -f t0007$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0007_OBJECTS) $(t0007_LDADD) $(LIBS) t0008$(EXEEXT): $(t0008_OBJECTS) $(t0008_DEPENDENCIES) $(EXTRA_t0008_DEPENDENCIES) @rm -f t0008$(EXEEXT) $(AM_V_CCLD)$(LINK) $(t0008_OBJECTS) $(t0008_LDADD) $(LIBS) toodynamic$(EXEEXT): $(toodynamic_OBJECTS) $(toodynamic_DEPENDENCIES) $(EXTRA_toodynamic_DEPENDENCIES) @rm -f toodynamic$(EXEEXT) $(AM_V_CCLD)$(LINK) $(toodynamic_OBJECTS) $(toodynamic_LDADD) $(LIBS) utf8_1$(EXEEXT): $(utf8_1_OBJECTS) $(utf8_1_DEPENDENCIES) $(EXTRA_utf8_1_DEPENDENCIES) @rm -f utf8_1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(utf8_1_OBJECTS) $(utf8_1_LDADD) $(LIBS) utf8_2$(EXEEXT): $(utf8_2_OBJECTS) $(utf8_2_DEPENDENCIES) $(EXTRA_utf8_2_DEPENDENCIES) @rm -f utf8_2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(utf8_2_OBJECTS) $(utf8_2_LDADD) $(LIBS) utf8_3$(EXEEXT): $(utf8_3_OBJECTS) $(utf8_3_DEPENDENCIES) $(EXTRA_utf8_3_DEPENDENCIES) @rm -f utf8_3$(EXEEXT) $(AM_V_CCLD)$(LINK) $(utf8_3_OBJECTS) $(utf8_3_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allcolumns.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/charconv.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collations.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/corrupt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dataread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/declarations.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynamic1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/freeze.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconv_fread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_elision.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nulls.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/numeric.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsing.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/portconf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readconf.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0001.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0002.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0003.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0004.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0005.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0006.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0007.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t0008.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toodynamic.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_3.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? t0001.log: t0001$(EXEEXT) @p='t0001$(EXEEXT)'; \ b='t0001'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0002.log: t0002$(EXEEXT) @p='t0002$(EXEEXT)'; \ b='t0002'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0003.log: t0003$(EXEEXT) @p='t0003$(EXEEXT)'; \ b='t0003'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0004.log: t0004$(EXEEXT) @p='t0004$(EXEEXT)'; \ b='t0004'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0005.log: t0005$(EXEEXT) @p='t0005$(EXEEXT)'; \ b='t0005'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0006.log: t0006$(EXEEXT) @p='t0006$(EXEEXT)'; \ b='t0006'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0007.log: t0007$(EXEEXT) @p='t0007$(EXEEXT)'; \ b='t0007'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) t0008.log: t0008$(EXEEXT) @p='t0008$(EXEEXT)'; \ b='t0008'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dynamic1.log: dynamic1$(EXEEXT) @p='dynamic1$(EXEEXT)'; \ b='dynamic1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) convert.log: convert$(EXEEXT) @p='convert$(EXEEXT)'; \ b='convert'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dataread.log: dataread$(EXEEXT) @p='dataread$(EXEEXT)'; \ b='dataread'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8_1.log: utf8_1$(EXEEXT) @p='utf8_1$(EXEEXT)'; \ b='utf8_1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8_2.log: utf8_2$(EXEEXT) @p='utf8_2$(EXEEXT)'; \ b='utf8_2'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) utf8_3.log: utf8_3$(EXEEXT) @p='utf8_3$(EXEEXT)'; \ b='utf8_3'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) numeric.log: numeric$(EXEEXT) @p='numeric$(EXEEXT)'; \ b='numeric'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) iconv_fread.log: iconv_fread$(EXEEXT) @p='iconv_fread$(EXEEXT)'; \ b='iconv_fread'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) toodynamic.log: toodynamic$(EXEEXT) @p='toodynamic$(EXEEXT)'; \ b='toodynamic'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) readconf.log: readconf$(EXEEXT) @p='readconf$(EXEEXT)'; \ b='readconf'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) charconv.log: charconv$(EXEEXT) @p='charconv$(EXEEXT)'; \ b='charconv'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) nulls.log: nulls$(EXEEXT) @p='nulls$(EXEEXT)'; \ b='nulls'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) corrupt.log: corrupt$(EXEEXT) @p='corrupt$(EXEEXT)'; \ b='corrupt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) declarations.log: declarations$(EXEEXT) @p='declarations$(EXEEXT)'; \ b='declarations'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) portconf.log: portconf$(EXEEXT) @p='portconf$(EXEEXT)'; \ b='portconf'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) parsing.log: parsing$(EXEEXT) @p='parsing$(EXEEXT)'; \ b='parsing'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) freeze.log: freeze$(EXEEXT) @p='freeze$(EXEEXT)'; \ b='freeze'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) strftime.log: strftime$(EXEEXT) @p='strftime$(EXEEXT)'; \ b='strftime'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) log_elision.log: log_elision$(EXEEXT) @p='log_elision$(EXEEXT)'; \ b='log_elision'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/allcolumns.Po -rm -f ./$(DEPDIR)/charconv.Po -rm -f ./$(DEPDIR)/collations.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/convert.Po -rm -f ./$(DEPDIR)/corrupt.Po -rm -f ./$(DEPDIR)/dataread.Po -rm -f ./$(DEPDIR)/declarations.Po -rm -f ./$(DEPDIR)/dynamic1.Po -rm -f ./$(DEPDIR)/freeze.Po -rm -f ./$(DEPDIR)/iconv_fread.Po -rm -f ./$(DEPDIR)/log_elision.Po -rm -f ./$(DEPDIR)/nulls.Po -rm -f ./$(DEPDIR)/numeric.Po -rm -f ./$(DEPDIR)/parsing.Po -rm -f ./$(DEPDIR)/portconf.Po -rm -f ./$(DEPDIR)/readconf.Po -rm -f ./$(DEPDIR)/strftime.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/t0004.Po -rm -f ./$(DEPDIR)/t0005.Po -rm -f ./$(DEPDIR)/t0006.Po -rm -f ./$(DEPDIR)/t0007.Po -rm -f ./$(DEPDIR)/t0008.Po -rm -f ./$(DEPDIR)/toodynamic.Po -rm -f ./$(DEPDIR)/utf8.Po -rm -f ./$(DEPDIR)/utf8_1.Po -rm -f ./$(DEPDIR)/utf8_2.Po -rm -f ./$(DEPDIR)/utf8_3.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/allcolumns.Po -rm -f ./$(DEPDIR)/charconv.Po -rm -f ./$(DEPDIR)/collations.Po -rm -f ./$(DEPDIR)/common.Po -rm -f ./$(DEPDIR)/convert.Po -rm -f ./$(DEPDIR)/corrupt.Po -rm -f ./$(DEPDIR)/dataread.Po -rm -f ./$(DEPDIR)/declarations.Po -rm -f ./$(DEPDIR)/dynamic1.Po -rm -f ./$(DEPDIR)/freeze.Po -rm -f ./$(DEPDIR)/iconv_fread.Po -rm -f ./$(DEPDIR)/log_elision.Po -rm -f ./$(DEPDIR)/nulls.Po -rm -f ./$(DEPDIR)/numeric.Po -rm -f ./$(DEPDIR)/parsing.Po -rm -f ./$(DEPDIR)/portconf.Po -rm -f ./$(DEPDIR)/readconf.Po -rm -f ./$(DEPDIR)/strftime.Po -rm -f ./$(DEPDIR)/t0001.Po -rm -f ./$(DEPDIR)/t0002.Po -rm -f ./$(DEPDIR)/t0003.Po -rm -f ./$(DEPDIR)/t0004.Po -rm -f ./$(DEPDIR)/t0005.Po -rm -f ./$(DEPDIR)/t0006.Po -rm -f ./$(DEPDIR)/t0007.Po -rm -f ./$(DEPDIR)/t0008.Po -rm -f ./$(DEPDIR)/toodynamic.Po -rm -f ./$(DEPDIR)/utf8.Po -rm -f ./$(DEPDIR)/utf8_1.Po -rm -f ./$(DEPDIR)/utf8_2.Po -rm -f ./$(DEPDIR)/utf8_3.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/tds/unittests/common.c000644 025423 025423 00000007546 14056414271 021702 0ustar00fredianofrediano000000 000000 #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #include "common.h" #include char USER[512]; char SERVER[512]; char PASSWORD[512]; char DATABASE[512]; /* TODO use another default ?? */ char CHARSET[512] = "ISO-8859-1"; int read_login_info(void); int read_login_info(void) { FILE *in = NULL; char line[512]; char *s1, *s2; s1 = getenv("TDSPWDFILE"); if (s1 && s1[0]) in = fopen(s1, "r"); if (!in) in = fopen("../../../PWD", "r"); if (!in) { fprintf(stderr, "Can not open PWD file\n\n"); return TDS_FAIL; } while (fgets(line, 512, in)) { s1 = strtok(line, "="); s2 = strtok(NULL, "\n"); if (!s1 || !s2) { continue; } if (!strcmp(s1, "UID")) { strcpy(USER, s2); } else if (!strcmp(s1, "SRV")) { strcpy(SERVER, s2); } else if (!strcmp(s1, "PWD")) { strcpy(PASSWORD, s2); } else if (!strcmp(s1, "DB")) { strcpy(DATABASE, s2); } } fclose(in); return TDS_SUCCESS; } TDSCONTEXT *test_context = NULL; int try_tds_login(TDSLOGIN ** login, TDSSOCKET ** tds, const char *appname, int verbose) { TDSLOGIN *connection; char *appname_copy; if (verbose) { printf("Entered tds_try_login()\n"); } if (!login) { fprintf(stderr, "Invalid TDSLOGIN**\n"); return TDS_FAIL; } if (!tds) { fprintf(stderr, "Invalid TDSSOCKET**\n"); return TDS_FAIL; } if (verbose) { printf("Trying read_login_info()\n"); } read_login_info(); if (verbose) { printf("Setting login parameters\n"); } *login = tds_alloc_login(1); if (!*login) { fprintf(stderr, "tds_alloc_login() failed.\n"); return TDS_FAIL; } appname_copy = strdup(appname); if (!tds_set_passwd(*login, PASSWORD) || !tds_set_user(*login, USER) || !appname_copy || !tds_set_app(*login, basename(appname_copy)) || !tds_set_host(*login, "myhost") || !tds_set_library(*login, "TDS-Library") || !tds_set_server(*login, SERVER) || !tds_set_client_charset(*login, CHARSET) || !tds_set_language(*login, "us_english")) { free(appname_copy); fprintf(stderr, "tds_alloc_login() failed.\n"); return TDS_FAIL; } free(appname_copy); if (verbose) { printf("Connecting to database\n"); } test_context = tds_alloc_context(NULL); *tds = tds_alloc_socket(test_context, 512); tds_set_parent(*tds, NULL); connection = tds_read_config_info(*tds, *login, test_context->locale); if (!connection || tds_connect_and_login(*tds, connection) != TDS_SUCCESS) { if (connection) { tds_free_socket(*tds); *tds = NULL; tds_free_login(connection); } fprintf(stderr, "tds_connect_and_login() failed\n"); return TDS_FAIL; } tds_free_login(connection); return TDS_SUCCESS; } /* Note that this always suceeds */ int try_tds_logout(TDSLOGIN * login, TDSSOCKET * tds, int verbose) { if (verbose) { printf("Entered tds_try_logout()\n"); } tds_close_socket(tds); tds_free_socket(tds); tds_free_login(login); tds_free_context(test_context); test_context = NULL; return TDS_SUCCESS; } /* Run query for which there should be no return results */ int run_query(TDSSOCKET * tds, const char *query) { int rc; int result_type; rc = tds_submit_query(tds, query); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_submit_query() failed for query '%s'\n", query); return TDS_FAIL; } while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: /* ignore possible spurious result (TDS7+ send it) */ case TDS_STATUS_RESULT: break; default: fprintf(stderr, "Error: query should not return results\n"); return TDS_FAIL; } } if (rc == TDS_FAIL) { fprintf(stderr, "tds_process_tokens() returned TDS_FAIL for '%s'\n", query); return TDS_FAIL; } else if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); return TDS_FAIL; } return TDS_SUCCESS; } freetds-1.3.6/src/tds/unittests/common.h000644 025423 025423 00000001740 14056414222 021671 0ustar00fredianofrediano000000 000000 #ifndef COMMON_h #define COMMON_h #undef NDEBUG #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #ifndef FREETDS_SRCDIR #define FREETDS_SRCDIR FREETDS_TOPDIR "/src/tds/unittests" #endif extern char PASSWORD[512]; extern char USER[512]; extern char SERVER[512]; extern char DATABASE[512]; extern char CHARSET[512]; extern TDSCONTEXT *test_context; int try_tds_login(TDSLOGIN ** login, TDSSOCKET ** tds, const char *appname, int verbose); int try_tds_logout(TDSLOGIN * login, TDSSOCKET * tds, int verbose); int run_query(TDSSOCKET * tds, const char *query); extern int utf8_max_len; int get_unichar(const char **psrc); char *to_utf8(const char *src, char *dest); typedef void tds_any_type_t(TDSSOCKET *tds, TDSCOLUMN *col); void tds_all_types(TDSSOCKET *tds, tds_any_type_t *func); #endif freetds-1.3.6/src/tds/unittests/utf8.c000644 025423 025423 00000003513 14056414222 021262 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #undef NDEBUG #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #include "common.h" #include #include int utf8_max_len = 0; int get_unichar(const char **psrc) { const char *src = *psrc; int n; if (!*src) return -1; if (src[0] == '&' && src[1] == '#') { char *end; int radix = 10; if (toupper(src[2]) == 'X') { radix = 16; ++src; } n = strtol(src+2, &end, radix); assert(*end == ';' && n > 0 && n < 0x10000); src = end + 1; } else { n = (unsigned char) *src++; } *psrc = src; return n; } char * to_utf8(const char *src, char *dest) { unsigned char *p = (unsigned char *) dest; int len = 0, n; while ((n=get_unichar(&src)) > 0) { if (n >= 0x2000) { *p++ = 0xe0 | (n >> 12); *p++ = 0x80 | ((n >> 6) & 0x3f); *p++ = 0x80 | (n & 0x3f); } else if (n >= 0x80) { *p++ = 0xc0 | (n >> 6); *p++ = 0x80 | (n & 0x3f); } else { *p++ = (unsigned char) n; } ++len; } if (len > utf8_max_len) utf8_max_len = len; *p = 0; return dest; } freetds-1.3.6/src/tds/unittests/allcolumns.c000644 025423 025423 00000017275 14056414271 022563 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2017 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #include "common.h" #include #include #include static bool is_convert_pointer_type(int type) { switch (type) { case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case XSYBCHAR: case XSYBVARCHAR: case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: case XSYBBINARY: case XSYBVARBINARY: case SYBLONGBINARY: return true; } return false; } static void free_convert(int type, CONV_RESULT *cr) { if (is_convert_pointer_type(type)) free(cr->c); } static void create_type(TDSSOCKET *tds, int desttype, int server_type, tds_any_type_t *func); enum { TDSVER_MS = 0x704, TDSVER_SYB = 0x500 }; void tds_all_types(TDSSOCKET *tds, tds_any_type_t *func) { int desttype; tds->conn->tds_version = TDSVER_MS; /* * Test every type */ for (desttype = 0; desttype < 0x100; desttype++) { int types_buffer[10]; int *types = types_buffer, *types_end; int server_type; int varint, other_varint; if (!is_tds_type_valid(desttype)) continue; tds->conn->tds_version = TDSVER_MS; /* if is only Sybase change version to Sybase */ varint = tds_get_varint_size(tds->conn, desttype); tds->conn->tds_version ^= TDSVER_MS ^ TDSVER_SYB; other_varint = tds_get_varint_size(tds->conn, desttype); tds->conn->tds_version ^= TDSVER_MS ^ TDSVER_SYB; if (varint == 1 && varint != other_varint) tds->conn->tds_version = TDSVER_SYB; server_type = desttype; switch (desttype) { /* unsupported */ case SYBVOID: case SYBINTERVAL: continue; /* nullable, use another type */ /* TODO, try all sizes */ case SYBINTN: *types++ = SYBINT1; *types++ = SYBINT2; *types++ = SYBINT4; *types++ = SYBINT8; break; case SYBUINTN: *types++ = SYBUINT1; *types++ = SYBUINT2; *types++ = SYBUINT4; *types++ = SYBUINT8; tds->conn->tds_version = TDSVER_SYB; break; case SYBFLTN: *types++ = SYBREAL; *types++ = SYBFLT8; break; case SYBMONEYN: *types++ = SYBMONEY4; *types++ = SYBMONEY; break; case SYBDATETIMN: *types++ = SYBDATETIME4; *types++ = SYBDATETIME; break; case SYBDATEN: *types++ = SYBDATE; tds->conn->tds_version = TDSVER_SYB; break; case SYBTIMEN: *types++ = SYBTIME; tds->conn->tds_version = TDSVER_SYB; break; case SYB5INT8: *types++ = SYBINT8; break; /* TODO tds_set_column_type */ case SYBXML: /* ?? */ case SYBNTEXT: /* ?? */ case XSYBNVARCHAR: case XSYBNCHAR: case SYBNVARCHAR: case SYBMSUDT: case SYBMSXML: case SYBUNITEXT: case SYBVARIANT: /* TODO */ case SYBSINT1: /* TODO */ continue; } if (types == types_buffer) *types++ = desttype; types_end = types; for (types = types_buffer; types != types_end; ++types) { create_type(tds, *types, server_type, func); if (*types != server_type) create_type(tds, *types, *types, func); } } } static void create_type(TDSSOCKET *tds, int desttype, int server_type, tds_any_type_t *func) { const TDSCONTEXT *ctx = tds_get_ctx(tds); int result; TDS_CHAR *src = NULL; TDS_UINT srclen; CONV_RESULT cr; const int srctype = SYBCHAR; TDSRESULTINFO *results; TDSCOLUMN *curcol; cr.n.precision = 8; cr.n.scale = 2; switch (desttype) { case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case XSYBVARCHAR: case XSYBCHAR: src = "test of a character field"; break; case SYBDATETIME: case SYBDATETIME4: src = "Apr 12, 1985 17:49:41"; break; case SYBMSDATE: case SYBDATE: src = "2012-11-27"; break; case SYBTIME: src = "15:27:12"; break; case SYBMSTIME: case SYB5BIGTIME: src = "15:27:12.327862"; break; case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYB5BIGDATETIME: src = "2015-09-12 21:48:12.638161"; break; case SYBBINARY: case SYBIMAGE: src = "0xbeef"; break; case SYBINT1: case SYBINT2: case SYBINT4: case SYBUINT1: case SYBUINT2: case SYBUINT4: src = "255"; break; case SYBINT8: case SYBUINT8: src = "374632567765"; break; case SYBFLT8: case SYBREAL: case SYBMONEY: case SYBMONEY4: src = "1237.45"; cr.n.precision = 8; cr.n.scale = 2; break; case SYBNUMERIC: case SYBDECIMAL: src = "947919.25"; cr.n.precision = 8; cr.n.scale = 2; break; case SYBUNIQUE: src = "A8C60F70-5BD4-3E02-B769-7CCCCA585DCC"; break; case SYBBIT: default: src = "1"; break; } assert(src); srclen = strlen(src); /* * Now at last do the conversion */ result = tds_convert(ctx, srctype, src, srclen, desttype, &cr); if (result < 0) { if (result == TDS_CONVERT_NOAVAIL) /* tds_willconvert returned true, but it lied. */ fprintf(stderr, "Conversion not yet implemented:\n\t"); fprintf(stderr, "failed (%d) to convert %d (%s, %d bytes) : %d (%s).\n", result, srctype, tds_prtype(srctype), srclen, desttype, tds_prtype(desttype)); if (result == TDS_CONVERT_NOAVAIL) exit(1); } printf("converted %d (%s, %d bytes) -> %d (%s, %d bytes).\n", srctype, tds_prtype(srctype), srclen, desttype, tds_prtype(desttype), result); results = tds_alloc_param_result(NULL); assert(results); curcol = results->columns[0]; assert(curcol); tds_set_column_type(tds->conn, curcol, server_type); curcol->on_server.column_size = curcol->column_size = curcol->column_cur_size = result; if (is_numeric_type(desttype)) { curcol->column_prec = cr.n.precision; curcol->column_scale = cr.n.scale; } switch (desttype) { case SYB5BIGDATETIME: case SYB5BIGTIME: curcol->column_prec = curcol->column_scale = 6; break; } CHECK_COLUMN_EXTRA(curcol); tds_alloc_param_data(curcol); if (is_blob_col(curcol)) { ((TDSBLOB *) curcol->column_data)->textvalue = cr.c; cr.c = NULL; } else if (is_convert_pointer_type(desttype)) { memcpy(curcol->column_data, cr.c, result); } else { memcpy(curcol->column_data, &cr.i, result); } func(tds, curcol); /* try to convert to SQL_VARIANT */ if (is_variant_inner_type(desttype)) { TDSVARIANT *v; TDSCOLUMN *basecol; tds->conn->tds_version = TDSVER_MS; results = tds_alloc_param_result(results); assert(results); basecol = results->columns[0]; curcol = results->columns[1]; tds_set_column_type(tds->conn, curcol, SYBVARIANT); CHECK_COLUMN_EXTRA(curcol); tds_alloc_param_data(curcol); v = (TDSVARIANT *) curcol->column_data; v->size = basecol->column_size; v->type = basecol->column_type; memcpy(v->collation, basecol->column_collation, sizeof(v->collation)); assert(basecol->column_cur_size > 0); v->data = tds_new(TDS_CHAR, basecol->column_cur_size); assert(v->data); v->data_len = basecol->column_cur_size; curcol->column_cur_size = v->data_len; curcol->column_size = curcol->on_server.column_size = 8009; assert(!is_blob_col(basecol)); memcpy(v->data, basecol->column_data, v->data_len); CHECK_COLUMN_EXTRA(curcol); func(tds, curcol); } tds_free_results(results); if (result >= 0) free_convert(desttype, &cr); } freetds-1.3.6/src/tds/unittests/charconv.c000644 025423 025423 00000016431 14056414222 022202 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2014 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * This test test tds_convert_stream which is supposed to be the main * character conversion routine * * Check that error are reported to error handler if found and tds * is not NULL. * * Check that conversions works with NULL tds. * * Check all types of errors (EILSEQ, EINVAL, E2BIG). * * Check that error are capture in middle and on end of stream. */ #include "common.h" #include #include #if HAVE_UNISTD_H #undef getpid #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include /* test tds_bcp_fread */ static char buf[4096+80]; static char buf_out[4096+80]; static int last_errno = 0; static TDSRET convert(TDSSOCKET *tds, TDSICONV *conv, TDS_ICONV_DIRECTION direction, const char *from, size_t from_len, char *dest, size_t *dest_len) { /* copy to make valgrind test fail on memory problems */ char *in = tds_new(char, from_len); char *out = tds_new(char, *dest_len); int res; TDSSTATICINSTREAM r; TDSSTATICOUTSTREAM w; assert(in && out); memcpy(in, from, from_len); tds_staticin_stream_init(&r, in, from_len); tds_staticout_stream_init(&w, out, *dest_len); last_errno = 0; res = tds_convert_stream(tds, conv, direction, &r.stream, &w.stream); last_errno = errno; memcpy(dest, out, *dest_len - w.stream.buf_len); *dest_len = *dest_len - w.stream.buf_len; free(in); free(out); return res; } enum Odd { ODD_NONE = 0, ODD_NORMAL, ODD_INVALID, ODD_INCOMPLETE, ODD_NUM_VALUES }; static const char *odd_names[] = { "None", "Normal", "Invalid", "Incomplete" }; static int add_odd(char *buf, int *pos, enum Odd type) { const unsigned char x = 0xa0; switch (type) { case ODD_NONE: return 0; case ODD_NORMAL: buf[*pos] = 0xC0 + (x >> 6); ++*pos; buf[*pos] = 0x80 + (x & 0x3f); ++*pos; return 0; case ODD_INVALID: buf[*pos] = 0xff; ++*pos; return EILSEQ; case ODD_INCOMPLETE: buf[*pos] = 0xC2; ++*pos; return EINVAL; default: assert(0); } return 0; } static void add_odd2(char *buf, int *pos, enum Odd type) { const unsigned char x = 0xa0; switch (type) { case ODD_NONE: return; case ODD_NORMAL: buf[*pos] = x; ++*pos; break; case ODD_INVALID: break; case ODD_INCOMPLETE: break; default: assert(0); } } static int captured_errno = 0; static int err_handler(const TDSCONTEXT * tds_ctx, TDSSOCKET * tds, TDSMESSAGE * msg) { int old_err = captured_errno; if (msg->msgno == TDSEICONVAVAIL) { captured_errno = EINVAL; } else if (strstr(msg->message, "could not be converted")) { captured_errno = EILSEQ; } else if (msg->msgno == TDSEICONVIU) { captured_errno = E2BIG; } else { fprintf(stderr, "Unexpected error: %s\n", msg->message); exit(1); } assert(old_err == 0 || old_err == captured_errno); return TDS_INT_CANCEL; } static TDSICONV * conv = NULL; static int pos_type = 0; static void test(TDSSOCKET *tds, enum Odd odd_type) { int i, l; captured_errno = 0; /* do not complete incomplete */ if (odd_type == ODD_INCOMPLETE && pos_type > 0) return; printf("test pos %d type %s\n", pos_type, odd_names[odd_type]); for (i = 0; i < 4096+20; ++i) { size_t out_len; TDSRET res; int err; if (i == 34) i = 4096-20; l = i; memset(buf, 'a', sizeof(buf)); switch (pos_type) { case 0: /* end */ err = add_odd(buf, &l, odd_type); break; case 1: /* start */ l = 0; err = add_odd(buf, &l, odd_type); if (l > i) continue; l = i; break; case 2: /* middle */ err = add_odd(buf, &l, odd_type); l = 4096+30; break; default: exit(1); return; } /* convert it */ out_len = sizeof(buf_out); res = convert(tds, conv, to_server, buf, l, buf_out, &out_len); printf("i %d res %d out_len %u errno %d captured_errno %d\n", i, (int) res, (unsigned int) out_len, last_errno, captured_errno); /* test */ l = i; memset(buf, 'a', sizeof(buf)); switch (pos_type) { case 0: /* end */ add_odd2(buf, &l, odd_type); break; case 1: /* start */ l = 0; add_odd2(buf, &l, odd_type); l = i; if (odd_type == ODD_NORMAL) l = i-1; if (odd_type == ODD_INVALID) l = 0; break; case 2: /* middle */ add_odd2(buf, &l, odd_type); l = 4096+30; if (odd_type == ODD_NORMAL) --l; if (odd_type == ODD_INVALID) l = i; break; } if (err) { assert(last_errno == err); assert(TDS_FAILED(res)); assert(!tds || captured_errno == last_errno); } else { assert(TDS_SUCCEED(res)); assert(captured_errno == 0); } if (out_len != l) { fprintf(stderr, "out %u bytes expected %d\n", (unsigned int) out_len, l); exit(1); } assert(memcmp(buf_out, buf, l) == 0); } } static void big_test(TDSSOCKET *tds) { int i, l; const int limit = 1025; captured_errno = 0; printf("E2BIG test\n"); for (i = 0; i < 4096+20; ++i) { size_t out_len; TDSRET res; int err; if (i == 32) i = 490; l = i; memset(buf, 0xa0, sizeof(buf)); /* convert it */ out_len = limit; res = convert(tds, conv, to_client, buf, l, buf_out, &out_len); printf("i %d res %d out_len %u errno %d captured_errno %d\n", i, (int) res, (unsigned int) out_len, last_errno, captured_errno); err = l * 2 > limit ? E2BIG : 0; if (err) { assert(last_errno == err); assert(TDS_FAILED(res)); assert(!tds || captured_errno == last_errno); } else { assert(TDS_SUCCEED(res)); assert(captured_errno == 0); } if (out_len != i*2 && i*2 <= limit) { fprintf(stderr, "out %u bytes expected %d\n", (unsigned int) out_len, i*2); exit(1); } } } int main(int argc, char **argv) { int i; TDSCONTEXT *ctx = tds_alloc_context(NULL); TDSSOCKET *tds = tds_alloc_socket(ctx, 512); const char *tdsdump; setbuf(stdout, NULL); setbuf(stderr, NULL); ctx->err_handler = err_handler; /* allow dumps, we don't have a connection here */ tdsdump = getenv("TDSDUMP"); if (tdsdump) tdsdump_open(tdsdump); if (!ctx || !tds) { fprintf(stderr, "Error creating socket!\n"); return 1; } tds_iconv_open(tds->conn, "ISO-8859-1", 0); conv = tds_iconv_get(tds->conn, "UTF-8", "ISO-8859-1"); if (conv == NULL) { fprintf(stderr, "Error creating conversion, giving up!\n"); return 1; } for (i = 0; i < ODD_NUM_VALUES*3*2; ++i) { int n = i; enum Odd odd_type = (enum Odd) (n % ODD_NUM_VALUES); n /= ODD_NUM_VALUES; pos_type = n % 3; n /= 3; test(n ? tds : NULL, odd_type); } /* not try E2BIG error */ big_test(NULL); big_test(tds); tds_free_socket(tds); tds_free_context(ctx); return 0; } freetds-1.3.6/src/tds/unittests/collations.c000644 025423 025423 00000015700 14056414222 022544 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #undef NDEBUG #include "common.h" #include #include #undef NDEBUG #include #include #if HAVE_UNISTD_H #undef getpid #include #elif defined(_WIN32) # include # undef isatty # define isatty(fd) _isatty(fd) #endif /* HAVE_UNISTD_H */ static TDSSOCKET *tds; static void get_coll_md5(const char *name, char *digest) { MD5_CTX ctx; char *p = NULL, *sql = NULL; int ret; TDSRET rc; TDS_INT result_type; int done_flags, i; unsigned char dig[16]; ret = asprintf(&sql, "convert(nvarchar(1024), bin) collate %s", name); assert(ret >= 0); ret = asprintf(&p, "convert(varchar(4096), %s)", sql); assert(ret >= 0); free(sql); sql = NULL; ret = asprintf(&sql, "select convert(varbinary(8000), %s) from #all_chars order by id", p); assert(ret >= 0); free(p); p = NULL; rc = tds_submit_query(tds, sql); assert(rc == TDS_SUCCESS); free(sql); sql = NULL; MD5Init(&ctx); while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_RETURN_ROW)) == TDS_SUCCESS) { TDSCOLUMN *curcol; assert(result_type == TDS_ROW_RESULT); curcol = tds->current_results->columns[0]; assert(!is_blob_col(curcol)); assert(curcol->on_server.column_type == XSYBVARBINARY); MD5Update(&ctx, curcol->column_data, curcol->column_cur_size); } assert(rc == TDS_NO_MORE_RESULTS); memset(dig, 0, sizeof(dig)); MD5Final(&ctx, dig); for (i = 0; i < 16; ++i) sprintf(digest + i * 2, "%02x", dig[i]); } static void get_encoding_coll(TDS71_COLLATION *coll, char *digest, char *cp, const char *name) { int rc; int done_flags; TDS_INT result_type; char sql[512]; static TDS71_COLLATION old_coll = { 0, 0, 0}; static char old_digest[33]; sprintf(sql, "SELECT CAST(CAST('a' AS NVARCHAR(10)) COLLATE %s AS VARCHAR(10)) COLLATE %s", name, name); /* do a select and check all results */ rc = tds_submit_query(tds, sql); assert(rc == TDS_SUCCESS); assert(tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) == TDS_SUCCESS); if (result_type == TDS_DONE_RESULT) return; assert(result_type == TDS_ROWFMT_RESULT); assert(tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) == TDS_SUCCESS); assert(result_type == TDS_ROW_RESULT); while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_STOPAT_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { TDSCOLUMN *curcol; TDS_UCHAR *c; if (result_type != TDS_ROW_RESULT) break; curcol = tds->current_results->columns[0]; strcpy(cp, curcol->char_conv->to.charset.name); c = curcol->column_collation; coll->locale_id = c[0] + 256 * c[1]; coll->flags = c[2] + 256 * c[3]; coll->charset_id = c[4]; } if (rc != TDS_SUCCESS || result_type == TDS_ROW_RESULT || result_type == TDS_COMPUTE_RESULT) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); exit(1); } while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_NO_MORE_RESULTS: return; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if (!(done_flags & TDS_DONE_ERROR)) break; default: fprintf(stderr, "tds_proces_tokens() unexpected result_type\n"); exit(1); break; } } get_coll_md5(name, digest); memcpy(old_digest, digest, 33); memcpy(&old_coll, coll, sizeof(*coll)); } static void test_column_encoding(void) { FILE *f = fopen("collations.txt", "r"); char line[1024]; assert(f); while (fgets(line, sizeof(line), f)) { TDS71_COLLATION coll; char cp[128], digest[33]; char *s = strtok(line, " \n"); if (!s[0]) continue; memset(&coll, 0, sizeof(coll)); cp[0] = 0; digest[0] = 0; get_encoding_coll(&coll, digest, cp, s); printf("%s %04x %04x %d %s %s\n", s, coll.locale_id, coll.flags, coll.charset_id, cp, digest); } fclose(f); } static void add_couple(unsigned n) { enum { CHUNK = 512 }; static char buf[CHUNK * 4+1]; static int cnt = 0; static int id = 0; char *sql = NULL; int ret; sprintf(buf + cnt * 4, "%02x%02x", n & 0xff, (n >> 8) & 0xff); /* time to insert the command into database ? */ if (++cnt != CHUNK) return; cnt = 0; ++id; ret = asprintf(&sql, "insert into #all_chars values(%d, convert(varbinary(2048), 0x%s))", id, buf); assert(ret >= 0); if (isatty(fileno(stdout))) { printf("\rInserting: %d", id); fflush(stdout); } ret = run_query(tds, sql); assert(ret == TDS_SUCCESS); free(sql); } static void add_plane0(void) { unsigned n; for (n = 0; n < 65536; ++n) add_couple(n); } static void add_couples(void) { unsigned n; for (n = 0; n <= 0xfffff; ++n) { add_couple( (n >> 10) + 0xd800 ); add_couple( (n & 0x3ff) + 0xdc00 ); } } static void prepare_all_chars(void) { int ret; ret = run_query(tds, "CREATE TABLE #all_chars(id int, bin varbinary(2048))"); assert(ret == TDS_SUCCESS); add_plane0(); add_couples(); printf("\n"); } static void extract_collations(void) { TDS_INT result_type; int done_flags; TDSRET rc; FILE *f; f = fopen("collations.txt", "w"); assert(f); rc = tds_submit_query(tds, "select name from ::fn_helpcollations() order by name"); assert(rc == TDS_SUCCESS); while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_RETURN_ROW)) == TDS_SUCCESS) { TDSCOLUMN *curcol; int len; assert(result_type == TDS_ROW_RESULT); curcol = tds->current_results->columns[0]; assert(!is_blob_col(curcol)); assert(curcol->column_type == SYBVARCHAR); len = curcol->column_cur_size; fprintf(f, "%*.*s\n", len, len, curcol->column_data); } assert(rc == TDS_NO_MORE_RESULTS); fclose(f); } int main(int argc, char **argv) { TDSLOGIN *login; int ret; int verbose = 0; /* use UTF-8 as our coding */ strcpy(CHARSET, "UTF-8"); ret = try_tds_login(&login, &tds, __FILE__, verbose); if (ret != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } if (IS_TDS71_PLUS(tds->conn)) { printf("Preparing table with all characters\n"); prepare_all_chars(); printf("Extracting collation list\n"); extract_collations(); printf("Testing encodings\n"); test_column_encoding(); } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/convert.c000644 025423 025423 00000023563 14056414271 022067 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Purpose: test conversions. If they work, test their performance. * To test performance, call this program with an iteration count (10 is probably fine). * The following shows performance converting to varchar: * $ make convert && ./convert 1 |grep iterations |grep 'varchar\.' |sort -n */ #include "common.h" #include #include #include #include static int g_result = 0; static TDSCONTEXT *ctx; static void free_convert(int type, CONV_RESULT *cr) { switch (type) { case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case XSYBCHAR: case XSYBVARCHAR: case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: case XSYBBINARY: case XSYBVARBINARY: case SYBLONGBINARY: free(cr->c); break; } } int main(int argc, char **argv) { int srctype; int desttype; /* some default inputs */ static const int bit_input = 1; /* timing variables to compute performance */ struct timeval start, end; double starttime, endtime; int i, j, iterations = 0, result; TDS_CHAR *src = NULL; TDS_UINT srclen; CONV_RESULT cr; TDS_NUMERIC numeric; TDS_MONEY money; TDS_MONEY4 money4; TDS_DATETIME datetime; TDS_DATETIME4 datetime4; TDS_DATETIMEALL dta; TDS_DATE date; TDS_TIME time; TDS_BIGDATETIME bigdatetime; TDS_BIGTIME bigtime; TDS_TINYINT tds_tinyint; TDS_SMALLINT tds_smallint; TDS_INT tds_int; TDS_INT8 tds_int8; TDS_USMALLINT tds_usmallint; TDS_UINT tds_uint; TDS_UINT8 tds_uint8; TDS_REAL tds_real; TDS_FLOAT tds_float; TDS_UNIQUE tds_unique; if (argc > 1) { iterations = atoi(argv[1]); printf("Computing %d iterations\n", iterations); } setbuf(stdout, NULL); setbuf(stderr, NULL); ctx = tds_alloc_context(NULL); assert(ctx); if (ctx->locale && !ctx->locale->date_fmt) { /* set default in case there's no locale file */ ctx->locale->date_fmt = strdup(STD_DATETIME_FMT); } /* * Test every possible conversion pair */ for (i = 0; i < 0x10000; i++) { srctype = i >> 8; desttype = i & 0xff; srctype = (srctype + SYBCHAR) & 0xff; if (!tds_willconvert(srctype, desttype)) { /* pass a CONV_RESULT as input for make sure size and alignment is enough * for all types */ CONV_RESULT src; memset(&src, 0, sizeof(src)); srclen = 4; result = tds_convert(ctx, srctype, (const TDS_CHAR *) &src, srclen, desttype, &cr); if (result >= 0) free_convert(desttype, &cr); if (result != TDS_CONVERT_NOAVAIL) { printf("NOT EXPECTED: converted %d (%s, %d bytes) : %d (%s, %d bytes).\n", srctype, tds_prtype(srctype), srclen, desttype, tds_prtype(desttype), result); exit(1); } continue; /* don't attempt nonconvertible types */ } if (srctype == desttype) continue; /* don't attempt same types */ /* valid types should have a name ! */ assert(tds_prtype(srctype)[0] != 0); assert(tds_prtype(desttype)[0] != 0); cr.n.precision = 8; cr.n.scale = 2; switch (srctype) { case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case SYBBINARY: case SYBVARBINARY: case SYBIMAGE: case SYBLONGBINARY: case XSYBBINARY: case XSYBVARBINARY: case XSYBCHAR: case XSYBVARCHAR: switch (desttype) { case SYBCHAR: case SYBVARCHAR: case SYBTEXT: case SYBDATETIME: case SYBDATETIME4: src = "Jan 1, 1999"; break; case SYBMSDATE: case SYBDATE: src = "2012-11-27"; break; case SYBTIME: src = "15:27:12"; break; case SYBMSTIME: case SYB5BIGTIME: src = "15:27:12.327862"; break; case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: case SYB5BIGDATETIME: src = "2015-09-12 21:48:12.638161"; break; case SYBBINARY: case SYBIMAGE: src = "0xbeef"; break; case SYBINT1: case SYBINT2: case SYBINT4: case SYBINT8: case SYBUINT1: case SYBUINT2: case SYBUINT4: case SYBUINT8: src = "255"; break; case SYBFLT8: case SYBREAL: case SYBNUMERIC: case SYBDECIMAL: case SYBMONEY: case SYBMONEY4: src = "1999.25"; cr.n.precision = 8; cr.n.scale = 2; break; case SYBUNIQUE: src = "A8C60F70-5BD4-3E02-B769-7CCCCA585DCC"; break; case SYBBIT: default: src = "1"; break; } assert(src); srclen = strlen(src); break; case SYBINT1: case SYBUINT1: src = (char *) &tds_tinyint; srclen = sizeof(tds_tinyint); break; case SYBINT2: src = (char *) &tds_smallint; srclen = sizeof(tds_smallint); break; case SYBINT4: src = (char *) &tds_int; srclen = sizeof(tds_int); break; case SYBINT8: src = (char *) &tds_int8; srclen = sizeof(tds_int8); break; case SYBUINT2: src = (char *) &tds_usmallint; srclen = sizeof(tds_usmallint); break; case SYBUINT4: src = (char *) &tds_uint; srclen = sizeof(tds_uint); break; case SYBUINT8: src = (char *) &tds_uint8; srclen = sizeof(tds_uint8); break; case SYBFLT8: tds_float = 3.14159; src = (char *) &tds_float; srclen = sizeof(tds_float); break; case SYBREAL: tds_real = (TDS_REAL) 3.14159; src = (char *) &tds_real; srclen = sizeof(tds_real); break; case SYBNUMERIC: case SYBDECIMAL: src = (char *) &numeric; srclen = sizeof(numeric); break; case SYBMONEY: src = (char *) &money; srclen = sizeof(money); break; case SYBMONEY4: src = (char *) &money4; srclen = sizeof(money4); break; case SYBBIT: case SYBBITN: src = (char *) &bit_input; srclen = sizeof(bit_input); break; case SYBDATETIME: src = (char *) &datetime; srclen = sizeof(datetime); break; case SYBDATETIME4: src = (char *) &datetime4; srclen = sizeof(datetime4); break; case SYBDATE: src = (char *) &date; srclen = sizeof(date); break; case SYBTIME: src = (char *) &time; srclen = sizeof(time); break; case SYB5BIGTIME: src = (char *) &bigtime; srclen = sizeof(bigtime); break; case SYB5BIGDATETIME: src = (char *) &bigdatetime; srclen = sizeof(bigdatetime); break; case SYBUNIQUE: src = (char *) &tds_unique; srclen = sizeof(tds_unique); break; case SYBMSTIME: case SYBMSDATE: case SYBMSDATETIME2: case SYBMSDATETIMEOFFSET: src = (char *) &dta; srclen = sizeof(dta); break; /***** not defined yet case SYBBOUNDARY: case SYBSENSITIVITY: fprintf (stderr, "type %d not supported\n", srctype ); continue; break; *****/ default: fprintf(stderr, "no such type %d (%s)\n", srctype, tds_prtype(srctype)); return -1; } /* * Now at last do the conversion */ result = tds_convert(ctx, srctype, src, srclen, desttype, &cr); if (result >= 0) free_convert(desttype, &cr); if (result < 0) { if (result == TDS_CONVERT_NOAVAIL) /* tds_willconvert returned true, but it lied. */ fprintf(stderr, "Conversion not yet implemented:\n\t"); fprintf(stderr, "failed (%d) to convert %d (%s, %d bytes) : %d (%s).\n", result, srctype, tds_prtype(srctype), srclen, desttype, tds_prtype(desttype)); if (result == TDS_CONVERT_NOAVAIL) exit(1); } printf("converted %d (%s, %d bytes) -> %d (%s, %d bytes).\n", srctype, tds_prtype(srctype), srclen, desttype, tds_prtype(desttype), result); /* * In the first iteration, start with varchar -> others. * By saving the output, we initialize subsequent inputs. */ switch (desttype) { case SYBNUMERIC: case SYBDECIMAL: numeric = cr.n; break; case SYBMONEY: money = cr.m; break; case SYBMONEY4: money4 = cr.m4; break; case SYBDATETIME: datetime = cr.dt; break; case SYBDATETIME4: datetime4 = cr.dt4; break; case SYBDATE: date = cr.date; break; case SYBTIME: time = cr.time; break; case SYBMSDATETIME2: dta = cr.dta; break; case SYB5BIGTIME: bigtime = cr.bigtime; break; case SYB5BIGDATETIME: bigdatetime = cr.bigdatetime; break; case SYBINT1: case SYBUINT1: tds_tinyint = cr.ti; break; case SYBINT2: tds_smallint = cr.si; break; case SYBINT4: tds_int = cr.i; break; case SYBINT8: tds_int8 = cr.bi; break; case SYBUINT2: tds_usmallint = cr.usi; break; case SYBUINT4: tds_uint = cr.ui; break; case SYBUINT8: tds_uint8 = cr.ubi; break; case SYBUNIQUE: tds_unique = cr.u; break; default: break; } /* * If an iteration count was passed on the command line (not by "make check") * run the conversion N times and print the conversions per second. */ result = gettimeofday(&start, NULL); starttime = (double) start.tv_sec + (double) start.tv_usec * 0.000001; for (j = 0; result >= 0 && j < iterations; j++) { result = tds_convert(ctx, srctype, src, srclen, desttype, &cr); if (result >= 0) free_convert(desttype, &cr); } if (result < 0) continue; result = gettimeofday(&end, NULL); endtime = (double) end.tv_sec + (double) end.tv_usec * 0.000001; if (endtime != starttime && iterations) { printf("%9.0f iterations/second converting %13s => %s.\n", j / (endtime - starttime), tds_prtype(srctype), tds_prtype(desttype)); } } tds_free_context(ctx); return g_result; } freetds-1.3.6/src/tds/unittests/corrupt.c000644 025423 025423 00000006426 14056414222 022100 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Check sending integer till they overlap a packet. * This is to check if an integer can spread in multiple * packets. The problem raise from internal implementation * and how is handled the overlapping. */ #include "common.h" #include static const char select_query[] = "\nselect 'test'"; static void unfinished_query_test(TDSSOCKET *tds) { int char_len; char *buf, *p; int i, len; union { TDS_USMALLINT si; TDS_UINT i; TDS_INT8 i8; char buf[8]; } conv; if (IS_TDS72_PLUS(tds->conn)) return; tds_init_write_buf(tds); /* try to build an invalid (unfinished) query split in two packets */ char_len = IS_TDS7_PLUS(tds->conn) ? 2 : 1; buf = tds_new0(char, tds->out_buf_max + 200); memset(buf, '-', tds->out_buf_max + 200); strcpy(buf + (tds->out_buf_max - 8) / char_len - strlen(select_query) + 1, select_query); memset(strchr(buf, 0), 0, 16); /* convert if needed */ len = strlen(buf); for (i = len; --i >= 0; ) { char c = buf[i]; buf[i * char_len + 0] = c; if (IS_TDS7_PLUS(tds->conn)) buf[i * char_len + 1] = 0; } len *= char_len; /* send the query using tds_put_int8, not aligned */ tds->out_flag = TDS_QUERY; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) exit(1); p = buf; memcpy(conv.buf, p, 2); #ifdef WORDS_BIGENDIAN tds_swap_bytes(conv.buf, 2); #endif tds_put_smallint(tds, conv.si); p += 2; for (; p < buf + len; p += 8) { CHECK_TDS_EXTRA(tds); memcpy(conv.buf, p, 8); #ifdef WORDS_BIGENDIAN tds_swap_bytes(conv.buf, 8); #endif tds_put_int8(tds, conv.i8); } tds_flush_packet(tds); tds_set_state(tds, TDS_PENDING); /* check result was fine */ if (TDS_FAILED(tds_process_simple_query(tds))) { fprintf(stderr, "Error in prepared query\n"); exit(1); } free(buf); } int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int ret; int verbose = 0; TDS_INT8 i8; unsigned limit; printf("%s: Testing login, logout\n", __FILE__); ret = try_tds_login(&login, &tds, __FILE__, verbose); if (ret != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } unfinished_query_test(tds); tds->out_flag = TDS_QUERY; if (tds_set_state(tds, TDS_WRITING) != TDS_WRITING) { return 1; } tds_put_n(tds, "aaa", 3); limit = tds->out_buf_max / 8 + 100; for (i8 = 0; i8 < limit; ++i8) { CHECK_TDS_EXTRA(tds); tds_put_int8(tds, i8); } tds_send_cancel(tds); tds_process_simple_query(tds); try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/dataread.c000644 025423 025423 00000015074 14056414222 022146 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Test data from server * The test do a select for a given type, convert to char and compare result */ #include "common.h" #include #include static int g_result = 0; static TDSLOGIN *login; static TDSSOCKET *tds; static void test0(const char *type, ...); static void test(const char *type, const char *value, const char *result) { test0(type, value, result, NULL); } static void exec_query(const char *query) { if (tds_submit_query(tds, query) != TDS_SUCCESS || tds_process_simple_query(tds) != TDS_SUCCESS) { fprintf(stderr, "executing query failed\n"); exit(1); } } static void test0(const char *type, ...) { char buf[512]; CONV_RESULT cr; int rc; TDS_INT result_type; int done_flags; va_list ap; struct { const char *value; const char *result; } data[10]; int num_data = 0, i_row; sprintf(buf, "CREATE TABLE #tmp(a %s)", type); exec_query(buf); va_start(ap, type); for (;;) { const char * value = va_arg(ap, const char *); const char * result; if (!value) break; result = va_arg(ap, const char *); if (!result) result = value; data[num_data].value = value; data[num_data].result = result; sprintf(buf, "INSERT INTO #tmp VALUES(CONVERT(%s,'%s'))", type, value); exec_query(buf); ++num_data; } va_end(ap); assert(num_data > 0); /* execute it */ rc = tds_submit_query(tds, "SELECT * FROM #tmp"); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_submit_query() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROWFMT_RESULT) { fprintf(stderr, "expected row fmt() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROW_RESULT) { fprintf(stderr, "expected row result() failed\n"); exit(1); } i_row = 0; while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS && (result_type == TDS_ROW_RESULT || result_type == TDS_COMPUTE_RESULT)) { TDSCOLUMN *curcol = tds->current_results->columns[0]; TDS_CHAR *src = (TDS_CHAR *) curcol->column_data; int conv_type = tds_get_conversion_type(curcol->column_type, curcol->column_size); assert(i_row < num_data); if (is_blob_col(curcol) && curcol->column_type != SYBVARIANT) { TDSBLOB *blob = (TDSBLOB *) src; src = blob->textvalue; } if (tds_convert(test_context, conv_type, src, curcol->column_cur_size, SYBVARCHAR, &cr) < 0) { fprintf(stderr, "Error converting\n"); g_result = 1; } else { if (strcmp(data[i_row].result, cr.c) != 0) { fprintf(stderr, "Failed! Is \n%s\nShould be\n%s\n", cr.c, data[i_row].result); g_result = 1; } free(cr.c); } ++i_row; } if (rc != TDS_NO_MORE_RESULTS && rc != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); exit(1); } while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_NO_MORE_RESULTS: return; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if (!(done_flags & TDS_DONE_ERROR)) break; default: fprintf(stderr, "tds_process_tokens() unexpected result_type\n"); exit(1); break; } } exec_query("DROP TABLE #tmp"); } int main(int argc, char **argv) { printf("%s: Testing conversion from server\n", __FILE__); if (try_tds_login(&login, &tds, __FILE__, 0) != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } /* bit */ test("BIT", "0", NULL); test("BIT", "1", NULL); /* integers */ test("TINYINT", "234", NULL); test("SMALLINT", "-31789", NULL); test("INT", "16909060", NULL); /* floating point */ test("REAL", "1.25", NULL); test("FLOAT", "-49586.345", "-49586.345000000001"); /* money */ test("MONEY", "-123.3400", "-123.3400"); test("MONEY", "-123.3450", "-123.3450"); test("MONEY", "123.3450", "123.3450"); /* very long money, this test int64 operations too */ test("MONEY", "123456789012345.67", "123456789012345.6700"); /* test smaller money */ test("MONEY", "-922337203685477.5808", "-922337203685477.5808"); test("SMALLMONEY", "89123.12", "89123.1200"); test("SMALLMONEY", "-123.3400", "-123.3400"); test("SMALLMONEY", "-123.3450", "-123.3450"); test("SMALLMONEY", "123.3450", "123.3450"); /* test smallest smallmoney */ test("SMALLMONEY", "-214748.3648", "-214748.3648"); /* char */ test("CHAR(10)", "pippo", "pippo "); test("VARCHAR(20)", "pippo", NULL); test0("TEXT", "a", NULL, "foofoo", NULL, "try with a relatively long value, we hope for the best", NULL, NULL); /* binary */ test("VARBINARY(6)", "foo", "666f6f"); test("BINARY(6)", "foo", "666f6f000000"); test0("IMAGE", "foo", "666f6f", "foofoofoofoo", "666f6f666f6f666f6f666f6f", NULL); /* numeric */ test("NUMERIC(10,2)", "12765.76", NULL); test("NUMERIC(18,4)", "12765.761234", "12765.7612"); /* date */ free(test_context->locale->date_fmt); test_context->locale->date_fmt = strdup("%Y-%m-%d %H:%M:%S"); test("DATETIME", "2003-04-21 17:50:03", NULL); test("SMALLDATETIME", "2003-04-21 17:50:03", "2003-04-21 17:50:00"); if (IS_TDS7_PLUS(tds->conn)) { test("UNIQUEIDENTIFIER", "12345678-1234-A234-9876-543298765432", NULL); test("NVARCHAR(20)", "Excellent test", NULL); test("NCHAR(20)", "Excellent test", "Excellent test "); test("NTEXT", "Excellent test", NULL); } if (IS_TDS71_PLUS(tds->conn)) { test("SQL_VARIANT", "test123", NULL); } try_tds_logout(login, tds, 0); return g_result; } freetds-1.3.6/src/tds/unittests/declarations.c000644 025423 025423 00000003330 14056414222 023041 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2017 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Purpose: test we can declare any possible column type. */ #include "common.h" #include static void test_declaration(TDSSOCKET *tds, TDSCOLUMN *curcol) { char declaration[128]; TDSRET ret; declaration[0] = 0; ret = tds_get_column_declaration(tds, curcol, declaration); assert(ret == TDS_SUCCESS); printf("Declaration: %s\n", declaration); assert(declaration[0] != 0); } int main(int argc, char **argv) { int g_result = 0; TDSCONTEXT *ctx; TDSSOCKET *tds; setbuf(stdout, NULL); setbuf(stderr, NULL); ctx = tds_alloc_context(NULL); assert(ctx); if (ctx->locale && !ctx->locale->date_fmt) { /* set default in case there's no locale file */ ctx->locale->date_fmt = strdup(STD_DATETIME_FMT); } tds = tds_alloc_socket(ctx, 512); assert(tds); tds_all_types(tds, test_declaration); tds_free_socket(tds); tds_free_context(ctx); return g_result; } freetds-1.3.6/src/tds/unittests/dynamic1.c000644 025423 025423 00000011351 14056414222 022100 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" static int discard_result(TDSSOCKET * tds); static void fatal_error(const char *msg) { fprintf(stderr, "%s\n", msg); exit(1); } static void test(TDSSOCKET * tds, TDSDYNAMIC * dyn, TDS_INT n, const char *s) { TDSPARAMINFO *params; TDSCOLUMN *curcol; int len = (int)strlen(s); tds_free_input_params(dyn); if (!(params = tds_alloc_param_result(dyn->params))) fatal_error("out of memory!"); dyn->params = params; curcol = params->columns[0]; tds_set_param_type(tds->conn, curcol, SYBINT4); /* TODO test error */ tds_alloc_param_data(curcol); curcol->column_cur_size = sizeof(TDS_INT); memcpy(curcol->column_data, &n, sizeof(n)); if (!(params = tds_alloc_param_result(dyn->params))) fatal_error("out of memory!"); dyn->params = params; curcol = params->columns[1]; tds_set_param_type(tds->conn, curcol, SYBVARCHAR); curcol->column_size = 40; curcol->column_cur_size = len; tds_alloc_param_data(curcol); memcpy(curcol->column_data, s, len); if (tds_submit_execute(tds, dyn) != TDS_SUCCESS) fatal_error("tds_submit_execute() error"); if (discard_result(tds) != TDS_SUCCESS) fatal_error("tds_submit_execute() output error"); } int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 0; TDSDYNAMIC *dyn = NULL; int rc; printf("%s: Test dynamic queries\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) fatal_error("try_tds_login() failed"); run_query(tds, "DROP TABLE #dynamic1"); if (run_query(tds, "CREATE TABLE #dynamic1 (i INT, c VARCHAR(40))") != TDS_SUCCESS) fatal_error("creating table error"); if (tds->cur_dyn) fatal_error("already a dynamic query??"); /* prepare to insert */ if (tds_submit_prepare(tds, "INSERT INTO #dynamic1(i,c) VALUES(?,?)", NULL, &dyn, NULL) != TDS_SUCCESS) fatal_error("tds_submit_prepare() error"); if (discard_result(tds) != TDS_SUCCESS) fatal_error("tds_submit_prepare() output error"); if (!dyn) fatal_error("dynamic not present??"); /* insert one record */ test(tds, dyn, 123, "dynamic"); /* some test */ if (run_query(tds, "DECLARE @n INT SELECT @n = COUNT(*) FROM #dynamic1 IF @n <> 1 SELECT 0") != TDS_SUCCESS) fatal_error("checking rows"); if (run_query(tds, "DECLARE @n INT SELECT @n = COUNT(*) FROM #dynamic1 WHERE i = 123 AND c = 'dynamic' IF @n <> 1 SELECT 0") != TDS_SUCCESS) fatal_error("checking rows 1"); /* insert one record */ test(tds, dyn, 654321, "a longer string"); /* some test */ if (run_query(tds, "DECLARE @n INT SELECT @n = COUNT(*) FROM #dynamic1 IF @n <> 2 SELECT 0") != TDS_SUCCESS) fatal_error("checking rows"); if (run_query(tds, "DECLARE @n INT SELECT @n = COUNT(*) FROM #dynamic1 WHERE i = 123 AND c = 'dynamic' IF @n <> 1 SELECT 0") != TDS_SUCCESS) fatal_error("checking rows 2"); if (run_query (tds, "DECLARE @n INT SELECT @n = COUNT(*) FROM #dynamic1 WHERE i = 654321 AND c = 'a longer string' IF @n <> 1 SELECT 0") != TDS_SUCCESS) fatal_error("checking rows 3"); if (run_query(tds, "DROP TABLE #dynamic1") != TDS_SUCCESS) fatal_error("dropping table error"); tds_release_dynamic(&dyn); try_tds_logout(login, tds, verbose); return 0; } static int discard_result(TDSSOCKET * tds) { int rc; int result_type; while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: case TDS_DESCRIBE_RESULT: case TDS_STATUS_RESULT: case TDS_PARAM_RESULT: break; default: fprintf(stderr, "Error: query should not return results\n"); return TDS_FAIL; } } if (rc == TDS_FAIL) { fprintf(stderr, "tds_process_tokens() returned TDS_FAIL\n"); return TDS_FAIL; } else if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); return TDS_FAIL; } return TDS_SUCCESS; } freetds-1.3.6/src/tds/unittests/freeze.c000644 025423 025423 00000024705 14056414271 021666 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2020 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Purpose: test freeze functionality */ #include "common.h" #include #include #if HAVE_UNISTD_H #undef getpid #include #endif /* HAVE_UNISTD_H */ #include #ifdef _WIN32 #define SHUT_WR SD_SEND #endif typedef struct { uint8_t *buf; size_t len; size_t capacity; } buffer; #define BUF_INITIALIZER { NULL, 0, 0 } static void buf_append(buffer *buf, const void *data, size_t data_len) { size_t min_size = buf->len + data_len; if (min_size > buf->capacity) { buf->capacity *= 2; if (buf->capacity < min_size) buf->capacity = min_size; assert(TDS_RESIZE(buf->buf, buf->capacity) != NULL); } memcpy(buf->buf + buf->len, data, data_len); buf->len += data_len; } static void buf_free(buffer *buf) { free(buf->buf); buf->buf = NULL; buf->len = buf->capacity = 0; } static TDSSOCKET *tds = NULL; static buffer thread_buf = BUF_INITIALIZER; static TDS_SYS_SOCKET server_socket = INVALID_SOCKET; static bool was_shutdown = false; static void shutdown_server_socket(void); #define BLOCK_SIZE (tds->conn->env.block_size) /* thread to read data from main thread */ static TDS_THREAD_PROC_DECLARE(fake_thread_proc, arg) { TDS_SYS_SOCKET s = TDS_PTR2INT(arg); #if ENABLE_ODBC_MARS unsigned seq = 0; unsigned total_len = 0; TDS72_SMP_HEADER mars; #endif for (;;) { char buf[4096]; int len = READSOCKET(s, buf, sizeof(buf)); if (len <= 0) break; buf_append(&thread_buf, buf, len); tdsdump_dump_buf(TDS_DBG_INFO1, "received", buf, len); #if ENABLE_ODBC_MARS total_len += len; while (tds->conn->mars && total_len >= BLOCK_SIZE + sizeof(mars)) { mars.signature = TDS72_SMP; mars.type = TDS_SMP_ACK; mars.sid = 0; TDS_PUT_A4LE(&mars.size, 16); TDS_PUT_A4LE(&mars.seq, 4); TDS_PUT_A4LE(&mars.wnd, 4 + seq); WRITESOCKET(s, &mars, sizeof(mars)); total_len -= BLOCK_SIZE + sizeof(mars); seq++; } #endif } /* close socket to cleanup and signal main thread */ CLOSESOCKET(s); return TDS_THREAD_RESULT(0); } /* remove all headers (TDS and MARS) and do some checks on them */ static void strip_headers(buffer *buf) { uint8_t final = 0; uint8_t *p = buf->buf; uint8_t *dst = p; uint8_t *end = buf->buf + buf->len; while (p < end) { size_t len; assert(final == 0); if (p[0] == TDS72_SMP) { assert(end - p >= 8); /* to read SMP part */ len = TDS_GET_UA4LE(p+4); assert(len >= 16); assert(end - p >= len); p += 16; len -= 16; assert(end - p >= 4); /* to read TDS header part */ assert(len == TDS_GET_UA2BE(p+2)); } else { assert(end - p >= 4); /* to read TDS header part */ len = TDS_GET_UA2BE(p+2); } assert(len > 8); assert(end - p >= len); final = p[1]; memmove(dst, p + 8, len - 8); dst += len - 8; p += len; } assert(final == 1 || was_shutdown); buf->len = dst - buf->buf; } static buffer buf = BUF_INITIALIZER; /* Append some data to buffer and TDS. * If data is NULL append some random data */ static void append(const void *data, size_t size) { uint8_t rand_buf[2048]; if (!data) { size_t n; assert(size <= sizeof(rand_buf)); for (n = 0; n < size; ++n) rand_buf[n] = rand(); data = rand_buf; } tds_put_n(tds, data, size); buf_append(&buf, data, size); } /* Append a number for buffer only */ static void append_num(uint64_t num, unsigned size) { uint8_t num_buf[8]; unsigned n; assert(size == 1 || size == 2 || size == 4 || size == 8); for (n = 0; n < size; ++n) { num_buf[n] = num & 0xff; num >>= 8; } assert(num == 0); buf_append(&buf, num_buf, size); } /* base tests * - lengths; * - nested freeze; * - some packet wrapping case; */ static void test1(void) { TDSFREEZE outer, inner; size_t written; unsigned left; /* just to not start at 0 */ append("test", 4); /* test writing data as UTF16 */ tds_freeze(tds, &outer, 2); append_num(3, 2); append("a\0b\0c", 6); assert(tds_freeze_written(&outer) == 8); written = tds_freeze_written(&outer) / 2 - 1; tds_freeze_close_len(&outer, written); /* nested freeze */ tds_freeze(tds, &outer, 0); assert(tds_freeze_written(&outer) == 0); append("test", 4); tds_freeze(tds, &inner, 0); assert(tds_freeze_written(&outer) == 4); assert(tds_freeze_written(&inner) == 0); tds_put_smallint(tds, 1234); append_num(1234, 2); append("test", 4); assert(tds_freeze_written(&outer) == 10); assert(tds_freeze_written(&inner) == 6); append(NULL, 600 - 5); append("hello", 5); tdsdump_log(TDS_DBG_INFO2, "%u\n", (unsigned) tds_freeze_written(&outer)); assert(tds_freeze_written(&outer) == 610); assert(tds_freeze_written(&inner) == 606); /* check values do not change before and after close */ tds_freeze_close(&inner); assert(tds_freeze_written(&outer) == 610); /* test wrapping packets */ append(NULL, 600 - 5); append("hello", 5); tdsdump_log(TDS_DBG_INFO2, "%u\n", (unsigned) tds_freeze_written(&outer)); assert(tds_freeze_written(&outer) == 610 + 600); /* append data in the additional part to check it */ left = tds->out_buf_max - tds->out_pos; append(NULL, left - 3); tds_put_int(tds, 0x12345678); assert(tds->out_pos > tds->out_buf_max); append_num(0x12345678, 4); tds_freeze_close(&outer); } static void test_len1(void) { TDSFREEZE outer; /* simple len, small */ tds_freeze(tds, &outer, 4); append_num(10, 4); append(NULL, 10); tds_freeze_close(&outer); /* simple len, large */ tds_freeze(tds, &outer, 2); append_num(1234, 2); append(NULL, 1234); tds_freeze_close(&outer); /* simple len, large */ tds_freeze(tds, &outer, 4); append_num(1045, 4); append(NULL, 1045); tds_freeze_close(&outer); } /* similar to test_len1 with other APIs */ static void test_len2(void) { TDS_START_LEN_UINT(tds) { append_num(4 + 10 + 2 + 1234 + 4 + 1045, 4); /* simple len, small */ TDS_START_LEN_UINT(tds) { append_num(10, 4); append(NULL, 10); } TDS_END_LEN /* simple len, large */ TDS_START_LEN_USMALLINT(tds) { append_num(1234, 2); append(NULL, 1234); } TDS_END_LEN /* simple len, large */ TDS_START_LEN_UINT(tds) { append_num(1045, 4); append(NULL, 1045); } TDS_END_LEN } TDS_END_LEN } /* check if sending packet is failing */ static void test_failure(size_t len) { TDSFREEZE outer; size_t old_len; append(NULL, 123); tds_freeze(tds, &outer, 2); old_len = buf.len; if (len) append(NULL, len); tds_freeze_abort(&outer); memset(buf.buf + old_len, 0xab, buf.capacity - old_len); buf.len = old_len; } static void test_failure1(void) { test_failure(0); } static void test_failure2(void) { test_failure(BLOCK_SIZE * 3 + 56); } /* test if server close connection */ static void test_shutdown(void) { TDSFREEZE outer; append(NULL, BLOCK_SIZE + 17); tds_freeze(tds, &outer, 4); append(NULL, BLOCK_SIZE * 2 + 67); shutdown_server_socket(); was_shutdown = true; tds_freeze_close(&outer); buf.len = BLOCK_SIZE - 8; } /* test freeze cross packet boundary */ static void test_cross(unsigned num_bytes) { TDSFREEZE outer; unsigned left; left = tds->out_buf_max - tds->out_pos; append(NULL, left - num_bytes); append_num(1234, 4); tds_put_int(tds, 1234); tds_freeze(tds, &outer, 2); append_num(1045, 2); append(NULL, 1045); tds_freeze_close(&outer); } /* this will make the first packet a bit bigger than final */ static void test_cross1(void) { test_cross(1); } /* this will make the first packet exact as big as final */ static void test_cross2(void) { test_cross(4); } /* test freeze just when another packet is finished, * we should not generate an empty final one */ static void test_end(void) { TDSFREEZE outer, inner; unsigned left; left = tds->out_buf_max - tds->out_pos; append(NULL, left - 1); tds_freeze(tds, &outer, 0); append_num(123, 1); tds_put_byte(tds, 123); tds_freeze(tds, &inner, 0); tds_freeze_close(&inner); tds_freeze_close(&outer); } /* close the socket, force thread to stop also */ static void shutdown_server_socket(void) { char sock_buf[32]; shutdown(server_socket, SHUT_WR); while (READSOCKET(server_socket, sock_buf, sizeof(sock_buf)) > 0) continue; } static void test(int mars, void (*real_test)(void)) { TDSCONTEXT *ctx; TDS_SYS_SOCKET sockets[2]; tds_thread fake_thread; #if !ENABLE_ODBC_MARS if (mars) return; #endif ctx = tds_alloc_context(NULL); assert(ctx); tds = tds_alloc_socket(ctx, 512); assert(tds); /* provide connection to a fake remove server */ assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) >= 0); was_shutdown = false; tds->state = TDS_IDLE; tds_set_s(tds, sockets[0]); if (tds_thread_create(&fake_thread, fake_thread_proc, TDS_INT2PTR(sockets[1])) != 0) { perror("tds_thread_create"); exit(1); } server_socket = sockets[0]; #if ENABLE_ODBC_MARS if (mars) { tds->conn->mars = 1; assert(tds_realloc_socket(tds, tds->out_buf_max)); tds_init_write_buf(tds); } #endif real_test(); tds_flush_packet(tds); /* flush all data and wait for other thread to finish cleanly */ shutdown_server_socket(); tds_thread_join(fake_thread, NULL); tdsdump_dump_buf(TDS_DBG_INFO1, "sent buffer", buf.buf, buf.len); strip_headers(&thread_buf); tdsdump_dump_buf(TDS_DBG_INFO1, "thread buffer", thread_buf.buf, thread_buf.len); assert(buf.len == thread_buf.len); assert(memcmp(buf.buf, thread_buf.buf, buf.len) == 0); tds_free_socket(tds); tds = NULL; tds_free_context(ctx); buf_free(&buf); buf_free(&thread_buf); } int main(int argc, char **argv) { int mars; setbuf(stdout, NULL); setbuf(stderr, NULL); tdsdump_open(getenv("TDSDUMP")); for (mars = 0; mars < 2; ++mars) { test(mars, test1); test(mars, test_len1); test(mars, test_len2); test(mars, test_failure1); test(mars, test_failure2); test(mars, test_shutdown); test(mars, test_cross1); test(mars, test_cross2); test(mars, test_end); } return 0; } freetds-1.3.6/src/tds/unittests/iconv_fread.c000644 025423 025423 00000005441 14056414222 022655 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2006 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #if HAVE_UNISTD_H #undef getpid #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include /* test tds_bcp_fread */ static char buf[4096+80]; int main(int argc, char **argv) { static const char out_file[] = "iconv_fread.out"; int i; FILE *f; TDSCONTEXT *ctx = tds_alloc_context(NULL); TDSSOCKET *tds = tds_alloc_socket(ctx, 512); TDSICONV * conv; const char *tdsdump; tdsdump = getenv("TDSDUMP"); if (tdsdump) tdsdump_open(tdsdump); if (!ctx || !tds) { fprintf(stderr, "Error creating socket!\n"); return 1; } tds_iconv_open(tds->conn, "ISO-8859-1", 0); conv = tds_iconv_get(tds->conn, "UTF-8", "ISO-8859-1"); if (conv == NULL) { fprintf(stderr, "Error creating conversion, giving up!\n"); return 1; } f = fopen(out_file, "w+b"); if (!f) { fprintf(stderr, "Error opening file!\n"); return 1; } for (i = 0; i < 4096+20; ++i) { char *out = NULL; size_t out_len = 0xdeadbeef; TDSRET res; const unsigned char x = 0x90; if (i == 32) i = 4096-20; /* write test string to file */ if (fseek(f, 0L, SEEK_SET)) { fprintf(stderr, "Error seeking!\n"); return 1; } memset(buf, 'a', i); buf[i] = 0xC0 + (x >> 6); buf[i+1] = 0x80 + (x & 0x3f); buf[i+2] = '!'; buf[i+3] = '!'; fwrite(buf, 1, i+4, f); if (fseek(f, 0L, SEEK_SET)) { fprintf(stderr, "Error seeking!\n"); return 1; } /* convert it */ res = tds_bcp_fread(NULL, conv, f, "!!", 2, &out, &out_len); printf("res %d out_len %u\n", (int) res, (unsigned int) out_len); /* test */ memset(buf, 'a', i); buf[i] = (char) x; assert(TDS_SUCCEED(res)); if (out_len != i+1) { fprintf(stderr, "out %u bytes expected %d\n", (unsigned int) out_len, i+1); return 1; } assert(memcmp(out, buf, i+1) == 0); free(out); } fclose(f); unlink(out_file); tds_free_socket(tds); tds_free_context(ctx); return 0; } freetds-1.3.6/src/tds/unittests/log_elision.c000644 025423 025423 00000006352 14056414271 022707 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2021 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Check log elision implementation */ #include "common.h" #include #include #if HAVE_UNISTD_H #undef getpid #include #endif /* HAVE_UNISTD_H */ enum { LOOP = 100, THREADS = 3, }; static TDS_THREAD_PROC_DECLARE(log_func, idx_ptr) { const int idx = TDS_PTR2INT(idx_ptr); const char letter = 'A' + idx; TDSDUMP_OFF_ITEM off_item; int n = idx, i; /* LOOP times */ for (i = 0; i < LOOP; ++i) { /* send log */ tdsdump_log(TDS_DBG_ERROR, "Some log from %c number %d\n", letter, n); /* wait 1-10 ms */ tds_sleep_ms((rand() % 10) + 1); /* disable logs */ tdsdump_off(&off_item); /* send wrong log */ tdsdump_log(TDS_DBG_ERROR, "Disabled log %c number %d\n", letter, n); /* wait 1-10 ms */ tds_sleep_ms((rand() % 10) + 1); /* enable logs */ tdsdump_on(&off_item); n += 3; } return TDS_THREAD_RESULT(0); } int main(int argc, char **argv) { int i, ret; tds_thread threads[THREADS]; FILE *f; char line[1024]; int wrong_lines = 0; int nexts[THREADS]; tds_debug_flags = TDS_DBGFLAG_ALL | TDS_DBGFLAG_SOURCE; /* remove file */ unlink("log_elision.out"); /* set output file */ tdsdump_open("log_elision.out"); /* THREADS thread */ for (i = 0; i < THREADS; ++i) { nexts[i] = i; } for (i = 1; i < THREADS; ++i) { ret = tds_thread_create(&threads[i], log_func, TDS_INT2PTR(i)); assert(ret == 0); } log_func(TDS_INT2PTR(0)); for (i = 1; i < THREADS; ++i) { ret = tds_thread_join(threads[i], NULL); assert(ret == 0); } /* close logs */ tdsdump_close(); /* open logs to read */ f = fopen("log_elision.out", "r"); assert(f != NULL); /* read line by line */ while (fgets(line, sizeof(line), f) != NULL) { char thread_letter; int num_line, num, idx; /* ignore some start lines */ if (strstr(line, "log_elision.c") == NULL) { assert(++wrong_lines < 4); continue; } ret = sscanf(line, "log_elision.c:%d:Some log from %c number %d\n", &num_line, &thread_letter, &num); assert(ret == 3); /* detect number of thread */ assert(thread_letter >= 'A' && thread_letter < 'A' + THREADS); idx = thread_letter - 'A'; /* check number inside string match the next */ assert(num == nexts[idx]); nexts[idx] += 3; } fclose(f); f = NULL; /* check we got all numbers */ for (i = 0; i < THREADS; ++i) { assert(nexts[i] == i + LOOP * 3); } /* cleanup file */ unlink("log_elision.out"); return 0; } freetds-1.3.6/src/tds/unittests/nulls.c000644 025423 025423 00000006527 14056414222 021541 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2014 Mikhail Denisenko * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 1; int rc; int i; TDSCOLUMN *curcol; TDSRESULTINFO *resinfo; int result_type; printf("%s: Test null values\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } rc = tds_submit_query(tds, "SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL"); while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROW_RESULT: resinfo = tds->res_info; for (i = 0; i < 14; i++) { curcol = resinfo->columns[i]; if (curcol->column_cur_size != -1) { fprintf(stderr, "NULL value expected\n"); return 1; } } case TDS_COMPUTE_RESULT: break; default: fprintf(stderr, "tds_process_tokens() unexpected result\n"); break; } } if (rc == TDS_FAIL) { fprintf(stderr, "query failed\n"); return 1; } if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } rc = tds_submit_query(tds, "SELECT 12, 'abc', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL"); while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROW_RESULT: resinfo = tds->res_info; curcol = resinfo->columns[0]; if (curcol->column_type != SYBINT4) { fprintf(stderr, "SYBINT value expected\n"); return 1; } if (*(TDS_INT*)curcol->column_data != 12) { fprintf(stderr, "invalid integer returned\n"); return 1; } curcol = resinfo->columns[1]; if (curcol->column_type != SYBVARCHAR) { fprintf(stderr, "SYBVARCHAR value expected\n"); return 1; } if (strcmp((char *) curcol->column_data, "abc") != 0) { fprintf(stderr, "invalid string returned\n"); return 1; } for (i = 2; i < 14; i++) { curcol = resinfo->columns[i]; if (curcol->column_cur_size != -1) { fprintf(stderr, "NULL value expected\n"); return 1; } } case TDS_COMPUTE_RESULT: break; default: fprintf(stderr, "tds_process_tokens() unexpected result\n"); break; } } if (rc == TDS_FAIL) { fprintf(stderr, "query failed\n"); return 1; } if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/numeric.c000644 025423 025423 00000007202 14056414222 022035 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2005 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #include /* test numeric scale */ static int g_result = 0; static TDSCONTEXT ctx; static void test0(const char *src, int prec, int scale, int prec2, unsigned char scale2) { int i; char buf[256]; char result[256]; char *p; CONV_RESULT cr; TDS_NUMERIC num; /* get initial number */ memset(&cr.n, 0, sizeof(cr.n)); cr.n.precision = prec; cr.n.scale = scale; if (tds_convert(&ctx, SYBVARCHAR, src, (TDS_UINT)strlen(src), SYBNUMERIC, &cr) < 0) { fprintf(stderr, "Error getting numeric %s(%d,%d)\n", src, prec, scale); exit(1); } num = cr.n; /* change scale with string */ tds_numeric_to_string(&num, buf); while ((p = strchr(buf, '.')) != NULL) memmove(p, p+1, strlen(p)); for (i = 0; i < (scale2 - scale); ++i) strcat(buf, "0"); for (i = 0; i < (scale - scale2); ++i) { assert(strlen(buf) > 1); buf[strlen(buf)-1] = 0; } if (scale2) { size_t len = strlen(buf); assert(len > scale2); memmove(buf + len - scale2 + 1, buf + len - scale2, scale2 + 1); buf[len-scale2] = '.'; } cr.n.precision = prec2; cr.n.scale = scale2; if (tds_convert(&ctx, SYBVARCHAR, src, (TDS_UINT)strlen(src), SYBNUMERIC, &cr) < 0) strcpy(buf, "error"); /* change scale with function */ if (tds_numeric_change_prec_scale(&num, prec2, scale2) < 0) strcpy(result, "error"); else tds_numeric_to_string(&num, result); if (strcmp(buf, result) != 0) { fprintf(stderr, "Failed! %s (%d,%d) -> (%d,%d)\n\tshould be %s\n\tis %s\n", src, prec, scale, prec2, scale2, buf, result); g_result = 1; exit(1); } else { printf("%s -> %s ok!\n", src, buf); } } static void test(const char *src, int prec, int scale, int scale2) { test0(src, prec, scale, prec, scale2); } int main(int argc, char **argv) { int i; memset(&ctx, 0, sizeof(ctx)); /* increase scale */ for (i = 0; i < 10; ++i) { test("1234", 18+i, 0, 2+i); test("1234.1234", 18+i, 5, 3+i); test("1234.1234", 22+i, 5+i, 12+i); } /* overflow */ test("1234", 4, 0, 2); for (i = 1; i < 12; ++i) test("1234", 3+i, 0, i); for (i = 2; i < 12; ++i) test("1234", 2+i, 0, i); /* decrease scale */ test("1234", 10, 4, 0); test("1234.765", 30, 20, 2); test0("765432.2", 30, 2, 20, 2); test0("765432.2", 30, 2, 40, 2); test0("765432.2", 30, 2, 6, 2); /* test big overflows */ test0("10000000000000000000000000", 30, 0, 10, 0); test0("1000000000000000000", 30, 0, 10, 0); test0("10000000000000000", 30, 10, 19, 0); test0("10000000000000000", 30, 10, 12, 0); #if 0 { int p1, s1, p2, s2; for (p1 = 1; p1 <= 77; ++p1) { printf("(%d,%d) -> (%d,%d)\n", p1, s1, p2, s2); for (s1 = 0; s1 < p1; ++s1) for (p2 = 1; p2 <= 77; ++p2) for (s2 = 0; s2 < p2; ++s2) test0("9", p1, s1, p2, s2); } } #endif if (!g_result) printf("All passed!\n"); return g_result; } freetds-1.3.6/src/tds/unittests/parsing.c000644 025423 025423 00000005623 14056414271 022047 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2020 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #undef NDEBUG /* allows to use some internal functions */ #include "../query.c" #include static void test_generic(const char *s, int expected_pos, bool comment, int line) { const char *next; size_t len, n; char *buf; tdsdump_log(TDS_DBG_FUNC, "test line %d\n", line); /* multi byte */ if (comment) next = tds_skip_comment(s); else next = tds_skip_quoted(s); tdsdump_log(TDS_DBG_INFO1, "returned ptr %p diff %ld\n", next, (long int) (next - s)); assert(next >= s); assert(next - s == expected_pos); /* ucs2/utf16 */ len = strlen(s); buf = tds_new(char, len * 2); /* use malloc to help memory debuggers */ for (n = 0; n < len; ++n) { buf[n*2] = s[n]; buf[n*2 + 1] = 0; } s = buf; if (comment) next = tds_skip_comment_ucs2le(s, s + len*2); else next = tds_skip_quoted_ucs2le(s, s + len*2); tdsdump_log(TDS_DBG_INFO1, "returned ptr %p diff %ld\n", next, (long int) (next - s)); assert(next >= s); assert((next - s) % 2 == 0); assert((next - s) / 2 == expected_pos); free(buf); } #define test_comment(s, e) test_generic(s, e, true, __LINE__) #define test_quote(s, e) test_generic(s, e, false, __LINE__) int main(int argc, char **argv) { tdsdump_open(getenv("TDSDUMP")); /* test comment skipping */ test_comment("--", 2); test_comment("-- aa", 6); test_comment("--\nx", 3); test_comment("/*", 2); test_comment("/*/", 3); test_comment("/* a", 8); test_comment("/**/v", 4); test_comment("/* */x", 5); /* test quoted strings */ test_quote("''", 2); test_quote("'a'", 3); test_quote("''''", 4); test_quote("'a'''", 5); test_quote("'''a'", 5); test_quote("'' ", 2); test_quote("'a'x", 3); test_quote("'''' ", 4); test_quote("'a'''x", 5); test_quote("'''a' ", 5); /* test quoted identifiers */ test_quote("[]", 2); test_quote("[a]", 3); test_quote("[]]]", 4); test_quote("[a]]]", 5); test_quote("[]]a]", 5); test_quote("[]x", 2); test_quote("[a] ", 3); test_quote("[]]]x", 4); test_quote("[a]]] ", 5); test_quote("[]]a]x", 5); test_quote("[[]", 3); test_quote("[[[]", 4); test_quote("[[x[]", 5); return 0; } freetds-1.3.6/src/tds/unittests/portconf.c000644 025423 025423 00000006124 14056414271 022233 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2019 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include static void set_interface(void) { const char *in_file = FREETDS_SRCDIR "/portconf.in"; FILE *f = fopen(in_file, "r"); if (!f) { in_file = "portconf.in"; f = fopen(in_file, "r"); } if (!f) { fprintf(stderr, "error opening test file\n"); exit(1); } fclose(f); tds_set_interfaces_file_loc(in_file); } static void dump_login(const char *name, const TDSLOGIN *login) { printf("Dump login %s\n", name); #define STR(name) printf(" " #name ": %s\n", tds_dstr_cstr(&login->name)); #define INT(name) printf(" " #name ": %d\n", login->name); STR(server_name); STR(server_host_name); STR(instance_name); INT(port); } static void test0(TDSCONTEXT *ctx, TDSSOCKET *tds, const char *input, const char *expected, int line) { TDSLOGIN *login, *connection; char *ret = NULL; login = tds_alloc_login(1); if (!login || !tds_set_server(login, input)) { fprintf(stderr, "Error setting login!\n"); exit(1); } connection = tds_read_config_info(tds, login, ctx->locale); dump_login("input", login); dump_login("final", connection); if (asprintf(&ret, "%s,%s,%s,%d", tds_dstr_cstr(&connection->server_name), tds_dstr_cstr(&connection->server_host_name), tds_dstr_cstr(&connection->instance_name), connection->port) < 0) exit(1); if (strcmp(ret, expected) != 0) { fprintf(stderr, "Mismatch line %d:\n OUT: %s\n EXP: %s\n", line, ret, expected); exit(1); } tds_free_login(connection); tds_free_login(login); free(ret); } #define test(in, out) test0(ctx, tds, in, out, __LINE__) int main(void) { TDSCONTEXT *ctx = tds_alloc_context(NULL); TDSSOCKET *tds = tds_alloc_socket(ctx, 512); FILE *f; /* set an empty base configuration */ f = fopen("empty.conf", "w"); if (f) fclose(f); putenv("FREETDSCONF=empty.conf"); unsetenv("TDSPORT"); set_interface(); if (!ctx || !tds) { fprintf(stderr, "Error creating socket!\n"); return 1; } test("NotExistingServer1:1234", "my_server,8.7.6.5,,1234"); test("localhost:1234", "localhost,localhost,,1234"); test("NotExistingServer1\\named", "my_server,8.7.6.5,named,0"); test("localhost\\named", "localhost,localhost,named,0"); tds_free_socket(tds); tds_free_context(ctx); tds_set_interfaces_file_loc(NULL); return 0; } freetds-1.3.6/src/tds/unittests/portconf.in000644 025423 025423 00000000153 14056414222 022407 0ustar00fredianofrediano000000 000000 [global] port = 1433 [NotExistingServer1] asa database=my_server server name=pippo host=8.7.6.5 port=4321 freetds-1.3.6/src/tds/unittests/readconf.c000644 025423 025423 00000004317 14056414222 022160 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" static FILE *f = NULL; static char *return_value = NULL; static void conf_parse(const char *option, const char *value, void *param) { const char *entry = (const char *) param; if (strcmp(option, entry) == 0) return_value = strdup(value); } static void test(const char *section, const char *entry, const char *expected) { int fail = 0; rewind(f); tds_read_conf_section(f, section, conf_parse, (void *) entry); if (!expected && return_value) { fprintf(stderr, "return value %s NOT expected\n", return_value); fail = 1; } else if (expected && !return_value) { fprintf(stderr, "expected value %s NOT found\n", expected); fail = 1; } else if (expected && return_value) { if (strcmp(expected, return_value) != 0) { fprintf(stderr, "expected value %s got %s\n", expected, return_value); fail = 1; } } free(return_value); return_value = NULL; if (fail) exit(1); } int main(int argc, char **argv) { const char *in_file = FREETDS_SRCDIR "/readconf.in"; f = fopen(in_file, "r"); if (!f) f = fopen("readconf.in", "r"); if (!f) { fprintf(stderr, "error opening test file\n"); exit(1); } /* option with no spaces */ test("section1", "opt1", "value1"); /* option name with spaces, different case in section name */ test("section2", "opt two", "value2"); test("section 3", "opt three", "value three"); fclose(f); return 0; } freetds-1.3.6/src/tds/unittests/readconf.in000644 025423 025423 00000000145 14056414222 022337 0ustar00fredianofrediano000000 000000 [section1] opt1=value1 [SECTION2] opt two=value2 [Section 3] opt three = value three freetds-1.3.6/src/tds/unittests/t0001.c000644 025423 025423 00000002374 14056414222 021144 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Just connect to server and disconnect */ #include "common.h" int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int ret; int verbose = 0; printf("%s: Testing login, logout\n", __FILE__); ret = try_tds_login(&login, &tds, __FILE__, verbose); if (ret != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/strftime.c000644 025423 025423 00000004047 14056414271 022240 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2020 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Purpose: test tds_strftime. * This is a wrapper to strftime for portability and extension. */ #include "common.h" #include #include #include static void test(const TDSDATEREC* dr, int prec, const char *fmt, const char *expected, int line) { char out[256]; char *format = strdup(fmt); assert(format != NULL); tds_strftime(out, sizeof(out), format, dr, prec); if (strcmp(out, expected) != 0) { fprintf(stderr, "%d: Wrong results got '%s' expected '%s'\n", line, out, expected); exit(1); } free(format); } int main(int argc, char **argv) { TDSDATEREC dr; memset(&dr, 0, sizeof(dr)); #define TEST(prec, fmt, exp) test(&dr, prec, fmt, exp, __LINE__) /* %z extension, second decimals */ TEST(3, "%z", "000"); TEST(0, "x%z", "x"); TEST(3, ".%z", ".000"); dr.decimicrosecond = 1234567; TEST(5, ".%z", ".12345"); TEST(4, "%z", "1234"); TEST(4, "%z%%", "1234%"); TEST(4, "%z%H", "123400"); /* not portable %l, we should handle it */ TEST(0, "%l", "12"); TEST(0, "%%%l", "%12"); dr.hour = 16; TEST(0, "%l", " 4"); /* not portable %e, we should handle it */ dr.day = 23; TEST(0, "%e", "23"); dr.day = 5; TEST(0, "x%e", "x 5"); return 0; } freetds-1.3.6/src/tds/unittests/t0002.c000644 025423 025423 00000007073 14056414271 021152 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #include static char * value_as_string(TDSSOCKET * tds, int col_idx) { static char result[256]; const int type = tds->res_info->columns[col_idx]->column_type; const void *value = tds->res_info->columns[col_idx]->column_data; switch (type) { case SYBVARCHAR: strlcpy(result, (const char *) value, sizeof(result)); break; case SYBINT4: sprintf(result, "%d", *(const int *) value); break; default: sprintf(result, "Unexpected column_type %d", type); break; } return result; } /* value_as_string() */ int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 0; int num_cols = 2; TDS_INT result_type; int rc; int i, done_flags; printf("%s: Test basic submit query, results\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } rc = tds_submit_query(tds, "select db_name() dbname, user_name() username"); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_submit_query() failed\n"); return 1; } while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROWFMT_RESULT: if (tds->res_info->num_cols != num_cols) { fprintf(stderr, "Error: num_cols != %d in %s\n", num_cols, __FILE__); return 1; } if (tds->res_info->columns[0]->column_type != SYBVARCHAR || tds->res_info->columns[1]->column_type != SYBVARCHAR) { fprintf(stderr, "Wrong column_type in %s\n", __FILE__); return 1; } if (strcmp(tds_dstr_cstr(&tds->res_info->columns[0]->column_name), "dbname") || strcmp(tds_dstr_cstr(&tds->res_info->columns[1]->column_name), "username")) { fprintf(stderr, "Wrong column_name in %s\n", __FILE__); return 1; } break; case TDS_ROW_RESULT: while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { if (result_type != TDS_ROW_RESULT || result_type != TDS_COMPUTE_RESULT) break; if (verbose) { for (i = 0; i < num_cols; i++) { printf("col %i is %s\n", i, value_as_string(tds, i)); } } } if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } break; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if (!(done_flags & TDS_DONE_ERROR)) break; default: fprintf(stderr, "tds_process_tokens() unexpected result_type\n"); break; } } if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/t0003.c000644 025423 025423 00000003655 14056414222 021151 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 0; int rc; printf("%s: Testing DB change -- 'use tempdb'\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } rc = tds_submit_query(tds, "use tempdb"); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_submit_query() failed\n"); return 1; } /* warning: this mucks with some internals to get the env chg message */ if (tds_process_simple_query(tds) != TDS_SUCCESS) { fprintf(stderr, "query results failed\n"); return 1; } if (!tds || !tds->conn->env.database) { fprintf(stderr, "No database ??\n"); return 1; } /* Test currently disabled during TDSENV changes */ if (verbose) { printf("database changed to %s\n", tds->conn->env.database); } if (strcmp(tds->conn->env.database, "tempdb")) { fprintf(stderr, "Wrong database, %s != tempdb\n", tds->conn->env.database); return 1; } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/t0004.c000644 025423 025423 00000007005 14056414271 021147 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include static char * varchar_as_string(TDSSOCKET * tds, int col_idx) { static char result[256]; const void *value = tds->res_info->columns[col_idx]->column_data; strlcpy(result, (const char *) value, sizeof(result)); return result; } int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 0; int rc, i; int result_type; int rows_returned = 0; const char *len200 = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"; char *long_query = (char*) malloc(5000); strcpy(long_query, "SELECT name FROM #longquerytest WHERE ("); for (i = 0; i < 20; ++i) sprintf(strchr(long_query, 0), "name = '%c%s' OR ", 'A'+i, len200); strcat(long_query, "name = 'correct')"); printf("%s: Test large (>4096 bytes) queries\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } /* do not check error here, if TABLE is not create this give error */ rc = run_query(tds, "DROP TABLE #longquerytest"); rc = run_query(tds, "CREATE TABLE #longquerytest (name varchar(255))"); if (rc != TDS_SUCCESS) { return 1; } rc = run_query(tds, "INSERT #longquerytest (name) VALUES ('incorrect')"); if (rc != TDS_SUCCESS) { return 1; } rc = run_query(tds, "INSERT #longquerytest (name) VALUES ('correct')"); if (rc != TDS_SUCCESS) { return 1; } /* * The heart of the test */ if (verbose) { printf("block size %d\n", tds->conn->env.block_size); } rc = tds_submit_query(tds, long_query); while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_RETURN_ROWFMT|TDS_RETURN_ROW)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROWFMT_RESULT: if (tds->res_info->columns[0]->column_type != SYBVARCHAR) { fprintf(stderr, "Wrong column_type in %s\n", __FILE__); return 1; } break; case TDS_ROW_RESULT: ++rows_returned; if (verbose) { printf("col 0 is %s\n", varchar_as_string(tds, 0)); } break; default: break; } } if (rc == TDS_FAIL) { fprintf(stderr, "tds_process_tokens() returned TDS_FAIL for long query\n"); return 1; } else if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } if (rows_returned != 1) { fprintf(stderr, "%d rows returned, 1 expected\n", rows_returned); return 1; } /* do not check error here, if TABLE is not create this give error */ rc = run_query(tds, "DROP TABLE #longquerytest"); try_tds_logout(login, tds, verbose); free(long_query); return 0; } freetds-1.3.6/src/tds/unittests/t0005.c000644 025423 025423 00000006761 14056414271 021160 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include static char *value_as_string(TDSSOCKET * tds, int col_idx); int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 0; int rc; int i; int result_type; const char *len200 = "01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"; char large_sql[1000]; printf("%s: Test large (>512 bytes) replies\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } /* do not test error, remove always table */ rc = run_query(tds, "DROP TABLE #test_table"); rc = run_query(tds, "CREATE TABLE #test_table (id int, name varchar(255))"); if (rc != TDS_SUCCESS) { return 1; } sprintf(large_sql, "INSERT #test_table (id, name) VALUES (0, 'A%s')", len200); rc = run_query(tds, large_sql); if (rc != TDS_SUCCESS) { return 1; } sprintf(large_sql, "INSERT #test_table (id, name) VALUES (1, 'B%s')", len200); rc = run_query(tds, large_sql); if (rc != TDS_SUCCESS) { return 1; } sprintf(large_sql, "INSERT #test_table (id, name) VALUES (2, 'C%s')", len200); rc = run_query(tds, large_sql); if (rc != TDS_SUCCESS) { return 1; } /* * The heart of the test */ rc = tds_submit_query(tds, "SELECT * FROM #test_table"); while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_RETURN_ROW)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROW_RESULT: for (i = 0; i < tds->res_info->num_cols; i++) { if (verbose) { printf("col %i is %s\n", i, value_as_string(tds, i)); } } break; default: fprintf(stderr, "tds_process_tokens() returned unexpected result\n"); break; } } if (rc == TDS_FAIL) { fprintf(stderr, "tds_process_tokens() returned TDS_FAIL for SELECT\n"); return 1; } else if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } /* do not test error, remove always table */ rc = run_query(tds, "DROP TABLE #test_table"); try_tds_logout(login, tds, verbose); return 0; } static char * value_as_string(TDSSOCKET * tds, int col_idx) { static char result[256]; const int type = tds->res_info->columns[col_idx]->column_type; const void *value = tds->res_info->columns[col_idx]->column_data; switch (type) { case SYBVARCHAR: strlcpy(result, (const char *) value, sizeof(result)); break; case SYBINT4: sprintf(result, "%d", *(const int *) value); break; default: sprintf(result, "Unexpected column_type %d", type); break; } return result; } freetds-1.3.6/src/tds/unittests/t0006.c000644 025423 025423 00000013022 14056414222 021141 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include static TDSCONTEXT ctx; int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 0; int rc; int row_count, i; /* variables for conversions */ TDSCOLUMN *curcol; TDSRESULTINFO *resinfo; unsigned char *src; CONV_RESULT cr; TDS_INT srctype, srclen; int src_id = 0; double src_val; double src_err; double tolerance = 0.000001; char sql[256]; int num_sybreal = 5; float sybreal[5]; int num_sybflt8 = 7; double sybflt8[7]; int result_type; memset(&ctx, 0, sizeof(ctx)); sybreal[0] = (float) 1.1; sybreal[1] = (float) 12345678; sybreal[2] = (float) 0.012345678; sybreal[3] = (float) 1.234567890e+20; sybreal[4] = (float) 1.234567890e-20; sybflt8[0] = 1.1; sybflt8[1] = 1234567890123456.0; sybflt8[2] = 0.01234567890123456; sybflt8[3] = 1.234567890123456e+20; sybflt8[4] = 1.234567890123456e-20; sybflt8[5] = 1.234567890123456e+200; sybflt8[6] = 1.234567890123456e-200; printf("%s: Test SYBREAL, SYBFLT8 values\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } /* * SYBREAL tests */ if (verbose) printf("Starting SYBREAL tests\n"); rc = run_query(tds, "DROP TABLE #test_table"); if (rc != TDS_SUCCESS) { return 1; } rc = run_query(tds, "CREATE TABLE #test_table (id int, val real)"); if (rc != TDS_SUCCESS) { return 1; } for (i = 0; i < num_sybreal; i++) { sprintf(sql, "INSERT #test_table (id, val) VALUES (%d, %.8g)", i, sybreal[i]); if (verbose) printf("%s\n", sql); rc = run_query(tds, sql); if (rc != TDS_SUCCESS) { return 1; } } rc = tds_submit_query(tds, "SELECT * FROM #test_table"); row_count = 0; while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROW_RESULT: resinfo = tds->res_info; for (i = 0; i < resinfo->num_cols; i++) { curcol = resinfo->columns[i]; src = curcol->column_data; if (verbose) { srctype = curcol->column_type; srclen = curcol->column_size; tds_convert(&ctx, srctype, src, srclen, SYBCHAR, &cr); printf("col %i is %s\n", i, cr.c); } if (i == 0) { src_id = *(int *) src; } else { src_val = *(float *) src; src_err = src_val - sybreal[src_id]; if (src_err != 0.0) { src_err = src_err / src_val; } if (src_err < -tolerance || src_err > tolerance) { fprintf(stderr, "SYBREAL expected %.8g got %.8g\n", sybreal[src_id], src_val); fprintf(stderr, "Error was %.4g%%\n", 100 * src_err); return 1; } } } row_count++; case TDS_COMPUTE_RESULT: break; default: fprintf(stderr, "tds_process_tokens() unexpected result\n"); break; } } if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } /* * SYBFLT8 tests */ if (verbose) printf("Starting SYBFLT8 tests\n"); rc = run_query(tds, "DROP TABLE #test_table"); if (rc != TDS_SUCCESS) { return 1; } rc = run_query(tds, "CREATE TABLE #test_table (id int, val float(48))"); if (rc != TDS_SUCCESS) { return 1; } for (i = 0; i < num_sybflt8; i++) { sprintf(sql, "INSERT #test_table (id, val) VALUES (%d, %.15g)", i, sybflt8[i]); if (verbose) printf("%s\n", sql); rc = run_query(tds, sql); if (rc != TDS_SUCCESS) { return 1; } } rc = tds_submit_query(tds, "SELECT * FROM #test_table"); while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROW_RESULT: resinfo = tds->res_info; for (i = 0; i < resinfo->num_cols; i++) { curcol = resinfo->columns[i]; src = curcol->column_data; if (verbose) { srctype = curcol->column_type; srclen = curcol->column_size; tds_convert(&ctx, srctype, src, srclen, SYBCHAR, &cr); printf("col %i is %s\n", i, cr.c); } if (i == 0) { src_id = *(int *) src; } else { memcpy(&src_val, src, 8); src_err = src_val - sybflt8[src_id]; if (src_err != 0.0) { src_err = src_err / src_val; } if (src_err < -tolerance || src_err > tolerance) { fprintf(stderr, "SYBFLT8 expected %.16g got %.16g\n", sybflt8[src_id], src_val); fprintf(stderr, "Error was %.4g%%\n", 100 * src_err); return 1; } } } case TDS_COMPUTE_RESULT: break; default: fprintf(stderr, "tds_process_tokens() returned unexpected result\n"); break; } } if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/t0007.c000644 025423 025423 00000034123 14056414222 021147 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * This test exercise manually conversions from types. * Does not require any connection. */ #include "common.h" #include static TDSCONTEXT ctx; static void test0(const char *src, int len, int midtype, int dsttype, const char *result, int line) { int i, res; char buf[256]; CONV_RESULT cr, cr_mid, cr_out; int srctype = SYBVARCHAR; char *copy; copy = tds_new(char, len); memcpy(copy, src, len); src = copy; if (midtype) { if (midtype == SYBNUMERIC || midtype == SYBDECIMAL) { cr_mid.n.precision = 20; cr_mid.n.scale = 8; } res = tds_convert(&ctx, SYBVARCHAR, src, len, midtype, &cr_mid); if (res < 0) { fprintf(stderr, "Unexpected failure converting %*.*s\n", len, len, src); exit(1); } src = (const char *) &cr_mid; len = res; srctype = midtype; } if (dsttype == SYBNUMERIC || dsttype == SYBDECIMAL) { cr.n.precision = 20; cr.n.scale = 8; } res = tds_convert(&ctx, srctype, src, len, dsttype, &cr); if (res < 0) strcpy(buf, "error"); else { buf[0] = 0; switch (dsttype) { case SYBINT1: case SYBUINT1: sprintf(buf, "%d", cr.ti); break; case SYBINT2: sprintf(buf, "%d", cr.si); break; case SYBUINT2: sprintf(buf, "%u", cr.usi); break; case SYBINT4: sprintf(buf, "%d", cr.i); break; case SYBUINT4: sprintf(buf, "%u", cr.ui); break; case SYBINT8: sprintf(buf, "0x%08x%08x", (unsigned int) ((cr.bi >> 32) & 0xfffffffflu), (unsigned int) (cr.bi & 0xfffffffflu)); break; case SYB5BIGTIME: case SYB5BIGDATETIME: case SYBUINT8: sprintf(buf, "0x%08x%08x", (unsigned int) ((cr.ubi >> 32) & 0xfffffffflu), (unsigned int) (cr.ubi & 0xfffffffflu)); break; case SYBUNIQUE: sprintf(buf, "%08X-%04X-%04X-%02X%02X%02X%02X" "%02X%02X%02X%02X", cr.u.Data1, cr.u.Data2, cr.u.Data3, cr.u.Data4[0], cr.u.Data4[1], cr.u.Data4[2], cr.u.Data4[3], cr.u.Data4[4], cr.u.Data4[5], cr.u.Data4[6], cr.u.Data4[7]); break; case SYBBINARY: sprintf(buf, "len=%d", res); for (i = 0; i < res; ++i) sprintf(strchr(buf, 0), " %02X", (TDS_UCHAR) cr.ib[i]); free(cr.ib); break; case SYBCHAR: sprintf(buf, "len=%d %s", res, cr.c); free(cr.c); break; case SYBDATETIME: sprintf(buf, "%ld %ld", (long int) cr.dt.dtdays, (long int) cr.dt.dttime); break; case SYBDATE: sprintf(buf, "%ld", (long int) cr.date); break; case SYBTIME: sprintf(buf, "%ld", (long int) cr.time); break; case SYBNUMERIC: case SYBDECIMAL: cr_out.cc.c = buf; cr_out.cc.len = sizeof(buf) - 1; res = tds_convert(&ctx, dsttype, &cr.n, sizeof(cr.n), TDS_CONVERT_CHAR, &cr_out); if (res < 0) { fprintf(stderr, "Unexpected failure converting %*.*s\n", len, len, src); exit(1); } buf[res] = 0; } } printf("%s\n", buf); if (strcmp(buf, result) != 0) { fprintf(stderr, "Expected '%s' got '%s' at line %d\n", result, buf, line); exit(1); } free(copy); } #define test(s,d,r) test0(s,strlen(s),0,d,r,__LINE__) #define test2(s,m,d,r) test0(s,strlen(s),m,d,r,__LINE__) static int int_types[] = { SYBINT1, SYBUINT1, SYBINT2, SYBUINT2, SYBINT4, SYBUINT4, SYBINT8, SYBUINT8, SYBMONEY4, SYBMONEY, SYBNUMERIC, -1 }; static const char * int_values[] = { "0", "127", "255", "128", "256", "32767", "65535", "32768", "65536", "214748", "214749", "2147483647", "4294967295", "2147483648", "4294967296", "922337203685477", "922337203685478", "9223372036854775807", "18446744073709551615", "9223372036854775808", "18446744073709551616", "-128", "-129", "-32768", "-32769", "-214748", "-214749", "-2147483648", "-2147483649", "-922337203685477", "-922337203685478", "-9223372036854775808", "-9223372036854775809", NULL }; int main(int argc, char **argv) { int *type1, *type2; const char **value; int big_endian = 1; if (((char *) &big_endian)[0] == 1) big_endian = 0; memset(&ctx, 0, sizeof(ctx)); if ((ctx.locale = tds_get_locale()) == NULL) return 1; /* date */ free(ctx.locale->date_fmt); ctx.locale->date_fmt = strdup("%Y-%m-%d %H:%M:%S.%z"); /* test some conversion */ printf("some checks...\n"); test("1234", SYBINT4, "1234"); test("1234", SYBUINT4, "1234"); test("123", SYBINT1, "123"); test("123", SYBUINT1, "123"); test(" - 1234 ", SYBINT2, "-1234"); test(" - 1234 a", SYBINT2, "error"); test("", SYBINT4, "0"); test(" ", SYBINT4, "0"); test(" 123", SYBINT4, "123"); test(" 123 ", SYBINT4, "123"); test(" + 123 ", SYBINT4, "123"); test(" + 123 ", SYBUINT4, "123"); test(" - 0 ", SYBINT4, "0"); test(" - 0 ", SYBUINT4, "0"); test("+", SYBINT4, "error"); test(" +", SYBINT4, "error"); test("+ ", SYBINT4, "error"); test(" + ", SYBINT4, "error"); test("-", SYBINT4, "error"); test(" -", SYBINT4, "error"); test("- ", SYBINT4, "error"); test(" - ", SYBINT4, "error"); test(" - 1234 ", SYBINT8, "0xfffffffffffffb2e"); test("1234x", SYBINT8, "error"); test(" - 1234 a", SYBINT8, "error"); test("", SYBINT8, "0x0000000000000000"); test(" ", SYBINT8, "0x0000000000000000"); test(" 123", SYBINT8, "0x000000000000007b"); test(" 123 ", SYBINT8, "0x000000000000007b"); test(" + 123 ", SYBINT8, "0x000000000000007b"); test(" 123", SYBUINT8, "0x000000000000007b"); test(" 123 ", SYBUINT8, "0x000000000000007b"); test(" + 123 ", SYBUINT8, "0x000000000000007b"); test("+", SYBINT8, "error"); test(" +", SYBINT8, "error"); test("+ ", SYBINT8, "error"); test(" + ", SYBINT8, "error"); test("-", SYBINT8, "error"); test(" -", SYBINT8, "error"); test("- ", SYBINT8, "error"); test(" - ", SYBINT8, "error"); /* test for overflow */ /* for SYBUINT8 a test with all different digit near limit is required */ printf("overflow checks...\n"); test("9223372036854775807", SYBINT8, "0x7fffffffffffffff"); test("9223372036854775807", SYBUINT8, "0x7fffffffffffffff"); test("9223372036854775808", SYBINT8, "error"); test("-9223372036854775808", SYBINT8, "0x8000000000000000"); test("9223372036854775808", SYBUINT8, "0x8000000000000000"); test("18446744073709551610", SYBUINT8, "0xfffffffffffffffa"); test("18446744073709551611", SYBUINT8, "0xfffffffffffffffb"); test("18446744073709551612", SYBUINT8, "0xfffffffffffffffc"); test("18446744073709551613", SYBUINT8, "0xfffffffffffffffd"); test("18446744073709551614", SYBUINT8, "0xfffffffffffffffe"); test("18446744073709551615", SYBUINT8, "0xffffffffffffffff"); test("18446744073709551616", SYBUINT8, "error"); test("18446744073709551617", SYBUINT8, "error"); test("18446744073709551618", SYBUINT8, "error"); test("18446744073709551619", SYBUINT8, "error"); test("18446744073709551620", SYBUINT8, "error"); test("20496382304121724025", SYBUINT8, "error"); test("20496382308118429681", SYBUINT8, "error"); test("-1", SYBUINT8, "error"); test("-9223372036854775809", SYBINT8, "error"); test("2147483647", SYBINT4, "2147483647"); test("2147483648", SYBINT4, "error"); test("2147483647", SYBUINT4, "2147483647"); test("4294967295", SYBUINT4, "4294967295"); test("4294967296", SYBUINT4, "error"); test("-2147483648", SYBINT4, "-2147483648"); test("-2147483648", SYBUINT4, "error"); test("-2147483649", SYBINT4, "error"); test("32767", SYBINT2, "32767"); test("32767", SYBUINT2, "32767"); test("65535", SYBUINT2, "65535"); test("65536", SYBUINT2, "error"); test("32768", SYBINT2, "error"); test("-32768", SYBINT2, "-32768"); test("-32769", SYBINT2, "error"); test("255", SYBINT1, "255"); test("256", SYBINT1, "error"); test("255", SYBUINT1, "255"); test("256", SYBUINT1, "error"); test("0", SYBINT1, "0"); test("-1", SYBINT1, "error"); test("0", SYBUINT1, "0"); test("-1", SYBUINT1, "error"); /* * test overflow on very big numbers * I use increment of 10^9 to be sure lower 32bit be correct * in a case */ printf("overflow on big number checks...\n"); test("62147483647", SYBINT4, "error"); test("63147483647", SYBINT4, "error"); test("64147483647", SYBINT4, "error"); test("65147483647", SYBINT4, "error"); test("53248632876323876761", SYBINT8, "error"); test("56248632876323876761", SYBINT8, "error"); test("59248632876323876761", SYBINT8, "error"); test("12248632876323876761", SYBINT8, "error"); /* money */ test2("1234.11111111111111111111111111111111111111111111111111111111111111111111111111111111111111", SYBMONEY, SYBCHAR, "len=9 1234.1111"); /* some test for unique */ printf("unique type...\n"); test("12345678-1234-1234-9876543298765432", SYBUNIQUE, "12345678-1234-1234-9876543298765432"); test("{12345678-1234-1E34-9876ab3298765432}", SYBUNIQUE, "12345678-1234-1E34-9876AB3298765432"); test(" 12345678-1234-1234-9876543298765432", SYBUNIQUE, "error"); test(" {12345678-1234-1234-9876543298765432}", SYBUNIQUE, "error"); test("12345678-1234-G234-9876543298765432", SYBUNIQUE, "error"); test("12345678-1234-a234-9876543298765432", SYBUNIQUE, "12345678-1234-A234-9876543298765432"); test("123a5678-1234-a234-98765-43298765432", SYBUNIQUE, "error"); test("123-5678-1234-a234-9876543298765432", SYBUNIQUE, "error"); printf("binary test...\n"); test("0x1234", SYBBINARY, "len=2 12 34"); test("0xaBFd ", SYBBINARY, "len=2 AB FD"); test("AbfD ", SYBBINARY, "len=2 AB FD"); test("0x000", SYBBINARY, "len=2 00 00"); test("0x0", SYBBINARY, "len=1 00"); test("0x100", SYBBINARY, "len=2 01 00"); test("0x1", SYBBINARY, "len=1 01"); test("Jan 01 2006", SYBDATETIME, "38716 0"); test("January 01 2006", SYBDATETIME, "38716 0"); test("March 05 2005", SYBDATETIME, "38414 0"); test("may 13 2001", SYBDATETIME, "37022 0"); test("02 Jan 2006", SYBDATETIME, "38717 0"); test("2 Jan 2006", SYBDATETIME, "38717 0"); test("02Jan2006", SYBDATETIME, "38717 0"); test("20060102", SYBDATETIME, "38717 0"); test("060102", SYBDATETIME, "38717 0"); test("2006-01-02", SYBDATE, "38717"); test("12:34:56.337", SYBTIME, "13588901"); test2("2006-01-02", SYBDATE, SYBDATE, "38717"); test2("12:34:56.337", SYBTIME, SYBTIME, "13588901"); test2("2006-01-02 12:34:56.337", SYBDATETIME, SYBDATE, "38717"); test2("2006-01-02 12:34:56.337", SYBDATETIME, SYBTIME, "13588901"); test("2006-01-02 12:34:56.337321", SYB5BIGTIME, "0x0000000a8bdf41a9"); test("2006-01-23 12:34:56.337321", SYB5BIGDATETIME, "0x00e0e7c784d661a9"); test("2006-01-02 12:34:56.337321", SYB5BIGDATETIME, "0x00e0e621122b81a9"); test2("2006-01-02 12:34:56.337765", SYB5BIGDATETIME, SYBCHAR, "len=26 2006-01-02 12:34:56.337765"); test("2006-01-02 12:34:56.337765", SYB5BIGDATETIME, "0x00e0e621122b8365"); test2("2006-01-02 12:34:56.337", SYBMSDATETIME2, SYBDATE, "38717"); test2("2006-01-02 12:34:56.337", SYBMSDATETIME2, SYBTIME, "13588901"); test2("2006-01-02 12:34:56.337", SYBMSDATETIME2, SYBCHAR, "len=27 2006-01-02 12:34:56.3370000"); #if 0 /* FIXME should fail conversion ?? */ test2("2006-01-02", SYBDATE, SYBTIME, "0"); test2("12:34:56.337", SYBTIME, SYBDATE, "0"); #endif test2("2006-01-02", SYBDATE, SYBCHAR, "len=23 2006-01-02 00:00:00.000"); test2("12:34:56.337", SYBTIME, SYBCHAR, "len=23 1900-01-01 12:34:56.337"); test2("123", SYBINT1, SYBBINARY, "len=1 7B"); test2("0.000001", SYBFLT8, SYBNUMERIC, "0.00000100"); if (big_endian) { test2("12345", SYBINT2, SYBBINARY, "len=2 30 39"); test2("123456789", SYBINT4, SYBBINARY, "len=4 07 5B CD 15"); test2("123456789", SYBUINT8, SYBBINARY, "len=8 00 00 00 00 07 5B CD 15"); test2("123456789", SYBINT8, SYBBINARY, "len=8 00 00 00 00 07 5B CD 15"); test2("-123456789", SYBINT8, SYBBINARY, "len=8 FF FF FF FF F8 A4 32 EB"); } else { test2("12345", SYBINT2, SYBBINARY, "len=2 39 30"); test2("123456789", SYBINT4, SYBBINARY, "len=4 15 CD 5B 07"); test2("123456789", SYBUINT8, SYBBINARY, "len=8 15 CD 5B 07 00 00 00 00"); test2("123456789", SYBINT8, SYBBINARY, "len=8 15 CD 5B 07 00 00 00 00"); test2("-123456789", SYBINT8, SYBBINARY, "len=8 EB 32 A4 F8 FF FF FF FF"); } /* now try many int conversion operations */ for (value = int_values; *value; ++value) for (type1 = int_types; *type1 >= 0; ++type1) for (type2 = int_types; *type2 >= 0; ++type2) { char buf[64], expected[64]; CONV_RESULT cr_src, cr_dst; TDS_INT len_src, len_dst; /* try conversion from char (already tested above) */ cr_src.n.precision = 20; cr_src.n.scale = 0; len_src = tds_convert(&ctx, SYBVARCHAR, *value, strlen(*value), *type1, &cr_src); cr_dst.n.precision = 20; cr_dst.n.scale = 0; len_dst = tds_convert(&ctx, SYBVARCHAR, *value, strlen(*value), *type2, &cr_dst); if (len_src <= 0 || len_dst <= 0) continue; cr_dst.n.precision = 20; cr_dst.n.scale = 0; if (tds_convert(&ctx, *type1, &cr_src.i, len_src, *type2, &cr_dst) <= 0) { fprintf(stderr, "conversion from %s to %s of %s should succeed\n", tds_prtype(*type1), tds_prtype(*type2), *value); return 1; } memcpy(&cr_src, &cr_dst, sizeof(cr_dst)); cr_dst.cc.c = buf; cr_dst.cc.len = sizeof(buf)-4; len_dst = tds_convert(&ctx, *type2, &cr_src.i, len_dst, TDS_CONVERT_CHAR, &cr_dst); if (len_dst <= 0) { fprintf(stderr, "conversion from %s to string should succeed\n", tds_prtype(*type1)); return 1; } buf[len_dst] = 0; if (*type2 == SYBMONEY4 || *type2 == SYBMONEY) sprintf(expected, "%s.0000", *value); else strcpy(expected, *value); if (strcmp(buf, expected) != 0) { fprintf(stderr, "conversion from %s to %s of %s got wrong value '%s'\n", tds_prtype(*type1), tds_prtype(*type2), *value, buf); return 1; } } tds_free_locale(ctx.locale); return 0; } freetds-1.3.6/src/tds/unittests/t0008.c000644 025423 025423 00000010100 14056414222 021135 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include static int g_result = 0; static TDSCONTEXT ctx; static void test(const char *src, const char *intro, const char *cont, int prec, int scale, int n2s, int line) { int i; char buf[256]; char result[256]; CONV_RESULT cr; /* build result string from intro and cont */ strcpy(result, intro); if (*cont) { for (i = 0; i < sizeof(cr.n.array); ++i) strcat(result, " 00"); memcpy(result + strlen(intro) + 1, cont, strlen(cont)); } memset(&cr.n, 0, sizeof(cr.n)); cr.n.precision = prec; cr.n.scale = scale; if (tds_convert(&ctx, SYBVARCHAR, src, strlen(src), SYBNUMERIC, &cr) < 0) strcpy(buf, "error"); else { sprintf(buf, "prec=%d scale=%d", cr.n.precision, cr.n.scale); for (i = 0; i < sizeof(cr.n.array); ++i) sprintf(strchr(buf, 0), " %02X", cr.n.array[i]); } printf("%s\n", buf); if (strcmp(buf, result) != 0) { fprintf(stderr, "line %d: Failed! Should be\n\t%s\n", line, result); g_result = 1; } if (!n2s || strcmp(buf, "error") == 0) return; tds_numeric_to_string(&cr.n, buf); printf("%s\n", buf); if (strcmp(buf, src) != 0) { fprintf(stderr, "line %d: Failed! Should be\n\t%s\n", line, src); g_result = 1; } } #define test(a,b,c,d,e,f) test(a,b,c,d,e,f,__LINE__) int main(int argc, char **argv) { /* very long string for test buffer overflow */ int i; char long_test[201]; memset(&ctx, 0, sizeof(ctx)); printf("test some valid values..\n"); test(" 1234", "prec=18 scale=0", "00 00 00 00 00 00 00 04 D2", 18, 0, 0); test("1234567890", "prec=18 scale=0", "00 00 00 00 00 49 96 02 D2", 18, 0, 1); test("123456789012345678", "prec=18 scale=0", "00 01 B6 9B 4B A6 30 F3 4E", 18, 0, 1); test("999999999999999999", "prec=18 scale=0", "00 0D E0 B6 B3 A7 63 FF FF", 18, 0, 1); printf("test overflow..\n"); test("123456789012345678901234567890", "error", "", 18, 0, 0); long_test[0] = 0; for (i = 0; i < 20; ++i) strcat(long_test, "1234567890"); test(long_test, "error", "", 18, 0, 0); memcpy(long_test, "1234.", 5); test(long_test, "prec=18 scale=0", "00 00 00 00 00 00 00 04 D2", 18, 0, 0); test("123456789012345678901234567890", "prec=38 scale=0", "00 00 00 00 01 8E E9 0F F6 C3 73 E0 EE 4E 3F 0A D2", 38, 0, 1); test("1234567890123456789012345678901234567890123456789012345678901234567890-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", "error", "", 38, 0, 1); test("99999999999999999999999999999999999999", "prec=38 scale=0", "00 4B 3B 4C A8 5A 86 C4 7A 09 8A 22 3F FF FF FF FF", 38, 0, 1); test("100000000000000000000000000000000000000", "error", "", 38, 0, 1); test(" 1234", "prec=18 scale=1", "00 00 00 00 00 00 00 30 34", 18, 1, 0); test("1234.56", "prec=18 scale=2", "00 00 00 00 00 00 01 E2 40", 18, 2, 1); test("0.00123", "prec=18 scale=5", "00 00 00 00 00 00 00 00 7B", 18, 5, 1); test("0.0123", "prec=18 scale=4", "00 00 00 00 00 00 00 00 7B", 18, 4, 1); test("0.123", "prec=18 scale=3", "00 00 00 00 00 00 00 00 7B", 18, 3, 1); test("1.23", "prec=18 scale=2", "00 00 00 00 00 00 00 00 7B", 18, 2, 1); test("12.3", "prec=18 scale=1", "00 00 00 00 00 00 00 00 7B", 18, 1, 1); test("0.0000", "prec=18 scale=4", "00", 18, 4, 1); test("0", "prec=18 scale=0", "00", 18, 0, 1); return g_result; } freetds-1.3.6/src/tds/unittests/toodynamic.c000644 025423 025423 00000005720 14056414222 022544 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" /* * Test creating a lot of dynamics. This can cause some problems cause * generated IDs are reused on a base of 2^16 */ static void fatal_error(const char *msg) { fprintf(stderr, "%s\n", msg); exit(1); } int main(int argc, char **argv) { TDSLOGIN *login; TDSSOCKET *tds; int verbose = 0; TDSDYNAMIC *dyn = NULL; int rc; unsigned int n; printf("%s: Test creating a lot of dynamic queries\n", __FILE__); rc = try_tds_login(&login, &tds, __FILE__, verbose); if (rc != TDS_SUCCESS) fatal_error("try_tds_login() failed"); run_query(tds, "DROP TABLE #test"); if (run_query(tds, "CREATE TABLE #test (i INT, c VARCHAR(40))") != TDS_SUCCESS) fatal_error("creating table error"); if (tds->cur_dyn) fatal_error("already a dynamic query??"); /* prepare to insert */ if (tds_submit_prepare(tds, "UPDATE #test SET c = 'test' WHERE i = ?", NULL, &dyn, NULL) != TDS_SUCCESS) fatal_error("tds_submit_prepare() error"); if (tds_process_simple_query(tds) != TDS_SUCCESS) fatal_error("tds_process_simple_query() error"); if (!dyn) fatal_error("dynamic not present??"); /* waste some ids */ for (n = 0; n < 65525; ++n) { TDSDYNAMIC *dyn; dyn = tds_alloc_dynamic(tds->conn, NULL); if (!dyn) fatal_error("create dynamic"); tds_dynamic_deallocated(tds->conn, dyn); tds_release_dynamic(&dyn); } /* this should not cause duplicate IDs or erros*/ for (n = 0; n < 20; ++n) { TDSDYNAMIC *dyn2 = NULL; if (tds_submit_prepare(tds, "INSERT INTO #test(i,c) VALUES(?,?)", NULL, &dyn2, NULL) != TDS_SUCCESS) fatal_error("tds_submit_prepare() error"); if (dyn == dyn2) fatal_error("got duplicated dynamic"); if (tds_process_simple_query(tds) != TDS_SUCCESS) fatal_error("tds_process_simple_query() error"); if (!dyn2) fatal_error("dynamic not present??"); if (tds_submit_unprepare(tds, dyn2) != TDS_SUCCESS || tds_process_simple_query(tds) != TDS_SUCCESS) fatal_error("unprepare error"); tds_dynamic_deallocated(tds->conn, dyn2); tds_release_dynamic(&dyn2); } tds_dynamic_deallocated(tds->conn, dyn); tds_release_dynamic(&dyn); try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/utf8_1.c000644 025423 025423 00000013314 14056414222 021502 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #include static TDSSOCKET *tds; /* Some no-ASCII strings (XML coding) */ static const char english[] = "English"; static const char spanish[] = "Español"; static const char french[] = "Français"; static const char portuguese[] = "Português"; static const char russian[] = "Русский"; static const char arabic[] = "العربية"; static const char chinese[] = "简体中文"; static const char japanese[] = "日本語"; static const char hebrew[] = "עברית"; static const char *strings[] = { english, spanish, french, portuguese, russian, arabic, chinese, japanese, hebrew, NULL, /* will be replaced with large data */ NULL, /* will be replaced with large data */ NULL, /* will be replaced with large data */ NULL, /* will be replaced with large data */ NULL }; static void query(const char *sql) { if (run_query(tds, sql) != TDS_SUCCESS) { fprintf(stderr, "error executing query: %s\n", sql); exit(1); } } static void test(const char *type, const char *test_name) { char buf[256]; char tmp[256]; int i; const char **s; int rc; TDS_INT result_type; int done_flags; sprintf(buf, "CREATE TABLE #tmp (i INT, t %s)", type); query(buf); /* insert all test strings in table */ for (i = 0, s = strings; *s; ++s, ++i) { sprintf(buf, "insert into #tmp values(%d, N'%s')", i, to_utf8(*s, tmp)); query(buf); } /* do a select and check all results */ rc = tds_submit_query(tds, "select t from #tmp order by i"); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_submit_query() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROWFMT_RESULT) { fprintf(stderr, "expected row fmt() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROW_RESULT) { fprintf(stderr, "expected row result() failed\n"); exit(1); } i = 0; while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_RETURN_ROWFMT|TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { switch (result_type) { case TDS_ROW_RESULT: { TDSCOLUMN *curcol = tds->current_results->columns[0]; char *src = (char *) curcol->column_data; if (is_blob_col(curcol)) { TDSBLOB *blob = (TDSBLOB *) src; src = blob->textvalue; } strcpy(buf, to_utf8(strings[i], tmp)); if (strlen(buf) != curcol->column_cur_size || strncmp(buf, src, curcol->column_cur_size) != 0) { int l = curcol->column_cur_size; if (l > 200) l = 200; strncpy(tmp, src, l); tmp[l] = 0; fprintf(stderr, "Wrong result in test %s\n Got: '%s' len %d\n Expected: '%s' len %u\n", test_name, tmp, curcol->column_cur_size, buf, (unsigned int) strlen(buf)); exit(1); } ++i; } break; default: fprintf(stderr, "Unexpected result\n"); exit(1); break; } } if (rc != TDS_NO_MORE_RESULTS) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); exit(1); } while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_NO_MORE_RESULTS: return; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if (!(done_flags & TDS_DONE_ERROR)) break; default: fprintf(stderr, "tds_process_tokens() unexpected result_type\n"); exit(1); break; } } query("DROP TABLE #tmp"); /* do sone select to test results */ /* * for (s = strings; *s; ++s) { * printf("%s\n", to_utf8(*s, tmp)); * } */ } int main(int argc, char **argv) { TDSLOGIN *login; int ret; int verbose = 0; /* use UTF-8 as our coding */ strcpy(CHARSET, "UTF-8"); ret = try_tds_login(&login, &tds, __FILE__, verbose); if (ret != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } if (IS_TDS7_PLUS(tds->conn)) { char type[32]; char buf[1024]; int i, len; strcpy(buf, "aaa"); len = 0; for (i = 0; strlen(buf) < 980 && len < 200; ++i) { char tmp[256]; strcat(buf, japanese); len += strlen(to_utf8(japanese, tmp)); } strings[TDS_VECTOR_SIZE(strings) - 5] = buf + 3; strings[TDS_VECTOR_SIZE(strings) - 4] = buf + 2; strings[TDS_VECTOR_SIZE(strings) - 3] = buf + 1; strings[TDS_VECTOR_SIZE(strings) - 2] = buf; test("NVARCHAR(500)", "NVARCHAR with large size"); sprintf(type, "NVARCHAR(%d)", utf8_max_len); test(type, "NVARCHAR with sufficient size"); test("NTEXT", "TEXT"); /* TODO test parameters */ } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/utf8_2.c000644 025423 025423 00000014567 14056414222 021516 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2003, 2004 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #include /* try conversion from utf8 to iso8859-1 */ static TDSSOCKET *tds; static int g_result = 0; static int einval_error = 0; static int eilseq_error = 0; static int einval_count = 0; static int eilseq_count = 0; static int e2big_count = 0; static char test_name[128]; static int invalid_char = -1; static void test(int n, int type) { int rc; TDS_INT result_type; char buf[1024+128], tmp[1024]; TDSCOLUMN *curcol; char *src; int done_flags; int i; char prefix[32], suffix[32]; sprintf(test_name, "test %d len %d", type, n); /* do a select and check all results */ prefix[0] = 0; suffix[0] = 0; tmp[0] = 0; switch (type) { case 0: strcpy(suffix, "C280C290"); break; case 1: /* try two invalid in different part */ strcpy(prefix, "C480C290"); strcpy(suffix, "C480C290"); break; } for (i = 0; i < n; ++i) sprintf(strchr(tmp, 0), "%02X", 0x30 + (i % 10)); sprintf(buf, "select convert(varchar(255), 0x%s%s%s)", prefix, tmp, suffix); rc = tds_submit_query(tds, buf); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_submit_query() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROWFMT_RESULT) { fprintf(stderr, "expected row fmt() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROW_RESULT) { fprintf(stderr, "expected row result() failed\n"); exit(1); } /* force tds to convert from utf8 to iso8859-1 (even on Sybase) */ tds_srv_charset_changed(tds->conn, "UTF-8"); tds->current_results->columns[0]->char_conv = tds->conn->char_convs[client2server_chardata]; rc = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } curcol = tds->current_results->columns[0]; src = (char*) curcol->column_data; if (is_blob_col(curcol)) { TDSBLOB *blob = (TDSBLOB *) src; src = blob->textvalue; } prefix[0] = 0; suffix[0] = 0; tmp[0] = 0; switch (type) { case 0: strcpy(suffix, "\x80\x90"); break; case 1: /* try two invalid in different part */ strcpy(prefix, "?\x90"); strcpy(suffix, "?\x90"); /* some platforms replace invalid sequence with a fixed char */ if (invalid_char < 0) invalid_char = (unsigned char) src[0]; prefix[0] = (char) invalid_char; suffix[0] = (char) invalid_char; break; } for (i = 0; i < n; ++i) sprintf(strchr(tmp, 0), "%c", "0123456789"[i % 10]); sprintf(buf, "%s%s%s", prefix, tmp, suffix); if (strlen(buf) != curcol->column_cur_size || strncmp(buf, src, curcol->column_cur_size) != 0) { int l = curcol->column_cur_size; if (l > 1000) l = 1000; strncpy(tmp, src, l); tmp[l] = 0; fprintf(stderr, "Wrong result in %s\n Got: '%s' len %d\n Expected: '%s' len %u\n", test_name, tmp, curcol->column_cur_size, buf, (unsigned int) strlen(buf)); exit(1); } rc = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_RETURN_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE); if (rc != TDS_SUCCESS || result_type == TDS_ROW_RESULT) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); exit(1); } while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_NO_MORE_RESULTS: break; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if (!(done_flags & TDS_DONE_ERROR)) break; default: fprintf(stderr, "tds_process_tokens() unexpected result_type\n"); exit(1); break; } } } static int err_handler(const TDSCONTEXT * tds_ctx, TDSSOCKET * tds, TDSMESSAGE * msg) { int error = 0; if (strstr(msg->message, "EINVAL")) { ++einval_count; if (einval_error) error = 1; } else if (strstr(msg->message, "could not be converted")) { ++eilseq_count; if (eilseq_error) error = 1; } else if (strstr(msg->message, "E2BIG")) { ++e2big_count; error = 1; } else { error = 1; } if (error) { fprintf(stderr, "Unexpected in %s error: %s\n", test_name, msg->message); g_result = 1; } return TDS_INT_CANCEL; } int main(int argc, char **argv) { TDSLOGIN *login; int ret; int verbose = 0; int i; typedef int (*perr)(const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *); const perr * my_err; /* use ISO8859-1 as our coding */ strcpy(CHARSET, "ISO8859-1"); ret = try_tds_login(&login, &tds, __FILE__, verbose); if (ret != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } /* override a const in a safe way */ my_err = &tds_get_ctx(tds)->err_handler; *((perr*)my_err) = err_handler; /* prepend some characters to check part of sequence error */ einval_error = 1; eilseq_error = 1; /* do not stop on first error so we check conversion correct */ for (i = 0; i <= 192; ++i) test(i, 0); /* try creating a double conversion warning */ eilseq_error = 0; einval_error = 0; /* we already tested this error above */ for (i = 0; i <= 192; ++i) { eilseq_count = 0; test(i, 1); if (eilseq_count > 1) { fprintf(stderr, "Two warnings returned instead of one in %s\n", test_name); g_result = 1; break; } if (eilseq_count < 1 && invalid_char == '?') { fprintf(stderr, "No warning returned in %s\n", test_name); g_result = 1; } } try_tds_logout(login, tds, verbose); return g_result; } freetds-1.3.6/src/tds/unittests/utf8_3.c000644 025423 025423 00000007510 14056414271 021511 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include "common.h" #include #include #include #include static TDSSOCKET *tds; static void test(const char *buf) { char query[1024]; char tmp[129 * 3]; int i; int rc; TDS_INT result_type; int done_flags; to_utf8(buf, tmp); sprintf(query, "SELECT 1 AS [%s]", tmp); /* do a select and check all results */ rc = tds_submit_query(tds, query); if (rc != TDS_SUCCESS) { fprintf(stderr, "tds_submit_query() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROWFMT_RESULT) { fprintf(stderr, "expected row fmt() failed\n"); exit(1); } if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCESS) { fprintf(stderr, "tds_process_tokens() failed\n"); exit(1); } if (result_type != TDS_ROW_RESULT) { fprintf(stderr, "expected row result() failed\n"); exit(1); } i = 0; while ((rc = tds_process_tokens(tds, &result_type, NULL, TDS_STOPAT_ROWFMT|TDS_STOPAT_DONE|TDS_RETURN_ROW|TDS_RETURN_COMPUTE)) == TDS_SUCCESS) { TDSCOLUMN *curcol; if (result_type != TDS_ROW_RESULT) break; curcol = tds->current_results->columns[0]; if (strcmp(tmp, tds_dstr_cstr(&curcol->column_name)) != 0) { strlcpy(query, tds_dstr_cstr(&curcol->column_name), sizeof(query)); fprintf(stderr, "Wrong result Got: '%s' len %u\n Expected: '%s' len %u\n", query, (unsigned) tds_dstr_len(&curcol->column_name), tmp, (unsigned int) strlen(tmp)); exit(1); } ++i; } if (rc != TDS_SUCCESS || result_type == TDS_ROW_RESULT || result_type == TDS_COMPUTE_RESULT) { fprintf(stderr, "tds_process_tokens() unexpected return\n"); exit(1); } while ((rc = tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS)) == TDS_SUCCESS) { switch (result_type) { case TDS_NO_MORE_RESULTS: return; case TDS_DONE_RESULT: case TDS_DONEPROC_RESULT: case TDS_DONEINPROC_RESULT: if (!(done_flags & TDS_DONE_ERROR)) break; default: fprintf(stderr, "tds_proces_tokens() unexpected result_type\n"); exit(1); break; } } } int main(int argc, char **argv) { TDSLOGIN *login; int ret; int verbose = 0; /* use UTF-8 as our coding */ strcpy(CHARSET, "UTF-8"); ret = try_tds_login(&login, &tds, __FILE__, verbose); if (ret != TDS_SUCCESS) { fprintf(stderr, "try_tds_login() failed\n"); return 1; } if (IS_TDS7_PLUS(tds->conn)) { char buf[129 * 8]; int i; /* build a string of length 128 */ strcpy(buf, ""); for (i = 1; i <= 128; ++i) { sprintf(strchr(buf, 0), "&#x%04x;", 0x4000 + i); } /* do all test */ for (i = 1;;) { printf("Testing len %d\n", i); test(buf + 8 * (128 - i)); if (i == 128) break; ++i; if (i > 12) i += 3; if (i >= 128) i = 128; } } try_tds_logout(login, tds, verbose); return 0; } freetds-1.3.6/src/tds/unittests/CMakeLists.txt000644 025423 025423 00000001367 14056414271 023001 0ustar00fredianofrediano000000 000000 include_directories(..) add_library(t_common STATIC common.c common.h utf8.c allcolumns.c) foreach(target t0001 t0002 t0003 t0004 t0005 t0006 t0007 t0008 dynamic1 convert dataread utf8_1 utf8_2 utf8_3 numeric iconv_fread toodynamic readconf collations corrupt declarations portconf parsing freeze strftime log_elision) add_executable(t_${target} EXCLUDE_FROM_ALL ${target}.c) set_target_properties(t_${target} PROPERTIES OUTPUT_NAME ${target}) target_link_libraries(t_${target} t_common tds replacements tdsutils ${lib_NETWORK} ${lib_BASE}) if(NOT ${target} STREQUAL "collations") add_test(NAME t_${target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND t_${target}) endif() add_dependencies(check t_${target}) endforeach(target) freetds-1.3.6/src/replacements/Makefile.am000644 025423 025423 00000001506 14056414271 022116 0ustar00fredianofrediano000000 000000 NULL = SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/replacements noinst_LTLIBRARIES = libreplacements.la libreplacements_la_SOURCES = \ iconv.c \ gettimeofday.c \ poll.c \ socketpair.c \ getaddrinfo.c \ $(NULL) libreplacements_la_LDFLAGS = libreplacements_la_LIBADD = @LTLIBOBJS@ ../utils/libtdsutils.la EXTRA_DIST = \ asprintf.c \ basename.c \ getopt.c \ readpassphrase.c \ strlcat.c \ getaddrinfo.c \ strlcpy.c \ strtok_r.c \ strsep.c \ vasprintf.c \ socketpair.c \ daemon.c \ setenv.c \ CMakeLists.txt \ $(PERL_OUTPUT) \ $(NULL) PERL_OUTPUT = iconv_charsets.h if HAVE_PERL_SOURCES BUILT_SOURCES = $(PERL_OUTPUT) clean-local: cd $(srcdir) && rm -f $(BUILT_SOURCES) iconv_charsets.h: iconv_charsets.pl Makefile perl $(srcdir)/iconv_charsets.pl > $@.tmp mv $@.tmp $@ endif freetds-1.3.6/src/replacements/Makefile.in000644 025423 025423 00000070620 14162303357 022132 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/replacements ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libreplacements_la_DEPENDENCIES = @LTLIBOBJS@ ../utils/libtdsutils.la am__objects_1 = am_libreplacements_la_OBJECTS = iconv.lo gettimeofday.lo poll.lo \ socketpair.lo getaddrinfo.lo $(am__objects_1) libreplacements_la_OBJECTS = $(am_libreplacements_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libreplacements_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libreplacements_la_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = $(DEPDIR)/asprintf.Plo $(DEPDIR)/basename.Plo \ $(DEPDIR)/daemon.Plo $(DEPDIR)/getopt.Plo \ $(DEPDIR)/readpassphrase.Plo $(DEPDIR)/setenv.Plo \ $(DEPDIR)/strlcat.Plo $(DEPDIR)/strlcpy.Plo \ $(DEPDIR)/strsep.Plo $(DEPDIR)/strtok_r.Plo \ $(DEPDIR)/vasprintf.Plo ./$(DEPDIR)/getaddrinfo.Plo \ ./$(DEPDIR)/gettimeofday.Plo ./$(DEPDIR)/iconv.Plo \ ./$(DEPDIR)/poll.Plo ./$(DEPDIR)/socketpair.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libreplacements_la_SOURCES) DIST_SOURCES = $(libreplacements_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs asprintf.c basename.c daemon.c \ getopt.c readpassphrase.c setenv.c strlcat.c strlcpy.c \ strsep.c strtok_r.c vasprintf.c DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/replacements noinst_LTLIBRARIES = libreplacements.la libreplacements_la_SOURCES = \ iconv.c \ gettimeofday.c \ poll.c \ socketpair.c \ getaddrinfo.c \ $(NULL) libreplacements_la_LDFLAGS = libreplacements_la_LIBADD = @LTLIBOBJS@ ../utils/libtdsutils.la EXTRA_DIST = \ asprintf.c \ basename.c \ getopt.c \ readpassphrase.c \ strlcat.c \ getaddrinfo.c \ strlcpy.c \ strtok_r.c \ strsep.c \ vasprintf.c \ socketpair.c \ daemon.c \ setenv.c \ CMakeLists.txt \ $(PERL_OUTPUT) \ $(NULL) PERL_OUTPUT = iconv_charsets.h @HAVE_PERL_SOURCES_TRUE@BUILT_SOURCES = $(PERL_OUTPUT) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/replacements/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/replacements/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libreplacements.la: $(libreplacements_la_OBJECTS) $(libreplacements_la_DEPENDENCIES) $(EXTRA_libreplacements_la_DEPENDENCIES) $(AM_V_CCLD)$(libreplacements_la_LINK) $(libreplacements_la_OBJECTS) $(libreplacements_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/asprintf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/basename.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/daemon.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/readpassphrase.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/setenv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcat.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcpy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strsep.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtok_r.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getaddrinfo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/poll.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socketpair.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_FALSE@clean-local: clean: clean-recursive clean-am: clean-generic clean-libtool clean-local \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive -rm -f $(DEPDIR)/asprintf.Plo -rm -f $(DEPDIR)/basename.Plo -rm -f $(DEPDIR)/daemon.Plo -rm -f $(DEPDIR)/getopt.Plo -rm -f $(DEPDIR)/readpassphrase.Plo -rm -f $(DEPDIR)/setenv.Plo -rm -f $(DEPDIR)/strlcat.Plo -rm -f $(DEPDIR)/strlcpy.Plo -rm -f $(DEPDIR)/strsep.Plo -rm -f $(DEPDIR)/strtok_r.Plo -rm -f $(DEPDIR)/vasprintf.Plo -rm -f ./$(DEPDIR)/getaddrinfo.Plo -rm -f ./$(DEPDIR)/gettimeofday.Plo -rm -f ./$(DEPDIR)/iconv.Plo -rm -f ./$(DEPDIR)/poll.Plo -rm -f ./$(DEPDIR)/socketpair.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(DEPDIR)/asprintf.Plo -rm -f $(DEPDIR)/basename.Plo -rm -f $(DEPDIR)/daemon.Plo -rm -f $(DEPDIR)/getopt.Plo -rm -f $(DEPDIR)/readpassphrase.Plo -rm -f $(DEPDIR)/setenv.Plo -rm -f $(DEPDIR)/strlcat.Plo -rm -f $(DEPDIR)/strlcpy.Plo -rm -f $(DEPDIR)/strsep.Plo -rm -f $(DEPDIR)/strtok_r.Plo -rm -f $(DEPDIR)/vasprintf.Plo -rm -f ./$(DEPDIR)/getaddrinfo.Plo -rm -f ./$(DEPDIR)/gettimeofday.Plo -rm -f ./$(DEPDIR)/iconv.Plo -rm -f ./$(DEPDIR)/poll.Plo -rm -f ./$(DEPDIR)/socketpair.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all check install install-am \ install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic clean-libtool \ clean-local clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile @HAVE_PERL_SOURCES_TRUE@clean-local: @HAVE_PERL_SOURCES_TRUE@ cd $(srcdir) && rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_TRUE@iconv_charsets.h: iconv_charsets.pl Makefile @HAVE_PERL_SOURCES_TRUE@ perl $(srcdir)/iconv_charsets.pl > $@.tmp @HAVE_PERL_SOURCES_TRUE@ mv $@.tmp $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/replacements/asprintf.c000644 025423 025423 00000000744 14056414271 022057 0ustar00fredianofrediano000000 000000 /* * asprintf(3) * 20020809 entropy@tappedin.com * public domain. no warranty. use at your own risk. have a nice day. */ #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include int tds_asprintf(char **ret, const char *fmt, ...) { int len; va_list ap; va_start(ap, fmt); len = vasprintf(ret, fmt, ap); va_end(ap); return len; } freetds-1.3.6/src/replacements/basename.c000644 025423 025423 00000002765 14056414271 022011 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2005 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #if ! HAVE_BASENAME #ifdef _WIN32 #define TDS_ISDIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') #else #define TDS_ISDIR_SEPARATOR(c) ((c) == '/') #endif char *tds_basename(char *path) { char *p; if (path == NULL) return path; /* remove trailing directories separators */ for (p = path + strlen(path); --p > path && TDS_ISDIR_SEPARATOR(*p);) *p = '\0'; p = strrchr(path, '/'); if (p) path = p + 1; #ifdef _WIN32 p = strrchr(path, '\\'); if (p) path = p + 1; #endif return path; } #endif freetds-1.3.6/src/replacements/daemon.c000644 025423 025423 00000006370 14056414271 021475 0ustar00fredianofrediano000000 000000 /*---------------------------------------------------------------------------*\ NAME daemon.c - replacement daemon(3) function DESCRIPTION This source file contains a version of a BSD-style daemon(3) function, a function to "daemonize" the calling process. This implementation is based both on the generic daemon logic defined in the Unix Programmer's FAQ and on the daemon_start() function in W. Richard Stevens' _Unix_Network_Programming_ book (Prentice-Hall, 1990). At the time of this writing, the Unix Programmer's FAQ is located at `http://www.whitefang.com/unix/faq_toc.html' (among other places). LICENSE This source code is released under a BSD-style. See the LICENSE file for details. Copyright (c) 2003-2015 Brian M. Clapper, bmc@clapper.org \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ Includes \*---------------------------------------------------------------------------*/ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #include #include #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #ifdef HAVE_SYS_FILE_H #include #endif /* HAVE_SYS_FILE_H */ #if HAVE_SYS_STAT_H #include #endif /* HAVE_SYS_STAT_H */ #include #ifndef _WIN32 /*---------------------------------------------------------------------------*\ Static Routines \*---------------------------------------------------------------------------*/ /* redirect_fds(): redirect stdin, stdout, and stderr to /dev/NULL */ static void redirect_fds(int dev_null) { dup2(dev_null, 0); dup2(dev_null, 1); dup2(dev_null, 2); close(dev_null); } static int do_fork(void) { int status = 0; switch (fork()) { case 0: /* This is the child that will become the daemon. */ break; case -1: /* Fork failure. */ status = -1; break; default: /* Parent: Exit. */ _exit(0); } return status; } /*---------------------------------------------------------------------------*\ Public Routines \*---------------------------------------------------------------------------*/ int tds_daemon(int nochdir, int noclose) { int status = 0; int dev_null = -1; if (!noclose) { dev_null = open("/dev/null", O_RDWR); if (dev_null < 0) return -1; } /* Fork once to go into the background. */ if ((status = do_fork()) < 0) return -1; /* Create new session */ if (setsid() < 0) /* shouldn't fail */ return -1; /* Fork again to ensure that daemon never reacquires a control terminal. */ if ((status = do_fork()) < 0) return -1; /* clear any inherited umask(2) value */ umask(0); /* We're there. */ if (!nochdir) { /* Go to a neutral corner. */ chdir("/"); } if (!noclose) redirect_fds(dev_null); return status; } #endif /* _WIN32 */ freetds-1.3.6/src/replacements/getopt.c000644 025423 025423 00000010276 14056414222 021530 0ustar00fredianofrediano000000 000000 /* $NetBSD: getopt.c,v 1.27 2005/11/29 03:12:00 christos Exp $ */ /* * Copyright (c) 1987, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #undef LIBC_SCCS #if !defined(_WIN32) # include #else # define __UNCONST(x) ((char*)(x)) # define getprogname() (nargv[0]) # define _DIAGASSERT(x) assert((x)) #endif #include #include #include #include #include #if !defined(_WIN32) # include #endif #include #ifdef __weak_alias __weak_alias(getopt,_getopt) #endif int opterr = 1, /* if error message should be printed */ optind = 1, /* index into parent argv vector */ optopt, /* character checked for validity */ optreset; /* reset getopt */ char *optarg; /* argument associated with option */ #define BADCH (int)'?' #define BADARG (int)':' #define EMSG "" /* * getopt -- * Parse argc/argv argument vector. */ int tds_getopt(nargc, nargv, ostr) int nargc; char * const nargv[]; const char *ostr; { static const char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ _DIAGASSERT(nargv != NULL); _DIAGASSERT(ostr != NULL); if (optreset || *place == 0) { /* update scanning pointer */ optreset = 0; place = nargv[optind]; if (optind >= nargc || *place++ != '-') { /* Argument is absent or is not an option */ place = EMSG; return (-1); } optopt = *place++; if (optopt == '-' && *place == 0) { /* "--" => end of options */ ++optind; place = EMSG; return (-1); } if (optopt == 0) { /* Solitary '-', treat as a '-' option if the program (eg su) is looking for it. */ place = EMSG; if (strchr(ostr, '-') == NULL) return -1; optopt = '-'; } } else optopt = *place++; /* See if option letter is one the caller wanted... */ if (optopt == ':' || (oli = strchr(ostr, optopt)) == NULL) { if (*place == 0) ++optind; if (opterr && *ostr != ':') (void)fprintf(stderr, "%s: unknown option -- %c\n", getprogname(), optopt); return (BADCH); } /* Does this option need an argument? */ if (oli[1] != ':') { /* don't need argument */ optarg = NULL; if (*place == 0) ++optind; } else { /* Option-argument is either the rest of this argument or the entire next argument. */ if (*place) optarg = __UNCONST(place); else if (nargc > ++optind) optarg = nargv[optind]; else { /* option-argument absent */ place = EMSG; if (*ostr == ':') return (BADARG); if (opterr) (void)fprintf(stderr, "%s: option requires an argument -- %c\n", getprogname(), optopt); return (BADCH); } place = EMSG; ++optind; } return (optopt); /* return option letter */ } freetds-1.3.6/src/replacements/readpassphrase.c000644 025423 025423 00000015052 14056414271 023234 0ustar00fredianofrediano000000 000000 /* OPENBSD ORIGINAL: lib/libc/gen/readpassphrase.c */ /* $OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $ */ /* * Copyright (c) 2000-2002 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Sponsored in part by the Defense Advanced Research Projects * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ #if defined(LIBC_SCCS) && !defined(lint) static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include #ifndef HAVE_READPASSPHRASE #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #include #ifdef HAVE_PATHS_H #include /* For _PATH_XXX */ #endif #include #if !defined(_WIN32) && !defined(_WIN64) #include #ifndef _PATH_TTY # define _PATH_TTY "/dev/tty" #endif #ifdef TCSASOFT # define _T_FLUSH (TCSAFLUSH|TCSASOFT) #else # define _T_FLUSH (TCSAFLUSH) #endif /* SunOS 4.x which lacks _POSIX_VDISABLE, but has VDISABLE */ #if !defined(_POSIX_VDISABLE) && defined(VDISABLE) # define _POSIX_VDISABLE VDISABLE #endif static volatile sig_atomic_t signo; static void handler(int); char * tds_readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) { ssize_t nr; int input, output, save_errno; char ch, *p, *end; struct termios term, oterm; struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm; struct sigaction savetstp, savettin, savettou, savepipe; /* I suppose we could alloc on demand in this case (XXX). */ if (bufsiz == 0) { errno = EINVAL; return(NULL); } restart: signo = 0; /* * Read and write to /dev/tty if available. If not, read from * stdin and write to stderr unless a tty is required. */ if ((flags & RPP_STDIN) || (input = output = open(_PATH_TTY, O_RDWR)) == -1) { if (flags & RPP_REQUIRE_TTY) { errno = ENOTTY; return(NULL); } input = STDIN_FILENO; output = STDERR_FILENO; } /* * Catch signals that would otherwise cause the user to end * up with echo turned off in the shell. Don't worry about * things like SIGXCPU and SIGVTALRM for now. */ sigemptyset(&sa.sa_mask); sa.sa_flags = 0; /* don't restart system calls */ sa.sa_handler = handler; (void)sigaction(SIGALRM, &sa, &savealrm); (void)sigaction(SIGHUP, &sa, &savehup); (void)sigaction(SIGINT, &sa, &saveint); (void)sigaction(SIGPIPE, &sa, &savepipe); (void)sigaction(SIGQUIT, &sa, &savequit); (void)sigaction(SIGTERM, &sa, &saveterm); (void)sigaction(SIGTSTP, &sa, &savetstp); (void)sigaction(SIGTTIN, &sa, &savettin); (void)sigaction(SIGTTOU, &sa, &savettou); /* Turn off echo if possible. */ if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) { memcpy(&term, &oterm, sizeof(term)); if (!(flags & RPP_ECHO_ON)) term.c_lflag &= ~(ECHO | ECHONL); #ifdef VSTATUS if (term.c_cc[VSTATUS] != _POSIX_VDISABLE) term.c_cc[VSTATUS] = _POSIX_VDISABLE; #endif (void)tcsetattr(input, _T_FLUSH, &term); } else { memset(&term, 0, sizeof(term)); term.c_lflag |= ECHO; memset(&oterm, 0, sizeof(oterm)); oterm.c_lflag |= ECHO; } if (!(flags & RPP_STDIN)) (void)write(output, prompt, strlen(prompt)); end = buf + bufsiz - 1; for (p = buf; (nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r';) { if (p < end) { if ((flags & RPP_SEVENBIT)) ch &= 0x7f; if (isalpha((unsigned char) ch)) { if ((flags & RPP_FORCELOWER)) ch = tolower((unsigned char) ch); if ((flags & RPP_FORCEUPPER)) ch = toupper((unsigned char) ch); } *p++ = ch; } } *p = '\0'; save_errno = errno; if (!(term.c_lflag & ECHO)) (void)write(output, "\n", 1); /* Restore old terminal settings and signals. */ if (memcmp(&term, &oterm, sizeof(term)) != 0) (void)tcsetattr(input, _T_FLUSH, &oterm); (void)sigaction(SIGALRM, &savealrm, NULL); (void)sigaction(SIGHUP, &savehup, NULL); (void)sigaction(SIGINT, &saveint, NULL); (void)sigaction(SIGQUIT, &savequit, NULL); (void)sigaction(SIGPIPE, &savepipe, NULL); (void)sigaction(SIGTERM, &saveterm, NULL); (void)sigaction(SIGTSTP, &savetstp, NULL); (void)sigaction(SIGTTIN, &savettin, NULL); if (input != STDIN_FILENO) (void)close(input); /* * If we were interrupted by a signal, resend it to ourselves * now that we have restored the signal handlers. */ if (signo) { kill(getpid(), signo); switch (signo) { case SIGTSTP: case SIGTTIN: case SIGTTOU: goto restart; } } errno = save_errno; return(nr == -1 ? NULL : buf); } #if 0 char * getpass(const char *prompt) { static char buf[_PASSWORD_LEN + 1]; return(readpassphrase(prompt, buf, sizeof(buf), RPP_ECHO_OFF)); } #endif static void handler(int s) { signo = s; } #else /* _WIN32 */ char * tds_readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) { int save_errno, ch; char *p, *end; /* I suppose we could alloc on demand in this case (XXX). */ if (bufsiz == 0) { errno = EINVAL; return(NULL); } printf("%s", prompt); fflush(stdout); end = buf + bufsiz - 1; for (p = buf; (ch = getchar()) != EOF && ch != '\n' && ch != '\r';) { if (p < end) { ch &= 0xff; if ((flags & RPP_SEVENBIT)) ch &= 0x7f; if (isalpha(ch)) { if ((flags & RPP_FORCELOWER)) ch = tolower(ch); if ((flags & RPP_FORCEUPPER)) ch = toupper(ch); } *p++ = ch; } } *p = '\0'; save_errno = errno; printf("\n"); errno = save_errno; return (ch == EOF ? NULL : buf); } #endif /* _WIN32 */ #endif /* HAVE_READPASSPHRASE */ freetds-1.3.6/src/replacements/setenv.c000644 025423 025423 00000002016 14056414271 021527 0ustar00fredianofrediano000000 000000 /* * setenv/unsetenv */ #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include #include #include #ifndef _WIN32 #error Platform should have setenv/unsetenv #endif static bool check_name(const char *name) { if (!name || !name[0] || strchr(name, '=') != NULL) { errno = EINVAL; return false; } return true; } static int set_env_value(const char *name, const char *value) { char *s; int res; if (asprintf(&s, "%s=%s", name, value ? value : "") < 0) { errno = ENOMEM; return -1; } res = _putenv(s); free(s); return res; } int tds_setenv(const char *name, const char *value, int overwrite) { if (!check_name(name)) return -1; if (!overwrite && getenv(name)) return 0; return set_env_value(name, value); } int tds_unsetenv(const char *name) { if (!check_name(name)) return -1; return set_env_value(name, NULL); } freetds-1.3.6/src/replacements/strlcat.c000644 025423 025423 00000002563 14056414271 021706 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2005 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include size_t tds_strlcat(char *dest, const char *src, size_t len) { size_t dest_len = strlen(dest); size_t src_len = strlen(src); if (len) { --len; if (dest_len + src_len > len) { if (len > dest_len) { memcpy(dest + dest_len, src, len - dest_len); dest[len] = 0; } } else { memcpy(dest + dest_len, src, src_len + 1); } } return dest_len + src_len; } freetds-1.3.6/src/replacements/strlcpy.c000644 025423 025423 00000002302 14056414271 021721 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2005 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include size_t tds_strlcpy(char *dest, const char *src, size_t len) { size_t l = strlen(src); if (len) { --len; if (l <= len) len = l; memcpy(dest, src, len); dest[len] = 0; } return l; } freetds-1.3.6/src/replacements/strsep.c000644 025423 025423 00000003526 14056414271 021552 0ustar00fredianofrediano000000 000000 /* Copyright (C) 1992, 93, 96, 97, 98, 99, 2004 Free Software Foundation, Inc. * This file is part of the GNU C Library. * * The GNU C Library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * The GNU C 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with the GNU C Library; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. */ #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include /* Taken from glibc 2.6.1 */ char * tds_strsep(char **stringp, const char *delim) { char *begin, *end; begin = *stringp; if (begin == NULL) return NULL; /* A frequent case is when the delimiter string contains only one * character. Here we don't need to call the expensive `strpbrk' * function and instead work using `strchr'. */ if (delim[0] == '\0') { end = NULL; } else if (delim[1] == '\0') { char ch = delim[0]; if (*begin == ch) end = begin; else if (*begin == '\0') end = NULL; else end = strchr(begin + 1, ch); } else { /* Find the end of the token. */ end = strpbrk(begin, delim); } if (end) { /* Terminate the token and set *STRINGP past NUL character. */ *end++ = '\0'; } else { /* No more delimiters; this is the last token. */ } *stringp = end; return begin; } freetds-1.3.6/src/replacements/strtok_r.c000644 025423 025423 00000001244 14056414271 022074 0ustar00fredianofrediano000000 000000 /* * strtok_r(3) * 20020927 entropy@tappedin.com * public domain. no warranty. use at your own risk. have a nice day. */ #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include char * tds_strtok_r(char *str, const char *sep, char **lasts) { char *p; if (str == NULL) { str = *lasts; } if (str == NULL) { return NULL; } str += strspn(str, sep); /* skip any separators */ if ((p = strpbrk(str, sep)) != NULL) { *lasts = p + 1; *p = '\0'; } else { if (!*str) str = NULL; *lasts = NULL; } return str; } freetds-1.3.6/src/replacements/vasprintf.c000644 025423 025423 00000004700 14056414271 022241 0ustar00fredianofrediano000000 000000 /* * vasprintf(3) * 20020809 entropy@tappedin.com * public domain. no warranty. use at your own risk. have a nice day. */ #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_PATHS_H #include #endif /* HAVE_PATHS_H */ #include #include #if defined(HAVE__VSNPRINTF) && !defined(HAVE_VSNPRINTF) #undef HAVE_VSNPRINTF #undef vsnprintf #define HAVE_VSNPRINTF 1 #define vsnprintf _vsnprintf #endif #ifndef _PATH_DEVNULL #define _PATH_DEVNULL "/dev/null" #endif #define CHUNKSIZE 512 int tds_vasprintf(char **ret, const char *fmt, va_list ap) { #if HAVE__VSCPRINTF int len = _vscprintf(fmt, ap); if (len >= 0) { *ret = malloc(len + 1); if (*ret) { vsprintf(*ret, fmt, ap); return len; } errno = ENOMEM; } *ret = NULL; return -1; #elif HAVE_VSNPRINTF size_t chunks; size_t buflen; char *buf; int len; chunks = ((strlen(fmt) + 1) / CHUNKSIZE) + 1; buflen = chunks * CHUNKSIZE; for (;;) { if ((buf = malloc(buflen)) == NULL) { errno = ENOMEM; *ret = NULL; return -1; } len = vsnprintf(buf, buflen, fmt, ap); if (0 <= len && (size_t) len < buflen - 1) { break; } free(buf); buflen = (++chunks) * CHUNKSIZE; /* * len >= 0 is required for vsnprintf implementations that * return -1 for insufficient buffer */ if (len >= 0 && buflen <= (size_t) len) { buflen = len + 1; } } *ret = buf; return len; #else /* HAVE_VSNPRINTF */ #ifdef _REENTRANT FILE *fp; #else /* !_REENTRANT */ static FILE *fp = NULL; #endif /* !_REENTRANT */ int len; char *buf; *ret = NULL; #ifdef _REENTRANT # ifdef _WIN32 # error Win32 do not have /dev/null, should use vsnprintf version # endif if ((fp = fopen(_PATH_DEVNULL, "w")) == NULL) return -1; #else /* !_REENTRANT */ if ((fp == NULL) && ((fp = fopen(_PATH_DEVNULL, "w")) == NULL)) return -1; #endif /* !_REENTRANT */ len = vfprintf(fp, fmt, ap); #ifdef _REENTRANT if (fclose(fp) != 0) return -1; #endif /* _REENTRANT */ if (len < 0) return len; if ((buf = malloc(len + 1)) == NULL) { errno = ENOMEM; return -1; } if (vsprintf(buf, fmt, ap) != len) return -1; *ret = buf; return len; #endif /* HAVE_VSNPRINTF */ } freetds-1.3.6/src/replacements/iconv.c000644 025423 025423 00000025136 14111343115 021337 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2003, 2004 James K. Lowden, based on original work by Brian Bruns * Copyright (C) 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * \file * This file implements a very simple iconv. * Its purpose is to allow ASCII clients to communicate with Microsoft servers * that encode their metadata in Unicode (UTF-16). * * It supports ISO-8859-1, ASCII, CP1252, UTF-16, UCS-4 and UTF-8 */ #include #if ! HAVE_ICONV #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_ERRNO_H #include #endif #include #include #include #include #include #include #include "iconv_charsets.h" /** * \addtogroup conv * @{ */ enum ICONV_CD_VALUE { Like_to_Like = 0x100 }; typedef uint32_t ICONV_CHAR; /* * Return values for get_*: * - >0 bytes readed * - -EINVAL not enough data to read * - -EILSEQ invalid encoding detected * Return values for put_*: * - >0 bytes written * - -E2BIG no space left on output * - -EILSEQ character can't be encoded in output charset */ static int get_utf8(const unsigned char *p, size_t len, ICONV_CHAR *out) { uint32_t uc, state = UTF8_ACCEPT; size_t l = 1; do { switch (decode_utf8(&state, &uc, *p++)) { case UTF8_ACCEPT: *out = uc; return l; case UTF8_REJECT: return -EILSEQ; } } while (l++ < len); return -EINVAL; } static int put_utf8(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { #define MASK(n) ((0xffffffffu << (n)) & 0xffffffffu) size_t o_len; if ((c & MASK(7)) == 0) { if (buf_len < 1) return -E2BIG; *buf = (unsigned char) c; return 1; } o_len = 2; for (;;) { if ((c & MASK(11)) == 0) break; ++o_len; if ((c & MASK(16)) == 0) break; ++o_len; if ((c & MASK(21)) == 0) break; ++o_len; if ((c & MASK(26)) == 0) break; ++o_len; if ((c & MASK(31)) != 0) return -EILSEQ; } if (buf_len < o_len) return -E2BIG; buf += o_len; buf_len = o_len - 1; do { *--buf = 0x80 | (c & 0x3f); c >>= 6; } while (--buf_len); *--buf = (0xff00u >> o_len) | c; return o_len; } static int get_ucs4le(const unsigned char *p, size_t len, ICONV_CHAR *out) { TDS_EXTRA_CHECK(assert((((uintptr_t) p) & 3) == 0)); if (len < 4) return -EINVAL; *out = TDS_GET_A4LE(p); return 4; } static int put_ucs4le(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { TDS_EXTRA_CHECK(assert((((uintptr_t) buf) & 3) == 0)); if (buf_len < 4) return -E2BIG; TDS_PUT_A4LE(buf, c); return 4; } static int get_ucs4be(const unsigned char *p, size_t len, ICONV_CHAR *out) { TDS_EXTRA_CHECK(assert((((uintptr_t) p) & 3) == 0)); if (len < 4) return -EINVAL; *out = TDS_GET_A4BE(p); return 4; } static int put_ucs4be(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { TDS_EXTRA_CHECK(assert((((uintptr_t) buf) & 3) == 0)); if (buf_len < 4) return -E2BIG; TDS_PUT_A4BE(buf, c); return 4; } static int get_utf16le(const unsigned char *p, size_t len, ICONV_CHAR *out) { ICONV_CHAR c, c2; TDS_EXTRA_CHECK(assert((((uintptr_t) p) & 1) == 0)); if (len < 2) return -EINVAL; c = TDS_GET_A2LE(p); if ((c & 0xfc00) == 0xd800) { if (len < 4) return -EINVAL; c2 = TDS_GET_A2LE(p+2); if ((c2 & 0xfc00) == 0xdc00) { *out = (c << 10) + c2 - ((0xd800 << 10) + 0xdc00 - 0x10000); return 4; } } *out = c; return 2; } static int put_utf16le(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { TDS_EXTRA_CHECK(assert((((uintptr_t) buf) & 1) == 0)); if (c < 0x10000u) { if (buf_len < 2) return -E2BIG; TDS_PUT_A2LE(buf, c); return 2; } if (TDS_UNLIKELY(c >= 0x110000u)) return -EILSEQ; if (buf_len < 4) return -E2BIG; TDS_PUT_A2LE(buf, 0xd7c0 + (c >> 10)); TDS_PUT_A2LE(buf+2, 0xdc00 + (c & 0x3ffu)); return 4; } static int get_utf16be(const unsigned char *p, size_t len, ICONV_CHAR *out) { ICONV_CHAR c, c2; TDS_EXTRA_CHECK(assert((((uintptr_t) p) & 1) == 0)); if (len < 2) return -EINVAL; c = TDS_GET_A2BE(p); if ((c & 0xfc00) == 0xd800) { if (len < 4) return -EINVAL; c2 = TDS_GET_A2BE(p+2); if ((c2 & 0xfc00) == 0xdc00) { *out = (c << 10) + c2 - ((0xd800 << 10) + 0xdc00 - 0x10000); return 4; } } *out = c; return 2; } static int put_utf16be(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { TDS_EXTRA_CHECK(assert((((uintptr_t) buf) & 1) == 0)); if (c < 0x10000u) { if (buf_len < 2) return -E2BIG; TDS_PUT_A2BE(buf, c); return 2; } if (TDS_UNLIKELY(c >= 0x110000u)) return -EILSEQ; if (buf_len < 4) return -E2BIG; TDS_PUT_A2BE(buf, 0xd7c0 + (c >> 10)); TDS_PUT_A2BE(buf+2, 0xdc00 + (c & 0x3ffu)); return 4; } static int get_iso1(const unsigned char *p, size_t len, ICONV_CHAR *out) { *out = p[0]; return 1; } static int put_iso1(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { if (c >= 0x100u) return -EILSEQ; if (buf_len < 1) return -E2BIG; buf[0] = (unsigned char) c; return 1; } static int get_ascii(const unsigned char *p, size_t len, ICONV_CHAR *out) { if (p[0] >= 0x80) return -EILSEQ; *out = p[0]; return 1; } static int put_ascii(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { if (c >= 0x80u) return -EILSEQ; if (buf_len < 1) return -E2BIG; buf[0] = (unsigned char) c; return 1; } static int get_cp1252(const unsigned char *p, size_t len, ICONV_CHAR *out) { if (*p >= 0x80 && *p < 0xa0) *out = cp1252_0080_00a0[*p - 0x80]; else *out = *p; return 1; } static int put_cp1252(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { if (buf_len < 1) return -E2BIG; if (c >= 0x100 || ((c&~0x1fu) == 0x80 && cp1252_0080_00a0[c - 0x80] != c - 0x80)) { switch (c) { #define CP1252(i,o) case o: c = i; break; CP1252_ALL #undef CP1252 default: return -EILSEQ; } } *buf = c; return 1; } static int get_err(const unsigned char *p, size_t len, ICONV_CHAR *out) { return -EILSEQ; } static int put_err(unsigned char *buf, size_t buf_len, ICONV_CHAR c) { return -EILSEQ; } typedef int (*iconv_get_t)(const unsigned char *p, size_t len, ICONV_CHAR *out); typedef int (*iconv_put_t)(unsigned char *buf, size_t buf_len, ICONV_CHAR c); static const iconv_get_t iconv_gets[16] = { get_iso1, get_ascii, get_utf16le, get_utf16be, get_ucs4le, get_ucs4be, get_utf8, get_cp1252, get_err, get_err, get_err, get_err, get_err, get_err, get_err, get_err, }; static const iconv_put_t iconv_puts[16] = { put_iso1, put_ascii, put_utf16le, put_utf16be, put_ucs4le, put_ucs4be, put_utf8, put_cp1252, put_err, put_err, put_err, put_err, put_err, put_err, put_err, put_err, }; /** * Inputs are FreeTDS canonical names, no other. No alias list is consulted. */ iconv_t tds_sys_iconv_open (const char* tocode, const char* fromcode) { int i; unsigned int fromto; const char *enc_name; unsigned char encodings[2]; static char first_time = 1; if (TDS_UNLIKELY(first_time)) { first_time = 0; tdsdump_log(TDS_DBG_INFO1, "Using trivial iconv\n"); } /* match both inputs to our canonical names */ enc_name = fromcode; for (i=0; i < 2; ++i) { unsigned char encoding; if (strcmp(enc_name, "ISO-8859-1") == 0) encoding = 0; else if (strcmp(enc_name, "US-ASCII") == 0) encoding = 1; else if (strcmp(enc_name, "UCS-2LE") == 0 || strcmp(enc_name, "UTF-16LE") == 0) encoding = 2; else if (strcmp(enc_name, "UCS-2BE") == 0 || strcmp(enc_name, "UTF-16BE") == 0) encoding = 3; else if (strcmp(enc_name, "UCS-4LE") == 0) encoding = 4; else if (strcmp(enc_name, "UCS-4BE") == 0) encoding = 5; else if (strcmp(enc_name, "UTF-8") == 0) encoding = 6; else if (strcmp(enc_name, "CP1252") == 0) encoding = 7; else { errno = EINVAL; return (iconv_t)(-1); } encodings[i] = encoding; enc_name = tocode; } fromto = (encodings[0] << 4) | (encodings[1] & 0x0F); /* like to like */ if (encodings[0] == encodings[1]) { fromto = Like_to_Like; } return (iconv_t) (intptr_t) fromto; } int tds_sys_iconv_close (iconv_t cd) { return 0; } size_t tds_sys_iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft) { const unsigned char *ib; unsigned char *ob; size_t il, ol; int local_errno; #undef CD #define CD ((int) (intptr_t) cd) /* iconv defines valid semantics for NULL inputs, but we don't support them. */ if (!inbuf || !*inbuf || !inbytesleft || !outbuf || !*outbuf || !outbytesleft) return 0; /* * some optimizations * - do not use errno directly only assign a time * (some platform define errno as a complex macro) * - some processors have few registers, deference and copy input variable * (this make also compiler optimize more due to removed aliasing) * also we use unsigned to remove required unsigned casts */ local_errno = 0; il = *inbytesleft; ol = *outbytesleft; ib = (const unsigned char*) *inbuf; ob = (unsigned char*) *outbuf; if (CD == Like_to_Like) { size_t copybytes = (il < ol)? il : ol; memcpy(ob, ib, copybytes); ob += copybytes; ol -= copybytes; ib += copybytes; il -= copybytes; } else if (CD & ~0xff) { local_errno = EINVAL; } else { iconv_get_t get_func = iconv_gets[(CD>>4) & 15]; iconv_put_t put_func = iconv_puts[ CD & 15]; while (il) { ICONV_CHAR out_c; int readed = get_func(ib, il, &out_c), written; TDS_EXTRA_CHECK(assert(readed > 0 || readed == -EINVAL || readed == -EILSEQ)); if (TDS_UNLIKELY(readed < 0)) { local_errno = -readed; break; } written = put_func(ob, ol, out_c); TDS_EXTRA_CHECK(assert(written > 0 || written == -E2BIG || written == -EILSEQ)); if (TDS_UNLIKELY(written < 0)) { local_errno = -written; break; } il -= readed; ib += readed; ol -= written; ob += written; } } /* back to source */ *inbytesleft = il; *outbytesleft = ol; *inbuf = (const char*) ib; *outbuf = (char*) ob; if (il && !local_errno) local_errno = E2BIG; if (local_errno) { errno = local_errno; return (size_t)(-1); } return 0; } /** @} */ #endif freetds-1.3.6/src/replacements/gettimeofday.c000644 025423 025423 00000003761 14056414271 022714 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2003, 2004 James K. Lowden, based on original work by Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if defined(_WIN32) #if HAVE_ERRNO_H #include #endif #include /* * Number of micro-seconds between the beginning of the Windows epoch * (Jan. 1, 1601) and the Unix epoch (Jan. 1, 1970). * * This assumes all Win32 compilers have 64-bit support. */ #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) || defined(__WATCOMC__) # define DELTA_EPOCH_IN_USEC 11644473600000000Ui64 #else # define DELTA_EPOCH_IN_USEC 11644473600000000ULL #endif int tds_gettimeofday (struct timeval *tv, void *tz) { FILETIME ft; uint64_t tim; uint32_t r; if (!tv) { errno = EINVAL; return -1; } /* * Although this function returns 10^-7 precision the real * precision is less than milliseconds on Windows XP */ GetSystemTimeAsFileTime (&ft); tim = ((((uint64_t) ft.dwHighDateTime) << 32) | ft.dwLowDateTime) - (DELTA_EPOCH_IN_USEC * 10U); /* * here we use same division to compute quotient * and remainder at the same time (gcc) */ tv->tv_sec = (long) (tim / 10000000UL); r = tim % 10000000UL; tv->tv_usec = (long) (r / 10L); return 0; } #endif freetds-1.3.6/src/replacements/poll.c000644 025423 025423 00000010177 14056414271 021200 0ustar00fredianofrediano000000 000000 /* * poll(2) implemented with select(2), for systems without poll(2). * Warning: a call to this poll() takes about 4K of stack space. * * This file and the accompanying poll.h * are based on poll.h in C++ by * * Greg Parker gparker-web@sealiesoftware.com December 2000 * This code is in the public domain. * * Updated May 2002: * * fix crash when an fd is less than 0 * * set errno=EINVAL if an fd is greater or equal to FD_SETSIZE * * don't set POLLIN or POLLOUT in revents if it wasn't requested * in events (only happens when an fd is in the poll set twice) * * Converted to C and spruced up by James K. Lowden December 2008. */ #include #ifndef HAVE_POLL #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #include #include #include int tds_poll(struct pollfd fds[], int nfds, int timeout) { struct timeval tv, *tvp; fd_set fdsr, fdsw, fdsp; struct pollfd *p; const struct pollfd *endp = fds? fds + nfds : NULL; int selected, polled = 0, maxfd = 0; #if defined(_WIN32) typedef int (WSAAPI *WSAPoll_t)(struct pollfd fds[], ULONG nfds, INT timeout); static WSAPoll_t poll_p = (WSAPoll_t) -1; if (poll_p == (WSAPoll_t) -1) { HMODULE mod; poll_p = NULL; mod = GetModuleHandle(TEXT("ws2_32")); if (mod) poll_p = (WSAPoll_t) GetProcAddress(mod, "WSAPoll"); } /* Windows 2008 have WSAPoll which is semantically equal to poll */ if (poll_p != NULL) return poll_p(fds, nfds, timeout); #endif if (fds == NULL) { errno = EFAULT; return -1; } FD_ZERO(&fdsr); FD_ZERO(&fdsw); FD_ZERO(&fdsp); /* * Transcribe flags from the poll set to the fd sets. * Also ensure we don't exceed select's capabilities. */ for (p = fds; p < endp; p++) { /* Negative fd checks nothing and always reports zero */ if (p->fd < 0) { continue; } #if defined(_WIN32) /* Win32 cares about the number of descriptors, not the highest one. */ ++maxfd; #else if (p->fd > maxfd) maxfd = p->fd; #endif /* POLLERR is never set coming in; poll(2) always reports errors */ /* But don't report if we're not listening to anything at all. */ if (p->events & POLLIN) FD_SET(p->fd, &fdsr); if (p->events & POLLOUT) FD_SET(p->fd, &fdsw); if (p->events != 0) FD_SET(p->fd, &fdsp); } /* * If any FD is too big for select(2), we need to return an error. * Which one, though, is debatable. There's no defined errno for * this for poll(2) because it's an "impossible" condition; * there's no such thing as "too many" FD's to check. * select(2) returns EINVAL, and so do we. * EFAULT might be better. */ #if !defined(_WIN32) if (maxfd > FD_SETSIZE) { assert(FD_SETSIZE > 0); errno = EINVAL; return -1; } #endif /* * poll timeout is in milliseconds. Convert to struct timeval. * timeout == -1: wait forever : select timeout of NULL * timeout == 0: return immediately : select timeout of zero */ if (timeout >= 0) { tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; tvp = &tv; } else { tvp = NULL; } /* * call select(2) */ if ((selected = select(maxfd+1, &fdsr, &fdsw, &fdsp, tvp)) < 0) { return -1; /* error */ } /* timeout, clear all result bits and return zero. */ if (selected == 0) { for (p = fds; p < endp; p++) { p->revents = 0; } return 0; } /* * Select found something * Transcribe result from fd sets to poll set. * Return the number of ready fds. */ for (polled=0, p=fds; p < endp; p++) { p->revents = 0; /* Negative fd always reports zero */ if (p->fd < 0) { continue; } if ((p->events & POLLIN) && FD_ISSET(p->fd, &fdsr)) { p->revents |= POLLIN; } if ((p->events & POLLOUT) && FD_ISSET(p->fd, &fdsw)) { p->revents |= POLLOUT; } if ((p->events != 0) && FD_ISSET(p->fd, &fdsp)) { p->revents |= POLLERR; } if (p->revents) polled++; } assert(polled == selected); return polled; } #endif /* HAVE_POLL */ freetds-1.3.6/src/replacements/socketpair.c000644 025423 025423 00000005370 14056414271 022375 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if !defined(HAVE_SOCKETPAIR) #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_ERRNO_H #include #endif #if HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NET_INET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #include #include int tds_socketpair(int domain, int type, int protocol, TDS_SYS_SOCKET sv[2]) { struct sockaddr_in sa, sa2; SOCKLEN_T addrlen; TDS_SYS_SOCKET s; if (!sv) return -1; /* create a listener */ s = socket(AF_INET, type, 0); if (TDS_IS_SOCKET_INVALID(s)) return -1; sv[1] = INVALID_SOCKET; sv[0] = socket(AF_INET, type, 0); if (TDS_IS_SOCKET_INVALID(sv[0])) goto Cleanup; /* bind to a random port */ sa.sin_family = AF_INET; sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sa.sin_port = 0; if (bind(s, (struct sockaddr*) &sa, sizeof(sa)) < 0) goto Cleanup; if (listen(s, 1) < 0) goto Cleanup; /* connect to kernel choosen port */ addrlen = sizeof(sa); if (tds_getsockname(s, (struct sockaddr*) &sa, &addrlen) < 0) goto Cleanup; if (connect(sv[0], (struct sockaddr*) &sa, sizeof(sa)) < 0) goto Cleanup; addrlen = sizeof(sa2); sv[1] = tds_accept(s, (struct sockaddr*) &sa2, &addrlen); if (TDS_IS_SOCKET_INVALID(sv[1])) goto Cleanup; /* check proper connection */ addrlen = sizeof(sa); if (tds_getsockname(sv[0], (struct sockaddr*) &sa, &addrlen) < 0) goto Cleanup; addrlen = sizeof(sa2); if (tds_getpeername(sv[1], (struct sockaddr*) &sa2, &addrlen) < 0) goto Cleanup; if (sa.sin_family != sa2.sin_family || sa.sin_port != sa2.sin_port || sa.sin_addr.s_addr != sa2.sin_addr.s_addr) goto Cleanup; CLOSESOCKET(s); return 0; Cleanup: CLOSESOCKET(s); CLOSESOCKET(sv[0]); CLOSESOCKET(sv[1]); return -1; } #endif freetds-1.3.6/src/replacements/getaddrinfo.c000644 025423 025423 00000016107 14056414271 022517 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2013 Peter Deacon * Copyright (C) 2013 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if !defined(HAVE_GETADDRINFO) #include #include #include #if HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NET_INET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #include #include #include static struct hostent *tds_gethostbyname_r(const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop); /* * If reentrant code was not requested, we don't care reentrancy, so * just assume the standard BSD netdb interface is reentrant and use it. */ #ifndef _REENTRANT # undef NETDB_REENTRANT # define NETDB_REENTRANT 1 #endif /* _REENTRANT */ #if defined(NETDB_REENTRANT) static struct hostent * tds_gethostbyname_r(const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop) { return gethostbyname(servername); } #elif defined(HAVE_GETIPNODEBYNAME) || defined(HAVE_GETIPNODEBYADDR) /** * Copy a hostent structure to an allocated buffer * @return 0 on success, -1 otherwise */ static int tds_copy_hostent(struct hostent *he, struct hostent *result, char *buffer, int buflen) { #define CHECK_BUF(len) \ if (p + sizeof(struct hostent) - buffer > buflen) return -1; #define ALIGN_P do { p += TDS_ALIGN_SIZE - 1; p -= (p-buffer) % TDS_ALIGN_SIZE; } while(0) int n, i; char *p = buffer; struct hostent *he2; /* copy structure */ he2 = result; memcpy(he2, he, sizeof(struct hostent)); if (he->h_addr_list) { int len; char **addresses; /* count addresses */ for (n = 0; he->h_addr_list[n]; ++n) continue; /* copy addresses */ addresses = (char **) p; he2->h_addr_list = (char **) p; len = sizeof(char *) * (n + 1); CHECK_BUF(len); p += len; ALIGN_P; for (i = 0; i < n; ++i) { addresses[i] = p; CHECK_BUF(he->h_length); memcpy(p, he->h_addr_list[i], he->h_length); p += he->h_length; ALIGN_P; } addresses[n] = NULL; } /* copy name */ if (he->h_name) { n = strlen(he->h_name) + 1; he2->h_name = p; CHECK_BUF(n); memcpy(p, he->h_name, n); p += n; ALIGN_P; } if (he->h_aliases) { int len; char **aliases; /* count aliases */ for (n = 0; he->h_aliases[n]; ++n) continue; /* copy aliases */ aliases = (char **) p; he2->h_aliases = (char **) p; len = sizeof(char *) * (n + 1); CHECK_BUF(len); p += len; for (i = 0; i < n; ++i) { len = strlen(he->h_aliases[i]) + 1; aliases[i] = p; CHECK_BUF(len); memcpy(p, he->h_aliases[i], len); p += len; } aliases[n] = NULL; } return 0; } static struct hostent * tds_gethostbyname_r(const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop) { struct hostent *he = getipnodebyname(servername, AF_INET, 0, h_errnop); if (!he) return NULL; if (tds_copy_hostent(he, result, buffer, buflen)) { errno = ENOMEM; if (h_errnop) *h_errnop = NETDB_INTERNAL; freehostent(he); return NULL; } freehostent(he); return result; } #elif defined(HAVE_FUNC_GETHOSTBYNAME_R_6) static struct hostent * tds_gethostbyname_r(const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop) { if (gethostbyname_r(servername, result, buffer, buflen, &result, h_errnop)) return NULL; return result; } #elif defined(HAVE_FUNC_GETHOSTBYNAME_R_5) static struct hostent * tds_gethostbyname_r(const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop) { result = gethostbyname_r(servername, result, buffer, buflen, h_errnop); return result; } #elif defined(HAVE_FUNC_GETHOSTBYNAME_R_3) static struct hostent * tds_gethostbyname_r(const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop) { struct hostent_data *data = (struct hostent_data *) buffer; memset(buffer, 0, buflen); if (gethostbyname_r(servername, result, data)) { *h_errnop = 0; result = NULL; } return result; } #elif defined(TDS_NO_THREADSAFE) static struct hostent * tds_gethostbyname_r(const char *servername, struct hostent *result, char *buffer, int buflen, int *h_errnop) { return gethostbyname(servername); } #else #error gethostbyname_r style unknown #endif /* Incomplete implementation, single ipv4 addr, service does not work, hints do not work */ int tds_getaddrinfo(const char *node, const char *service, const struct tds_addrinfo *hints, struct tds_addrinfo **res) { struct tds_addrinfo *addr; struct sockaddr_in *sin = NULL; struct hostent *host; in_addr_t ipaddr; char buffer[4096]; struct hostent result; int h_errnop, port = 0; assert(node != NULL); if ((addr = (tds_addrinfo *) calloc(1, sizeof(struct tds_addrinfo))) == NULL) goto Cleanup; if ((sin = (struct sockaddr_in *) calloc(1, sizeof(struct sockaddr_in))) == NULL) goto Cleanup; addr->ai_addr = (struct sockaddr *) sin; addr->ai_addrlen = sizeof(struct sockaddr_in); addr->ai_family = AF_INET; if ((ipaddr = inet_addr(node)) == INADDR_NONE) { if ((host = tds_gethostbyname_r(node, &result, buffer, sizeof(buffer), &h_errnop)) == NULL) goto Cleanup; if (host->h_name) addr->ai_canonname = strdup(host->h_name); ipaddr = *(in_addr_t *) host->h_addr; } if (service) { port = atoi(service); if (!port) port = tds_getservice(service); } sin->sin_family = AF_INET; sin->sin_addr.s_addr = ipaddr; sin->sin_port = htons(port); *res = addr; return 0; Cleanup: if (addr != NULL) tds_freeaddrinfo(addr); return -1; } /* Incomplete implementation, ipv4 only, port does not work, flags do not work */ int tds_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) { struct sockaddr_in *sin = (struct sockaddr_in *) sa; if (sa->sa_family != AF_INET) return EAI_FAMILY; if (host == NULL || hostlen < 16) return EAI_OVERFLOW; #if defined(AF_INET) && HAVE_INET_NTOP inet_ntop(AF_INET, &sin->sin_addr, host, hostlen); #elif HAVE_INET_NTOA_R inet_ntoa_r(sin->sin_addr, host, hostlen); #else strlcpy(hostip, inet_ntoa(sin->sin_addr), hostlen); #endif return 0; } void tds_freeaddrinfo(struct tds_addrinfo *addr) { assert(addr != NULL); free(addr->ai_canonname); free(addr->ai_addr); free(addr); } #endif freetds-1.3.6/src/replacements/CMakeLists.txt000644 025423 025423 00000003002 14056414271 022613 0ustar00fredianofrediano000000 000000 include_directories(.) if(PERL_FOUND AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/iconv_charsets.h") add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/iconv_charsets.h" COMMAND ${PERL_EXECUTABLE} iconv_charsets.pl > "${CMAKE_CURRENT_BINARY_DIR}/iconv_charsets.h" MAIN_DEPENDENCY iconv_charsets.pl WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) add_custom_target(iconv_charsets_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/iconv_charsets.h") else(PERL_FOUND AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/iconv_charsets.h") add_custom_target(iconv_charsets_h DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/iconv_charsets.h") endif(PERL_FOUND AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/iconv_charsets.h") include(CheckFunctionExists) set(FUNCS asprintf vasprintf strtok_r readpassphrase strlcpy strlcat basename getopt strsep setenv) set(add_SRCS) foreach(func ${FUNCS}) string(TOUPPER "HAVE_${func}" var) check_function_exists(${func} ${var}) if(NOT ${var}) set(add_SRCS ${add_SRCS} ${func}.c) endif() endforeach(func) add_library(replacements STATIC iconv.c gettimeofday.c poll.c socketpair.c getaddrinfo.c ${add_SRCS} ) target_include_directories(replacements PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") add_dependencies(replacements iconv_charsets_h) if (NOT WIN32) set_target_properties(replacements PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() add_subdirectory(unittests) INSTALL(TARGETS replacements PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) freetds-1.3.6/src/replacements/iconv_charsets.h000644 025423 025423 00000002054 14162303404 023235 0ustar00fredianofrediano000000 000000 /* * Autogenerated file. * Generated by iconv_charsets.pl */ #define CP1252_ALL \ CP1252(0x80, 8364) \ CP1252(0x82, 8218) \ CP1252(0x83, 402) \ CP1252(0x84, 8222) \ CP1252(0x85, 8230) \ CP1252(0x86, 8224) \ CP1252(0x87, 8225) \ CP1252(0x88, 710) \ CP1252(0x89, 8240) \ CP1252(0x8a, 352) \ CP1252(0x8b, 8249) \ CP1252(0x8c, 338) \ CP1252(0x8e, 381) \ CP1252(0x91, 8216) \ CP1252(0x92, 8217) \ CP1252(0x93, 8220) \ CP1252(0x94, 8221) \ CP1252(0x95, 8226) \ CP1252(0x96, 8211) \ CP1252(0x97, 8212) \ CP1252(0x98, 732) \ CP1252(0x99, 8482) \ CP1252(0x9a, 353) \ CP1252(0x9b, 8250) \ CP1252(0x9c, 339) \ CP1252(0x9e, 382) \ CP1252(0x9f, 376) static const uint16_t cp1252_0080_00a0[] = { 0x20ac, 0x81, 0x201a, 0x192, 0x201e, 0x2026, 0x2020, 0x2021, 0x2c6, 0x2030, 0x160, 0x2039, 0x152, 0x8d, 0x17d, 0x8f, 0x90, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x2dc, 0x2122, 0x161, 0x203a, 0x153, 0x9d, 0x17e, 0x178, }; TDS_COMPILE_CHECK(cp1252size, sizeof(cp1252_0080_00a0) == 0x20*sizeof(uint16_t)); freetds-1.3.6/src/replacements/unittests/000755 025423 025423 00000000000 14162303404 022113 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/replacements/unittests/Makefile.am000644 025423 025423 00000000534 14056414222 024154 0ustar00fredianofrediano000000 000000 NULL = TESTS = \ strings$(EXEEXT) \ strtok_r$(EXEEXT) \ strsep$(EXEEXT) \ $(NULL) check_PROGRAMS = $(TESTS) strings_SOURCES = strings.c strtok_r_SOURCES = strtok_r.c strsep_SOURCES = strsep.c AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir)/.. -I../ LDADD = ../../replacements/libreplacements.la $(NETWORK_LIBS) EXTRA_DIST = CMakeLists.txt freetds-1.3.6/src/replacements/unittests/Makefile.in000644 025423 025423 00000106741 14162303357 024200 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ TESTS = strings$(EXEEXT) strtok_r$(EXEEXT) strsep$(EXEEXT) \ $(am__EXEEXT_1) check_PROGRAMS = $(am__EXEEXT_2) subdir = src/replacements/unittests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = am__EXEEXT_2 = strings$(EXEEXT) strtok_r$(EXEEXT) strsep$(EXEEXT) \ $(am__EXEEXT_1) am_strings_OBJECTS = strings.$(OBJEXT) strings_OBJECTS = $(am_strings_OBJECTS) strings_LDADD = $(LDADD) am__DEPENDENCIES_1 = strings_DEPENDENCIES = ../../replacements/libreplacements.la \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am_strsep_OBJECTS = strsep.$(OBJEXT) strsep_OBJECTS = $(am_strsep_OBJECTS) strsep_LDADD = $(LDADD) strsep_DEPENDENCIES = ../../replacements/libreplacements.la \ $(am__DEPENDENCIES_1) am_strtok_r_OBJECTS = strtok_r.$(OBJEXT) strtok_r_OBJECTS = $(am_strtok_r_OBJECTS) strtok_r_LDADD = $(LDADD) strtok_r_DEPENDENCIES = ../../replacements/libreplacements.la \ $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/strings.Po ./$(DEPDIR)/strsep.Po \ ./$(DEPDIR)/strtok_r.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(strings_SOURCES) $(strsep_SOURCES) $(strtok_r_SOURCES) DIST_SOURCES = $(strings_SOURCES) $(strsep_SOURCES) \ $(strtok_r_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = strings_SOURCES = strings.c strtok_r_SOURCES = strtok_r.c strsep_SOURCES = strsep.c AM_CPPFLAGS = -I$(top_srcdir)/include -I$(srcdir)/.. -I../ LDADD = ../../replacements/libreplacements.la $(NETWORK_LIBS) EXTRA_DIST = CMakeLists.txt all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/replacements/unittests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/replacements/unittests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list strings$(EXEEXT): $(strings_OBJECTS) $(strings_DEPENDENCIES) $(EXTRA_strings_DEPENDENCIES) @rm -f strings$(EXEEXT) $(AM_V_CCLD)$(LINK) $(strings_OBJECTS) $(strings_LDADD) $(LIBS) strsep$(EXEEXT): $(strsep_OBJECTS) $(strsep_DEPENDENCIES) $(EXTRA_strsep_DEPENDENCIES) @rm -f strsep$(EXEEXT) $(AM_V_CCLD)$(LINK) $(strsep_OBJECTS) $(strsep_LDADD) $(LIBS) strtok_r$(EXEEXT): $(strtok_r_OBJECTS) $(strtok_r_DEPENDENCIES) $(EXTRA_strtok_r_DEPENDENCIES) @rm -f strtok_r$(EXEEXT) $(AM_V_CCLD)$(LINK) $(strtok_r_OBJECTS) $(strtok_r_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strings.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strsep.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtok_r.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? strings.log: strings$(EXEEXT) @p='strings$(EXEEXT)'; \ b='strings'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) strtok_r.log: strtok_r$(EXEEXT) @p='strtok_r$(EXEEXT)'; \ b='strtok_r'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) strsep.log: strsep$(EXEEXT) @p='strsep$(EXEEXT)'; \ b='strsep'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/strings.Po -rm -f ./$(DEPDIR)/strsep.Po -rm -f ./$(DEPDIR)/strtok_r.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/strings.Po -rm -f ./$(DEPDIR)/strsep.Po -rm -f ./$(DEPDIR)/strtok_r.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/replacements/unittests/strings.c000644 025423 025423 00000005375 14056414271 023771 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2014 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #undef NDEBUG #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #include /* If the system supplies these, we're going to simulate the situation * where it doesn't so we're always testing our own versions. */ #if HAVE_STRLCPY size_t tds_strlcpy(char *dest, const char *src, size_t len); #include "../strlcpy.c" #endif #if HAVE_STRLCAT size_t tds_strlcat(char *dest, const char *src, size_t len); #include "../strlcat.c" #endif int main(void) { char *buf = (char *) malloc(10); /* test tds_strlcpy */ memset(buf, 0xff, 10); assert(tds_strlcpy(buf, "test", 10) == 4); assert(strcmp(buf, "test") == 0); memset(buf, 0xff, 10); assert(tds_strlcpy(buf, "TESTTEST", 10) == 8); assert(strcmp(buf, "TESTTEST") == 0); memset(buf, 0xff, 10); assert(tds_strlcpy(buf, "abcdefghi", 10) == 9); assert(strcmp(buf, "abcdefghi") == 0); memset(buf, 0xff, 10); assert(tds_strlcpy(buf, "1234567890", 10) == 10); assert(strcmp(buf, "123456789") == 0); memset(buf, 0xff, 10); assert(tds_strlcpy(buf, "xyzabc1234567890", 10) == 16); assert(strcmp(buf, "xyzabc123") == 0); /* test tds_strlcat */ strcpy(buf, "xyz"); assert(tds_strlcat(buf, "test", 10) == 7); assert(strcmp(buf, "xyztest") == 0); strcpy(buf, "xyz"); assert(tds_strlcat(buf, "TESTAB", 10) == 9); assert(strcmp(buf, "xyzTESTAB") == 0); strcpy(buf, "xyz"); assert(tds_strlcat(buf, "TESTabc", 10) == 10); assert(strcmp(buf, "xyzTESTab") == 0); strcpy(buf, "xyz"); assert(tds_strlcat(buf, "123456789012345", 10) == 18); assert(strcmp(buf, "xyz123456") == 0); strcpy(buf, "123456789"); assert(tds_strlcat(buf, "test", 4) == 13); assert(strcmp(buf, "123456789") == 0); /* test length == 0 */ assert(tds_strlcpy(buf + 10, "test", 0) == 4); strcpy(buf, "123"); assert(tds_strlcat(buf, "456", 0) == 6); assert(strcmp(buf, "123") == 0); free(buf); return 0; } freetds-1.3.6/src/replacements/unittests/strsep.c000644 025423 025423 00000004665 14056414271 023621 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2018 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #undef NDEBUG #include #ifdef HAVE_STRSEP char *tds_strsep(char **stringp, const char *delim); #include "../strsep.c" #else #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #endif #include #include #include /* test strsep with same separators */ static void test(char *s, const char *sep, ...) { char *copy = strdup(s); const char *out, *expected; va_list ap; printf("testing '%s' with '%s' separator(s)\n", s, sep); s = copy; va_start(ap, sep); do { out = tds_strsep(&s, sep); expected = va_arg(ap, const char *); if (expected) { assert(out && strcmp(out, expected) == 0); } else { assert(out == NULL); } } while (expected != NULL); va_end(ap); /* should continue to give NULL */ assert(tds_strsep(&s, sep) == NULL); assert(tds_strsep(&s, sep) == NULL); free(copy); } /* test with different separators */ static void test2(void) { char buf[] = "one;two=value"; char *s = buf; assert(strcmp(tds_strsep(&s, ";:"), "one") == 0); assert(strcmp(tds_strsep(&s, "="), "two") == 0); assert(strcmp(tds_strsep(&s, ""), "value") == 0); assert(tds_strsep(&s, "") == NULL); } int main(void) { test("a b c", "", "a b c", NULL); test("a b c", " ", "a", "b", "c", NULL); test("a c", " ", "a", "", "c", NULL); test("a b\tc", " \t", "a", "b", "c", NULL); test("a b\tc ", " \t", "a", "b", "c", "", NULL); test(" a b\tc", " \t", "", "a", "b", "c", NULL); test(",,", ",", "", "", "", NULL); test(",foo,", ",", "", "foo", "", NULL); test2(); return 0; } freetds-1.3.6/src/replacements/unittests/strtok_r.c000644 025423 025423 00000003634 14056414271 024143 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010-2018 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #define TDS_INTERNAL_TEST 1 #include #include #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include static void test(const char *s, const char *sep) { size_t len = strlen(s); char *c1 = (char*) malloc(len+1); char *c2 = (char*) malloc(len+1); char *last = NULL, *s1, *s2; const char *p1, *p2; printf("testint '%s' with '%s' separator(s)\n", s, sep); strcpy(c1, s); strcpy(c2, s); s1 = c1; s2 = c2; for (;;) { p1 = strtok(s1, sep); p2 = strtok_r(s2, sep, &last); s1 = s2 = NULL; if ((p1 && !p2) || (!p1 && p2)) { fprintf(stderr, "ptr mistmach %p %p\n", p1, p2); exit(1); } if (!p1) break; if (strcmp(p1, p2) != 0) { fprintf(stderr, "string mistmach '%s' '%s'\n", p1, p2); exit(1); } printf("got string %s\n", p1); } printf("\n"); free(c1); free(c2); } int main(void) { test("a b\tc", "\t "); test(" x y \t z", " \t"); test("a;b;c;", ";"); test("a;b; c;;", ";"); test("", ";"); test(";;;", ";"); return 0; } freetds-1.3.6/src/replacements/unittests/CMakeLists.txt000644 025423 025423 00000000562 14056414222 024661 0ustar00fredianofrediano000000 000000 foreach(target strings strtok_r strsep) add_executable(r_${target} ${target}.c) set_target_properties(r_${target} PROPERTIES OUTPUT_NAME ${target}) target_link_libraries(r_${target} replacements tdsutils ${lib_BASE}) add_test(NAME r_${target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND r_${target}) add_dependencies(check r_${target}) endforeach(target) freetds-1.3.6/src/utils/Makefile.am000644 025423 025423 00000000556 14056414222 020574 0ustar00fredianofrediano000000 000000 NULL = SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include noinst_LTLIBRARIES = libtdsutils.la libtdsutils_la_SOURCES = \ md4.c \ md5.c \ des.c \ hmac_md5.c \ dlist.c \ getpassarg.c \ sleep.c \ tds_cond.c \ win_mutex.c \ threadsafe.c \ bjoern-utf8.c \ tdsstring.c \ net.c \ $(NULL) EXTRA_DIST = \ CMakeLists.txt \ ptw32_MCS_lock.c \ $(NULL) freetds-1.3.6/src/utils/Makefile.in000644 025423 025423 00000065267 14162303357 020623 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = src/utils ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libtdsutils_la_LIBADD = am__objects_1 = am_libtdsutils_la_OBJECTS = md4.lo md5.lo des.lo hmac_md5.lo dlist.lo \ getpassarg.lo sleep.lo tds_cond.lo win_mutex.lo threadsafe.lo \ bjoern-utf8.lo tdsstring.lo net.lo $(am__objects_1) libtdsutils_la_OBJECTS = $(am_libtdsutils_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bjoern-utf8.Plo ./$(DEPDIR)/des.Plo \ ./$(DEPDIR)/dlist.Plo ./$(DEPDIR)/getpassarg.Plo \ ./$(DEPDIR)/hmac_md5.Plo ./$(DEPDIR)/md4.Plo \ ./$(DEPDIR)/md5.Plo ./$(DEPDIR)/net.Plo ./$(DEPDIR)/sleep.Plo \ ./$(DEPDIR)/tds_cond.Plo ./$(DEPDIR)/tdsstring.Plo \ ./$(DEPDIR)/threadsafe.Plo ./$(DEPDIR)/win_mutex.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtdsutils_la_SOURCES) DIST_SOURCES = $(libtdsutils_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = SUBDIRS = . unittests AM_CPPFLAGS = -I$(top_srcdir)/include noinst_LTLIBRARIES = libtdsutils.la libtdsutils_la_SOURCES = \ md4.c \ md5.c \ des.c \ hmac_md5.c \ dlist.c \ getpassarg.c \ sleep.c \ tds_cond.c \ win_mutex.c \ threadsafe.c \ bjoern-utf8.c \ tdsstring.c \ net.c \ $(NULL) EXTRA_DIST = \ CMakeLists.txt \ ptw32_MCS_lock.c \ $(NULL) all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/utils/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtdsutils.la: $(libtdsutils_la_OBJECTS) $(libtdsutils_la_DEPENDENCIES) $(EXTRA_libtdsutils_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libtdsutils_la_OBJECTS) $(libtdsutils_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bjoern-utf8.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/des.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlist.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getpassarg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hmac_md5.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md4.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/net.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sleep.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tds_cond.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdsstring.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threadsafe.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win_mutex.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -f ./$(DEPDIR)/bjoern-utf8.Plo -rm -f ./$(DEPDIR)/des.Plo -rm -f ./$(DEPDIR)/dlist.Plo -rm -f ./$(DEPDIR)/getpassarg.Plo -rm -f ./$(DEPDIR)/hmac_md5.Plo -rm -f ./$(DEPDIR)/md4.Plo -rm -f ./$(DEPDIR)/md5.Plo -rm -f ./$(DEPDIR)/net.Plo -rm -f ./$(DEPDIR)/sleep.Plo -rm -f ./$(DEPDIR)/tds_cond.Plo -rm -f ./$(DEPDIR)/tdsstring.Plo -rm -f ./$(DEPDIR)/threadsafe.Plo -rm -f ./$(DEPDIR)/win_mutex.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/bjoern-utf8.Plo -rm -f ./$(DEPDIR)/des.Plo -rm -f ./$(DEPDIR)/dlist.Plo -rm -f ./$(DEPDIR)/getpassarg.Plo -rm -f ./$(DEPDIR)/hmac_md5.Plo -rm -f ./$(DEPDIR)/md4.Plo -rm -f ./$(DEPDIR)/md5.Plo -rm -f ./$(DEPDIR)/net.Plo -rm -f ./$(DEPDIR)/sleep.Plo -rm -f ./$(DEPDIR)/tds_cond.Plo -rm -f ./$(DEPDIR)/tdsstring.Plo -rm -f ./$(DEPDIR)/threadsafe.Plo -rm -f ./$(DEPDIR)/win_mutex.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--depfiles check check-am clean clean-generic clean-libtool \ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/utils/md4.c000644 025423 025423 00000014623 14056414222 017370 0ustar00fredianofrediano000000 000000 /* * Copyright (C) 2001 Nikos Mavroyanopoulos * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * The algorithm is due to Ron Rivest. This code is based on code * written by Colin Plumb in 1993. */ /* * This code implements the MD4 message-digest algorithm. */ /* * File from mhash library (mhash.sourceforge.net) */ #include #ifndef HAVE_NETTLE #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #ifndef WORDS_BIGENDIAN #define byteReverse(buf, len) /* Nothing */ #else /* * Note: this code is harmless on little-endian machines. */ static void byteReverse(uint32_t *buf, unsigned longs) { do { *buf = TDS_GET_A4LE(buf); ++buf; } while (--longs); } #endif #define rotl32(x,n) (((x) << ((uint32_t)(n))) | ((x) >> (32 - (uint32_t)(n)))) static void MD4Transform(uint32_t buf[4], const uint32_t in[16]); /* * Start MD4 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD4Init(struct MD4Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bytes = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD4Update(struct MD4Context *ctx, unsigned char const *buf, size_t len) { register uint32_t t; t = ctx->bytes & 0x3f; /* Update bytecount */ ctx->bytes += len; /* Handle any leading odd-sized chunks */ if (t) { unsigned char *p = (unsigned char *) ctx->in + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); byteReverse(ctx->in, 16); MD4Transform(ctx->buf, ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); MD4Transform(ctx->buf, ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD4Final(struct MD4Context *ctx, unsigned char *digest) { unsigned int count; unsigned char *p; /* Compute number of bytes mod 64 */ count = ctx->bytes & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is * always at least one byte free */ p = (unsigned char *) ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); MD4Transform(ctx->buf, ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } byteReverse(ctx->in, 14); /* Append length in bits and transform */ ctx->in[14] = (uint32_t) (ctx->bytes << 3); ctx->in[15] = (uint32_t) (ctx->bytes >> 29); MD4Transform(ctx->buf, ctx->in); byteReverse(ctx->buf, 4); if (digest != NULL) memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The three core functions */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define FF(a, b, c, d, x, s) { \ (a) += F ((b), (c), (d)) + (x); \ (a) = rotl32 ((a), (s)); \ } #define GG(a, b, c, d, x, s) { \ (a) += G ((b), (c), (d)) + (x) + (uint32_t)0x5a827999; \ (a) = rotl32 ((a), (s)); \ } #define HH(a, b, c, d, x, s) { \ (a) += H ((b), (c), (d)) + (x) + (uint32_t)0x6ed9eba1; \ (a) = rotl32 ((a), (s)); \ } /* * The core of the MD4 algorithm */ static void MD4Transform(uint32_t buf[4], const uint32_t in[16]) { register uint32_t a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; FF(a, b, c, d, in[0], 3); /* 1 */ FF(d, a, b, c, in[1], 7); /* 2 */ FF(c, d, a, b, in[2], 11); /* 3 */ FF(b, c, d, a, in[3], 19); /* 4 */ FF(a, b, c, d, in[4], 3); /* 5 */ FF(d, a, b, c, in[5], 7); /* 6 */ FF(c, d, a, b, in[6], 11); /* 7 */ FF(b, c, d, a, in[7], 19); /* 8 */ FF(a, b, c, d, in[8], 3); /* 9 */ FF(d, a, b, c, in[9], 7); /* 10 */ FF(c, d, a, b, in[10], 11); /* 11 */ FF(b, c, d, a, in[11], 19); /* 12 */ FF(a, b, c, d, in[12], 3); /* 13 */ FF(d, a, b, c, in[13], 7); /* 14 */ FF(c, d, a, b, in[14], 11); /* 15 */ FF(b, c, d, a, in[15], 19); /* 16 */ GG(a, b, c, d, in[0], 3); /* 17 */ GG(d, a, b, c, in[4], 5); /* 18 */ GG(c, d, a, b, in[8], 9); /* 19 */ GG(b, c, d, a, in[12], 13); /* 20 */ GG(a, b, c, d, in[1], 3); /* 21 */ GG(d, a, b, c, in[5], 5); /* 22 */ GG(c, d, a, b, in[9], 9); /* 23 */ GG(b, c, d, a, in[13], 13); /* 24 */ GG(a, b, c, d, in[2], 3); /* 25 */ GG(d, a, b, c, in[6], 5); /* 26 */ GG(c, d, a, b, in[10], 9); /* 27 */ GG(b, c, d, a, in[14], 13); /* 28 */ GG(a, b, c, d, in[3], 3); /* 29 */ GG(d, a, b, c, in[7], 5); /* 30 */ GG(c, d, a, b, in[11], 9); /* 31 */ GG(b, c, d, a, in[15], 13); /* 32 */ HH(a, b, c, d, in[0], 3); /* 33 */ HH(d, a, b, c, in[8], 9); /* 34 */ HH(c, d, a, b, in[4], 11); /* 35 */ HH(b, c, d, a, in[12], 15); /* 36 */ HH(a, b, c, d, in[2], 3); /* 37 */ HH(d, a, b, c, in[10], 9); /* 38 */ HH(c, d, a, b, in[6], 11); /* 39 */ HH(b, c, d, a, in[14], 15); /* 40 */ HH(a, b, c, d, in[1], 3); /* 41 */ HH(d, a, b, c, in[9], 9); /* 42 */ HH(c, d, a, b, in[5], 11); /* 43 */ HH(b, c, d, a, in[13], 15); /* 44 */ HH(a, b, c, d, in[3], 3); /* 45 */ HH(d, a, b, c, in[11], 9); /* 46 */ HH(c, d, a, b, in[7], 11); /* 47 */ HH(b, c, d, a, in[15], 15); /* 48 */ buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } #endif freetds-1.3.6/src/utils/md5.c000644 025423 025423 00000017473 14056414222 017377 0ustar00fredianofrediano000000 000000 /* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. */ /* * File from mhash library (mhash.sourceforge.net) */ #include #ifndef HAVE_NETTLE #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #ifndef WORDS_BIGENDIAN #define byteReverse(buf, len) /* Nothing */ #else /* * Note: this code is harmless on little-endian machines. */ static void byteReverse(uint32_t *buf, unsigned longs) { do { *buf = TDS_GET_A4LE(buf); ++buf; } while (--longs); } #endif static void MD5Transform(uint32_t buf[4], const uint32_t in[16]); /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bytes = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, size_t len) { register uint32_t t; t = ctx->bytes & 0x3f; /* Bytes already in shsInfo->data */ /* Update bytecount */ ctx->bytes += len; /* Handle any leading odd-sized chunks */ if (t) { unsigned char *p = (unsigned char *) ctx->in + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD5Final(struct MD5Context *ctx, unsigned char* digest) { unsigned int count; unsigned char *p; /* Compute number of bytes mod 64 */ count = ctx->bytes & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ p = (unsigned char *) ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } byteReverse(ctx->in, 14); /* Append length in bits and transform */ ctx->in[14] = (uint32_t) (ctx->bytes << 3); ctx->in[15] = (uint32_t) (ctx->bytes >> 29); MD5Transform(ctx->buf, ctx->in); byteReverse(ctx->buf, 4); if (digest!=NULL) memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ static void MD5Transform(uint32_t buf[4], const uint32_t in[16]) { register uint32_t a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } #endif freetds-1.3.6/src/utils/des.c000644 025423 025423 00000041312 14056414222 017452 0ustar00fredianofrediano000000 000000 /* * Copyright (C) 1998,1999,2000,2001 Nikos Mavroyanopoulos * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* Sofware DES functions * written 12 Dec 1986 by Phil Karn, KA9Q; large sections adapted from * the 1977 public-domain program by Jim Gillogly * Modified for additional speed - 6 December 1988 Phil Karn * Modified for parameterized key schedules - Jan 1991 Phil Karn * Callers now allocate a key schedule as follows: * kn = (char (*)[8])malloc(sizeof(char) * 8 * 16); * or * char kn[16][8]; */ /* modified in order to use the libmcrypt API by Nikos Mavroyanopoulos * All modifications are placed under the license of libmcrypt. */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include void tds_des_set_odd_parity(des_cblock key) { int i; unsigned char parity; for (i = 0; i < 8; i++) { parity = key[i]; parity ^= parity >> 4; parity ^= parity >> 2; parity ^= parity >> 1; key[i] = (key[i] & 0xfe) | (parity & 1); } } #ifndef HAVE_NETTLE static void permute_ip(const des_cblock inblock, const DES_KEY * key, des_cblock outblock); static void permute_fp(const des_cblock inblock, const DES_KEY * key, des_cblock outblock); static void perminit_ip(DES_KEY * key); static void spinit(DES_KEY * key); static void perminit_fp(DES_KEY * key); static uint32_t f(const DES_KEY * key, register uint32_t r, register const unsigned char *subkey); /* Tables defined in the Data Encryption Standard documents */ /* initial permutation IP */ static const char ip[] = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 }; /* final permutation IP^-1 */ static const char fp[] = { 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25 }; /* expansion operation matrix * This is for reference only; it is unused in the code * as the f() function performs it implicitly for speed */ #ifdef notdef static char ei[] = { 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 }; #endif /* permuted choice table (key) */ static const char pc1[] = { 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 }; /* number left rotations of pc1 */ static const char totrot[] = { 1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28 }; /* permuted choice key (table) */ static const char pc2[] = { 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 }; /* The (in)famous S-boxes */ static const char si[8][64] = { /* S1 */ {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}, /* S2 */ {15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}, /* S3 */ {10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}, /* S4 */ {7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}, /* S5 */ {2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}, /* S6 */ {12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}, /* S7 */ {4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}, /* S8 */ {13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}, }; #ifdef notdef /* 32-bit permutation function P used on the output of the S-boxes */ static const char p32i[] = { 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 }; #endif #define P32I_INDEX_ROW(n,i,a,b,c,d) \ n==a ? 0+i : n==b ? 1+i : n==c ? 2+i : n==d ? 3+i #define P32I_INDEX(n) \ (P32I_INDEX_ROW(n, 0, 16, 7, 20, 21) :\ P32I_INDEX_ROW(n, 4, 29, 12, 28, 17) :\ P32I_INDEX_ROW(n, 8, 1, 15, 23, 26) :\ P32I_INDEX_ROW(n,12, 5, 18, 31, 10) :\ P32I_INDEX_ROW(n,16, 2, 8, 24, 14) :\ P32I_INDEX_ROW(n,20, 32, 27, 3, 9) :\ P32I_INDEX_ROW(n,24, 19, 13, 30, 6) :\ P32I_INDEX_ROW(n,28, 22, 11, 4, 25) : 0x7f) static const char pbox[32] = { P32I_INDEX( 1), P32I_INDEX( 2), P32I_INDEX( 3), P32I_INDEX( 4), P32I_INDEX( 5), P32I_INDEX( 6), P32I_INDEX( 7), P32I_INDEX( 8), P32I_INDEX( 9), P32I_INDEX(10), P32I_INDEX(11), P32I_INDEX(12), P32I_INDEX(13), P32I_INDEX(14), P32I_INDEX(15), P32I_INDEX(16), P32I_INDEX(17), P32I_INDEX(18), P32I_INDEX(19), P32I_INDEX(20), P32I_INDEX(21), P32I_INDEX(22), P32I_INDEX(23), P32I_INDEX(24), P32I_INDEX(25), P32I_INDEX(26), P32I_INDEX(27), P32I_INDEX(28), P32I_INDEX(29), P32I_INDEX(30), P32I_INDEX(31), P32I_INDEX(32), }; /* End of DES-defined tables */ /* Lookup tables initialized once only at startup by des_init() */ /* bit 0 is left-most in byte */ static const int bytebit[] = { 0200, 0100, 040, 020, 010, 04, 02, 01 }; static const int nibblebit[] = { 010, 04, 02, 01 }; /* Allocate space and initialize DES lookup arrays * mode == 0: standard Data Encryption Algorithm */ static int des_init(DES_KEY * key) { spinit(key); perminit_ip(key); perminit_fp(key); return 0; } /* Set key (initialize key schedule array) */ int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len) { char pc1m[56]; /* place to modify pc1 into */ char pcr[56]; /* place to rotate pc1 into */ register int i, j, l; int m; memset(dkey, '\0', sizeof(DES_KEY)); des_init(dkey); /* Clear key schedule */ for (j = 0; j < 56; j++) { /* convert pc1 to bits of key */ l = pc1[j] - 1; /* integer bit location */ m = l & 07; /* find bit */ pc1m[j] = (user_key[l >> 3] & /* find which key byte l is in */ bytebit[m]) /* and which bit of that byte */ ? 1 : 0; /* and store 1-bit result */ } for (i = 0; i < 16; i++) { /* key chunk for each iteration */ for (j = 0; j < 56; j++) /* rotate pc1 the right amount */ pcr[j] = pc1m[(l = j + totrot[i]) < (j < 28 ? 28 : 56) ? l : l - 28]; /* rotate left and right halves independently */ for (j = 0; j < 48; j++) { /* select bits individually */ /* check bit that goes to kn[j] */ if (pcr[pc2[j] - 1]) { /* mask it in if it's there */ l = j % 6; dkey->kn[i][j / 6] |= bytebit[l] >> 2; } } } return 0; } /* In-place encryption of 64-bit block */ void tds_des_encrypt(const DES_KEY * key, des_cblock block) { register uint32_t left, right; register const unsigned char *knp; uint32_t work[2]; /* Working data storage */ permute_ip(block, key, (unsigned char *) work); /* Initial Permutation */ left = TDS_GET_A4BE(&work[0]); right = TDS_GET_A4BE(&work[1]); /* Do the 16 rounds. * The rounds are numbered from 0 to 15. On even rounds * the right half is fed to f() and the result exclusive-ORs * the left half; on odd rounds the reverse is done. */ knp = &key->kn[0][0]; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); knp += 8; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); knp += 8; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); knp += 8; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); knp += 8; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); knp += 8; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); knp += 8; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); knp += 8; left ^= f(key, right, knp); knp += 8; right ^= f(key, left, knp); /* Left/right half swap, plus byte swap if little-endian */ TDS_PUT_A4BE(&work[0], right); TDS_PUT_A4BE(&work[1], left); permute_fp((unsigned char *) work, key, block); /* Inverse initial permutation */ } /* In-place decryption of 64-bit block. This function is the mirror * image of encryption; exactly the same steps are taken, but in * reverse order */ #if 0 void _mcrypt_decrypt(DES_KEY * key, unsigned char *block) { register uint32_t left, right; register unsigned char *knp; uint32_t work[2]; /* Working data storage */ permute_ip(block, key, (unsigned char *) work); /* Initial permutation */ /* Left/right half swap, plus byte swap if little-endian */ right = TDS_GET_A4BE(&work[0]); left = TDS_GET_A4BE(&work[1]); /* Do the 16 rounds in reverse order. * The rounds are numbered from 15 to 0. On even rounds * the right half is fed to f() and the result exclusive-ORs * the left half; on odd rounds the reverse is done. */ knp = &key->kn[15][0]; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); knp -= 8; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); knp -= 8; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); knp -= 8; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); knp -= 8; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); knp -= 8; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); knp -= 8; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); knp -= 8; right ^= f(key, left, knp); knp -= 8; left ^= f(key, right, knp); TDS_PUT_A4BE(&work[0], left); TDS_PUT_A4BE(&work[1], right); permute_fp((unsigned char *) work, key, block); /* Inverse initial permutation */ } #endif /* Permute inblock with perm */ static void permute_ip(const des_cblock inblock, const DES_KEY * key, des_cblock outblock) { register const unsigned char *ib; /* ptr to input block */ register unsigned char *ob; /* ptr to output block */ register const unsigned char *p, *q; register int j; /* Clear output block */ memset(outblock, '\0', 8); ib = inblock; for (j = 0; j < 16; j += 2, ib++) { /* for each input nibble */ ob = outblock; p = key->iperm[j][(*ib >> 4) & 0xf]; q = key->iperm[j + 1][*ib & 0xf]; /* and each output byte, OR the masks together */ *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; } } /* Permute inblock with perm */ static void permute_fp(const des_cblock inblock, const DES_KEY * key, des_cblock outblock) { register const unsigned char *ib; /* ptr to input block */ register unsigned char *ob; /* ptr to output block */ register const unsigned char *p, *q; register int j; /* Clear output block */ memset(outblock, '\0', 8); ib = inblock; for (j = 0; j < 16; j += 2, ib++) { /* for each input nibble */ ob = outblock; p = key->fperm[j][(*ib >> 4) & 0xf]; q = key->fperm[j + 1][*ib & 0xf]; /* and each output byte, OR the masks together */ *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; *ob++ |= *p++ | *q++; } } /* The nonlinear function f(r,k), the heart of DES */ static uint32_t f(const DES_KEY * key, register uint32_t r, register const unsigned char *subkey) { register const uint32_t *spp; register uint32_t rval, rt; register int er; #ifdef TRACE printf("f(%08lx, %02x %02x %02x %02x %02x %02x %02x %02x) = ", r, subkey[0], subkey[1], subkey[2], subkey[3], subkey[4], subkey[5], subkey[6], subkey[7]); #endif /* Run E(R) ^ K through the combined S & P boxes. * This code takes advantage of a convenient regularity in * E, namely that each group of 6 bits in E(R) feeding * a single S-box is a contiguous segment of R. */ subkey += 7; /* Compute E(R) for each block of 6 bits, and run thru boxes */ er = ((int) r << 1) | ((r & 0x80000000) ? 1 : 0); spp = &key->sp[7][0]; rval = spp[(er ^ *subkey--) & 0x3f]; spp -= 64; rt = (uint32_t) r >> 3; rval |= spp[((int) rt ^ *subkey--) & 0x3f]; spp -= 64; rt >>= 4; rval |= spp[((int) rt ^ *subkey--) & 0x3f]; spp -= 64; rt >>= 4; rval |= spp[((int) rt ^ *subkey--) & 0x3f]; spp -= 64; rt >>= 4; rval |= spp[((int) rt ^ *subkey--) & 0x3f]; spp -= 64; rt >>= 4; rval |= spp[((int) rt ^ *subkey--) & 0x3f]; spp -= 64; rt >>= 4; rval |= spp[((int) rt ^ *subkey--) & 0x3f]; spp -= 64; rt >>= 4; rt |= (r & 1) << 5; rval |= spp[((int) rt ^ *subkey) & 0x3f]; #ifdef TRACE printf(" %08lx\n", rval); #endif return rval; } /* initialize a perm array */ static void perminit_ip(DES_KEY * key) { register int l, j, k; int i, m; /* Clear the permutation array */ memset(key->iperm, '\0', 16 * 16 * 8); for (i = 0; i < 16; i++) /* each input nibble position */ for (j = 0; j < 16; j++) /* each possible input nibble */ for (k = 0; k < 64; k++) { /* each output bit position */ l = ip[k] - 1; /* where does this bit come from */ if ((l >> 2) != i) /* does it come from input posn? */ continue; /* if not, bit k is 0 */ if (!(j & nibblebit[l & 3])) continue; /* any such bit in input? */ m = k & 07; /* which bit is this in the byte */ key->iperm[i][j][k >> 3] |= bytebit[m]; } } static void perminit_fp(DES_KEY * key) { register int l, j, k; int i, m; /* Clear the permutation array */ memset(key->fperm, '\0', 16 * 16 * 8); for (i = 0; i < 16; i++) /* each input nibble position */ for (j = 0; j < 16; j++) /* each possible input nibble */ for (k = 0; k < 64; k++) { /* each output bit position */ l = fp[k] - 1; /* where does this bit come from */ if ((l >> 2) != i) /* does it come from input posn? */ continue; /* if not, bit k is 0 */ if (!(j & nibblebit[l & 3])) continue; /* any such bit in input? */ m = k & 07; /* which bit is this in the byte */ key->fperm[i][j][k >> 3] |= bytebit[m]; } } /* Initialize the lookup table for the combined S and P boxes */ static void spinit(DES_KEY * key) { int i, s, j, rowcol; uint32_t val; for (s = 0; s < 8; s++) { /* For each S-box */ for (i = 0; i < 64; i++) { /* For each possible input */ val = 0; /* The row number is formed from the first and last * bits; the column number is from the middle 4 */ rowcol = (i & 32) | ((i & 1) ? 16 : 0) | ((i >> 1) & 0xf); for (j = 0; j < 4; j++) { /* For each output bit */ if (si[s][rowcol] & (8 >> j)) { val |= 1L << (31 - pbox[4 * s + j]); } } key->sp[s][i] = val; } } } #endif /* ECB MODE */ int tds_des_ecb_encrypt(const void *plaintext, int len, DES_KEY * akey, unsigned char *output) { int j; const unsigned char *plain = (const unsigned char *) plaintext; for (j = 0; j < len / 8; j++) { memcpy(&output[j * 8], &plain[j * 8], 8); tds_des_encrypt(akey, &output[j * 8]); } if (j == 0 && len != 0) return -1; /* no blocks were encrypted */ return 0; } freetds-1.3.6/src/utils/hmac_md5.c000644 025423 025423 00000003703 14056414222 020356 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include #include /** * Calculates the HMAC-MD5 hash of the given data using the specified * hashing key. * * @param key The hashing key. * @param data The data for which the hash will be calculated. * @param data_len data length. * @param digest The HMAC-MD5 hash of the given data. */ void hmac_md5(const unsigned char key[16], const unsigned char* data, size_t data_len, unsigned char* digest) { int i; MD5_CTX ctx; unsigned char k_ipad[64]; unsigned char k_opad[64]; /* compute ipad and opad */ memset(k_ipad, 0x36, sizeof(k_ipad)); memset(k_opad, 0x5c, sizeof(k_opad)); for (i=0; i<16; ++i) { k_ipad[i] ^= key[i]; k_opad[i] ^= key[i]; } MD5Init(&ctx); MD5Update(&ctx, k_ipad, 64); if (data_len != 0) MD5Update(&ctx, data, data_len); MD5Final(&ctx, digest); MD5Init(&ctx); MD5Update(&ctx, k_opad, 64); MD5Update(&ctx, digest, 16); MD5Final(&ctx, digest); } freetds-1.3.6/src/utils/dlist.c000644 025423 025423 00000002103 14056414222 020011 0ustar00fredianofrediano000000 000000 /* Dlist - dynamic list * Copyright (C) 2016 Frediano Ziglio * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #if ENABLE_EXTRA_CHECKS void dlist_ring_check(dlist_ring *ring) { const dlist_ring *item = ring; do { assert(item->prev->next == item); assert(item->next->prev == item); item = item->next; } while (item != ring); } #endif freetds-1.3.6/src/utils/getpassarg.c000644 025423 025423 00000003055 14056414222 021041 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2006, 2007, 2008, 2009, 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include /* * return a copy of the password, reading from stdin if arg is '-' * trashing he argument in the process. */ char * tds_getpassarg(char *arg) { char pwd[256], *ptr, *q; if (strcmp(arg, "-") == 0) { if (fgets(pwd, sizeof(pwd), stdin) == NULL) return NULL; ptr = strchr(pwd, '\n'); if (ptr) *ptr = '\0'; arg = pwd; } ptr = strdup(arg); memset(pwd, 0, sizeof(pwd)); for (q = arg; *q; *q++ = '*') continue; return ptr; } freetds-1.3.6/src/utils/sleep.c000644 025423 025423 00000003147 14056414222 020013 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_POLL_H #include #endif /* HAVE_POLL_H */ #include #include #include void tds_sleep_s(unsigned sec) { #ifdef _WIN32 Sleep(sec * 1000u); #else sleep(sec); #endif } void tds_sleep_ms(unsigned ms) { #ifdef _WIN32 Sleep(ms); #elif defined(HAVE_NANOSLEEP) struct timespec ts = { ms / 1000u, (ms % 1000u) * 1000000lu }, rem; int r; for (;;) { r = nanosleep(&ts, &rem); if (!r || errno != EINTR) break; ts = rem; } #elif defined(HAVE_USLEEP) usleep(ms * 1000u); #else struct pollfd fd; poll(&fd, 0, ms); #endif } freetds-1.3.6/src/utils/tds_cond.c000644 025423 025423 00000014020 14056414222 020470 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef _WIN32 #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include /* implementation for systems that support Condition Variables */ typedef VOID(WINAPI * init_cv_t) (TDS_CONDITION_VARIABLE * cv); typedef BOOL(WINAPI * sleep_cv_t) (TDS_CONDITION_VARIABLE * cv, CRITICAL_SECTION * crit, DWORD milli); typedef VOID(WINAPI * wake_cv_t) (TDS_CONDITION_VARIABLE * cv); static init_cv_t init_cv = NULL; static sleep_cv_t sleep_cv = NULL; static wake_cv_t wake_cv = NULL; static int new_cond_init(tds_condition * cond) { init_cv(&cond->cv); return 0; } static int new_cond_destroy(tds_condition * cond) { return 0; } static int new_cond_signal(tds_condition * cond) { wake_cv(&cond->cv); return 0; } static int new_cond_timedwait(tds_condition * cond, tds_raw_mutex * mtx, int timeout_sec) { if (sleep_cv(&cond->cv, &mtx->crit, timeout_sec <= 0 ? INFINITE : timeout_sec * 1000)) return 0; return ETIMEDOUT; } /* implementation for systems that do not support Condition Variables */ static int old_cond_init(tds_condition * cond) { cond->ev = CreateEvent(NULL, FALSE, FALSE, NULL); if (!cond->ev) return ENOMEM; return 0; } static int old_cond_destroy(tds_condition * cond) { CloseHandle(cond->ev); return 0; } static int old_cond_signal(tds_condition * cond) { SetEvent(cond->ev); return 0; } static int old_cond_timedwait(tds_condition * cond, tds_raw_mutex * mtx, int timeout_sec) { int res; LeaveCriticalSection(&mtx->crit); res = WaitForSingleObject(cond->ev, timeout_sec < 0 ? INFINITE : timeout_sec * 1000); EnterCriticalSection(&mtx->crit); return res == WAIT_TIMEOUT ? ETIMEDOUT : 0; } /* dummy implementation used to detect which version above to use */ static void detect_cond(void) { /* detect if this Windows support condition variables */ HMODULE mod = GetModuleHandle(TEXT("kernel32")); init_cv = (init_cv_t) GetProcAddress(mod, "InitializeConditionVariable"); sleep_cv = (sleep_cv_t) GetProcAddress(mod, "SleepConditionVariableCS"); wake_cv = (wake_cv_t) GetProcAddress(mod, "WakeConditionVariable"); if (init_cv && sleep_cv && wake_cv) { tds_raw_cond_init = new_cond_init; tds_raw_cond_destroy = new_cond_destroy; tds_raw_cond_signal = new_cond_signal; tds_raw_cond_timedwait = new_cond_timedwait; } else { tds_raw_cond_init = old_cond_init; tds_raw_cond_destroy = old_cond_destroy; tds_raw_cond_signal = old_cond_signal; tds_raw_cond_timedwait = old_cond_timedwait; } } static int detect_cond_init(tds_condition * cond) { detect_cond(); return tds_raw_cond_init(cond); } static int detect_cond_destroy(tds_condition * cond) { detect_cond(); return tds_raw_cond_destroy(cond); } static int detect_cond_signal(tds_condition * cond) { detect_cond(); return tds_raw_cond_signal(cond); } static int detect_cond_timedwait(tds_condition * cond, tds_raw_mutex * mtx, int timeout_sec) { detect_cond(); return tds_raw_cond_timedwait(cond, mtx, timeout_sec); } int (*tds_raw_cond_init) (tds_condition * cond) = detect_cond_init; int (*tds_raw_cond_destroy) (tds_condition * cond) = detect_cond_destroy; int (*tds_raw_cond_signal) (tds_condition * cond) = detect_cond_signal; int (*tds_raw_cond_timedwait) (tds_condition * cond, tds_raw_mutex * mtx, int timeout_sec) = detect_cond_timedwait; #elif defined(TDS_HAVE_PTHREAD_MUTEX) && !defined(TDS_NO_THREADSAFE) #include #include /* check if we can use clock_gettime */ #undef USE_CLOCK_IN_COND #if !defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP) && \ defined(HAVE_CLOCK_GETTIME) && (defined(CLOCK_REALTIME) || defined(CLOCK_MONOTONIC)) #define USE_CLOCK_IN_COND 1 #endif /* check if we can use CLOCK_MONOTONIC for conditions */ #undef USE_MONOTONIC_CLOCK_IN_COND #if defined(USE_CLOCK_IN_COND) && defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(CLOCK_MONOTONIC) #define USE_MONOTONIC_CLOCK_IN_COND 1 #endif int tds_raw_cond_init(tds_condition *cond) { #ifdef USE_MONOTONIC_CLOCK_IN_COND int res; pthread_condattr_t attr; pthread_condattr_init(&attr); res = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); if (!res) res = pthread_cond_init(cond, &attr); pthread_condattr_destroy(&attr); return res; #else return pthread_cond_init(cond, NULL); #endif } int tds_raw_cond_timedwait(tds_condition *cond, tds_raw_mutex *mtx, int timeout_sec) { struct timespec ts; #if !defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP) && !defined(USE_CLOCK_IN_COND) struct timeval tv; #endif if (timeout_sec <= 0) return tds_raw_cond_wait(cond, mtx); #if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP) ts.tv_sec = timeout_sec; ts.tv_nsec = 0; return pthread_cond_timedwait_relative_np(cond, mtx, &ts); #else # ifdef USE_CLOCK_IN_COND # if defined(USE_MONOTONIC_CLOCK_IN_COND) clock_gettime(CLOCK_MONOTONIC, &ts); # else clock_gettime(CLOCK_REALTIME, &ts); # endif # elif defined(HAVE_GETTIMEOFDAY) gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000u; # else # error No way to get a proper time! # endif ts.tv_sec += timeout_sec; return pthread_cond_timedwait(cond, mtx, &ts); #endif } #endif freetds-1.3.6/src/utils/win_mutex.c000644 025423 025423 00000004074 14056414222 020722 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef _WIN32 #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include "ptw32_MCS_lock.c" void tds_win_mutex_lock(tds_raw_mutex * mutex) { if (!InterlockedExchangeAdd(&mutex->done, 0)) { /* MBR fence */ ptw32_mcs_local_node_t node; ptw32_mcs_lock_acquire(&mutex->lock, &node); if (!mutex->done) { InitializeCriticalSection(&mutex->crit); mutex->done = 1; } ptw32_mcs_lock_release(&node); } EnterCriticalSection(&mutex->crit); mutex->thread_id = GetCurrentThreadId(); } int tds_raw_mutex_trylock(tds_raw_mutex * mutex) { if (!mutex->done && !InterlockedExchangeAdd(&mutex->done, 0)) { /* MBR fence */ ptw32_mcs_local_node_t node; ptw32_mcs_lock_acquire(&mutex->lock, &node); if (!mutex->done) { InitializeCriticalSection(&mutex->crit); mutex->done = 1; } ptw32_mcs_lock_release(&node); } if (TryEnterCriticalSection(&mutex->crit)) { DWORD thread_id = GetCurrentThreadId(); if (mutex->thread_id == thread_id) { LeaveCriticalSection(&mutex->crit); return -1; } mutex->thread_id = thread_id; return 0; } return -1; } #endif freetds-1.3.6/src/utils/threadsafe.c000644 025423 025423 00000017256 14056414271 021023 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2005-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include #if defined(HAVE_GETUID) && defined(HAVE_GETPWUID) #include #endif #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #if HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #if HAVE_ROKEN_H #include #endif /* HAVE_ROKEN_H */ #if defined(_WIN32) || defined(_WIN64) #include #include #endif #include #include #include #include struct tm * tds_localtime_r(const time_t *timep, struct tm *result) { struct tm *tm; #if defined(_REENTRANT) && !defined(_WIN32) #if HAVE_FUNC_LOCALTIME_R_TM tm = localtime_r(timep, result); #else tm = NULL; if (!localtime_r(timep, result)) tm = result; #endif /* HAVE_FUNC_LOCALTIME_R_TM */ #else tm = localtime(timep); if (tm) { memcpy(result, tm, sizeof(*result)); tm = result; } #endif return tm; } char * tds_timestamp_str(char *str, int maxlen) { #if !defined(_WIN32) && !defined(_WIN64) struct tm *tm; struct tm res; time_t t; #if HAVE_GETTIMEOFDAY struct timeval tv; char usecs[10]; gettimeofday(&tv, NULL); t = tv.tv_sec; #else /* * XXX Need to get a better time resolution for * systems that don't have gettimeofday(). */ time(&t); #endif tm = tds_localtime_r(&t, &res); /** strftime(str, maxlen - 6, "%Y-%m-%d %H:%M:%S", tm); **/ strftime(str, maxlen - 6, "%H:%M:%S", tm); #if HAVE_GETTIMEOFDAY sprintf(usecs, ".%06lu", (long) tv.tv_usec); strcat(str, usecs); #endif #else /* _WIN32 */ SYSTEMTIME st; GetLocalTime(&st); _snprintf(str, maxlen - 1, "%02u:%02u:%02u.%03u", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); str[maxlen - 1] = 0; #endif return str; } /* * If reentrant code was not requested, we don't care reentrancy, so * just assume the standard BSD netdb interface is reentrant and use it. */ #ifndef _REENTRANT # undef NETDB_REENTRANT # define NETDB_REENTRANT 1 #endif /* _REENTRANT */ #if 0 #undef HAVE_GETADDRINFO #undef NETDB_REENTRANT #undef HAVE_FUNC_GETSERVBYNAME_R_6 #undef HAVE_FUNC_GETSERVBYNAME_R_5 #undef HAVE_FUNC_GETSERVBYNAME_R_4 #undef TDS_NO_THREADSAFE # if 0 # define HAVE_FUNC_GETSERVBYNAME_R_6 1 int test_getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buffer, size_t buflen, struct servent **result); # define getservbyname_r test_getservbyname_r # elif 0 # define HAVE_FUNC_GETSERVBYNAME_R_5 1 struct servent * test_getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buffer, size_t buflen); # define getservbyname_r test_getservbyname_r # else # define HAVE_FUNC_GETSERVBYNAME_R_4 1 struct servent_data { int dummy; }; int test_getservbyname_r(const char *name, const char *proto, struct servent *result_buf, struct servent_data *data); # define getservbyname_r test_getservbyname_r # endif #endif /** * Return service port given the name */ int tds_getservice(const char *name) { #if defined(HAVE_GETADDRINFO) /* new OSes should implement this in a proper way */ struct addrinfo hints, *res; int result; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; res = NULL; if (getaddrinfo(NULL, name, &hints, &res)) return 0; if (res->ai_family != AF_INET || !res->ai_addr) { freeaddrinfo(res); return 0; } result = ntohs(((struct sockaddr_in *) res->ai_addr)->sin_port); freeaddrinfo(res); return result; #elif defined(NETDB_REENTRANT) /* HP-UX/Windows */ struct servent *result = getservbyname(name, "tcp"); return result ? ntohs(result->s_port) : 0; #elif defined(HAVE_FUNC_GETSERVBYNAME_R_6) /* Linux variant */ struct servent *result = NULL; struct servent result_buf; char buffer[4096]; if (!getservbyname_r(name, "tcp", &result_buf, buffer, sizeof(buffer), &result)) return ntohs(result->s_port); return 0; #elif defined(HAVE_FUNC_GETSERVBYNAME_R_5) /* Solaris variant */ struct servent result; char buffer[4096]; if (getservbyname_r(name, "tcp", &result, buffer, sizeof(buffer))) return ntohs(result.s_port); return 0; #elif defined(HAVE_FUNC_GETSERVBYNAME_R_4) /* AIX/BSD variant */ struct servent result; struct servent_data data; if (!getservbyname_r(name, "tcp", &result, &data)) return ntohs(result.s_port); return 0; #elif defined(TDS_NO_THREADSAFE) struct servent *result = getservbyname(name, "tcp"); return result ? ntohs(result->s_port) : 0; #else #error getservbyname_r style unknown #endif } /** * Get user home directory * @return home directory or NULL if error. Should be freed with free */ char * tds_get_homedir(void) { #ifndef _WIN32 /* if is available getpwuid_r use it */ #if defined(HAVE_GETUID) && defined(HAVE_GETPWUID_R) struct passwd *pw, bpw; char buf[1024]; # if defined(HAVE_FUNC_GETPWUID_R_5) /* getpwuid_r can return 0 if uid is not found so check pw */ pw = NULL; if (getpwuid_r(getuid(), &bpw, buf, sizeof(buf), &pw) || !pw) return NULL; # elif defined(HAVE_FUNC_GETPWUID_R_4_PW) if (!(pw = getpwuid_r(getuid(), &bpw, buf, sizeof(buf)))) return NULL; # else /* !HAVE_FUNC_GETPWUID_R_4_PW */ if (getpwuid_r(getuid(), &bpw, buf, sizeof(buf))) return NULL; pw = &bpw; # endif return strdup(pw->pw_dir); /* if getpwuid is available use it for no reentrant (getpwuid is not reentrant) */ #elif defined(HAVE_GETUID) && defined(HAVE_GETPWUID) && !defined(_REENTRANT) struct passwd *pw; pw = getpwuid(getuid()); if (!pw) return NULL; return strdup(pw->pw_dir); #else char *home; home = getenv("HOME"); if (!home || !home[0]) return NULL; return strdup(home); #endif #else /* _WIN32 */ /* * For win32 we return application data cause we use "HOME" * only to store configuration files */ HRESULT hr; LPMALLOC pMalloc = NULL; char * res = NULL; hr = SHGetMalloc(&pMalloc); if (!FAILED(hr)) { LPITEMIDLIST pidl; hr = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl); if (!FAILED(hr)) { /* * SHGetPathFromIDListA() tries to count the length of "path", * so we have to make sure that it has only zeros; otherwise, * invalid memory access is inevitable. */ char path[MAX_PATH] = ""; if (SHGetPathFromIDList(pidl, path)) res = strdup(path); (*pMalloc->lpVtbl->Free)(pMalloc, pidl); } (*pMalloc->lpVtbl->Release)(pMalloc); } return res; #endif } freetds-1.3.6/src/utils/bjoern-utf8.c000644 025423 025423 00000004613 14056414222 021045 0ustar00fredianofrediano000000 000000 /* * Copyright (c) 2008-2010 Bjoern Hoehrmann * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. */ #include #include const uint8_t utf8_table[] = { /* The first part of the table maps bytes to character classes that * to reduce the size of the transition table and create bitmasks. */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3, 11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8, /* The second part is a transition table that maps a combination * of a state of the automaton and a character class to a state. */ 0,12,24,36,60,96,84,12,12,12,48,72, 12,12,12,12,12,12,12,12,12,12,12,12, 12, 0,12,12,12,12,12, 0,12, 0,12,12, 12,24,12,12,12,12,12,24,12,24,12,12, 12,12,12,12,12,12,12,24,12,12,12,12, 12,24,12,12,12,12,12,12,12,24,12,12, 12,12,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,36,12,36,12,12, 12,36,12,12,12,12,12,12,12,12,12,12, }; freetds-1.3.6/src/utils/tdsstring.c000644 025423 025423 00000010202 14056414222 020712 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004-2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include /** * \ingroup libtds * \defgroup dstring Dynamic string functions * Handle dynamic string. In this string are always valid * (you don't have NULL pointer, only empty strings) */ /* This is in a separate module because we use the pointer to discriminate allocated and not allocated */ const struct tds_dstr tds_str_empty = { 0, "" }; #define EMPTY ((struct tds_dstr*) &tds_str_empty) /** * \addtogroup dstring * @{ */ /** clear all string filling with zeroes (mainly for security reason) */ void tds_dstr_zero(DSTR * s) { memset((*s)->dstr_s, 0, (*s)->dstr_size); } /** free string */ void tds_dstr_free(DSTR * s) { if (*s != EMPTY) free(*s); *s = EMPTY; } /** * Set string to a given buffer of characters * @param s dynamic string * @param src source buffer * @param length length of source buffer * @return string copied or NULL on memory error */ DSTR* tds_dstr_copyn(DSTR * s, const char *src, size_t length) { if (!length) { if (*s != EMPTY) { free(*s); *s = EMPTY; } } else { struct tds_dstr *p = (struct tds_dstr *) malloc(length + TDS_OFFSET(struct tds_dstr, dstr_s) + 1); if (TDS_UNLIKELY(!p)) return NULL; memcpy(p->dstr_s, src, length); p->dstr_s[length] = 0; p->dstr_size = length; if (*s != EMPTY) free(*s); *s = p; } return s; } /** * set a string from another buffer. * The string will use the supplied buffer (it not copy the string), * so it should be a pointer returned by malloc. * @param s dynamic string * @param src source buffer * @return string copied or NULL on memory error */ DSTR* tds_dstr_set(DSTR * s, char *src) { DSTR *res = tds_dstr_copy(s, src); if (TDS_LIKELY(res != NULL)) free(src); return res; } /** * copy a string from another * @param s dynamic string * @param src source buffer * @return string copied or NULL on memory error */ DSTR* tds_dstr_copy(DSTR * s, const char *src) { return tds_dstr_copyn(s, src, strlen(src)); } /** * Duplicate a string from another dynamic string * @param s output string * @param src source string to copy * @return string copied or NULL on memory error */ DSTR* tds_dstr_dup(DSTR * s, const DSTR * src) { return tds_dstr_copyn(s, (*src)->dstr_s, (*src)->dstr_size); } /** * limit length of string, MUST be <= current length * @param s dynamic string * @param length new length */ DSTR* tds_dstr_setlen(DSTR *s, size_t length) { #if ENABLE_EXTRA_CHECKS assert((*s)->dstr_size >= length); #endif /* test required for empty strings */ if ((*s)->dstr_size >= length && *s != EMPTY) { (*s)->dstr_size = length; (*s)->dstr_s[length] = 0; } return s; } /** * allocate space for length char * @param s dynamic string * @param length new length * @return string allocated or NULL on memory error */ DSTR* tds_dstr_alloc(DSTR *s, size_t length) { struct tds_dstr *p = (struct tds_dstr *) malloc(length + TDS_OFFSET(struct tds_dstr, dstr_s) + 1); if (TDS_UNLIKELY(!p)) return NULL; if (*s != EMPTY) free(*s); p->dstr_s[0] = 0; p->dstr_size = length; *s = p; return s; } /** @} */ freetds-1.3.6/src/utils/net.c000644 025423 025423 00000003726 14056414222 017474 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2018 Ziglio Frediano * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_SYS_TYPES_H #include #endif /* HAVE_SYS_TYPES_H */ #if HAVE_ERRNO_H #include #endif /* HAVE_ERRNO_H */ #if HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NETINET_IN_H */ #ifdef _WIN32 #include #endif #include /** * \addtogroup network * @{ */ #ifndef __APPLE__ #undef SO_NOSIGPIPE #endif /** * Set socket to not throw SIGPIPE. * Not many systems support this feature (in this case ENOTSUP can be * returned). * @param sock socket to set * @param on flag if enable or disable * @return 0 on success or error code */ int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on) { #if defined(SO_NOSIGPIPE) if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, (const void *) &on, sizeof(on))) return sock_errno; return 0; #elif defined(_WIN32) return 0; #else return on ? ENOTSUP : 0; #endif } /** @} */ freetds-1.3.6/src/utils/CMakeLists.txt000644 025423 025423 00000001034 14056414222 021270 0ustar00fredianofrediano000000 000000 add_subdirectory(unittests) if(WIN32) set(add_SRCS md5.c) else(WIN32) set(add_SRCS md4.c md5.c des.c hmac_md5.c) endif(WIN32) add_library(tdsutils STATIC dlist.c getpassarg.c sleep.c tds_cond.c win_mutex.c threadsafe.c bjoern-utf8.c tdsstring.c net.c ${add_SRCS} ) if (NOT WIN32) set_target_properties(tdsutils PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() if(WIN32) INSTALL(TARGETS tdsutils PUBLIC_HEADER DESTINATION include RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) endif(WIN32) freetds-1.3.6/src/utils/ptw32_MCS_lock.c000644 025423 025423 00000014733 14056414222 021377 0ustar00fredianofrediano000000 000000 /* * ptw32_MCS_lock.c * * Description: * This translation unit implements queue-based locks. * * -------------------------------------------------------------------------- * * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors * * Contact Email: rpj@callisto.canberra.edu.au * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library in the file COPYING_LIB.txt; * if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* * About MCS locks: * * MCS locks are queue-based locks, where the queue nodes are local to the * thread. The 'lock' is nothing more than a global pointer that points to * the last node in the queue, or is NULL if the queue is empty. * * Originally designed for use as spin locks requiring no kernel resources * for synchronisation or blocking, the implementation below has adapted * the MCS spin lock for use as a general mutex that will suspend threads * when there is lock contention. * * Because the queue nodes are thread-local, most of the memory read/write * operations required to add or remove nodes from the queue do not trigger * cache-coherence updates. * * Like 'named' mutexes, MCS locks consume system resources transiently - * they are able to acquire and free resources automatically - but MCS * locks do not require any unique 'name' to identify the lock to all * threads using it. * * Usage of MCS locks: * * - you need a global ptw32_mcs_lock_t instance initialised to 0 or NULL. * - you need a local thread-scope ptw32_mcs_local_node_t instance, which * may serve several different locks but you need at least one node for * every lock held concurrently by a thread. * * E.g.: * * ptw32_mcs_lock_t lock1 = 0; * ptw32_mcs_lock_t lock2 = 0; * * void *mythread(void *arg) * { * ptw32_mcs_local_node_t node; * * ptw32_mcs_acquire (&lock1, &node); * ptw32_mcs_release (&node); * * ptw32_mcs_acquire (&lock2, &node); * ptw32_mcs_release (&node); * { * ptw32_mcs_local_node_t nodex; * * ptw32_mcs_acquire (&lock1, &node); * ptw32_mcs_acquire (&lock2, &nodex); * * ptw32_mcs_release (&nodex); * ptw32_mcs_release (&node); * } * return (void *)0; * } */ #if 0 #include "implement.h" #include "pthread.h" #endif struct ptw32_mcs_node_t_ { struct ptw32_mcs_node_t_ **lock; /* ptr to tail of queue */ struct ptw32_mcs_node_t_ *next; /* ptr to successor in queue */ void *readyFlag; /* set after lock is released by predecessor */ void *nextFlag; /* set after 'next' ptr is set by successor */ }; typedef struct ptw32_mcs_node_t_ ptw32_mcs_local_node_t; typedef struct ptw32_mcs_node_t_ *ptw32_mcs_lock_t; /* * ptw32_mcs_flag_set -- notify another thread about an event. * * Set event if an event handle has been stored in the flag, and * set flag to -1 otherwise. Note that -1 cannot be a valid handle value. */ static inline void ptw32_mcs_flag_set(PVOID volatile *flag) { HANDLE e = (HANDLE) InterlockedCompareExchangePointer(flag, (void *) -1, (void *) 0); if ((HANDLE) 0 != e) { /* another thread has already stored an event handle in the flag */ SetEvent(e); } } /* * ptw32_mcs_flag_set -- wait for notification from another. * * Store an event handle in the flag and wait on it if the flag has not been * set, and proceed without creating an event otherwise. */ static inline void ptw32_mcs_flag_wait(PVOID volatile *flag) { if (0 == InterlockedCompareExchangePointer(flag, 0, 0)) { /* MBR fence */ /* the flag is not set. create event. */ HANDLE e = CreateEvent(NULL, FALSE, FALSE, NULL); if (0 == InterlockedCompareExchangePointer(flag, (void *) e, (void *) 0)) { /* stored handle in the flag. wait on it now. */ WaitForSingleObject(e, INFINITE); } CloseHandle(e); } } /* * ptw32_mcs_lock_acquire -- acquire an MCS lock. * * See: * J. M. Mellor-Crummey and M. L. Scott. * Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors. * ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991. */ static inline void ptw32_mcs_lock_acquire(ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node) { ptw32_mcs_local_node_t *pred; node->lock = lock; node->nextFlag = 0; node->readyFlag = 0; node->next = 0; /* initially, no successor */ /* queue for the lock */ pred = (ptw32_mcs_local_node_t *) InterlockedExchangePointer((void **) lock, node); if (0 != pred) { /* the lock was not free. link behind predecessor. */ pred->next = node; ptw32_mcs_flag_set(&pred->nextFlag); ptw32_mcs_flag_wait(&node->readyFlag); } } /* * ptw32_mcs_lock_release -- release an MCS lock. * * See: * J. M. Mellor-Crummey and M. L. Scott. * Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors. * ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991. */ static inline void ptw32_mcs_lock_release(ptw32_mcs_local_node_t * node) { ptw32_mcs_lock_t *lock = node->lock; ptw32_mcs_local_node_t *next = (ptw32_mcs_local_node_t *) InterlockedCompareExchangePointer((void * volatile*) &node->next, 0, 0); /* MBR fence */ if (0 == next) { /* no known successor */ if (node == (ptw32_mcs_local_node_t *) InterlockedCompareExchangePointer((void * volatile*) lock, 0, node)) { /* no successor, lock is free now */ return; } /* wait for successor */ ptw32_mcs_flag_wait(&node->nextFlag); next = (ptw32_mcs_local_node_t *) InterlockedCompareExchangePointer((void * volatile*) &node->next, 0, 0); /* MBR fence */ } /* pass the lock */ ptw32_mcs_flag_set(&next->readyFlag); } freetds-1.3.6/src/utils/unittests/000755 025423 025423 00000000000 14162303404 020571 5ustar00fredianofrediano000000 000000 freetds-1.3.6/src/utils/unittests/Makefile.am000644 025423 025423 00000000713 14056414222 022631 0ustar00fredianofrediano000000 000000 NULL = TESTS = \ passarg$(EXEEXT) \ condition$(EXEEXT) \ mutex1$(EXEEXT) \ dlist$(EXEEXT) \ bytes$(EXEEXT) \ $(NULL) check_PROGRAMS = $(TESTS) passarg_SOURCES = passarg.c condition_SOURCES = condition.c mutex1_SOURCES = mutex1.c dlist_SOURCES = dlist.c if !HAVE_SSPI TESTS += challenge$(EXEEXT) challenge_SOURCES= challenge.c endif AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = ../libtdsutils.la @NETWORK_LIBS@ EXTRA_DIST = CMakeLists.txt challenge.c freetds-1.3.6/src/utils/unittests/Makefile.in000644 025423 025423 00000113702 14162303357 022651 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ TESTS = passarg$(EXEEXT) condition$(EXEEXT) mutex1$(EXEEXT) \ dlist$(EXEEXT) bytes$(EXEEXT) $(am__EXEEXT_1) $(am__append_1) check_PROGRAMS = $(am__EXEEXT_2) @HAVE_SSPI_FALSE@am__append_1 = challenge$(EXEEXT) subdir = src/utils/unittests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__EXEEXT_1 = am__EXEEXT_2 = passarg$(EXEEXT) condition$(EXEEXT) mutex1$(EXEEXT) \ dlist$(EXEEXT) bytes$(EXEEXT) $(am__EXEEXT_1) $(am__append_1) bytes_SOURCES = bytes.c bytes_OBJECTS = bytes.$(OBJEXT) bytes_LDADD = $(LDADD) bytes_DEPENDENCIES = ../libtdsutils.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = am__challenge_SOURCES_DIST = challenge.c @HAVE_SSPI_FALSE@am_challenge_OBJECTS = challenge.$(OBJEXT) challenge_OBJECTS = $(am_challenge_OBJECTS) challenge_LDADD = $(LDADD) challenge_DEPENDENCIES = ../libtdsutils.la am_condition_OBJECTS = condition.$(OBJEXT) condition_OBJECTS = $(am_condition_OBJECTS) condition_LDADD = $(LDADD) condition_DEPENDENCIES = ../libtdsutils.la am_dlist_OBJECTS = dlist.$(OBJEXT) dlist_OBJECTS = $(am_dlist_OBJECTS) dlist_LDADD = $(LDADD) dlist_DEPENDENCIES = ../libtdsutils.la am_mutex1_OBJECTS = mutex1.$(OBJEXT) mutex1_OBJECTS = $(am_mutex1_OBJECTS) mutex1_LDADD = $(LDADD) mutex1_DEPENDENCIES = ../libtdsutils.la am_passarg_OBJECTS = passarg.$(OBJEXT) passarg_OBJECTS = $(am_passarg_OBJECTS) passarg_LDADD = $(LDADD) passarg_DEPENDENCIES = ../libtdsutils.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bytes.Po ./$(DEPDIR)/challenge.Po \ ./$(DEPDIR)/condition.Po ./$(DEPDIR)/dlist.Po \ ./$(DEPDIR)/mutex1.Po ./$(DEPDIR)/passarg.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = bytes.c $(challenge_SOURCES) $(condition_SOURCES) \ $(dlist_SOURCES) $(mutex1_SOURCES) $(passarg_SOURCES) DIST_SOURCES = bytes.c $(am__challenge_SOURCES_DIST) \ $(condition_SOURCES) $(dlist_SOURCES) $(mutex1_SOURCES) \ $(passarg_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = passarg_SOURCES = passarg.c condition_SOURCES = condition.c mutex1_SOURCES = mutex1.c dlist_SOURCES = dlist.c @HAVE_SSPI_FALSE@challenge_SOURCES = challenge.c AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = ../libtdsutils.la @NETWORK_LIBS@ EXTRA_DIST = CMakeLists.txt challenge.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/unittests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/utils/unittests/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list bytes$(EXEEXT): $(bytes_OBJECTS) $(bytes_DEPENDENCIES) $(EXTRA_bytes_DEPENDENCIES) @rm -f bytes$(EXEEXT) $(AM_V_CCLD)$(LINK) $(bytes_OBJECTS) $(bytes_LDADD) $(LIBS) challenge$(EXEEXT): $(challenge_OBJECTS) $(challenge_DEPENDENCIES) $(EXTRA_challenge_DEPENDENCIES) @rm -f challenge$(EXEEXT) $(AM_V_CCLD)$(LINK) $(challenge_OBJECTS) $(challenge_LDADD) $(LIBS) condition$(EXEEXT): $(condition_OBJECTS) $(condition_DEPENDENCIES) $(EXTRA_condition_DEPENDENCIES) @rm -f condition$(EXEEXT) $(AM_V_CCLD)$(LINK) $(condition_OBJECTS) $(condition_LDADD) $(LIBS) dlist$(EXEEXT): $(dlist_OBJECTS) $(dlist_DEPENDENCIES) $(EXTRA_dlist_DEPENDENCIES) @rm -f dlist$(EXEEXT) $(AM_V_CCLD)$(LINK) $(dlist_OBJECTS) $(dlist_LDADD) $(LIBS) mutex1$(EXEEXT): $(mutex1_OBJECTS) $(mutex1_DEPENDENCIES) $(EXTRA_mutex1_DEPENDENCIES) @rm -f mutex1$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mutex1_OBJECTS) $(mutex1_LDADD) $(LIBS) passarg$(EXEEXT): $(passarg_OBJECTS) $(passarg_DEPENDENCIES) $(EXTRA_passarg_DEPENDENCIES) @rm -f passarg$(EXEEXT) $(AM_V_CCLD)$(LINK) $(passarg_OBJECTS) $(passarg_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytes.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/challenge.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/condition.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlist.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mutex1.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passarg.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? passarg.log: passarg$(EXEEXT) @p='passarg$(EXEEXT)'; \ b='passarg'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) condition.log: condition$(EXEEXT) @p='condition$(EXEEXT)'; \ b='condition'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) mutex1.log: mutex1$(EXEEXT) @p='mutex1$(EXEEXT)'; \ b='mutex1'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) dlist.log: dlist$(EXEEXT) @p='dlist$(EXEEXT)'; \ b='dlist'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) bytes.log: bytes$(EXEEXT) @p='bytes$(EXEEXT)'; \ b='bytes'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) challenge.log: challenge$(EXEEXT) @p='challenge$(EXEEXT)'; \ b='challenge'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/bytes.Po -rm -f ./$(DEPDIR)/challenge.Po -rm -f ./$(DEPDIR)/condition.Po -rm -f ./$(DEPDIR)/dlist.Po -rm -f ./$(DEPDIR)/mutex1.Po -rm -f ./$(DEPDIR)/passarg.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/bytes.Po -rm -f ./$(DEPDIR)/challenge.Po -rm -f ./$(DEPDIR)/condition.Po -rm -f ./$(DEPDIR)/dlist.Po -rm -f ./$(DEPDIR)/mutex1.Po -rm -f ./$(DEPDIR)/passarg.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/src/utils/unittests/bytes.c000644 025423 025423 00000004732 14056414222 022074 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2019 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Purpose: test bytes.h header. */ #undef NDEBUG #include #include #include #ifdef HAVE_STRING_H #include #endif #include "tds_sysdep_public.h" #include #define WRITE(buf, off, bytes, endian, val) do { \ if ((off % bytes) == 0) TDS_PUT_A ## bytes ## endian(buf+off, val); \ else TDS_PUT_UA ## bytes ## endian(buf+off, val); \ } while(0) #define READ(buf, off, bytes, endian) ( \ ((off % bytes) == 0) ? TDS_GET_A ## bytes ## endian(buf+off) : \ TDS_GET_UA ## bytes ## endian(buf+off) \ ) /* check read and write works at a given offset */ #define CHECK(off, bytes, endian, expected) do { \ uint32_t val = READ(bufs.u1.buf, off, bytes, endian); \ WRITE(bufs.u2.buf, off, bytes, endian, val); \ assert(READ(bufs.u1.buf, off, bytes, endian) == READ(bufs.u2.buf, off, bytes, endian)); \ assert(val == expected); \ } while(0) int main(void) { /* this structure make sure buffer are properly aligned */ struct { union { uint8_t buf[26]; uint32_t a1; } u1; union { uint8_t buf[26]; uint32_t a2; } u2; } bufs; unsigned n; memset(&bufs, 0, sizeof(bufs)); for (n = 0; n < sizeof(bufs.u1.buf); ++n) bufs.u1.buf[n] = (uint8_t) (123 * n + 67); /* aligned access */ CHECK(0, 4, LE, 0xb439be43u); CHECK(4, 2, LE, 0xaa2fu); CHECK(6, 2, BE, 0x25a0u); CHECK(8, 4, BE, 0x1b96118cu); CHECK(12, 1, LE, 0x7u); /* unaligned access */ CHECK(13, 2, BE, 0x82fdu); CHECK(15, 2, LE, 0xf378u); CHECK(17, 4, LE, 0xdf64e96eu); CHECK(21, 4, BE, 0x5ad550cbu); CHECK(25, 1, BE, 0x46); assert(memcmp(bufs.u1.buf, bufs.u2.buf, sizeof(bufs.u1.buf)) == 0); return 0; } freetds-1.3.6/src/utils/unittests/challenge.c000644 025423 025423 00000012131 14056414222 022660 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Purpose: test challenge code. */ #undef NDEBUG #include #include #include #if HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "tds_sysdep_public.h" #include #include #include #include static char long_string[512]; static char * bin2ascii(char *dest, const void *data, size_t len) { char *s = dest; const unsigned char *src = (const unsigned char *) data; for (; len > 0; --len, s += 2) sprintf(s, "%02x", *src++); *s = 0; return dest; } static void md4(const char *src, const char *out) { MD4_CTX ctx; unsigned char digest[16]; char s_digest[34]; assert(strlen(out) == 32); MD4Init(&ctx); if (strlen(src) > 12) { MD4Update(&ctx, (const unsigned char *) src, 5); MD4Update(&ctx, (const unsigned char *) src+5, strlen(src) - 5); } else { MD4Update(&ctx, (const unsigned char *) src, strlen(src)); } MD4Final(&ctx, digest); if (strcasecmp(bin2ascii(s_digest, digest, 16), out) != 0) { fprintf(stderr, "Wrong md4(%s) -> %s expected %s\n", src, s_digest, out); exit(1); } } static void md4tests(void) { md4("", "31d6cfe0d16ae931b73c59d7e0c089c0"); md4("a", "bde52cb31de33e46245e05fbdbd6fb24"); md4("abc", "a448017aaf21d8525fc10ae87aa6729d"); md4("message digest", "d9130a8164549fe818874806e1c7014b"); md4("abcdefghijklmnopqrstuvwxyz", "d79e1c308aa5bbcdeea8ed63df412da9"); md4("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "043f8582f241db351ce627e153e7f0e4"); md4("12345678901234567890123456789012345678901234567890123456789012345678901234567890", "e33b4ddc9c38f2199c3e7b164fcc0536"); md4(long_string, "9a827c99bab54f09cd2dbd80246f5fb6"); } static void md5(const char *src, const char *out) { MD5_CTX ctx; unsigned char digest[16]; char s_digest[34]; assert(strlen(out) == 32); MD5Init(&ctx); if (strlen(src) > 12) { MD5Update(&ctx, (const unsigned char *) src, 5); MD5Update(&ctx, (const unsigned char *) src+5, strlen(src) - 5); } else { MD5Update(&ctx, (const unsigned char *) src, strlen(src)); } MD5Final(&ctx, digest); if (strcasecmp(bin2ascii(s_digest, digest, 16), out) != 0) { fprintf(stderr, "Wrong md5(%s) -> %s expected %s\n", src, s_digest, out); exit(1); } } static void md5tests(void) { md5("", "d41d8cd98f00b204e9800998ecf8427e"); md5("The quick brown fox jumps over the lazy dog", "9e107d9d372bb6826bd81d3542a419d6"); md5("The quick brown fox jumps over the lazy dog.", "e4d909c290d0fb1ca068ffaddf22cbd0"); md5(long_string, "8b9fc2ac1113974b82ef43ff890efdc6"); } static const char *hmac5_key = NULL; static void hmac5(const char *src, const char *out) { unsigned char digest[16]; char s_digest[34]; assert(strlen(out) == 32 && hmac5_key); hmac_md5((const unsigned char*) hmac5_key, (const unsigned char*) src, strlen(src), digest); if (strcasecmp(bin2ascii(s_digest, digest, 16), out) != 0) { fprintf(stderr, "Wrong hman md5(%s) -> %s expected %s\n", src, s_digest, out); exit(1); } } static void hmac5tests(void) { hmac5_key = "01234567890123456"; hmac5("", "c26c57d7ff1236db11d7419a490ad84d"); hmac5("message digest", "e4f89edbda3d3b6b7328a0a90f87ece8"); hmac5("abcdefghijklmnopqrstuvwxyz", "2c4eac474ec340df63ae93b8ffc33571"); } static void des(const char *src, const char *out) { static const des_cblock key = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 }; DES_KEY ks; unsigned char digest[128]; char s_digest[256]; size_t out_len; memset(digest, 0, sizeof(digest)); tds_des_set_key(&ks, key, sizeof(key)); tds_des_ecb_encrypt(src, strlen(src), &ks, digest); out_len = strlen(src) & ~7u; if (strcasecmp(bin2ascii(s_digest, digest, out_len), out) != 0) { fprintf(stderr, "Wrong des(%s) -> %s expected %s\n", src, s_digest, out); exit(1); } } static void destests(void) { des("", ""); des("The quick brown fox jumps over the lazy dog", "51551eab3ebab959553caaed64a3dd9c49f595a630c45cb7317332f8ade70308c4e97aeabbdc7f19"); des("test des encryption", "7ced9849bed3f7efc1686c89759bafa8"); } int main(void) { int i; long_string[0] = 0; for (i = 0; i < 18; ++i) strcat(long_string, "test md4 12345"); md4tests(); md5tests(); hmac5tests(); destests(); printf("All tests passed\n"); return 0; } freetds-1.3.6/src/utils/unittests/condition.c000644 025423 025423 00000006564 14056414271 022745 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef HAVE_UNISTD_H #include #endif #include #include #include #include #if !defined(TDS_NO_THREADSAFE) static tds_mutex mtx = TDS_MUTEX_INITIALIZER; static TDS_THREAD_PROC_DECLARE(signal_proc, arg) { tds_condition *cond = (tds_condition *) arg; /* success */ int res = 0; tds_mutex_lock(&mtx); if (tds_cond_signal(cond)) { /* failure */ res = 1; } tds_mutex_unlock(&mtx); return TDS_THREAD_RESULT(res); } static void check(int cond, const char *msg) { if (cond) { fprintf(stderr, "%s\n", msg); exit(1); } } int main(void) { tds_condition cond; tds_thread th; void *res; check(tds_cond_init(&cond), "failed initializing condition"); tds_mutex_lock(&mtx); check(tds_thread_create(&th, signal_proc, &cond) != 0, "error creating thread"); tds_sleep_ms(100); check(tds_cond_wait(&cond, &mtx), "failed waiting condition"); res = &th; check(tds_thread_join(th, &res) != 0, "error waiting thread"); check(TDS_PTR2INT(res) != 0, "error signaling condition"); /* under Windows mutex are recursive */ #ifndef _WIN32 check(tds_mutex_trylock(&mtx) == 0, "mutex should be locked"); #endif /* check timed version */ check(tds_cond_timedwait(&cond, &mtx, 1) != ETIMEDOUT, "should not succeed to wait condition"); check(tds_thread_create(&th, signal_proc, &cond) != 0, "error creating thread"); check(tds_cond_timedwait(&cond, &mtx, 1), "error on timed waiting condition"); res = &th; /* just to avoid NULL */ check(tds_thread_join(th, &res) != 0, "error waiting thread"); check(TDS_PTR2INT(res) != 0, "error signaling condition"); check(tds_thread_create(&th, signal_proc, &cond) != 0, "error creating thread"); check(tds_cond_timedwait(&cond, &mtx, -1), "error on timed waiting condition"); res = &th; /* just to avoid NULL */ check(tds_thread_join(th, &res) != 0, "error waiting thread"); check(TDS_PTR2INT(res) != 0, "error signaling condition"); check(tds_thread_create(&th, signal_proc, &cond) != 0, "error creating thread"); check(tds_cond_timedwait(&cond, &mtx, 0), "error on timed waiting condition"); res = &th; /* just to avoid NULL */ check(tds_thread_join(th, &res) != 0, "error waiting thread"); check(TDS_PTR2INT(res) != 0, "error signaling condition"); tds_mutex_unlock(&mtx); check(tds_cond_destroy(&cond), "failed destroying condition"); return 0; } #else int main(void) { return 0; } #endif freetds-1.3.6/src/utils/unittests/dlist.c000644 025423 025423 00000004105 14056414222 022057 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2016 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Purpose: test dlist code. */ #undef NDEBUG #include #include #include #ifdef HAVE_STRING_H #include #endif #include typedef struct { DLIST_FIELDS(list_item); int n; } test_item; #define DLIST_PREFIX list #define DLIST_LIST_TYPE test_items #define DLIST_ITEM_TYPE test_item #include int main(void) { test_items list[1]; test_item items[6], *p; int n; list_init(list); memset(&items, 0, sizeof(items)); assert(list_first(list) == NULL); assert(list_last(list) == NULL); p = &items[0]; p->n = 2; list_append(list, p++); p->n = 3; list_append(list, p++); p->n = 1; list_prepend(list, p++); assert(!list_in_list(list, p)); assert(list_first(list)->n == 1); assert(list_last(list)->n == 3); /* check sequence is [1, 2, 3] */ n = 0; DLIST_FOREACH(list, list, p) { assert(p->n == ++n); } assert(n == 3); /* remove item with n == 2, sequence will be [1, 3] */ assert(list_in_list(list, &items[0])); list_remove(list, &items[0]); assert(!list_in_list(list, &items[0])); /* change sequence to [1, 2] */ items[1].n = 2; n = 0; DLIST_FOREACH(list, list, p) { assert(p->n == ++n); } assert(n == 2); return 0; } freetds-1.3.6/src/utils/unittests/mutex1.c000644 025423 025423 00000005044 14056414271 022172 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #include #if !defined(TDS_NO_THREADSAFE) static tds_mutex mtx = TDS_MUTEX_INITIALIZER; static TDS_THREAD_PROC_DECLARE(trylock_proc, arg) { tds_mutex *mtx = (tds_mutex *) arg; if (!tds_mutex_trylock(mtx)) { /* got mutex, failure as should be locked */ return TDS_THREAD_RESULT(1); } /* success */ return TDS_THREAD_RESULT(0); } static void test(tds_mutex *mtx) { tds_thread th; void *res; if (tds_mutex_trylock(mtx)) { fprintf(stderr, "mutex should be unlocked\n"); exit(1); } /* check mutex are not recursive, even on Windows */ if (!tds_mutex_trylock(mtx)) { fprintf(stderr, "mutex should be locked\n"); exit(1); } if (tds_thread_create(&th, trylock_proc, mtx) != 0) { fprintf(stderr, "error creating thread\n"); exit(1); } if (tds_thread_join(th, &res) != 0) { fprintf(stderr, "error waiting thread\n"); exit(1); } if (TDS_PTR2INT(res) != 0) { fprintf(stderr, "mutex should be locked inside thread\n"); exit(1); } tds_mutex_unlock(mtx); /* now trylock after the unlock should succeed */ if (tds_mutex_trylock(mtx)) { fprintf(stderr, "mutex should be unlocked\n"); exit(1); } tds_mutex_unlock(mtx); } int main(void) { tds_mutex local; test(&mtx); /* try allocating it */ if (tds_mutex_init(&local)) { fprintf(stderr, "error creating mutex\n"); exit(1); } test(&local); tds_mutex_free(&local); /* try again */ if (tds_mutex_init(&local)) { fprintf(stderr, "error creating mutex\n"); exit(1); } test(&local); tds_mutex_free(&local); return 0; } #else int main(void) { return 0; } #endif freetds-1.3.6/src/utils/unittests/passarg.c000644 025423 025423 00000003172 14056414222 022403 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2014 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #undef NDEBUG #include #include #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef HAVE_UNISTD_H #include #endif #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ #include #include #include int main(void) { FILE *f; char *pwd = strdup("password"); char *p; p = tds_getpassarg(pwd); assert(p); assert(strcmp(pwd, "********") == 0); assert(strcmp(p, "password") == 0); free(p); free(pwd); f = fopen("passarg.in", "w"); assert(f); fputs("line1pwd\nline2pwd\n", f); fclose(f); f = freopen("passarg.in", "r", stdin); assert(f); p = tds_getpassarg("-"); assert(p); assert(strcmp(p, "line1pwd") == 0); free(p); unlink("passarg.in"); return 0; } freetds-1.3.6/src/utils/unittests/CMakeLists.txt000644 025423 025423 00000000764 14056414222 023343 0ustar00fredianofrediano000000 000000 include_directories(..) if(NOT WIN32) set(unix_TESTS challenge) endif(NOT WIN32) foreach(target passarg condition mutex1 dlist bytes ${unix_TESTS}) add_executable(u_${target} EXCLUDE_FROM_ALL ${target}.c) set_target_properties(u_${target} PROPERTIES OUTPUT_NAME ${target}) target_link_libraries(u_${target} tdsutils ${lib_NETWORK} ${lib_BASE}) add_test(NAME u_${target} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND u_${target}) add_dependencies(check u_${target}) endforeach(target) freetds-1.3.6/include/Makefile.am000644 025423 025423 00000000534 14056414271 020270 0ustar00fredianofrediano000000 000000 AUTOMAKE_OPTIONS = 1.5.3 NULL = SUBDIRS = freetds include_HEADERS = \ bkpublic.h \ cspublic.h \ cstypes.h \ ctpublic.h \ sqldb.h \ sqlfront.h \ sybdb.h \ sybfront.h \ syberror.h \ odbcss.h \ $(NULL) nodist_include_HEADERS = tds_sysdep_public.h noinst_HEADERS = \ ctlib.h \ dblib.h \ $(NULL) DISTCLEANFILES = tds_sysdep_public.h freetds-1.3.6/include/bkpublic.h000644 025423 025423 00000005756 14056414221 020206 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _bkpublic_h_ #define _bkpublic_h_ static const char rcsid_bkpublic_h[] = "$Id: bkpublic.h,v 1.5 2004-10-28 12:42:11 freddy77 Exp $"; static const void *const no_unused_bkpublic_h_warn[] = { rcsid_bkpublic_h, no_unused_bkpublic_h_warn }; /* seperate this stuff out later */ #include #ifdef __cplusplus extern "C" { #if 0 } #endif #endif /* buld properties start with 1 i guess */ #define BLK_IDENTITY 1 CS_RETCODE blk_alloc(CS_CONNECTION * connection, CS_INT version, CS_BLKDESC ** blk_pointer); CS_RETCODE blk_bind(CS_BLKDESC * blkdesc, CS_INT colnum, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT * datalen, CS_SMALLINT * indicator); CS_RETCODE blk_colval(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp, CS_INT colnum, CS_VOID * valuep, CS_INT valuelen, CS_INT * outlenp); CS_RETCODE blk_default(CS_BLKDESC * blkdesc, CS_INT colnum, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE blk_describe(CS_BLKDESC * blkdesc, CS_INT colnum, CS_DATAFMT * datafmt); CS_RETCODE blk_done(CS_BLKDESC * blkdesc, CS_INT type, CS_INT * outrow); CS_RETCODE blk_drop(CS_BLKDESC * blkdesc); CS_RETCODE blk_getrow(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp); CS_RETCODE blk_gettext(SRV_PROC * srvproc, CS_BLKDESC * blkdescp, CS_BLK_ROW * rowp, CS_INT bufsize, CS_INT * outlenp); CS_RETCODE blk_init(CS_BLKDESC * blkdesc, CS_INT direction, CS_CHAR * tablename, CS_INT tnamelen); CS_RETCODE blk_props(CS_BLKDESC * blkdesc, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE blk_rowalloc(SRV_PROC * srvproc, CS_BLK_ROW ** row); CS_RETCODE blk_rowdrop(SRV_PROC * srvproc, CS_BLK_ROW * row); CS_RETCODE blk_rowxfer(CS_BLKDESC * blkdesc); CS_RETCODE blk_rowxfer_mult(CS_BLKDESC * blkdesc, CS_INT * row_count); CS_RETCODE blk_sendrow(CS_BLKDESC * blkdesc, CS_BLK_ROW * row); CS_RETCODE blk_sendtext(CS_BLKDESC * blkdesc, CS_BLK_ROW * row, CS_BYTE * buffer, CS_INT buflen); CS_RETCODE blk_srvinit(SRV_PROC * srvproc, CS_BLKDESC * blkdescp); CS_RETCODE blk_textxfer(CS_BLKDESC * blkdesc, CS_BYTE * buffer, CS_INT buflen, CS_INT * outlen); #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/cspublic.h000644 025423 025423 00000054243 14056414221 020212 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _cspublic_h_ #define _cspublic_h_ #include #undef TDS_STATIC_CAST #ifdef __cplusplus #define TDS_STATIC_CAST(type, a) static_cast(a) extern "C" { #if 0 } #endif #else #define TDS_STATIC_CAST(type, a) ((type)(a)) #endif #define CS_PUBLIC #define CS_STATIC static #define CS_SUCCEED 1 #define CS_FAIL 0 #define CS_MEM_ERROR -1 #define CS_PENDING -2 #define CS_QUIET -3 #define CS_BUSY -4 #define CS_INTERRUPT -5 #define CS_BLK_HAS_TEXT -6 #define CS_CONTINUE -7 #define CS_FATAL -8 #define CS_RET_HAFAILOVER -9 #define CS_UNSUPPORTED -10 #define CS_CANCELED -202 #define CS_ROW_FAIL -203 #define CS_END_DATA -204 #define CS_END_RESULTS -205 #define CS_END_ITEM -206 #define CS_NOMSG -207 #define CS_TIMED_OUT -208 #define CS_SIZEOF(x) sizeof(x) #define CS_LAYER(x) (((x) >> 24) & 0xFF) #define CS_ORIGIN(x) (((x) >> 16) & 0xFF) #define CS_SEVERITY(x) (((x) >> 8) & 0xFF) #define CS_NUMBER(x) ((x) & 0xFF) /* forward declarations */ typedef CS_RETCODE(*CS_CSLIBMSG_FUNC) (CS_CONTEXT *, CS_CLIENTMSG *); typedef CS_RETCODE(*CS_CLIENTMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_CLIENTMSG *); typedef CS_RETCODE(*CS_SERVERMSG_FUNC) (CS_CONTEXT *, CS_CONNECTION *, CS_SERVERMSG *); #define CS_IODATA TDS_STATIC_CAST(CS_INT, 1600) #define CS_SRC_VALUE -2562 /* status bits for CS_SERVERMSG */ #define CS_HASEED 0x01 typedef struct _cs_blkdesc CS_BLKDESC; /* CS_CAP_REQUEST values */ #define CS_REQ_LANG 1 #define CS_REQ_RPC 2 #define CS_REQ_NOTIF 3 #define CS_REQ_MSTMT 4 #define CS_REQ_BCP 5 #define CS_REQ_CURSOR 6 #define CS_REQ_DYN 7 #define CS_REQ_MSG 8 #define CS_REQ_PARAM 9 #define CS_DATA_INT1 10 #define CS_DATA_INT2 11 #define CS_DATA_INT4 12 #define CS_DATA_BIT 13 #define CS_DATA_CHAR 14 #define CS_DATA_VCHAR 15 #define CS_DATA_BIN 16 #define CS_DATA_VBIN 17 #define CS_DATA_MNY8 18 #define CS_DATA_MNY4 19 #define CS_DATA_DATE8 20 #define CS_DATA_DATE4 21 #define CS_DATA_FLT4 22 #define CS_DATA_FLT8 23 #define CS_DATA_NUM 24 #define CS_DATA_TEXT 25 #define CS_DATA_IMAGE 26 #define CS_DATA_DEC 27 #define CS_DATA_LCHAR 28 #define CS_DATA_LBIN 29 #define CS_DATA_INTN 30 #define CS_DATA_DATETIMEN 31 #define CS_DATA_MONEYN 32 #define CS_CSR_PREV 33 #define CS_CSR_FIRST 34 #define CS_CSR_LAST 35 #define CS_CSR_ABS 36 #define CS_CSR_REL 37 #define CS_CSR_MULTI 38 #define CS_CON_OOB 39 #define CS_CON_INBAND 40 #define CS_CON_LOGICAL 41 #define CS_PROTO_TEXT 42 #define CS_PROTO_BULK 43 #define CS_REQ_URGNOTIF 44 #define CS_DATA_SENSITIVITY 45 #define CS_DATA_BOUNDARY 46 #define CS_PROTO_DYNAMIC 47 #define CS_PROTO_DYNPROC 48 #define CS_DATA_FLTN 49 #define CS_DATA_BITN 50 #define CS_OPTION_GET 51 #define CS_DATA_INT8 52 #define CS_DATA_VOID 53 /* CS_CAP_RESPONSE values */ #define CS_RES_NOMSG 1 #define CS_RES_NOEED 2 #define CS_RES_NOPARAM 3 #define CS_DATA_NOINT1 4 #define CS_DATA_NOINT2 5 #define CS_DATA_NOINT4 6 #define CS_DATA_NOBIT 7 #define CS_DATA_NOCHAR 8 #define CS_DATA_NOVCHAR 9 #define CS_DATA_NOBIN 10 #define CS_DATA_NOVBIN 11 #define CS_DATA_NOMNY8 12 #define CS_DATA_NOMNY4 13 #define CS_DATA_NODATE8 14 #define CS_DATA_NODATE4 15 #define CS_DATA_NOFLT4 16 #define CS_DATA_NOFLT8 17 #define CS_DATA_NONUM 18 #define CS_DATA_NOTEXT 19 #define CS_DATA_NOIMAGE 20 #define CS_DATA_NODEC 21 #define CS_DATA_NOLCHAR 22 #define CS_DATA_NOLBIN 23 #define CS_DATA_NOINTN 24 #define CS_DATA_NODATETIMEN 25 #define CS_DATA_NOMONEYN 26 #define CS_CON_NOOOB 27 #define CS_CON_NOINBAND 28 #define CS_PROTO_NOTEXT 29 #define CS_PROTO_NOBULK 30 #define CS_DATA_NOSENSITIVITY 31 #define CS_DATA_NOBOUNDARY 32 #define CS_RES_NOTDSDEBUG 33 #define CS_RES_NOSTRIPBLANKS 34 #define CS_DATA_NOINT8 35 /* Properties */ enum { /* * These defines looks weird but programs can test support for defines, * compiler can check enum and there are no define side effecs */ CS_USERNAME = 9100, #define CS_USERNAME CS_USERNAME CS_PASSWORD = 9101, #define CS_PASSWORD CS_PASSWORD CS_APPNAME = 9102, #define CS_APPNAME CS_APPNAME CS_HOSTNAME = 9103, #define CS_HOSTNAME CS_HOSTNAME CS_LOGIN_STATUS = 9104, #define CS_LOGIN_STATUS CS_LOGIN_STATUS CS_TDS_VERSION = 9105, #define CS_TDS_VERSION CS_TDS_VERSION CS_CHARSETCNV = 9106, #define CS_CHARSETCNV CS_CHARSETCNV CS_PACKETSIZE = 9107, #define CS_PACKETSIZE CS_PACKETSIZE CS_USERDATA = 9108, #define CS_USERDATA CS_USERDATA CS_NETIO = 9110, #define CS_NETIO CS_NETIO CS_TEXTLIMIT = 9112, #define CS_TEXTLIMIT CS_TEXTLIMIT CS_HIDDEN_KEYS = 9113, #define CS_HIDDEN_KEYS CS_HIDDEN_KEYS CS_VERSION = 9114, #define CS_VERSION CS_VERSION CS_IFILE = 9115, #define CS_IFILE CS_IFILE CS_LOGIN_TIMEOUT = 9116, #define CS_LOGIN_TIMEOUT CS_LOGIN_TIMEOUT CS_TIMEOUT = 9117, #define CS_TIMEOUT CS_TIMEOUT CS_MAX_CONNECT = 9118, #define CS_MAX_CONNECT CS_MAX_CONNECT CS_EXPOSE_FMTS = 9120, #define CS_EXPOSE_FMTS CS_EXPOSE_FMTS CS_EXTRA_INF = 9121, #define CS_EXTRA_INF CS_EXTRA_INF CS_ANSI_BINDS = 9123, #define CS_ANSI_BINDS CS_ANSI_BINDS CS_BULK_LOGIN = 9124, #define CS_BULK_LOGIN CS_BULK_LOGIN CS_LOC_PROP = 9125, #define CS_LOC_PROP CS_LOC_PROP CS_PARENT_HANDLE = 9130, #define CS_PARENT_HANDLE CS_PARENT_HANDLE CS_EED_CMD = 9131, #define CS_EED_CMD CS_EED_CMD CS_DIAG_TIMEOUT = 9132, #define CS_DIAG_TIMEOUT CS_DIAG_TIMEOUT CS_DISABLE_POLL = 9133, #define CS_DISABLE_POLL CS_DISABLE_POLL CS_SEC_ENCRYPTION = 9135, #define CS_SEC_ENCRYPTION CS_SEC_ENCRYPTION CS_SEC_CHALLENGE = 9136, #define CS_SEC_CHALLENGE CS_SEC_CHALLENGE CS_SEC_NEGOTIATE = 9137, #define CS_SEC_NEGOTIATE CS_SEC_NEGOTIATE CS_CON_STATUS = 9143, #define CS_CON_STATUS CS_CON_STATUS CS_VER_STRING = 9144, #define CS_VER_STRING CS_VER_STRING CS_SERVERNAME = 9146, #define CS_SERVERNAME CS_SERVERNAME CS_SEC_APPDEFINED = 9149, #define CS_SEC_APPDEFINED CS_SEC_APPDEFINED CS_STICKY_BINDS = 9151, #define CS_STICKY_BINDS CS_STICKY_BINDS CS_SEC_NETWORKAUTH = 9175, #define CS_SEC_NETWORKAUTH CS_SEC_NETWORKAUTH CS_SEC_DELEGATION = 9176, #define CS_SEC_DELEGATION CS_SEC_DELEGATION CS_SEC_MUTUALAUTH = 9177, #define CS_SEC_MUTUALAUTH CS_SEC_MUTUALAUTH CS_SEC_SERVERPRINCIPAL = 9188, #define CS_SEC_SERVERPRINCIPAL CS_SEC_SERVERPRINCIPAL CS_SERVERADDR = 9206, #define CS_SERVERADDR CS_SERVERADDR CS_PORT = 9300, #define CS_PORT CS_PORT CS_CLIENTCHARSET = 9301, #define CS_CLIENTCHARSET CS_CLIENTCHARSET CS_DATABASE = 9302 #define CS_DATABASE CS_DATABASE }; /* Arbitrary precision math operators */ enum { CS_ADD = 1, CS_SUB, CS_MULT, CS_DIV }; enum { #define CS_TDS_AUTO CS_TDS_AUTO CS_TDS_AUTO = 0, CS_TDS_40 = 7360, CS_TDS_42, CS_TDS_46, CS_TDS_495, CS_TDS_50, CS_TDS_70, CS_TDS_71, #define CS_TDS_71 CS_TDS_71 CS_TDS_72, #define CS_TDS_72 CS_TDS_72 CS_TDS_73, #define CS_TDS_73 CS_TDS_73 CS_TDS_74, #define CS_TDS_74 CS_TDS_74 }; /* bit mask values used by CS_DATAFMT.status */ #define CS_HIDDEN (1 << 0) #define CS_KEY (1 << 1) #define CS_VERSION_KEY (1 << 2) #define CS_NODATA (1 << 3) #define CS_UPDATABLE (1 << 4) #define CS_CANBENULL (1 << 5) #define CS_DESCIN (1 << 6) #define CS_DESCOUT (1 << 7) #define CS_INPUTVALUE (1 << 8) #define CS_UPDATECOL (1 << 9) #define CS_RETURN (1 << 10) #define CS_TIMESTAMP (1 << 13) #define CS_NODEFAULT (1 << 14) #define CS_IDENTITY (1 << 15) /* * DBD::Sybase compares indicator to CS_NULLDATA so this is -1 * (the documentation states -1) */ #define CS_GOODDATA 0 #define CS_NULLDATA (-1) /* CS_CON_STATUS read-only property bit mask values */ #define CS_CONSTAT_CONNECTED 0x01 #define CS_CONSTAT_DEAD 0x02 /* * Code added for CURSOR support * types accepted by ct_cursor */ #define CS_CURSOR_DECLARE 700 #define CS_CURSOR_OPEN 701 #define CS_CURSOR_ROWS 703 #define CS_CURSOR_UPDATE 704 #define CS_CURSOR_DELETE 705 #define CS_CURSOR_CLOSE 706 #define CS_CURSOR_DEALLOC 707 #define CS_CURSOR_OPTION 725 #define CS_FOR_UPDATE TDS_STATIC_CAST(CS_INT, 0x1) #define CS_READ_ONLY TDS_STATIC_CAST(CS_INT, 0x2) #define CS_RESTORE_OPEN TDS_STATIC_CAST(CS_INT, 0x8) #define CS_IMPLICIT_CURSOR TDS_STATIC_CAST(CS_INT, 0x40) #define CS_CURSTAT_NONE TDS_STATIC_CAST(CS_INT, 0x0) #define CS_CURSTAT_DECLARED TDS_STATIC_CAST(CS_INT, 0x1) #define CS_CURSTAT_OPEN TDS_STATIC_CAST(CS_INT, 0x2) #define CS_CURSTAT_CLOSED TDS_STATIC_CAST(CS_INT, 0x4) #define CS_CURSTAT_RDONLY TDS_STATIC_CAST(CS_INT, 0x8) #define CS_CURSTAT_UPDATABLE TDS_STATIC_CAST(CS_INT, 0x10) #define CS_CURSTAT_ROWCOUNT TDS_STATIC_CAST(CS_INT, 0x20) #define CS_CURSTAT_DEALLOC TDS_STATIC_CAST(CS_INT, 0x40) #define CS_CUR_STATUS TDS_STATIC_CAST(CS_INT, 9126) #define CS_CUR_ID TDS_STATIC_CAST(CS_INT, 9127) #define CS_CUR_NAME TDS_STATIC_CAST(CS_INT, 9128) #define CS_CUR_ROWCOUNT TDS_STATIC_CAST(CS_INT, 9129) /* options accepted by ct_options() */ #define CS_OPT_DATEFIRST 5001 #define CS_OPT_TEXTSIZE 5002 #define CS_OPT_STATS_TIME 5003 #define CS_OPT_STATS_IO 5004 #define CS_OPT_ROWCOUNT 5005 #define CS_OPT_DATEFORMAT 5007 #define CS_OPT_ISOLATION 5008 #define CS_OPT_AUTHON 5009 #define CS_OPT_SHOWPLAN 5013 #define CS_OPT_NOEXEC 5014 #define CS_OPT_ARITHIGNORE 5015 #define CS_OPT_TRUNCIGNORE 5016 #define CS_OPT_ARITHABORT 5017 #define CS_OPT_PARSEONLY 5018 #define CS_OPT_GETDATA 5020 #define CS_OPT_NOCOUNT 5021 #define CS_OPT_FORCEPLAN 5023 #define CS_OPT_FORMATONLY 5024 #define CS_OPT_CHAINXACTS 5025 #define CS_OPT_CURCLOSEONXACT 5026 #define CS_OPT_FIPSFLAG 5027 #define CS_OPT_RESTREES 5028 #define CS_OPT_IDENTITYON 5029 #define CS_OPT_CURREAD 5030 #define CS_OPT_CURWRITE 5031 #define CS_OPT_IDENTITYOFF 5032 #define CS_OPT_AUTHOFF 5033 #define CS_OPT_ANSINULL 5034 #define CS_OPT_QUOTED_IDENT 5035 #define CS_OPT_ANSIPERM 5036 #define CS_OPT_STR_RTRUNC 5037 /* options accepted by ct_command() */ enum ct_command_options { CS_MORE = 16, CS_END = 32, CS_RECOMPILE = 188, CS_NO_RECOMPILE, CS_BULK_INIT, CS_BULK_CONT, CS_BULK_DATA, CS_COLUMN_DATA }; /* * bind formats, should be mapped to TDS types * can be a combination of bit */ enum { CS_FMT_UNUSED = 0, #define CS_FMT_UNUSED CS_FMT_UNUSED CS_FMT_NULLTERM = 1, #define CS_FMT_NULLTERM CS_FMT_NULLTERM CS_FMT_PADNULL = 2, #define CS_FMT_PADBLANK CS_FMT_PADBLANK CS_FMT_PADBLANK = 4, #define CS_FMT_PADNULL CS_FMT_PADNULL CS_FMT_JUSTIFY_RT = 8 #define CS_FMT_JUSTIFY_RT CS_FMT_JUSTIFY_RT }; /* callbacks */ #define CS_COMPLETION_CB 1 #define CS_SERVERMSG_CB 2 #define CS_CLIENTMSG_CB 3 #define CS_NOTIF_CB 4 #define CS_ENCRYPT_CB 5 #define CS_CHALLENGE_CB 6 #define CS_DS_LOOKUP_CB 7 #define CS_SECSESSION_CB 8 #define CS_SIGNAL_CB 100 #define CS_MESSAGE_CB 9119 /* string types */ #define CS_NULLTERM -9 #define CS_WILDCARD -99 #define CS_NO_LIMIT -9999 #define CS_UNUSED -99999 /* other */ #define CS_GET 33 #define CS_SET 34 #define CS_CLEAR 35 #define CS_INIT 36 #define CS_STATUS 37 #define CS_MSGLIMIT 38 #define CS_SUPPORTED 40 #define CS_CMD_DONE 4046 #define CS_CMD_SUCCEED 4047 #define CS_CMD_FAIL 4048 /* commands */ #define CS_LANG_CMD 148 #define CS_RPC_CMD 149 #define CS_SEND_DATA_CMD 151 #define CS_SEND_BULK_CMD 153 #define CS_VERSION_100 112 #define CS_VERSION_110 1100 #define CS_VERSION_120 1100 #define CS_VERSION_125 12500 #define CS_VERSION_150 15000 #define BLK_VERSION_100 CS_VERSION_100 #define BLK_VERSION_110 CS_VERSION_110 #define BLK_VERSION_120 CS_VERSION_120 #define BLK_VERSION_125 CS_VERSION_125 #define BLK_VERSION_150 CS_VERSION_150 #define CS_FORCE_EXIT 300 #define CS_FORCE_CLOSE 301 #define CS_SYNC_IO 8111 #define CS_ASYNC_IO 8112 #define CS_DEFER_IO 8113 #define CS_CANCEL_CURRENT 6000 #define CS_CANCEL_ALL 6001 #define CS_CANCEL_ATTN 6002 #define CS_ROW_COUNT 800 #define CS_CMD_NUMBER 801 #define CS_NUM_COMPUTES 802 #define CS_NUMDATA 803 #define CS_NUMORDERCOLS 805 #define CS_MSGTYPE 806 #define CS_BROWSE_INFO 807 #define CS_TRANS_STATE 808 #define CS_TRAN_UNDEFINED 0 #define CS_TRAN_IN_PROGRESS 1 #define CS_TRAN_COMPLETED 2 #define CS_TRAN_FAIL 3 #define CS_TRAN_STMT_FAIL 4 #define CS_COMP_OP 5350 #define CS_COMP_ID 5351 #define CS_COMP_COLID 5352 #define CS_COMP_BYLIST 5353 #define CS_BYLIST_LEN 5354 #define CS_NO_COUNT -1 #define CS_OP_SUM 5370 #define CS_OP_AVG 5371 #define CS_OP_COUNT 5372 #define CS_OP_MIN 5373 #define CS_OP_MAX 5374 #define CS_CAP_REQUEST 1 #define CS_CAP_RESPONSE 2 #define CS_PREPARE 717 #define CS_EXECUTE 718 #define CS_DESCRIBE_INPUT 720 #define CS_DESCRIBE_OUTPUT 721 #define CS_DEALLOC 711 #define CS_LC_ALL 7 #define CS_SYB_LANG 8 #define CS_SYB_CHARSET 9 #define CS_SYB_SORTORDER 10 #define CS_SYB_COLLATE CS_SYB_SORTORDER #define CS_SYB_LANG_CHARSET 11 #define CS_BLK_IN 1 #define CS_BLK_OUT 2 #define CS_BLK_BATCH 1 #define CS_BLK_ALL 2 #define CS_BLK_CANCEL 3 /* to do support these */ #define CS_BLK_ARRAY_MAXLEN 0x1000 #define CS_DEF_PREC 18 /* Error Severities */ #define CS_SV_INFORM TDS_STATIC_CAST(CS_INT, 0) #define CS_SV_API_FAIL TDS_STATIC_CAST(CS_INT, 1) #define CS_SV_RETRY_FAIL TDS_STATIC_CAST(CS_INT, 2) #define CS_SV_RESOURCE_FAIL TDS_STATIC_CAST(CS_INT, 3) #define CS_SV_CONFIG_FAIL TDS_STATIC_CAST(CS_INT, 4) #define CS_SV_COMM_FAIL TDS_STATIC_CAST(CS_INT, 5) #define CS_SV_INTERNAL_FAIL TDS_STATIC_CAST(CS_INT, 6) #define CS_SV_FATAL TDS_STATIC_CAST(CS_INT, 7) /* result_types */ #define CS_COMPUTE_RESULT 4045 #define CS_CURSOR_RESULT 4041 #define CS_PARAM_RESULT 4042 #define CS_ROW_RESULT 4040 #define CS_STATUS_RESULT 4043 #define CS_COMPUTEFMT_RESULT 4050 #define CS_ROWFMT_RESULT 4049 #define CS_MSG_RESULT 4044 #define CS_DESCRIBE_RESULT 4051 /* bind types */ #define CS_ILLEGAL_TYPE TDS_STATIC_CAST(CS_INT, -1) #define CS_CHAR_TYPE TDS_STATIC_CAST(CS_INT, 0) #define CS_BINARY_TYPE TDS_STATIC_CAST(CS_INT, 1) #define CS_LONGCHAR_TYPE TDS_STATIC_CAST(CS_INT, 2) #define CS_LONGBINARY_TYPE TDS_STATIC_CAST(CS_INT, 3) #define CS_TEXT_TYPE TDS_STATIC_CAST(CS_INT, 4) #define CS_IMAGE_TYPE TDS_STATIC_CAST(CS_INT, 5) #define CS_TINYINT_TYPE TDS_STATIC_CAST(CS_INT, 6) #define CS_SMALLINT_TYPE TDS_STATIC_CAST(CS_INT, 7) #define CS_INT_TYPE TDS_STATIC_CAST(CS_INT, 8) #define CS_REAL_TYPE TDS_STATIC_CAST(CS_INT, 9) #define CS_FLOAT_TYPE TDS_STATIC_CAST(CS_INT, 10) #define CS_BIT_TYPE TDS_STATIC_CAST(CS_INT, 11) #define CS_DATETIME_TYPE TDS_STATIC_CAST(CS_INT, 12) #define CS_DATETIME4_TYPE TDS_STATIC_CAST(CS_INT, 13) #define CS_MONEY_TYPE TDS_STATIC_CAST(CS_INT, 14) #define CS_MONEY4_TYPE TDS_STATIC_CAST(CS_INT, 15) #define CS_NUMERIC_TYPE TDS_STATIC_CAST(CS_INT, 16) #define CS_DECIMAL_TYPE TDS_STATIC_CAST(CS_INT, 17) #define CS_VARCHAR_TYPE TDS_STATIC_CAST(CS_INT, 18) #define CS_VARBINARY_TYPE TDS_STATIC_CAST(CS_INT, 19) #define CS_LONG_TYPE TDS_STATIC_CAST(CS_INT, 20) #define CS_SENSITIVITY_TYPE TDS_STATIC_CAST(CS_INT, 21) #define CS_BOUNDARY_TYPE TDS_STATIC_CAST(CS_INT, 22) #define CS_VOID_TYPE TDS_STATIC_CAST(CS_INT, 23) #define CS_USHORT_TYPE TDS_STATIC_CAST(CS_INT, 24) #define CS_UNICHAR_TYPE TDS_STATIC_CAST(CS_INT, 25) #define CS_BLOB_TYPE TDS_STATIC_CAST(CS_INT, 26) #define CS_DATE_TYPE TDS_STATIC_CAST(CS_INT, 27) #define CS_TIME_TYPE TDS_STATIC_CAST(CS_INT, 28) #define CS_UNITEXT_TYPE TDS_STATIC_CAST(CS_INT, 29) #define CS_BIGINT_TYPE TDS_STATIC_CAST(CS_INT, 30) #define CS_USMALLINT_TYPE TDS_STATIC_CAST(CS_INT, 31) #define CS_UINT_TYPE TDS_STATIC_CAST(CS_INT, 32) #define CS_UBIGINT_TYPE TDS_STATIC_CAST(CS_INT, 33) #define CS_XML_TYPE TDS_STATIC_CAST(CS_INT, 34) #define CS_BIGDATETIME_TYPE TDS_STATIC_CAST(CS_INT, 35) #define CS_BIGTIME_TYPE TDS_STATIC_CAST(CS_INT, 36) #define CS_UNIQUE_TYPE TDS_STATIC_CAST(CS_INT, 40) #define CS_MIN_SYBTYPE CS_CHAR_TYPE #define CS_MAX_SYBTYPE CS_UNIQUE_TYPE #define CS_USER_TYPE TDS_STATIC_CAST(CS_INT, 100) /* cs_dt_info type values */ enum { CS_MONTH = 7340, #define CS_MONTH CS_MONTH CS_SHORTMONTH, #define CS_SHORTMONTH CS_SHORTMONTH CS_DAYNAME, #define CS_DAYNAME CS_DAYNAME CS_DATEORDER, #define CS_DATEORDER CS_DATEORDER CS_12HOUR, #define CS_12HOUR CS_12HOUR CS_DT_CONVFMT #define CS_DT_CONVFMT CS_DT_CONVFMT }; /* DT_CONVFMT types */ enum { CS_DATES_SHORT = 0, #define CS_DATES_SHORT CS_DATES_SHORT CS_DATES_MDY1, #define CS_DATES_MDY1 CS_DATES_MDY1 CS_DATES_YMD1, #define CS_DATES_YMD1 CS_DATES_YMD1 CS_DATES_DMY1, #define CS_DATES_DMY1 CS_DATES_DMY1 CS_DATES_DMY2, #define CS_DATES_DMY2 CS_DATES_DMY2 CS_DATES_DMY3, #define CS_DATES_DMY3 CS_DATES_DMY3 CS_DATES_DMY4, #define CS_DATES_DMY4 CS_DATES_DMY4 CS_DATES_MDY2, #define CS_DATES_MDY2 CS_DATES_MDY2 CS_DATES_HMS, #define CS_DATES_HMS CS_DATES_HMS CS_DATES_LONG, #define CS_DATES_LONG CS_DATES_LONG CS_DATES_MDY3, #define CS_DATES_MDY3 CS_DATES_MDY3 CS_DATES_YMD2, #define CS_DATES_YMD2 CS_DATES_YMD2 CS_DATES_YMD3, #define CS_DATES_YMD3 CS_DATES_YMD3 CS_DATES_YDM1, #define CS_DATES_YDM1 CS_DATES_YDM1 CS_DATES_MYD1, #define CS_DATES_MYD1 CS_DATES_MYD1 CS_DATES_DYM1, #define CS_DATES_DYM1 CS_DATES_DYM1 CS_DATES_MDY1_YYYY = 101, #define CS_DATES_MDY1_YYYY CS_DATES_MDY1_YYYY CS_DATES_YMD1_YYYY, #define CS_DATES_YMD1_YYYY CS_DATES_YMD1_YYYY CS_DATES_DMY1_YYYY, #define CS_DATES_DMY1_YYYY CS_DATES_DMY1_YYYY CS_DATES_DMY2_YYYY, #define CS_DATES_DMY2_YYYY CS_DATES_DMY2_YYYY CS_DATES_DMY3_YYYY, #define CS_DATES_DMY3_YYYY CS_DATES_DMY3_YYYY CS_DATES_DMY4_YYYY, #define CS_DATES_DMY4_YYYY CS_DATES_DMY4_YYYY CS_DATES_MDY2_YYYY, #define CS_DATES_MDY2_YYYY CS_DATES_MDY2_YYYY CS_DATES_MDY3_YYYY = 110, #define CS_DATES_MDY3_YYYY CS_DATES_MDY3_YYYY CS_DATES_YMD2_YYYY, #define CS_DATES_YMD2_YYYY CS_DATES_YMD2_YYYY CS_DATES_YMD3_YYYY #define CS_DATES_YMD3_YYYY CS_DATES_YMD3_YYYY }; typedef CS_RETCODE(*CS_CONV_FUNC) (CS_CONTEXT * context, CS_DATAFMT * srcfmt, CS_VOID * src, CS_DATAFMT * detsfmt, CS_VOID * dest, CS_INT * destlen); typedef struct _cs_objname { CS_BOOL thinkexists; CS_INT object_type; CS_CHAR last_name[CS_MAX_NAME]; CS_INT lnlen; CS_CHAR first_name[CS_MAX_NAME]; CS_INT fnlen; CS_VOID *scope; CS_INT scopelen; CS_VOID *thread; CS_INT threadlen; } CS_OBJNAME; typedef struct _cs_objdata { CS_BOOL actuallyexists; CS_CONNECTION *connection; CS_COMMAND *command; CS_VOID *buffer; CS_INT buflen; } CS_OBJDATA; /* Eventually, these should be in terms of TDS values */ enum { CS_OPT_MONDAY = 1, CS_OPT_TUESDAY, CS_OPT_WEDNESDAY, CS_OPT_THURSDAY, CS_OPT_FRIDAY, CS_OPT_SATURDAY, CS_OPT_SUNDAY }; enum { CS_OPT_FMTMDY = 1, CS_OPT_FMTDMY, CS_OPT_FMTYMD, CS_OPT_FMTYDM, CS_OPT_FMTMYD, CS_OPT_FMTDYM }; enum { CS_OPT_LEVEL0 = 0, CS_OPT_LEVEL1, CS_OPT_LEVEL2, CS_OPT_LEVEL3 }; #define CS_FALSE 0 #define CS_TRUE 1 #define SRV_PROC CS_VOID /* constants required for ct_diag (not jet implemented) */ #define CS_CLIENTMSG_TYPE 4700 #define CS_SERVERMSG_TYPE 4701 #define CS_ALLMSG_TYPE 4702 CS_RETCODE cs_convert(CS_CONTEXT * ctx, CS_DATAFMT * srcfmt, CS_VOID * srcdata, CS_DATAFMT * destfmt, CS_VOID * destdata, CS_INT * resultlen); CS_RETCODE cs_ctx_alloc(CS_INT version, CS_CONTEXT ** ctx); CS_RETCODE cs_ctx_global(CS_INT version, CS_CONTEXT ** ctx); CS_RETCODE cs_ctx_drop(CS_CONTEXT * ctx); CS_RETCODE cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE cs_strbuild(CS_CONTEXT * ctx, CS_CHAR * buffer, CS_INT buflen, CS_INT * resultlen, CS_CHAR * text, CS_INT textlen, CS_CHAR * formats, CS_INT formatlen, ...); #undef cs_dt_crack CS_RETCODE cs_dt_crack(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec); CS_RETCODE cs_dt_crack_v2(CS_CONTEXT * ctx, CS_INT datetype, CS_VOID * dateval, CS_DATEREC * daterec); #define cs_dt_crack cs_dt_crack_v2 CS_RETCODE cs_loc_alloc(CS_CONTEXT * ctx, CS_LOCALE ** locptr); CS_RETCODE cs_loc_drop(CS_CONTEXT * ctx, CS_LOCALE * locale); CS_RETCODE cs_locale(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE cs_dt_info(CS_CONTEXT * ctx, CS_INT action, CS_LOCALE * locale, CS_INT type, CS_INT item, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE cs_calc(CS_CONTEXT * ctx, CS_INT op, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_VOID * dest); CS_RETCODE cs_cmp(CS_CONTEXT * ctx, CS_INT datatype, CS_VOID * var1, CS_VOID * var2, CS_INT * result); CS_RETCODE cs_conv_mult(CS_CONTEXT * ctx, CS_LOCALE * srcloc, CS_LOCALE * destloc, CS_INT * conv_multiplier); CS_RETCODE cs_diag(CS_CONTEXT * ctx, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer); CS_RETCODE cs_manage_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_CHAR * srcname, CS_INT srcnamelen, CS_INT desttype, CS_CHAR * destname, CS_INT destnamelen, CS_INT * conv_multiplier, CS_CONV_FUNC * func); CS_RETCODE cs_objects(CS_CONTEXT * ctx, CS_INT action, CS_OBJNAME * objname, CS_OBJDATA * objdata); CS_RETCODE cs_set_convert(CS_CONTEXT * ctx, CS_INT action, CS_INT srctype, CS_INT desttype, CS_CONV_FUNC * func); CS_RETCODE cs_setnull(CS_CONTEXT * ctx, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT buflen); CS_RETCODE cs_strcmp(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_INT type, CS_CHAR * str1, CS_INT len1, CS_CHAR * str2, CS_INT len2, CS_INT * result); CS_RETCODE cs_time(CS_CONTEXT * ctx, CS_LOCALE * locale, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen, CS_DATEREC * daterec); CS_RETCODE cs_will_convert(CS_CONTEXT * ctx, CS_INT srctype, CS_INT desttype, CS_BOOL * result); const char * cs_prretcode(int retcode); #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/cstypes.h000644 025423 025423 00000010774 14056414221 020101 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _cstypes_h_ #define _cstypes_h_ #include "tds_sysdep_public.h" #ifdef __cplusplus extern "C" { #if 0 } #endif #endif typedef int32_t CS_INT; typedef uint32_t CS_UINT; typedef int64_t CS_BIGINT; typedef uint64_t CS_UBIGINT; typedef int16_t CS_SMALLINT; typedef uint16_t CS_USMALLINT; typedef unsigned char CS_TINYINT; typedef char CS_CHAR; typedef unsigned char CS_BYTE; typedef tds_sysdep_real32_type CS_REAL; typedef tds_sysdep_real64_type CS_FLOAT; typedef int32_t CS_BOOL; typedef void CS_VOID; typedef unsigned char CS_IMAGE; typedef unsigned char CS_TEXT; typedef unsigned char CS_LONGBINARY; typedef unsigned char CS_LONGCHAR; typedef long CS_LONG; typedef unsigned char CS_BINARY; typedef uint16_t CS_USHORT; typedef unsigned char CS_BIT; typedef CS_INT CS_RETCODE; #define CS_MAX_NAME 132 #define CS_MAX_SCALE 77 #define CS_MAX_PREC 77 /* used by php */ #define CS_MAX_NUMLEN 33 /* used by roguewave */ #define CS_MAX_MSG 1024 #define CS_SQLSTATE_SIZE 8 #define CS_OBJ_NAME 400 #define CS_TP_SIZE 16 /* text pointer */ #define CS_TS_SIZE 8 /* length of timestamp */ typedef struct _cs_numeric { unsigned char precision; unsigned char scale; unsigned char array[CS_MAX_NUMLEN]; } CS_NUMERIC; typedef CS_NUMERIC CS_DECIMAL; typedef struct _cs_varbinary { CS_SMALLINT len; CS_CHAR array[256]; } CS_VARBINARY; typedef struct _cs_varchar { CS_SMALLINT len; /* length of the string */ CS_CHAR str[256]; /* string, no NULL terminator */ } CS_VARCHAR; typedef struct _cs_config CS_CONFIG; typedef struct _cs_context CS_CONTEXT; typedef struct _cs_connection CS_CONNECTION; typedef struct _cs_locale CS_LOCALE; typedef struct _cs_command CS_COMMAND; typedef struct _cs_blk_row CS_BLK_ROW; typedef struct _cs_iodesc { CS_INT iotype; CS_INT datatype; CS_LOCALE *locale; CS_INT usertype; CS_INT total_txtlen; CS_INT offset; CS_BOOL log_on_update; CS_CHAR name[CS_OBJ_NAME]; CS_INT namelen; CS_BYTE timestamp[CS_TS_SIZE]; CS_INT timestamplen; CS_BYTE textptr[CS_TP_SIZE]; CS_INT textptrlen; } CS_IODESC; typedef struct _cs_datafmt { CS_CHAR name[CS_MAX_NAME]; CS_INT namelen; CS_INT datatype; CS_INT format; CS_INT maxlength; CS_INT scale; CS_INT precision; CS_INT status; CS_INT count; CS_INT usertype; CS_LOCALE *locale; } CS_DATAFMT; typedef struct _cs_money { CS_INT mnyhigh; CS_UINT mnylow; } CS_MONEY; typedef struct _cs_money4 { CS_INT mny4; } CS_MONEY4; typedef CS_INT CS_DATE; typedef CS_INT CS_TIME; typedef CS_UBIGINT CS_BIGDATETIME; typedef CS_UBIGINT CS_BIGTIME; typedef struct _cs_datetime { CS_INT dtdays; CS_INT dttime; } CS_DATETIME; typedef struct _cs_datetime4 { CS_USHORT days; CS_USHORT minutes; } CS_DATETIME4; typedef struct _cs_daterec { CS_INT dateyear; CS_INT datemonth; CS_INT datedmonth; CS_INT datedyear; CS_INT datedweek; CS_INT datehour; CS_INT dateminute; CS_INT datesecond; CS_INT datemsecond; CS_INT datetzone; CS_INT datesecfrac; CS_INT datesecprec; } CS_DATEREC; typedef CS_INT CS_MSGNUM; typedef struct _cs_clientmsg { CS_INT severity; CS_MSGNUM msgnumber; CS_CHAR msgstring[CS_MAX_MSG]; CS_INT msgstringlen; CS_INT osnumber; CS_CHAR osstring[CS_MAX_MSG]; CS_INT osstringlen; CS_INT status; CS_BYTE sqlstate[CS_SQLSTATE_SIZE]; CS_INT sqlstatelen; } CS_CLIENTMSG; typedef struct _cs_servermsg { CS_MSGNUM msgnumber; CS_INT state; CS_INT severity; CS_CHAR text[CS_MAX_MSG]; CS_INT textlen; CS_CHAR svrname[CS_MAX_NAME]; CS_INT svrnlen; CS_CHAR proc[CS_MAX_NAME]; CS_INT proclen; CS_INT line; CS_INT status; CS_BYTE sqlstate[CS_SQLSTATE_SIZE]; CS_INT sqlstatelen; } CS_SERVERMSG; #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/ctpublic.h000644 025423 025423 00000016227 14056414221 020213 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _ctpublic_h_ #define _ctpublic_h_ #include #undef TDS_STATIC_CAST #ifdef __cplusplus #define TDS_STATIC_CAST(type, a) static_cast(a) extern "C" { #if 0 } #endif #else #define TDS_STATIC_CAST(type, a) ((type)(a)) #endif /* ** define for each CT-Lib API */ #define CT_BIND TDS_STATIC_CAST(CS_INT, 0) #define CT_BR_COLUMN TDS_STATIC_CAST(CS_INT, 1) #define CT_BR_TABLE TDS_STATIC_CAST(CS_INT, 2) #define CT_CALLBACK TDS_STATIC_CAST(CS_INT, 3) #define CT_CANCEL TDS_STATIC_CAST(CS_INT, 4) #define CT_CAPABILITY TDS_STATIC_CAST(CS_INT, 5) #define CT_CLOSE TDS_STATIC_CAST(CS_INT, 6) #define CT_CMD_ALLOC TDS_STATIC_CAST(CS_INT, 7) #define CT_CMD_DROP TDS_STATIC_CAST(CS_INT, 8) #define CT_CMD_PROPS TDS_STATIC_CAST(CS_INT, 9) #define CT_COMMAND TDS_STATIC_CAST(CS_INT, 10) #define CT_COMPUTE_INFO TDS_STATIC_CAST(CS_INT, 11) #define CT_CON_ALLOC TDS_STATIC_CAST(CS_INT, 12) #define CT_CON_DROP TDS_STATIC_CAST(CS_INT, 13) #define CT_CON_PROPS TDS_STATIC_CAST(CS_INT, 14) #define CT_CON_XFER TDS_STATIC_CAST(CS_INT, 15) #define CT_CONFIG TDS_STATIC_CAST(CS_INT, 16) #define CT_CONNECT TDS_STATIC_CAST(CS_INT, 17) #define CT_CURSOR TDS_STATIC_CAST(CS_INT, 18) #define CT_DATA_INFO TDS_STATIC_CAST(CS_INT, 19) #define CT_DEBUG TDS_STATIC_CAST(CS_INT, 20) #define CT_DESCRIBE TDS_STATIC_CAST(CS_INT, 21) #define CT_DIAG TDS_STATIC_CAST(CS_INT, 22) #define CT_DYNAMIC TDS_STATIC_CAST(CS_INT, 23) #define CT_DYNDESC TDS_STATIC_CAST(CS_INT, 24) #define CT_EXIT TDS_STATIC_CAST(CS_INT, 25) #define CT_FETCH TDS_STATIC_CAST(CS_INT, 26) #define CT_GET_DATA TDS_STATIC_CAST(CS_INT, 27) #define CT_GETFORMAT TDS_STATIC_CAST(CS_INT, 28) #define CT_GETLOGINFO TDS_STATIC_CAST(CS_INT, 29) #define CT_INIT TDS_STATIC_CAST(CS_INT, 30) #define CT_KEYDATA TDS_STATIC_CAST(CS_INT, 31) #define CT_OPTIONS TDS_STATIC_CAST(CS_INT, 32) #define CT_PARAM TDS_STATIC_CAST(CS_INT, 33) #define CT_POLL TDS_STATIC_CAST(CS_INT, 34) #define CT_RECVPASSTHRU TDS_STATIC_CAST(CS_INT, 35) #define CT_REMOTE_PWD TDS_STATIC_CAST(CS_INT, 36) #define CT_RES_INFO TDS_STATIC_CAST(CS_INT, 37) #define CT_RESULTS TDS_STATIC_CAST(CS_INT, 38) #define CT_SEND TDS_STATIC_CAST(CS_INT, 39) #define CT_SEND_DATA TDS_STATIC_CAST(CS_INT, 40) #define CT_SENDPASSTHRU TDS_STATIC_CAST(CS_INT, 41) #define CT_SETLOGINFO TDS_STATIC_CAST(CS_INT, 42) #define CT_WAKEUP TDS_STATIC_CAST(CS_INT, 43) #define CT_LABELS TDS_STATIC_CAST(CS_INT, 44) #define CT_DS_LOOKUP TDS_STATIC_CAST(CS_INT, 45) #define CT_DS_DROP TDS_STATIC_CAST(CS_INT, 46) #define CT_DS_OBJINFO TDS_STATIC_CAST(CS_INT, 47) #define CT_SETPARAM TDS_STATIC_CAST(CS_INT, 48) #define CT_DYNSQLDA TDS_STATIC_CAST(CS_INT, 49) #define CT_NOTIFICATION TDS_STATIC_CAST(CS_INT, 1000) static const char rcsid_ctpublic_h[] = "$Id: ctpublic.h,v 1.14 2005-05-28 10:48:26 freddy77 Exp $"; static const void *const no_unused_ctpublic_h_warn[] = { rcsid_ctpublic_h, no_unused_ctpublic_h_warn }; CS_RETCODE ct_init(CS_CONTEXT * ctx, CS_INT version); CS_RETCODE ct_con_alloc(CS_CONTEXT * ctx, CS_CONNECTION ** con); CS_RETCODE ct_con_props(CS_CONNECTION * con, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len); CS_RETCODE ct_connect(CS_CONNECTION * con, CS_CHAR * servername, CS_INT snamelen); CS_RETCODE ct_cmd_alloc(CS_CONNECTION * con, CS_COMMAND ** cmd); CS_RETCODE ct_cancel(CS_CONNECTION * conn, CS_COMMAND * cmd, CS_INT type); CS_RETCODE ct_cmd_drop(CS_COMMAND * cmd); CS_RETCODE ct_close(CS_CONNECTION * con, CS_INT option); CS_RETCODE ct_con_drop(CS_CONNECTION * con); CS_RETCODE ct_exit(CS_CONTEXT * ctx, CS_INT unused); CS_RETCODE ct_command(CS_COMMAND * cmd, CS_INT type, const CS_VOID * buffer, CS_INT buflen, CS_INT option); CS_RETCODE ct_send(CS_COMMAND * cmd); CS_RETCODE ct_results(CS_COMMAND * cmd, CS_INT * result_type); CS_RETCODE ct_bind(CS_COMMAND * cmd, CS_INT item, CS_DATAFMT * datafmt, CS_VOID * buffer, CS_INT * copied, CS_SMALLINT * indicator); CS_RETCODE ct_fetch(CS_COMMAND * cmd, CS_INT type, CS_INT offset, CS_INT option, CS_INT * rows_read); CS_RETCODE ct_res_info_dyn(CS_COMMAND * cmd, CS_INT type, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len); CS_RETCODE ct_res_info(CS_COMMAND * cmd, CS_INT type, CS_VOID * buffer, CS_INT buflen, CS_INT * out_len); CS_RETCODE ct_describe(CS_COMMAND * cmd, CS_INT item, CS_DATAFMT * datafmt); CS_RETCODE ct_callback(CS_CONTEXT * ctx, CS_CONNECTION * con, CS_INT action, CS_INT type, CS_VOID * func); CS_RETCODE ct_send_dyn(CS_COMMAND * cmd); CS_RETCODE ct_results_dyn(CS_COMMAND * cmd, CS_INT * result_type); CS_RETCODE ct_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE ct_cmd_props(CS_COMMAND * cmd, CS_INT action, CS_INT property, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE ct_compute_info(CS_COMMAND * cmd, CS_INT type, CS_INT colnum, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE ct_get_data(CS_COMMAND * cmd, CS_INT item, CS_VOID * buffer, CS_INT buflen, CS_INT * outlen); CS_RETCODE ct_send_data(CS_COMMAND * cmd, CS_VOID * buffer, CS_INT buflen); CS_RETCODE ct_data_info(CS_COMMAND * cmd, CS_INT action, CS_INT colnum, CS_IODESC * iodesc); CS_RETCODE ct_capability(CS_CONNECTION * con, CS_INT action, CS_INT type, CS_INT capability, CS_VOID * value); CS_RETCODE ct_dynamic(CS_COMMAND * cmd, CS_INT type, CS_CHAR * id, CS_INT idlen, CS_CHAR * buffer, CS_INT buflen); CS_RETCODE ct_param(CS_COMMAND * cmd, CS_DATAFMT * datafmt, CS_VOID * data, CS_INT datalen, CS_SMALLINT indicator); CS_RETCODE ct_setparam(CS_COMMAND * cmd, CS_DATAFMT * datafmt, CS_VOID * data, CS_INT * datalen, CS_SMALLINT * indicator); CS_RETCODE ct_options(CS_CONNECTION * con, CS_INT action, CS_INT option, CS_VOID * param, CS_INT paramlen, CS_INT * outlen); CS_RETCODE ct_poll(CS_CONTEXT * ctx, CS_CONNECTION * connection, CS_INT milliseconds, CS_CONNECTION ** compconn, CS_COMMAND ** compcmd, CS_INT * compid, CS_INT * compstatus); CS_RETCODE ct_cursor(CS_COMMAND * cmd, CS_INT type, CS_CHAR * name, CS_INT namelen, CS_CHAR * text, CS_INT tlen, CS_INT option); CS_RETCODE ct_diag(CS_CONNECTION * conn, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * buffer); #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/sqldb.h000644 025423 025423 00000011736 14056414221 017513 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef SQLDB_h #define SQLDB_h #include "./sybdb.h" #define SQLCHAR SYBCHAR #define SQLVARCHAR SYBVARCHAR #define SQLINTN SYBINTN #define SQLINT1 SYBINT1 #define SQLINT2 SYBINT2 #define SQLINT4 SYBINT4 #define SQLINT8 SYBINT8 #define SQLFLT8 SYBFLT8 #define SQLDATETIME SYBDATETIME #define SQLBIT SYBBIT #define SQLTEXT SYBTEXT #define SQLIMAGE SYBIMAGE #define SQLMONEY4 SYBMONEY4 #define SQLMONEY SYBMONEY #define SQLDATETIM4 SYBDATETIME4 #define SQLFLT4 SYBREAL #define SQLBINARY SYBBINARY #define SQLVARBINARY SYBVARBINARY #define SQLNUMERIC SYBNUMERIC #define SQLDECIMAL SYBDECIMAL #define SQLFLTN SYBFLTN #define SQLMONEYN SYBMONEYN #define SQLDATETIMN SYBDATETIMN #define SQLVOID SYBVOID #define SMALLDATETIBIND SMALLDATETIMEBIND #define DBERRHANDLE_PROC EHANDLEFUNC #define DBMSGHANDLE_PROC MHANDLEFUNC /* DB-Library errors as defined by Microsoft */ #define SQLEMEM SYBEMEM #define SQLENULL SYBENULL #define SQLENLOG SYBENLOG #define SQLEPWD SYBEPWD #define SQLECONN SYBECONN #define SQLEDDNE SYBEDDNE #define SQLENULLO SYBENULLO #define SQLESMSG SYBESMSG #define SQLEBTOK SYBEBTOK #define SQLENSPE SYBENSPE #define SQLEREAD SYBEREAD #define SQLECNOR SYBECNOR #define SQLETSIT SYBETSIT #define SQLEPARM SYBEPARM #define SQLEAUTN SYBEAUTN #define SQLECOFL SYBECOFL #define SQLERDCN SYBERDCN #define SQLEICN SYBEICN #define SQLECLOS SYBECLOS #define SQLENTXT SYBENTXT #define SQLEDNTI SYBEDNTI #define SQLETMTD SYBETMTD #define SQLEASEC SYBEASEC #define SQLENTLL SYBENTLL #define SQLETIME SYBETIME #define SQLEWRIT SYBEWRIT #define SQLEMODE SYBEMODE #define SQLEOOB SYBEOOB #define SQLEITIM SYBEITIM #define SQLEDBPS SYBEDBPS #define SQLEIOPT SYBEIOPT #define SQLEASNL SYBEASNL #define SQLEASUL SYBEASUL #define SQLENPRM SYBENPRM #define SQLEDBOP SYBEDBOP #define SQLENSIP SYBENSIP #define SQLECNULL SYBECNULL #define SQLESEOF SYBESEOF #define SQLERPND SYBERPND #define SQLECSYN SYBECSYN #define SQLENONET SYBENONET #define SQLEBTYP SYBEBTYP #define SQLEABNC SYBEABNC #define SQLEABMT SYBEABMT #define SQLEABNP SYBEABNP #define SQLEBNCR SYBEBNCR #define SQLEAAMT SYBEAAMT #define SQLENXID SYBENXID #define SQLEIFNB SYBEIFNB #define SQLEKBCO SYBEKBCO #define SQLEBBCI SYBEBBCI #define SQLEKBCI SYBEKBCI #define SQLEBCWE SYBEBCWE #define SQLEBCNN SYBEBCNN #define SQLEBCOR SYBEBCOR #define SQLEBCPI SYBEBCPI #define SQLEBCPN SYBEBCPN #define SQLEBCPB SYBEBCPB #define SQLEVDPT SYBEVDPT #define SQLEBIVI SYBEBIVI #define SQLEBCBC SYBEBCBC #define SQLEBCFO SYBEBCFO #define SQLEBCVH SYBEBCVH #define SQLEBCUO SYBEBCUO #define SQLEBUOE SYBEBUOE #define SQLEBWEF SYBEBWEF #define SQLEBTMT SYBEBTMT #define SQLEBEOF SYBEBEOF #define SQLEBCSI SYBEBCSI #define SQLEPNUL SYBEPNUL #define SQLEBSKERR SYBEBSKERR #define SQLEBDIO SYBEBDIO #define SQLEBCNT SYBEBCNT #define SQLEMDBP SYBEMDBP #define SQLINIT SYBINIT #define SQLCRSINV SYBCRSINV #define SQLCRSCMD SYBCRSCMD #define SQLCRSNOIND SYBCRSNOIND #define SQLCRSDIS SYBCRSDIS #define SQLCRSAGR SYBCRSAGR #define SQLCRSORD SYBCRSORD #define SQLCRSMEM SYBCRSMEM #define SQLCRSBSKEY SYBCRSBSKEY #define SQLCRSNORES SYBCRSNORES #define SQLCRSVIEW SYBCRSVIEW #define SQLCRSBUFR SYBCRSBUFR #define SQLCRSFROWN SYBCRSFROWN #define SQLCRSBROL SYBCRSBROL #define SQLCRSFRAND SYBCRSFRAND #define SQLCRSFLAST SYBCRSFLAST #define SQLCRSRO SYBCRSRO #define SQLCRSTAB SYBCRSTAB #define SQLCRSUPDTAB SYBCRSUPDTAB #define SQLCRSUPDNB SYBCRSUPDNB #define SQLCRSVIIND SYBCRSVIIND #define SQLCRSNOUPD SYBCRSNOUPD #define SQLCRSOS SYBCRSOS #define SQLEBCSA SYBEBCSA #define SQLEBCRO SYBEBCRO #define SQLEBCNE SYBEBCNE #define SQLEBCSK SYBEBCSK #define SQLEUVBF SYBEUVBF #define SQLEBIHC SYBEBIHC #define SQLEBWFF SYBEBWFF #define SQLNUMVAL SYBNUMVAL #define SQLEOLDVR SYBEOLDVR #define SQLEBCPS SYBEBCPS #define SQLEDTC SYBEDTC #define SQLENOTIMPL SYBENOTIMPL #define SQLENONFLOAT SYBENONFLOAT #define SQLECONNFB SYBECONNFB #define dbfreelogin(x) dbloginfree((x)) #define dbprocerrhandle(p, h) dberrhandle((h)) #define dbprocmsghandle(p, h) dbmsghandle((h)) #define dbwinexit() static const char rcsid_sqldb_h[] = "$Id: sqldb.h,v 1.6 2009-12-02 22:35:18 jklowden Exp $"; static const void *const no_unused_sqldb_h_warn[] = { rcsid_sqldb_h, no_unused_sqldb_h_warn }; #endif freetds-1.3.6/include/sqlfront.h000644 025423 025423 00000003745 14056414221 020257 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * Copyright (C) 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef SQLFRONT_h #define SQLFRONT_h #include "./sybfront.h" static const char rcsid_sqlfront_h[] = "$Id: sqlfront.h,v 1.10 2011-07-13 11:06:31 freddy77 Exp $"; static const void *const no_unused_sqlfront_h_warn[] = { rcsid_sqlfront_h, no_unused_sqlfront_h_warn }; typedef DBPROCESS * PDBPROCESS; typedef LOGINREC * PLOGINREC; typedef DBCURSOR * PDBCURSOR; typedef int * LPINT; typedef char * LPSTR; #if !defined(PHP_MSSQL_H) || !defined(PHP_MSSQL_API) typedef BYTE * LPBYTE; #endif typedef void * LPVOID; typedef const char * LPCSTR; typedef const LPINT LPCINT; #ifndef _LPCBYTE_DEFINED #define _LPCBYTE_DEFINED typedef const BYTE * LPCBYTE; #endif typedef USHORT * LPUSHORT; typedef const LPUSHORT LPCUSHORT; typedef DBINT * LPDBINT; typedef const LPDBINT LPCDBINT; typedef DBBINARY * LPDBBINARY; typedef const LPDBBINARY LPCDBBINARY; typedef DBDATEREC * LPDBDATEREC; typedef const LPDBDATEREC LPCDBDATEREC; typedef DBDATETIME * LPDBDATETIME; typedef const LPDBDATETIME LPCDBDATETIME; #endif freetds-1.3.6/include/sybdb.h000644 025423 025423 00000177105 14056414271 017521 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2010, 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** \file ../include/sybdb.h * \brief Primary include file for db-lib applications. * * Declares macros, functions, enumerated types, and defined tokens * used by the db-lib API. */ #ifndef _sybdb_h_ #define _sybdb_h_ #include "tds_sysdep_public.h" #undef TDS_STATIC_CAST #ifdef __cplusplus #define TDS_STATIC_CAST(type, a) static_cast(a) extern "C" { #if 0 } #endif #else #define TDS_STATIC_CAST(type, a) ((type)(a)) #endif #ifdef FALSE #undef FALSE #endif #ifdef TRUE #undef TRUE #endif #define FALSE 0 #define TRUE 1 #define DBSAVE 1 #define DBNOSAVE 0 #define DBNOERR -1 #define INT_EXIT 0 #define INT_CONTINUE 1 #define INT_CANCEL 2 #define INT_TIMEOUT 3 #define DBMAXNUMLEN 33 /* https://msdn.microsoft.com/en-us/library/ms176061.aspx */ #define DBMAXNAME 128 /** * DBVERSION_xxx are used with dbsetversion() */ #define DBVERSION_UNKNOWN 0 #define DBVERSION_46 1 #define DBVERSION_100 2 #define DBVERSION_42 3 #define DBVERSION_70 4 #define DBVERSION_71 5 #define DBVERSION_72 6 #define DBVERSION_73 7 #define DBVERSION_74 8 /* these two are defined by Microsoft for dbsetlversion() */ #define DBVER42 DBVERSION_42 #define DBVER60 DBVERSION_70 /* our best approximation */ /** * DBTDS_xxx are returned by DBTDS() * The integer values of the constants are poorly chosen. */ #define DBTDS_UNKNOWN 0 #define DBTDS_2_0 1 /* pre 4.0 SQL Server */ #define DBTDS_3_4 2 /* Microsoft SQL Server (3.0) */ #define DBTDS_4_0 3 /* 4.0 SQL Server */ #define DBTDS_4_2 4 /* 4.2 SQL Server */ #define DBTDS_4_6 5 /* 2.0 OpenServer and 4.6 SQL Server. */ #define DBTDS_4_9_5 6 /* 4.9.5 (NCR) SQL Server */ #define DBTDS_5_0 7 /* 5.0 SQL Server */ #define DBTDS_7_0 8 /* Microsoft SQL Server 7.0 */ #define DBTDS_8_0 9 /* Microsoft SQL Server 2000 */ #define DBTDS_9_0 10 /* Microsoft SQL Server 2005 */ #define DBTDS_7_1 9 /* Microsoft SQL Server 2000 */ #define DBTDS_7_2 10 /* Microsoft SQL Server 2005 */ #define DBTDS_7_3 11 /* Microsoft SQL Server 2008 */ #define DBTDS_7_4 12 /* Microsoft SQL Server 2012/2014 */ #define DBTXPLEN 16 #define BCPMAXERRS 1 #define BCPFIRST 2 #define BCPLAST 3 #define BCPBATCH 4 #define BCPKEEPIDENTITY 8 #define BCPLABELED 5 #define BCPHINTS 6 #define DBCMDNONE 0 #define DBCMDPEND 1 #define DBCMDSENT 2 typedef int RETCODE; typedef void DBCURSOR; typedef void DBXLATE; typedef void DBSORTORDER; typedef void DBLOGINFO; typedef void *DBVOIDPTR; typedef short SHORT; typedef unsigned short USHORT; typedef int (*INTFUNCPTR) (void *, ...); typedef int (*DBWAITFUNC) (void); typedef DBWAITFUNC(*DB_DBBUSY_FUNC) (void *dbproc); typedef void (*DB_DBIDLE_FUNC) (DBWAITFUNC dfunc, void *dbproc); typedef int (*DB_DBCHKINTR_FUNC) (void *dbproc); typedef int (*DB_DBHNDLINTR_FUNC) (void *dbproc); #ifndef __INCvxWorksh /* VxWorks already defines STATUS and BOOL. Compiler gets mad if you ** redefine them. */ /* __INCvxWorksh will get #defined by std. include files included from tds.h */ #ifdef STATUS /* On DU4.0d we get a conflicting STATUS definition from arpa/nameser.h when _REENTRANT is defined. */ #undef STATUS #endif typedef int STATUS; #if !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(DOS32X) typedef int BOOL; #endif #endif #ifndef _tds_h_ /* copied from tds.h */ /* TODO find a best way... */ enum { SYBCHAR = 47, /* 0x2F */ #define SYBCHAR SYBCHAR SYBVARCHAR = 39, /* 0x27 */ #define SYBVARCHAR SYBVARCHAR SYBINTN = 38, /* 0x26 */ #define SYBINTN SYBINTN SYBINT1 = 48, /* 0x30 */ #define SYBINT1 SYBINT1 SYBINT2 = 52, /* 0x34 */ #define SYBINT2 SYBINT2 SYBINT4 = 56, /* 0x38 */ #define SYBINT4 SYBINT4 SYBINT8 = 127, /* 0x7F */ #define SYBINT8 SYBINT8 SYBFLT8 = 62, /* 0x3E */ #define SYBFLT8 SYBFLT8 SYBDATETIME = 61, /* 0x3D */ #define SYBDATETIME SYBDATETIME SYBBIT = 50, /* 0x32 */ #define SYBBIT SYBBIT SYBBITN = 104, /* 0x68 */ #define SYBBITN SYBBITN SYBTEXT = 35, /* 0x23 */ #define SYBTEXT SYBTEXT SYBNTEXT = 99, /* 0x63 */ #define SYBNTEXT SYBNTEXT SYBIMAGE = 34, /* 0x22 */ #define SYBIMAGE SYBIMAGE SYBMONEY4 = 122, /* 0x7A */ #define SYBMONEY4 SYBMONEY4 SYBMONEY = 60, /* 0x3C */ #define SYBMONEY SYBMONEY SYBDATETIME4 = 58, /* 0x3A */ #define SYBDATETIME4 SYBDATETIME4 SYBREAL = 59, /* 0x3B */ #define SYBREAL SYBREAL SYBBINARY = 45, /* 0x2D */ #define SYBBINARY SYBBINARY SYBVOID = 31, /* 0x1F */ #define SYBVOID SYBVOID SYBVARBINARY = 37, /* 0x25 */ #define SYBVARBINARY SYBVARBINARY SYBNUMERIC = 108, /* 0x6C */ #define SYBNUMERIC SYBNUMERIC SYBDECIMAL = 106, /* 0x6A */ #define SYBDECIMAL SYBDECIMAL SYBFLTN = 109, /* 0x6D */ #define SYBFLTN SYBFLTN SYBMONEYN = 110, /* 0x6E */ #define SYBMONEYN SYBMONEYN SYBDATETIMN = 111, /* 0x6F */ #define SYBDATETIMN SYBDATETIMN SYBNVARCHAR = 103, /* 0x67 */ #define SYBNVARCHAR SYBNVARCHAR SYBDATE = 49, /* 0x31 */ #define SYBDATE SYBDATE SYBTIME = 51, /* 0x33 */ #define SYBTIME SYBTIME SYBBIGDATETIME = 187, /* 0xBB */ #define SYBBIGDATETIME SYBBIGDATETIME SYBBIGTIME = 188, /* 0xBC */ #define SYBBIGTIME SYBBIGTIME SYBMSDATE = 40, /* 0x28 */ #define SYBMSDATE SYBMSDATE SYBMSTIME = 41, /* 0x29 */ #define SYBMSTIME SYBMSTIME SYBMSDATETIME2 = 42, /* 0x2A */ #define SYBMSDATETIME2 SYBMSDATETIME2 SYBMSDATETIMEOFFSET = 43, /* 0x2B */ #define SYBMSDATETIMEOFFSET SYBMSDATETIMEOFFSET }; #define SYBAOPCNT 0x4b #define SYBAOPCNTU 0x4c #define SYBAOPSUM 0x4d #define SYBAOPSUMU 0x4e #define SYBAOPAVG 0x4f #define SYBAOPAVGU 0x50 #define SYBAOPMIN 0x51 #define SYBAOPMAX 0x52 /* mssql2k compute operator */ #define SYBAOPCNT_BIG 0x09 #define SYBAOPSTDEV 0x30 #define SYBAOPSTDEVP 0x31 #define SYBAOPVAR 0x32 #define SYBAOPVARP 0x33 #define SYBAOPCHECKSUM_AGG 0x72 #endif typedef unsigned char DBBOOL; typedef char DBCHAR; typedef unsigned char DBBIT; typedef unsigned char DBTINYINT; typedef int16_t DBSMALLINT; typedef int32_t DBINT; typedef int64_t DBBIGINT; typedef unsigned char DBBINARY; typedef tds_sysdep_real32_type DBREAL; typedef tds_sysdep_real64_type DBFLT8; typedef uint16_t DBUSMALLINT; typedef uint32_t DBUINT; typedef uint64_t DBUBIGINT; typedef struct { DBSMALLINT len; char str[256]; } DBVARYCHAR; typedef struct { DBSMALLINT len; unsigned char array[256]; } DBVARYBIN; typedef struct { unsigned char precision; unsigned char scale; unsigned char array[33]; } DBNUMERIC; typedef DBNUMERIC DBDECIMAL; typedef struct { DBINT mnyhigh; DBUINT mnylow; } DBMONEY; typedef struct { DBINT mny4; } DBMONEY4; typedef struct { DBINT dtdays; DBINT dttime; } DBDATETIME; typedef struct { DBUSMALLINT days; /* days since Jan-1-1900 */ DBUSMALLINT minutes; /* minutes since midnight */ } DBDATETIME4; typedef struct { DBUBIGINT time; /**< time, 7 digit precision */ DBINT date; /**< date, 0 = 1900-01-01 */ DBSMALLINT offset; /**< time offset */ DBUSMALLINT time_prec:3; /* fix a problem with some public headers defining _res */ #undef _res DBUSMALLINT _res:10; DBUSMALLINT has_time:1; DBUSMALLINT has_date:1; DBUSMALLINT has_offset:1; } DBDATETIMEALL; #ifdef MSDBLIB # define SQLCHAR SYBCHAR typedef struct { DBUSMALLINT numdays; DBUSMALLINT nummins; } DBDATETIM4; #endif typedef struct tds_dblib_loginrec LOGINREC; #ifndef DOS32X typedef unsigned char BYTE; #endif typedef struct dbtypeinfo { DBINT precision; DBINT scale; } DBTYPEINFO; struct dbstring { BYTE *strtext; DBINT strtotlen; struct dbstring *strnext; }; typedef struct dbstring DBSTRING; /* Used by dbcolinfo */ enum { MAXCOLNAMELEN = 512 }; /* duplicates TDS_SYSNAME_SIZE */ typedef enum { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 } CI_TYPE; typedef struct { DBINT SizeOfStruct; DBCHAR Name[MAXCOLNAMELEN+2]; DBCHAR ActualName[MAXCOLNAMELEN+2]; DBCHAR TableName[MAXCOLNAMELEN+2]; SHORT Type; DBINT UserType; DBINT MaxLength; BYTE Precision; BYTE Scale; BOOL VarLength; BYTE Null; BYTE CaseSensitive; BYTE Updatable; BOOL Identity; } DBCOL; typedef struct { DBINT SizeOfStruct; DBCHAR Name[MAXCOLNAMELEN+2]; DBCHAR ActualName[MAXCOLNAMELEN+2]; DBCHAR TableName[MAXCOLNAMELEN+2]; SHORT Type; DBINT UserType; DBINT MaxLength; BYTE Precision; BYTE Scale; BOOL VarLength; BYTE Null; BYTE CaseSensitive; BYTE Updatable; BOOL Identity; SHORT ServerType; DBINT ServerMaxLength; DBCHAR ServerTypeDeclaration[256]; } DBCOL2; /* end dbcolinfo stuff */ /* a large list of options, DBTEXTSIZE is needed by sybtcl */ #define DBPARSEONLY 0 #define DBESTIMATE 1 #define DBSHOWPLAN 2 #define DBNOEXEC 3 #define DBARITHIGNORE 4 #define DBNOCOUNT 5 #define DBARITHABORT 6 #define DBTEXTLIMIT 7 #define DBBROWSE 8 #define DBOFFSET 9 #define DBSTAT 10 #define DBERRLVL 11 #define DBCONFIRM 12 #define DBSTORPROCID 13 #define DBBUFFER 14 #define DBNOAUTOFREE 15 #define DBROWCOUNT 16 #define DBTEXTSIZE 17 #define DBNATLANG 18 #define DBDATEFORMAT 19 #define DBPRPAD 20 #define DBPRCOLSEP 21 #define DBPRLINELEN 22 #define DBPRLINESEP 23 #define DBLFCONVERT 24 #define DBDATEFIRST 25 #define DBCHAINXACTS 26 #define DBFIPSFLAG 27 #define DBISOLATION 28 #define DBAUTH 29 #define DBIDENTITY 30 #define DBNOIDCOL 31 #define DBDATESHORT 32 #define DBCLIENTCURSORS 33 #define DBSETTIME 34 #define DBQUOTEDIDENT 35 #define DBNUMOPTIONS 36 #define DBPADOFF 0 #define DBPADON 1 #define OFF 0 #define ON 1 #define NOSUCHOPTION 2 #define MAXOPTTEXT 32 typedef struct tds_dblib_dbprocess DBPROCESS; /* * Sybase & Microsoft use different names for the dbdaterec members. * Keep these two structures physically identical in memory. * dbdatecrack() casts one to the other for ease of implementation. * * Giving credit where credit is due, we can acknowledge that * Microsoft chose the better names here, hands down. ("datedmonth"?!) */ struct tds_microsoft_dbdaterec { DBINT year; /* 1753 - 9999 */ DBINT quarter; /* 1 - 4 */ DBINT month; /* 1 - 12 */ DBINT day; /* 1 - 31 */ DBINT dayofyear; /* 1 - 366 */ DBINT week; /* 1 - 54 (for leap years) */ DBINT weekday; /* 1 - 7 (Mon. - Sun.) */ DBINT hour; /* 0 - 23 */ DBINT minute; /* 0 - 59 */ DBINT second; /* 0 - 59 */ DBINT millisecond; /* 0 - 999 */ DBINT tzone; /* -840 - 840 */ }; struct tds_sybase_dbdaterec { DBINT dateyear; /* 1900 and counting */ DBINT quarter; /* 0 - 3 (Microsoft only) */ DBINT datemonth; /* 0 - 11 */ DBINT datedmonth; /* 1 - 31 */ DBINT datedyear; /* 1 - 366 */ DBINT week; /* 1 - 54 (Microsoft only) */ DBINT datedweek; /* 0 - 6 */ DBINT datehour; /* 0 - 23 */ DBINT dateminute; /* 0 - 59 */ DBINT datesecond; /* 0 - 59 */ DBINT datemsecond; /* 0 - 999 */ DBINT datetzone; /* -840 - 840 */ }; struct tds_microsoft_dbdaterec2 { DBINT year; /* 1753 - 9999 */ DBINT quarter; /* 1 - 4 */ DBINT month; /* 1 - 12 */ DBINT day; /* 1 - 31 */ DBINT dayofyear; /* 1 - 366 */ DBINT week; /* 1 - 54 (for leap years) */ DBINT weekday; /* 1 - 7 (Mon. - Sun.) */ DBINT hour; /* 0 - 23 */ DBINT minute; /* 0 - 59 */ DBINT second; /* 0 - 59 */ DBINT nanosecond; /* 0 - 999999999 */ DBINT tzone; /* 0 - 127 (Sybase only) */ }; struct tds_sybase_dbdaterec2 { DBINT dateyear; /* 1900 and counting */ DBINT quarter; /* 0 - 3 (Microsoft only) */ DBINT datemonth; /* 0 - 11 */ DBINT datedmonth; /* 1 - 31 */ DBINT datedyear; /* 1 - 366 */ DBINT week; /* 1 - 54 (Microsoft only) */ DBINT datedweek; /* 0 - 6 */ DBINT datehour; /* 0 - 23 */ DBINT dateminute; /* 0 - 59 */ DBINT datesecond; /* 0 - 59 */ DBINT datensecond; /* 0 - 999999999 */ DBINT datetzone; /* 0 - 127 */ }; #ifdef MSDBLIB typedef struct tds_microsoft_dbdaterec DBDATEREC; typedef struct tds_microsoft_dbdaterec2 DBDATEREC2; #else typedef struct tds_sybase_dbdaterec DBDATEREC; typedef struct tds_sybase_dbdaterec2 DBDATEREC2; #endif typedef int (*EHANDLEFUNC) (DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); typedef int (*MHANDLEFUNC) (DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *proc, int line); /* dbpoll() result codes, sybtcl needs DBRESULT */ #define DBRESULT 1 #define DBNOTIFICATION 2 #define DBTIMEOUT 3 #define DBINTERRUPT 4 /* more sybtcl needs: */ #define DBTXTSLEN 8 /* bind types */ #define CHARBIND 0 #define STRINGBIND 1 #define NTBSTRINGBIND 2 #define VARYCHARBIND 3 #define VARYBINBIND 4 #define TINYBIND 6 #define SMALLBIND 7 #define INTBIND 8 #define FLT8BIND 9 #define REALBIND 10 #define DATETIMEBIND 11 #define SMALLDATETIMEBIND 12 #define MONEYBIND 13 #define SMALLMONEYBIND 14 #define BINARYBIND 15 #define BITBIND 16 #define NUMERICBIND 17 #define DECIMALBIND 18 #define SRCNUMERICBIND 19 #define SRCDECIMALBIND 20 #define DATEBIND 21 #define TIMEBIND 22 #define BIGDATETIMEBIND 23 #define BIGTIMEBIND 24 #define BIGINTBIND 30 #define DATETIME2BIND 31 #define MAXBINDTYPES 32 /* keep last */ #define DBPRCOLSEP 21 #define DBPRLINELEN 22 #define DBRPCNORETURN 0 #define DBRPCRETURN 1 #define DBRPCDEFAULT 2 #define REG_ROW -1 #define MORE_ROWS -1 #define NO_MORE_ROWS -2 #define BUF_FULL -3 #define NO_MORE_RESULTS 2 #define SUCCEED 1 #define FAIL 0 #define DB_IN 1 #define DB_OUT 2 #define DB_QUERYOUT 3 #define DBSINGLE 0 #define DBDOUBLE 1 #define DBBOTH 2 /* remote procedure call (rpc) options */ #define DBRPCRECOMPILE TDS_STATIC_CAST(DBSMALLINT, 0x0001) #define DBRPCRESET TDS_STATIC_CAST(DBSMALLINT, 0x0002) #define DBRPCCURSOR TDS_STATIC_CAST(DBSMALLINT, 0x0008) #if defined(DBLIB_UNIMPLEMENTED) DBBOOL db12hour(DBPROCESS * dbprocess, const char language[]); DBBOOL dbcolbrowse(DBPROCESS * dbprocess, int colnum); RETCODE dbcursor(DBCURSOR * hc, DBINT optype, DBINT bufno, BYTE * table, BYTE * values); RETCODE dbcursorbind(DBCURSOR * hc, int col, int vartype, DBINT varlen, DBINT * poutlen, BYTE * pvaraddr, DBTYPEINFO * typeinfo); void dbcursorclose(DBCURSOR * hc); RETCODE dbcursorcolinfo(DBCURSOR * hc, DBINT column, DBCHAR * colname, DBINT * coltype, DBINT * collen, DBINT * usertype); RETCODE dbcursorfetch(DBCURSOR * hc, DBINT fetchtype, DBINT rownum); RETCODE dbcursorinfo(DBCURSOR * hc, DBINT * ncols, DBINT * nrows); DBCURSOR *dbcursoropen(DBPROCESS * dbprocess, BYTE * stmt, SHORT scollopt, SHORT concuropt, USHORT nrows, DBINT * pstatus); int dbdate4cmp(DBPROCESS * dbprocess, DBDATETIME4 * d1, DBDATETIME4 * d2); RETCODE dbdate4zero(DBPROCESS * dbprocess, DBDATETIME4 * d1); RETCODE dbdatechar(DBPROCESS * dbprocess, char *buf, int datepart, int value); int dbdatename(DBPROCESS * dbprocess, char *buf, int date, DBDATETIME * datetime); char *dateorder(DBPROCESS * dbprocess, char *language); DBINT dbdatepart(DBPROCESS * dbprocess, int datepart, DBDATETIME * datetime); RETCODE dbdatezero(DBPROCESS * dbprocess, DBDATETIME * d1); char *dbdayname(DBPROCESS * dbprocess, char *language, int daynum); int dbgetoff(DBPROCESS * dbprocess, DBUSMALLINT offtype, int startfrom); char *dbqual(DBPROCESS * dbprocess, int tabnum, char *tabname); void dbfreequal(char *qualptr); DBSORTORDER *dbloadsort(DBPROCESS * dbprocess); RETCODE dbfreesort(DBPROCESS * dbprocess, DBSORTORDER * sortorder); RETCODE dbload_xlate(DBPROCESS * dbprocess, char *srv_charset, char *clt_name, DBXLATE ** xlt_tosrv, DBXLATE ** xlt_todisp); RETCODE dbmny4divide(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * quotient); RETCODE dbmny4mul(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * prod); RETCODE dbmnyadd(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * sum); RETCODE dbmnydivide(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * quotient); RETCODE dbmnydown(DBPROCESS * dbproc, DBMONEY * mnyptr, int divisor, int *remainder); RETCODE dbmnyinit(DBPROCESS * dbproc, DBMONEY * mnyptr, int trim, DBBOOL * negative); RETCODE dbmnyndigit(DBPROCESS * dbproc, DBMONEY * mnyptr, DBCHAR * value, DBBOOL * zero); RETCODE dbmnymul(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * prod); RETCODE dbmnydigit(DBPROCESS * dbprocess, DBMONEY * m1, DBCHAR * value, DBBOOL * zero); RETCODE dbmnyscale(DBPROCESS * dbproc, DBMONEY * dest, int multiplier, int addend); RETCODE dbnpcreate(DBPROCESS * dbprocess); RETCODE dbnpdefine(DBPROCESS * dbprocess, DBCHAR * procedure_name, DBSMALLINT namelen); int DBNUMORDERS(DBPROCESS * dbprocess); RETCODE dbpoll(DBPROCESS * dbproc, long milliseconds, DBPROCESS ** ready_dbproc, int *return_reason); int dbordercol(DBPROCESS * dbprocess, int order); RETCODE dbregdrop(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen); RETCODE dbregexec(DBPROCESS * dbproc, DBUSMALLINT options); RETCODE dbreghandle(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, INTFUNCPTR handler); RETCODE dbreginit(DBPROCESS * dbproc, DBCHAR * procedure_name, DBSMALLINT namelen); RETCODE dbreglist(DBPROCESS * dbproc); RETCODE dbregnowatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen); RETCODE dbregparam(DBPROCESS * dbproc, char *param_name, int type, DBINT datalen, BYTE * data); RETCODE dbregwatch(DBPROCESS * dbprocess, DBCHAR * procnm, DBSMALLINT namelen, DBUSMALLINT options); RETCODE dbregwatchlist(DBPROCESS * dbprocess); void dbrpwclr(LOGINREC * login); RETCODE dbrpwset(LOGINREC * login, char *srvname, char *password, int pwlen); DBINT dbreadpage(DBPROCESS * dbprocess, char *p_dbname, DBINT pageno, BYTE * buf); RETCODE dbwritepage(DBPROCESS * dbprocess, char *p_dbname, DBINT pageno, DBINT size, BYTE * buf); RETCODE dbsetdeflang(char *language); int dbstrcmp(DBPROCESS * dbprocess, char *s1, int l1, char *s2, int l2, DBSORTORDER * sort); int dbstrsort(DBPROCESS * dbprocess, char *s1, int l1, char *s2, int l2, DBSORTORDER * sort); DBBOOL dbtabbrowse(DBPROCESS * dbprocess, int tabnum); int dbtabcount(DBPROCESS * dbprocess); char *dbtabname(DBPROCESS * dbprocess, int tabnum); char *dbtabsource(DBPROCESS * dbprocess, int colnum, int *tabnum); RETCODE dbsendpassthru(DBPROCESS * dbprocess, DBVOIDPTR bufp); RETCODE dbrecvpassthru(DBPROCESS * dbprocess, DBVOIDPTR * bufp); RETCODE dbgetloginfo(DBPROCESS * dbprocess, DBLOGINFO ** loginfo); RETCODE dbsetloginfo(LOGINREC * loginrec, DBLOGINFO * loginfo); int dbtsnewlen(DBPROCESS * dbprocess); DBBINARY *dbtsnewval(DBPROCESS * dbprocess); RETCODE dbtsput(DBPROCESS * dbprocess, DBBINARY * newts, int newtslen, int tabnum, char *tabname); RETCODE dbfree_xlate(DBPROCESS * dbprocess, DBXLATE * xlt_tosrv, DBXLATE * clt_todisp); int dbxlate(DBPROCESS * dbprocess, char *src, int srclen, char *dest, int destlen, DBXLATE * xlt, int *srcbytes_used, DBBOOL srcend, int status); RETCODE bcp_moretext(DBPROCESS * dbproc, DBINT size, BYTE * text); RETCODE bcp_writefmt(DBPROCESS * dbproc, const char filename[]); void build_xact_string(char *xact_name, char *service_name, DBINT commid, char *result); RETCODE remove_xact(DBPROCESS * connect, DBINT commid, int n); RETCODE abort_xact(DBPROCESS * connect, DBINT commid); void close_commit(DBPROCESS * connect); RETCODE commit_xact(DBPROCESS * connect, DBINT commid); DBPROCESS *open_commit(LOGINREC * login, char *servername); RETCODE scan_xact(DBPROCESS * connect, DBINT commid); DBINT start_xact(DBPROCESS * connect, char *application_name, char *xact_name, int site_count); DBINT stat_xact(DBPROCESS * connect, DBINT commid); #endif /* define unimplemented */ BYTE *dbadata(DBPROCESS * dbproc, int computeid, int column); DBINT dbadlen(DBPROCESS * dbproc, int computeid, int column); RETCODE dbaltbind(DBPROCESS * dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE * varaddr); RETCODE dbaltbind_ps(DBPROCESS * dbprocess, int computeid, int column, int vartype, DBINT varlen, BYTE * varaddr, DBTYPEINFO * typeinfo); int dbaltcolid(DBPROCESS * dbproc, int computeid, int column); DBINT dbaltlen(DBPROCESS * dbproc, int computeid, int column); int dbaltop(DBPROCESS * dbproc, int computeid, int column); int dbalttype(DBPROCESS * dbproc, int computeid, int column); DBINT dbaltutype(DBPROCESS * dbproc, int computeid, int column); RETCODE dbanullbind(DBPROCESS * dbprocess, int computeid, int column, DBINT * indicator); RETCODE dbbind(DBPROCESS * dbproc, int column, int vartype, DBINT varlen, BYTE * varaddr); RETCODE dbbind_ps(DBPROCESS * dbprocess, int column, int vartype, DBINT varlen, BYTE * varaddr, DBTYPEINFO * typeinfo); int dbbufsize(DBPROCESS * dbprocess); BYTE *dbbylist(DBPROCESS * dbproc, int computeid, int *size); RETCODE dbcancel(DBPROCESS * dbproc); RETCODE dbcanquery(DBPROCESS * dbproc); char *dbchange(DBPROCESS * dbprocess); DBBOOL dbcharsetconv(DBPROCESS * dbprocess); void dbclose(DBPROCESS * dbproc); void dbclrbuf(DBPROCESS * dbproc, DBINT n); RETCODE dbclropt(DBPROCESS * dbproc, int option, const char param[]); RETCODE dbcmd(DBPROCESS * dbproc, const char cmdstring[]); RETCODE dbcmdrow(DBPROCESS * dbproc); #define DBCMDROW(x) dbcmdrow((x)) RETCODE dbtablecolinfo (DBPROCESS *dbproc, DBINT column, DBCOL *pdbcol ); RETCODE dbcolinfo (DBPROCESS *dbproc, CI_TYPE type, DBINT column, DBINT computeid, DBCOL *pdbcol); DBINT dbcollen(DBPROCESS * dbproc, int column); char *dbcolname(DBPROCESS * dbproc, int column); const char *dbacolname(DBPROCESS * dbproc, int computeid, int column); char *dbcolsource(DBPROCESS * dbproc, int colnum); int dbcoltype(DBPROCESS * dbproc, int column); DBTYPEINFO *dbcoltypeinfo(DBPROCESS * dbproc, int column); DBINT dbcolutype(DBPROCESS * dbprocess, int column); DBINT dbconvert(DBPROCESS * dbproc, int srctype, const BYTE * src, DBINT srclen, int desttype, BYTE * dest, DBINT destlen); DBINT dbconvert_ps(DBPROCESS * dbprocess, int srctype, const BYTE * src, DBINT srclen, int desttype, BYTE * dest, DBINT destlen, DBTYPEINFO * typeinfo); BOOL dbiscount(DBPROCESS * dbproc); DBINT dbcount(DBPROCESS * dbproc); #define DBCOUNT(x) dbcount((x)) int dbcurcmd(DBPROCESS * dbproc); #define DBCURCMD(x) dbcurcmd((x)) DBINT dbcurrow(DBPROCESS * dbproc); #define DBCURROW(x) dbcurrow((x)) BYTE *dbdata(DBPROCESS * dbproc, int column); int dbdatecmp(DBPROCESS * dbproc, DBDATETIME * d1, DBDATETIME * d2); RETCODE dbdatecrack(DBPROCESS * dbproc, DBDATEREC * di, DBDATETIME * dt); RETCODE dbanydatecrack(DBPROCESS * dbproc, DBDATEREC2 * di, int type, const void *data); DBINT dbdatlen(DBPROCESS * dbproc, int column); DBBOOL dbdead(DBPROCESS * dbproc); #define DBDEAD(x) dbdead((x)) EHANDLEFUNC dberrhandle(EHANDLEFUNC handler); void dbexit(void); RETCODE dbfcmd(DBPROCESS * dbproc, const char *fmt, ...); DBINT dbfirstrow(DBPROCESS * dbproc); #define DBFIRSTROW(x) dbfirstrow((x)) void dbfreebuf(DBPROCESS * dbproc); char *dbgetchar(DBPROCESS * dbprocess, int n); char *dbgetcharset(DBPROCESS * dbprocess); int dbgetlusername(LOGINREC * login, BYTE * name_buffer, int buffer_len); int dbgetmaxprocs(void); char *dbgetnatlanf(DBPROCESS * dbprocess); int dbgetpacket(DBPROCESS * dbproc); RETCODE dbgetrow(DBPROCESS * dbproc, DBINT row); int dbgettime(void); #define DBGETTIME dbgettime BYTE *dbgetuserdata(DBPROCESS * dbproc); DBBOOL dbhasretstat(DBPROCESS * dbproc); RETCODE dbinit(void); int dbiordesc(DBPROCESS * dbproc); #define DBIORDESC(x) dbiordesc((x)) int dbiowdesc(DBPROCESS * dbproc); #define DBIOWDESC(x) dbiowdesc((x)) DBBOOL dbisavail(DBPROCESS * dbprocess); #define DBISAVAIL(x) dbisavail((x)) DBBOOL dbisopt(DBPROCESS * dbproc, int option, const char param[]); DBINT dblastrow(DBPROCESS * dbproc); #define DBLASTROW(x) dblastrow((x)) LOGINREC *dblogin(void); void dbloginfree(LOGINREC * login); int dbmny4cmp(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2); int dbmnycmp(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2); RETCODE dbmny4add(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * sum); RETCODE dbmnydec(DBPROCESS * dbproc, DBMONEY * mnyptr); RETCODE dbmnyinc(DBPROCESS * dbproc, DBMONEY * mnyptr); RETCODE dbmnymaxpos(DBPROCESS * dbproc, DBMONEY * dest); RETCODE dbmnymaxneg(DBPROCESS * dbproc, DBMONEY * dest); RETCODE dbmny4minus(DBPROCESS * dbproc, DBMONEY4 * src, DBMONEY4 * dest); RETCODE dbmnyminus(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest); RETCODE dbmny4sub(DBPROCESS * dbproc, DBMONEY4 * m1, DBMONEY4 * m2, DBMONEY4 * diff); RETCODE dbmnysub(DBPROCESS * dbproc, DBMONEY * m1, DBMONEY * m2, DBMONEY * diff); RETCODE dbmny4copy(DBPROCESS * dbprocess, DBMONEY4 * m1, DBMONEY4 * m2); RETCODE dbmnycopy(DBPROCESS * dbproc, DBMONEY * src, DBMONEY * dest); RETCODE dbmny4zero(DBPROCESS * dbproc, DBMONEY4 * dest); RETCODE dbmnyzero(DBPROCESS * dbproc, DBMONEY * dest); const char *dbmonthname(DBPROCESS * dbproc, char *language, int monthnum, DBBOOL shortform); RETCODE dbmorecmds(DBPROCESS * dbproc); #define DBMORECMDS(x) dbmorecmds((x)) RETCODE dbmoretext(DBPROCESS * dbproc, DBINT size, const BYTE text[]); MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler); char *dbname(DBPROCESS * dbproc); STATUS dbnextrow(DBPROCESS * dbproc); RETCODE dbnullbind(DBPROCESS * dbproc, int column, DBINT * indicator); int dbnumalts(DBPROCESS * dbproc, int computeid); int dbnumcols(DBPROCESS * dbproc); int dbnumcompute(DBPROCESS * dbprocess); int dbnumrets(DBPROCESS * dbproc); DBPROCESS *tdsdbopen(LOGINREC * login, const char *server, int msdblib); DBPROCESS *dbopen(LOGINREC * login, const char *server); /* pivot functions */ struct col_t; void dbpivot_count (struct col_t *output, const struct col_t *input); void dbpivot_sum (struct col_t *output, const struct col_t *input); void dbpivot_min (struct col_t *output, const struct col_t *input); void dbpivot_max (struct col_t *output, const struct col_t *input); struct pivot_t; typedef void (*DBPIVOT_FUNC)(struct col_t *output, const struct col_t *input); struct pivot_t * dbrows_pivoted(DBPROCESS *dbproc); STATUS dbnextrow_pivoted(DBPROCESS *dbproc, struct pivot_t *pp); RETCODE dbpivot(DBPROCESS *dbproc, int nkeys, int *keys, int ncols, int *cols, DBPIVOT_FUNC func, int val); DBPIVOT_FUNC dbpivot_lookup_name( const char name[] ); #ifdef MSDBLIB #define dbopen(x,y) tdsdbopen((x),(y), 1) #else #define dbopen(x,y) tdsdbopen((x),(y), 0) #endif /* fix PHP problem */ #ifdef PHP_SYBASE_DBOPEN #undef PHP_SYBASE_DBOPEN #define PHP_SYBASE_DBOPEN dbopen #endif void dbprhead(DBPROCESS * dbproc); DBINT dbprcollen(DBPROCESS * dbproc, int column); RETCODE dbprrow(DBPROCESS * dbproc); const char *dbprtype(int token); DBBOOL DRBUF(DBPROCESS * dbprocess); STATUS dbreadtext(DBPROCESS * dbproc, void *buf, DBINT bufsize); void dbrecftos(const char filename[]); RETCODE dbresults(DBPROCESS * dbproc); RETCODE dbresults_r(DBPROCESS * dbproc, int recursive); BYTE *dbretdata(DBPROCESS * dbproc, int retnum); int dbretlen(DBPROCESS * dbproc, int retnum); char *dbretname(DBPROCESS * dbproc, int retnum); DBINT dbretstatus(DBPROCESS * dbproc); int dbrettype(DBPROCESS * dbproc, int retnum); RETCODE dbrows(DBPROCESS * dbproc); #define DBROWS(x) dbrows((x)) STATUS dbrowtype(DBPROCESS * dbprocess); #define DBROWTYPE(x) dbrowtype((x)) RETCODE dbrpcinit(DBPROCESS * dbproc, const char rpcname[], DBSMALLINT options); RETCODE dbrpcparam(DBPROCESS * dbproc, const char paramname[], BYTE status, int type, DBINT maxlen, DBINT datalen, BYTE * value); RETCODE dbrpcsend(DBPROCESS * dbproc); RETCODE dbsafestr(DBPROCESS * dbproc, const char *src, DBINT srclen, char *dest, DBINT destlen, int quotetype); RETCODE *dbsechandle(DBINT type, INTFUNCPTR handler); char *dbservcharset(DBPROCESS * dbprocess); void dbsetavail(DBPROCESS * dbprocess); void dbsetbusy(DBPROCESS * dbprocess, DB_DBBUSY_FUNC busyfunc); RETCODE dbsetdefcharset(char *charset); void dbsetidle(DBPROCESS * dbprocess, DB_DBIDLE_FUNC idlefunc); void dbsetifile(char *filename); void dbsetinterrupt(DBPROCESS * dbproc, DB_DBCHKINTR_FUNC chkintr, DB_DBHNDLINTR_FUNC hndlintr); RETCODE dbsetlogintime(int seconds); RETCODE dbsetmaxprocs(int maxprocs); RETCODE dbsetnull(DBPROCESS * dbprocess, int bindtype, int bindlen, BYTE * bindval); RETCODE dbsetopt(DBPROCESS * dbproc, int option, const char *char_param, int int_param); STATUS dbsetrow(DBPROCESS * dbprocess, DBINT row); RETCODE dbsettime(int seconds); void dbsetuserdata(DBPROCESS * dbproc, BYTE * ptr); RETCODE dbsetversion(DBINT version); int dbspid(DBPROCESS * dbproc); RETCODE dbspr1row(DBPROCESS * dbproc, char *buffer, DBINT buf_len); DBINT dbspr1rowlen(DBPROCESS * dbproc); RETCODE dbsprhead(DBPROCESS * dbproc, char *buffer, DBINT buf_len); RETCODE dbsprline(DBPROCESS * dbproc, char *buffer, DBINT buf_len, DBCHAR line_char); RETCODE dbsqlexec(DBPROCESS * dbproc); RETCODE dbsqlok(DBPROCESS * dbproc); RETCODE dbsqlsend(DBPROCESS * dbproc); int dbstrbuild(DBPROCESS * dbproc, char *charbuf, int bufsize, char *text, char *formats, ...); RETCODE dbstrcpy(DBPROCESS * dbproc, int start, int numbytes, char *dest); int dbstrlen(DBPROCESS * dbproc); DBINT dbvarylen(DBPROCESS * dbproc, int column); #define SYBEVERDOWN 100 /* TDS version downgraded . */ #define SYBEICONVIU 2400 /* Some character(s) could not be converted into client's character set. */ #define SYBEICONVAVAIL 2401 /* Character set conversion is not available between client character set '%.*s' and server character set '%.*s'.*/ #define SYBEICONVO 2402 /* Error converting characters into server's character set. Some character(s) could not be converted.*/ #define SYBEICONVI 2403 /* Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?').*/ #define SYBEICONV2BIG 2404 /* Buffer overflow converting characters from client into server's character set.*/ /* cf. doc/dblib_errors.txt for more iconv error values. */ /* Reserve a few slots for other iconv-related issues. */ #define SYBETDSVER 2410 /* Cannot bcp with TDSVER < 5.0 */ #define SYBEPORT 2500 /* Both port and instance specified */ #define SYBESYNC 20001 /* Read attempted while out of synchronization with SQL Server. */ #define SYBEFCON 20002 /* SQL Server connection failed. */ #define SYBETIME 20003 /* SQL Server connection timed out. */ #define SYBEREAD 20004 /* Read from SQL Server failed. */ #define SYBEBUFL 20005 /* DB-LIBRARY internal error - send buffer length corrupted. */ #define SYBEWRIT 20006 /* Write to SQL Server failed. */ #define SYBEVMS 20007 /* Sendflush: VMS I/O error. */ #define SYBESOCK 20008 /* Unable to open socket */ #define SYBECONN 20009 /* Unable to connect socket -- SQL Server is unavailable or does not exist. */ #define SYBEMEM 20010 /* Unable to allocate sufficient memory */ #define SYBEDBPS 20011 /* Maximum number of DBPROCESSes already allocated. */ #define SYBEINTF 20012 /* Server name not found in interface file */ #define SYBEUHST 20013 /* Unknown host machine name */ #define SYBEPWD 20014 /* Incorrect password. */ #define SYBEOPIN 20015 /* Could not open interface file. */ #define SYBEINLN 20016 /* Interface file: unexpected end-of-line. */ #define SYBESEOF 20017 /* Unexpected EOF from SQL Server. */ #define SYBESMSG 20018 /* General SQL Server error: Check messages from the SQL Server. */ #define SYBERPND 20019 /* Attempt to initiate a new SQL Server operation with results pending. */ #define SYBEBTOK 20020 /* Bad token from SQL Server: Data-stream processing out of sync. */ #define SYBEITIM 20021 /* Illegal timeout value specified. */ #define SYBEOOB 20022 /* Error in sending out-of-band data to SQL Server. */ #define SYBEBTYP 20023 /* Unknown bind type passed to DB-LIBRARY function. */ #define SYBEBNCR 20024 /* Attempt to bind user variable to a non-existent compute row. */ #define SYBEIICL 20025 /* Illegal integer column length returned by SQL Server. Legal integer lengths are 1, 2, and 4 bytes. */ #define SYBECNOR 20026 /* Column number out of range. */ #define SYBENPRM 20027 /* NULL parameter not allowed for this dboption. */ #define SYBEUVDT 20028 /* Unknown variable-length datatype encountered. */ #define SYBEUFDT 20029 /* Unknown fixed-length datatype encountered. */ #define SYBEWAID 20030 /* DB-LIBRARY internal error: ALTFMT following ALTNAME has wrong id. */ #define SYBECDNS 20031 /* Datastream indicates that a compute column is derived from a non-existent select-list member. */ #define SYBEABNC 20032 /* Attempt to bind to a non-existent column. */ #define SYBEABMT 20033 /* User attempted a dbbind() with mismatched column and variable types. */ #define SYBEABNP 20034 /* Attempt to bind using NULL pointers. */ #define SYBEAAMT 20035 /* User attempted a dbaltbind() with mismatched column and variable types. */ #define SYBENXID 20036 /* The Server did not grant us a distributed-transaction ID. */ #define SYBERXID 20037 /* The Server did not recognize our distributed-transaction ID. */ #define SYBEICN 20038 /* Invalid computeid or compute column number. */ #define SYBENMOB 20039 /* No such member of 'order by' clause. */ #define SYBEAPUT 20040 /* Attempt to print unknown token. */ #define SYBEASNL 20041 /* Attempt to set fields in a null loginrec. */ #define SYBENTLL 20042 /* Name too long for loginrec field. */ #define SYBEASUL 20043 /* Attempt to set unknown loginrec field. */ #define SYBERDNR 20044 /* Attempt to retrieve data from a non-existent row. */ #define SYBENSIP 20045 /* Negative starting index passed to dbstrcpy(). */ #define SYBEABNV 20046 /* Attempt to bind to a NULL program variable. */ #define SYBEDDNE 20047 /* DBPROCESS is dead or not enabled. */ #define SYBECUFL 20048 /* Data-conversion resulted in underflow. */ #define SYBECOFL 20049 /* Data-conversion resulted in overflow. */ #define SYBECSYN 20050 /* Attempt to convert data stopped by syntax error in source field. */ #define SYBECLPR 20051 /* Data-conversion resulted in loss of precision. */ #define SYBECNOV 20052 /* Attempt to set variable to NULL resulted in overflow. */ #define SYBERDCN 20053 /* Requested data-conversion does not exist. */ #define SYBESFOV 20054 /* dbsafestr() overflowed its destination buffer. */ #define SYBEUNT 20055 /* Unknown network type found in interface file. */ #define SYBECLOS 20056 /* Error in closing network connection. */ #define SYBEUAVE 20057 /* Unable to allocate VMS event flag. */ #define SYBEUSCT 20058 /* Unable to set communications timer. */ #define SYBEEQVA 20059 /* Error in queueing VMS AST routine. */ #define SYBEUDTY 20060 /* Unknown datatype encountered. */ #define SYBETSIT 20061 /* Attempt to call dbtsput() with an invalid timestamp. */ #define SYBEAUTN 20062 /* Attempt to update the timestamp of a table which has no timestamp column. */ #define SYBEBDIO 20063 /* Bad bulk-copy direction. Must be either IN or OUT. */ #define SYBEBCNT 20064 /* Attempt to use Bulk Copy with a non-existent Server table. */ #define SYBEIFNB 20065 /* Illegal field number passed to bcp_control(). */ #define SYBETTS 20066 /* The table which bulk-copy is attempting to copy to a host-file is shorter than the number of rows which bulk-copy was instructed to skip. */ #define SYBEKBCO 20067 /* 1000 rows successfully bulk-copied to host-file. */ #define SYBEBBCI 20068 /* Batch successfully bulk-copied to SQL Server. */ #define SYBEKBCI 20069 /* Bcp: 1000 rows sent to SQL Server. */ #define SYBEBCRE 20070 /* I/O error while reading bcp data-file. */ #define SYBETPTN 20071 /* Syntax error: only two periods are permitted in table names. */ #define SYBEBCWE 20072 /* I/O error while writing bcp data-file. */ #define SYBEBCNN 20073 /* Attempt to bulk-copy a NULL value into Server column %d, which does not accept NULL values. */ #define SYBEBCOR 20074 /* Attempt to bulk-copy an oversized row to the SQL Server. */ #define SYBEBCIS 20075 /* Attempt to bulk-copy an illegally-sized column value to the SQL Server. */ #define SYBEBCPI 20076 /* bcp_init() must be called before any other bcp routines. */ #define SYBEBCPN 20077 /* bcp_bind(), bcp_collen(), bcp_colptr(), bcp_moretext() and bcp_sendrow() may be used only after bcp_init() has been called with the copy direction set to DB_IN. */ #define SYBEBCPB 20078 /* bcp_bind(), bcp_moretext() and bcp_sendrow() may NOT be used after bcp_init() has been passed a non-NULL input file name. */ #define SYBEVDPT 20079 /* For bulk copy, all variable-length data must have either a length-prefix or a terminator specified. */ #define SYBEBIVI 20080 /* bcp_columns(), bcp_colfmt() and bcp_colfmt_ps() may be used only after bcp_init() has been passed a valid input file. */ #define SYBEBCBC 20081 /* bcp_columns() must be called before bcp_colfmt() and bcp_colfmt_ps(). */ #define SYBEBCFO 20082 /* Bcp host-files must contain at least one column. */ #define SYBEBCVH 20083 /* bcp_exec() may be called only after bcp_init() has been passed a valid host file. */ #define SYBEBCUO 20084 /* Bcp: Unable to open host data-file. */ #define SYBEBCUC 20085 /* Bcp: Unable to close host data-file. */ #define SYBEBUOE 20086 /* Bcp: Unable to open error-file. */ #define SYBEBUCE 20087 /* Bcp: Unable to close error-file. */ #define SYBEBWEF 20088 /* I/O error while writing bcp error-file. */ #define SYBEASTF 20089 /* VMS: Unable to setmode for control_c ast. */ #define SYBEUACS 20090 /* VMS: Unable to assign channel to sys$command. */ #define SYBEASEC 20091 /* Attempt to send an empty command buffer to the SQL Server. */ #define SYBETMTD 20092 /* Attempt to send too much TEXT data via the dbmoretext() call. */ #define SYBENTTN 20093 /* Attempt to use dbtxtsput() to put a new text-timestamp into a non-existent data row. */ #define SYBEDNTI 20094 /* Attempt to use dbtxtsput() to put a new text-timestamp into a column whose datatype is neither SYBTEXT nor SYBIMAGE. */ #define SYBEBTMT 20095 /* Attempt to send too much TEXT data via the bcp_moretext() call. */ #define SYBEORPF 20096 /* Attempt to set remote password would overflow the login-record's remote-password field. */ #define SYBEUVBF 20097 /* Attempt to read an unknown version of BCP format-file. */ #define SYBEBUOF 20098 /* Bcp: Unable to open format-file. */ #define SYBEBUCF 20099 /* Bcp: Unable to close format-file. */ #define SYBEBRFF 20100 /* I/O error while reading bcp format-file. */ #define SYBEBWFF 20101 /* I/O error while writing bcp format-file. */ #define SYBEBUDF 20102 /* Bcp: Unrecognized datatype found in format-file. */ #define SYBEBIHC 20103 /* Incorrect host-column number found in bcp format-file. */ #define SYBEBEOF 20104 /* Unexpected EOF encountered in BCP data-file. */ #define SYBEBCNL 20105 /* Negative length-prefix found in BCP data-file. */ #define SYBEBCSI 20106 /* Host-file columns may be skipped only when copying INto the Server. */ #define SYBEBCIT 20107 /* It's illegal to use BCP terminators with program variables other than SYBCHAR, SYBBINARY, SYBTEXT, or SYBIMAGE. */ #define SYBEBCSA 20108 /* The BCP hostfile '%s' contains only %ld rows. Skipping all of these rows is not allowed. */ #define SYBENULL 20109 /* NULL DBPROCESS pointer passed to DB-Library. */ #define SYBEUNAM 20110 /* Unable to get current username from operating system. */ #define SYBEBCRO 20111 /* The BCP hostfile '%s' contains only %ld rows. It was impossible to read the requested %ld rows. */ #define SYBEMPLL 20112 /* Attempt to set maximum number of DBPROCESSes lower than 1. */ #define SYBERPIL 20113 /* It is illegal to pass -1 to dbrpcparam() for the datalen of parameters which are of type SYBCHAR, SYBVARCHAR, SYBBINARY, or SYBVARBINARY. */ #define SYBERPUL 20114 /* When passing a SYBINTN, SYBDATETIMN, SYBMONEYN, or SYBFLTN parameter via dbrpcparam(), it's necessary to specify the parameter's maximum or actual length, so that DB-Library can recognize it as a SYBINT1, SYBINT2, SYBINT4, SYBMONEY, or SYBMONEY4, etc. */ #define SYBEUNOP 20115 /* Unknown option passed to dbsetopt(). */ #define SYBECRNC 20116 /* The current row is not a result of compute clause %d, so it is illegal to attempt to extract that data from this row. */ #define SYBERTCC 20117 /* dbreadtext() may not be used to receive the results of a query which contains a COMPUTE clause. */ #define SYBERTSC 20118 /* dbreadtext() may only be used to receive the results of a query which contains a single result column. */ #define SYBEUCRR 20119 /* Internal software error: Unknown connection result reported by * dbpasswd(). */ #define SYBERPNA 20120 /* The RPC facility is available only when using a SQL Server whose version number is 4.0 or greater. */ #define SYBEOPNA 20121 /* The text/image facility is available only when using a SQL Server whose version number is 4.0 or greater. */ #define SYBEFGTL 20122 /* Bcp: Row number of the first row to be copied cannot be greater than the row number for the last row to be copied. */ #define SYBECWLL 20123 /* Attempt to set column width less than 1. */ #define SYBEUFDS 20124 /* Unrecognized format encountered in dbstrbuild(). */ #define SYBEUCPT 20125 /* Unrecognized custom-format parameter-type encountered in dbstrbuild(). */ #define SYBETMCF 20126 /* Attempt to install too many custom formats via dbfmtinstall(). */ #define SYBEAICF 20127 /* Error in attempting to install custom format. */ #define SYBEADST 20128 /* Error in attempting to determine the size of a pair of translation tables. */ #define SYBEALTT 20129 /* Error in attempting to load a pair of translation tables. */ #define SYBEAPCT 20130 /* Error in attempting to perform a character-set translation. */ #define SYBEXOCI 20131 /* A character-set translation overflowed its destination buffer while using bcp to copy data from a host-file to the SQL Server. */ #define SYBEFSHD 20132 /* Error in attempting to find the Sybase home directory. */ #define SYBEAOLF 20133 /* Error in attempting to open a localization file. */ #define SYBEARDI 20134 /* Error in attempting to read datetime information from a localization file. */ #define SYBEURCI 20135 /* Unable to read copyright information from the dblib localization file. */ #define SYBEARDL 20136 /* Error in attempting to read the dblib.loc localization file. */ #define SYBEURMI 20137 /* Unable to read money-format information from the dblib localization file. */ #define SYBEUREM 20138 /* Unable to read error mnemonic from the dblib localization file. */ #define SYBEURES 20139 /* Unable to read error string from the dblib localization file. */ #define SYBEUREI 20140 /* Unable to read error information from the dblib localization file. */ #define SYBEOREN 20141 /* Warning: an out-of-range error-number was encountered in dblib.loc. The maximum permissible error-number is defined as DBERRCOUNT in sybdb.h. */ #define SYBEISOI 20142 /* Invalid sort-order information found. */ #define SYBEIDCL 20143 /* Illegal datetime column length returned by DataServer. Legal datetime lengths are 4 and 8 bytes. */ #define SYBEIMCL 20144 /* Illegal money column length returned by DataServer. Legal money lengths are 4 and 8 bytes. */ #define SYBEIFCL 20145 /* Illegal floating-point column length returned by DataServer. Legal floating-point lengths are 4 and 8 bytes. */ #define SYBEUTDS 20146 /* Unrecognized TDS version received from SQL Server. */ #define SYBEBUFF 20147 /* Bcp: Unable to create format-file. */ #define SYBEACNV 20148 /* Attemp to do conversion with NULL destination variable. */ #define SYBEDPOR 20149 /* Out-of-range datepart constant. */ #define SYBENDC 20150 /* Cannot have negative component in date in numeric form. */ #define SYBEMVOR 20151 /* Month values must be between 1 and 12. */ #define SYBEDVOR 20152 /* Day values must be between 1 and 7. */ #define SYBENBVP 20153 /* Cannot pass dbsetnull() a NULL bindval pointer. */ #define SYBESPID 20154 /* Called dbspid() with a NULL dbproc. */ #define SYBENDTP 20155 /* Called dbdatecrack() with a NULL datetime parameter. */ #define SYBEXTN 20156 /* The xlt_todisp and xlt_tosrv parameters to dbfree_xlate() were NULL. */ #define SYBEXTDN 20157 /* Warning: the xlt_todisp parameter to dbfree_xlate() was NULL. The space associated with the xlt_tosrv parameter has been freed. */ #define SYBEXTSN 20158 /* Warning: the xlt_tosrv parameter to dbfree_xlate() was NULL. The space associated with the xlt_todisp parameter has been freed. */ #define SYBENUM 20159 /* Incorrect number of arguments given to DB-Library. */ #define SYBETYPE 20160 /* Invalid argument type given to DB-Library. */ #define SYBEGENOS 20161 /* General Operating System Error. */ #define SYBEPAGE 20162 /* wrong resource type or length given for dbpage() operation. */ #define SYBEOPTNO 20163 /* Option is not allowed or is unreconized */ #define SYBEETD 20164 /* Failure to send the expected amount of TEXT or IMAGE data via dbmoretext(). */ #define SYBERTYPE 20165 /* Invalid resource type given to DB-Library. */ #define SYBERFILE 20166 /* "Can not open resource file." */ #define SYBEFMODE 20167 /* Read/Write/Append mode denied on file. */ #define SYBESLCT 20168 /* Could not select or copy field specified */ #define SYBEZTXT 20169 /* Attempt to send zero length TEXT or IMAGE to dataserver via dbwritetext(). */ #define SYBENTST 20170 /* The file being opened must be a stream_lf. */ #define SYBEOSSL 20171 /* Operating system login level not in range of Secure SQL Server */ #define SYBEESSL 20172 /* Login security level entered does not agree with operating system level */ #define SYBENLNL 20173 /* Program not linked with specified network library. */ #define SYBENHAN 20174 /* called dbrecvpassthru() with a NULL handler parameter. */ #define SYBENBUF 20175 /* called dbsendpassthru() with a NULL buf pointer. */ #define SYBENULP 20176 /* Called %s with a NULL %s parameter. */ #define SYBENOTI 20177 /* No event handler installed. */ #define SYBEEVOP 20178 /* Called dbregwatch() with a bad options parameter. */ #define SYBENEHA 20179 /* Called dbreghandle() with a NULL handler parameter. */ #define SYBETRAN 20180 /* DBPROCESS is being used for another transaction. */ #define SYBEEVST 20181 /* Must initiate a transaction before calling dbregparam(). */ #define SYBEEINI 20182 /* Must call dbreginit() before dbregraise(). */ #define SYBEECRT 20183 /* Must call dbregdefine() before dbregcreate(). */ #define SYBEECAN 20184 /* Attempted to cancel unrequested event notification. */ #define SYBEEUNR 20185 /* Unsolicited event notification received. */ #define SYBERPCS 20186 /* Must call dbrpcinit() before dbrpcparam(). */ #define SYBETPAR 20187 /* No SYBTEXT or SYBIMAGE parameters were defined. */ #define SYBETEXS 20188 /* Called dbmoretext() with a bad size parameter. */ #define SYBETRAC 20189 /* Attempted to turn off a trace flag that was not on. */ #define SYBETRAS 20190 /* DB-Library internal error - trace structure not found. */ #define SYBEPRTF 20191 /* dbtracestring() may only be called from a printfunc(). */ #define SYBETRSN 20192 /* Bad numbytes parameter passed to dbtracestring(). */ #define SYBEBPKS 20193 /* In DBSETLPACKET(), the packet size parameter must be between 0 and 999999. */ #define SYBEIPV 20194 /* %1! is an illegal value for the %2! parameter of %3!. */ #define SYBEMOV 20195 /* Money arithmetic resulted in overflow in function %1!. */ #define SYBEDIVZ 20196 /* Attempt to divide by $0.00 in function %1!. */ #define SYBEASTL 20197 /* Synchronous I/O attempted at AST level. */ #define SYBESEFA 20198 /* DBSETNOTIFS cannot be called if connections are present. */ #define SYBEPOLL 20199 /* Only one dbpoll() can be active at a time. */ #define SYBENOEV 20200 /* dbpoll() cannot be called if registered procedure notifications have been disabled. */ #define SYBEBADPK 20201 /* Packet size of %1! not supported. -- size of %2! used instead. */ #define SYBESECURE 20202 /* Secure Server function not supported in this version. */ #define SYBECAP 20203 /* DB-Library capabilities not accepted by the Server. */ #define SYBEFUNC 20204 /* Functionality not supported at the specified version level. */ #define SYBERESP 20205 /* Response function address passed to dbresponse() must be non-NULL. */ #define SYBEIVERS 20206 /* Illegal version level specified. */ #define SYBEONCE 20207 /* Function can be called only once. */ #define SYBERPNULL 20208 /* value parameter for dbprcparam() can be NULL, only if the datalen parameter is 0 */ #define SYBERPTXTIM 20209 /* RPC parameters cannot be of type Text/Image. */ #define SYBENEG 20210 /* Negotiated login attempt failed. */ #define SYBELBLEN 20211 /* Security labels should be less than 256 characters long. */ #define SYBEUMSG 20212 /* Unknown message-id in MSG datastream. */ #define SYBECAPTYP 20213 /* Unexpected capability type in CAPABILITY datastream. */ #define SYBEBNUM 20214 /* Bad numbytes parameter passed to dbstrcpy() */ #define SYBEBBL 20215 /* Bad bindlen parameter passed to dbsetnull() */ #define SYBEBPREC 20216 /* Illegal precision specified */ #define SYBEBSCALE 20217 /* Illegal scale specified */ #define SYBECDOMAIN 20218 /* Source field value is not within the domain of legal values. */ #define SYBECINTERNAL 20219 /* Internal Conversion error. */ #define SYBEBTYPSRV 20220 /* Datatype is not supported by the server. */ #define SYBEBCSET 20221 /* Unknown character-set encountered." */ #define SYBEFENC 20222 /* Password Encryption failed." */ #define SYBEFRES 20223 /* Challenge-Response function failed.", */ #define SYBEISRVPREC 20224 /* Illegal precision value returned by the server. */ #define SYBEISRVSCL 20225 /* Illegal scale value returned by the server. */ #define SYBEINUMCL 20226 /* Invalid numeric column length returned by the server. */ #define SYBEIDECCL 20227 /* Invalid decimal column length returned by the server. */ #define SYBEBCMTXT 20228 /* bcp_moretext() may be used only when there is at least one text or image column in the server table. */ #define SYBEBCPREC 20229 /* Column %1!: Illegal precision value encountered. */ #define SYBEBCBNPR 20230 /* bcp_bind(): if varaddr is NULL, prefixlen must be 0 and no terminator should be specified. */ #define SYBEBCBNTYP 20231 /* bcp_bind(): if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */ #define SYBEBCSNTYP 20232 /* column number %1!: if varaddr is NULL and varlen greater than 0, the table column type must be SYBTEXT or SYBIMAGE and the program variable type must be SYBTEXT, SYBCHAR, SYBIMAGE or SYBBINARY. */ #define SYBEBCPCTYP 20233 /* bcp_colfmt(): If table_colnum is 0, host_type cannot be 0. */ #define SYBEBCVLEN 20234 /* varlen should be greater than or equal to -1. */ #define SYBEBCHLEN 20235 /* host_collen should be greater than or equal to -1. */ #define SYBEBCBPREF 20236 /* Illegal prefix length. Legal values are 0, 1, 2 or 4. */ #define SYBEBCPREF 20237 /* Illegal prefix length. Legal values are -1, 0, 1, 2 or 4. */ #define SYBEBCITBNM 20238 /* bcp_init(): tblname parameter cannot be NULL. */ #define SYBEBCITBLEN 20239 /* bcp_init(): tblname parameter is too long. */ #define SYBEBCSNDROW 20240 /* bcp_sendrow() may NOT be called unless all text data for the previous row has been sent using bcp_moretext(). */ #define SYBEBPROCOL 20241 /* bcp protocol error: returned column count differs from the actual number of columns received. */ #define SYBEBPRODEF 20242 /* bcp protocol error: expected default information and got none. */ #define SYBEBPRONUMDEF 20243 /* bcp protocol error: expected number of defaults differs from the actual number of defaults received. */ #define SYBEBPRODEFID 20244 /* bcp protocol error: default column id and actual column id are not same */ #define SYBEBPRONODEF 20245 /* bcp protocol error: default value received for column that does not have default. */ #define SYBEBPRODEFTYP 20246 /* bcp protocol error: default value datatype differs from column datatype. */ #define SYBEBPROEXTDEF 20247 /* bcp protocol error: more than one row of default information received. */ #define SYBEBPROEXTRES 20248 /* bcp protocol error: unexpected set of results received. */ #define SYBEBPROBADDEF 20249 /* bcp protocol error: illegal default column id received. */ #define SYBEBPROBADTYP 20250 /* bcp protocol error: unknown column datatype. */ #define SYBEBPROBADLEN 20251 /* bcp protocol error: illegal datatype length received. */ #define SYBEBPROBADPREC 20252 /* bcp protocol error: illegal precision value received. */ #define SYBEBPROBADSCL 20253 /* bcp protocol error: illegal scale value received. */ #define SYBEBADTYPE 20254 /* Illegal value for type parameter given to %1!. */ #define SYBECRSNORES 20255 /* Cursor statement generated no results. */ #define SYBECRSNOIND 20256 /* One of the tables involved in the cursor statement does not have a unique index. */ #define SYBECRSVIEW 20257 /* A view cannot be joined with another table or a view in a cursor statement. */ #define SYBECRSVIIND 20258 /* The view used in the cursor statement does not include all the unique index columns of the underlying tables. */ #define SYBECRSORD 20259 /* Only fully keyset driven cursors can have 'order by', ' group by', or 'having' phrases. */ #define SYBECRSBUFR 20260 /* Row buffering should not be turned on when using cursor APIs. */ #define SYBECRSNOFREE 20261 /* The DBNOAUTOFREE option should not be turned on when using cursor APIs. */ #define SYBECRSDIS 20262 /* Cursor statement contains one of the disallowed phrases 'compute', 'union', 'for browse', or 'select into'. */ #define SYBECRSAGR 20263 /* Aggregate functions are not allowed in a cursor statement. */ #define SYBECRSFRAND 20264 /* Fetch types RANDOM and RELATIVE can only be used within the keyset of keyset driven cursors. */ #define SYBECRSFLAST 20265 /* Fetch type LAST requires fully keyset driven cursors. */ #define SYBECRSBROL 20266 /* Backward scrolling cannot be used in a forward scrolling cursor. */ #define SYBECRSFROWN 20267 /* Row number to be fetched is outside valid range. */ #define SYBECRSBSKEY 20268 /* Keyset cannot be scrolled backward in mixed cursors with a previous fetch type. */ #define SYBECRSRO 20269 /* Data locking or modifications cannot be made in a READONLY cursor. */ #define SYBECRSNOCOUNT 20270 /* The DBNOCOUNT option should not be turned on when doing updates or deletes with dbcursor(). */ #define SYBECRSTAB 20271 /* Table name must be determined in operations involving data locking or modifications. */ #define SYBECRSUPDNB 20272 /* Update or insert operations cannot use bind variables when binding type is NOBIND. */ #define SYBECRSNOWHERE 20273 /* A WHERE clause is not allowed in a cursor update or insert. */ #define SYBECRSSET 20274 /* A SET clause is required for a cursor update or insert. */ #define SYBECRSUPDTAB 20275 /* Update or insert operations using bind variables require single table cursors. */ #define SYBECRSNOUPD 20276 /* Update or delete operation did not affect any rows. */ #define SYBECRSINV 20277 /* Invalid cursor statement. */ #define SYBECRSNOKEYS 20278 /* The entire keyset must be defined for KEYSET cursors. */ #define SYBECRSNOBIND 20279 /* Cursor bind must be called prior to updating cursor */ #define SYBECRSFTYPE 20280 /* Unknown fetch type. */ #define SYBECRSINVALID 20281 /* The cursor handle is invalid. */ #define SYBECRSMROWS 20282 /* Multiple rows are returned, only one is expected. */ #define SYBECRSNROWS 20283 /* No rows returned, at least one is expected. */ #define SYBECRSNOLEN 20284 /* No unique index found. */ #define SYBECRSNOPTCC 20285 /* No OPTCC was found. */ #define SYBECRSNORDER 20286 /* The order of clauses must be from, where, and order by. */ #define SYBECRSNOTABLE 20287 /* Table name is NULL. */ #define SYBECRSNUNIQUE 20288 /* No unique keys associated with this view. */ #define SYBECRSVAR 20289 /* There is no valid address associated with this bind. */ #define SYBENOVALUE 20290 /* Security labels require both a name and a value */ #define SYBEVOIDRET 20291 /* Parameter of type SYBVOID cannot be a return parameter. */ #define SYBECLOSEIN 20292 /* Unable to close interface file. */ #define SYBEBOOL 20293 /* Boolean parameters must be TRUE or FALSE. */ #define SYBEBCPOPT 20294 /* The option cannot be called while a bulk copy operation is progress. */ #define SYBEERRLABEL 20295 /* An illegal value was returned from the security label handler. */ #define SYBEATTNACK 20296 /* Timed out waiting for server to acknowledge attention." */ #define SYBEBBFL 20297 /* -001- Batch failed in bulk-copy to SQL Server */ #define SYBEDCL 20298 /* -004- DCL Error */ #define SYBECS 20299 /* -004- cs context Error */ #define SYBEBULKINSERT 20599 /* cannot build bulk insert statement */ #define SYBECOLSIZE 22000 /* Invalid column information structure size */ int dbtds(DBPROCESS * dbprocess); #define DBTDS(a) dbtds(a) DBINT dbtextsize(DBPROCESS * dbprocess); DBBINARY *dbtxptr(DBPROCESS * dbproc, int column); DBBINARY *dbtxtimestamp(DBPROCESS * dbproc, int column); DBBINARY *dbtxtsnewval(DBPROCESS * dbprocess); RETCODE dbtxtsput(DBPROCESS * dbprocess, DBBINARY newtxts, int colnum); RETCODE dbuse(DBPROCESS * dbproc, const char *name); const char *dbversion(void); DBBOOL dbwillconvert(int srctype, int desttype); RETCODE dbwritetext(DBPROCESS * dbproc, char *objname, DBBINARY * textptr, DBTINYINT textptrlen, DBBINARY * timestamp, DBBOOL log, DBINT size, BYTE * text); /* LOGINREC manipulation */ RETCODE dbsetlname(LOGINREC * login, const char *value, int which); RETCODE dbsetlbool(LOGINREC * login, int value, int which); RETCODE dbsetlshort(LOGINREC * login, int value, int which); RETCODE dbsetllong(LOGINREC * login, long value, int which); RETCODE dbsetlversion (LOGINREC * login, BYTE version); #define DBSETHOST 1 #define DBSETLHOST(x,y) dbsetlname((x), (y), DBSETHOST) #define dbsetlhost(x,y) dbsetlname((x), (y), DBSETHOST) #define DBSETUSER 2 #define DBSETLUSER(x,y) dbsetlname((x), (y), DBSETUSER) #define dbsetluser(x,y) dbsetlname((x), (y), DBSETUSER) #define DBSETPWD 3 #define DBSETLPWD(x,y) dbsetlname((x), (y), DBSETPWD) #define dbsetlpwd(x,y) dbsetlname((x), (y), DBSETPWD) #if defined(DBLIB_UNIMPLEMENTED) # define DBSETHID 4 /* not implemented */ # define DBSETLHID(x,y) dbsetlname((x), (y), DBSETHID) #endif #define DBSETAPP 5 #define DBSETLAPP(x,y) dbsetlname((x), (y), DBSETAPP) #define dbsetlapp(x,y) dbsetlname((x), (y), DBSETAPP) #define DBSETBCP 6 #define BCP_SETL(x,y) dbsetlbool((x), (y), DBSETBCP) #define DBSETLSECURE(x) dbsetlbool((x), (1), DBSETBCP) #define DBSETNATLANG 7 #define DBSETLNATLANG(x,y) dbsetlname((x), (y), DBSETNATLANG) #define dbsetlnatlang(x,y) dbsetlname((x), (y), DBSETNATLANG) #if defined(DBLIB_UNIMPLEMENTED) # define DBSETNOSHORT 8 /* not implemented */ # define DBSETLNOSHORT(x,y) dbsetlbool((x), (y), DBSETNOSHORT) # define DBSETHIER 9 /* not implemented */ # define DBSETLHIER(x,y) dbsetlshort((x), (y), DBSETHIER) #endif #define DBSETCHARSET 10 #define DBSETLCHARSET(x,y) dbsetlname((x), (y), DBSETCHARSET) #define DBSETPACKET 11 #define DBSETLPACKET(x,y) dbsetllong((x), (y), DBSETPACKET) #define dbsetlpacket(x,y) dbsetllong((x), (y), DBSETPACKET) #define DBSETENCRYPT 12 #define DBSETLENCRYPT(x,y) dbsetlbool((x), (y), DBSETENCRYPT) #define DBSETLABELED 13 #define DBSETLLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED) #define BCP_SETLABELED(x,y) dbsetlbool((x), (y), DBSETLABELED) #define DBSETDBNAME 14 #define DBSETLDBNAME(x,y) dbsetlname((x), (y), DBSETDBNAME) #define DBSETLVERSION(login, version) dbsetlversion((login), (version)) #define DBSETNETWORKAUTH 101 #define DBSETLNETWORKAUTH(x, y) dbsetlbool((x), (y), DBSETNETWORKAUTH) #define DBSETMUTUALAUTH 102 #define DBSETLMUTUALAUTH(x, y) dbsetlbool((x), (y), DBSETMUTUALAUTH) #define DBSETSERVERPRINCIPAL 103 #define DBSETLSERVERPRINCIPAL(x,y) dbsetlname((x), (y), DBSETSERVERPRINCIPAL) /* settings from here are purely FreeTDS extensions */ #define DBSETUTF16 1001 #define DBSETLUTF16(x,y) dbsetlbool((x), (y), DBSETUTF16) #define DBSETNTLMV2 1002 #define DBSETLNTLMV2(x,y) dbsetlbool((x), (y), DBSETNTLMV2) #define DBSETREADONLY 1003 #define DBSETLREADONLY(x,y) dbsetlbool((x), (y), DBSETREADONLY) #define DBSETDELEGATION 1004 #define DBSETLDELEGATION(x, y) dbsetlbool((x), (y), DBSETDELEGATION) RETCODE bcp_init(DBPROCESS * dbproc, const char *tblname, const char *hfile, const char *errfile, int direction); DBINT bcp_done(DBPROCESS * dbproc); DBINT bcp_batch(DBPROCESS * dbproc); RETCODE bcp_bind(DBPROCESS * dbproc, BYTE * varaddr, int prefixlen, DBINT varlen, BYTE * terminator, int termlen, int type, int table_column); RETCODE bcp_collen(DBPROCESS * dbproc, DBINT varlen, int table_column); RETCODE bcp_columns(DBPROCESS * dbproc, int host_colcount); RETCODE bcp_colfmt(DBPROCESS * dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, const BYTE * host_term, int host_termlen, int colnum); RETCODE bcp_colfmt_ps(DBPROCESS * dbproc, int host_column, int host_type, int host_prefixlen, DBINT host_collen, BYTE * host_term, int host_termlen, int colnum, DBTYPEINFO * typeinfo); RETCODE bcp_colptr(DBPROCESS * dbproc, BYTE * colptr, int table_column); RETCODE bcp_control(DBPROCESS * dbproc, int field, DBINT value); int bcp_getbatchsize(DBPROCESS * dbproc); /* FreeTDS only */ RETCODE bcp_exec(DBPROCESS * dbproc, DBINT * rows_copied); DBBOOL bcp_getl(LOGINREC * login); RETCODE bcp_options(DBPROCESS * dbproc, int option, BYTE * value, int valuelen); RETCODE bcp_readfmt(DBPROCESS * dbproc, const char filename[]); RETCODE bcp_sendrow(DBPROCESS * dbproc); #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/sybfront.h000644 025423 025423 00000002323 14056414221 020244 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef SYBFRONT_h #define SYBFRONT_h #include "sybdb.h" #ifdef __cplusplus extern "C" { #if 0 } #endif #endif static const char rcsid_sybfront_h[] = "$Id: sybfront.h,v 1.3 2004-10-28 12:42:12 freddy77 Exp $"; static const void *const no_unused_sybfront_h_warn[] = { rcsid_sybfront_h, no_unused_sybfront_h_warn }; #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/syberror.h000644 025423 025423 00000002777 14056414221 020262 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _syberror_h_ #define _syberror_h_ #ifdef __cplusplus extern "C" { #if 0 } #endif #endif static const char rcsid_syberror_h[] = "$Id: syberror.h,v 1.4 2004-10-28 12:42:12 freddy77 Exp $"; static const void *const no_unused_syberror_h_warn[] = { rcsid_syberror_h, no_unused_syberror_h_warn }; /* severity levels, gleaned from google */ #define EXINFO 1 #define EXUSER 2 #define EXNONFATAL 3 #define EXCONVERSION 4 #define EXSERVER 5 #define EXTIME 6 #define EXPROGRAM 7 #define EXRESOURCE 8 #define EXCOMM 9 #define EXFATAL 10 #define EXCONSISTENCY 11 #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/odbcss.h000644 025423 025423 00000024260 14056414221 017657 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _odbcss_h_ #define _odbcss_h_ #ifdef TDSODBC_BCP #include #endif #ifdef __cplusplus extern "C" { #endif #define SQL_DIAG_SS_MSGSTATE (-1150) #define SQL_DIAG_SS_LINE (-1154) #define SQL_SOPT_SS_QUERYNOTIFICATION_TIMEOUT 1233 #define SQL_SOPT_SS_QUERYNOTIFICATION_MSGTEXT 1234 #define SQL_SOPT_SS_QUERYNOTIFICATION_OPTIONS 1235 #ifndef SQL_SS_LENGTH_UNLIMITED #define SQL_SS_LENGTH_UNLIMITED 0 #endif #ifndef SQL_COPT_SS_BASE #define SQL_COPT_SS_BASE 1200 #endif #ifndef SQL_COPT_SS_MARS_ENABLED #define SQL_COPT_SS_MARS_ENABLED (SQL_COPT_SS_BASE+24) #endif #ifndef SQL_COPT_SS_OLDPWD #define SQL_COPT_SS_OLDPWD (SQL_COPT_SS_BASE+26) #endif #define SQL_INFO_FREETDS_TDS_VERSION 1300 #define SQL_INFO_FREETDS_SOCKET 1301 #ifndef SQL_MARS_ENABLED_NO #define SQL_MARS_ENABLED_NO 0 #endif #ifndef SQL_MARS_ENABLED_YES #define SQL_MARS_ENABLED_YES 1 #endif #ifndef SQL_SS_VARIANT #define SQL_SS_VARIANT (-150) #endif #ifndef SQL_SS_UDT #define SQL_SS_UDT (-151) #endif #ifndef SQL_SS_XML #define SQL_SS_XML (-152) #endif #ifndef SQL_SS_TABLE #define SQL_SS_TABLE (-153) #endif #ifndef SQL_SS_TIME2 #define SQL_SS_TIME2 (-154) #endif #ifndef SQL_SS_TIMESTAMPOFFSET #define SQL_SS_TIMESTAMPOFFSET (-155) #endif /* * these types are used from conversion from client to server */ #ifndef SQL_C_SS_TIME2 #define SQL_C_SS_TIME2 (0x4000) #endif #ifndef SQL_C_SS_TIMESTAMPOFFSET #define SQL_C_SS_TIMESTAMPOFFSET (0x4001) #endif #ifndef SQL_CA_SS_BASE #define SQL_CA_SS_BASE 1200 #endif #ifndef SQL_CA_SS_UDT_CATALOG_NAME #define SQL_CA_SS_UDT_CATALOG_NAME (SQL_CA_SS_BASE+18) #endif #ifndef SQL_CA_SS_UDT_SCHEMA_NAME #define SQL_CA_SS_UDT_SCHEMA_NAME (SQL_CA_SS_BASE+19) #endif #ifndef SQL_CA_SS_UDT_TYPE_NAME #define SQL_CA_SS_UDT_TYPE_NAME (SQL_CA_SS_BASE+20) #endif #ifndef SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME #define SQL_CA_SS_UDT_ASSEMBLY_TYPE_NAME (SQL_CA_SS_BASE+21) #endif #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME #define SQL_CA_SS_XML_SCHEMACOLLECTION_CATALOG_NAME (SQL_CA_SS_BASE+22) #endif #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME #define SQL_CA_SS_XML_SCHEMACOLLECTION_SCHEMA_NAME (SQL_CA_SS_BASE+23) #endif #ifndef SQL_CA_SS_XML_SCHEMACOLLECTION_NAME #define SQL_CA_SS_XML_SCHEMACOLLECTION_NAME (SQL_CA_SS_BASE+24) #endif typedef struct tagSS_TIME2_STRUCT { SQLUSMALLINT hour; SQLUSMALLINT minute; SQLUSMALLINT second; SQLUINTEGER fraction; } SQL_SS_TIME2_STRUCT; typedef struct tagSS_TIMESTAMPOFFSET_STRUCT { SQLSMALLINT year; SQLUSMALLINT month; SQLUSMALLINT day; SQLUSMALLINT hour; SQLUSMALLINT minute; SQLUSMALLINT second; SQLUINTEGER fraction; SQLSMALLINT timezone_hour; SQLSMALLINT timezone_minute; } SQL_SS_TIMESTAMPOFFSET_STRUCT; #ifdef TDSODBC_BCP #ifndef SUCCEED #define SUCCEED 1 #endif #ifndef FAIL #define FAIL 0 #endif #ifndef BCPKEEPIDENTITY #define BCPKEEPIDENTITY 8 #endif #ifndef BCPHINTS #define BCPHINTS 6 #endif #define BCP_DIRECTION_IN 1 #define SQL_COPT_SS_BCP (SQL_COPT_SS_BASE+19) #define SQL_BCP_OFF 0 #define SQL_BCP_ON 1 #define SQL_COPT_TDSODBC_IMPL_BASE 1500 #define SQL_COPT_TDSODBC_IMPL_BCP_INITA (SQL_COPT_TDSODBC_IMPL_BASE) #define SQL_COPT_TDSODBC_IMPL_BCP_CONTROL (SQL_COPT_TDSODBC_IMPL_BASE+1) #define SQL_COPT_TDSODBC_IMPL_BCP_COLPTR (SQL_COPT_TDSODBC_IMPL_BASE+2) #define SQL_COPT_TDSODBC_IMPL_BCP_SENDROW (SQL_COPT_TDSODBC_IMPL_BASE+3) #define SQL_COPT_TDSODBC_IMPL_BCP_BATCH (SQL_COPT_TDSODBC_IMPL_BASE+4) #define SQL_COPT_TDSODBC_IMPL_BCP_DONE (SQL_COPT_TDSODBC_IMPL_BASE+5) #define SQL_COPT_TDSODBC_IMPL_BCP_BIND (SQL_COPT_TDSODBC_IMPL_BASE+6) #define SQL_COPT_TDSODBC_IMPL_BCP_INITW (SQL_COPT_TDSODBC_IMPL_BASE+7) #define SQL_VARLEN_DATA -10 /* copied from sybdb.h which was copied from tds.h */ /* TODO find a much better way... */ enum { BCP_TYPE_SQLCHAR = 47, /* 0x2F */ #define BCP_TYPE_SQLCHAR BCP_TYPE_SQLCHAR BCP_TYPE_SQLVARCHAR = 39, /* 0x27 */ #define BCP_TYPE_SQLVARCHAR BCP_TYPE_SQLVARCHAR BCP_TYPE_SQLINTN = 38, /* 0x26 */ #define BCP_TYPE_SQLINTN BCP_TYPE_SQLINTN BCP_TYPE_SQLINT1 = 48, /* 0x30 */ #define BCP_TYPE_SQLINT1 BCP_TYPE_SQLINT1 BCP_TYPE_SQLINT2 = 52, /* 0x34 */ #define BCP_TYPE_SQLINT2 BCP_TYPE_SQLINT2 BCP_TYPE_SQLINT4 = 56, /* 0x38 */ #define BCP_TYPE_SQLINT4 BCP_TYPE_SQLINT4 BCP_TYPE_SQLINT8 = 127, /* 0x7F */ #define BCP_TYPE_SQLINT8 BCP_TYPE_SQLINT8 BCP_TYPE_SQLFLT8 = 62, /* 0x3E */ #define BCP_TYPE_SQLFLT8 BCP_TYPE_SQLFLT8 BCP_TYPE_SQLDATETIME = 61, /* 0x3D */ #define BCP_TYPE_SQLDATETIME BCP_TYPE_SQLDATETIME BCP_TYPE_SQLBIT = 50, /* 0x32 */ #define BCP_TYPE_SQLBIT BCP_TYPE_SQLBIT BCP_TYPE_SQLBITN = 104, /* 0x68 */ #define BCP_TYPE_SQLBITN BCP_TYPE_SQLBITN BCP_TYPE_SQLTEXT = 35, /* 0x23 */ #define BCP_TYPE_SQLTEXT BCP_TYPE_SQLTEXT BCP_TYPE_SQLNTEXT = 99, /* 0x63 */ #define BCP_TYPE_SQLNTEXT BCP_TYPE_SQLNTEXT BCP_TYPE_SQLIMAGE = 34, /* 0x22 */ #define BCP_TYPE_SQLIMAGE BCP_TYPE_SQLIMAGE BCP_TYPE_SQLMONEY4 = 122, /* 0x7A */ #define BCP_TYPE_SQLMONEY4 BCP_TYPE_SQLMONEY4 BCP_TYPE_SQLMONEY = 60, /* 0x3C */ #define BCP_TYPE_SQLMONEY BCP_TYPE_SQLMONEY BCP_TYPE_SQLDATETIME4 = 58, /* 0x3A */ #define BCP_TYPE_SQLDATETIME4 BCP_TYPE_SQLDATETIME4 BCP_TYPE_SQLREAL = 59, /* 0x3B */ BCP_TYPE_SQLFLT4 = 59, /* 0x3B */ #define BCP_TYPE_SQLREAL BCP_TYPE_SQLREAL #define BCP_TYPE_SQLFLT4 BCP_TYPE_SQLFLT4 BCP_TYPE_SQLBINARY = 45, /* 0x2D */ #define BCP_TYPE_SQLBINARY BCP_TYPE_SQLBINARY BCP_TYPE_SQLVOID = 31, /* 0x1F */ #define BCP_TYPE_SQLVOID BCP_TYPE_SQLVOID BCP_TYPE_SQLVARBINARY = 37, /* 0x25 */ #define BCP_TYPE_SQLVARBINARY BCP_TYPE_SQLVARBINARY BCP_TYPE_SQLNUMERIC = 108, /* 0x6C */ #define BCP_TYPE_SQLNUMERIC BCP_TYPE_SQLNUMERIC BCP_TYPE_SQLDECIMAL = 106, /* 0x6A */ #define BCP_TYPE_SQLDECIMAL BCP_TYPE_SQLDECIMAL BCP_TYPE_SQLFLTN = 109, /* 0x6D */ #define BCP_TYPE_SQLFLTN BCP_TYPE_SQLFLTN BCP_TYPE_SQLMONEYN = 110, /* 0x6E */ #define BCP_TYPE_SQLMONEYN BCP_TYPE_SQLMONEYN BCP_TYPE_SQLDATETIMN = 111, /* 0x6F */ #define BCP_TYPE_SQLDATETIMN BCP_TYPE_SQLDATETIMN BCP_TYPE_SQLNVARCHAR = 103, /* 0x67 */ #define BCP_TYPE_SQLNVARCHAR BCP_TYPE_SQLNVARCHAR BCP_TYPE_SQLUNIQUEID = 36, /* 0x24 */ #define BCP_TYPE_SQLUNIQUEID BCP_TYPE_SQLUNIQUEID BCP_TYPE_SQLDATETIME2 = 42, /* 0x2a */ #define BCP_TYPE_SQLDATETIME2 BCP_TYPE_SQLDATETIME2 }; typedef struct { int dtdays; int dttime; } DBDATETIME; #ifdef _MSC_VER #define TDSODBC_INLINE __inline #else #define TDSODBC_INLINE __inline__ #endif struct tdsodbc_impl_bcp_init_params { const void *tblname; const void *hfile; const void *errfile; int direction; }; static TDSODBC_INLINE RETCODE SQL_API bcp_initA(HDBC hdbc, const char *tblname, const char *hfile, const char *errfile, int direction) { struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITA, ¶ms, SQL_IS_POINTER)) ? SUCCEED : FAIL; } static TDSODBC_INLINE RETCODE SQL_API bcp_initW(HDBC hdbc, const SQLWCHAR *tblname, const SQLWCHAR *hfile, const SQLWCHAR *errfile, int direction) { struct tdsodbc_impl_bcp_init_params params = {tblname, hfile, errfile, direction}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_INITW, ¶ms, SQL_IS_POINTER)) ? SUCCEED : FAIL; } struct tdsodbc_impl_bcp_control_params { int field; void *value; }; static TDSODBC_INLINE RETCODE SQL_API bcp_control(HDBC hdbc, int field, void *value) { struct tdsodbc_impl_bcp_control_params params = {field, value}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_CONTROL, ¶ms, SQL_IS_POINTER)) ? SUCCEED : FAIL; } struct tdsodbc_impl_bcp_colptr_params { const unsigned char * colptr; int table_column; }; static TDSODBC_INLINE RETCODE SQL_API bcp_colptr(HDBC hdbc, const unsigned char * colptr, int table_column) { struct tdsodbc_impl_bcp_colptr_params params = {colptr, table_column}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_COLPTR, ¶ms, SQL_IS_POINTER)) ? SUCCEED : FAIL; } static TDSODBC_INLINE RETCODE SQL_API bcp_sendrow(HDBC hdbc) { return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_SENDROW, NULL, SQL_IS_POINTER)) ? SUCCEED : FAIL; } struct tdsodbc_impl_bcp_batch_params { int rows; }; static TDSODBC_INLINE int SQL_API bcp_batch(HDBC hdbc) { struct tdsodbc_impl_bcp_batch_params params = {-1}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BATCH, ¶ms, SQL_IS_POINTER)) ? params.rows : -1; } struct tdsodbc_impl_bcp_done_params { int rows; }; static TDSODBC_INLINE int SQL_API bcp_done(HDBC hdbc) { struct tdsodbc_impl_bcp_done_params params = {-1}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_DONE, ¶ms, SQL_IS_POINTER)) ? params.rows : -1; } struct tdsodbc_impl_bcp_bind_params { const unsigned char * varaddr; int prefixlen; int varlen; const unsigned char * terminator; int termlen; int vartype; int table_column; }; static TDSODBC_INLINE RETCODE SQL_API bcp_bind(HDBC hdbc, const unsigned char * varaddr, int prefixlen, int varlen, const unsigned char * terminator, int termlen, int vartype, int table_column) { struct tdsodbc_impl_bcp_bind_params params = {varaddr, prefixlen, varlen, terminator, termlen, vartype, table_column}; return SQL_SUCCEEDED(SQLSetConnectAttr(hdbc, SQL_COPT_TDSODBC_IMPL_BCP_BIND, ¶ms, SQL_IS_POINTER)) ? SUCCEED : FAIL; } #ifdef UNICODE #define bcp_init bcp_initW #else #define bcp_init bcp_initA #endif #endif /* TDSODBC_BCP */ #ifdef __cplusplus } #endif #endif /* _odbcss_h_ */ freetds-1.3.6/include/ctlib.h000644 025423 025423 00000014511 14056414221 017475 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _ctlib_h_ #define _ctlib_h_ #include #include #include /* * Internal (not part of the exposed API) prototypes and such. */ #include #ifdef __cplusplus extern "C" { #if 0 } #endif #endif /* * internal types */ struct _cs_config { short cs_expose_formats; }; /* Code changed for error handling */ /* Code changes starts here - CT_DIAG - 01 */ /* This structure is used in CT_DIAG */ struct cs_diag_msg_client { CS_CLIENTMSG *clientmsg; struct cs_diag_msg_client *next; }; struct cs_diag_msg_svr { CS_SERVERMSG *servermsg; struct cs_diag_msg_svr *next; }; /* Code changes ends here - CT_DIAG - 01 */ struct cs_diag_msg { CS_CLIENTMSG *msg; struct cs_diag_msg *next; }; struct _cs_context { CS_INT date_convert_fmt; CS_INT cs_errhandletype; CS_INT cs_diag_msglimit; /* added for storing the maximum messages limit CT_DIAG */ /* code changes starts here - CT_DIAG - 02 */ CS_INT cs_diag_msglimit_client; CS_INT cs_diag_msglimit_server; CS_INT cs_diag_msglimit_total; struct cs_diag_msg_client *clientstore; struct cs_diag_msg_svr *svrstore; /* code changes ends here - CT_DIAG - 02 */ struct cs_diag_msg *msgstore; CS_CSLIBMSG_FUNC _cslibmsg_cb; CS_CLIENTMSG_FUNC _clientmsg_cb; CS_SERVERMSG_FUNC _servermsg_cb; /* code changes start here - CS_CONFIG - 01*/ void *userdata; int userdata_len; /* code changes end here - CS_CONFIG - 01*/ TDSCONTEXT *tds_ctx; CS_CONFIG config; int login_timeout; /**< not used unless positive */ int query_timeout; /**< not used unless positive */ }; /* * internal typedefs */ typedef struct _ct_colinfo { TDS_SMALLINT *indicator; } CT_COLINFO; typedef struct _cs_dynamic CS_DYNAMIC; struct _cs_connection { CS_CONTEXT *ctx; TDSLOGIN *tds_login; TDSSOCKET *tds_socket; CS_CLIENTMSG_FUNC _clientmsg_cb; CS_SERVERMSG_FUNC _servermsg_cb; void *userdata; int userdata_len; CS_LOCALE *locale; CS_COMMAND *cmds; CS_DYNAMIC *dynlist; char *server_addr; bool network_auth; }; /* * Formerly CSREMOTE_PROC_PARAM, this structure can be used in other * places, too. */ typedef struct _cs_param { struct _cs_param *next; char *name; int status; int datatype; CS_INT maxlen; CS_INT scale; CS_INT precision; CS_INT *datalen; CS_SMALLINT *ind; CS_BYTE *value; int param_by_value; CS_INT datalen_value; CS_SMALLINT indicator_value; } CS_PARAM; /* * Code added for RPC functionality - SUHA * RPC Code changes starts here */ typedef CS_PARAM CSREMOTE_PROC_PARAM; typedef struct _csremote_proc { char *name; CS_SMALLINT options; CSREMOTE_PROC_PARAM *param_list; } CSREMOTE_PROC; /* * Structure CS_COMMAND changed for RPC functionality -SUHA * Added CSREMOTE_PROC *rpc to CS_COMMAND structure */ typedef CS_PARAM CS_DYNAMIC_PARAM; struct _cs_dynamic { struct _cs_dynamic *next; char *id; char *stmt; CS_DYNAMIC_PARAM *param_list; TDSDYNAMIC *tdsdyn; }; /* specific FreeTDS commands */ #define CS_DYNAMIC_CMD 160 #define CS_CUR_CMD 161 /* values for cs_command.results_state */ #define _CS_RES_NONE -1 #define _CS_RES_INIT 0 #define _CS_RES_RESULTSET_EMPTY 1 #define _CS_RES_RESULTSET_ROWS 2 #define _CS_RES_STATUS 3 #define _CS_RES_CMD_DONE 4 #define _CS_RES_CMD_SUCCEED 5 #define _CS_RES_END_RESULTS 6 #define _CS_RES_DESCRIBE_RESULT 7 /* values for cs_command.command_state */ #define _CS_COMMAND_IDLE 0 #define _CS_COMMAND_BUILDING 1 #define _CS_COMMAND_READY 2 #define _CS_COMMAND_SENT 3 /* values for cs_command.cancel_state */ #define _CS_CANCEL_NOCANCEL 0 #define _CS_CANCEL_PENDING 1 struct _cs_command { struct _cs_command *next; CS_INT command_state; CS_INT results_state; CS_INT cancel_state; CS_INT cursor_state; CS_CONNECTION *con; CS_INT command_type; CS_CHAR *query; short dynamic_cmd; CS_DYNAMIC *dyn; int row_prefetched; int curr_result_type; int bind_count; int get_data_item; int get_data_bytes_returned; CS_IODESC *iodesc; CS_INT send_data_started; CSREMOTE_PROC *rpc; CS_PARAM *input_params; CS_INT client_cursor_id; TDSCURSOR *cursor; void *userdata; int userdata_len; }; struct _cs_blkdesc { TDSBCPINFO bcpinfo; }; #define _CS_ERRHAND_INLINE 1 #define _CS_ERRHAND_CB 2 struct _cs_locale { char *language; char *charset; char *time; char *collate; }; /* internal defines for cursor processing */ #define _CS_CURS_TYPE_UNACTIONED 0 #define _CS_CURS_TYPE_REQUESTED 1 #define _CS_CURS_TYPE_SENT 2 /* * internal prototypes */ TDSRET _ct_handle_server_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr); int _ct_handle_client_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE * msgptr); TDS_SERVER_TYPE _ct_get_server_type(TDSSOCKET *tds, int datatype); int _ct_bind_data(CS_CONTEXT *ctx, TDSRESULTINFO * resinfo, TDSRESULTINFO *bindinfo, CS_INT offset); int _ct_get_client_type(const TDSCOLUMN *col, bool describe); void _ctclient_msg(CS_CONNECTION * con, const char *funcname, int layer, int origin, int severity, int number, const char *fmt, ...); CS_INT _ct_diag_clearmsg(CS_CONTEXT * context, CS_INT type); void _cs_locale_free(CS_LOCALE *locale); CS_LOCALE *_cs_locale_copy(CS_LOCALE *orig); int _cs_locale_copy_inplace(CS_LOCALE *new_locale, CS_LOCALE *orig); int _cs_convert_not_client(CS_CONTEXT *ctx, const TDSCOLUMN *curcol, CONV_RESULT *convert_buffer, unsigned char **p_src); #ifdef __cplusplus #if 0 { #endif } #endif #include #endif freetds-1.3.6/include/dblib.h000644 025423 025423 00000012440 14056414221 017453 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _dblib_h_ #define _dblib_h_ #include #ifdef __cplusplus extern "C" { #if 0 } #endif #endif typedef enum { _DB_RES_INIT , _DB_RES_RESULTSET_EMPTY , _DB_RES_RESULTSET_ROWS , _DB_RES_NEXT_RESULT , _DB_RES_NO_MORE_RESULTS , _DB_RES_SUCCEED } DB_RESULT_STATE; struct tds_dblib_loginrec { TDSLOGIN *tds_login; bool network_auth; }; struct dblib_buffer_row; typedef struct { int received; /* how many rows have been received for this result set */ int head; /* queue insertion point */ int tail; /* oldest item in queue */ int current; /* dbnextrow() reads this row */ int capacity; /* how many elements the queue can hold */ struct dblib_buffer_row *rows; /* pointer to the row storage */ } DBPROC_ROWBUF; typedef struct { int host_column; TDS_SERVER_TYPE datatype; int prefix_len; DBINT column_len; BYTE *terminator; int term_len; int tab_colnum; int column_error; } BCP_HOSTCOLINFO; typedef struct { TDS_CHAR *hostfile; TDS_CHAR *errorfile; FILE *bcp_errfileptr; TDS_INT host_colcount; BCP_HOSTCOLINFO **host_columns; TDS_INT firstrow; TDS_INT lastrow; TDS_INT maxerrs; TDS_INT batch; } BCP_HOSTFILEINFO; /* linked list of rpc parameters */ typedef struct DBREMOTE_PROC_PARAM { struct DBREMOTE_PROC_PARAM *next; char *name; BYTE status; TDS_SERVER_TYPE type; DBINT maxlen; DBINT datalen; BYTE *value; } DBREMOTE_PROC_PARAM; typedef struct DBREMOTE_PROC { struct DBREMOTE_PROC *next; char *name; DBSMALLINT options; DBREMOTE_PROC_PARAM *param_list; } DBREMOTE_PROC; typedef struct dboption { const char *text; DBSTRING *param; DBBOOL factive; } DBOPTION; typedef struct { const BYTE *bindval; size_t len; } NULLREP; struct tds_dblib_dbprocess { TDSSOCKET *tds_socket; STATUS row_type; DBPROC_ROWBUF row_buf; int noautofree; int more_results; /* boolean. Are we expecting results? */ DB_RESULT_STATE dbresults_state; int dbresults_retcode; BYTE *user_data; /* see dbsetuserdata() and dbgetuserdata() */ unsigned char *dbbuf; /* is dynamic! */ int dbbufsz; int command_state; TDS_INT text_size; TDS_INT text_sent; DBTYPEINFO typeinfo; unsigned char avail_flag; DBOPTION *dbopts; DBSTRING *dboptcmd; BCP_HOSTFILEINFO *hostfileinfo; TDSBCPINFO *bcpinfo; DBREMOTE_PROC *rpc; DBUSMALLINT envchange_rcv; char dbcurdb[DBMAXNAME + 1]; char servcharset[DBMAXNAME + 1]; FILE *ftos; DB_DBCHKINTR_FUNC chkintr; DB_DBHNDLINTR_FUNC hndlintr; /** boolean use ms behaviour */ int msdblib; int ntimeouts; /** default null values **/ NULLREP nullreps[MAXBINDTYPES]; }; enum { #if MSDBLIB dblib_msdblib = 1 #else dblib_msdblib = 0 #endif }; /* * internal prototypes */ RETCODE dbgetnull(DBPROCESS *dbproc, int bindtype, int varlen, BYTE* varaddr); void copy_data_to_host_var(DBPROCESS * dbproc, TDS_SERVER_TYPE srctype, const BYTE * src, DBINT srclen, BYTE * dest, DBINT destlen, int bindtype, DBINT *indicator); int dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum, ...); int _dblib_handle_info_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr); int _dblib_handle_err_message(const TDSCONTEXT * ctxptr, TDSSOCKET * tdsptr, TDSMESSAGE* msgptr); int _dblib_check_and_handle_interrupt(void * vdbproc); void _dblib_setTDS_version(TDSLOGIN * tds_login, DBINT version); void _dblib_convert_err(DBPROCESS * dbproc, TDS_INT len); DBINT _convert_char(int srctype, BYTE * src, int destype, BYTE * dest, DBINT destlen); DBINT _convert_intn(int srctype, BYTE * src, int destype, BYTE * dest, DBINT destlen); RETCODE _bcp_clear_storage(DBPROCESS * dbproc); RETCODE _bcp_get_prog_data(DBPROCESS * dbproc); extern MHANDLEFUNC _dblib_msg_handler; extern EHANDLEFUNC _dblib_err_handler; #define CHECK_PARAMETER(x, msg, ret) if (!(x)) { dbperror(dbproc, (msg), 0); return ret; } #define CHECK_NULP(x, func, param_num, ret) if (!(x)) { dbperror(dbproc, SYBENULP, 0, func, (int) param_num); return ret; } #define CHECK_PARAMETER_NOPROC(x, msg) if (!(x)) { dbperror(NULL, (msg), 0); return FAIL; } #define DBPERROR_RETURN(x, msg) if (x) { dbperror(dbproc, (msg), 0); return FAIL; } #define DBPERROR_RETURN3(x, msg, a, b, c) if (x) { dbperror(dbproc, (msg), 0, a, b, c); return FAIL; } #define CHECK_CONN(ret) do { CHECK_PARAMETER(dbproc, SYBENULL, (ret)); \ if (IS_TDSDEAD(dbproc->tds_socket)) { dbperror(dbproc, SYBEDDNE, 0); return (ret); } } while(0) #ifdef __cplusplus #if 0 { #endif } #endif #include #endif freetds-1.3.6/include/Makefile.in000644 025423 025423 00000061225 14162303356 020304 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ $(noinst_HEADERS) $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = tds_sysdep_public.h CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)" HEADERS = $(include_HEADERS) $(nodist_include_HEADERS) \ $(noinst_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir distdir-am am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/tds_sysdep_public.h.in $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = 1.5.3 NULL = SUBDIRS = freetds include_HEADERS = \ bkpublic.h \ cspublic.h \ cstypes.h \ ctpublic.h \ sqldb.h \ sqlfront.h \ sybdb.h \ sybfront.h \ syberror.h \ odbcss.h \ $(NULL) nodist_include_HEADERS = tds_sysdep_public.h noinst_HEADERS = \ ctlib.h \ dblib.h \ $(NULL) DISTCLEANFILES = tds_sysdep_public.h all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 tds_sysdep_public.h: $(top_builddir)/config.status $(srcdir)/tds_sysdep_public.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) install-nodist_includeHEADERS: $(nodist_include_HEADERS) @$(NORMAL_INSTALL) @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-nodist_includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(HEADERS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-includeHEADERS install-nodist_includeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-includeHEADERS uninstall-nodist_includeHEADERS .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-man install-nodist_includeHEADERS install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ uninstall-nodist_includeHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/include/config.h.in000644 025423 025423 00000050003 14162303401 020241 0ustar00fredianofrediano000000 000000 /* include/config.h.in. Generated from configure.ac by autoheader. */ #define _freetds_config_h_ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you need BSD_COMP defined to get FIONBIO defined. */ #undef BSD_COMP /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to enable work in progress code */ #undef ENABLE_DEVELOPING /* Define to enable extra checks on code */ #undef ENABLE_EXTRA_CHECKS /* Defined if --enable-krb5 used and library detected */ #undef ENABLE_KRB5 /* Define to enable MARS support */ #undef ENABLE_ODBC_MARS /* Define to enable ODBC wide string support */ #undef ENABLE_ODBC_WIDE /* Define to 1 if GNU tls use nettle as backend. */ #undef GNUTLS_USE_NETTLE /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `ASN1_STRING_get0_data' function. */ #undef HAVE_ASN1_STRING_GET0_DATA /* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF /* Define to 1 if you have the `basename' function. */ #undef HAVE_BASENAME /* Define to 1 if you have the `BIO_get_data' function. */ #undef HAVE_BIO_GET_DATA /* Define if you have the clock_gettime function. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the header file. */ #undef HAVE_COM_ERR_H /* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON /* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if you don't. */ #undef HAVE_DECL_CYGWIN_CONV_PATH /* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. */ #undef HAVE_DECL_TZNAME /* Define to 1 if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the GNU dld library. */ #undef HAVE_DLD /* Define to 1 if you have the `dlerror' function. */ #undef HAVE_DLERROR /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if you have the _dyld_func_lookup function. */ #undef HAVE_DYLD /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the `error_message' function. */ #undef HAVE_ERROR_MESSAGE /* Define to 1 if you have the `eventfd' function. */ #undef HAVE_EVENTFD /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO /* Define to 1 if you have the `fstat' function. */ #undef HAVE_FSTAT /* Define to 1 if your system provides the 5-parameter version of gethostbyaddr_r(). */ #undef HAVE_FUNC_GETHOSTBYADDR_R_5 /* Define to 1 if your system provides the 7-parameter version of gethostbyaddr_r(). */ #undef HAVE_FUNC_GETHOSTBYADDR_R_7 /* Define to 1 if your system provides the 8-parameter version of gethostbyaddr_r(). */ #undef HAVE_FUNC_GETHOSTBYADDR_R_8 /* Define to 1 if your system provides the 3-parameter version of gethostbyname_r(). */ #undef HAVE_FUNC_GETHOSTBYNAME_R_3 /* Define to 1 if your system provides the 5-parameter version of gethostbyname_r(). */ #undef HAVE_FUNC_GETHOSTBYNAME_R_5 /* Define to 1 if your system provides the 6-parameter version of gethostbyname_r(). */ #undef HAVE_FUNC_GETHOSTBYNAME_R_6 /* Define to 1 if your system provides the 4-parameter version of getpwuid_r(). */ #undef HAVE_FUNC_GETPWUID_R_4 /* Define to 1 if your system getpwuid_r() have 4 parameters and return struct passwd*. */ #undef HAVE_FUNC_GETPWUID_R_4_PW /* Define to 1 if your system provides the 5-parameter version of getpwuid_r(). */ #undef HAVE_FUNC_GETPWUID_R_5 /* Define to 1 if your system provides the 4-parameter version of getservbyname_r(). */ #undef HAVE_FUNC_GETSERVBYNAME_R_4 /* Define to 1 if your system provides the 5-parameter version of getservbyname_r(). */ #undef HAVE_FUNC_GETSERVBYNAME_R_5 /* Define to 1 if your system provides the 6-parameter version of getservbyname_r(). */ #undef HAVE_FUNC_GETSERVBYNAME_R_6 /* Define to 1 if your localtime_r return a int. */ #undef HAVE_FUNC_LOCALTIME_R_INT /* Define to 1 if your localtime_r return a struct tm*. */ #undef HAVE_FUNC_LOCALTIME_R_TM /* Define if you have getaddrinfo function */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `gethostname' function. */ #undef HAVE_GETHOSTNAME /* Define to 1 if you have the `gethrtime' function. */ #undef HAVE_GETHRTIME /* Define to 1 if you have the `getipnodebyaddr' function. */ #undef HAVE_GETIPNODEBYADDR /* Define to 1 if you have the `getipnodebyname' function. */ #undef HAVE_GETIPNODEBYNAME /* Define to 1 if you have the `getopt' function. */ #undef HAVE_GETOPT /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define if your getopt(3) defines and uses optreset */ #undef HAVE_GETOPT_OPTRESET /* Define to 1 if you have the `getpwuid' function. */ #undef HAVE_GETPWUID /* Define to 1 if you have the `getpwuid_r' function. */ #undef HAVE_GETPWUID_R /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID /* Define if you have GMP library */ #undef HAVE_GMP /* Define to 1 if you have GnuTLS. */ #undef HAVE_GNUTLS /* Define to 1 if you have the header file. */ #undef HAVE_GNUTLS_ABSTRACT_H /* Define to 1 if you have the `gnutls_certificate_set_verify_function' function. */ #undef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION /* Define to 1 if you have the `gnutls_record_disable_padding' function. */ #undef HAVE_GNUTLS_RECORD_DISABLE_PADDING /* Define to 1 if you have the `gnutls_rnd' function. */ #undef HAVE_GNUTLS_RND /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV /* Define to 1 if you have the `inet_ntoa_r' function. */ #undef HAVE_INET_NTOA_R /* Define to 1 if you have the `inet_ntop' function. */ #undef HAVE_INET_NTOP /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_IODBCINST_H /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H /* Define if you have the libdl library or equivalent. */ #undef HAVE_LIBDL /* Define if libdlloader will be built on this platform */ #undef HAVE_LIBDLLOADER /* Define to 1 if you have the header file. */ #undef HAVE_LIBGEN_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALCHARSET_H /* Define to 1 if you have the `locale_charset' function. */ #undef HAVE_LOCALE_CHARSET /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R /* Define to 1 if you have the header file. */ #undef HAVE_MALLOC_H /* Define to 1 if your system provides the malloc_options variable. */ #undef HAVE_MALLOC_OPTIONS /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_TCP_H /* Define to 1 if nettle is present. */ #undef HAVE_NETTLE /* Define to 1 if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* Define if you have the OpenSSL. */ #undef HAVE_OPENSSL /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL /* Define to 1 if you have the header file. */ #undef HAVE_POLL_H /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the `pthread_condattr_setclock' function. */ #undef HAVE_PTHREAD_CONDATTR_SETCLOCK /* Define to 1 if you have the `pthread_cond_timedwait' function. */ #undef HAVE_PTHREAD_COND_TIMEDWAIT /* Define to 1 if you have the `pthread_cond_timedwait_relative_np' function. */ #undef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP /* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV /* Define to 1 if you have the `readdir_r' function. */ #undef HAVE_READDIR_R /* Define to 1 if you have the GNU Readline library. */ #undef HAVE_READLINE /* Define to 1 if you have the `readpassphrase' function. */ #undef HAVE_READPASSPHRASE /* Define to 1 if you have rl_inhibit_completion. */ #undef HAVE_RL_INHIBIT_COMPLETION /* Define to 1 if you have the `rl_on_new_line' function. */ #undef HAVE_RL_ON_NEW_LINE /* Define to 1 if you have the `rl_reset_line_state' function. */ #undef HAVE_RL_RESET_LINE_STATE /* Define to 1 if you have the header file. */ #undef HAVE_ROKEN_H /* Define to 1 if you have the `RSA_get0_key' function. */ #undef HAVE_RSA_GET0_KEY /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the `setitimer' function. */ #undef HAVE_SETITIMER /* Define to 1 if you have the `setrlimit' function. */ #undef HAVE_SETRLIMIT /* Define if you have the shl_load function. */ #undef HAVE_SHL_LOAD /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* Define to 1 if you have the `socketpair' function. */ #undef HAVE_SOCKETPAIR /* Define to 1 if you have the SQLGetPrivateProfileString function. */ #undef HAVE_SQLGETPRIVATEPROFILESTRING /* Define if sqltypes.h define SQLLEN */ #undef HAVE_SQLLEN /* Define to 1 if the system has the type `SQLROWOFFSET'. */ #undef HAVE_SQLROWOFFSET /* Define to 1 if the system has the type `SQLROWSETSIZE'. */ #undef HAVE_SQLROWSETSIZE /* Define to 1 if the system has the type `SQLSETPOSIROW'. */ #undef HAVE_SQLSETPOSIROW /* Define to 1 if you have the header file. */ #undef HAVE_SQL_H /* Defined if not --disable-sspi and SSPI detected */ #undef HAVE_SSPI /* Define to 1 if you have the header file. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcat' function. */ #undef HAVE_STRLCAT /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the `strsep' function. */ #undef HAVE_STRSEP /* Define to 1 if you have the `strtok_r' function. */ #undef HAVE_STRTOK_R /* Define to 1 if you have the `strtok_s' function. */ #undef HAVE_STRTOK_S /* Define to 1 if `tm_zone' is a member of `struct tm'. */ #undef HAVE_STRUCT_TM_TM_ZONE /* Define to 1 if `__tm_zone' is a member of `struct tm'. */ #undef HAVE_STRUCT_TM___TM_ZONE /* Define to 1 if you have the 'system' function */ #undef HAVE_SYSTEM /* Define to 1 if you have the header file. */ #undef HAVE_SYS_EVENTFD_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead. */ #undef HAVE_TM_ZONE /* Define to 1 if you don't have `tm_zone' but do have the external array `tzname'. */ #undef HAVE_TZNAME /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define to 1 if you have the header file. */ #undef HAVE_VALGRIND_MEMCHECK_H /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H /* Define to 1 if you have the header file. */ #undef HAVE_WINDOWS_H /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK2_H /* Define to 1 if you have the `_fseeki64' function. */ #undef HAVE__FSEEKI64 /* Define to 1 if you have the `_ftelli64' function. */ #undef HAVE__FTELLI64 /* Define to 1 if you have the `_lock_file' function. */ #undef HAVE__LOCK_FILE /* Define to 1 if you have the `_unlock_file' function. */ #undef HAVE__UNLOCK_FILE /* Define to 1 if you have the `_vscprintf' function. */ #undef HAVE__VSCPRINTF /* Define to 1 if you have the `_vsnprintf' function. */ #undef HAVE__VSNPRINTF /* Define to 1 if you have the `_xpg_accept' function. */ #undef HAVE__XPG_ACCEPT /* Define to 1 if you have the `_xpg_getpeername' function. */ #undef HAVE__XPG_GETPEERNAME /* Define to 1 if you have the `_xpg_getsockname' function. */ #undef HAVE__XPG_GETSOCKNAME /* Define to 1 if you have the `_xpg_getsockopt' function. */ #undef HAVE__XPG_GETSOCKOPT /* Define to 1 if you have the `_xpg_recvfrom' function. */ #undef HAVE__XPG_RECVFROM /* Define to 1 if you have the `__accept' function. */ #undef HAVE___ACCEPT /* Define to 1 if you have the `__getpeername' function. */ #undef HAVE___GETPEERNAME /* Define to 1 if you have the `__getsockname' function. */ #undef HAVE___GETSOCKNAME /* Define to 1 if you have the `__getsockopt' function. */ #undef HAVE___GETSOCKOPT /* Define to 1 if you have the `__recvfrom' function. */ #undef HAVE___RECVFROM /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST /* Define to value of INADDR_NONE if not provided by your system header files. */ #undef INADDR_NONE /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if the BSD-style netdb interface is reentrant. */ #undef NETDB_REENTRANT /* Define to 1 if memset(0) sets pointers to NULL. */ #undef NULL_REP_IS_ZERO_BYTES /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* The size of `char', as computed by sizeof. */ #undef SIZEOF_CHAR /* The size of `double', as computed by sizeof. */ #undef SIZEOF_DOUBLE /* The size of `float', as computed by sizeof. */ #undef SIZEOF_FLOAT /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long double', as computed by sizeof. */ #undef SIZEOF_LONG_DOUBLE /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* The size of `SQLWCHAR', as computed by sizeof. */ #undef SIZEOF_SQLWCHAR /* The size of `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* The size of `wchar_t', as computed by sizeof. */ #undef SIZEOF_WCHAR_T /* The size of `__int64', as computed by sizeof. */ #undef SIZEOF___INT64 /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to use TDS 5.0 by default */ #undef TDS50 /* Define to use TDS 7.1 by default */ #undef TDS71 /* Define to use TDS 7.2 by default */ #undef TDS72 /* Define to use TDS 7.3 by default */ #undef TDS73 /* Define to use TDS 7.4 by default */ #undef TDS74 /* Define to 1 if your compiler supports __attribute__((destructor)). */ #undef TDS_ATTRIBUTE_DESTRUCTOR /* define to constant to use for clock_gettime */ #undef TDS_GETTIMEMILLI_CONST /* Define if you have pthread with mutex support */ #undef TDS_HAVE_PTHREAD_MUTEX /* Define if stdio support locking */ #undef TDS_HAVE_STDIO_LOCKED /* define to prefix format string used for 64bit integers */ #undef TDS_I64_PREFIX /* Define if you don't care about thread safety */ #undef TDS_NO_THREADSAFE /* Define to 1 if last argument of SQLColAttribute it's SQLLEN * */ #undef TDS_SQLCOLATTRIBUTE_SQLLEN /* Define to 1 if SQLParamOptions accept SQLULEN as arguments */ #undef TDS_SQLPARAMOPTIONS_SQLLEN /* Defined if --enable-sybase-compat used */ #undef TDS_SYBASE_COMPAT /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `unsigned int' if does not define. */ #undef size_t /* type to use in place of socklen_t if not defined */ #undef socklen_t freetds-1.3.6/include/tds_sysdep_public.h.in000644 025423 025423 00000011476 14073251137 022537 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-2011 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tds_sysdep_public_h_ #define _tds_sysdep_public_h_ /* * This file is publicly installed. * MUST not include config.h */ #if (!defined(_MSC_VER) && defined(__cplusplus) && __cplusplus >= 201103L) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) # include #elif (defined(__sun) && defined(__SVR4)) || defined(__hpux) # include #else typedef signed char int8_t; /* 8-bit int */ typedef unsigned char uint8_t; /* 8-bit int */ /* * This is where platform-specific changes need to be made. */ # if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) # include # include # include typedef signed short int16_t; /* 16-bit int */ typedef unsigned short uint16_t; /* 16-bit int */ typedef signed int int32_t; /* 32-bit int */ typedef unsigned int uint32_t; /* 32-bit int */ typedef signed __int64 int64_t; /* 64-bit int */ typedef unsigned __int64 uint64_t; /* 64-bit int */ # if !defined(WIN64) && !defined(_WIN64) typedef signed int intptr_t; /* 32-bit int */ typedef unsigned int uintptr_t; /* 32-bit int */ # else typedef signed __int64 intptr_t; /* 64-bit int */ typedef unsigned __int64 uintptr_t; /* 64-bit int */ # endif # else /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */ typedef signed @tds_sysdep_int16_type@ int16_t; /* 16-bit int */ typedef unsigned @tds_sysdep_int16_type@ uint16_t; /* 16-bit int */ typedef signed @tds_sysdep_int32_type@ int32_t; /* 32-bit int */ typedef unsigned @tds_sysdep_int32_type@ uint32_t; /* 32-bit int */ typedef signed @tds_sysdep_int64_type@ int64_t; /* 64-bit int */ typedef unsigned @tds_sysdep_int64_type@ uint64_t; /* 64-bit int */ typedef signed @tds_sysdep_intptr_type@ intptr_t; typedef unsigned @tds_sysdep_intptr_type@ uintptr_t; # endif #endif #include /* try to understand float sizes using float.h constants */ #if FLT_RADIX == 2 # if FLT_MANT_DIG == 24 && FLT_MAX_EXP == 128 # define tds_sysdep_real32_type float /* 32-bit real */ # elif DBL_MANT_DIG == 24 && DBL_MAX_EXP == 128 # define tds_sysdep_real32_type double /* 32-bit real */ # elif LDBL_MANT_DIG == 24 && LDBL_MAX_EXP == 128 # define tds_sysdep_real32_type long double /* 32-bit real */ # endif # if FLT_MANT_DIG == 53 && FLT_MAX_EXP == 1024 # define tds_sysdep_real64_type float /* 64-bit real */ # elif DBL_MANT_DIG == 53 && DBL_MAX_EXP == 1024 # define tds_sysdep_real64_type double /* 64-bit real */ # elif LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 # define tds_sysdep_real64_type long double /* 64-bit real */ # endif # if !defined(tds_sysdep_real32_type) || !defined(tds_sysdep_real64_type) # error Some float type was not found! # endif #else # if FLT_DIG == 6 && FLT_MAX_10_EXP == 38 # define tds_sysdep_real32_type float /* 32-bit real */ # elif DBL_DIG == 6 && DBL_MAX_10_EXP == 38 # define tds_sysdep_real32_type double /* 32-bit real */ # elif LDBL_DIG == 6 && LDBL_MAX_10_EXP == 38 # define tds_sysdep_real32_type long double /* 32-bit real */ # endif # if FLT_DIG == 15 && FLT_MAX_10_EXP == 308 # define tds_sysdep_real64_type float /* 64-bit real */ # elif DBL_DIG == 15 && DBL_MAX_10_EXP == 308 # define tds_sysdep_real64_type double /* 64-bit real */ # elif LDBL_DIG == 15 && LDBL_MAX_10_EXP == 308 # define tds_sysdep_real64_type long double /* 64-bit real */ # endif #endif /* fall back to configure.ac types */ #ifndef tds_sysdep_real32_type #define tds_sysdep_real32_type @tds_sysdep_real32_type@ /* 32-bit real */ #endif /* !tds_sysdep_real32_type */ #ifndef tds_sysdep_real64_type #define tds_sysdep_real64_type @tds_sysdep_real64_type@ /* 64-bit real */ #endif /* !tds_sysdep_real64_type */ #if !defined(MSDBLIB) && !defined(SYBDBLIB) @dblib_define@ #endif #if defined(MSDBLIB) && defined(SYBDBLIB) #error MSDBLIB and SYBDBLIB cannot both be defined #endif #endif /* _tds_sysdep_public_h_ */ freetds-1.3.6/include/freetds/000755 025423 025423 00000000000 14162303404 017657 5ustar00fredianofrediano000000 000000 freetds-1.3.6/include/freetds/replacements/000755 025423 025423 00000000000 14162303404 022341 5ustar00fredianofrediano000000 000000 freetds-1.3.6/include/freetds/utils/000755 025423 025423 00000000000 14162303404 021017 5ustar00fredianofrediano000000 000000 freetds-1.3.6/include/freetds/Makefile.am000644 025423 025423 00000002076 14056414271 021727 0ustar00fredianofrediano000000 000000 NULL = noinst_HEADERS = \ iconv.h \ convert.h \ bytes.h \ thread.h \ proto.h \ tds.h \ odbc.h \ version.h \ server.h \ configs.h \ enum_cap.h \ sysdep_private.h \ stream.h \ data.h \ pushvis.h \ popvis.h \ time.h \ tls.h \ bool.h \ checks.h \ alloca.h \ macros.h \ windows.h \ utils.h \ utils/string.h \ utils/dlist.h \ utils/dlist.tmpl.h \ utils/bjoern-utf8.h \ utils/md4.h \ utils/des.h \ utils/md5.h \ utils/hmac_md5.h \ replacements.h \ replacements/poll.h \ replacements/readpassphrase.h \ $(NULL) DISTCLEANFILES = sysconfdir.h sysconfdir.h: Makefile echo '#define FREETDS_SYSCONFDIR "$(sysconfdir)"' >$@ all-am: sysconfdir.h GENERATED_HEADER_FILES = encodings.h charset_lookup.h EXTRA_DIST = $(GENERATED_HEADER_FILES) if HAVE_PERL_SOURCES BUILT_SOURCES = $(GENERATED_HEADER_FILES) clean-local: cd $(srcdir) && rm -f $(BUILT_SOURCES) charset_lookup.h: encodings.h encodings.h: encodings.pl alternative_character_sets.h character_sets.h Makefile perl $(srcdir)/encodings.pl $(srcdir) $(GPERF) > $@.tmp 2> /dev/null mv $@.tmp $@ endif freetds-1.3.6/include/freetds/iconv.h000644 025423 025423 00000007034 14056414221 021154 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tds_iconv_h_ #define _tds_iconv_h_ #if HAVE_ICONV #include #else /* Define iconv_t for src/replacements/iconv.c. */ #undef iconv_t typedef void *iconv_t; #endif /* HAVE_ICONV */ #if HAVE_ERRNO_H #include #endif #if HAVE_WCHAR_H #include #endif /* The following EILSEQ advice is borrowed verbatim from GNU iconv. */ /* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, have EILSEQ in a different header. On these systems, define EILSEQ ourselves. */ #ifndef EILSEQ # define EILSEQ ENOENT #endif #if HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #include #ifdef __cplusplus extern "C" { #endif #if ! HAVE_ICONV iconv_t tds_sys_iconv_open(const char *tocode, const char *fromcode); size_t tds_sys_iconv(iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft); int tds_sys_iconv_close(iconv_t cd); #else #define tds_sys_iconv_open iconv_open #define tds_sys_iconv iconv #define tds_sys_iconv_close iconv_close #endif /* !HAVE_ICONV */ typedef enum { to_server, to_client } TDS_ICONV_DIRECTION; typedef struct _character_set_alias { const char *alias; int canonic; } CHARACTER_SET_ALIAS; typedef struct tds_errno_message_flags { unsigned int e2big:1; unsigned int eilseq:1; unsigned int einval:1; } TDS_ERRNO_MESSAGE_FLAGS; typedef struct tdsiconvdir { TDS_ENCODING charset; iconv_t cd; } TDSICONVDIR; struct tdsiconvinfo { struct tdsiconvdir to, from; #define TDS_ENCODING_MEMCPY 1 unsigned int flags; /* * Suppress error messages that would otherwise be emitted by tds_iconv(). * Functions that process large buffers ask tds_iconv to convert it in "chunks". * We don't want to emit spurious EILSEQ errors or multiple errors for one * buffer. tds_iconv() checks this structure before emiting a message, and * adds to it whenever it emits one. Callers that handle a particular situation themselves * can prepopulate it. */ TDS_ERRNO_MESSAGE_FLAGS suppress; }; /* We use ICONV_CONST for tds_iconv(), even if we don't have iconv() */ #ifndef ICONV_CONST # define ICONV_CONST const #endif size_t tds_iconv(TDSSOCKET * tds, TDSICONV * char_conv, TDS_ICONV_DIRECTION io, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft); int tds_canonical_charset(const char *charset_name); const char *tds_canonical_charset_name(const char *charset_name); TDSICONV *tds_iconv_get(TDSCONNECTION * conn, const char *client_charset, const char *server_charset); TDSICONV *tds_iconv_get_info(TDSCONNECTION * conn, int canonic_client, int canonic_server); #ifdef __cplusplus } #endif #include #endif /* _tds_iconv_h_ */ freetds-1.3.6/include/freetds/convert.h000644 025423 025423 00000004761 14056414221 021522 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsconvert_h_ #define _tdsconvert_h_ #include #ifdef __cplusplus extern "C" { #if 0 } #endif #endif typedef union conv_result { /* fixed */ TDS_TINYINT ti; TDS_SMALLINT si; TDS_USMALLINT usi; TDS_INT i; TDS_UINT ui; TDS_INT8 bi; TDS_UINT8 ubi; TDS_FLOAT f; TDS_REAL r; TDS_MONEY m; TDS_MONEY4 m4; TDS_DATETIME dt; TDS_DATETIME4 dt4; TDS_DATETIMEALL dta; TDS_TIME time; TDS_DATE date; TDS_BIGTIME bigtime; TDS_BIGDATETIME bigdatetime; TDS_NUMERIC n; TDS_UNIQUE u; /* variable */ TDS_CHAR *c; TDS_CHAR *ib; /* sized buffer types */ struct cc_t { TDS_CHAR *c; TDS_UINT len; } cc; struct cb_t { TDS_CHAR *ib; TDS_UINT len; } cb; } CONV_RESULT; /* * Failure return codes for tds_convert() */ #define TDS_CONVERT_FAIL -1 /* unspecified failure */ #define TDS_CONVERT_NOAVAIL -2 /* conversion does not exist */ #define TDS_CONVERT_SYNTAX -3 /* syntax error in source field */ #define TDS_CONVERT_NOMEM -4 /* insufficient memory */ #define TDS_CONVERT_OVERFLOW -5 /* result too large */ /* sized types */ #define TDS_CONVERT_CHAR 256 #define TDS_CONVERT_BINARY 257 unsigned char tds_willconvert(int srctype, int desttype); TDS_SERVER_TYPE tds_get_null_type(TDS_SERVER_TYPE srctype); TDS_INT tds_char2hex(TDS_CHAR *dest, TDS_UINT destlen, const TDS_CHAR * src, TDS_UINT srclen); TDS_INT tds_convert(const TDSCONTEXT *context, int srctype, const void *src, TDS_UINT srclen, int desttype, CONV_RESULT *cr); size_t tds_strftime(char *buf, size_t maxsize, const char *format, const TDSDATEREC * timeptr, int prec); #ifdef __cplusplus #if 0 { #endif } #endif #include #endif /* _tdsconvert_h_ */ freetds-1.3.6/include/freetds/bytes.h000644 025423 025423 00000023105 14056414221 021161 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2005-2008 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsbytes_h_ #define _tdsbytes_h_ /* * read a word of n bytes aligned, architecture dependent endian * TDS_GET_An * read a word of n bytes aligned, little endian * TDS_GET_AnLE * read a word of n bytes aligned, big endian * TDS_GET_AnBE * read a word of n bytes unaligned, architecture dependent endian * TDS_GET_UAn * read a word of n bytes unaligned, little endian * TDS_GET_UAnLE * read a word of n bytes unaligned, big endian * TDS_GET_UAnBE */ /* one byte, easy... */ #define TDS_GET_A1LE(ptr) (((uint8_t *)(ptr))[0]) #define TDS_GET_A1BE(ptr) TDS_GET_A1LE(ptr) #define TDS_GET_UA1LE(ptr) TDS_GET_A1LE(ptr) #define TDS_GET_UA1BE(ptr) TDS_GET_A1LE(ptr) #define TDS_PUT_A1LE(ptr,val) do { ((uint8_t *)(ptr))[0] = (val); } while(0) #define TDS_PUT_A1BE(ptr,val) TDS_PUT_A1LE(ptr,val) #define TDS_PUT_UA1LE(ptr,val) TDS_PUT_A1LE(ptr,val) #define TDS_PUT_UA1BE(ptr,val) TDS_PUT_A1LE(ptr,val) /* two bytes */ #define TDS_GET_UA2LE(ptr) (((uint8_t *)(ptr))[1] * 0x100u + ((uint8_t *)(ptr))[0]) #define TDS_GET_UA2BE(ptr) (((uint8_t *)(ptr))[0] * 0x100u + ((uint8_t *)(ptr))[1]) #define TDS_GET_A2LE(ptr) TDS_GET_UA2LE(ptr) #define TDS_GET_A2BE(ptr) TDS_GET_UA2BE(ptr) #define TDS_PUT_UA2LE(ptr,val) do {\ ((uint8_t *)(ptr))[1] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[0] = (uint8_t)(val); } while(0) #define TDS_PUT_UA2BE(ptr,val) do {\ ((uint8_t *)(ptr))[0] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[1] = (uint8_t)(val); } while(0) #define TDS_PUT_A2LE(ptr,val) TDS_PUT_UA2LE(ptr,val) #define TDS_PUT_A2BE(ptr,val) TDS_PUT_UA2BE(ptr,val) /* four bytes */ #define TDS_GET_UA4LE(ptr) \ (((uint8_t *)(ptr))[3] * 0x1000000u + ((uint8_t *)(ptr))[2] * 0x10000u +\ ((uint8_t *)(ptr))[1] * 0x100u + ((uint8_t *)(ptr))[0]) #define TDS_GET_UA4BE(ptr) \ (((uint8_t *)(ptr))[0] * 0x1000000u + ((uint8_t *)(ptr))[1] * 0x10000u +\ ((uint8_t *)(ptr))[2] * 0x100u + ((uint8_t *)(ptr))[3]) #define TDS_GET_A4LE(ptr) TDS_GET_UA4LE(ptr) #define TDS_GET_A4BE(ptr) TDS_GET_UA4BE(ptr) #define TDS_PUT_UA4LE(ptr,val) do {\ ((uint8_t *)(ptr))[3] = (uint8_t)((val)>>24); ((uint8_t *)(ptr))[2] = (uint8_t)((val)>>16);\ ((uint8_t *)(ptr))[1] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[0] = (uint8_t)(val); } while(0) #define TDS_PUT_UA4BE(ptr,val) do {\ ((uint8_t *)(ptr))[0] = (uint8_t)((val)>>24); ((uint8_t *)(ptr))[1] = (uint8_t)((val)>>16);\ ((uint8_t *)(ptr))[2] = (uint8_t)((val)>>8); ((uint8_t *)(ptr))[3] = (uint8_t)(val); } while(0) #define TDS_PUT_A4LE(ptr,val) TDS_PUT_UA4LE(ptr,val) #define TDS_PUT_A4BE(ptr,val) TDS_PUT_UA4BE(ptr,val) #if defined(__GNUC__) # define TDS_MAY_ALIAS __attribute__((__may_alias__)) #else # define TDS_MAY_ALIAS #endif typedef union { uint16_t usi; uint8_t uc[2]; } TDS_MAY_ALIAS TDS_BYTE_CONVERT2; typedef union { uint32_t ui; uint8_t uc[4]; } TDS_MAY_ALIAS TDS_BYTE_CONVERT4; /* architecture dependent */ /* map to generic macros or redefine for aligned and same endianess */ #ifdef WORDS_BIGENDIAN # define TDS_GET_A1(ptr) TDS_GET_A1BE(ptr) # define TDS_GET_UA1(ptr) TDS_GET_UA1BE(ptr) # define TDS_GET_A2(ptr) TDS_GET_A2BE(ptr) # define TDS_GET_UA2(ptr) TDS_GET_UA2BE(ptr) # define TDS_GET_A4(ptr) TDS_GET_A4BE(ptr) # define TDS_GET_UA4(ptr) TDS_GET_UA4BE(ptr) # undef TDS_GET_A2BE # undef TDS_GET_A4BE # define TDS_GET_A2BE(ptr) (((TDS_BYTE_CONVERT2*)(ptr))->usi) # define TDS_GET_A4BE(ptr) (((TDS_BYTE_CONVERT4*)(ptr))->ui) # define TDS_PUT_A1(ptr,val) TDS_PUT_A1BE(ptr,val) # define TDS_PUT_UA1(ptr,val) TDS_PUT_UA1BE(ptr,val) # define TDS_PUT_A2(ptr,val) TDS_PUT_A2BE(ptr,val) # define TDS_PUT_UA2(ptr,val) TDS_PUT_UA2BE(ptr,val) # define TDS_PUT_A4(ptr,val) TDS_PUT_A4BE(ptr,val) # define TDS_PUT_UA4(ptr,val) TDS_PUT_UA4BE(ptr,val) # undef TDS_PUT_A2BE # undef TDS_PUT_A4BE # define TDS_PUT_A2BE(ptr,val) (((TDS_BYTE_CONVERT2*)(ptr))->usi = (val)) # define TDS_PUT_A4BE(ptr,val) (((TDS_BYTE_CONVERT4*)(ptr))->ui = (val)) # define TDS_HOST2LE(val) TDS_BYTE_SWAP16(val) # define TDS_HOST4LE(val) TDS_BYTE_SWAP32(val) # define TDS_HOST2BE(val) (val) # define TDS_HOST4BE(val) (val) #else # define TDS_GET_A1(ptr) TDS_GET_A1LE(ptr) # define TDS_GET_UA1(ptr) TDS_GET_UA1LE(ptr) # define TDS_GET_A2(ptr) TDS_GET_A2LE(ptr) # define TDS_GET_UA2(ptr) TDS_GET_UA2LE(ptr) # define TDS_GET_A4(ptr) TDS_GET_A4LE(ptr) # define TDS_GET_UA4(ptr) TDS_GET_UA4LE(ptr) # undef TDS_GET_A2LE # undef TDS_GET_A4LE # define TDS_GET_A2LE(ptr) (((TDS_BYTE_CONVERT2*)(ptr))->usi) # define TDS_GET_A4LE(ptr) (((TDS_BYTE_CONVERT4*)(ptr))->ui) # define TDS_PUT_A1(ptr,val) TDS_PUT_A1LE(ptr,val) # define TDS_PUT_UA1(ptr,val) TDS_PUT_UA1LE(ptr,val) # define TDS_PUT_A2(ptr,val) TDS_PUT_A2LE(ptr,val) # define TDS_PUT_UA2(ptr,val) TDS_PUT_UA2LE(ptr,val) # define TDS_PUT_A4(ptr,val) TDS_PUT_A4LE(ptr,val) # define TDS_PUT_UA4(ptr,val) TDS_PUT_UA4LE(ptr,val) # undef TDS_PUT_A2LE # undef TDS_PUT_A4LE # define TDS_PUT_A2LE(ptr,val) (((TDS_BYTE_CONVERT2*)(ptr))->usi = (val)) # define TDS_PUT_A4LE(ptr,val) (((TDS_BYTE_CONVERT4*)(ptr))->ui = (val)) # define TDS_HOST2LE(val) (val) # define TDS_HOST4LE(val) (val) # define TDS_HOST2BE(val) TDS_BYTE_SWAP16(val) # define TDS_HOST4BE(val) TDS_BYTE_SWAP32(val) #endif /* these platform support unaligned fetch/store */ /* map unaligned macro to aligned ones */ #if defined(__i386__) || defined(__amd64__) || defined(__CRIS__) ||\ defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__) ||\ defined(__s390__) || defined(__s390x__) || defined(__m68k__) ||\ (defined(_MSC_VER) && (defined(_M_AMD64) || defined(_M_IX86) || defined(_M_X64))) ||\ defined(__ARM_FEATURE_UNALIGNED) ||\ defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_8__) ||\ (defined(_M_ARM) && (_M_ARM >= 7)) # ifdef WORDS_BIGENDIAN # undef TDS_GET_UA2BE # undef TDS_GET_UA4BE # define TDS_GET_UA2BE(ptr) TDS_GET_A2BE(ptr) # define TDS_GET_UA4BE(ptr) TDS_GET_A4BE(ptr) # undef TDS_PUT_UA2BE # undef TDS_PUT_UA4BE # define TDS_PUT_UA2BE(ptr,val) TDS_PUT_A2BE(ptr,val) # define TDS_PUT_UA4BE(ptr,val) TDS_PUT_A4BE(ptr,val) # else # undef TDS_GET_UA2LE # undef TDS_GET_UA4LE # define TDS_GET_UA2LE(ptr) TDS_GET_A2LE(ptr) # define TDS_GET_UA4LE(ptr) TDS_GET_A4LE(ptr) # undef TDS_PUT_UA2LE # undef TDS_PUT_UA4LE # define TDS_PUT_UA2LE(ptr,val) TDS_PUT_A2LE(ptr,val) # define TDS_PUT_UA4LE(ptr,val) TDS_PUT_A4LE(ptr,val) # endif #endif #undef TDS_BSWAP16 #undef TDS_BSWAP32 /* __builtin_bswap16 was introduced in GCC 4.8 */ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) && defined(__OPTIMIZE__) # define TDS_BSWAP16(val) __builtin_bswap16(val) # define TDS_BSWAP32(val) __builtin_bswap32(val) /* __builtin_bswap32 was introduced in GCC 4.3 */ #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && defined(__OPTIMIZE__) # define TDS_BSWAP32(val) __builtin_bswap32(val) #elif defined(_MSC_VER) # define TDS_BSWAP16(val) _byteswap_ushort(val) # define TDS_BSWAP32(val) _byteswap_ulong(val) #endif #if defined(TDS_BSWAP16) && !defined(WORDS_BIGENDIAN) # undef TDS_GET_UA2BE # define TDS_GET_UA2BE(ptr) TDS_BSWAP16(TDS_GET_UA2LE(ptr)) # undef TDS_PUT_UA2BE # define TDS_PUT_UA2BE(ptr,val) do {\ uint16_t _tds_si = TDS_BSWAP16(val); TDS_PUT_UA2LE(ptr,_tds_si); } while(0) #elif defined(TDS_BSWAP16) && defined(WORDS_BIGENDIAN) # undef TDS_GET_UA2LE # define TDS_GET_UA2LE(ptr) TDS_BSWAP16(TDS_GET_UA2BE(ptr)) # undef TDS_PUT_UA2LE # define TDS_PUT_UA2LE(ptr,val) do {\ uint16_t _tds_si = TDS_BSWAP16(val); TDS_PUT_UA2BE(ptr,_tds_si); } while(0) #endif #if defined(TDS_BSWAP32) && !defined(WORDS_BIGENDIAN) # undef TDS_GET_UA4BE # define TDS_GET_UA4BE(ptr) TDS_BSWAP32(TDS_GET_UA4LE(ptr)) # undef TDS_PUT_UA4BE # define TDS_PUT_UA4BE(ptr,val) do {\ uint32_t _tds_i = TDS_BSWAP32(val); TDS_PUT_UA4LE(ptr,_tds_i); } while(0) #elif defined(TDS_BSWAP32) && defined(WORDS_BIGENDIAN) # undef TDS_GET_UA4LE # define TDS_GET_UA4LE(ptr) TDS_BSWAP32(TDS_GET_UA4BE(ptr)) # undef TDS_PUT_UA4LE # define TDS_PUT_UA4LE(ptr,val) do {\ uint32_t _tds_i = TDS_BSWAP32(val); TDS_PUT_UA4BE(ptr,_tds_i); } while(0) #endif #if defined(__GNUC__) && defined(__powerpc__) && defined(WORDS_BIGENDIAN) # undef TDS_GET_UA2LE # undef TDS_GET_UA4LE static inline uint16_t TDS_GET_UA2LE(void *ptr) { unsigned long res; __asm__ ("lhbrx %0,0,%1\n" : "=r" (res) : "r" (ptr), "m"(*(uint16_t *)ptr)); return (uint16_t) res; } static inline uint32_t TDS_GET_UA4LE(void *ptr) { unsigned long res; __asm__ ("lwbrx %0,0,%1\n" : "=r" (res) : "r" (ptr), "m"(*(uint32_t *)ptr)); return (uint32_t) res; } # undef TDS_PUT_UA2LE # undef TDS_PUT_UA4LE static inline void TDS_PUT_UA2LE(void *ptr, unsigned data) { __asm__ ("sthbrx %1,0,%2\n" : "=m" (*(uint16_t *)ptr) : "r" (data), "r" (ptr)); } static inline void TDS_PUT_UA4LE(void *ptr, unsigned data) { __asm__ ("stwbrx %1,0,%2\n" : "=m" (*(uint32_t *)ptr) : "r" (data), "r" (ptr)); } #endif #endif freetds-1.3.6/include/freetds/thread.h000644 025423 025423 00000023334 14056414221 021306 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * * Copyright (C) 2005 Liam Widdowson * Copyright (C) 2010-2012 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef TDSTHREAD_H #define TDSTHREAD_H 1 #undef TDS_HAVE_MUTEX #if defined(_THREAD_SAFE) && defined(TDS_HAVE_PTHREAD_MUTEX) #include #include #include #include typedef pthread_mutex_t tds_raw_mutex; #define TDS_RAW_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx) { pthread_mutex_lock(mtx); } static inline int tds_raw_mutex_trylock(tds_raw_mutex *mtx) { return pthread_mutex_trylock(mtx); } static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx) { pthread_mutex_unlock(mtx); } static inline int tds_raw_mutex_init(tds_raw_mutex *mtx) { return pthread_mutex_init(mtx, NULL); } static inline void tds_raw_mutex_free(tds_raw_mutex *mtx) { pthread_mutex_destroy(mtx); } typedef pthread_cond_t tds_condition; int tds_raw_cond_init(tds_condition *cond); static inline int tds_raw_cond_destroy(tds_condition *cond) { return pthread_cond_destroy(cond); } static inline int tds_raw_cond_signal(tds_condition *cond) { return pthread_cond_signal(cond); } static inline int tds_raw_cond_wait(tds_condition *cond, tds_raw_mutex *mtx) { return pthread_cond_wait(cond, mtx); } int tds_raw_cond_timedwait(tds_condition *cond, tds_raw_mutex *mtx, int timeout_sec); #define TDS_HAVE_MUTEX 1 typedef pthread_t tds_thread; typedef pthread_t tds_thread_id; typedef void *(*tds_thread_proc)(void *arg); #define TDS_THREAD_PROC_DECLARE(name, arg) \ void *name(void *arg) #define TDS_THREAD_RESULT(n) ((void*)(intptr_t)(n)) static inline int tds_thread_create(tds_thread *ret, tds_thread_proc proc, void *arg) { return pthread_create(ret, NULL, proc, arg); } static inline int tds_thread_create_detached(tds_thread_proc proc, void *arg) { tds_thread th; int ret = pthread_create(&th, NULL, proc, arg); if (!ret) pthread_detach(th); return ret; } static inline int tds_thread_join(tds_thread th, void **ret) { return pthread_join(th, ret); } static inline tds_thread_id tds_thread_get_current_id(void) { return pthread_self(); } static inline int tds_thread_is_current(tds_thread_id th) { return pthread_equal(th, pthread_self()); } #include #elif defined(_WIN32) #include #include /* old version of Windows do not define this constant */ #ifndef ETIMEDOUT #define ETIMEDOUT 138 #endif struct ptw32_mcs_node_t_; typedef struct { struct ptw32_mcs_node_t_ *lock; LONG done; DWORD thread_id; CRITICAL_SECTION crit; } tds_raw_mutex; #define TDS_RAW_MUTEX_INITIALIZER { NULL, 0, 0 } static inline int tds_raw_mutex_init(tds_raw_mutex *mtx) { mtx->lock = NULL; mtx->done = 0; mtx->thread_id = 0; return 0; } void tds_win_mutex_lock(tds_raw_mutex *mutex); static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx) { if (mtx->done) { EnterCriticalSection(&mtx->crit); mtx->thread_id = GetCurrentThreadId(); } else { tds_win_mutex_lock(mtx); } } int tds_raw_mutex_trylock(tds_raw_mutex *mtx); static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx) { mtx->thread_id = 0; LeaveCriticalSection(&mtx->crit); } static inline void tds_raw_mutex_free(tds_raw_mutex *mtx) { if (mtx->done) { DeleteCriticalSection(&mtx->crit); mtx->done = 0; } } #define TDS_HAVE_MUTEX 1 /* easy way, only single signal supported */ typedef void *TDS_CONDITION_VARIABLE; typedef union { HANDLE ev; TDS_CONDITION_VARIABLE cv; } tds_condition; extern int (*tds_raw_cond_init)(tds_condition *cond); extern int (*tds_raw_cond_destroy)(tds_condition *cond); extern int (*tds_raw_cond_signal)(tds_condition *cond); extern int (*tds_raw_cond_timedwait)(tds_condition *cond, tds_raw_mutex *mtx, int timeout_sec); static inline int tds_raw_cond_wait(tds_condition *cond, tds_raw_mutex *mtx) { return tds_raw_cond_timedwait(cond, mtx, -1); } typedef HANDLE tds_thread; typedef DWORD tds_thread_id; typedef DWORD (WINAPI *tds_thread_proc)(void *arg); #define TDS_THREAD_PROC_DECLARE(name, arg) \ DWORD WINAPI name(void *arg) #define TDS_THREAD_RESULT(n) ((DWORD)(int)(n)) static inline int tds_thread_create(tds_thread *ret, tds_thread_proc proc, void *arg) { *ret = CreateThread(NULL, 0, proc, arg, 0, NULL); return *ret != NULL ? 0 : 11 /* EAGAIN */; } static inline int tds_thread_create_detached(tds_thread_proc proc, void *arg) { HANDLE h = CreateThread(NULL, 0, proc, arg, 0, NULL); if (h) return 0; CloseHandle(h); return 11 /* EAGAIN */; } static inline int tds_thread_join(tds_thread th, void **ret) { if (WaitForSingleObject(th, INFINITE) == WAIT_OBJECT_0) { if (ret) { DWORD r; if (!GetExitCodeThread(th, &r)) r = 0xffffffffu; *ret = (void*) (((char*)0) + r); } CloseHandle(th); return 0; } CloseHandle(th); return 22 /* EINVAL */; } static inline tds_thread_id tds_thread_get_current_id(void) { return GetCurrentThreadId(); } static inline int tds_thread_is_current(tds_thread_id th) { return th == GetCurrentThreadId(); } #else #include /* define noops as "successful" */ typedef struct { char dummy[0]; /* compiler compatibility */ } tds_raw_mutex; #define TDS_RAW_MUTEX_INITIALIZER {} static inline void tds_raw_mutex_lock(tds_raw_mutex *mtx) { } static inline int tds_raw_mutex_trylock(tds_raw_mutex *mtx) { return 0; } static inline void tds_raw_mutex_unlock(tds_raw_mutex *mtx) { } static inline int tds_raw_mutex_init(tds_raw_mutex *mtx) { return 0; } static inline void tds_raw_mutex_free(tds_raw_mutex *mtx) { } typedef struct { char dummy[0]; /* compiler compatibility */ } tds_condition; static inline int tds_raw_cond_init(tds_condition *cond) { return 0; } static inline int tds_raw_cond_destroy(tds_condition *cond) { return 0; } #define tds_raw_cond_signal(cond) \ FreeTDS_Condition_not_compiled #define tds_raw_cond_wait(cond, mtx) \ FreeTDS_Condition_not_compiled #define tds_raw_cond_timedwait(cond, mtx, timeout_sec) \ FreeTDS_Condition_not_compiled typedef struct { char dummy[0]; /* compiler compatibility */ } tds_thread; typedef int tds_thread_id; typedef void *(*tds_thread_proc)(void *arg); #define TDS_THREAD_PROC_DECLARE(name, arg) \ void *name(void *arg) #define TDS_THREAD_RESULT(n) ((void*)(intptr_t)(n)) #define tds_thread_create(ret, proc, arg) \ FreeTDS_Thread_not_compiled #define tds_thread_create_detached(proc, arg) \ FreeTDS_Thread_not_compiled #define tds_thread_join(th, ret) \ FreeTDS_Thread_not_compiled static inline tds_thread_id tds_thread_get_current_id(void) { return 0; } static inline int tds_thread_is_current(tds_thread_id th) { return 1; } #endif # define tds_cond_init tds_raw_cond_init # define tds_cond_destroy tds_raw_cond_destroy # define tds_cond_signal tds_raw_cond_signal # if !ENABLE_EXTRA_CHECKS # define TDS_MUTEX_INITIALIZER TDS_RAW_MUTEX_INITIALIZER # define tds_mutex tds_raw_mutex # define tds_mutex_lock tds_raw_mutex_lock # define tds_mutex_trylock tds_raw_mutex_trylock # define tds_mutex_unlock tds_raw_mutex_unlock # define tds_mutex_check_owned(mtx) do {} while(0) # define tds_mutex_init tds_raw_mutex_init # define tds_mutex_free tds_raw_mutex_free # define tds_cond_wait tds_raw_cond_wait # define tds_cond_timedwait tds_raw_cond_timedwait # else # include typedef struct tds_mutex { tds_raw_mutex mtx; volatile int locked; volatile tds_thread_id locked_by; } tds_mutex; # define TDS_MUTEX_INITIALIZER { TDS_RAW_MUTEX_INITIALIZER, 0 } static inline void tds_mutex_lock(tds_mutex *mtx) { assert(mtx); tds_raw_mutex_lock(&mtx->mtx); assert(!mtx->locked); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); } static inline int tds_mutex_trylock(tds_mutex *mtx) { int ret; assert(mtx); ret = tds_raw_mutex_trylock(&mtx->mtx); if (!ret) { assert(!mtx->locked); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); } return ret; } static inline void tds_mutex_unlock(tds_mutex *mtx) { assert(mtx && mtx->locked); mtx->locked = 0; tds_raw_mutex_unlock(&mtx->mtx); } static inline void tds_mutex_check_owned(tds_mutex *mtx) { int ret; assert(mtx); ret = tds_raw_mutex_trylock(&mtx->mtx); assert(ret); assert(mtx->locked); assert(tds_thread_is_current(mtx->locked_by)); } static inline int tds_mutex_init(tds_mutex *mtx) { mtx->locked = 0; return tds_raw_mutex_init(&mtx->mtx); } static inline void tds_mutex_free(tds_mutex *mtx) { assert(mtx && !mtx->locked); tds_raw_mutex_free(&mtx->mtx); } static inline int tds_cond_wait(tds_condition *cond, tds_mutex *mtx) { int ret; assert(mtx && mtx->locked); mtx->locked = 0; ret = tds_raw_cond_wait(cond, &mtx->mtx); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); return ret; } static inline int tds_cond_timedwait(tds_condition *cond, tds_mutex *mtx, int timeout_sec) { int ret; assert(mtx && mtx->locked); mtx->locked = 0; ret = tds_raw_cond_timedwait(cond, &mtx->mtx, timeout_sec); mtx->locked = 1; mtx->locked_by = tds_thread_get_current_id(); return ret; } # endif #endif freetds-1.3.6/include/freetds/proto.h000644 025423 025423 00000043006 14056414221 021200 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010, 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * This file contains defines and structures strictly related to TDS protocol */ typedef struct tdsnumeric { unsigned char precision; unsigned char scale; unsigned char array[33]; } TDS_NUMERIC; typedef struct tdsoldmoney { TDS_INT mnyhigh; TDS_UINT mnylow; } TDS_OLD_MONEY; typedef union tdsmoney { TDS_OLD_MONEY tdsoldmoney; TDS_INT8 mny; } TDS_MONEY; typedef struct tdsmoney4 { TDS_INT mny4; } TDS_MONEY4; typedef struct tdsdatetime { TDS_INT dtdays; TDS_INT dttime; } TDS_DATETIME; typedef struct tdsdatetime4 { TDS_USMALLINT days; TDS_USMALLINT minutes; } TDS_DATETIME4; typedef struct tdsunique { TDS_UINT Data1; TDS_USMALLINT Data2; TDS_USMALLINT Data3; TDS_UCHAR Data4[8]; } TDS_UNIQUE; typedef TDS_INT TDS_DATE; typedef TDS_INT TDS_TIME; typedef TDS_UINT8 TDS_BIGTIME; typedef TDS_UINT8 TDS_BIGDATETIME; #define TDS5_PARAMFMT2_TOKEN 32 /* 0x20 */ #define TDS_LANGUAGE_TOKEN 33 /* 0x21 TDS 5.0 only */ #define TDS_ORDERBY2_TOKEN 34 /* 0x22 */ #define TDS_ROWFMT2_TOKEN 97 /* 0x61 TDS 5.0 only */ #define TDS_MSG_TOKEN 101 /* 0x65 TDS 5.0 only */ #define TDS_LOGOUT_TOKEN 113 /* 0x71 TDS 5.0 only? ct_close() */ #define TDS_RETURNSTATUS_TOKEN 121 /* 0x79 */ #define TDS_PROCID_TOKEN 124 /* 0x7C TDS 4.2 only - TDS_PROCID */ #define TDS7_RESULT_TOKEN 129 /* 0x81 TDS 7.0 only */ #define TDS7_COMPUTE_RESULT_TOKEN 136 /* 0x88 TDS 7.0 only */ #define TDS_COLNAME_TOKEN 160 /* 0xA0 TDS 4.2 only */ #define TDS_COLFMT_TOKEN 161 /* 0xA1 TDS 4.2 only - TDS_COLFMT */ #define TDS_DYNAMIC2_TOKEN 163 /* 0xA3 */ #define TDS_TABNAME_TOKEN 164 /* 0xA4 */ #define TDS_COLINFO_TOKEN 165 /* 0xA5 */ #define TDS_OPTIONCMD_TOKEN 166 /* 0xA6 */ #define TDS_COMPUTE_NAMES_TOKEN 167 /* 0xA7 */ #define TDS_COMPUTE_RESULT_TOKEN 168 /* 0xA8 */ #define TDS_ORDERBY_TOKEN 169 /* 0xA9 TDS_ORDER */ #define TDS_ERROR_TOKEN 170 /* 0xAA */ #define TDS_INFO_TOKEN 171 /* 0xAB */ #define TDS_PARAM_TOKEN 172 /* 0xAC RETURNVALUE? */ #define TDS_LOGINACK_TOKEN 173 /* 0xAD */ #define TDS_CONTROL_FEATUREEXTACK_TOKEN \ 174 /* 0xAE TDS_CONTROL/TDS_FEATUREEXTACK */ #define TDS_ROW_TOKEN 209 /* 0xD1 */ #define TDS_NBC_ROW_TOKEN 210 /* 0xD2 as of TDS 7.3.B */ #define TDS_CMP_ROW_TOKEN 211 /* 0xD3 */ #define TDS5_PARAMS_TOKEN 215 /* 0xD7 TDS 5.0 only */ #define TDS_CAPABILITY_TOKEN 226 /* 0xE2 */ #define TDS_ENVCHANGE_TOKEN 227 /* 0xE3 */ #define TDS_SESSIONSTATE_TOKEN 228 /* 0xE4 TDS 7.4 */ #define TDS_EED_TOKEN 229 /* 0xE5 */ #define TDS_DBRPC_TOKEN 230 /* 0xE6 TDS 5.0 only */ #define TDS5_DYNAMIC_TOKEN 231 /* 0xE7 TDS 5.0 only */ #define TDS5_PARAMFMT_TOKEN 236 /* 0xEC TDS 5.0 only */ #define TDS_AUTH_TOKEN 237 /* 0xED TDS 7.0 only */ #define TDS_RESULT_TOKEN 238 /* 0xEE */ #define TDS_DONE_TOKEN 253 /* 0xFD TDS_DONE */ #define TDS_DONEPROC_TOKEN 254 /* 0xFE TDS_DONEPROC */ #define TDS_DONEINPROC_TOKEN 255 /* 0xFF TDS_DONEINPROC */ /* CURSOR support: TDS 5.0 only*/ #define TDS_CURCLOSE_TOKEN 128 /* 0x80 TDS 5.0 only */ #define TDS_CURDELETE_TOKEN 129 /* 0x81 TDS 5.0 only */ #define TDS_CURFETCH_TOKEN 130 /* 0x82 TDS 5.0 only */ #define TDS_CURINFO_TOKEN 131 /* 0x83 TDS 5.0 only */ #define TDS_CUROPEN_TOKEN 132 /* 0x84 TDS 5.0 only */ #define TDS_CURDECLARE_TOKEN 134 /* 0x86 TDS 5.0 only */ /* environment type field */ #define TDS_ENV_DATABASE 1 #define TDS_ENV_LANG 2 #define TDS_ENV_CHARSET 3 #define TDS_ENV_PACKSIZE 4 #define TDS_ENV_LCID 5 #define TDS_ENV_SQLCOLLATION 7 #define TDS_ENV_BEGINTRANS 8 #define TDS_ENV_COMMITTRANS 9 #define TDS_ENV_ROLLBACKTRANS 10 #define TDS_ENV_ROUTING 20 /* Microsoft internal stored procedure id's */ #define TDS_SP_CURSOR 1 #define TDS_SP_CURSOROPEN 2 #define TDS_SP_CURSORPREPARE 3 #define TDS_SP_CURSOREXECUTE 4 #define TDS_SP_CURSORPREPEXEC 5 #define TDS_SP_CURSORUNPREPARE 6 #define TDS_SP_CURSORFETCH 7 #define TDS_SP_CURSOROPTION 8 #define TDS_SP_CURSORCLOSE 9 #define TDS_SP_EXECUTESQL 10 #define TDS_SP_PREPARE 11 #define TDS_SP_EXECUTE 12 #define TDS_SP_PREPEXEC 13 #define TDS_SP_PREPEXECRPC 14 #define TDS_SP_UNPREPARE 15 /* * Sybase does an awful job of this stuff, non null ints of size 1 2 * and 4 have there own codes but nullable ints are lumped into INTN * sheesh! */ typedef enum { SYBCHAR = 47, /* 0x2F */ SYBVARCHAR = 39, /* 0x27 */ SYBINTN = 38, /* 0x26 */ SYBINT1 = 48, /* 0x30 */ SYBINT2 = 52, /* 0x34 */ SYBINT4 = 56, /* 0x38 */ SYBFLT8 = 62, /* 0x3E */ SYBDATETIME = 61, /* 0x3D */ SYBBIT = 50, /* 0x32 */ SYBTEXT = 35, /* 0x23 */ SYBNTEXT = 99, /* 0x63 */ SYBIMAGE = 34, /* 0x22 */ SYBMONEY4 = 122, /* 0x7A */ SYBMONEY = 60, /* 0x3C */ SYBDATETIME4 = 58, /* 0x3A */ SYBREAL = 59, /* 0x3B */ SYBBINARY = 45, /* 0x2D */ SYBVOID = 31, /* 0x1F */ SYBVARBINARY = 37, /* 0x25 */ SYBBITN = 104, /* 0x68 */ SYBNUMERIC = 108, /* 0x6C */ SYBDECIMAL = 106, /* 0x6A */ SYBFLTN = 109, /* 0x6D */ SYBMONEYN = 110, /* 0x6E */ SYBDATETIMN = 111, /* 0x6F */ /* * MS only types */ SYBNVARCHAR = 103, /* 0x67 */ SYBINT8 = 127, /* 0x7F */ XSYBCHAR = 175, /* 0xAF */ XSYBVARCHAR = 167, /* 0xA7 */ XSYBNVARCHAR = 231, /* 0xE7 */ XSYBNCHAR = 239, /* 0xEF */ XSYBVARBINARY = 165, /* 0xA5 */ XSYBBINARY = 173, /* 0xAD */ SYBUNIQUE = 36, /* 0x24 */ SYBVARIANT = 98, /* 0x62 */ SYBMSUDT = 240, /* 0xF0 */ SYBMSXML = 241, /* 0xF1 */ SYBMSDATE = 40, /* 0x28 */ SYBMSTIME = 41, /* 0x29 */ SYBMSDATETIME2 = 42, /* 0x2a */ SYBMSDATETIMEOFFSET = 43,/* 0x2b */ /* * Sybase only types */ SYBLONGBINARY = 225, /* 0xE1 */ SYBUINT1 = 64, /* 0x40 */ SYBUINT2 = 65, /* 0x41 */ SYBUINT4 = 66, /* 0x42 */ SYBUINT8 = 67, /* 0x43 */ SYBBLOB = 36, /* 0x24 */ SYBBOUNDARY = 104, /* 0x68 */ SYBDATE = 49, /* 0x31 */ SYBDATEN = 123, /* 0x7B */ SYB5INT8 = 191, /* 0xBF */ SYBINTERVAL = 46, /* 0x2E */ SYBLONGCHAR = 175, /* 0xAF */ SYBSENSITIVITY = 103, /* 0x67 */ SYBSINT1 = 176, /* 0xB0 */ SYBTIME = 51, /* 0x33 */ SYBTIMEN = 147, /* 0x93 */ SYBUINTN = 68, /* 0x44 */ SYBUNITEXT = 174, /* 0xAE */ SYBXML = 163, /* 0xA3 */ SYB5BIGDATETIME = 187, /* 0xBB */ SYB5BIGTIME = 188, /* 0xBC */ } TDS_SERVER_TYPE; typedef enum { USER_UNICHAR_TYPE = 34, /* 0x22 */ USER_UNIVARCHAR_TYPE = 35 /* 0x23 */ } TDS_USER_TYPE; /* compute operator */ #define SYBAOPCNT 75 /* 0x4B */ #define SYBAOPCNTU 76 /* 0x4C, obsolete */ #define SYBAOPSUM 77 /* 0x4D */ #define SYBAOPSUMU 78 /* 0x4E, obsolete */ #define SYBAOPAVG 79 /* 0x4F */ #define SYBAOPAVGU 80 /* 0x50, obsolete */ #define SYBAOPMIN 81 /* 0x51 */ #define SYBAOPMAX 82 /* 0x52 */ /* mssql2k compute operator */ #define SYBAOPCNT_BIG 9 /* 0x09 */ #define SYBAOPSTDEV 48 /* 0x30 */ #define SYBAOPSTDEVP 49 /* 0x31 */ #define SYBAOPVAR 50 /* 0x32 */ #define SYBAOPVARP 51 /* 0x33 */ #define SYBAOPCHECKSUM_AGG 114 /* 0x72 */ /** * options that can be sent with a TDS_OPTIONCMD token */ typedef enum { TDS_OPT_SET = 1 /**< Set an option. */ , TDS_OPT_DEFAULT = 2 /**< Set option to its default value. */ , TDS_OPT_LIST = 3 /**< Request current setting of a specific option. */ , TDS_OPT_INFO = 4 /**< Report current setting of a specific option. */ } TDS_OPTION_CMD; typedef enum { TDS_OPT_DATEFIRST = 1 /* 0x01 */ , TDS_OPT_TEXTSIZE = 2 /* 0x02 */ , TDS_OPT_STAT_TIME = 3 /* 0x03 */ , TDS_OPT_STAT_IO = 4 /* 0x04 */ , TDS_OPT_ROWCOUNT = 5 /* 0x05 */ , TDS_OPT_NATLANG = 6 /* 0x06 */ , TDS_OPT_DATEFORMAT = 7 /* 0x07 */ , TDS_OPT_ISOLATION = 8 /* 0x08 */ , TDS_OPT_AUTHON = 9 /* 0x09 */ , TDS_OPT_CHARSET = 10 /* 0x0a */ , TDS_OPT_SHOWPLAN = 13 /* 0x0d */ , TDS_OPT_NOEXEC = 14 /* 0x0e */ , TDS_OPT_ARITHIGNOREON = 15 /* 0x0f */ , TDS_OPT_ARITHABORTON = 17 /* 0x11 */ , TDS_OPT_PARSEONLY = 18 /* 0x12 */ , TDS_OPT_GETDATA = 20 /* 0x14 */ , TDS_OPT_NOCOUNT = 21 /* 0x15 */ , TDS_OPT_FORCEPLAN = 23 /* 0x17 */ , TDS_OPT_FORMATONLY = 24 /* 0x18 */ , TDS_OPT_CHAINXACTS = 25 /* 0x19 */ , TDS_OPT_CURCLOSEONXACT = 26 /* 0x1a */ , TDS_OPT_FIPSFLAG = 27 /* 0x1b */ , TDS_OPT_RESTREES = 28 /* 0x1c */ , TDS_OPT_IDENTITYON = 29 /* 0x1d */ , TDS_OPT_CURREAD = 30 /* 0x1e */ , TDS_OPT_CURWRITE = 31 /* 0x1f */ , TDS_OPT_IDENTITYOFF = 32 /* 0x20 */ , TDS_OPT_AUTHOFF = 33 /* 0x21 */ , TDS_OPT_ANSINULL = 34 /* 0x22 */ , TDS_OPT_QUOTED_IDENT = 35 /* 0x23 */ , TDS_OPT_ARITHIGNOREOFF = 36 /* 0x24 */ , TDS_OPT_ARITHABORTOFF = 37 /* 0x25 */ , TDS_OPT_TRUNCABORT = 38 /* 0x26 */ } TDS_OPTION; enum { TDS_OPT_ARITHOVERFLOW = 0x01, TDS_OPT_NUMERICTRUNC = 0x02 }; enum TDS_OPT_DATEFIRST_CHOICE { TDS_OPT_MONDAY = 1, TDS_OPT_TUESDAY = 2, TDS_OPT_WEDNESDAY = 3, TDS_OPT_THURSDAY = 4, TDS_OPT_FRIDAY = 5, TDS_OPT_SATURDAY = 6, TDS_OPT_SUNDAY = 7 }; enum TDS_OPT_DATEFORMAT_CHOICE { TDS_OPT_FMTMDY = 1, TDS_OPT_FMTDMY = 2, TDS_OPT_FMTYMD = 3, TDS_OPT_FMTYDM = 4, TDS_OPT_FMTMYD = 5, TDS_OPT_FMTDYM = 6 }; enum TDS_OPT_ISOLATION_CHOICE { TDS_OPT_LEVEL0 = 0, TDS_OPT_LEVEL1 = 1, TDS_OPT_LEVEL2 = 2, TDS_OPT_LEVEL3 = 3 }; typedef enum tds_packet_type { TDS_QUERY = 1, TDS_LOGIN = 2, TDS_RPC = 3, TDS_REPLY = 4, TDS_CANCEL = 6, TDS_BULK = 7, TDS7_TRANS = 14, /* transaction management */ TDS_NORMAL = 15, TDS7_LOGIN = 16, TDS7_AUTH = 17, TDS71_PRELOGIN = 18, TDS72_SMP = 0x53 } TDS_PACKET_TYPE; /** * TDS 7.1 collation informations. */ typedef struct { TDS_USMALLINT locale_id; /* master..syslanguages.lcid */ TDS_USMALLINT flags; TDS_UCHAR charset_id; /* or zero */ } TDS71_COLLATION; /** * TDS 7.2 SMP packet header */ typedef struct { TDS_UCHAR signature; /* TDS72_SMP */ TDS_UCHAR type; TDS_USMALLINT sid; TDS_UINT size; TDS_UINT seq; TDS_UINT wnd; } TDS72_SMP_HEADER; enum { TDS_SMP_SYN = 1, TDS_SMP_ACK = 2, TDS_SMP_FIN = 4, TDS_SMP_DATA = 8, }; /* SF stands for "sort flag" */ #define TDS_SF_BIN (TDS_USMALLINT) 0x100 #define TDS_SF_WIDTH_INSENSITIVE (TDS_USMALLINT) 0x080 #define TDS_SF_KATATYPE_INSENSITIVE (TDS_USMALLINT) 0x040 #define TDS_SF_ACCENT_SENSITIVE (TDS_USMALLINT) 0x020 #define TDS_SF_CASE_INSENSITIVE (TDS_USMALLINT) 0x010 /* UT stands for user type */ #define TDS_UT_TIMESTAMP 80 /* mssql login options flags */ enum option_flag1_values { TDS_BYTE_ORDER_X86 = 0, TDS_CHARSET_ASCII = 0, TDS_DUMPLOAD_ON = 0, TDS_FLOAT_IEEE_754 = 0, TDS_INIT_DB_WARN = 0, TDS_SET_LANG_OFF = 0, TDS_USE_DB_SILENT = 0, TDS_BYTE_ORDER_68000 = 0x01, TDS_CHARSET_EBDDIC = 0x02, TDS_FLOAT_VAX = 0x04, TDS_FLOAT_ND5000 = 0x08, TDS_DUMPLOAD_OFF = 0x10, /* prevent BCP */ TDS_USE_DB_NOTIFY = 0x20, TDS_INIT_DB_FATAL = 0x40, TDS_SET_LANG_ON = 0x80 }; enum option_flag2_values { TDS_INIT_LANG_WARN = 0, TDS_INTEGRATED_SECURTY_OFF = 0, TDS_ODBC_OFF = 0, TDS_USER_NORMAL = 0, /* SQL Server login */ TDS_INIT_LANG_REQUIRED = 0x01, TDS_ODBC_ON = 0x02, TDS_TRANSACTION_BOUNDARY71 = 0x04, /* removed in TDS 7.2 */ TDS_CACHE_CONNECT71 = 0x08, /* removed in TDS 7.2 */ TDS_USER_SERVER = 0x10, /* reserved */ TDS_USER_REMUSER = 0x20, /* DQ login */ TDS_USER_SQLREPL = 0x40, /* replication login */ TDS_INTEGRATED_SECURITY_ON = 0x80 }; enum option_flag3_values { TDS_RESTRICTED_COLLATION = 0, TDS_CHANGE_PASSWORD = 0x01, /* TDS 7.2 */ TDS_SEND_YUKON_BINARY_XML = 0x02, /* TDS 7.2 */ TDS_REQUEST_USER_INSTANCE = 0x04, /* TDS 7.2 */ TDS_UNKNOWN_COLLATION_HANDLING = 0x08, /* TDS 7.3 */ TDS_EXTENSION = 0x10, /* TDS 7.4 */ }; enum type_flags { TDS_OLEDB_ON = 0x10, TDS_READONLY_INTENT = 0x20, }; /* Sybase dynamic types */ enum dynamic_types { TDS_DYN_PREPARE = 0x01, TDS_DYN_EXEC = 0x02, TDS_DYN_DEALLOC = 0x04, TDS_DYN_EXEC_IMMED = 0x08, TDS_DYN_PROCNAME = 0x10, TDS_DYN_ACK = 0x20, TDS_DYN_DESCIN = 0x40, TDS_DYN_DESCOUT = 0x80, }; /* http://jtds.sourceforge.net/apiCursors.html */ /* Cursor scroll option, must be one of 0x01 - 0x10, OR'd with other bits */ enum { TDS_CUR_TYPE_KEYSET = 0x0001, /* default */ TDS_CUR_TYPE_DYNAMIC = 0x0002, TDS_CUR_TYPE_FORWARD = 0x0004, TDS_CUR_TYPE_STATIC = 0x0008, TDS_CUR_TYPE_FASTFORWARDONLY = 0x0010, TDS_CUR_TYPE_PARAMETERIZED = 0x1000, TDS_CUR_TYPE_AUTO_FETCH = 0x2000 }; enum { TDS_CUR_CONCUR_READ_ONLY = 1, TDS_CUR_CONCUR_SCROLL_LOCKS = 2, TDS_CUR_CONCUR_OPTIMISTIC = 4, /* default */ TDS_CUR_CONCUR_OPTIMISTIC_VALUES = 8 }; /* TDS 4/5 login*/ #define TDS_MAXNAME 30 /* maximum login name lenghts */ #define TDS_PROGNLEN 10 /* maximum program lenght */ #define TDS_PKTLEN 6 /* maximum packet lenght in login */ /* TDS 5 login security flags */ enum { TDS5_SEC_LOG_ENCRYPT = 1, TDS5_SEC_LOG_CHALLENGE = 2, TDS5_SEC_LOG_LABELS = 4, TDS5_SEC_LOG_APPDEFINED = 8, TDS5_SEC_LOG_SECSESS = 16, TDS5_SEC_LOG_ENCRYPT2 = 32, TDS5_SEC_LOG_ENCRYPT3 = 128, }; /** TDS 5 TDS_MSG_TOKEN message types */ enum { TDS5_MSG_SEC_ENCRYPT = 1, /**< Start encrypted login protocol. */ TDS5_MSG_SEC_LOGPWD = 2, /**< Sending encrypted user password. */ TDS5_MSG_SEC_REMPWD = 3, /**< Sending remote server passwords. */ TDS5_MSG_SEC_CHALLENGE = 4, /**< Start challenge/response protocol. */ TDS5_MSG_SEC_RESPONSE = 5, /**< Returned encrypted challenge. */ TDS5_MSG_SEC_GETLABEL = 6, /**< Start trusted user login protocol. */ TDS5_MSG_SEC_LABEL = 7, /**< Return security labels. */ TDS5_MSG_SQL_TBLNAME = 8, /**< CS_MSG_TABLENAME */ TDS5_MSG_GW_RESERVED = 9, /**< Used by interoperability group. */ TDS5_MSG_OMNI_CAPABILITIES = 10, /**< Used by OMNI SQL Server. */ TDS5_MSG_SEC_OPAQUE = 11, /**< Send opaque security token. */ TDS5_MSG_HAFAILOVER = 12, /**< Used during login to obtain the HA Session ID */ TDS5_MSG_EMPTY = 13, /**< Sometimes a MSG response stream is required by TDS syntax, but the sender has no real information to pass. This message type indicates that the following paramfmt/param streams are meaningless */ TDS5_MSG_SEC_ENCRYPT2 = 14, /**< Start alternate encrypted password protocol. */ TDS5_MSG_SEC_LOGPWD2 = 15, /**< Return alternate encrypted passwords. */ TDS5_MSG_SEC_SUP_CIPHER = 16, /**< Returns list of supported ciphers. */ TDS5_MSG_MIG_REQ = 17, /**< Initiate client connection migration to alternative server via address pro- vided as message parameter. */ TDS5_MSG_MIG_SYNC = 18, /**< Client sends to acknowledge receipt of TDS_MSG_MIG_REQ . */ TDS5_MSG_MIG_CONT = 19, /**< Server sends to start actual client migration to alternate server. */ TDS5_MSG_MIG_IGN = 20, /**< Server sends to abort previous TDS_MSG_MIG_REQ . */ TDS5_MSG_MIG_FAIL = 21, /**< Client sends to original server to indicate that the migration attempt failed. Optional parameter indicates failure reason. */ TDS5_MSG_SEC_REMPWD2 = 22, TDS5_MSG_MIG_RESUME = 23, TDS5_MSG_SEC_ENCRYPT3 = 30, TDS5_MSG_SEC_LOGPWD3 = 31, TDS5_MSG_SEC_REMPWD3 = 32, TDS5_MSG_DR_MAP = 33, }; /** * TDS 5 TDS5_MSG_SEC_OPAQUE types. * * TDS5_SEC_SECSESS has 5 parameters * 1- security version. INTN(4). Always TDS5_SEC_VERSION * 2- security message type. INTN(4). Always TDS5_SEC_SECSESS * 3- security OID. VARBINARY. * 4- opaque security token. LONGVARBINARY. * 5- security services requested. INTN(4). A set of flags. */ enum { TDS5_SEC_SECSESS = 1, /**< Security session token */ TDS5_SEC_FORWARD = 2, /**< Credential forwarding */ TDS5_SEC_SIGN = 3, /**< Data signature packet */ TDS5_SEC_OTHER = 4, /**< Other security message */ }; /** * TDS 5 security services */ enum { TDS5_SEC_NETWORK_AUTHENTICATION = 0x1, TDS5_SEC_MUTUAL_AUTHENTICATION = 0x2, TDS5_SEC_DELEGATION = 0x4, TDS5_SEC_INTEGRITY = 0x8, TDS5_SEC_CONFIDENTIALITY = 0x10, TDS5_SEC_DETECT_REPLAY = 0x20, TDS5_SEC_DETECT_SEQUENCE = 0x40, TDS5_SEC_DATA_ORIGIN = 0x80, TDS5_SEC_CHANNEL_BINDING = 0x100, }; enum { TDS5_SEC_VERSION = 50, }; /* MS encryption byte (pre login) */ enum { TDS7_ENCRYPT_OFF, TDS7_ENCRYPT_ON, TDS7_ENCRYPT_NOT_SUP, TDS7_ENCRYPT_REQ, }; freetds-1.3.6/include/freetds/tds.h000644 025423 025423 00000161727 14056414271 020647 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010, 2011 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tds_h_ #define _tds_h_ #ifndef _freetds_config_h_ #error should include config.h before #endif #include #include #include #ifdef HAVE_STDDEF_H #include #endif #if HAVE_NETDB_H #include #endif /* HAVE_NETDB_H */ #if HAVE_NETINET_IN_H #include #endif /* HAVE_NET_INET_IN_H */ #if HAVE_ARPA_INET_H #include #endif /* HAVE_ARPA_INET_H */ #if HAVE_SYS_SOCKET_H #include #endif /* HAVE_SYS_SOCKET_H */ /* forward declaration */ typedef struct tdsiconvinfo TDSICONV; typedef struct tds_connection TDSCONNECTION; typedef struct tds_socket TDSSOCKET; typedef struct tds_column TDSCOLUMN; typedef struct tds_bcpinfo TDSBCPINFO; #include #include #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #if 0 } #endif #endif /** * A structure to hold all the compile-time settings. * This structure is returned by tds_get_compiletime_settings */ typedef struct tds_compiletime_settings { const char *freetds_version; /* release version of FreeTDS */ const char *sysconfdir; /* location of freetds.conf */ const char *last_update; /* latest software_version date among the modules */ const char *tdsver; /* TDS protocol version (4.2/4.6/5.0/7.0/7.1) 5.0 */ bool msdblib; /* for MS style dblib */ bool sybase_compat; /* enable increased Open Client binary compatibility */ bool threadsafe; /* compile for thread safety default=no */ bool libiconv; /* search for libiconv in DIR/include and DIR/lib */ bool iodbc; /* build odbc driver against iODBC in DIR */ bool unixodbc; /* build odbc driver against unixODBC in DIR */ bool openssl; /* build against OpenSSL */ bool gnutls; /* build against GnuTLS */ bool mars; /* MARS enabled */ bool sspi; /* SSPI enabled */ bool kerberos; /* Kerberos enabled */ } TDS_COMPILETIME_SETTINGS; /** * @file tds.h * Main include file for libtds */ /** * \defgroup libtds LibTDS API * Callable functions in \c libtds. * * The \c libtds library is for use internal to \em FreeTDS. It is not * intended for use by applications. Although any use is \em permitted, you're * encouraged to use one of the established public APIs instead, because their * interfaces are stable and documented by the vendors. */ /* * All references to data that touch the wire should use the following typedefs. * * If you have problems on 64-bit machines and the code is * using a native datatype, please change it to use * these. (In the TDS layer only, the API layers have their * own typedefs which equate to these). */ typedef char TDS_CHAR; /* 8-bit char */ typedef uint8_t TDS_UCHAR; /* 8-bit uchar */ typedef uint8_t TDS_TINYINT; /* 8-bit unsigned */ typedef int16_t TDS_SMALLINT; /* 16-bit int */ typedef uint16_t TDS_USMALLINT; /* 16-bit unsigned */ typedef int32_t TDS_INT; /* 32-bit int */ typedef uint32_t TDS_UINT; /* 32-bit unsigned */ typedef int64_t TDS_INT8; /* 64-bit integer */ typedef uint64_t TDS_UINT8; /* 64-bit unsigned */ typedef intptr_t TDS_INTPTR; typedef uintptr_t TDS_UINTPTR; typedef tds_sysdep_real32_type TDS_REAL; /* 32-bit real */ typedef tds_sysdep_real64_type TDS_FLOAT; /* 64-bit real */ #include #define TDS_INVALID_TYPE ((TDS_SERVER_TYPE) 0) /** * this structure is not directed connected to a TDS protocol but * keeps any DATE/TIME information. */ typedef struct { TDS_UINT8 time; /**< time, 7 digit precision */ TDS_INT date; /**< date, 0 = 1900-01-01 */ TDS_SMALLINT offset; /**< time offset */ TDS_USMALLINT time_prec:3; TDS_USMALLINT _tds_reserved:10; TDS_USMALLINT has_time:1; TDS_USMALLINT has_date:1; TDS_USMALLINT has_offset:1; } TDS_DATETIMEALL; /** Used by tds_datecrack */ typedef struct tdsdaterec { TDS_INT year; /**< year */ TDS_INT quarter; /**< quarter (0-3) */ TDS_INT month; /**< month number (0-11) */ TDS_INT day; /**< day of month (1-31) */ TDS_INT dayofyear; /**< day of year (1-366) */ TDS_INT weekday; /**< day of week (0-6, 0 = sunday) */ TDS_INT hour; /**< 0-23 */ TDS_INT minute; /**< 0-59 */ TDS_INT second; /**< 0-59 */ TDS_INT decimicrosecond; /**< 0-9999999 */ TDS_INT timezone; /**< -840 - 840 minutes from UTC */ } TDSDATEREC; /** * The following little table is indexed by precision and will * tell us the number of bytes required to store the specified * precision. */ extern const int tds_numeric_bytes_per_prec[]; typedef int TDSRET; #define TDS_NO_MORE_RESULTS ((TDSRET)1) #define TDS_SUCCESS ((TDSRET)0) #define TDS_FAIL ((TDSRET)-1) #define TDS_CANCELLED ((TDSRET)-2) #define TDS_FAILED(rc) ((rc)<0) #define TDS_SUCCEED(rc) ((rc)>=0) #define TDS_PROPAGATE(rc) \ do { TDSRET _tds_ret = (rc); if (TDS_FAILED(_tds_ret)) return _tds_ret; } while(0) #define TDS_INT_CONTINUE 1 #define TDS_INT_CANCEL 2 #define TDS_INT_TIMEOUT 3 #define TDS_NO_COUNT -1 #define TDS_ROW_RESULT 4040 #define TDS_PARAM_RESULT 4042 #define TDS_STATUS_RESULT 4043 #define TDS_MSG_RESULT 4044 #define TDS_COMPUTE_RESULT 4045 #define TDS_CMD_DONE 4046 #define TDS_CMD_SUCCEED 4047 #define TDS_CMD_FAIL 4048 #define TDS_ROWFMT_RESULT 4049 #define TDS_COMPUTEFMT_RESULT 4050 #define TDS_DESCRIBE_RESULT 4051 #define TDS_DONE_RESULT 4052 #define TDS_DONEPROC_RESULT 4053 #define TDS_DONEINPROC_RESULT 4054 #define TDS_OTHERS_RESULT 4055 enum tds_token_results { TDS_TOKEN_RES_OTHERS, TDS_TOKEN_RES_ROWFMT, TDS_TOKEN_RES_COMPUTEFMT, TDS_TOKEN_RES_PARAMFMT, TDS_TOKEN_RES_DONE, TDS_TOKEN_RES_ROW, TDS_TOKEN_RES_COMPUTE, TDS_TOKEN_RES_PROC, TDS_TOKEN_RES_MSG, TDS_TOKEN_RES_ENV, }; #define TDS_TOKEN_FLAG(flag) TDS_RETURN_##flag = (1 << (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << (TDS_TOKEN_RES_##flag*2)) enum tds_token_flags { TDS_HANDLE_ALL = 0, TDS_TOKEN_FLAG(OTHERS), TDS_TOKEN_FLAG(ROWFMT), TDS_TOKEN_FLAG(COMPUTEFMT), TDS_TOKEN_FLAG(PARAMFMT), TDS_TOKEN_FLAG(DONE), TDS_TOKEN_FLAG(ROW), TDS_TOKEN_FLAG(COMPUTE), TDS_TOKEN_FLAG(PROC), TDS_TOKEN_FLAG(MSG), TDS_TOKEN_FLAG(ENV), TDS_TOKEN_RESULTS = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC, TDS_TOKEN_TRAILING = TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS }; /** * Flags returned in TDS_DONE token */ enum tds_end { TDS_DONE_FINAL = 0x00 /**< final result set, command completed successfully. */ , TDS_DONE_MORE_RESULTS = 0x01 /**< more results follow */ , TDS_DONE_ERROR = 0x02 /**< error occurred */ , TDS_DONE_INXACT = 0x04 /**< transaction in progress */ , TDS_DONE_PROC = 0x08 /**< results are from a stored procedure */ , TDS_DONE_COUNT = 0x10 /**< count field in packet is valid */ , TDS_DONE_CANCELLED = 0x20 /**< acknowledging an attention command (usually a cancel) */ , TDS_DONE_EVENT = 0x40 /* part of an event notification. */ , TDS_DONE_SRVERROR = 0x100 /**< SQL server server error */ /* after the above flags, a TDS_DONE packet has a field describing the state of the transaction */ , TDS_DONE_NO_TRAN = 0 /* No transaction in effect */ , TDS_DONE_TRAN_SUCCEED = 1 /* Transaction completed successfully */ , TDS_DONE_TRAN_PROGRESS= 2 /* Transaction in progress */ , TDS_DONE_STMT_ABORT = 3 /* A statement aborted */ , TDS_DONE_TRAN_ABORT = 4 /* Transaction aborted */ }; /* * TDSERRNO is emitted by libtds to the client library's error handler * (which may in turn call the client's error handler). * These match the db-lib msgno, because the same values have the same meaning * in db-lib and ODBC. ct-lib maps them to ct-lib numbers (todo). */ typedef enum { TDSEOK = TDS_SUCCESS, TDSEVERDOWN = 100, TDSEINPROGRESS, TDSEICONVIU = 2400, TDSEICONVAVAIL = 2401, TDSEICONVO = 2402, TDSEICONVI = 2403, TDSEICONV2BIG = 2404, TDSEPORTINSTANCE = 2500, TDSESYNC = 20001, TDSEFCON = 20002, TDSETIME = 20003, TDSEREAD = 20004, TDSEWRIT = 20006, TDSESOCK = 20008, TDSECONN = 20009, TDSEMEM = 20010, TDSEINTF = 20012, /* Server name not found in interface file */ TDSEUHST = 20013, /* Unknown host machine name. */ TDSEPWD = 20014, TDSESEOF = 20017, TDSERPND = 20019, TDSEBTOK = 20020, TDSEOOB = 20022, TDSECLOS = 20056, TDSEUSCT = 20058, TDSEUTDS = 20146, TDSEEUNR = 20185, TDSECAP = 20203, TDSENEG = 20210, TDSEUMSG = 20212, TDSECAPTYP = 20213, TDSECONF = 20214, TDSEBPROBADTYP = 20250, TDSECLOSEIN = 20292 } TDSERRNO; enum { TDS_CUR_ISTAT_UNUSED = 0x00, TDS_CUR_ISTAT_DECLARED = 0x01, TDS_CUR_ISTAT_OPEN = 0x02, TDS_CUR_ISTAT_CLOSED = 0x04, TDS_CUR_ISTAT_RDONLY = 0x08, TDS_CUR_ISTAT_UPDATABLE = 0x10, TDS_CUR_ISTAT_ROWCNT = 0x20, TDS_CUR_ISTAT_DEALLOC = 0x40 }; /* string types */ #define TDS_NULLTERM -9 typedef union tds_option_arg { TDS_TINYINT ti; TDS_INT i; TDS_CHAR *c; } TDS_OPTION_ARG; typedef enum tds_encryption_level { TDS_ENCRYPTION_DEFAULT, TDS_ENCRYPTION_OFF, TDS_ENCRYPTION_REQUEST, TDS_ENCRYPTION_REQUIRE } TDS_ENCRYPTION_LEVEL; /* * TODO use system macros for optimization * See mcrypt for reference and linux kernel source for optimization * check if unaligned access and use fast write/read when implemented */ #define TDS_BYTE_SWAP16(value) \ (((((uint16_t)value)<<8) & 0xFF00u) | \ ((((uint16_t)value)>>8) & 0x00FFu)) #define TDS_BYTE_SWAP32(value) \ (((((uint32_t)value)<<24) & 0xFF000000u)| \ ((((uint32_t)value)<< 8) & 0x00FF0000u)| \ ((((uint32_t)value)>> 8) & 0x0000FF00u)| \ ((((uint32_t)value)>>24) & 0x000000FFu)) #define is_end_token(x) ((x) >= TDS_DONE_TOKEN && (x) <= TDS_DONEINPROC_TOKEN) enum { TDS_TYPEFLAG_INVALID = 0, TDS_TYPEFLAG_NULLABLE = 1, TDS_TYPEFLAG_FIXED = 2, TDS_TYPEFLAG_VARIABLE = 4, TDS_TYPEFLAG_COLLATE = 8, TDS_TYPEFLAG_ASCII = 16, TDS_TYPEFLAG_UNICODE = 32, TDS_TYPEFLAG_BINARY = 64, TDS_TYPEFLAG_DATETIME = 128, TDS_TYPEFLAG_NUMERIC = 256, TDS_TYPEFLAG_VARIANT = 512, }; extern const uint16_t tds_type_flags_ms[256]; #if 0 extern const uint16_t tds_type_flags_syb[256]; extern const char *const tds_type_names[256]; #endif #define is_fixed_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_FIXED) != 0) #define is_nullable_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_NULLABLE) != 0) #define is_variable_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIABLE) != 0) #define is_variant_inner_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_VARIANT) != 0) #define is_blob_type(x) ((x)==SYBTEXT || (x)==SYBIMAGE || (x)==SYBNTEXT) #define is_blob_col(x) ((x)->column_varint_size > 2) /* large type means it has a two byte size field */ /* define is_large_type(x) (x>128) */ #define is_numeric_type(x) ((x)==SYBNUMERIC || (x)==SYBDECIMAL) /** return true if type is a datetime (but not date or time) */ #define is_datetime_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_DATETIME) != 0) #define is_unicode_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_UNICODE) != 0) #define is_collate_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_COLLATE) != 0) #define is_ascii_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_ASCII) != 0) #define is_binary_type(x) ((tds_type_flags_ms[x] & TDS_TYPEFLAG_BINARY) != 0) #define is_char_type(x) ((tds_type_flags_ms[x] & (TDS_TYPEFLAG_ASCII|TDS_TYPEFLAG_UNICODE)) != 0) #define is_similar_type(x, y) (is_char_type(x) && is_char_type(y)) static inline bool is_tds_type_valid(int type) { return (unsigned) type < 256u && tds_type_flags_ms[type] != 0; } #define TDS_MAX_CAPABILITY 32 #define MAXPRECISION 77 #define TDS_MAX_CONN 4096 #define TDS_MAX_DYNID_LEN 30 /* defaults to use if no others are found */ #define TDS_DEF_SERVER "SYBASE" #define TDS_DEF_BLKSZ 512 #define TDS_DEF_CHARSET "iso_1" #define TDS_DEF_LANG "us_english" #if TDS50 #define TDS_DEFAULT_VERSION 0x500 #define TDS_DEF_PORT 4000 #elif TDS71 #define TDS_DEFAULT_VERSION 0x701 #define TDS_DEF_PORT 1433 #elif TDS72 #define TDS_DEFAULT_VERSION 0x702 #define TDS_DEF_PORT 1433 #elif TDS73 #define TDS_DEFAULT_VERSION 0x703 #define TDS_DEF_PORT 1433 #elif TDS74 #define TDS_DEFAULT_VERSION 0x704 #define TDS_DEF_PORT 1433 #else #define TDS_DEFAULT_VERSION 0x000 #define TDS_DEF_PORT 1433 #endif /* normalized strings from freetds.conf file */ #define TDS_STR_VERSION "tds version" #define TDS_STR_BLKSZ "initial block size" #define TDS_STR_SWAPDT "swap broken dates" #define TDS_STR_DUMPFILE "dump file" #define TDS_STR_DEBUGLVL "debug level" #define TDS_STR_DEBUGFLAGS "debug flags" #define TDS_STR_TIMEOUT "timeout" #define TDS_STR_QUERY_TIMEOUT "query timeout" #define TDS_STR_CONNTIMEOUT "connect timeout" #define TDS_STR_HOSTNAME "hostname" #define TDS_STR_HOST "host" #define TDS_STR_PORT "port" #define TDS_STR_TEXTSZ "text size" /* for big endian hosts, obsolete, ignored */ #define TDS_STR_EMUL_LE "emulate little endian" #define TDS_STR_CHARSET "charset" #define TDS_STR_CLCHARSET "client charset" #define TDS_STR_USE_UTF_16 "use utf-16" #define TDS_STR_LANGUAGE "language" #define TDS_STR_APPENDMODE "dump file append" #define TDS_STR_DATEFMT "date format" #define TDS_STR_INSTANCE "instance" #define TDS_STR_ASA_DATABASE "asa database" #define TDS_STR_DATABASE "database" #define TDS_STR_ENCRYPTION "encryption" #define TDS_STR_USENTLMV2 "use ntlmv2" #define TDS_STR_USELANMAN "use lanman" /* conf values */ #define TDS_STR_ENCRYPTION_OFF "off" #define TDS_STR_ENCRYPTION_REQUEST "request" #define TDS_STR_ENCRYPTION_REQUIRE "require" /* Defines to enable optional GSSAPI delegation */ #define TDS_GSSAPI_DELEGATION "enable gssapi delegation" /* Mutual authentication */ #define TDS_STR_MUTUAL_AUTHENTICATION "mutual authentication" /* Kerberos realm name */ #define TDS_STR_REALM "realm" /* Kerberos SPN */ #define TDS_STR_SPN "spn" /* CA file */ #define TDS_STR_CAFILE "ca file" /* CRL file */ #define TDS_STR_CRLFILE "crl file" /* check SSL hostname */ #define TDS_STR_CHECKSSLHOSTNAME "check certificate hostname" /* database filename to attach on login (MSSQL) */ #define TDS_STR_DBFILENAME "database filename" /* Application Intent MSSQL 2012 support */ #define TDS_STR_READONLY_INTENT "read-only intent" /* configurable cipher suite to send to openssl's SSL_set_cipher_list() function */ #define TLS_STR_OPENSSL_CIPHERS "openssl ciphers" /* enable old TLS v1, required for instance if you are using a really old Windows XP */ #define TDS_STR_ENABLE_TLS_V1 "enable tls v1" /* TODO do a better check for alignment than this */ typedef union { void *p; int i; int64_t ui; } tds_align_struct; #define TDS_ALIGN_SIZE sizeof(tds_align_struct) typedef struct tds_capability_type { unsigned char type; unsigned char len; /* always sizeof(values) */ unsigned char values[TDS_MAX_CAPABILITY/2-2]; } TDS_CAPABILITY_TYPE; typedef struct tds_capabilities { TDS_CAPABILITY_TYPE types[2]; } TDS_CAPABILITIES; #define TDS_MAX_LOGIN_STR_SZ 128 typedef struct tds_login { DSTR server_name; /**< server name (in freetds.conf) */ int port; /**< port of database service */ TDS_USMALLINT tds_version; /**< TDS version */ int block_size; DSTR language; /* e.g. us-english */ DSTR server_charset; /**< charset of server e.g. iso_1 */ TDS_INT connect_timeout; DSTR client_host_name; DSTR server_host_name; DSTR server_realm_name; /**< server realm name (in freetds.conf) */ DSTR server_spn; /**< server SPN (in freetds.conf) */ DSTR db_filename; /**< database filename to attach (MSSQL) */ DSTR cafile; /**< certificate authorities file */ DSTR crlfile; /**< certificate revocation file */ DSTR openssl_ciphers; DSTR app_name; DSTR user_name; /**< account for login */ DSTR password; /**< password of account login */ DSTR new_password; /**< new password to set (TDS 7.2+) */ DSTR library; /* Ct-Library, DB-Library, TDS-Library or ODBC */ TDS_TINYINT encryption_level; TDS_INT query_timeout; TDS_CAPABILITIES capabilities; DSTR client_charset; DSTR database; struct addrinfo *ip_addrs; /**< ip(s) of server */ DSTR instance_name; DSTR dump_file; int debug_flags; int text_size; DSTR routing_address; uint16_t routing_port; unsigned char option_flag2; unsigned int bulk_copy:1; /**< if bulk copy should be enabled */ unsigned int suppress_language:1; unsigned int gssapi_use_delegation:1; unsigned int mutual_authentication:1; unsigned int use_ntlmv2:1; unsigned int use_ntlmv2_specified:1; unsigned int use_lanman:1; unsigned int mars:1; unsigned int use_utf16:1; unsigned int use_new_password:1; unsigned int valid_configuration:1; unsigned int check_ssl_hostname:1; unsigned int readonly_intent:1; unsigned int enable_tls_v1:1; unsigned int server_is_valid:1; } TDSLOGIN; typedef struct tds_headers { const char *qn_options; const char *qn_msgtext; TDS_INT qn_timeout; /* TDS 7.4+: trace activity ID char[20] */ } TDSHEADERS; typedef struct tds_locale { char *language; char *server_charset; char *date_fmt; } TDSLOCALE; /** * Information about blobs (e.g. text or image). * current_row contains this structure. */ typedef struct tds_blob { TDS_CHAR *textvalue; TDS_CHAR textptr[16]; TDS_CHAR timestamp[8]; unsigned char valid_ptr; } TDSBLOB; /** * Store variant informations */ typedef struct tds_variant { /* this MUST have same position and place of textvalue in tds_blob */ TDS_CHAR *data; TDS_INT size; TDS_INT data_len; TDS_SERVER_TYPE type; TDS_UCHAR collation[5]; } TDSVARIANT; /** * Information relevant to libiconv. The name is an iconv name, not * the same as found in master..syslanguages. */ typedef struct tds_encoding { /** name of the encoding (ie UTF-8) */ const char *name; unsigned char min_bytes_per_char; unsigned char max_bytes_per_char; /** internal numeric index into array of all encodings */ unsigned char canonic; } TDS_ENCODING; typedef struct tds_bcpcoldata { TDS_UCHAR *data; TDS_INT datalen; bool is_null; } BCPCOLDATA; typedef TDSRET tds_func_get_info(TDSSOCKET *tds, TDSCOLUMN *col); typedef TDSRET tds_func_get_data(TDSSOCKET *tds, TDSCOLUMN *col); typedef TDS_INT tds_func_row_len(TDSCOLUMN *col); typedef TDSRET tds_func_put_info(TDSSOCKET *tds, TDSCOLUMN *col); typedef TDSRET tds_func_put_data(TDSSOCKET *tds, TDSCOLUMN *col, int bcp7); typedef int tds_func_check(const TDSCOLUMN *col); typedef struct tds_column_funcs { tds_func_get_info *get_info; tds_func_get_data *get_data; tds_func_row_len *row_len; /** * Send metadata column information to server. * \tds * \param col column to send */ tds_func_put_info *put_info; /** * Send column data to server. * Usually send parameters unless bcp7 is specified, in * this case send BCP for TDS7+ (Sybase use a completely * different format for BCP) * \tds * \param col column to send * \param bcp7 1 to send BCP column on TDS7+ */ tds_func_put_data *put_data; #if ENABLE_EXTRA_CHECKS /** * Check column is valid. * Some things should be checked: * - column_type and on_server.column_type; * - column_size and on_server.column_size; * - column_cur_size; * - column_prec and column_scale; * - is_XXXX_type macros/functions (nullable/fixed/blob/variable); * - tds_get_size_by_type; * - tds_get_conversion_type. * * \tds * \param col column to check */ tds_func_check *check; #endif #if 0 TDSRET (*convert)(TDSSOCKET *tds, TDSCOLUMN *col); #endif } TDSCOLUMNFUNCS; /** * Metadata about columns in regular and compute rows */ struct tds_column { const TDSCOLUMNFUNCS *funcs; TDS_INT column_usertype; TDS_INT column_flags; TDS_INT column_size; /**< maximun size of data. For fixed is the size. */ TDS_SERVER_TYPE column_type; /**< This type can be different from wire type because * conversion (e.g. UCS-2->Ascii) can be applied. * I'm beginning to wonder about the wisdom of this, however. * April 2003 jkl */ TDS_TINYINT column_varint_size; /**< size of length when reading from wire (0, 1, 2 or 4) */ TDS_TINYINT column_prec; /**< precision for decimal/numeric */ TDS_TINYINT column_scale; /**< scale for decimal/numeric */ struct { TDS_SERVER_TYPE column_type; /**< type of data, saved from wire */ TDS_INT column_size; } on_server; TDSICONV *char_conv; /**< refers to previously allocated iconv information */ DSTR table_name; DSTR column_name; DSTR table_column_name; unsigned char *column_data; void (*column_data_free)(struct tds_column *column); unsigned char column_nullable:1; unsigned char column_writeable:1; unsigned char column_identity:1; unsigned char column_key:1; unsigned char column_hidden:1; unsigned char column_output:1; unsigned char column_timestamp:1; unsigned char column_computed:1; TDS_UCHAR column_collation[5]; /* additional fields flags for compute results */ TDS_SMALLINT column_operand; TDS_TINYINT column_operator; /* FIXME this is data related, not column */ /** size written in variable (ie: char, text, binary). -1 if NULL. */ TDS_INT column_cur_size; /* related to binding or info stored by client libraries */ /* FIXME find a best place to store these data, some are unused */ TDS_SMALLINT column_bindtype; TDS_SMALLINT column_bindfmt; TDS_UINT column_bindlen; TDS_SMALLINT *column_nullbind; TDS_CHAR *column_varaddr; TDS_INT *column_lenbind; TDS_INT column_textpos; TDS_INT column_text_sqlgetdatapos; TDS_CHAR column_text_sqlputdatainfo; unsigned char column_iconv_left; char column_iconv_buf[9]; BCPCOLDATA *bcp_column_data; /** * The length, in bytes, of any length prefix this column may have. * For example, strings in some non-C programming languages are * made up of a one-byte length prefix, followed by the string * data itself. * If the data do not have a length prefix, set prefixlen to 0. * Currently not very used in code, however do not remove. */ TDS_INT bcp_prefix_len; TDS_INT bcp_term_len; TDS_CHAR *bcp_terminator; }; /** Hold information for any results */ typedef struct tds_result_info { /* TODO those fields can became a struct */ TDSCOLUMN **columns; TDS_USMALLINT num_cols; TDS_USMALLINT computeid; TDS_INT ref_count; TDSSOCKET *attached_to; unsigned char *current_row; void (*row_free)(struct tds_result_info* result, unsigned char *row); TDS_INT row_size; TDS_SMALLINT *bycolumns; TDS_USMALLINT by_cols; bool rows_exist; /* TODO remove ?? used only in dblib */ bool more_results; } TDSRESULTINFO; /** values for tds->state */ typedef enum tds_states { TDS_IDLE, /**< no data expected */ TDS_WRITING, /**< client is writing data */ TDS_SENDING, /**< client would send data */ TDS_PENDING, /**< cilent is waiting for data */ TDS_READING, /**< client is reading data */ TDS_DEAD /**< no connection */ } TDS_STATE; typedef enum tds_operations { TDS_OP_NONE = 0, /* mssql operations */ TDS_OP_CURSOR = TDS_SP_CURSOR, TDS_OP_CURSOROPEN = TDS_SP_CURSOROPEN, TDS_OP_CURSORPREPARE = TDS_SP_CURSORPREPARE, TDS_OP_CURSOREXECUTE = TDS_SP_CURSOREXECUTE, TDS_OP_CURSORPREPEXEC = TDS_SP_CURSORPREPEXEC, TDS_OP_CURSORUNPREPARE = TDS_SP_CURSORUNPREPARE, TDS_OP_CURSORFETCH = TDS_SP_CURSORFETCH, TDS_OP_CURSOROPTION = TDS_SP_CURSOROPTION, TDS_OP_CURSORCLOSE = TDS_SP_CURSORCLOSE, TDS_OP_EXECUTESQL = TDS_SP_EXECUTESQL, TDS_OP_PREPARE = TDS_SP_PREPARE, TDS_OP_EXECUTE = TDS_SP_EXECUTE, TDS_OP_PREPEXEC = TDS_SP_PREPEXEC, TDS_OP_PREPEXECRPC = TDS_SP_PREPEXECRPC, TDS_OP_UNPREPARE = TDS_SP_UNPREPARE, /* sybase operations */ TDS_OP_DYN_DEALLOC = 100, } TDS_OPERATION; #define TDS_DBG_LOGIN __FILE__, ((__LINE__ << 4) | 11) #define TDS_DBG_HEADER __FILE__, ((__LINE__ << 4) | 10) #define TDS_DBG_FUNC __FILE__, ((__LINE__ << 4) | 7) #define TDS_DBG_INFO2 __FILE__, ((__LINE__ << 4) | 6) #define TDS_DBG_INFO1 __FILE__, ((__LINE__ << 4) | 5) #define TDS_DBG_NETWORK __FILE__, ((__LINE__ << 4) | 4) #define TDS_DBG_WARN __FILE__, ((__LINE__ << 4) | 3) #define TDS_DBG_ERROR __FILE__, ((__LINE__ << 4) | 2) #define TDS_DBG_SEVERE __FILE__, ((__LINE__ << 4) | 1) #define TDS_DBGFLAG_FUNC 0x80 #define TDS_DBGFLAG_INFO2 0x40 #define TDS_DBGFLAG_INFO1 0x20 #define TDS_DBGFLAG_NETWORK 0x10 #define TDS_DBGFLAG_WARN 0x08 #define TDS_DBGFLAG_ERROR 0x04 #define TDS_DBGFLAG_SEVERE 0x02 #define TDS_DBGFLAG_ALL 0xfff #define TDS_DBGFLAG_LOGIN 0x0800 #define TDS_DBGFLAG_HEADER 0x0400 #define TDS_DBGFLAG_PID 0x1000 #define TDS_DBGFLAG_TIME 0x2000 #define TDS_DBGFLAG_SOURCE 0x4000 #define TDS_DBGFLAG_THREAD 0x8000 #if 0 /** * An attempt at better logging. * Using these bitmapped values, various logging features can be turned on and off. * It can be especially helpful to turn packet data on/off for security reasons. */ enum TDS_DBG_LOG_STATE { TDS_DBG_LOGIN = (1 << 0) /**< for diagnosing login problems; otherwise the username/password information is suppressed. */ , TDS_DBG_API = (1 << 1) /**< Log calls to client libraries */ , TDS_DBG_ASYNC = (1 << 2) /**< Log asynchronous function starts or completes. */ , TDS_DBG_DIAG = (1 << 3) /**< Log client- and server-generated messages */ , TDS_DBG_error = (1 << 4) /* TODO: ^^^^^ make upper case when old #defines (above) are removed */ /* Log FreeTDS runtime/logic error occurs. */ , TDS_DBG_PACKET = (1 << 5) /**< Log hex dump of packets to/from the server. */ , TDS_DBG_LIBTDS = (1 << 6) /**< Log calls to (and in) libtds */ , TDS_DBG_CONFIG = (1 << 7) /**< replaces TDSDUMPCONFIG */ , TDS_DBG_DEFAULT = 0xFE /**< all above except login packets */ }; #endif typedef struct tds_result_info TDSCOMPUTEINFO; typedef TDSRESULTINFO TDSPARAMINFO; typedef struct tds_message { TDS_CHAR *server; TDS_CHAR *message; TDS_CHAR *proc_name; TDS_CHAR *sql_state; TDS_INT msgno; TDS_INT line_number; /* -1 .. 255 */ TDS_SMALLINT state; TDS_TINYINT priv_msg_type; TDS_TINYINT severity; /* for library-generated errors */ int oserr; } TDSMESSAGE; typedef struct tds_upd_col { struct tds_upd_col *next; TDS_INT colnamelength; char * columnname; } TDSUPDCOL; typedef enum { TDS_CURSOR_STATE_UNACTIONED = 0 /* initial value */ , TDS_CURSOR_STATE_REQUESTED = 1 /* called by ct_cursor */ , TDS_CURSOR_STATE_SENT = 2 /* sent to server */ , TDS_CURSOR_STATE_ACTIONED = 3 /* acknowledged by server */ } TDS_CURSOR_STATE; typedef struct tds_cursor_status { TDS_CURSOR_STATE declare; TDS_CURSOR_STATE cursor_row; TDS_CURSOR_STATE open; TDS_CURSOR_STATE fetch; TDS_CURSOR_STATE close; TDS_CURSOR_STATE dealloc; } TDS_CURSOR_STATUS; typedef enum tds_cursor_operation { TDS_CURSOR_POSITION = 0, TDS_CURSOR_UPDATE = 1, TDS_CURSOR_DELETE = 2, TDS_CURSOR_INSERT = 4 } TDS_CURSOR_OPERATION; typedef enum tds_cursor_fetch { TDS_CURSOR_FETCH_NEXT = 1, TDS_CURSOR_FETCH_PREV, TDS_CURSOR_FETCH_FIRST, TDS_CURSOR_FETCH_LAST, TDS_CURSOR_FETCH_ABSOLUTE, TDS_CURSOR_FETCH_RELATIVE } TDS_CURSOR_FETCH; /** * Holds informations about a cursor */ typedef struct tds_cursor { struct tds_cursor *next; /**< next in linked list, keep first */ TDS_INT ref_count; /**< reference counter so client can retain safely a pointer */ char *cursor_name; /**< name of the cursor */ TDS_INT cursor_id; /**< cursor id returned by the server after cursor declare */ TDS_TINYINT options; /**< read only|updatable TODO use it */ /** * true if cursor was marker to be closed when connection is idle */ bool defer_close; char *query; /**< SQL query */ /* TODO for updatable columns */ /* TDS_TINYINT number_upd_cols; */ /**< number of updatable columns */ /* TDSUPDCOL *cur_col_list; */ /**< updatable column list */ TDS_INT cursor_rows; /**< number of cursor rows to fetch */ /* TDSPARAMINFO *params; */ /** cursor parameter */ TDS_CURSOR_STATUS status; TDS_USMALLINT srv_status; TDSRESULTINFO *res_info; /** row fetched from this cursor */ TDS_INT type, concurrency; } TDSCURSOR; /** * Current environment as reported by the server */ typedef struct tds_env { /** packet size (512-65535) */ int block_size; char *language; /** character set encoding */ char *charset; /** database name */ char *database; } TDSENV; /** * Holds information for a dynamic (also called prepared) query. */ typedef struct tds_dynamic { struct tds_dynamic *next; /**< next in linked list, keep first */ TDS_INT ref_count; /**< reference counter so client can retain safely a pointer */ /** numeric id for mssql7+*/ TDS_INT num_id; /** * id of dynamic. * Usually this id correspond to server one but if not specified * is generated automatically by libTDS */ char id[30]; /** * this dynamic query cannot be prepared so libTDS have to construct a simple query. * This can happen for instance is tds protocol doesn't support dynamics or trying * to prepare query under Sybase that have BLOBs as parameters. */ TDS_TINYINT emulated; /** * true if dynamic was marker to be closed when connection is idle */ bool defer_close; /* int dyn_state; */ /* TODO use it */ TDSPARAMINFO *res_info; /**< query results */ /** * query parameters. * Mostly used executing query however is a good idea to prepare query * again if parameter type change in an incompatible way (ie different * types or larger size). Is also better to prepare a query knowing * parameter types earlier. */ TDSPARAMINFO *params; /** saved query, we need to know original query if prepare is impossible */ char *query; } TDSDYNAMIC; typedef enum { TDS_MULTIPLE_QUERY, TDS_MULTIPLE_EXECUTE, TDS_MULTIPLE_RPC } TDS_MULTIPLE_TYPE; typedef struct tds_multiple { TDS_MULTIPLE_TYPE type; unsigned int flags; } TDSMULTIPLE; /* forward declaration */ typedef struct tds_context TDSCONTEXT; typedef int (*err_handler_t) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *); struct tds_context { TDSLOCALE *locale; void *parent; /* handlers */ int (*msg_handler) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *); int (*err_handler) (const TDSCONTEXT *, TDSSOCKET *, TDSMESSAGE *); int (*int_handler) (void *); bool money_use_2_digits; }; enum TDS_ICONV_ENTRY { client2ucs2 , client2server_chardata , initial_char_conv_count /* keep last */ }; typedef struct tds_authentication { uint8_t *packet; int packet_len; /* TDS_MSG_TOKEN type, for TDS5 */ uint16_t msg_type; TDSRET (*free)(TDSCONNECTION* conn, struct tds_authentication * auth); TDSRET (*handle_next)(TDSSOCKET * tds, struct tds_authentication * auth, size_t len); } TDSAUTHENTICATION; typedef struct tds_packet { struct tds_packet *next; uint16_t sid; #if ENABLE_ODBC_MARS /** * Data before TDS data, currently can be 0 or sizeof(TDS72_SMP_HEADER) */ uint8_t data_start; #endif /** * data length, this does not account SMP header, only TDS part */ unsigned data_len; unsigned capacity; unsigned char buf[1]; } TDSPACKET; #if ENABLE_ODBC_MARS #define tds_packet_zero_data_start(pkt) do { (pkt)->data_start = 0; } while(0) #define tds_packet_get_data_start(pkt) ((pkt)->data_start) #else #define tds_packet_zero_data_start(pkt) do { } while(0) #define tds_packet_get_data_start(pkt) 0 #endif typedef struct tds_poll_wakeup { TDS_SYS_SOCKET s_signal, s_signaled; } TDSPOLLWAKEUP; /* field related to connection */ struct tds_connection { TDS_USMALLINT tds_version; TDS_UINT product_version; /**< version of product (Sybase/MS and full version) */ char *product_name; TDS_SYS_SOCKET s; /**< tcp socket, INVALID_SOCKET if not connected */ TDSPOLLWAKEUP wakeup; const TDSCONTEXT *tds_ctx; /** environment is shared between all sessions */ TDSENV env; /** * linked list of cursors allocated for this connection * contains only cursors allocated on the server */ TDSCURSOR *cursors; /** * list of dynamic allocated for this connection * contains only dynamic allocated on the server */ TDSDYNAMIC *dyns; int char_conv_count; TDSICONV **char_convs; TDS_UCHAR collation[5]; TDS_UCHAR tds72_transaction[8]; TDS_CAPABILITIES capabilities; unsigned int use_iconv:1; unsigned int tds71rev1:1; unsigned int pending_close:1; /**< true is connection has pending closing (cursors or dynamic) */ unsigned int encrypt_single_packet:1; #if ENABLE_ODBC_MARS unsigned int mars:1; TDSSOCKET *in_net_tds; TDSPACKET *packets; TDSPACKET *recv_packet; TDSPACKET *send_packets; unsigned send_pos, recv_pos; #define BUSY_SOCKET ((TDSSOCKET*)(TDS_UINTPTR)1) #define TDSSOCKET_VALID(tds) (((TDS_UINTPTR)(tds)) > 1) struct tds_socket **sessions; unsigned num_sessions; #endif tds_mutex list_mtx; unsigned num_cached_packets; TDSPACKET *packet_cache; int spid; int client_spid; void *tls_session; #if defined(HAVE_GNUTLS) void *tls_credentials; #elif defined(HAVE_OPENSSL) void *tls_ctx; #else void *tls_dummy; #endif TDSAUTHENTICATION *authentication; char *server; }; /** * Information for a server connection */ struct tds_socket { #if ENABLE_ODBC_MARS TDSCONNECTION *conn; #else TDSCONNECTION conn[1]; #endif void *parent; /** Input buffer. * Points to receiving packet buffer. * As input buffer contains just the raw packet actually this pointer * is the address of recv_packet->buf. */ unsigned char *in_buf; /** Output buffer. * Points to sending packet buffer. * Output buffer can contain additional data before the raw TDS packet * so this buffer can point some bytes after send_packet->buf. * Specifically this will point to send_packet->buf + send_packet->data_start. */ unsigned char *out_buf; /** Maximum size of packet pointed by out_buf. * The buffer is actually a bit larger to make possible to do some * optimizations (at least TDS_ADDITIONAL_SPACE bytes). */ unsigned int out_buf_max; unsigned in_pos; /**< current position in in_buf */ unsigned out_pos; /**< current position in out_buf */ unsigned in_len; /**< input buffer length */ unsigned char in_flag; /**< input buffer type */ unsigned char out_flag; /**< output buffer type */ unsigned frozen; /** * list of packets frozen, points to first one. * send_packet is the last packet in the list. */ TDSPACKET *frozen_packets; #if ENABLE_ODBC_MARS /** SID of MARS session. * ==0 Not in a MARS session or first session * >0 SID of MARS session valid. */ uint16_t sid; /** * This condition will be signaled by the network thread on packet * received or sent for this session */ tds_condition packet_cond; /** * Packet we are trying to send to network. * This field should be protected by conn->list_mtx */ TDSPACKET *sending_packet; TDS_UINT recv_seq; TDS_UINT send_seq; TDS_UINT recv_wnd; TDS_UINT send_wnd; #endif /* packet we received */ TDSPACKET *recv_packet; /** packet we are preparing to send */ TDSPACKET *send_packet; /** * Current query information. * Contains information in process, both normal and compute results. * This pointer shouldn't be freed; it's just an alias to another structure. */ TDSRESULTINFO *current_results; TDSRESULTINFO *res_info; TDS_UINT num_comp_info; TDSCOMPUTEINFO **comp_info; TDSPARAMINFO *param_info; TDSCURSOR *cur_cursor; /**< cursor in use */ bool bulk_query; /**< true is query sent was a bulk query so we need to switch state to QUERYING */ bool has_status; /**< true is ret_status is valid */ bool in_row; /**< true if we are getting rows */ volatile unsigned char in_cancel; /**< indicate we are waiting a cancel reply; discard tokens till acknowledge; 1 mean we have to send cancel packet, 2 already sent. */ TDS_INT ret_status; /**< return status from store procedure */ TDS_STATE state; TDS_INT query_timeout; TDS_INT8 rows_affected; /**< rows updated/deleted/inserted/selected, TDS_NO_COUNT if not valid */ TDSDYNAMIC *cur_dyn; /**< dynamic structure in use */ TDSLOGIN *login; /**< config for login stuff. After login this field is NULL */ void (*env_chg_func) (TDSSOCKET * tds, int type, char *oldval, char *newval); TDS_OPERATION current_op; int option_value; tds_mutex wire_mtx; }; #define tds_get_ctx(tds) ((tds)->conn->tds_ctx) #define tds_set_ctx(tds, val) do { ((tds)->conn->tds_ctx) = (val); } while(0) #define tds_get_parent(tds) ((tds)->parent) #define tds_set_parent(tds, val) do { ((tds)->parent) = (val); } while(0) #define tds_get_s(tds) ((tds)->conn->s) #define tds_set_s(tds, val) do { ((tds)->conn->s) = (val); } while(0) /* config.c */ const TDS_COMPILETIME_SETTINGS *tds_get_compiletime_settings(void); typedef void (*TDSCONFPARSE) (const char *option, const char *value, void *param); bool tds_read_conf_section(FILE * in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param); bool tds_read_conf_file(TDSLOGIN * login, const char *server); void tds_parse_conf_section(const char *option, const char *value, void *param); TDSLOGIN *tds_read_config_info(TDSSOCKET * tds, TDSLOGIN * login, TDSLOCALE * locale); void tds_fix_login(TDSLOGIN* login); TDS_USMALLINT * tds_config_verstr(const char *tdsver, TDSLOGIN* login); struct addrinfo *tds_lookup_host(const char *servername); TDSRET tds_lookup_host_set(const char *servername, struct addrinfo **addr); const char *tds_addrinfo2str(struct addrinfo *addr, char *name, int namemax); char *tds_get_home_file(const char *file); TDSRET tds_set_interfaces_file_loc(const char *interfloc); extern const char STD_DATETIME_FMT[]; int tds_parse_boolean(const char *value, int default_value); int tds_config_boolean(const char *option, const char *value, TDSLOGIN * login); TDSLOCALE *tds_get_locale(void); TDSRET tds_alloc_row(TDSRESULTINFO * res_info); TDSRET tds_alloc_compute_row(TDSCOMPUTEINFO * res_info); BCPCOLDATA * tds_alloc_bcp_column_data(unsigned int column_size); TDSDYNAMIC *tds_lookup_dynamic(TDSCONNECTION * conn, const char *id); /*@observer@*/ const char *tds_prtype(int token); int tds_get_varint_size(TDSCONNECTION * conn, int datatype); TDS_SERVER_TYPE tds_get_cardinal_type(TDS_SERVER_TYPE datatype, int usertype); /* iconv.c */ TDSRET tds_iconv_open(TDSCONNECTION * conn, const char *charset, int use_utf16); void tds_iconv_close(TDSCONNECTION * conn); void tds_srv_charset_changed(TDSCONNECTION * conn, const char *charset); void tds7_srv_charset_changed(TDSCONNECTION * conn, TDS_UCHAR collate[5]); int tds_iconv_alloc(TDSCONNECTION * conn); void tds_iconv_free(TDSCONNECTION * conn); TDSICONV *tds_iconv_from_collate(TDSCONNECTION * conn, TDS_UCHAR collate[5]); /* mem.c */ void tds_free_socket(TDSSOCKET * tds); void tds_free_all_results(TDSSOCKET * tds); void tds_free_results(TDSRESULTINFO * res_info); void tds_free_param_results(TDSPARAMINFO * param_info); void tds_free_param_result(TDSPARAMINFO * param_info); void tds_free_msg(TDSMESSAGE * message); void tds_cursor_deallocated(TDSCONNECTION *conn, TDSCURSOR *cursor); void tds_release_cursor(TDSCURSOR **pcursor); void tds_free_bcp_column_data(BCPCOLDATA * coldata); TDSRESULTINFO *tds_alloc_results(TDS_USMALLINT num_cols); TDSCOMPUTEINFO **tds_alloc_compute_results(TDSSOCKET * tds, TDS_USMALLINT num_cols, TDS_USMALLINT by_cols); TDSCONTEXT *tds_alloc_context(void * parent); void tds_free_context(TDSCONTEXT * locale); TDSPARAMINFO *tds_alloc_param_result(TDSPARAMINFO * old_param); void tds_free_input_params(TDSDYNAMIC * dyn); void tds_release_dynamic(TDSDYNAMIC ** dyn); static inline void tds_release_cur_dyn(TDSSOCKET * tds) { tds_release_dynamic(&tds->cur_dyn); } void tds_dynamic_deallocated(TDSCONNECTION *conn, TDSDYNAMIC *dyn); void tds_set_cur_dyn(TDSSOCKET *tds, TDSDYNAMIC *dyn); TDSSOCKET *tds_realloc_socket(TDSSOCKET * tds, size_t bufsize); char *tds_alloc_client_sqlstate(int msgno); char *tds_alloc_lookup_sqlstate(TDSSOCKET * tds, int msgno); TDSLOGIN *tds_alloc_login(int use_environment); TDSDYNAMIC *tds_alloc_dynamic(TDSCONNECTION * conn, const char *id); void tds_free_login(TDSLOGIN * login); TDSLOGIN *tds_init_login(TDSLOGIN * login, TDSLOCALE * locale); TDSLOCALE *tds_alloc_locale(void); void *tds_alloc_param_data(TDSCOLUMN * curparam); void tds_free_locale(TDSLOCALE * locale); TDSCURSOR * tds_alloc_cursor(TDSSOCKET * tds, const char *name, TDS_INT namelen, const char *query, TDS_INT querylen); void tds_free_row(TDSRESULTINFO * res_info, unsigned char *row); TDSSOCKET *tds_alloc_socket(TDSCONTEXT * context, unsigned int bufsize); TDSSOCKET *tds_alloc_additional_socket(TDSCONNECTION *conn); void tds_set_current_results(TDSSOCKET *tds, TDSRESULTINFO *info); void tds_detach_results(TDSRESULTINFO *info); void * tds_realloc(void **pp, size_t new_size); #define TDS_RESIZE(p, n_elem) \ tds_realloc((void **) &(p), sizeof(*(p)) * (size_t) (n_elem)) #define tds_new(type, n) ((type *) malloc(sizeof(type) * (n))) #define tds_new0(type, n) ((type *) calloc(n, sizeof(type))) TDSPACKET *tds_alloc_packet(void *buf, unsigned len); TDSPACKET *tds_realloc_packet(TDSPACKET *packet, unsigned len); void tds_free_packets(TDSPACKET *packet); TDSBCPINFO *tds_alloc_bcpinfo(void); void tds_free_bcpinfo(TDSBCPINFO *bcpinfo); void tds_deinit_bcpinfo(TDSBCPINFO *bcpinfo); /* login.c */ void tds_set_packet(TDSLOGIN * tds_login, int packet_size); void tds_set_port(TDSLOGIN * tds_login, int port); bool tds_set_passwd(TDSLOGIN * tds_login, const char *password) TDS_WUR; void tds_set_bulk(TDSLOGIN * tds_login, bool enabled); bool tds_set_user(TDSLOGIN * tds_login, const char *username) TDS_WUR; bool tds_set_app(TDSLOGIN * tds_login, const char *application) TDS_WUR; bool tds_set_host(TDSLOGIN * tds_login, const char *hostname) TDS_WUR; bool tds_set_library(TDSLOGIN * tds_login, const char *library) TDS_WUR; bool tds_set_server(TDSLOGIN * tds_login, const char *server) TDS_WUR; bool tds_set_client_charset(TDSLOGIN * tds_login, const char *charset) TDS_WUR; bool tds_set_language(TDSLOGIN * tds_login, const char *language) TDS_WUR; void tds_set_version(TDSLOGIN * tds_login, TDS_TINYINT major_ver, TDS_TINYINT minor_ver); int tds_connect_and_login(TDSSOCKET * tds, TDSLOGIN * login); /* query.c */ void tds_start_query(TDSSOCKET *tds, unsigned char packet_type); TDSRET tds_submit_query(TDSSOCKET * tds, const char *query); TDSRET tds_submit_query_params(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params, TDSHEADERS * head); TDSRET tds_submit_queryf(TDSSOCKET * tds, const char *queryf, ...); TDSRET tds_submit_prepare(TDSSOCKET * tds, const char *query, const char *id, TDSDYNAMIC ** dyn_out, TDSPARAMINFO * params); TDSRET tds_submit_execdirect(TDSSOCKET * tds, const char *query, TDSPARAMINFO * params, TDSHEADERS * head); TDSRET tds71_submit_prepexec(TDSSOCKET * tds, const char *query, const char *id, TDSDYNAMIC ** dyn_out, TDSPARAMINFO * params); TDSRET tds_submit_execute(TDSSOCKET * tds, TDSDYNAMIC * dyn); TDSRET tds_send_cancel(TDSSOCKET * tds); const char *tds_next_placeholder(const char *start); int tds_count_placeholders(const char *query); int tds_needs_unprepare(TDSCONNECTION * conn, TDSDYNAMIC * dyn); TDSRET tds_deferred_unprepare(TDSCONNECTION * conn, TDSDYNAMIC * dyn); TDSRET tds_submit_unprepare(TDSSOCKET * tds, TDSDYNAMIC * dyn); TDSRET tds_submit_rpc(TDSSOCKET * tds, const char *rpc_name, TDSPARAMINFO * params, TDSHEADERS * head); TDSRET tds_submit_optioncmd(TDSSOCKET * tds, TDS_OPTION_CMD command, TDS_OPTION option, TDS_OPTION_ARG *param, TDS_INT param_size); TDSRET tds_submit_begin_tran(TDSSOCKET *tds); TDSRET tds_submit_rollback(TDSSOCKET *tds, int cont); TDSRET tds_submit_commit(TDSSOCKET *tds, int cont); TDSRET tds_disconnect(TDSSOCKET * tds); size_t tds_quote_id(TDSSOCKET * tds, char *buffer, const char *id, int idlen); size_t tds_quote_id_rpc(TDSSOCKET * tds, char *buffer, const char *id, int idlen); size_t tds_quote_string(TDSSOCKET * tds, char *buffer, const char *str, int len); const char *tds_skip_comment(const char *s); const char *tds_skip_quoted(const char *s); size_t tds_fix_column_size(TDSSOCKET * tds, TDSCOLUMN * curcol); const char *tds_convert_string(TDSSOCKET * tds, TDSICONV * char_conv, const char *s, int len, size_t *out_len); void tds_convert_string_free(const char *original, const char *converted); #if !ENABLE_EXTRA_CHECKS #define tds_convert_string_free(original, converted) \ do { if (original != converted) free((char*) converted); } while(0) #endif TDSRET tds_get_column_declaration(TDSSOCKET * tds, TDSCOLUMN * curcol, char *out); TDSRET tds_cursor_declare(TDSSOCKET * tds, TDSCURSOR * cursor, TDSPARAMINFO *params, int *send); TDSRET tds_cursor_setrows(TDSSOCKET * tds, TDSCURSOR * cursor, int *send); TDSRET tds_cursor_open(TDSSOCKET * tds, TDSCURSOR * cursor, TDSPARAMINFO *params, int *send); TDSRET tds_cursor_fetch(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_CURSOR_FETCH fetch_type, TDS_INT i_row); TDSRET tds_cursor_get_cursor_info(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_UINT * row_number, TDS_UINT * row_count); TDSRET tds_cursor_close(TDSSOCKET * tds, TDSCURSOR * cursor); TDSRET tds_cursor_dealloc(TDSSOCKET * tds, TDSCURSOR * cursor); TDSRET tds_deferred_cursor_dealloc(TDSCONNECTION *conn, TDSCURSOR * cursor); TDSRET tds_cursor_update(TDSSOCKET * tds, TDSCURSOR * cursor, TDS_CURSOR_OPERATION op, TDS_INT i_row, TDSPARAMINFO * params); TDSRET tds_cursor_setname(TDSSOCKET * tds, TDSCURSOR * cursor); TDSRET tds_multiple_init(TDSSOCKET *tds, TDSMULTIPLE *multiple, TDS_MULTIPLE_TYPE type, TDSHEADERS * head); TDSRET tds_multiple_done(TDSSOCKET *tds, TDSMULTIPLE *multiple); TDSRET tds_multiple_query(TDSSOCKET *tds, TDSMULTIPLE *multiple, const char *query, TDSPARAMINFO * params); TDSRET tds_multiple_execute(TDSSOCKET *tds, TDSMULTIPLE *multiple, TDSDYNAMIC * dyn); /* token.c */ TDSRET tds_process_cancel(TDSSOCKET * tds); int tds_get_token_size(int marker); TDSRET tds_process_login_tokens(TDSSOCKET * tds); TDSRET tds_process_simple_query(TDSSOCKET * tds); int tds5_send_optioncmd(TDSSOCKET * tds, TDS_OPTION_CMD tds_command, TDS_OPTION tds_option, TDS_OPTION_ARG * tds_argument, TDS_INT * tds_argsize); TDSRET tds_process_tokens(TDSSOCKET * tds, /*@out@*/ TDS_INT * result_type, /*@out@*/ int *done_flags, unsigned flag); /* data.c */ void tds_set_param_type(TDSCONNECTION * conn, TDSCOLUMN * curcol, TDS_SERVER_TYPE type); void tds_set_column_type(TDSCONNECTION * conn, TDSCOLUMN * curcol, TDS_SERVER_TYPE type); #ifdef WORDS_BIGENDIAN void tds_swap_datatype(int coltype, void *b); #endif /* tds_convert.c */ TDSRET tds_datecrack(TDS_INT datetype, const void *di, TDSDATEREC * dr); TDS_SERVER_TYPE tds_get_conversion_type(TDS_SERVER_TYPE srctype, int colsize); extern const char tds_hex_digits[]; /* write.c */ int tds_init_write_buf(TDSSOCKET * tds); int tds_put_n(TDSSOCKET * tds, const void *buf, size_t n); int tds_put_string(TDSSOCKET * tds, const char *buf, int len); int tds_put_int(TDSSOCKET * tds, TDS_INT i); int tds_put_int8(TDSSOCKET * tds, TDS_INT8 i); int tds_put_smallint(TDSSOCKET * tds, TDS_SMALLINT si); /** Output a tinyint value */ #define tds_put_tinyint(tds, ti) tds_put_byte(tds,ti) int tds_put_byte(TDSSOCKET * tds, unsigned char c); TDSRET tds_flush_packet(TDSSOCKET * tds); int tds_put_buf(TDSSOCKET * tds, const unsigned char *buf, int dsize, int ssize); /* read.c */ unsigned char tds_get_byte(TDSSOCKET * tds); void tds_unget_byte(TDSSOCKET * tds); unsigned char tds_peek(TDSSOCKET * tds); TDS_USMALLINT tds_get_usmallint(TDSSOCKET * tds); #define tds_get_smallint(tds) ((TDS_SMALLINT) tds_get_usmallint(tds)) TDS_UINT tds_get_uint(TDSSOCKET * tds); #define tds_get_int(tds) ((TDS_INT) tds_get_uint(tds)) TDS_UINT8 tds_get_uint8(TDSSOCKET * tds); #define tds_get_int8(tds) ((TDS_INT8) tds_get_uint8(tds)) size_t tds_get_string(TDSSOCKET * tds, size_t string_len, char *dest, size_t dest_size); TDSRET tds_get_char_data(TDSSOCKET * tds, char *dest, size_t wire_size, TDSCOLUMN * curcol); bool tds_get_n(TDSSOCKET * tds, /*@out@*/ /*@null@*/ void *dest, size_t n); int tds_get_size_by_type(TDS_SERVER_TYPE servertype); DSTR* tds_dstr_get(TDSSOCKET * tds, DSTR * s, size_t len); /* util.c */ int tdserror (const TDSCONTEXT * tds_ctx, TDSSOCKET * tds, int msgno, int errnum); TDS_STATE tds_set_state(TDSSOCKET * tds, TDS_STATE state); void tds_swap_bytes(void *buf, int bytes); unsigned int tds_gettime_ms(void); char *tds_strndup(const void *s, TDS_INTPTR len); /* log.c */ typedef struct tdsdump_off_item { struct tdsdump_off_item *next; tds_thread_id thread_id; } TDSDUMP_OFF_ITEM; void tdsdump_off(TDSDUMP_OFF_ITEM *off_item); void tdsdump_on(TDSDUMP_OFF_ITEM *off_item); int tdsdump_isopen(void); #include int tdsdump_open(const char *filename); #include void tdsdump_close(void); void tdsdump_dump_buf(const char* file, unsigned int level_line, const char *msg, const void *buf, size_t length); void tdsdump_col(const TDSCOLUMN *col); #undef tdsdump_log void tdsdump_log(const char* file, unsigned int level_line, const char *fmt, ...) #if defined(__GNUC__) && __GNUC__ >= 2 #if defined(__MINGW32__) __attribute__ ((__format__ (ms_printf, 3, 4))) #else __attribute__ ((__format__ (__printf__, 3, 4))) #endif #endif ; #define TDSDUMP_LOG_FAST if (TDS_UNLIKELY(tds_write_dump)) tdsdump_log #define tdsdump_log TDSDUMP_LOG_FAST #define TDSDUMP_BUF_FAST if (TDS_UNLIKELY(tds_write_dump)) tdsdump_dump_buf #define tdsdump_dump_buf TDSDUMP_BUF_FAST extern int tds_write_dump; extern int tds_debug_flags; extern int tds_g_append_mode; /* net.c */ TDSERRNO tds_open_socket(TDSSOCKET * tds, struct addrinfo *ipaddr, unsigned int port, int timeout, int *p_oserr); void tds_close_socket(TDSSOCKET * tds); int tds7_get_instance_ports(FILE *output, struct addrinfo *addr); int tds7_get_instance_port(struct addrinfo *addr, const char *instance); char *tds_prwsaerror(int erc); void tds_prwsaerror_free(char *s); int tds_connection_read(TDSSOCKET * tds, unsigned char *buf, int buflen); int tds_connection_write(TDSSOCKET *tds, const unsigned char *buf, int buflen, int final); #define TDSSELREAD POLLIN #define TDSSELWRITE POLLOUT int tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds); void tds_connection_close(TDSCONNECTION *conn); int tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen); int tds_goodwrite(TDSSOCKET * tds, const unsigned char *buffer, size_t buflen); void tds_socket_flush(TDS_SYS_SOCKET sock); int tds_socket_set_nonblocking(TDS_SYS_SOCKET sock); int tds_wakeup_init(TDSPOLLWAKEUP *wakeup); void tds_wakeup_close(TDSPOLLWAKEUP *wakeup); void tds_wakeup_send(TDSPOLLWAKEUP *wakeup, char cancel); static inline TDS_SYS_SOCKET tds_wakeup_get_fd(const TDSPOLLWAKEUP *wakeup) { return wakeup->s_signaled; } /* packet.c */ int tds_read_packet(TDSSOCKET * tds); TDSRET tds_write_packet(TDSSOCKET * tds, unsigned char final); #if ENABLE_ODBC_MARS int tds_append_cancel(TDSSOCKET *tds); TDSRET tds_append_syn(TDSSOCKET *tds); TDSRET tds_append_fin(TDSSOCKET *tds); #else int tds_put_cancel(TDSSOCKET * tds); #endif typedef struct tds_freeze { /** which socket we refer to */ TDSSOCKET *tds; /** first packet frozen */ TDSPACKET *pkt; /** position in pkt */ unsigned pkt_pos; /** length size (0, 1, 2 or 4) */ unsigned size_len; } TDSFREEZE; void tds_freeze(TDSSOCKET *tds, TDSFREEZE *freeze, unsigned size_len); size_t tds_freeze_written(TDSFREEZE *freeze); TDSRET tds_freeze_abort(TDSFREEZE *freeze); TDSRET tds_freeze_close(TDSFREEZE *freeze); TDSRET tds_freeze_close_len(TDSFREEZE *freeze, int32_t size); static void inline tds_set_current_send_packet(TDSSOCKET *tds, TDSPACKET *pkt) { tds->send_packet = pkt; tds->out_buf = pkt->buf + tds_packet_get_data_start(pkt); } /* Macros to allow some indentation of the packets. * * The 3 nested fake loops require some explanation: * - first is to allows to declare variables; * - second is to force using brackets; * - third is to avoids that a break inside will skip the close. */ #define TDS_START_LEN_GENERIC(tds_socket, len) do { \ TDSFREEZE current_freeze[1]; \ tds_freeze((tds_socket), current_freeze, (len)); do { do #define TDS_END_LEN while(0); } while(tds_freeze_close(current_freeze), 0); } while(0); #define TDS_START_LEN_TINYINT(tds_socket) TDS_START_LEN_GENERIC(tds_socket, 1) #define TDS_START_LEN_USMALLINT(tds_socket) TDS_START_LEN_GENERIC(tds_socket, 2) #define TDS_START_LEN_UINT(tds_socket) TDS_START_LEN_GENERIC(tds_socket, 4) /* vstrbuild.c */ TDSRET tds_vstrbuild(char *buffer, int buflen, int *resultlen, const char *text, int textlen, const char *formats, int formatlen, va_list ap); /* numeric.c */ char *tds_money_to_string(const TDS_MONEY * money, char *s, bool use_2_digits); TDS_INT tds_numeric_to_string(const TDS_NUMERIC * numeric, char *s); TDS_INT tds_numeric_change_prec_scale(TDS_NUMERIC * numeric, unsigned char new_prec, unsigned char new_scale); /* getmac.c */ void tds_getmac(TDS_SYS_SOCKET s, unsigned char mac[6]); /* challenge.c */ #ifndef HAVE_SSPI TDSAUTHENTICATION * tds_ntlm_get_auth(TDSSOCKET * tds); TDSAUTHENTICATION * tds_gss_get_auth(TDSSOCKET * tds); #else TDSAUTHENTICATION * tds_sspi_get_auth(TDSSOCKET * tds); #endif TDSRET tds5_gss_send(TDSSOCKET *tds); /* random.c */ void tds_random_buffer(unsigned char *out, int len); /* sec_negotiate.c */ TDSAUTHENTICATION * tds5_negotiate_get_auth(TDSSOCKET * tds); static inline void tds5_negotiate_set_msg_type(TDSAUTHENTICATION * tds_auth, unsigned msg_type) { if (tds_auth) tds_auth->msg_type = msg_type; } /* bulk.c */ /** bcp direction */ enum tds_bcp_directions { TDS_BCP_IN = 1, TDS_BCP_OUT = 2, TDS_BCP_QUERYOUT = 3 }; struct tds_bcpinfo { const char *hint; void *parent; DSTR tablename; TDS_CHAR *insert_stmt; TDS_INT direction; TDS_INT identity_insert_on; TDS_INT xfer_init; TDS_INT bind_count; TDSRESULTINFO *bindinfo; }; TDSRET tds_bcp_init(TDSSOCKET *tds, TDSBCPINFO *bcpinfo); typedef TDSRET (*tds_bcp_get_col_data) (TDSBCPINFO *bulk, TDSCOLUMN *bcpcol, int offset); typedef void (*tds_bcp_null_error) (TDSBCPINFO *bulk, int index, int offset); TDSRET tds_bcp_send_record(TDSSOCKET *tds, TDSBCPINFO *bcpinfo, tds_bcp_get_col_data get_col_data, tds_bcp_null_error null_error, int offset); TDSRET tds_bcp_done(TDSSOCKET *tds, int *rows_copied); TDSRET tds_bcp_start(TDSSOCKET *tds, TDSBCPINFO *bcpinfo); TDSRET tds_bcp_start_copy_in(TDSSOCKET *tds, TDSBCPINFO *bcpinfo); TDSRET tds_bcp_fread(TDSSOCKET * tds, TDSICONV * conv, FILE * stream, const char *terminator, size_t term_len, char **outbuf, size_t * outbytes); TDSRET tds_writetext_start(TDSSOCKET *tds, const char *objname, const char *textptr, const char *timestamp, int with_log, TDS_UINT size); TDSRET tds_writetext_continue(TDSSOCKET *tds, const TDS_UCHAR *text, TDS_UINT size); TDSRET tds_writetext_end(TDSSOCKET *tds); static inline bool tds_capability_enabled(const TDS_CAPABILITY_TYPE *cap, unsigned cap_num) { return (cap->values[sizeof(cap->values)-1-(cap_num>>3)] >> (cap_num&7)) & 1; } #define tds_capability_has_req(conn, cap) \ tds_capability_enabled(&conn->capabilities.types[0], cap) #define tds_capability_has_res(conn, cap) \ tds_capability_enabled(&conn->capabilities.types[1], cap) #define IS_TDS42(x) (x->tds_version==0x402) #define IS_TDS46(x) (x->tds_version==0x406) #define IS_TDS50(x) (x->tds_version==0x500) #define IS_TDS70(x) (x->tds_version==0x700) #define IS_TDS71(x) (x->tds_version==0x701) #define IS_TDS72(x) (x->tds_version==0x702) #define IS_TDS73(x) (x->tds_version==0x703) #define IS_TDS50_PLUS(x) ((x)->tds_version>=0x500) #define IS_TDS7_PLUS(x) ((x)->tds_version>=0x700) #define IS_TDS71_PLUS(x) ((x)->tds_version>=0x701) #define IS_TDS72_PLUS(x) ((x)->tds_version>=0x702) #define IS_TDS73_PLUS(x) ((x)->tds_version>=0x703) #define IS_TDS74_PLUS(x) ((x)->tds_version>=0x704) #define TDS_MAJOR(x) ((x)->tds_version >> 8) #define TDS_MINOR(x) ((x)->tds_version & 0xff) #define IS_TDSDEAD(x) (((x) == NULL) || (x)->state == TDS_DEAD) /** Check if product is Sybase (such as Adaptive Server Enterrprice). x should be a TDSSOCKET*. */ #define TDS_IS_SYBASE(x) (!((x)->conn->product_version & 0x80000000u)) /** Check if product is Microsft SQL Server. x should be a TDSSOCKET*. */ #define TDS_IS_MSSQL(x) (((x)->conn->product_version & 0x80000000u)!=0) /** Calc a version number for mssql. Use with TDS_MS_VER(7,0,842). * For test for a range of version you can use check like * if (tds->product_version >= TDS_MS_VER(7,0,0) && tds->product_version < TDS_MS_VER(8,0,0)) */ #define TDS_MS_VER(maj,min,x) (0x80000000u|((maj)<<24)|((min)<<16)|(x)) /* TODO test if not similar to ms one*/ /** Calc a version number for Sybase. */ #define TDS_SYB_VER(maj,min,x) (((maj)<<24)|((min)<<16)|(x)<<8) #ifdef __cplusplus #if 0 { #endif } #endif #include #define TDS_PUT_INT(tds,v) tds_put_int((tds), ((TDS_INT)(v))) #define TDS_PUT_SMALLINT(tds,v) tds_put_smallint((tds), ((TDS_SMALLINT)(v))) #define TDS_PUT_BYTE(tds,v) tds_put_byte((tds), ((unsigned char)(v))) #endif /* _tds_h_ */ freetds-1.3.6/include/freetds/odbc.h000644 025423 025423 00000052005 14056414271 020750 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2004-2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _sql_h_ #define _sql_h_ #define TDS_DONT_DEFINE_DEFAULT_FUNCTIONS #include #include #include #if defined(UNIXODBC) || defined(_WIN32) || defined(TDS_NO_DM) #include #include #if defined(UNIXODBC) || defined(_WIN32) #include #endif #else /* IODBC */ #include #include #ifdef HAVE_IODBCINST_H #include #endif /* HAVE_IODBCINST_H */ #endif #ifdef HAVE_WCHAR_H #include #endif #ifndef HAVE_SQLLEN #ifndef SQLULEN #define SQLULEN SQLUINTEGER #endif #ifndef SQLLEN #define SQLLEN SQLINTEGER #endif #endif #ifndef HAVE_SQLSETPOSIROW #define SQLSETPOSIROW SQLUSMALLINT #endif #ifndef HAVE_SQLROWOFFSET #define SQLROWOFFSET SQLLEN #endif #ifndef HAVE_SQLROWSETSIZE #define SQLROWSETSIZE SQLULEN #endif #ifdef __cplusplus extern "C" { #if 0 } #endif #endif #include #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__) #define ODBC_API SQL_API __attribute__((externally_visible)) #else #define ODBC_API SQL_API #endif #if (defined(_WIN32) || defined(__CYGWIN__)) && defined(__GNUC__) # define ODBC_PUBLIC __attribute__((dllexport)) #else # define ODBC_PUBLIC #endif #define ODBC_MAX(a,b) ( (a) > (b) ? (a) : (b) ) #define ODBC_MIN(a,b) ( (a) < (b) ? (a) : (b) ) #define ODBC_CLAMP(x,a,b) ( (x) < (a) ? (a) : (x) > (b) ? (b) : (x) ) struct _sql_error { const char *msg; char state2[6]; char state3[6]; TDS_UINT native; char *server; int linenum; int msgstate; int row; }; struct _sql_errors { struct _sql_error *errs; int num_errors; SQLRETURN lastrc; char ranked; }; typedef struct _sql_errors TDS_ERRS; #if ENABLE_EXTRA_CHECKS void odbc_check_struct_extra(void *p); #else static inline void odbc_check_struct_extra(void *p) {} #endif #define ODBC_RETURN(handle, rc) \ do { odbc_check_struct_extra(handle); \ return handle->errs.lastrc = (rc); } while(0) #define ODBC_RETURN_(handle) \ do { odbc_check_struct_extra(handle); \ return handle->errs.lastrc; } while(0) #define ODBC_EXIT(handle, rc) \ do { SQLRETURN _odbc_rc = handle->errs.lastrc = (rc); \ odbc_check_struct_extra(handle); \ tds_mutex_unlock(&handle->mtx); \ return _odbc_rc; } while(0) #define ODBC_EXIT_(handle) \ do { SQLRETURN _odbc_rc = handle->errs.lastrc; \ odbc_check_struct_extra(handle); \ tds_mutex_unlock(&handle->mtx); \ return _odbc_rc; } while(0) /** reset errors */ void odbc_errs_reset(struct _sql_errors *errs); /** add an error to list */ void odbc_errs_add(struct _sql_errors *errs, const char *sqlstate, const char *msg); /** Add an error to list. This functions is for error that came from server */ void odbc_errs_add_rdbms(struct _sql_errors *errs, TDS_UINT native, const char *sqlstate, const char *msg, int linenum, int msgstate, const char *server, int row); struct _dheader { SQLSMALLINT sql_desc_alloc_type; SQLINTEGER sql_desc_bind_type; SQLULEN sql_desc_array_size; /* TODO SQLLEN ?? see http://support.microsoft.com/default.aspx?scid=kb;en-us;298678 */ SQLSMALLINT sql_desc_count; SQLUSMALLINT *sql_desc_array_status_ptr; SQLULEN *sql_desc_rows_processed_ptr; SQLLEN *sql_desc_bind_offset_ptr; }; struct _drecord { SQLUINTEGER sql_desc_auto_unique_value; DSTR sql_desc_base_column_name; DSTR sql_desc_base_table_name; SQLINTEGER sql_desc_case_sensitive; DSTR sql_desc_catalog_name; SQLSMALLINT sql_desc_concise_type; SQLPOINTER sql_desc_data_ptr; SQLSMALLINT sql_desc_datetime_interval_code; SQLINTEGER sql_desc_datetime_interval_precision; SQLLEN sql_desc_display_size; SQLSMALLINT sql_desc_fixed_prec_scale; SQLLEN *sql_desc_indicator_ptr; DSTR sql_desc_label; SQLULEN sql_desc_length; /* this point to a constant buffer, do not free or modify */ const char *sql_desc_literal_prefix; /* this point to a constant buffer, do not free or modify */ const char *sql_desc_literal_suffix; DSTR sql_desc_local_type_name; DSTR sql_desc_name; SQLSMALLINT sql_desc_nullable; SQLINTEGER sql_desc_num_prec_radix; SQLLEN sql_desc_octet_length; SQLLEN *sql_desc_octet_length_ptr; SQLSMALLINT sql_desc_parameter_type; SQLSMALLINT sql_desc_precision; SQLSMALLINT sql_desc_rowver; SQLSMALLINT sql_desc_scale; DSTR sql_desc_schema_name; SQLSMALLINT sql_desc_searchable; DSTR sql_desc_table_name; SQLSMALLINT sql_desc_type; /* this point to a constant buffer, do not free or modify */ const char *sql_desc_type_name; SQLSMALLINT sql_desc_unnamed; SQLSMALLINT sql_desc_unsigned; SQLSMALLINT sql_desc_updatable; }; struct _hdesc { SQLSMALLINT htype; /* do not reorder this field */ struct _sql_errors errs; /* do not reorder this field */ tds_mutex mtx; int type; SQLHANDLE parent; struct _dheader header; struct _drecord *records; }; typedef struct _hdesc TDS_DESC; #define DESC_IRD 1 #define DESC_IPD 2 #define DESC_ARD 3 #define DESC_APD 4 struct _heattr { SQLUINTEGER connection_pooling; SQLUINTEGER cp_match; SQLINTEGER odbc_version; SQLINTEGER output_nts; }; struct _hchk { SQLSMALLINT htype; /* do not reorder this field */ struct _sql_errors errs; /* do not reorder this field */ tds_mutex mtx; }; struct _henv { SQLSMALLINT htype; /* do not reorder this field */ struct _sql_errors errs; /* do not reorder this field */ tds_mutex mtx; TDSCONTEXT *tds_ctx; struct _heattr attr; }; struct _hcattr { SQLUINTEGER access_mode; SQLUINTEGER async_enable; SQLUINTEGER auto_ipd; SQLUINTEGER autocommit; SQLUINTEGER connection_dead; SQLUINTEGER connection_timeout; DSTR current_catalog; SQLUINTEGER login_timeout; SQLUINTEGER metadata_id; SQLUINTEGER odbc_cursors; SQLUINTEGER packet_size; SQLHWND quite_mode; DSTR translate_lib; SQLUINTEGER translate_option; SQLUINTEGER txn_isolation; SQLUINTEGER mars_enabled; SQLUINTEGER cursor_type; SQLUINTEGER bulk_enabled; #ifdef TDS_NO_DM SQLUINTEGER trace; DSTR tracefile; #endif }; #define TDS_MAX_APP_DESC 100 struct _hstmt; struct _hdbc { SQLSMALLINT htype; /* do not reorder this field */ struct _sql_errors errs; /* do not reorder this field */ tds_mutex mtx; struct _henv *env; TDSSOCKET *tds_socket; DSTR dsn; DSTR oldpwd; #ifdef ENABLE_ODBC_WIDE int original_charset_num; TDSICONV *mb_conv; #endif /** * Statement executing. This should be set AFTER sending query * to avoid race condition and assure to not overwrite it if * another statement is executing a query. */ struct _hstmt *current_statement; /** list of all statements allocated from this connection */ struct _hstmt *stmt_list; struct _hcattr attr; /** descriptors associated to connection */ TDS_DESC *uad[TDS_MAX_APP_DESC]; /** <>0 if server handle cursors */ unsigned int cursor_support:1; unsigned int use_oldpwd:1; TDS_INT default_query_timeout; TDSBCPINFO *bcpinfo; char *bcphint; }; struct _hsattr { /* TODO remove IRD, ARD, IPD, APD from statement, do not duplicate */ /* TDS_DESC *app_row_desc; */ /* TDS_DESC *app_param_desc; */ SQLUINTEGER async_enable; SQLUINTEGER concurrency; SQLUINTEGER cursor_scrollable; SQLUINTEGER cursor_sensitivity; SQLUINTEGER cursor_type; SQLUINTEGER enable_auto_ipd; SQLPOINTER fetch_bookmark_ptr; SQLULEN keyset_size; SQLULEN max_length; SQLULEN max_rows; SQLUINTEGER metadata_id; SQLUINTEGER noscan; /* apd->sql_desc_bind_offset_ptr */ /* SQLUINTEGER *param_bind_offset_ptr; */ /* apd->sql_desc_bind_type */ /* SQLUINTEGER param_bind_type; */ /* apd->sql_desc_array_status_ptr */ /* SQLUSMALLINT *param_operation_ptr; */ /* ipd->sql_desc_array_status_ptr */ /* SQLUSMALLINT *param_status_ptr; */ /* ipd->sql_desc_rows_processed_ptr */ /* SQLUSMALLINT *params_processed_ptr; */ /* apd->sql_desc_array_size */ /* SQLUINTEGER paramset_size; */ SQLUINTEGER query_timeout; SQLUINTEGER retrieve_data; /* ard->sql_desc_bind_offset_ptr */ /* SQLUINTEGER *row_bind_offset_ptr; */ /* ard->sql_desc_array_size */ /* SQLUINTEGER row_array_size; */ /* ard->sql_desc_bind_type */ /* SQLUINTEGER row_bind_type; */ SQLULEN row_number; /* ard->sql_desc_array_status_ptr */ /* SQLUINTEGER *row_operation_ptr; */ /* ird->sql_desc_array_status_ptr */ /* SQLUINTEGER *row_status_ptr; */ /* ird->sql_desc_rows_processed_ptr */ /* SQLUINTEGER *rows_fetched_ptr; */ SQLUINTEGER simulate_cursor; SQLUINTEGER use_bookmarks; /* SQLGetStmtAttr only */ /* TDS_DESC *imp_row_desc; */ /* TDS_DESC *imp_param_desc; */ DSTR qn_msgtext; DSTR qn_options; SQLUINTEGER qn_timeout; }; typedef enum { NOT_IN_ROW, IN_NORMAL_ROW, IN_COMPUTE_ROW, AFTER_COMPUTE_ROW, PRE_NORMAL_ROW } TDS_ODBC_ROW_STATUS; typedef enum { ODBC_SPECIAL_NONE = 0, ODBC_SPECIAL_GETTYPEINFO = 1, ODBC_SPECIAL_COLUMNS = 2, ODBC_SPECIAL_PROCEDURECOLUMNS = 3, ODBC_SPECIAL_SPECIALCOLUMNS = 4 } TDS_ODBC_SPECIAL_ROWS; struct _hstmt { SQLSMALLINT htype; /* do not reorder this field */ struct _sql_errors errs; /* do not reorder this field */ tds_mutex mtx; struct _hdbc *dbc; /** query to execute */ DSTR query; /** socket (only if active) */ TDSSOCKET *tds; /** next in list */ struct _hstmt *next; /** previous in list */ struct _hstmt *prev; /* begin prepared query stuff */ unsigned is_prepared_query:1; unsigned prepared_query_is_func:1; unsigned prepared_query_is_rpc:1; /** * Prepared statement needs to be prepared again. * This can happen if the parameters was changed or not specified. */ unsigned need_reprepare:1; unsigned param_data_called:1; /* end prepared query stuff */ /** parameters saved */ TDSPARAMINFO *params; /** last valid parameter in params, it's a ODBC index (from 1 relative to descriptor) */ int param_num; /** position in prepared query to check parameters, used only in RPC */ size_t prepared_pos; unsigned int curr_param_row, num_param_rows; /** number of parameter in current query */ unsigned int param_count; int row; /** row count to return */ TDS_INT8 row_count; /** status of row, it can happen that this flag mark that we are still parsing row, this it's normal */ TDS_ODBC_ROW_STATUS row_status; /* do NOT free dynamic, free from socket or attach to connection */ TDSDYNAMIC *dyn; TDS_DESC *ard, *ird, *apd, *ipd; TDS_DESC *orig_ard, *orig_apd; SQLULEN sql_rowset_size; struct _hsattr attr; DSTR cursor_name; /* auto generated cursor name */ TDS_ODBC_SPECIAL_ROWS special_row; /* do NOT free cursor, free from socket or attach to connection */ TDSCURSOR *cursor; }; typedef struct _henv TDS_ENV; typedef struct _hdbc TDS_DBC; typedef struct _hstmt TDS_STMT; typedef struct _hchk TDS_CHK; typedef struct { /* this must be the first member */ TDSCOLUMNFUNCS common; void (*set_type_info)(TDSCOLUMN *col, struct _drecord *drec, SQLINTEGER odbc_ver); } TDS_FUNCS; #define IS_HENV(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_ENV) #define IS_HDBC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DBC) #define IS_HSTMT(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_STMT) #define IS_HDESC(x) (((TDS_CHK *)x)->htype == SQL_HANDLE_DESC) /* fix a bug in MingW headers */ #ifdef __MINGW32__ #if SQL_INTERVAL_YEAR == (100 + SQL_CODE_SECOND) #undef SQL_INTERVAL_YEAR #undef SQL_INTERVAL_MONTH #undef SQL_INTERVAL_DAY #undef SQL_INTERVAL_HOUR #undef SQL_INTERVAL_MINUTE #undef SQL_INTERVAL_SECOND #undef SQL_INTERVAL_YEAR_TO_MONTH #undef SQL_INTERVAL_DAY_TO_HOUR #undef SQL_INTERVAL_DAY_TO_MINUTE #undef SQL_INTERVAL_DAY_TO_SECOND #undef SQL_INTERVAL_HOUR_TO_MINUTE #undef SQL_INTERVAL_HOUR_TO_SECOND #undef SQL_INTERVAL_MINUTE_TO_SECOND #define SQL_INTERVAL_YEAR (100 + SQL_CODE_YEAR) #define SQL_INTERVAL_MONTH (100 + SQL_CODE_MONTH) #define SQL_INTERVAL_DAY (100 + SQL_CODE_DAY) #define SQL_INTERVAL_HOUR (100 + SQL_CODE_HOUR) #define SQL_INTERVAL_MINUTE (100 + SQL_CODE_MINUTE) #define SQL_INTERVAL_SECOND (100 + SQL_CODE_SECOND) #define SQL_INTERVAL_YEAR_TO_MONTH (100 + SQL_CODE_YEAR_TO_MONTH) #define SQL_INTERVAL_DAY_TO_HOUR (100 + SQL_CODE_DAY_TO_HOUR) #define SQL_INTERVAL_DAY_TO_MINUTE (100 + SQL_CODE_DAY_TO_MINUTE) #define SQL_INTERVAL_DAY_TO_SECOND (100 + SQL_CODE_DAY_TO_SECOND) #define SQL_INTERVAL_HOUR_TO_MINUTE (100 + SQL_CODE_HOUR_TO_MINUTE) #define SQL_INTERVAL_HOUR_TO_SECOND (100 + SQL_CODE_HOUR_TO_SECOND) #define SQL_INTERVAL_MINUTE_TO_SECOND (100 + SQL_CODE_MINUTE_TO_SECOND) #endif #endif #ifdef _WIN32 bool get_login_info(HWND hwndParent, TDSLOGIN * login); #endif #define ODBC_PARAM_LIST \ ODBC_PARAM(Servername) \ ODBC_PARAM(Server) \ ODBC_PARAM(DSN) \ ODBC_PARAM(UID) \ ODBC_PARAM(PWD) \ ODBC_PARAM(Address) \ ODBC_PARAM(Port) \ ODBC_PARAM(TDS_Version) \ ODBC_PARAM(Language) \ ODBC_PARAM(Database) \ ODBC_PARAM(TextSize) \ ODBC_PARAM(PacketSize) \ ODBC_PARAM(ClientCharset) \ ODBC_PARAM(DumpFile) \ ODBC_PARAM(DumpFileAppend) \ ODBC_PARAM(DebugFlags) \ ODBC_PARAM(Encryption) \ ODBC_PARAM(Trusted_Connection) \ ODBC_PARAM(APP) \ ODBC_PARAM(WSID) \ ODBC_PARAM(UseNTLMv2) \ ODBC_PARAM(MARS_Connection) \ ODBC_PARAM(REALM) \ ODBC_PARAM(ServerSPN) \ ODBC_PARAM(AttachDbFilename) \ ODBC_PARAM(ApplicationIntent) \ ODBC_PARAM(Timeout) #define ODBC_PARAM(p) ODBC_PARAM_##p, enum { ODBC_PARAM_LIST ODBC_PARAM_SIZE }; #undef ODBC_PARAM /* * connectparams.h */ typedef struct { const char *p; size_t len; } TDS_PARSED_PARAM; /** * Parses a connection string for SQLDriverConnect(). * \param connect_string point to connection string * \param connect_string_end point to end of connection string * \param connection structure where to store informations * \return 0 if error, 1 otherwise */ int odbc_parse_connect_string(TDS_ERRS *errs, const char *connect_string, const char *connect_string_end, TDSLOGIN * login, TDS_PARSED_PARAM *parsed_params); int odbc_get_dsn_info(TDS_ERRS *errs, const char *DSN, TDSLOGIN * login); #ifdef _WIN32 int odbc_build_connect_string(TDS_ERRS *errs, TDS_PARSED_PARAM *params, char **out); #endif /* * convert_tds2sql.c */ SQLLEN odbc_tds2sql_col(TDS_STMT * stmt, TDSCOLUMN *curcol, int desttype, TDS_CHAR * dest, SQLULEN destlen, const struct _drecord *drec_ixd); SQLLEN odbc_tds2sql_int4(TDS_STMT * stmt, TDS_INT *src, int desttype, TDS_CHAR * dest, SQLULEN destlen); /* * descriptor.c */ TDS_DESC *desc_alloc(SQLHANDLE parent, int desc_type, int alloc_type); SQLRETURN desc_free(TDS_DESC * desc); SQLRETURN desc_alloc_records(TDS_DESC * desc, unsigned count); SQLRETURN desc_copy(TDS_DESC * dest, TDS_DESC * src); SQLRETURN desc_free_records(TDS_DESC * desc); TDS_DBC *desc_get_dbc(TDS_DESC *desc); /* * odbc.c */ SQLRETURN _SQLRowCount(SQLHSTMT hstmt, SQLLEN FAR * pcrow); /* * odbc_checks.h */ #if ENABLE_EXTRA_CHECKS /* macro */ #define CHECK_ENV_EXTRA(env) odbc_check_env_extra(env) #define CHECK_DBC_EXTRA(dbc) odbc_check_dbc_extra(dbc) #define CHECK_STMT_EXTRA(stmt) odbc_check_stmt_extra(stmt) #define CHECK_DESC_EXTRA(desc) odbc_check_desc_extra(desc) /* declarations*/ void odbc_check_env_extra(TDS_ENV * env); void odbc_check_dbc_extra(TDS_DBC * dbc); void odbc_check_stmt_extra(TDS_STMT * stmt); void odbc_check_desc_extra(TDS_DESC * desc); #else /* macro */ #define CHECK_ENV_EXTRA(env) #define CHECK_DBC_EXTRA(dbc) #define CHECK_STMT_EXTRA(stmt) #define CHECK_DESC_EXTRA(desc) #endif /* * odbc_util.h */ /* helpers for ODBC wide string support */ #undef _wide #undef _WIDE #ifdef ENABLE_ODBC_WIDE typedef union { char mb[1]; SQLWCHAR wide[1]; } ODBC_CHAR; # define _wide ,wide # define _wide0 ,0 # define _WIDE ,int wide #else # define _wide # define _wide0 # define _WIDE # define ODBC_CHAR SQLCHAR #endif int odbc_set_stmt_query(struct _hstmt *stmt, const ODBC_CHAR *sql, int sql_len _WIDE); void odbc_set_return_status(struct _hstmt *stmt, unsigned int n_row); void odbc_set_return_params(struct _hstmt *stmt, unsigned int n_row); void odbc_set_sql_type_info(TDSCOLUMN * col, struct _drecord *drec, SQLINTEGER odbc_ver); int odbc_sql_to_c_type_default(int sql_type); TDS_SERVER_TYPE odbc_sql_to_server_type(TDSCONNECTION * conn, int sql_type, int sql_unsigned); TDS_SERVER_TYPE odbc_c_to_server_type(int c_type); unsigned int odbc_get_string_size(int size, const ODBC_CHAR * str _WIDE); void odbc_rdbms_version(TDSSOCKET * tds_socket, char *pversion_string); SQLINTEGER odbc_get_param_len(const struct _drecord *drec_axd, const struct _drecord *drec_ixd, const TDS_DESC* axd, unsigned int n_row); #ifdef ENABLE_ODBC_WIDE DSTR* odbc_dstr_copy_flag(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str, int flag); #define odbc_dstr_copy(dbc, s, len, out) \ odbc_dstr_copy_flag(dbc, s, len, sizeof((out)->mb) ? (out) : (out), wide) #define odbc_dstr_copy_oct(dbc, s, len, out) \ odbc_dstr_copy_flag(dbc, s, len, out, wide|0x20) #else DSTR* odbc_dstr_copy(TDS_DBC *dbc, DSTR *s, int size, const ODBC_CHAR * str); #define odbc_dstr_copy_oct odbc_dstr_copy #endif SQLRETURN odbc_set_string_flag(TDS_DBC *dbc, SQLPOINTER buffer, SQLINTEGER cbBuffer, void FAR * pcbBuffer, const char *s, int len, int flag); #ifdef ENABLE_ODBC_WIDE #define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) \ odbc_set_string_flag(dbc, sizeof((buf)->mb) ? (buf) : (buf), buf_len, out_len, s, s_len, (wide) | (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10)) #define odbc_set_string_oct(dbc, buf, buf_len, out_len, s, s_len) \ odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (wide) | (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30)) #else #define odbc_set_string(dbc, buf, buf_len, out_len, s, s_len) \ odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0:0x10)) #define odbc_set_string_oct(dbc, buf, buf_len, out_len, s, s_len) \ odbc_set_string_flag(dbc, buf, buf_len, out_len, s, s_len, (sizeof(*(out_len)) == sizeof(SQLSMALLINT)?0x20:0x30)) #endif #define odbc_set_dstr_oct(dbc, buf, buf_len, out_len, s) odbc_set_string_oct(dbc, buf, buf_len, out_len, tds_dstr_cstr(s), tds_dstr_len(s)) #define odbc_set_dstr(dbc, buf, buf_len, out_len, s) odbc_set_string(dbc, buf, buf_len, out_len, tds_dstr_cstr(s), tds_dstr_len(s)) SQLSMALLINT odbc_get_concise_sql_type(SQLSMALLINT type, SQLSMALLINT interval); SQLRETURN odbc_set_concise_sql_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only); SQLSMALLINT odbc_get_concise_c_type(SQLSMALLINT type, SQLSMALLINT interval); SQLRETURN odbc_set_concise_c_type(SQLSMALLINT concise_type, struct _drecord *drec, int check_only); SQLLEN odbc_get_octet_len(int c_type, const struct _drecord *drec); void odbc_convert_err_set(struct _sql_errors *errs, TDS_INT err); /* * prepare_query.c */ SQLRETURN prepare_call(struct _hstmt *stmt); SQLRETURN native_sql(struct _hdbc *dbc, DSTR *s); int parse_prepared_query(struct _hstmt *stmt, bool compute_row); int start_parse_prepared_query(struct _hstmt *stmt, bool compute_row); int continue_parse_prepared_query(struct _hstmt *stmt, SQLPOINTER DataPtr, SQLLEN StrLen_or_Ind); const char *parse_const_param(const char * s, TDS_SERVER_TYPE *type); const char *odbc_skip_rpc_name(const char *s); /* * sql2tds.c */ SQLRETURN odbc_sql2tds(TDS_STMT * stmt, const struct _drecord *drec_ixd, const struct _drecord *drec_axd, TDSCOLUMN *curcol, bool compute_row, const TDS_DESC* axd, unsigned int n_row); TDS_INT convert_datetime2server(int bindtype, const void *src, TDS_DATETIMEALL * dta); /* * bcp.c */ void odbc_bcp_free_storage(TDS_DBC *dbc); void odbc_bcp_init(TDS_DBC *dbc, const ODBC_CHAR *tblname, const ODBC_CHAR *hfile, const ODBC_CHAR *errfile, int direction _WIDE); void odbc_bcp_control(TDS_DBC *dbc, int field, void *value); void odbc_bcp_colptr(TDS_DBC *dbc, const void * colptr, int table_column); void odbc_bcp_sendrow(TDS_DBC *dbc); int odbc_bcp_batch(TDS_DBC *dbc); int odbc_bcp_done(TDS_DBC *dbc); void odbc_bcp_bind(TDS_DBC *dbc, const void * varaddr, int prefixlen, int varlen, const void * terminator, int termlen, int vartype, int table_column); /* * sqlwchar.c */ #if SIZEOF_SQLWCHAR != SIZEOF_WCHAR_T size_t sqlwcslen(const SQLWCHAR * s); typedef struct sqlwstr_buf { struct sqlwstr_buf *next; wchar_t buf[256]; } SQLWSTRBUF; const wchar_t *sqlwstr(const SQLWCHAR * s, SQLWSTRBUF **bufs); void sqlwstr_free(SQLWSTRBUF *bufs); #define SQLWSTR_BUFS(n) SQLWSTRBUF *bufs = NULL #define SQLWSTR(s) sqlwstr(s, &bufs) #define SQLWSTR_FREE() sqlwstr_free(bufs) #else #define sqlwcslen(s) wcslen(s) #define SQLWSTR_BUFS(n) do {} while(0) #define SQLWSTR(s) ((const wchar_t*)(s)) #define SQLWSTR_FREE() do {} while(0) #endif int odbc_get_wide_canonic(TDSCONNECTION *conn); #include #ifdef __cplusplus #if 0 { #endif } #endif #endif freetds-1.3.6/include/freetds/version.h000644 025423 025423 00000002164 14162303376 021530 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsversion_h_ #define _tdsversion_h_ /* $Id: 9640daf619734147e3b5ff6a1dad56ad305ffa51 $ */ #define TDS_VERSION_NO "freetds v1.3.6" #define TDS_VERSION_MAJOR 1 #define TDS_VERSION_MINOR 3 #define TDS_VERSION_SUBVERSION 6 #define TDS_VERSION_BUILD_NUMBER 361 #endif freetds-1.3.6/include/freetds/server.h000644 025423 025423 00000005310 14056414221 021337 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsserver_h_ #define _tdsserver_h_ #endif #ifdef __cplusplus extern "C" { #endif #if 0 } #endif /* login.c */ unsigned char *tds7_decrypt_pass(const unsigned char *crypt_pass, int len, unsigned char *clear_pass); TDSSOCKET *tds_listen(TDSCONTEXT * ctx, int ip_port); int tds_read_login(TDSSOCKET * tds, TDSLOGIN * login); int tds7_read_login(TDSSOCKET * tds, TDSLOGIN * login); TDSLOGIN *tds_alloc_read_login(TDSSOCKET * tds); /* query.c */ char *tds_get_query(TDSSOCKET * tds); char *tds_get_generic_query(TDSSOCKET * tds); /* server.c */ void tds_env_change(TDSSOCKET * tds, int type, const char *oldvalue, const char *newvalue); void tds_send_msg(TDSSOCKET * tds, int msgno, int msgstate, int severity, const char *msgtext, const char *srvname, const char *procname, int line); void tds_send_login_ack(TDSSOCKET * tds, const char *progname); void tds_send_eed(TDSSOCKET * tds, int msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line); void tds_send_err(TDSSOCKET * tds, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); void tds_send_capabilities_token(TDSSOCKET * tds); /* TODO remove, use tds_send_done */ void tds_send_done_token(TDSSOCKET * tds, TDS_SMALLINT flags, TDS_INT numrows); void tds_send_done(TDSSOCKET * tds, int token, TDS_SMALLINT flags, TDS_INT numrows); void tds_send_control_token(TDSSOCKET * tds, TDS_SMALLINT numcols); void tds_send_col_name(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_col_info(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds7_send_result(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_table_header(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds_send_row(TDSSOCKET * tds, TDSRESULTINFO * resinfo); void tds71_send_prelogin(TDSSOCKET * tds); #if 0 { #endif #ifdef __cplusplus } #endif freetds-1.3.6/include/freetds/configs.h000644 025423 025423 00000002575 14056414221 021473 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tds_configs_h_ #define _tds_configs_h_ #include #ifndef _tds_h_ #error freetds/tds.h must be included before freetds/configs.h #endif #ifdef __cplusplus extern "C" { #if 0 } #endif #endif #define FREETDS_SYSCONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR "freetds.conf" #define FREETDS_POOLCONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR "pool.conf" #define FREETDS_LOCALECONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR "locales.conf" #ifdef __cplusplus #if 0 { #endif } #endif #endif /* _tds_configs_h_ */ freetds-1.3.6/include/freetds/enum_cap.h000644 025423 025423 00000014021 14056414221 021617 0ustar00fredianofrediano000000 000000 typedef enum tds_request_capability { TDS_REQ_LANG = 1 , TDS_REQ_RPC = 2 , TDS_REQ_EVT = 3 , TDS_REQ_MSTMT = 4 , TDS_REQ_BCP = 5 , TDS_REQ_CURSOR = 6 , TDS_REQ_DYNF = 7 , TDS_REQ_MSG = 8 , TDS_REQ_PARAM = 9 , TDS_REQ_DATA_INT1 = 10 , TDS_REQ_DATA_INT2 = 11 , TDS_REQ_DATA_INT4 = 12 , TDS_REQ_DATA_BIT = 13 , TDS_REQ_DATA_CHAR = 14 , TDS_REQ_DATA_VCHAR = 15 , TDS_REQ_DATA_BIN = 16 , TDS_REQ_DATA_VBIN = 17 , TDS_REQ_DATA_MNY8 = 18 , TDS_REQ_DATA_MNY4 = 19 , TDS_REQ_DATA_DATE8 = 20 , TDS_REQ_DATA_DATE4 = 21 , TDS_REQ_DATA_FLT4 = 22 , TDS_REQ_DATA_FLT8 = 23 , TDS_REQ_DATA_NUM = 24 , TDS_REQ_DATA_TEXT = 25 , TDS_REQ_DATA_IMAGE = 26 , TDS_REQ_DATA_DEC = 27 , TDS_REQ_DATA_LCHAR = 28 , TDS_REQ_DATA_LBIN = 29 , TDS_REQ_DATA_INTN = 30 , TDS_REQ_DATA_DATETIMEN = 31 , TDS_REQ_DATA_MONEYN = 32 , TDS_REQ_CSR_PREV = 33 , TDS_REQ_CSR_FIRST = 34 , TDS_REQ_CSR_LAST = 35 , TDS_REQ_CSR_ABS = 36 , TDS_REQ_CSR_REL = 37 , TDS_REQ_CSR_MULTI = 38 , TDS_REQ_CON_OOB = 39 , TDS_REQ_CON_INBAND = 40 , TDS_REQ_CON_LOGICAL = 41 , TDS_REQ_PROTO_TEXT = 42 , TDS_REQ_PROTO_BULK = 43 , TDS_REQ_URGEVT = 44 , TDS_REQ_DATA_SENSITIVITY = 45 , TDS_REQ_DATA_BOUNDARY = 46 , TDS_REQ_PROTO_DYNAMIC = 47 , TDS_REQ_PROTO_DYNPROC = 48 , TDS_REQ_DATA_FLTN = 49 , TDS_REQ_DATA_BITN = 50 , TDS_REQ_DATA_INT8 = 51 , TDS_REQ_DATA_VOID = 52 , TDS_REQ_DOL_BULK = 53 , TDS_REQ_OBJECT_JAVA1 = 54 , TDS_REQ_OBJECT_CHAR = 55 , TDS_REQ_OBJECT_BINARY = 57 , TDS_REQ_DATA_COLUMNSTATUS = 58 , TDS_REQ_WIDETABLE = 59 , TDS_REQ_DATA_UINT2 = 61 , TDS_REQ_DATA_UINT4 = 62 , TDS_REQ_DATA_UINT8 = 63 , TDS_REQ_DATA_UINTN = 64 , TDS_REQ_CUR_IMPLICIT = 65 , TDS_REQ_DATA_NLBIN = 66 , TDS_REQ_IMAGE_NCHAR = 67 , TDS_OBS_BLOB_NCHAR_16 = 68 /* obsolete */ , TDS_REQ_BLOB_NCHAR_8 = 69 , TDS_REQ_BLOB_NCHAR_SCSU = 70 , TDS_REQ_DATA_DATE = 71 , TDS_REQ_DATA_TIME = 72 , TDS_REQ_DATA_INTERVAL = 73 , TDS_REQ_CSR_SCROLL = 74 , TDS_REQ_CSR_SENSITIVE = 75 , TDS_REQ_CSR_INSENSITIVE = 76 , TDS_REQ_CSR_SEMISENSITIVE = 77 , TDS_REQ_CSR_KEYSETDRIVEN = 78 , TDS_REQ_SRVPKTSIZE = 79 , TDS_REQ_DATA_UNITEXT = 80 , TDS_REQ_CAP_CLUSTERFAILOVER = 81 , TDS_REQ_DATA_SINT1 = 82 , TDS_REQ_LARGEIDENT = 83 , TDS_REQ_BLOB_NCHAR_16 = 84 , TDS_REQ_DATA_XML = 85 , TDS_REQ_CURINFO3 = 86 , TDS_REQ_DBRPC2 = 87 , TDS_REQ_MIGRATE = 89 , TDS_REQ_DATA_BIGDATETIME = 93 , TDS_REQ_DATA_BIGTIME = 94 , TDS_REQ_CAP_MAX = 94 /* repeats last enum */ } TDS_REQUEST_CAPABILITY; typedef enum tds_response_capability { TDS_RES_NOMSG = 1 , TDS_RES_NOEED = 2 , TDS_RES_NOPARAM = 3 , TDS_RES_DATA_NOINT1 = 4 , TDS_RES_DATA_NOINT2 = 5 , TDS_RES_DATA_NOINT4 = 6 , TDS_RES_DATA_NOBIT = 7 , TDS_RES_DATA_NOCHAR = 8 , TDS_RES_DATA_NOVCHAR = 9 , TDS_RES_DATA_NOBIN = 10 , TDS_RES_DATA_NOVBIN = 11 , TDS_RES_DATA_NOMNY8 = 12 , TDS_RES_DATA_NOMNY4 = 13 , TDS_RES_DATA_NODATE8 = 14 , TDS_RES_DATA_NODATE4 = 15 , TDS_RES_DATA_NOFLT4 = 16 , TDS_RES_DATA_NOFLT8 = 17 , TDS_RES_DATA_NONUM = 18 , TDS_RES_DATA_NOTEXT = 19 , TDS_RES_DATA_NOIMAGE = 20 , TDS_RES_DATA_NODEC = 21 , TDS_RES_DATA_NOLCHAR = 22 , TDS_RES_DATA_NOLBIN = 23 , TDS_RES_DATA_INTN = 24 , TDS_RES_DATA_NODATETIMEN = 25 , TDS_RES_DATA_NOMONEYN = 26 , TDS_RES_CON_NOOOB = 27 , TDS_RES_CON_NOINBAND = 28 , TDS_RES_PROTO_NOTEXT = 29 , TDS_RES_PROTO_NOBULK = 30 , TDS_RES_DATA_NOSENSITIVITY = 31 , TDS_RES_DATA_NOBOUNDARY = 32 , TDS_RES_NOTDSDEBUG = 33 , TDS_RES_NOSTRIPBLANKS = 34 , TDS_RES_DATA_NOINT8 = 35 , TDS_RES_OBJECT_NOJAVA1 = 36 , TDS_RES_OBJECT_NOCHAR = 37 , TDS_RES_DATA_NOCOLUMNSTATUS = 38 , TDS_RES_OBJECT_NOBINARY = 39 , TDS_RES_DATA_NOUINT2 = 41 , TDS_RES_DATA_NOUINT4 = 42 , TDS_RES_DATA_NOUINT8 = 43 , TDS_RES_DATA_NOUINTN = 44 , TDS_RES_NO_WIDETABLES = 45 , TDS_RES_DATA_NONLBIN = 46 , TDS_RES_IMAGE_NONCHAR = 47 , TDS_RES_BLOB_NONCHAR_16 = 48 , TDS_RES_BLOB_NONCHAR_8 = 49 , TDS_RES_BLOB_NONCHAR_SCSU = 50 , TDS_RES_DATA_NODATE = 51 , TDS_RES_DATA_NOTIME = 52 , TDS_RES_DATA_NOINTERVAL = 53 , TDS_RES_DATA_NOUNITEXT = 54 , TDS_RES_DATA_NOSINT1 = 55 , TDS_RES_NO_LARGEIDENT = 56 , TDS_RES_NO_BLOB_NCHAR_16 = 57 , TDS_RES_NO_SRVPKTSIZE = 58 , TDS_RES_DATA_NOXML = 59 , TDS_RES_NONINT_RETURN_VALUE = 60 , TDS_RES_NOXNLDATA = 61 , TDS_RES_SUPPRESS_FMT = 62 , TDS_RES_SUPPRESS_DONEINPROC = 63 , TDS_RES_FORCE_ROWFMT2 = 64 , TDS_RES_CAP_MAX = 64 /* repeats last enum */ } TDS_RESPONSE_CAPABILITY; freetds-1.3.6/include/freetds/sysdep_private.h000644 025423 025423 00000015643 14056414221 023104 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * Copyright (C) 2010 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tds_sysdep_private_h_ #define _tds_sysdep_private_h_ #define TDS_ADDITIONAL_SPACE 16 #ifdef MSG_NOSIGNAL # define TDS_NOSIGNAL MSG_NOSIGNAL #else # define TDS_NOSIGNAL 0L #endif #ifdef __cplusplus extern "C" { #if 0 } #endif #endif #ifdef __INCvxWorksh #include /* for FIONBIO */ #endif /* __INCvxWorksh */ #if defined(DOS32X) #define READSOCKET(a,b,c) recv((a), (b), (c), TDS_NOSIGNAL) #define WRITESOCKET(a,b,c) send((a), (b), (c), TDS_NOSIGNAL) #define CLOSESOCKET(a) closesocket((a)) #define IOCTLSOCKET(a,b,c) ioctlsocket((a), (b), (char*)(c)) #define SOCKLEN_T int #define select select_s typedef int pid_t; #define strcasecmp stricmp #define strncasecmp strnicmp /* TODO this has nothing to do with ip ... */ #define getpid() _gethostid() #endif /* defined(DOS32X) */ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) #include #define READSOCKET(a,b,c) recv((a), (char *) (b), (c), TDS_NOSIGNAL) #define WRITESOCKET(a,b,c) send((a), (const char *) (b), (c), TDS_NOSIGNAL) #define CLOSESOCKET(a) closesocket((a)) #define IOCTLSOCKET(a,b,c) ioctlsocket((a), (b), (c)) #define SOCKLEN_T int int tds_socket_init(void); #define INITSOCKET() tds_socket_init() void tds_socket_done(void); #define DONESOCKET() tds_socket_done() #define NETDB_REENTRANT 1 /* BSD-style netdb interface is reentrant */ #define TDSSOCK_EINTR WSAEINTR #define TDSSOCK_EINPROGRESS WSAEWOULDBLOCK #define TDSSOCK_ETIMEDOUT WSAETIMEDOUT #define TDSSOCK_WOULDBLOCK(e) ((e)==WSAEWOULDBLOCK) #define TDSSOCK_ECONNRESET WSAECONNRESET #define sock_errno WSAGetLastError() #define set_sock_errno(err) WSASetLastError(err) #define sock_strerror(n) tds_prwsaerror(n) #define sock_strerror_free(s) tds_prwsaerror_free(s) #ifndef __MINGW32__ typedef DWORD pid_t; #endif #undef strcasecmp #define strcasecmp stricmp #undef strncasecmp #define strncasecmp strnicmp #if defined(HAVE__SNPRINTF) && !defined(HAVE_SNPRINTF) #define snprintf _snprintf #endif #ifndef WIN32 #define WIN32 1 #endif #if defined(_WIN64) && !defined(WIN64) #define WIN64 1 #endif #define TDS_SDIR_SEPARATOR "\\" /* use macros to use new style names */ #if defined(__MSVCRT__) || defined(_MSC_VER) /* Use API as always present and not causing problems */ #undef getpid #define getpid() GetCurrentProcessId() #define strdup(s) _strdup(s) #define unlink(f) _unlink(f) #define putenv(s) _putenv(s) #undef fileno #define fileno(f) _fileno(f) #undef close #define close(f) _close(f) #undef open #define open(fn,...) _open(fn,__VA_ARGS__) #undef dup2 #define dup2(o,n) _dup2(o,n) #define stricmp(s1,s2) _stricmp(s1,s2) #define strnicmp(s1,s2,n) _strnicmp(s1,s2,n) #endif #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */ #ifndef sock_errno #define sock_errno errno #endif #ifndef set_sock_errno #define set_sock_errno(err) do { errno = (err); } while(0) #endif #ifndef sock_strerror #define sock_strerror(n) strerror(n) #define sock_strerror_free(s) do {} while(0) #endif #ifndef TDSSOCK_EINTR #define TDSSOCK_EINTR EINTR #endif #ifndef TDSSOCK_EINPROGRESS #define TDSSOCK_EINPROGRESS EINPROGRESS #endif #ifndef TDSSOCK_ETIMEDOUT #define TDSSOCK_ETIMEDOUT ETIMEDOUT #endif #ifndef TDSSOCK_WOULDBLOCK # if defined(EWOULDBLOCK) && EAGAIN != EWOULDBLOCK # define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN||(e)==EWOULDBLOCK) # else # define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN) # endif #endif #ifndef TDSSOCK_ECONNRESET #define TDSSOCK_ECONNRESET ECONNRESET #endif #ifndef INITSOCKET #define INITSOCKET() 0 #endif /* !INITSOCKET */ #ifndef DONESOCKET #define DONESOCKET() do { } while(0) #endif /* !DONESOCKET */ #ifndef READSOCKET # ifdef MSG_NOSIGNAL # define READSOCKET(s,b,l) recv((s), (b), (l), MSG_NOSIGNAL) # else # define READSOCKET(s,b,l) read((s), (b), (l)) # endif #endif /* !READSOCKET */ #ifndef WRITESOCKET # ifdef MSG_NOSIGNAL # define WRITESOCKET(s,b,l) send((s), (b), (l), MSG_NOSIGNAL) # else # define WRITESOCKET(s,b,l) write((s), (b), (l)) # endif #endif /* !WRITESOCKET */ #ifndef CLOSESOCKET #define CLOSESOCKET(s) close((s)) #endif /* !CLOSESOCKET */ #ifndef IOCTLSOCKET #define IOCTLSOCKET(s,b,l) ioctl((s), (b), (l)) #endif /* !IOCTLSOCKET */ #ifndef SOCKLEN_T # define SOCKLEN_T socklen_t #endif #if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32) typedef int TDS_SYS_SOCKET; #define INVALID_SOCKET -1 #define TDS_IS_SOCKET_INVALID(s) ((s) < 0) #else typedef SOCKET TDS_SYS_SOCKET; #define TDS_IS_SOCKET_INVALID(s) ((s) == INVALID_SOCKET) #endif #define tds_accept accept #define tds_getpeername getpeername #define tds_getsockopt getsockopt #define tds_getsockname getsockname #define tds_recvfrom recvfrom #if defined(__hpux__) && SIZEOF_VOID_P == 8 && SIZEOF_INT == 4 # if HAVE__XPG_ACCEPT # undef tds_accept # define tds_accept _xpg_accept # elif HAVE___ACCEPT # undef tds_accept # define tds_accept __accept # endif # if HAVE__XPG_GETPEERNAME # undef tds_getpeername # define tds_getpeername _xpg_getpeername # elif HAVE___GETPEERNAME # undef tds_getpeername # define tds_getpeername __getpeername # endif # if HAVE__XPG_GETSOCKOPT # undef tds_getsockopt # define tds_getsockopt _xpg_getsockopt # elif HAVE___GETSOCKOPT # undef tds_getsockopt # define tds_getsockopt __getsockopt # endif # if HAVE__XPG_GETSOCKNAME # undef tds_getsockname # define tds_getsockname _xpg_getsockname # elif HAVE___GETSOCKNAME # undef tds_getsockname # define tds_getsockname __getsockname # endif # if HAVE__XPG_RECVFROM # undef tds_recvfrom # define tds_recvfrom _xpg_recvfrom # elif HAVE___RECVFROM # undef tds_recvfrom # define tds_recvfrom __recvfrom # endif #endif #ifndef TDS_SDIR_SEPARATOR #define TDS_SDIR_SEPARATOR "/" #endif /* !TDS_SDIR_SEPARATOR */ #ifdef HAVE_INTTYPES_H #include #endif #ifndef PRId64 #define PRId64 TDS_I64_PREFIX "d" #endif #ifndef PRIu64 #define PRIu64 TDS_I64_PREFIX "u" #endif #ifndef PRIx64 #define PRIx64 TDS_I64_PREFIX "x" #endif #ifdef __cplusplus #if 0 { #endif } #endif #endif /* _tds_sysdep_private_h_ */ freetds-1.3.6/include/freetds/stream.h000644 025423 025423 00000007176 14056414221 021340 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2013 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _freetds_stream_h_ #define _freetds_stream_h_ #ifndef _tds_h_ #error Include tds.h first #endif #include /** define a stream of data used for input */ typedef struct tds_input_stream { /** read some data * Return 0 if end of stream * Return <0 if error (actually not defined) */ int (*read)(struct tds_input_stream *stream, void *ptr, size_t len); } TDSINSTREAM; /** define a stream of data used for output */ typedef struct tds_output_stream { /** write len bytes from buffer, return <0 if error or len */ int (*write)(struct tds_output_stream *stream, size_t len); /** * write buffer. client will write data into this buffer. * not required that buffer is the result of any alloc function * so buffer pointer can point in the middle of another buffer. * client will write up to buf_len. * client should not cache buffer and buf_len before a call * to write as write can change these values. */ char *buffer; size_t buf_len; } TDSOUTSTREAM; /** Convert a stream from istream to ostream using a specific conversion */ TDSRET tds_convert_stream(TDSSOCKET * tds, TDSICONV * char_conv, TDS_ICONV_DIRECTION direction, TDSINSTREAM * istream, TDSOUTSTREAM *ostream); /** Copy data from a stream to another */ TDSRET tds_copy_stream(TDSINSTREAM * istream, TDSOUTSTREAM * ostream); /* Additional streams */ /** input stream to read data from tds protocol */ typedef struct tds_datain_stream { TDSINSTREAM stream; size_t wire_size; /**< bytes still to read */ TDSSOCKET *tds; } TDSDATAINSTREAM; void tds_datain_stream_init(TDSDATAINSTREAM * stream, TDSSOCKET * tds, size_t wire_size); /** output stream to write data to tds protocol */ typedef struct tds_dataout_stream { TDSOUTSTREAM stream; TDSSOCKET *tds; size_t written; } TDSDATAOUTSTREAM; void tds_dataout_stream_init(TDSDATAOUTSTREAM * stream, TDSSOCKET * tds); /** input stream to read data from a static buffer */ typedef struct tds_staticin_stream { TDSINSTREAM stream; const char *buffer; size_t buf_left; } TDSSTATICINSTREAM; void tds_staticin_stream_init(TDSSTATICINSTREAM * stream, const void *ptr, size_t len); /** output stream to write data to a static buffer. * stream.buffer contains the pointer where stream will write to. */ typedef struct tds_staticout_stream { TDSOUTSTREAM stream; } TDSSTATICOUTSTREAM; void tds_staticout_stream_init(TDSSTATICOUTSTREAM * stream, void *ptr, size_t len); /** output stream to write data to a dynamic buffer */ typedef struct tds_dynamic_stream { TDSOUTSTREAM stream; /** where is stored the pointer */ void **buf; /** currently allocated buffer */ size_t allocated; /** size of data inside buffer */ size_t size; } TDSDYNAMICSTREAM; TDSRET tds_dynamic_stream_init(TDSDYNAMICSTREAM * stream, void **ptr, size_t allocated); #include #endif freetds-1.3.6/include/freetds/data.h000644 025423 025423 00000006555 14056414221 020756 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2014 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _freetds_data_h_ #define _freetds_data_h_ #ifndef _tds_h_ # error Include tds.h before data.h #endif #include #define TDS_COMMON_FUNCS(name) \ { \ tds_ ## name ## _get_info, \ tds_ ## name ## _get, \ tds_ ## name ## _row_len, \ tds_ ## name ## _put_info, \ tds_ ## name ## _put, \ TDS_EXTRA_CHECK(tds_ ## name ## _check) \ } tds_func_get_info tds_invalid_get_info; tds_func_row_len tds_invalid_row_len; tds_func_get_data tds_invalid_get; tds_func_put_info tds_invalid_put_info; tds_func_put_data tds_invalid_put; tds_func_check tds_invalid_check; tds_func_get_info tds_generic_get_info; tds_func_row_len tds_generic_row_len; tds_func_get_data tds_generic_get; tds_func_put_info tds_generic_put_info; tds_func_put_data tds_generic_put; tds_func_check tds_generic_check; tds_func_get_info tds_numeric_get_info; tds_func_row_len tds_numeric_row_len; tds_func_get_data tds_numeric_get; tds_func_put_info tds_numeric_put_info; tds_func_put_data tds_numeric_put; tds_func_check tds_numeric_check; #define tds_variant_get_info tds_generic_get_info #define tds_variant_row_len tds_generic_row_len tds_func_get_data tds_variant_get; tds_func_put_info tds_variant_put_info; tds_func_put_data tds_variant_put; tds_func_check tds_variant_check; tds_func_get_info tds_msdatetime_get_info; tds_func_row_len tds_msdatetime_row_len; tds_func_get_data tds_msdatetime_get; tds_func_put_info tds_msdatetime_put_info; tds_func_put_data tds_msdatetime_put; tds_func_check tds_msdatetime_check; tds_func_get_info tds_clrudt_get_info; tds_func_row_len tds_clrudt_row_len; #define tds_clrudt_get tds_generic_get tds_func_put_info tds_clrudt_put_info; #define tds_clrudt_put tds_generic_put tds_func_check tds_clrudt_check; tds_func_get_info tds_sybbigtime_get_info; tds_func_row_len tds_sybbigtime_row_len; tds_func_get_data tds_sybbigtime_get; tds_func_put_info tds_sybbigtime_put_info; tds_func_put_data tds_sybbigtime_put; tds_func_check tds_sybbigtime_check; /** * If TDS_DONT_DEFINE_DEFAULT_FUNCTIONS is no defined * define default implementations for these tables */ #ifndef TDS_DONT_DEFINE_DEFAULT_FUNCTIONS # define TDS_DEFINE_DEFAULT_FUNCS(name) \ const TDSCOLUMNFUNCS tds_ ## name ## _funcs = TDS_COMMON_FUNCS(name) TDS_DEFINE_DEFAULT_FUNCS(invalid); TDS_DEFINE_DEFAULT_FUNCS(generic); TDS_DEFINE_DEFAULT_FUNCS(numeric); TDS_DEFINE_DEFAULT_FUNCS(variant); TDS_DEFINE_DEFAULT_FUNCS(msdatetime); TDS_DEFINE_DEFAULT_FUNCS(clrudt); TDS_DEFINE_DEFAULT_FUNCS(sybbigtime); #endif #include #endif freetds-1.3.6/include/freetds/pushvis.h000644 025423 025423 00000000153 14056414221 021532 0ustar00fredianofrediano000000 000000 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__) #pragma GCC visibility push(hidden) #endif freetds-1.3.6/include/freetds/popvis.h000644 025423 025423 00000000142 14056414221 021347 0ustar00fredianofrediano000000 000000 #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__) #pragma GCC visibility pop #endif freetds-1.3.6/include/freetds/time.h000644 025423 025423 00000000237 14056414221 020772 0ustar00fredianofrediano000000 000000 #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif freetds-1.3.6/include/freetds/tls.h000644 025423 025423 00000005713 14056414221 020642 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _freetds_tls_h_ #define _freetds_tls_h_ #ifndef _tds_h_ #error tds.h must be included before tls.h #endif #ifdef HAVE_GNUTLS # if defined(_THREAD_SAFE) && defined(TDS_HAVE_PTHREAD_MUTEX) # include # ifndef GNUTLS_USE_NETTLE # include # endif # endif # include # include #elif defined(HAVE_OPENSSL) # include # include # include #endif #include #if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL) TDSRET tds_ssl_init(TDSSOCKET *tds); void tds_ssl_deinit(TDSCONNECTION *conn); # ifdef HAVE_GNUTLS static inline int tds_ssl_pending(TDSCONNECTION *conn) { return gnutls_record_check_pending((gnutls_session_t) conn->tls_session); } static inline int tds_ssl_read(TDSCONNECTION *conn, unsigned char *buf, int buflen) { return gnutls_record_recv((gnutls_session_t) conn->tls_session, buf, buflen); } static inline int tds_ssl_write(TDSCONNECTION *conn, const unsigned char *buf, int buflen) { return gnutls_record_send((gnutls_session_t) conn->tls_session, buf, buflen); } # else /* compatibility for LibreSSL 2.7 */ #ifdef LIBRESSL_VERSION_NUMBER #define TLS_ST_OK SSL_ST_OK #endif static inline int tds_ssl_pending(TDSCONNECTION *conn) { return SSL_pending((SSL *) conn->tls_session); } static inline int tds_ssl_read(TDSCONNECTION *conn, unsigned char *buf, int buflen) { return SSL_read((SSL *) conn->tls_session, buf, buflen); } static inline int tds_ssl_write(TDSCONNECTION *conn, const unsigned char *buf, int buflen) { return SSL_write((SSL *) conn->tls_session, buf, buflen); } # endif #else static inline TDSRET tds_ssl_init(TDSSOCKET *tds) { return TDS_FAIL; } static inline void tds_ssl_deinit(TDSCONNECTION *conn) { } static inline int tds_ssl_pending(TDSCONNECTION *conn) { return 0; } static inline int tds_ssl_read(TDSCONNECTION *conn, unsigned char *buf, int buflen) { return -1; } static inline int tds_ssl_write(TDSCONNECTION *conn, const unsigned char *buf, int buflen) { return -1; } #endif #include #endif /* _freetds_tls_h_ */ freetds-1.3.6/include/freetds/bool.h000644 025423 025423 00000002222 14056414221 020763 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2015 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef freetds_bool_h_ #define freetds_bool_h_ #ifndef __cplusplus #ifdef HAVE_STDBOOL_H #include #else #undef true #undef false #undef bool typedef unsigned char freetds_boolean_t; #define bool freetds_boolean_t #define true 1 #define false 0 #endif #endif #endif /* freetds_bool_h_ */ freetds-1.3.6/include/freetds/checks.h000644 025423 025423 00000005573 14056414221 021304 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2004 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef TDS_CHECKS_H #define TDS_CHECKS_H #include #if ENABLE_EXTRA_CHECKS #define CHECK_STRUCT_EXTRA(func,s) func(s) #else #define CHECK_STRUCT_EXTRA(func,s) #endif #define CHECK_TDS_EXTRA(tds) CHECK_STRUCT_EXTRA(tds_check_tds_extra,tds) #define CHECK_CONTEXT_EXTRA(ctx) CHECK_STRUCT_EXTRA(tds_check_context_extra,ctx) #define CHECK_TDSENV_EXTRA(env) CHECK_STRUCT_EXTRA(tds_check_env_extra,env) #define CHECK_COLUMN_EXTRA(column) CHECK_STRUCT_EXTRA(tds_check_column_extra,column) #define CHECK_RESULTINFO_EXTRA(res_info) CHECK_STRUCT_EXTRA(tds_check_resultinfo_extra,res_info) #define CHECK_PARAMINFO_EXTRA(res_info) CHECK_STRUCT_EXTRA(tds_check_resultinfo_extra,res_info) #define CHECK_CURSOR_EXTRA(cursor) CHECK_STRUCT_EXTRA(tds_check_cursor_extra,cursor) #define CHECK_DYNAMIC_EXTRA(dynamic) CHECK_STRUCT_EXTRA(tds_check_dynamic_extra,dynamic) #define CHECK_FREEZE_EXTRA(freeze) CHECK_STRUCT_EXTRA(tds_check_freeze_extra,freeze) #define CHECK_CONN_EXTRA(conn) #if ENABLE_EXTRA_CHECKS void tds_check_tds_extra(const TDSSOCKET * tds); void tds_check_context_extra(const TDSCONTEXT * ctx); void tds_check_env_extra(const TDSENV * env); void tds_check_column_extra(const TDSCOLUMN * column); void tds_check_resultinfo_extra(const TDSRESULTINFO * res_info); void tds_check_cursor_extra(const TDSCURSOR * cursor); void tds_check_dynamic_extra(const TDSDYNAMIC * dynamic); void tds_check_freeze_extra(const TDSFREEZE * freeze); #endif #if defined(HAVE_VALGRIND_MEMCHECK_H) && ENABLE_EXTRA_CHECKS # include # define TDS_MARK_UNDEFINED(ptr, len) VALGRIND_MAKE_MEM_UNDEFINED(ptr, len) #else # define TDS_MARK_UNDEFINED(ptr, len) do {} while(0) #endif #if ENABLE_EXTRA_CHECKS void tds_extra_assert_check(const char *fn, int line, int cond, const char *cond_str); # define tds_extra_assert(cond) \ tds_extra_assert_check(__FILE__, __LINE__, cond, #cond) #else # define tds_extra_assert(cond) do { } while(0) #endif #include #endif /* TDS_CHECKS_H */ freetds-1.3.6/include/freetds/alloca.h000644 025423 025423 00000001112 14056414221 021260 0ustar00fredianofrediano000000 000000 /* Cfr https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html */ #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_ALLOCA_H # include #elif !defined alloca # ifdef __GNUC__ # define alloca __builtin_alloca # elif defined _AIX # define alloca __alloca # elif defined _MSC_VER # include # define alloca _alloca # elif !defined HAVE_ALLOCA # ifdef __cplusplus extern "C" # endif void *alloca (size_t); # endif #endif freetds-1.3.6/include/freetds/macros.h000644 025423 025423 00000004731 14056414271 021330 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns * Copyright (C) 2010-2017 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _freetds_macros_h_ #define _freetds_macros_h_ #ifndef _freetds_config_h_ #error should include config.h before #endif #if HAVE_STDDEF_H #include #endif /* HAVE_STDDEF_H */ #include "tds_sysdep_public.h" #define TDS_ZERO_FREE(x) do {free((x)); (x) = NULL;} while(0) #define TDS_VECTOR_SIZE(x) (sizeof(x)/sizeof(x[0])) #ifdef offsetof #define TDS_OFFSET(type, field) offsetof(type, field) #else #define TDS_OFFSET(type, field) (((char*)&((type*)0)->field)-((char*)0)) #endif #if ENABLE_EXTRA_CHECKS # if defined(__llvm__) || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) # define TDS_COMPILE_CHECK(name,check) \ _Static_assert(check,#name) # elif defined(__GNUC__) && __GNUC__ >= 2 # define TDS_COMPILE_CHECK(name,check) \ extern int name[(check)?1:-1] __attribute__ ((unused)) # else # define TDS_COMPILE_CHECK(name,check) \ extern int name[(check)?1:-1] # endif # define TDS_EXTRA_CHECK(stmt) stmt #else # define TDS_COMPILE_CHECK(name,check) \ extern int disabled_check_##name # define TDS_EXTRA_CHECK(stmt) #endif #if defined(__GNUC__) && __GNUC__ >= 3 # define TDS_LIKELY(x) __builtin_expect(!!(x), 1) # define TDS_UNLIKELY(x) __builtin_expect(!!(x), 0) #else # define TDS_LIKELY(x) (x) # define TDS_UNLIKELY(x) (x) #endif #if ENABLE_EXTRA_CHECKS && defined(__GNUC__) && __GNUC__ >= 4 #define TDS_WUR __attribute__ ((__warn_unused_result__)) #else #define TDS_WUR #endif #define TDS_INT2PTR(i) ((void*)(((char*)0)+((intptr_t)(i)))) #define TDS_PTR2INT(p) ((int)(((char*)(p))-((char*)0))) #endif freetds-1.3.6/include/freetds/utils.h000644 025423 025423 00000002761 14056414221 021200 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2016 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _freetds_utils_h_ #define _freetds_utils_h_ #if HAVE_STDDEF_H #include #endif /* HAVE_STDDEF_H */ #include #include #include #ifdef __cplusplus extern "C" { #endif void tds_sleep_s(unsigned sec); void tds_sleep_ms(unsigned ms); char *tds_getpassarg(char *arg); char *tds_timestamp_str(char *str, int maxlen); struct tm *tds_localtime_r(const time_t *timep, struct tm *result); int tds_getservice(const char *name); char *tds_get_homedir(void); int tds_socket_set_nosigpipe(TDS_SYS_SOCKET sock, int on); #ifdef __cplusplus } #endif #include #endif freetds-1.3.6/include/freetds/windows.h000644 025423 025423 00000002014 14056414221 021521 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2018 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef freetds_windows_h_ #define freetds_windows_h_ #ifdef _WIN32 #include #include #include #endif #endif /* freetds_windows_h_ */ freetds-1.3.6/include/freetds/replacements.h000644 025423 025423 00000012466 14056414271 022532 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _replacements_h_ #define _replacements_h_ #include #include "tds_sysdep_public.h" #include #include /* these headers are needed for basename */ #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_LIBGEN_H # include #endif #ifdef HAVE_GETOPT_H # include #endif #if !HAVE_POLL #include #endif /* !HAVE_POLL */ #include #ifdef __cplusplus extern "C" { #endif #if !HAVE_ASPRINTF #undef asprintf int tds_asprintf(char **ret, const char *fmt, ...); #define asprintf tds_asprintf #endif /* !HAVE_ASPRINTF */ #if !HAVE_VASPRINTF #undef vasprintf int tds_vasprintf(char **ret, const char *fmt, va_list ap); #define vasprintf tds_vasprintf #endif /* !HAVE_VASPRINTF */ #if !HAVE_STRTOK_R /* Some MinGW define strtok_r macro thread-safe but not reentrant but we need both so avoid using the macro */ #undef strtok_r #if defined(_WIN32) && HAVE_STRTOK_S #define strtok_r strtok_s #else char *tds_strtok_r(char *str, const char *sep, char **lasts); #define strtok_r tds_strtok_r #endif #endif /* !HAVE_STRTOK_R */ #if !HAVE_STRSEP #undef strsep char *tds_strsep(char **stringp, const char *delim); #define strsep tds_strsep #endif /* !HAVE_STRSEP */ #if !HAVE_STRLCPY size_t tds_strlcpy(char *dest, const char *src, size_t len); #undef strlcpy #define strlcpy(d,s,l) tds_strlcpy(d,s,l) #endif #if !HAVE_GETADDRINFO typedef struct tds_addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; size_t ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct tds_addrinfo *ai_next; } tds_addrinfo; int tds_getaddrinfo(const char *node, const char *service, const struct tds_addrinfo *hints, struct tds_addrinfo **res); int tds_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags); void tds_freeaddrinfo(struct tds_addrinfo *addr); #define addrinfo tds_addrinfo #define getaddrinfo(n,s,h,r) tds_getaddrinfo(n,s,h,r) #define getnameinfo(a,b,c,d,e,f,g) tds_getnameinfo(a,b,c,d,e,f,g) #define freeaddrinfo(a) tds_freeaddrinfo(a) #endif #ifndef AI_FQDN #define AI_FQDN 0 #endif #if !HAVE_STRLCAT size_t tds_strlcat(char *dest, const char *src, size_t len); #undef strlcat #define strlcat(d,s,l) tds_strlcat(d,s,l) #endif #if !HAVE_BASENAME char *tds_basename(char *path); #define basename(path) tds_basename(path) #endif /* * Microsoft's C Runtime library is missing strcasecmp and strncasecmp. * Other Win32 C runtime libraries, notably MinGW, may define it. * There is no symbol uniquely defined in Microsoft's header files that * can be used by the preprocessor to know whether we're compiling for * Microsoft's library or not (or which version). Thus there's no * way to automatically decide whether or not to define strcasecmp * in terms of stricmp. * * The Microsoft *compiler* defines _MSC_VER. On the assumption that * anyone using their compiler is also using their library, the below * tests check _MSC_VER as a proxy. */ #if defined(_WIN32) # if !defined(strcasecmp) && defined(_MSC_VER) # define strcasecmp(A, B) stricmp((A), (B)) # endif # if !defined(strncasecmp) && defined(_MSC_VER) # define strncasecmp(x,y,z) strnicmp((x),(y),(z)) # endif #undef gettimeofday int tds_gettimeofday (struct timeval *tv, void *tz); #define gettimeofday tds_gettimeofday /* Older MinGW-w64 versions don't define these flags. */ #if defined(__MINGW32__) && !defined(AI_ADDRCONFIG) # define AI_ADDRCONFIG 0x00000400 #endif #if defined(__MINGW32__) && !defined(AI_V4MAPPED) # define AI_V4MAPPED 0x00000800 #endif #endif #if defined(_WIN32) && defined(_MSC_VER) #define tds_strtoll _strtoi64 #else #define tds_strtoll strtoll #endif #if !HAVE_GETOPT #undef getopt int tds_getopt(int argc, char * const argv[], const char *optstring); #define getopt tds_getopt extern char *optarg; extern int optind, offset, opterr, optreset; #endif #if !HAVE_SOCKETPAIR int tds_socketpair(int domain, int type, int protocol, TDS_SYS_SOCKET sv[2]); #define socketpair(d,t,p,s) tds_socketpair(d,t,p,s) #endif #if !HAVE_DAEMON int tds_daemon(int no_chdir, int no_close); #define daemon(d,c) tds_daemon(d,c) #endif #if !HAVE_SETENV int tds_setenv(const char *name, const char *value, int overwrite); #define setenv(n,v,o) tds_setenv(n,v,o) int tds_unsetenv(const char *name); #define unsetenv(n) tds_unsetenv(n) #endif #ifdef __cplusplus } #endif #include #endif freetds-1.3.6/include/freetds/Makefile.in000644 025423 025423 00000043430 14162303356 021736 0ustar00fredianofrediano000000 000000 # Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = include/freetds ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = \ $(top_srcdir)/m4/ac_caolan_func_which_gethostbyname_r.m4 \ $(top_srcdir)/m4/ac_have_inaddr_none.m4 \ $(top_srcdir)/m4/ac_have_malloc_options.m4 \ $(top_srcdir)/m4/ac_nullzero.m4 \ $(top_srcdir)/m4/ac_raf_func_which_getservbyname_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_gethostbyaddr_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_getpwuid_r.m4 \ $(top_srcdir)/m4/ac_tds_func_which_localtime_r.m4 \ $(top_srcdir)/m4/acx_pthread.m4 \ $(top_srcdir)/m4/ax_cflags_gcc_option.m4 \ $(top_srcdir)/m4/check_openssl.m4 \ $(top_srcdir)/m4/gettimemilli.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/pushlibs.m4 \ $(top_srcdir)/m4/sprintf_i64_format.m4 \ $(top_srcdir)/m4/type_socklen_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = version.h CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/version.h.in \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_CFLAGS = @AM_CFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_NUMBER = @BUILD_NUMBER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FREETDS_LIBGCC = @FREETDS_LIBGCC@ FREETDS_ODBC_MODULE = @FREETDS_ODBC_MODULE@ FREETDS_SYMBOLIC = @FREETDS_SYMBOLIC@ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@ GCRYPT_LIBS = @GCRYPT_LIBS@ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ GNUTLS_LIBS = @GNUTLS_LIBS@ GPERF = @GPERF@ GREP = @GREP@ HAVE_OPENSSL = @HAVE_OPENSSL@ HAVE_PERL_SOURCES = @HAVE_PERL_SOURCES@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ IODBC_CFLAGS = @IODBC_CFLAGS@ IODBC_LIBS = @IODBC_LIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBADD_DL = @LIBADD_DL@ LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ LIBADD_DLOPEN = @LIBADD_DLOPEN@ LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAJOR = @MAJOR@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MINOR = @MINOR@ MKDIR_P = @MKDIR_P@ NETTLE_CFLAGS = @NETTLE_CFLAGS@ NETTLE_LIBS = @NETTLE_LIBS@ NETWORK_LIBS = @NETWORK_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ ODBC = @ODBC@ ODBCINST_LDFLAGS = @ODBCINST_LDFLAGS@ ODBC_CONFIG = @ODBC_CONFIG@ ODBC_INC = @ODBC_INC@ ODBC_LDFLAGS = @ODBC_LDFLAGS@ OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ OPENSSL_LIBS = @OPENSSL_LIBS@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ RANLIB = @RANLIB@ RC = @RC@ READLINE_LIBS = @READLINE_LIBS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUBVERSION = @SUBVERSION@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acx_pthread_config = @acx_pthread_config@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dblib_define = @dblib_define@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ tds_sysdep_int16_type = @tds_sysdep_int16_type@ tds_sysdep_int32_type = @tds_sysdep_int32_type@ tds_sysdep_int64_type = @tds_sysdep_int64_type@ tds_sysdep_intptr_type = @tds_sysdep_intptr_type@ tds_sysdep_real32_type = @tds_sysdep_real32_type@ tds_sysdep_real64_type = @tds_sysdep_real64_type@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ NULL = noinst_HEADERS = \ iconv.h \ convert.h \ bytes.h \ thread.h \ proto.h \ tds.h \ odbc.h \ version.h \ server.h \ configs.h \ enum_cap.h \ sysdep_private.h \ stream.h \ data.h \ pushvis.h \ popvis.h \ time.h \ tls.h \ bool.h \ checks.h \ alloca.h \ macros.h \ windows.h \ utils.h \ utils/string.h \ utils/dlist.h \ utils/dlist.tmpl.h \ utils/bjoern-utf8.h \ utils/md4.h \ utils/des.h \ utils/md5.h \ utils/hmac_md5.h \ replacements.h \ replacements/poll.h \ replacements/readpassphrase.h \ $(NULL) DISTCLEANFILES = sysconfdir.h GENERATED_HEADER_FILES = encodings.h charset_lookup.h EXTRA_DIST = $(GENERATED_HEADER_FILES) @HAVE_PERL_SOURCES_TRUE@BUILT_SOURCES = $(GENERATED_HEADER_FILES) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/freetds/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/freetds/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): version.h: $(top_builddir)/config.status $(srcdir)/version.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(HEADERS) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_FALSE@clean-local: clean: clean-am clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-local cscopelist-am ctags ctags-am \ distclean distclean-generic distclean-libtool distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile sysconfdir.h: Makefile echo '#define FREETDS_SYSCONFDIR "$(sysconfdir)"' >$@ all-am: sysconfdir.h @HAVE_PERL_SOURCES_TRUE@clean-local: @HAVE_PERL_SOURCES_TRUE@ cd $(srcdir) && rm -f $(BUILT_SOURCES) @HAVE_PERL_SOURCES_TRUE@charset_lookup.h: encodings.h @HAVE_PERL_SOURCES_TRUE@encodings.h: encodings.pl alternative_character_sets.h character_sets.h Makefile @HAVE_PERL_SOURCES_TRUE@ perl $(srcdir)/encodings.pl $(srcdir) $(GPERF) > $@.tmp 2> /dev/null @HAVE_PERL_SOURCES_TRUE@ mv $@.tmp $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: freetds-1.3.6/include/freetds/version.h.in000644 025423 025423 00000002234 14056414221 022125 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998-1999 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsversion_h_ #define _tdsversion_h_ /* $Id: 9640daf619734147e3b5ff6a1dad56ad305ffa51 $ */ #define TDS_VERSION_NO "@PACKAGE@ v@VERSION@" #define TDS_VERSION_MAJOR @MAJOR@ #define TDS_VERSION_MINOR @MINOR@ #define TDS_VERSION_SUBVERSION @SUBVERSION@ #define TDS_VERSION_BUILD_NUMBER @BUILD_NUMBER@ #endif freetds-1.3.6/include/freetds/encodings.h000644 025423 025423 00000052066 14162303403 022011 0ustar00fredianofrediano000000 000000 /* * This file produced from ./encodings.pl on Mon Dec 27 09:27:29 2021 */ #ifdef TDS_ICONV_ENCODING_TABLES static const TDS_ENCODING canonic_charsets[] = { { "ISO-8859-1", 1, 1, 0}, /* 0 */ { "UTF-8", 1, 4, 1}, /* 1 */ { "UCS-2LE", 2, 2, 2}, /* 2 */ { "UCS-2BE", 2, 2, 3}, /* 3 */ { "ARMSCII-8", 1, 1, 4}, /* 4 */ { "BIG-5", 1, 2, 5}, /* 5 */ { "BIG5-HKSCS", 1, 2, 6}, /* 6 */ { "C99", 1, 1, 7}, /* 7 */ { "CHINESE", 1, 1, 8}, /* 8 */ { "CN", 1, 1, 9}, /* 9 */ { "CN-GB", 1, 2, 10}, /* 10 */ { "CN-GB-ISOIR165", 1, 1, 11}, /* 11 */ { "CP1133", 1, 1, 12}, /* 12 */ { "CP1250", 1, 1, 13}, /* 13 */ { "CP1251", 1, 1, 14}, /* 14 */ { "CP1252", 1, 1, 15}, /* 15 */ { "CP1253", 1, 1, 16}, /* 16 */ { "CP1254", 1, 1, 17}, /* 17 */ { "CP1255", 1, 1, 18}, /* 18 */ { "CP1256", 1, 1, 19}, /* 19 */ { "CP1257", 1, 1, 20}, /* 20 */ { "CP1258", 1, 1, 21}, /* 21 */ { "CP1361", 1, 2, 22}, /* 22 */ { "CP437", 1, 1, 23}, /* 23 */ { "CP850", 1, 1, 24}, /* 24 */ { "CP862", 1, 1, 25}, /* 25 */ { "CP866", 1, 1, 26}, /* 26 */ { "CP874", 1, 1, 27}, /* 27 */ { "CP932", 1, 2, 28}, /* 28 */ { "CP936", 1, 2, 29}, /* 29 */ { "CP949", 1, 2, 30}, /* 30 */ { "CP950", 1, 2, 31}, /* 31 */ { "EUC-JP", 1, 3, 32}, /* 32 */ { "EUC-KR", 1, 2, 33}, /* 33 */ { "EUC-TW", 1, 4, 34}, /* 34 */ { "GB18030", 1, 4, 35}, /* 35 */ { "GEORGIAN-ACADEMY", 1, 1, 36}, /* 36 */ { "GEORGIAN-PS", 1, 1, 37}, /* 37 */ { "HZ", 1, 1, 38}, /* 38 */ { "ISO-2022-CN", 1, 4, 39}, /* 39 */ { "ISO-2022-CN-EXT", 1, 4, 40}, /* 40 */ { "ISO-2022-JP", 1, 1, 41}, /* 41 */ { "ISO-2022-JP-1", 1, 1, 42}, /* 42 */ { "ISO-2022-JP-2", 1, 1, 43}, /* 43 */ { "ISO-2022-KR", 1, 2, 44}, /* 44 */ { "ISO-8859-10", 1, 1, 45}, /* 45 */ { "ISO-8859-13", 1, 1, 46}, /* 46 */ { "ISO-8859-14", 1, 1, 47}, /* 47 */ { "ISO-8859-15", 1, 1, 48}, /* 48 */ { "ISO-8859-16", 1, 1, 49}, /* 49 */ { "ISO-8859-2", 1, 1, 50}, /* 50 */ { "ISO-8859-3", 1, 1, 51}, /* 51 */ { "ISO-8859-4", 1, 1, 52}, /* 52 */ { "ISO-8859-5", 1, 1, 53}, /* 53 */ { "ISO-8859-6", 1, 1, 54}, /* 54 */ { "ISO-8859-7", 1, 1, 55}, /* 55 */ { "ISO-8859-8", 1, 1, 56}, /* 56 */ { "ISO-8859-9", 1, 1, 57}, /* 57 */ { "ISO-IR-14", 1, 1, 58}, /* 58 */ { "ISO-IR-149", 1, 1, 59}, /* 59 */ { "ISO-IR-159", 1, 1, 60}, /* 60 */ { "ISO-IR-166", 1, 1, 61}, /* 61 */ { "ISO-IR-87", 1, 1, 62}, /* 62 */ { "JAVA", 1, 1, 63}, /* 63 */ { "JISX0201-1976", 1, 1, 64}, /* 64 */ { "KOI8-R", 1, 1, 65}, /* 65 */ { "KOI8-RU", 1, 1, 66}, /* 66 */ { "KOI8-T", 1, 1, 67}, /* 67 */ { "KOI8-U", 1, 1, 68}, /* 68 */ { "MAC", 1, 1, 69}, /* 69 */ { "MACARABIC", 1, 1, 70}, /* 70 */ { "MACCENTRALEUROPE", 1, 1, 71}, /* 71 */ { "MACCROATIAN", 1, 1, 72}, /* 72 */ { "MACCYRILLIC", 1, 1, 73}, /* 73 */ { "MACGREEK", 1, 1, 74}, /* 74 */ { "MACHEBREW", 1, 1, 75}, /* 75 */ { "MACICELAND", 1, 1, 76}, /* 76 */ { "MACROMANIA", 1, 1, 77}, /* 77 */ { "MACTHAI", 1, 1, 78}, /* 78 */ { "MACTURKISH", 1, 1, 79}, /* 79 */ { "MACUKRAINE", 1, 1, 80}, /* 80 */ { "MULELAO-1", 1, 1, 81}, /* 81 */ { "NEXTSTEP", 1, 1, 82}, /* 82 */ { "ROMAN8", 1, 1, 83}, /* 83 */ { "SJIS", 1, 2, 84}, /* 84 */ { "TCVN", 1, 1, 85}, /* 85 */ { "UCS-4BE", 4, 4, 86}, /* 86 */ { "UCS-4LE", 4, 4, 87}, /* 87 */ { "US-ASCII", 1, 1, 88}, /* 88 */ { "UTF-16BE", 2, 4, 89}, /* 89 */ { "UTF-16LE", 2, 4, 90}, /* 90 */ { "UTF-32BE", 4, 4, 91}, /* 91 */ { "UTF-32LE", 4, 4, 92}, /* 92 */ { "UTF-7", 1, 4, 93}, /* 93 */ { "VISCII", 1, 1, 94}, /* 94 */ }; static const CHARACTER_SET_ALIAS iconv_aliases[] = { { "646", 88 }, { "850", 24 }, { "862", 25 }, { "866", 26 }, { "ANSI_X3.4-1968", 88 }, { "ANSI_X3.4-1986", 88 }, { "ARABIC", 54 }, { "ARMSCII-8", 4 }, { "ASCII", 88 }, { "ASMO-708", 54 }, { "BIG-5", 5 }, { "BIG-FIVE", 5 }, { "BIG5", 5 }, { "BIG5-HKSCS", 6 }, { "BIG5HKSCS", 6 }, { "BIGFIVE", 5 }, { "C99", 7 }, { "CHINESE", 8 }, { "CN", 9 }, { "CN-BIG5", 5 }, { "CN-GB", 10 }, { "CN-GB-ISOIR165", 11 }, { "CP1133", 12 }, { "CP1250", 13 }, { "CP1251", 14 }, { "CP1252", 15 }, { "CP1253", 16 }, { "CP1254", 17 }, { "CP1255", 18 }, { "CP1256", 19 }, { "CP1257", 20 }, { "CP1258", 21 }, { "CP1361", 22 }, { "CP367", 88 }, { "CP437", 23 }, { "CP819", 0 }, { "CP850", 24 }, { "CP862", 25 }, { "CP866", 26 }, { "CP874", 27 }, { "CP932", 28 }, { "CP936", 29 }, { "CP949", 30 }, { "CP950", 31 }, { "CSASCII", 88 }, { "CSBIG5", 5 }, { "CSEUCKR", 33 }, { "CSEUCPKDFMTJAPANESE", 32 }, { "CSEUCTW", 34 }, { "CSGB2312", 10 }, { "CSHALFWIDTHKATAKANA", 64 }, { "CSHPROMAN8", 83 }, { "CSIBM866", 26 }, { "CSISO14JISC6220RO", 58 }, { "CSISO159JISX02121990", 60 }, { "CSISO2022CN", 39 }, { "CSISO2022JP", 41 }, { "CSISO2022JP2", 43 }, { "CSISO2022KR", 44 }, { "CSISO57GB1988", 9 }, { "CSISO58GB231280", 8 }, { "CSISO87JISX0208", 62 }, { "CSISOLATIN1", 0 }, { "CSISOLATIN2", 50 }, { "CSISOLATIN3", 51 }, { "CSISOLATIN4", 52 }, { "CSISOLATIN5", 57 }, { "CSISOLATIN6", 45 }, { "CSISOLATINARABIC", 54 }, { "CSISOLATINCYRILLIC", 53 }, { "CSISOLATINGREEK", 55 }, { "CSISOLATINHEBREW", 56 }, { "CSKOI8R", 65 }, { "CSKSC56011987", 59 }, { "CSMACINTOSH", 69 }, { "CSPC850MULTILINGUAL", 24 }, { "CSPC862LATINHEBREW", 25 }, { "CSSHIFTJIS", 84 }, { "CSUNICODE11", 3 }, { "CSUNICODE11UTF7", 93 }, { "CSVISCII", 94 }, { "CYRILLIC", 53 }, { "ECMA-114", 54 }, { "ECMA-118", 55 }, { "ELOT_928", 55 }, { "EUC-CN", 10 }, { "EUC-JP", 32 }, { "EUC-KR", 33 }, { "EUC-TW", 34 }, { "EUCCN", 10 }, { "EUCJP", 32 }, { "EUCKR", 33 }, { "EUCTW", 34 }, {"EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", 32 }, { "GB18030", 35 }, { "GB2312", 10 }, { "GBK", 29 }, { "GB_1988-80", 9 }, { "GB_2312-80", 8 }, { "GEORGIAN-ACADEMY", 36 }, { "GEORGIAN-PS", 37 }, { "GREEK", 55 }, { "GREEK8", 55 }, { "HEBREW", 56 }, { "HP-ROMAN8", 83 }, { "HZ", 38 }, { "HZ-GB-2312", 38 }, { "IBM-CP1133", 12 }, { "IBM367", 88 }, { "IBM437", 23 }, { "IBM819", 0 }, { "IBM850", 24 }, { "IBM862", 25 }, { "IBM866", 26 }, { "ISO-2022-CN", 39 }, { "ISO-2022-CN-EXT", 40 }, { "ISO-2022-JP", 41 }, { "ISO-2022-JP-1", 42 }, { "ISO-2022-JP-2", 43 }, { "ISO-2022-KR", 44 }, { "ISO-8859-1", 0 }, { "ISO-8859-10", 45 }, { "ISO-8859-13", 46 }, { "ISO-8859-14", 47 }, { "ISO-8859-15", 48 }, { "ISO-8859-16", 49 }, { "ISO-8859-2", 50 }, { "ISO-8859-3", 51 }, { "ISO-8859-4", 52 }, { "ISO-8859-5", 53 }, { "ISO-8859-6", 54 }, { "ISO-8859-7", 55 }, { "ISO-8859-8", 56 }, { "ISO-8859-9", 57 }, { "ISO-CELTIC", 47 }, { "ISO-IR-100", 0 }, { "ISO-IR-101", 50 }, { "ISO-IR-109", 51 }, { "ISO-IR-110", 52 }, { "ISO-IR-126", 55 }, { "ISO-IR-127", 54 }, { "ISO-IR-138", 56 }, { "ISO-IR-14", 58 }, { "ISO-IR-144", 53 }, { "ISO-IR-148", 57 }, { "ISO-IR-149", 59 }, { "ISO-IR-157", 45 }, { "ISO-IR-159", 60 }, { "ISO-IR-165", 11 }, { "ISO-IR-166", 61 }, { "ISO-IR-179", 46 }, { "ISO-IR-199", 47 }, { "ISO-IR-203", 48 }, { "ISO-IR-226", 49 }, { "ISO-IR-57", 9 }, { "ISO-IR-58", 8 }, { "ISO-IR-6", 88 }, { "ISO-IR-87", 62 }, { "ISO646-CN", 9 }, { "ISO646-JP", 58 }, { "ISO646-US", 88 }, { "ISO8859-1", 0 }, { "ISO8859-10", 45 }, { "ISO8859-15", 48 }, { "ISO8859-2", 50 }, { "ISO8859-4", 52 }, { "ISO8859-5", 53 }, { "ISO8859-6", 54 }, { "ISO8859-7", 55 }, { "ISO8859-8", 56 }, { "ISO8859-9", 57 }, { "ISO_646.IRV:1991", 88 }, { "ISO_8859-1", 0 }, { "ISO_8859-10", 45 }, { "ISO_8859-10:1992", 45 }, { "ISO_8859-13", 46 }, { "ISO_8859-14", 47 }, { "ISO_8859-14:1998", 47 }, { "ISO_8859-15", 48 }, { "ISO_8859-15:1998", 48 }, { "ISO_8859-16", 49 }, { "ISO_8859-16:2000", 49 }, { "ISO_8859-1:1987", 0 }, { "ISO_8859-2", 50 }, { "ISO_8859-2:1987", 50 }, { "ISO_8859-3", 51 }, { "ISO_8859-3:1988", 51 }, { "ISO_8859-4", 52 }, { "ISO_8859-4:1988", 52 }, { "ISO_8859-5", 53 }, { "ISO_8859-5:1988", 53 }, { "ISO_8859-6", 54 }, { "ISO_8859-6:1987", 54 }, { "ISO_8859-7", 55 }, { "ISO_8859-7:1987", 55 }, { "ISO_8859-8", 56 }, { "ISO_8859-8:1988", 56 }, { "ISO_8859-9", 57 }, { "ISO_8859-9:1989", 57 }, { "JAVA", 63 }, { "JIS0208", 62 }, { "JISX0201-1976", 64 }, { "JIS_C6220-1969-RO", 58 }, { "JIS_C6226-1983", 62 }, { "JIS_X0201", 64 }, { "JIS_X0208", 62 }, { "JIS_X0208-1983", 62 }, { "JIS_X0208-1990", 62 }, { "JIS_X0212", 60 }, { "JIS_X0212-1990", 60 }, { "JIS_X0212.1990-0", 60 }, { "JOHAB", 22 }, { "JP", 58 }, { "KOI8-R", 65 }, { "KOI8-RU", 66 }, { "KOI8-T", 67 }, { "KOI8-U", 68 }, { "KOREAN", 59 }, { "KSC_5601", 59 }, { "KS_C_5601-1987", 59 }, { "KS_C_5601-1989", 59 }, { "L1", 0 }, { "L2", 50 }, { "L3", 51 }, { "L4", 52 }, { "L5", 57 }, { "L6", 45 }, { "L7", 46 }, { "L8", 47 }, { "LATIN1", 0 }, { "LATIN2", 50 }, { "LATIN3", 51 }, { "LATIN4", 52 }, { "LATIN5", 57 }, { "LATIN6", 45 }, { "LATIN7", 46 }, { "LATIN8", 47 }, { "MAC", 69 }, { "MACARABIC", 70 }, { "MACCENTRALEUROPE", 71 }, { "MACCROATIAN", 72 }, { "MACCYRILLIC", 73 }, { "MACGREEK", 74 }, { "MACHEBREW", 75 }, { "MACICELAND", 76 }, { "MACINTOSH", 69 }, { "MACROMAN", 69 }, { "MACROMANIA", 77 }, { "MACTHAI", 78 }, { "MACTURKISH", 79 }, { "MACUKRAINE", 80 }, { "MS-ANSI", 15 }, { "MS-ARAB", 19 }, { "MS-CYRL", 14 }, { "MS-EE", 13 }, { "MS-GREEK", 16 }, { "MS-HEBR", 18 }, { "MS-TURK", 17 }, { "MS_KANJI", 84 }, { "MULELAO-1", 81 }, { "NEXTSTEP", 82 }, { "R8", 83 }, { "ROMAN8", 83 }, { "SHIFT-JIS", 84 }, { "SHIFT_JIS", 84 }, { "SJIS", 84 }, { "TCVN", 85 }, { "TCVN-5712", 85 }, { "TCVN5712-1", 85 }, { "TCVN5712-1:1993", 85 }, { "TIS-620", 61 }, { "TIS620", 61 }, { "TIS620-0", 61 }, { "TIS620.2529-1", 61 }, { "TIS620.2533-0", 61 }, { "TIS620.2533-1", 61 }, { "UCS-2BE", 3 }, { "UCS-2LE", 2 }, { "UCS-4BE", 86 }, { "UCS-4LE", 87 }, { "UHC", 30 }, { "UNICODE-1-1", 3 }, { "UNICODE-1-1-UTF-7", 93 }, { "UNICODEBIG", 3 }, { "UNICODELITTLE", 2 }, { "US", 88 }, { "US-ASCII", 88 }, { "UTF-16BE", 89 }, { "UTF-16LE", 90 }, { "UTF-32BE", 91 }, { "UTF-32LE", 92 }, { "UTF-7", 93 }, { "UTF-8", 1 }, { "UTF7", 93 }, { "UTF8", 1 }, { "VISCII", 94 }, { "VISCII1.1-1", 94 }, { "WINBALTRIM", 20 }, { "WINDOWS-1250", 13 }, { "WINDOWS-1251", 14 }, { "WINDOWS-1252", 15 }, { "WINDOWS-1253", 16 }, { "WINDOWS-1254", 17 }, { "WINDOWS-1255", 18 }, { "WINDOWS-1256", 19 }, { "WINDOWS-1257", 20 }, { "WINDOWS-1258", 21 }, { "WINDOWS-874", 27 }, { "X0201", 64 }, { "X0208", 62 }, { "X0212", 60 }, { "big5", 5 }, { "cp1250", 13 }, { "cp1251", 14 }, { "cp1252", 15 }, { "cp1253", 16 }, { "cp1254", 17 }, { "cp1255", 18 }, { "cp1256", 19 }, { "cp1257", 20 }, { "cp1258", 21 }, { "cp437", 23 }, { "cp850", 24 }, { "cp862", 25 }, { "cp866", 26 }, { "cp874", 27 }, { "eucJP", 32 }, { "eucKR", 33 }, { "eucTW", 34 }, { "hp15CN", 8 }, { "iso81", 0 }, { "iso815", 48 }, { "iso82", 50 }, { "iso83", 51 }, { "iso84", 52 }, { "iso85", 53 }, { "iso86", 54 }, { "iso87", 55 }, { "iso88", 56 }, { "iso88591", 0 }, { "iso885915", 48 }, { "iso88592", 50 }, { "iso88593", 51 }, { "iso88594", 52 }, { "iso88595", 53 }, { "iso88596", 54 }, { "iso88597", 55 }, { "iso88598", 56 }, { "iso88599", 57 }, { "iso89", 57 }, { "roma8", 83 }, { "roman8", 83 }, { "sjis", 84 }, { "thai8", 61 }, { "tis620", 61 }, { "utf8", 1 }, {NULL, 0} }; #endif enum { TDS_CHARSET_ISO_8859_1 = 0, TDS_CHARSET_UTF_8 = 1, TDS_CHARSET_UCS_2LE = 2, TDS_CHARSET_UCS_2BE = 3, TDS_CHARSET_ARMSCII_8 = 4, TDS_CHARSET_BIG_5 = 5, TDS_CHARSET_BIG5_HKSCS = 6, TDS_CHARSET_C99 = 7, TDS_CHARSET_CHINESE = 8, TDS_CHARSET_CN = 9, TDS_CHARSET_CN_GB = 10, TDS_CHARSET_CN_GB_ISOIR165 = 11, TDS_CHARSET_CP1133 = 12, TDS_CHARSET_CP1250 = 13, TDS_CHARSET_CP1251 = 14, TDS_CHARSET_CP1252 = 15, TDS_CHARSET_CP1253 = 16, TDS_CHARSET_CP1254 = 17, TDS_CHARSET_CP1255 = 18, TDS_CHARSET_CP1256 = 19, TDS_CHARSET_CP1257 = 20, TDS_CHARSET_CP1258 = 21, TDS_CHARSET_CP1361 = 22, TDS_CHARSET_CP437 = 23, TDS_CHARSET_CP850 = 24, TDS_CHARSET_CP862 = 25, TDS_CHARSET_CP866 = 26, TDS_CHARSET_CP874 = 27, TDS_CHARSET_CP932 = 28, TDS_CHARSET_CP936 = 29, TDS_CHARSET_CP949 = 30, TDS_CHARSET_CP950 = 31, TDS_CHARSET_EUC_JP = 32, TDS_CHARSET_EUC_KR = 33, TDS_CHARSET_EUC_TW = 34, TDS_CHARSET_GB18030 = 35, TDS_CHARSET_GEORGIAN_ACADEMY = 36, TDS_CHARSET_GEORGIAN_PS = 37, TDS_CHARSET_HZ = 38, TDS_CHARSET_ISO_2022_CN = 39, TDS_CHARSET_ISO_2022_CN_EXT = 40, TDS_CHARSET_ISO_2022_JP = 41, TDS_CHARSET_ISO_2022_JP_1 = 42, TDS_CHARSET_ISO_2022_JP_2 = 43, TDS_CHARSET_ISO_2022_KR = 44, TDS_CHARSET_ISO_8859_10 = 45, TDS_CHARSET_ISO_8859_13 = 46, TDS_CHARSET_ISO_8859_14 = 47, TDS_CHARSET_ISO_8859_15 = 48, TDS_CHARSET_ISO_8859_16 = 49, TDS_CHARSET_ISO_8859_2 = 50, TDS_CHARSET_ISO_8859_3 = 51, TDS_CHARSET_ISO_8859_4 = 52, TDS_CHARSET_ISO_8859_5 = 53, TDS_CHARSET_ISO_8859_6 = 54, TDS_CHARSET_ISO_8859_7 = 55, TDS_CHARSET_ISO_8859_8 = 56, TDS_CHARSET_ISO_8859_9 = 57, TDS_CHARSET_ISO_IR_14 = 58, TDS_CHARSET_ISO_IR_149 = 59, TDS_CHARSET_ISO_IR_159 = 60, TDS_CHARSET_ISO_IR_166 = 61, TDS_CHARSET_ISO_IR_87 = 62, TDS_CHARSET_JAVA = 63, TDS_CHARSET_JISX0201_1976 = 64, TDS_CHARSET_KOI8_R = 65, TDS_CHARSET_KOI8_RU = 66, TDS_CHARSET_KOI8_T = 67, TDS_CHARSET_KOI8_U = 68, TDS_CHARSET_MAC = 69, TDS_CHARSET_MACARABIC = 70, TDS_CHARSET_MACCENTRALEUROPE = 71, TDS_CHARSET_MACCROATIAN = 72, TDS_CHARSET_MACCYRILLIC = 73, TDS_CHARSET_MACGREEK = 74, TDS_CHARSET_MACHEBREW = 75, TDS_CHARSET_MACICELAND = 76, TDS_CHARSET_MACROMANIA = 77, TDS_CHARSET_MACTHAI = 78, TDS_CHARSET_MACTURKISH = 79, TDS_CHARSET_MACUKRAINE = 80, TDS_CHARSET_MULELAO_1 = 81, TDS_CHARSET_NEXTSTEP = 82, TDS_CHARSET_ROMAN8 = 83, TDS_CHARSET_SJIS = 84, TDS_CHARSET_TCVN = 85, TDS_CHARSET_UCS_4BE = 86, TDS_CHARSET_UCS_4LE = 87, TDS_CHARSET_US_ASCII = 88, TDS_CHARSET_UTF_16BE = 89, TDS_CHARSET_UTF_16LE = 90, TDS_CHARSET_UTF_32BE = 91, TDS_CHARSET_UTF_32LE = 92, TDS_CHARSET_UTF_7 = 93, TDS_CHARSET_VISCII = 94, TDS_NUM_CHARSETS = 95 }; freetds-1.3.6/include/freetds/charset_lookup.h000644 025423 025423 00000223043 14162303403 023055 0ustar00fredianofrediano000000 000000 /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: /usr/pkg/bin/gperf -m 100 -C -K alias_pos -t -F ,-1 -P -H hash_charset -N charset_lookup -L ANSI-C charset_lookup.gperf */ /* Computed positions: -k'1,3-11,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif #line 3 "charset_lookup.gperf" static const struct charset_alias *charset_lookup(register const char *str, register size_t len); #line 2 "charset_lookup.gperf" struct charset_alias { short int alias_pos; short int canonic; }; #define TOTAL_KEYWORDS 374 #define MIN_WORD_LENGTH 2 #define MAX_WORD_LENGTH 45 #define MIN_HASH_VALUE 15 #define MAX_HASH_VALUE 1079 /* maximum key range = 1065, duplicates = 0 */ #ifdef __GNUC__ __inline #else #ifdef __cplusplus inline #endif #endif static unsigned int hash_charset (register const char *str, register size_t len) { static const unsigned short asso_values[] = { 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 7, 132, 1080, 56, 6, 47, 83, 35, 8, 18, 63, 7, 9, 363, 1080, 1080, 1080, 1080, 1080, 1080, 7, 99, 128, 6, 22, 141, 116, 95, 6, 34, 68, 7, 159, 6, 6, 80, 1080, 26, 6, 115, 191, 39, 162, 231, 14, 8, 1080, 1080, 1080, 1080, 37, 1080, 10, 16, 147, 1080, 16, 8, 12, 13, 6, 1080, 6, 1080, 8, 6, 6, 1080, 1080, 6, 7, 6, 19, 1080, 1080, 1080, 6, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080 }; register unsigned int hval = len; switch (hval) { default: hval += asso_values[(unsigned char)str[10]]; /*FALLTHROUGH*/ case 10: hval += asso_values[(unsigned char)str[9]]; /*FALLTHROUGH*/ case 9: hval += asso_values[(unsigned char)str[8]]; /*FALLTHROUGH*/ case 8: hval += asso_values[(unsigned char)str[7]]; /*FALLTHROUGH*/ case 7: hval += asso_values[(unsigned char)str[6]]; /*FALLTHROUGH*/ case 6: hval += asso_values[(unsigned char)str[5]]; /*FALLTHROUGH*/ case 5: hval += asso_values[(unsigned char)str[4]]; /*FALLTHROUGH*/ case 4: hval += asso_values[(unsigned char)str[3]]; /*FALLTHROUGH*/ case 3: hval += asso_values[(unsigned char)str[2]]; /*FALLTHROUGH*/ case 2: case 1: hval += asso_values[(unsigned char)str[0]]; break; } return hval + asso_values[(unsigned char)str[len - 1]]; } struct stringpool_t { char stringpool_str15[sizeof("L1")]; char stringpool_str16[sizeof("L8")]; char stringpool_str17[sizeof("L5")]; char stringpool_str27[sizeof("L6")]; char stringpool_str28[sizeof("SJIS")]; char stringpool_str30[sizeof("koi8")]; char stringpool_str31[sizeof("sjis")]; char stringpool_str35[sizeof("R8")]; char stringpool_str36[sizeof("iso81")]; char stringpool_str38[sizeof("iso88")]; char stringpool_str39[sizeof("iso15")]; char stringpool_str40[sizeof("iso85")]; char stringpool_str41[sizeof("thai8")]; char stringpool_str42[sizeof("iso89")]; char stringpool_str43[sizeof("roma8")]; char stringpool_str44[sizeof("L4")]; char stringpool_str45[sizeof("utf8")]; char stringpool_str46[sizeof("866")]; char stringpool_str47[sizeof("iso815")]; char stringpool_str48[sizeof("big5")]; char stringpool_str50[sizeof("roman8")]; char stringpool_str56[sizeof("L2")]; char stringpool_str57[sizeof("646")]; char stringpool_str60[sizeof("iso86")]; char stringpool_str63[sizeof("iso88591")]; char stringpool_str65[sizeof("iso88598")]; char stringpool_str66[sizeof("iso_1")]; char stringpool_str67[sizeof("iso88595")]; char stringpool_str69[sizeof("iso88599")]; char stringpool_str70[sizeof("greek8")]; char stringpool_str71[sizeof("ISO8859-1")]; char stringpool_str72[sizeof("L7")]; char stringpool_str73[sizeof("ISO8859-8")]; char stringpool_str74[sizeof("iso885915")]; char stringpool_str75[sizeof("ISO8859-5")]; char stringpool_str77[sizeof("ISO8859-9")]; char stringpool_str79[sizeof("ISO-8859-1")]; char stringpool_str81[sizeof("ISO-8859-8")]; char stringpool_str82[sizeof("ISO8859-15")]; char stringpool_str83[sizeof("ISO-8859-5")]; char stringpool_str85[sizeof("ISO-8859-9")]; char stringpool_str87[sizeof("iso88596")]; char stringpool_str89[sizeof("ISO-IR-58")]; char stringpool_str90[sizeof("ISO-8859-15")]; char stringpool_str91[sizeof("JAVA")]; char stringpool_str92[sizeof("L3")]; char stringpool_str93[sizeof("iso14")]; char stringpool_str94[sizeof("iso84")]; char stringpool_str95[sizeof("ISO8859-6")]; char stringpool_str100[sizeof("ISO-IR-159")]; char stringpool_str101[sizeof("ISO-IR-199")]; char stringpool_str102[sizeof("ISO-IR-6")]; char stringpool_str103[sizeof("ISO-8859-6")]; char stringpool_str104[sizeof("862")]; char stringpool_str105[sizeof("HZ")]; char stringpool_str107[sizeof("iso646")]; char stringpool_str108[sizeof("ISO-IR-165")]; char stringpool_str109[sizeof("ISO_8859-1")]; char stringpool_str110[sizeof("ISO-8859-16")]; char stringpool_str111[sizeof("ISO_8859-8")]; char stringpool_str113[sizeof("ISO_8859-5")]; char stringpool_str115[sizeof("ISO_8859-9")]; char stringpool_str116[sizeof("JP")]; char stringpool_str118[sizeof("iso82")]; char stringpool_str120[sizeof("ISO_8859-15")]; char stringpool_str121[sizeof("iso88594")]; char stringpool_str122[sizeof("850")]; char stringpool_str123[sizeof("ISO-IR-148")]; char stringpool_str124[sizeof("ISO_8859-15:1998")]; char stringpool_str127[sizeof("ISO-IR-149")]; char stringpool_str128[sizeof("ISO-IR-166")]; char stringpool_str129[sizeof("ISO8859-4")]; char stringpool_str133[sizeof("ISO_8859-6")]; char stringpool_str135[sizeof("iso10")]; char stringpool_str136[sizeof("CN")]; char stringpool_str137[sizeof("ISO-8859-4")]; char stringpool_str140[sizeof("ISO_8859-16")]; char stringpool_str141[sizeof("KOREAN")]; char stringpool_str142[sizeof("ISO-IR-101")]; char stringpool_str143[sizeof("ISO-IR-14")]; char stringpool_str144[sizeof("ISO-8859-14")]; char stringpool_str145[sizeof("iso88592")]; char stringpool_str146[sizeof("KOI8-R")]; char stringpool_str148[sizeof("ISO-IR-109")]; char stringpool_str149[sizeof("C99")]; char stringpool_str150[sizeof("iso87")]; char stringpool_str151[sizeof("ISO_8859-14:1998")]; char stringpool_str152[sizeof("LATIN1")]; char stringpool_str153[sizeof("ISO8859-2")]; char stringpool_str154[sizeof("LATIN8")]; char stringpool_str155[sizeof("ISO-IR-179")]; char stringpool_str156[sizeof("LATIN5")]; char stringpool_str157[sizeof("ISO-IR-126")]; char stringpool_str158[sizeof("ASCII")]; char stringpool_str161[sizeof("ISO-8859-2")]; char stringpool_str164[sizeof("CP819")]; char stringpool_str167[sizeof("ISO_8859-4")]; char stringpool_str170[sizeof("TCVN")]; char stringpool_str171[sizeof("ISO-IR-138")]; char stringpool_str173[sizeof("hp15CN")]; char stringpool_str174[sizeof("ISO_8859-14")]; char stringpool_str176[sizeof("LATIN6")]; char stringpool_str177[sizeof("iso88597")]; char stringpool_str178[sizeof("ISO8859-10")]; char stringpool_str179[sizeof("ISO-IR-144")]; char stringpool_str183[sizeof("ISO_8859-16:2000")]; char stringpool_str185[sizeof("ISO8859-7")]; char stringpool_str186[sizeof("ISO-8859-10")]; char stringpool_str189[sizeof("iso13")]; char stringpool_str190[sizeof("iso83")]; char stringpool_str191[sizeof("ISO_8859-2")]; char stringpool_str192[sizeof("ISO-IR-110")]; char stringpool_str193[sizeof("ISO-8859-7")]; char stringpool_str194[sizeof("CP866")]; char stringpool_str195[sizeof("CP949")]; char stringpool_str196[sizeof("tis620")]; char stringpool_str197[sizeof("VISCII")]; char stringpool_str198[sizeof("ISO-IR-226")]; char stringpool_str199[sizeof("US")]; char stringpool_str200[sizeof("ISO-IR-87")]; char stringpool_str201[sizeof("ISO-IR-57")]; char stringpool_str202[sizeof("IBM819")]; char stringpool_str203[sizeof("macthai")]; char stringpool_str204[sizeof("MS-ANSI")]; char stringpool_str205[sizeof("macturk")]; char stringpool_str207[sizeof("CP1251")]; char stringpool_str208[sizeof("ISO-IR-157")]; char stringpool_str209[sizeof("CP1258")]; char stringpool_str210[sizeof("LATIN4")]; char stringpool_str211[sizeof("CP1255")]; char stringpool_str212[sizeof("ISO_8859-10:1992")]; char stringpool_str213[sizeof("cp866")]; char stringpool_str214[sizeof("cp949")]; char stringpool_str216[sizeof("ISO_8859-10")]; char stringpool_str217[sizeof("iso88593")]; char stringpool_str218[sizeof("ROMAN8")]; char stringpool_str219[sizeof("CHINESE")]; char stringpool_str220[sizeof("JIS0208")]; char stringpool_str223[sizeof("ISO_8859-7")]; char stringpool_str225[sizeof("macgreek")]; char stringpool_str226[sizeof("cp1251")]; char stringpool_str227[sizeof("ascii_8")]; char stringpool_str228[sizeof("cp1258")]; char stringpool_str229[sizeof("ECMA-118")]; char stringpool_str230[sizeof("cp1255")]; char stringpool_str231[sizeof("CP1256")]; char stringpool_str232[sizeof("IBM866")]; char stringpool_str233[sizeof("ISO-8859-3")]; char stringpool_str234[sizeof("LATIN2")]; char stringpool_str235[sizeof("BIG5")]; char stringpool_str236[sizeof("MULELAO-1")]; char stringpool_str237[sizeof("MS-EE")]; char stringpool_str239[sizeof("ISO646-CN")]; char stringpool_str240[sizeof("ISO-8859-13")]; char stringpool_str242[sizeof("ISO-IR-100")]; char stringpool_str243[sizeof("BIG-5")]; char stringpool_str247[sizeof("ISO-IR-127")]; char stringpool_str248[sizeof("GREEK8")]; char stringpool_str250[sizeof("cp1256")]; char stringpool_str252[sizeof("CP862")]; char stringpool_str253[sizeof("CP1361")]; char stringpool_str255[sizeof("GBK")]; char stringpool_str258[sizeof("ELOT_928")]; char stringpool_str260[sizeof("CP850")]; char stringpool_str261[sizeof("CP936")]; char stringpool_str262[sizeof("CP950")]; char stringpool_str263[sizeof("ISO_8859-3")]; char stringpool_str265[sizeof("CP1254")]; char stringpool_str266[sizeof("LATIN7")]; char stringpool_str270[sizeof("ISO_8859-13")]; char stringpool_str271[sizeof("cp862")]; char stringpool_str273[sizeof("CP874")]; char stringpool_str274[sizeof("CSKOI8R")]; char stringpool_str275[sizeof("EUCKR")]; char stringpool_str279[sizeof("cp850")]; char stringpool_str280[sizeof("cp936")]; char stringpool_str281[sizeof("cp950")]; char stringpool_str283[sizeof("EUC-KR")]; char stringpool_str284[sizeof("cp1254")]; char stringpool_str285[sizeof("ECMA-114")]; char stringpool_str288[sizeof("eucKR")]; char stringpool_str289[sizeof("CP1252")]; char stringpool_str290[sizeof("IBM862")]; char stringpool_str291[sizeof("CSISO159JISX02121990")]; char stringpool_str292[sizeof("cp874")]; char stringpool_str293[sizeof("ISO646-JP")]; char stringpool_str294[sizeof("CSASCII")]; char stringpool_str295[sizeof("EUCCN")]; char stringpool_str297[sizeof("UCS-4LE")]; char stringpool_str298[sizeof("IBM850")]; char stringpool_str301[sizeof("GREEK")]; char stringpool_str302[sizeof("ISO646-US")]; char stringpool_str303[sizeof("EUC-CN")]; char stringpool_str304[sizeof("TIS620")]; char stringpool_str305[sizeof("mac")]; char stringpool_str306[sizeof("LATIN3")]; char stringpool_str307[sizeof("CP1250")]; char stringpool_str308[sizeof("cp1252")]; char stringpool_str309[sizeof("UCS-2LE")]; char stringpool_str310[sizeof("CSISOLATIN1")]; char stringpool_str312[sizeof("TIS-620")]; char stringpool_str313[sizeof("TCVN5712-1")]; char stringpool_str314[sizeof("CSISOLATIN5")]; char stringpool_str318[sizeof("GB_1988-80")]; char stringpool_str319[sizeof("CP932")]; char stringpool_str320[sizeof("ASMO-708")]; char stringpool_str321[sizeof("CP1257")]; char stringpool_str324[sizeof("KOI8-T")]; char stringpool_str326[sizeof("cp1250")]; char stringpool_str329[sizeof("HP-ROMAN8")]; char stringpool_str331[sizeof("MS_KANJI")]; char stringpool_str333[sizeof("CSVISCII")]; char stringpool_str334[sizeof("CSISOLATIN6")]; char stringpool_str335[sizeof("KSC_5601")]; char stringpool_str336[sizeof("SHIFT-JIS")]; char stringpool_str337[sizeof("ISO-IR-203")]; char stringpool_str338[sizeof("cp932")]; char stringpool_str339[sizeof("JOHAB")]; char stringpool_str340[sizeof("cp1257")]; char stringpool_str342[sizeof("ARMSCII-8")]; char stringpool_str345[sizeof("ISO_646.IRV:1991")]; char stringpool_str347[sizeof("TCVN-5712")]; char stringpool_str349[sizeof("EUCJP")]; char stringpool_str350[sizeof("UTF8")]; char stringpool_str351[sizeof("X0201")]; char stringpool_str352[sizeof("GB2312")]; char stringpool_str353[sizeof("X0208")]; char stringpool_str354[sizeof("ISO-2022-KR")]; char stringpool_str355[sizeof("MS-CYRL")]; char stringpool_str356[sizeof("ISO-2022-JP-1")]; char stringpool_str357[sizeof("EUC-JP")]; char stringpool_str358[sizeof("UTF-8")]; char stringpool_str359[sizeof("VISCII1.1-1")]; char stringpool_str360[sizeof("CP367")]; char stringpool_str361[sizeof("CP1253")]; char stringpool_str362[sizeof("eucJP")]; char stringpool_str364[sizeof("mac_cyr")]; char stringpool_str365[sizeof("US-ASCII")]; char stringpool_str366[sizeof("SHIFT_JIS")]; char stringpool_str368[sizeof("CSISOLATIN4")]; char stringpool_str369[sizeof("TIS620-0")]; char stringpool_str371[sizeof("CSBIG5")]; char stringpool_str374[sizeof("ISO-2022-CN")]; char stringpool_str377[sizeof("CP437")]; char stringpool_str379[sizeof("CN-BIG5")]; char stringpool_str380[sizeof("cp1253")]; char stringpool_str381[sizeof("ARABIC")]; char stringpool_str383[sizeof("X0212")]; char stringpool_str384[sizeof("CSISO14JISC6220RO")]; char stringpool_str387[sizeof("GB18030")]; char stringpool_str389[sizeof("UCS-4BE")]; char stringpool_str392[sizeof("CSISOLATIN2")]; char stringpool_str393[sizeof("GEORGIAN-PS")]; char stringpool_str394[sizeof("KS_C_5601-1989")]; char stringpool_str395[sizeof("CP1133")]; char stringpool_str396[sizeof("cp437")]; char stringpool_str397[sizeof("ISO-2022-JP-2")]; char stringpool_str398[sizeof("IBM367")]; char stringpool_str401[sizeof("UCS-2BE")]; char stringpool_str402[sizeof("UNICODE-1-1")]; char stringpool_str409[sizeof("JIS_C6220-1969-RO")]; char stringpool_str411[sizeof("MS-ARAB")]; char stringpool_str415[sizeof("IBM437")]; char stringpool_str418[sizeof("MAC")]; char stringpool_str422[sizeof("UTF-16LE")]; char stringpool_str428[sizeof("ISO-2022-JP")]; char stringpool_str429[sizeof("CN-GB-ISOIR165")]; char stringpool_str434[sizeof("WINDOWS-1251")]; char stringpool_str435[sizeof("WINDOWS-1258")]; char stringpool_str436[sizeof("WINDOWS-1255")]; char stringpool_str438[sizeof("CSISOLATINARABIC")]; char stringpool_str441[sizeof("MS-HEBR")]; char stringpool_str444[sizeof("CYRILLIC")]; char stringpool_str445[sizeof("JIS_C6226-1983")]; char stringpool_str446[sizeof("WINDOWS-1256")]; char stringpool_str448[sizeof("KS_C_5601-1987")]; char stringpool_str450[sizeof("UHC")]; char stringpool_str452[sizeof("BIGFIVE")]; char stringpool_str454[sizeof("CN-GB")]; char stringpool_str455[sizeof("GEORGIAN-ACADEMY")]; char stringpool_str460[sizeof("BIG-FIVE")]; char stringpool_str461[sizeof("CSIBM866")]; char stringpool_str462[sizeof("UTF7")]; char stringpool_str463[sizeof("WINDOWS-1254")]; char stringpool_str464[sizeof("CSISOLATIN3")]; char stringpool_str465[sizeof("UNICODE-1-1-UTF-7")]; char stringpool_str467[sizeof("CSISO57GB1988")]; char stringpool_str470[sizeof("UTF-7")]; char stringpool_str472[sizeof("GB_2312-80")]; char stringpool_str474[sizeof("CSISO2022KR")]; char stringpool_str475[sizeof("WINDOWS-1252")]; char stringpool_str476[sizeof("KOI8-U")]; char stringpool_str479[sizeof("ISO_8859-8:1988")]; char stringpool_str480[sizeof("ISO_8859-5:1988")]; char stringpool_str483[sizeof("ISO_8859-9:1989")]; char stringpool_str484[sizeof("WINDOWS-1250")]; char stringpool_str485[sizeof("MACICELAND")]; char stringpool_str486[sizeof("CSISOLATINGREEK")]; char stringpool_str487[sizeof("ISO-2022-CN-EXT")]; char stringpool_str488[sizeof("JIS_X0201")]; char stringpool_str489[sizeof("JISX0201-1976")]; char stringpool_str490[sizeof("JIS_X0208")]; char stringpool_str491[sizeof("WINDOWS-1257")]; char stringpool_str494[sizeof("CSISO2022CN")]; char stringpool_str496[sizeof("MS-GREEK")]; char stringpool_str500[sizeof("EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE")]; char stringpool_str503[sizeof("KOI8-RU")]; char stringpool_str504[sizeof("TIS620.2529-1")]; char stringpool_str505[sizeof("MACROMAN")]; char stringpool_str506[sizeof("WINDOWS-874")]; char stringpool_str507[sizeof("ISO_8859-4:1988")]; char stringpool_str509[sizeof("CSKSC56011987")]; char stringpool_str511[sizeof("WINDOWS-1253")]; char stringpool_str514[sizeof("UTF-16BE")]; char stringpool_str515[sizeof("CSISO87JISX0208")]; char stringpool_str516[sizeof("CSISO2022JP2")]; char stringpool_str520[sizeof("JIS_X0212")]; char stringpool_str521[sizeof("MACROMANIA")]; char stringpool_str522[sizeof("CSUNICODE11")]; char stringpool_str523[sizeof("MACTHAI")]; char stringpool_str528[sizeof("UTF-32LE")]; char stringpool_str531[sizeof("CSHPROMAN8")]; char stringpool_str534[sizeof("ISO_8859-1:1987")]; char stringpool_str541[sizeof("BIG5HKSCS")]; char stringpool_str546[sizeof("ISO_8859-6:1987")]; char stringpool_str547[sizeof("JIS_X0212-1990")]; char stringpool_str548[sizeof("CSISO2022JP")]; char stringpool_str549[sizeof("BIG5-HKSCS")]; char stringpool_str553[sizeof("CSSHIFTJIS")]; char stringpool_str555[sizeof("ISO_8859-3:1988")]; char stringpool_str557[sizeof("JIS_X0208-1990")]; char stringpool_str560[sizeof("CSISOLATINHEBREW")]; char stringpool_str561[sizeof("CSISOLATINCYRILLIC")]; char stringpool_str563[sizeof("ISO-CELTIC")]; char stringpool_str564[sizeof("HZ-GB-2312")]; char stringpool_str571[sizeof("ANSI_X3.4-1968")]; char stringpool_str572[sizeof("HEBREW")]; char stringpool_str575[sizeof("ISO_8859-2:1987")]; char stringpool_str577[sizeof("CSISO58GB231280")]; char stringpool_str581[sizeof("CSGB2312")]; char stringpool_str582[sizeof("ANSI_X3.4-1986")]; char stringpool_str583[sizeof("CSUNICODE11UTF7")]; char stringpool_str584[sizeof("JIS_X0208-1983")]; char stringpool_str591[sizeof("ISO_8859-7:1987")]; char stringpool_str594[sizeof("EUCTW")]; char stringpool_str596[sizeof("CSEUCKR")]; char stringpool_str602[sizeof("EUC-TW")]; char stringpool_str605[sizeof("MACCROATIAN")]; char stringpool_str607[sizeof("eucTW")]; char stringpool_str614[sizeof("TIS620.2533-1")]; char stringpool_str617[sizeof("MACGREEK")]; char stringpool_str620[sizeof("UTF-32BE")]; char stringpool_str625[sizeof("MACINTOSH")]; char stringpool_str637[sizeof("UNICODELITTLE")]; char stringpool_str641[sizeof("MS-TURK")]; char stringpool_str645[sizeof("MACUKRAINE")]; char stringpool_str651[sizeof("IBM-CP1133")]; char stringpool_str658[sizeof("MACCENTRALEUROPE")]; char stringpool_str663[sizeof("NEXTSTEP")]; char stringpool_str664[sizeof("TIS620.2533-0")]; char stringpool_str674[sizeof("JIS_X0212.1990-0")]; char stringpool_str697[sizeof("MACARABIC")]; char stringpool_str706[sizeof("UNICODEBIG")]; char stringpool_str723[sizeof("CSPC862LATINHEBREW")]; char stringpool_str748[sizeof("MACCYRILLIC")]; char stringpool_str756[sizeof("WINBALTRIM")]; char stringpool_str758[sizeof("TCVN5712-1:1993")]; char stringpool_str762[sizeof("CSMACINTOSH")]; char stringpool_str788[sizeof("CSHALFWIDTHKATAKANA")]; char stringpool_str884[sizeof("MACHEBREW")]; char stringpool_str899[sizeof("MACTURKISH")]; char stringpool_str905[sizeof("CSPC850MULTILINGUAL")]; char stringpool_str915[sizeof("CSEUCTW")]; char stringpool_str1079[sizeof("CSEUCPKDFMTJAPANESE")]; }; static const struct stringpool_t stringpool_contents = { "L1", "L8", "L5", "L6", "SJIS", "koi8", "sjis", "R8", "iso81", "iso88", "iso15", "iso85", "thai8", "iso89", "roma8", "L4", "utf8", "866", "iso815", "big5", "roman8", "L2", "646", "iso86", "iso88591", "iso88598", "iso_1", "iso88595", "iso88599", "greek8", "ISO8859-1", "L7", "ISO8859-8", "iso885915", "ISO8859-5", "ISO8859-9", "ISO-8859-1", "ISO-8859-8", "ISO8859-15", "ISO-8859-5", "ISO-8859-9", "iso88596", "ISO-IR-58", "ISO-8859-15", "JAVA", "L3", "iso14", "iso84", "ISO8859-6", "ISO-IR-159", "ISO-IR-199", "ISO-IR-6", "ISO-8859-6", "862", "HZ", "iso646", "ISO-IR-165", "ISO_8859-1", "ISO-8859-16", "ISO_8859-8", "ISO_8859-5", "ISO_8859-9", "JP", "iso82", "ISO_8859-15", "iso88594", "850", "ISO-IR-148", "ISO_8859-15:1998", "ISO-IR-149", "ISO-IR-166", "ISO8859-4", "ISO_8859-6", "iso10", "CN", "ISO-8859-4", "ISO_8859-16", "KOREAN", "ISO-IR-101", "ISO-IR-14", "ISO-8859-14", "iso88592", "KOI8-R", "ISO-IR-109", "C99", "iso87", "ISO_8859-14:1998", "LATIN1", "ISO8859-2", "LATIN8", "ISO-IR-179", "LATIN5", "ISO-IR-126", "ASCII", "ISO-8859-2", "CP819", "ISO_8859-4", "TCVN", "ISO-IR-138", "hp15CN", "ISO_8859-14", "LATIN6", "iso88597", "ISO8859-10", "ISO-IR-144", "ISO_8859-16:2000", "ISO8859-7", "ISO-8859-10", "iso13", "iso83", "ISO_8859-2", "ISO-IR-110", "ISO-8859-7", "CP866", "CP949", "tis620", "VISCII", "ISO-IR-226", "US", "ISO-IR-87", "ISO-IR-57", "IBM819", "macthai", "MS-ANSI", "macturk", "CP1251", "ISO-IR-157", "CP1258", "LATIN4", "CP1255", "ISO_8859-10:1992", "cp866", "cp949", "ISO_8859-10", "iso88593", "ROMAN8", "CHINESE", "JIS0208", "ISO_8859-7", "macgreek", "cp1251", "ascii_8", "cp1258", "ECMA-118", "cp1255", "CP1256", "IBM866", "ISO-8859-3", "LATIN2", "BIG5", "MULELAO-1", "MS-EE", "ISO646-CN", "ISO-8859-13", "ISO-IR-100", "BIG-5", "ISO-IR-127", "GREEK8", "cp1256", "CP862", "CP1361", "GBK", "ELOT_928", "CP850", "CP936", "CP950", "ISO_8859-3", "CP1254", "LATIN7", "ISO_8859-13", "cp862", "CP874", "CSKOI8R", "EUCKR", "cp850", "cp936", "cp950", "EUC-KR", "cp1254", "ECMA-114", "eucKR", "CP1252", "IBM862", "CSISO159JISX02121990", "cp874", "ISO646-JP", "CSASCII", "EUCCN", "UCS-4LE", "IBM850", "GREEK", "ISO646-US", "EUC-CN", "TIS620", "mac", "LATIN3", "CP1250", "cp1252", "UCS-2LE", "CSISOLATIN1", "TIS-620", "TCVN5712-1", "CSISOLATIN5", "GB_1988-80", "CP932", "ASMO-708", "CP1257", "KOI8-T", "cp1250", "HP-ROMAN8", "MS_KANJI", "CSVISCII", "CSISOLATIN6", "KSC_5601", "SHIFT-JIS", "ISO-IR-203", "cp932", "JOHAB", "cp1257", "ARMSCII-8", "ISO_646.IRV:1991", "TCVN-5712", "EUCJP", "UTF8", "X0201", "GB2312", "X0208", "ISO-2022-KR", "MS-CYRL", "ISO-2022-JP-1", "EUC-JP", "UTF-8", "VISCII1.1-1", "CP367", "CP1253", "eucJP", "mac_cyr", "US-ASCII", "SHIFT_JIS", "CSISOLATIN4", "TIS620-0", "CSBIG5", "ISO-2022-CN", "CP437", "CN-BIG5", "cp1253", "ARABIC", "X0212", "CSISO14JISC6220RO", "GB18030", "UCS-4BE", "CSISOLATIN2", "GEORGIAN-PS", "KS_C_5601-1989", "CP1133", "cp437", "ISO-2022-JP-2", "IBM367", "UCS-2BE", "UNICODE-1-1", "JIS_C6220-1969-RO", "MS-ARAB", "IBM437", "MAC", "UTF-16LE", "ISO-2022-JP", "CN-GB-ISOIR165", "WINDOWS-1251", "WINDOWS-1258", "WINDOWS-1255", "CSISOLATINARABIC", "MS-HEBR", "CYRILLIC", "JIS_C6226-1983", "WINDOWS-1256", "KS_C_5601-1987", "UHC", "BIGFIVE", "CN-GB", "GEORGIAN-ACADEMY", "BIG-FIVE", "CSIBM866", "UTF7", "WINDOWS-1254", "CSISOLATIN3", "UNICODE-1-1-UTF-7", "CSISO57GB1988", "UTF-7", "GB_2312-80", "CSISO2022KR", "WINDOWS-1252", "KOI8-U", "ISO_8859-8:1988", "ISO_8859-5:1988", "ISO_8859-9:1989", "WINDOWS-1250", "MACICELAND", "CSISOLATINGREEK", "ISO-2022-CN-EXT", "JIS_X0201", "JISX0201-1976", "JIS_X0208", "WINDOWS-1257", "CSISO2022CN", "MS-GREEK", "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", "KOI8-RU", "TIS620.2529-1", "MACROMAN", "WINDOWS-874", "ISO_8859-4:1988", "CSKSC56011987", "WINDOWS-1253", "UTF-16BE", "CSISO87JISX0208", "CSISO2022JP2", "JIS_X0212", "MACROMANIA", "CSUNICODE11", "MACTHAI", "UTF-32LE", "CSHPROMAN8", "ISO_8859-1:1987", "BIG5HKSCS", "ISO_8859-6:1987", "JIS_X0212-1990", "CSISO2022JP", "BIG5-HKSCS", "CSSHIFTJIS", "ISO_8859-3:1988", "JIS_X0208-1990", "CSISOLATINHEBREW", "CSISOLATINCYRILLIC", "ISO-CELTIC", "HZ-GB-2312", "ANSI_X3.4-1968", "HEBREW", "ISO_8859-2:1987", "CSISO58GB231280", "CSGB2312", "ANSI_X3.4-1986", "CSUNICODE11UTF7", "JIS_X0208-1983", "ISO_8859-7:1987", "EUCTW", "CSEUCKR", "EUC-TW", "MACCROATIAN", "eucTW", "TIS620.2533-1", "MACGREEK", "UTF-32BE", "MACINTOSH", "UNICODELITTLE", "MS-TURK", "MACUKRAINE", "IBM-CP1133", "MACCENTRALEUROPE", "NEXTSTEP", "TIS620.2533-0", "JIS_X0212.1990-0", "MACARABIC", "UNICODEBIG", "CSPC862LATINHEBREW", "MACCYRILLIC", "WINBALTRIM", "TCVN5712-1:1993", "CSMACINTOSH", "CSHALFWIDTHKATAKANA", "MACHEBREW", "MACTURKISH", "CSPC850MULTILINGUAL", "CSEUCTW", "CSEUCPKDFMTJAPANESE" }; #define stringpool ((const char *) &stringpool_contents) const struct charset_alias * charset_lookup (register const char *str, register size_t len) { static const struct charset_alias wordlist[] = { {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 228 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str15), 0}, #line 235 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str16), 47}, #line 232 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str17), 57}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 233 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str27), 45}, #line 272 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str28), 84}, {-1,-1}, #line 375 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str30), 65}, #line 359 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str31), 84}, {-1,-1}, {-1,-1}, {-1,-1}, #line 268 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str35), 83}, #line 337 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str36), 0}, {-1,-1}, #line 345 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str38), 56}, #line 372 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str39), 48}, #line 342 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str40), 53}, #line 360 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str41), 61}, #line 356 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str42), 57}, #line 357 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str43), 83}, #line 231 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str44), 52}, #line 362 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str45), 1}, #line 10 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str46), 26}, #line 338 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str47), 48}, #line 318 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str48), 5}, {-1,-1}, #line 358 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str50), 83}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 229 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str56), 50}, #line 7 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str57), 88}, {-1,-1}, {-1,-1}, #line 343 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str60), 54}, {-1,-1}, {-1,-1}, #line 346 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str63), 0}, {-1,-1}, #line 354 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str65), 56}, #line 374 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str66), 0}, #line 351 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str67), 53}, {-1,-1}, #line 355 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str69), 57}, #line 368 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str70), 55}, #line 168 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str71), 0}, #line 234 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str72), 46}, #line 176 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str73), 56}, #line 347 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str74), 48}, #line 173 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str75), 53}, {-1,-1}, #line 177 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str77), 57}, {-1,-1}, #line 127 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str79), 0}, {-1,-1}, #line 139 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str81), 56}, #line 170 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str82), 48}, #line 136 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str83), 53}, {-1,-1}, #line 140 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str85), 57}, {-1,-1}, #line 352 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str87), 54}, {-1,-1}, #line 162 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str89), 8}, #line 131 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str90), 48}, #line 206 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str91), 63}, #line 230 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str92), 51}, #line 371 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str93), 47}, #line 341 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str94), 52}, #line 174 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str95), 54}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 154 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str100), 60}, #line 158 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str101), 47}, #line 163 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str102), 88}, #line 137 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str103), 54}, #line 9 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str104), 25}, #line 112 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str105), 38}, {-1,-1}, #line 373 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str107), 88}, #line 155 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str108), 11}, #line 179 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str109), 0}, #line 132 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str110), 49}, #line 202 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str111), 56}, {-1,-1}, #line 196 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str113), 53}, {-1,-1}, #line 204 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str115), 57}, #line 219 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str116), 58}, {-1,-1}, #line 339 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str118), 50}, {-1,-1}, #line 185 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str120), 48}, #line 350 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str121), 52}, #line 8 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str122), 24}, #line 151 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str123), 57}, #line 186 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str124), 48}, {-1,-1}, {-1,-1}, #line 152 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str127), 59}, #line 156 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str128), 61}, #line 172 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str129), 52}, {-1,-1}, {-1,-1}, {-1,-1}, #line 198 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str133), 54}, {-1,-1}, #line 369 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str135), 45}, #line 25 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str136), 9}, #line 135 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str137), 52}, {-1,-1}, {-1,-1}, #line 187 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str140), 49}, #line 224 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str141), 59}, #line 143 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str142), 50}, #line 149 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str143), 58}, #line 130 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str144), 47}, #line 348 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str145), 50}, #line 220 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str146), 65}, {-1,-1}, #line 144 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str148), 51}, #line 23 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str149), 7}, #line 344 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str150), 55}, #line 184 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str151), 47}, #line 236 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str152), 0}, #line 171 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str153), 50}, #line 243 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str154), 47}, #line 157 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str155), 46}, #line 240 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str156), 57}, #line 146 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str157), 55}, #line 15 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str158), 88}, {-1,-1}, {-1,-1}, #line 133 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str161), 50}, {-1,-1}, {-1,-1}, #line 42 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str164), 0}, {-1,-1}, {-1,-1}, #line 194 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str167), 52}, {-1,-1}, {-1,-1}, #line 273 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str170), 85}, #line 148 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str171), 56}, {-1,-1}, #line 336 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str173), 8}, #line 183 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str174), 47}, {-1,-1}, #line 241 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str176), 45}, #line 353 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str177), 55}, #line 169 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str178), 45}, #line 150 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str179), 53}, {-1,-1}, {-1,-1}, {-1,-1}, #line 188 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str183), 49}, {-1,-1}, #line 175 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str185), 55}, #line 128 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str186), 45}, {-1,-1}, {-1,-1}, #line 370 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str189), 46}, #line 340 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str190), 51}, #line 190 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str191), 50}, #line 145 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str192), 52}, #line 138 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str193), 55}, #line 45 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str194), 26}, #line 49 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str195), 30}, #line 361 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str196), 61}, #line 302 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str197), 94}, #line 160 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str198), 49}, #line 292 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str199), 88}, #line 164 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str200), 62}, #line 161 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str201), 9}, #line 117 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str202), 0}, #line 379 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str203), 78}, #line 258 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str204), 15}, #line 380 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str205), 79}, {-1,-1}, #line 31 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str207), 14}, #line 153 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str208), 45}, #line 38 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str209), 21}, #line 239 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str210), 52}, #line 35 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str211), 18}, #line 181 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str212), 45}, #line 331 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str213), 26}, #line 366 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str214), 30}, {-1,-1}, #line 180 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str216), 45}, #line 349 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str217), 51}, #line 269 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str218), 83}, #line 24 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str219), 8}, #line 207 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str220), 62}, {-1,-1}, {-1,-1}, #line 200 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str223), 55}, {-1,-1}, #line 378 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str225), 74}, #line 320 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str226), 14}, #line 363 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str227), 0}, #line 327 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str228), 21}, #line 90 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str229), 55}, #line 324 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str230), 18}, #line 36 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str231), 19}, #line 120 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str232), 26}, #line 134 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str233), 51}, #line 237 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str234), 50}, #line 19 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str235), 5}, #line 266 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str236), 81}, #line 261 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str237), 13}, {-1,-1}, #line 165 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str239), 9}, #line 129 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str240), 46}, {-1,-1}, #line 142 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str242), 0}, #line 17 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str243), 5}, {-1,-1}, {-1,-1}, {-1,-1}, #line 147 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str247), 54}, #line 109 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str248), 55}, {-1,-1}, #line 325 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str250), 19}, {-1,-1}, #line 44 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str252), 25}, #line 39 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str253), 22}, {-1,-1}, #line 103 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str255), 29}, {-1,-1}, {-1,-1}, #line 91 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str258), 55}, {-1,-1}, #line 43 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str260), 24}, #line 48 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str261), 29}, #line 50 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str262), 31}, #line 192 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str263), 51}, {-1,-1}, #line 34 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str265), 17}, #line 242 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str266), 46}, {-1,-1}, {-1,-1}, {-1,-1}, #line 182 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str270), 46}, #line 330 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str271), 25}, {-1,-1}, #line 46 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str273), 27}, #line 79 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str274), 65}, #line 98 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str275), 33}, {-1,-1}, {-1,-1}, {-1,-1}, #line 329 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str279), 24}, #line 365 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str280), 29}, #line 367 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str281), 31}, {-1,-1}, #line 94 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str283), 33}, #line 323 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str284), 17}, #line 89 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str285), 54}, {-1,-1}, {-1,-1}, #line 334 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str288), 33}, #line 32 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str289), 15}, #line 119 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str290), 25}, #line 61 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str291), 60}, #line 332 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str292), 27}, #line 166 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str293), 58}, #line 51 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str294), 88}, #line 96 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str295), 10}, {-1,-1}, #line 286 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str297), 87}, #line 118 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str298), 24}, {-1,-1}, {-1,-1}, #line 108 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str301), 55}, #line 167 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str302), 88}, #line 92 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str303), 10}, #line 278 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str304), 61}, #line 376 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str305), 69}, #line 238 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str306), 51}, #line 30 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str307), 13}, #line 321 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str308), 15}, #line 284 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str309), 2}, #line 69 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str310), 0}, {-1,-1}, #line 277 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str312), 61}, #line 275 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str313), 85}, #line 73 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str314), 57}, {-1,-1}, {-1,-1}, {-1,-1}, #line 104 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str318), 9}, #line 47 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str319), 28}, #line 16 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str320), 54}, #line 37 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str321), 20}, {-1,-1}, {-1,-1}, #line 222 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str324), 67}, {-1,-1}, #line 319 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str326), 13}, {-1,-1}, {-1,-1}, #line 111 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str329), 83}, {-1,-1}, #line 265 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str331), 84}, {-1,-1}, #line 87 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str333), 94}, #line 74 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str334), 45}, #line 225 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str335), 59}, #line 270 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str336), 84}, #line 159 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str337), 48}, #line 364 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str338), 28}, #line 218 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str339), 22}, #line 326 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str340), 20}, {-1,-1}, #line 14 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str342), 4}, {-1,-1}, {-1,-1}, #line 178 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str345), 88}, {-1,-1}, #line 274 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str347), 85}, {-1,-1}, #line 97 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str349), 32}, #line 301 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str350), 1}, #line 315 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str351), 64}, #line 102 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str352), 10}, #line 316 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str353), 62}, #line 126 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str354), 44}, #line 260 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str355), 14}, #line 124 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str356), 42}, #line 93 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str357), 32}, #line 299 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str358), 1}, #line 303 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str359), 94}, #line 40 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str360), 88}, #line 33 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str361), 16}, #line 333 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str362), 32}, {-1,-1}, #line 377 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str364), 73}, #line 293 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str365), 88}, #line 271 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str366), 84}, {-1,-1}, #line 72 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str368), 52}, #line 279 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str369), 61}, {-1,-1}, #line 52 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str371), 5}, {-1,-1}, {-1,-1}, #line 121 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str374), 39}, {-1,-1}, {-1,-1}, #line 41 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str377), 23}, {-1,-1}, #line 26 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str379), 5}, #line 322 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str380), 16}, #line 13 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str381), 54}, {-1,-1}, #line 317 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str383), 60}, #line 60 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str384), 58}, {-1,-1}, {-1,-1}, #line 101 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str387), 35}, {-1,-1}, #line 285 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str389), 86}, {-1,-1}, {-1,-1}, #line 70 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str392), 50}, #line 107 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str393), 37}, #line 227 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str394), 59}, #line 29 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str395), 12}, #line 328 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str396), 23}, #line 125 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str397), 43}, #line 115 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str398), 88}, {-1,-1}, {-1,-1}, #line 283 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str401), 3}, #line 288 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str402), 3}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 209 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str409), 58}, {-1,-1}, #line 259 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str411), 19}, {-1,-1}, {-1,-1}, {-1,-1}, #line 116 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str415), 23}, {-1,-1}, {-1,-1}, #line 244 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str418), 69}, {-1,-1}, {-1,-1}, {-1,-1}, #line 295 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str422), 90}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 123 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str428), 41}, #line 28 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str429), 11}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 306 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str434), 14}, #line 313 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str435), 21}, #line 310 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str436), 18}, {-1,-1}, #line 75 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str438), 54}, {-1,-1}, {-1,-1}, #line 263 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str441), 18}, {-1,-1}, {-1,-1}, #line 88 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str444), 53}, #line 210 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str445), 62}, #line 311 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str446), 19}, {-1,-1}, #line 226 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str448), 59}, {-1,-1}, #line 287 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str450), 30}, {-1,-1}, #line 22 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str452), 5}, {-1,-1}, #line 27 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str454), 10}, #line 106 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str455), 36}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 18 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str460), 5}, #line 59 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str461), 26}, #line 300 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str462), 93}, #line 309 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str463), 17}, #line 71 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str464), 51}, #line 289 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str465), 93}, {-1,-1}, #line 66 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str467), 9}, {-1,-1}, {-1,-1}, #line 298 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str470), 93}, {-1,-1}, #line 105 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str472), 8}, {-1,-1}, #line 65 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str474), 44}, #line 307 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str475), 15}, #line 223 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str476), 68}, {-1,-1}, {-1,-1}, #line 203 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str479), 56}, #line 197 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str480), 53}, {-1,-1}, {-1,-1}, #line 205 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str483), 57}, #line 305 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str484), 13}, #line 251 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str485), 76}, #line 77 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str486), 55}, #line 122 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str487), 40}, #line 211 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str488), 64}, #line 208 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str489), 64}, #line 212 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str490), 62}, #line 312 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str491), 20}, {-1,-1}, {-1,-1}, #line 62 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str494), 39}, {-1,-1}, #line 262 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str496), 16}, {-1,-1}, {-1,-1}, {-1,-1}, #line 100 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str500), 32}, {-1,-1}, {-1,-1}, #line 221 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str503), 66}, #line 280 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str504), 61}, #line 253 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str505), 69}, #line 314 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str506), 27}, #line 195 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str507), 52}, {-1,-1}, #line 80 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str509), 59}, {-1,-1}, #line 308 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str511), 16}, {-1,-1}, {-1,-1}, #line 294 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str514), 89}, #line 68 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str515), 62}, #line 64 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str516), 43}, {-1,-1}, {-1,-1}, {-1,-1}, #line 215 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str520), 60}, #line 254 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str521), 77}, #line 85 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str522), 3}, #line 255 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str523), 78}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 297 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str528), 92}, {-1,-1}, {-1,-1}, #line 58 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str531), 83}, {-1,-1}, {-1,-1}, #line 189 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str534), 0}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 21 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str541), 6}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 199 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str546), 54}, #line 216 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str547), 60}, #line 63 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str548), 41}, #line 20 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str549), 6}, {-1,-1}, {-1,-1}, {-1,-1}, #line 84 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str553), 84}, {-1,-1}, #line 193 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str555), 51}, {-1,-1}, #line 214 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str557), 62}, {-1,-1}, {-1,-1}, #line 78 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str560), 56}, #line 76 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str561), 53}, {-1,-1}, #line 141 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str563), 47}, #line 113 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str564), 38}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 11 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str571), 88}, #line 110 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str572), 56}, {-1,-1}, {-1,-1}, #line 191 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str575), 50}, {-1,-1}, #line 67 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str577), 8}, {-1,-1}, {-1,-1}, {-1,-1}, #line 56 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str581), 10}, #line 12 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str582), 88}, #line 86 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str583), 93}, #line 213 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str584), 62}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 201 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str591), 55}, {-1,-1}, {-1,-1}, #line 99 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str594), 34}, {-1,-1}, #line 53 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str596), 33}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 95 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str602), 34}, {-1,-1}, {-1,-1}, #line 247 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str605), 72}, {-1,-1}, #line 335 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str607), 34}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 282 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str614), 61}, {-1,-1}, {-1,-1}, #line 249 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str617), 74}, {-1,-1}, {-1,-1}, #line 296 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str620), 91}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 252 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str625), 69}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 291 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str637), 2}, {-1,-1}, {-1,-1}, {-1,-1}, #line 264 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str641), 17}, {-1,-1}, {-1,-1}, {-1,-1}, #line 257 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str645), 80}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 114 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str651), 12}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 246 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str658), 71}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 267 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str663), 82}, #line 281 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str664), 61}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 217 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str674), 60}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 245 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str697), 70}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 290 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str706), 3}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 83 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str723), 25}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 248 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str748), 73}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 304 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str756), 20}, {-1,-1}, #line 276 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str758), 85}, {-1,-1}, {-1,-1}, {-1,-1}, #line 81 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str762), 69}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 57 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str788), 64}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 250 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str884), 75}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 256 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str899), 79}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 82 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str905), 24}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 55 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str915), 34}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, #line 54 "charset_lookup.gperf" {(int)offsetof(struct stringpool_t, stringpool_str1079), 32} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { register unsigned int key = hash_charset (str, len); if (key <= MAX_HASH_VALUE) { register int o = wordlist[key].alias_pos; if (o >= 0) { register const char *s = o + stringpool; if (*str == *s && !strcmp (str + 1, s + 1)) return &wordlist[key]; } } } return 0; } #line 381 "charset_lookup.gperf" freetds-1.3.6/include/freetds/utils/string.h000644 025423 025423 00000005367 14056414221 022513 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Brian Bruns * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _tdsstring_h_ #define _tdsstring_h_ #include #include /** \addtogroup dstring * @{ */ /** * Structure to hold a string. * Use tds_dstr_* functions/macros, do not access members directly. * There should be always a buffer. */ typedef struct tds_dstr { size_t dstr_size; char dstr_s[1]; } *DSTR; /** Internal representation for an empty string */ extern const struct tds_dstr tds_str_empty; /** Initializer, used to initialize string like in the following example * @code * DSTR s = DSTR_INITIALIZER; * @endcode */ #define DSTR_INITIALIZER ((struct tds_dstr*) &tds_str_empty) /** init a string with empty */ static inline void tds_dstr_init(DSTR * s) { *(s) = DSTR_INITIALIZER; } /** test if string is empty */ static inline int tds_dstr_isempty(const DSTR * s) { return (*s)->dstr_size == 0; } /** * Returns a buffer to edit the string. * Be careful to avoid buffer overflows and remember to * set the correct length at the end of the editing if changed. */ static inline char * tds_dstr_buf(DSTR * s) { return (*s)->dstr_s; } /** Returns a C version (NUL terminated string) of dstr */ static inline const char * tds_dstr_cstr(const DSTR * s) { return (*s)->dstr_s; } /** Returns the length of the string in bytes */ static inline size_t tds_dstr_len(const DSTR * s) { return (*s)->dstr_size; } /** Make a string empty */ #define tds_dstr_empty(s) \ tds_dstr_free(s) void tds_dstr_zero(DSTR * s); void tds_dstr_free(DSTR * s); DSTR* tds_dstr_dup(DSTR * s, const DSTR * src) TDS_WUR; DSTR* tds_dstr_copy(DSTR * s, const char *src) TDS_WUR; DSTR* tds_dstr_copyn(DSTR * s, const char *src, size_t length) TDS_WUR; DSTR* tds_dstr_set(DSTR * s, char *src) TDS_WUR; DSTR* tds_dstr_setlen(DSTR *s, size_t length); DSTR* tds_dstr_alloc(DSTR *s, size_t length) TDS_WUR; /** @} */ #include #endif /* _tdsstring_h_ */ freetds-1.3.6/include/freetds/utils/dlist.h000644 025423 025423 00000002734 14056414221 022317 0ustar00fredianofrediano000000 000000 /* Dlist - dynamic list * Copyright (C) 2016 Frediano Ziglio * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef TDS_DLIST_H #define TDS_DLIST_H typedef struct dlist_ring { struct dlist_ring *next; struct dlist_ring *prev; } dlist_ring; #if ENABLE_EXTRA_CHECKS void dlist_ring_check(dlist_ring *ring); #endif #define DLIST_FIELDS(name) \ dlist_ring name #define DLIST_FOREACH(prefix, list, p) \ for (p = prefix ## _ ## first(list); p != NULL; p = prefix ## _ ## next(list, p)) static inline void dlist_insert_after(dlist_ring *ring_pos, dlist_ring *ring_item) { assert(!ring_item->next && !ring_item->prev); ring_pos->next->prev = ring_item; ring_item->prev = ring_pos; ring_item->next = ring_pos->next; ring_pos->next = ring_item; assert(ring_item->next && ring_item->prev); } #endif /* TDS_DLIST_H */ freetds-1.3.6/include/freetds/utils/dlist.tmpl.h000644 025423 025423 00000007016 14056414221 023270 0ustar00fredianofrediano000000 000000 /* Dlist - dynamic list * Copyright (C) 2016 Frediano Ziglio * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #if !defined(DLIST_PREFIX) || !defined(DLIST_ITEM_TYPE) || !defined(DLIST_LIST_TYPE) #error Required defines for dlist missing! #endif #if defined(DLIST_NAME) || defined(DLIST_PASTER) || \ defined(DLIST_EVALUATOR) || defined(DLIST_ITEM) #error Some internal dlist macros already defined #endif typedef struct { dlist_ring ring; } DLIST_LIST_TYPE; #define DLIST_PASTER(x,y) x ## _ ## y #define DLIST_EVALUATOR(x,y) DLIST_PASTER(x,y) #define DLIST_NAME(suffix) DLIST_EVALUATOR(DLIST_PREFIX, suffix) #define DLIST_ITEM(ring) \ ((DLIST_ITEM_TYPE *) (((char *) (ring)) - TDS_OFFSET(DLIST_ITEM_TYPE, DLIST_NAME(item)))) static inline void DLIST_NAME(check)(DLIST_LIST_TYPE *list) { #if ENABLE_EXTRA_CHECKS assert(list != NULL); dlist_ring_check(&list->ring); #endif } static inline void DLIST_NAME(init)(DLIST_LIST_TYPE *list) { list->ring.next = list->ring.prev = &list->ring; DLIST_NAME(check)(list); } static inline DLIST_ITEM_TYPE *DLIST_NAME(first)(DLIST_LIST_TYPE *list) { return list->ring.next == &list->ring ? NULL : DLIST_ITEM(list->ring.next); } static inline DLIST_ITEM_TYPE *DLIST_NAME(last)(DLIST_LIST_TYPE *list) { return list->ring.prev == &list->ring ? NULL : DLIST_ITEM(list->ring.prev); } static inline DLIST_ITEM_TYPE *DLIST_NAME(next)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item) { return item->DLIST_NAME(item).next == &list->ring ? NULL : DLIST_ITEM(item->DLIST_NAME(item).next); } static inline DLIST_ITEM_TYPE *DLIST_NAME(prev)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item) { return item->DLIST_NAME(item).prev == &list->ring ? NULL : DLIST_ITEM(item->DLIST_NAME(item).prev); } static inline void DLIST_NAME(prepend)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item) { DLIST_NAME(check)(list); dlist_insert_after(&list->ring, &item->DLIST_NAME(item)); DLIST_NAME(check)(list); } static inline void DLIST_NAME(append)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item) { DLIST_NAME(check)(list); dlist_insert_after(list->ring.prev, &item->DLIST_NAME(item)); DLIST_NAME(check)(list); } static inline void DLIST_NAME(remove)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item) { dlist_ring *prev = item->DLIST_NAME(item).prev, *next = item->DLIST_NAME(item).next; DLIST_NAME(check)(list); if (prev) { prev->next = next; next->prev = prev; } item->DLIST_NAME(item).prev = NULL; item->DLIST_NAME(item).next = NULL; DLIST_NAME(check)(list); } static inline bool DLIST_NAME(in_list)(DLIST_LIST_TYPE *list, DLIST_ITEM_TYPE *item) { DLIST_NAME(check)(list); return item->DLIST_NAME(item).prev != NULL || item->DLIST_NAME(item).next != NULL; } #undef DLIST_ITEM #undef DLIST_NAME #undef DLIST_ITEM_TYPE #undef DLIST_LIST_TYPE #undef DLIST_PREFIX #undef DLIST_PASTER #undef DLIST_EVALUATOR freetds-1.3.6/include/freetds/utils/bjoern-utf8.h000644 025423 025423 00000003052 14056414221 023335 0ustar00fredianofrediano000000 000000 /* * Copyright (c) 2008-2010 Bjoern Hoehrmann * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. */ #include #define UTF8_ACCEPT 0 #define UTF8_REJECT 12 extern const uint8_t utf8_table[]; static inline uint32_t decode_utf8(uint32_t* state, uint32_t* codep, uint32_t byte) { uint32_t type = utf8_table[byte]; *codep = (*state != UTF8_ACCEPT) ? (byte & 0x3fu) | (*codep << 6) : (0xff >> type) & (byte); *state = utf8_table[256 + *state + type]; return *state; } freetds-1.3.6/include/freetds/utils/md4.h000644 025423 025423 00000001414 14056414221 021656 0ustar00fredianofrediano000000 000000 #ifndef MD4_H #define MD4_H #ifndef HAVE_NETTLE #include struct MD4Context { uint32_t buf[4]; uint64_t bytes; uint32_t in[16]; }; void MD4Init(struct MD4Context *context); void MD4Update(struct MD4Context *context, const uint8_t *buf, size_t len); void MD4Final(struct MD4Context *context, uint8_t *digest); typedef struct MD4Context MD4_CTX; #include #else #include typedef struct md4_ctx MD4_CTX; static inline void MD4Init(MD4_CTX *ctx) { nettle_md4_init(ctx); } static inline void MD4Update(MD4_CTX *ctx, const uint8_t *buf, size_t len) { nettle_md4_update(ctx, len, buf); } static inline void MD4Final(MD4_CTX *ctx, uint8_t *digest) { nettle_md4_digest(ctx, 16, digest); } #endif #endif /* !MD4_H */ freetds-1.3.6/include/freetds/utils/des.h000644 025423 025423 00000001675 14056414221 021756 0ustar00fredianofrediano000000 000000 #ifndef DES_H #define DES_H #ifdef HAVE_NETTLE #include typedef struct des_ctx DES_KEY; #endif #include typedef uint8_t des_cblock[8]; #ifndef HAVE_NETTLE typedef struct des_key { uint8_t kn[16][8]; uint32_t sp[8][64]; uint8_t iperm[16][16][8]; uint8_t fperm[16][16][8]; } DES_KEY; int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len); void tds_des_encrypt(const DES_KEY * key, des_cblock block); #endif void tds_des_set_odd_parity(des_cblock key); int tds_des_ecb_encrypt(const void *plaintext, int len, DES_KEY * akey, uint8_t *output); #include #ifdef HAVE_NETTLE static inline void tds_des_encrypt(const DES_KEY * key, des_cblock block) { nettle_des_encrypt(key, sizeof(des_cblock), block, block); } static inline int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len) { return nettle_des_set_key(dkey, user_key); } #endif #endif /* !DES_H */ freetds-1.3.6/include/freetds/utils/md5.h000644 025423 025423 00000001523 14056414221 021660 0ustar00fredianofrediano000000 000000 #ifndef MD5_H #define MD5_H #ifndef HAVE_NETTLE #include struct MD5Context { uint32_t buf[4]; uint64_t bytes; uint32_t in[16]; }; void MD5Init(struct MD5Context *context); void MD5Update(struct MD5Context *context, const uint8_t *buf, size_t len); void MD5Final(struct MD5Context *context, uint8_t *digest); /* * This is needed to make RSAREF happy on some MS-DOS compilers. */ typedef struct MD5Context MD5_CTX; #include #else #include typedef struct md5_ctx MD5_CTX; static inline void MD5Init(MD5_CTX *ctx) { nettle_md5_init(ctx); } static inline void MD5Update(MD5_CTX *ctx, const uint8_t *buf, size_t len) { nettle_md5_update(ctx, len, buf); } static inline void MD5Final(MD5_CTX *ctx, uint8_t *digest) { nettle_md5_digest(ctx, 16, digest); } #endif #endif /* !MD5_H */ freetds-1.3.6/include/freetds/utils/hmac_md5.h000644 025423 025423 00000002124 14056414221 022646 0ustar00fredianofrediano000000 000000 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases * Copyright (C) 2008 Frediano Ziglio * * 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., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _hmac_md5_h_ #define _hmac_md5_h_ #include void hmac_md5(const unsigned char key[16], const unsigned char* data, size_t data_len, unsigned char* digest); #include #endif freetds-1.3.6/include/freetds/replacements/poll.h000644 025423 025423 00000003402 14056414271 023466 0ustar00fredianofrediano000000 000000 /** \file * \brief Provide poll call where missing */ #if !defined(_REPLACEMENTS_POLL_H) && !defined(HAVE_POLL) #define _REPLACEMENTS_POLL_H #include #if HAVE_LIMITS_H #include #endif #if HAVE_SYS_SELECT_H #include #endif #if defined(_WIN32) #include #endif #if defined(__VMS) #include /* FD_SETSIZE is in here */ #endif #if !defined(FD_SETSIZE) # if !defined(OPEN_MAX) # error cannot establish FD_SETSIZE # endif #define FD_SETSIZE OPEN_MAX #endif #include #ifndef _WIN32 /* poll flags */ # define POLLIN 0x0001 # define POLLOUT 0x0004 # define POLLERR 0x0008 /* synonyms */ # define POLLNORM POLLIN # define POLLPRI POLLIN # define POLLRDNORM POLLIN # define POLLRDBAND POLLIN # define POLLWRNORM POLLOUT # define POLLWRBAND POLLOUT /* ignored */ # define POLLHUP 0x0010 # define POLLNVAL 0x0020 typedef struct pollfd { int fd; /* file descriptor to poll */ short events; /* events of interest on fd */ short revents; /* events that occurred on fd */ } pollfd_t; #else /* Windows */ /* * Windows use different constants then Unix * Newer version have a WSAPoll which is equal to Unix poll */ # if !defined(POLLRDNORM) && !defined(POLLWRNORM) # define POLLIN 0x0300 # define POLLOUT 0x0010 # define POLLERR 0x0001 # define POLLRDNORM 0x0100 # define POLLWRNORM 0x0010 typedef struct pollfd { SOCKET fd; /* file descriptor to poll */ short events; /* events of interest on fd */ short revents; /* events that occurred on fd */ } pollfd_t; # else typedef struct pollfd pollfd_t; # endif #endif #undef poll int tds_poll(struct pollfd fds[], int nfds, int timeout); #define poll(fds, nfds, timeout) tds_poll(fds, nfds, timeout) #include #endif freetds-1.3.6/include/freetds/replacements/readpassphrase.h000644 025423 025423 00000004752 14056414271 025536 0ustar00fredianofrediano000000 000000 /* OPENBSD ORIGINAL: include/readpassphrase.h */ /* $OpenBSD: readpassphrase.h,v 1.3 2002/06/28 12:32:22 millert Exp $ */ /* * Copyright (c) 2000 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FREETDS_READPASSPHRASE_H_ #define FREETDS_READPASSPHRASE_H_ #ifndef _freetds_config_h_ #error should include config.h before #endif #ifdef HAVE_READPASSPHRASE # include #else /* !HAVE_READPASSPHRASE */ #include #define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */ #define RPP_ECHO_ON 0x01 /* Leave echo on. */ #define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */ #define RPP_FORCELOWER 0x04 /* Force input to lower case. */ #define RPP_FORCEUPPER 0x08 /* Force input to upper case. */ #define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */ #define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */ #undef readpassphrase char * tds_readpassphrase(const char *, char *, size_t, int); #define readpassphrase tds_readpassphrase #include #endif /* !HAVE_READPASSPHRASE */ #endif /* !FREETDS_READPASSPHRASE_H_ */ freetds-1.3.6/m4/ac_caolan_func_which_gethostbyname_r.m4000644 025423 025423 00000005167 14056414221 024744 0ustar00fredianofrediano000000 000000 dnl $Id: ac_caolan_func_which_gethostbyname_r.m4,v 1.3 2006-03-29 16:24:36 freddy77 Exp $ ## # @synopsis AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R # # Provides a test to determine the correct # way to call gethostbyname_r # # defines HAVE_FUNC_GETHOSTBYNAME_R_6 if it needs 6 arguments (e.g linux) # defines HAVE_FUNC_GETHOSTBYNAME_R_5 if it needs 5 arguments (e.g. solaris) # defines HAVE_FUNC_GETHOSTBYNAME_R_3 if it needs 3 arguments (e.g. osf/1) # # if used in conjunction in gethostname.c the api demonstrated # in test.c can be used regardless of which gethostbyname_r # exists. These example files found at # http://www.csn.ul.ie/~caolan/publink/gethostbyname_r # # @author Caolan McNamara # updated with AC_LINK_IFELSE March 2006 . # Could probably be replaced with better version: # http://autoconf-archive.cryp.to/ax_func_which_gethostbyname_r.html # # based on David Arnold's autoconf suggestion in the threads faq ## AC_DEFUN([AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R], [ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NETWORK_LIBS" AC_CACHE_CHECK(for which type of gethostbyname_r, ac_cv_func_which_gethostname_r, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([ # include ], [ char *name; struct hostent *he; struct hostent_data data; (void) gethostbyname_r(name, he, &data); ])],ac_cv_func_which_gethostname_r=three, [ dnl ac_cv_func_which_gethostname_r=no AC_LINK_IFELSE([AC_LANG_PROGRAM([ # include ], [[ char *name; struct hostent *he, *res; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) ]])],ac_cv_func_which_gethostname_r=six, [ dnl ac_cv_func_which_gethostname_r=no AC_LINK_IFELSE([AC_LANG_PROGRAM([ # include ], [[ char *name; struct hostent *he; char buffer[2048]; int buflen = 2048; int h_errnop; (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) ]])],ac_cv_func_which_gethostname_r=five,ac_cv_func_which_gethostname_r=no) ] ) ] )]) if test $ac_cv_func_which_gethostname_r = six; then AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_6, 1, [Define to 1 if your system provides the 6-parameter version of gethostbyname_r().]) elif test $ac_cv_func_which_gethostname_r = five; then AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_5, 1, [Define to 1 if your system provides the 5-parameter version of gethostbyname_r().]) elif test $ac_cv_func_which_gethostname_r = three; then AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_3, 1, [Define to 1 if your system provides the 3-parameter version of gethostbyname_r().]) fi CFLAGS=$ac_save_CFLAGS ]) freetds-1.3.6/m4/ac_have_inaddr_none.m4000644 025423 025423 00000001463 14056414221 021316 0ustar00fredianofrediano000000 000000 dnl $Id: ac_have_inaddr_none.m4,v 1.3 2006-03-29 16:24:37 freddy77 Exp $ AC_DEFUN([AC_HAVE_INADDR_NONE], [ AC_CACHE_CHECK([whether INADDR_NONE is defined], ac_cv_have_inaddr_none, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [/* our includes */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif /* end includes */], [unsigned long foo = INADDR_NONE; /* our test code */])], ac_cv_have_inaddr_none=yes, ac_cv_have_inaddr_none=no) ]) if test $ac_cv_have_inaddr_none != yes; then AC_DEFINE(INADDR_NONE, 0xffffffff, [Define to value of INADDR_NONE if not provided by your system header files.]) fi ] ) freetds-1.3.6/m4/ac_have_malloc_options.m4000644 025423 025423 00000001073 14056414221 022055 0ustar00fredianofrediano000000 000000 dnl $Id: ac_have_malloc_options.m4,v 1.3 2006-03-29 16:24:37 freddy77 Exp $ AC_DEFUN([AC_HAVE_MALLOC_OPTIONS], [AC_CACHE_CHECK([whether malloc_options variable is present], ac_cv_have_malloc_options, [AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include ],[ extern char *malloc_options; malloc_options = "AJR"; ])], ac_cv_have_malloc_options=yes, ac_cv_have_malloc_options=no)]) if test $ac_cv_have_malloc_options = yes; then AC_DEFINE(HAVE_MALLOC_OPTIONS, 1, [Define to 1 if your system provides the malloc_options variable.]) fi]) freetds-1.3.6/m4/ac_nullzero.m4000644 025423 025423 00000002653 14056414221 017707 0ustar00fredianofrediano000000 000000 # TDS_NULL_IS_ZERO ([ACTION-IF-TRUE], [ACTION-IF-FALSE]) # ------------------------------------------------------------------------- AC_DEFUN([TDS_NULL_IS_ZERO], [AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tds_cv_null_is_zero, [ tds_cv_null_is_zero=no # compile a test program. AC_RUN_IFELSE( [AC_LANG_SOURCE([[#include #include #include #ifdef HAVE_STDDEF_H #include #endif int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2)); return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])], [tds_cv_null_is_zero=yes], [], [# try to guess the endianness by grepping values into an object file AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include struct test { char begin[16]; void *ptrs[4]; char end[16]; } xxx[] = { { "abcdefghijklmnop", { NULL, NULL, NULL, NULL }, "qrstuvwxyzabcdef" }, { "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x91\x92\x93\x94\x95\x96\x97", { NULL, NULL, NULL, NULL }, "\x98\x99\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\x81\x82\x83\x84\x85\x86" } };]], [[]])], [if cat -v conftest.$ac_objext|grep 'abcdefghijklmnop\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\(\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\)*qrstuvwxyzabcdef'>/dev/null ; then tds_cv_null_is_zero=yes fi])])]) case $tds_cv_null_is_zero in yes) m4_default([$1], [AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1, [Define to 1 if memset(0) sets pointers to NULL.])]) ;; no) $2 ;; esac ])# TDS_NULL_IS_ZERO freetds-1.3.6/m4/ac_raf_func_which_getservbyname_r.m4000644 025423 025423 00000004012 14056414221 024245 0ustar00fredianofrediano000000 000000 dnl $Id: ac_raf_func_which_getservbyname_r.m4,v 1.3 2006-03-29 16:24:37 freddy77 Exp $ ## # Found on autoconf archive # Based on Caolan McNamara's gethostbyname_r macro. # Based on David Arnold's autoconf suggestion in the threads faq. AC_DEFUN([AC_raf_FUNC_WHICH_GETSERVBYNAME_R], [ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NETWORK_LIBS" AC_CACHE_CHECK(for which type of getservbyname_r, ac_cv_func_which_getservbyname_r, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([ # include ], [ char *name; char *proto; struct servent *se; struct servent_data data; (void) getservbyname_r(name, proto, se, &data); ])],ac_cv_func_which_getservbyname_r=four, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([ # include ], [[ char *name; char *proto; struct servent *se, *res; char buffer[2048]; int buflen = 2048; (void) getservbyname_r(name, proto, se, buffer, buflen, &res) ]])],ac_cv_func_which_getservbyname_r=six, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([ # include ], [[ char *name; char *proto; struct servent *se; char buffer[2048]; int buflen = 2048; (void) getservbyname_r(name, proto, se, buffer, buflen) ]])],ac_cv_func_which_getservbyname_r=five,ac_cv_func_which_getservbyname_r=no) ] ) ] )]) if test $ac_cv_func_which_getservbyname_r = six; then AC_DEFINE(HAVE_FUNC_GETSERVBYNAME_R_6, 1, [Define to 1 if your system provides the 6-parameter version of getservbyname_r().]) elif test $ac_cv_func_which_getservbyname_r = five; then AC_DEFINE(HAVE_FUNC_GETSERVBYNAME_R_5, 1, [Define to 1 if your system provides the 5-parameter version of getservbyname_r().]) elif test $ac_cv_func_which_getservbyname_r = four; then AC_DEFINE(HAVE_FUNC_GETSERVBYNAME_R_4, 1, [Define to 1 if your system provides the 4-parameter version of getservbyname_r().]) fi CFLAGS=$ac_save_CFLAGS ]) freetds-1.3.6/m4/ac_tds_func_which_gethostbyaddr_r.m4000644 025423 025423 00000004001 14056414221 024255 0ustar00fredianofrediano000000 000000 dnl $Id: ac_tds_func_which_gethostbyaddr_r.m4,v 1.3 2006-03-29 16:24:37 freddy77 Exp $ ## # based on gethostbyname_r check and snippits from curl's check ## AC_DEFUN([AC_tds_FUNC_WHICH_GETHOSTBYADDR_R], [ac_save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NETWORK_LIBS" AC_CACHE_CHECK(for which type of gethostbyaddr_r, ac_cv_func_which_gethostbyaddr_r, [ AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ], [ char * address; int length; int type; struct hostent h; struct hostent_data hdata; int rc; rc = gethostbyaddr_r(address, length, type, &h, &hdata); ])],ac_cv_func_which_gethostbyaddr_r=five, [ dnl ac_cv_func_which_gethostbyaddr_r=no AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ], [[ char * address; int length; int type; struct hostent h; char buffer[8192]; int h_errnop; struct hostent * hp; hp = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &h_errnop); ]])],ac_cv_func_which_gethostbyaddr_r=seven, [ dnl ac_cv_func_which_gethostbyaddr_r=no AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include ], [[ char * address; int length; int type; struct hostent h; char buffer[8192]; int h_errnop; struct hostent * hp; int rc; rc = gethostbyaddr_r(address, length, type, &h, buffer, 8192, &hp, &h_errnop); ]])],ac_cv_func_which_gethostbyaddr_r=eight,ac_cv_func_which_gethostbyaddr_r=no) ] ) ] )]) if test $ac_cv_func_which_gethostbyaddr_r = eight; then AC_DEFINE(HAVE_FUNC_GETHOSTBYADDR_R_8, 1, [Define to 1 if your system provides the 8-parameter version of gethostbyaddr_r().]) elif test $ac_cv_func_which_gethostbyaddr_r = seven; then AC_DEFINE(HAVE_FUNC_GETHOSTBYADDR_R_7, 1, [Define to 1 if your system provides the 7-parameter version of gethostbyaddr_r().]) elif test $ac_cv_func_which_gethostbyaddr_r = five; then AC_DEFINE(HAVE_FUNC_GETHOSTBYADDR_R_5, 1, [Define to 1 if your system provides the 5-parameter version of gethostbyaddr_r().]) fi CFLAGS=$ac_save_CFLAGS ]) freetds-1.3.6/m4/ac_tds_func_which_getpwuid_r.m4000644 025423 025423 00000004651 14056414221 023255 0ustar00fredianofrediano000000 000000 dnl $Id: ac_tds_func_which_getpwuid_r.m4,v 1.4 2006-08-23 14:26:20 freddy77 Exp $ ## # Check getpwuid_r parameters # There are three version of this function # int getpwuid_r(uid_t uid, struct passwd *result, char *buffer, int buflen); # (hp/ux 10.20, digital unix 4) # struct passwd *getpwuid_r(uid_t uid, struct passwd * pwd, char *buffer, int buflen); # (SunOS 5.5, many other) # int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t buflen, struct passwd **result); # (hp/ux 11, many other, posix compliant) ## AC_DEFUN([AC_tds_FUNC_WHICH_GETPWUID_R], [if test x$ac_cv_func_getpwuid = xyes; then AC_CACHE_CHECK(for which type of getpwuid_r, ac_cv_func_which_getpwuid_r, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ], [[ struct passwd bpw; char buf[1024]; char *dir = getpwuid_r(getuid(), &bpw, buf, sizeof(buf))->pw_dir; ]])],ac_cv_func_which_getpwuid_r=four_pw, [AC_TRY_RUN([ #include #include int main() { struct passwd bpw; char buf[1024]; getpwuid_r(getuid(), &bpw, buf, sizeof(buf)); return 0; } ],ac_cv_func_which_getpwuid_r=four, [AC_TRY_RUN([ #include #include int main() { struct passwd *pw, bpw; char buf[1024]; getpwuid_r(getuid(), &bpw, buf, sizeof(buf), &pw); return 0; } ],ac_cv_func_which_getpwuid_r=five, ac_cv_func_which_getpwuid_r=no)], [# cross compile case ac_cv_func_which_getpwuid_r=no num_params=four for params in "int" "size_t, struct passwd **"; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include extern int getpwuid_r(uid_t, struct passwd *, char *, $params); ],[])],[ if test $ac_cv_func_which_getpwuid_r != no; then AC_ERROR([Two types of getpwuid_r detected]) fi ac_cv_func_which_getpwuid_r=$num_params ]) num_params=five done ] )] )]) if test $ac_cv_func_which_getpwuid_r = four_pw; then AC_DEFINE(HAVE_FUNC_GETPWUID_R_4, 1, [Define to 1 if your system provides the 4-parameter version of getpwuid_r().]) AC_DEFINE(HAVE_FUNC_GETPWUID_R_4_PW, 1, [Define to 1 if your system getpwuid_r() have 4 parameters and return struct passwd*.]) elif test $ac_cv_func_which_getpwuid_r = four; then AC_DEFINE(HAVE_FUNC_GETPWUID_R_4, 1, [Define to 1 if your system provides the 4-parameter version of getpwuid_r().]) elif test $ac_cv_func_which_getpwuid_r = five; then AC_DEFINE(HAVE_FUNC_GETPWUID_R_5, 1, [Define to 1 if your system provides the 5-parameter version of getpwuid_r().]) fi fi ]) freetds-1.3.6/m4/ac_tds_func_which_localtime_r.m4000644 025423 025423 00000001262 14056414221 023371 0ustar00fredianofrediano000000 000000 dnl $Id: ac_tds_func_which_localtime_r.m4,v 1.3 2006-03-29 16:24:37 freddy77 Exp $ AC_DEFUN([AC_tds_FUNC_WHICH_LOCALTIME_R], [AC_CACHE_CHECK(for which type of localtime_r, ac_cv_func_which_localtime_r, [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ], [ struct tm mytm; time_t t; int y = localtime_r(&t, &mytm)->tm_year; ])],ac_cv_func_which_localtime_r=struct, ac_cv_func_which_localtime_r=int) ]) if test $ac_cv_func_which_localtime_r = struct; then AC_DEFINE(HAVE_FUNC_LOCALTIME_R_TM, 1, [Define to 1 if your localtime_r return a struct tm*.]) else AC_DEFINE(HAVE_FUNC_LOCALTIME_R_INT, 1, [Define to 1 if your localtime_r return a int.]) fi ]) freetds-1.3.6/m4/acx_pthread.m4000644 025423 025423 00000022665 14056414221 017661 0ustar00fredianofrediano000000 000000 dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl dnl @summary figure out how to build C programs using POSIX threads dnl dnl This macro figures out how to build C programs using POSIX threads. dnl It sets the PTHREAD_LIBS output variable to the threads library and dnl linker flags, and the PTHREAD_CFLAGS output variable to any special dnl C compiler flags that are needed. (The user can also force certain dnl compiler flags/libs to be tested by setting these environment dnl variables.) dnl dnl Also sets PTHREAD_CC to any special C compiler that is needed for dnl multi-threaded programs (defaults to the value of CC otherwise). dnl (This is necessary on AIX to use the special cc_r compiler alias.) dnl dnl NOTE: You are assumed to not only compile your program with these dnl flags, but also link it with them as well. e.g. you should link dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS dnl $LIBS dnl dnl If you are only building threads programs, you may wish to use dnl these variables in your default LIBS, CFLAGS, and CC: dnl dnl LIBS="$PTHREAD_LIBS $LIBS" dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" dnl CC="$PTHREAD_CC" dnl dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). dnl dnl ACTION-IF-FOUND is a list of shell commands to run if a threads dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the dnl default action will define HAVE_PTHREAD. dnl dnl Please let the authors know if this macro fails on any platform, or dnl if you have any other suggestions or comments. This macro was based dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. dnl We are also grateful for the helpful feedback of numerous users. dnl dnl @category InstalledPackages dnl @author Steven G. Johnson dnl @version 2006-05-29 dnl @license GPLWithACException AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; # The HP-UX compiler just warns about options it does not understand # but it needs -mt. *-hpux*) acx_pthread_flags="-mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_MSG_CHECKING([for joinable pthread attribute]) attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_TRY_LINK([#include ], [int attr=$attr; return attr;], [attr_name=$attr; break]) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD freetds-1.3.6/m4/ax_cflags_gcc_option.m4000644 025423 025423 00000015355 14056414221 021530 0ustar00fredianofrediano000000 000000 dnl $Id: ax_cflags_gcc_option.m4,v 1.3 2006-03-29 16:24:37 freddy77 Exp $ dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]]) dnl dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the dnl optionflag to CFLAGS if it is understood. You can override the dnl shellvar-default of CFLAGS of course. The order of arguments stems dnl from the explicit macros like AX_CFLAGS_WARN_ALL. dnl dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C dnl (since it is possible to use different compilers for C and C++). dnl dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options. dnl However, if you use this macro in a few places, it would be great dnl if you would make up a new function-macro and submit it to the dnl ac-archive. dnl dnl - $1 option-to-check-for : required ("-option" as non-value) dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case) dnl - $3 action-if-found : add value to shellvariable dnl - $4 action-if-not-found : nothing dnl dnl note: in earlier versions, $1-$2 were swapped. We try to detect the dnl situation and accept a $2=~/-/ as being the old dnl option-to-check-for. dnl dnl also: there are other variants that emerged from the original macro dnl variant which did just test an option to be possibly added. dnl However, some compilers accept an option silently, or possibly for dnl just another option that was not intended. Therefore, we have to do dnl a generic test for a compiler family. For gcc we check "-pedantic" dnl being accepted which is also understood by compilers who just want dnl to be compatible with gcc even when not being made from gcc dnl sources. dnl dnl see also: dnl dnl AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION dnl AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION dnl dnl @category C dnl @author Guido Draheim dnl @version 2003-11-04 dnl @license GPLWithACException AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], VAR,[VAR="no, unknown" AC_LANG_SAVE AC_LANG_C ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return 0;]), [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_RESTORE ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl the only difference - the LANG selection... and the default FLAGS AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], VAR,[VAR="no, unknown" AC_LANG_SAVE AC_LANG_CXX ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return 0;]), [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_RESTORE ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl ------------------------------------------------------------------------- AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], VAR,[VAR="no, unknown" AC_LANG_SAVE AC_LANG_C ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])], [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_RESTORE ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) dnl the only difference - the LANG selection... and the default FLAGS AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], VAR,[VAR="no, unknown" AC_LANG_SAVE AC_LANG_CXX ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC # do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])], [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done FLAGS="$ac_save_[]FLAGS" AC_LANG_RESTORE ]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_ifvaln($4,$4) ;; *) m4_ifvaln($3,$3,[ if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" fi ]) ;; esac AS_VAR_POPDEF([VAR])dnl AS_VAR_POPDEF([FLAGS])dnl ]) AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, [AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])]) AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, [AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])]) freetds-1.3.6/m4/check_openssl.m4000644 025423 025423 00000003370 14056414221 020207 0ustar00fredianofrediano000000 000000 dnl $Id: check_openssl.m4,v 1.2 2006-03-27 07:22:54 jklowden Exp $ # OpenSSL check AC_DEFUN([CHECK_OPENSSL], [AC_MSG_CHECKING(if openssl is wanted) AC_ARG_WITH(openssl, AS_HELP_STRING([--with-openssl], [--with-openssl=DIR build with OpenSSL (license NOT compatible cf. User Guide)])) if test "$with_openssl" != "no"; then AC_MSG_RESULT(yes) old_NETWORK_LIBS="$NETWORK_LIBS" PKG_CHECK_MODULES(OPENSSL, [openssl], [found_ssl=yes CFLAGS="$CFLAGS $OPENSSL_CFLAGS" NETWORK_LIBS="$NETWORK_LIBS $OPENSSL_LIBS"], [found_ssl=no if test "$cross_compiling" != "yes"; then for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do ssldir="$dir" if test -f "$dir/include/openssl/ssl.h"; then echo "OpenSSL found in $ssldir" found_ssl="yes" CFLAGS="$CFLAGS -I$ssldir/include" NETWORK_LIBS="$NETWORK_LIBS -lssl -lcrypto" LDFLAGS="$LDFLAGS -L$ssldir/lib" break fi done fi]) if test x$found_ssl = xyes; then ACX_PUSH_LIBS("$NETWORK_LIBS") AC_TRY_LINK([#include ], [SSL_read(NULL, NULL, 100);], [], [found_ssl=no]) ACX_POP_LIBS fi if test x$found_ssl != xyes -a "$with_openssl" != ""; then AC_MSG_ERROR(Cannot find OpenSSL libraries) NETWORK_LIBS="$old_NETWORK_LIBS" elif test x$found_ssl = xyes; then HAVE_OPENSSL=yes ACX_PUSH_LIBS("$NETWORK_LIBS") AC_CHECK_FUNCS([BIO_get_data RSA_get0_key ASN1_STRING_get0_data]) ACX_POP_LIBS AC_DEFINE(HAVE_OPENSSL, 1, [Define if you have the OpenSSL.]) else NETWORK_LIBS="$old_NETWORK_LIBS" fi AC_SUBST(HAVE_OPENSSL) else AC_MSG_RESULT(no) fi ]) freetds-1.3.6/m4/gettimemilli.m4000644 025423 025423 00000004177 14056414221 020062 0ustar00fredianofrediano000000 000000 dnl $Id: gettimemilli.m4,v 1.1 2006-08-11 12:40:32 freddy77 Exp $ dnl this macros try to detect which is the better implementation dnl for a monotonic clock on different platforms dnl this is the results of some searching starting from dnl clock_gettime dnl dnl Linux and *BSD: clock_gettime(CLOCK_MONOTONIC) dnl IRIX: clock_gettime(CLOCK_SGI_CYCLE) dnl HU-UX: clock_gettime(CLOCK_REALTIME) dnl not monotonic but the better I found, same as gettimeofday dnl Solaris: gethrtime (returns a 64bit, very fine and easy) dnl Windows: GetTickCount dnl dnl I choose millisedonds precision cause this suite very well in dnl a unsigned int dnl check clock_gettime dnl some implemetations require -lrt or -lposix4 (Solaris) AC_DEFUN([TDS_CLOCK_GETTIME], [ AC_SEARCH_LIBS(clock_gettime, [rt posix4]) if test "$ac_cv_search_clock_gettime" != no; then AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have the clock_gettime function.]) fi ]) dnl check for constants for clock_gettime AC_DEFUN([TDS_CLOCK_GETTIME_CONST], [ AC_MSG_CHECKING(if clock_gettime support $1) AC_TRY_COMPILE([ #include #ifdef HAVE_SYS_TIME_H #include #endif ], [struct timespec ts; clock_gettime($1, &ts); ], tds_clock_gettime_const=yes, tds_clock_gettime_const=no) AC_MSG_RESULT($tds_clock_gettime_const) ]) dnl check all dnl if windows dnl use GetTickCount dnl else if gethrtime dnl use gethrtime dnl else if clock_gettime dnl check CLOCK_MONOTONIC dnl check CLOCK_SGI_CYCLE dnl check CLOCK_REALTIME dnl else if gettimeofday dnl use gettimeofday dnl end AC_DEFUN([TDS_GETTIMEMILLI], [ if test x$ac_cv_func_gethrtime = xno; then tds_save_LIBS="$LIBS" TDS_CLOCK_GETTIME if test "$ac_cv_search_clock_gettime" != no; then for tds_const in CLOCK_MONOTONIC CLOCK_SGI_CYCLE CLOCK_REALTIME; do TDS_CLOCK_GETTIME_CONST($tds_const) if test $tds_clock_gettime_const = yes; then AC_DEFINE_UNQUOTED(TDS_GETTIMEMILLI_CONST, [$tds_const], [define to constant to use for clock_gettime]) break fi done if test $tds_clock_gettime_const != yes; then LIBS="$tds_save_LIBS" fi fi fi ]) freetds-1.3.6/m4/libtool.m4000644 025423 025423 00001125073 14162303271 017041 0ustar00fredianofrediano000000 000000 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool 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 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool 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. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS freetds-1.3.6/m4/ltoptions.m4000644 025423 025423 00000034262 14162303271 017426 0ustar00fredianofrediano000000 000000 # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) freetds-1.3.6/m4/ltsugar.m4000644 025423 025423 00000010440 14162303271 017044 0ustar00fredianofrediano000000 000000 # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) freetds-1.3.6/m4/ltversion.m4000644 025423 025423 00000001273 14162303271 017414 0ustar00fredianofrediano000000 000000 # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) freetds-1.3.6/m4/lt~obsolete.m4000644 025423 025423 00000013774 14162303272 017753 0ustar00fredianofrediano000000 000000 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) freetds-1.3.6/m4/pushlibs.m4000644 025423 025423 00000000276 14056414221 017222 0ustar00fredianofrediano000000 000000 AC_DEFUN([ACX_PUSH_LIBS], [m4_pushdef([SAVELIBS],[LIBS_]__line__)dnl SAVELIBS="$LIBS" LIBS=[$1]]) AC_DEFUN([ACX_POP_LIBS], [LIBS="$SAVELIBS" unset SAVELIBS dnl m4_popdef([SAVELIBS])dnl ]) freetds-1.3.6/m4/sprintf_i64_format.m4000644 025423 025423 00000003442 14056414221 021106 0ustar00fredianofrediano000000 000000 dnl $Id: sprintf_i64_format.m4,v 1.11 2010-12-28 14:37:10 freddy77 Exp $ ## # Test for 64bit integer sprintf format specifier # ld 64 bit machine # lld long long format # I64d Windows format # Ld Watcom compiler format ## AC_DEFUN([SPRINTF_I64_FORMAT], [tds_i64_format= # Win32 case AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #if !defined(__MINGW32__) || !defined(__MSVCRT__) this should produce an error! #endif ],[return 0;])],[tds_i64_format="I64"]) # long is 64 bit if test "x$ac_cv_sizeof_long" = "x8"; then tds_i64_format=l fi # long long support if test "x$tds_i64_format" = "x"; then AC_LINK_IFELSE([AC_LANG_SOURCE([[ #include #if !defined(__GLIBC__) || __GLIBC__ < 2 || !defined(__GLIBC_MINOR__) || __GLIBC_MINOR__ < 2 # if !defined(__APPLE__) # error no proper glibc or darwin system # endif #endif int main() { char buf[64]; long long ll = atoll(buf); return 0; } ]])],[tds_i64_format="ll"]) fi # extract from inttypes.h if test "x$tds_i64_format" = "x"; then AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include #include char test_fmt[] = "Start PRId64:" PRId64 ":End PRId64"; ]], [[]])], [for arg in l ll I64 L; do if grep "Start PRId64:${arg}d:End PRId64" conftest.$ac_objext >/dev/null ; then tds_i64_format=$arg fi done]) fi if test "x$tds_i64_format" = "x"; then for arg in l ll I64 L; do AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include int main() { char buf[20]; $tds_sysdep_int64_type ll = ((($tds_sysdep_int64_type) 0x12345) << 32) + 0x6789abcd; sprintf(buf, "%${arg}d", ll); return strcmp(buf, "320255973501901") != 0; } ]])],[tds_i64_format="$arg"; break]) done fi if test "x$tds_i64_format" != "x"; then AC_DEFINE_UNQUOTED(TDS_I64_PREFIX, ["$tds_i64_format"], [define to prefix format string used for 64bit integers]) fi ]) freetds-1.3.6/m4/type_socklen_t.m4000644 025423 025423 00000002772 14056414221 020416 0ustar00fredianofrediano000000 000000 dnl $Id: type_socklen_t.m4,v 1.3 2006-03-29 16:24:37 freddy77 Exp $ ## # This macro came from internet, appear in lftp, rsync and others. ## AC_DEFUN([TYPE_SOCKLEN_T], [ AC_CHECK_TYPE([socklen_t], ,[ AC_MSG_CHECKING([for socklen_t equivalent]) AC_CACHE_VAL([xml_cv_socklen_t_equiv], [ # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername xml_cv_socklen_t_equiv= for arg2 in "struct sockaddr" void; do for t in int size_t unsigned long "unsigned long"; do AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_WINSOCK2_H # include # include int PASCAL getpeername (SOCKET, $arg2 *, $t *); #elif defined(HAVE_SYS_SOCKET_H) # include int getpeername (int, $arg2 *, $t *); #endif ],[ $t len; getpeername(0,0,&len); ])],[ xml_cv_socklen_t_equiv="$t" break ]) done done if test "x$xml_cv_socklen_t_equiv" = x; then AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) fi ]) AC_MSG_RESULT($xml_cv_socklen_t_equiv) AC_DEFINE_UNQUOTED(socklen_t, $xml_cv_socklen_t_equiv, [type to use in place of socklen_t if not defined])], [#include #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_WINSOCK2_H # include # include #endif]) ])